mirror of
https://github.com/italicsjenga/gba.git
synced 2025-02-04 13:46:40 +11:00
make mode3 clear a little speedier
This commit is contained in:
parent
c05eae7f13
commit
62abc3cbd2
1 changed files with 4 additions and 5 deletions
|
@ -69,13 +69,12 @@ pub fn mode3_read_pixel(col: isize, row: isize) -> Option<u16> {
|
||||||
|
|
||||||
/// Clears the entire screen to the color specified.
|
/// Clears the entire screen to the color specified.
|
||||||
pub unsafe fn mode3_clear_screen(color: u16) {
|
pub unsafe fn mode3_clear_screen(color: u16) {
|
||||||
|
// TODO: use DMA?
|
||||||
let color = color as u32;
|
let color = color as u32;
|
||||||
let bulk_color = color << 16 | color;
|
let bulk_color = color << 16 | color;
|
||||||
let mut ptr = VolatilePtr(VRAM_BASE_ADDRESS as *mut u32);
|
let mut ptr = VolatilePtr(VRAM_BASE_ADDRESS as *mut u32);
|
||||||
for _ in 0..SCREEN_HEIGHT {
|
for _ in 0..(SCREEN_HEIGHT * SCREEN_WIDTH / 2) {
|
||||||
for _ in 0..(SCREEN_WIDTH / 2) {
|
|
||||||
ptr.write(bulk_color);
|
ptr.write(bulk_color);
|
||||||
ptr = ptr.offset(1);
|
ptr = ptr.offset(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue