mirror of
https://github.com/RevCurtisP/C02.git
synced 2024-09-29 12:54:55 +00:00
Bug Fx: Modified bgnblk() and added to call when parsing CASE
This commit is contained in:
parent
9c49c61d44
commit
68aa3c1a8f
@ -9,7 +9,7 @@ char c;
|
|||||||
|
|
||||||
main:
|
main:
|
||||||
|
|
||||||
for (c=0; c<=9; c++) {
|
for (c=0; c<10; c++) {
|
||||||
prbyte(c);
|
prbyte(c);
|
||||||
putc(' ');
|
putc(' ');
|
||||||
select (c) {
|
select (c) {
|
||||||
@ -24,7 +24,7 @@ for (c=0; c<=9; c++) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
newlin();
|
newlin();
|
||||||
for (c=0; c<=9; c++) {
|
for (c=0; c<10; c++) {
|
||||||
prbyte(c);
|
prbyte(c);
|
||||||
putc(' ');
|
putc(' ');
|
||||||
select (c) {
|
select (c) {
|
||||||
@ -38,4 +38,20 @@ for (c=0; c<=9; c++) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
newlin();
|
||||||
|
for (c=$18; c<$23; c++) {
|
||||||
|
prbyte(c);
|
||||||
|
putc(' ');
|
||||||
|
select (c) {
|
||||||
|
case $18: putln("I'M EIGHTEEN!");
|
||||||
|
case $19:
|
||||||
|
putln("BREAK ONE-NINE");
|
||||||
|
if (c==$19) break;
|
||||||
|
putln("OOPS!");
|
||||||
|
case $22: putln("BLACKJACK!");
|
||||||
|
default: //putln("*");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
goto exit;
|
goto exit;
|
||||||
|
12
stmnt.c
12
stmnt.c
@ -92,11 +92,11 @@ void prcvar(char trmntr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Begin Program Block */
|
/* Begin Program Block */
|
||||||
void bgnblk(int blkflg)
|
void bgnblk(char blkchr)
|
||||||
{
|
{
|
||||||
DEBUG("Begining program block\n", 0);
|
DEBUG("Begining program block\n", 0);
|
||||||
if (blkflg) {
|
if (blkchr) {
|
||||||
expect('{');
|
expect(blkchr);
|
||||||
inblck = TRUE;
|
inblck = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -313,12 +313,13 @@ void pslct() {
|
|||||||
prsxpr(')'); //Parse Expression
|
prsxpr(')'); //Parse Expression
|
||||||
newlbl(endlbl); //Create New Label
|
newlbl(endlbl); //Create New Label
|
||||||
pshlbl(LTSLCT,endlbl); //Push Onto Stack
|
pshlbl(LTSLCT,endlbl); //Push Onto Stack
|
||||||
bgnblk(TRUE); //Check For and Begin Block
|
bgnblk('{'); //Require Beginning of Block
|
||||||
strcpy(xstmnt, "CASE"); //Require Next Statement to be CASE
|
strcpy(xstmnt, "CASE"); //Require Next Statement to be CASE
|
||||||
}
|
}
|
||||||
|
|
||||||
/* process end of case block */
|
/* process end of case block */
|
||||||
void ecase() {
|
void ecase() {
|
||||||
|
DEBUG("Processing end of CASE block\n", 0);
|
||||||
if (poplbl(cndlbl) != LTCASE)
|
if (poplbl(cndlbl) != LTCASE)
|
||||||
ERROR("%s not at end of CASE block\n", word, EXIT_FAILURE);
|
ERROR("%s not at end of CASE block\n", word, EXIT_FAILURE);
|
||||||
if (toplbl(endlbl) != LTSLCT)
|
if (toplbl(endlbl) != LTSLCT)
|
||||||
@ -347,7 +348,7 @@ void pcase() {
|
|||||||
fcase = 0;
|
fcase = 0;
|
||||||
continue; //Parse next argument
|
continue; //Parse next argument
|
||||||
}
|
}
|
||||||
expect(':'); //Emit branch to end of CASE block
|
bgnblk(':'); //Emit branch to end of CASE block
|
||||||
asmlin("BNE", cndlbl);
|
asmlin("BNE", cndlbl);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -481,6 +482,7 @@ void pstmnt()
|
|||||||
else
|
else
|
||||||
prssym();
|
prssym();
|
||||||
if (lblcnt && !inblck) {
|
if (lblcnt && !inblck) {
|
||||||
|
DEBUG("Ending implied block\n", 0);
|
||||||
if (poplbl() == LTDO)
|
if (poplbl() == LTDO)
|
||||||
pdowhl(); //Parse While at End of Do Loop
|
pdowhl(); //Parse While at End of Do Loop
|
||||||
}
|
}
|
||||||
|
2
vars.c
2
vars.c
@ -233,7 +233,7 @@ void addfnc()
|
|||||||
asmlin("STX", prmtrx); //Store Third Parameter
|
asmlin("STX", prmtrx); //Store Third Parameter
|
||||||
endlbl[0] = 0; //Create Dummy End Label
|
endlbl[0] = 0; //Create Dummy End Label
|
||||||
pshlbl(LTFUNC, endlbl); //and Push onto Stack
|
pshlbl(LTFUNC, endlbl); //and Push onto Stack
|
||||||
bgnblk(TRUE); //Start Program Block
|
bgnblk('{'); //Start Program Block
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (Check For and) Parse Variable Declaration*/
|
/* (Check For and) Parse Variable Declaration*/
|
||||||
|
Loading…
Reference in New Issue
Block a user