1
0
mirror of https://github.com/RevCurtisP/C02.git synced 2024-11-27 19:49:41 +00:00

Updated header and batch files: Apple 1 & 2, C64, VIC20, X16, run6502

This commit is contained in:
Curtis F Kaylor 2020-10-19 15:42:10 -04:00
parent c3bc2c619e
commit 85b04dff00
27 changed files with 425 additions and 455 deletions

View File

@ -19,31 +19,29 @@ RTNKEY EQU $0D ;Return/Enter Key (Carriage Return)
.IN EQU $200 ;Input Buffer
;Standard Library Variables
SRCPTR EQU $30 ;Source String Pointer (stdio.a02)
DSTPTR EQU $32 ;Destination String Pointer (string.a02)
BFRLO EQU $34 ;Work Buffer Pointer
BFRHI EQU $35
BLKPTR EQU $36 ;Block Segment Pointer (block.a02)
STKLO EQU $38 ;System Pointer (pointer.a02)
STKHI EQU $39
SRCPTR EQU $30 ;Source String Pointer
DSTPTR EQU $32 ;Destination Pointer
BLKPTR EQU $34 ;Block Segment Pointer
STKPTR EQU $36 ;Stack Pointer
BLKBGN EQU $38 ;Block Start Address
BLKEND EQU $3A ;Block End Address
STKBGN EQU $3C ;Stack Start Address
STKEND EQU $3E ;Stack End Address
BLKLEN EQU $40 ;Block Segment Length
SYSBFP EQU $41 ;Position in System Buffer
RDSEED EQU $42 ;Pseudo-RANDOM Seed
RANDOM EQU $43 ;Pseudo-RANDOM Number Storage
TEMP0 EQU $44 ;Temporary Storage
TEMP1 EQU $45
TEMP2 EQU $46
TEMP3 EQU $47
TMPPTR EQU $48 ;Temporary Pointer
USRPTR EQU $4A ;User Pointer
; $4C-$4F ;Unused
; $50-$FF ;Free Zero Page for Applications
RDSEED EQU $3E ;Pseudo-RANDOM Seed
RANDOM EQU $3F ;Pseudo-RANDOM Number Storage
TEMP0 EQU $40 ;Temporary Storage
TEMP1 EQU $41
TEMP2 EQU $42
TEMP3 EQU $43
BLKLEN EQU $47 ;Block Segment Length
BLKBGN EQU $48 ;Block Start Address
BLKEND EQU $4A ;Block End Address
STKSLO EQU $4C ;Stack Start Address
STKSHI EQU $4D
STKELO EQU $4E ;Stack End Address
STKEHI EQU $4F
SYSBFP EQU $50 ;Position in System Buffer
SYSBFL EQU 128 ;System Buffer Size (128 Bytes)
SYSBFR EQU .IN ;System Buffer (Input Buffer
@ -56,7 +54,7 @@ SYSBFR EQU .IN ;System Buffer (Input Buffer
EXIT EQU $FF00 ;Monitor Entry Point
.ECHO EQU $FFEF ;Subroutine - Print Character in Accumulator
PRBYTE EQU $FFDC ;Subroutine - Print Accumulator as Hexadadecimal number
PRBYTE EQU $FFDC ;Subroutine - Print Accumulator as Hexadecimal Number
PRHEX EQU $FFE5 ;Subroutine - Print Low Nybble of Accumulator as Hex Digit
ORG $0300 ;Start one page above Monitor input buffer
@ -99,6 +97,6 @@ DELCHR: LDA #DELKEY ;Load Underscore Character
NEWLIN: LDA #$0D ;Load C/R into Accumulator
JMP PUTCHR ; and Print it
INCLUDE "../include/putstr.a02" ;PUTSTR routine
INCLUDE "putstr.a02" ;PUTSTR routine
ENDSUBROUTINE

View File

@ -1,37 +1,37 @@
/* Apple 1 Header File */
//Platform Specific Constants
/* Platform Specific Settings */
#pragma zeropage $50 $FF //Zero Page Free Space
/* Platform Specific Constants */
#define DELKEY $5F //Delete/Backspace Key
#define ESCKEY $1B //Escape/Stop Key
#define RTNKEY $0D //Return/Enter Key
#define SYSBFL 128 //System Buffer Length
/* Standard Library Variables */
zeropage int srcptr, dstptr, bfrptr, blkptr;
char stklo,skthi; //System Pointer
int blkbgn, blkend; //Block Start and End Address
char blklen; //Block Segment Length
char stkslo, stkshi; //Stack Start Address
char stkelo, stkehi; //Stack End Address
char random, rdseed; //Pseudo-Random Number Generator
char temp0, temp1, temp2, temp3; //Temporary Variables
zeropage int srcptr, dstptr; //Source and Destination Pointer
zeropage int blkptr, stkptr; //Block and Stack Pointers
zeropage int tmpptr, usrptr; //Temporary and User Pointer
int stkbgn, stkend; //Stack Begin and End Address
int blkbgn, blkend; //Block Begin and End Address
char blklen, xmbank; //Block Segment Length, Ext Memory Bank
int xmaddr; //Extended Memory Address
char random, rdseed; //Pseudo-Random Number and Seed
char temp0, temp1, temp2, temp3; //Temporary Storage
char sysbfr[], sysbfp; //System String Buffer and Position
//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
/* System Subroutines */
void delchr(); //Delete previous character
char getchr(); //Wait for character from Console
char getkey(); //Read ASCII character from Console
void newlin(); //Advance cursor to beginning of next line
char polkey(); //Poll Console for character
void prbyte(); //Print Accumulator as Hexadecimal number
void prhex(); //Print Low Nybble of Accumulator as Hex Digit
char putchr(); //Print ASCII character to Console
char getchr(); //Wait for character from Console
char putstr(); //Print ASCII string to Console
//System Labels
/* System Labels */
start: //Start of Code
exit: //Return to Operating System

View File

@ -9,29 +9,30 @@ RTNKEY EQU $0D ;Return/Enter Key (Return)
;Zero Page Variables (*=System Variable)
DSTPTR EQU $06 ;Destination Pointer [Unused]
BLKPTR EQU $08 ;Block Segment Pointer [Unused]
SYSBFP EQU $1D ;Stack Pointer [Unused]
; $1E ;Unused
STKLO EQU $2E ;Stack Pointer [Tape Read Work Area]
STKHI EQU $2F
RANDOM EQU $1F ;Random Number
SRCPTR EQU $08 ;Source Pointer [Unused]
STKPTR EQU $1D ;Stack Pointer [Unused]
RANDOM EQU $1F ;Random Number [Unused]
.INVFLG EQU $32 ;*Inverse Flag: $3F=Blinking, $7F=Inverse, $FF=Normal
SRCPTR EQU $71 ;Source Pointer [Temporary Register]
RDSEED EQU $E3 ;Random Seed
BLKBGN EQU $EB ;Block Start Address [Unused]
BLKEND EQU $ED ;Block End Address [Unused]
BLKLEN EQU $EF ;Block Segment Length [Unused]
BFRLO EQU $FA ;Work Buffer Pointer [Unused]
BFRHI EQU $FB
TEMP0 EQU $FC ;Temporary Variables [Unused]
TEMP1 EQU $FD
TEMP2 EQU $FE
TEMP3 EQU $FF
BLKPTR EQU $3C ;Block Segment Pointer [A1]
TEMP0 EQU $3E ;Temporary Variables [A2-A3]
TEMP1 EQU $3F
TEMP2 EQU $40
TEMP3 EQU $41
TMPPTR EQU $42 ;Temporary Pointer [A4]
USRPTR EQU $44 ;User Pointer[A5]
RDSEED EQU $4E ;Random Number Seed
; $71 ;[Temporary Register]
; $FA-$FF ;Free Zero Page for Applications
;System Variables
SYSBFL EQU 255 ;System Buffer Size [88 Bytes]
SYSBFR EQU $0300 ;System Buffer [Keyboard Buffer]
SYSBFL EQU 128 ;System Buffer Size [Max String Length]
SYSBFR EQU $0300 ;System Buffer [Keyboard Buffer through $0380]
SYSBFP EQU $03F6 ;System Buffer Position
BLKLEN EQU $03F7 ;Block Segment Length
BLKBGN EQU $03F8 ;Block Start Address
BLKEND EQU $03FA ;Block End Address
STKBGN EQU $03FC ;Stack Start Address
STKEND EQU $03FE ;Stack End Address
;I/O Locations
.KBD EQU $C000 ;Keyboard Data
@ -83,4 +84,4 @@ PRCHRX: JMP $FDF0 ;Execute Monitor Routine COUT1
;Advance Character to Next line
NEWLIN EQU $FD8E ;Monitor Routine CROUT
INCLUDE "../include/putstr.a02" ;PUTSTR routine
INCLUDE "putstr.a02" ;PUTSTR routine

View File

@ -1,49 +1,37 @@
/* Apple ][ Header File */
/* Platform Specific Settings */
#pragma zeropage $FA $FF //Zero Page Free Space
/* Platform Specific Constants */
#define DELKEY $08 //Delete/Backspace Key
#define ESCKEY $1B //Escape/Stop Key
#define RTNKEY $0D //Return/Enter Key
#define SYSBFL 255 //System Buffer Length
/* Standard Library Pointers */
zeropage int srcptr, dstptr, bfrptr, blkptr;
char bfrlo,bfrhi; //Buffer Pointer for Library Functions
char stklo,stkhi; //System Pointer
/* Standard Library Variables */
int blkbgn, blkend; //Block Start and 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 Variables
zeropage int srcptr, dstptr; //Source and Destination Pointer
zeropage int blkptr, stkptr; //Block and Stack Pointers
zeropage int tmpptr, usrptr; //Temporary and User Pointer
int stkbgn, stkend; //Stack Begin and End Address
int blkbgn, blkend; //Block Begin and End Address
char blklen, xmbank; //Block Segment Length, Ext Memory Bank
int xmaddr; //Extended Memory Address
char random, rdseed; //Pseudo-Random Number and Seed
char temp0, temp1, temp2, temp3; //Temporary Storage
char sysbfr[], sysbfp; //System String Buffer and Position
/* Platform Specific Variables */
char invflg; //Video Invert Mask
/* Keyboard I/O */
char kbd; //Keyboard Data Register
char akd; //Keyboard Strobe Register
/* Monitor Subroutines */
void prbyte(); //Print Accumulator as Hexadecimal number
void prhex(); //Print Low Nybble of Accumulator as Hex Digit
/* System Subroutines */
void clrscr(); //Clear the Screen
void delchr(); //Delete previous character
char getchr(); //Wait for character from Console
char getkey(); //Read ASCII character from Console
char getpos(); //Get Cursor Position
char getsiz(); //Get Screen Size
void newlin(); //Advance cursor to beginning of next line
char polkey(); //Poll Console for character
void prbyte(); //Print Accumulator as Hexadecimal number
void prhex(); //Print Low Nybble of Accumulator as Hex Digit
char putchr(); //Print ASCII character to Console
char putstr(); //Print ASCII string to Console
void setpos(); //Set Cursor Position
//System Labels
/* System Labels */
start: //Start of Code
exit: //Return to Operating System

View File

@ -6,24 +6,27 @@ ESCKEY EQU $03 ;Escape/Stop Key (RUN/STOP)
RTNKEY EQU $0D ;Return/Enter Key (RETURN)
;Zero Page Variables
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]
DSTPTR EQU $24 ;Destination Pointer [Temporary Pointers]
BLKPTR EQU $26 ;Block Pointer [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]
XMBANK EQU $0A ;Extended Memory Bank [Load/Verify Flag]
XMADDR EQU $0B ;Extended Memory Address [Array Index/Flags]
; $16 ;[Temporary String Stack Pointer]
SRCPTR EQU $17 ;Source Pointer [Temporary String Space Pointer]
DSTPTR EQU $19 ;Destination Pointer [Temporary String Stack]
; $21 ;[Temporary String Stack]
BLKPTR EQU $22 ;Block Pointer [Temporary Pointers]
STKPTR EQU $24 ;Stack Pointer [Temporary Pointers]
; $26-$29 ;[Floating Point Work Area]
USRPTR EQU $35 ;[Temporary String Pointer]
TEMP0 EQU $61 ;Temporary Variable [Floating Point Accumulator]
TEMP1 EQU $63 ;Temporary Variable [Floating Point Accumulator]
TEMP2 EQU $65 ;Temporary Variable [Floating Point Accumulator]
TEMP3 EQU $67 ;Temporary Variable [Floating Point Accumulator]
TMPPTR EQU $69 ;Temporary Pointer [Floating Point Argument]
; $6A-$70 ;[Floating Point Argument]
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]
; $FB-$FE ;Unused Zero Page for Applications
;System Variables
SYSBFL EQU 88 ;System Buffer Size [88 Bytes]
SYSBFL EQU 88 ;System Buffer Size (88 Bytes)
SYSBFR EQU $0200 ;System Buffer [Keyboard Buffer]
SYSBFP EQU $0313 ;Position in System Buffer [Free Byte]
@ -33,13 +36,11 @@ BLKLEN EQU $0338 ;Block Length [Unused Byte]
RANDOM EQU $0339 ;Random Number Storage [Unused Byte]
STKSAV EQU $033A ;Machine Stack Storage [Unused Byte]
USER11 EQU $033B ;Free Byte for User Programs
; $033B ;Free Byte for User Programs
TBFFR EQU $033C ;Cassette I/O Buffer
STKSLO EQU $03FC ;Stack Start LSB [Unused Byte]
STKSHI EQU $03FD ;Stack Start MSB [Unused Byte]
STKELO EQU $03FE ;Stack End LSB [Unused Byte]
STKEHI EQU $03FF ;Stack End MSB [Unused Byte]
STKBGN EQU $03FC ;Stack Start [Unused Byte]
STKEND EQU $03FE ;Stack End [Unused Byte]
;Video RAM and ROM
VICSCN EQU $0400 ;Video Screen Memory Area (Unexpanded)
@ -65,7 +66,7 @@ START: TSX ;Get Stack Pointer
EXIT: LDX STKSAV ;Retrieve Saved Stack Pointer
TXS ;and Restore It
RTS ;Return to BASIC
RTS
;Poll Keyboard for Character
POLKEY EQU $FFE4 ;Aliased to Kernal GETIN Routine

