1
0
mirror of https://github.com/RevCurtisP/C02.git synced 2024-11-22 01:31:33 +00:00

Added Apple-1 C02 test programs

This commit is contained in:
Curtis F Kaylor 2018-01-28 14:52:58 -05:00
parent 236a2eead1
commit 541ee6ff67
14 changed files with 353 additions and 0 deletions

25
apple1/a1min.h02 Normal file
View File

@ -0,0 +1,25 @@
/* Apple 1 Minimal Header File for Apple 1*/
/* Monitor Variables */
char xaml, xamh; //Examine Index
char stl, sth; //Store Index
char l,h; //Hex Data
char ysave; //Y Register Storage
char mode; //Mode: Store, Examine, Block Examine
char buffer[]; //Input Buffer
//PIA 6820 Registers
char kbd; //Keyboard Data
char kbdcr; //Keyboard Control Register
char dsp; //Display Data
char dspcr; //Display Control Register
//Monitor Subroutines
void echo(); //Print Character in Accumulator
void prbyte(); //Print Accumulator as Hexadadecimal number
void prhex(); //Print Low Nybble of Accumulator as Hex Digit
//System Subroutines
char plkey(); //Poll Keyboard for raw character
char rdkey(); //Wait for raw character from Keyboard

20
apple1/bfrtest.c02 Normal file
View File

@ -0,0 +1,20 @@
/***************************************
* BUFFER TEST - Test buffer routines *
* from file prdec.asm for Apple 1 *
***************************************/
#include <apple1.h>
#include <apple1.asm>
#include <prdec.asm>
#include <buffer.asm>
char n;
main:
n = getbfr(); //Read line into buffer
prdec(n); //Print line length
echo($20); //Print a space
putbfr(); //Print buffer contents
goto main; // and loop

24
apple1/chrset.c02 Normal file
View File

@ -0,0 +1,24 @@
/******************************************
* CHRSET - Display Apple 1 Character Set *
******************************************/
#include <apple1.h>
#include <apple1.asm>
byte i;
main:
i = $20;
loop:
echo(i);
i++;
if (i & $0F == 0) echo($0D);
if (i < $60) goto loop;
echo($0D);
goto exit;

28
apple1/chrsetv.c02 Normal file
View File

@ -0,0 +1,28 @@
/******************************************
* CHRSET - Display Apple 1 Character Set *
******************************************/
#include <apple1.h>
#include <apple1.asm>
byte i, j;
main:
i = $20;
j = 0;
loop:
echo(i + j);
j = j + 8;
if (j < 64) goto loop;
echo($0D);
j = 0;
i = i + 8;
if (i<96) goto loop;
echo($0D);
goto exit;

68
apple1/compare1.c02 Normal file
View File

@ -0,0 +1,68 @@
/***********************************
* COMPARE TEST - Test C02 compare *
* instructions on Apple 1 *
***********************************/
#include <apple1.h>
#include <apple1.asm>
#include <prdec.asm>
#include <stdio.asm>
char passed = " PASSED.\r";
char failed = " FAILED.\r";
main:
prdecr(1);
if (1==1) putstr(&passed);
else putstr(&failed);
prdecr(2);
if (1==2) putstr(&failed);
else putstr(&passed);
prdecr(3);
if (1<2) putstr(&passed);
else putstr(&failed);
prdecr(4);
if (2<1) putstr(&failed);
else putstr(&passed);
prdecr(5);
if (1<1) putstr(&failed);
else putstr(&passed);
prdecr(6);
if (1<=2) putstr(&passed);
else putstr(&failed);
prdecr(7);
if (2<=1) putstr(&failed);
else putstr(&passed);
prdecr(8);
if (1<=1) putstr(&passed);
else putstr(&failed);
prdecr(9);
if (2>1) putstr(&passed);
else putstr(&failed);
prdecr(10);
if (1>2) putstr(&failed);
else putstr(&passed);
prdecr(11);
if (1>1) putstr(&failed);
else putstr(&passed);
prdecr(12);
if (1<>2) putstr(&passed);
else putstr(&failed);
prdecr(13);
if (1<>1) putstr(&failed);
else putstr(&passed);
goto exit;

16
apple1/echo.c02 Normal file
View File

