bus/msx/slot/disk.cpp: Small improvement to Turbo-R disk interface. (#12221)

* Add register mirrors.
* Add read back of rom bank.
* Add stubs for reading media change and some unknown registers.
* Connect disk change signal.
This commit is contained in:
wilbertpol 2024-04-07 21:44:55 +01:00 committed by GitHub
parent 3a7868fd30
commit 8c0dea9bb3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 51 additions and 2 deletions

View File

@ -598,13 +598,27 @@ void msx_slot_disk4_tc8566_device::device_start()
m_rombank->set_entry(0);
page(1)->install_read_bank(0x4000, 0x7fff, m_rombank);
page(1)->install_read_handler(0x7ff0, 0x7ff0, emu::rw_delegate(*this, FUNC(msx_slot_disk4_tc8566_device::bank_r)));
page(1)->install_write_handler(0x7ff0, 0x7ff0, emu::rw_delegate(*this, FUNC(msx_slot_disk4_tc8566_device::bank_w)));
// 0x7ff1 media change register
page(1)->install_read_handler(0x7ff1, 0x7ff1, emu::rw_delegate(*this, FUNC(msx_slot_disk4_tc8566_device::media_change_r)));
page(1)->install_write_handler(0x7ff2, 0x7ff2, emu::rw_delegate(*this, FUNC(msx_slot_disk4_tc8566_device::dor_w)));
page(1)->install_write_handler(0x7ff3, 0x7ff3, emu::rw_delegate(*m_fdc, FUNC(tc8566af_device::cr1_w)));
page(1)->install_read_handler(0x7ff4, 0x7ff4, emu::rw_delegate(*m_fdc, FUNC(tc8566af_device::msr_r)));
page(1)->install_read_handler(0x7ff5, 0x7ff5, emu::rw_delegate(*m_fdc, FUNC(tc8566af_device::fifo_r)));
page(1)->install_write_handler(0x7ff5, 0x7ff5, emu::rw_delegate(*m_fdc, FUNC(tc8566af_device::fifo_w)));
page(1)->install_read_handler(0x7ffc, 0x7ffc, emu::rw_delegate(*this, FUNC(msx_slot_disk4_tc8566_device::unk_7ffc_r)));
page(1)->install_read_handler(0x7ffd, 0x7ffd, emu::rw_delegate(*this, FUNC(msx_slot_disk4_tc8566_device::unk_7ffd_r)));
page(1)->install_read_handler(0x7fff, 0x7fff, emu::rw_delegate(*this, FUNC(msx_slot_disk4_tc8566_device::unk_7fff_r)));
// TODO: Investigate on real unit
// Some or all register reads are mirrored? Register writes also?
// At least msr_r must be mirrored otherwise Microcabin software will not boot (on FS-A1ST).
page(2)->install_read_handler(0xbff0, 0xbff0, emu::rw_delegate(*this, FUNC(msx_slot_disk4_tc8566_device::bank_r)));
page(2)->install_read_handler(0xbff1, 0xbff1, emu::rw_delegate(*this, FUNC(msx_slot_disk4_tc8566_device::media_change_r)));
page(2)->install_read_handler(0xbff4, 0xbff4, emu::rw_delegate(*m_fdc, FUNC(tc8566af_device::msr_r)));
page(2)->install_read_handler(0xbff5, 0xbff5, emu::rw_delegate(*m_fdc, FUNC(tc8566af_device::fifo_r)));
page(2)->install_read_handler(0xbffc, 0xbffc, emu::rw_delegate(*this, FUNC(msx_slot_disk4_tc8566_device::unk_7ffc_r)));
page(2)->install_read_handler(0xbffd, 0xbffd, emu::rw_delegate(*this, FUNC(msx_slot_disk4_tc8566_device::unk_7ffd_r)));
page(2)->install_read_handler(0xbfff, 0xbfff, emu::rw_delegate(*this, FUNC(msx_slot_disk4_tc8566_device::unk_7fff_r)));
}
void msx_slot_disk4_tc8566_device::device_add_mconfig(machine_config &config)
@ -612,11 +626,41 @@ void msx_slot_disk4_tc8566_device::device_add_mconfig(machine_config &config)
add_mconfig(config);
}
u8 msx_slot_disk4_tc8566_device::bank_r()
{
return m_rombank->entry();
}
void msx_slot_disk4_tc8566_device::bank_w(u8 data)
{
m_rombank->set_entry(data & 0x03);
}
u8 msx_slot_disk4_tc8566_device::media_change_r()
{
return (m_floppy[0] && m_floppy[0]->get_device()->dskchg_r() ? 0x10 : 0x00) |
(m_floppy[1] && m_floppy[1]->get_device()->dskchg_r() ? 0x20 : 0x00) |
0x03
;
}
u8 msx_slot_disk4_tc8566_device::unk_7ffc_r()
{
// Unknown
return 0xfc;
}
u8 msx_slot_disk4_tc8566_device::unk_7ffd_r()
{
// Unknown
return 0xfc;
}
u8 msx_slot_disk4_tc8566_device::unk_7fff_r()
{
// Unknown
return 0x3f;
}

View File

@ -315,7 +315,12 @@ protected:
virtual void device_start() override;
private:
void bank_w(u8 control);
u8 bank_r();
void bank_w(u8 bank);
u8 media_change_r();
u8 unk_7ffc_r();
u8 unk_7ffd_r();
u8 unk_7fff_r();
memory_bank_creator m_rombank;
};