Home » Recent acquisitions » Acorn ADFS disks » adfs_AcornUser_199604.adf » Features » StarInfo/Fletcher/AllWCD/WSWI-Help

StarInfo/Fletcher/AllWCD/WSWI-Help

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 » Recent acquisitions » Acorn ADFS disks » adfs_AcornUser_199604.adf » Features
Filename: StarInfo/Fletcher/AllWCD/WSWI-Help
Read OK:
File size: 367D bytes
Load address: 0000
Exec address: 0000
File contents
WimpSWIVe       0.04 (27 Apr 1995)
==================================


 NewerLook needs to trap Wimp_ SWIs in order to provide its new error
windows. The only official way to trap SWIs is to trap the SWI hardware
vector, but even this is not recommended. It takes much code to implement
properly in all circumstances (about 30K of source code for Desktop Hacker),
and can slow the machine down, quite considerably when there are multiple
claimants.

 It is, however, possible to trap Wimp_ SWIs by providing another module
with the same SWI chunk and names. This method is much quicker and easier,
but is rather dodgy. One of the problems is that only one module can do this
at a time. So if NewerLook had a module that used this method, it wouldn�t
work properly when another program tried to do the same thing.

 Thus, I have separated the trapping code from the action code (which resides
in another module), and released this module separately. It can manage SWI
claims and releases dynamically, a bit like vectors. You can use it in your
own programs if you like. Here�s how.

 Because WimpSWIVe uses the Wimp�s SWI chunk, it cannot provide its own
SWIs. Instead, it communicates using a Wimp SWI, namely Wimp_RegisterFilter.
Here is the WimpSWIVe specification for Wimp_RegisterFilter.


            |                                             Wimp_RegisterFilter
            |                                                    (SWI &400F5)
            |
            | Used by the Filter Manager to register or deregister a filter
            | OR used to register SWI claims and releases with WimpSWIVe
            |
  On entry: | R0 = reason code:
            |         &49575357 (�WSWI�) for WimpSWIVe operation (see below)
            |         anything else for filter operation (see RISC OS 3
            |         Programmers� Reference Manual, page 3-224)
            | R1 = SWI word:
            |         bits 0-5 : offset in SWI chunk of SWI to claim/release
            |         bits 6-29: undefined, leave unset
            |         bit  30  : high priority if set, else low priority
            |         bit  31  : claim if set, else release
            | R2 = value to be passed in R12 on entry to code
            | R3 = address of SWI pre-trapping code, or 0 if none needed
            | R4 = address of SWI post-trapping code, or 0 if none needed
            |
   On exit: | Registers preserved
            |
Interrupts: | Interrupts may be enabled
            | Fast interrupts may be enabled
            |
 Processor: | Processor is in SVC mode
            |
Reentrancy: | SWI is not re-entrant
            |
       Use: | In WimpSWIVe usage, this SWI is used to claim or release SWIs.
            | The pre-trapping code specified is called before the SWI is
            | called, and the post-trapping code afterwards.
            |
            | High-priority pre-code is called before low priority pre-code.
            | (And high-priority post-code is called after low priority
            | post-code.) This is important because one piece of pre-code
            | could intercept a SWI call before another bit got a look in.
            | You should use high-priority code for monitoring and register-
            | altering code. If your pre-code is at all likely to intercept
            | a SWI, you must use low-priority code. In effect, low-priority
            | code is 'closer' to the real SWI.
            |
            | Pre-trapping code conditions:
            |
            | On entry: R0-R8 = registers passed to SWI
            |           R9    = offset into chunk of SWI called
            |           R12   = value specified when RegisterFilter called
            |           R13   = full, descending stack
            |           R14   = return address
            |  On exit: R0-R8 = may be altered to change effect of SWI
            |           R9    = preserved, or -1 to intercept SWI
            |
            | Pre-trapping code is entered in SVC mode, with interrupts
            | disabled. If R9=-1 on exit, the SWI is not called. Instead,
            | any outstanding post-code is called, and the caller is returned
            | to with the supplied R0-R8 and PSR flags. An error may be
            | signified by pointing R0 to an error block and setting the V
            | flag on return as normal, when intercepting. (See footnote 1.)
            |
            | If more than one client has claimed a SWI, it is the earliest
            | claimant�s pre-trapping code that is called last - new
            | claimants take priority (though high-priority always beats low-
            | priority, of course). If interception occurs, any post-trapping
            | code for claims where the pre-trapping code (if any) has
            | already been executed are also executed. In effect, you are
            | guaranteed that you will get a post-trap event if you have had
            | a pre-trap. (See footnote 2.)
            |
            |
            | Post-trapping code conditions:
            |
            | On entry: R0-R8 = registers passed back from SWI
            |           R9    = offset into chunk of SWI called
            |           R12   = value specified when RegisterFilter called
            |           R13   = full, descending stack
            |           R14   = return address
            |  On exit: R0-R8 = may be altered to change perceived results
            |           PSR flags may be altered to change perceived results
            |           (for example to flag an error).
            |
            | Post-trapping code is entered in SVC mode, with interrupts
            | disabled.
            |
            | If more than one client has claimed a SWI, it is the earliest
            | claimant�s post-trapping code that is called first, subject
            | to priority. (See footnote 2.)
            |
            | Remember that your post-trapping code may well be entered in an
            | error condition. So check whether the V flag is set on entry,
            | and return if it is (if you return with the S flag (MovS Pc,R14
            | or LdmFd R13!,{...,Pc}^, the flags are unaffected). Never
            | change the PSR flags by accident.
            |
            |
            | Unlike OS_Claim, this SWI will not remove previous instances of
            | claims with the same values. The release routine also only
            | removes one instance of the values at a time.
            |
            | Claiming the Wimp_RegisterFilter SWI only traps the normal
            | filter-based use of the SWI. Under no circumstances should you
            | call Wimp_RegisterFilter with WimpSWIVe usage in your trapping
            | code. If you really must claim or release a SWI when some other
            | SWI is executed, use a CallBack to do it. (See the RISC OS 3
            | Programmers� Reference Manual, page 1-319.)
            |
            | NB: You should NOT post-trap Wimp_Poll or Wimp_StartTask.
            | (Or Wimp_PollIdle.) Trapping Wimp_Poll is easy anyway, using
            | the old filter system.
            |
    Errors: | Bad value passed to WIMP in R0
            |    if WimpSWIVe is not loaded, the attempt to use this SWI in
            |    the WimpSWIVe manner will cause this error
            | Bad WimpSWIVe release
            |    releasing a SWI you had not claimed generates this error
            | No room in RMA
            |    is also possible but highly unlikely.
            |


 Footnote 1 - Re-entrancy issues:

 Re-entrancy is nae problem if you only use pre-trapping or only use post-
trapping - you can either be re-entrant by using a stack to store stuff, or
prevent re-entering using a threaded flag (and unless you call a SWI, you
cannot be re-entered anyway). If you use both, but the post-code always does
the same regardless of the pre-code, you're all right too.

 But if you use both at once and the action of post depends on something
that happened in pre (for example if you have pre to check the reason code
is worth bothering with in the post-trap code), it is slightly more complex.
It's quite possible that calling a Wimp SWI may cause another Wimp SWI to be
called, especially when you consider there can be many WimpSWIVe claimants.
Consider:

     SWI Wimp_Thing called
       WimpSWIVe claimant 1 pre-traps SWI
         Claimant 1 store data for SWI 1 in workspace
       WimpSWIVe claimant 2 pre-traps SWI
         Claimant 2 executes Wimp_Gubbins
           Wimp_Gubbins causes Wimp_Thing to be called
             WimpSWIVe claimant 1 pre-traps SWI
               Claimant 1 stores data for SWI 2 in workspace
             WimpSWIVe claimant 2 pre-traps SWI
               Claimant 2 is threaded, and so does nothing
             WimpSWIVe executes real SWI Wimp_Thing
             WimpSWIVe claimant 2 post-traps SWI
               Claimant 2 is threaded, and so does nothing
             WimpSWIVe claimant 1 post-traps SWI
               Claimant 1 performs action on results, dependent on workspace
               which holds data for SWI 2
             WimpSWIVe returns
       WimpSWIVe executes real Wimp_Thing SWI
       WimpSWIVe claimant 2 post-traps SWI
         Claimant 2 does whatever it needs to with results
       WimpSWIVe claimant 1 post-traps SWI
         Claimant 1 performs action on results, dependent on workspace
         which holds data for SWI *2*
       WimpSWIVe returns

 As you can see, there is a lot of scope here for things going wrong, and
horrible clashes where one WimpSWIVe program may make another go wrong,
potentially rather messily.

 There are two things you can do about it. Perhaps the best is to store a
'count' of post-traps to ignore. This count should be zero initially, and
should be incremented first when your pre-trap code detects that post-
trapping should do something effective. It should also be incremented every
time the pre-trap code is entered with the count non-zero. The post trap code
then checks the count on entry. If the count is zero, it returns doing
nothing. If the count is one or greater, the count is decremented. If the
count is one exactly one, the effect of the post-trap is activated. There's
an example of this in the EigenSysInfo source.

 This is fine normally, but it makes the trapping code only affect the first
SWI to be affected (the "outermost" affected SWI). If you want to be truly
re-entrant, you'd have to store values on the stack to indicate whether to
post-trap on each call. And you couldn't use the SVC stack, so you'd have to
use a private stack. And you'd have to revert to the above behaviour if the
stack was filled up. Therefore, I don't reckon it's worth bothering with,
especially as allowing true re-entrancy opens the door to recursive problems
(Wimp_Thing calls Wimp_Gubbins calls Wimp_Thing calls Wimp_Gubbins etc.) too.

 Sorry about the complexity of this footnote. Relax. You don't need to
bother about all this horrid stuff, usually. :-)


 Footnote 2:

 Your post-trap code will only be called if the SWI does return. This might
not happen if the SWI is one that doesn't return (but I can't think of any
Wimp_ SWIs that don't), or if a serious error happens. The latter should
never happen in a perfect system, but bugs happen and the SWI being trapped
might branch through zero or something. With the Wimp, though, a crash at
this stage often means there is something very wrong with the whole desktop
and everything is going to die anyway, so your module failing to post-trap
is unlikely to annoy the user much. :-)

-----------------------------------------------------------------------------

 This module is supplied with some example programs:

 - 3DErrorWindow. This is a useful module that replaces the WIMP�s error
   windows with its own Risc PCable 3D ones (it needs 3DErrorWindow$Path to
   point to a directory containing Templates and Messages - you can find one
   in Sources.ErrorWind) using pre-trapping (usually with interception). The
   windows could do with the NewerLook 'titlejoint' sprite in the wimp pool,
   along with the Risc PC error system sprites.
 - EigenSysInfo. This is a pretty useless one that changes Wimp_ReadSysInfo
   2 always to return 24 or 22, and return the latter if Log2YEig<2 (the
   WIMP returns 22 if Log2YEig==Log2XEig, which is silly). It also goes
   'beep' if the Wimp returned a different value to it (try mode 22 and the
   like). It�s not particularly great because most programs don�t take any
   notice of ReadSysInfo (partly because of its aforementioned bobbinsness)
   but it shows you how to pre-trap and post-trap SWIs at the same time (as
   in footnote 1).

 The source for these programs, along with the full source to WimpSWIVe and
some resources for 3DErrorWindow are to be found in the Sources directory.
However, these programs require BAX to be loaded for them to compile. BAX is
DoggySoft�s Basic Assembler Extension, which provides all ARM3, ARM6, FPA10
and coprocessor instructions, along with many useful pseudo-instructions.
You can get BAX from good PD libraries and Arcade, Digital Databank and
Furzefield Hq BBSs. It�s essential for Basic assembler programmers!

 If you use this module in a program, be sure to RMEnsure version 0.04 or
later - versions 0.01 and 0.02 are NewerLook quick releases with bugs in
post-trapping, and version 0.03 do not feature high-priority SWI trapping,
as well as sometimes entering pre-code with interrupts enabled.

 This module is freeware. Free free to distribute and use. To contact me -
for praise, to suggest new bits to add, or (heaven forbid) to report a bug,
please write to:

  Andrew Clover,
   7 Blackhorse Crescent,
    Amersham,
     Bucks.,
      HP6 6HP.

 Or phone me on 01494-431916, send a fax on 01494-675878, send some email to
