Fix fake reads so DiskII doesn't break

This commit is contained in:
Badvision 2024-08-14 22:51:53 -05:00
parent 519c561537
commit 2304eaab30
4 changed files with 8 additions and 2 deletions

View File

@ -415,7 +415,7 @@ public class MOS65C02 extends CPU {
int address2 = cpu.getMemory().readWord(cpu.getProgramCounter() + 1, TYPE.READ_OPERAND, cpu.readAddressTriggersEvent, false);
int address = 0x0FFFF & (address2 + cpu.X);
// False read
cpu.getMemory().read(address, TYPE.READ_DATA, true, false);
cpu.getMemory().read(address, TYPE.READ_FAKE, true, false);
cpu.setPageBoundaryPenalty((address & 0x00ff00) != (address2 & 0x00ff00));
cpu.setPageBoundaryApplied(true);
return address;
@ -424,7 +424,7 @@ public class MOS65C02 extends CPU {
int address2 = cpu.getMemory().readWord(cpu.getProgramCounter() + 1, TYPE.READ_OPERAND, cpu.readAddressTriggersEvent, false);
int address = 0x0FFFF & (address2 + cpu.Y);
// False read
cpu.getMemory().read(address, TYPE.READ_DATA, true, false);
cpu.getMemory().read(address, TYPE.READ_FAKE, true, false);
cpu.setPageBoundaryPenalty((address & 0x00ff00) != (address2 & 0x00ff00));
cpu.setPageBoundaryApplied(true);
return address;

View File

@ -40,6 +40,7 @@ public class RAMEvent {
READ(true),
READ_DATA(true),
READ_OPERAND(true),
READ_FAKE(true),
EXECUTE(true),
WRITE(false),
ANY(false);

View File

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

View File

@ -333,6 +333,8 @@ public class CardSSC extends Card {
}
}
break;
case READ_FAKE:
return;
}
if (newValue > -1) {
e.setNewValue(newValue);