Skip to content
Snippets Groups Projects
Verified Commit e6b9eb04 authored by João Magalhães's avatar João Magalhães :rocket:
Browse files

fix: issues related with height

parent d233d07e
No related branches found
No related tags found
No related merge requests found
...@@ -112,6 +112,7 @@ fn main() { ...@@ -112,6 +112,7 @@ fn main() {
// information presented to the user // information presented to the user
canvas.present(); canvas.present();
// @todo this must be improved with proper timestamps
graphics.timer_subsystem.delay(17); graphics.timer_subsystem.delay(17);
} }
} }
...@@ -11,7 +11,7 @@ pub const TILE_COUNT: usize = 384; ...@@ -11,7 +11,7 @@ pub const TILE_COUNT: usize = 384;
pub const DISPLAY_WIDTH: usize = 160; pub const DISPLAY_WIDTH: usize = 160;
/// The height of the Game Boy screen in pixels. /// The height of the Game Boy screen in pixels.
pub const DISPLAY_HEIGHT: usize = 154; pub const DISPLAY_HEIGHT: usize = 144;
// The size of the RGB frame buffer in bytes. // The size of the RGB frame buffer in bytes.
pub const FRAME_BUFFER_SIZE: usize = DISPLAY_WIDTH * DISPLAY_HEIGHT * RGB_SIZE; pub const FRAME_BUFFER_SIZE: usize = DISPLAY_WIDTH * DISPLAY_HEIGHT * RGB_SIZE;
...@@ -124,7 +124,7 @@ impl Ppu { ...@@ -124,7 +124,7 @@ impl Ppu {
// in case we've reached the end of the // in case we've reached the end of the
// screen we're now entering the v-blank // screen we're now entering the v-blank
if self.line == 143 { if self.line == 144 {
self.mode = PpuMode::VBlank; self.mode = PpuMode::VBlank;
// self.drawData // self.drawData
// @todo implement this one // @todo implement this one
...@@ -142,7 +142,7 @@ impl Ppu { ...@@ -142,7 +142,7 @@ impl Ppu {
// in case the end of v-blank has been reached then // in case the end of v-blank has been reached then
// we must jump again to the OAM read mode and reset // we must jump again to the OAM read mode and reset
// the scan line counter to the zero value // the scan line counter to the zero value
if self.line == 153 { if self.line == 154 {
self.mode = PpuMode::OamRead; self.mode = PpuMode::OamRead;
self.line = 0; self.line = 0;
} }
...@@ -246,6 +246,7 @@ impl Ppu { ...@@ -246,6 +246,7 @@ impl Ppu {
// Game Boy screen width and RGB pixel (3 bytes) size // Game Boy screen width and RGB pixel (3 bytes) size
let mut frame_offset = self.line as usize * DISPLAY_WIDTH * RGB_SIZE; let mut frame_offset = self.line as usize * DISPLAY_WIDTH * RGB_SIZE;
for _index in 0..DISPLAY_WIDTH { for _index in 0..DISPLAY_WIDTH {
// obtains the current pixel data from the tile and // obtains the current pixel data from the tile and
// re-maps it according to the current palette // re-maps it according to the current palette
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment