2018-02-14 00:55:25 +00:00
|
|
|
; py65mon program initialization code for c02 programs
|
|
|
|
|
|
|
|
;System Specific ASCII Key Mappings
|
2018-08-14 18:14:32 +00:00
|
|
|
DELKEY EQU $08 ;Delete/Backspace Key (Delete)
|
2018-02-14 00:55:25 +00:00
|
|
|
ESCKEY EQU $1B ;Escape/Stop Key (Escape)
|
|
|
|
RTNKEY EQU $0D ;Return/Enter Key (Carriage Return)
|
|
|
|
|
|
|
|
;Memory Mapped I/O
|
2018-08-14 18:14:32 +00:00
|
|
|
PUTCON EQU $F001 ;Write Character to Console
|
|
|
|
GETCON EQU $F004 ;Read Character from Console
|
2018-02-14 00:55:25 +00:00
|
|
|
|
|
|
|
ORG $0200 ;Start Directly Above Stack
|
|
|
|
|
|
|
|
START: JMP MAIN ;Execute Program
|
|
|
|
|
2018-08-14 18:14:32 +00:00
|
|
|
;Delete Previous Character
|
|
|
|
DELCHR: JSR DELCHB ;Print Backspace
|
|
|
|
LDA #$20 ;Load Space into Accumulater
|
|
|
|
JSR PRCHR ; and Print it
|
|
|
|
DELCHB: LDA #$08 ;Load Backspace into Accumulator
|
|
|
|
BNE PRCHR ; and Print it
|
|
|
|
|
|
|
|
;Advance Character to Next line
|
|
|
|
NEWLIN: LDA #$0D ;Load C/R into Accumulator
|
|
|
|
JSR PRCHR ; and Print it
|
|
|
|
LDA #$0A ;Load L/F into Accumulater
|
|
|
|
; and fall into PRCHR
|
|
|
|
;Print Character to Console
|
|
|
|
PRCHR: STA PUTCON ;Write Character to Console
|
2018-02-14 00:55:25 +00:00
|
|
|
RTS
|
|
|
|
|
2018-08-14 18:14:32 +00:00
|
|
|
;Poll Keyboard for Keypress
|
|
|
|
PLKEY: LDA GETCON ;Read Character from Console
|
|
|
|
RTS
|
|
|
|
|
|
|
|
;Wait for Character from Console
|
|
|
|
RDKEY: JSR PLKEY ;Read Character from Console
|
|
|
|
BEQ RDKEY ; Loop if None Received
|
2018-02-14 00:55:25 +00:00
|
|
|
RTS
|
|
|
|
|
|
|
|
EXIT: BRK ;Return to Monitor
|
|
|
|
|