use of com.rox.emu.processor.mos6502.util.Program in project emuRox by rossdrew.
the class Mos6502Test method testADCWithCarry.
@Test
public void testADCWithCarry() {
Program program = new Program().with(SEC, LDA_I, 0x1, ADC_I, 0x1);
memory.setBlock(0, program.getProgramAsByteArray());
processor.step(3);
Registers registers = processor.getRegisters();
assertEquals(0x3, registers.getRegister(Registers.Register.ACCUMULATOR));
assertEquals(program.getLength(), registers.getPC());
assertEquals(0x0, 0);
}
use of com.rox.emu.processor.mos6502.util.Program in project emuRox by rossdrew.
the class Mos6502Test method testReset.
@Test
public void testReset() {
Program program = new Program().with(LDA_I, 0xAA, LDX_I, 0xBB, LDX_I, 0xCC);
memory.setBlock(0, program.getProgramAsByteArray());
memory.setByteAt(0xFFFC, 0x0);
memory.setByteAt(0xFFFD, 0x0);
Registers registers = processor.getRegisters();
registers.setRegister(Registers.Register.STATUS_FLAGS, 0x99);
registers.setRegister(Registers.Register.PROGRAM_COUNTER_LOW, 0x99);
registers.setRegister(Registers.Register.PROGRAM_COUNTER_HI, 0x99);
registers.setRegister(Registers.Register.STACK_POINTER_HI, 0x99);
registers.setRegister(Registers.Register.ACCUMULATOR, 0x99);
registers.setRegister(Registers.Register.X_INDEX, 0x99);
registers.setRegister(Registers.Register.Y_INDEX, 0x99);
processor.step(3);
processor.reset();
assertEquals(0x34, registers.getRegister(Registers.Register.STATUS_FLAGS));
assertEquals(0x0, registers.getRegister(Registers.Register.PROGRAM_COUNTER_LOW));
assertEquals(0x0, registers.getRegister(Registers.Register.PROGRAM_COUNTER_HI));
assertEquals(0xFF, registers.getRegister(Registers.Register.STACK_POINTER_HI));
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.processor.mos6502.util.Program in project emuRox by rossdrew.
the class Mos6502Test method testDEY.
@Test
public void testDEY() {
Program program = new Program().with(LDY_I, 0x01, DEY);
memory.setBlock(0, program.getProgramAsByteArray());
Registers registers = processor.getRegisters();
processor.step();
assert (processor.getRegisters().getRegister(Registers.Register.Y_INDEX) == 1);
processor.step();
assertEquals(program.getLength(), registers.getPC());
assertEquals(0, processor.getRegisters().getRegister(Registers.Register.Y_INDEX));
}
use of com.rox.emu.processor.mos6502.util.Program in project emuRox by rossdrew.
the class Mos6502Test method testASL.
@Test
public void testASL() {
Program program = new Program().with(LDA_I, 0b01010101, ASL_A);
memory.setBlock(0, program.getProgramAsByteArray());
Registers registers = processor.getRegisters();
processor.step(2);
assertEquals(program.getLength(), registers.getPC());
assertEquals("Expected 10101010, got " + Integer.toBinaryString(processor.getRegisters().getRegister(Registers.Register.ACCUMULATOR)), 0b10101010, processor.getRegisters().getRegister(Registers.Register.ACCUMULATOR));
}
use of com.rox.emu.processor.mos6502.util.Program in project emuRox by rossdrew.
the class Mos6502Test method testLDA.
@Test
public void testLDA() {
Program program = new Program().with(LDA_I, 0xAA);
memory.setBlock(0, program.getProgramAsByteArray());
processor.step();
Registers registers = processor.getRegisters();
assertEquals(0xAA, registers.getRegister(Registers.Register.ACCUMULATOR));
assertEquals(0x0, 0);
assertEquals(program.getLength(), registers.getPC());
}
Aggregations