diff --git a/.java-version b/.java-version index c7464da..4099407 100644 --- a/.java-version +++ b/.java-version @@ -1 +1 @@ -graalvm64-17.0.3 +23 diff --git a/src/main/java/jace/hardware/CardHayesMicromodem.java b/src/main/java/jace/hardware/CardHayesMicromodem.java index e5fbbfb..8bef799 100644 --- a/src/main/java/jace/hardware/CardHayesMicromodem.java +++ b/src/main/java/jace/hardware/CardHayesMicromodem.java @@ -17,6 +17,8 @@ package jace.hardware; import java.io.IOException; +import java.io.InputStream; +import java.util.Arrays; import java.util.logging.Level; import java.util.logging.Logger; @@ -55,6 +57,19 @@ public class CardHayesMicromodem extends CardSSC { TRANS_IRQ_ENABLED = false; } + @Override + public void loadRom() throws IOException { + String path = "/jace/data/hayes-micromodem-8308a271.rom"; + // Load rom file, first 0x0FF bytes are CX rom, next 0x0800 bytes are C8 rom + try (InputStream romFile = CardSSC.class.getResourceAsStream(path)) { + final int cxRomLength = 0x0100; + final int c8RomLength = 0x0800; + byte[] rom8Data = new byte[c8RomLength]; + getC8Rom().loadData(rom8Data); + getCxRom().loadData(Arrays.copyOf(rom8Data, cxRomLength)); + } + } + @Override public void clientConnected() { setRingIndicator(true); @@ -105,11 +120,6 @@ public class CardHayesMicromodem extends CardSSC { } } - @Override - public void loadRom(String path) throws IOException { - // Do nothing -- there is no rom for this card right now. - } - /** * @return the ringIndicator */ diff --git a/src/main/java/jace/hardware/CardSSC.java b/src/main/java/jace/hardware/CardSSC.java index 79eeb07..f0a3eb7 100644 --- a/src/main/java/jace/hardware/CardSSC.java +++ b/src/main/java/jace/hardware/CardSSC.java @@ -110,7 +110,7 @@ public class CardSSC extends Card { @Override public void setSlot(int slot) { try { - loadRom("/jace/data/SSC.rom"); + loadRom(); } catch (IOException ex) { Logger.getLogger(CardSSC.class.getName()).log(Level.SEVERE, null, ex); } @@ -173,22 +173,25 @@ public class CardSSC extends Card { System.out.println("Client disconnected"); } - public void loadRom(String path) throws IOException { + public void loadRom() throws IOException { + System.out.println("Loading SSC rom"); + String path = "/jace/data/SSC.rom"; // Load rom file, first 0x0700 bytes are C8 rom, last 0x0100 bytes are CX rom // CF00-CFFF are unused by the SSC - InputStream romFile = CardSSC.class.getResourceAsStream(path); - final int cxRomLength = 0x0100; - final int c8RomLength = 0x0700; - byte[] romxData = new byte[cxRomLength]; - byte[] rom8Data = new byte[c8RomLength]; - if (romFile.read(rom8Data) != c8RomLength) { - throw new IOException("Bad SSC rom size"); + try (InputStream romFile = CardSSC.class.getResourceAsStream(path)) { + final int cxRomLength = 0x0100; + final int c8RomLength = 0x0700; + byte[] romxData = new byte[cxRomLength]; + byte[] rom8Data = new byte[c8RomLength]; + if (romFile.read(rom8Data) != c8RomLength) { + throw new IOException("Bad SSC rom size"); + } + getC8Rom().loadData(rom8Data); + if (romFile.read(romxData) != cxRomLength) { + throw new IOException("Bad SSC rom size"); + } + getCxRom().loadData(romxData); } - getC8Rom().loadData(rom8Data); - if (romFile.read(romxData) != cxRomLength) { - throw new IOException("Bad SSC rom size"); - } - getCxRom().loadData(romxData); } @Override diff --git a/src/main/resources/jace/data/hayes-micromodem-8308a271.rom b/src/main/resources/jace/data/hayes-micromodem-8308a271.rom new file mode 100644 index 0000000..b153209 Binary files /dev/null and b/src/main/resources/jace/data/hayes-micromodem-8308a271.rom differ diff --git a/src/test/java/jace/TestUtils.java b/src/test/java/jace/TestUtils.java index e5abdcd..c0a18d2 100644 --- a/src/test/java/jace/TestUtils.java +++ b/src/test/java/jace/TestUtils.java @@ -18,9 +18,11 @@ package jace; import java.io.IOException; import java.util.Arrays; +import jace.apple2e.RAM128k; import jace.core.CPU; import jace.core.Computer; import jace.core.Device; +import jace.core.PagedMemory; import jace.core.RAM; import jace.core.RAMEvent.TYPE; import jace.core.Utility; @@ -41,7 +43,8 @@ public class TestUtils { Emulator.withComputer(Computer::reconfigure); } - public static class FakeRAM extends RAM { + public static class FakeRAM extends RAM128k { + PagedMemory fakeMemory = new PagedMemory(0x0, PagedMemory.Type.RAM); byte[] memory = new byte[65536]; public byte read(int address, TYPE eventType, boolean triggerEvent, boolean requireSyncronization) { return memory[address & 0x0ffff]; @@ -92,6 +95,22 @@ public class TestUtils { @Override public void resetState() { } + @Override + public PagedMemory getAuxVideoMemory() { + return fakeMemory; + } + @Override + public PagedMemory getAuxMemory() { + return fakeMemory; + } + @Override + public PagedMemory getAuxLanguageCard() { + return fakeMemory; + } + @Override + public PagedMemory getAuxLanguageCard2() { + return fakeMemory; + } } public static void clearFakeRam(RAM ram) { diff --git a/src/test/java/jace/apple2e/CpuUnitTest.java b/src/test/java/jace/apple2e/CpuUnitTest.java index 7a7b35f..c8cf78f 100644 --- a/src/test/java/jace/apple2e/CpuUnitTest.java +++ b/src/test/java/jace/apple2e/CpuUnitTest.java @@ -151,13 +151,12 @@ public class CpuUnitTest { ram.write(mem[0], (byte) mem[1], false, false); } // Step the CPU for each cycle - for (List c : t.cycles()) { + for (@SuppressWarnings("unused") List c : t.cycles()) { if (BREAK_ON_FAIL) { cpu.traceLength = 100; cpu.setTraceEnabled(true); } cpu.doTick(); - // TODO: Check the memory accesses } // Check the final state boolean passed = true; diff --git a/src/test/java/jace/apple2e/Full65C02Test.java b/src/test/java/jace/apple2e/Full65C02Test.java index 6fb9bd8..d174894 100644 --- a/src/test/java/jace/apple2e/Full65C02Test.java +++ b/src/test/java/jace/apple2e/Full65C02Test.java @@ -400,18 +400,18 @@ public class Full65C02Test { new TestProgram() .add("LDA #$FF") .add("STA $FF") - .assertTimed("BIT #0", 2) - .assertFlags(IS_ZERO, POSITIVE, OVERFLOW_CLEAR) - .assertTimed("BIT #$FF", 2) + .assertTimed("BIT #0", 3) + .assertFlags(IS_ZERO, NEGATIVE, OVERFLOW_CLEAR) + .assertTimed("BIT #$FF", 3) .assertFlags(NOT_ZERO, NEGATIVE, OVERFLOW_CLEAR) .assertTimed("BIT $FF", 3) .assertFlags(NOT_ZERO, NEGATIVE, OVERFLOW_SET) .add("CLV") .add("LDA #$40") - .assertTimed("BIT #$40", 2) + .assertTimed("BIT #$40", 3) .assertFlags(NOT_ZERO, POSITIVE, OVERFLOW_CLEAR) - .assertTimed("BIT #$80", 2) - .assertFlags(IS_ZERO, NEGATIVE, OVERFLOW_CLEAR) + .assertTimed("BIT #$80", 3) + .assertFlags(IS_ZERO, POSITIVE, OVERFLOW_CLEAR) .assertTimed("BIT $1000", 4) .assertTimed("BIT $1000,x", 4) .assertTimed("BIT $00,X", 4)