mirror of
https://github.com/RevCurtisP/C02.git
synced 2024-11-22 01:31:33 +00:00
a02 assembler: fixed error in hexadecimal evaluation
This commit is contained in:
parent
37b98c5d0b
commit
501944f525
13
a02.c
13
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;
|
||||
|
Loading…
Reference in New Issue
Block a user