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

Updated c64.a02, vic.a02, x16.a02

This commit is contained in:
Curtis F Kaylor 2019-11-20 01:36:43 -05:00
parent d09386dd9b
commit c5460db89e
6 changed files with 70 additions and 37 deletions

0
ca02.sh Executable file → Normal file
View File

View File

@ -99,4 +99,3 @@ PUTSTR: TXA ;Copy LSB to Accumulator
JMP $AB1E ;Execute STROUT JMP $AB1E ;Execute STROUT
INCLUDE "../include/prbyte.a02" ;PRBYTE and PRHEX routine INCLUDE "../include/prbyte.a02" ;PRBYTE and PRHEX routine

20
include/via.h02 Normal file
View File

@ -0,0 +1,20 @@
/* MOS 6522 VIA Registers */
struct via {
char iorb; //Input/Output Register B
char iora; //Input/Output Register A
char ddrb; //Data Direction Register B
char ddra; // Data Direction Register A
char t1cl; //T1 Low-Order Counter
char t1ch; //T1 High-Order Counter
char t1ll; //T1L-L | T1 Low-Order Latches
char t1lh; //T1 High-Order Latches
char t2cl; //T2 Low-Order Latches
char t2ch; //T2 High-Order Counter
char sr; //Shift Register
char acr; //Auxiliary Control Register
char pcr; //Peripheral Control Register
char ifr; //Interrupt Flag Register
char ier; //Interrupt Enable Register
char nhra; //Input/Output Register A (No Handshake)
}

View File

@ -100,3 +100,6 @@ NEWLIN: LDX #0 ;Store 0
STX $D3 ;in Cursor Column and STX $D3 ;in Cursor Column and
JMP $E8C3 ;Execute NXTLINE Routine JMP $E8C3 ;Execute NXTLINE Routine
;Print Zero-Terminated String
PUTSTR: TXA ;Copy LSB to Accumulator
JMP $CB1E ;Execute STROUT Routine

View File

