Issue #16: Memory window should not reset device registers

This commit is contained in:
Matt Harlum committed 2017-05-26 17:01:41 +10:00
1 parent 9cdd718e8d
commit 96819f1bf7
26 files changed
+355 -318

No files matched your search

@@ -107,10 +107,12 @@ public abstract class Acia extends Device {
return name + "@" + String.format("%04X", baseAddress);
}
public synchronized int rxRead() {
lastRxRead = System.nanoTime();
overrun = false;
rxFull = false;
public synchronized int rxRead(boolean cpuAccess) {
if (cpuAccess) {
lastRxRead = System.nanoTime();
overrun = false;
rxFull = false;
}
return rxChar;
}
@@ -128,13 +130,14 @@ public abstract class Acia extends Device {
rxChar = data;
}
public synchronized int txRead() {
txEmpty = true;
public synchronized int txRead(boolean cpuAccess) {
if (cpuAccess) {
txEmpty = true;
if (transmitIrqEnabled) {
if (transmitIrqEnabled) {
getBus().assertIrq();
}
}
return txChar;
}
@@ -56,10 +56,10 @@ public class Acia6551 extends Acia {
}
@Override
public int read(int address) throws MemoryAccessException {
public int read(int address, boolean cpuAccess) throws MemoryAccessException {
switch (address) {
case DATA_REG:
return rxRead();
return rxRead(cpuAccess);
case STAT_REG:
return statusReg();
case CMND_REG:
@@ -53,10 +53,10 @@ public class Acia6850 extends Acia {
}
@Override
public int read(int address) throws MemoryAccessException {
public int read(int address, boolean cpuAccess) throws MemoryAccessException {
switch (address) {
case RX_REG:
return rxRead();
return rxRead(cpuAccess);
case STAT_REG:
return statusReg();
@@ -119,7 +119,7 @@ public class Crtc extends Device {
}
@Override
public int read(int address) throws MemoryAccessException {
public int read(int address, boolean cpuAccess) throws MemoryAccessException {
switch (address) {
case REGISTER_RW:
switch (currentRegister) {
@@ -142,7 +142,7 @@ public class Crtc extends Device {
public int getCharAtAddress(int address) throws MemoryAccessException {
// TODO: Row/Column addressing
return memory.read(address);
return memory.read(address, false);
}
public int getHorizontalDisplayed() {
@@ -72,7 +72,7 @@ public abstract class Device implements Comparable<Device> {
/* Methods required to be implemented by inheriting classes. */
public abstract void write(int address, int data) throws MemoryAccessException;
public abstract int read(int address) throws MemoryAccessException;
public abstract int read(int address, boolean cpuAccess) throws MemoryAccessException;
public abstract String toString();
@@ -94,7 +94,7 @@ public class Memory extends Device {
}
public int read(int address) throws MemoryAccessException {
public int read(int address, boolean cpuAccess) throws MemoryAccessException {
return this.mem[address];
}
@@ -94,7 +94,7 @@ public class SdController extends Device {
}
@Override
public int read(int address) throws MemoryAccessException {
public int read(int address, boolean cpuAccess) throws MemoryAccessException {
switch (address) {
case 0:
return readData();
@@ -75,7 +75,7 @@ public class Via6522 extends Pia {
}
@Override
public int read(int address) throws MemoryAccessException {
public int read(int address, boolean cpuAccess) throws MemoryAccessException {
Register[] registers = Register.values();
if (address >= registers.length) {