summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Robbbert <Robbbert@users.noreply.github.com>2021-05-19 03:43:30 +1000
committer Robbbert <Robbbert@users.noreply.github.com>2021-05-19 03:43:30 +1000
commitdb98a0b858eb7cd81aa9cdc9b5c8ad7647b0385f (patch)
tree0a33d38c424e9396f93eaa4abdd93426b601b4eb
parentab1a5b7d7904845772eb0b53a6f2b64ce34b636a (diff)
bml3mp1805: fixed the crashing, but it seems to have trouble reading the disk.
-rw-r--r--src/devices/bus/bml3/bml3mp1805.cpp58
1 files changed, 38 insertions, 20 deletions
diff --git a/src/devices/bus/bml3/bml3mp1805.cpp b/src/devices/bus/bml3/bml3mp1805.cpp
index a08c8312cfc..9d7e0823388 100644
--- a/src/devices/bus/bml3/bml3mp1805.cpp
+++ b/src/devices/bus/bml3/bml3mp1805.cpp
@@ -6,7 +6,7 @@
Hitachi MP-1805 floppy disk controller card for the MB-6890
Floppy drive is attached
- TODO: fix crash when a floppy is mounted
+ TODO: make sure disk can be read
*********************************************************************/
@@ -32,9 +32,11 @@ ROM_START( mp1805 )
ROM_LOAD( "mp1805.rom", 0xf800, 0x0800, BAD_DUMP CRC(b532d8d9) SHA1(6f1160356d5bf64b5926b1fdb60db414edf65f22))
ROM_END
+// Although the drive is single-sided, D88 images are double-sided,
+// so we need to allocate enough space or MAME will crash.
void bml3bus_mp1805_device::floppy_drives(device_slot_interface &device)
{
- device.option_add("mb_6890", FLOPPY_3_SSDD);
+ device.option_add("mb_6890", FLOPPY_3_DSDD);
}
@@ -83,26 +85,42 @@ void bml3bus_mp1805_device::bml3_mp1805_w(uint8_t data)
// Dn: 1=select drive <n>
logerror("control_w %02x\n", data);
- int prev, next;
- for(prev = 0; prev != 4; prev++)
- if(m_control & (1 << prev))
- break;
- m_control = data;
- for(next = 0; next != 4; next++)
- if(m_control & (1 << next))
- break;
-
- auto fprev = m_floppy[prev]->get_device();
- auto fnext = m_floppy[next]->get_device();
-
- if(fprev && fprev != fnext)
- m_floppy[prev]->get_device()->mon_w(1);
-
- if((m_control & 0x80) && fnext) {
- logerror("motor on\n");
- fnext->mon_w(0);
+ u8 prev, next;
+ bool mon = BIT(data, 7);
+ floppy_image_device *fprev = nullptr, *fnext = nullptr;
+
+ if (!mon)
+ {
+ for(prev = 0; prev < 4; prev++)
+ if(BIT(m_control, prev))
+ break;
+
+ if (prev < 4)
+ {
+ fprev = m_floppy[prev]->get_device();
+ if (fprev)
+ {
+ logerror("Drive %d motor off\n",prev);
+ fprev->mon_w(1);
+ }
+ }
+ }
+ else
+ if (data & 15)
+ {
+ for(next = 0; next < 4; next++)
+ if(BIT(data, next))
+ break;
+
+ fnext = m_floppy[next]->get_device();
+ if (fnext)
+ {
+ logerror("Drive %d motor on\n",next);
+ fnext->mon_w(0);
+ }
}
+ m_control = data;
m_mc6843->set_floppy(fnext);
}