use of com.rox.emu.processor.mos6502.util.Program in project emuRox by rossdrew.
the class Mos6502Test method testDEC.
@Test
public void testDEC() {
Program program = new Program().with(LDA_I, 9, STA_Z, 0x20, DEC_Z, 0x20);
memory.setBlock(0, program.getProgramAsByteArray());
Registers registers = processor.getRegisters();
processor.step(3);
assertEquals(program.getLength(), registers.getPC());
assertEquals(8, memory.getByte(0x20));
}
use of com.rox.emu.processor.mos6502.util.Program in project emuRox by rossdrew.
the class Mos6502Test method testPLP.
@Test
public void testPLP() {
Program program = new Program().with(PHP, PLP);
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, 0b11111111);
processor.step(1);
registers.setRegister(Registers.Register.STATUS_FLAGS, 0b00000000);
processor.step(1);
assertEquals(program.getLength(), registers.getPC());
assertEquals(0b11111111, registers.getRegister(Registers.Register.STATUS_FLAGS));
}
use of com.rox.emu.processor.mos6502.util.Program in project emuRox by rossdrew.
the class Mos6502Test method testSTA.
@Test
public void testSTA() {
Program program = new Program().with(LDA_I, 0xAA, STA_Z, 100);
memory.setBlock(0, program.getProgramAsByteArray());
processor.step(2);
Registers registers = processor.getRegisters();
assertEquals(program.getLength(), registers.getPC());
assertEquals(0xAA, memory.getByte(100));
}
use of com.rox.emu.processor.mos6502.util.Program in project emuRox by rossdrew.
the class Mos6502Test method testSTYAbsolute.
@Test
public void testSTYAbsolute() {
Program program = new Program().with(LDY_I, 0xAA, STY_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 testSTY.
@Test
public void testSTY() {
Program program = new Program().with(LDY_I, 0xAA, STY_Z, 100);
memory.setBlock(0, program.getProgramAsByteArray());
processor.step(2);
Registers registers = processor.getRegisters();
assertEquals(program.getLength(), registers.getPC());
assertEquals(0xAA, memory.getByte(100));
}
Aggregations