Correcting floating bus behavior (hopefully)

This commit is contained in:
Brendan Robert 2023-10-24 11:36:32 -05:00
parent cba2850759
commit de782575bb
5 changed files with 11 additions and 6 deletions

View File

@ -234,10 +234,6 @@ public class EmulatorUILogic implements Reconfigurable {
}
public static void brun(File binary, int address) throws IOException {
// If it was halted already, then it was initiated outside of an opcode execution
// If it was not yet halted, then it is the case that the CPU is processing another opcode
// So if that is the case, the program counter will need to be decremented here to compensate
// TODO: Find a better mousetrap for this one -- it's an ugly hack
byte[] data;
try (FileInputStream in = new FileInputStream(binary)) {
data = new byte[in.available()];

View File

@ -350,7 +350,7 @@ abstract public class RAM128k extends RAM {
read.setBanks(7, 8, 0x0C8, cPageRom);
}
}
// All ROM reads not intecepted will return 0xFF! (TODO: floating bus)
// All ROM reads not intecepted will return 0xFF!
read.set(0x0c0, blank.get(0));
return read;
}

View File

@ -323,6 +323,9 @@ public abstract class RAM implements Reconfigurable {
if (activeListeners != null && !activeListeners.isEmpty()) {
RAMEvent e = new RAMEvent(t, RAMEvent.SCOPE.ADDRESS, RAMEvent.VALUE.ANY, address, oldValue, newValue);
activeListeners.forEach((l) -> l.handleEvent(e));
if (!e.isIntercepted() && (address & 0x0FF00) == 0x0C000) {
return computer.getVideo().getFloatingBus();
}
return (byte) e.getNewValue();
}
return (byte) newValue;

View File

@ -74,6 +74,7 @@ public class RAMEvent {
private SCOPE scope;
private VALUE value;
private int address, oldValue, newValue;
private boolean valueIntercepted = false;
/**
* Creates a new instance of RAMEvent
@ -142,5 +143,10 @@ public class RAMEvent {
public final void setNewValue(int newValue) {
this.newValue = newValue;
valueIntercepted = true;
}
public final boolean isIntercepted() {
return valueIntercepted;
}
}

View File

@ -101,7 +101,7 @@ public class TocTreeModel implements TreeModel {
public int getIndexOfChild(Object parent, Object child) {
if (parent instanceof String) {
String n = (String) parent;
// String n = (String) parent;
int index = 0;
for (String c : tree.get(parent).keySet()) {
if (c.equals(child)) {