use of com.rox.emu.processor.mos6502.util.Program in project emuRox by rossdrew.
the class Mos6502Test method testTYA.
@Test
public void testTYA() {
Program program = new Program().with(LDY_I, 0x0D, TYA);
memory.setBlock(0, program.getProgramAsByteArray());
Registers registers = processor.getRegisters();
processor.step(2);
assertEquals(program.getLength(), registers.getPC());
assertEquals(0x0D, registers.getRegister(Registers.Register.Y_INDEX));
assertEquals(0x0D, registers.getRegister(Registers.Register.ACCUMULATOR));
}
use of com.rox.emu.processor.mos6502.util.Program in project emuRox by rossdrew.
the class Mos6502Test method testTAX.
@Test
public void testTAX() {
Program program = new Program().with(LDA_I, 0x0F, TAX);
memory.setBlock(0, program.getProgramAsByteArray());
Registers registers = processor.getRegisters();
processor.step(2);
assertEquals(program.getLength(), registers.getPC());
assertEquals(0x0F, registers.getRegister(Registers.Register.ACCUMULATOR));
assertEquals(0x0F, registers.getRegister(Registers.Register.X_INDEX));
}
use of com.rox.emu.processor.mos6502.util.Program in project emuRox by rossdrew.
the class Mos6502Test method testLDY.
@Test
public void testLDY() {
Program program = new Program().with(LDY_I, 0xAA);
memory.setBlock(0, program.getProgramAsByteArray());
processor.step();
Registers registers = processor.getRegisters();
assertEquals(0xAA, registers.getRegister(Registers.Register.Y_INDEX));
assertEquals(0x0, 0);
assertEquals(program.getLength(), registers.getPC());
}
use of com.rox.emu.processor.mos6502.util.Program in project emuRox by rossdrew.
the class Mos6502Test method testPLA.
@Test
public void testPLA() {
Program program = new Program().with(LDA_I, 0x99, PHA, LDA_I, 0x11, PLA);
memory.setBlock(0, program.getProgramAsByteArray());
Registers registers = processor.getRegisters();
processor.step(2);
assert (processor.getRegisters().getRegister(Registers.Register.ACCUMULATOR) == 0x99);
processor.step();
assert (processor.getRegisters().getRegister(Registers.Register.ACCUMULATOR) == 0x11);
processor.step();
assertEquals(program.getLength(), registers.getPC());
assertEquals(0xFF, processor.getRegisters().getRegister(Registers.Register.STACK_POINTER_HI));
assertEquals(0x99, processor.getRegisters().getRegister(Registers.Register.ACCUMULATOR));
}
use of com.rox.emu.processor.mos6502.util.Program in project emuRox by rossdrew.
the class Mos6502Test method testBCC.
@Test
public void testBCC() {
Program program = new Program().with(CLC, BCC, 0x4, LDA_I, 0x99, LDX_I, 0x98, LDY_I, 0x97);
memory.setBlock(0, program.getProgramAsByteArray());
Registers registers = processor.getRegisters();
processor.step(3);
assertEquals(program.getLength(), registers.getPC());
assertEquals(0x0, registers.getRegister(Registers.Register.ACCUMULATOR));
assertEquals(0x0, registers.getRegister(Registers.Register.X_INDEX));
assertEquals(0x97, registers.getRegister(Registers.Register.Y_INDEX));
}
Aggregations