mirror of
https://github.com/RevCurtisP/C02.git
synced 2025-02-19 19:31:04 +00:00
Modified #pragma zeropage, made anonymous strings const
This commit is contained in:
parent
f3072000b5
commit
bdf949b72c
@ -44,6 +44,8 @@ void init(void) {
|
|||||||
rambas = 0; //RAM Base Address
|
rambas = 0; //RAM Base Address
|
||||||
wrtbas = 0; //Write Base Address
|
wrtbas = 0; //Write Base Address
|
||||||
zpaddr = 0; //Current Zero-Page Address
|
zpaddr = 0; //Current Zero-Page Address
|
||||||
|
zpgbgn = 0; //Start of Free Zero-Page
|
||||||
|
zpgend = 0xFF; //End of Free Zero-Page
|
||||||
invasc = FALSE; //Invert ASCII Flag
|
invasc = FALSE; //Invert ASCII Flag
|
||||||
mskasc = FALSE; //Set High Bit Flag
|
mskasc = FALSE; //Set High Bit Flag
|
||||||
fcase = FALSE; //First Case Statement Flag
|
fcase = FALSE; //First Case Statement Flag
|
||||||
|
12
src/expr.c
12
src/expr.c
@ -219,12 +219,12 @@ void prsadr(int adract) {
|
|||||||
void prsstr(int adract, int alwstr) {
|
void prsstr(int adract, int alwstr) {
|
||||||
if (!alwstr) ERROR("Illegal String Reference", 0, EXIT_FAILURE)
|
if (!alwstr) ERROR("Illegal String Reference", 0, EXIT_FAILURE)
|
||||||
DEBUG("expr.prsstr: Parsing anonymous string\n", 0)
|
DEBUG("expr.prsstr: Parsing anonymous string\n", 0)
|
||||||
newlbl(vrname); //Generate Variable Name
|
newlbl(vrname); //Generate Variable Name
|
||||||
value[0] = 0; //Use Variable Size 0
|
value[0] = 0; //Use Variable Size 0
|
||||||
setvar(MTNONE, VTCHAR); //Set Variable Name, Type, and Size
|
setvar(MTCONST, VTCHAR); //Set Variable Name, Type, and Size
|
||||||
prsdts(); //Parse Data String
|
prsdts(); //Parse Data String
|
||||||
setdat(); //Set Variable Data
|
setdat(); //Set Variable Data
|
||||||
varcnt++; //Increment Variable Counter
|
varcnt++; //Increment Variable Counter
|
||||||
if (adract) prcadr(adract, vrname); //Compile Address Reference
|
if (adract) prcadr(adract, vrname); //Compile Address Reference
|
||||||
else strcpy(word, vrname); //Save for Calling Routine
|
else strcpy(word, vrname); //Save for Calling Routine
|
||||||
}
|
}
|
||||||
|
@ -129,8 +129,12 @@ void pwrtbs(void) {
|
|||||||
|
|
||||||
/* Parse Zeropage Subdirective */
|
/* Parse Zeropage Subdirective */
|
||||||
void pzropg(void) {
|
void pzropg(void) {
|
||||||
zpaddr = prsnum(0xFF); //Set Zero Page Address to Literal
|
zpgbgn = prsnum(0xFF); //Set Zero Page Address to Literal
|
||||||
DEBUG("Set zero page address to %d\n", zpaddr)
|
zpgend = prsnum(0xFF); //Set Zero Page Address to Literal
|
||||||
|
zpaddr = zpgbgn;
|
||||||
|
DEBUG("Set free zero page to %d ", zpgbgn)
|
||||||
|
DETAIL("through %d ", zpgend)
|
||||||
|
DETAIL("and zero page address to %d\n", zpaddr)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Process Vartable Subdirective */
|
/* Process Vartable Subdirective */
|
||||||
|
@ -272,6 +272,8 @@ void addvar(int m, int t) {
|
|||||||
if (t == VTVOID) ERROR("Illegal Variable Type\n", 0, EXIT_FAILURE)
|
if (t == VTVOID) ERROR("Illegal Variable Type\n", 0, EXIT_FAILURE)
|
||||||
if (m & MTZP) {
|
if (m & MTZP) {
|
||||||
if (alcvar) {
|
if (alcvar) {
|
||||||
|
int zpgmax = (t == VTINT) ? zpgend -1 : zpgend;
|
||||||
|
if (zpaddr > zpgmax) ERROR("Free Zero Page Space Exceeded\n", 0, EXIT_FAILURE)
|
||||||
setlbl(vrname);
|
setlbl(vrname);
|
||||||
sprintf(word, "$%hhX", zpaddr++);
|
sprintf(word, "$%hhX", zpaddr++);
|
||||||
if (t == VTINT) zpaddr++; //int uses two bytes
|
if (t == VTINT) zpaddr++; //int uses two bytes
|
||||||
|
@ -75,6 +75,8 @@ int symdef(char *name); //Is Variable defined (TRUE or FALSE)
|
|||||||
int rambas; //RAM Base Address (0=None)
|
int rambas; //RAM Base Address (0=None)
|
||||||
int wrtbas; //Write Base Address (0=None)
|
int wrtbas; //Write Base Address (0=None)
|
||||||
int zpaddr; //Current Zero-Page Address
|
int zpaddr; //Current Zero-Page Address
|
||||||
|
int zpgbgn; //Start of Free Zero-Page
|
||||||
|
int zpgend; //End of Free Zero-Page
|
||||||
char wrtofs[6]; //Write Address Offset
|
char wrtofs[6]; //Write Address Offset
|
||||||
|
|
||||||
void addvar(int m, int t); //Parse and Compile Variable Declaration
|
void addvar(int m, int t); //Parse and Compile Variable Declaration
|
||||||
|
Loading…
x
Reference in New Issue
Block a user