Home » Archimedes archive » Acorn User » AU 1997-01 B.adf » Extras » PD/IClear/ReadMe

PD/IClear/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 User » AU 1997-01 B.adf » Extras
Filename: PD/IClear/ReadMe
Read OK:
File size: 1EF0 bytes
Load address: 0000
Exec address: 0000
File contents
                               IClear Module
                               ====== ======

                               by Martyn Fox

This software is Public Domain. It may be freely copied and distributed,
including distribution by magazine discs, PD libraries, bulletin boards
etc., provided the following conditions are adhered to:

1. No charge is made other than to cover the reasonable cost of duplication
and distribution.

2. No alteration is made to either the software or this text file.

3. This text file accompanies all copies of the software.

Please note that this module will only work with RISC OS 3 or later. This
copy has been modified for compatibility with the StrongARM 110 processor.

IClear is a module which makes it easier to delete text from a writable
icon. Under RISC OS, to replace the text in such an icon with new text, you
first have to either delete all the characters of the old text or press
Ctrl-U to clear it. This can be a nuisance, especially if you have just
selected the icon with the mouse, as you first have to transfer to the
keyboard, then press Ctrl-U before you can type in your new text.

With IClear running, simply double-click on the writable icon, using either
Select or Adjust. The icon will be inverted, which usually means that it
will turn black with white text. As soon as you press a key, the text in the
icon will vanish, to be replaced with the character that you typed. If you
change your mind after inverting the icon and decide you want to keep your
existing text, a further click with any mouse button anywhere on the screen
will de-invert the icon and put things back to normal.

This software will work with writable icons (button type 15) and also
draggable writable icons (button type 14) but not with writable menu items.

                             Programming Notes
                             =========== =====

The module intercepts the MouseV and InsV vectors to detect calls to
OS_Mouse and keypresses. OS_Mouse calls are first passed onto the SWI
routine and processed on exit.

Because RISC OS will not automatically detect a double-click over a writable
icon, the module has to do the job itself. This involves checking the time
interval since the previous click, selecting the 'double-arrow' pointer
sprite, checking which button was pressed and monitoring the mouse position.

Rather than put too much code into a vector intercept routine, the software
just sets one of two callbacks, depending on the time interval since the
previous click. The callback routine is called by RISC OS as soon as it is
not busy. The first of these callbacks handles a single click. It first
checks to see if the module has a record of an inverted icon and, if so,
takes steps to clear it. It then stores a record of which button was pressed
and checks the icon type. If the click was over a writable icon, it stores
the mouse position and redefines mouse pointer 1 sprite as ptr_double.

N.B. There appears to be no way of reading which sprite is used by a
particular pointer number. Versions of this module up to v1.01 always
replaced the double pointer with the ptr_default sprite after the
double-click time-out. Subsequent versions checks the icon�s validation
string, if any, looking for the �P� instruction, which sets an alternative
pointer sprite when over the icon, and restore the pointer to this sprite
after first checking its presence in the Wimp sprite pool.

The module then sets a call-after, which is an instruction to RISC OS to
call a routine after a certain length of time. It also calls OS_CallEvery to
arrange for a call every 10 centiseconds to a routine which checks the mouse
position and cancels the double-click monitoring if the mouse is moved more
than a certain amount.

N.B. Although the normal double-click time limit and permitted mouse
movement can be configured, there appears to be no way of reading their
values, other than the unreliable method of checking CMOS RAM locations,
which could change between different versions of RISC OS. This module uses
the default configuration values of 1 second maximum between clicks and a
maximum mouse movement of 10 OS units (it checks for either 10 horizontal or
10 vertical units of movement). These values are fixed in this version of
the module. If there is a demand for the ability to alter these values, I
will endeavour to include a couple of SWIs and/or star commands in a later
version.

If either a second button is pressed or the mouse is moved before the
call-after has timed out, the call-after and call-every are cancelled and a
second callback is used. This routine checks that the same button has been
pressed as previously, sets a flag and takes steps to invert the icon.

Although any icon can be inverted or de-inverted by means of a call to
Wimp_SetIconState, the procedure is not that simple. This SWI may only be
called while the application which owns the icon is the currently active
task. If we simply call it when the mouse is clicked, this may not be the
case, especially if several multi-tasking applications are running at the
same time. We have to send a message to the task but we cannot, of course,
rewrite its software.

The solution is to use a filter. We could use a pre-filter, which is called
just before Wimp_Poll is executed, or a post-filter which is called on
return from Wimp_Poll. In this case, we use the latter. The technique is to
send a unique message to the task which our filter will intercept and
recognise, telling it to invert or de-invert the required icon. Version
v1.10 also uses the filter to check the icon�s validation string to get the
pointer sprite name.

We could send a message, using reason code 17 or 18, but we would have to
find a message action code that is not used for anything else, which would
present problems. It is also permissible for a task to mask out these reason
codes, which would prevent our message getting through. So that this cannot
happen, the module sends a message with reason code 2, which usually means
'open window request'. This reason code is not supposed to be masked out
when calling Wimp_Poll. Our message sends R1+0 as zero and R1+4 as
&726C4349, which is the ASCII code for 'IClr'. This corresponds to a request
to open the window whose handle is zero, with a minimum x coordinate of
&726C4349 - a most unlikely state of affairs in any other situation! The
third word in the block contains the action code for the call. Bit 1 set
denotes that the call is to invert or clear the icon - bit 0 is cleared to
clear, set to invert. Bit 2 is set to call the routine to read the
validation string.

If a key is pressed while the inverted icon flag is set, the routine (again
by means of a callback) sends a message to clear the icon, then sends the
keypress character, preceded by a Ctrl-U to delete the text.

The module incorporates a self-checking routine to detect corruption by
viruses.

StrongARM compatibility

The Engineering Support Application Note distributed by Acorn with the
StrongARM processor states that storing the program counter to memory stores
PC+8 instead of PC+12, as in the case of the ARM, and points out that the
example code on page 1-107 of the PRM will not work for this reason.
Unfortunately, this code had been used by versions of IClear up to v1.10,
with the result that loading the module caused the machine to crash. A
simple modification to a few lines of code has restored compatibility while
maintaining backward compatibility with earlier ARM processors.

Incidentally, use of this module revealed that the configuration dialogue
box of software PC Emulator v1.70 contained a writable icon which was
created in its inverted state. Its response to a double-click is to remain
black-on-white. A subsequent single click clears it to white-on-black!

Please send all comments and suggestions to:

