mirror of https://github.com/RevCurtisP/C02.git
Changed placeholder from asterisk to question mark
This commit is contained in:
parent
e30d98b9a6
commit
e87b4e9b44
|
@ -119,7 +119,7 @@ void prscnd(char trmntr, int revrse) {
|
|||
revcmp = revrse;
|
||||
if (look('!')) revcmp = (revcmp) ? FALSE: TRUE;
|
||||
DEBUG("Set REVCMP to %d\n", revcmp)
|
||||
if (!look('*')) prsxpr(0);
|
||||
if (!look('?')) prsxpr(0);
|
||||
if (look(':')) prsflg(revcmp); //Parse Flag Operator
|
||||
else prscmp(revcmp); //Parse Comparison Operator
|
||||
prslop(); //Parse Logical Operator
|
||||
|
|
|
@ -38,8 +38,8 @@ void addfnc(void) {
|
|||
prmtry[0] = 0;
|
||||
prmtrx[0] = 0;
|
||||
skpspc(); //Skip Spaces
|
||||
if (isalph() || match('*')) { //Parse Parameters
|
||||
if (!look('*')) {if (addprm(prmtra)) goto addfne;} //Get First Parameter
|
||||
if (isalph() || match('?')) { //Parse Parameters
|
||||
if (!look('?')) {if (addprm(prmtra)) goto addfne;} //Get First Parameter
|
||||
if (look(',')) { //Look for Comma
|
||||
if (addprm(prmtry)) goto addfne; //Get Second Parameter
|
||||
if (look(',')) { //Look for Comma
|
||||
|
@ -85,7 +85,7 @@ void penum(int m, int bitmsk) {
|
|||
expect('{');
|
||||
do {
|
||||
if (enmval > 0xFF) ERROR("Maximum ENUM or BITMASK value exceeded\n", 0, EXIT_FAILURE)
|
||||
if (look('*'))
|
||||
if (look('?'))
|
||||
DEBUG("Skipping sequence %d\n", enmval)
|
||||
else {
|
||||
getwrd(); //get defined identifier
|
||||
|
|
|
@ -186,10 +186,10 @@ int chkadr(int adract, int alwstr) {
|
|||
|
||||
/* Parse Function Parameters or Return Values */
|
||||
void prsfpr(char trmntr) {
|
||||
if (!chkadr(ADLDYX, TRUE) && isxpre() || match('*')) {
|
||||
if (!look('*')) {if (prsxpf(0)) goto prsfne;}
|
||||
if (!chkadr(ADLDYX, TRUE) && isxpre() || match('?')) {
|
||||
if (!look('?')) {if (prsxpf(0)) goto prsfne;}
|
||||
if (look(',') && !chkadr(ADLDYX, TRUE)) {
|
||||
if (!look('*')) {
|
||||
if (!look('?')) {
|
||||
if (prstrm(TRUE)) goto prsfne;
|
||||
asmlin("LDY", term);
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
int match(char c) {return TF(nxtchr == c);}
|
||||
int inbtwn(char mn, char mx) {return TF(nxtupc >= mn && nxtupc <= mx);}
|
||||
int isalph(void) {return isalpha(nxtchr);}
|
||||
int isalst(void) {return TF(isalph() || match('*'));}
|
||||
int isanum(void) {return isalnum(nxtchr);}
|
||||
int isapos(void) {return match('\'');}
|
||||
int isbin(void) {return inbtwn('0', '1');}
|
||||
|
|
|
@ -25,7 +25,6 @@ int mskasc; //Set High Bit Flag
|
|||
|
||||
int match(char c); //Does Next Character match c
|
||||
int isalph(); //Is Next Character Alphabetic
|
||||
int isalst(); //Is Next Character Alpha or Asterisk
|
||||
int isanum(); //Is Next Character AlphaNumeric
|
||||
int isapos(); //Is Next Character an Apostrophe
|
||||
int isbin(); //Is Next Character a Binary Digit
|
||||
|
|
|
@ -343,7 +343,7 @@ void pinlne(void) {
|
|||
void ppop(void) {
|
||||
DEBUG("Parsing POP statement\n", 0)
|
||||
do {
|
||||
if (look('*')) term[0]=0;
|
||||
if (look('?')) term[0]=0;
|
||||
else {
|
||||
reqvar(TRUE);
|
||||
strcpy(term, value);
|
||||
|
|
|
@ -56,7 +56,7 @@ do {
|
|||
putln("PRTWRD()");
|
||||
do {
|
||||
j = i ^ $FF;
|
||||
putwrd(*,i,j);
|
||||
putwrd(?,i,j);
|
||||
putc(':');
|
||||
i++;
|
||||
if (!i&3) newlin();
|
||||
|
|
|
@ -79,28 +79,28 @@ puts("Pushing Array onto Stack\t");
|
|||
puts("stkpsh(@r,$r)\t");
|
||||
aa,hi,lo=stkptr(); //Save Stack Pointer
|
||||
f=stkpsh(@r,&r); printf(f,"bytes=%d:");
|
||||
setdst(*,hi,lo); g=(memcmp(@r, &r)==0) ? #TRUE : #FALSE;
|
||||
setdst(?,hi,lo); g=(memcmp(@r, &r)==0) ? #TRUE : #FALSE;
|
||||
psorfl(f & g); chksiz(#TRUE, &5); chkptr(&$8004);
|
||||
|
||||
puts("Duplicating Top of Stack\t");
|
||||
puts("stkdup()\t");
|
||||
aa,hi,lo=stkptr(); //Save Stack Pointer
|
||||
f=stkdup(); printf(f,"bytes=%d:");
|
||||
setdst(*,hi,lo); g=(memcmp(@r, &r)==0) ? #TRUE : #FALSE;
|
||||
setdst(?,hi,lo); g=(memcmp(@r, &r)==0) ? #TRUE : #FALSE;
|
||||
psorfl(f & g); chksiz(#TRUE, &10); chkptr(&$8009);
|
||||
|
||||
puts("Pushing String onto Stack\t");
|
||||
puts("stkstr(&s)\t");
|
||||
aa,hi,lo=stkptr(); //Save Stack Pointer
|
||||
f=stkstr(&s); printf(f,"bytes=%d:");
|
||||
setdst(*,hi,lo); g=(strcmp(&s)==0) ? #TRUE : #FALSE;
|
||||
setdst(?,hi,lo); g=(strcmp(&s)==0) ? #TRUE : #FALSE;
|
||||
psorfl(f & g); chksiz(#TRUE, &23); chkptr(&$8016);
|
||||
|
||||
puts("Duplicating Second Stack Entry\t");
|
||||
puts("stkovr()\t");
|
||||
aa,hi,lo=stkptr(); //Save Stack Pointer
|
||||
f=stkovr(); printf(f,"bytes=%d:");
|
||||
setdst(*,hi,lo); g=(memcmp(@r, &r)==0) ? #TRUE : #FALSE;
|
||||
setdst(?,hi,lo); g=(memcmp(@r, &r)==0) ? #TRUE : #FALSE;
|
||||
psorfl(f & g); chksiz(#TRUE, &28); chkptr(&$801B);
|
||||
|
||||
c = anykey(); if (c == #esckey) goto exit;
|
||||
|
|
|
@ -25,13 +25,13 @@ main:
|
|||
|
||||
for (i=0;i<$20;i++) srclo[i]=0; //Initialize Pointers
|
||||
|
||||
puts("Setting Stack Start Address\t");
|
||||
puts("stkbgn($7FFF)\t");
|
||||
putln("SETTING STACK START");
|
||||
putln(" STKBGN(&$7FFF)");
|
||||
stkbgn(&$7FFF); lo=stkslo; hi=stkshi;
|
||||
setdst("stks"); cklohi(&$7FFF);
|
||||
|
||||
puts("Setting Stack End Address\t");
|
||||
puts("stkend($807E)\t");
|
||||
putln("SETTING STACK END");
|
||||
putln(" STKEND(&$807E)\t");
|
||||
stkend(&$807E); lo=stkelo; hi=stkehi;
|
||||
setdst("stke"); cklohi(&$807E);
|
||||
|
||||
|
@ -45,14 +45,14 @@ puts("Pushing Array onto Stack\t");
|
|||
puts("stkpsh(@r,$r)\t");
|
||||
aa,hi,lo=stkptr(); //Save Stack Pointer
|
||||
f=stkpsh(@r,&r); printf(f,"bytes=%d:");
|
||||
setdst(*,hi,lo); g=(memcmp(@r, &r)==0) ? #TRUE : #FALSE;
|
||||
setdst(?,hi,lo); g=(memcmp(@r, &r)==0) ? #TRUE : #FALSE;
|
||||
psorfl(f & g); chksiz(#TRUE, &5); chkptr(&$8004);
|
||||
|
||||
puts("Pushing String onto Stack\t");
|
||||
puts("stkstr(&s)\t");
|
||||
aa,hi,lo=stkptr(); //Save Stack Pointer
|
||||
f=stkstr(&s); printf(f,"bytes=%d:");
|
||||
setdst(*,hi,lo); g=(strcmp(&s)==0) ? #TRUE : #FALSE;
|
||||
setdst(?,hi,lo); g=(strcmp(&s)==0) ? #TRUE : #FALSE;
|
||||
psorfl(f & g); chksiz(#TRUE, &18); chkptr(&$8011);
|
||||
|
||||
puts("Swapping Top and Second Entry\t");
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
/***********************************
|
||||
* TESTUTIL - Test util.h02 module *
|
||||
***********************************/
|
||||
|
||||
|
||||
//use -h option on command line
|
||||
#include <stddef.h02>
|
||||
#include <stdlib.h02>
|
||||
#include <stdio.h02>
|
||||
#include <stdiox.h02>
|
||||
#include <string.h02>
|
||||
#include <util.h02>
|
||||
|
||||
char addlo,addhi; //Value to Add
|
||||
char chklo,chkhi; //Expected Result
|
||||
char retlo,rethi; //Returned Value
|
||||
|
||||
char i; //Loop Variable
|
||||
|
||||
main:
|
||||
|
||||
putln("TESTING ADDDST");
|
||||
|
||||
addlo = 0; addhi = 0; //Clear Added Value
|
||||
chklo = 0; chkhi = 0; //Clear Expected Result
|
||||
setdst(?,chkhi,chklo); //and Destination Pointer
|
||||
|
||||
for (i=0; i<16; i++) {
|
||||
addlo = addlo | 1; //Set bit 0
|
||||
chklo = chklo + addlo; //Add Low Byte
|
||||
//How do I check for carry???
|
||||
}
|
||||
|
||||
anykey();
|
||||
|
||||
goto exit;
|
|
@ -10,10 +10,10 @@
|
|||
|
||||
enum {SOLO};
|
||||
enum {ZERO, ONE, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE, TEN};
|
||||
enum {*, FIRST, SECOND, THIRD};
|
||||
enum {?, FIRST, SECOND, THIRD};
|
||||
bitmask {BLUE, GREEN, RED, BRIGHT, INVERT, BLINK, FLIP, BKGRND};
|
||||
bitmask {RD, RTS, DTR, RI, CD, *, CTS, DSR};
|
||||
bitmask {HNDSHK, *, *, *, DUPLEX};
|
||||
bitmask {RD, RTS, DTR, RI, CD, ?, CTS, DSR};
|
||||
bitmask {HNDSHK, ?, ?, ?, DUPLEX};
|
||||
|
||||
const char b = {#TRUE, #FALSE};
|
||||
char c, i;
|
||||
|
|
|
@ -53,10 +53,10 @@ testfn(prchr(b));
|
|||
testfn(b,c,d);
|
||||
testfn(b+c+d,r[i],f);
|
||||
testfn(&s); //Print a String
|
||||
dofn(*,yy);
|
||||
dofn(*,yy,xx);
|
||||
dofn(aa,*,xx);
|
||||
dofn(*,*,XX);
|
||||
dofn(?,yy);
|
||||
dofn(?,yy,xx);
|
||||
dofn(aa,?,xx);
|
||||
dofn(?,?,XX);
|
||||
|
||||
|
||||
funcyx:
|
||||
|
|
|
@ -31,13 +31,13 @@ d = fnd(b,c);
|
|||
i = fni(c);
|
||||
j = fnj(b,c);
|
||||
|
||||
int fnb(*,yy,xx) {
|
||||
return *,xx,yy;
|
||||
int fnb(?,yy,xx) {
|
||||
return ?,xx,yy;
|
||||
}
|
||||
|
||||
int fnd(aa,yy,xx) {
|
||||
if (aa) return *,xx,yy;
|
||||
else return *,yy,xx;
|
||||
if (aa) return ?,xx,yy;
|
||||
else return ?,yy,xx;
|
||||
}
|
||||
|
||||
int fni(yx) {
|
||||
|
|
|
@ -28,6 +28,15 @@ const char m = {"mixed", 1, "const", 2, "array", 3};
|
|||
char aa,xx,yy ; //Function parameter variables
|
||||
char STROBE; //Strobe Register
|
||||
|
||||
/* Aliased Variables */
|
||||
alias char zp = $80; //aliased to zero page
|
||||
alias char via = $D000; //aliased to i/o mapped device
|
||||
alias char cc = c; //aliased to variable
|
||||
alias char rr = r; //aliased to array
|
||||
|
||||
/* Aliased Function */
|
||||
//alias void chrout() = $F000; //aliased to ROM routine
|
||||
|
||||
/* Function Declaration */
|
||||
char myfunc();
|
||||
return b-c-d;
|
||||
|
@ -94,10 +103,10 @@ testfn(prchr(b));
|
|||
testfn(b,c,d);
|
||||
testfn(b+c+d,r[i],f);
|
||||
testfn(&s); //Print a String
|
||||
dofn(*,yy);
|
||||
dofn(*,yy,xx);
|
||||
dofn(aa,*,xx);
|
||||
dofn(*,*,XX);
|
||||
dofn(?,yy);
|
||||
dofn(?,yy,xx);
|
||||
dofn(aa,?,xx);
|
||||
dofn(?,?,XX);
|
||||
|
||||
/*
|
||||
defs:
|
||||
|
@ -118,6 +127,8 @@ here: if (getkey() & $7F == $1B) goto exit;
|
|||
|
||||
there: goto flwctl;
|
||||
|
||||
goto &$C000;
|
||||
|
||||
if (#TRUE) putln("TRUE");
|
||||
else if (#FALSE) putln("FALSE");
|
||||
|
||||
|
@ -170,7 +181,7 @@ void vdfnc3(aa, yy, xx) {
|
|||
|
||||
push &s, b+c+d, r[i];
|
||||
stkfnc(); //Push/Pop Parameters
|
||||
pop d, *, z[f];
|
||||
pop d, ?, z[f];
|
||||
|
||||
|
||||
iprint(); inline "Hello World";
|
||||
|
|
Loading…
Reference in New Issue