1
0
mirror of https://github.com/makarcz/vm6502.git synced 2024-12-28 05:29:47 +00:00
vm6502/test_char_io_01.65s
Marek Karcz 67f1a62596 Version 2.0
Version 2.0, full emulation of 6502 op-codes, fully tested and functional. Extended description in ReadMe file. Bin2Hex tool to convert binary images to memory definition format. Microchess, EhBasic added.
2016-03-13 19:12:14 -04:00

50 lines
679 B
Plaintext

; Basic test of char I/O emulation
.ORG $0200
CHRGET = $E000
PUTCH = $E000
TXTBUF = $0400
CR = $0D
NL = $0A
START: LDX #$00
PR1: LDA PROMPT,X ;print prompt
BEQ L0
STA PUTCH
INX
BNE PR1
L0: LDX #$00
GETTXT: LDA CHRGET ;get text from input
BEQ GETTXT
CMP #CR
BEQ L1
CMP #NL
BEQ L1
STA PUTCH ;echo char
STA TXTBUF,X ;store char
INX
BNE GETTXT
L1: LDA #NL ; add line break
STA TXTBUF,X
STA PUTCH
INX
LDA #CR
STA TXTBUF,X
STA PUTCH
INX
LDA #$00 ; add null
STA TXTBUF,X
TAX
PRINT: LDA TXTBUF,X ; print to output
BEQ L2
STA PUTCH
INX
BNE PRINT
L2: BRK
NOP
JMP START
PROMPT: .DB "Enter text:",0