Skip to content

Commit

Permalink
Speed up VGA text mode (#516)
Browse files Browse the repository at this point in the history
* Refactor Writer#new_line

* Refactor Writer#clear_row_after

* Update changelog
  • Loading branch information
vinc authored Jul 21, 2023
1 parent 9d2f832 commit 48dc105
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog

## Unreleased
- Speed up VGA text mode ([#516](https://github.com/vinc/moros/pull/516))
- Add PageUp and PageDown keys support ([#515](https://github.com/vinc/moros/pull/515))
- Bump pbkdf2 from 0.12.1 to 0.12.2 ([#513](https://github.com/vinc/moros/pull/513))
- Bump uart_16550 from 0.2.18 to 0.2.19 ([#514](https://github.com/vinc/moros/pull/514))
Expand Down
13 changes: 2 additions & 11 deletions src/sys/vga.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,7 @@ impl Writer {
self.writer[1] += 1;
} else {
for y in 1..BUFFER_HEIGHT {
for x in 0..BUFFER_WIDTH {
unsafe {
let c = core::ptr::read_volatile(&self.buffer.chars[y][x]);
core::ptr::write_volatile(&mut self.buffer.chars[y - 1][x], c);
}
}
self.buffer.chars[y - 1] = self.buffer.chars[y];
}
self.clear_row_after(0, BUFFER_HEIGHT - 1);
}
Expand All @@ -196,11 +191,7 @@ impl Writer {
ascii_code: b' ',
color_code: self.color_code,
};
for i in x..BUFFER_WIDTH {
unsafe {
core::ptr::write_volatile(&mut self.buffer.chars[y][i], c);
}
}
self.buffer.chars[y][x..BUFFER_WIDTH].fill(c);
}

fn clear_screen(&mut self) {
Expand Down

0 comments on commit 48dc105

Please sign in to comment.