@ -0,0 +1,16 @@
/***************************************
* ECHO - Demo program for the Apple 1 *
* Echos typed keys to display *
* ESC key aborts to monitor *
***************************************/
#include <apple1.h02>
char key; //Key value
main:
key = getkey();
if (key == 155) goto exit;
echo(key);
goto main;

20
apple1/echomin.c02 Normal file
View File

@ -0,0 +1,20 @@
/***************************************
* ECHO - Demo C02 program for Apple 1 *
* using minimal header file *
* Echos typed keys to display *
* ESC key aborts to monitor *
***************************************/
#include "a1min.h02"
char key; //Key value
main:
while() {
key = rdkey(); //Read keyboard
if (key == $9B) //If ESCAPE pressed
break; //exit loop
echo(key); //Display character on screen
}
goto exit;

18
apple1/ehex.c02 Normal file
View File

@ -0,0 +1,18 @@
/**************************************************
* ECHO HEX - Demo program for the Apple 1 *
* Displays typed key ASCII values in hexadecimal *
**************************************************/
#include <apple1.h>
#include <apple1.asm>
char key; //Key value
main:
key = getkey();
echo(key);
echo(32);
prbyte(key);
echo(32);
goto main;

20
apple1/prdec0.c02 Normal file
View File

@ -0,0 +1,20 @@
/***************************************
* PRDEC0 TEST - Test routine prdec0 *
* from file prdec.asm for Apple 1 *
***************************************/
#include <apple1.h>
#include <apple1.asm>
#include <prdec.asm>
byte i;
main:
i = 0;
loop:
prdec0(i);
echo(32);
i++;
if (i<>0) goto loop;
goto exit;

20
apple1/prdec1.c02 Normal file
View File

@ -0,0 +1,20 @@
/***************************************
* PRDEC TEST - Test routine prdec *
* from file prdec.asm for Apple 1 *
***************************************/
#include <apple1.h>
#include <apple1.asm>
#include <prdec.asm>
byte i;
main:
i = 0;
loop:
prdec(i);
echo(32);
i++;
if (i<>0) goto loop;
goto exit;

20
apple1/prdecr.c02 Normal file
View File

@ -0,0 +1,20 @@
/***************************************
* PRDEC0 TEST - Test routine prdecr *
* from file prdec.asm for Apple 1 *
***************************************/
#include <apple1.h>
#include <apple1.asm>
#include <prdec.asm>
byte i;
main:
i = 0;
loop:
prdecr(i);
echo(32);
i++;
if (i<>0) goto loop;
goto exit;

25
apple1/rndtest.c02 Normal file
View File

@ -0,0 +1,25 @@
/************************************************
* RNDTEST - Test Random Function in apple1.h02 *
************************************************/
#include <apple1.h02>
char c, i; //Index
char msg = "Press any key to start";
main:
i = 0;
print:
c = msg[i];
echo(c);
i++;
if (c <> 0) goto print;
echo($0D);
getkey();
random(count);
loop:
c = random(0);
prbyte(c);
echo(' ');
goto loop;

15
apple1/strtest.c02 Normal file
View File

@ -0,0 +1,15 @@
/*********************************************
* STRTEST - Test Library string.h for Apple *
*********************************************/
#include <apple1.h02>
#include <string.h02>
char key; //Key value
main:
key = getkey();
if (key == 155) goto exit;
echo(key);
goto main;

34
apple1/testio.c02 Normal file
View File

@ -0,0 +1,34 @@
/*********************************************
* STRTEST - Test Library stdio.h for Apple *
*********************************************/
#include <apple1.h02>
#include <stdio.h02>
char key; //Key read from keyboard
char len; //Length of input output string
char str[128]; //String to read/write
char anykey = "Press any key to continue";
char tlines = "Type lines followed by carriage-return";
char escend = "press Escape key to end";
char utyped = "You typed: ";
main:
putstr(&anykey); //Display "Press any key" message
key = getchr(); //Wait for key press
newlin(); //Advance cursor to next line
putstr(&tlines); //Display "Type lines" message
putstr(&utyped); //Display "press Escape" message
loop:
newlin();
len = getstr(&str); //Read string from keybaord
if (len == $FF) //If entry was aborted
goto done;
prbyte(len); //Display length of entered string
putstr(&str); //Display entered string
goto loop;
done:
goto exit;