View File

@ -1,38 +1,37 @@
/* Platform Specific Header file for Commodore 64 */
/* Platform Specific Settings */
#pragma zeropage $FB $FE //Zero Page Free Space
/* Platform Specific Constants */
#define DELKEY $14 //Delete/Backspace Key (DEL)
#define ESCKEY $03 //Escape/Break Key (STOP)
#define RTNKEY $0D //Return/Enter Key (RETURN)
#define SYSBFL 88 //System Buffer Length
/* Standard Library Pointers */
zeropage int srcptr, dstptr, bfrptr, blkptr;
char bfrlo,bfrhi; //Buffer Pointer for Library Functions
char stklo,stkhi; //Stack Pointer
/* Standard Library Variables */
int blkbgn, blkend; //Block Start and End Address
char blklen; //Block Segment Length
char stkslo, stkshi; //Stack Start Address
char stkelo, stkehi; //Stack End Address
char random, rdseed; //Pseudo-Random Number Generator
zeropage int srcptr, dstptr; //Source and Destination Pointer
zeropage int blkptr, stkptr; //Block and Stack Pointers
zeropage int tmpptr, usrptr; //Temporary and User Pointer
int stkbgn, stkend; //Stack Begin and End Address
int blkbgn, blkend; //Block Begin and End Address
char blklen, xmbank; //Block Segment Length, Ext Memory Bank
int xmaddr; //Extended Memory Address
char random, rdseed; //Pseudo-Random Number and Seed
char temp0, temp1, temp2, temp3; //Temporary Storage
char sysbfr[], sysbfp; //System String Buffer and Position
/* System Subroutines */
void delchr(); //Delete previous character
char getkey(); //Read ASCII character from Keyboard
char getpos(); //Get Cursor Position
char getsiz(); //Get Screen Size
char getchr(); //Wait for character from Console
char getkey(); //Read ASCII character from Console
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
char polkey(); //Poll Console for character
void prbyte(); //Print Accumulator as Hexadecimal number
void prhex(); //Print Low Nybble of Accumulator as Hex Digit
char getchr(); //Wait for character from Keyboard
void setpos(); //Set Cursor Position
char putchr(); //Print ASCII character to Console
char putstr(); //Print ASCII string to Console
//System Labels
/* System Labels */
start: //Start of Code
exit: //Return to Operating System

