Improved keyboard response for the Dragon 32/64

Hardware Hacking, Programming and Game Solutions/Cheats
Post Reply
zephyr
Posts: 1474
Joined: Mon Jul 21, 2008 1:18 am

Improved keyboard response for the Dragon 32/64

Post by zephyr »

Steve Woolham sent me this via e-mail the other day and asked me to post it here after testing. The BASIC example program works perfectly and is safe to use even with DragonDOS running. I have included a listing of the BASIC program so that you can type it in directly if you prefer.

Code: Select all

0 'SPEEDKEY V1.0
1 'BY STEPHEN J WOOLHAM
2 '
3 'IMPROVED KEYBOARD RESPONSE
4 'FOR DRAGON 32 AND 64.
5 '
10 '
20 'CHECK IF SPEEDKEY IS ENABLED
30 '
40 IF PEEK(269)+PEEK(270)=250 THEN 140
50 '
60 'ENABLE SPEEDKEY
70 '
80 IC=65283
90 POKE IC,PEEK(IC)AND 254
100 POKE 250,116:POKE 251,1:POKE 252,81:POKE 253,126:POKE 254,PEEK(269):POKE 255,PEEK(270)
110 POKE 269,0:POKE 270,250
120 POKE IC,PEEK(IC)OR 1
130 PRINT"SPEEDKEY ENABLED":END
140 '
150 'DISABLE SPEEDKEY
160 '
170 IC=65283
180 POKE IC,PEEK(IC) AND 254
190 POKE 269,PEEK(254):POKE 270,PEEK(255)
200 POKE IC,PEEK(IC)OR 1
210 PRINT"SPEEDKEY DISABLED":END
From the ReadMe:
SpeedKey v1.0
By Stephen J Woolham

Improved keyboard response for the Dragon 32 and 64.


Due to a minor problem with the Dragon 32 (and 64) keyboard routine, some keys
can regularly fail to be detected even at typing speed of the non professional
typists among us. A brief explanaton of the problem from the book "Inside the
Dragon" (Duncan Smeed and Ian Sommerville) is listed below.


** Text below copied from "Inside the Dragon":

"This two-stage scanning technique is used to speed up the scanning routine
although it does mean that key rollover does not occur for keys on the same
row. In other words, holding the 'A' key down and then pressing a key on the
same row, say 'C, does not register the new character but pressing a key on
a different row, say 'H', does register."

"One drawback of this technique is that it prevents the same key from being
recognised again unless it is released and re-pressed. Furthermore, if a key
is held down, it prevents other keys in the same matrix row from being
recognised."

** End of text copied from Inside the Dragon.


Fortunately this problem can easily be remedied by typing in just a few pokes
at the BASIC command prompt, or from within a BASIC (or machine code) program.
Although the pokes can be entered at the BASIC command prompt, I have decided
to included the pokes as part of a BASIC program in order to best illustrate
their use.

The quickest way to test if the pokes have been entered correctly is to press in
turn the keys "ASDF". Only the first two keys will be detected if the pokes have
not been entered correctly.

NOTE: These pokes are not necessary if you are using the Dragon 64's auto-repeat
function, or any of the auto-repeat routines released by myself as standalone
programs, or included as part of an enhanced Dragon operating system ROM.


Hope you enjoy using these pokes!!!

Regards,
Stephen J. Woolham
Attachments
SpeedKey10.zip
(6.5 KiB) Downloaded 351 times
zephyr
Posts: 1474
Joined: Mon Jul 21, 2008 1:18 am

Re: Improved keyboard response for the Dragon 32/64

Post by zephyr »

Here's a little more information about the Dragon's poor keyboard response.
A couple more items on keyboard related matters: DRAGON BASIC’s routine to poll for entry from the keyboard is somewhat less efficient then CoCo’s. I’m not a speed typist but, in the two years I’ve been computing, I’ve gotten pretty proficient at typing the word "LIST". The word is typed so fast that before the "L" key is released, the "I" key is being pressed then "S" and "T". The DRAGON turns my lightning "LIST" into "LST". This occurs because DRAGON’s keyboard polling routine will not recognize the "I" key stroke until the "L" key is released because they are apparently on the same row of the keyboard matrix. This also effects the method used to pause scrolling during a LIST with a "SHIFT @". The inability to accept a double keystroke happens only while DRAGON is in the 32K mode (on powerup). While in the 64K mode, not only is the "problem" eliminated but, if a key is held down for more than a few 10ths of a second, it starts repeating.
The text above was copied from 'The "CoCo" Chronicles' thread at the coco3.com community forum.
zephyr
Posts: 1474
Joined: Mon Jul 21, 2008 1:18 am

Re: Improved keyboard response for the Dragon 32/64

Post by zephyr »

Here in an alternative version of Steve Woolham's Speedkey routine. This updated version is also compatible with all known versions of CoCo and Dragon DOS (The original SpeedKey routine is not compatible with HDB-DOS).

Code: Select all

10 GOSUB 10000
20 END
10000 ' ENABLE SPEEDKEY
10010 IF PEEK(269)+PEEK(270)<>1 THEN POKE65283,52:POKE256,116:POKE257,1:POKE258,81:POKE259,126:POKE260,PEEK(269):POKE 261,PEEK(270):POKE269,1:POKE270,0:POKE65283,53
10020 RETURN
10030 ' DISABLE SPEEDKEY
10040 IF PEEK(269)+PEEK(270)=1 THEN POKE65283,52:POKE269,PEEK(260):POKE270,PEEK(261):POKE65283,53
10050 RETURN
I have also attached a copy of the BASIC example program and an auto-running machine code version in .CAS and .WAV format. I recommend using Audacity 1.2.6 to convert the included wave (.WAV) files to a real audio cassette recording.

Note: The auto-running machine code version is not DOS compatible (except DeltaDOS). It is designed to be loaded very quickly from cassette (or DeltaDOS disk) before writing your own programs or playing any of your favourite BASIC games.

To save the auto-running machine code version to DeltaDOS disk:
(1) CLOADM"SKEY"
(2) POKE253,126:POKE254,139:POKE255,141:SAVEM"SKEY",253,270
Attachments
SPEEDKEYv1-1.zip
(1.58 KiB) Downloaded 290 times
Last edited by zephyr on Thu Feb 27, 2014 1:32 pm, edited 4 times in total.
zephyr
Posts: 1474
Joined: Mon Jul 21, 2008 1:18 am

Re: Improved keyboard response for the Dragon 32/64

Post by zephyr »

Here is a DOS compatible auto-running machine code version.

To save SKEYDOS to CumanaDOS/DragonDOS/DOSPlus/SuperDOS disk:
(1) CLEAR200,32000
(2) CLOADM"SKEYDOS"
(3) SAVE"SKEYDOS",32382,32567,35725

To save SKEYDOS HDB-DOS disk:
(1) CLEAR200,32000
(2) CLOADM"SKEYDOS"
(3) SAVEM"SKEYDOS",32382,32567,35725

EDIT: Attachment removed.
Last edited by zephyr on Tue Feb 25, 2014 5:10 pm, edited 5 times in total.
zephyr
Posts: 1474
Joined: Mon Jul 21, 2008 1:18 am

Re: Improved keyboard response for the Dragon 32/64

Post by zephyr »

Here is an improved auto-running DOS compatible version. Follow the previous instructions for saving to disk.
Attachments
SKEY-DOSv1-2.zip
(724 Bytes) Downloaded 283 times
Post Reply