From a77a4d354a70be4cb8b04b228a621422e429c229 Mon Sep 17 00:00:00 2001 From: Marco Maccaferri Date: Sat, 8 Aug 2020 12:17:09 +0200 Subject: [PATCH] Removed unused I/O array --- src/com/maccasoft/tools/Application.java | 6 +++--- src/com/maccasoft/tools/TMS9918.java | 4 ++-- src/z80core/MemIoOps.java | 14 ++------------ 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/src/com/maccasoft/tools/Application.java b/src/com/maccasoft/tools/Application.java index 4685186..5eed7a4 100644 --- a/src/com/maccasoft/tools/Application.java +++ b/src/com/maccasoft/tools/Application.java @@ -2441,7 +2441,7 @@ public class Application { debugTMS9918.redraw(); } - memIoOps = new MemIoOps(65536, 256) { + memIoOps = new MemIoOps(65536) { public final static int SIOA_D = 0x81; public final static int SIOA_C = 0x80; @@ -2491,7 +2491,7 @@ public class Application { return tms9918.inReg(); } - return super.inPort(port & 0xFF); + return super.inPort(port); } @Override @@ -2515,7 +2515,7 @@ public class Application { if ((port & 0xFF) == preferences.getTms9918Register()) { tms9918.outReg(value); } - super.outPort(port & 0xFF, value); + super.outPort(port, value); } }; diff --git a/src/com/maccasoft/tools/TMS9918.java b/src/com/maccasoft/tools/TMS9918.java index 12c846a..faac0bc 100644 --- a/src/com/maccasoft/tools/TMS9918.java +++ b/src/com/maccasoft/tools/TMS9918.java @@ -126,13 +126,13 @@ public class TMS9918 { public int inRam() { int result = ram[ramPtr] & 0xFF; ramPtr = (ramPtr + 1) & 0x3FFF; - return result; + return result & 0xFF; } public int inReg() { int result = status; status &= ~0x80; - return result; + return result & 0xFF; } public void processFrame(long elapsedTimeNs) { diff --git a/src/z80core/MemIoOps.java b/src/z80core/MemIoOps.java index 3caa434..817333d 100644 --- a/src/z80core/MemIoOps.java +++ b/src/z80core/MemIoOps.java @@ -12,7 +12,6 @@ package z80core; public class MemIoOps { private byte[] z80Ram; - private byte[] z80Ports; protected long tstates = 0; @@ -20,7 +19,7 @@ public class MemIoOps { } - public MemIoOps(int ramSize, int portSize) { + public MemIoOps(int ramSize) { if (ramSize < 0 || ramSize > 0x10000) { throw new IndexOutOfBoundsException("ramSize Out of Range [0x0000 - 0x10000"); } @@ -28,14 +27,6 @@ public class MemIoOps { if (ramSize > 0) { z80Ram = new byte[ramSize]; } - - if (portSize < 0 || portSize > 0x10000) { - throw new IndexOutOfBoundsException("portSize Out of Range [0x0000 - 0x10000"); - } - - if (portSize > 0) { - z80Ports = new byte[portSize]; - } } public byte[] getRam() { @@ -79,12 +70,11 @@ public class MemIoOps { public int inPort(int port) { tstates += 4; // 4 clocks for read byte from bus - return z80Ports[port & 0xFFFF] & 0xff; + return port & 0xff; } public void outPort(int port, int value) { tstates += 4; // 4 clocks for write byte to bus - z80Ports[port & 0xFFFF] = (byte) value; } public void addressOnBus(int address, int tstates) {