Skip to content

Commit

Permalink
CGB Boot ROM
Browse files Browse the repository at this point in the history
  • Loading branch information
IsaacMarovitz committed Feb 2, 2024
1 parent 344403c commit f38b2b6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
10 changes: 7 additions & 3 deletions src/components/cpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::config::Config;
use crate::components::prelude::*;

pub struct CPU {
reg: Registers,
pub reg: Registers,
pub mem: MMU,
halted: bool,
// Enabled Interrupts
Expand All @@ -28,8 +28,12 @@ impl CPU {
boot.read_to_end(&mut boot_rom)
.expect("Failed to read Boot ROM!");

// Display Nintendo Logo
rom[0..=0x00FF].copy_from_slice(boot_rom.as_slice());
// Copy Boot ROM
if config.mode == GBMode::DMG {
rom[0..=0x00FF].copy_from_slice(boot_rom.as_slice());
} else if config.mode == GBMode::CGB {
rom[0..=0x08FF].copy_from_slice(boot_rom.as_slice());
}

true
}
Expand Down
6 changes: 3 additions & 3 deletions src/components/ppu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -420,9 +420,9 @@ impl PPU {

fn draw_sprites(&mut self) {
let sprite_size = if self.lcdc.contains(LCDC::OBJ_SIZE) { 16 } else { 8 };
let mut object_count = 0;
let mut previous_px = 0;
let mut previous_address = 0;
let mut object_count: u8 = 0;
let mut previous_px: u8 = 0;
let mut previous_address: u16 = 0;

for i in 0..40 {
let sprite_address = 0xFE00 + (i as u16) * 4;
Expand Down

0 comments on commit f38b2b6

Please sign in to comment.