ti/lcd: add support for backspace

Also, fix visual glitch on line wrap.
This commit is contained in:
Virgil Dupras 2019-11-09 14:37:52 -05:00
parent a4190f9984
commit 6d9f96aee6

View File

@ -153,13 +153,6 @@ lcdSendGlyph:
ld a, (LCD_CURCOL) ld a, (LCD_CURCOL)
call lcdSetCol call lcdSetCol
; let's increase (and wrap) col now
inc a
ld (LCD_CURCOL), a
cp 16
jr nz, .skip
call lcdLinefeed
.skip:
ld b, FNT_HEIGHT ld b, FNT_HEIGHT
.loop: .loop:
ld a, (hl) ld a, (hl)
@ -167,6 +160,14 @@ lcdSendGlyph:
call lcdData call lcdData
djnz .loop djnz .loop
; Increase column and wrap if necessary
ld a, (LCD_CURCOL)
inc a
ld (LCD_CURCOL), a
cp 16
jr nz, .skip
call lcdLinefeed
.skip:
pop hl pop hl
pop bc pop bc
pop af pop af
@ -240,6 +241,8 @@ lcdClrScr:
lcdPutC: lcdPutC:
cp ASCII_LF cp ASCII_LF
jp z, lcdLinefeed jp z, lcdLinefeed
cp ASCII_BS
jr z, .bs
push hl push hl
call fntGet call fntGet
jr nz, .end jr nz, .end
@ -247,3 +250,11 @@ lcdPutC:
.end: .end:
pop hl pop hl
ret ret
.bs:
ld a, (LCD_CURCOL)
or a
ret z ; going back one line is too complicated.
; not implemented yet
dec a
ld (LCD_CURCOL), a
ret