diff --git a/src/core/iodev.rs b/src/core/iodev.rs index 35c55ae..41dae65 100644 --- a/src/core/iodev.rs +++ b/src/core/iodev.rs @@ -26,6 +26,7 @@ pub struct IoDevices { pub post_boot_flag: bool, pub waitcnt: WaitControl, // TODO also implement 4000800 pub haltcnt: HaltState, + pub sound_bias: u16, mem: BoxedMemory, } @@ -42,6 +43,7 @@ impl IoDevices { haltcnt: HaltState::Running, keyinput: keypad::KEYINPUT_ALL_RELEASED, waitcnt: WaitControl(0), + sound_bias: 0x200, } } } @@ -96,6 +98,8 @@ impl Bus for IoDevices { REG_DMA2CNT_H => io.dmac.channels[2].ctrl.0, REG_DMA3CNT_H => io.dmac.channels[3].ctrl.0, + REG_SOUNDBIAS => io.sound_bias, + REG_WAITCNT => io.waitcnt.0, REG_POSTFLG => io.post_boot_flag as u16, @@ -234,6 +238,8 @@ impl Bus for IoDevices { io.dmac.write_16(channel_id, ofs % 12, value) } + REG_SOUNDBIAS => io.sound_bias = value & 0xc3fe, + REG_WAITCNT => io.waitcnt.0 = value, REG_POSTFLG => io.post_boot_flag = value != 0,