mirror of
https://github.com/RevCurtisP/C02.git
synced 2024-11-24 15:31:17 +00:00
Added prtstr() to apple, oric header files
This commit is contained in:
parent
fd7e1a708b
commit
0e060485ff
@ -1,28 +1,30 @@
|
|||||||
;Apple 1 program initialization code for c02 programs
|
;Apple 1 program initialization code for c02 programs
|
||||||
|
|
||||||
|
SUBROUTINE _APPLE1
|
||||||
|
|
||||||
;System Specific ASCII Key Mappings
|
;System Specific ASCII Key Mappings
|
||||||
DELKEY EQU $5F ;Delete/Backspace Key (Left Arrow/Underscore)
|
DELKEY EQU $5F ;Delete/Backspace Key (Left Arrow/Underscore)
|
||||||
ESCKEY EQU $1B ;Escape/Stop Key (Escape)
|
ESCKEY EQU $1B ;Escape/Stop Key (Escape)
|
||||||
RTNKEY EQU $0D ;Return/Enter Key (Carriage Return)
|
RTNKEY EQU $0D ;Return/Enter Key (Carriage Return)
|
||||||
|
|
||||||
;Locations used by Monitor
|
;Locations used by Monitor
|
||||||
XAML EQU $24 ;Examine Index
|
.XAML EQU $24 ;Examine Index
|
||||||
XAMH EQU $25 ;
|
.XAMH EQU $25 ;
|
||||||
STL EQU $26 ;Store Index
|
.STL EQU $26 ;Store Index
|
||||||
STH EQU $27 ;
|
.STH EQU $27 ;
|
||||||
HEXL EQU $28 ;Hex Data
|
.HEXL EQU $28 ;Hex Data
|
||||||
HEXH EQU $29 ;
|
.HEXH EQU $29 ;
|
||||||
YSAVE EQU $2A ;Y Register Storage
|
.YSAVE EQU $2A ;Y Register Storage
|
||||||
MODE EQU $2B ;Mode: Store, Examine, Block Examine
|
.MODE EQU $2B ;Mode: Store, Examine, Block Examine
|
||||||
BUFFER EQU $200 ;Input Buffer
|
.BUFFER EQU $200 ;Input Buffer
|
||||||
|
|
||||||
;Standard Library Variables
|
;Standard Library Variables
|
||||||
SRCLO EQU $30 ;Source String Pointer (stdio.a02)
|
SRCLO EQU $30 ;Source String Pointer (stdio.a02)
|
||||||
SRCHI EQU $31
|
SRCHI EQU $31
|
||||||
DSTLO EQU $32 ;Destination String Pointer (string.a02)
|
DSTLO EQU $32 ;Destination String Pointer (string.a02)
|
||||||
DSTHI EQU $33
|
DSTHI EQU $33
|
||||||
DSTLO EQU $34 ;Destination String Pointer (string.a02)
|
BFRLO EQU $34 ;Work Buffer Pointer
|
||||||
DSTHI EQU $35
|
BFRHI EQU $35
|
||||||
BLKLO EQU $36 ;Block Segment Pointer (block.a02)
|
BLKLO EQU $36 ;Block Segment Pointer (block.a02)
|
||||||
BLKHI EQU $37
|
BLKHI EQU $37
|
||||||
STKLO EQU $38 ;System Pointer (pointer.a02)
|
STKLO EQU $38 ;System Pointer (pointer.a02)
|
||||||
@ -47,13 +49,13 @@ STKELO EQU $4E ;Stack End Address
|
|||||||
STKEHI EQU $4F
|
STKEHI EQU $4F
|
||||||
|
|
||||||
;PIA 6820 Registers
|
;PIA 6820 Registers
|
||||||
KBD EQU $D010 ;Keyboard Data
|
.KBD EQU $D010 ;Keyboard Data
|
||||||
KBDCR EQU $D011 ;Keyboard Control Register
|
.KBDCR EQU $D011 ;Keyboard Control Register
|
||||||
DSP EQU $D012 ;Display Data
|
.DSP EQU $D012 ;Display Data
|
||||||
DSPCR EQU $D013 ;Display Control Register
|
.DSPCR EQU $D013 ;Display Control Register
|
||||||
|
|
||||||
EXIT EQU $FF00 ;Monitor Entry Point
|
EXIT EQU $FF00 ;Monitor Entry Point
|
||||||
ECHO EQU $FFEF ;Subroutine - Print Character in Accumulator
|
.ECHO EQU $FFEF ;Subroutine - Print Character in Accumulator
|
||||||
PRBYTE EQU $FFDC ;Subroutine - Print Accumulator as Hexadadecimal number
|
PRBYTE EQU $FFDC ;Subroutine - Print Accumulator as Hexadadecimal number
|
||||||
PRHEX EQU $FFE5 ;Subroutine - Print Low Nybble of Accumulator as Hex Digit
|
PRHEX EQU $FFE5 ;Subroutine - Print Low Nybble of Accumulator as Hex Digit
|
||||||
|
|
||||||
@ -67,26 +69,27 @@ START: LDX #$FF ;Reset stack - the monitor doesn't do this
|
|||||||
|
|
||||||
;Subroutine Poll Keyboard
|
;Subroutine Poll Keyboard
|
||||||
PLKEY: INC RDSEED ;Cycle Keypress Counter
|
PLKEY: INC RDSEED ;Cycle Keypress Counter
|
||||||
BIT KBDCR ;Check the Keyboard Control Register
|
LDA #0 ;Set Return Value to 0
|
||||||
BMI RDKEYA ;If Key Pressed, Read Key
|
BIT .KBDCR ;Check the Keyboard Control Register
|
||||||
LDA #0 ;Otherwise Return ASCII NUL
|
BPL .PLKEYX ;If No Key Pressed, Return 0
|
||||||
RTS
|
LDA .KBD ;Else Read Key and Return
|
||||||
|
.PLKEYX RTS
|
||||||
|
|
||||||
GETCHR: INC RDSEED ;Cycle Keypress Counter
|
GETKEY: JSR PLKEY ;Read Keyboard
|
||||||
RDKEYC: BIT KBDCR ;Check the Keyboard Control Register
|
AND #$7F ;Strip High Bit
|
||||||
BPL RDKEYC ; and loop if key not pressed
|
RTS
|
||||||
RDKEYA: LDA KBD ; Read key into Accumulator
|
|
||||||
RTS
|
|
||||||
|
|
||||||
GETKEY: JSR GETCHR ;Subroutine - Read ASCII from Keyboard
|
BIT .GETKEM ;If Character is in
|
||||||
GETKEA: AND #$7F ;Strip High Bit
|
BEQ .GETKEX ; Alpha Block ($40-$74)
|
||||||
BIT GETKEM ;If Character is in
|
|
||||||
BEQ GETKEX ; Alpha Block ($40-$74)
|
|
||||||
AND #$5F ; Strip Bit 5
|
AND #$5F ; Strip Bit 5
|
||||||
GETKEX: RTS
|
.GETKEX RTS
|
||||||
GETKEM: DC $40 ;Character Block Bit Mask
|
.GETKEM DC $40 ;Character Block Bit Mask
|
||||||
|
|
||||||
PUTCHR EQU ECHO ;Alias to Monitor Routine
|
GETCHR: JSR GETKEY ;Get Keypress
|
||||||
|
BEQ GETCHR ;Loop if No Key Pressed
|
||||||
|
RTS
|
||||||
|
|
||||||
|
PUTCHR EQU .ECHO ;Alias to Monitor Routine
|
||||||
|
|
||||||
;Delete Previous Character
|
;Delete Previous Character
|
||||||
DELCHR: LDA #DELKEY ;Load Underscore Character
|
DELCHR: LDA #DELKEY ;Load Underscore Character
|
||||||
@ -95,3 +98,5 @@ DELCHR: LDA #DELKEY ;Load Underscore Character
|
|||||||
;Advance Character to Next line
|
;Advance Character to Next line
|
||||||
NEWLIN: LDA #$0D ;Load C/R into Accumulator
|
NEWLIN: LDA #$0D ;Load C/R into Accumulator
|
||||||
JMP PUTCHR ; and Print it
|
JMP PUTCHR ; and Print it
|
||||||
|
|
||||||
|
INCLUDE "../include/putstr.a02" ;PUTSTR routine
|
||||||
|
@ -1,13 +1,5 @@
|
|||||||
/* Apple 1 Header File */
|
/* Apple 1 Header File */
|
||||||
|
|
||||||
/* Monitor Variables */
|
|
||||||
char xaml, xamh; //Examine Index
|
|
||||||
char stl, sth; //Store Index
|
|
||||||
char hexl,hexh; //Hex Data
|
|
||||||
char ysave; //Y Register Storage
|
|
||||||
char mode; //Mode: Store, Examine, Block Examine
|
|
||||||
char buffer[]; //Input Buffer
|
|
||||||
|
|
||||||
//Platform Specific Constants
|
//Platform Specific Constants
|
||||||
#define DELKEY $5F //Delete/Backspace Key
|
#define DELKEY $5F //Delete/Backspace Key
|
||||||
#define ESCKEY $1B //Escape/Stop Key
|
#define ESCKEY $1B //Escape/Stop Key
|
||||||
@ -28,12 +20,6 @@ char stkelo, stkehi; //Stack End Address
|
|||||||
|
|
||||||
char temp0, temp1, temp2, temp3; //Temporary Variables
|
char temp0, temp1, temp2, temp3; //Temporary Variables
|
||||||
|
|
||||||
//PIA 6820 Registers
|
|
||||||
char kbd; //Keyboard Data
|
|
||||||
char kbdcr; //Keyboard Control Register
|
|
||||||
char dsp; //Display Data
|
|
||||||
char dspcr; //Display Control Register
|
|
||||||
|
|
||||||
//Monitor Subroutines
|
//Monitor Subroutines
|
||||||
void echo(); //Print Character in Accumulator
|
void echo(); //Print Character in Accumulator
|
||||||
void prbyte(); //Print Accumulator as Hexadadecimal number
|
void prbyte(); //Print Accumulator as Hexadadecimal number
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
;Apple 1 program initialization code for c02 programs
|
;Apple 1 program initialization code for c02 programs
|
||||||
|
|
||||||
|
SUBROUTINE _APPLE2
|
||||||
|
|
||||||
;System Specific ASCII Key Mappings
|
;System Specific ASCII Key Mappings
|
||||||
DELKEY EQU $08 ;Delete/Backspace Key (Left Arrow)
|
DELKEY EQU $08 ;Delete/Backspace Key (Left Arrow)
|
||||||
ESCKEY EQU $1B ;Escape/Stop Key (Escape)
|
ESCKEY EQU $1B ;Escape/Stop Key (Escape)
|
||||||
@ -30,8 +32,8 @@ TEMP2 EQU $FE
|
|||||||
TEMP3 EQU $FF
|
TEMP3 EQU $FF
|
||||||
|
|
||||||
;I/O Locations
|
;I/O Locations
|
||||||
KBD EQU $C000 ;Keyboard Data
|
.KBD EQU $C000 ;Keyboard Data
|
||||||
AKD EQU $C010 ;Keyboard Strobe Register
|
.AKD EQU $C010 ;Keyboard Strobe Register
|
||||||
|
|
||||||
;Monitor Routines
|
;Monitor Routines
|
||||||
PRBYTE EQU $FDDA ;Print Accumulator as Hexadecimal Number
|
PRBYTE EQU $FDDA ;Print Accumulator as Hexadecimal Number
|
||||||
@ -46,10 +48,10 @@ START: JSR NEWLIN ;Start On New Line
|
|||||||
;Poll Keyboard for Raw Character
|
;Poll Keyboard for Raw Character
|
||||||
POLKEY: INC RDSEED ;Cycle Random Seed
|
POLKEY: INC RDSEED ;Cycle Random Seed
|
||||||
LDA #0 ;Clear Accumulator
|
LDA #0 ;Clear Accumulator
|
||||||
BIT KBD ;Check Keyboard Strobe Bit
|
BIT .KBD ;Check Keyboard Strobe Bit
|
||||||
BPL POLKER ;If Key Pressed
|
BPL POLKER ;If Key Pressed
|
||||||
LDA KBD ; Load Key Value
|
LDA .KBD ; Load Key Value
|
||||||
STA AKD ; Clear Strobe
|
STA .AKD ; Clear Strobe
|
||||||
POLKER: RTS
|
POLKER: RTS
|
||||||
|
|
||||||
;Get ASCII Character from Keyboard
|
;Get ASCII Character from Keyboard
|
||||||
@ -74,7 +76,9 @@ PUTCHR: ORA #$80 ;Set High Bit
|
|||||||
CMP #$E0 ;
|
CMP #$E0 ;
|
||||||
BCC PRCHRX ;If Lower Case
|
BCC PRCHRX ;If Lower Case
|
||||||
AND #$1F ; Convert to Inverse
|
AND #$1F ; Convert to Inverse
|
||||||
PRCHRX: JMP $FDF0 ;Call Monitor Routine COUT1
|
PRCHRX: JMP $FDF0 ;Execute Monitor Routine COUT1
|
||||||
|
|
||||||
;Advance Character to Next line
|
;Advance Character to Next line
|
||||||
NEWLIN EQU $FD8E ;Monitor Routine CROUT
|
NEWLIN EQU $FD8E ;Monitor Routine CROUT
|
||||||
|
|
||||||
|
INCLUDE "../include/putstr.a02" ;PUTSTR routine
|
||||||
|
@ -42,6 +42,7 @@ char getsiz(); //Get Screen Size
|
|||||||
void newlin(); //Advance cursor to beginning of next line
|
void newlin(); //Advance cursor to beginning of next line
|
||||||
char polkey(); //Poll Console for character
|
char polkey(); //Poll Console for character
|
||||||
char putchr(); //Print ASCII character to Console
|
char putchr(); //Print ASCII character to Console
|
||||||
|
char putstr(); //Print ASCII string to Console
|
||||||
void setpos(); //Set Cursor Position
|
void setpos(); //Set Cursor Position
|
||||||
|
|
||||||
//System Labels
|
//System Labels
|
||||||
|
@ -96,6 +96,10 @@ NEWLIN EQU $CB9F ;Basic NEWLINE Routine ($CBF0 for ATMOS)
|
|||||||
PUTCHR: TAX ;Transfer Character to X Register
|
PUTCHR: TAX ;Transfer Character to X Register
|
||||||
JMP $F409 ;Execute VDU Routine
|
JMP $F409 ;Execute VDU Routine
|
||||||
|
|
||||||
|
;Print String to Screen
|
||||||
|
PUTSTR: TXA ;Copy LSB to A6
|
||||||
|
JMP $CCB0 ;Execute BASIC String Print Routine
|
||||||
|
|
||||||
;Get End of Free Memory
|
;Get End of Free Memory
|
||||||
RAMTOP: LDX $A6 ;Load HIMEM LSB
|
RAMTOP: LDX $A6 ;Load HIMEM LSB
|
||||||
LDY $A7 ;Load HIMEM MSB
|
LDY $A7 ;Load HIMEM MSB
|
||||||
|
@ -23,6 +23,7 @@ char getchr(); //Wait for character from Console
|
|||||||
char getkey(); //Read ASCII character from Console
|
char getkey(); //Read ASCII character from Console
|
||||||
void newlin(); //Advance cursor to beginning of next line
|
void newlin(); //Advance cursor to beginning of next line
|
||||||
char putchr(); //Print ASCII character to Console
|
char putchr(); //Print ASCII character to Console
|
||||||
|
char putstr(); //Print ASCII string to Console
|
||||||
void prbyte(); //Print Accumulator as Hexadadecimal number
|
void prbyte(); //Print Accumulator as Hexadadecimal number
|
||||||
void prhex(); //Print Low Nybble of Accumulator as Hex Digit
|
void prhex(); //Print Low Nybble of Accumulator as Hex Digit
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user