1
0
mirror of https://github.com/RevCurtisP/C02.git synced 2024-11-30 23:50:04 +00:00
C02/work/define.c02

32 lines
728 B
Plaintext
Raw Normal View History

2018-01-28 19:47:06 +00:00
/* Test C02 define directive */
2018-03-03 19:35:12 +00:00
#pragma origin 1000
#define TRUE $FF
#define FALSE 0
2018-01-28 19:47:06 +00:00
#define BITS %01010101
#define ZED 'Z'
2018-03-07 16:38:22 +00:00
enum {SOLO};
enum {ZERO, ONE, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE, TEN};
enum {?, FIRST, SECOND, THIRD};
bitmask {BLUE, GREEN, RED, BRIGHT, INVERT, BLINK, FLIP, BKGRND};
bitmask {RD, RTS, DTR, RI, CD, ?, CTS, DSR};
bitmask {HNDSHK, ?, ?, ?, DUPLEX};
2018-03-03 19:35:12 +00:00
2018-08-04 22:29:04 +00:00
const char b = {#TRUE, #FALSE};
char c, i;
2018-08-04 22:29:04 +00:00
const char f = #FALSE;
const char t = #TRUE;
char zed;
2018-01-28 19:47:06 +00:00
2018-08-04 22:29:04 +00:00
//b = #TRUE; ***Error: Illegal use of const variable 'B'
2018-08-04 22:29:04 +00:00
const char nums = {#ZERO, #ONE, #TWO, #THREE, #FOUR, #FIVE, #SIX, #SEVEN, #EIGHT, #NINE, #TEN};
for (i=#ZERO; i<#TEN; i++) {
c = (i = nums[i]) ? #TRUE : #FALSE;
putdec(c);
}