use of com.rox.emu.processor.mos6502.util.Mos6502Compiler in project emuRox by rossdrew.
the class Mos6502CompilerTest method testOversizedValue.
@Test
public void testOversizedValue() {
try {
final Mos6502Compiler compiler = new Mos6502Compiler("ADC " + VALUE_PREFIX + "12345");
Program program = compiler.compileProgram();
int[] bytes = program.getProgramAsByteArray();
fail("Argument size over " + 0xFFFF + " should throw an exception but was " + Arrays.toString(bytes));
} catch (UnknownOpCodeException e) {
assertFalse(e.getMessage().isEmpty());
assertFalse(e.getOpCode() == null);
}
}
use of com.rox.emu.processor.mos6502.util.Mos6502Compiler in project emuRox by rossdrew.
the class Mos6502CompilerTest method testDoubleDigitArgument.
@Test
public void testDoubleDigitArgument() {
OpCode.streamOf(AddressingMode.ZERO_PAGE).forEach((opcode) -> {
final Mos6502Compiler compiler = new Mos6502Compiler(opcode.getOpCodeName() + " " + VALUE_PREFIX + "AB");
Program program = compiler.compileProgram();
int[] bytes = program.getProgramAsByteArray();
assertArrayEquals("Output for '" + opcode.toString() + "' was wrong.", new int[] { opcode.getByteValue(), 0xAB }, bytes);
});
}
use of com.rox.emu.processor.mos6502.util.Mos6502Compiler in project emuRox by rossdrew.
the class Mos6502CompilerTest method testQuadrupleDigitArgument.
@Test
public void testQuadrupleDigitArgument() {
OpCode.streamOf(AddressingMode.ABSOLUTE).forEach((opcode) -> {
final Mos6502Compiler compiler = new Mos6502Compiler(opcode.getOpCodeName() + " " + VALUE_PREFIX + "ABCD");
Program program = compiler.compileProgram();
int[] bytes = program.getProgramAsByteArray();
assertArrayEquals("Output for '" + opcode.toString() + "' was wrong.", new int[] { opcode.getByteValue(), 0xAB, 0xCD }, bytes);
});
}
use of com.rox.emu.processor.mos6502.util.Mos6502Compiler in project emuRox by rossdrew.
the class Mos6502CompilerTest method testChainedTwoByteInstruction.
@Test
public void testChainedTwoByteInstruction() {
final Mos6502Compiler compiler = new Mos6502Compiler("LDA " + IMMEDIATE_VALUE_PREFIX + "47 SEC");
final Program program = compiler.compileProgram();
int[] bytes = program.getProgramAsByteArray();
int[] expected = new int[] { OpCode.LDA_I.getByteValue(), 0x47, OpCode.SEC.getByteValue() };
assertArrayEquals("Expected: " + Arrays.toString(expected) + ", Got: " + Arrays.toString(bytes), expected, bytes);
}
use of com.rox.emu.processor.mos6502.util.Mos6502Compiler in project emuRox by rossdrew.
the class Mos6502CompilerTest method testImpliedInstructions.
@Test
public void testImpliedInstructions() {
OpCode.streamOf(AddressingMode.IMPLIED).forEach((opcode) -> {
final Mos6502Compiler compiler = new Mos6502Compiler(opcode.getOpCodeName());
Program program = compiler.compileProgram();
int[] bytes = program.getProgramAsByteArray();
assertEquals("Wrong byte value for " + opcode.getOpCodeName() + "(" + opcode.getByteValue() + ")", opcode.getByteValue(), bytes[0]);
});
}
Aggregations