Greg Dionne has been working on a TRS-80 BASIC compiler. In the midst of corresponding with him about the developments we discussed my normal PEEK(2)ANDPEEK(17023) routine for continuous polling of key input. He then mentioned the "debounce" key delay, which could apparently be adjusted by way of a couple of POKEs. Here are his comments, which might be helpful for MC-10 BASIC programmers:
More notes for you now that I'm looking at the keyboard routines.
1. If you want the interpreter to go faster when a key is pressed, set the debounce delay to 1. (POKE 16925,0 : POKE 16926,1).
2. To examine the state of the BREAK key, (well, for the compiler at least), take a PEEK at 16955. 255=PRESSED 0=NOT PRESSED
3. The keys for the KEYSCAN are stored in 16945 to 16952. This gives you access to each individual key. So you can tell if more than one key is pressed and which keys.
4. CONTROL, SHIFT and BREAK do not have dedicated memory allocated for them. You can query the SHIFT key state via doing a PEEK(3). But the others will be lost since the interpreter will immediately stomp on the keystrobe after catching a key, so only SHIFT can (reliably) be caught this way. The compiler will have no trouble querying the other states.
To see all of this in action:
10 POKE 16925,0:POKE 16926,1 : REM MAKE IT SNAPPY
30 FOR I = 0 TO 7:POKE MC+I,PEEK(KS+I):NEXT
40 POKE2,254:POKE 16393,PEEK(3):REM CONTROL
50 POKE2,251:POKE 16394,PEEK(3):REM BREAK
60 POKE2,127:POKE 16395,PEEK(3):REM SHIFT
70 KY$=INKEY$:REM NEEDED FOR COMPILER ONLY
80 GOTO 30
I have added his debounce delay POKES (set to 1) to the following programs and updated my compilations:
It seems to make a noticeable difference. Movement seems much smoother and responsive. I'll be adding the POKEs to other programs over the next little while.