1
0
mirror of https://github.com/RevCurtisP/C02.git synced 2024-09-27 14:56:27 +00:00

Allow Modifiers in Header File and Pointer DeRefs in Function Calls

This commit is contained in:
Curtis F Kaylor 2019-11-14 23:57:49 -05:00
parent 0e4495d9cf
commit 24ba4b6dfd
3 changed files with 13 additions and 8 deletions

View File

@ -197,7 +197,7 @@ void prcadr(int adract, char* symbol) {
/* Parse and Compile Address of Operator *
* Args: adract = Address Action */
void prsadr(int adract) {
DEBUG("Parsing address\n", 0)
DEBUG("expr.prsadr: Parsing address\n", 0)
if (isnpre()) prsnum(0xFFFF);
else {
getwrd();
@ -228,7 +228,7 @@ void prsstr(int adract, int alwstr) {
* Args: adract = Address Action *
* alwstr = Allow String */
int chkadr(int adract, int alwstr) {
DEBUG("Checking for Address or String\n", 0)
DEBUG("expr.chkadr: Checking for Address or String\n", 0)
int result = TRUE;
if (look('&')) prsadr(adract);
else if (match('"')) prsstr(adract, alwstr);
@ -257,7 +257,9 @@ void prsbop(void) {
/* Parse Function Argument or Return Values */
void prsfpr(char trmntr) {
int pusha = 0; int pushy = 0; //A and Y Arguments Pushed
if (!chkadr(ADLDYX, TRUE) && isxpre() || match('.')) {
DEBUG("expr.prsfpr: Parsing Function Argument or Return Values\n", 0)
if (!chkadr(ADLDYX, TRUE) && !match(')')) {
DEBUG("expr.prsfpr: Parsing Accumulator Expression\n", 0);
if (look('.')) pusha = 255;
else {if (prsxpf(0)) goto prsfne;}
if (look(',') && !chkadr(ADLDYX, TRUE)) {
@ -412,6 +414,7 @@ void prsxpr(char trmntr) {
/* Parse and compile function parameter expression *
* Returns: TRUE if Integer Expression */
int prsxpf(char trmntr) {
DEBUG("expr.prsxpf: Parsing Function Expression\n", 0)
return prsxpp(trmntr, TRUE);
}

View File

@ -177,7 +177,7 @@ void pincdr(void) {
void phdwrd(void) {
getwrd();
if (match(':')) prslab();
else if (!ptype(MTNONE))
else if (!pmodfr() && !ptype(MTNONE))
ERROR("Unexpected word '%s' in header\n", word, EXIT_FAILURE)
}

View File

@ -270,10 +270,12 @@ void addvar(int m, int t) {
if (fndvar(vrname)) ERROR("Duplicate declaration of variable '%s\n", vrname, EXIT_FAILURE)
if (t == VTVOID) ERROR("Illegal Variable Type\n", 0, EXIT_FAILURE)
if (m & MTZP) {
setlbl(vrname);
sprintf(word, "$%hhX", zpaddr++);
if (t == VTINT) zpaddr++; //int uses two bytes
asmlin(EQUOP, word);
if (alcvar) {
setlbl(vrname);
sprintf(word, "$%hhX", zpaddr++);
if (t == VTINT) zpaddr++; //int uses two bytes
asmlin(EQUOP, word);
}
strcpy(value, "*"); //Set Variable to Non Allocated
}
else if (m & MTALS) {