diff --git a/a02.c b/a02.c index cdc9338..d019911 100644 --- a/a02.c +++ b/a02.c @@ -67,8 +67,15 @@ void usage(char* appnam) { exit(EXIT_FAILURE); } +/* Print Error Dump Info */ +void xdump(void) { + puts("Error Dump"); + oprnd[opridx]=0; printf("Operand: %s\n", oprnd); +} + /* Print Error Message and Exit */ void xerror(char* format, char *s) { + if (debug) xdump(); if (lineno) fprintf(stderr, "%04d: ", lineno); fprintf(stderr, format, s); exit(EXIT_FAILURE); @@ -182,7 +189,7 @@ int evlbin() { return result; } -/* Evaluate Binary Number */ +/* Evaluate Character Constant */ int evlchr() { int result = 0; cpychr('\''); @@ -207,7 +214,7 @@ int evlhex() { int result = 0; cpychr('$'); while (isxdigit(*linptr)) { - int digit = *linptr - '0'; + int digit = toupper(*linptr) - '0'; if (digit > 9) digit = digit - 7; result = (result << 4) + digit; cpychr(0); @@ -333,7 +340,7 @@ void asmwrd(void) { } while (cpychr(',')); } -/* Assemble FILL Pseudo-Op */ +/* Assemble ALIGN Pseudo-Op */ void asmaln(void) { if (debug) puts("Assembling ALIGN Pseudo-Op"); int size = evlopd(0xFFFF); if (size < 2) return; diff --git a/a02.h b/a02.h index 4c3e011..db2889c 100644 --- a/a02.h +++ b/a02.h @@ -22,7 +22,7 @@ #define INDCY 0x0800 //(Indirect),Y #define RELTV 0x1000 //Relative -char zpgabs[][] = {"Absolute", "ZeroPage"}; +char zpgabs[][9] = {"Absolute", "ZeroPage"}; struct amd {int amode; char desc[12];}; struct amd amdesc[] = {