From dfedddab72025534bdb61140c9684887a0001f50 Mon Sep 17 00:00:00 2001 From: Curtis F Kaylor Date: Sat, 17 Feb 2018 13:52:13 -0500 Subject: [PATCH] Renamed Apple 2 standard header files --- apple2/a2test.c02 | 3 +- apple2/c02.bat | 19 ++- doc/header.txt | 172 ++++++++++++++------------- include/{apple2.a02 => appl2std.a02} | 1 + include/{apple2.h02 => appl2std.h02} | 6 +- 5 files changed, 110 insertions(+), 91 deletions(-) rename include/{apple2.a02 => appl2std.a02} (99%) rename include/{apple2.h02 => appl2std.h02} (90%) diff --git a/apple2/a2test.c02 b/apple2/a2test.c02 index 3207669..48b5fb1 100644 --- a/apple2/a2test.c02 +++ b/apple2/a2test.c02 @@ -1,6 +1,6 @@ /* C02 Apple II Test Program */ -#include +#include char i; @@ -10,3 +10,4 @@ main: prchr(i); } goto exit; + diff --git a/apple2/c02.bat b/apple2/c02.bat index 3e79d91..87be0d0 100644 --- a/apple2/c02.bat +++ b/apple2/c02.bat @@ -1,5 +1,16 @@ -@ECHO Compiling File %1.c02 -..\c02.exe %1 +@echo Compiling File %1.c02 +..\c02.exe %1 >%1.out +@if ERRORLEVEL 1 exit /b -@ECHO Assembling File %1.asm -C:\Programs\dasm %1.asm -f3 -o%1.bin -l%1.lst -s%1.sym +@echo Assembling File %1.asm +dasm %1.asm -f3 -o%1.bin -l%1.lst -s%1.sym +@if ERRORLEVEL 1 exit /b + +@echo Building Disk Image +copy /Y boot.dsk %1.dsk +echo BRUN %1 |a2tools in t %1.dsk command +a2tools in b.0C00 %1.dsk %1 %1.bin +@if ERRORLEVEL 1 exit /b + +@echo Starting Emulator +start C:\Programs\AppleWin\applewin -d1 %1.dsk diff --git a/doc/header.txt b/doc/header.txt index 51e5b05..df174e9 100644 --- a/doc/header.txt +++ b/doc/header.txt @@ -1,83 +1,89 @@ -System Specific Header File Specification - -The very first directive of the program must be - - #include - -where header.h02 is the system specific header file, (e.g. apple1.h02, -vic20.h02, etc.). - -Note: This will probably be replaced with a command line parameter -(e.g. '-s apple1', '-s vic20', etc...) to allow program portability. - -If compatibility with the C02 Standard Libraries is needed, the following -functions must be defined: - - c = plkey(); Polls keyboard and returns raw ASCII character - corresponding to last/current pressed key. - - Returns constant NULKEY (usually 0) if no key was - pressed. - - c = rdkey(); Waits for a keypress and returns the raw ASCII - character corresponding to the pressed key. - - Note: Usually a loop that calls plkey(), but may - also directly call a system subroutine. - - c = getkey(); Waits for a keypress and returns the cleaned - ASCII value corresponding to the pressed key. - - Note: Calls rdkey() followed by any necessary - character code conversions. This can be due to - high-bit being set by keyboard decoder, - non-standard key mappings, keys that generate - escape sequences, etc... - - newlin(); Advances the cursor to the beginning of then - next line. - - Note: Depending on the system, this will usually - output a Carriage Return, Line Feed, both. - - prchr(c); Writes character c to the screen. - - Note: May directly access memory-mapped I/O - or may call a system subroutine. - - setdst(&s): Stores pointer to &s in dstlo and dsthi. - - setsrc(&s): Stores pointer to &s in srclo and srchi and - initializes Y register to 0. - -along with the Zero Page locations (each pair of which must be sequential) - - srclo, srchi Spurce String Pointer - dstlo, dsthi Destination String Pointer - -the following locations that may be Zero Page, but don't have to before - - temp0 Temporary variables used by stdlib.asm - temp1 - temp2 - -and the following locations that must be preserved between function calls - - random Storage for the Random Number Generator - - Contains the last number generated and is used to - generate the next number in the sequence - - rdseed Seed for Pseudo-Random Number Generator - - Usually a counter or timer. If one is not provided - by the system, should be generated by incrementing - in the plkey(), rdkey() functions. - -and the constants - - DELKEY ASCII code for Delete/Backspace key (usually DEL or BS) - ESCKEY ASCII code for Escape/Abort key (usually ESC) - NULKEY Returned if no Key was Pressed - RTNKEY ASCII code for Return/Enter key (usually CR) - +System Specific Header File Specification + +The very first directive of the program must be + + #include + +where header.h02 is the system specific header file, (e.g. apple1.h02, +vic20.h02, etc.). + +Note: This will probably be replaced with a command line parameter +(e.g. '-s apple1', '-s vic20', etc...) to allow program portability. + +If compatibility with the C02 Standard Libraries is needed, the following +functions must be defined: + + c = plkey(); Polls keyboard and returns raw ASCII character + corresponding to last/current pressed key. + + Returns constant NULKEY (usually 0) if no key was + pressed. + + c = rdkey(); Waits for a keypress and returns the raw ASCII + character corresponding to the pressed key. + + Note: Usually a loop that calls plkey(), but may + also directly call a system subroutine. + + c = getkey(); Waits for a keypress and returns the cleaned + ASCII value corresponding to the pressed key. + + Note: Calls rdkey() followed by any necessary + character code conversions. This can be due to + high-bit being set by keyboard decoder, + non-standard key mappings, keys that generate + escape sequences, etc... + + newlin(); Advances the cursor to the beginning of then + next line. + + Note: Depending on the system, this will usually + output a Carriage Return, Line Feed, both. + + echo(c); Writes character c to the screen without any + translation. + + Note: May directly access memory-mapped I/O + or may call a system subroutine. + + prchr(c); Writes character c to the screen. + + Note: Does any needed ACSII conversions, then calls + echo(). + + setdst(&s): Stores pointer to &s in dstlo and dsthi. + + setsrc(&s): Stores pointer to &s in srclo and srchi and + initializes Y register to 0. + +along with the Zero Page locations (each pair of which must be sequential) + + srclo, srchi Spurce String Pointer + dstlo, dsthi Destination String Pointer + +the following locations that may be Zero Page, but don't have to before + + temp0 Temporary variables used by stdlib.asm + temp1 + temp2 + +and the following locations that must be preserved between function calls + + random Storage for the Random Number Generator + + Contains the last number generated and is used to + generate the next number in the sequence + + rdseed Seed for Pseudo-Random Number Generator + + Usually a counter or timer. If one is not provided + by the system, should be generated by incrementing + in the plkey(), rdkey() functions. + +and the constants + + DELKEY ASCII code for Delete/Backspace key (usually DEL or BS) + ESCKEY ASCII code for Escape/Abort key (usually ESC) + NULKEY Returned if no Key was Pressed + RTNKEY ASCII code for Return/Enter key (usually CR) + diff --git a/include/apple2.a02 b/include/appl2std.a02 similarity index 99% rename from include/apple2.a02 rename to include/appl2std.a02 index 45379eb..6558bba 100644 --- a/include/apple2.a02 +++ b/include/appl2std.a02 @@ -71,6 +71,7 @@ PLKEYR: RTS ;Read Keyboard GETKEY EQU KEYIN ;Alias to Monitor Routine + ;Print Character to Screen PRCHR: ORA #$80 ;Set High Bit CMP #$E0 ; diff --git a/include/apple2.h02 b/include/appl2std.h02 similarity index 90% rename from include/apple2.h02 rename to include/appl2std.h02 index c7e0f05..c068587 100644 --- a/include/apple2.h02 +++ b/include/appl2std.h02 @@ -1,4 +1,4 @@ -/* Apple 1 Header File */ +/* Apple ][ Header File */ /* Monitor Variables */ @@ -18,8 +18,8 @@ char temp0, temp1, temp2, temp3; //Temporary Variables char invflg; //Video Invert Mask //Keyboard I/O -char kbd; //Keyboard Data -char abd; //Keyboard Strobe +char kbd; //Keyboard Data Register +char abd; //Keyboard Strobe Register //Monitor Subroutines void echo(); //Print Character in Accumulator