From 4ce0727c7266f0ff1fdabc119f0a31c747bba933 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Sat, 9 May 2020 11:55:58 -0400 Subject: [PATCH] ti84: kbd driver wip --- blk/263 | 1 + blk/312 | 7 +++++++ blk/433 | 1 - blk/550 | 2 +- blk/564 | 16 ++++++++++++++++ blk/565 | 6 ++++++ blk/566 | 14 ++++++++++++++ blk/567 | 16 ++++++++++++++++ blk/568 | 9 +++++++++ blk/569 | 13 +++++++++++++ emul/forth.bin | Bin 5907 -> 5913 bytes recipes/ti84/xcomp.fs | 9 ++++++--- 12 files changed, 89 insertions(+), 5 deletions(-) create mode 100644 blk/564 create mode 100644 blk/565 create mode 100644 blk/566 create mode 100644 blk/567 create mode 100644 blk/568 create mode 100644 blk/569 diff --git a/blk/263 b/blk/263 index 370a121..dbaf796 100644 --- a/blk/263 +++ b/blk/263 @@ -4,6 +4,7 @@ VARIABLE XCURRENT : XCOFF 0x02 RAM+ CURRENT* ! ; : (xentry) XCON (entry) XCOFF ; +: XCREATE (xentry) 11 C, ; : XCODE XCON CODE XCOFF ; diff --git a/blk/312 b/blk/312 index 554a599..b2db2ee 100644 --- a/blk/312 +++ b/blk/312 @@ -5,4 +5,11 @@ CODE 2DROP chkPS, ;CODE +( a b -- a b a b ) +CODE 2DUP + HL POPqq, ( b ) DE POPqq, ( a ) + chkPS, + DE PUSHqq, HL PUSHqq, + DE PUSHqq, HL PUSHqq, +;CODE diff --git a/blk/433 b/blk/433 index 27bbd0a..a6690f1 100644 --- a/blk/433 +++ b/blk/433 @@ -7,7 +7,6 @@ SWAP DROP ; -: 2DUP OVER OVER ; : 2OVER 3 PICK 3 PICK ; : 2SWAP 3 ROLL 3 ROLL ; diff --git a/blk/550 b/blk/550 index 1792232..5820af0 100644 --- a/blk/550 +++ b/blk/550 @@ -3,4 +3,4 @@ TI-84+ Recipe Support code for the TI-84+ recipe. Contains drivers for the keyboard and LCD. -551 LCD +551 LCD 564 Keyboard diff --git a/blk/564 b/blk/564 new file mode 100644 index 0000000..477d9db --- /dev/null +++ b/blk/564 @@ -0,0 +1,16 @@ +Keyboard driver + +Low layer range: 566-568 + +Implement a (key) word that interpret keystrokes from the +builtin keyboard. The word waits for a digit to be pressed and +returns the corresponding ASCII value. + +This routine waits for a key to be pressed, but before that, it +waits for all keys to be de-pressed. It does that to ensure +that two calls to _wait only go through after two actual key +presses (otherwise, the user doesn't have enough time to +de-press the button before the next _wait routine registers the +same key press as a second one). + + (cont.) diff --git a/blk/565 b/blk/565 new file mode 100644 index 0000000..7d47d12 --- /dev/null +++ b/blk/565 @@ -0,0 +1,6 @@ +Sending 0xff to the port resets the keyboard, and then we have +to send groups we want to "listen" to, with a 0 in the group +bit. Thus, to know if *any* key is pressed, we send 0xff to +reset the keypad, then 0x00 to select all groups, if the result +isn't 0xff, at least one key is pressed. + diff --git a/blk/566 b/blk/566 new file mode 100644 index 0000000..2ea1d19 --- /dev/null +++ b/blk/566 @@ -0,0 +1,14 @@ +( Requires KBD_MEM, KBD_PORT ) +( gm -- pm, get pressed keys mask for group mask gm ) +CODE _get + HL POPqq, + chkPS, + DI, + A 0xff LDrn, + KBD_PORT OUTnA, + A L LDrr, + KBD_PORT OUTnA, + KBD_PORT INAn, + EI, + L A LDrr, HL PUSHqq, +;CODE diff --git a/blk/567 b/blk/567 new file mode 100644 index 0000000..9010624 --- /dev/null +++ b/blk/567 @@ -0,0 +1,16 @@ +( wait until all keys are de-pressed. To avoid repeat keys, we + require 64 subsequent polls to indicate all depressed keys. + all keys are considered depressed when the 0 group returns + 0xff. ) +: _wait 64 0 DO 0 _get 0xff = UNTIL ; + +( digits table. seach row represents a group. 0 means + unsupported. no group 7 because it has no key. ) +CREATE _dtbl + 0 C, 0 C, 0 C, 0 C, 0 C, 0 C, 0 C, 0 C, + 0xd C, '+' C, '-' C, '*' C, '/' C, '^' C, 0 C, 0 C, + 0 C, '3' C, '6' C, '9' C, ')' C, 0 C, 0 C, 0 C, + '.' C, '2' C, '5' C, '8' C, '(' C, 0 C, 0 C, 0 C, + '0' C, '1' C, '4' C, '7' C, ',' C, 0 C, 0 C, 0 C, + 0 C, 0 C, 0 C, 0 C, 0 C, 0 C, 0 C, 0x80 ( alpha ) C, + 0 C, 0 C, 0 C, 0 C, 0 C, 0x81 ( 2nd ) C, 0 C, 0x7f C, diff --git a/blk/568 b/blk/568 new file mode 100644 index 0000000..919b672 --- /dev/null +++ b/blk/568 @@ -0,0 +1,9 @@ +( alpha table. same as _dtbl, for when we're in alpha mode. ) +CREATE _atbl + 0 C, 0 C, 0 C, 0 C, 0 C, 0 C, 0 C, 0 C, + 0xd C, '"' C, 'w' C, 'r' C, 'm' C, 'h' C, 0 C, 0 C, + '?' C, 0 C, 'v' C, 'q' C, 'l' C, 'g' C, 0 C, 0 C, + ':' C, 'z' C, 'u' C, 'p' C, 'k' C, 'f' C, 'c' C, 0 C, + 0x20 C, 'y' C, 't' C, 'o' C, 'j' C, 'e' C, 'b' C, 0 C, + 0 C, 'x' C, 's' C, 'n' C, 'i' C, 'd' C, 'a' C, 0x80 C, + 0 C, 0 C, 0 C, 0 C, 0 C, 0x81 ( 2nd ) C, 0 C, 0x7f C, diff --git a/blk/569 b/blk/569 new file mode 100644 index 0000000..572fcd7 --- /dev/null +++ b/blk/569 @@ -0,0 +1,13 @@ +: (key) + 0 ( gid ) 0 ( dummy ) + BEGIN ( loop until a digit is pressed ) + DROP + 1+ DUP 7 = IF DROP 0 THEN ( inc gid ) + 1 OVER LSHIFT 0xff -^ ( group dmask ) _get + DUP 0xff = NOT UNTIL + ( gid dmask ) + 0xff XOR ( dpos ) 0 ( dindex ) + BEGIN 2DUP RSHIFT IF 1+ 1 ELSE 0 THEN UNTIL + ( gid dpos dindex ) SWAP DROP + ( gid dindex ) SWAP 8 * + _dtbl + C@ +; diff --git a/emul/forth.bin b/emul/forth.bin index 92c9af8b0f32d48aee07ab6af8346b28bb17d11c..ec04e62be851dd0a7b86148e2506473475696e11 100644 GIT binary patch literal 5913 zcmai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