diff --git a/c02.exe b/c02.exe index cc9eb5b..b39aaab 100644 Binary files a/c02.exe and b/c02.exe differ diff --git a/c02.tag b/c02.tag index be475c3..bd7fe93 100644 Binary files a/c02.tag and b/c02.tag differ diff --git a/py65/testslct.c02 b/py65/testslct.c02 index e3d5872..512b47f 100644 --- a/py65/testslct.c02 +++ b/py65/testslct.c02 @@ -9,7 +9,7 @@ char c; main: -for (c=0; c<=9; c++) { +for (c=0; c<10; c++) { prbyte(c); putc(' '); select (c) { @@ -24,7 +24,7 @@ for (c=0; c<=9; c++) { } newlin(); -for (c=0; c<=9; c++) { +for (c=0; c<10; c++) { prbyte(c); putc(' '); 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; diff --git a/stmnt.c b/stmnt.c index 2c44952..aa74ef3 100644 --- a/stmnt.c +++ b/stmnt.c @@ -92,11 +92,11 @@ void prcvar(char trmntr) } /* Begin Program Block */ -void bgnblk(int blkflg) +void bgnblk(char blkchr) { DEBUG("Begining program block\n", 0); - if (blkflg) { - expect('{'); + if (blkchr) { + expect(blkchr); inblck = TRUE; } else @@ -313,12 +313,13 @@ void pslct() { prsxpr(')'); //Parse Expression newlbl(endlbl); //Create New Label 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 } /* process end of case block */ void ecase() { + DEBUG("Processing end of CASE block\n", 0); if (poplbl(cndlbl) != LTCASE) ERROR("%s not at end of CASE block\n", word, EXIT_FAILURE); if (toplbl(endlbl) != LTSLCT) @@ -347,7 +348,7 @@ void pcase() { fcase = 0; continue; //Parse next argument } - expect(':'); //Emit branch to end of CASE block + bgnblk(':'); //Emit branch to end of CASE block asmlin("BNE", cndlbl); break; } @@ -481,6 +482,7 @@ void pstmnt() else prssym(); if (lblcnt && !inblck) { + DEBUG("Ending implied block\n", 0); if (poplbl() == LTDO) pdowhl(); //Parse While at End of Do Loop } diff --git a/vars.c b/vars.c index a97ab7d..697cbc1 100644 --- a/vars.c +++ b/vars.c @@ -233,7 +233,7 @@ void addfnc() asmlin("STX", prmtrx); //Store Third Parameter endlbl[0] = 0; //Create Dummy End Label pshlbl(LTFUNC, endlbl); //and Push onto Stack - bgnblk(TRUE); //Start Program Block + bgnblk('{'); //Start Program Block } /* (Check For and) Parse Variable Declaration*/