1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-27 12:38:05 +11:00
This commit is contained in:
Virgil Dupras 2020-05-20 18:56:18 -04:00
parent c86d8a74a0
commit b874a1c175
5 changed files with 49 additions and 0 deletions

View File

@ -6,6 +6,7 @@ MASTER INDEX
150 Extra words
200 Z80 assembler 260 Cross compilation
280 Z80 boot code 350 Core words
410 PS/2 keyboard subsystem
490 TRS-80 Recipe 520 Fonts
550 TI-84+ Recipe 580 RC2014 Recipe
620 Sega Master System Recipe

11
blk/410 Normal file
View File

@ -0,0 +1,11 @@
PS/2 keyboard subsystem
Provides (key) from a driver providing (ps2kc). That is, for a
driver taking care of providing all key codes emanating from a
PS/2 keyboard, this subsystem takes care of mapping those key-
strokes to ASCII characters. This code is designed to be cross-
compiled and loaded with drivers.
Requires PS2_MEM to be defined.
Load range: 411-414

14
blk/411 Normal file
View File

@ -0,0 +1,14 @@
: PS2_SHIFT [ PS2_MEM LITN ] ;
: PS2$ 0 PS2_SHIFT C! ;
( A list of the values associated with the 0x80 possible scan
codes of the set 2 of the PS/2 keyboard specs. 0 means no
value. That value is a character that can be read in (key)
No make code in the PS/2 set 2 reaches 0x80. )
CREATE PS2_CODES
( 00 ) 0 C, 0 C, 0 C, 0 C, 0 C, 0 C, 0 C, 0 C,
( 08 ) 0 C, 0 C, 0 C, 0 C, 0 C, 9 C, '`' C, 0 C,
( 10 ) 0 C, 0 C, 0 C, 0 C, 0 C, 'q' C, '1' C, 0 C,
( 18 ) 0 C, 0 C, 'z' C, 's' C, 'a' C, 'w' C, '2' C, 0 C,
( 20 ) 0 C, 'c' C, 'x' C, 'd' C, 'e' C, '4' C, '3' C, 0 C,
( 28 ) 0 C, 32 C, 'v' C, 'f' C, 't' C, 'r' C, '5' C, 0 C,

11
blk/412 Normal file
View File

@ -0,0 +1,11 @@
( 30 ) 0 C, 'n' C, 'b' C, 'h' C, 'g' C, 'y' C, '6' C, 0 C,
( 38 ) 0 C, 0 C, 'm' C, 'j' C, 'u' C, '7' C, '8' C, 0 C,
( 40 ) 0 C, ',' C, 'k' C, 'i' C, 'o' C, '0' C, '9' C, 0 C,
( 48 ) 0 C, '.' C, '/' C, 'l' C, ';' C, 'p' C, '-' C, 0 C,
( 50 ) 0 C, 0 C, ''' C, 0 C, '[' C, '=' C, 0 C, 0 C,
( 58 ) 0 C, 0 C, 13 C, ']' C, 0 C, '\' C, 0 C, 0 C,
( 60 ) 0 C, 0 C, 0 C, 0 C, 0 C, 0 C, 8 C, 0 C,
( 68 ) 0 C, '1' C, 0 C, '4' C, '7' C, 0 C, 0 C, 0 C,
( 70 ) '0' C, '.' C, '2' C, '5' C, '6' C, '8' C, 27 C, 0 C,
( 78 ) 0 C, 0 C, '3' C, 0 C, 0 C, '9' C, 0 C, 0 C,
: _shift? ( kc -- f ) DUP 0x12 = SWAP 0x59 = OR ;

12
blk/413 Normal file
View File

@ -0,0 +1,12 @@
: (key) 0 ( dummy ) BEGIN DROP (ps2kc) DUP UNTIL ( kc )
DUP 0xe0 ( extended ) = IF ( ignore ) DROP (key) EXIT THEN
DUP 0xf0 ( break ) = IF DROP ( )
( get next key and see if it's a shift )
(key) _shift? IF ( drop shift ) 0 PS2_SHIFT ! THEN
( whether we had a shift or not, we return the next )
(key) EXIT THEN
DUP 0x7f > IF DROP (key) EXIT THEN
DUP _shift? IF DROP 1 PS2_SHIFT ! (key) EXIT THEN
( ah, finally, we have a gentle run-of-the-mill KC )
PS2_CODES + C@ DUP NOT IF DROP (key) EXIT THEN ;