mirror of
https://github.com/RevCurtisP/C02.git
synced 2024-11-21 10:32:08 +00:00
Added Commander X16 Header Files
This commit is contained in:
parent
8d12f452a0
commit
51bf4514d6
88
include/x16.a02
Normal file
88
include/x16.a02
Normal file
@ -0,0 +1,88 @@
|
||||
; c02 Program Initialization Code for Commander X16
|
||||
|
||||
;PETSCII Key Mappings
|
||||
DELKEY EQU $14 ;Delete/Backspace Key (Delete)
|
||||
ESCKEY EQU $03 ;Escape/Stop Key (RUN/STOP)
|
||||
RTNKEY EQU $0D ;Return/Enter Key (RETURN)
|
||||
|
||||
;Zero Page System Variables - Assumes Usage is Same as C64
|
||||
XMBANK EQU $0A ;Extended Memory Bank (Load/Verify Flag)
|
||||
XADRLO EQU $0B ;Ext Memory Address LSB (Text Index/Array Size)
|
||||
XADRHI EQU $0C ;Ext Memory Address MSB (Array Dimension Fkags)
|
||||
SRCPTR EQU $22 ;Source Pointer [Temporary Pointers]
|
||||
SRCLO EQU $22 ;Source Pointer LSB [Temporary Pointers]
|
||||
SRCHI EQU $23 ;Source Pointer MSB [Temporary Pointers]
|
||||
DSTPTR EQU $24 ;Destination Pointer [Temporary Pointers]
|
||||
DSTLO EQU $24 ;Destination Pointer LSB [Temporary Pointers]
|
||||
DSTHI EQU $25 ;Destination Pointer MSB [Temporary Pointers]
|
||||
BLKLO EQU $26 ;Block Pointer LSB [Floating Point Work Area]
|
||||
BLKHI EQU $27 ;Block Pointer MSB [Floating Point Work Area]
|
||||
STKLO EQU $28 ;Stack Pointer LSB [Floating Point Work Area]
|
||||
STKHI EQU $29 ;Stack Pointer MSB [Floating Point Work Area]
|
||||
BFRLO EQU $35 ;Buffer Pointer LSB [Temporary String Pointer]
|
||||
BFRHI EQU $36 ;Buffer Pointer MSB [Temporary String Pointer]
|
||||
RDSEED EQU $A2 ;Random Seed [Software Jiffy Clock (Low Byte)]
|
||||
TEMP0 EQU $FB ;Temporary Variable [Unused Byte]
|
||||
TEMP1 EQU $FC ;Temporary Variable [Unused Byte]
|
||||
TEMP2 EQU $FD ;Temporary Variable [Unused Byte]
|
||||
TEMP3 EQU $FE ;Temporary Variable [Unused Byte]
|
||||
|
||||
;Other Variables - Top of Extended System RAM Area
|
||||
BLKSLO EQU $07F4 ;Block Start LSB [Unused Byte]
|
||||
BLKSHI EQU $07F5 ;Block Start MSB [Unused Byte]
|
||||
BLKELO EQU $07F6 ;Block End LSB [Unused Byte]
|
||||
BLKEHI EQU $07F7 ;Block End MSB [Unused Byte]
|
||||
BLKLEN EQU $07F8 ;Block Length [Unused Byte]
|
||||
|
||||
RANDOM EQU $07F9 ;Random Number Storage [Unused Byte]
|
||||
STKSAV EQU $07FA ;Machine Stack Storage [Unused Byte]
|
||||
|
||||
STKSLO EQU $07FC ;Stack Start LSB [Unused Byte]
|
||||
STKSHI EQU $07FD ;Stack Start MSB [Unused Byte]
|
||||
STKELO EQU $07FE ;Stack End LSB [Unused Byte]
|
||||
STKEHI EQU $07FF ;Stack End MSB [Unused Byte]
|
||||
|
||||
;Machine Language Basic Stub - Same as Commodore 64
|
||||
ORG $0801 ;Start of Basic Program
|
||||
BASIC: DC $0C, $08 ;Pointer to Next Line
|
||||
DC $00, $00 ;Line Number (0)
|
||||
DC $9E ;SYS
|
||||
DC $20 ;' '
|
||||
DC $32, $30, $36 ,$32 ;"2062"
|
||||
DC $00 ;End of Line Marker
|
||||
DC $00, $00 ;End of Basic Program
|
||||
|
||||
START: TSX ;Get Stack Pointer
|
||||
STX STKSAV ;and Save for Exit
|
||||
JMP MAIN ;Execute Program
|
||||
|
||||
EXIT: LDX STKSAV ;Retrieve Saved Stack Pointer
|
||||
TXS ;and Restore It
|
||||
RTS ;Return to BASIC
|
||||
|
||||
;Poll Keyboard for Character
|
||||
POLKEY EQU $FFE4 ;Aliased to Kernal GETIN Routine
|
||||
|
||||
;Get Character from Keyboard
|
||||
GETKEY EQU POLKEY ;Aliased to POLKEY Routine
|
||||
|
||||
;Wait for Character from Keyboard
|
||||
GETCHR: JSR GETKEY ;Poll Keyboard
|
||||
BEQ GETCHR ;If No Key, Loop
|
||||
RTS
|
||||
|
||||
;Print Character to Console
|
||||
PUTCHR EQU $FFD2 ;Aliased to CHROUT Routine
|
||||
|
||||
;Delete Previous Character
|
||||
DELCHR: LDA #DELKEY ;Load Delete Character
|
||||
JMP PUTCHR ;Print and Return
|
||||
|
||||
;Advance Character to Next line
|
||||
NEWLIN: LDA #RTNKEY ;Load Return Character
|
||||
JMP PUTCHR ;Print and Return
|
||||
|
||||
PUTSTR: TXA ;Copy LSB to Accumulator
|
||||
JMP $CBD2 ;Execute STROUT
|
||||
|
||||
INCLUDE "../include/prbyte.a02" ;PRBYTE and PRHEX routine
|
42
include/x16.h02
Normal file
42
include/x16.h02
Normal file
@ -0,0 +1,42 @@
|
||||
/* C02 System Header file for Commander X16 */
|
||||
|
||||
/* Platform Specific Constants */
|
||||
#define DELKEY $14 //Delete/Backspace Key (DEL)
|
||||
#define ESCKEY $03 //Escape/Break Key (STOP)
|
||||
#define RTNKEY $0D //Return/Enter Key (RETURN)
|
||||
|
||||
/* Standard Library Pointers */
|
||||
zeropage char srclo,srchi; //Source Pointer for Library Functions
|
||||
zeropage char dstlo,dsthi; //String Pointer for Library Functions
|
||||
zeropage int srcptr,dstptr; //Source, Destination Pointers
|
||||
zeropage char bfrlo,bfrhi; //Buffer Pointer for Library Functions
|
||||
zeropage char blklo,blkhi; //Block Segment Pointer
|
||||
zeropage char stklo,stkhi; //Stack Pointer
|
||||
zeropage char xadrlo,xadrhi; //Physical Address LSB, MSB
|
||||
|
||||
/* Standard Library Variables */
|
||||
char blkslo,blkshi; //Block Start Address
|
||||
char blkelo,blkehi; //Block End Address
|
||||
char blklen; //Block Segment Length
|
||||
char stkslo,stkshi; //Stack Start Address
|
||||
char stkelo,stkehi; //Stsck End Address
|
||||
char random,rdseed; //Pseudo-Random Number Generation
|
||||
char temp0,temp1,temp2,temp3; //Temporary Storage
|
||||
char xmbank; //Physical Bank
|
||||
|
||||
/* System Subroutines */
|
||||
void delchr(); //Delete previous character
|
||||
char getkey(); //Read ASCII character from Keyboard
|
||||
char getpos(); //Get Cursor Position
|
||||
char getsiz(); //Get Screen Size
|
||||
void newlin(); //Advance cursor to beginning of next line
|
||||
char polkey(); //Poll Keyboard for character
|
||||
char putchr(); //Print ASCII character to Keyboard
|
||||
void prbyte(); //Print Accumulator as Hexadadecimal number
|
||||
void prhex(); //Print Low Nybble of Accumulator as Hex Digit
|
||||
char getchr(); //Wait for character from Keyboard
|
||||
void setpos(); //Set Cursor Position
|
||||
|
||||
//System Labels
|
||||
start: //Start of Code
|
||||
exit: //Return to Operating System
|
24
test/x16.bat
Normal file
24
test/x16.bat
Normal file
@ -0,0 +1,24 @@
|
||||
@REM Compile and Run C02 Program for Commander X16 Emulator
|
||||
@ECHO OFF
|
||||
IF EXIST %1.c02 GOTO COMPILE
|
||||
ECHO File %1.c02 not found
|
||||
GOTO EOF
|
||||
|
||||
:COMPILE
|
||||
ECHO Compiling File %1.c02 for Commander X16
|
||||
..\c02.exe -c 65C02 -h x16 -s x16 -s cbm %1 >%1.dbg
|
||||
IF %ERRORLEVEL% NEQ 0 GOTO EOF
|
||||
ECHO Assembling File %1.asm
|
||||
..\a02.exe -p %1.asm %1.prg %1.lst >%1.out
|
||||
REM C:\Programs\dasm %1.asm -f1 -o%1.prg -l%1.lst -s%1.sym
|
||||
|
||||
IF %ERRORLEVEL% NEQ 0 GOTO EOF
|
||||
|
||||
ECHO Starting Emulator in Debug Mode
|
||||
REM SET X16DIR=C:\Programs\x16emu
|
||||
REM SET X16EXE=%X16DIR%\x16emu.exe
|
||||
REM SET X16ROM=%X16DIR%\rom.bin
|
||||
REM SET X16CHR=%X16DIR%\chargen.bin
|
||||
REM %X16EXE% -rom %X16ROM% -char %X16CHR% -prg %1.prg -run -debug
|
||||
C:\Programs\x16emu\x16emu -prg %1.prg -run -debug -echo raw >%1.out
|
||||
:EOF
|
Loading…
Reference in New Issue
Block a user