@ -1,46 +1,53 @@
; c02 Program Initialization Code for Commander X16 ; c02 Program Initialization Code for Commander X16
; Compatible with x16emu Release 34
;PETSCII Key Mappings ;PETSCII Key Mappings
DELKEY EQU $14 ;Delete/Backspace Key (Delete) DELKEY EQU $14 ;Delete/Backspace Key (Delete)
ESCKEY EQU $03 ;Escape/Stop Key (RUN/STOP) ESCKEY EQU $03 ;Escape/Stop Key (RUN/STOP)
RTNKEY EQU $0D ;Return/Enter Key (RETURN) RTNKEY EQU $0D ;Return/Enter Key (RETURN)
;Zero Page System Variables - Assumes Usage is Same as C64 ;Zero Page System Variables - x16emu Release 34 Memory Map
XMBANK EQU $0A ;Extended Memory Bank (Load/Verify Flag) ;UNUSED $00-$01 ;Available to User
XADRLO EQU $0B ;Ext Memory Address LSB (Text Index/Array Size) ; $02-$52 ;Used by Basic graphics commands
XADRHI EQU $0C ;Ext Memory Address MSB (Array Dimension Fkags) XMBANK EQU $53 ;Extended Memory Bank
SRCPTR EQU $22 ;Source Pointer [Temporary Pointers] XADRLO EQU $54 ;Ext Memory Address LSB
SRCLO EQU $22 ;Source Pointer LSB [Temporary Pointers] XADRHI EQU $55 ;Ext Memory Address MSB
SRCHI EQU $23 ;Source Pointer MSB [Temporary Pointers] SRCPTR EQU $56 ;Source Pointer
DSTPTR EQU $24 ;Destination Pointer [Temporary Pointers] SRCLO EQU $57 ;Source Pointer LSB
DSTLO EQU $24 ;Destination Pointer LSB [Temporary Pointers] SRCHI EQU $58 ;Source Pointer MSB
DSTHI EQU $25 ;Destination Pointer MSB [Temporary Pointers] DSTPTR EQU $59 ;Destination Pointer
BLKLO EQU $26 ;Block Pointer LSB [Floating Point Work Area] DSTLO EQU $5A ;Destination Pointer LSB
BLKHI EQU $27 ;Block Pointer MSB [Floating Point Work Area] DSTHI EQU $5B ;Destination Pointer MSB
STKLO EQU $28 ;Stack Pointer LSB [Floating Point Work Area] BLKLO EQU $5C ;Block Pointer LSB
STKHI EQU $29 ;Stack Pointer MSB [Floating Point Work Area] BLKHI EQU $5D ;Block Pointer MSB
BFRLO EQU $35 ;Buffer Pointer LSB [Temporary String Pointer] STKLO EQU $5E ;Stack Pointer LSB
BFRHI EQU $36 ;Buffer Pointer MSB [Temporary String Pointer] STKHI EQU $5F ;Stack Pointer MSB
RDSEED EQU $A2 ;Random Seed [Software Jiffy Clock (Low Byte)] BFRLO EQU $60 ;Buffer Pointer LSB
TEMP0 EQU $FB ;Temporary Variable [Unused Byte] BFRHI EQU $61 ;Buffer Pointer MSB
TEMP1 EQU $FC ;Temporary Variable [Unused Byte] RANDOM EQU $62 ;Random Number Storage
TEMP2 EQU $FD ;Temporary Variable [Unused Byte] RDSEED EQU $63 ;Random Seed
TEMP3 EQU $FE ;Temporary Variable [Unused Byte] TEMP0 EQU $64 ;Temporary Variable
TEMP1 EQU $65 ;Temporary Variable
TEMP2 EQU $66 ;Temporary Variable
TEMP3 EQU $67 ;Temporary Variable
; $68-7F ;Available to User
; $80-$83 ;Used by Kernal and DOS
; $A4-$A8 ;Reserved for KERNAL/DOS/BASIC
; $A9-$FF ;Used by BASIC
;Other Variables - Top of Extended System RAM Area ;Other Variables - Top of Extended System RAM Area
BLKSLO EQU $07F4 ;Block Start LSB [Unused Byte] BLKSLO EQU $07F4 ;Block Start LSB
BLKSHI EQU $07F5 ;Block Start MSB [Unused Byte] BLKSHI EQU $07F5 ;Block Start MSB
BLKELO EQU $07F6 ;Block End LSB [Unused Byte] BLKELO EQU $07F6 ;Block End LSB
BLKEHI EQU $07F7 ;Block End MSB [Unused Byte] BLKEHI EQU $07F7 ;Block End MSB
BLKLEN EQU $07F8 ;Block Length [Unused Byte] BLKLEN EQU $07F8 ;Block Length
RANDOM EQU $07F9 ;Random Number Storage [Unused Byte] STKSAV EQU $07FA ;Machine Stack Storage
STKSAV EQU $07FA ;Machine Stack Storage [Unused Byte]
STKSLO EQU $07FC ;Stack Start LSB [Unused Byte] STKSLO EQU $07FC ;Stack Start LSB
STKSHI EQU $07FD ;Stack Start MSB [Unused Byte] STKSHI EQU $07FD ;Stack Start MSB
STKELO EQU $07FE ;Stack End LSB [Unused Byte] STKELO EQU $07FE ;Stack End LSB
STKEHI EQU $07FF ;Stack End MSB [Unused Byte] STKEHI EQU $07FF ;Stack End MSB
;Machine Language Basic Stub - Same as Commodore 64 ;Machine Language Basic Stub - Same as Commodore 64
ORG $0801 ;Start of Basic Program ORG $0801 ;Start of Basic Program
@ -54,6 +61,9 @@ BASIC: DC $0C, $08 ;Pointer to Next Line
START: TSX ;Get Stack Pointer START: TSX ;Get Stack Pointer
STX STKSAV ;and Save for Exit STX STKSAV ;and Save for Exit
SEC ;Set Screen Mode
LDA #0 ;to 40x30 Text
JSR $FF5F ;using SCRMOD
JMP MAIN ;Execute Program JMP MAIN ;Execute Program
EXIT: LDX STKSAV ;Retrieve Saved Stack Pointer EXIT: LDX STKSAV ;Retrieve Saved Stack Pointer
@ -82,7 +92,5 @@ DELCHR: LDA #DELKEY ;Load Delete Character
NEWLIN: LDA #RTNKEY ;Load Return Character NEWLIN: LDA #RTNKEY ;Load Return Character
JMP PUTCHR ;Print and Return JMP PUTCHR ;Print and Return
PUTSTR: TXA ;Copy LSB to Accumulator
JMP $CBD2 ;Execute STROUT
INCLUDE "../include/prbyte.a02" ;PRBYTE and PRHEX routine INCLUDE "../include/prbyte.a02" ;PRBYTE and PRHEX routine
INCLUDE "../include/putstr.a02" ;PUTSTR routine

View File

@ -1,5 +1,8 @@
/* C02 System Header file for Commander X16 */ /* C02 System Header file for Commander X16 */
/* Platform Specific Settings */
#pragma zeropage $68 //Unused Zero Page - $68-$7F
/* Platform Specific Constants */ /* Platform Specific Constants */
#define DELKEY $14 //Delete/Backspace Key (DEL) #define DELKEY $14 //Delete/Backspace Key (DEL)
#define ESCKEY $03 //Escape/Break Key (STOP) #define ESCKEY $03 //Escape/Break Key (STOP)