chore: document IO registers
This commit is contained in:
18
src/bus.rs
18
src/bus.rs
@@ -225,13 +225,13 @@ impl BusIo for Bus {
|
||||
// Every address here starts with 0xFF so we can just check the
|
||||
// low byte to figure out which register it is
|
||||
match addr & 0x00FF {
|
||||
0x00 => self.joypad.status,
|
||||
0x00 => self.joypad.p1,
|
||||
0x01 => self.serial.next,
|
||||
0x02 => self.serial.control.into(),
|
||||
0x02 => self.serial.ctrl.into(),
|
||||
0x04 => (self.timer.divider >> 8) as u8,
|
||||
0x05 => self.timer.counter,
|
||||
0x06 => self.timer.modulo,
|
||||
0x07 => self.timer.control.into(),
|
||||
0x07 => self.timer.ctrl.into(),
|
||||
0x0F => self.interrupt_flag().into(),
|
||||
0x11 => self.sound.ch1.sound_duty.into(),
|
||||
0x12 => self.sound.ch1.vol_envelope.into(),
|
||||
@@ -239,13 +239,13 @@ impl BusIo for Bus {
|
||||
0x24 => self.sound.control.channel.into(),
|
||||
0x25 => self.sound.control.output.into(),
|
||||
0x26 => self.sound.control.status.into(),
|
||||
0x40 => self.ppu.control.into(),
|
||||
0x40 => self.ppu.ctrl.into(),
|
||||
0x41 => self.ppu.stat.into(),
|
||||
0x42 => self.ppu.pos.scroll_y,
|
||||
0x43 => self.ppu.pos.scroll_x,
|
||||
0x44 => self.ppu.pos.line_y,
|
||||
0x45 => self.ppu.pos.ly_compare as u8,
|
||||
0x46 => self.ppu.dma.ctrl.repr,
|
||||
0x46 => self.ppu.dma.start.into(),
|
||||
0x47 => self.ppu.monochrome.bg_palette.into(),
|
||||
0x48 => self.ppu.monochrome.obj_palette_0.into(),
|
||||
0x49 => self.ppu.monochrome.obj_palette_1.into(),
|
||||
@@ -336,11 +336,11 @@ impl BusIo for Bus {
|
||||
match addr & 0x00FF {
|
||||
0x00 => self.joypad.update(byte),
|
||||
0x01 => self.serial.next = byte,
|
||||
0x02 => self.serial.control = byte.into(),
|
||||
0x02 => self.serial.ctrl = byte.into(),
|
||||
0x04 => self.timer.divider = 0x0000,
|
||||
0x05 => self.timer.counter = byte,
|
||||
0x06 => self.timer.modulo = byte,
|
||||
0x07 => self.timer.control = byte.into(),
|
||||
0x07 => self.timer.ctrl = byte.into(),
|
||||
0x0F => self.set_interrupt_flag(byte),
|
||||
0x11 => self.sound.ch1.sound_duty = byte.into(),
|
||||
0x12 => self.sound.ch1.vol_envelope = byte.into(),
|
||||
@@ -349,7 +349,7 @@ impl BusIo for Bus {
|
||||
0x24 => self.sound.control.channel = byte.into(),
|
||||
0x25 => self.sound.control.output = byte.into(),
|
||||
0x26 => self.sound.control.status = byte.into(), // FIXME: Should we control which bytes are written to here?
|
||||
0x40 => self.ppu.control = byte.into(),
|
||||
0x40 => self.ppu.ctrl = byte.into(),
|
||||
0x41 => self.ppu.stat.update(byte),
|
||||
0x42 => self.ppu.pos.scroll_y = byte,
|
||||
0x43 => self.ppu.pos.scroll_x = byte,
|
||||
@@ -367,7 +367,7 @@ impl BusIo for Bus {
|
||||
self.ppu.int.set_lcd_stat(true);
|
||||
}
|
||||
}
|
||||
0x46 => self.ppu.dma.ctrl.update(byte, &mut self.ppu.dma.state),
|
||||
0x46 => self.ppu.dma.start.update(byte, &mut self.ppu.dma.state),
|
||||
0x47 => self.ppu.monochrome.bg_palette = byte.into(),
|
||||
0x48 => self.ppu.monochrome.obj_palette_0 = byte.into(),
|
||||
0x49 => self.ppu.monochrome.obj_palette_1 = byte.into(),
|
||||
|
Reference in New Issue
Block a user