use of com.rox.emu.processor.mos6502.util.Program in project emuRox by rossdrew.
the class Mos6502Test method testINC.
@Test
public void testINC() {
Program program = new Program().with(LDA_I, 1, STA_Z, 0x20, INC_Z, 0x20);
memory.setBlock(0, program.getProgramAsByteArray());
Registers registers = processor.getRegisters();
processor.step(3);
assertEquals(program.getLength(), registers.getPC());
assertEquals(2, memory.getByte(0x20));
}
use of com.rox.emu.processor.mos6502.util.Program in project emuRox by rossdrew.
the class Mos6502Test method testTXS.
@Test
public void testTXS() {
Program program = new Program().with(LDX_I, 0xAA, TXS);
memory.setBlock(0, program.getProgramAsByteArray());
Registers registers = processor.getRegisters();
processor.step(2);
assertEquals(program.getLength(), registers.getPC());
assertEquals(0xAA, registers.getRegister(Registers.Register.X_INDEX));
assertEquals(0xAA, registers.getRegister(Registers.Register.STACK_POINTER_HI));
}
use of com.rox.emu.processor.mos6502.util.Program in project emuRox by rossdrew.
the class Mos6502Test method testSBC.
@Test
public void testSBC() {
Program program = new Program().with(SEC, LDA_I, 0xA, SBC_I, 0x5);
memory.setBlock(0, program.getProgramAsByteArray());
processor.step(3);
Registers registers = processor.getRegisters();
assertEquals(0x5, registers.getRegister(Registers.Register.ACCUMULATOR));
assertEquals(program.getLength(), registers.getPC());
}
use of com.rox.emu.processor.mos6502.util.Program in project emuRox by rossdrew.
the class Mos6502Test method testCLI.
@Test
public void testCLI() {
Program program = new Program().with(CLI);
memory.setBlock(0, program.getProgramAsByteArray());
Registers registers = processor.getRegisters();
// Load status, push to stack then clear it and pull it from stack
registers.setRegister(Registers.Register.STATUS_FLAGS, 0b00000100);
processor.step(1);
assertEquals(program.getLength(), registers.getPC());
assertEquals(0b00000000, registers.getRegister(Registers.Register.STATUS_FLAGS));
}
use of com.rox.emu.processor.mos6502.util.Program in project emuRox by rossdrew.
the class Mos6502Test method testAND.
@Test
public void testAND() {
Program program = new Program().with(LDA_I, 0b00000101, AND_I, 0b00000101);
memory.setBlock(0, program.getProgramAsByteArray());
processor.step(2);
Registers registers = processor.getRegisters();
assertEquals(0b00000101, registers.getRegister(Registers.Register.ACCUMULATOR));
assertEquals(program.getLength(), registers.getPC());
assertEquals(0x0, 0);
}
Aggregations