Home » Archimedes archive » Acorn Computing » 1994 11.adf » 9411 » TechForum/DASpatch/ReadMe

TechForum/DASpatch/ReadMe

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Acorn Computing » 1994 11.adf » 9411
Filename: TechForum/DASpatch/ReadMe
Read OK:
File size: 0ACF bytes
Load address: 0000
Exec address: 0000
File contents
Back in the 1993 Special issue, I mentioned a small problem with
DragASprite v 0.03, & Acorn still have yet to release a sofloaded
replacement, for RISC OS 3.1 machines, which fixes this bug.

Recall, there is a single faulty instruction in the module which
can screw up initial sprite alignment within its drag box. For top
alignment, the original code uses sprite width in a calculation that
should use height.

The resulting error in initial sprite position may only be cosmetic,
but it can be very noticeable when it does occur.

I recently wanted to distribute an application which required this bug
be fixed, & although, as described in the December '93 TechForum, I
had patched a single copy of DragASprite, due to copyright
restrictions I couldn't distribute this.

The original BASIC routine which I wrote to patch the module could
itself have been distributed, as it was with TechForum, however to
non-programming users it was rather cumbersome, so instead I've
written a short ARM code utility which has the similar effect of
patching the module, but does so only temporarily - upto the next hard
reset - each time it is run.

Unlike the former routine which saved the patched module to disc for
manual loading & relied on the user only using it if she did indeed
have the bugged 0.03 version, this one can be executed from an
application's !Run file to automatically patch & reinitialise the
module, if appropriate, such that the end user need know nothing about
what is going on.

Most importantly, this code takes much more care to ensure that the
version of DragASprite currently present is this bugged one, before it
makes any modifications, so it should be safe to run on any machine.

When run, if there is no version present or it is pre 0.03, no patch
can occur. If it is 0.03 & it still contains the bug, it will be fixed
if possible, whereas if the version is post 0.03, it shouldn't need
fixing & will be left alone.

The bugged version is identified by checking the module length, the
specific instruction to be changed, & by performing an OS_CRC on the
whole module.

The utility is only 640 bytes long. I've included the source code for
your perusal, in directory 's'.

It's usually silent in operation, however if you add the argument
'verbose' to its command tail, you will get a report on the action
taken, via Wimp_ReportError.

Assuming you put DASpatch into your application directory, I suggest
you call it from !Run using something like:

