use of com.rox.emu.processor.mos6502.util.Program in project emuRox by rossdrew.
the class Mos6502Test method testCPY.
@Test
public void testCPY() {
Program program = new Program().with(LDY_I, 0x10, CPY_I, 0x10);
memory.setBlock(0, program.getProgramAsByteArray());
Registers registers = processor.getRegisters();
processor.step(2);
assertEquals(program.getLength(), registers.getPC());
assertEquals(0x10, registers.getRegister(Registers.Register.Y_INDEX));
assertEquals(true, registers.getFlag(Registers.Flag.ZERO));
assertEquals(false, registers.getFlag(Registers.Flag.NEGATIVE));
assertEquals(true, registers.getFlag(Registers.Flag.CARRY));
}
use of com.rox.emu.processor.mos6502.util.Program in project emuRox by rossdrew.
the class Mos6502Test method testCLD.
@Test
public void testCLD() {
Program program = new Program().with(CLD);
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, 0b00001000);
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 testSTX.
@Test
public void testSTX() {
Program program = new Program().with(LDX_I, 0xAA, STX_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 testBCS.
@Test
public void testBCS() {
Program program = new Program().with(SEC, BCS, 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));
}
use of com.rox.emu.processor.mos6502.util.Program in project emuRox by rossdrew.
the class Mos6502Test method testBIT.
@Test
public void testBIT() {
Program program = new Program().with(LDA_I, 0x01, STA_Z, 0x20, LDA_I, 0x01, BIT_Z, 0x20);
memory.setBlock(0, program.getProgramAsByteArray());
Registers registers = processor.getRegisters();
processor.step(4);
assertEquals(program.getLength(), registers.getPC());
assertEquals(true, registers.getFlag(Registers.Flag.ZERO));
assertEquals(false, registers.getFlag(Registers.Flag.NEGATIVE));
assertEquals(false, registers.getFlag(Registers.Flag.OVERFLOW));
}
Aggregations