use of com.rox.emu.mem.SimpleMemory in project emuRox by rossdrew.
the class Mos6502Theories method testValidStartup.
@Theory
public void testValidStartup(@FromDataPoints("validBytes") int memHi, @FromDataPoints("validBytes") int memLo) {
assumeThat(memHi, is(both(greaterThanOrEqualTo(0)).and(lessThanOrEqualTo(255))));
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]
assertThat(memHi, equalTo(registers.getRegister(Registers.Register.PROGRAM_COUNTER_HI)));
// ...
assertThat(memLo, equalTo(registers.getRegister(Registers.Register.PROGRAM_COUNTER_LOW)));
// Status flags reset
assertThat(registers.getRegister(Registers.Register.STATUS_FLAGS), equalTo(0x34));
// Stack Pointer at top of stack
assertThat(registers.getRegister(Registers.Register.STATUS_FLAGS), equalTo(0x34));
// All cleared
assertThat(registers.getRegister(Registers.Register.STACK_POINTER_HI), equalTo(0xFF));
assertThat(registers.getRegister(Registers.Register.ACCUMULATOR), equalTo(0));
assertThat(registers.getRegister(Registers.Register.X_INDEX), equalTo(0));
assertThat(registers.getRegister(Registers.Register.Y_INDEX), equalTo(0));
}
use of com.rox.emu.mem.SimpleMemory in project emuRox by rossdrew.
the class Ricoh2C02Properties method testCreation.
@Test
public void testCreation() {
final Ricoh2C02 ppu = new Ricoh2C02(new SimpleMemory(), new SimpleMemory(), new SimpleMemory());
assertNotNull(ppu);
}
use of com.rox.emu.mem.SimpleMemory in project emuRox by rossdrew.
the class Ricoh2C02Properties method testSetControlRegister.
@Property(trials = 10)
public void testSetControlRegister(@InRange(min = "0", max = "255") int byteValue) {
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()) {
ppu.setRegister(register, byteValue);
verify(cpuRam, times(1)).setByteAt(register.getMemoryMappedLocation(), byteValue);
}
}
use of com.rox.emu.mem.SimpleMemory in project emuRox by rossdrew.
the class Ricoh2C02Properties method testGetControlRegister.
@Property(trials = 10)
public void testGetControlRegister(@InRange(min = "0", max = "255") int byteValue) {
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);
assertEquals(byteValue, ppu.getRegister(register));
}
}
use of com.rox.emu.mem.SimpleMemory in project emuRox by rossdrew.
the class DebuggerWindow method init.
private void init() {
memory = new SimpleMemory();
processor = new Mos6502(memory);
newRegisterPanel = new Registers6502(processor.getRegisters());
}
Aggregations