begin implementing chrin to read from keyboard buffer

This commit is contained in:
Paul Gardner-Stephen committed 2019-04-20 02:06:31 +09:30
1 parent f37e32f856
commit 8a4f4928e5
1 file changed
+21 -2
+21 -2
View File
@@ -5,8 +5,27 @@
;; Repeated calls after that read out the successive bytes of the line of input.
chrin:
;; XXX - Not yet implemented, so infinite loop for now
inc $d020
jmp chrin
lda keys_in_key_buffer
beq chrin
;; Print character
lda keyboard_buffer
jsr chrout
;; Pop key out of keyboard buffer
;; Disable interrupts while reading from keyboard buffer
;; so that no race conditions can occur
sei
ldx #$00
ldy #$01
* lda keyboard_buffer,y
sta keyboard_buffer,x
inx
iny
cpy keys_in_key_buffer
bne -
dec keys_in_key_buffer
cli
lda #$00
clc