View File

@ -1,43 +1,47 @@
; Program initialization code for C02 programs
; Template for System Specific Code
;Template Program Initialization code for C02 programs
;System Specific ASCII Key Mappings
DELKEY EQU $7F ;Delete/Backspace Key ($08=Backspace, $7F=Delete)
ESCKEY EQU $1B ;Escape/Stop Key ($03=Ctrl-C, $1B=Escape)
RTNKEY EQU $0D ;Return/Enter Key ($0D=Carriage Return)
NULKEY EQU $00 ;No Key was Pressed ($00=Null)
;Zero Page Locations
SRCPTR EQU $00 ;Source Pointer
DSTPTR EQU $02 ;Destination Pointer
BFRLO EQU $04 ;Work Buffer Pointer
BFRHI EQU $05
BLKPTR EQU $34 ;Block Segment Pointer
STKPTR EQU $06 ;Stack Pointer
USRPTR EQU $08 ;User Pointer
XMADDR EQU $0A ;Extended Memory Address
XMBANK EQU $0C ;Extended Memory Bank
STKSAV EQU $0D ;Stack Pointer Storage
RDSEED EQU $0E ;Pseudo-RANDOM Seed
RANDOM EQU $0F ;Pseudo-RANDOM Number Storage
TEMP0 EQU $10 ;Temporary Storage
TEMP1 EQU $11
TEMP2 EQU $12
TEMP3 EQU $12
TEMP3 EQU $13
TMPPTR EQU $14 ;Temporary Pointer
BLKBGN EQU $20 ;Block Start Address
BLKEND EQU $22 ;Block End Address
BLKPTR EQU $24 ;Block Pointer
BLKLEN EQY $26 ;Block Segment Length
BLKBGN EQU $16 ;Block Start Address
BLKEND EQU $18 ;Block End Address
BLKLEN EQU $1A ;Block Segment Length
SYSBFP EQU $1B ;Position in System Buffer
STKBGN EQU $1C ;Stack Start Address
STKEND EQU $1E ;Stack End Address
; $20-$FF ;Free Zero Page for Applications
STKSLO EQU $28 ;Stack Start Address
STKSHI EQU $29
STKELO EQU $2A ;Stack End Address
STKEHI EQU $2B
STKLO EQU $2C ;Stack Pointer
STKHI EQU $2D
SYSBFL EQU 128 ;System Buffer Size (Max String Size)
SYSBFR EQU $0200 ;System Buffer
; $0281-$02FF ;Unused
;Placeholders Labels for the Example Code Below
POLKEY EQU $FFFE ;ROM Read Key Routine
WSTART EQU $FFFF ;BASIC Warm Start Routine
ORG $0200 ;Program Start Address
ORG $0300 ;Program Start Address
START: NOP ;System specific initialization code
TXS ;If an RTS is used to return to the Operating System,
@ -75,10 +79,8 @@ NEWLIN: RTS ;Code to move Cursor to beginning of next line
;May emit Carriage Return, Line Feed, or both
;Print Character to Screen
PUTCHR RTS ;Code to write ASCII character to Screen
PUTCHR: RTS ;Code to write ASCII character to Screen
INCLUDE "prbyte.a02" ;PRBYTE and PRHEX routines
INCLUDE "putstr.a02" ;PUTSTR routine
;System Key Names
KNAMES BYTE "DELETE",0,"ESCAPE",0,"RETURN",0

