1
0
mirror of https://github.com/RevCurtisP/C02.git synced 2024-11-24 15:31:17 +00:00

Updated include and test files

This commit is contained in:
Curtis F Kaylor 2018-03-03 14:35:12 -05:00
parent b165a4993f
commit fa19c4bbde
5 changed files with 81 additions and 5 deletions

View File

@ -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

View File

@ -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()

View File

@ -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;

63
test/funcs.c02 Normal file
View File

@ -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

View File

@ -3,7 +3,6 @@
* Test file for Compiler *
********************************************/
#include "testhdr.h02"
//#define CR $0D -- DEFINE needs to be reimplimented