mirror of
https://github.com/RevCurtisP/C02.git
synced 2025-02-15 23:31:46 +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
|
||||
wrtbas = 0; //Write Base 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
|
||||
mskasc = FALSE; //Set High Bit 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) {
|
||||
if (!alwstr) ERROR("Illegal String Reference", 0, EXIT_FAILURE)
|
||||
DEBUG("expr.prsstr: Parsing anonymous string\n", 0)
|
||||
newlbl(vrname); //Generate Variable Name
|
||||
value[0] = 0; //Use Variable Size 0
|
||||
setvar(MTNONE, VTCHAR); //Set Variable Name, Type, and Size
|
||||
prsdts(); //Parse Data String
|
||||
setdat(); //Set Variable Data
|
||||
varcnt++; //Increment Variable Counter
|
||||
newlbl(vrname); //Generate Variable Name
|
||||
value[0] = 0; //Use Variable Size 0
|
||||
setvar(MTCONST, VTCHAR); //Set Variable Name, Type, and Size
|
||||
prsdts(); //Parse Data String
|
||||
setdat(); //Set Variable Data
|
||||
varcnt++; //Increment Variable Counter
|
||||
if (adract) prcadr(adract, vrname); //Compile Address Reference
|
||||
else strcpy(word, vrname); //Save for Calling Routine
|
||||
}
|
||||
|
@ -129,8 +129,12 @@ void pwrtbs(void) {
|
||||
|
||||
/* Parse Zeropage Subdirective */
|
||||
void pzropg(void) {
|
||||
zpaddr = prsnum(0xFF); //Set Zero Page Address to Literal
|
||||
DEBUG("Set zero page address to %d\n", zpaddr)
|
||||
zpgbgn = prsnum(0xFF); //Set Zero Page Address to Literal
|
||||
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 */
|
||||
|
@ -272,6 +272,8 @@ void addvar(int m, int t) {
|
||||
if (t == VTVOID) ERROR("Illegal Variable Type\n", 0, EXIT_FAILURE)
|
||||
if (m & MTZP) {
|
||||
if (alcvar) {
|
||||
int zpgmax = (t == VTINT) ? zpgend -1 : zpgend;
|
||||
if (zpaddr > zpgmax) ERROR("Free Zero Page Space Exceeded\n", 0, EXIT_FAILURE)
|
||||
setlbl(vrname);
|
||||
sprintf(word, "$%hhX", zpaddr++);
|
||||
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 wrtbas; //Write Base Address (0=None)
|
||||
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
|
||||
|
||||
void addvar(int m, int t); //Parse and Compile Variable Declaration
|
||||
|
Loading…
x
Reference in New Issue
Block a user