View File

@ -1,46 +1,37 @@
/* System Specific C02 Header File Template */
/* This header contains standardized Constants, *
* Variables, and Function Calls tailored to a *
* a specific platform. */
/* Platform Specific Settings */
#pragma zeropage $50 $FF //Zero Page Free Space
/* System Specific ASCII Key Codes */
/* Platform Specific Constants */
#define DELKEY $7F //Delete/Backspace Key
#define ESCKEY $1B //Escape/Stop Key
#define RTNKEY $0D //Return/Enter Key
#define SYSBFL 128 //System Buffer Length
/* Zero Page Variables used as Pointers */
zeropage int srcptr, dstptr, bfrptr, blkptr;
char stklo,stkhi; //Stack Pointer
/* Ephemeral Library Variables *
* Available for use in program code, but may *
* be obliterated by Function Calls. *
* May be Zero Page, but not required */
char temp0,temp1,temp2,temp3; //Temporary variables
/* Static Library Variables *
* Must be preserved between function calls *
* May be Zero Page, but not required */
int blkbgn, blkend; //Block Start and End Address
char blklen; //Block Segment Length
char stkslo, stkshi; //Stack Start Address
char stkelo, stkehi; //Stsck End Address
char random; //Last Result of Pseudo-Random Number Generator
char rdseed; //System Seed for Pseudo-Random Number Generator
/* Standard Library Variables */
zeropage int srcptr, dstptr; //Source and Destination Pointer
zeropage int blkptr, stkptr; //Block and Stack Pointers
zeropage int tmpptr, usrptr; //Temporary and User Pointer
int stkbgn, stkend; //Stack Begin and End Address
int blkbgn, blkend; //Block Begin and End Address
char blklen, xmbank; //Block Segment Length, Ext Memory Bank
int xmaddr; //Extended Memory Address
char random, rdseed; //Pseudo-Random Number and Seed
char temp0, temp1, temp2, temp3; //Temporary Storage
char sysbfr[], sysbfp; //System String Buffer and Position
//System Subroutines
/* System Subroutines */
void delchr(); //Delete previous character
char getchr(); //Wait for character from Console
char getkey(); //Read ASCII character from Console
void newlin(); //Advance cursor to beginning of next line
char polkey(); //Poll Console for character
char putchr(); //Print ASCII character to Console
void prbyte(); //Print Accumulator as Hexadadecimal number
void prbyte(); //Print Accumulator as Hexadecimal number
void prhex(); //Print Low Nybble of Accumulator as Hex Digit
char putchr(); //Print ASCII character to Console
char putstr(); //Print ASCII string to Console
//System Labels
/* System Labels */
start: //Start of Code
exit: //Return to Operating System

View File

@ -2,18 +2,19 @@
;System Specific ASCII Key Mappings
DELKEY EQU $08 ;Delete/Backspace Key (Backspace)
ESCKEY EQU $18 ;Escape/Stop Key (Control-X)
ESCKEY EQU $1B ;Escape/Stop Key (Escape)
RTNKEY EQU $0D ;Return/Enter Key (Carriage Return)
;Zero Page Locations
SRCPTR EQU $30 ;Source String Pointer (stdio.a02)
DSTPTR EQU $32 ;Destination String Pointer (string.a02)
BFRPTR EQU $34 ;Work Buffer Pointer
BFRLO EQU $34
BFRHI EQU $35
BLKPTR EQU $36 ;Block Segment Pointer (block.a02)
STKLO EQU $38 ;Stack Pointer (stack.a02)
STKHI EQU $39
SRCPTR EQU $30 ;Source String Pointer
DSTPTR EQU $32 ;Destination String Pointer
BLKPTR EQU $34 ;Block Segment Pointer
STKPTR EQU $36 ;Stack Pointer
USRPTR EQU $38 ;User Pointer
XMADDR EQU $3A ;Extended Memory Address
XMBANK EQU $3C ;Extended Memory Bank
; $3D ;Unused
RDSEED EQU $3E ;Pseudo-RANDOM Seed
RANDOM EQU $3F ;Pseudo-RANDOM Number Storage
@ -22,21 +23,19 @@ TEMP0 EQU $40 ;Temporary Storage
TEMP1 EQU $41
TEMP2 EQU $42
TEMP3 EQU $43
TMPPTR EQU $44 ;Temporary Pointer
BLKBGN EQU $46
BLKEND EQU $48
BLKLEN EQU $4A ;Block Segment Length
STKSLO EQU $4C ;Stack Start Address
STKSHI EQU $4D
STKELO EQU $4E ;Stack End Address
STKEHI EQU $4F
SYSBFP EQU $50 ;Position in System Buffer
SYSBFP EQU $4B ;Position in System Buffer
STKBGN EQU $4C ;Stack Start Address
STKEND EQU $4E ;Stack End Address
; $50-$FF ;Free Zero Page for Applications
SYSBFL EQU 128 ;System Buffer Size (Max String Size)
SYSBFR EQU $0200 ;System Buffer
; $0281-$03FF ;Unused
;Memory Mapped I/O
_KBHIT EQU $FFF0 ;Is a Key Pressed

View File

@ -1,43 +1,37 @@
/* run6502 Header File */
//Platform Specific Constants
/* Platform Specific Settings */
#pragma zeropage $50 $FF //Zero Page Free Space
/* Platform Specific Constants */
#define DELKEY $08 //Delete/Backspace Key
#define ESCKEY $18 //Escape/Stop Key
#define RTNKEY $0A //Return/Enter Key
#define ESCKEY $1B //Escape/Stop Key
#define RTNKEY $0D //Return/Enter Key
#define SYSBFL 128 //System Buffer Length
const char delnam; //Delete/Backspace Key Name
const char escnam; //Escape/Stop Key Name
const char rtnnam; //Return/Enter Key Name
//Library Pointer Variables
zeropage int srcptr, dstptr, bfrptr, blkptr;
char bfrlo,bfrhi; //Buffer Pointer for Library Functions
char stklo,stkhi; //Stack Pointer
//Library Variables
int blkbgn, blkend;
char blklen; //Block Segment Length
char stkslo, stkshi; //Stack Start Address
char stkelo, stkehi; //Stsck End Address
char random, rdseed; //Pseudo-Random Number Generation
/* Standard Library Variables */
zeropage int srcptr, dstptr; //Source and Destination Pointer
zeropage int blkptr, stkptr; //Block and Stack Pointers
zeropage int tmpptr, usrptr; //Temporary and User Pointer
int stkbgn, stkend; //Stack Begin and End Address
int blkbgn, blkend; //Block Begin and End Address
char blklen, xmbank; //Block Segment Length, Ext Memory Bank
int xmaddr; //Extended Memory Address
char random, rdseed; //Pseudo-Random Number and Seed
char temp0, temp1, temp2, temp3; //Temporary Storage
char sysbfr[], sysbfp; //System String Buffer and Position
//Memory Mapped I/O
char putcon; //Write Character to Console
char getcon; //Read Character from Console
//System Subroutines
/* System Subroutines */
void delchr(); //Delete previous character
char getchr(); //Wait for character from Console
char getkey(); //Read ASCII character from Console (Exits Emulator)
char getkey(); //Read ASCII character from Console
void newlin(); //Advance cursor to beginning of next line
char polkey(); //Poll Console for character (Exits Emulator)
char putchr(); //Print ASCII character to Console
void prbyte(); //Print Accumulator as Hexadadecimal number
char polkey(); //Poll Console for character
void prbyte(); //Print Accumulator as Hexadecimal number
void prhex(); //Print Low Nybble of Accumulator as Hex Digit
char putchr(); //Print ASCII character to Console
char putstr(); //Print ASCII string to Console
//System Labels
/* System Labels */
start: //Start of Code
exit: //Return to Operating System

