use of com.rox.emu.processor.mos6502.op.OpCode in project emuRox by rossdrew.
the class Mos6502CompilerTest method testAccumulatorInstructions.
@Property
public void testAccumulatorInstructions(@InRange(min = "0", max = "255") int byteValue) {
final String hexByte = Integer.toHexString(byteValue);
OpCode.streamOf(AddressingMode.ACCUMULATOR).forEach((opcode) -> {
final Mos6502Compiler compiler = new Mos6502Compiler(opcode.getOpCodeName() + " " + ACCUMULATOR_PREFIX + hexByte);
Program program = compiler.compileProgram();
int[] bytes = program.getProgramAsByteArray();
assertArrayEquals("Output for '" + opcode.toString() + "' was wrong.", new int[] { opcode.getByteValue(), byteValue }, bytes);
});
}
use of com.rox.emu.processor.mos6502.op.OpCode in project emuRox by rossdrew.
the class Mos6502CompilerTest method testZeroPageInstructions.
@Property
public void testZeroPageInstructions(@InRange(min = "0", max = "255") int byteValue) {
final String hexByte = Integer.toHexString(byteValue);
OpCode.streamOf(AddressingMode.ZERO_PAGE).forEach((opcode) -> {
final Mos6502Compiler compiler = new Mos6502Compiler(opcode.getOpCodeName() + " " + VALUE_PREFIX + hexByte);
Program program = compiler.compileProgram();
int[] bytes = program.getProgramAsByteArray();
assertArrayEquals("Output for '" + opcode.toString() + "' was wrong.", new int[] { opcode.getByteValue(), byteValue }, bytes);
});
}
use of com.rox.emu.processor.mos6502.op.OpCode in project emuRox by rossdrew.
the class Mos6502CompilerTest method testZeroPageYInstructions.
@Property
public void testZeroPageYInstructions(@InRange(min = "0", max = "255") int byteValue) {
final String hexByte = Integer.toHexString(byteValue);
OpCode.streamOf(AddressingMode.ZERO_PAGE_Y).forEach((opcode) -> {
final Mos6502Compiler compiler = new Mos6502Compiler(opcode.getOpCodeName() + " " + VALUE_PREFIX + hexByte + ",Y");
Program program = compiler.compileProgram();
int[] bytes = program.getProgramAsByteArray();
assertArrayEquals("Output for '" + opcode.toString() + "' was wrong.", new int[] { opcode.getByteValue(), byteValue }, bytes);
});
}
use of com.rox.emu.processor.mos6502.op.OpCode in project emuRox by rossdrew.
the class Mos6502CompilerTest method testAbsoluteXInstructions.
@Property
public void testAbsoluteXInstructions(@InRange(min = "256", max = "65535") int wordValue) {
final String hexWord = Integer.toHexString(wordValue);
final int highByte = (wordValue >> 8) & 0xFF;
final int lowByte = wordValue & 0xFF;
OpCode.streamOf(AddressingMode.ABSOLUTE_X).forEach((opcode) -> {
final Mos6502Compiler compiler = new Mos6502Compiler(opcode.getOpCodeName() + " " + VALUE_PREFIX + hexWord + ",X");
Program program = compiler.compileProgram();
int[] bytes = program.getProgramAsByteArray();
assertArrayEquals("Output for '" + opcode.toString() + " 0x" + hexWord + "' was wrong.", new int[] { opcode.getByteValue(), highByte, lowByte }, bytes);
});
}
use of com.rox.emu.processor.mos6502.op.OpCode in project emuRox by rossdrew.
the class Mos6502CompilerTest method testIndirectXInstructions.
@Property
public void testIndirectXInstructions(@InRange(min = "0", max = "255") int byteValue) {
final String hexByte = Integer.toHexString(byteValue);
OpCode.streamOf(AddressingMode.INDIRECT_X).forEach((opcode) -> {
final Mos6502Compiler compiler = new Mos6502Compiler(opcode.getOpCodeName() + " (" + VALUE_PREFIX + hexByte + ",X)");
Program program = compiler.compileProgram();
int[] bytes = program.getProgramAsByteArray();
assertArrayEquals(new int[] { opcode.getByteValue(), byteValue }, bytes);
});
}
Aggregations