mirror of
https://github.com/hsoft/collapseos.git
synced 2024-12-25 18:08:05 +11:00
f6ded7712e
This is the first commit I do entirely in VE. It's a habit I'm planning on taking as it helps a lot to find usability issues.
17 lines
645 B
Plaintext
17 lines
645 B
Plaintext
: _shift? ( kc -- f ) DUP 0x12 = SWAP 0x59 = OR ;
|
|
: _get ( -- kc ) 0 ( dummy ) BEGIN DROP (ps2kc) DUP UNTIL ;
|
|
: (key) _get
|
|
DUP 0xe0 ( extended ) = IF ( ignore ) DROP (key) EXIT THEN
|
|
DUP 0xf0 ( break ) = IF DROP ( )
|
|
( get next kc and see if it's a shift )
|
|
_get _shift? IF ( drop shift ) 0 PS2_SHIFT C! 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 C! (key) EXIT THEN
|
|
( ah, finally, we have a gentle run-of-the-mill KC )
|
|
PS2_CODES PS2_SHIFT C@ IF 0x80 + THEN + C@
|
|
?DUP NOT IF (key) THEN ;
|
|
|
|
|