2018-08-02 09:10:14 +00:00
|
|
|
; Program initialization code for Oric-1
|
|
|
|
|
|
|
|
;System Specific ASCII Key Mappings
|
|
|
|
DELKEY EQU $7F ;Delete/Backspace Key (Delete)
|
|
|
|
ESCKEY EQU $1B ;Escape/Stop Key (Escape)
|
|
|
|
RTNKEY EQU $0D ;Return/Enter Key ($0D=Carriage Return)
|
|
|
|
|
|
|
|
;Zero Page Locations
|
2019-03-23 00:28:43 +00:00
|
|
|
SRCLO EQU $10 ;Source String Pointer (stdio.asm)
|
|
|
|
SRCHI EQU $11
|
|
|
|
DSTLO EQU $12 ;Destination String Pointer (string.asm)
|
|
|
|
DSTHI EQU $13
|
|
|
|
BFRLO EQU $14 ;Work Buffer Pointer
|
|
|
|
BFRHI EQU $15
|
|
|
|
|
|
|
|
TEMP0 EQU $16 ;Temporary Storage
|
|
|
|
TEMP1 EQU $17
|
|
|
|
TEMP2 EQU $18
|
|
|
|
TEMP3 EQU $19
|
|
|
|
|
|
|
|
RDSEED EQU $1A ;Pseudo-RANDOM Seed
|
|
|
|
RANDOM EQU $1B ;Pseudo-RANDOM Number Storage
|
|
|
|
|
|
|
|
; EQU $1C ;Unused
|
|
|
|
; EQU $1D ;Unused
|
|
|
|
|
|
|
|
BLKLEN EQU $1F ;Block Length
|
|
|
|
BLKSLO EQU $20 ;Block Start Address
|
|
|
|
BLKSHI EQU $21
|
|
|
|
BLKELO EQU $22 ;Block End Address
|
|
|
|
BLKEHI EQU $23
|
|
|
|
|
|
|
|
STKSLO EQU $24 ;Stack Start LSB
|
|
|
|
STKSHI EQU $25 ;Stack Start MSB
|
|
|
|
STKELO EQU $26 ;Stack End LSB
|
|
|
|
STKEHI EQU $27 ;Stack End MSB
|
|
|
|
|
2018-08-02 09:10:14 +00:00
|
|
|
|
|
|
|
;Oric-1 Tape images have the file extension ".tap"
|
|
|
|
;and have the following header prepended to the code
|
|
|
|
; $16,$16,$16, $16 Tape Syncronization Pattern
|
|
|
|
; $24 Tape Syncronization Byte
|
|
|
|
; $00,$00 Filler Bytes
|
|
|
|
; $00 Basic Program
|
|
|
|
; $00 No Autostart ($80 for Autostart)
|
|
|
|
; $xx,$xx MSB, LSB of End Address
|
|
|
|
; $05,$01 MSB, LSB of Start Address
|
|
|
|
; $00 Filler Byte
|
|
|
|
; "filename" Up to 16 ASCII Characters
|
|
|
|
; $00 Strint Terminator
|
|
|
|
|
|
|
|
;The End Address is actually one higher than the last
|
|
|
|
;byte of the Basic program and the first byte of Basic
|
|
|
|
;variable space. so the compiled program need to have
|
|
|
|
;one dummy byte added to the end.
|
|
|
|
|
|
|
|
ORG $0501 ;Basic Program Start Address
|
|
|
|
|
2018-08-19 00:48:45 +00:00
|
|
|
BASIC: .DC $0C,$05 ;Address of Next Line
|
|
|
|
.DC $00,$00 ;Basic Line Number (0)
|
|
|
|
.DC $BF ;Token for Basic Call Command
|
|
|
|
.DC $20 ;Space
|
|
|
|
.DC "1294" ;Address of START Label
|
|
|
|
.DC $00 ;End of Line
|
|
|
|
.DC $00,$00 ;End of Program Marker
|
|
|
|
|
|
|
|
START: LDA #127 ;Set Caps Lock Off
|
2018-09-17 23:41:51 +00:00
|
|
|
STA $020C
|
|
|
|
LDA #$0B ;Turn Cursor On, Keyclick Off
|
|
|
|
STA $026A ;and Protect Columns 0 & 1
|
2018-08-02 09:10:14 +00:00
|
|
|
JMP MAIN ;Execute Program
|
|
|
|
|
|
|
|
;Poll Character from Keyboard
|
2018-09-17 23:41:51 +00:00
|
|
|
POLKEY: INC RDSEED ;Cycle the Random Seed
|
|
|
|
JMP $E905 ;Execute GETORKB
|
2018-08-02 09:10:14 +00:00
|
|
|
|
|
|
|
;Read Character from Console
|
2018-09-17 23:41:51 +00:00
|
|
|
GETKEY EQU POLKEY ;Aliased to POLKEY
|
2018-08-02 09:10:14 +00:00
|
|
|
|
|
|
|
;Wait for Character from Console
|
2018-11-07 05:11:09 +00:00
|
|
|
GETCHR: JSR GETKEY ;Calls GETKEY
|
2018-09-17 23:41:51 +00:00
|
|
|
BEQ GETCHR ; until a non-zero is returned
|
2018-08-02 09:10:14 +00:00
|
|
|
RTS
|
|
|
|
|
|
|
|
;Delete Previous Character
|
2018-08-19 00:48:45 +00:00
|
|
|
DELCHR: LDA #DELKEY ;Load Delete Character
|
2018-09-17 23:41:51 +00:00
|
|
|
BNE PUTCHR ;and Print to Screem
|
2018-08-02 09:10:14 +00:00
|
|
|
|
|
|
|
;Advance Cursor to Next line
|
2018-09-17 23:41:51 +00:00
|
|
|
NEWLIN EQU $CB9F ;Basic NEWLINE Routine ($CBF0 for ATMOS)
|
|
|
|
; LDA #$0D ;Load Carriage Return
|
|
|
|
; JSR PUTCHR ;and Print It
|
|
|
|
; LDA #$0A ;Load Line Feed and fall through to PRCHR
|
2018-08-02 09:10:14 +00:00
|
|
|
|
|
|
|
;Print Character to Screen
|
2018-11-07 05:11:09 +00:00
|
|
|
PUTCHR: TAX ;Transfer Character to X Register
|
2018-09-17 23:41:51 +00:00
|
|
|
JMP $F409 ;Execute VDU Routine
|
2018-08-02 09:10:14 +00:00
|
|
|
|
2018-11-07 05:11:09 +00:00
|
|
|
;Get End of Free Memory
|
|
|
|
RAMTOP: LDX $A6 ;Load HIMEM LSB
|
|
|
|
LDY $A7 ;Load HIMEM MSB
|
|
|
|
RTS
|
|
|
|
|
2018-08-02 09:10:14 +00:00
|
|
|
;Exit Program and Return to Operating System or Monitor
|
2018-11-07 05:11:09 +00:00
|
|
|
EXIT: LDA #255 ;Set Caps Lock On
|
2018-09-17 23:41:51 +00:00
|
|
|
STA $020C
|
2018-08-19 00:48:45 +00:00
|
|
|
JMP $C003 ;BASIC Warm Start
|
2018-11-07 05:11:09 +00:00
|
|
|
|
|
|
|
INCLUDE "../include/prbyte.a02" ;PRBYTE and PRHEX routines
|