diff --git a/include/appl2std.a02 b/include/appl2std.a02 index 6558bba..876a574 100644 --- a/include/appl2std.a02 +++ b/include/appl2std.a02 @@ -37,6 +37,11 @@ COLDST EQU $3D3 ;Jump vector to DOS cold start KBD EQU $C000 ;Keyboard Data AKD EQU $C010 ;Keyboard Strobe Register +;BASIC Routines +SHWCUR EQU $CC4C ;Display Cursor +UPDATE EQU $CC70 ;Flash Cursor +STORY EQU $C3B3 ;Store Accumulator at Current Screen Position + ;Monitor Routines PRBLNK EQU $F94C ;Print 3 blanks PRBLNX EQU $F94C ;Print X blanks @@ -69,14 +74,16 @@ PLKEY: LDA #0 ;Clear Accumulator PLKEYR: RTS ;Read Keyboard -GETKEY EQU KEYIN ;Alias to Monitor Routine - +GETKEY JSR PLKEY ;Poll Keyboard + BEQ GETKEY ;Loop if No Key + AND #$7F ;Strip High Bit + RTS ;Print Character to Screen PRCHR: ORA #$80 ;Set High Bit CMP #$E0 ; BCC PRCHRX ;If Lower Case - AND #$DF ; Convert to Upper Case + AND #$1F ; Convert to Inverse PRCHRX: JMP ECHO ;Alias to Monitor Routine ;Delete Previous Character diff --git a/include/stdio.a02 b/include/stdio.a02 index 85cd0a7..bd83e2d 100644 --- a/include/stdio.a02 +++ b/include/stdio.a02 @@ -1,5 +1,5 @@ ; C02 library stdio.h02 assembly language subroutines -; Requires external routines GETKEY, prchr, delchr, and NEWLIN +; Requires external routines GETKEY, PRCHR, DELCHR, and NEWLIN ; external zero page locations SRCLO and SRCHI ; and external constants DELKEY, ESCKEY, and RTNKEY ;char getc() diff --git a/test/define.c02 b/test/define.c02 index 7cc2f4d..7f7ee61 100644 --- a/test/define.c02 +++ b/test/define.c02 @@ -1,8 +1,15 @@ /* Test C02 define directive */ +#pragma origin 1000 + #define TRUE = $FF #define FALSE = 0 +#enum ZERO, ONE, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE, TEN + +char a = {#TRUE, #FALSE}; char b; +char f = #FALSE; +char t = #TRUE; b = #TRUE; diff --git a/test/funcs.c02 b/test/funcs.c02 new file mode 100644 index 0000000..92736f8 --- /dev/null +++ b/test/funcs.c02 @@ -0,0 +1,63 @@ +/**************************** + * Test C02 Function Calls * + * Test file for Compiler * + ****************************/ + +/* Variables */ +char b , + i , j; +char c,d,f; +char r[15]; +char z[15]; +char t = {1, 2, 3, 4, 5}; +char s = "This is a string."; +char aa,xx,yy ; //Function parameter variables +char aaa,xxx,yyy ; //Function return variables +char STROBE; //Strobe Register + + +/* Function Declaration */ +char myfunc(); + return b-c-d; + return; + +main: + +funcx: +f = testfn(b); //Simple Variable +f = testfn(r[i]); //Array Element +f = testfn(r[i],b); //Two Parameters +f = testfn(r[1],r[2]); //Two Array Elements +f = testfn(r[1],r[2],b); //Three Parameters +f = testfn(&s); //Pointer +f = testfn(b,&s); //Byte and Pointer +f = testfn(r[i],&s); //Array Element and Pointer +f = testfn(r[1],&s); //Array Element and Pointer +f = testfn(b+c+d,&s); //Expression in Function Call +f = testfn(getkey(b)+c); //Nested Function Call + +funcs: +prchr(b+c+d); +testfn(prchr(b)); +testfn(b,c,d); +testfn(b+c+d,r[i],f); +testfn(&s); //Print a String +dofn(*,yy); +dofn(*,yy,xx); +dofn(aa,*,xx); +dofn(*,*,XX); + + +funcyx: +aaa = testfn(); //Return 1 Value +aaa, yyy = testfn(); //Return 2 Values +aaa, yyy, xxx = testfn(); //Return 3 Values +r[i], d = testfn(); //Return 2 Values with Array +c, z[i] = testfn(); //Return 2 Values with Array +r[i], d, f = testfn(); //Return 3 Values with Array +c, z[i], f = testfn(); //Return 3 Values with Array +r[i], z[j] = testfn(); //Return 2 Values with Arrays +r[i], z[j], f = testfn(); //Return 2 Values with Arrays + +//A, Y = testfn(); //Error - Registers not Allowed when returning multiple values +//r[i], z[j], f[b] = testfn(); //Error - Array Element not Allowed with STX assignment diff --git a/test/test.c02 b/test/test.c02 index 230ae66..ad2e662 100644 --- a/test/test.c02 +++ b/test/test.c02 @@ -3,7 +3,6 @@ * Test file for Compiler * ********************************************/ -#include "testhdr.h02" //#define CR $0D -- DEFINE needs to be reimplimented