View File

@ -1,102 +0,0 @@
;c02 Program Initialization Code for Vic-20 - Common Code
;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 Locations
SRCPTR EQU $22 ;Source Pointer [Temporary Pointers]
DSTPTR EQU $24 ;Destination Pointer [Temporary Pointers]
BLKPTR EQU $26 ;Block Pointer [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]
;System Variables
SYSBFL EQU 88 ;System Buffer Size [88 Bytes]
SYSBFR EQU $0200 ;System Buffer [Keyboard Buffer]
USER0 EQU $0310 ;Free Byte for User Programs
USER1 EQU $0311 ;Free Byte for User Programs
USER2 EQU $0312 ;Free Byte for User Programs
SYSBFP EQU $0313 ;Position in System Buffer [Free Byte]
BLKBGN EQU $0334 ;Block Start [Unused Byte]
BLKEND EQU $0336 ;Block Start [Unused Byte]
BLKLEN EQU $0338 ;Block Length [Unused Byte]
RANDOM EQU $0339 ;Random Number Storage [Unused Byte]
STKSAV EQU $033A ;Machine Stack Storage [Unused Byte]
USER11 EQU $033B ;Free Byte for User Programs
TBFFR EQU $033C ;Cassette I/O Buffer
STKSLO EQU $03FC ;Stack Start LSB [Unused Byte]
STKSHI EQU $03FD ;Stack Start MSB [Unused Byte]
STKELO EQU $03FE ;Stack End LSB [Unused Byte]
STKEHI EQU $03FF ;Stack End MSB [Unused Byte]
;ROM Routines
FSFLFA EQU $F3D4 ;Find Logical File A
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 ;Get Key From Keybord
;Get Character from Keyboard
;GETKEY: JSR POLKEY ;Get Key From Keybord
; ;The below is not working...
; LDY $9005 ;Get Character Memory Offset
; CPY #242 ;If Upper/Lower
; BNE GETKEX
; BIT $FF ; Bit 7 -> C, Bit 6 -> V
; BVC GETKEX ; If Bit 6 Set (Alpha)
; BCC GETKEL ; If Bit 7 Set (PETSCII Upper)
; AND #$7F ; Clear Bit 7 (ASCII Upper)
; BNE GETKEX ; Else
;GETKEL: ORA #$20 ; Set Bit 5 (ASCII Lower)
;GETKEX: ORA #$00 ;Set Flags
; RTS
;A = $41 %0100 0001
;a = $C1 %1100 0001 PETSCII
;a = $61 %0110 0001 PETSCII
;$9005 = 240 UPR/GFX
; 242 UPR/LWR
;Wait for Character from Keyboard
GETCHR: JSR GETKEY ;Poll Keyboard
BEQ GETCHR ;If No Key, Loop
RTS
;Print Character to Console
;uses direct call to SCRNOUT instead of CHROUT
PUTCHR EQU $E742 ;Aliased to SRCOUT Routine
;Delete Previous Character
DELCHR: LDA #DELKEY ;Load Delete Character
JMP PUTCHR ;Print and Return
;Advance Character to Next line
NEWLIN: LDX #0 ;Store 0
STX $D3 ;in Cursor Column and
JMP $E8C3 ;Execute NXTLINE Routine
;Print Zero-Terminated String
PUTSTR: TXA ;Copy LSB to Accumulator
JMP $CB1E ;Execute STROUT Routine

View File

@ -1,5 +1,7 @@
; c02 Program Initialization Code for Unexpanded VIC-20
INCLUDE "vicequ.a02" ;Include VIC 20 Common Code
;Video RAM and ROM
VICSCN EQU $1E00 ;Video Screen Memory Area (Unexpanded)
CHRROM EQU $8000 ;Character Generator ROM
@ -15,5 +17,5 @@ BASIC: DC $0C, $10 ;Pointer to Next Line
DC $00 ;End of Line Marker
DC $00, $00 ;End of Basic Program
INCLUDE "../include/vic.a02" ;Include VIC 20 Common Code
INCLUDE "../include/prbyte.a02" ;PRBYTE and PRHEX routines
INCLUDE "vicasm.a02" ;Include VIC 20 Common Code
INCLUDE "prbyte.a02" ;PRBYTE and PRHEX routines

View File

@ -1,38 +1,37 @@
/* Unexpanded VIC 20 Header File */
/* Platform Specific Settings */
#pragma zeropage $FB $FE //Zero Page Free Space
/* Platform Specific Constants */
#define DELKEY $14 //Delete/Backspace Key (DEL)
#define ESCKEY $03 //Escape/Break Key (STOP)
#define ESCKEY $03 //Escape/Stop Key (STOP)
#define RTNKEY $0D //Return/Enter Key (RETURN)
#define SYSBFL 88 //System Buffer Length
/* Standard Library Pointers */
zeropage int srcptr, dstptr, bfrptr, blkptr;
char bfrlo,bfrhi; //Buffer Pointer for Library Functions
char stklo,stkhi; //Stack Pointer
/* Standard Library Variables */
int blkbgn, blkend; //Block Start and 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
zeropage int srcptr, dstptr; //Source and Destination Pointer
zeropage int blkptr, stkptr; //Block and Stack Pointers
zeropage int tmpptr, usrptr; //Temporary and User Pointer
int stkbgn, stkend; //Stack Begin and End Address
int blkbgn, blkend; //Block Begin and End Address
char blklen, xmbank; //Block Segment Length, Ext Memory Bank
int xmaddr; //Extended Memory Address
char random, rdseed; //Pseudo-Random Number and Seed
char temp0, temp1, temp2, temp3; //Temporary Storage
char sysbfr[], sysbfp; //System String Buffer and Position
/* System Subroutines */
void delchr(); //Delete previous character
char getkey(); //Read ASCII character from Keyboard
char getpos(); //Get Cursor Position
char getsiz(); //Get Screen Size
char getchr(); //Wait for character from Console
char getkey(); //Read ASCII character from Console
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
char polkey(); //Poll Console for character
void prbyte(); //Print Accumulator as Hexadecimal number
void prhex(); //Print Low Nybble of Accumulator as Hex Digit
char getchr(); //Wait for character from Keyboard
void setpos(); //Set Cursor Position
char putchr(); //Print ASCII character to Console
char putstr(); //Print ASCII string to Console
//System Labels
/* System Labels */
start: //Start of Code
exit: //Return to Operating System

