Inhibit fake reads from afecting any cards

This commit is contained in:
Badvision 2024-08-16 01:46:26 -05:00
parent 5444f40bd4
commit 4db3cca98d
3 changed files with 8 additions and 7 deletions

View File

@ -17,6 +17,7 @@
package jace.core; package jace.core;
import jace.apple2e.SoftSwitches; import jace.apple2e.SoftSwitches;
import jace.core.RAMEvent.TYPE;
/** /**
* Card is an abstraction of an Apple ][ hardware module which can carry its own * Card is an abstraction of an Apple ][ hardware module which can carry its own
@ -113,6 +114,9 @@ public abstract class Card extends TimedDevice {
int baseIO = 0x0c080 + slot * 16; int baseIO = 0x0c080 + slot * 16;
int baseRom = 0x0c000 + slot * 256; int baseRom = 0x0c000 + slot * 256;
ioListener = getMemory().observe("Slot " + getSlot() + " " + getDeviceName() + " IO access", RAMEvent.TYPE.ANY, baseIO, baseIO + 15, (e) -> { ioListener = getMemory().observe("Slot " + getSlot() + " " + getDeviceName() + " IO access", RAMEvent.TYPE.ANY, baseIO, baseIO + 15, (e) -> {
if (e.getType() == TYPE.READ_FAKE) {
return;
}
int address = e.getAddress() & 0x0f; int address = e.getAddress() & 0x0f;
handleIOAccess(address, e.getType(), e.getNewValue(), e); handleIOAccess(address, e.getType(), e.getNewValue(), e);
}); });
@ -121,6 +125,9 @@ public abstract class Card extends TimedDevice {
getMemory().setActiveCard(slot); getMemory().setActiveCard(slot);
// Sather 6-4: Writes will still go through even when CXROM inhibits slot ROM // Sather 6-4: Writes will still go through even when CXROM inhibits slot ROM
if (SoftSwitches.CXROM.isOff() || !e.getType().isRead()) { if (SoftSwitches.CXROM.isOff() || !e.getType().isRead()) {
if (e.getType() == TYPE.READ_FAKE) {
return;
}
handleFirmwareAccess(e.getAddress() & 0x0ff, e.getType(), e.getNewValue(), e); handleFirmwareAccess(e.getAddress() & 0x0ff, e.getType(), e.getNewValue(), e);
} }
}); });

View File

@ -86,9 +86,6 @@ public class CardDiskII extends Card implements MediaConsumerParent {
@Override @Override
protected void handleIOAccess(int register, RAMEvent.TYPE type, int value, RAMEvent e) { protected void handleIOAccess(int register, RAMEvent.TYPE type, int value, RAMEvent e) {
if (type == TYPE.READ_FAKE) {
return;
}
// handle Disk ][ registers // handle Disk ][ registers
switch (register) { switch (register) {
case 0x0: case 0x0:

View File

@ -140,9 +140,6 @@ public class CardMockingboard extends Card {
@Override @Override
protected void handleFirmwareAccess(int register, TYPE type, int value, RAMEvent e) { protected void handleFirmwareAccess(int register, TYPE type, int value, RAMEvent e) {
if (type == TYPE.READ_FAKE) {
return;
}
if (chips == null) { if (chips == null) {
reconfigure(); reconfigure();
} }