Dragon 64 keyboard auto-repeat bug fix

Use this forum to submit new files for the download section of the archive. I will check each submission and upload it to the archive on a regular basis.
Post Reply
zephyr
Posts: 1474
Joined: Mon Jul 21, 2008 1:18 am

Dragon 64 keyboard auto-repeat bug fix

Post by zephyr »

Here's a handy little program from Steve Woolham that fixes a bug in the Dragon/Tano Dragon 64's keyboard auto-repeat routine. I have included a listing of the BASIC loader so you can type it directly if you prefer.

Code: Select all

0 'AUTO-REPEAT BUG FIX PATCH 1.0
1 'FOR THE DRAGON/TANO DRAGON 64
2 '(C) 2009 BY STEPHEN J WOOLHAM
3 '
10 CLS:PRINT"WRITING MACHINE CODE..."
20 FOR I=28672 TO 28980:READ A$:X=VAL("&H"+A$):CSUM=CSUM+X:POKEI,X:NEXT
30 CLS:IF CSUM<>28256 THEN PRINT"ERROR IN DATA LINES":END
40 PRINT"START ADDRESS = 28672"
50 PRINT"END ADDRESS = 28980"
60 PRINT"EXEC ADDRESS = 28672"
70 END
100 DATA 1A,50,8D,7B,81,55,26,1,39,8D,60,8E,70,C0,8D,64,8D,6D,26,33,8E,80,0,7F,FF,DE,EC,84,7F,FF,DF,ED,81,8C,FE,FF,25,F1,BE,1,D,8C,BF
110 DATA 20,26,4,9E,76,27,B,BF,BF,47,9F,76,8E,BF,20,BF,1,D,CE,BE,E0,8D,52,8E,71,1D,20,17,CE,FD,E5,8D,48,4F,5F,8E,C0,0,E3,81,8C,FF,0
120 DATA 25,F9,FD,1,1B,8E,71,29,8D,14,B6,FF,3,8A,1,B7,FF,3,1C,AF,39,8D,12,10,27,4A,6,7E,F9,F7,30,1F,8D,7,10,27,20,69,7E,D0,E5,CC,F6
130 DATA FF,10,B3,BF,20,27,9,10,B3,FE,18,27,4,86,55,39,4F,4D,39,8E,70,A1,A6,80,A7,C0,8C,70,C0,26,F7,39,F6,1,51,CA,40,5C,26,3,F7,1,1D
140 DATA 4D,27,E,F6,1,1F,B1,1,1D,27,3,58,58,58,FD,1,1D,35,94,12,41,55,54,4F,2D,52,45,50,45,41,54,20,42,55,47,20,46,49,58,20,50,41,54
150 DATA 43,48,20,56,31,2E,30,D,46,4F,52,20,54,48,45,20,44,52,41,47,4F,4E,2F,54,41,4E,4F,20,44,52,41,47,4F,4E,20,36,34,D,28,43,29,20
160 DATA 32,30,30,39,20,42,59,20,53,54,45,50,48,45,4E,20,4A,20,57,4F,4F,4C,48,41,4D,D,D,0,27,33,32,27,20,42,41,53,49,43,D,0,27,36,34,27,20,42,41,53,49,43,D,0
From the ReadMe:
Auto-Repeat Bug Fix Patch v1.0
For the Dragon/Tano Dragon 64
Copyright (c) 2009 by Stephen J. Woolham


If you've ever used the keyboard auto-repeat function of the Dragon 64, you
will be very much aware by now that it has a rather annoying bug that causes
the 0.8 second 'delay before repeat' to fail when the shift key is held down
in combination with any of the keys which double as shifted characters.

e.g.

Hold down SHIFT and press the '9' key to get the right round bracket, release
the key but keep SHIFT held down, press the '9' key again. You will now find
it very difficult to type only a single bracket because the key will start to
repeat again almost immediately.


This program fixes the bug by patching the Dragon 64's keyboard auto-repeat
routine. It patches the 32K mode BASIC by switching the computer into 64K RAM
mode, and copying all ROM area's to RAM where the BASIC operating system can
be modified. The only problem with this method is that the computer switches
back to 32K mode if the reset button is pressed. The best way to restore the
bug fix after reset is to run the program again. This method will refresh the
BASIC operating system in RAM which will prevent the chance of any corruption
caused by whatever crashed your computer in the first place. The other quick
but somewhat unsafe method is to simply use POKE65503,0. After patching, the
program will automatically enable the auto-repeat function.

None of the above is necessary in '64' mode as the BASIC operating system is
already copied to RAM by default. The '64' mode checksum at $011B - $011C is
also updated by the program in order to prevent the patch being overwritten
if the reset button is pressed.


Although this program is written entirely in machine code, I have decided to
release it in the form of a BASIC loader so that it can easily be listed and
typed in directly on a real Dragon 64. The loader will poke the machine code
into memory and display START, END, and EXEC addresses for saving to tape or
disk when it finishes. Once you have saved the machine code program to tape,
or disk, it can be loaded very quickly any time you want to use the keyboard
auto-repeat function.


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

Re: Dragon 64 keyboard auto-repeat bug fix

Post by zephyr »

Some extra information that I think should have been mentioned in the readme.

(1) This patch also makes the Dragon 64's auto-repeat function usable under DragonDOS.

(2) For people using DragonDOS for the first time please note that you need to add 1 to the end address when saving to disk.

Example:
Save to tape: CSAVEM"D64PATCH",28672,28980,28672
Save to disk: SAVE"D64PATCH",28672,28981,28672
Last edited by zephyr on Fri Dec 04, 2009 5:41 pm, edited 1 time in total.
User avatar
snarkhunter
Posts: 241
Joined: Fri Apr 03, 2009 7:16 pm
Location: France

Re: Dragon 64 keyboard auto-repeat bug fix

Post by snarkhunter »

zephyr wrote:(2) For people using DragonDOS for the first time please note that you need to add 1 to the end address when saving to disk.

Example:
Save to tape: CSAVEM"D64PATCH",28672,28980,28672
Save to disk: SAVE"D64PATH",28672,28981,28672
Why is is so?!!!

I already know one can only PEEK the program's length under DragonDOS, not its actual end address. Therefore, one needs to compute its end address as (start address + length -1).

But I cannot understand why the (end adress +1) would be delivered...

Any more information about this, please?

Kind regards,
Lionel
zephyr
Posts: 1474
Joined: Mon Jul 21, 2008 1:18 am

Re: Dragon 64 keyboard auto-repeat bug fix

Post by zephyr »

If you don't add +1 to the the end address, I can assure you that DragonDOS will save the program code to disk minus the last byte. Try the following quick test under emulation and see for yourself...

Test #1
(a) Load and run the BASIC loader program

(b) Save M/C to disk with SAVE"D64PATCH",28672,28980,28672

(c) POKE28980,255:LOAD"D64PATCH.BIN"

(d) PRINT PEEK(28980) << The result will be 255 because the last byted will not be loaded.

Test #2
(a) Load and run the BASIC loader program

(b) Save M/C to disk with SAVE"D64PATCH2",28672,28981,28672

(c) POKE28980,255:LOAD"D64PATCH2.BIN"

(d) PRINT PEEK(28980) << The result will be zero because the last byte will now be loaded correctly.


From the DragonDOS Manual:
Saving and Loading Machine Code

Machine code (or any other series of bytes) may be saved on disk using
SAVE"CODE" ,start,end,entry
where start is the starting address of the code in memory, end is the
addresss of the byte following the last byte of the code in memory and
entry is the entry point (the default EXEC value). "CODE" may be
replaced by any other legal filename.
Post Reply