View File

@ -1,5 +1,7 @@
;c02 Program Initialization Code for VIC-20 with 3K Expansion
INCLUDE "vicequ.a02" ;Include VIC 20 Common Code
;Video RAM and ROM
VICSCN EQU $1E00 ;Video Screen Memory Area (Unexpanded)
CHRROM EQU $8000 ;Character Generator ROM
@ -15,6 +17,6 @@ BASIC: DC $0C, $04 ;Pointer to Next Line
DC $00 ;End of Line Marker
DC $00, $00 ;End of Basic Program
INCLUDE "../include/vic.a02" ;Include VIC 20 Common Code
INCLUDE "../include/prbyte.a02" ;PRBYTE and PRHEX routines
INCLUDE "vicasm.a02" ;Include VIC 20 Common Code
INCLUDE "prbyte.a02" ;PRBYTE and PRHEX routines

View File

@ -1,37 +1,37 @@
/* VIC 20 with 3k Expansion Header File */
//#pragma ascii invert //switch case for PETSCII
/* Platform Specific Settings */
#pragma zeropage $FB $FE //Zero Page Free Space
//Platform Specific Constants
/* Platform Specific Constants */
#define DELKEY $14 //Delete/Backspace Key (DEL)
#define ESCKEY $03 //Escape/Stop Key (STOP)
#define RTNKEY $0D //Return/Enter Key (RETURN)
#define SYSBFL 88 //System Buffer Length
/* Standard Library Pointers */
zeropage int srcptr, dstptr, bfrptr, blkptr;
char bfrlo,bfrhi; //Buffer Pointer for Library Functions
char stklo,stkhi; //Stack Pointer
/* Standard Library Variables */
int blkbgn, blkend; //Block Start and 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
zeropage int srcptr, dstptr; //Source and Destination Pointer
zeropage int blkptr, stkptr; //Block and Stack Pointers
zeropage int tmpptr, usrptr; //Temporary and User Pointer
int stkbgn, stkend; //Stack Begin and End Address
int blkbgn, blkend; //Block Begin and End Address
char blklen, xmbank; //Block Segment Length, Ext Memory Bank
int xmaddr; //Extended Memory Address
char random, rdseed; //Pseudo-Random Number and Seed
char temp0, temp1, temp2, temp3; //Temporary Storage
char sysbfr[], sysbfp; //System String Buffer and Position
//System Subroutines
char polkey(); //Poll Console for character
/* System Subroutines */
void delchr(); //Delete previous character
char getchr(); //Wait for character from Console
char getkey(); //Read ASCII character from Console
void newlin(); //Advance cursor to beginning of next line
void delchr(); //Delete previous character
char putchr(); //Print ASCII character to Console
void prbyte(); //Print Accumulator as Hexadadecimal number
char polkey(); //Poll Console for character
void prbyte(); //Print Accumulator as Hexadecimal number
void prhex(); //Print Low Nybble of Accumulator as Hex Digit
char putchr(); //Print ASCII character to Console
char putstr(); //Print ASCII string to Console
//System Labels
/* System Labels */
start: //Start of Code
exit: //Return to Operating System

View File

@ -1,5 +1,7 @@
;c02 Program Initialization Code for Vic-20 with at 8K Expansion
INCLUDE "vicequ.a02" ;Include VIC 20 Common Code
;Video RAM and ROM
VICSCN EQU $1000 ;Video Screen Memory Area (Unexpanded)
CHRROM EQU $8000 ;Character Generator ROM
@ -15,5 +17,5 @@ BASIC: DC $0C, $12 ;Pointer to Next Line
DC $00 ;End of Line Marker
DC $00, $00 ;End of Basic Program
INCLUDE "../include/vic.a02" ;Include VIC 20 Common Code
INCLUDE "../include/prbyte.a02" ;PRBYTE and PRHEX routines
INCLUDE "vicasm.a02" ;Include VIC 20 Common Code
INCLUDE "prbyte.a02" ;PRBYTE and PRHEX routines

View File

@ -1,41 +1,37 @@
/* VIC 20 with 8k Expansion Header File */
//#pragma ascii invert //switch case for PETSCII
/* Platform Specific Settings */
#pragma zeropage $FB $FE //Zero Page Free Space
//Platform Specific Constants
/* Platform Specific Constants */
#define DELKEY $14 //Delete/Backspace Key (DEL)
#define ESCKEY $03 //Escape/Stop Key (STOP)
#define RTNKEY $0D //Return/Enter Key (RETURN)
#define SYSBFL 88 //System Buffer Length
/* Standard Library Pointers */
zeropage int srcptr, dstptr, bfrptr, blkptr;
char bfrlo,bfrhi; //Buffer Pointer for Library Functions
char stklo,stkhi; //Stack Pointer
/* Standard Library Variables */
int blkbgn, blkend; //Block Start and 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
zeropage int srcptr, dstptr; //Source and Destination Pointer
zeropage int blkptr, stkptr; //Block and Stack Pointers
zeropage int tmpptr, usrptr; //Temporary and User Pointer
int stkbgn, stkend; //Stack Begin and End Address
int blkbgn, blkend; //Block Begin and End Address
char blklen, xmbank; //Block Segment Length, Ext Memory Bank
int xmaddr; //Extended Memory Address
char random, rdseed; //Pseudo-Random Number and Seed
char temp0, temp1, temp2, temp3; //Temporary Storage
char sysbfr[], sysbfp; //System String Buffer and Position
//System Subroutines
char polkey(); //Poll Console for character
/* System Subroutines */
void delchr(); //Delete previous character
char getchr(); //Wait for character from Console
char getkey(); //Read ASCII character from Console
void newlin(); //Advance cursor to beginning of next line
void delchr(); //Delete previous character
char putchr(); //Print ASCII character to Console
void prbyte(); //Print Accumulator as Hexadadecimal number
char polkey(); //Poll Console for character
void prbyte(); //Print Accumulator as Hexadecimal number
void prhex(); //Print Low Nybble of Accumulator as Hex Digit
void clrscr(); //Clear the Screen
char getsiz(); //Get Screen Size
char getpos(); //Get Cursor Position
void setpos(); //Set Cursor Position
char putchr(); //Print ASCII character to Console
char putstr(); //Print ASCII string to Console
//System Labels
/* System Labels */
start: //Start of Code
exit: //Return to Operating System

