ReadOnlyMemory extends RandomAccessMemory { @Override public boolean write(boolean isByteMode, int address, int value) { return false; } ReadOnlyMemory(String id, int startAddress, short[] data);  ReadOnlyMemory(String id, int startAddress, byte[] data); @Override boolean write(boolean isByteMode, int address, int value);  }
@Test public void testWriteWord() { short[] romData = new short[] { 0, (short) 0177777 }; ReadOnlyMemory rom = new ReadOnlyMemory("TestRom", 01000, romData); rom.write(false, 01000, 0377); assertEquals(0, rom.read(false, 01000)); rom.write(false, 01001, 0377); assertEquals(0, rom.read(false, 01000)); rom.write(false, 01002, 0); assertEquals(0177777, rom.read(false, 01002)); rom.write(false, 01003, 0); assertEquals(0177777, rom.read(false, 01002)); }
@Test public void testWriteByte() { byte[] romData = new byte[] { 0, (byte) 0377 }; ReadOnlyMemory rom = new ReadOnlyMemory("TestRom", 01000, romData); rom.write(true, 01000, 0377); assertEquals(0377 << 8, rom.read(false, 01000)); rom.write(true, 01001, 0); assertEquals(0377 << 8, rom.read(false, 01000)); }