diff --git a/src/main/java/com/loomcom/symon/devices/Acia6551.java b/src/main/java/com/loomcom/symon/devices/Acia6551.java index 8977103..c596bf7 100644 --- a/src/main/java/com/loomcom/symon/devices/Acia6551.java +++ b/src/main/java/com/loomcom/symon/devices/Acia6551.java @@ -53,6 +53,14 @@ public class Acia6551 extends Acia { public Acia6551(int address) throws MemoryRangeException { super(address, ACIA_SIZE, "ACIA"); + + // Figure 6 in the 6551 ACIA data sheet says the "hardware reset" + // state of the Control Register is all zeros. + setControlRegister(0b00000000); + // Figure 7 of the 6551 ACIA data sheet says the "hardware reset" + // state of the Command Register is zeros, but Transmitter Control + // is set to "interrupt disabled, ready to send". + setCommandRegister(0b00000010); } @Override diff --git a/src/test/java/com/loomcom/symon/AciaTest.java b/src/test/java/com/loomcom/symon/AciaTest.java index ba29b27..309ce89 100644 --- a/src/test/java/com/loomcom/symon/AciaTest.java +++ b/src/test/java/com/loomcom/symon/AciaTest.java @@ -254,4 +254,25 @@ public class AciaTest { assertEquals(0x08, acia.read(0x0001, true)); } + + @Test + public void statusRegisterInitializedAtHardwareReset() throws Exception { + Acia6551 acia = new Acia6551(0x0000); + + assertEquals(0x10, acia.read(0x0001, false)); + } + + @Test + public void commandRegisterInitializedAtHardwareReset() throws Exception { + Acia6551 acia = new Acia6551(0x0000); + + assertEquals(0x02, acia.read(0x0002, false)); + } + + @Test + public void controlRegisterInitializedAtHardwareReset() throws Exception { + Acia6551 acia = new Acia6551(0x0000); + + assertEquals(0x00, acia.read(0x0003, false)); + } }