use of com.rox.emu.UnknownOpCodeException in project emuRox by rossdrew.
the class Mos6502CompilerTest method testInvalidValuePrefix.
@Test
public void testInvalidValuePrefix() {
try {
final Mos6502Compiler compiler = new Mos6502Compiler("ADC @$10");
Program program = compiler.compileProgram();
int[] bytes = program.getProgramAsByteArray();
fail("Invalid value prefix 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.UnknownOpCodeException 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.UnknownOpCodeException in project emuRox by rossdrew.
the class DebuggerWindow method compile.
public void compile(String programText) {
final Mos6502Compiler compiler = new Mos6502Compiler(programText);
try {
final Program program = compiler.compileProgram();
final int[] programAsByteArray = program.getProgramAsByteArray();
loadProgram(programAsByteArray);
} catch (UnknownOpCodeException e) {
JOptionPane.showMessageDialog(this, e.getMessage());
}
}
use of com.rox.emu.UnknownOpCodeException in project emuRox by rossdrew.
the class Mos6502CompilerTest method testInvalidArgument.
@Test
public void testInvalidArgument() {
try {
final Mos6502Compiler compiler = new Mos6502Compiler("INC $12345");
Program program = compiler.compileProgram();
program.getProgramAsByteArray();
fail("The argument for INC is too long, should throw an error");
} catch (UnknownOpCodeException e) {
assertNotNull(e);
}
}
use of com.rox.emu.UnknownOpCodeException in project emuRox by rossdrew.
the class Mos6502CompilerTest method testInvalidIndirectIndexingMode.
@Test
public void testInvalidIndirectIndexingMode() {
try {
final Mos6502Compiler compiler = new Mos6502Compiler("ADC " + INDIRECT_PREFIX + "10(");
Program program = compiler.compileProgram();
int[] bytes = program.getProgramAsByteArray();
fail("Invalid prefix for an indirect value should throw an exception but was " + Arrays.toString(bytes));
} catch (UnknownOpCodeException e) {
assertFalse(e.getMessage().isEmpty());
assertFalse(e.getOpCode() == null);
}
}
Aggregations