use of com.rox.emu.processor.mos6502.util.Program in project emuRox by rossdrew.
the class Mos6502Test method testPHP.
@Test
public void testPHP() {
Program program = new Program().with(PHP);
memory.setBlock(0, program.getProgramAsByteArray());
Registers registers = processor.getRegisters();
processor.step();
int stackLoc = (registers.getRegister(Registers.Register.STACK_POINTER_HI) + 1);
int stackValue = (memory.getByte(0x100 | stackLoc));
assertEquals(program.getLength(), registers.getPC());
assertEquals(registers.getRegister(Registers.Register.STATUS_FLAGS), stackValue);
}
use of com.rox.emu.processor.mos6502.util.Program in project emuRox by rossdrew.
the class Mos6502Test method testINX.
@Test
public void testINX() {
Program program = new Program().with(LDX_I, 0x01, INX);
memory.setBlock(0, program.getProgramAsByteArray());
Registers registers = processor.getRegisters();
processor.step();
assert (processor.getRegisters().getRegister(Registers.Register.X_INDEX) == 1);
processor.step();
assertEquals(program.getLength(), registers.getPC());
assertEquals(2, processor.getRegisters().getRegister(Registers.Register.X_INDEX));
}
use of com.rox.emu.processor.mos6502.util.Program in project emuRox by rossdrew.
the class Mos6502Test method testBMI.
@Test
public void testBMI() {
Program program = new Program().with(LDA_I, 0b11111110, BMI, 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(0b11111110, registers.getRegister(Registers.Register.ACCUMULATOR));
assertEquals(0x0, registers.getRegister(Registers.Register.X_INDEX));
assertEquals(0x97, registers.getRegister(Registers.Register.Y_INDEX));
}
use of com.rox.emu.processor.mos6502.util.Program in project emuRox by rossdrew.
the class Mos6502Test method testBVC.
@Test
public void testBVC() {
Program program = new Program().with(LDA_I, 0x0, ADC_I, 0x10, BVC, 0x4, LDA_I, 0x99, LDX_I, 0x98, LDY_I, 0x97);
memory.setBlock(0, program.getProgramAsByteArray());
Registers registers = processor.getRegisters();
processor.step(4);
assertEquals(program.getLength(), registers.getPC());
assertEquals(0x10, registers.getRegister(Registers.Register.ACCUMULATOR));
assertEquals(0x0, registers.getRegister(Registers.Register.X_INDEX));
assertEquals(0x97, registers.getRegister(Registers.Register.Y_INDEX));
}
use of com.rox.emu.processor.mos6502.util.Program in project emuRox by rossdrew.
the class Mos6502Test method testSEI.
@Test
public void testSEI() {
Program program = new Program().with(SEI);
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, 0b11111011);
processor.step(1);
assertEquals(program.getLength(), registers.getPC());
assertEquals(0b11111111, registers.getRegister(Registers.Register.STATUS_FLAGS));
}
Aggregations