From 929fa2976ce0459537c274778ac10bdf314cccf0 Mon Sep 17 00:00:00 2001 From: Curtis F Kaylor Date: Sat, 17 Oct 2020 22:19:30 -0400 Subject: [PATCH] Fixed >> on char variables, < and > operators in function calls --- src/c02.c | 7 +++---- src/common.h | 2 +- src/parse.c | 8 ++++---- test/{teststk.c02 => stktest.c02} | 0 4 files changed, 8 insertions(+), 9 deletions(-) rename test/{teststk.c02 => stktest.c02} (100%) diff --git a/src/c02.c b/src/c02.c index 41dc609..840c51e 100644 --- a/src/c02.c +++ b/src/c02.c @@ -89,7 +89,7 @@ void pdrctv(void) { void prolog(void) { DEBUG("c02.prolog: Writing Assembly Prolog\n", 0) - asmlin(CPUOP,cputyp); + if (strlen(cputyp)) asmlin(CPUOP,cputyp); setcmt("Program "); addcmt(srcnam); cmtlin(); @@ -193,9 +193,8 @@ void pargs(int argc, char *argv[]) { * Uses: cputype * * Sets: cmos */ void chkcpu(void) { - if (strcmp(cputyp, "6502") == 0) cmos = FALSE; - else if (strcmp(cputyp, "65C02") == 0) cmos = TRUE; - else ERROR("Invalid CPU Type %s\n", cputyp, EXIT_FAILURE) + if (strcmp(cputyp, "65C02") == 0) cmos = TRUE; + else cmos = FALSE; } diff --git a/src/common.h b/src/common.h index 21b4f99..3b412b8 100644 --- a/src/common.h +++ b/src/common.h @@ -26,7 +26,7 @@ #define LOCPFX "." //Local Variable Prefix #define CPUOP "PROCESSOR" //Target CPU Pseudo-Operator -#define CPUARG "6502" //Target CPU Operand +#define CPUARG "" //Target CPU Operand #define ORGOP "ORG" //Origin Pseudo-Op #define EQUOP "EQU" //Equate Pseudo-Op #define BYTEOP "BYTE" //Define Byte Pseudo-Op diff --git a/src/parse.c b/src/parse.c index 00449e6..aace269 100644 --- a/src/parse.c +++ b/src/parse.c @@ -38,7 +38,7 @@ int isspc(void) {return isspace(nxtchr);} int isszop(void) {return match('@');} int isvpre(void) {return TF(isalph() || islpre());} int isxfop(void) {return match('?');} -int isxpre(void) {return TF(isvpre() || match('-') || match('*'));} +int isxpre(void) {return TF(isvpre() || isbtop() || match('-') || match('*'));} /* Process ASCII Character */ char prcchr(char c) { @@ -375,7 +375,7 @@ void poperr(char* name) { /* Process Post Operator */ void prcpst(int isint, char* name, char *index, char indtyp, char ispntr) { - DEBUG("parse.prcpst: Processing post operation '%c'\n", oper) + DEBUG("parse.prcpst: Processing post operation '%c\n'", oper) if (ispntr) ERROR("Post Operation on dereferenced pointer %s not supported\n", name, EXIT_FAILURE) //sprintf(word,"(%s),Y", name); strcpy(name, word); } char name1[VARLEN+3]; @@ -429,8 +429,8 @@ void prcpst(int isint, char* name, char *index, char indtyp, char ispntr) { else if (strcmp(name, "Y")==0) poperr(name); //Index Register Shift not Supported else if (strcmp(name, "A")==0) asmlin("LSR", ""); else { - asmlin("LSR", name); - if (isint) asmlin("ROR", name1); + if (isint) {asmlin("LSR", name1); asmlin("ROR", name);} + else asmlin("LSR", name); } break; default: diff --git a/test/teststk.c02 b/test/stktest.c02 similarity index 100% rename from test/teststk.c02 rename to test/stktest.c02