diff options
Diffstat (limited to 'src/devices/bus/msx_slot/disk.cpp')
-rw-r--r-- | src/devices/bus/msx_slot/disk.cpp | 75 |
1 files changed, 42 insertions, 33 deletions
diff --git a/src/devices/bus/msx_slot/disk.cpp b/src/devices/bus/msx_slot/disk.cpp index 309b7f2d80f..39ec248e3f2 100644 --- a/src/devices/bus/msx_slot/disk.cpp +++ b/src/devices/bus/msx_slot/disk.cpp @@ -137,6 +137,8 @@ void msx_slot_disk1_device::device_start() save_item(NAME(m_side_control)); save_item(NAME(m_control)); + + machine().save().register_postload(save_prepost_delegate(FUNC(msx_slot_disk1_device::post_load), this)); } @@ -146,7 +148,7 @@ void msx_slot_disk1_device::device_reset() } -void msx_slot_disk1_device::device_post_load() +void msx_slot_disk1_device::post_load() { uint8_t data = m_control; @@ -205,7 +207,7 @@ void msx_slot_disk1_device::set_control(uint8_t data) } -uint8_t msx_slot_disk1_device::read(offs_t offset) +READ8_MEMBER(msx_slot_disk1_device::read) { switch (offset) { @@ -238,11 +240,11 @@ uint8_t msx_slot_disk1_device::read(offs_t offset) return 0x3f | (m_fdc->intrq_r() ? 0 : 0x40) | (m_fdc->drq_r() ? 0 : 0x80); } - return msx_slot_rom_device::read(offset); + return msx_slot_rom_device::read(space, offset); } -void msx_slot_disk1_device::write(offs_t offset, uint8_t data) +WRITE8_MEMBER(msx_slot_disk1_device::write) { switch (offset) { @@ -296,6 +298,8 @@ void msx_slot_disk2_device::device_start() msx_slot_wd_disk_device::device_start(); save_item(NAME(m_control)); + + machine().save().register_postload(save_prepost_delegate(FUNC(msx_slot_disk2_device::post_load), this)); } @@ -305,7 +309,7 @@ void msx_slot_disk2_device::device_reset() } -void msx_slot_disk2_device::device_post_load() +void msx_slot_disk2_device::post_load() { uint8_t data = m_control; @@ -352,7 +356,7 @@ void msx_slot_disk2_device::set_control(uint8_t data) } -uint8_t msx_slot_disk2_device::read(offs_t offset) +READ8_MEMBER(msx_slot_disk2_device::read) { switch (offset) { @@ -377,11 +381,11 @@ uint8_t msx_slot_disk2_device::read(offs_t offset) return 0x3f | (m_fdc->drq_r() ? 0 : 0x40) | (m_fdc->intrq_r() ? 0x80 : 0); } - return msx_slot_rom_device::read(offset); + return msx_slot_rom_device::read(space, offset); } -void msx_slot_disk2_device::write(offs_t offset, uint8_t data) +WRITE8_MEMBER(msx_slot_disk2_device::write) { switch (offset) { @@ -427,20 +431,20 @@ msx_slot_disk3_device::msx_slot_disk3_device(const machine_config &mconfig, cons } -void msx_slot_disk3_device::write(offs_t offset, uint8_t data) +WRITE8_MEMBER(msx_slot_disk3_device::write) { switch (offset) { case 0x7ff8: // CR0 : 0 - 0 - MEN1 - MEN0 - 0 - -FRST - 0 - DSA - m_fdc->dor_w(data); + m_fdc->dor_w(space, 2, data); break; case 0x7ff9: // CR1 : 0 - 0 - C4E - C4 - SBME - SBM - TCE - FDCTC - m_fdc->cr1_w(data); + m_fdc->cr1_w(space, 3, data); break; case 0x7ffb: // Data Register - m_fdc->fifo_w(data); + m_fdc->fifo_w(space, 5, data); break; default: @@ -450,17 +454,17 @@ void msx_slot_disk3_device::write(offs_t offset, uint8_t data) } -uint8_t msx_slot_disk3_device::read(offs_t offset) +READ8_MEMBER(msx_slot_disk3_device::read) { switch (offset) { case 0x7ffa: // Status Register - return m_fdc->msr_r(); + return m_fdc->msr_r(space, 4); case 0x7ffb: // Data Register - return m_fdc->fifo_r(); + return m_fdc->fifo_r(space, 5); } - return msx_slot_rom_device::read(offset); + return msx_slot_rom_device::read(space, offset); } @@ -473,7 +477,7 @@ msx_slot_disk4_device::msx_slot_disk4_device(const machine_config &mconfig, cons } -void msx_slot_disk4_device::write(offs_t offset, uint8_t data) +WRITE8_MEMBER(msx_slot_disk4_device::write) { switch (offset) { @@ -481,15 +485,15 @@ void msx_slot_disk4_device::write(offs_t offset, uint8_t data) break; case 0x7ff2: // CR0 : 0 - 0 - MEN1 - MEN0 - 0 - -FRST - 0 - DSA - m_fdc->dor_w(data); + m_fdc->dor_w(space, 2, data); break; case 0x7ff3: // CR1 : 0 - 0 - C4E - C4 - SBME - SBM - TCE - FDCTC - m_fdc->cr1_w(data); + m_fdc->cr1_w(space, 3, data); break; case 0x7ff5: // Data Register - m_fdc->fifo_w(data); + m_fdc->fifo_w(space, 5, data); break; default: @@ -499,7 +503,7 @@ void msx_slot_disk4_device::write(offs_t offset, uint8_t data) } -uint8_t msx_slot_disk4_device::read(offs_t offset) +READ8_MEMBER(msx_slot_disk4_device::read) { switch (offset) { @@ -508,12 +512,12 @@ uint8_t msx_slot_disk4_device::read(offs_t offset) break; case 0x7ff4: // Status Register - return m_fdc->msr_r(); + return m_fdc->msr_r(space, 4); case 0x7ff5: // Data Register - return m_fdc->fifo_r(); + return m_fdc->fifo_r(space, 5); } - return msx_slot_rom_device::read(offset); + return msx_slot_rom_device::read(space, offset); } @@ -532,9 +536,12 @@ void msx_slot_disk5_device::device_start() save_item(NAME(m_control)); + machine().save().register_postload(save_prepost_delegate(FUNC(msx_slot_disk5_device::post_load), this)); + // Install IO read/write handlers - io_space().install_write_handler(0xd0, 0xd4, write8sm_delegate(FUNC(msx_slot_disk5_device::io_write), this)); - io_space().install_read_handler(0xd0, 0xd4, read8sm_delegate(FUNC(msx_slot_disk5_device::io_read), this)); + address_space &space = machine().device<cpu_device>("maincpu")->space(AS_IO); + space.install_write_handler(0xd0, 0xd4, write8_delegate(FUNC(msx_slot_disk5_device::io_write), this)); + space.install_read_handler(0xd0, 0xd4, read8_delegate(FUNC(msx_slot_disk5_device::io_read), this)); } @@ -544,7 +551,7 @@ void msx_slot_disk5_device::device_reset() } -void msx_slot_disk5_device::device_post_load() +void msx_slot_disk5_device::post_load() { set_control(m_control); } @@ -587,7 +594,7 @@ void msx_slot_disk5_device::set_control(uint8_t control) } -uint8_t msx_slot_disk5_device::io_read(offs_t offset) +READ8_MEMBER(msx_slot_disk5_device::io_read) { switch (offset) { @@ -611,7 +618,7 @@ uint8_t msx_slot_disk5_device::io_read(offs_t offset) } -void msx_slot_disk5_device::io_write(offs_t offset, uint8_t data) +WRITE8_MEMBER(msx_slot_disk5_device::io_write) { switch (offset) { @@ -655,6 +662,8 @@ void msx_slot_disk6_device::device_start() save_item(NAME(m_side_motor)); save_item(NAME(m_drive_select0)); save_item(NAME(m_drive_select1)); + + machine().save().register_postload(save_prepost_delegate(FUNC(msx_slot_disk6_device::post_load), this)); } @@ -664,7 +673,7 @@ void msx_slot_disk6_device::device_reset() } -void msx_slot_disk6_device::device_post_load() +void msx_slot_disk6_device::post_load() { select_drive(); } @@ -706,7 +715,7 @@ void msx_slot_disk6_device::set_side_motor() } -uint8_t msx_slot_disk6_device::read(offs_t offset) +READ8_MEMBER(msx_slot_disk6_device::read) { switch (offset) { @@ -748,11 +757,11 @@ uint8_t msx_slot_disk6_device::read(offs_t offset) return 0x3f | (m_fdc->intrq_r() ? 0 : 0x40) | (m_fdc->drq_r() ? 0 : 0x80); } - return msx_slot_rom_device::read(offset); + return msx_slot_rom_device::read(space, offset); } -void msx_slot_disk6_device::write(offs_t offset, uint8_t data) +WRITE8_MEMBER(msx_slot_disk6_device::write) { switch (offset) { |