From 8d5c26f299a1f092215b1bb6e1d32cbef1aa95de Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Fri, 8 Nov 2019 15:45:45 -0500 Subject: [PATCH] ti/kbd: add alpha support no a-lock or lowercase yet. ref #41 --- kernel/ti/kbd.asm | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/kernel/ti/kbd.asm b/kernel/ti/kbd.asm index f31802b..1993207 100644 --- a/kernel/ti/kbd.asm +++ b/kernel/ti/kbd.asm @@ -24,11 +24,17 @@ kbdGetC: push bc push hl -; loop until a digit is pressed + ; During this GetC loop, register C holds the modificators (Alpha, 2nd) + ld c, 0 + ; loop until a digit is pressed .loop: ld hl, .dtbl ; we go through the 7 rows of the table ld b, 7 + ; is alpha mod enabled? + bit 0, c + jr z, .inner ; unset? skip next + ld hl, .atbl ; set? we're in alpha mode .inner: ld a, (hl) ; group mask call .get @@ -54,6 +60,11 @@ kbdGetC: ld a, (hl) or a ; is char 0? jr z, .loop ; yes? unsupported. loop. + cp 0x80 ; is it alpha? + jr nz, .notalpha + set 0, c + jr .loop +.notalpha: ; wait until all keys are de-pressed push af ; --> lvl 1 @@ -81,11 +92,22 @@ kbdGetC: ; digits table. each row represents a group. first item is group mask. ; 0 means unsupported. no group 7 because it has no keys. +; 0x80 is a special value for ALPHA key which is never returned directly. .dtbl: .db 0xfe, 0, 0, 0, 0, 0, 0, 0, 0 .db 0xfd, 0x0d, '+' ,'-' ,'*', '/', '^', 0, 0 .db 0xfb, 0, '3', '6', '9', ')', 0, 0, 0 .db 0xf7, '.', '2', '5', '8', '(', 0, 0, 0 .db 0xef, '0', '1', '4', '7', ',', 0, 0, 0 - .db 0xdf, 0, 0, 0, 0, 0, 0, 0, 0 + .db 0xdf, 0, 0, 0, 0, 0, 0, 0, 0x80 + .db 0xbf, 0, 0, 0, 0, 0, 0, 0, 0x7f + +; alpha table. same as .dtbl, for when we're in alpha mode. +.atbl: + .db 0xfe, 0, 0, 0, 0, 0, 0, 0, 0 + .db 0xfd, 0x0d, '"' ,'W' ,'R', 'M', 'H', 0, 0 + .db 0xfb, '?', 0, 'V', 'Q', 'L', 'G', 0, 0 + .db 0xf7, ':', 'Z', 'U', 'P', 'K', 'F', 'C', 0 + .db 0xef, '_', 'Y', 'T', 'O', 'J', 'E', 'B', 0 + .db 0xdf, 0, 'X', 'S', 'N', 'I', 'D', 'A', 0x80 .db 0xbf, 0, 0, 0, 0, 0, 0, 0, 0x7f