use of com.rox.emu.mem.Memory in project emuRox by rossdrew.
the class Mos6502CompilerTest method testAbsoluteAddressing.
@Test
public void testAbsoluteAddressing() {
final Mos6502Compiler compiler = new Mos6502Compiler("LDA #$1C STA $100 INC $100");
Program program = compiler.compileProgram();
final int[] programByte = program.getProgramAsByteArray();
Memory memory = new SimpleMemory();
Mos6502 processor = new Mos6502(memory);
processor.reset();
memory.setBlock(0, programByte);
processor.step(3);
assertEquals(0x1D, memory.getByte(0x100));
}
use of com.rox.emu.mem.Memory in project emuRox by rossdrew.
the class Mos6502CompilerTest method testIntegration.
@Test
public void testIntegration() {
final Mos6502Compiler compiler = new Mos6502Compiler("LDA #$14 ADC #$5 STA $20");
Program program = compiler.compileProgram();
final int[] programByte = program.getProgramAsByteArray();
Memory memory = new SimpleMemory();
Mos6502 processor = new Mos6502(memory);
processor.reset();
memory.setBlock(0, programByte);
processor.step(3);
Registers registers = processor.getRegisters();
assertEquals(0x19, registers.getRegister(Registers.Register.ACCUMULATOR));
assertEquals(0x19, memory.getByte(0x20));
assertEquals(programByte.length, registers.getPC());
}
use of com.rox.emu.mem.Memory 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.Memory 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.Memory in project emuRox by rossdrew.
the class Ricoh2C02RegistersTest method testSimpleWrite.
@Test
public void testSimpleWrite() {
final Memory cpuMemory = mock(SimpleMemory.class);
final Ricoh2C02Registers registers = new Ricoh2C02Registers(cpuMemory);
registers.setRegister(CTRL_1, 99);
verify(cpuMemory, times(1)).setByteAt(CTRL_1.getMemoryMappedLocation(), 99);
}
Aggregations