From 8e4a406f741bfa4f58e2c42b566d907cae6f1c92 Mon Sep 17 00:00:00 2001 From: Brendan Robert Date: Sun, 5 Apr 2015 15:37:07 -0500 Subject: [PATCH] Drive will not read if the motor is off. This breaks compatibility with the cracked copy of Sherwood Forrst, making it more like the original and expected behavior of the real hardware. --- src/main/java/jace/hardware/CardDiskII.java | 5 +++-- src/main/java/jace/hardware/DiskIIDrive.java | 11 +++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/main/java/jace/hardware/CardDiskII.java b/src/main/java/jace/hardware/CardDiskII.java index a0496bb..dc919da 100644 --- a/src/main/java/jace/hardware/CardDiskII.java +++ b/src/main/java/jace/hardware/CardDiskII.java @@ -18,7 +18,6 @@ */ package jace.hardware; -import jace.Emulator; import jace.EmulatorUILogic; import jace.config.ConfigurableField; import jace.config.Name; @@ -128,7 +127,9 @@ public class CardDiskII extends Card implements Reconfigurable, MediaConsumerPar // read/write latch currentDrive.write(); e.setNewValue(currentDrive.readLatch()); - EmulatorUILogic.addIndicator(this, currentDrive.getIcon()); + if (currentDrive.isOn()) { + EmulatorUILogic.addIndicator(this, currentDrive.getIcon()); + } break; case 0xF: // write mode diff --git a/src/main/java/jace/hardware/DiskIIDrive.java b/src/main/java/jace/hardware/DiskIIDrive.java index 22c711d..4d9c236 100644 --- a/src/main/java/jace/hardware/DiskIIDrive.java +++ b/src/main/java/jace/hardware/DiskIIDrive.java @@ -131,14 +131,17 @@ public class DiskIIDrive implements MediaConsumer { spinCount = (spinCount + 1) & 0x0F; if (spinCount > 0) { if (disk != null) { - result = disk.nibbles[trackStartOffset + nibbleOffset++]; + result = disk.nibbles[trackStartOffset + nibbleOffset]; + if (isOn()) { + nibbleOffset++; + if (nibbleOffset >= FloppyDisk.TRACK_NIBBLE_LENGTH) { + nibbleOffset = 0; + } + } } else { result = (byte) 0x0ff; } } - if (nibbleOffset >= FloppyDisk.TRACK_NIBBLE_LENGTH) { - nibbleOffset = 0; - } } else { spinCount = (spinCount + 1) & 0x0F; if (spinCount > 0) {