SetEval App$DAS3 0
RMEnsure DragASprite 0.04 SetEval App$DAS3 -1
RMEnsure DragASprite 0.03 SetEval App$DAS3 0
If App$DAS3 Then Run <App$Dir>.DASpatch
UnSet App$DAS3
| NB Use
| If App$DAS3 Then Run <App$Dir>.DASpatch verbose
| instead of the similar line above, to get a report on action taken
00000000  0a 42 61 63 6b 20 69 6e  20 74 68 65 20 31 39 39  |.Back in the 199|
00000010  33 20 53 70 65 63 69 61  6c 20 69 73 73 75 65 2c  |3 Special issue,|
00000020  20 49 20 6d 65 6e 74 69  6f 6e 65 64 20 61 20 73  | I mentioned a s|
00000030  6d 61 6c 6c 20 70 72 6f  62 6c 65 6d 20 77 69 74  |mall problem wit|
00000040  68 0a 44 72 61 67 41 53  70 72 69 74 65 20 76 20  |h.DragASprite v |
00000050  30 2e 30 33 2c 20 26 20  41 63 6f 72 6e 20 73 74  |0.03, & Acorn st|
00000060  69 6c 6c 20 68 61 76 65  20 79 65 74 20 74 6f 20  |ill have yet to |
00000070  72 65 6c 65 61 73 65 20  61 20 73 6f 66 6c 6f 61  |release a sofloa|
00000080  64 65 64 0a 72 65 70 6c  61 63 65 6d 65 6e 74 2c  |ded.replacement,|
00000090  20 66 6f 72 20 52 49 53  43 20 4f 53 20 33 2e 31  | for RISC OS 3.1|
000000a0  20 6d 61 63 68 69 6e 65  73 2c 20 77 68 69 63 68  | machines, which|
000000b0  20 66 69 78 65 73 20 74  68 69 73 20 62 75 67 2e  | fixes this bug.|
000000c0  0a 0a 52 65 63 61 6c 6c  2c 20 74 68 65 72 65 20  |..Recall, there |
000000d0  69 73 20 61 20 73 69 6e  67 6c 65 20 66 61 75 6c  |is a single faul|
000000e0  74 79 20 69 6e 73 74 72  75 63 74 69 6f 6e 20 69  |ty instruction i|
000000f0  6e 20 74 68 65 20 6d 6f  64 75 6c 65 20 77 68 69  |n the module whi|
00000100  63 68 0a 63 61 6e 20 73  63 72 65 77 20 75 70 20  |ch.can screw up |
00000110  69 6e 69 74 69 61 6c 20  73 70 72 69 74 65 20 61  |initial sprite a|
00000120  6c 69 67 6e 6d 65 6e 74  20 77 69 74 68 69 6e 20  |lignment within |
00000130  69 74 73 20 64 72 61 67  20 62 6f 78 2e 20 46 6f  |its drag box. Fo|
00000140  72 20 74 6f 70 0a 61 6c  69 67 6e 6d 65 6e 74 2c  |r top.alignment,|
00000150  20 74 68 65 20 6f 72 69  67 69 6e 61 6c 20 63 6f  | the original co|
00000160  64 65 20 75 73 65 73 20  73 70 72 69 74 65 20 77  |de uses sprite w|
00000170  69 64 74 68 20 69 6e 20  61 20 63 61 6c 63 75 6c  |idth in a calcul|
00000180  61 74 69 6f 6e 20 74 68  61 74 0a 73 68 6f 75 6c  |ation that.shoul|
00000190  64 20 75 73 65 20 68 65  69 67 68 74 2e 0a 0a 54  |d use height...T|
000001a0  68 65 20 72 65 73 75 6c  74 69 6e 67 20 65 72 72  |he resulting err|
000001b0  6f 72 20 69 6e 20 69 6e  69 74 69 61 6c 20 73 70  |or in initial sp|
000001c0  72 69 74 65 20 70 6f 73  69 74 69 6f 6e 20 6d 61  |rite position ma|
000001d0  79 20 6f 6e 6c 79 20 62  65 20 63 6f 73 6d 65 74  |y only be cosmet|
000001e0  69 63 2c 0a 62 75 74 20  69 74 20 63 61 6e 20 62  |ic,.but it can b|
000001f0  65 20 76 65 72 79 20 6e  6f 74 69 63 65 61 62 6c  |e very noticeabl|
00000200  65 20 77 68 65 6e 20 69  74 20 64 6f 65 73 20 6f  |e when it does o|
00000210  63 63 75 72 2e 0a 0a 49  20 72 65 63 65 6e 74 6c  |ccur...I recentl|
00000220  79 20 77 61 6e 74 65 64  20 74 6f 20 64 69 73 74  |y wanted to dist|
00000230  72 69 62 75 74 65 20 61  6e 20 61 70 70 6c 69 63  |ribute an applic|
00000240  61 74 69 6f 6e 20 77 68  69 63 68 20 72 65 71 75  |ation which requ|
00000250  69 72 65 64 20 74 68 69  73 20 62 75 67 0a 62 65  |ired this bug.be|
00000260  20 66 69 78 65 64 2c 20  26 20 61 6c 74 68 6f 75  | fixed, & althou|
00000270  67 68 2c 20 61 73 20 64  65 73 63 72 69 62 65 64  |gh, as described|
00000280  20 69 6e 20 74 68 65 20  44 65 63 65 6d 62 65 72  | in the December|
00000290  20 27 39 33 20 54 65 63  68 46 6f 72 75 6d 2c 20  | '93 TechForum, |
000002a0  49 0a 68 61 64 20 70 61  74 63 68 65 64 20 61 20  |I.had patched a |
000002b0  73 69 6e 67 6c 65 20 63  6f 70 79 20 6f 66 20 44  |single copy of D|
000002c0  72 61 67 41 53 70 72 69  74 65 2c 20 64 75 65 20  |ragASprite, due |
000002d0  74 6f 20 63 6f 70 79 72  69 67 68 74 0a 72 65 73  |to copyright.res|
000002e0  74 72 69 63 74 69 6f 6e  73 20 49 20 63 6f 75 6c  |trictions I coul|
000002f0  64 6e 27 74 20 64 69 73  74 72 69 62 75 74 65 20  |dn't distribute |
00000300  74 68 69 73 2e 0a 0a 54  68 65 20 6f 72 69 67 69  |this...The origi|
00000310  6e 61 6c 20 42 41 53 49  43 20 72 6f 75 74 69 6e  |nal BASIC routin|
00000320  65 20 77 68 69 63 68 20  49 20 77 72 6f 74 65 20  |e which I wrote |
00000330  74 6f 20 70 61 74 63 68  20 74 68 65 20 6d 6f 64  |to patch the mod|
00000340  75 6c 65 20 63 6f 75 6c  64 0a 69 74 73 65 6c 66  |ule could.itself|
00000350  20 68 61 76 65 20 62 65  65 6e 20 64 69 73 74 72  | have been distr|
00000360  69 62 75 74 65 64 2c 20  61 73 20 69 74 20 77 61  |ibuted, as it wa|
00000370  73 20 77 69 74 68 20 54  65 63 68 46 6f 72 75 6d  |s with TechForum|
00000380  2c 20 68 6f 77 65 76 65  72 20 74 6f 0a 6e 6f 6e  |, however to.non|
00000390  2d 70 72 6f 67 72 61 6d  6d 69 6e 67 20 75 73 65  |-programming use|
000003a0  72 73 20 69 74 20 77 61  73 20 72 61 74 68 65 72  |rs it was rather|
000003b0  20 63 75 6d 62 65 72 73  6f 6d 65 2c 20 73 6f 20  | cumbersome, so |
000003c0  69 6e 73 74 65 61 64 20  49 27 76 65 0a 77 72 69  |instead I've.wri|
000003d0  74 74 65 6e 20 61 20 73  68 6f 72 74 20 41 52 4d  |tten a short ARM|
000003e0  20 63 6f 64 65 20 75 74  69 6c 69 74 79 20 77 68  | code utility wh|
000003f0  69 63 68 20 68 61 73 20  74 68 65 20 73 69 6d 69  |ich has the simi|
00000400  6c 61 72 20 65 66 66 65  63 74 20 6f 66 0a 70 61  |lar effect of.pa|
00000410  74 63 68 69 6e 67 20 74  68 65 20 6d 6f 64 75 6c  |tching the modul|
00000420  65 2c 20 62 75 74 20 64  6f 65 73 20 73 6f 20 6f  |e, but does so o|
00000430  6e 6c 79 20 74 65 6d 70  6f 72 61 72 69 6c 79 20  |nly temporarily |
00000440  2d 20 75 70 74 6f 20 74  68 65 20 6e 65 78 74 20  |- upto the next |
00000450  68 61 72 64 0a 72 65 73  65 74 20 2d 20 65 61 63  |hard.reset - eac|
00000460  68 20 74 69 6d 65 20 69  74 20 69 73 20 72 75 6e  |h time it is run|
00000470  2e 0a 0a 55 6e 6c 69 6b  65 20 74 68 65 20 66 6f  |...Unlike the fo|
00000480  72 6d 65 72 20 72 6f 75  74 69 6e 65 20 77 68 69  |rmer routine whi|
00000490  63 68 20 73 61 76 65 64  20 74 68 65 20 70 61 74  |ch saved the pat|
000004a0  63 68 65 64 20 6d 6f 64  75 6c 65 20 74 6f 20 64  |ched module to d|
000004b0  69 73 63 20 66 6f 72 0a  6d 61 6e 75 61 6c 20 6c  |isc for.manual l|
000004c0  6f 61 64 69 6e 67 20 26  20 72 65 6c 69 65 64 20  |oading & relied |
000004d0  6f 6e 20 74 68 65 20 75  73 65 72 20 6f 6e 6c 79  |on the user only|
000004e0  20 75 73 69 6e 67 20 69  74 20 69 66 20 73 68 65  | using it if she|
000004f0  20 64 69 64 20 69 6e 64  65 65 64 0a 68 61 76 65  | did indeed.have|
00000500  20 74 68 65 20 62 75 67  67 65 64 20 30 2e 30 33  | the bugged 0.03|
00000510  20 76 65 72 73 69 6f 6e  2c 20 74 68 69 73 20 6f  | version, this o|
00000520  6e 65 20 63 61 6e 20 62  65 20 65 78 65 63 75 74  |ne can be execut|
00000530  65 64 20 66 72 6f 6d 20  61 6e 0a 61 70 70 6c 69  |ed from an.appli|
00000540  63 61 74 69 6f 6e 27 73  20 21 52 75 6e 20 66 69  |cation's !Run fi|
00000550  6c 65 20 74 6f 20 61 75  74 6f 6d 61 74 69 63 61  |le to automatica|
00000560  6c 6c 79 20 70 61 74 63  68 20 26 20 72 65 69 6e  |lly patch & rein|
00000570  69 74 69 61 6c 69 73 65  20 74 68 65 0a 6d 6f 64  |itialise the.mod|
00000580  75 6c 65 2c 20 69 66 20  61 70 70 72 6f 70 72 69  |ule, if appropri|
00000590  61 74 65 2c 20 73 75 63  68 20 74 68 61 74 20 74  |ate, such that t|
000005a0  68 65 20 65 6e 64 20 75  73 65 72 20 6e 65 65 64  |he end user need|
000005b0  20 6b 6e 6f 77 20 6e 6f  74 68 69 6e 67 20 61 62  | know nothing ab|
000005c0  6f 75 74 0a 77 68 61 74  20 69 73 20 67 6f 69 6e  |out.what is goin|
000005d0  67 20 6f 6e 2e 0a 0a 4d  6f 73 74 20 69 6d 70 6f  |g on...Most impo|
000005e0  72 74 61 6e 74 6c 79 2c  20 74 68 69 73 20 63 6f  |rtantly, this co|
000005f0  64 65 20 74 61 6b 65 73  20 6d 75 63 68 20 6d 6f  |de takes much mo|
00000600  72 65 20 63 61 72 65 20  74 6f 20 65 6e 73 75 72  |re care to ensur|
00000610  65 20 74 68 61 74 20 74  68 65 0a 76 65 72 73 69  |e that the.versi|
00000620  6f 6e 20 6f 66 20 44 72  61 67 41 53 70 72 69 74  |on of DragASprit|
00000630  65 20 63 75 72 72 65 6e  74 6c 79 20 70 72 65 73  |e currently pres|
00000640  65 6e 74 20 69 73 20 74  68 69 73 20 62 75 67 67  |ent is this bugg|
00000650  65 64 20 6f 6e 65 2c 20  62 65 66 6f 72 65 20 69  |ed one, before i|
00000660  74 0a 6d 61 6b 65 73 20  61 6e 79 20 6d 6f 64 69  |t.makes any modi|
00000670  66 69 63 61 74 69 6f 6e  73 2c 20 73 6f 20 69 74  |fications, so it|
00000680  20 73 68 6f 75 6c 64 20  62 65 20 73 61 66 65 20  | should be safe |
00000690  74 6f 20 72 75 6e 20 6f  6e 20 61 6e 79 20 6d 61  |to run on any ma|
000006a0  63 68 69 6e 65 2e 0a 0a  57 68 65 6e 20 72 75 6e  |chine...When run|
000006b0  2c 20 69 66 20 74 68 65  72 65 20 69 73 20 6e 6f  |, if there is no|
000006c0  20 76 65 72 73 69 6f 6e  20 70 72 65 73 65 6e 74  | version present|
000006d0  20 6f 72 20 69 74 20 69  73 20 70 72 65 20 30 2e  | or it is pre 0.|
000006e0  30 33 2c 20 6e 6f 20 70  61 74 63 68 0a 63 61 6e  |03, no patch.can|
000006f0  20 6f 63 63 75 72 2e 20  49 66 20 69 74 20 69 73  | occur. If it is|
00000700  20 30 2e 30 33 20 26 20  69 74 20 73 74 69 6c 6c  | 0.03 & it still|
00000710  20 63 6f 6e 74 61 69 6e  73 20 74 68 65 20 62 75  | contains the bu|
00000720  67 2c 20 69 74 20 77 69  6c 6c 20 62 65 20 66 69  |g, it will be fi|
00000730  78 65 64 0a 69 66 20 70  6f 73 73 69 62 6c 65 2c  |xed.if possible,|
00000740  20 77 68 65 72 65 61 73  20 69 66 20 74 68 65 20  | whereas if the |
00000750  76 65 72 73 69 6f 6e 20  69 73 20 70 6f 73 74 20  |version is post |
00000760  30 2e 30 33 2c 20 69 74  20 73 68 6f 75 6c 64 6e  |0.03, it shouldn|
00000770  27 74 20 6e 65 65 64 0a  66 69 78 69 6e 67 20 26  |'t need.fixing &|
00000780  20 77 69 6c 6c 20 62 65  20 6c 65 66 74 20 61 6c  | will be left al|
00000790  6f 6e 65 2e 0a 0a 54 68  65 20 62 75 67 67 65 64  |one...The bugged|
000007a0  20 76 65 72 73 69 6f 6e  20 69 73 20 69 64 65 6e  | version is iden|
000007b0  74 69 66 69 65 64 20 62  79 20 63 68 65 63 6b 69  |tified by checki|
000007c0  6e 67 20 74 68 65 20 6d  6f 64 75 6c 65 20 6c 65  |ng the module le|
000007d0  6e 67 74 68 2c 20 74 68  65 0a 73 70 65 63 69 66  |ngth, the.specif|
000007e0  69 63 20 69 6e 73 74 72  75 63 74 69 6f 6e 20 74  |ic instruction t|
000007f0  6f 20 62 65 20 63 68 61  6e 67 65 64 2c 20 26 20  |o be changed, & |
00000800  62 79 20 70 65 72 66 6f  72 6d 69 6e 67 20 61 6e  |by performing an|
00000810  20 4f 53 5f 43 52 43 20  6f 6e 20 74 68 65 0a 77  | OS_CRC on the.w|
00000820  68 6f 6c 65 20 6d 6f 64  75 6c 65 2e 0a 0a 54 68  |hole module...Th|
00000830  65 20 75 74 69 6c 69 74  79 20 69 73 20 6f 6e 6c  |e utility is onl|
00000840  79 20 36 34 30 20 62 79  74 65 73 20 6c 6f 6e 67  |y 640 bytes long|
00000850  2e 20 49 27 76 65 20 69  6e 63 6c 75 64 65 64 20  |. I've included |
00000860  74 68 65 20 73 6f 75 72  63 65 20 63 6f 64 65 20  |the source code |
00000870  66 6f 72 0a 79 6f 75 72  20 70 65 72 75 73 61 6c  |for.your perusal|
00000880  2c 20 69 6e 20 64 69 72  65 63 74 6f 72 79 20 27  |, in directory '|
00000890  73 27 2e 0a 0a 49 74 27  73 20 75 73 75 61 6c 6c  |s'...It's usuall|
000008a0  79 20 73 69 6c 65 6e 74  20 69 6e 20 6f 70 65 72  |y silent in oper|
000008b0  61 74 69 6f 6e 2c 20 68  6f 77 65 76 65 72 20 69  |ation, however i|
000008c0  66 20 79 6f 75 20 61 64  64 20 74 68 65 20 61 72  |f you add the ar|
000008d0  67 75 6d 65 6e 74 0a 27  76 65 72 62 6f 73 65 27  |gument.'verbose'|
000008e0  20 74 6f 20 69 74 73 20  63 6f 6d 6d 61 6e 64 20  | to its command |
000008f0  74 61 69 6c 2c 20 79 6f  75 20 77 69 6c 6c 20 67  |tail, you will g|
00000900  65 74 20 61 20 72 65 70  6f 72 74 20 6f 6e 20 74  |et a report on t|
00000910  68 65 20 61 63 74 69 6f  6e 0a 74 61 6b 65 6e 2c  |he action.taken,|
00000920  20 76 69 61 20 57 69 6d  70 5f 52 65 70 6f 72 74  | via Wimp_Report|
00000930  45 72 72 6f 72 2e 0a 0a  41 73 73 75 6d 69 6e 67  |Error...Assuming|
00000940  20 79 6f 75 20 70 75 74  20 44 41 53 70 61 74 63  | you put DASpatc|
00000950  68 20 69 6e 74 6f 20 79  6f 75 72 20 61 70 70 6c  |h into your appl|
00000960  69 63 61 74 69 6f 6e 20  64 69 72 65 63 74 6f 72  |ication director|
00000970  79 2c 20 49 20 73 75 67  67 65 73 74 0a 79 6f 75  |y, I suggest.you|
00000980  20 63 61 6c 6c 20 69 74  20 66 72 6f 6d 20 21 52  | call it from !R|
00000990  75 6e 20 75 73 69 6e 67  20 73 6f 6d 65 74 68 69  |un using somethi|
000009a0  6e 67 20 6c 69 6b 65 3a  0a 0a 53 65 74 45 76 61  |ng like:..SetEva|
000009b0  6c 20 41 70 70 24 44 41  53 33 20 30 0a 52 4d 45  |l App$DAS3 0.RME|
000009c0  6e 73 75 72 65 20 44 72  61 67 41 53 70 72 69 74  |nsure DragASprit|
000009d0  65 20 30 2e 30 34 20 53  65 74 45 76 61 6c 20 41  |e 0.04 SetEval A|
000009e0  70 70 24 44 41 53 33 20  2d 31 0a 52 4d 45 6e 73  |pp$DAS3 -1.RMEns|
000009f0  75 72 65 20 44 72 61 67  41 53 70 72 69 74 65 20  |ure DragASprite |
00000a00  30 2e 30 33 20 53 65 74  45 76 61 6c 20 41 70 70  |0.03 SetEval App|
00000a10  24 44 41 53 33 20 30 0a  49 66 20 41 70 70 24 44  |$DAS3 0.If App$D|
00000a20  41 53 33 20 54 68 65 6e  20 52 75 6e 20 3c 41 70  |AS3 Then Run <Ap|
00000a30  70 24 44 69 72 3e 2e 44  41 53 70 61 74 63 68 0a  |p$Dir>.DASpatch.|
00000a40  55 6e 53 65 74 20 41 70  70 24 44 41 53 33 0a 7c  |UnSet App$DAS3.||
00000a50  20 4e 42 20 55 73 65 0a  7c 20 49 66 20 41 70 70  | NB Use.| If App|
00000a60  24 44 41 53 33 20 54 68  65 6e 20 52 75 6e 20 3c  |$DAS3 Then Run <|
00000a70  41 70 70 24 44 69 72 3e  2e 44 41 53 70 61 74 63  |App$Dir>.DASpatc|
00000a80  68 20 76 65 72 62 6f 73  65 0a 7c 20 69 6e 73 74  |h verbose.| inst|
00000a90  65 61 64 20 6f 66 20 74  68 65 20 73 69 6d 69 6c  |ead of the simil|
00000aa0  61 72 20 6c 69 6e 65 20  61 62 6f 76 65 2c 20 74  |ar line above, t|
00000ab0  6f 20 67 65 74 20 61 20  72 65 70 6f 72 74 20 6f  |o get a report o|
00000ac0  6e 20 61 63 74 69 6f 6e  20 74 61 6b 65 6e 0a     |n action taken.|
00000acf