mirror of
https://github.com/RevCurtisP/C02.git
synced 2026-04-26 04:18:22 +00:00
Fixed errors in compiler
This commit is contained in:
+4
-3
@@ -70,12 +70,13 @@ void chklbl(char* lbname) {
|
||||
newlbl(lbname);
|
||||
}
|
||||
|
||||
/* Require Label *
|
||||
/* Request Label *
|
||||
* if label is already set, returns that label *
|
||||
* else generates new label and sets it */
|
||||
void reqlbl(char* lbname) {
|
||||
if (lblasm[0] == 0) newlbl(lbname);
|
||||
setlbl(lbname);
|
||||
DEBUG("Requesting Label\n",0)
|
||||
if (lblasm[0] == 0) {newlbl(lbname); setlbl(lbname);}
|
||||
else {strcpy(lbname,lblasm); DEBUG("Found lblasm set to \"%s\"\n", lblasm)}
|
||||
}
|
||||
|
||||
/* End Function Block */
|
||||
|
||||
+2
-2
@@ -161,7 +161,7 @@ void setdat(void) {
|
||||
datvar[dsize++] = litval;
|
||||
}
|
||||
else if (dtype == DTARRY) {
|
||||
DEBUG("Setting variable data to array of length %d\n", dlen)
|
||||
DEBUG("Setting variable data to array of length %d\n", dlen)
|
||||
for (i=0; i<dlen; i++) datvar[dsize++] = dattmp[i];
|
||||
}
|
||||
else {
|
||||
@@ -183,7 +183,7 @@ void prsdat(void) {
|
||||
else if (match('"')) prsdts(); //Parse Data String
|
||||
else if (match('{')) prsdta(); //Parse Data Array
|
||||
else expctd("numeric or string literal");
|
||||
setdat(); //Store Data Value
|
||||
if (alcvar && dtype == DTBYTE) setdat(); //Store Data Value
|
||||
}
|
||||
|
||||
/* Add Variable to Variable table *
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
/*************************************************
|
||||
* Test header variable and function definitions *
|
||||
*************************************************/
|
||||
|
||||
#include "testhdr.h02"
|
||||
|
||||
main:
|
||||
|
||||
puts("Header Test");
|
||||
|
||||
goto exit;
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
/*****************************
|
||||
* Test compilation of Loops *
|
||||
*****************************/
|
||||
|
||||
#pragma padding 1
|
||||
|
||||
char c,i;
|
||||
|
||||
main:
|
||||
whilei: i = 0; while (i < 10) i++;
|
||||
while (i:+) i--;
|
||||
dord: do {c = rdkey();} while (c=0);
|
||||
for (i=1; i<9; i++) prchr(i);
|
||||
goto exit;
|
||||
+15
-7
@@ -1,14 +1,22 @@
|
||||
;6502 Assembly Language File for DASM Macro Assembler
|
||||
|
||||
TRUE EQU $FF ;Bitwise True
|
||||
FALSE EQU $FF ;Bitwise False
|
||||
|
||||
ORG $0200 ;Set Origin
|
||||
|
||||
start: JMP main ;Jump to Beginning of Program
|
||||
START: JMP main ;Jump to Beginning of Program
|
||||
|
||||
;Dummy Functions
|
||||
testfn: RTS ;Generic Test Function
|
||||
getkey: RTS ;Get Character from Keyboard
|
||||
prchr: RTS ;Print Character to Screen
|
||||
putstr: RTS ;Print String to Screen
|
||||
strlen: RTS ;Return Length of String
|
||||
exit: BRK ;Return to Monitor
|
||||
GETC: RTS ;Get Character from Keyboard
|
||||
PUTC: RTS ;Put Character to Screen
|
||||
PUTS: RTS ;Print String to Screen
|
||||
STRLEN: RTS ;Return Length of String
|
||||
EXIT: BRK ;Return to Monitor
|
||||
|
||||
ANYKEY DC "Press any key to continue...",0
|
||||
|
||||
ONES DC "ZERO ",0,"ONE ",0,"TWO ",0,"THREE",0,"FOUR ",0
|
||||
"FIVE ",0,"SIX ",0,"SEVEN",0,"EIGHT",0,"NINE ",0
|
||||
|
||||
|
||||
|
||||
+12
-4
@@ -1,7 +1,15 @@
|
||||
/* Generic 6502 header file */
|
||||
|
||||
char getchr();
|
||||
void putchr();
|
||||
char putstr();
|
||||
const #TRUE = $FF, #FALSE = 0;
|
||||
|
||||
char anykey = "Press any key to continue...";
|
||||
|
||||
|
||||
/* Get Character from Keyboard */
|
||||
char getc();
|
||||
|
||||
void putc();
|
||||
|
||||
char puts();
|
||||
|
||||
char strlen();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user