use of com.rox.emu.mem.SimpleMemory in project emuRox by rossdrew.
the class Mos6502Properties method setUp.
@Before
public void setUp() {
memory = new SimpleMemory();
memory.setByteAt(0x0, 0xFFFC);
memory.setByteAt(0x0, 0xFFFD);
processor = new Mos6502(memory);
processor.reset();
}
use of com.rox.emu.mem.SimpleMemory in project emuRox by rossdrew.
the class Mos6502Properties method testValidStartup.
@Property(trials = 100)
public void testValidStartup(@InRange(min = "0", max = "255") int memHi, @InRange(min = "0", max = "255") int memLo) {
memory = new SimpleMemory();
memory.setByteAt(0xFFFC, memHi);
memory.setByteAt(0xFFFD, memLo);
processor = new Mos6502(memory);
processor.reset();
Registers registers = processor.getRegisters();
// PC Set to location pointed to by mem[FFFC:FFFD]
assertEquals(memHi, registers.getRegister(Registers.Register.PROGRAM_COUNTER_HI));
// ...
assertEquals(memLo, registers.getRegister(Registers.Register.PROGRAM_COUNTER_LOW));
// Status flags reset
assertEquals(0x34, registers.getRegister(Registers.Register.STATUS_FLAGS));
// Stack Pointer at top of stack
assertEquals(0xFF, registers.getRegister(Registers.Register.STACK_POINTER_HI));
// All cleared
assertEquals(0, registers.getRegister(Registers.Register.ACCUMULATOR));
assertEquals(0, registers.getRegister(Registers.Register.X_INDEX));
assertEquals(0, registers.getRegister(Registers.Register.Y_INDEX));
}
use of com.rox.emu.mem.SimpleMemory in project emuRox by rossdrew.
the class Ricoh2C02Theories method testGetControlRegister.
@Theory
public void testGetControlRegister(int byteValue) {
assumeThat(byteValue, is(both(greaterThanOrEqualTo(0)).and(lessThanOrEqualTo(255))));
final Memory vRam = new SimpleMemory();
final Memory sprRam = mock(Memory.class);
final Memory cpuRam = mock(Memory.class);
final Ricoh2C02 ppu = new Ricoh2C02(vRam, sprRam, cpuRam);
for (Ricoh2C02Registers.Register register : Ricoh2C02Registers.Register.values()) {
when(cpuRam.getByte(register.getMemoryMappedLocation())).thenReturn(byteValue);
assertThat(byteValue, equalTo(ppu.getRegister(register)));
}
}
Aggregations