Skip to content

Commit

Permalink
Add more logging
Browse files Browse the repository at this point in the history
  • Loading branch information
caklimas committed Jan 1, 2024
1 parent 7fafe5b commit 95de4b2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
8 changes: 3 additions & 5 deletions src/cpu/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,7 @@ impl Cpu {
return;
}

self.program_counter = PROGRAM_START;
self.stack_pointer = 0xFFFE;

// https://gbdev.io/pandocs/Power_Up_Sequence.html#cpu-registers
match &self.mmu.cartridge.header.cgb_mode {
CgbMode::CgbMonochrome => {
self.registers.set_target_16(&CpuRegister16::AF, 0x1180);
Expand All @@ -308,7 +306,7 @@ impl Cpu {
}
}

// https://gbdev.io/pandocs/CGB_Registers.html#detecting-cgb-and-gba-functions
info!("A after startup: {}", self.registers.a);
self.program_counter = PROGRAM_START;
self.stack_pointer = 0xFFFE;
}
}
10 changes: 8 additions & 2 deletions src/gpu/lcd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,10 @@ impl Lcd {
SPRITE_ATTRIBUTE_TABLE_LOWER..=SPRITE_ATTRIBUTE_TABLE_UPPER => {
self.video_oam.read(address)
}
LCD_BCPS_BGPI => self.bg_color_palette_spec.0,
LCD_BCPS_BGPI => {
info!("Read from LCD_BCPS_BGPI");
self.bg_color_palette_spec.0
}
LCD_BCPD_BGPD => {
info!("Read from LCD_BCPD_BGPD");
0
Expand Down Expand Up @@ -176,7 +179,10 @@ impl Lcd {
SPRITE_ATTRIBUTE_TABLE_LOWER..=SPRITE_ATTRIBUTE_TABLE_UPPER => {
self.video_oam.write(address, data)
}
LCD_BCPS_BGPI => self.bg_color_palette_spec.set(data),
LCD_BCPS_BGPI => {
info!("Writing to LCD_BCPS_BGPI");
self.bg_color_palette_spec.set(data)
}
LCD_BCPD_BGPD => {
info!("Writing to LCD_BCPD_BGPD")
}
Expand Down

0 comments on commit 95de4b2

Please sign in to comment.