58
include/vicasm.a02 Normal file
View File

@ -0,0 +1,58 @@
;c02 Program Initialization Code for Vic-20 - Common Code
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 ;Get Key From Keybord
;Get Character from Keyboard
;GETKEY: JSR POLKEY ;Get Key From Keybord
; ;The below is not working...
; LDY $9005 ;Get Character Memory Offset
; CPY #242 ;If Upper/Lower
; BNE GETKEX
; BIT $FF ; Bit 7 -> C, Bit 6 -> V
; BVC GETKEX ; If Bit 6 Set (Alpha)
; BCC GETKEL ; If Bit 7 Set (PETSCII Upper)
; AND #$7F ; Clear Bit 7 (ASCII Upper)
; BNE GETKEX ; Else
;GETKEL: ORA #$20 ; Set Bit 5 (ASCII Lower)
;GETKEX: ORA #$00 ;Set Flags
; RTS
;A = $41 %0100 0001
;a = $C1 %1100 0001 PETSCII
;a = $61 %0110 0001 PETSCII
;$9005 = 240 UPR/GFX
; 242 UPR/LWR
;Wait for Character from Keyboard
GETCHR: JSR GETKEY ;Poll Keyboard
BEQ GETCHR ;If No Key, Loop
RTS
;Print Character to Console
;uses direct call to SCRNOUT instead of CHROUT
PUTCHR EQU $E742 ;Aliased to SRCOUT Routine
;Delete Previous Character
DELCHR: LDA #DELKEY ;Load Delete Character
JMP PUTCHR ;Print and Return
;Advance Character to Next line
NEWLIN: LDX #0 ;Store 0
STX $D3 ;in Cursor Column and
JMP $E8C3 ;Execute NXTLINE Routine
;Print Zero-Terminated String
PUTSTR: TXA ;Copy LSB to Accumulator
JMP $CB1E ;Execute STROUT Routine

50
include/vicequ.a02 Normal file
View File

