6502-OS/programs/viu.s65

55 lines
942 B
Plaintext

;;********************************************************************************
;; @file
;; @brief VIU - VI Unimproved
;;********************************************************************************
.include "lcd.h65"
.include "ps2_keyboard_text_handler.h65"
.import home:absolute
.zeropage
ptr: .res 2
.bss
buffer: .res 256
.code
.proc init
stz ptr
stz ptr+1
stz buffer
.endproc
.proc insert_mode
jsr lcd::clear
jsr kb::init
loop:
lda kb::char
ldx ptr
beq @no_char
stz kb::char
jsr lcd::print_char
bra loop
@no_char:
lda kb::keycode
beq loop
cmp #kb::K::ESCAPE
beq k_esacpe
cmp #kb::K::PRINT
beq clear_display
cmp #kb::K::BACKSPACE
beq k_backspace
bra loop
k_esacpe:
jmp home
clear_display:
jsr lcd::clear
bra loop
k_backspace:
lcd_DecrementCursor
lda #' '
jsr lcd::print_char
lcd_DecrementCursor
bra loop
.endproc