ajc@doggysft.demon.co.uk or even telex on 83675 Brit G.
00000000  57 69 6d 70 53 57 49 56  65 20 20 20 20 20 20 20  |WimpSWIVe       |
00000010  30 2e 30 34 20 28 32 37  20 41 70 72 20 31 39 39  |0.04 (27 Apr 199|
00000020  35 29 0a 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |5).=============|
00000030  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
00000040  3d 3d 3d 3d 3d 0a 0a 0a  20 4e 65 77 65 72 4c 6f  |=====... NewerLo|
00000050  6f 6b 20 6e 65 65 64 73  20 74 6f 20 74 72 61 70  |ok needs to trap|
00000060  20 57 69 6d 70 5f 20 53  57 49 73 20 69 6e 20 6f  | Wimp_ SWIs in o|
00000070  72 64 65 72 20 74 6f 20  70 72 6f 76 69 64 65 20  |rder to provide |
00000080  69 74 73 20 6e 65 77 20  65 72 72 6f 72 0a 77 69  |its new error.wi|
00000090  6e 64 6f 77 73 2e 20 54  68 65 20 6f 6e 6c 79 20  |ndows. The only |
000000a0  6f 66 66 69 63 69 61 6c  20 77 61 79 20 74 6f 20  |official way to |
000000b0  74 72 61 70 20 53 57 49  73 20 69 73 20 74 6f 20  |trap SWIs is to |
000000c0  74 72 61 70 20 74 68 65  20 53 57 49 20 68 61 72  |trap the SWI har|
000000d0  64 77 61 72 65 0a 76 65  63 74 6f 72 2c 20 62 75  |dware.vector, bu|
000000e0  74 20 65 76 65 6e 20 74  68 69 73 20 69 73 20 6e  |t even this is n|
000000f0  6f 74 20 72 65 63 6f 6d  6d 65 6e 64 65 64 2e 20  |ot recommended. |
00000100  49 74 20 74 61 6b 65 73  20 6d 75 63 68 20 63 6f  |It takes much co|
00000110  64 65 20 74 6f 20 69 6d  70 6c 65 6d 65 6e 74 0a  |de to implement.|
00000120  70 72 6f 70 65 72 6c 79  20 69 6e 20 61 6c 6c 20  |properly in all |
00000130  63 69 72 63 75 6d 73 74  61 6e 63 65 73 20 28 61  |circumstances (a|
00000140  62 6f 75 74 20 33 30 4b  20 6f 66 20 73 6f 75 72  |bout 30K of sour|
00000150  63 65 20 63 6f 64 65 20  66 6f 72 20 44 65 73 6b  |ce code for Desk|
00000160  74 6f 70 20 48 61 63 6b  65 72 29 2c 0a 61 6e 64  |top Hacker),.and|
00000170  20 63 61 6e 20 73 6c 6f  77 20 74 68 65 20 6d 61  | can slow the ma|
00000180  63 68 69 6e 65 20 64 6f  77 6e 2c 20 71 75 69 74  |chine down, quit|
00000190  65 20 63 6f 6e 73 69 64  65 72 61 62 6c 79 20 77  |e considerably w|
000001a0  68 65 6e 20 74 68 65 72  65 20 61 72 65 20 6d 75  |hen there are mu|
000001b0  6c 74 69 70 6c 65 0a 63  6c 61 69 6d 61 6e 74 73  |ltiple.claimants|
000001c0  2e 0a 0a 20 49 74 20 69  73 2c 20 68 6f 77 65 76  |... It is, howev|
000001d0  65 72 2c 20 70 6f 73 73  69 62 6c 65 20 74 6f 20  |er, possible to |
000001e0  74 72 61 70 20 57 69 6d  70 5f 20 53 57 49 73 20  |trap Wimp_ SWIs |
000001f0  62 79 20 70 72 6f 76 69  64 69 6e 67 20 61 6e 6f  |by providing ano|
00000200  74 68 65 72 20 6d 6f 64  75 6c 65 0a 77 69 74 68  |ther module.with|
00000210  20 74 68 65 20 73 61 6d  65 20 53 57 49 20 63 68  | the same SWI ch|
00000220  75 6e 6b 20 61 6e 64 20  6e 61 6d 65 73 2e 20 54  |unk and names. T|
00000230  68 69 73 20 6d 65 74 68  6f 64 20 69 73 20 6d 75  |his method is mu|
00000240  63 68 20 71 75 69 63 6b  65 72 20 61 6e 64 20 65  |ch quicker and e|
00000250  61 73 69 65 72 2c 0a 62  75 74 20 69 73 20 72 61  |asier,.but is ra|
00000260  74 68 65 72 20 64 6f 64  67 79 2e 20 4f 6e 65 20  |ther dodgy. One |
00000270  6f 66 20 74 68 65 20 70  72 6f 62 6c 65 6d 73 20  |of the problems |
00000280  69 73 20 74 68 61 74 20  6f 6e 6c 79 20 6f 6e 65  |is that only one|
00000290  20 6d 6f 64 75 6c 65 20  63 61 6e 20 64 6f 20 74  | module can do t|
000002a0  68 69 73 0a 61 74 20 61  20 74 69 6d 65 2e 20 53  |his.at a time. S|
000002b0  6f 20 69 66 20 4e 65 77  65 72 4c 6f 6f 6b 20 68  |o if NewerLook h|
000002c0  61 64 20 61 20 6d 6f 64  75 6c 65 20 74 68 61 74  |ad a module that|
000002d0  20 75 73 65 64 20 74 68  69 73 20 6d 65 74 68 6f  | used this metho|
000002e0  64 2c 20 69 74 20 77 6f  75 6c 64 6e 91 74 0a 77  |d, it wouldn.t.w|
000002f0  6f 72 6b 20 70 72 6f 70  65 72 6c 79 20 77 68 65  |ork properly whe|
00000300  6e 20 61 6e 6f 74 68 65  72 20 70 72 6f 67 72 61  |n another progra|
00000310  6d 20 74 72 69 65 64 20  74 6f 20 64 6f 20 74 68  |m tried to do th|
00000320  65 20 73 61 6d 65 20 74  68 69 6e 67 2e 0a 0a 20  |e same thing... |
00000330  54 68 75 73 2c 20 49 20  68 61 76 65 20 73 65 70  |Thus, I have sep|
00000340  61 72 61 74 65 64 20 74  68 65 20 74 72 61 70 70  |arated the trapp|
00000350  69 6e 67 20 63 6f 64 65  20 66 72 6f 6d 20 74 68  |ing code from th|
00000360  65 20 61 63 74 69 6f 6e  20 63 6f 64 65 20 28 77  |e action code (w|
00000370  68 69 63 68 20 72 65 73  69 64 65 73 0a 69 6e 20  |hich resides.in |
00000380  61 6e 6f 74 68 65 72 20  6d 6f 64 75 6c 65 29 2c  |another module),|
00000390  20 61 6e 64 20 72 65 6c  65 61 73 65 64 20 74 68  | and released th|
000003a0  69 73 20 6d 6f 64 75 6c  65 20 73 65 70 61 72 61  |is module separa|
000003b0  74 65 6c 79 2e 20 49 74  20 63 61 6e 20 6d 61 6e  |tely. It can man|
000003c0  61 67 65 20 53 57 49 0a  63 6c 61 69 6d 73 20 61  |age SWI.claims a|
000003d0  6e 64 20 72 65 6c 65 61  73 65 73 20 64 79 6e 61  |nd releases dyna|
000003e0  6d 69 63 61 6c 6c 79 2c  20 61 20 62 69 74 20 6c  |mically, a bit l|
000003f0  69 6b 65 20 76 65 63 74  6f 72 73 2e 20 59 6f 75  |ike vectors. You|
00000400  20 63 61 6e 20 75 73 65  20 69 74 20 69 6e 20 79  | can use it in y|
00000410  6f 75 72 0a 6f 77 6e 20  70 72 6f 67 72 61 6d 73  |our.own programs|
00000420  20 69 66 20 79 6f 75 20  6c 69 6b 65 2e 20 48 65  | if you like. He|
00000430  72 65 91 73 20 68 6f 77  2e 0a 0a 20 42 65 63 61  |re.s how... Beca|
00000440  75 73 65 20 57 69 6d 70  53 57 49 56 65 20 75 73  |use WimpSWIVe us|
00000450  65 73 20 74 68 65 20 57  69 6d 70 91 73 20 53 57  |es the Wimp.s SW|
00000460  49 20 63 68 75 6e 6b 2c  20 69 74 20 63 61 6e 6e  |I chunk, it cann|
00000470  6f 74 20 70 72 6f 76 69  64 65 20 69 74 73 20 6f  |ot provide its o|
00000480  77 6e 0a 53 57 49 73 2e  20 49 6e 73 74 65 61 64  |wn.SWIs. Instead|
00000490  2c 20 69 74 20 63 6f 6d  6d 75 6e 69 63 61 74 65  |, it communicate|
000004a0  73 20 75 73 69 6e 67 20  61 20 57 69 6d 70 20 53  |s using a Wimp S|
000004b0  57 49 2c 20 6e 61 6d 65  6c 79 20 57 69 6d 70 5f  |WI, namely Wimp_|
000004c0  52 65 67 69 73 74 65 72  46 69 6c 74 65 72 2e 0a  |RegisterFilter..|
000004d0  48 65 72 65 20 69 73 20  74 68 65 20 57 69 6d 70  |Here is the Wimp|
000004e0  53 57 49 56 65 20 73 70  65 63 69 66 69 63 61 74  |SWIVe specificat|
000004f0  69 6f 6e 20 66 6f 72 20  57 69 6d 70 5f 52 65 67  |ion for Wimp_Reg|
00000500  69 73 74 65 72 46 69 6c  74 65 72 2e 0a 0a 0a 20  |isterFilter.... |
00000510  20 20 20 20 20 20 20 20  20 20 20 7c 20 20 20 20  |           |    |
00000520  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00000540  20 20 20 20 20 20 20 20  20 57 69 6d 70 5f 52 65  |         Wimp_Re|
00000550  67 69 73 74 65 72 46 69  6c 74 65 72 0a 20 20 20  |gisterFilter.   |
00000560  20 20 20 20 20 20 20 20  20 7c 20 20 20 20 20 20  |         |      |
00000570  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00000590  20 20 20 20 20 20 20 20  20 20 20 20 20 20 28 53  |              (S|
000005a0  57 49 20 26 34 30 30 46  35 29 0a 20 20 20 20 20  |WI &400F5).     |
000005b0  20 20 20 20 20 20 20 7c  0a 20 20 20 20 20 20 20  |       |.       |
000005c0  20 20 20 20 20 7c 20 55  73 65 64 20 62 79 20 74  |     | Used by t|
000005d0  68 65 20 46 69 6c 74 65  72 20 4d 61 6e 61 67 65  |he Filter Manage|
000005e0  72 20 74 6f 20 72 65 67  69 73 74 65 72 20 6f 72  |r to register or|
000005f0  20 64 65 72 65 67 69 73  74 65 72 20 61 20 66 69  | deregister a fi|
00000600  6c 74 65 72 0a 20 20 20  20 20 20 20 20 20 20 20  |lter.           |
00000610  20 7c 20 4f 52 20 75 73  65 64 20 74 6f 20 72 65  | | OR used to re|
00000620  67 69 73 74 65 72 20 53  57 49 20 63 6c 61 69 6d  |gister SWI claim|
00000630  73 20 61 6e 64 20 72 65  6c 65 61 73 65 73 20 77  |s and releases w|
00000640  69 74 68 20 57 69 6d 70  53 57 49 56 65 0a 20 20  |ith WimpSWIVe.  |
00000650  20 20 20 20 20 20 20 20  20 20 7c 0a 20 20 4f 6e  |          |.  On|
00000660  20 65 6e 74 72 79 3a 20  7c 20 52 30 20 3d 20 72  | entry: | R0 = r|
00000670  65 61 73 6f 6e 20 63 6f  64 65 3a 0a 20 20 20 20  |eason code:.    |
00000680  20 20 20 20 20 20 20 20  7c 20 20 20 20 20 20 20  |        |       |
00000690  20 20 26 34 39 35 37 35  33 35 37 20 28 94 57 53  |  &49575357 (.WS|
000006a0  57 49 95 29 20 66 6f 72  20 57 69 6d 70 53 57 49  |WI.) for WimpSWI|
000006b0  56 65 20 6f 70 65 72 61  74 69 6f 6e 20 28 73 65  |Ve operation (se|
000006c0  65 20 62 65 6c 6f 77 29  0a 20 20 20 20 20 20 20  |e below).       |
000006d0  20 20 20 20 20 7c 20 20  20 20 20 20 20 20 20 61  |     |         a|
000006e0  6e 79 74 68 69 6e 67 20  65 6c 73 65 20 66 6f 72  |nything else for|
000006f0  20 66 69 6c 74 65 72 20  6f 70 65 72 61 74 69 6f  | filter operatio|
00000700  6e 20 28 73 65 65 20 52  49 53 43 20 4f 53 20 33  |n (see RISC OS 3|
00000710  0a 20 20 20 20 20 20 20  20 20 20 20 20 7c 20 20  |.            |  |
00000720  20 20 20 20 20 20 20 50  72 6f 67 72 61 6d 6d 65  |       Programme|
00000730  72 73 91 20 52 65 66 65  72 65 6e 63 65 20 4d 61  |rs. Reference Ma|
00000740  6e 75 61 6c 2c 20 70 61  67 65 20 33 2d 32 32 34  |nual, page 3-224|
00000750  29 0a 20 20 20 20 20 20  20 20 20 20 20 20 7c 20  |).            | |
00000760  52 31 20 3d 20 53 57 49  20 77 6f 72 64 3a 0a 20  |R1 = SWI word:. |
00000770  20 20 20 20 20 20 20 20  20 20 20 7c 20 20 20 20  |           |    |
00000780  20 20 20 20 20 62 69 74  73 20 30 2d 35 20 3a 20  |     bits 0-5 : |
00000790  6f 66 66 73 65 74 20 69  6e 20 53 57 49 20 63 68  |offset in SWI ch|
000007a0  75 6e 6b 20 6f 66 20 53  57 49 20 74 6f 20 63 6c  |unk of SWI to cl|
000007b0  61 69 6d 2f 72 65 6c 65  61 73 65 0a 20 20 20 20  |aim/release.    |
000007c0  20 20 20 20 20 20 20 20  7c 20 20 20 20 20 20 20  |        |       |
000007d0  20 20 62 69 74 73 20 36  2d 32 39 3a 20 75 6e 64  |  bits 6-29: und|
000007e0  65 66 69 6e 65 64 2c 20  6c 65 61 76 65 20 75 6e  |efined, leave un|
000007f0  73 65 74 0a 20 20 20 20  20 20 20 20 20 20 20 20  |set.            |
00000800  7c 20 20 20 20 20 20 20  20 20 62 69 74 20 20 33  ||         bit  3|
00000810  30 20 20 3a 20 68 69 67  68 20 70 72 69 6f 72 69  |0  : high priori|
00000820  74 79 20 69 66 20 73 65  74 2c 20 65 6c 73 65 20  |ty if set, else |
00000830  6c 6f 77 20 70 72 69 6f  72 69 74 79 0a 20 20 20  |low priority.   |
00000840  20 20 20 20 20 20 20 20  20 7c 20 20 20 20 20 20  |         |      |
00000850  20 20 20 62 69 74 20 20  33 31 20 20 3a 20 63 6c  |   bit  31  : cl|
00000860  61 69 6d 20 69 66 20 73  65 74 2c 20 65 6c 73 65  |aim if set, else|
00000870  20 72 65 6c 65 61 73 65  0a 20 20 20 20 20 20 20  | release.       |
00000880  20 20 20 20 20 7c 20 52  32 20 3d 20 76 61 6c 75  |     | R2 = valu|
00000890  65 20 74 6f 20 62 65 20  70 61 73 73 65 64 20 69  |e to be passed i|
000008a0  6e 20 52 31 32 20 6f 6e  20 65 6e 74 72 79 20 74  |n R12 on entry t|
000008b0  6f 20 63 6f 64 65 0a 20  20 20 20 20 20 20 20 20  |o code.         |
000008c0  20 20 20 7c 20 52 33 20  3d 20 61 64 64 72 65 73  |   | R3 = addres|
000008d0  73 20 6f 66 20 53 57 49  20 70 72 65 2d 74 72 61  |s of SWI pre-tra|
000008e0  70 70 69 6e 67 20 63 6f  64 65 2c 20 6f 72 20 30  |pping code, or 0|
000008f0  20 69 66 20 6e 6f 6e 65  20 6e 65 65 64 65 64 0a  | if none needed.|
00000900  20 20 20 20 20 20 20 20  20 20 20 20 7c 20 52 34  |            | R4|
00000910  20 3d 20 61 64 64 72 65  73 73 20 6f 66 20 53 57  | = address of SW|
00000920  49 20 70 6f 73 74 2d 74  72 61 70 70 69 6e 67 20  |I post-trapping |
00000930  63 6f 64 65 2c 20 6f 72  20 30 20 69 66 20 6e 6f  |code, or 0 if no|
00000940  6e 65 20 6e 65 65 64 65  64 0a 20 20 20 20 20 20  |ne needed.      |
00000950  20 20 20 20 20 20 7c 0a  20 20 20 4f 6e 20 65 78  |      |.   On ex|
00000960  69 74 3a 20 7c 20 52 65  67 69 73 74 65 72 73 20  |it: | Registers |
00000970  70 72 65 73 65 72 76 65  64 0a 20 20 20 20 20 20  |preserved.      |
00000980  20 20 20 20 20 20 7c 0a  49 6e 74 65 72 72 75 70  |      |.Interrup|
00000990  74 73 3a 20 7c 20 49 6e  74 65 72 72 75 70 74 73  |ts: | Interrupts|
000009a0  20 6d 61 79 20 62 65 20  65 6e 61 62 6c 65 64 0a  | may be enabled.|
000009b0  20 20 20 20 20 20 20 20  20 20 20 20 7c 20 46 61  |            | Fa|
000009c0  73 74 20 69 6e 74 65 72  72 75 70 74 73 20 6d 61  |st interrupts ma|
000009d0  79 20 62 65 20 65 6e 61  62 6c 65 64 0a 20 20 20  |y be enabled.   |
000009e0  20 20 20 20 20 20 20 20  20 7c 0a 20 50 72 6f 63  |         |. Proc|
000009f0  65 73 73 6f 72 3a 20 7c  20 50 72 6f 63 65 73 73  |essor: | Process|
00000a00  6f 72 20 69 73 20 69 6e  20 53 56 43 20 6d 6f 64  |or is in SVC mod|
00000a10  65 0a 20 20 20 20 20 20  20 20 20 20 20 20 7c 0a  |e.            |.|
00000a20  52 65 65 6e 74 72 61 6e  63 79 3a 20 7c 20 53 57  |Reentrancy: | SW|
00000a30  49 20 69 73 20 6e 6f 74  20 72 65 2d 65 6e 74 72  |I is not re-entr|
00000a40  61 6e 74 0a 20 20 20 20  20 20 20 20 20 20 20 20  |ant.            |
00000a50  7c 0a 20 20 20 20 20 20  20 55 73 65 3a 20 7c 20  ||.       Use: | |
00000a60  49 6e 20 57 69 6d 70 53  57 49 56 65 20 75 73 61  |In WimpSWIVe usa|
00000a70  67 65 2c 20 74 68 69 73  20 53 57 49 20 69 73 20  |ge, this SWI is |
00000a80  75 73 65 64 20 74 6f 20  63 6c 61 69 6d 20 6f 72  |used to claim or|
00000a90  20 72 65 6c 65 61 73 65  20 53 57 49 73 2e 0a 20  | release SWIs.. |
00000aa0  20 20 20 20 20 20 20 20  20 20 20 7c 20 54 68 65  |           | The|
00000ab0  20 70 72 65 2d 74 72 61  70 70 69 6e 67 20 63 6f  | pre-trapping co|
00000ac0  64 65 20 73 70 65 63 69  66 69 65 64 20 69 73 20  |de specified is |
00000ad0  63 61 6c 6c 65 64 20 62  65 66 6f 72 65 20 74 68  |called before th|
00000ae0  65 20 53 57 49 20 69 73  0a 20 20 20 20 20 20 20  |e SWI is.       |
00000af0  20 20 20 20 20 7c 20 63  61 6c 6c 65 64 2c 20 61  |     | called, a|
00000b00  6e 64 20 74 68 65 20 70  6f 73 74 2d 74 72 61 70  |nd the post-trap|
00000b10  70 69 6e 67 20 63 6f 64  65 20 61 66 74 65 72 77  |ping code afterw|
00000b20  61 72 64 73 2e 0a 20 20  20 20 20 20 20 20 20 20  |ards..          |
00000b30  20 20 7c 0a 20 20 20 20  20 20 20 20 20 20 20 20  |  |.            |
00000b40  7c 20 48 69 67 68 2d 70  72 69 6f 72 69 74 79 20  || High-priority |
00000b50  70 72 65 2d 63 6f 64 65  20 69 73 20 63 61 6c 6c  |pre-code is call|
00000b60  65 64 20 62 65 66 6f 72  65 20 6c 6f 77 20 70 72  |ed before low pr|
00000b70  69 6f 72 69 74 79 20 70  72 65 2d 63 6f 64 65 2e  |iority pre-code.|
00000b80  0a 20 20 20 20 20 20 20  20 20 20 20 20 7c 20 28  |.            | (|
00000b90  41 6e 64 20 68 69 67 68  2d 70 72 69 6f 72 69 74  |And high-priorit|
00000ba0  79 20 70 6f 73 74 2d 63  6f 64 65 20 69 73 20 63  |y post-code is c|
00000bb0  61 6c 6c 65 64 20 61 66  74 65 72 20 6c 6f 77 20  |alled after low |
00000bc0  70 72 69 6f 72 69 74 79  0a 20 20 20 20 20 20 20  |priority.       |
00000bd0  20 20 20 20 20 7c 20 70  6f 73 74 2d 63 6f 64 65  |     | post-code|
00000be0  2e 29 20 54 68 69 73 20  69 73 20 69 6d 70 6f 72  |.) This is impor|
00000bf0  74 61 6e 74 20 62 65 63  61 75 73 65 20 6f 6e 65  |tant because one|
00000c00  20 70 69 65 63 65 20 6f  66 20 70 72 65 2d 63 6f  | piece of pre-co|
00000c10  64 65 0a 20 20 20 20 20  20 20 20 20 20 20 20 7c  |de.            ||
00000c20  20 63 6f 75 6c 64 20 69  6e 74 65 72 63 65 70 74  | could intercept|
00000c30  20 61 20 53 57 49 20 63  61 6c 6c 20 62 65 66 6f  | a SWI call befo|
00000c40  72 65 20 61 6e 6f 74 68  65 72 20 62 69 74 20 67  |re another bit g|
00000c50  6f 74 20 61 20 6c 6f 6f  6b 20 69 6e 2e 0a 20 20  |ot a look in..  |
00000c60  20 20 20 20 20 20 20 20  20 20 7c 20 59 6f 75 20  |          | You |
00000c70  73 68 6f 75 6c 64 20 75  73 65 20 68 69 67 68 2d  |should use high-|
00000c80  70 72 69 6f 72 69 74 79  20 63 6f 64 65 20 66 6f  |priority code fo|
00000c90  72 20 6d 6f 6e 69 74 6f  72 69 6e 67 20 61 6e 64  |r monitoring and|
00000ca0  20 72 65 67 69 73 74 65  72 2d 0a 20 20 20 20 20  | register-.     |
00000cb0  20 20 20 20 20 20 20 7c  20 61 6c 74 65 72 69 6e  |       | alterin|
00000cc0  67 20 63 6f 64 65 2e 20  49 66 20 79 6f 75 72 20  |g code. If your |
00000cd0  70 72 65 2d 63 6f 64 65  20 69 73 20 61 74 20 61  |pre-code is at a|
00000ce0  6c 6c 20 6c 69 6b 65 6c  79 20 74 6f 20 69 6e 74  |ll likely to int|
00000cf0  65 72 63 65 70 74 0a 20  20 20 20 20 20 20 20 20  |ercept.         |
00000d00  20 20 20 7c 20 61 20 53  57 49 2c 20 79 6f 75 20  |   | a SWI, you |
00000d10  6d 75 73 74 20 75 73 65  20 6c 6f 77 2d 70 72 69  |must use low-pri|
00000d20  6f 72 69 74 79 20 63 6f  64 65 2e 20 49 6e 20 65  |ority code. In e|
00000d30  66 66 65 63 74 2c 20 6c  6f 77 2d 70 72 69 6f 72  |ffect, low-prior|
00000d40  69 74 79 0a 20 20 20 20  20 20 20 20 20 20 20 20  |ity.            |
00000d50  7c 20 63 6f 64 65 20 69  73 20 27 63 6c 6f 73 65  || code is 'close|
00000d60  72 27 20 74 6f 20 74 68  65 20 72 65 61 6c 20 53  |r' to the real S|
00000d70  57 49 2e 0a 20 20 20 20  20 20 20 20 20 20 20 20  |WI..            |
00000d80  7c 0a 20 20 20 20 20 20  20 20 20 20 20 20 7c 20  ||.            | |
00000d90  50 72 65 2d 74 72 61 70  70 69 6e 67 20 63 6f 64  |Pre-trapping cod|
00000da0  65 20 63 6f 6e 64 69 74  69 6f 6e 73 3a 0a 20 20  |e conditions:.  |
00000db0  20 20 20 20 20 20 20 20  20 20 7c 0a 20 20 20 20  |          |.    |
00000dc0  20 20 20 20 20 20 20 20  7c 20 4f 6e 20 65 6e 74  |        | On ent|
00000dd0  72 79 3a 20 52 30 2d 52  38 20 3d 20 72 65 67 69  |ry: R0-R8 = regi|
00000de0  73 74 65 72 73 20 70 61  73 73 65 64 20 74 6f 20  |sters passed to |
00000df0  53 57 49 0a 20 20 20 20  20 20 20 20 20 20 20 20  |SWI.            |
00000e00  7c 20 20 20 20 20 20 20  20 20 20 20 52 39 20 20  ||           R9  |
00000e10  20 20 3d 20 6f 66 66 73  65 74 20 69 6e 74 6f 20  |  = offset into |
00000e20  63 68 75 6e 6b 20 6f 66  20 53 57 49 20 63 61 6c  |chunk of SWI cal|
00000e30  6c 65 64 0a 20 20 20 20  20 20 20 20 20 20 20 20  |led.            |
00000e40  7c 20 20 20 20 20 20 20  20 20 20 20 52 31 32 20  ||           R12 |
00000e50  20 20 3d 20 76 61 6c 75  65 20 73 70 65 63 69 66  |  = value specif|
00000e60  69 65 64 20 77 68 65 6e  20 52 65 67 69 73 74 65  |ied when Registe|
00000e70  72 46 69 6c 74 65 72 20  63 61 6c 6c 65 64 0a 20  |rFilter called. |
00000e80  20 20 20 20 20 20 20 20  20 20 20 7c 20 20 20 20  |           |    |
00000e90  20 20 20 20 20 20 20 52  31 33 20 20 20 3d 20 66  |       R13   = f|
00000ea0  75 6c 6c 2c 20 64 65 73  63 65 6e 64 69 6e 67 20  |ull, descending |
00000eb0  73 74 61 63 6b 0a 20 20  20 20 20 20 20 20 20 20  |stack.          |
00000ec0  20 20 7c 20 20 20 20 20  20 20 20 20 20 20 52 31  |  |           R1|
00000ed0  34 20 20 20 3d 20 72 65  74 75 72 6e 20 61 64 64  |4   = return add|
00000ee0  72 65 73 73 0a 20 20 20  20 20 20 20 20 20 20 20  |ress.           |
00000ef0  20 7c 20 20 4f 6e 20 65  78 69 74 3a 20 52 30 2d  | |  On exit: R0-|
00000f00  52 38 20 3d 20 6d 61 79  20 62 65 20 61 6c 74 65  |R8 = may be alte|
00000f10  72 65 64 20 74 6f 20 63  68 61 6e 67 65 20 65 66  |red to change ef|
00000f20  66 65 63 74 20 6f 66 20  53 57 49 0a 20 20 20 20  |fect of SWI.    |
00000f30  20 20 20 20 20 20 20 20  7c 20 20 20 20 20 20 20  |        |       |
00000f40  20 20 20 20 52 39 20 20  20 20 3d 20 70 72 65 73  |    R9    = pres|
00000f50  65 72 76 65 64 2c 20 6f  72 20 2d 31 20 74 6f 20  |erved, or -1 to |
00000f60  69 6e 74 65 72 63 65 70  74 20 53 57 49 0a 20 20  |intercept SWI.  |
00000f70  20 20 20 20 20 20 20 20  20 20 7c 0a 20 20 20 20  |          |.    |
00000f80  20 20 20 20 20 20 20 20  7c 20 50 72 65 2d 74 72  |        | Pre-tr|
00000f90  61 70 70 69 6e 67 20 63  6f 64 65 20 69 73 20 65  |apping code is e|
00000fa0  6e 74 65 72 65 64 20 69  6e 20 53 56 43 20 6d 6f  |ntered in SVC mo|
00000fb0  64 65 2c 20 77 69 74 68  20 69 6e 74 65 72 72 75  |de, with interru|
00000fc0  70 74 73 0a 20 20 20 20  20 20 20 20 20 20 20 20  |pts.            |
00000fd0  7c 20 64 69 73 61 62 6c  65 64 2e 20 49 66 20 52  || disabled. If R|
00000fe0  39 3d 2d 31 20 6f 6e 20  65 78 69 74 2c 20 74 68  |9=-1 on exit, th|
00000ff0  65 20 53 57 49 20 69 73  20 6e 6f 74 20 63 61 6c  |e SWI is not cal|
00001000  6c 65 64 2e 20 49 6e 73  74 65 61 64 2c 0a 20 20  |led. Instead,.  |
00001010  20 20 20 20 20 20 20 20  20 20 7c 20 61 6e 79 20  |          | any |
00001020  6f 75 74 73 74 61 6e 64  69 6e 67 20 70 6f 73 74  |outstanding post|
00001030  2d 63 6f 64 65 20 69 73  20 63 61 6c 6c 65 64 2c  |-code is called,|
00001040  20 61 6e 64 20 74 68 65  20 63 61 6c 6c 65 72 20  | and the caller |
00001050  69 73 20 72 65 74 75 72  6e 65 64 0a 20 20 20 20  |is returned.    |
00001060  20 20 20 20 20 20 20 20  7c 20 74 6f 20 77 69 74  |        | to wit|
00001070  68 20 74 68 65 20 73 75  70 70 6c 69 65 64 20 52  |h the supplied R|
00001080  30 2d 52 38 20 61 6e 64  20 50 53 52 20 66 6c 61  |0-R8 and PSR fla|
00001090  67 73 2e 20 41 6e 20 65  72 72 6f 72 20 6d 61 79  |gs. An error may|
000010a0  20 62 65 0a 20 20 20 20  20 20 20 20 20 20 20 20  | be.            |
000010b0  7c 20 73 69 67 6e 69 66  69 65 64 20 62 79 20 70  || signified by p|
000010c0  6f 69 6e 74 69 6e 67 20  52 30 20 74 6f 20 61 6e  |ointing R0 to an|
000010d0  20 65 72 72 6f 72 20 62  6c 6f 63 6b 20 61 6e 64  | error block and|
000010e0  20 73 65 74 74 69 6e 67  20 74 68 65 20 56 0a 20  | setting the V. |
000010f0  20 20 20 20 20 20 20 20  20 20 20 7c 20 66 6c 61  |           | fla|
00001100  67 20 6f 6e 20 72 65 74  75 72 6e 20 61 73 20 6e  |g on return as n|
00001110  6f 72 6d 61 6c 2c 20 77  68 65 6e 20 69 6e 74 65  |ormal, when inte|
00001120  72 63 65 70 74 69 6e 67  2e 20 28 53 65 65 20 66  |rcepting. (See f|
00001130  6f 6f 74 6e 6f 74 65 20  31 2e 29 0a 20 20 20 20  |ootnote 1.).    |
00001140  20 20 20 20 20 20 20 20  7c 0a 20 20 20 20 20 20  |        |.      |
00001150  20 20 20 20 20 20 7c 20  49 66 20 6d 6f 72 65 20  |      | If more |
00001160  74 68 61 6e 20 6f 6e 65  20 63 6c 69 65 6e 74 20  |than one client |
00001170  68 61 73 20 63 6c 61 69  6d 65 64 20 61 20 53 57  |has claimed a SW|
00001180  49 2c 20 69 74 20 69 73  20 74 68 65 20 65 61 72  |I, it is the ear|
00001190  6c 69 65 73 74 0a 20 20  20 20 20 20 20 20 20 20  |liest.          |
000011a0  20 20 7c 20 63 6c 61 69  6d 61 6e 74 91 73 20 70  |  | claimant.s p|
000011b0  72 65 2d 74 72 61 70 70  69 6e 67 20 63 6f 64 65  |re-trapping code|
000011c0  20 74 68 61 74 20 69 73  20 63 61 6c 6c 65 64 20  | that is called |
000011d0  6c 61 73 74 20 2d 20 6e  65 77 0a 20 20 20 20 20  |last - new.     |
000011e0  20 20 20 20 20 20 20 7c  20 63 6c 61 69 6d 61 6e  |       | claiman|
000011f0  74 73 20 74 61 6b 65 20  70 72 69 6f 72 69 74 79  |ts take priority|
00001200  20 28 74 68 6f 75 67 68  20 68 69 67 68 2d 70 72  | (though high-pr|
00001210  69 6f 72 69 74 79 20 61  6c 77 61 79 73 20 62 65  |iority always be|
00001220  61 74 73 20 6c 6f 77 2d  0a 20 20 20 20 20 20 20  |ats low-.       |
00001230  20 20 20 20 20 7c 20 70  72 69 6f 72 69 74 79 2c  |     | priority,|
00001240  20 6f 66 20 63 6f 75 72  73 65 29 2e 20 49 66 20  | of course). If |
00001250  69 6e 74 65 72 63 65 70  74 69 6f 6e 20 6f 63 63  |interception occ|
00001260  75 72 73 2c 20 61 6e 79  20 70 6f 73 74 2d 74 72  |urs, any post-tr|
00001270  61 70 70 69 6e 67 0a 20  20 20 20 20 20 20 20 20  |apping.         |
00001280  20 20 20 7c 20 63 6f 64  65 20 66 6f 72 20 63 6c  |   | code for cl|
00001290  61 69 6d 73 20 77 68 65  72 65 20 74 68 65 20 70  |aims where the p|
000012a0  72 65 2d 74 72 61 70 70  69 6e 67 20 63 6f 64 65  |re-trapping code|
000012b0  20 28 69 66 20 61 6e 79  29 20 68 61 73 0a 20 20  | (if any) has.  |
000012c0  20 20 20 20 20 20 20 20  20 20 7c 20 61 6c 72 65  |          | alre|
000012d0  61 64 79 20 62 65 65 6e  20 65 78 65 63 75 74 65  |ady been execute|
000012e0  64 20 61 72 65 20 61 6c  73 6f 20 65 78 65 63 75  |d are also execu|
000012f0  74 65 64 2e 20 49 6e 20  65 66 66 65 63 74 2c 20  |ted. In effect, |
00001300  79 6f 75 20 61 72 65 0a  20 20 20 20 20 20 20 20  |you are.        |
00001310  20 20 20 20 7c 20 67 75  61 72 61 6e 74 65 65 64  |    | guaranteed|
00001320  20 74 68 61 74 20 79 6f  75 20 77 69 6c 6c 20 67  | that you will g|
00001330  65 74 20 61 20 70 6f 73  74 2d 74 72 61 70 20 65  |et a post-trap e|
00001340  76 65 6e 74 20 69 66 20  79 6f 75 20 68 61 76 65  |vent if you have|
00001350  20 68 61 64 0a 20 20 20  20 20 20 20 20 20 20 20  | had.           |
00001360  20 7c 20 61 20 70 72 65  2d 74 72 61 70 2e 20 28  | | a pre-trap. (|
00001370  53 65 65 20 66 6f 6f 74  6e 6f 74 65 20 32 2e 29  |See footnote 2.)|
00001380  0a 20 20 20 20 20 20 20  20 20 20 20 20 7c 0a 20  |.            |. |
00001390  20 20 20 20 20 20 20 20  20 20 20 7c 0a 20 20 20  |           |.   |
000013a0  20 20 20 20 20 20 20 20  20 7c 20 50 6f 73 74 2d  |         | Post-|
000013b0  74 72 61 70 70 69 6e 67  20 63 6f 64 65 20 63 6f  |trapping code co|
000013c0  6e 64 69 74 69 6f 6e 73  3a 0a 20 20 20 20 20 20  |nditions:.      |
000013d0  20 20 20 20 20 20 7c 0a  20 20 20 20 20 20 20 20  |      |.        |
000013e0  20 20 20 20 7c 20 4f 6e  20 65 6e 74 72 79 3a 20  |    | On entry: |
000013f0  52 30 2d 52 38 20 3d 20  72 65 67 69 73 74 65 72  |R0-R8 = register|
00001400  73 20 70 61 73 73 65 64  20 62 61 63 6b 20 66 72  |s passed back fr|
00001410  6f 6d 20 53 57 49 0a 20  20 20 20 20 20 20 20 20  |om SWI.         |
00001420  20 20 20 7c 20 20 20 20  20 20 20 20 20 20 20 52  |   |           R|
00001430  39 20 20 20 20 3d 20 6f  66 66 73 65 74 20 69 6e  |9    = offset in|
00001440  74 6f 20 63 68 75 6e 6b  20 6f 66 20 53 57 49 20  |to chunk of SWI |
00001450  63 61 6c 6c 65 64 0a 20  20 20 20 20 20 20 20 20  |called.         |
00001460  20 20 20 7c 20 20 20 20  20 20 20 20 20 20 20 52  |   |           R|
00001470  31 32 20 20 20 3d 20 76  61 6c 75 65 20 73 70 65  |12   = value spe|
00001480  63 69 66 69 65 64 20 77  68 65 6e 20 52 65 67 69  |cified when Regi|
00001490  73 74 65 72 46 69 6c 74  65 72 20 63 61 6c 6c 65  |sterFilter calle|
000014a0  64 0a 20 20 20 20 20 20  20 20 20 20 20 20 7c 20  |d.            | |
000014b0  20 20 20 20 20 20 20 20  20 20 52 31 33 20 20 20  |          R13   |
000014c0  3d 20 66 75 6c 6c 2c 20  64 65 73 63 65 6e 64 69  |= full, descendi|
000014d0  6e 67 20 73 74 61 63 6b  0a 20 20 20 20 20 20 20  |ng stack.       |
000014e0  20 20 20 20 20 7c 20 20  20 20 20 20 20 20 20 20  |     |          |
000014f0  20 52 31 34 20 20 20 3d  20 72 65 74 75 72 6e 20  | R14   = return |
00001500  61 64 64 72 65 73 73 0a  20 20 20 20 20 20 20 20  |address.        |
00001510  20 20 20 20 7c 20 20 4f  6e 20 65 78 69 74 3a 20  |    |  On exit: |
00001520  52 30 2d 52 38 20 3d 20  6d 61 79 20 62 65 20 61  |R0-R8 = may be a|
00001530  6c 74 65 72 65 64 20 74  6f 20 63 68 61 6e 67 65  |ltered to change|
00001540  20 70 65 72 63 65 69 76  65 64 20 72 65 73 75 6c  | perceived resul|
00001550  74 73 0a 20 20 20 20 20  20 20 20 20 20 20 20 7c  |ts.            ||
00001560  20 20 20 20 20 20 20 20  20 20 20 50 53 52 20 66  |           PSR f|
00001570  6c 61 67 73 20 6d 61 79  20 62 65 20 61 6c 74 65  |lags may be alte|
00001580  72 65 64 20 74 6f 20 63  68 61 6e 67 65 20 70 65  |red to change pe|
00001590  72 63 65 69 76 65 64 20  72 65 73 75 6c 74 73 0a  |rceived results.|
000015a0  20 20 20 20 20 20 20 20  20 20 20 20 7c 20 20 20  |            |   |
000015b0  20 20 20 20 20 20 20 20  28 66 6f 72 20 65 78 61  |        (for exa|
000015c0  6d 70 6c 65 20 74 6f 20  66 6c 61 67 20 61 6e 20  |mple to flag an |
000015d0  65 72 72 6f 72 29 2e 0a  20 20 20 20 20 20 20 20  |error)..        |
000015e0  20 20 20 20 7c 0a 20 20  20 20 20 20 20 20 20 20  |    |.          |
000015f0  20 20 7c 20 50 6f 73 74  2d 74 72 61 70 70 69 6e  |  | Post-trappin|
00001600  67 20 63 6f 64 65 20 69  73 20 65 6e 74 65 72 65  |g code is entere|
00001610  64 20 69 6e 20 53 56 43  20 6d 6f 64 65 2c 20 77  |d in SVC mode, w|
00001620  69 74 68 20 69 6e 74 65  72 72 75 70 74 73 0a 20  |ith interrupts. |
00001630  20 20 20 20 20 20 20 20  20 20 20 7c 20 64 69 73  |           | dis|
00001640  61 62 6c 65 64 2e 0a 20  20 20 20 20 20 20 20 20  |abled..         |
00001650  20 20 20 7c 0a 20 20 20  20 20 20 20 20 20 20 20  |   |.           |
00001660  20 7c 20 49 66 20 6d 6f  72 65 20 74 68 61 6e 20  | | If more than |
00001670  6f 6e 65 20 63 6c 69 65  6e 74 20 68 61 73 20 63  |one client has c|
00001680  6c 61 69 6d 65 64 20 61  20 53 57 49 2c 20 69 74  |laimed a SWI, it|
00001690  20 69 73 20 74 68 65 20  65 61 72 6c 69 65 73 74  | is the earliest|
000016a0  0a 20 20 20 20 20 20 20  20 20 20 20 20 7c 20 63  |.            | c|
000016b0  6c 61 69 6d 61 6e 74 91  73 20 70 6f 73 74 2d 74  |laimant.s post-t|
000016c0  72 61 70 70 69 6e 67 20  63 6f 64 65 20 74 68 61  |rapping code tha|
000016d0  74 20 69 73 20 63 61 6c  6c 65 64 20 66 69 72 73  |t is called firs|
000016e0  74 2c 20 73 75 62 6a 65  63 74 0a 20 20 20 20 20  |t, subject.     |
000016f0  20 20 20 20 20 20 20 7c  20 74 6f 20 70 72 69 6f  |       | to prio|
00001700  72 69 74 79 2e 20 28 53  65 65 20 66 6f 6f 74 6e  |rity. (See footn|
00001710  6f 74 65 20 32 2e 29 0a  20 20 20 20 20 20 20 20  |ote 2.).        |
00001720  20 20 20 20 7c 0a 20 20  20 20 20 20 20 20 20 20  |    |.          |
00001730  20 20 7c 20 52 65 6d 65  6d 62 65 72 20 74 68 61  |  | Remember tha|
00001740  74 20 79 6f 75 72 20 70  6f 73 74 2d 74 72 61 70  |t your post-trap|
00001750  70 69 6e 67 20 63 6f 64  65 20 6d 61 79 20 77 65  |ping code may we|
00001760  6c 6c 20 62 65 20 65 6e  74 65 72 65 64 20 69 6e  |ll be entered in|
00001770  20 61 6e 0a 20 20 20 20  20 20 20 20 20 20 20 20  | an.            |
00001780  7c 20 65 72 72 6f 72 20  63 6f 6e 64 69 74 69 6f  || error conditio|
00001790  6e 2e 20 53 6f 20 63 68  65 63 6b 20 77 68 65 74  |n. So check whet|
000017a0  68 65 72 20 74 68 65 20  56 20 66 6c 61 67 20 69  |her the V flag i|
000017b0  73 20 73 65 74 20 6f 6e  20 65 6e 74 72 79 2c 0a  |s set on entry,.|
000017c0  20 20 20 20 20 20 20 20  20 20 20 20 7c 20 61 6e  |            | an|
000017d0  64 20 72 65 74 75 72 6e  20 69 66 20 69 74 20 69  |d return if it i|
000017e0  73 20 28 69 66 20 79 6f  75 20 72 65 74 75 72 6e  |s (if you return|
000017f0  20 77 69 74 68 20 74 68  65 20 53 20 66 6c 61 67  | with the S flag|
00001800  20 28 4d 6f 76 53 20 50  63 2c 52 31 34 0a 20 20  | (MovS Pc,R14.  |
00001810  20 20 20 20 20 20 20 20  20 20 7c 20 6f 72 20 4c  |          | or L|
00001820  64 6d 46 64 20 52 31 33  21 2c 7b 2e 2e 2e 2c 50  |dmFd R13!,{...,P|
00001830  63 7d 5e 2c 20 74 68 65  20 66 6c 61 67 73 20 61  |c}^, the flags a|
00001840  72 65 20 75 6e 61 66 66  65 63 74 65 64 29 2e 20  |re unaffected). |
00001850  4e 65 76 65 72 0a 20 20  20 20 20 20 20 20 20 20  |Never.          |
00001860  20 20 7c 20 63 68 61 6e  67 65 20 74 68 65 20 50  |  | change the P|
00001870  53 52 20 66 6c 61 67 73  20 62 79 20 61 63 63 69  |SR flags by acci|
00001880  64 65 6e 74 2e 0a 20 20  20 20 20 20 20 20 20 20  |dent..          |
00001890  20 20 7c 0a 20 20 20 20  20 20 20 20 20 20 20 20  |  |.            |
000018a0  7c 0a 20 20 20 20 20 20  20 20 20 20 20 20 7c 20  ||.            | |
000018b0  55 6e 6c 69 6b 65 20 4f  53 5f 43 6c 61 69 6d 2c  |Unlike OS_Claim,|
000018c0  20 74 68 69 73 20 53 57  49 20 77 69 6c 6c 20 6e  | this SWI will n|
000018d0  6f 74 20 72 65 6d 6f 76  65 20 70 72 65 76 69 6f  |ot remove previo|
000018e0  75 73 20 69 6e 73 74 61  6e 63 65 73 20 6f 66 0a  |us instances of.|
000018f0  20 20 20 20 20 20 20 20  20 20 20 20 7c 20 63 6c  |            | cl|
00001900  61 69 6d 73 20 77 69 74  68 20 74 68 65 20 73 61  |aims with the sa|
00001910  6d 65 20 76 61 6c 75 65  73 2e 20 54 68 65 20 72  |me values. The r|
00001920  65 6c 65 61 73 65 20 72  6f 75 74 69 6e 65 20 61  |elease routine a|
00001930  6c 73 6f 20 6f 6e 6c 79  0a 20 20 20 20 20 20 20  |lso only.       |
00001940  20 20 20 20 20 7c 20 72  65 6d 6f 76 65 73 20 6f  |     | removes o|
00001950  6e 65 20 69 6e 73 74 61  6e 63 65 20 6f 66 20 74  |ne instance of t|
00001960  68 65 20 76 61 6c 75 65  73 20 61 74 20 61 20 74  |he values at a t|
00001970  69 6d 65 2e 0a 20 20 20  20 20 20 20 20 20 20 20  |ime..           |
00001980  20 7c 0a 20 20 20 20 20  20 20 20 20 20 20 20 7c  | |.            ||
00001990  20 43 6c 61 69 6d 69 6e  67 20 74 68 65 20 57 69  | Claiming the Wi|
000019a0  6d 70 5f 52 65 67 69 73  74 65 72 46 69 6c 74 65  |mp_RegisterFilte|
000019b0  72 20 53 57 49 20 6f 6e  6c 79 20 74 72 61 70 73  |r SWI only traps|
000019c0  20 74 68 65 20 6e 6f 72  6d 61 6c 0a 20 20 20 20  | the normal.    |
000019d0  20 20 20 20 20 20 20 20  7c 20 66 69 6c 74 65 72  |        | filter|
000019e0  2d 62 61 73 65 64 20 75  73 65 20 6f 66 20 74 68  |-based use of th|
000019f0  65 20 53 57 49 2e 20 55  6e 64 65 72 20 6e 6f 20  |e SWI. Under no |
00001a00  63 69 72 63 75 6d 73 74  61 6e 63 65 73 20 73 68  |circumstances sh|
00001a10  6f 75 6c 64 20 79 6f 75  0a 20 20 20 20 20 20 20  |ould you.       |
00001a20  20 20 20 20 20 7c 20 63  61 6c 6c 20 57 69 6d 70  |     | call Wimp|
00001a30  5f 52 65 67 69 73 74 65  72 46 69 6c 74 65 72 20  |_RegisterFilter |
00001a40  77 69 74 68 20 57 69 6d  70 53 57 49 56 65 20 75  |with WimpSWIVe u|
00001a50  73 61 67 65 20 69 6e 20  79 6f 75 72 20 74 72 61  |sage in your tra|
00001a60  70 70 69 6e 67 0a 20 20  20 20 20 20 20 20 20 20  |pping.          |
00001a70  20 20 7c 20 63 6f 64 65  2e 20 49 66 20 79 6f 75  |  | code. If you|
00001a80  20 72 65 61 6c 6c 79 20  6d 75 73 74 20 63 6c 61  | really must cla|
00001a90  69 6d 20 6f 72 20 72 65  6c 65 61 73 65 20 61 20  |im or release a |
00001aa0  53 57 49 20 77 68 65 6e  20 73 6f 6d 65 20 6f 74  |SWI when some ot|
00001ab0  68 65 72 0a 20 20 20 20  20 20 20 20 20 20 20 20  |her.            |
00001ac0  7c 20 53 57 49 20 69 73  20 65 78 65 63 75 74 65  || SWI is execute|
00001ad0  64 2c 20 75 73 65 20 61  20 43 61 6c 6c 42 61 63  |d, use a CallBac|
00001ae0  6b 20 74 6f 20 64 6f 20  69 74 2e 20 28 53 65 65  |k to do it. (See|
00001af0  20 74 68 65 20 52 49 53  43 20 4f 53 20 33 0a 20  | the RISC OS 3. |
00001b00  20 20 20 20 20 20 20 20  20 20 20 7c 20 50 72 6f  |           | Pro|
00001b10  67 72 61 6d 6d 65 72 73  91 20 52 65 66 65 72 65  |grammers. Refere|
00001b20  6e 63 65 20 4d 61 6e 75  61 6c 2c 20 70 61 67 65  |nce Manual, page|
00001b30  20 31 2d 33 31 39 2e 29  0a 20 20 20 20 20 20 20  | 1-319.).       |
00001b40  20 20 20 20 20 7c 0a 20  20 20 20 20 20 20 20 20  |     |.         |
00001b50  20 20 20 7c 20 4e 42 3a  20 59 6f 75 20 73 68 6f  |   | NB: You sho|
00001b60  75 6c 64 20 4e 4f 54 20  70 6f 73 74 2d 74 72 61  |uld NOT post-tra|
00001b70  70 20 57 69 6d 70 5f 50  6f 6c 6c 20 6f 72 20 57  |p Wimp_Poll or W|
00001b80  69 6d 70 5f 53 74 61 72  74 54 61 73 6b 2e 0a 20  |imp_StartTask.. |
00001b90  20 20 20 20 20 20 20 20  20 20 20 7c 20 28 4f 72  |           | (Or|
00001ba0  20 57 69 6d 70 5f 50 6f  6c 6c 49 64 6c 65 2e 29  | Wimp_PollIdle.)|
00001bb0  20 54 72 61 70 70 69 6e  67 20 57 69 6d 70 5f 50  | Trapping Wimp_P|
00001bc0  6f 6c 6c 20 69 73 20 65  61 73 79 20 61 6e 79 77  |oll is easy anyw|
00001bd0  61 79 2c 20 75 73 69 6e  67 0a 20 20 20 20 20 20  |ay, using.      |
00001be0  20 20 20 20 20 20 7c 20  74 68 65 20 6f 6c 64 20  |      | the old |
00001bf0  66 69 6c 74 65 72 20 73  79 73 74 65 6d 2e 0a 20  |filter system.. |
00001c00  20 20 20 20 20 20 20 20  20 20 20 7c 0a 20 20 20  |           |.   |
00001c10  20 45 72 72 6f 72 73 3a  20 7c 20 42 61 64 20 76  | Errors: | Bad v|
00001c20  61 6c 75 65 20 70 61 73  73 65 64 20 74 6f 20 57  |alue passed to W|
00001c30  49 4d 50 20 69 6e 20 52  30 0a 20 20 20 20 20 20  |IMP in R0.      |
00001c40  20 20 20 20 20 20 7c 20  20 20 20 69 66 20 57 69  |      |    if Wi|
00001c50  6d 70 53 57 49 56 65 20  69 73 20 6e 6f 74 20 6c  |mpSWIVe is not l|
00001c60  6f 61 64 65 64 2c 20 74  68 65 20 61 74 74 65 6d  |oaded, the attem|
00001c70  70 74 20 74 6f 20 75 73  65 20 74 68 69 73 20 53  |pt to use this S|
00001c80  57 49 20 69 6e 0a 20 20  20 20 20 20 20 20 20 20  |WI in.          |
00001c90  20 20 7c 20 20 20 20 74  68 65 20 57 69 6d 70 53  |  |    the WimpS|
00001ca0  57 49 56 65 20 6d 61 6e  6e 65 72 20 77 69 6c 6c  |WIVe manner will|
00001cb0  20 63 61 75 73 65 20 74  68 69 73 20 65 72 72 6f  | cause this erro|
00001cc0  72 0a 20 20 20 20 20 20  20 20 20 20 20 20 7c 20  |r.            | |
00001cd0  42 61 64 20 57 69 6d 70  53 57 49 56 65 20 72 65  |Bad WimpSWIVe re|
00001ce0  6c 65 61 73 65 0a 20 20  20 20 20 20 20 20 20 20  |lease.          |
00001cf0  20 20 7c 20 20 20 20 72  65 6c 65 61 73 69 6e 67  |  |    releasing|
00001d00  20 61 20 53 57 49 20 79  6f 75 20 68 61 64 20 6e  | a SWI you had n|
00001d10  6f 74 20 63 6c 61 69 6d  65 64 20 67 65 6e 65 72  |ot claimed gener|
00001d20  61 74 65 73 20 74 68 69  73 20 65 72 72 6f 72 0a  |ates this error.|
00001d30  20 20 20 20 20 20 20 20  20 20 20 20 7c 20 4e 6f  |            | No|
00001d40  20 72 6f 6f 6d 20 69 6e  20 52 4d 41 0a 20 20 20  | room in RMA.   |
00001d50  20 20 20 20 20 20 20 20  20 7c 20 20 20 20 69 73  |         |    is|
00001d60  20 61 6c 73 6f 20 70 6f  73 73 69 62 6c 65 20 62  | also possible b|
00001d70  75 74 20 68 69 67 68 6c  79 20 75 6e 6c 69 6b 65  |ut highly unlike|
00001d80  6c 79 2e 0a 20 20 20 20  20 20 20 20 20 20 20 20  |ly..            |
00001d90  7c 0a 0a 0a 20 46 6f 6f  74 6e 6f 74 65 20 31 20  ||... Footnote 1 |
00001da0  2d 20 52 65 2d 65 6e 74  72 61 6e 63 79 20 69 73  |- Re-entrancy is|
00001db0  73 75 65 73 3a 0a 0a 20  52 65 2d 65 6e 74 72 61  |sues:.. Re-entra|
00001dc0  6e 63 79 20 69 73 20 6e  61 65 20 70 72 6f 62 6c  |ncy is nae probl|
00001dd0  65 6d 20 69 66 20 79 6f  75 20 6f 6e 6c 79 20 75  |em if you only u|
00001de0  73 65 20 70 72 65 2d 74  72 61 70 70 69 6e 67 20  |se pre-trapping |
00001df0  6f 72 20 6f 6e 6c 79 20  75 73 65 20 70 6f 73 74  |or only use post|
00001e00  2d 0a 74 72 61 70 70 69  6e 67 20 2d 20 79 6f 75  |-.trapping - you|
00001e10  20 63 61 6e 20 65 69 74  68 65 72 20 62 65 20 72  | can either be r|
00001e20  65 2d 65 6e 74 72 61 6e  74 20 62 79 20 75 73 69  |e-entrant by usi|
00001e30  6e 67 20 61 20 73 74 61  63 6b 20 74 6f 20 73 74  |ng a stack to st|
00001e40  6f 72 65 20 73 74 75 66  66 2c 20 6f 72 0a 70 72  |ore stuff, or.pr|
00001e50  65 76 65 6e 74 20 72 65  2d 65 6e 74 65 72 69 6e  |event re-enterin|
00001e60  67 20 75 73 69 6e 67 20  61 20 74 68 72 65 61 64  |g using a thread|
00001e70  65 64 20 66 6c 61 67 20  28 61 6e 64 20 75 6e 6c  |ed flag (and unl|
00001e80  65 73 73 20 79 6f 75 20  63 61 6c 6c 20 61 20 53  |ess you call a S|
00001e90  57 49 2c 20 79 6f 75 0a  63 61 6e 6e 6f 74 20 62  |WI, you.cannot b|
00001ea0  65 20 72 65 2d 65 6e 74  65 72 65 64 20 61 6e 79  |e re-entered any|
00001eb0  77 61 79 29 2e 20 49 66  20 79 6f 75 20 75 73 65  |way). If you use|
00001ec0  20 62 6f 74 68 2c 20 62  75 74 20 74 68 65 20 70  | both, but the p|
00001ed0  6f 73 74 2d 63 6f 64 65  20 61 6c 77 61 79 73 20  |ost-code always |
00001ee0  64 6f 65 73 0a 74 68 65  20 73 61 6d 65 20 72 65  |does.the same re|
00001ef0  67 61 72 64 6c 65 73 73  20 6f 66 20 74 68 65 20  |gardless of the |
00001f00  70 72 65 2d 63 6f 64 65  2c 20 79 6f 75 27 72 65  |pre-code, you're|
00001f10  20 61 6c 6c 20 72 69 67  68 74 20 74 6f 6f 2e 0a  | all right too..|
00001f20  0a 20 42 75 74 20 69 66  20 79 6f 75 20 75 73 65  |. But if you use|
00001f30  20 62 6f 74 68 20 61 74  20 6f 6e 63 65 20 61 6e  | both at once an|
00001f40  64 20 74 68 65 20 61 63  74 69 6f 6e 20 6f 66 20  |d the action of |
00001f50  70 6f 73 74 20 64 65 70  65 6e 64 73 20 6f 6e 20  |post depends on |
00001f60  73 6f 6d 65 74 68 69 6e  67 0a 74 68 61 74 20 68  |something.that h|
00001f70  61 70 70 65 6e 65 64 20  69 6e 20 70 72 65 20 28  |appened in pre (|
00001f80  66 6f 72 20 65 78 61 6d  70 6c 65 20 69 66 20 79  |for example if y|
00001f90  6f 75 20 68 61 76 65 20  70 72 65 20 74 6f 20 63  |ou have pre to c|
00001fa0  68 65 63 6b 20 74 68 65  20 72 65 61 73 6f 6e 20  |heck the reason |
00001fb0  63 6f 64 65 0a 69 73 20  77 6f 72 74 68 20 62 6f  |code.is worth bo|
00001fc0  74 68 65 72 69 6e 67 20  77 69 74 68 20 69 6e 20  |thering with in |
00001fd0  74 68 65 20 70 6f 73 74  2d 74 72 61 70 20 63 6f  |the post-trap co|
00001fe0  64 65 29 2c 20 69 74 20  69 73 20 73 6c 69 67 68  |de), it is sligh|
00001ff0  74 6c 79 20 6d 6f 72 65  20 63 6f 6d 70 6c 65 78  |tly more complex|
00002000  2e 0a 49 74 27 73 20 71  75 69 74 65 20 70 6f 73  |..It's quite pos|
00002010  73 69 62 6c 65 20 74 68  61 74 20 63 61 6c 6c 69  |sible that calli|
00002020  6e 67 20 61 20 57 69 6d  70 20 53 57 49 20 6d 61  |ng a Wimp SWI ma|
00002030  79 20 63 61 75 73 65 20  61 6e 6f 74 68 65 72 20  |y cause another |
00002040  57 69 6d 70 20 53 57 49  20 74 6f 20 62 65 0a 63  |Wimp SWI to be.c|
00002050  61 6c 6c 65 64 2c 20 65  73 70 65 63 69 61 6c 6c  |alled, especiall|
00002060  79 20 77 68 65 6e 20 79  6f 75 20 63 6f 6e 73 69  |y when you consi|
00002070  64 65 72 20 74 68 65 72  65 20 63 61 6e 20 62 65  |der there can be|
00002080  20 6d 61 6e 79 20 57 69  6d 70 53 57 49 56 65 20  | many WimpSWIVe |
00002090  63 6c 61 69 6d 61 6e 74  73 2e 0a 43 6f 6e 73 69  |claimants..Consi|
000020a0  64 65 72 3a 0a 0a 20 20  20 20 20 53 57 49 20 57  |der:..     SWI W|
000020b0  69 6d 70 5f 54 68 69 6e  67 20 63 61 6c 6c 65 64  |imp_Thing called|
000020c0  0a 20 20 20 20 20 20 20  57 69 6d 70 53 57 49 56  |.       WimpSWIV|
000020d0  65 20 63 6c 61 69 6d 61  6e 74 20 31 20 70 72 65  |e claimant 1 pre|
000020e0  2d 74 72 61 70 73 20 53  57 49 0a 20 20 20 20 20  |-traps SWI.     |
000020f0  20 20 20 20 43 6c 61 69  6d 61 6e 74 20 31 20 73  |    Claimant 1 s|
00002100  74 6f 72 65 20 64 61 74  61 20 66 6f 72 20 53 57  |tore data for SW|
00002110  49 20 31 20 69 6e 20 77  6f 72 6b 73 70 61 63 65  |I 1 in workspace|
00002120  0a 20 20 20 20 20 20 20  57 69 6d 70 53 57 49 56  |.       WimpSWIV|
00002130  65 20 63 6c 61 69 6d 61  6e 74 20 32 20 70 72 65  |e claimant 2 pre|
00002140  2d 74 72 61 70 73 20 53  57 49 0a 20 20 20 20 20  |-traps SWI.     |
00002150  20 20 20 20 43 6c 61 69  6d 61 6e 74 20 32 20 65  |    Claimant 2 e|
00002160  78 65 63 75 74 65 73 20  57 69 6d 70 5f 47 75 62  |xecutes Wimp_Gub|
00002170  62 69 6e 73 0a 20 20 20  20 20 20 20 20 20 20 20  |bins.           |
00002180  57 69 6d 70 5f 47 75 62  62 69 6e 73 20 63 61 75  |Wimp_Gubbins cau|
00002190  73 65 73 20 57 69 6d 70  5f 54 68 69 6e 67 20 74  |ses Wimp_Thing t|
000021a0  6f 20 62 65 20 63 61 6c  6c 65 64 0a 20 20 20 20  |o be called.    |
000021b0  20 20 20 20 20 20 20 20  20 57 69 6d 70 53 57 49  |         WimpSWI|
000021c0  56 65 20 63 6c 61 69 6d  61 6e 74 20 31 20 70 72  |Ve claimant 1 pr|
000021d0  65 2d 74 72 61 70 73 20  53 57 49 0a 20 20 20 20  |e-traps SWI.    |
000021e0  20 20 20 20 20 20 20 20  20 20 20 43 6c 61 69 6d  |           Claim|
000021f0  61 6e 74 20 31 20 73 74  6f 72 65 73 20 64 61 74  |ant 1 stores dat|
00002200  61 20 66 6f 72 20 53 57  49 20 32 20 69 6e 20 77  |a for SWI 2 in w|
00002210  6f 72 6b 73 70 61 63 65  0a 20 20 20 20 20 20 20  |orkspace.       |
00002220  20 20 20 20 20 20 57 69  6d 70 53 57 49 56 65 20  |      WimpSWIVe |
00002230  63 6c 61 69 6d 61 6e 74  20 32 20 70 72 65 2d 74  |claimant 2 pre-t|
00002240  72 61 70 73 20 53 57 49  0a 20 20 20 20 20 20 20  |raps SWI.       |
00002250  20 20 20 20 20 20 20 20  43 6c 61 69 6d 61 6e 74  |        Claimant|
00002260  20 32 20 69 73 20 74 68  72 65 61 64 65 64 2c 20  | 2 is threaded, |
00002270  61 6e 64 20 73 6f 20 64  6f 65 73 20 6e 6f 74 68  |and so does noth|
00002280  69 6e 67 0a 20 20 20 20  20 20 20 20 20 20 20 20  |ing.            |
00002290  20 57 69 6d 70 53 57 49  56 65 20 65 78 65 63 75  | WimpSWIVe execu|
000022a0  74 65 73 20 72 65 61 6c  20 53 57 49 20 57 69 6d  |tes real SWI Wim|
000022b0  70 5f 54 68 69 6e 67 0a  20 20 20 20 20 20 20 20  |p_Thing.        |
000022c0  20 20 20 20 20 57 69 6d  70 53 57 49 56 65 20 63  |     WimpSWIVe c|
000022d0  6c 61 69 6d 61 6e 74 20  32 20 70 6f 73 74 2d 74  |laimant 2 post-t|
000022e0  72 61 70 73 20 53 57 49  0a 20 20 20 20 20 20 20  |raps SWI.       |
000022f0  20 20 20 20 20 20 20 20  43 6c 61 69 6d 61 6e 74  |        Claimant|
00002300  20 32 20 69 73 20 74 68  72 65 61 64 65 64 2c 20  | 2 is threaded, |
00002310  61 6e 64 20 73 6f 20 64  6f 65 73 20 6e 6f 74 68  |and so does noth|
00002320  69 6e 67 0a 20 20 20 20  20 20 20 20 20 20 20 20  |ing.            |
00002330  20 57 69 6d 70 53 57 49  56 65 20 63 6c 61 69 6d  | WimpSWIVe claim|
00002340  61 6e 74 20 31 20 70 6f  73 74 2d 74 72 61 70 73  |ant 1 post-traps|
00002350  20 53 57 49 0a 20 20 20  20 20 20 20 20 20 20 20  | SWI.           |
00002360  20 20 20 20 43 6c 61 69  6d 61 6e 74 20 31 20 70  |    Claimant 1 p|
00002370  65 72 66 6f 72 6d 73 20  61 63 74 69 6f 6e 20 6f  |erforms action o|
00002380  6e 20 72 65 73 75 6c 74  73 2c 20 64 65 70 65 6e  |n results, depen|
00002390  64 65 6e 74 20 6f 6e 20  77 6f 72 6b 73 70 61 63  |dent on workspac|
000023a0  65 0a 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |e.              |
000023b0  20 77 68 69 63 68 20 68  6f 6c 64 73 20 64 61 74  | which holds dat|
000023c0  61 20 66 6f 72 20 53 57  49 20 32 0a 20 20 20 20  |a for SWI 2.    |
000023d0  20 20 20 20 20 20 20 20  20 57 69 6d 70 53 57 49  |         WimpSWI|
000023e0  56 65 20 72 65 74 75 72  6e 73 0a 20 20 20 20 20  |Ve returns.     |
000023f0  20 20 57 69 6d 70 53 57  49 56 65 20 65 78 65 63  |  WimpSWIVe exec|
00002400  75 74 65 73 20 72 65 61  6c 20 57 69 6d 70 5f 54  |utes real Wimp_T|
00002410  68 69 6e 67 20 53 57 49  0a 20 20 20 20 20 20 20  |hing SWI.       |
00002420  57 69 6d 70 53 57 49 56  65 20 63 6c 61 69 6d 61  |WimpSWIVe claima|
00002430  6e 74 20 32 20 70 6f 73  74 2d 74 72 61 70 73 20  |nt 2 post-traps |
00002440  53 57 49 0a 20 20 20 20  20 20 20 20 20 43 6c 61  |SWI.         Cla|
00002450  69 6d 61 6e 74 20 32 20  64 6f 65 73 20 77 68 61  |imant 2 does wha|
00002460  74 65 76 65 72 20 69 74  20 6e 65 65 64 73 20 74  |tever it needs t|
00002470  6f 20 77 69 74 68 20 72  65 73 75 6c 74 73 0a 20  |o with results. |
00002480  20 20 20 20 20 20 57 69  6d 70 53 57 49 56 65 20  |      WimpSWIVe |
00002490  63 6c 61 69 6d 61 6e 74  20 31 20 70 6f 73 74 2d  |claimant 1 post-|
000024a0  74 72 61 70 73 20 53 57  49 0a 20 20 20 20 20 20  |traps SWI.      |
000024b0  20 20 20 43 6c 61 69 6d  61 6e 74 20 31 20 70 65  |   Claimant 1 pe|
000024c0  72 66 6f 72 6d 73 20 61  63 74 69 6f 6e 20 6f 6e  |rforms action on|
000024d0  20 72 65 73 75 6c 74 73  2c 20 64 65 70 65 6e 64  | results, depend|
000024e0  65 6e 74 20 6f 6e 20 77  6f 72 6b 73 70 61 63 65  |ent on workspace|
000024f0  0a 20 20 20 20 20 20 20  20 20 77 68 69 63 68 20  |.         which |
00002500  68 6f 6c 64 73 20 64 61  74 61 20 66 6f 72 20 53  |holds data for S|
00002510  57 49 20 2a 32 2a 0a 20  20 20 20 20 20 20 57 69  |WI *2*.       Wi|
00002520  6d 70 53 57 49 56 65 20  72 65 74 75 72 6e 73 0a  |mpSWIVe returns.|
00002530  0a 20 41 73 20 79 6f 75  20 63 61 6e 20 73 65 65  |. As you can see|
00002540  2c 20 74 68 65 72 65 20  69 73 20 61 20 6c 6f 74  |, there is a lot|
00002550  20 6f 66 20 73 63 6f 70  65 20 68 65 72 65 20 66  | of scope here f|
00002560  6f 72 20 74 68 69 6e 67  73 20 67 6f 69 6e 67 20  |or things going |
00002570  77 72 6f 6e 67 2c 20 61  6e 64 0a 68 6f 72 72 69  |wrong, and.horri|
00002580  62 6c 65 20 63 6c 61 73  68 65 73 20 77 68 65 72  |ble clashes wher|
00002590  65 20 6f 6e 65 20 57 69  6d 70 53 57 49 56 65 20  |e one WimpSWIVe |
000025a0  70 72 6f 67 72 61 6d 20  6d 61 79 20 6d 61 6b 65  |program may make|
000025b0  20 61 6e 6f 74 68 65 72  20 67 6f 20 77 72 6f 6e  | another go wron|
000025c0  67 2c 0a 70 6f 74 65 6e  74 69 61 6c 6c 79 20 72  |g,.potentially r|
000025d0  61 74 68 65 72 20 6d 65  73 73 69 6c 79 2e 0a 0a  |ather messily...|
000025e0  20 54 68 65 72 65 20 61  72 65 20 74 77 6f 20 74  | There are two t|
000025f0  68 69 6e 67 73 20 79 6f  75 20 63 61 6e 20 64 6f  |hings you can do|
00002600  20 61 62 6f 75 74 20 69  74 2e 20 50 65 72 68 61  | about it. Perha|
00002610  70 73 20 74 68 65 20 62  65 73 74 20 69 73 20 74  |ps the best is t|
00002620  6f 20 73 74 6f 72 65 20  61 0a 27 63 6f 75 6e 74  |o store a.'count|
00002630  27 20 6f 66 20 70 6f 73  74 2d 74 72 61 70 73 20  |' of post-traps |
00002640  74 6f 20 69 67 6e 6f 72  65 2e 20 54 68 69 73 20  |to ignore. This |
00002650  63 6f 75 6e 74 20 73 68  6f 75 6c 64 20 62 65 20  |count should be |
00002660  7a 65 72 6f 20 69 6e 69  74 69 61 6c 6c 79 2c 20  |zero initially, |
00002670  61 6e 64 0a 73 68 6f 75  6c 64 20 62 65 20 69 6e  |and.should be in|
00002680  63 72 65 6d 65 6e 74 65  64 20 66 69 72 73 74 20  |cremented first |
00002690  77 68 65 6e 20 79 6f 75  72 20 70 72 65 2d 74 72  |when your pre-tr|
000026a0  61 70 20 63 6f 64 65 20  64 65 74 65 63 74 73 20  |ap code detects |
000026b0  74 68 61 74 20 70 6f 73  74 2d 0a 74 72 61 70 70  |that post-.trapp|
000026c0  69 6e 67 20 73 68 6f 75  6c 64 20 64 6f 20 73 6f  |ing should do so|
000026d0  6d 65 74 68 69 6e 67 20  65 66 66 65 63 74 69 76  |mething effectiv|
000026e0  65 2e 20 49 74 20 73 68  6f 75 6c 64 20 61 6c 73  |e. It should als|
000026f0  6f 20 62 65 20 69 6e 63  72 65 6d 65 6e 74 65 64  |o be incremented|
00002700  20 65 76 65 72 79 0a 74  69 6d 65 20 74 68 65 20  | every.time the |
00002710  70 72 65 2d 74 72 61 70  20 63 6f 64 65 20 69 73  |pre-trap code is|
00002720  20 65 6e 74 65 72 65 64  20 77 69 74 68 20 74 68  | entered with th|
00002730  65 20 63 6f 75 6e 74 20  6e 6f 6e 2d 7a 65 72 6f  |e count non-zero|
00002740  2e 20 54 68 65 20 70 6f  73 74 20 74 72 61 70 20  |. The post trap |
00002750  63 6f 64 65 0a 74 68 65  6e 20 63 68 65 63 6b 73  |code.then checks|
00002760  20 74 68 65 20 63 6f 75  6e 74 20 6f 6e 20 65 6e  | the count on en|
00002770  74 72 79 2e 20 49 66 20  74 68 65 20 63 6f 75 6e  |try. If the coun|
00002780  74 20 69 73 20 7a 65 72  6f 2c 20 69 74 20 72 65  |t is zero, it re|
00002790  74 75 72 6e 73 20 64 6f  69 6e 67 0a 6e 6f 74 68  |turns doing.noth|
000027a0  69 6e 67 2e 20 49 66 20  74 68 65 20 63 6f 75 6e  |ing. If the coun|
000027b0  74 20 69 73 20 6f 6e 65  20 6f 72 20 67 72 65 61  |t is one or grea|
000027c0  74 65 72 2c 20 74 68 65  20 63 6f 75 6e 74 20 69  |ter, the count i|
000027d0  73 20 64 65 63 72 65 6d  65 6e 74 65 64 2e 20 49  |s decremented. I|
000027e0  66 20 74 68 65 0a 63 6f  75 6e 74 20 69 73 20 6f  |f the.count is o|
000027f0  6e 65 20 65 78 61 63 74  6c 79 20 6f 6e 65 2c 20  |ne exactly one, |
00002800  74 68 65 20 65 66 66 65  63 74 20 6f 66 20 74 68  |the effect of th|
00002810  65 20 70 6f 73 74 2d 74  72 61 70 20 69 73 20 61  |e post-trap is a|
00002820  63 74 69 76 61 74 65 64  2e 20 54 68 65 72 65 27  |ctivated. There'|
00002830  73 0a 61 6e 20 65 78 61  6d 70 6c 65 20 6f 66 20  |s.an example of |
00002840  74 68 69 73 20 69 6e 20  74 68 65 20 45 69 67 65  |this in the Eige|
00002850  6e 53 79 73 49 6e 66 6f  20 73 6f 75 72 63 65 2e  |nSysInfo source.|
00002860  0a 0a 20 54 68 69 73 20  69 73 20 66 69 6e 65 20  |.. This is fine |
00002870  6e 6f 72 6d 61 6c 6c 79  2c 20 62 75 74 20 69 74  |normally, but it|
00002880  20 6d 61 6b 65 73 20 74  68 65 20 74 72 61 70 70  | makes the trapp|
00002890  69 6e 67 20 63 6f 64 65  20 6f 6e 6c 79 20 61 66  |ing code only af|
000028a0  66 65 63 74 20 74 68 65  20 66 69 72 73 74 0a 53  |fect the first.S|
000028b0  57 49 20 74 6f 20 62 65  20 61 66 66 65 63 74 65  |WI to be affecte|
000028c0  64 20 28 74 68 65 20 22  6f 75 74 65 72 6d 6f 73  |d (the "outermos|
000028d0  74 22 20 61 66 66 65 63  74 65 64 20 53 57 49 29  |t" affected SWI)|
000028e0  2e 20 49 66 20 79 6f 75  20 77 61 6e 74 20 74 6f  |. If you want to|
000028f0  20 62 65 20 74 72 75 6c  79 0a 72 65 2d 65 6e 74  | be truly.re-ent|
00002900  72 61 6e 74 2c 20 79 6f  75 27 64 20 68 61 76 65  |rant, you'd have|
00002910  20 74 6f 20 73 74 6f 72  65 20 76 61 6c 75 65 73  | to store values|
00002920  20 6f 6e 20 74 68 65 20  73 74 61 63 6b 20 74 6f  | on the stack to|
00002930  20 69 6e 64 69 63 61 74  65 20 77 68 65 74 68 65  | indicate whethe|
00002940  72 20 74 6f 0a 70 6f 73  74 2d 74 72 61 70 20 6f  |r to.post-trap o|
00002950  6e 20 65 61 63 68 20 63  61 6c 6c 2e 20 41 6e 64  |n each call. And|
00002960  20 79 6f 75 20 63 6f 75  6c 64 6e 27 74 20 75 73  | you couldn't us|
00002970  65 20 74 68 65 20 53 56  43 20 73 74 61 63 6b 2c  |e the SVC stack,|
00002980  20 73 6f 20 79 6f 75 27  64 20 68 61 76 65 20 74  | so you'd have t|
00002990  6f 0a 75 73 65 20 61 20  70 72 69 76 61 74 65 20  |o.use a private |
000029a0  73 74 61 63 6b 2e 20 41  6e 64 20 79 6f 75 27 64  |stack. And you'd|
000029b0  20 68 61 76 65 20 74 6f  20 72 65 76 65 72 74 20  | have to revert |
000029c0  74 6f 20 74 68 65 20 61  62 6f 76 65 20 62 65 68  |to the above beh|
000029d0  61 76 69 6f 75 72 20 69  66 20 74 68 65 0a 73 74  |aviour if the.st|
000029e0  61 63 6b 20 77 61 73 20  66 69 6c 6c 65 64 20 75  |ack was filled u|
000029f0  70 2e 20 54 68 65 72 65  66 6f 72 65 2c 20 49 20  |p. Therefore, I |
00002a00  64 6f 6e 27 74 20 72 65  63 6b 6f 6e 20 69 74 27  |don't reckon it'|
00002a10  73 20 77 6f 72 74 68 20  62 6f 74 68 65 72 69 6e  |s worth botherin|
00002a20  67 20 77 69 74 68 2c 0a  65 73 70 65 63 69 61 6c  |g with,.especial|
00002a30  6c 79 20 61 73 20 61 6c  6c 6f 77 69 6e 67 20 74  |ly as allowing t|
00002a40  72 75 65 20 72 65 2d 65  6e 74 72 61 6e 63 79 20  |rue re-entrancy |
00002a50  6f 70 65 6e 73 20 74 68  65 20 64 6f 6f 72 20 74  |opens the door t|
00002a60  6f 20 72 65 63 75 72 73  69 76 65 20 70 72 6f 62  |o recursive prob|
00002a70  6c 65 6d 73 0a 28 57 69  6d 70 5f 54 68 69 6e 67  |lems.(Wimp_Thing|
00002a80  20 63 61 6c 6c 73 20 57  69 6d 70 5f 47 75 62 62  | calls Wimp_Gubb|
00002a90  69 6e 73 20 63 61 6c 6c  73 20 57 69 6d 70 5f 54  |ins calls Wimp_T|
00002aa0  68 69 6e 67 20 63 61 6c  6c 73 20 57 69 6d 70 5f  |hing calls Wimp_|
00002ab0  47 75 62 62 69 6e 73 20  65 74 63 2e 29 20 74 6f  |Gubbins etc.) to|
00002ac0  6f 2e 0a 0a 20 53 6f 72  72 79 20 61 62 6f 75 74  |o... Sorry about|
00002ad0  20 74 68 65 20 63 6f 6d  70 6c 65 78 69 74 79 20  | the complexity |
00002ae0  6f 66 20 74 68 69 73 20  66 6f 6f 74 6e 6f 74 65  |of this footnote|
00002af0  2e 20 52 65 6c 61 78 2e  20 59 6f 75 20 64 6f 6e  |. Relax. You don|
00002b00  27 74 20 6e 65 65 64 20  74 6f 0a 62 6f 74 68 65  |'t need to.bothe|
00002b10  72 20 61 62 6f 75 74 20  61 6c 6c 20 74 68 69 73  |r about all this|
00002b20  20 68 6f 72 72 69 64 20  73 74 75 66 66 2c 20 75  | horrid stuff, u|
00002b30  73 75 61 6c 6c 79 2e 20  3a 2d 29 0a 0a 0a 20 46  |sually. :-)... F|
00002b40  6f 6f 74 6e 6f 74 65 20  32 3a 0a 0a 20 59 6f 75  |ootnote 2:.. You|
00002b50  72 20 70 6f 73 74 2d 74  72 61 70 20 63 6f 64 65  |r post-trap code|
00002b60  20 77 69 6c 6c 20 6f 6e  6c 79 20 62 65 20 63 61  | will only be ca|
00002b70  6c 6c 65 64 20 69 66 20  74 68 65 20 53 57 49 20  |lled if the SWI |
00002b80  64 6f 65 73 20 72 65 74  75 72 6e 2e 20 54 68 69  |does return. Thi|
00002b90  73 20 6d 69 67 68 74 0a  6e 6f 74 20 68 61 70 70  |s might.not happ|
00002ba0  65 6e 20 69 66 20 74 68  65 20 53 57 49 20 69 73  |en if the SWI is|
00002bb0  20 6f 6e 65 20 74 68 61  74 20 64 6f 65 73 6e 27  | one that doesn'|
00002bc0  74 20 72 65 74 75 72 6e  20 28 62 75 74 20 49 20  |t return (but I |
00002bd0  63 61 6e 27 74 20 74 68  69 6e 6b 20 6f 66 20 61  |can't think of a|
00002be0  6e 79 0a 57 69 6d 70 5f  20 53 57 49 73 20 74 68  |ny.Wimp_ SWIs th|
00002bf0  61 74 20 64 6f 6e 27 74  29 2c 20 6f 72 20 69 66  |at don't), or if|
00002c00  20 61 20 73 65 72 69 6f  75 73 20 65 72 72 6f 72  | a serious error|
00002c10  20 68 61 70 70 65 6e 73  2e 20 54 68 65 20 6c 61  | happens. The la|
00002c20  74 74 65 72 20 73 68 6f  75 6c 64 0a 6e 65 76 65  |tter should.neve|
00002c30  72 20 68 61 70 70 65 6e  20 69 6e 20 61 20 70 65  |r happen in a pe|
00002c40  72 66 65 63 74 20 73 79  73 74 65 6d 2c 20 62 75  |rfect system, bu|
00002c50  74 20 62 75 67 73 20 68  61 70 70 65 6e 20 61 6e  |t bugs happen an|
00002c60  64 20 74 68 65 20 53 57  49 20 62 65 69 6e 67 20  |d the SWI being |
00002c70  74 72 61 70 70 65 64 0a  6d 69 67 68 74 20 62 72  |trapped.might br|
00002c80  61 6e 63 68 20 74 68 72  6f 75 67 68 20 7a 65 72  |anch through zer|
00002c90  6f 20 6f 72 20 73 6f 6d  65 74 68 69 6e 67 2e 20  |o or something. |
00002ca0  57 69 74 68 20 74 68 65  20 57 69 6d 70 2c 20 74  |With the Wimp, t|
00002cb0  68 6f 75 67 68 2c 20 61  20 63 72 61 73 68 20 61  |hough, a crash a|
00002cc0  74 0a 74 68 69 73 20 73  74 61 67 65 20 6f 66 74  |t.this stage oft|
00002cd0  65 6e 20 6d 65 61 6e 73  20 74 68 65 72 65 20 69  |en means there i|
00002ce0  73 20 73 6f 6d 65 74 68  69 6e 67 20 76 65 72 79  |s something very|
00002cf0  20 77 72 6f 6e 67 20 77  69 74 68 20 74 68 65 20  | wrong with the |
00002d00  77 68 6f 6c 65 20 64 65  73 6b 74 6f 70 0a 61 6e  |whole desktop.an|
00002d10  64 20 65 76 65 72 79 74  68 69 6e 67 20 69 73 20  |d everything is |
00002d20  67 6f 69 6e 67 20 74 6f  20 64 69 65 20 61 6e 79  |going to die any|
00002d30  77 61 79 2c 20 73 6f 20  79 6f 75 72 20 6d 6f 64  |way, so your mod|
00002d40  75 6c 65 20 66 61 69 6c  69 6e 67 20 74 6f 20 70  |ule failing to p|
00002d50  6f 73 74 2d 74 72 61 70  0a 69 73 20 75 6e 6c 69  |ost-trap.is unli|
00002d60  6b 65 6c 79 20 74 6f 20  61 6e 6e 6f 79 20 74 68  |kely to annoy th|
00002d70  65 20 75 73 65 72 20 6d  75 63 68 2e 20 3a 2d 29  |e user much. :-)|
00002d80  0a 0a 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |..--------------|
00002d90  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00002dc0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 0a  |---------------.|
00002dd0  0a 20 54 68 69 73 20 6d  6f 64 75 6c 65 20 69 73  |. This module is|
00002de0  20 73 75 70 70 6c 69 65  64 20 77 69 74 68 20 73  | supplied with s|
00002df0  6f 6d 65 20 65 78 61 6d  70 6c 65 20 70 72 6f 67  |ome example prog|
00002e00  72 61 6d 73 3a 0a 0a 20  2d 20 33 44 45 72 72 6f  |rams:.. - 3DErro|
00002e10  72 57 69 6e 64 6f 77 2e  20 54 68 69 73 20 69 73  |rWindow. This is|
00002e20  20 61 20 75 73 65 66 75  6c 20 6d 6f 64 75 6c 65  | a useful module|
00002e30  20 74 68 61 74 20 72 65  70 6c 61 63 65 73 20 74  | that replaces t|
00002e40  68 65 20 57 49 4d 50 91  73 20 65 72 72 6f 72 0a  |he WIMP.s error.|
00002e50  20 20 20 77 69 6e 64 6f  77 73 20 77 69 74 68 20  |   windows with |
00002e60  69 74 73 20 6f 77 6e 20  52 69 73 63 20 50 43 61  |its own Risc PCa|
00002e70  62 6c 65 20 33 44 20 6f  6e 65 73 20 28 69 74 20  |ble 3D ones (it |
00002e80  6e 65 65 64 73 20 33 44  45 72 72 6f 72 57 69 6e  |needs 3DErrorWin|
00002e90  64 6f 77 24 50 61 74 68  20 74 6f 0a 20 20 20 70  |dow$Path to.   p|
00002ea0  6f 69 6e 74 20 74 6f 20  61 20 64 69 72 65 63 74  |oint to a direct|
00002eb0  6f 72 79 20 63 6f 6e 74  61 69 6e 69 6e 67 20 54  |ory containing T|
00002ec0  65 6d 70 6c 61 74 65 73  20 61 6e 64 20 4d 65 73  |emplates and Mes|
00002ed0  73 61 67 65 73 20 2d 20  79 6f 75 20 63 61 6e 20  |sages - you can |
00002ee0  66 69 6e 64 20 6f 6e 65  0a 20 20 20 69 6e 20 53  |find one.   in S|
00002ef0  6f 75 72 63 65 73 2e 45  72 72 6f 72 57 69 6e 64  |ources.ErrorWind|
00002f00  29 20 75 73 69 6e 67 20  70 72 65 2d 74 72 61 70  |) using pre-trap|
00002f10  70 69 6e 67 20 28 75 73  75 61 6c 6c 79 20 77 69  |ping (usually wi|
00002f20  74 68 20 69 6e 74 65 72  63 65 70 74 69 6f 6e 29  |th interception)|
00002f30  2e 20 54 68 65 0a 20 20  20 77 69 6e 64 6f 77 73  |. The.   windows|
00002f40  20 63 6f 75 6c 64 20 64  6f 20 77 69 74 68 20 74  | could do with t|
00002f50  68 65 20 4e 65 77 65 72  4c 6f 6f 6b 20 27 74 69  |he NewerLook 'ti|
00002f60  74 6c 65 6a 6f 69 6e 74  27 20 73 70 72 69 74 65  |tlejoint' sprite|
00002f70  20 69 6e 20 74 68 65 20  77 69 6d 70 20 70 6f 6f  | in the wimp poo|
00002f80  6c 2c 0a 20 20 20 61 6c  6f 6e 67 20 77 69 74 68  |l,.   along with|
00002f90  20 74 68 65 20 52 69 73  63 20 50 43 20 65 72 72  | the Risc PC err|
00002fa0  6f 72 20 73 79 73 74 65  6d 20 73 70 72 69 74 65  |or system sprite|
00002fb0  73 2e 0a 20 2d 20 45 69  67 65 6e 53 79 73 49 6e  |s.. - EigenSysIn|
00002fc0  66 6f 2e 20 54 68 69 73  20 69 73 20 61 20 70 72  |fo. This is a pr|
00002fd0  65 74 74 79 20 75 73 65  6c 65 73 73 20 6f 6e 65  |etty useless one|
00002fe0  20 74 68 61 74 20 63 68  61 6e 67 65 73 20 57 69  | that changes Wi|
00002ff0  6d 70 5f 52 65 61 64 53  79 73 49 6e 66 6f 0a 20  |mp_ReadSysInfo. |
00003000  20 20 32 20 61 6c 77 61  79 73 20 74 6f 20 72 65  |  2 always to re|
00003010  74 75 72 6e 20 32 34 20  6f 72 20 32 32 2c 20 61  |turn 24 or 22, a|
00003020  6e 64 20 72 65 74 75 72  6e 20 74 68 65 20 6c 61  |nd return the la|
00003030  74 74 65 72 20 69 66 20  4c 6f 67 32 59 45 69 67  |tter if Log2YEig|
00003040  3c 32 20 28 74 68 65 0a  20 20 20 57 49 4d 50 20  |<2 (the.   WIMP |
00003050  72 65 74 75 72 6e 73 20  32 32 20 69 66 20 4c 6f  |returns 22 if Lo|
00003060  67 32 59 45 69 67 3d 3d  4c 6f 67 32 58 45 69 67  |g2YEig==Log2XEig|
00003070  2c 20 77 68 69 63 68 20  69 73 20 73 69 6c 6c 79  |, which is silly|
00003080  29 2e 20 49 74 20 61 6c  73 6f 20 67 6f 65 73 0a  |). It also goes.|
00003090  20 20 20 27 62 65 65 70  27 20 69 66 20 74 68 65  |   'beep' if the|
000030a0  20 57 69 6d 70 20 72 65  74 75 72 6e 65 64 20 61  | Wimp returned a|
000030b0  20 64 69 66 66 65 72 65  6e 74 20 76 61 6c 75 65  | different value|
000030c0  20 74 6f 20 69 74 20 28  74 72 79 20 6d 6f 64 65  | to it (try mode|
000030d0  20 32 32 20 61 6e 64 20  74 68 65 0a 20 20 20 6c  | 22 and the.   l|
000030e0  69 6b 65 29 2e 20 49 74  91 73 20 6e 6f 74 20 70  |ike). It.s not p|
000030f0  61 72 74 69 63 75 6c 61  72 6c 79 20 67 72 65 61  |articularly grea|
00003100  74 20 62 65 63 61 75 73  65 20 6d 6f 73 74 20 70  |t because most p|
00003110  72 6f 67 72 61 6d 73 20  64 6f 6e 91 74 20 74 61  |rograms don.t ta|
00003120  6b 65 20 61 6e 79 0a 20  20 20 6e 6f 74 69 63 65  |ke any.   notice|
00003130  20 6f 66 20 52 65 61 64  53 79 73 49 6e 66 6f 20  | of ReadSysInfo |
00003140  28 70 61 72 74 6c 79 20  62 65 63 61 75 73 65 20  |(partly because |
00003150  6f 66 20 69 74 73 20 61  66 6f 72 65 6d 65 6e 74  |of its aforement|
00003160  69 6f 6e 65 64 20 62 6f  62 62 69 6e 73 6e 65 73  |ioned bobbinsnes|
00003170  73 29 0a 20 20 20 62 75  74 20 69 74 20 73 68 6f  |s).   but it sho|
00003180  77 73 20 79 6f 75 20 68  6f 77 20 74 6f 20 70 72  |ws you how to pr|
00003190  65 2d 74 72 61 70 20 61  6e 64 20 70 6f 73 74 2d  |e-trap and post-|
000031a0  74 72 61 70 20 53 57 49  73 20 61 74 20 74 68 65  |trap SWIs at the|
000031b0  20 73 61 6d 65 20 74 69  6d 65 20 28 61 73 0a 20  | same time (as. |
000031c0  20 20 69 6e 20 66 6f 6f  74 6e 6f 74 65 20 31 29  |  in footnote 1)|
000031d0  2e 0a 0a 20 54 68 65 20  73 6f 75 72 63 65 20 66  |... The source f|
000031e0  6f 72 20 74 68 65 73 65  20 70 72 6f 67 72 61 6d  |or these program|
000031f0  73 2c 20 61 6c 6f 6e 67  20 77 69 74 68 20 74 68  |s, along with th|
00003200  65 20 66 75 6c 6c 20 73  6f 75 72 63 65 20 74 6f  |e full source to|
00003210  20 57 69 6d 70 53 57 49  56 65 20 61 6e 64 0a 73  | WimpSWIVe and.s|
00003220  6f 6d 65 20 72 65 73 6f  75 72 63 65 73 20 66 6f  |ome resources fo|
00003230  72 20 33 44 45 72 72 6f  72 57 69 6e 64 6f 77 20  |r 3DErrorWindow |
00003240  61 72 65 20 74 6f 20 62  65 20 66 6f 75 6e 64 20  |are to be found |
00003250  69 6e 20 74 68 65 20 53  6f 75 72 63 65 73 20 64  |in the Sources d|
00003260  69 72 65 63 74 6f 72 79  2e 0a 48 6f 77 65 76 65  |irectory..Howeve|
00003270  72 2c 20 74 68 65 73 65  20 70 72 6f 67 72 61 6d  |r, these program|
00003280  73 20 72 65 71 75 69 72  65 20 42 41 58 20 74 6f  |s require BAX to|
00003290  20 62 65 20 6c 6f 61 64  65 64 20 66 6f 72 20 74  | be loaded for t|
000032a0  68 65 6d 20 74 6f 20 63  6f 6d 70 69 6c 65 2e 20  |hem to compile. |
000032b0  42 41 58 20 69 73 0a 44  6f 67 67 79 53 6f 66 74  |BAX is.DoggySoft|
000032c0  91 73 20 42 61 73 69 63  20 41 73 73 65 6d 62 6c  |.s Basic Assembl|
000032d0  65 72 20 45 78 74 65 6e  73 69 6f 6e 2c 20 77 68  |er Extension, wh|
000032e0  69 63 68 20 70 72 6f 76  69 64 65 73 20 61 6c 6c  |ich provides all|
000032f0  20 41 52 4d 33 2c 20 41  52 4d 36 2c 20 46 50 41  | ARM3, ARM6, FPA|
00003300  31 30 0a 61 6e 64 20 63  6f 70 72 6f 63 65 73 73  |10.and coprocess|
00003310  6f 72 20 69 6e 73 74 72  75 63 74 69 6f 6e 73 2c  |or instructions,|
00003320  20 61 6c 6f 6e 67 20 77  69 74 68 20 6d 61 6e 79  | along with many|
00003330  20 75 73 65 66 75 6c 20  70 73 65 75 64 6f 2d 69  | useful pseudo-i|
00003340  6e 73 74 72 75 63 74 69  6f 6e 73 2e 0a 59 6f 75  |nstructions..You|
00003350  20 63 61 6e 20 67 65 74  20 42 41 58 20 66 72 6f  | can get BAX fro|
00003360  6d 20 67 6f 6f 64 20 50  44 20 6c 69 62 72 61 72  |m good PD librar|
00003370  69 65 73 20 61 6e 64 20  41 72 63 61 64 65 2c 20  |ies and Arcade, |
00003380  44 69 67 69 74 61 6c 20  44 61 74 61 62 61 6e 6b  |Digital Databank|
00003390  20 61 6e 64 0a 46 75 72  7a 65 66 69 65 6c 64 20  | and.Furzefield |
000033a0  48 71 20 42 42 53 73 2e  20 49 74 91 73 20 65 73  |Hq BBSs. It.s es|
000033b0  73 65 6e 74 69 61 6c 20  66 6f 72 20 42 61 73 69  |sential for Basi|
000033c0  63 20 61 73 73 65 6d 62  6c 65 72 20 70 72 6f 67  |c assembler prog|
000033d0  72 61 6d 6d 65 72 73 21  0a 0a 20 49 66 20 79 6f  |rammers!.. If yo|
000033e0  75 20 75 73 65 20 74 68  69 73 20 6d 6f 64 75 6c  |u use this modul|
000033f0  65 20 69 6e 20 61 20 70  72 6f 67 72 61 6d 2c 20  |e in a program, |
00003400  62 65 20 73 75 72 65 20  74 6f 20 52 4d 45 6e 73  |be sure to RMEns|
00003410  75 72 65 20 76 65 72 73  69 6f 6e 20 30 2e 30 34  |ure version 0.04|
00003420  20 6f 72 0a 6c 61 74 65  72 20 2d 20 76 65 72 73  | or.later - vers|
00003430  69 6f 6e 73 20 30 2e 30  31 20 61 6e 64 20 30 2e  |ions 0.01 and 0.|
00003440  30 32 20 61 72 65 20 4e  65 77 65 72 4c 6f 6f 6b  |02 are NewerLook|
00003450  20 71 75 69 63 6b 20 72  65 6c 65 61 73 65 73 20  | quick releases |
00003460  77 69 74 68 20 62 75 67  73 20 69 6e 0a 70 6f 73  |with bugs in.pos|
00003470  74 2d 74 72 61 70 70 69  6e 67 2c 20 61 6e 64 20  |t-trapping, and |
00003480  76 65 72 73 69 6f 6e 20  30 2e 30 33 20 64 6f 20  |version 0.03 do |
00003490  6e 6f 74 20 66 65 61 74  75 72 65 20 68 69 67 68  |not feature high|
000034a0  2d 70 72 69 6f 72 69 74  79 20 53 57 49 20 74 72  |-priority SWI tr|
000034b0  61 70 70 69 6e 67 2c 0a  61 73 20 77 65 6c 6c 20  |apping,.as well |
000034c0  61 73 20 73 6f 6d 65 74  69 6d 65 73 20 65 6e 74  |as sometimes ent|
000034d0  65 72 69 6e 67 20 70 72  65 2d 63 6f 64 65 20 77  |ering pre-code w|
000034e0  69 74 68 20 69 6e 74 65  72 72 75 70 74 73 20 65  |ith interrupts e|
000034f0  6e 61 62 6c 65 64 2e 0a  0a 20 54 68 69 73 20 6d  |nabled... This m|
00003500  6f 64 75 6c 65 20 69 73  20 66 72 65 65 77 61 72  |odule is freewar|
00003510  65 2e 20 46 72 65 65 20  66 72 65 65 20 74 6f 20  |e. Free free to |
00003520  64 69 73 74 72 69 62 75  74 65 20 61 6e 64 20 75  |distribute and u|
00003530  73 65 2e 20 54 6f 20 63  6f 6e 74 61 63 74 20 6d  |se. To contact m|
00003540  65 20 2d 0a 66 6f 72 20  70 72 61 69 73 65 2c 20  |e -.for praise, |
00003550  74 6f 20 73 75 67 67 65  73 74 20 6e 65 77 20 62  |to suggest new b|
00003560  69 74 73 20 74 6f 20 61  64 64 2c 20 6f 72 20 28  |its to add, or (|
00003570  68 65 61 76 65 6e 20 66  6f 72 62 69 64 29 20 74  |heaven forbid) t|
00003580  6f 20 72 65 70 6f 72 74  20 61 20 62 75 67 2c 0a  |o report a bug,.|
00003590  70 6c 65 61 73 65 20 77  72 69 74 65 20 74 6f 3a  |please write to:|
000035a0  0a 0a 20 20 41 6e 64 72  65 77 20 43 6c 6f 76 65  |..  Andrew Clove|
000035b0  72 2c 0a 20 20 20 37 20  42 6c 61 63 6b 68 6f 72  |r,.   7 Blackhor|
000035c0  73 65 20 43 72 65 73 63  65 6e 74 2c 0a 20 20 20  |se Crescent,.   |
000035d0  20 41 6d 65 72 73 68 61  6d 2c 0a 20 20 20 20 20  | Amersham,.     |
000035e0  42 75 63 6b 73 2e 2c 0a  20 20 20 20 20 20 48 50  |Bucks.,.      HP|
000035f0  36 20 36 48 50 2e 0a 0a  20 4f 72 20 70 68 6f 6e  |6 6HP... Or phon|
00003600  65 20 6d 65 20 6f 6e 20  30 31 34 39 34 2d 34 33  |e me on 01494-43|
00003610  31 39 31 36 2c 20 73 65  6e 64 20 61 20 66 61 78  |1916, send a fax|
00003620  20 6f 6e 20 30 31 34 39  34 2d 36 37 35 38 37 38  | on 01494-675878|
00003630  2c 20 73 65 6e 64 20 73  6f 6d 65 20 65 6d 61 69  |, send some emai|
00003640  6c 20 74 6f 0a 61 6a 63  40 64 6f 67 67 79 73 66  |l to.ajc@doggysf|
00003650  74 2e 64 65 6d 6f 6e 2e  63 6f 2e 75 6b 20 6f 72  |t.demon.co.uk or|
00003660  20 65 76 65 6e 20 74 65  6c 65 78 20 6f 6e 20 38  | even telex on 8|
00003670  33 36 37 35 20 42 72 69  74 20 47 2e 0a           |3675 Brit G..|
0000367d