Skip to content

Commit

Permalink
Implemented LCDC.0
Browse files Browse the repository at this point in the history
  • Loading branch information
velllu committed Apr 1, 2024
1 parent d29aa3f commit 7bb78b9
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/gpu/states.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use crate::{

use super::{
sprite_parser::{SpriteData, SpriteHeight},
tile_parser::Line,
Color,
};

Expand Down Expand Up @@ -98,10 +99,13 @@ impl GameBoy {
}

// And we get the background fifo and the sprite fifo
let background_fifo = self.get_line_from_coordinates(
self.gpu.x.wrapping_add(self.bus[SCX]),
self.gpu.y.wrapping_add(self.bus[SCY]),
);
let background_fifo = match self.bus[LCDC].get_bit(0) {
false => Line::new_blank(), // When LCDC.0 is 0, the background tile is white
true => self.get_line_from_coordinates(
self.gpu.x.wrapping_add(self.bus[SCX]),
self.gpu.y.wrapping_add(self.bus[SCY]),
),
};

let mut sprite = self.get_sprite_fifo(self.gpu.x, self.gpu.y, &sprite_height);

Expand Down

0 comments on commit 7bb78b9

Please sign in to comment.