use of com.rox.emu.processor.mos6502.util.Program in project emuRox by rossdrew.
the class Mos6502Test method testInvalidOpCode.
@Test
public void testInvalidOpCode() {
Program program = new Program().with(231);
memory.setBlock(0, program.getProgramAsByteArray());
try {
processor.step();
fail("Invalid opCode exception expected!");
} catch (UnknownOpCodeException e) {
assertEquals("231", e.getOpCode());
}
}
use of com.rox.emu.processor.mos6502.util.Program in project emuRox by rossdrew.
the class Mos6502Test method testOR.
@Test
public void testOR() {
Program program = new Program().with(LDA_I, 0b00010101, ORA_I, 0b00000101);
memory.setBlock(0, program.getProgramAsByteArray());
processor.step(2);
Registers registers = processor.getRegisters();
assertEquals(0b00010101, registers.getRegister(Registers.Register.ACCUMULATOR));
assertEquals(program.getLength(), registers.getPC());
assertEquals(0x0, 0);
}
use of com.rox.emu.processor.mos6502.util.Program in project emuRox by rossdrew.
the class Mos6502Test method testBVS.
@Test
public void testBVS() {
Program program = new Program().with(LDA_I, 0x50, ADC_I, 0x50, BVS, 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(0xA0, 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 testTSX.
@Test
public void testTSX() {
Program program = new Program().with(TSX);
memory.setBlock(0, program.getProgramAsByteArray());
Registers registers = processor.getRegisters();
processor.step();
assertEquals(program.getLength(), registers.getPC());
assertEquals(0xFF, registers.getRegister(Registers.Register.X_INDEX));
}
use of com.rox.emu.processor.mos6502.util.Program in project emuRox by rossdrew.
the class Mos6502Test method testJSR.
@Test
public void testJSR() {
Program program = new Program().with(JSR, 0x02, 0x0F);
memory.setBlock(0, program.getProgramAsByteArray());
Registers registers = processor.getRegisters();
processor.step(1);
assertEquals(0x020F, registers.getPC());
// Jump address
assertEquals(0x02, registers.getRegister(Registers.Register.PROGRAM_COUNTER_HI));
assertEquals(0x0F, registers.getRegister(Registers.Register.PROGRAM_COUNTER_LOW));
// Return address
assertEquals(0x00, memory.getByte(0x1FF));
assertEquals(0x03, memory.getByte(0x1FE));
}
Aggregations