Sel1RegisterSystemBits implements Device { public Sel1RegisterSystemBits(int cpuStartupAddress) { state = cpuStartupAddress & 0177400; } Sel1RegisterSystemBits(int cpuStartupAddress); @Override int[] getAddresses(); @Override void init(long cpuTime); @Override int read(long cpuTime, int address); @Override boolean write(long cpuTime, boolean isByteMode, int address, int value); @Override void saveState(Bundle outState); @Override void restoreState(Bundle inState); final static int WRITE_FLAG; }
@Test public void testSel1RegisterSystemBits() { Computer computer = new Computer(); computer.addDevice(new Sel1RegisterSystemBits(0100000)); computer.reset(); assertEquals(0100000, computer.readMemory(false, Cpu.REG_SEL1) & 0177400); assertEquals(0, (computer.readMemory(false, Cpu.REG_SEL1) & 004)); assertTrue(computer.writeMemory(false, Cpu.REG_SEL1, 0)); assertTrue((computer.readMemory(false, Cpu.REG_SEL1) & 004) != 0); assertEquals(0, (computer.readMemory(false, Cpu.REG_SEL1) & 004)); }