1
0
mirror of https://github.com/RevCurtisP/C02.git synced 2024-11-29 01:49:19 +00:00

Removed #define and #enum directives

This commit is contained in:
Curtis F Kaylor 2018-03-07 12:10:23 -05:00
parent 4e421c8095
commit 1c4c2b4696
5 changed files with 10 additions and 29 deletions

View File

@ -779,6 +779,12 @@ Examples:
UNIMPLEMENTED FEATURES
The #define directive generates an error. Defining of constants is done
using the const keyword, and defining of macros is not supported.
The #if, #else, and #endif directives are not recognized at all by the
compiler. They may be added in the future.
The only type recognized by the compiler is char. Since the 6502 is an
8-bit processor, multi-byte types would generate over-complicated code.
In addition, the signed and unsigned keywords are unrecognized, due to the

View File

@ -13,7 +13,9 @@ statement.
DIRECTIVES
C02 does not use a preprocessor. All directives are directly processed
by the compiler.
by the compiler. C02 supports the directives #include and #pragma. The
directive #define is currently unimplemented and generates an error.
The #if, #else, and #endif directives are not recognized by C02.
CONSTANTS

View File

@ -67,7 +67,6 @@ void pdrctv(void) {
getwrd(); //read directive into word
DEBUG("Processing directive '%s'\n", word)
if (wordis("DEFINE")) pdefin(); //Parse Define
else if (wordis("ENUM")) penumd(); //Parse Enum Directive
else if (wordis("INCLUDE")) pincfl(); //Parse Include File
else if (wordis("ERROR")) ERROR("Error \n", 0, EXIT_FAILURE)
else if (wordis("PRAGMA")) pprgma();

View File

@ -59,31 +59,7 @@ void incasm(void) {
/* Process define directive */
void pdefin(void) {
getwrd(); //get defined identifier
DEBUG("Defining '%s'\n", word)
strncpy(defnam[defcnt], word, VARLEN);
setlbl(word); //Set label Assembler Line
expect('=');
defval[defcnt++] = prsbyt(); //Get Value
ACMNT(word); //comment value
asmlin(EQUOP, value); //Write Definition
DEBUG("Defined as '%s'\n", value)
}
/* Process enum directive */
void penumd(void) {
int enmval = 0;
do {
getwrd(); //get defined identifier
DEBUG("Enumerating '%s'\n", word)
strncpy(defnam[defcnt], word, VARLEN);
setlbl(word); //Set label Assembler Line
defval[defcnt++] = enmval; //Set Value
sprintf(value, "%d", enmval);
asmlin(EQUOP, value); //Write Definition
DEBUG("Defined as '%s'\n", value)
enmval++;
} while (look(','));
ERROR("Define directive not implemented\n", 0, EXIT_FAILURE)
}
/* Parse ASCII Subdirective */

View File

@ -4,8 +4,6 @@
********************************************/
#define CR = $0D //define is deprecated
/* Constants */
const #TRUE = $FF, #FALSE = 0;
const #BITS = %01010101;