M.P. Fox,
31 Pierson Road,
Windsor,
Berks. SL4 5RE
00000000  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000010  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 49  |               I|
00000020  43 6c 65 61 72 20 4d 6f  64 75 6c 65 0a 20 20 20  |Clear Module.   |
00000030  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000040  20 20 20 20 20 20 20 20  20 20 20 20 3d 3d 3d 3d  |            ====|
00000050  3d 3d 20 3d 3d 3d 3d 3d  3d 0a 0a 20 20 20 20 20  |== ======..     |
00000060  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000070  20 20 20 20 20 20 20 20  20 20 62 79 20 4d 61 72  |          by Mar|
00000080  74 79 6e 20 46 6f 78 0a  0a 54 68 69 73 20 73 6f  |tyn Fox..This so|
00000090  66 74 77 61 72 65 20 69  73 20 50 75 62 6c 69 63  |ftware is Public|
000000a0  20 44 6f 6d 61 69 6e 2e  20 49 74 20 6d 61 79 20  | Domain. It may |
000000b0  62 65 20 66 72 65 65 6c  79 20 63 6f 70 69 65 64  |be freely copied|
000000c0  20 61 6e 64 20 64 69 73  74 72 69 62 75 74 65 64  | and distributed|
000000d0  2c 0a 69 6e 63 6c 75 64  69 6e 67 20 64 69 73 74  |,.including dist|
000000e0  72 69 62 75 74 69 6f 6e  20 62 79 20 6d 61 67 61  |ribution by maga|
000000f0  7a 69 6e 65 20 64 69 73  63 73 2c 20 50 44 20 6c  |zine discs, PD l|
00000100  69 62 72 61 72 69 65 73  2c 20 62 75 6c 6c 65 74  |ibraries, bullet|
00000110  69 6e 20 62 6f 61 72 64  73 0a 65 74 63 2e 2c 20  |in boards.etc., |
00000120  70 72 6f 76 69 64 65 64  20 74 68 65 20 66 6f 6c  |provided the fol|
00000130  6c 6f 77 69 6e 67 20 63  6f 6e 64 69 74 69 6f 6e  |lowing condition|
00000140  73 20 61 72 65 20 61 64  68 65 72 65 64 20 74 6f  |s are adhered to|
00000150  3a 0a 0a 31 2e 20 4e 6f  20 63 68 61 72 67 65 20  |:..1. No charge |
00000160  69 73 20 6d 61 64 65 20  6f 74 68 65 72 20 74 68  |is made other th|
00000170  61 6e 20 74 6f 20 63 6f  76 65 72 20 74 68 65 20  |an to cover the |
00000180  72 65 61 73 6f 6e 61 62  6c 65 20 63 6f 73 74 20  |reasonable cost |
00000190  6f 66 20 64 75 70 6c 69  63 61 74 69 6f 6e 0a 61  |of duplication.a|
000001a0  6e 64 20 64 69 73 74 72  69 62 75 74 69 6f 6e 2e  |nd distribution.|
000001b0  0a 0a 32 2e 20 4e 6f 20  61 6c 74 65 72 61 74 69  |..2. No alterati|
000001c0  6f 6e 20 69 73 20 6d 61  64 65 20 74 6f 20 65 69  |on is made to ei|
000001d0  74 68 65 72 20 74 68 65  20 73 6f 66 74 77 61 72  |ther the softwar|
000001e0  65 20 6f 72 20 74 68 69  73 20 74 65 78 74 20 66  |e or this text f|
000001f0  69 6c 65 2e 0a 0a 33 2e  20 54 68 69 73 20 74 65  |ile...3. This te|
00000200  78 74 20 66 69 6c 65 20  61 63 63 6f 6d 70 61 6e  |xt file accompan|
00000210  69 65 73 20 61 6c 6c 20  63 6f 70 69 65 73 20 6f  |ies all copies o|
00000220  66 20 74 68 65 20 73 6f  66 74 77 61 72 65 2e 0a  |f the software..|
00000230  0a 50 6c 65 61 73 65 20  6e 6f 74 65 20 74 68 61  |.Please note tha|
00000240  74 20 74 68 69 73 20 6d  6f 64 75 6c 65 20 77 69  |t this module wi|
00000250  6c 6c 20 6f 6e 6c 79 20  77 6f 72 6b 20 77 69 74  |ll only work wit|
00000260  68 20 52 49 53 43 20 4f  53 20 33 20 6f 72 20 6c  |h RISC OS 3 or l|
00000270  61 74 65 72 2e 20 54 68  69 73 0a 63 6f 70 79 20  |ater. This.copy |
00000280  68 61 73 20 62 65 65 6e  20 6d 6f 64 69 66 69 65  |has been modifie|
00000290  64 20 66 6f 72 20 63 6f  6d 70 61 74 69 62 69 6c  |d for compatibil|
000002a0  69 74 79 20 77 69 74 68  20 74 68 65 20 53 74 72  |ity with the Str|
000002b0  6f 6e 67 41 52 4d 20 31  31 30 20 70 72 6f 63 65  |ongARM 110 proce|
000002c0  73 73 6f 72 2e 0a 0a 49  43 6c 65 61 72 20 69 73  |ssor...IClear is|
000002d0  20 61 20 6d 6f 64 75 6c  65 20 77 68 69 63 68 20  | a module which |
000002e0  6d 61 6b 65 73 20 69 74  20 65 61 73 69 65 72 20  |makes it easier |
000002f0  74 6f 20 64 65 6c 65 74  65 20 74 65 78 74 20 66  |to delete text f|
00000300  72 6f 6d 20 61 20 77 72  69 74 61 62 6c 65 0a 69  |rom a writable.i|
00000310  63 6f 6e 2e 20 55 6e 64  65 72 20 52 49 53 43 20  |con. Under RISC |
00000320  4f 53 2c 20 74 6f 20 72  65 70 6c 61 63 65 20 74  |OS, to replace t|
00000330  68 65 20 74 65 78 74 20  69 6e 20 73 75 63 68 20  |he text in such |
00000340  61 6e 20 69 63 6f 6e 20  77 69 74 68 20 6e 65 77  |an icon with new|
00000350  20 74 65 78 74 2c 20 79  6f 75 0a 66 69 72 73 74  | text, you.first|
00000360  20 68 61 76 65 20 74 6f  20 65 69 74 68 65 72 20  | have to either |
00000370  64 65 6c 65 74 65 20 61  6c 6c 20 74 68 65 20 63  |delete all the c|
00000380  68 61 72 61 63 74 65 72  73 20 6f 66 20 74 68 65  |haracters of the|
00000390  20 6f 6c 64 20 74 65 78  74 20 6f 72 20 70 72 65  | old text or pre|
000003a0  73 73 0a 43 74 72 6c 2d  55 20 74 6f 20 63 6c 65  |ss.Ctrl-U to cle|
000003b0  61 72 20 69 74 2e 20 54  68 69 73 20 63 61 6e 20  |ar it. This can |
000003c0  62 65 20 61 20 6e 75 69  73 61 6e 63 65 2c 20 65  |be a nuisance, e|
000003d0  73 70 65 63 69 61 6c 6c  79 20 69 66 20 79 6f 75  |specially if you|
000003e0  20 68 61 76 65 20 6a 75  73 74 0a 73 65 6c 65 63  | have just.selec|
000003f0  74 65 64 20 74 68 65 20  69 63 6f 6e 20 77 69 74  |ted the icon wit|
00000400  68 20 74 68 65 20 6d 6f  75 73 65 2c 20 61 73 20  |h the mouse, as |
00000410  79 6f 75 20 66 69 72 73  74 20 68 61 76 65 20 74  |you first have t|
00000420  6f 20 74 72 61 6e 73 66  65 72 20 74 6f 20 74 68  |o transfer to th|
00000430  65 0a 6b 65 79 62 6f 61  72 64 2c 20 74 68 65 6e  |e.keyboard, then|
00000440  20 70 72 65 73 73 20 43  74 72 6c 2d 55 20 62 65  | press Ctrl-U be|
00000450  66 6f 72 65 20 79 6f 75  20 63 61 6e 20 74 79 70  |fore you can typ|
00000460  65 20 69 6e 20 79 6f 75  72 20 6e 65 77 20 74 65  |e in your new te|
00000470  78 74 2e 0a 0a 57 69 74  68 20 49 43 6c 65 61 72  |xt...With IClear|
00000480  20 72 75 6e 6e 69 6e 67  2c 20 73 69 6d 70 6c 79  | running, simply|
00000490  20 64 6f 75 62 6c 65 2d  63 6c 69 63 6b 20 6f 6e  | double-click on|
000004a0  20 74 68 65 20 77 72 69  74 61 62 6c 65 20 69 63  | the writable ic|
000004b0  6f 6e 2c 20 75 73 69 6e  67 20 65 69 74 68 65 72  |on, using either|
000004c0  0a 53 65 6c 65 63 74 20  6f 72 20 41 64 6a 75 73  |.Select or Adjus|
000004d0  74 2e 20 54 68 65 20 69  63 6f 6e 20 77 69 6c 6c  |t. The icon will|
000004e0  20 62 65 20 69 6e 76 65  72 74 65 64 2c 20 77 68  | be inverted, wh|
000004f0  69 63 68 20 75 73 75 61  6c 6c 79 20 6d 65 61 6e  |ich usually mean|
00000500  73 20 74 68 61 74 20 69  74 0a 77 69 6c 6c 20 74  |s that it.will t|
00000510  75 72 6e 20 62 6c 61 63  6b 20 77 69 74 68 20 77  |urn black with w|
00000520  68 69 74 65 20 74 65 78  74 2e 20 41 73 20 73 6f  |hite text. As so|
00000530  6f 6e 20 61 73 20 79 6f  75 20 70 72 65 73 73 20  |on as you press |
00000540  61 20 6b 65 79 2c 20 74  68 65 20 74 65 78 74 20  |a key, the text |
00000550  69 6e 20 74 68 65 0a 69  63 6f 6e 20 77 69 6c 6c  |in the.icon will|
00000560  20 76 61 6e 69 73 68 2c  20 74 6f 20 62 65 20 72  | vanish, to be r|
00000570  65 70 6c 61 63 65 64 20  77 69 74 68 20 74 68 65  |eplaced with the|
00000580  20 63 68 61 72 61 63 74  65 72 20 74 68 61 74 20  | character that |
00000590  79 6f 75 20 74 79 70 65  64 2e 20 49 66 20 79 6f  |you typed. If yo|
000005a0  75 0a 63 68 61 6e 67 65  20 79 6f 75 72 20 6d 69  |u.change your mi|
000005b0  6e 64 20 61 66 74 65 72  20 69 6e 76 65 72 74 69  |nd after inverti|
000005c0  6e 67 20 74 68 65 20 69  63 6f 6e 20 61 6e 64 20  |ng the icon and |
000005d0  64 65 63 69 64 65 20 79  6f 75 20 77 61 6e 74 20  |decide you want |
000005e0  74 6f 20 6b 65 65 70 20  79 6f 75 72 0a 65 78 69  |to keep your.exi|
000005f0  73 74 69 6e 67 20 74 65  78 74 2c 20 61 20 66 75  |sting text, a fu|
00000600  72 74 68 65 72 20 63 6c  69 63 6b 20 77 69 74 68  |rther click with|
00000610  20 61 6e 79 20 6d 6f 75  73 65 20 62 75 74 74 6f  | any mouse butto|
00000620  6e 20 61 6e 79 77 68 65  72 65 20 6f 6e 20 74 68  |n anywhere on th|
00000630  65 20 73 63 72 65 65 6e  0a 77 69 6c 6c 20 64 65  |e screen.will de|
00000640  2d 69 6e 76 65 72 74 20  74 68 65 20 69 63 6f 6e  |-invert the icon|
00000650  20 61 6e 64 20 70 75 74  20 74 68 69 6e 67 73 20  | and put things |
00000660  62 61 63 6b 20 74 6f 20  6e 6f 72 6d 61 6c 2e 0a  |back to normal..|
00000670  0a 54 68 69 73 20 73 6f  66 74 77 61 72 65 20 77  |.This software w|
00000680  69 6c 6c 20 77 6f 72 6b  20 77 69 74 68 20 77 72  |ill work with wr|
00000690  69 74 61 62 6c 65 20 69  63 6f 6e 73 20 28 62 75  |itable icons (bu|
000006a0  74 74 6f 6e 20 74 79 70  65 20 31 35 29 20 61 6e  |tton type 15) an|
000006b0  64 20 61 6c 73 6f 0a 64  72 61 67 67 61 62 6c 65  |d also.draggable|
000006c0  20 77 72 69 74 61 62 6c  65 20 69 63 6f 6e 73 20  | writable icons |
000006d0  28 62 75 74 74 6f 6e 20  74 79 70 65 20 31 34 29  |(button type 14)|
000006e0  20 62 75 74 20 6e 6f 74  20 77 69 74 68 20 77 72  | but not with wr|
000006f0  69 74 61 62 6c 65 20 6d  65 6e 75 20 69 74 65 6d  |itable menu item|
00000700  73 2e 0a 0a 20 20 20 20  20 20 20 20 20 20 20 20  |s...            |
00000710  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000720  20 50 72 6f 67 72 61 6d  6d 69 6e 67 20 4e 6f 74  | Programming Not|
00000730  65 73 0a 20 20 20 20 20  20 20 20 20 20 20 20 20  |es.             |
00000740  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000750  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 20 3d 3d 3d 3d  |=========== ====|
00000760  3d 0a 0a 54 68 65 20 6d  6f 64 75 6c 65 20 69 6e  |=..The module in|
00000770  74 65 72 63 65 70 74 73  20 74 68 65 20 4d 6f 75  |tercepts the Mou|
00000780  73 65 56 20 61 6e 64 20  49 6e 73 56 20 76 65 63  |seV and InsV vec|
00000790  74 6f 72 73 20 74 6f 20  64 65 74 65 63 74 20 63  |tors to detect c|
000007a0  61 6c 6c 73 20 74 6f 0a  4f 53 5f 4d 6f 75 73 65  |alls to.OS_Mouse|
000007b0  20 61 6e 64 20 6b 65 79  70 72 65 73 73 65 73 2e  | and keypresses.|
000007c0  20 4f 53 5f 4d 6f 75 73  65 20 63 61 6c 6c 73 20  | OS_Mouse calls |
000007d0  61 72 65 20 66 69 72 73  74 20 70 61 73 73 65 64  |are first passed|
000007e0  20 6f 6e 74 6f 20 74 68  65 20 53 57 49 0a 72 6f  | onto the SWI.ro|
000007f0  75 74 69 6e 65 20 61 6e  64 20 70 72 6f 63 65 73  |utine and proces|
00000800  73 65 64 20 6f 6e 20 65  78 69 74 2e 0a 0a 42 65  |sed on exit...Be|
00000810  63 61 75 73 65 20 52 49  53 43 20 4f 53 20 77 69  |cause RISC OS wi|
00000820  6c 6c 20 6e 6f 74 20 61  75 74 6f 6d 61 74 69 63  |ll not automatic|
00000830  61 6c 6c 79 20 64 65 74  65 63 74 20 61 20 64 6f  |ally detect a do|
00000840  75 62 6c 65 2d 63 6c 69  63 6b 20 6f 76 65 72 20  |uble-click over |
00000850  61 20 77 72 69 74 61 62  6c 65 0a 69 63 6f 6e 2c  |a writable.icon,|
00000860  20 74 68 65 20 6d 6f 64  75 6c 65 20 68 61 73 20  | the module has |
00000870  74 6f 20 64 6f 20 74 68  65 20 6a 6f 62 20 69 74  |to do the job it|
00000880  73 65 6c 66 2e 20 54 68  69 73 20 69 6e 76 6f 6c  |self. This invol|
00000890  76 65 73 20 63 68 65 63  6b 69 6e 67 20 74 68 65  |ves checking the|
000008a0  20 74 69 6d 65 0a 69 6e  74 65 72 76 61 6c 20 73  | time.interval s|
000008b0  69 6e 63 65 20 74 68 65  20 70 72 65 76 69 6f 75  |ince the previou|
000008c0  73 20 63 6c 69 63 6b 2c  20 73 65 6c 65 63 74 69  |s click, selecti|
000008d0  6e 67 20 74 68 65 20 27  64 6f 75 62 6c 65 2d 61  |ng the 'double-a|
000008e0  72 72 6f 77 27 20 70 6f  69 6e 74 65 72 0a 73 70  |rrow' pointer.sp|
000008f0  72 69 74 65 2c 20 63 68  65 63 6b 69 6e 67 20 77  |rite, checking w|
00000900  68 69 63 68 20 62 75 74  74 6f 6e 20 77 61 73 20  |hich button was |
00000910  70 72 65 73 73 65 64 20  61 6e 64 20 6d 6f 6e 69  |pressed and moni|
00000920  74 6f 72 69 6e 67 20 74  68 65 20 6d 6f 75 73 65  |toring the mouse|
00000930  20 70 6f 73 69 74 69 6f  6e 2e 0a 0a 52 61 74 68  | position...Rath|
00000940  65 72 20 74 68 61 6e 20  70 75 74 20 74 6f 6f 20  |er than put too |
00000950  6d 75 63 68 20 63 6f 64  65 20 69 6e 74 6f 20 61  |much code into a|
00000960  20 76 65 63 74 6f 72 20  69 6e 74 65 72 63 65 70  | vector intercep|
00000970  74 20 72 6f 75 74 69 6e  65 2c 20 74 68 65 20 73  |t routine, the s|
00000980  6f 66 74 77 61 72 65 0a  6a 75 73 74 20 73 65 74  |oftware.just set|
00000990  73 20 6f 6e 65 20 6f 66  20 74 77 6f 20 63 61 6c  |s one of two cal|
000009a0  6c 62 61 63 6b 73 2c 20  64 65 70 65 6e 64 69 6e  |lbacks, dependin|
000009b0  67 20 6f 6e 20 74 68 65  20 74 69 6d 65 20 69 6e  |g on the time in|
000009c0  74 65 72 76 61 6c 20 73  69 6e 63 65 20 74 68 65  |terval since the|
000009d0  0a 70 72 65 76 69 6f 75  73 20 63 6c 69 63 6b 2e  |.previous click.|
000009e0  20 54 68 65 20 63 61 6c  6c 62 61 63 6b 20 72 6f  | The callback ro|
000009f0  75 74 69 6e 65 20 69 73  20 63 61 6c 6c 65 64 20  |utine is called |
00000a00  62 79 20 52 49 53 43 20  4f 53 20 61 73 20 73 6f  |by RISC OS as so|
00000a10  6f 6e 20 61 73 20 69 74  20 69 73 0a 6e 6f 74 20  |on as it is.not |
00000a20  62 75 73 79 2e 20 54 68  65 20 66 69 72 73 74 20  |busy. The first |
00000a30  6f 66 20 74 68 65 73 65  20 63 61 6c 6c 62 61 63  |of these callbac|
00000a40  6b 73 20 68 61 6e 64 6c  65 73 20 61 20 73 69 6e  |ks handles a sin|
00000a50  67 6c 65 20 63 6c 69 63  6b 2e 20 49 74 20 66 69  |gle click. It fi|
00000a60  72 73 74 0a 63 68 65 63  6b 73 20 74 6f 20 73 65  |rst.checks to se|
00000a70  65 20 69 66 20 74 68 65  20 6d 6f 64 75 6c 65 20  |e if the module |
00000a80  68 61 73 20 61 20 72 65  63 6f 72 64 20 6f 66 20  |has a record of |
00000a90  61 6e 20 69 6e 76 65 72  74 65 64 20 69 63 6f 6e  |an inverted icon|
00000aa0  20 61 6e 64 2c 20 69 66  20 73 6f 2c 0a 74 61 6b  | and, if so,.tak|
00000ab0  65 73 20 73 74 65 70 73  20 74 6f 20 63 6c 65 61  |es steps to clea|
00000ac0  72 20 69 74 2e 20 49 74  20 74 68 65 6e 20 73 74  |r it. It then st|
00000ad0  6f 72 65 73 20 61 20 72  65 63 6f 72 64 20 6f 66  |ores a record of|
00000ae0  20 77 68 69 63 68 20 62  75 74 74 6f 6e 20 77 61  | which button wa|
00000af0  73 20 70 72 65 73 73 65  64 0a 61 6e 64 20 63 68  |s pressed.and ch|
00000b00  65 63 6b 73 20 74 68 65  20 69 63 6f 6e 20 74 79  |ecks the icon ty|
00000b10  70 65 2e 20 49 66 20 74  68 65 20 63 6c 69 63 6b  |pe. If the click|
00000b20  20 77 61 73 20 6f 76 65  72 20 61 20 77 72 69 74  | was over a writ|
00000b30  61 62 6c 65 20 69 63 6f  6e 2c 20 69 74 20 73 74  |able icon, it st|
00000b40  6f 72 65 73 0a 74 68 65  20 6d 6f 75 73 65 20 70  |ores.the mouse p|
00000b50  6f 73 69 74 69 6f 6e 20  61 6e 64 20 72 65 64 65  |osition and rede|
00000b60  66 69 6e 65 73 20 6d 6f  75 73 65 20 70 6f 69 6e  |fines mouse poin|
00000b70  74 65 72 20 31 20 73 70  72 69 74 65 20 61 73 20  |ter 1 sprite as |
00000b80  70 74 72 5f 64 6f 75 62  6c 65 2e 0a 0a 4e 2e 42  |ptr_double...N.B|
00000b90  2e 20 54 68 65 72 65 20  61 70 70 65 61 72 73 20  |. There appears |
00000ba0  74 6f 20 62 65 20 6e 6f  20 77 61 79 20 6f 66 20  |to be no way of |
00000bb0  72 65 61 64 69 6e 67 20  77 68 69 63 68 20 73 70  |reading which sp|
00000bc0  72 69 74 65 20 69 73 20  75 73 65 64 20 62 79 20  |rite is used by |
00000bd0  61 0a 70 61 72 74 69 63  75 6c 61 72 20 70 6f 69  |a.particular poi|
00000be0  6e 74 65 72 20 6e 75 6d  62 65 72 2e 20 56 65 72  |nter number. Ver|
00000bf0  73 69 6f 6e 73 20 6f 66  20 74 68 69 73 20 6d 6f  |sions of this mo|
00000c00  64 75 6c 65 20 75 70 20  74 6f 20 76 31 2e 30 31  |dule up to v1.01|
00000c10  20 61 6c 77 61 79 73 0a  72 65 70 6c 61 63 65 64  | always.replaced|
00000c20  20 74 68 65 20 64 6f 75  62 6c 65 20 70 6f 69 6e  | the double poin|
00000c30  74 65 72 20 77 69 74 68  20 74 68 65 20 70 74 72  |ter with the ptr|
00000c40  5f 64 65 66 61 75 6c 74  20 73 70 72 69 74 65 20  |_default sprite |
00000c50  61 66 74 65 72 20 74 68  65 0a 64 6f 75 62 6c 65  |after the.double|
00000c60  2d 63 6c 69 63 6b 20 74  69 6d 65 2d 6f 75 74 2e  |-click time-out.|
00000c70  20 53 75 62 73 65 71 75  65 6e 74 20 76 65 72 73  | Subsequent vers|
00000c80  69 6f 6e 73 20 63 68 65  63 6b 73 20 74 68 65 20  |ions checks the |
00000c90  69 63 6f 6e 91 73 20 76  61 6c 69 64 61 74 69 6f  |icon.s validatio|
00000ca0  6e 0a 73 74 72 69 6e 67  2c 20 69 66 20 61 6e 79  |n.string, if any|
00000cb0  2c 20 6c 6f 6f 6b 69 6e  67 20 66 6f 72 20 74 68  |, looking for th|
00000cc0  65 20 90 50 91 20 69 6e  73 74 72 75 63 74 69 6f  |e .P. instructio|
00000cd0  6e 2c 20 77 68 69 63 68  20 73 65 74 73 20 61 6e  |n, which sets an|
00000ce0  20 61 6c 74 65 72 6e 61  74 69 76 65 0a 70 6f 69  | alternative.poi|
00000cf0  6e 74 65 72 20 73 70 72  69 74 65 20 77 68 65 6e  |nter sprite when|
00000d00  20 6f 76 65 72 20 74 68  65 20 69 63 6f 6e 2c 20  | over the icon, |
00000d10  61 6e 64 20 72 65 73 74  6f 72 65 20 74 68 65 20  |and restore the |
00000d20  70 6f 69 6e 74 65 72 20  74 6f 20 74 68 69 73 20  |pointer to this |
00000d30  73 70 72 69 74 65 0a 61  66 74 65 72 20 66 69 72  |sprite.after fir|
00000d40  73 74 20 63 68 65 63 6b  69 6e 67 20 69 74 73 20  |st checking its |
00000d50  70 72 65 73 65 6e 63 65  20 69 6e 20 74 68 65 20  |presence in the |
00000d60  57 69 6d 70 20 73 70 72  69 74 65 20 70 6f 6f 6c  |Wimp sprite pool|
00000d70  2e 0a 0a 54 68 65 20 6d  6f 64 75 6c 65 20 74 68  |...The module th|
00000d80  65 6e 20 73 65 74 73 20  61 20 63 61 6c 6c 2d 61  |en sets a call-a|
00000d90  66 74 65 72 2c 20 77 68  69 63 68 20 69 73 20 61  |fter, which is a|
00000da0  6e 20 69 6e 73 74 72 75  63 74 69 6f 6e 20 74 6f  |n instruction to|
00000db0  20 52 49 53 43 20 4f 53  20 74 6f 0a 63 61 6c 6c  | RISC OS to.call|
00000dc0  20 61 20 72 6f 75 74 69  6e 65 20 61 66 74 65 72  | a routine after|
00000dd0  20 61 20 63 65 72 74 61  69 6e 20 6c 65 6e 67 74  | a certain lengt|
00000de0  68 20 6f 66 20 74 69 6d  65 2e 20 49 74 20 61 6c  |h of time. It al|
00000df0  73 6f 20 63 61 6c 6c 73  20 4f 53 5f 43 61 6c 6c  |so calls OS_Call|
00000e00  45 76 65 72 79 20 74 6f  0a 61 72 72 61 6e 67 65  |Every to.arrange|
00000e10  20 66 6f 72 20 61 20 63  61 6c 6c 20 65 76 65 72  | for a call ever|
00000e20  79 20 31 30 20 63 65 6e  74 69 73 65 63 6f 6e 64  |y 10 centisecond|
00000e30  73 20 74 6f 20 61 20 72  6f 75 74 69 6e 65 20 77  |s to a routine w|
00000e40  68 69 63 68 20 63 68 65  63 6b 73 20 74 68 65 20  |hich checks the |
00000e50  6d 6f 75 73 65 0a 70 6f  73 69 74 69 6f 6e 20 61  |mouse.position a|
00000e60  6e 64 20 63 61 6e 63 65  6c 73 20 74 68 65 20 64  |nd cancels the d|
00000e70  6f 75 62 6c 65 2d 63 6c  69 63 6b 20 6d 6f 6e 69  |ouble-click moni|
00000e80  74 6f 72 69 6e 67 20 69  66 20 74 68 65 20 6d 6f  |toring if the mo|
00000e90  75 73 65 20 69 73 20 6d  6f 76 65 64 20 6d 6f 72  |use is moved mor|
00000ea0  65 0a 74 68 61 6e 20 61  20 63 65 72 74 61 69 6e  |e.than a certain|
00000eb0  20 61 6d 6f 75 6e 74 2e  0a 0a 4e 2e 42 2e 20 41  | amount...N.B. A|
00000ec0  6c 74 68 6f 75 67 68 20  74 68 65 20 6e 6f 72 6d  |lthough the norm|
00000ed0  61 6c 20 64 6f 75 62 6c  65 2d 63 6c 69 63 6b 20  |al double-click |
00000ee0  74 69 6d 65 20 6c 69 6d  69 74 20 61 6e 64 20 70  |time limit and p|
00000ef0  65 72 6d 69 74 74 65 64  20 6d 6f 75 73 65 0a 6d  |ermitted mouse.m|
00000f00  6f 76 65 6d 65 6e 74 20  63 61 6e 20 62 65 20 63  |ovement can be c|
00000f10  6f 6e 66 69 67 75 72 65  64 2c 20 74 68 65 72 65  |onfigured, there|
00000f20  20 61 70 70 65 61 72 73  20 74 6f 20 62 65 20 6e  | appears to be n|
00000f30  6f 20 77 61 79 20 6f 66  20 72 65 61 64 69 6e 67  |o way of reading|
00000f40  20 74 68 65 69 72 0a 76  61 6c 75 65 73 2c 20 6f  | their.values, o|
00000f50  74 68 65 72 20 74 68 61  6e 20 74 68 65 20 75 6e  |ther than the un|
00000f60  72 65 6c 69 61 62 6c 65  20 6d 65 74 68 6f 64 20  |reliable method |
00000f70  6f 66 20 63 68 65 63 6b  69 6e 67 20 43 4d 4f 53  |of checking CMOS|
00000f80  20 52 41 4d 20 6c 6f 63  61 74 69 6f 6e 73 2c 0a  | RAM locations,.|
00000f90  77 68 69 63 68 20 63 6f  75 6c 64 20 63 68 61 6e  |which could chan|
00000fa0  67 65 20 62 65 74 77 65  65 6e 20 64 69 66 66 65  |ge between diffe|
00000fb0  72 65 6e 74 20 76 65 72  73 69 6f 6e 73 20 6f 66  |rent versions of|
00000fc0  20 52 49 53 43 20 4f 53  2e 20 54 68 69 73 20 6d  | RISC OS. This m|
00000fd0  6f 64 75 6c 65 20 75 73  65 73 0a 74 68 65 20 64  |odule uses.the d|
00000fe0  65 66 61 75 6c 74 20 63  6f 6e 66 69 67 75 72 61  |efault configura|
00000ff0  74 69 6f 6e 20 76 61 6c  75 65 73 20 6f 66 20 31  |tion values of 1|
00001000  20 73 65 63 6f 6e 64 20  6d 61 78 69 6d 75 6d 20  | second maximum |
00001010  62 65 74 77 65 65 6e 20  63 6c 69 63 6b 73 20 61  |between clicks a|
00001020  6e 64 20 61 0a 6d 61 78  69 6d 75 6d 20 6d 6f 75  |nd a.maximum mou|
00001030  73 65 20 6d 6f 76 65 6d  65 6e 74 20 6f 66 20 31  |se movement of 1|
00001040  30 20 4f 53 20 75 6e 69  74 73 20 28 69 74 20 63  |0 OS units (it c|
00001050  68 65 63 6b 73 20 66 6f  72 20 65 69 74 68 65 72  |hecks for either|
00001060  20 31 30 20 68 6f 72 69  7a 6f 6e 74 61 6c 20 6f  | 10 horizontal o|
00001070  72 0a 31 30 20 76 65 72  74 69 63 61 6c 20 75 6e  |r.10 vertical un|
00001080  69 74 73 20 6f 66 20 6d  6f 76 65 6d 65 6e 74 29  |its of movement)|
00001090  2e 20 54 68 65 73 65 20  76 61 6c 75 65 73 20 61  |. These values a|
000010a0  72 65 20 66 69 78 65 64  20 69 6e 20 74 68 69 73  |re fixed in this|
000010b0  20 76 65 72 73 69 6f 6e  20 6f 66 0a 74 68 65 20  | version of.the |
000010c0  6d 6f 64 75 6c 65 2e 20  49 66 20 74 68 65 72 65  |module. If there|
000010d0  20 69 73 20 61 20 64 65  6d 61 6e 64 20 66 6f 72  | is a demand for|
000010e0  20 74 68 65 20 61 62 69  6c 69 74 79 20 74 6f 20  | the ability to |
000010f0  61 6c 74 65 72 20 74 68  65 73 65 20 76 61 6c 75  |alter these valu|
00001100  65 73 2c 20 49 0a 77 69  6c 6c 20 65 6e 64 65 61  |es, I.will endea|
00001110  76 6f 75 72 20 74 6f 20  69 6e 63 6c 75 64 65 20  |vour to include |
00001120  61 20 63 6f 75 70 6c 65  20 6f 66 20 53 57 49 73  |a couple of SWIs|
00001130  20 61 6e 64 2f 6f 72 20  73 74 61 72 20 63 6f 6d  | and/or star com|
00001140  6d 61 6e 64 73 20 69 6e  20 61 20 6c 61 74 65 72  |mands in a later|
00001150  0a 76 65 72 73 69 6f 6e  2e 0a 0a 49 66 20 65 69  |.version...If ei|
00001160  74 68 65 72 20 61 20 73  65 63 6f 6e 64 20 62 75  |ther a second bu|
00001170  74 74 6f 6e 20 69 73 20  70 72 65 73 73 65 64 20  |tton is pressed |
00001180  6f 72 20 74 68 65 20 6d  6f 75 73 65 20 69 73 20  |or the mouse is |
00001190  6d 6f 76 65 64 20 62 65  66 6f 72 65 20 74 68 65  |moved before the|
000011a0  0a 63 61 6c 6c 2d 61 66  74 65 72 20 68 61 73 20  |.call-after has |
000011b0  74 69 6d 65 64 20 6f 75  74 2c 20 74 68 65 20 63  |timed out, the c|
000011c0  61 6c 6c 2d 61 66 74 65  72 20 61 6e 64 20 63 61  |all-after and ca|
000011d0  6c 6c 2d 65 76 65 72 79  20 61 72 65 20 63 61 6e  |ll-every are can|
000011e0  63 65 6c 6c 65 64 20 61  6e 64 20 61 0a 73 65 63  |celled and a.sec|
000011f0  6f 6e 64 20 63 61 6c 6c  62 61 63 6b 20 69 73 20  |ond callback is |
00001200  75 73 65 64 2e 20 54 68  69 73 20 72 6f 75 74 69  |used. This routi|
00001210  6e 65 20 63 68 65 63 6b  73 20 74 68 61 74 20 74  |ne checks that t|
00001220  68 65 20 73 61 6d 65 20  62 75 74 74 6f 6e 20 68  |he same button h|
00001230  61 73 20 62 65 65 6e 0a  70 72 65 73 73 65 64 20  |as been.pressed |
00001240  61 73 20 70 72 65 76 69  6f 75 73 6c 79 2c 20 73  |as previously, s|
00001250  65 74 73 20 61 20 66 6c  61 67 20 61 6e 64 20 74  |ets a flag and t|
00001260  61 6b 65 73 20 73 74 65  70 73 20 74 6f 20 69 6e  |akes steps to in|
00001270  76 65 72 74 20 74 68 65  20 69 63 6f 6e 2e 0a 0a  |vert the icon...|
00001280  41 6c 74 68 6f 75 67 68  20 61 6e 79 20 69 63 6f  |Although any ico|
00001290  6e 20 63 61 6e 20 62 65  20 69 6e 76 65 72 74 65  |n can be inverte|
000012a0  64 20 6f 72 20 64 65 2d  69 6e 76 65 72 74 65 64  |d or de-inverted|
000012b0  20 62 79 20 6d 65 61 6e  73 20 6f 66 20 61 20 63  | by means of a c|
000012c0  61 6c 6c 20 74 6f 0a 57  69 6d 70 5f 53 65 74 49  |all to.Wimp_SetI|
000012d0  63 6f 6e 53 74 61 74 65  2c 20 74 68 65 20 70 72  |conState, the pr|
000012e0  6f 63 65 64 75 72 65 20  69 73 20 6e 6f 74 20 74  |ocedure is not t|
000012f0  68 61 74 20 73 69 6d 70  6c 65 2e 20 54 68 69 73  |hat simple. This|
00001300  20 53 57 49 20 6d 61 79  20 6f 6e 6c 79 20 62 65  | SWI may only be|
00001310  0a 63 61 6c 6c 65 64 20  77 68 69 6c 65 20 74 68  |.called while th|
00001320  65 20 61 70 70 6c 69 63  61 74 69 6f 6e 20 77 68  |e application wh|
00001330  69 63 68 20 6f 77 6e 73  20 74 68 65 20 69 63 6f  |ich owns the ico|
00001340  6e 20 69 73 20 74 68 65  20 63 75 72 72 65 6e 74  |n is the current|
00001350  6c 79 20 61 63 74 69 76  65 0a 74 61 73 6b 2e 20  |ly active.task. |
00001360  49 66 20 77 65 20 73 69  6d 70 6c 79 20 63 61 6c  |If we simply cal|
00001370  6c 20 69 74 20 77 68 65  6e 20 74 68 65 20 6d 6f  |l it when the mo|
00001380  75 73 65 20 69 73 20 63  6c 69 63 6b 65 64 2c 20  |use is clicked, |
00001390  74 68 69 73 20 6d 61 79  20 6e 6f 74 20 62 65 20  |this may not be |
000013a0  74 68 65 0a 63 61 73 65  2c 20 65 73 70 65 63 69  |the.case, especi|
000013b0  61 6c 6c 79 20 69 66 20  73 65 76 65 72 61 6c 20  |ally if several |
000013c0  6d 75 6c 74 69 2d 74 61  73 6b 69 6e 67 20 61 70  |multi-tasking ap|
000013d0  70 6c 69 63 61 74 69 6f  6e 73 20 61 72 65 20 72  |plications are r|
000013e0  75 6e 6e 69 6e 67 20 61  74 20 74 68 65 0a 73 61  |unning at the.sa|
000013f0  6d 65 20 74 69 6d 65 2e  20 57 65 20 68 61 76 65  |me time. We have|
00001400  20 74 6f 20 73 65 6e 64  20 61 20 6d 65 73 73 61  | to send a messa|
00001410  67 65 20 74 6f 20 74 68  65 20 74 61 73 6b 20 62  |ge to the task b|
00001420  75 74 20 77 65 20 63 61  6e 6e 6f 74 2c 20 6f 66  |ut we cannot, of|
00001430  20 63 6f 75 72 73 65 2c  0a 72 65 77 72 69 74 65  | course,.rewrite|
00001440  20 69 74 73 20 73 6f 66  74 77 61 72 65 2e 0a 0a  | its software...|
00001450  54 68 65 20 73 6f 6c 75  74 69 6f 6e 20 69 73 20  |The solution is |
00001460  74 6f 20 75 73 65 20 61  20 66 69 6c 74 65 72 2e  |to use a filter.|
00001470  20 57 65 20 63 6f 75 6c  64 20 75 73 65 20 61 20  | We could use a |
00001480  70 72 65 2d 66 69 6c 74  65 72 2c 20 77 68 69 63  |pre-filter, whic|
00001490  68 20 69 73 20 63 61 6c  6c 65 64 0a 6a 75 73 74  |h is called.just|
000014a0  20 62 65 66 6f 72 65 20  57 69 6d 70 5f 50 6f 6c  | before Wimp_Pol|
000014b0  6c 20 69 73 20 65 78 65  63 75 74 65 64 2c 20 6f  |l is executed, o|
000014c0  72 20 61 20 70 6f 73 74  2d 66 69 6c 74 65 72 20  |r a post-filter |
000014d0  77 68 69 63 68 20 69 73  20 63 61 6c 6c 65 64 20  |which is called |
000014e0  6f 6e 0a 72 65 74 75 72  6e 20 66 72 6f 6d 20 57  |on.return from W|
000014f0  69 6d 70 5f 50 6f 6c 6c  2e 20 49 6e 20 74 68 69  |imp_Poll. In thi|
00001500  73 20 63 61 73 65 2c 20  77 65 20 75 73 65 20 74  |s case, we use t|
00001510  68 65 20 6c 61 74 74 65  72 2e 20 54 68 65 20 74  |he latter. The t|
00001520  65 63 68 6e 69 71 75 65  20 69 73 20 74 6f 0a 73  |echnique is to.s|
00001530  65 6e 64 20 61 20 75 6e  69 71 75 65 20 6d 65 73  |end a unique mes|
00001540  73 61 67 65 20 74 6f 20  74 68 65 20 74 61 73 6b  |sage to the task|
00001550  20 77 68 69 63 68 20 6f  75 72 20 66 69 6c 74 65  | which our filte|
00001560  72 20 77 69 6c 6c 20 69  6e 74 65 72 63 65 70 74  |r will intercept|
00001570  20 61 6e 64 0a 72 65 63  6f 67 6e 69 73 65 2c 20  | and.recognise, |
00001580  74 65 6c 6c 69 6e 67 20  69 74 20 74 6f 20 69 6e  |telling it to in|
00001590  76 65 72 74 20 6f 72 20  64 65 2d 69 6e 76 65 72  |vert or de-inver|
000015a0  74 20 74 68 65 20 72 65  71 75 69 72 65 64 20 69  |t the required i|
000015b0  63 6f 6e 2e 20 56 65 72  73 69 6f 6e 0a 76 31 2e  |con. Version.v1.|
000015c0  31 30 20 61 6c 73 6f 20  75 73 65 73 20 74 68 65  |10 also uses the|
000015d0  20 66 69 6c 74 65 72 20  74 6f 20 63 68 65 63 6b  | filter to check|
000015e0  20 74 68 65 20 69 63 6f  6e 91 73 20 76 61 6c 69  | the icon.s vali|
000015f0  64 61 74 69 6f 6e 20 73  74 72 69 6e 67 20 74 6f  |dation string to|
00001600  20 67 65 74 20 74 68 65  0a 70 6f 69 6e 74 65 72  | get the.pointer|
00001610  20 73 70 72 69 74 65 20  6e 61 6d 65 2e 0a 0a 57  | sprite name...W|
00001620  65 20 63 6f 75 6c 64 20  73 65 6e 64 20 61 20 6d  |e could send a m|
00001630  65 73 73 61 67 65 2c 20  75 73 69 6e 67 20 72 65  |essage, using re|
00001640  61 73 6f 6e 20 63 6f 64  65 20 31 37 20 6f 72 20  |ason code 17 or |
00001650  31 38 2c 20 62 75 74 20  77 65 20 77 6f 75 6c 64  |18, but we would|
00001660  20 68 61 76 65 20 74 6f  0a 66 69 6e 64 20 61 20  | have to.find a |
00001670  6d 65 73 73 61 67 65 20  61 63 74 69 6f 6e 20 63  |message action c|
00001680  6f 64 65 20 74 68 61 74  20 69 73 20 6e 6f 74 20  |ode that is not |
00001690  75 73 65 64 20 66 6f 72  20 61 6e 79 74 68 69 6e  |used for anythin|
000016a0  67 20 65 6c 73 65 2c 20  77 68 69 63 68 20 77 6f  |g else, which wo|
000016b0  75 6c 64 0a 70 72 65 73  65 6e 74 20 70 72 6f 62  |uld.present prob|
000016c0  6c 65 6d 73 2e 20 49 74  20 69 73 20 61 6c 73 6f  |lems. It is also|
000016d0  20 70 65 72 6d 69 73 73  69 62 6c 65 20 66 6f 72  | permissible for|
000016e0  20 61 20 74 61 73 6b 20  74 6f 20 6d 61 73 6b 20  | a task to mask |
000016f0  6f 75 74 20 74 68 65 73  65 20 72 65 61 73 6f 6e  |out these reason|
00001700  0a 63 6f 64 65 73 2c 20  77 68 69 63 68 20 77 6f  |.codes, which wo|
00001710  75 6c 64 20 70 72 65 76  65 6e 74 20 6f 75 72 20  |uld prevent our |
00001720  6d 65 73 73 61 67 65 20  67 65 74 74 69 6e 67 20  |message getting |
00001730  74 68 72 6f 75 67 68 2e  20 53 6f 20 74 68 61 74  |through. So that|
00001740  20 74 68 69 73 20 63 61  6e 6e 6f 74 0a 68 61 70  | this cannot.hap|
00001750  70 65 6e 2c 20 74 68 65  20 6d 6f 64 75 6c 65 20  |pen, the module |
00001760  73 65 6e 64 73 20 61 20  6d 65 73 73 61 67 65 20  |sends a message |
00001770  77 69 74 68 20 72 65 61  73 6f 6e 20 63 6f 64 65  |with reason code|
00001780  20 32 2c 20 77 68 69 63  68 20 75 73 75 61 6c 6c  | 2, which usuall|
00001790  79 20 6d 65 61 6e 73 0a  27 6f 70 65 6e 20 77 69  |y means.'open wi|
000017a0  6e 64 6f 77 20 72 65 71  75 65 73 74 27 2e 20 54  |ndow request'. T|
000017b0  68 69 73 20 72 65 61 73  6f 6e 20 63 6f 64 65 20  |his reason code |
000017c0  69 73 20 6e 6f 74 20 73  75 70 70 6f 73 65 64 20  |is not supposed |
000017d0  74 6f 20 62 65 20 6d 61  73 6b 65 64 20 6f 75 74  |to be masked out|
000017e0  0a 77 68 65 6e 20 63 61  6c 6c 69 6e 67 20 57 69  |.when calling Wi|
000017f0  6d 70 5f 50 6f 6c 6c 2e  20 4f 75 72 20 6d 65 73  |mp_Poll. Our mes|
00001800  73 61 67 65 20 73 65 6e  64 73 20 52 31 2b 30 20  |sage sends R1+0 |
00001810  61 73 20 7a 65 72 6f 20  61 6e 64 20 52 31 2b 34  |as zero and R1+4|
00001820  20 61 73 0a 26 37 32 36  43 34 33 34 39 2c 20 77  | as.&726C4349, w|
00001830  68 69 63 68 20 69 73 20  74 68 65 20 41 53 43 49  |hich is the ASCI|
00001840  49 20 63 6f 64 65 20 66  6f 72 20 27 49 43 6c 72  |I code for 'IClr|
00001850  27 2e 20 54 68 69 73 20  63 6f 72 72 65 73 70 6f  |'. This correspo|
00001860  6e 64 73 20 74 6f 20 61  20 72 65 71 75 65 73 74  |nds to a request|
00001870  0a 74 6f 20 6f 70 65 6e  20 74 68 65 20 77 69 6e  |.to open the win|
00001880  64 6f 77 20 77 68 6f 73  65 20 68 61 6e 64 6c 65  |dow whose handle|
00001890  20 69 73 20 7a 65 72 6f  2c 20 77 69 74 68 20 61  | is zero, with a|
000018a0  20 6d 69 6e 69 6d 75 6d  20 78 20 63 6f 6f 72 64  | minimum x coord|
000018b0  69 6e 61 74 65 20 6f 66  0a 26 37 32 36 43 34 33  |inate of.&726C43|
000018c0  34 39 20 2d 20 61 20 6d  6f 73 74 20 75 6e 6c 69  |49 - a most unli|
000018d0  6b 65 6c 79 20 73 74 61  74 65 20 6f 66 20 61 66  |kely state of af|
000018e0  66 61 69 72 73 20 69 6e  20 61 6e 79 20 6f 74 68  |fairs in any oth|
000018f0  65 72 20 73 69 74 75 61  74 69 6f 6e 21 20 54 68  |er situation! Th|
00001900  65 0a 74 68 69 72 64 20  77 6f 72 64 20 69 6e 20  |e.third word in |
00001910  74 68 65 20 62 6c 6f 63  6b 20 63 6f 6e 74 61 69  |the block contai|
00001920  6e 73 20 74 68 65 20 61  63 74 69 6f 6e 20 63 6f  |ns the action co|
00001930  64 65 20 66 6f 72 20 74  68 65 20 63 61 6c 6c 2e  |de for the call.|
00001940  20 42 69 74 20 31 20 73  65 74 0a 64 65 6e 6f 74  | Bit 1 set.denot|
00001950  65 73 20 74 68 61 74 20  74 68 65 20 63 61 6c 6c  |es that the call|
00001960  20 69 73 20 74 6f 20 69  6e 76 65 72 74 20 6f 72  | is to invert or|
00001970  20 63 6c 65 61 72 20 74  68 65 20 69 63 6f 6e 20  | clear the icon |
00001980  2d 20 62 69 74 20 30 20  69 73 20 63 6c 65 61 72  |- bit 0 is clear|
00001990  65 64 20 74 6f 0a 63 6c  65 61 72 2c 20 73 65 74  |ed to.clear, set|
000019a0  20 74 6f 20 69 6e 76 65  72 74 2e 20 42 69 74 20  | to invert. Bit |
000019b0  32 20 69 73 20 73 65 74  20 74 6f 20 63 61 6c 6c  |2 is set to call|
000019c0  20 74 68 65 20 72 6f 75  74 69 6e 65 20 74 6f 20  | the routine to |
000019d0  72 65 61 64 20 74 68 65  0a 76 61 6c 69 64 61 74  |read the.validat|
000019e0  69 6f 6e 20 73 74 72 69  6e 67 2e 0a 0a 49 66 20  |ion string...If |
000019f0  61 20 6b 65 79 20 69 73  20 70 72 65 73 73 65 64  |a key is pressed|
00001a00  20 77 68 69 6c 65 20 74  68 65 20 69 6e 76 65 72  | while the inver|
00001a10  74 65 64 20 69 63 6f 6e  20 66 6c 61 67 20 69 73  |ted icon flag is|
00001a20  20 73 65 74 2c 20 74 68  65 20 72 6f 75 74 69 6e  | set, the routin|
00001a30  65 20 28 61 67 61 69 6e  0a 62 79 20 6d 65 61 6e  |e (again.by mean|
00001a40  73 20 6f 66 20 61 20 63  61 6c 6c 62 61 63 6b 29  |s of a callback)|
00001a50  20 73 65 6e 64 73 20 61  20 6d 65 73 73 61 67 65  | sends a message|
00001a60  20 74 6f 20 63 6c 65 61  72 20 74 68 65 20 69 63  | to clear the ic|
00001a70  6f 6e 2c 20 74 68 65 6e  20 73 65 6e 64 73 20 74  |on, then sends t|
00001a80  68 65 0a 6b 65 79 70 72  65 73 73 20 63 68 61 72  |he.keypress char|
00001a90  61 63 74 65 72 2c 20 70  72 65 63 65 64 65 64 20  |acter, preceded |
00001aa0  62 79 20 61 20 43 74 72  6c 2d 55 20 74 6f 20 64  |by a Ctrl-U to d|
00001ab0  65 6c 65 74 65 20 74 68  65 20 74 65 78 74 2e 0a  |elete the text..|
00001ac0  0a 54 68 65 20 6d 6f 64  75 6c 65 20 69 6e 63 6f  |.The module inco|
00001ad0  72 70 6f 72 61 74 65 73  20 61 20 73 65 6c 66 2d  |rporates a self-|
00001ae0  63 68 65 63 6b 69 6e 67  20 72 6f 75 74 69 6e 65  |checking routine|
00001af0  20 74 6f 20 64 65 74 65  63 74 20 63 6f 72 72 75  | to detect corru|
00001b00  70 74 69 6f 6e 20 62 79  0a 76 69 72 75 73 65 73  |ption by.viruses|
00001b10  2e 0a 0a 53 74 72 6f 6e  67 41 52 4d 20 63 6f 6d  |...StrongARM com|
00001b20  70 61 74 69 62 69 6c 69  74 79 0a 0a 54 68 65 20  |patibility..The |
00001b30  45 6e 67 69 6e 65 65 72  69 6e 67 20 53 75 70 70  |Engineering Supp|
00001b40  6f 72 74 20 41 70 70 6c  69 63 61 74 69 6f 6e 20  |ort Application |
00001b50  4e 6f 74 65 20 64 69 73  74 72 69 62 75 74 65 64  |Note distributed|
00001b60  20 62 79 20 41 63 6f 72  6e 20 77 69 74 68 20 74  | by Acorn with t|
00001b70  68 65 0a 53 74 72 6f 6e  67 41 52 4d 20 70 72 6f  |he.StrongARM pro|
00001b80  63 65 73 73 6f 72 20 73  74 61 74 65 73 20 74 68  |cessor states th|
00001b90  61 74 20 73 74 6f 72 69  6e 67 20 74 68 65 20 70  |at storing the p|
00001ba0  72 6f 67 72 61 6d 20 63  6f 75 6e 74 65 72 20 74  |rogram counter t|
00001bb0  6f 20 6d 65 6d 6f 72 79  20 73 74 6f 72 65 73 0a  |o memory stores.|
00001bc0  50 43 2b 38 20 69 6e 73  74 65 61 64 20 6f 66 20  |PC+8 instead of |
00001bd0  50 43 2b 31 32 2c 20 61  73 20 69 6e 20 74 68 65  |PC+12, as in the|
00001be0  20 63 61 73 65 20 6f 66  20 74 68 65 20 41 52 4d  | case of the ARM|
00001bf0  2c 20 61 6e 64 20 70 6f  69 6e 74 73 20 6f 75 74  |, and points out|
00001c00  20 74 68 61 74 20 74 68  65 0a 65 78 61 6d 70 6c  | that the.exampl|
00001c10  65 20 63 6f 64 65 20 6f  6e 20 70 61 67 65 20 31  |e code on page 1|
00001c20  2d 31 30 37 20 6f 66 20  74 68 65 20 50 52 4d 20  |-107 of the PRM |
00001c30  77 69 6c 6c 20 6e 6f 74  20 77 6f 72 6b 20 66 6f  |will not work fo|
00001c40  72 20 74 68 69 73 20 72  65 61 73 6f 6e 2e 0a 55  |r this reason..U|
00001c50  6e 66 6f 72 74 75 6e 61  74 65 6c 79 2c 20 74 68  |nfortunately, th|
00001c60  69 73 20 63 6f 64 65 20  68 61 64 20 62 65 65 6e  |is code had been|
00001c70  20 75 73 65 64 20 62 79  20 76 65 72 73 69 6f 6e  | used by version|
00001c80  73 20 6f 66 20 49 43 6c  65 61 72 20 75 70 20 74  |s of IClear up t|
00001c90  6f 20 76 31 2e 31 30 2c  0a 77 69 74 68 20 74 68  |o v1.10,.with th|
00001ca0  65 20 72 65 73 75 6c 74  20 74 68 61 74 20 6c 6f  |e result that lo|
00001cb0  61 64 69 6e 67 20 74 68  65 20 6d 6f 64 75 6c 65  |ading the module|
00001cc0  20 63 61 75 73 65 64 20  74 68 65 20 6d 61 63 68  | caused the mach|
00001cd0  69 6e 65 20 74 6f 20 63  72 61 73 68 2e 20 41 0a  |ine to crash. A.|
00001ce0  73 69 6d 70 6c 65 20 6d  6f 64 69 66 69 63 61 74  |simple modificat|
00001cf0  69 6f 6e 20 74 6f 20 61  20 66 65 77 20 6c 69 6e  |ion to a few lin|
00001d00  65 73 20 6f 66 20 63 6f  64 65 20 68 61 73 20 72  |es of code has r|
00001d10  65 73 74 6f 72 65 64 20  63 6f 6d 70 61 74 69 62  |estored compatib|
00001d20  69 6c 69 74 79 20 77 68  69 6c 65 0a 6d 61 69 6e  |ility while.main|
00001d30  74 61 69 6e 69 6e 67 20  62 61 63 6b 77 61 72 64  |taining backward|
00001d40  20 63 6f 6d 70 61 74 69  62 69 6c 69 74 79 20 77  | compatibility w|
00001d50  69 74 68 20 65 61 72 6c  69 65 72 20 41 52 4d 20  |ith earlier ARM |
00001d60  70 72 6f 63 65 73 73 6f  72 73 2e 0a 0a 49 6e 63  |processors...Inc|
00001d70  69 64 65 6e 74 61 6c 6c  79 2c 20 75 73 65 20 6f  |identally, use o|
00001d80  66 20 74 68 69 73 20 6d  6f 64 75 6c 65 20 72 65  |f this module re|
00001d90  76 65 61 6c 65 64 20 74  68 61 74 20 74 68 65 20  |vealed that the |
00001da0  63 6f 6e 66 69 67 75 72  61 74 69 6f 6e 20 64 69  |configuration di|
00001db0  61 6c 6f 67 75 65 0a 62  6f 78 20 6f 66 20 73 6f  |alogue.box of so|
00001dc0  66 74 77 61 72 65 20 50  43 20 45 6d 75 6c 61 74  |ftware PC Emulat|
00001dd0  6f 72 20 76 31 2e 37 30  20 63 6f 6e 74 61 69 6e  |or v1.70 contain|
00001de0  65 64 20 61 20 77 72 69  74 61 62 6c 65 20 69 63  |ed a writable ic|
00001df0  6f 6e 20 77 68 69 63 68  20 77 61 73 0a 63 72 65  |on which was.cre|
00001e00  61 74 65 64 20 69 6e 20  69 74 73 20 69 6e 76 65  |ated in its inve|
00001e10  72 74 65 64 20 73 74 61  74 65 2e 20 49 74 73 20  |rted state. Its |
00001e20  72 65 73 70 6f 6e 73 65  20 74 6f 20 61 20 64 6f  |response to a do|
00001e30  75 62 6c 65 2d 63 6c 69  63 6b 20 69 73 20 74 6f  |uble-click is to|
00001e40  20 72 65 6d 61 69 6e 0a  62 6c 61 63 6b 2d 6f 6e  | remain.black-on|
00001e50  2d 77 68 69 74 65 2e 20  41 20 73 75 62 73 65 71  |-white. A subseq|
00001e60  75 65 6e 74 20 73 69 6e  67 6c 65 20 63 6c 69 63  |uent single clic|
00001e70  6b 20 63 6c 65 61 72 73  20 69 74 20 74 6f 20 77  |k clears it to w|
00001e80  68 69 74 65 2d 6f 6e 2d  62 6c 61 63 6b 21 0a 0a  |hite-on-black!..|
00001e90  50 6c 65 61 73 65 20 73  65 6e 64 20 61 6c 6c 20  |Please send all |
00001ea0  63 6f 6d 6d 65 6e 74 73  20 61 6e 64 20 73 75 67  |comments and sug|
00001eb0  67 65 73 74 69 6f 6e 73  20 74 6f 3a 0a 0a 4d 2e  |gestions to:..M.|
00001ec0  50 2e 20 46 6f 78 2c 0a  33 31 20 50 69 65 72 73  |P. Fox,.31 Piers|
00001ed0  6f 6e 20 52 6f 61 64 2c  0a 57 69 6e 64 73 6f 72  |on Road,.Windsor|
00001ee0  2c 0a 42 65 72 6b 73 2e  20 53 4c 34 20 35 52 45  |,.Berks. SL4 5RE|
00001ef0