summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Nigel Barnes <Pernod70@users.noreply.github.com>2018-11-13 18:54:27 +0000
committer Nigel Barnes <Pernod70@users.noreply.github.com>2018-11-13 18:54:27 +0000
commit349d0be4e9295528d116eee5ff4ae4c8e28d0029 (patch)
treeaa8ee6ee993c457e765e2f7cb88947541cd1d779
parent1ca02639a42cae41cdf9ca5dd4582d8f7b50a7e8 (diff)
i8271: Prevent crash when no drives connected (nw)
-rw-r--r--src/devices/machine/i8271.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/devices/machine/i8271.cpp b/src/devices/machine/i8271.cpp
index bd374a6da6c..54db0c7f2cd 100644
--- a/src/devices/machine/i8271.cpp
+++ b/src/devices/machine/i8271.cpp
@@ -775,8 +775,8 @@ void i8271_device::start_command(int cmd)
case C_READ_DRIVE_STATUS:
{
floppy_info &fi = flopi[BIT(command[0], 7)];
- rr = (get_ready(1) ? 0x40 : 0) | (fi.dev->idx_r() ? 0x10 : 0) | (fi.dev->wpt_r() ? 0 : 8) |
- (get_ready(0) ? 4 : 0) | (fi.dev->trk00_r() ? 1 : 0);
+ rr = (get_ready(1) ? 0x40 : 0) | (fi.dev && fi.dev->idx_r() ? 0x10 : 0) | (fi.dev && fi.dev->wpt_r() ? 0 : 8) |
+ (get_ready(0) ? 4 : 0) | (fi.dev && fi.dev->trk00_r() ? 1 : 0);
flopi[0].ready = true;
flopi[1].ready = true;
main_phase = PHASE_IDLE;
@@ -841,8 +841,8 @@ void i8271_device::start_command(int cmd)
break;
case 0x22: {
floppy_info &fi = flopi[BIT(command[0], 7)];
- rr = (get_ready(1) ? 0x40 : 0) | (fi.dev->idx_r() ? 0x10 : 0) | (fi.dev->wpt_r() ? 0 : 8) |
- (get_ready(0) ? 4 : 0) | (fi.dev->trk00_r() ? 1 : 0);
+ rr = (get_ready(1) ? 0x40 : 0) | (fi.dev && fi.dev->idx_r() ? 0x10 : 0) | (fi.dev && fi.dev->wpt_r() ? 0 : 8) |
+ (get_ready(0) ? 4 : 0) | (fi.dev && fi.dev->trk00_r() ? 1 : 0);
break;
}
case 0x23:
@@ -888,8 +888,10 @@ void i8271_device::start_command(int cmd)
case 0x23: {
oport = command[2] & ~0xc0;
floppy_info &fi = flopi[BIT(command[0], 7)];
- fi.dev->dir_w(BIT(command[2], 2));
- fi.dev->stp_w(BIT(command[2], 1));
+ if (fi.dev) {
+ fi.dev->dir_w(BIT(command[2], 2));
+ fi.dev->stp_w(BIT(command[2], 1));
+ }
opt_cb(BIT(command[2], 5));
hdl_cb(BIT(command[2], 3));
break;