retro-extend(1) better error message on invalid instructions
FossilOrigin-Name: e79f2ee0c8ff46f0f6537fd820188e517c06a28bc0429576ee2bde0baddd13de
This commit is contained in:
parent
e89789839b
commit
3aa560c9dc
1 changed files with 10 additions and 2 deletions
|
@ -261,7 +261,7 @@ void update_rx() {
|
||||||
/* The `execute` function runs a word in the Retro image. */
|
/* The `execute` function runs a word in the Retro image. */
|
||||||
|
|
||||||
void execute(CELL cell) {
|
void execute(CELL cell) {
|
||||||
CELL opcode;
|
CELL opcode, a, i;
|
||||||
rp = 1;
|
rp = 1;
|
||||||
ip = cell;
|
ip = cell;
|
||||||
while (ip < IMAGE_SIZE) {
|
while (ip < IMAGE_SIZE) {
|
||||||
|
@ -272,7 +272,15 @@ void execute(CELL cell) {
|
||||||
if (ngaValidatePackedOpcodes(opcode) != 0) {
|
if (ngaValidatePackedOpcodes(opcode) != 0) {
|
||||||
ngaProcessPackedOpcodes(opcode);
|
ngaProcessPackedOpcodes(opcode);
|
||||||
} else {
|
} else {
|
||||||
printf("Invalid instruction!\n");
|
printf("\nERROR: Invalid instruction!\n");
|
||||||
|
printf("At %lld, opcode %lld\n", (long long)ip, (long long)opcode);
|
||||||
|
printf("Instructions: ");
|
||||||
|
a = opcode;
|
||||||
|
for (i = 0; i < 4; i++) {
|
||||||
|
printf("%lldd ", (long long)a & 0xFF);
|
||||||
|
a = a >> 8;
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
ip++;
|
ip++;
|
||||||
|
|
Loading…
Reference in a new issue