use of com.rox.emu.processor.mos6502.util.Program in project emuRox by rossdrew.
the class Mos6502Test method testPHA.
@Test
public void testPHA() {
Program program = new Program().with(LDA_I, 0x99, PHA);
memory.setBlock(0, program.getProgramAsByteArray());
Registers registers = processor.getRegisters();
processor.step();
assert (processor.getRegisters().getRegister(Registers.Register.STACK_POINTER_HI) == 0xFF);
processor.step();
assertEquals(program.getLength(), registers.getPC());
assertEquals(0xFE, processor.getRegisters().getRegister(Registers.Register.STACK_POINTER_HI));
assertEquals(0x99, memory.getByte(0x01FF));
}
use of com.rox.emu.processor.mos6502.util.Program in project emuRox by rossdrew.
the class Mos6502Test method testSTXAbsolute.
@Test
public void testSTXAbsolute() {
Program program = new Program().with(LDX_I, 0xAA, STX_ABS, 0x02, 0x20);
memory.setBlock(0, program.getProgramAsByteArray());
processor.step(2);
Registers registers = processor.getRegisters();
assertEquals(program.getLength(), registers.getPC());
assertEquals(0xAA, memory.getByte(0x220));
}
use of com.rox.emu.processor.mos6502.util.Program in project emuRox by rossdrew.
the class Mos6502Test method testROR.
@Test
public void testROR() {
Program program = new Program().with(SEC, LDA_I, 0b00000010, ROR_A);
memory.setBlock(0, program.getProgramAsByteArray());
Registers registers = processor.getRegisters();
processor.step(3);
assertEquals(program.getLength(), registers.getPC());
assertEquals(0b10000001, registers.getRegister(Registers.Register.ACCUMULATOR));
}
use of com.rox.emu.processor.mos6502.util.Program in project emuRox by rossdrew.
the class Mos6502Test method testINY.
@Test
public void testINY() {
Program program = new Program().with(LDY_I, 0x01, INY);
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(2, 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 testEOR.
@Test
public void testEOR() {
Program program = new Program().with(LDA_I, 0b00010101, EOR_I, 0b00000101);
memory.setBlock(0, program.getProgramAsByteArray());
processor.step(2);
Registers registers = processor.getRegisters();
assertEquals(0b00010000, registers.getRegister(Registers.Register.ACCUMULATOR));
assertEquals(program.getLength(), registers.getPC());
assertEquals(0x0, 0);
}
Aggregations