@ -0,0 +1,50 @@
;c02 Program Initialization Code for Vic-20 - Common Equates
;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 Locations
XMBANK EQU $0A ;Extended Memory Bank [Load/Verify Flag]
XMADDR EQU $0B ;Extended Memory Address [Array Index/Flags]
; $16 ;[Temporary String Stack Pointer]
SRCPTR EQU $17 ;Source Pointer [Temporary String Space Pointer]
DSTPTR EQU $19 ;Destination Pointer [Temporary String Stack]
; $21 ;[Temporary String Stack]
BLKPTR EQU $22 ;Block Pointer [Temporary Pointers]
STKPTR EQU $24 ;Stack Pointer [Pointer to TO Variable]
; $26-$29 ;[Floating Point Work Area]
USRPTR EQU $35 ;[Temporary String Pointer]
TEMP0 EQU $61 ;Temporary Variable [Floating Point Accumulator]
TEMP1 EQU $63 ;Temporary Variable [Floating Point Accumulator]
TEMP2 EQU $65 ;Temporary Variable [Floating Point Accumulator]
TEMP3 EQU $67 ;Temporary Variable [Floating Point Accumulator]
TMPPTR EQU $69 ;Temporary Pointer [Floating Point Argument]
; $6A-$70 ;[Floating Point Argument]
RDSEED EQU $A2 ;Random Seed [Software Jiffy Clock (Low Byte)
; $FB-$FE ;Unused Zero Page for Applications
;System Variables
SYSBFL EQU 88 ;System Buffer Size [88 Bytes]
SYSBFR EQU $0200 ;System Buffer [Keyboard Buffer]
USER0 EQU $0310 ;Free Byte for User Programs
USER1 EQU $0311 ;Free Byte for User Programs
USER2 EQU $0312 ;Free Byte for User Programs
SYSBFP EQU $0313 ;Position in System Buffer [Free Byte]
BLKBGN EQU $0334 ;Block Start [Unused Byte]
BLKEND EQU $0336 ;Block Start [Unused Byte]
BLKLEN EQU $0338 ;Block Length [Unused Byte]
RANDOM EQU $0339 ;Random Number Storage [Unused Byte]
STKSAV EQU $033A ;Machine Stack Storage [Unused Byte]
USER11 EQU $033B ;Free Byte for User Programs
TBFFR EQU $033C ;Cassette I/O Buffer
STKBGN EQU $03FC ;Stack Start [Unused Byte]
STKEND EQU $03FE ;Stack End [Unused Byte]
;ROM Routines
FSFLFA EQU $F3D4 ;Find Logical File A

View File

@ -10,41 +10,37 @@ RTNKEY EQU $0D ;Return/Enter Key (RETURN)
; $02-$21 ;ABI Registers
; $22-$52 ;Used by Basic graphics commands
XMBANK EQU $53 ;Extended Memory Bank
XADRLO EQU $54 ;Ext Memory Address LSB
XADRHI EQU $55 ;Ext Memory Address MSB
XMADDR EQU $54 ;Ext Memory Address
SRCPTR EQU $56 ;Source Pointer
DSTPTR EQU $59 ;Destination Pointer
BLKPTR EQU $5C ;Block Pointer
STKLO EQU $5E ;Stack Pointer LSB
STKHI EQU $5F ;Stack Pointer MSB
BFRLO EQU $60 ;Buffer Pointer LSB
BFRHI EQU $61 ;Buffer Pointer MSB
DSTPTR EQU $58 ;Destination Pointer
BLKPTR EQU $5A ;Block Pointer
STKPTR EQU $5C ;Stack Pointer
USRPTR EQU $5E ;User Pointer
RANDOM EQU $62 ;Random Number Storage
RDSEED EQU $63 ;Random Seed
TEMP0 EQU $64 ;Temporary Variable
TEMP1 EQU $65 ;Temporary Variable
TEMP2 EQU $66 ;Temporary Variable
TEMP3 EQU $67 ;Temporary Variable
SYSBFP EQU $68 ;Position in System Buffer [Free Byte]
; $69-7F ;Available to User
TEMP0 EQU $64 ;Temporary Variables
TEMP1 EQU $65
TEMP2 EQU $66
TEMP3 EQU $67
TMPPTR EQU $68 ;Temporary Pointer
SYSBFP EQU $6A ;Position in System Buffr
; $6B-$6F ;Unused
; $70-7F ;Free Zero-Page for Applications
; $80-$83 ;Used by Kernal and DOS
; $A4-$A8 ;Reserved for KERNAL/DOS/BASIC
; $A9-$FF ;Used by BASIC
;Other Constants
SYSBFL EQU 128 ;System Buffer Length
SYSBFL EQU 128 ;System Buffer Length [Max String Length]
;Other Variables - User Storage Area
SYSBFR EQU $0700 ;System Buffer
BLKBGN EQU $07F4 ;Block Start Address
BLKEND EQU $07F6 ;Block End Address
BLKLEN EQU $07F8 ;Block Length
STKSAV EQU $07FA ;Machine Stack Storage
STKSLO EQU $07FC ;Stack Start LSB
STKSHI EQU $07FD ;Stack Start MSB
STKELO EQU $07FE ;Stack End LSB
STKEHI EQU $07FF ;Stack End MSB
; $0781-$07F5 ;Unused
BLKBGN EQU $07F6 ;Block Start Address
BLKEND EQU $07F8 ;Block End Address
BLKLEN EQU $07FA ;Block Length
STKSAV EQU $07FB ;Machine Stack Storage
STKBGN EQU $07FC ;Stack Start
STKEND EQU $07FE ;Stack End
;Machine Language Basic Stub - Same as Commodore 64
ORG $0801 ;Start of Basic Program

View File

@ -1,7 +1,7 @@
/* C02 System Header file for Commander X16 */
/* Platform Specific Settings */
#pragma zeropage $69 //Unused Zero Page - $69-$7F
#pragma zeropage $70 $7F //Zero Page Free Space
/* Platform Specific Constants */
#define DELKEY $14 //Delete/Backspace Key (DEL)
@ -9,34 +9,29 @@
#define RTNKEY $0D //Return/Enter Key (RETURN)
#define SYSBFL 128 //System Buffer Length
/* Standard Library Pointers */
zeropage int srcptr, dstptr, bfrptr, blkptr;
zeropage char bfrlo,bfrhi; //Buffer Pointer for Library Functions
zeropage char stklo,stkhi; //Stack Pointer
zeropage char xadrlo,xadrhi; //Physical Address LSB, MSB
/* Standard Library Variables */
int blkbgn, blkend; //Block Start and 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 xmbank; //Physical Bank
char temp0,temp1,temp2,temp3; //Temporary Storage
zeropage int srcptr, dstptr; //Source and Destination Pointer
zeropage int blkptr, stkptr; //Block and Stack Pointers
zeropage int tmpptr, usrptr; //Temporary and User Pointer
int stkbgn, stkend; //Stack Begin and End Address
int blkbgn, blkend; //Block Begin and End Address
char blklen, xmbank; //Block Segment Length, Ext Memory Bank
int xmaddr; //Extended Memory Address
char random, rdseed; //Pseudo-Random Number and Seed
char temp0, temp1, temp2, temp3; //Temporary Storage
char sysbfr[], sysbfp; //System String Buffer and Position
/* System Subroutines */
void delchr(); //Delete previous character
char getkey(); //Read ASCII character from Keyboard
char getchr(); //Wait for character from Console
char getkey(); //Read ASCII character from Console
void newlin(); //Advance cursor to beginning of next line
char polkey(); //Poll Keyboard for character
char putchr(); //Print ASCII character to Screen
void prbyte(); //Print Accumulator as Hexadadecimal number
char polkey(); //Poll Console for character
void prbyte(); //Print Accumulator as Hexadecimal number
void prhex(); //Print Low Nybble of Accumulator as Hex Digit
char getchr(); //Wait for character from Keyboard
void putstr(); //Print String to Screen
char putchr(); //Print ASCII character to Console
char putstr(); //Print ASCII string to Console
//System Labels
/* System Labels */
start: //Start of Code
exit: //Return to Operating System

View File

@ -10,7 +10,7 @@ ECHO Compiling File %1.c02
IF ERRORLEVEL 1 EXIT /B
ECHO Assembling File %1.asm
..\a02 -p %1.asm %1.obj %1.lst
..\a02 -d -p -i "../include ../include/apple1" %1.asm %1.obj %1.lst >%1.out
IF ERRORLEVEL 1 EXIT /B
ECHO Converting Object File

View File

@ -9,7 +9,7 @@ ECHO Compiling File %1.c02
IF ERRORLEVEL 1 EXIT /B
ECHO Assembling File %1.asm
..\a02 %1.asm %1.obj %1.lst
..\a02 -d -i "../include ../include/c64" %1.asm %1.obj %1.lst >%1.out
IF ERRORLEVEL 1 EXIT /B
ECHO Building Disk Image

View File

@ -11,7 +11,7 @@ ECHO Compiling File %1.c02 for Commodore 64
IF %ERRORLEVEL% NEQ 0 GOTO EOF
ECHO Assembling File %1.asm
..\a02.exe -p %1.asm %1.prg %1.lst >%1.out
..\a02.exe -d -p -i "../include ../include/c64" %1.asm %1.prg %1.lst >%1.out
IF %ERRORLEVEL% NEQ 0 GOTO EOF
ECHO Starting Emulator

View File

@ -5,14 +5,14 @@ IF EXIST %1.c02 GOTO COMPILE
:COMPILE
@ECHO Compiling File %1.c02 for run6502
..\c02.exe -h run6502 -s run6502 %1 >%1.dbg
..\c02.exe -d -h run6502 -s run6502 %1 >%1.dbg
IF %ERRORLEVEL% NEQ 0 GOTO EOF
@ECHO Assembling File %1.asm
..\a02 %1.asm %1.bin %1.lst
..\a02 -d -i "..\include ..\include\run6502" %1.asm %1.bin %1.lst >%1.out
@ECHO Executing file %1.bin
..\emu\run6502 -l 0200 %1.bin -G FFE0 -P FFE3 -N 0000 -R 0200 -X 0
..\lib6502\run6502 -D -l 0400 %1.bin -K FFE0 -C FFE3 -F FFE6 -S FFE9 -M FFEA -N 0000 -R 0400 -X 0 2>%1.err
:EOF

View File

@ -8,7 +8,7 @@ ECHO Compiling File %1.c02 for VIC 20 +8k
..\c02.exe -h vic8k -s vic -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
..\a02.exe -d -p -i "../include ../include/vic20" %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

View File

@ -9,8 +9,7 @@ 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
..\a02.exe -p -i "../include ../include/x16" %1.asm %1.prg %1.lst >%1.out
IF %ERRORLEVEL% NEQ 0 GOTO EOF