1
0
mirror of https://github.com/RevCurtisP/C02.git synced 2024-11-24 15:31:17 +00:00
C02/py65/testslct.c02
2019-03-22 19:32:08 -04:00

60 lines
1.1 KiB
Plaintext

/************************************************
* TESTSELECT - Test C02 Select/Case Statements *
************************************************/
#include <py65.h02>
#include <stddef.h02>
#include <stdio.h02>
char c;
main:
for (c=0; c<10; c++) {
prbyte(c);
putc(' ');
select (c) {
case 0: putln("OH!");
case 1: putln("WON");
case 7,8,9: putln("SEVEN ATE NINE");
case 4: putln("FORE!");
case 10: putln("TEN");
case 0: putln("OOPS!");
default: putln("*");
}
}
newlin();
for (c=0; c<10; c++) {
prbyte(c);
putc(' ');
select (c) {
case 0,7: putln("SEVEN - LOVE");
case 5:
five: putln("FIVE");
case 9:
puts("WORKING NINE TO ");
goto five;
default: putln("*");
}
}
newlin();
for (c=$18; c<$22; c++) {
if (c & 15 > 9) continue; //Skip $1A - $1F
prbyte(c);
putc(' ');
select (c) {
case $18: putln("I'M EIGHTEEN!");
case $19:
putln("BREAK ONE-NINE");
if (c==$19) break;
putln("OOPS!");
case $21: putln("BLACKJACK!");
default: putln("*");
}
}
goto exit;