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