Home » Archimedes archive » Acorn User » AU 1998-12.adf » Regulars » StarInfo/Fletcher/!Purple/WSWI-Help

StarInfo/Fletcher/!Purple/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 » Archimedes archive » Acorn User » AU 1998-12.adf » Regulars
Filename: StarInfo/Fletcher/!Purple/WSWI-Help
Read OK:
File size: 3A6E bytes
Load address: 0000
Exec address: 0000
Duplicates

There is 1 duplicate copy of this file in the archive:

File contents
WimpSWIVe       0.05 (30 Oct 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 in 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 it is - as I�ll happily admit - 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. (And you know some program will.)

 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. Actually, quite a lot
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
            |         bit  6   : ignore bits 0-5 and claim all Wimp_ SWIs
            |         bits 7-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.)
            |
            | Don�t post-trap Wimp_Poll(Idle) or Wimp_StartTask: it�s a bad
            | idea. WimpSWIVe deals with it adequately, but there are all
            | sorts of simply horrid implications. Trapping Wimp_Poll is
            | easy anyway, using the old filter system.
            |
            | And finally, don�t use the �claim all SWIs� flag unless you
            | really want all the SWIs. Don�t use it for trapping a number
            | of different SWIs, use many separate claims: the speed
            | difference will be negligable, and you needn�t worry about
            | Wimp_Poll. The �claim all SWIs� flag is unlikely to be widely
            | useful - a Wimp SWI logging program seems to be the only
            | possible user.
            |
    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. Note that this is an OLD
   VERSION of 3DErrorWindow, which you should not actually use - get
   NewerLook for the fullest, newest version. This, however, is a better
   example of how to use WimpSWIVe, as it is less complicated than the
   latest version.
 - 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 does 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 35 20 28 33 30  20 4f 63 74 20 31 39 39  |0.05 (30 Oct 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 2a 61 6c 6c  |properly in *all|
00000130  2a 20 63 69 72 63 75 6d  73 74 61 6e 63 65 73 20  |* circumstances |
00000140  28 61 62 6f 75 74 20 33  30 4b 20 6f 66 20 73 6f  |(about 30K of so|
00000150  75 72 63 65 20 63 6f 64  65 20 69 6e 20 44 65 73  |urce code in Des|
00000160  6b 74 6f 70 20 48 61 63  6b 65 72 29 2c 0a 61 6e  |ktop Hacker),.an|
00000170  64 20 63 61 6e 20 73 6c  6f 77 20 74 68 65 20 6d  |d can slow the m|
00000180  61 63 68 69 6e 65 20 64  6f 77 6e 2c 20 71 75 69  |achine down, qui|
00000190  74 65 20 63 6f 6e 73 69  64 65 72 61 62 6c 79 20  |te considerably |
000001a0  77 68 65 6e 20 74 68 65  72 65 20 61 72 65 20 6d  |when there are m|
000001b0  75 6c 74 69 70 6c 65 0a  63 6c 61 69 6d 61 6e 74  |ultiple.claimant|
000001c0  73 2e 0a 0a 20 49 74 20  69 73 2c 20 68 6f 77 65  |s... It is, howe|
000001d0  76 65 72 2c 20 70 6f 73  73 69 62 6c 65 20 74 6f  |ver, possible to|
000001e0  20 74 72 61 70 20 57 69  6d 70 5f 20 53 57 49 73  | trap Wimp_ SWIs|
000001f0  20 62 79 20 70 72 6f 76  69 64 69 6e 67 20 61 6e  | by providing an|
00000200  6f 74 68 65 72 20 6d 6f  64 75 6c 65 0a 77 69 74  |other module.wit|
00000210  68 20 74 68 65 20 73 61  6d 65 20 53 57 49 20 63  |h the same SWI c|
00000220  68 75 6e 6b 20 61 6e 64  20 6e 61 6d 65 73 2e 20  |hunk and names. |
00000230  54 68 69 73 20 6d 65 74  68 6f 64 20 69 73 20 6d  |This method is m|
00000240  75 63 68 20 71 75 69 63  6b 65 72 20 61 6e 64 20  |uch quicker and |
00000250  65 61 73 69 65 72 2c 0a  62 75 74 20 69 74 20 69  |easier,.but it i|
00000260  73 20 2d 20 61 73 20 49  91 6c 6c 20 68 61 70 70  |s - as I.ll happ|
00000270  69 6c 79 20 61 64 6d 69  74 20 2d 20 72 61 74 68  |ily admit - rath|
00000280  65 72 20 64 6f 64 67 79  2e 20 4f 6e 65 20 6f 66  |er dodgy. One of|
00000290  20 74 68 65 20 70 72 6f  62 6c 65 6d 73 20 69 73  | the problems is|
000002a0  0a 74 68 61 74 20 6f 6e  6c 79 20 6f 6e 65 20 6d  |.that only one m|
000002b0  6f 64 75 6c 65 20 63 61  6e 20 64 6f 20 74 68 69  |odule can do thi|
000002c0  73 20 61 74 20 61 20 74  69 6d 65 2e 20 53 6f 20  |s at a time. So |
000002d0  69 66 20 4e 65 77 65 72  4c 6f 6f 6b 20 68 61 64  |if NewerLook had|
000002e0  20 61 20 6d 6f 64 75 6c  65 0a 74 68 61 74 20 75  | a module.that u|
000002f0  73 65 64 20 74 68 69 73  20 6d 65 74 68 6f 64 2c  |sed this method,|
00000300  20 69 74 20 77 6f 75 6c  64 6e 91 74 20 77 6f 72  | it wouldn.t wor|
00000310  6b 20 70 72 6f 70 65 72  6c 79 20 77 68 65 6e 20  |k properly when |
00000320  61 6e 6f 74 68 65 72 20  70 72 6f 67 72 61 6d 20  |another program |
00000330  74 72 69 65 64 0a 74 6f  20 64 6f 20 74 68 65 20  |tried.to do the |
00000340  73 61 6d 65 20 74 68 69  6e 67 2e 20 28 41 6e 64  |same thing. (And|
00000350  20 79 6f 75 20 6b 6e 6f  77 20 73 6f 6d 65 20 70  | you know some p|
00000360  72 6f 67 72 61 6d 20 77  69 6c 6c 2e 29 0a 0a 20  |rogram will.).. |
00000370  54 68 75 73 2c 20 49 20  68 61 76 65 20 73 65 70  |Thus, I have sep|
00000380  61 72 61 74 65 64 20 74  68 65 20 74 72 61 70 70  |arated the trapp|
00000390  69 6e 67 20 63 6f 64 65  20 66 72 6f 6d 20 74 68  |ing code from th|
000003a0  65 20 61 63 74 69 6f 6e  20 63 6f 64 65 20 28 77  |e action code (w|
000003b0  68 69 63 68 20 72 65 73  69 64 65 73 0a 69 6e 20  |hich resides.in |
000003c0  61 6e 6f 74 68 65 72 20  6d 6f 64 75 6c 65 29 2c  |another module),|
000003d0  20 61 6e 64 20 72 65 6c  65 61 73 65 64 20 74 68  | and released th|
000003e0  69 73 20 6d 6f 64 75 6c  65 20 73 65 70 61 72 61  |is module separa|
000003f0  74 65 6c 79 2e 20 49 74  20 63 61 6e 20 6d 61 6e  |tely. It can man|
00000400  61 67 65 20 53 57 49 0a  63 6c 61 69 6d 73 20 61  |age SWI.claims a|
00000410  6e 64 20 72 65 6c 65 61  73 65 73 20 64 79 6e 61  |nd releases dyna|
00000420  6d 69 63 61 6c 6c 79 2c  20 61 20 62 69 74 20 6c  |mically, a bit l|
00000430  69 6b 65 20 76 65 63 74  6f 72 73 2e 20 41 63 74  |ike vectors. Act|
00000440  75 61 6c 6c 79 2c 20 71  75 69 74 65 20 61 20 6c  |ually, quite a l|
00000450  6f 74 0a 6c 69 6b 65 20  76 65 63 74 6f 72 73 2e  |ot.like vectors.|
00000460  20 59 6f 75 20 63 61 6e  20 75 73 65 20 69 74 20  | You can use it |
00000470  69 6e 20 79 6f 75 72 20  6f 77 6e 20 70 72 6f 67  |in your own prog|
00000480  72 61 6d 73 20 69 66 20  79 6f 75 20 6c 69 6b 65  |rams if you like|
00000490  2e 20 48 65 72 65 91 73  20 68 6f 77 2e 0a 0a 20  |. Here.s how... |
000004a0  42 65 63 61 75 73 65 20  57 69 6d 70 53 57 49 56  |Because WimpSWIV|
000004b0  65 20 75 73 65 73 20 74  68 65 20 57 69 6d 70 91  |e uses the Wimp.|
000004c0  73 20 53 57 49 20 63 68  75 6e 6b 2c 20 69 74 20  |s SWI chunk, it |
000004d0  63 61 6e 6e 6f 74 20 70  72 6f 76 69 64 65 20 69  |cannot provide i|
000004e0  74 73 20 6f 77 6e 0a 53  57 49 73 2e 20 49 6e 73  |ts own.SWIs. Ins|
000004f0  74 65 61 64 2c 20 69 74  20 63 6f 6d 6d 75 6e 69  |tead, it communi|
00000500  63 61 74 65 73 20 75 73  69 6e 67 20 61 20 57 69  |cates using a Wi|
00000510  6d 70 20 53 57 49 2c 20  6e 61 6d 65 6c 79 20 57  |mp SWI, namely W|
00000520  69 6d 70 5f 52 65 67 69  73 74 65 72 46 69 6c 74  |imp_RegisterFilt|
00000530  65 72 2e 0a 48 65 72 65  20 69 73 20 74 68 65 20  |er..Here is the |
00000540  57 69 6d 70 53 57 49 56  65 20 73 70 65 63 69 66  |WimpSWIVe specif|
00000550  69 63 61 74 69 6f 6e 20  66 6f 72 20 57 69 6d 70  |ication for Wimp|
00000560  5f 52 65 67 69 73 74 65  72 46 69 6c 74 65 72 2e  |_RegisterFilter.|
00000570  0a 0a 0a 20 20 20 20 20  20 20 20 20 20 20 20 7c  |...            ||
00000580  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
000005a0  20 20 20 20 20 20 20 20  20 20 20 20 20 57 69 6d  |             Wim|
000005b0  70 5f 52 65 67 69 73 74  65 72 46 69 6c 74 65 72  |p_RegisterFilter|
000005c0  0a 20 20 20 20 20 20 20  20 20 20 20 20 7c 20 20  |.            |  |
000005d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00000600  20 20 28 53 57 49 20 26  34 30 30 46 35 29 0a 20  |  (SWI &400F5). |
00000610  20 20 20 20 20 20 20 20  20 20 20 7c 0a 20 20 20  |           |.   |
00000620  20 20 20 20 20 20 20 20  20 7c 20 55 73 65 64 20  |         | Used |
00000630  62 79 20 74 68 65 20 46  69 6c 74 65 72 20 4d 61  |by the Filter Ma|
00000640  6e 61 67 65 72 20 74 6f  20 72 65 67 69 73 74 65  |nager to registe|
00000650  72 20 6f 72 20 64 65 72  65 67 69 73 74 65 72 20  |r or deregister |
00000660  61 20 66 69 6c 74 65 72  0a 20 20 20 20 20 20 20  |a filter.       |
00000670  20 20 20 20 20 7c 20 4f  52 20 75 73 65 64 20 74  |     | OR used t|
00000680  6f 20 72 65 67 69 73 74  65 72 20 53 57 49 20 63  |o register SWI c|
00000690  6c 61 69 6d 73 20 61 6e  64 20 72 65 6c 65 61 73  |laims and releas|
000006a0  65 73 20 77 69 74 68 20  57 69 6d 70 53 57 49 56  |es with WimpSWIV|
000006b0  65 0a 20 20 20 20 20 20  20 20 20 20 20 20 7c 0a  |e.            |.|
000006c0  20 20 4f 6e 20 65 6e 74  72 79 3a 20 7c 20 52 30  |  On entry: | R0|
000006d0  20 3d 20 72 65 61 73 6f  6e 20 63 6f 64 65 3a 0a  | = reason code:.|
000006e0  20 20 20 20 20 20 20 20  20 20 20 20 7c 20 20 20  |            |   |
000006f0  20 20 20 20 20 20 26 34  39 35 37 35 33 35 37 20  |      &49575357 |
00000700  28 94 57 53 57 49 95 29  20 66 6f 72 20 57 69 6d  |(.WSWI.) for Wim|
00000710  70 53 57 49 56 65 20 6f  70 65 72 61 74 69 6f 6e  |pSWIVe operation|
00000720  20 28 73 65 65 20 62 65  6c 6f 77 29 0a 20 20 20  | (see below).   |
00000730  20 20 20 20 20 20 20 20  20 7c 20 20 20 20 20 20  |         |      |
00000740  20 20 20 61 6e 79 74 68  69 6e 67 20 65 6c 73 65  |   anything else|
00000750  20 66 6f 72 20 66 69 6c  74 65 72 20 6f 70 65 72  | for filter oper|
00000760  61 74 69 6f 6e 20 28 73  65 65 20 52 49 53 43 20  |ation (see RISC |
00000770  4f 53 20 33 0a 20 20 20  20 20 20 20 20 20 20 20  |OS 3.           |
00000780  20 7c 20 20 20 20 20 20  20 20 20 50 72 6f 67 72  | |         Progr|
00000790  61 6d 6d 65 72 73 91 20  52 65 66 65 72 65 6e 63  |ammers. Referenc|
000007a0  65 20 4d 61 6e 75 61 6c  2c 20 70 61 67 65 20 33  |e Manual, page 3|
000007b0  2d 32 32 34 29 0a 20 20  20 20 20 20 20 20 20 20  |-224).          |
000007c0  20 20 7c 20 52 31 20 3d  20 53 57 49 20 77 6f 72  |  | R1 = SWI wor|
000007d0  64 3a 0a 20 20 20 20 20  20 20 20 20 20 20 20 7c  |d:.            ||
000007e0  20 20 20 20 20 20 20 20  20 62 69 74 73 20 30 2d  |         bits 0-|
000007f0  35 20 3a 20 6f 66 66 73  65 74 20 69 6e 20 53 57  |5 : offset in SW|
00000800  49 20 63 68 75 6e 6b 20  6f 66 20 53 57 49 20 74  |I chunk of SWI t|
00000810  6f 20 63 6c 61 69 6d 2f  72 65 6c 65 61 73 65 0a  |o claim/release.|
00000820  20 20 20 20 20 20 20 20  20 20 20 20 7c 20 20 20  |            |   |
00000830  20 20 20 20 20 20 62 69  74 20 20 36 20 20 20 3a  |      bit  6   :|
00000840  20 69 67 6e 6f 72 65 20  62 69 74 73 20 30 2d 35  | ignore bits 0-5|
00000850  20 61 6e 64 20 63 6c 61  69 6d 20 61 6c 6c 20 57  | and claim all W|
00000860  69 6d 70 5f 20 53 57 49  73 0a 20 20 20 20 20 20  |imp_ SWIs.      |
00000870  20 20 20 20 20 20 7c 20  20 20 20 20 20 20 20 20  |      |         |
00000880  62 69 74 73 20 37 2d 32  39 3a 20 75 6e 64 65 66  |bits 7-29: undef|
00000890  69 6e 65 64 2c 20 6c 65  61 76 65 20 75 6e 73 65  |ined, leave unse|
000008a0  74 0a 20 20 20 20 20 20  20 20 20 20 20 20 7c 20  |t.            | |
000008b0  20 20 20 20 20 20 20 20  62 69 74 20 20 33 30 20  |        bit  30 |
000008c0  20 3a 20 68 69 67 68 20  70 72 69 6f 72 69 74 79  | : high priority|
000008d0  20 69 66 20 73 65 74 2c  20 65 6c 73 65 20 6c 6f  | if set, else lo|
000008e0  77 20 70 72 69 6f 72 69  74 79 0a 20 20 20 20 20  |w priority.     |
000008f0  20 20 20 20 20 20 20 7c  20 20 20 20 20 20 20 20  |       |        |
00000900  20 62 69 74 20 20 33 31  20 20 3a 20 63 6c 61 69  | bit  31  : clai|
00000910  6d 20 69 66 20 73 65 74  2c 20 65 6c 73 65 20 72  |m if set, else r|
00000920  65 6c 65 61 73 65 0a 20  20 20 20 20 20 20 20 20  |elease.         |
00000930  20 20 20 7c 20 52 32 20  3d 20 76 61 6c 75 65 20  |   | R2 = value |
00000940  74 6f 20 62 65 20 70 61  73 73 65 64 20 69 6e 20  |to be passed in |
00000950  52 31 32 20 6f 6e 20 65  6e 74 72 79 20 74 6f 20  |R12 on entry to |
00000960  63 6f 64 65 0a 20 20 20  20 20 20 20 20 20 20 20  |code.           |
00000970  20 7c 20 52 33 20 3d 20  61 64 64 72 65 73 73 20  | | R3 = address |
00000980  6f 66 20 53 57 49 20 70  72 65 2d 74 72 61 70 70  |of SWI pre-trapp|
00000990  69 6e 67 20 63 6f 64 65  2c 20 6f 72 20 30 20 69  |ing code, or 0 i|
000009a0  66 20 6e 6f 6e 65 20 6e  65 65 64 65 64 0a 20 20  |f none needed.  |
000009b0  20 20 20 20 20 20 20 20  20 20 7c 20 52 34 20 3d  |          | R4 =|
000009c0  20 61 64 64 72 65 73 73  20 6f 66 20 53 57 49 20  | address of SWI |
000009d0  70 6f 73 74 2d 74 72 61  70 70 69 6e 67 20 63 6f  |post-trapping co|
000009e0  64 65 2c 20 6f 72 20 30  20 69 66 20 6e 6f 6e 65  |de, or 0 if none|
000009f0  20 6e 65 65 64 65 64 0a  20 20 20 20 20 20 20 20  | needed.        |
00000a00  20 20 20 20 7c 0a 20 20  20 4f 6e 20 65 78 69 74  |    |.   On exit|
00000a10  3a 20 7c 20 52 65 67 69  73 74 65 72 73 20 70 72  |: | Registers pr|
00000a20  65 73 65 72 76 65 64 0a  20 20 20 20 20 20 20 20  |eserved.        |
00000a30  20 20 20 20 7c 0a 49 6e  74 65 72 72 75 70 74 73  |    |.Interrupts|
00000a40  3a 20 7c 20 49 6e 74 65  72 72 75 70 74 73 20 6d  |: | Interrupts m|
00000a50  61 79 20 62 65 20 65 6e  61 62 6c 65 64 0a 20 20  |ay be enabled.  |
00000a60  20 20 20 20 20 20 20 20  20 20 7c 20 46 61 73 74  |          | Fast|
00000a70  20 69 6e 74 65 72 72 75  70 74 73 20 6d 61 79 20  | interrupts may |
00000a80  62 65 20 65 6e 61 62 6c  65 64 0a 20 20 20 20 20  |be enabled.     |
00000a90  20 20 20 20 20 20 20 7c  0a 20 50 72 6f 63 65 73  |       |. Proces|
00000aa0  73 6f 72 3a 20 7c 20 50  72 6f 63 65 73 73 6f 72  |sor: | Processor|
00000ab0  20 69 73 20 69 6e 20 53  56 43 20 6d 6f 64 65 0a  | is in SVC mode.|
00000ac0  20 20 20 20 20 20 20 20  20 20 20 20 7c 0a 52 65  |            |.Re|
00000ad0  65 6e 74 72 61 6e 63 79  3a 20 7c 20 53 57 49 20  |entrancy: | SWI |
00000ae0  69 73 20 6e 6f 74 20 72  65 2d 65 6e 74 72 61 6e  |is not re-entran|
00000af0  74 0a 20 20 20 20 20 20  20 20 20 20 20 20 7c 0a  |t.            |.|
00000b00  20 20 20 20 20 20 20 55  73 65 3a 20 7c 20 49 6e  |       Use: | In|
00000b10  20 57 69 6d 70 53 57 49  56 65 20 75 73 61 67 65  | WimpSWIVe usage|
00000b20  2c 20 74 68 69 73 20 53  57 49 20 69 73 20 75 73  |, this SWI is us|
00000b30  65 64 20 74 6f 20 63 6c  61 69 6d 20 6f 72 20 72  |ed to claim or r|
00000b40  65 6c 65 61 73 65 20 53  57 49 73 2e 0a 20 20 20  |elease SWIs..   |
00000b50  20 20 20 20 20 20 20 20  20 7c 20 54 68 65 20 70  |         | The p|
00000b60  72 65 2d 74 72 61 70 70  69 6e 67 20 63 6f 64 65  |re-trapping code|
00000b70  20 73 70 65 63 69 66 69  65 64 20 69 73 20 63 61  | specified is ca|
00000b80  6c 6c 65 64 20 62 65 66  6f 72 65 20 74 68 65 20  |lled before the |
00000b90  53 57 49 20 69 73 0a 20  20 20 20 20 20 20 20 20  |SWI is.         |
00000ba0  20 20 20 7c 20 63 61 6c  6c 65 64 2c 20 61 6e 64  |   | called, and|
00000bb0  20 74 68 65 20 70 6f 73  74 2d 74 72 61 70 70 69  | the post-trappi|
00000bc0  6e 67 20 63 6f 64 65 20  61 66 74 65 72 77 61 72  |ng code afterwar|
00000bd0  64 73 2e 0a 20 20 20 20  20 20 20 20 20 20 20 20  |ds..            |
00000be0  7c 0a 20 20 20 20 20 20  20 20 20 20 20 20 7c 20  ||.            | |
00000bf0  48 69 67 68 2d 70 72 69  6f 72 69 74 79 20 70 72  |High-priority pr|
00000c00  65 2d 63 6f 64 65 20 69  73 20 63 61 6c 6c 65 64  |e-code is called|
00000c10  20 62 65 66 6f 72 65 20  6c 6f 77 20 70 72 69 6f  | before low prio|
00000c20  72 69 74 79 20 70 72 65  2d 63 6f 64 65 2e 0a 20  |rity pre-code.. |
00000c30  20 20 20 20 20 20 20 20  20 20 20 7c 20 28 41 6e  |           | (An|
00000c40  64 20 68 69 67 68 2d 70  72 69 6f 72 69 74 79 20  |d high-priority |
00000c50  70 6f 73 74 2d 63 6f 64  65 20 69 73 20 63 61 6c  |post-code is cal|
00000c60  6c 65 64 20 61 66 74 65  72 20 6c 6f 77 20 70 72  |led after low pr|
00000c70  69 6f 72 69 74 79 0a 20  20 20 20 20 20 20 20 20  |iority.         |
00000c80  20 20 20 7c 20 70 6f 73  74 2d 63 6f 64 65 2e 29  |   | post-code.)|
00000c90  20 54 68 69 73 20 69 73  20 69 6d 70 6f 72 74 61  | This is importa|
00000ca0  6e 74 20 62 65 63 61 75  73 65 20 6f 6e 65 20 70  |nt because one p|
00000cb0  69 65 63 65 20 6f 66 20  70 72 65 2d 63 6f 64 65  |iece of pre-code|
00000cc0  0a 20 20 20 20 20 20 20  20 20 20 20 20 7c 20 63  |.            | c|
00000cd0  6f 75 6c 64 20 69 6e 74  65 72 63 65 70 74 20 61  |ould intercept a|
00000ce0  20 53 57 49 20 63 61 6c  6c 20 62 65 66 6f 72 65  | SWI call before|
00000cf0  20 61 6e 6f 74 68 65 72  20 62 69 74 20 67 6f 74  | another bit got|
00000d00  20 61 20 6c 6f 6f 6b 20  69 6e 2e 0a 20 20 20 20  | a look in..    |
00000d10  20 20 20 20 20 20 20 20  7c 20 59 6f 75 20 73 68  |        | You sh|
00000d20  6f 75 6c 64 20 75 73 65  20 68 69 67 68 2d 70 72  |ould use high-pr|
00000d30  69 6f 72 69 74 79 20 63  6f 64 65 20 66 6f 72 20  |iority code for |
00000d40  6d 6f 6e 69 74 6f 72 69  6e 67 20 61 6e 64 20 72  |monitoring and r|
00000d50  65 67 69 73 74 65 72 2d  0a 20 20 20 20 20 20 20  |egister-.       |
00000d60  20 20 20 20 20 7c 20 61  6c 74 65 72 69 6e 67 20  |     | altering |
00000d70  63 6f 64 65 2e 20 49 66  20 79 6f 75 72 20 70 72  |code. If your pr|
00000d80  65 2d 63 6f 64 65 20 69  73 20 61 74 20 61 6c 6c  |e-code is at all|
00000d90  20 6c 69 6b 65 6c 79 20  74 6f 20 69 6e 74 65 72  | likely to inter|
00000da0  63 65 70 74 0a 20 20 20  20 20 20 20 20 20 20 20  |cept.           |
00000db0  20 7c 20 61 20 53 57 49  2c 20 79 6f 75 20 6d 75  | | a SWI, you mu|
00000dc0  73 74 20 75 73 65 20 6c  6f 77 2d 70 72 69 6f 72  |st use low-prior|
00000dd0  69 74 79 20 63 6f 64 65  2e 20 49 6e 20 65 66 66  |ity code. In eff|
00000de0  65 63 74 2c 20 6c 6f 77  2d 70 72 69 6f 72 69 74  |ect, low-priorit|
00000df0  79 0a 20 20 20 20 20 20  20 20 20 20 20 20 7c 20  |y.            | |
00000e00  63 6f 64 65 20 69 73 20  90 63 6c 6f 73 65 72 91  |code is .closer.|
00000e10  20 74 6f 20 74 68 65 20  72 65 61 6c 20 53 57 49  | to the real SWI|
00000e20  2e 0a 20 20 20 20 20 20  20 20 20 20 20 20 7c 0a  |..            |.|
00000e30  20 20 20 20 20 20 20 20  20 20 20 20 7c 20 50 72  |            | Pr|
00000e40  65 2d 74 72 61 70 70 69  6e 67 20 63 6f 64 65 20  |e-trapping code |
00000e50  63 6f 6e 64 69 74 69 6f  6e 73 3a 0a 20 20 20 20  |conditions:.    |
00000e60  20 20 20 20 20 20 20 20  7c 0a 20 20 20 20 20 20  |        |.      |
00000e70  20 20 20 20 20 20 7c 20  4f 6e 20 65 6e 74 72 79  |      | On entry|
00000e80  3a 20 52 30 2d 52 38 20  3d 20 72 65 67 69 73 74  |: R0-R8 = regist|
00000e90  65 72 73 20 70 61 73 73  65 64 20 74 6f 20 53 57  |ers passed to SW|
00000ea0  49 0a 20 20 20 20 20 20  20 20 20 20 20 20 7c 20  |I.            | |
00000eb0  20 20 20 20 20 20 20 20  20 20 52 39 20 20 20 20  |          R9    |
00000ec0  3d 20 6f 66 66 73 65 74  20 69 6e 74 6f 20 63 68  |= offset into ch|
00000ed0  75 6e 6b 20 6f 66 20 53  57 49 20 63 61 6c 6c 65  |unk of SWI calle|
00000ee0  64 0a 20 20 20 20 20 20  20 20 20 20 20 20 7c 20  |d.            | |
00000ef0  20 20 20 20 20 20 20 20  20 20 52 31 32 20 20 20  |          R12   |
00000f00  3d 20 76 61 6c 75 65 20  73 70 65 63 69 66 69 65  |= value specifie|
00000f10  64 20 77 68 65 6e 20 52  65 67 69 73 74 65 72 46  |d when RegisterF|
00000f20  69 6c 74 65 72 20 63 61  6c 6c 65 64 0a 20 20 20  |ilter called.   |
00000f30  20 20 20 20 20 20 20 20  20 7c 20 20 20 20 20 20  |         |      |
00000f40  20 20 20 20 20 52 31 33  20 20 20 3d 20 66 75 6c  |     R13   = ful|
00000f50  6c 2c 20 64 65 73 63 65  6e 64 69 6e 67 20 73 74  |l, descending st|
00000f60  61 63 6b 0a 20 20 20 20  20 20 20 20 20 20 20 20  |ack.            |
00000f70  7c 20 20 20 20 20 20 20  20 20 20 20 52 31 34 20  ||           R14 |
00000f80  20 20 3d 20 72 65 74 75  72 6e 20 61 64 64 72 65  |  = return addre|
00000f90  73 73 0a 20 20 20 20 20  20 20 20 20 20 20 20 7c  |ss.            ||
00000fa0  20 20 4f 6e 20 65 78 69  74 3a 20 52 30 2d 52 38  |  On exit: R0-R8|
00000fb0  20 3d 20 6d 61 79 20 62  65 20 61 6c 74 65 72 65  | = may be altere|
00000fc0  64 20 74 6f 20 63 68 61  6e 67 65 20 65 66 66 65  |d to change effe|
00000fd0  63 74 20 6f 66 20 53 57  49 0a 20 20 20 20 20 20  |ct of SWI.      |
00000fe0  20 20 20 20 20 20 7c 20  20 20 20 20 20 20 20 20  |      |         |
00000ff0  20 20 52 39 20 20 20 20  3d 20 70 72 65 73 65 72  |  R9    = preser|
00001000  76 65 64 2c 20 6f 72 20  2d 31 20 74 6f 20 69 6e  |ved, or -1 to in|
00001010  74 65 72 63 65 70 74 20  53 57 49 0a 20 20 20 20  |tercept SWI.    |
00001020  20 20 20 20 20 20 20 20  7c 0a 20 20 20 20 20 20  |        |.      |
00001030  20 20 20 20 20 20 7c 20  50 72 65 2d 74 72 61 70  |      | Pre-trap|
00001040  70 69 6e 67 20 63 6f 64  65 20 69 73 20 65 6e 74  |ping code is ent|
00001050  65 72 65 64 20 69 6e 20  53 56 43 20 6d 6f 64 65  |ered in SVC mode|
00001060  2c 20 77 69 74 68 20 69  6e 74 65 72 72 75 70 74  |, with interrupt|
00001070  73 0a 20 20 20 20 20 20  20 20 20 20 20 20 7c 20  |s.            | |
00001080  64 69 73 61 62 6c 65 64  2e 20 49 66 20 52 39 3d  |disabled. If R9=|
00001090  2d 31 20 6f 6e 20 65 78  69 74 2c 20 74 68 65 20  |-1 on exit, the |
000010a0  53 57 49 20 69 73 20 6e  6f 74 20 63 61 6c 6c 65  |SWI is not calle|
000010b0  64 2e 20 49 6e 73 74 65  61 64 2c 0a 20 20 20 20  |d. Instead,.    |
000010c0  20 20 20 20 20 20 20 20  7c 20 61 6e 79 20 6f 75  |        | any ou|
000010d0  74 73 74 61 6e 64 69 6e  67 20 70 6f 73 74 2d 63  |tstanding post-c|
000010e0  6f 64 65 20 69 73 20 63  61 6c 6c 65 64 2c 20 61  |ode is called, a|
000010f0  6e 64 20 74 68 65 20 63  61 6c 6c 65 72 20 69 73  |nd the caller is|
00001100  20 72 65 74 75 72 6e 65  64 0a 20 20 20 20 20 20  | returned.      |
00001110  20 20 20 20 20 20 7c 20  74 6f 20 77 69 74 68 20  |      | to with |
00001120  74 68 65 20 73 75 70 70  6c 69 65 64 20 52 30 2d  |the supplied R0-|
00001130  52 38 20 61 6e 64 20 50  53 52 20 66 6c 61 67 73  |R8 and PSR flags|
00001140  2e 20 41 6e 20 65 72 72  6f 72 20 6d 61 79 20 62  |. An error may b|
00001150  65 0a 20 20 20 20 20 20  20 20 20 20 20 20 7c 20  |e.            | |
00001160  73 69 67 6e 69 66 69 65  64 20 62 79 20 70 6f 69  |signified by poi|
00001170  6e 74 69 6e 67 20 52 30  20 74 6f 20 61 6e 20 65  |nting R0 to an e|
00001180  72 72 6f 72 20 62 6c 6f  63 6b 20 61 6e 64 20 73  |rror block and s|
00001190  65 74 74 69 6e 67 20 74  68 65 20 56 0a 20 20 20  |etting the V.   |
000011a0  20 20 20 20 20 20 20 20  20 7c 20 66 6c 61 67 20  |         | flag |
000011b0  6f 6e 20 72 65 74 75 72  6e 20 61 73 20 6e 6f 72  |on return as nor|
000011c0  6d 61 6c 2c 20 77 68 65  6e 20 69 6e 74 65 72 63  |mal, when interc|
000011d0  65 70 74 69 6e 67 2e 20  28 53 65 65 20 66 6f 6f  |epting. (See foo|
000011e0  74 6e 6f 74 65 20 31 2e  29 0a 20 20 20 20 20 20  |tnote 1.).      |
000011f0  20 20 20 20 20 20 7c 0a  20 20 20 20 20 20 20 20  |      |.        |
00001200  20 20 20 20 7c 20 49 66  20 6d 6f 72 65 20 74 68  |    | If more th|
00001210  61 6e 20 6f 6e 65 20 63  6c 69 65 6e 74 20 68 61  |an one client ha|
00001220  73 20 63 6c 61 69 6d 65  64 20 61 20 53 57 49 2c  |s claimed a SWI,|
00001230  20 69 74 20 69 73 20 74  68 65 20 65 61 72 6c 69  | it is the earli|
00001240  65 73 74 0a 20 20 20 20  20 20 20 20 20 20 20 20  |est.            |
00001250  7c 20 63 6c 61 69 6d 61  6e 74 91 73 20 70 72 65  || claimant.s pre|
00001260  2d 74 72 61 70 70 69 6e  67 20 63 6f 64 65 20 74  |-trapping code t|
00001270  68 61 74 20 69 73 20 63  61 6c 6c 65 64 20 6c 61  |hat is called la|
00001280  73 74 20 2d 20 6e 65 77  0a 20 20 20 20 20 20 20  |st - new.       |
00001290  20 20 20 20 20 7c 20 63  6c 61 69 6d 61 6e 74 73  |     | claimants|
000012a0  20 74 61 6b 65 20 70 72  69 6f 72 69 74 79 20 28  | take priority (|
000012b0  74 68 6f 75 67 68 20 68  69 67 68 2d 70 72 69 6f  |though high-prio|
000012c0  72 69 74 79 20 61 6c 77  61 79 73 20 62 65 61 74  |rity always beat|
000012d0  73 20 6c 6f 77 2d 0a 20  20 20 20 20 20 20 20 20  |s low-.         |
000012e0  20 20 20 7c 20 70 72 69  6f 72 69 74 79 2c 20 6f  |   | priority, o|
000012f0  66 20 63 6f 75 72 73 65  29 2e 20 49 66 20 69 6e  |f course). If in|
00001300  74 65 72 63 65 70 74 69  6f 6e 20 6f 63 63 75 72  |terception occur|
00001310  73 2c 20 61 6e 79 20 70  6f 73 74 2d 74 72 61 70  |s, any post-trap|
00001320  70 69 6e 67 0a 20 20 20  20 20 20 20 20 20 20 20  |ping.           |
00001330  20 7c 20 63 6f 64 65 20  66 6f 72 20 63 6c 61 69  | | code for clai|
00001340  6d 73 20 77 68 65 72 65  20 74 68 65 20 70 72 65  |ms where the pre|
00001350  2d 74 72 61 70 70 69 6e  67 20 63 6f 64 65 20 28  |-trapping code (|
00001360  69 66 20 61 6e 79 29 20  68 61 73 0a 20 20 20 20  |if any) has.    |
00001370  20 20 20 20 20 20 20 20  7c 20 61 6c 72 65 61 64  |        | alread|
00001380  79 20 62 65 65 6e 20 65  78 65 63 75 74 65 64 20  |y been executed |
00001390  61 72 65 20 61 6c 73 6f  20 65 78 65 63 75 74 65  |are also execute|
000013a0  64 2e 20 49 6e 20 65 66  66 65 63 74 2c 20 79 6f  |d. In effect, yo|
000013b0  75 20 61 72 65 0a 20 20  20 20 20 20 20 20 20 20  |u are.          |
000013c0  20 20 7c 20 67 75 61 72  61 6e 74 65 65 64 20 74  |  | guaranteed t|
000013d0  68 61 74 20 79 6f 75 20  77 69 6c 6c 20 67 65 74  |hat you will get|
000013e0  20 61 20 70 6f 73 74 2d  74 72 61 70 20 65 76 65  | a post-trap eve|
000013f0  6e 74 20 69 66 20 79 6f  75 20 68 61 76 65 20 68  |nt if you have h|
00001400  61 64 0a 20 20 20 20 20  20 20 20 20 20 20 20 7c  |ad.            ||
00001410  20 61 20 70 72 65 2d 74  72 61 70 2e 20 28 53 65  | a pre-trap. (Se|
00001420  65 20 66 6f 6f 74 6e 6f  74 65 20 32 2e 29 0a 20  |e footnote 2.). |
00001430  20 20 20 20 20 20 20 20  20 20 20 7c 0a 20 20 20  |           |.   |
00001440  20 20 20 20 20 20 20 20  20 7c 0a 20 20 20 20 20  |         |.     |
00001450  20 20 20 20 20 20 20 7c  20 50 6f 73 74 2d 74 72  |       | Post-tr|
00001460  61 70 70 69 6e 67 20 63  6f 64 65 20 63 6f 6e 64  |apping code cond|
00001470  69 74 69 6f 6e 73 3a 0a  20 20 20 20 20 20 20 20  |itions:.        |
00001480  20 20 20 20 7c 0a 20 20  20 20 20 20 20 20 20 20  |    |.          |
00001490  20 20 7c 20 4f 6e 20 65  6e 74 72 79 3a 20 52 30  |  | On entry: R0|
000014a0  2d 52 38 20 3d 20 72 65  67 69 73 74 65 72 73 20  |-R8 = registers |
000014b0  70 61 73 73 65 64 20 62  61 63 6b 20 66 72 6f 6d  |passed back from|
000014c0  20 53 57 49 0a 20 20 20  20 20 20 20 20 20 20 20  | SWI.           |
000014d0  20 7c 20 20 20 20 20 20  20 20 20 20 20 52 39 20  | |           R9 |
000014e0  20 20 20 3d 20 6f 66 66  73 65 74 20 69 6e 74 6f  |   = offset into|
000014f0  20 63 68 75 6e 6b 20 6f  66 20 53 57 49 20 63 61  | chunk of SWI ca|
00001500  6c 6c 65 64 0a 20 20 20  20 20 20 20 20 20 20 20  |lled.           |
00001510  20 7c 20 20 20 20 20 20  20 20 20 20 20 52 31 32  | |           R12|
00001520  20 20 20 3d 20 76 61 6c  75 65 20 73 70 65 63 69  |   = value speci|
00001530  66 69 65 64 20 77 68 65  6e 20 52 65 67 69 73 74  |fied when Regist|
00001540  65 72 46 69 6c 74 65 72  20 63 61 6c 6c 65 64 0a  |erFilter called.|
00001550  20 20 20 20 20 20 20 20  20 20 20 20 7c 20 20 20  |            |   |
00001560  20 20 20 20 20 20 20 20  52 31 33 20 20 20 3d 20  |        R13   = |
00001570  66 75 6c 6c 2c 20 64 65  73 63 65 6e 64 69 6e 67  |full, descending|
00001580  20 73 74 61 63 6b 0a 20  20 20 20 20 20 20 20 20  | stack.         |
00001590  20 20 20 7c 20 20 20 20  20 20 20 20 20 20 20 52  |   |           R|
000015a0  31 34 20 20 20 3d 20 72  65 74 75 72 6e 20 61 64  |14   = return ad|
000015b0  64 72 65 73 73 0a 20 20  20 20 20 20 20 20 20 20  |dress.          |
000015c0  20 20 7c 20 20 4f 6e 20  65 78 69 74 3a 20 52 30  |  |  On exit: R0|
000015d0  2d 52 38 20 3d 20 6d 61  79 20 62 65 20 61 6c 74  |-R8 = may be alt|
000015e0  65 72 65 64 20 74 6f 20  63 68 61 6e 67 65 20 70  |ered to change p|
000015f0  65 72 63 65 69 76 65 64  20 72 65 73 75 6c 74 73  |erceived results|
00001600  0a 20 20 20 20 20 20 20  20 20 20 20 20 7c 20 20  |.            |  |
00001610  20 20 20 20 20 20 20 20  20 50 53 52 20 66 6c 61  |         PSR fla|
00001620  67 73 20 6d 61 79 20 62  65 20 61 6c 74 65 72 65  |gs may be altere|
00001630  64 20 74 6f 20 63 68 61  6e 67 65 20 70 65 72 63  |d to change perc|
00001640  65 69 76 65 64 20 72 65  73 75 6c 74 73 0a 20 20  |eived results.  |
00001650  20 20 20 20 20 20 20 20  20 20 7c 20 20 20 20 20  |          |     |
00001660  20 20 20 20 20 20 28 66  6f 72 20 65 78 61 6d 70  |      (for examp|
00001670  6c 65 20 74 6f 20 66 6c  61 67 20 61 6e 20 65 72  |le to flag an er|
00001680  72 6f 72 29 2e 0a 20 20  20 20 20 20 20 20 20 20  |ror)..          |
00001690  20 20 7c 0a 20 20 20 20  20 20 20 20 20 20 20 20  |  |.            |
000016a0  7c 20 50 6f 73 74 2d 74  72 61 70 70 69 6e 67 20  || Post-trapping |
000016b0  63 6f 64 65 20 69 73 20  65 6e 74 65 72 65 64 20  |code is entered |
000016c0  69 6e 20 53 56 43 20 6d  6f 64 65 2c 20 77 69 74  |in SVC mode, wit|
000016d0  68 20 69 6e 74 65 72 72  75 70 74 73 0a 20 20 20  |h interrupts.   |
000016e0  20 20 20 20 20 20 20 20  20 7c 20 64 69 73 61 62  |         | disab|
000016f0  6c 65 64 2e 0a 20 20 20  20 20 20 20 20 20 20 20  |led..           |
00001700  20 7c 0a 20 20 20 20 20  20 20 20 20 20 20 20 7c  | |.            ||
00001710  20 49 66 20 6d 6f 72 65  20 74 68 61 6e 20 6f 6e  | If more than on|
00001720  65 20 63 6c 69 65 6e 74  20 68 61 73 20 63 6c 61  |e client has cla|
00001730  69 6d 65 64 20 61 20 53  57 49 2c 20 69 74 20 69  |imed a SWI, it i|
00001740  73 20 74 68 65 20 65 61  72 6c 69 65 73 74 0a 20  |s the earliest. |
00001750  20 20 20 20 20 20 20 20  20 20 20 7c 20 63 6c 61  |           | cla|
00001760  69 6d 61 6e 74 91 73 20  70 6f 73 74 2d 74 72 61  |imant.s post-tra|
00001770  70 70 69 6e 67 20 63 6f  64 65 20 74 68 61 74 20  |pping code that |
00001780  69 73 20 63 61 6c 6c 65  64 20 66 69 72 73 74 2c  |is called first,|
00001790  20 73 75 62 6a 65 63 74  0a 20 20 20 20 20 20 20  | subject.       |
000017a0  20 20 20 20 20 7c 20 74  6f 20 70 72 69 6f 72 69  |     | to priori|
000017b0  74 79 2e 20 28 53 65 65  20 66 6f 6f 74 6e 6f 74  |ty. (See footnot|
000017c0  65 20 32 2e 29 0a 20 20  20 20 20 20 20 20 20 20  |e 2.).          |
000017d0  20 20 7c 0a 20 20 20 20  20 20 20 20 20 20 20 20  |  |.            |
000017e0  7c 20 52 65 6d 65 6d 62  65 72 20 74 68 61 74 20  || Remember that |
000017f0  79 6f 75 72 20 70 6f 73  74 2d 74 72 61 70 70 69  |your post-trappi|
00001800  6e 67 20 63 6f 64 65 20  6d 61 79 20 77 65 6c 6c  |ng code may well|
00001810  20 62 65 20 65 6e 74 65  72 65 64 20 69 6e 20 61  | be entered in a|
00001820  6e 0a 20 20 20 20 20 20  20 20 20 20 20 20 7c 20  |n.            | |
00001830  65 72 72 6f 72 20 63 6f  6e 64 69 74 69 6f 6e 2e  |error condition.|
00001840  20 53 6f 20 63 68 65 63  6b 20 77 68 65 74 68 65  | So check whethe|
00001850  72 20 74 68 65 20 56 20  66 6c 61 67 20 69 73 20  |r the V flag is |
00001860  73 65 74 20 6f 6e 20 65  6e 74 72 79 2c 0a 20 20  |set on entry,.  |
00001870  20 20 20 20 20 20 20 20  20 20 7c 20 61 6e 64 20  |          | and |
00001880  72 65 74 75 72 6e 20 69  66 20 69 74 20 69 73 20  |return if it is |
00001890  28 69 66 20 79 6f 75 20  72 65 74 75 72 6e 20 77  |(if you return w|
000018a0  69 74 68 20 74 68 65 20  53 20 66 6c 61 67 20 28  |ith the S flag (|
000018b0  4d 6f 76 53 20 50 63 2c  52 31 34 0a 20 20 20 20  |MovS Pc,R14.    |
000018c0  20 20 20 20 20 20 20 20  7c 20 6f 72 20 4c 64 6d  |        | or Ldm|
000018d0  46 64 20 52 31 33 21 2c  7b 2e 2e 2e 2c 50 63 7d  |Fd R13!,{...,Pc}|
000018e0  5e 2c 20 74 68 65 20 66  6c 61 67 73 20 61 72 65  |^, the flags are|
000018f0  20 75 6e 61 66 66 65 63  74 65 64 29 2e 20 4e 65  | unaffected). Ne|
00001900  76 65 72 0a 20 20 20 20  20 20 20 20 20 20 20 20  |ver.            |
00001910  7c 20 63 68 61 6e 67 65  20 74 68 65 20 50 53 52  || change the PSR|
00001920  20 66 6c 61 67 73 20 62  79 20 61 63 63 69 64 65  | flags by accide|
00001930  6e 74 2e 0a 20 20 20 20  20 20 20 20 20 20 20 20  |nt..            |
00001940  7c 0a 20 20 20 20 20 20  20 20 20 20 20 20 7c 0a  ||.            |.|
00001950  20 20 20 20 20 20 20 20  20 20 20 20 7c 20 55 6e  |            | Un|
00001960  6c 69 6b 65 20 4f 53 5f  43 6c 61 69 6d 2c 20 74  |like OS_Claim, t|
00001970  68 69 73 20 53 57 49 20  77 69 6c 6c 20 6e 6f 74  |his SWI will not|
00001980  20 72 65 6d 6f 76 65 20  70 72 65 76 69 6f 75 73  | remove previous|
00001990  20 69 6e 73 74 61 6e 63  65 73 20 6f 66 0a 20 20  | instances of.  |
000019a0  20 20 20 20 20 20 20 20  20 20 7c 20 63 6c 61 69  |          | clai|
000019b0  6d 73 20 77 69 74 68 20  74 68 65 20 73 61 6d 65  |ms with the same|
000019c0  20 76 61 6c 75 65 73 2e  20 54 68 65 20 72 65 6c  | values. The rel|
000019d0  65 61 73 65 20 72 6f 75  74 69 6e 65 20 61 6c 73  |ease routine als|
000019e0  6f 20 6f 6e 6c 79 0a 20  20 20 20 20 20 20 20 20  |o only.         |
000019f0  20 20 20 7c 20 72 65 6d  6f 76 65 73 20 6f 6e 65  |   | removes one|
00001a00  20 69 6e 73 74 61 6e 63  65 20 6f 66 20 74 68 65  | instance of the|
00001a10  20 76 61 6c 75 65 73 20  61 74 20 61 20 74 69 6d  | values at a tim|
00001a20  65 2e 0a 20 20 20 20 20  20 20 20 20 20 20 20 7c  |e..            ||
00001a30  0a 20 20 20 20 20 20 20  20 20 20 20 20 7c 20 43  |.            | C|
00001a40  6c 61 69 6d 69 6e 67 20  74 68 65 20 57 69 6d 70  |laiming the Wimp|
00001a50  5f 52 65 67 69 73 74 65  72 46 69 6c 74 65 72 20  |_RegisterFilter |
00001a60  53 57 49 20 6f 6e 6c 79  20 74 72 61 70 73 20 74  |SWI only traps t|
00001a70  68 65 20 6e 6f 72 6d 61  6c 0a 20 20 20 20 20 20  |he normal.      |
00001a80  20 20 20 20 20 20 7c 20  66 69 6c 74 65 72 2d 62  |      | filter-b|
00001a90  61 73 65 64 20 75 73 65  20 6f 66 20 74 68 65 20  |ased use of the |
00001aa0  53 57 49 2e 20 55 6e 64  65 72 20 6e 6f 20 63 69  |SWI. Under no ci|
00001ab0  72 63 75 6d 73 74 61 6e  63 65 73 20 73 68 6f 75  |rcumstances shou|
00001ac0  6c 64 20 79 6f 75 0a 20  20 20 20 20 20 20 20 20  |ld you.         |
00001ad0  20 20 20 7c 20 63 61 6c  6c 20 57 69 6d 70 5f 52  |   | call Wimp_R|
00001ae0  65 67 69 73 74 65 72 46  69 6c 74 65 72 20 77 69  |egisterFilter wi|
00001af0  74 68 20 57 69 6d 70 53  57 49 56 65 20 75 73 61  |th WimpSWIVe usa|
00001b00  67 65 20 69 6e 20 79 6f  75 72 20 74 72 61 70 70  |ge in your trapp|
00001b10  69 6e 67 0a 20 20 20 20  20 20 20 20 20 20 20 20  |ing.            |
00001b20  7c 20 63 6f 64 65 2e 20  49 66 20 79 6f 75 20 72  || code. If you r|
00001b30  65 61 6c 6c 79 20 6d 75  73 74 20 63 6c 61 69 6d  |eally must claim|
00001b40  20 6f 72 20 72 65 6c 65  61 73 65 20 61 20 53 57  | or release a SW|
00001b50  49 20 77 68 65 6e 20 73  6f 6d 65 20 6f 74 68 65  |I when some othe|
00001b60  72 0a 20 20 20 20 20 20  20 20 20 20 20 20 7c 20  |r.            | |
00001b70  53 57 49 20 69 73 20 65  78 65 63 75 74 65 64 2c  |SWI is executed,|
00001b80  20 75 73 65 20 61 20 43  61 6c 6c 42 61 63 6b 20  | use a CallBack |
00001b90  74 6f 20 64 6f 20 69 74  2e 20 28 53 65 65 20 74  |to do it. (See t|
00001ba0  68 65 20 52 49 53 43 20  4f 53 20 33 0a 20 20 20  |he RISC OS 3.   |
00001bb0  20 20 20 20 20 20 20 20  20 7c 20 50 72 6f 67 72  |         | Progr|
00001bc0  61 6d 6d 65 72 73 91 20  52 65 66 65 72 65 6e 63  |ammers. Referenc|
00001bd0  65 20 4d 61 6e 75 61 6c  2c 20 70 61 67 65 20 31  |e Manual, page 1|
00001be0  2d 33 31 39 2e 29 0a 20  20 20 20 20 20 20 20 20  |-319.).         |
00001bf0  20 20 20 7c 0a 20 20 20  20 20 20 20 20 20 20 20  |   |.           |
00001c00  20 7c 20 44 6f 6e 91 74  20 70 6f 73 74 2d 74 72  | | Don.t post-tr|
00001c10  61 70 20 57 69 6d 70 5f  50 6f 6c 6c 28 49 64 6c  |ap Wimp_Poll(Idl|
00001c20  65 29 20 6f 72 20 57 69  6d 70 5f 53 74 61 72 74  |e) or Wimp_Start|
00001c30  54 61 73 6b 3a 20 69 74  91 73 20 61 20 62 61 64  |Task: it.s a bad|
00001c40  0a 20 20 20 20 20 20 20  20 20 20 20 20 7c 20 69  |.            | i|
00001c50  64 65 61 2e 20 57 69 6d  70 53 57 49 56 65 20 64  |dea. WimpSWIVe d|
00001c60  65 61 6c 73 20 77 69 74  68 20 69 74 20 61 64 65  |eals with it ade|
00001c70  71 75 61 74 65 6c 79 2c  20 62 75 74 20 74 68 65  |quately, but the|
00001c80  72 65 20 61 72 65 20 61  6c 6c 0a 20 20 20 20 20  |re are all.     |
00001c90  20 20 20 20 20 20 20 7c  20 73 6f 72 74 73 20 6f  |       | sorts o|
00001ca0  66 20 73 69 6d 70 6c 79  20 68 6f 72 72 69 64 20  |f simply horrid |
00001cb0  69 6d 70 6c 69 63 61 74  69 6f 6e 73 2e 20 54 72  |implications. Tr|
00001cc0  61 70 70 69 6e 67 20 57  69 6d 70 5f 50 6f 6c 6c  |apping Wimp_Poll|
00001cd0  20 69 73 0a 20 20 20 20  20 20 20 20 20 20 20 20  | is.            |
00001ce0  7c 20 65 61 73 79 20 61  6e 79 77 61 79 2c 20 75  || easy anyway, u|
00001cf0  73 69 6e 67 20 74 68 65  20 6f 6c 64 20 66 69 6c  |sing the old fil|
00001d00  74 65 72 20 73 79 73 74  65 6d 2e 0a 20 20 20 20  |ter system..    |
00001d10  20 20 20 20 20 20 20 20  7c 0a 20 20 20 20 20 20  |        |.      |
00001d20  20 20 20 20 20 20 7c 20  41 6e 64 20 66 69 6e 61  |      | And fina|
00001d30  6c 6c 79 2c 20 64 6f 6e  91 74 20 75 73 65 20 74  |lly, don.t use t|
00001d40  68 65 20 90 63 6c 61 69  6d 20 61 6c 6c 20 53 57  |he .claim all SW|
00001d50  49 73 91 20 66 6c 61 67  20 75 6e 6c 65 73 73 20  |Is. flag unless |
00001d60  79 6f 75 0a 20 20 20 20  20 20 20 20 20 20 20 20  |you.            |
00001d70  7c 20 72 65 61 6c 6c 79  20 77 61 6e 74 20 61 6c  || really want al|
00001d80  6c 20 74 68 65 20 53 57  49 73 2e 20 44 6f 6e 91  |l the SWIs. Don.|
00001d90  74 20 75 73 65 20 69 74  20 66 6f 72 20 74 72 61  |t use it for tra|
00001da0  70 70 69 6e 67 20 61 20  6e 75 6d 62 65 72 0a 20  |pping a number. |
00001db0  20 20 20 20 20 20 20 20  20 20 20 7c 20 6f 66 20  |           | of |
00001dc0  64 69 66 66 65 72 65 6e  74 20 53 57 49 73 2c 20  |different SWIs, |
00001dd0  75 73 65 20 6d 61 6e 79  20 73 65 70 61 72 61 74  |use many separat|
00001de0  65 20 63 6c 61 69 6d 73  3a 20 74 68 65 20 73 70  |e claims: the sp|
00001df0  65 65 64 0a 20 20 20 20  20 20 20 20 20 20 20 20  |eed.            |
00001e00  7c 20 64 69 66 66 65 72  65 6e 63 65 20 77 69 6c  || difference wil|
00001e10  6c 20 62 65 20 6e 65 67  6c 69 67 61 62 6c 65 2c  |l be negligable,|
00001e20  20 61 6e 64 20 79 6f 75  20 6e 65 65 64 6e 91 74  | and you needn.t|
00001e30  20 77 6f 72 72 79 20 61  62 6f 75 74 0a 20 20 20  | worry about.   |
00001e40  20 20 20 20 20 20 20 20  20 7c 20 57 69 6d 70 5f  |         | Wimp_|
00001e50  50 6f 6c 6c 2e 20 54 68  65 20 90 63 6c 61 69 6d  |Poll. The .claim|
00001e60  20 61 6c 6c 20 53 57 49  73 91 20 66 6c 61 67 20  | all SWIs. flag |
00001e70  69 73 20 75 6e 6c 69 6b  65 6c 79 20 74 6f 20 62  |is unlikely to b|
00001e80  65 20 77 69 64 65 6c 79  0a 20 20 20 20 20 20 20  |e widely.       |
00001e90  20 20 20 20 20 7c 20 75  73 65 66 75 6c 20 2d 20  |     | useful - |
00001ea0  61 20 57 69 6d 70 20 53  57 49 20 6c 6f 67 67 69  |a Wimp SWI loggi|
00001eb0  6e 67 20 70 72 6f 67 72  61 6d 20 73 65 65 6d 73  |ng program seems|
00001ec0  20 74 6f 20 62 65 20 74  68 65 20 6f 6e 6c 79 0a  | to be the only.|
00001ed0  20 20 20 20 20 20 20 20  20 20 20 20 7c 20 70 6f  |            | po|
00001ee0  73 73 69 62 6c 65 20 75  73 65 72 2e 0a 20 20 20  |ssible user..   |
00001ef0  20 20 20 20 20 20 20 20  20 7c 0a 20 20 20 20 45  |         |.    E|
00001f00  72 72 6f 72 73 3a 20 7c  20 42 61 64 20 76 61 6c  |rrors: | Bad val|
00001f10  75 65 20 70 61 73 73 65  64 20 74 6f 20 57 49 4d  |ue passed to WIM|
00001f20  50 20 69 6e 20 52 30 0a  20 20 20 20 20 20 20 20  |P in R0.        |
00001f30  20 20 20 20 7c 20 20 20  20 69 66 20 57 69 6d 70  |    |    if Wimp|
00001f40  53 57 49 56 65 20 69 73  20 6e 6f 74 20 6c 6f 61  |SWIVe is not loa|
00001f50  64 65 64 2c 20 74 68 65  20 61 74 74 65 6d 70 74  |ded, the attempt|
00001f60  20 74 6f 20 75 73 65 20  74 68 69 73 20 53 57 49  | to use this SWI|
00001f70  20 69 6e 0a 20 20 20 20  20 20 20 20 20 20 20 20  | in.            |
00001f80  7c 20 20 20 20 74 68 65  20 57 69 6d 70 53 57 49  ||    the WimpSWI|
00001f90  56 65 20 6d 61 6e 6e 65  72 20 77 69 6c 6c 20 63  |Ve manner will c|
00001fa0  61 75 73 65 20 74 68 69  73 20 65 72 72 6f 72 0a  |ause this error.|
00001fb0  20 20 20 20 20 20 20 20  20 20 20 20 7c 20 42 61  |            | Ba|
00001fc0  64 20 57 69 6d 70 53 57  49 56 65 20 72 65 6c 65  |d WimpSWIVe rele|
00001fd0  61 73 65 0a 20 20 20 20  20 20 20 20 20 20 20 20  |ase.            |
00001fe0  7c 20 20 20 20 72 65 6c  65 61 73 69 6e 67 20 61  ||    releasing a|
00001ff0  20 53 57 49 20 79 6f 75  20 68 61 64 20 6e 6f 74  | SWI you had not|
00002000  20 63 6c 61 69 6d 65 64  20 67 65 6e 65 72 61 74  | claimed generat|
00002010  65 73 20 74 68 69 73 20  65 72 72 6f 72 0a 20 20  |es this error.  |
00002020  20 20 20 20 20 20 20 20  20 20 7c 20 4e 6f 20 72  |          | No r|
00002030  6f 6f 6d 20 69 6e 20 52  4d 41 0a 20 20 20 20 20  |oom in RMA.     |
00002040  20 20 20 20 20 20 20 7c  20 20 20 20 69 73 20 61  |       |    is a|
00002050  6c 73 6f 20 70 6f 73 73  69 62 6c 65 20 62 75 74  |lso possible but|
00002060  20 68 69 67 68 6c 79 20  75 6e 6c 69 6b 65 6c 79  | highly unlikely|
00002070  2e 0a 20 20 20 20 20 20  20 20 20 20 20 20 7c 0a  |..            |.|
00002080  0a 0a 20 46 6f 6f 74 6e  6f 74 65 20 31 20 2d 20  |.. Footnote 1 - |
00002090  52 65 2d 65 6e 74 72 61  6e 63 79 20 69 73 73 75  |Re-entrancy issu|
000020a0  65 73 3a 0a 0a 20 52 65  2d 65 6e 74 72 61 6e 63  |es:.. Re-entranc|
000020b0  79 20 69 73 20 6e 61 65  20 70 72 6f 62 6c 65 6d  |y is nae problem|
000020c0  20 69 66 20 79 6f 75 20  6f 6e 6c 79 20 75 73 65  | if you only use|
000020d0  20 70 72 65 2d 74 72 61  70 70 69 6e 67 20 6f 72  | pre-trapping or|
000020e0  20 6f 6e 6c 79 20 75 73  65 20 70 6f 73 74 2d 0a  | only use post-.|
000020f0  74 72 61 70 70 69 6e 67  20 2d 20 79 6f 75 20 63  |trapping - you c|
00002100  61 6e 20 65 69 74 68 65  72 20 62 65 20 72 65 2d  |an either be re-|
00002110  65 6e 74 72 61 6e 74 20  62 79 20 75 73 69 6e 67  |entrant by using|
00002120  20 61 20 73 74 61 63 6b  20 74 6f 20 73 74 6f 72  | a stack to stor|
00002130  65 20 73 74 75 66 66 2c  20 6f 72 0a 70 72 65 76  |e stuff, or.prev|
00002140  65 6e 74 20 72 65 2d 65  6e 74 65 72 69 6e 67 20  |ent re-entering |
00002150  75 73 69 6e 67 20 61 20  74 68 72 65 61 64 65 64  |using a threaded|
00002160  20 66 6c 61 67 20 28 61  6e 64 20 75 6e 6c 65 73  | flag (and unles|
00002170  73 20 79 6f 75 20 63 61  6c 6c 20 61 20 53 57 49  |s you call a SWI|
00002180  2c 20 79 6f 75 0a 63 61  6e 6e 6f 74 20 62 65 20  |, you.cannot be |
00002190  72 65 2d 65 6e 74 65 72  65 64 20 61 6e 79 77 61  |re-entered anywa|
000021a0  79 29 2e 20 49 66 20 79  6f 75 20 75 73 65 20 62  |y). If you use b|
000021b0  6f 74 68 2c 20 62 75 74  20 74 68 65 20 70 6f 73  |oth, but the pos|
000021c0  74 2d 63 6f 64 65 20 61  6c 77 61 79 73 20 64 6f  |t-code always do|
000021d0  65 73 0a 74 68 65 20 73  61 6d 65 20 72 65 67 61  |es.the same rega|
000021e0  72 64 6c 65 73 73 20 6f  66 20 74 68 65 20 70 72  |rdless of the pr|
000021f0  65 2d 63 6f 64 65 2c 20  79 6f 75 91 72 65 20 61  |e-code, you.re a|
00002200  6c 6c 20 72 69 67 68 74  20 74 6f 6f 2e 0a 0a 20  |ll right too... |
00002210  42 75 74 20 69 66 20 79  6f 75 20 75 73 65 20 62  |But if you use b|
00002220  6f 74 68 20 61 74 20 6f  6e 63 65 20 61 6e 64 20  |oth at once and |
00002230  74 68 65 20 61 63 74 69  6f 6e 20 6f 66 20 70 6f  |the action of po|
00002240  73 74 20 64 65 70 65 6e  64 73 20 6f 6e 20 73 6f  |st depends on so|
00002250  6d 65 74 68 69 6e 67 0a  74 68 61 74 20 68 61 70  |mething.that hap|
00002260  70 65 6e 65 64 20 69 6e  20 70 72 65 20 28 66 6f  |pened in pre (fo|
00002270  72 20 65 78 61 6d 70 6c  65 20 69 66 20 79 6f 75  |r example if you|
00002280  20 68 61 76 65 20 70 72  65 20 74 6f 20 63 68 65  | have pre to che|
00002290  63 6b 20 74 68 65 20 72  65 61 73 6f 6e 20 63 6f  |ck the reason co|
000022a0  64 65 0a 69 73 20 77 6f  72 74 68 20 62 6f 74 68  |de.is worth both|
000022b0  65 72 69 6e 67 20 77 69  74 68 20 69 6e 20 74 68  |ering with in th|
000022c0  65 20 70 6f 73 74 2d 74  72 61 70 20 63 6f 64 65  |e post-trap code|
000022d0  29 2c 20 69 74 20 69 73  20 73 6c 69 67 68 74 6c  |), it is slightl|
000022e0  79 20 6d 6f 72 65 20 63  6f 6d 70 6c 65 78 2e 0a  |y more complex..|
000022f0  49 74 91 73 20 71 75 69  74 65 20 70 6f 73 73 69  |It.s quite possi|
00002300  62 6c 65 20 74 68 61 74  20 63 61 6c 6c 69 6e 67  |ble that calling|
00002310  20 61 20 57 69 6d 70 20  53 57 49 20 6d 61 79 20  | a Wimp SWI may |
00002320  63 61 75 73 65 20 61 6e  6f 74 68 65 72 20 57 69  |cause another Wi|
00002330  6d 70 20 53 57 49 20 74  6f 20 62 65 0a 63 61 6c  |mp SWI to be.cal|
00002340  6c 65 64 2c 20 65 73 70  65 63 69 61 6c 6c 79 20  |led, especially |
00002350  77 68 65 6e 20 79 6f 75  20 63 6f 6e 73 69 64 65  |when you conside|
00002360  72 20 74 68 65 72 65 20  63 61 6e 20 62 65 20 6d  |r there can be m|
00002370  61 6e 79 20 57 69 6d 70  53 57 49 56 65 20 63 6c  |any WimpSWIVe cl|
00002380  61 69 6d 61 6e 74 73 2e  0a 43 6f 6e 73 69 64 65  |aimants..Conside|
00002390  72 3a 0a 0a 20 20 20 20  20 53 57 49 20 57 69 6d  |r:..     SWI Wim|
000023a0  70 5f 54 68 69 6e 67 20  63 61 6c 6c 65 64 0a 20  |p_Thing called. |
000023b0  20 20 20 20 20 20 57 69  6d 70 53 57 49 56 65 20  |      WimpSWIVe |
000023c0  63 6c 61 69 6d 61 6e 74  20 31 20 70 72 65 2d 74  |claimant 1 pre-t|
000023d0  72 61 70 73 20 53 57 49  0a 20 20 20 20 20 20 20  |raps SWI.       |
000023e0  20 20 43 6c 61 69 6d 61  6e 74 20 31 20 73 74 6f  |  Claimant 1 sto|
000023f0  72 65 20 64 61 74 61 20  66 6f 72 20 53 57 49 20  |re data for SWI |
00002400  31 20 69 6e 20 77 6f 72  6b 73 70 61 63 65 0a 20  |1 in workspace. |
00002410  20 20 20 20 20 20 57 69  6d 70 53 57 49 56 65 20  |      WimpSWIVe |
00002420  63 6c 61 69 6d 61 6e 74  20 32 20 70 72 65 2d 74  |claimant 2 pre-t|
00002430  72 61 70 73 20 53 57 49  0a 20 20 20 20 20 20 20  |raps SWI.       |
00002440  20 20 43 6c 61 69 6d 61  6e 74 20 32 20 65 78 65  |  Claimant 2 exe|
00002450  63 75 74 65 73 20 57 69  6d 70 5f 47 75 62 62 69  |cutes Wimp_Gubbi|
00002460  6e 73 0a 20 20 20 20 20  20 20 20 20 20 20 57 69  |ns.           Wi|
00002470  6d 70 5f 47 75 62 62 69  6e 73 20 63 61 75 73 65  |mp_Gubbins cause|
00002480  73 20 57 69 6d 70 5f 54  68 69 6e 67 20 74 6f 20  |s Wimp_Thing to |
00002490  62 65 20 63 61 6c 6c 65  64 0a 20 20 20 20 20 20  |be called.      |
000024a0  20 20 20 20 20 20 20 57  69 6d 70 53 57 49 56 65  |       WimpSWIVe|
000024b0  20 63 6c 61 69 6d 61 6e  74 20 31 20 70 72 65 2d  | claimant 1 pre-|
000024c0  74 72 61 70 73 20 53 57  49 0a 20 20 20 20 20 20  |traps SWI.      |
000024d0  20 20 20 20 20 20 20 20  20 43 6c 61 69 6d 61 6e  |         Claiman|
000024e0  74 20 31 20 73 74 6f 72  65 73 20 64 61 74 61 20  |t 1 stores data |
000024f0  66 6f 72 20 53 57 49 20  32 20 69 6e 20 77 6f 72  |for SWI 2 in wor|
00002500  6b 73 70 61 63 65 0a 20  20 20 20 20 20 20 20 20  |kspace.         |
00002510  20 20 20 20 57 69 6d 70  53 57 49 56 65 20 63 6c  |    WimpSWIVe cl|
00002520  61 69 6d 61 6e 74 20 32  20 70 72 65 2d 74 72 61  |aimant 2 pre-tra|
00002530  70 73 20 53 57 49 0a 20  20 20 20 20 20 20 20 20  |ps SWI.         |
00002540  20 20 20 20 20 20 43 6c  61 69 6d 61 6e 74 20 32  |      Claimant 2|
00002550  20 69 73 20 74 68 72 65  61 64 65 64 2c 20 61 6e  | is threaded, an|
00002560  64 20 73 6f 20 64 6f 65  73 20 6e 6f 74 68 69 6e  |d so does nothin|
00002570  67 0a 20 20 20 20 20 20  20 20 20 20 20 20 20 57  |g.             W|
00002580  69 6d 70 53 57 49 56 65  20 65 78 65 63 75 74 65  |impSWIVe execute|
00002590  73 20 72 65 61 6c 20 53  57 49 20 57 69 6d 70 5f  |s real SWI Wimp_|
000025a0  54 68 69 6e 67 0a 20 20  20 20 20 20 20 20 20 20  |Thing.          |
000025b0  20 20 20 57 69 6d 70 53  57 49 56 65 20 63 6c 61  |   WimpSWIVe cla|
000025c0  69 6d 61 6e 74 20 32 20  70 6f 73 74 2d 74 72 61  |imant 2 post-tra|
000025d0  70 73 20 53 57 49 0a 20  20 20 20 20 20 20 20 20  |ps SWI.         |
000025e0  20 20 20 20 20 20 43 6c  61 69 6d 61 6e 74 20 32  |      Claimant 2|
000025f0  20 69 73 20 74 68 72 65  61 64 65 64 2c 20 61 6e  | is threaded, an|
00002600  64 20 73 6f 20 64 6f 65  73 20 6e 6f 74 68 69 6e  |d so does nothin|
00002610  67 0a 20 20 20 20 20 20  20 20 20 20 20 20 20 57  |g.             W|
00002620  69 6d 70 53 57 49 56 65  20 63 6c 61 69 6d 61 6e  |impSWIVe claiman|
00002630  74 20 31 20 70 6f 73 74  2d 74 72 61 70 73 20 53  |t 1 post-traps S|
00002640  57 49 0a 20 20 20 20 20  20 20 20 20 20 20 20 20  |WI.             |
00002650  20 20 43 6c 61 69 6d 61  6e 74 20 31 20 70 65 72  |  Claimant 1 per|
00002660  66 6f 72 6d 73 20 61 63  74 69 6f 6e 20 6f 6e 20  |forms action on |
00002670  72 65 73 75 6c 74 73 2c  20 64 65 70 65 6e 64 65  |results, depende|
00002680  6e 74 20 6f 6e 20 77 6f  72 6b 73 70 61 63 65 0a  |nt on workspace.|
00002690  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 77  |               w|
000026a0  68 69 63 68 20 68 6f 6c  64 73 20 64 61 74 61 20  |hich holds data |
000026b0  66 6f 72 20 53 57 49 20  32 0a 20 20 20 20 20 20  |for SWI 2.      |
000026c0  20 20 20 20 20 20 20 57  69 6d 70 53 57 49 56 65  |       WimpSWIVe|
000026d0  20 72 65 74 75 72 6e 73  0a 20 20 20 20 20 20 20  | returns.       |
000026e0  57 69 6d 70 53 57 49 56  65 20 65 78 65 63 75 74  |WimpSWIVe execut|
000026f0  65 73 20 72 65 61 6c 20  57 69 6d 70 5f 54 68 69  |es real Wimp_Thi|
00002700  6e 67 20 53 57 49 0a 20  20 20 20 20 20 20 57 69  |ng SWI.       Wi|
00002710  6d 70 53 57 49 56 65 20  63 6c 61 69 6d 61 6e 74  |mpSWIVe claimant|
00002720  20 32 20 70 6f 73 74 2d  74 72 61 70 73 20 53 57  | 2 post-traps SW|
00002730  49 0a 20 20 20 20 20 20  20 20 20 43 6c 61 69 6d  |I.         Claim|
00002740  61 6e 74 20 32 20 64 6f  65 73 20 77 68 61 74 65  |ant 2 does whate|
00002750  76 65 72 20 69 74 20 6e  65 65 64 73 20 74 6f 20  |ver it needs to |
00002760  77 69 74 68 20 72 65 73  75 6c 74 73 0a 20 20 20  |with results.   |
00002770  20 20 20 20 57 69 6d 70  53 57 49 56 65 20 63 6c  |    WimpSWIVe cl|
00002780  61 69 6d 61 6e 74 20 31  20 70 6f 73 74 2d 74 72  |aimant 1 post-tr|
00002790  61 70 73 20 53 57 49 0a  20 20 20 20 20 20 20 20  |aps SWI.        |
000027a0  20 43 6c 61 69 6d 61 6e  74 20 31 20 70 65 72 66  | Claimant 1 perf|
000027b0  6f 72 6d 73 20 61 63 74  69 6f 6e 20 6f 6e 20 72  |orms action on r|
000027c0  65 73 75 6c 74 73 2c 20  64 65 70 65 6e 64 65 6e  |esults, dependen|
000027d0  74 20 6f 6e 20 77 6f 72  6b 73 70 61 63 65 0a 20  |t on workspace. |
000027e0  20 20 20 20 20 20 20 20  77 68 69 63 68 20 68 6f  |        which ho|
000027f0  6c 64 73 20 64 61 74 61  20 66 6f 72 20 53 57 49  |lds data for SWI|
00002800  20 2a 32 2a 0a 20 20 20  20 20 20 20 57 69 6d 70  | *2*.       Wimp|
00002810  53 57 49 56 65 20 72 65  74 75 72 6e 73 0a 0a 20  |SWIVe returns.. |
00002820  41 73 20 79 6f 75 20 63  61 6e 20 73 65 65 2c 20  |As you can see, |
00002830  74 68 65 72 65 20 69 73  20 61 20 6c 6f 74 20 6f  |there is a lot o|
00002840  66 20 73 63 6f 70 65 20  68 65 72 65 20 66 6f 72  |f scope here for|
00002850  20 74 68 69 6e 67 73 20  67 6f 69 6e 67 20 77 72  | things going wr|
00002860  6f 6e 67 2c 20 61 6e 64  0a 68 6f 72 72 69 62 6c  |ong, and.horribl|
00002870  65 20 63 6c 61 73 68 65  73 20 77 68 65 72 65 20  |e clashes where |
00002880  6f 6e 65 20 57 69 6d 70  53 57 49 56 65 20 70 72  |one WimpSWIVe pr|
00002890  6f 67 72 61 6d 20 6d 61  79 20 6d 61 6b 65 20 61  |ogram may make a|
000028a0  6e 6f 74 68 65 72 20 67  6f 20 77 72 6f 6e 67 2c  |nother go wrong,|
000028b0  0a 70 6f 74 65 6e 74 69  61 6c 6c 79 20 72 61 74  |.potentially rat|
000028c0  68 65 72 20 6d 65 73 73  69 6c 79 2e 0a 0a 20 54  |her messily... T|
000028d0  68 65 72 65 20 61 72 65  20 74 77 6f 20 74 68 69  |here are two thi|
000028e0  6e 67 73 20 79 6f 75 20  63 61 6e 20 64 6f 20 61  |ngs you can do a|
000028f0  62 6f 75 74 20 69 74 2e  20 50 65 72 68 61 70 73  |bout it. Perhaps|
00002900  20 74 68 65 20 62 65 73  74 20 69 73 20 74 6f 20  | the best is to |
00002910  73 74 6f 72 65 20 61 0a  90 63 6f 75 6e 74 91 20  |store a..count. |
00002920  6f 66 20 70 6f 73 74 2d  74 72 61 70 73 20 74 6f  |of post-traps to|
00002930  20 69 67 6e 6f 72 65 2e  20 54 68 69 73 20 63 6f  | ignore. This co|
00002940  75 6e 74 20 73 68 6f 75  6c 64 20 62 65 20 7a 65  |unt should be ze|
00002950  72 6f 20 69 6e 69 74 69  61 6c 6c 79 2c 20 61 6e  |ro initially, an|
00002960  64 0a 73 68 6f 75 6c 64  20 62 65 20 69 6e 63 72  |d.should be incr|
00002970  65 6d 65 6e 74 65 64 20  66 69 72 73 74 20 77 68  |emented first wh|
00002980  65 6e 20 79 6f 75 72 20  70 72 65 2d 74 72 61 70  |en your pre-trap|
00002990  20 63 6f 64 65 20 64 65  74 65 63 74 73 20 74 68  | code detects th|
000029a0  61 74 20 70 6f 73 74 2d  0a 74 72 61 70 70 69 6e  |at post-.trappin|
000029b0  67 20 73 68 6f 75 6c 64  20 64 6f 20 73 6f 6d 65  |g should do some|
000029c0  74 68 69 6e 67 20 65 66  66 65 63 74 69 76 65 2e  |thing effective.|
000029d0  20 49 74 20 73 68 6f 75  6c 64 20 61 6c 73 6f 20  | It should also |
000029e0  62 65 20 69 6e 63 72 65  6d 65 6e 74 65 64 20 65  |be incremented e|
000029f0  76 65 72 79 0a 74 69 6d  65 20 74 68 65 20 70 72  |very.time the pr|
00002a00  65 2d 74 72 61 70 20 63  6f 64 65 20 69 73 20 65  |e-trap code is e|
00002a10  6e 74 65 72 65 64 20 77  69 74 68 20 74 68 65 20  |ntered with the |
00002a20  63 6f 75 6e 74 20 6e 6f  6e 2d 7a 65 72 6f 2e 20  |count non-zero. |
00002a30  54 68 65 20 70 6f 73 74  20 74 72 61 70 20 63 6f  |The post trap co|
00002a40  64 65 0a 74 68 65 6e 20  63 68 65 63 6b 73 20 74  |de.then checks t|
00002a50  68 65 20 63 6f 75 6e 74  20 6f 6e 20 65 6e 74 72  |he count on entr|
00002a60  79 2e 20 49 66 20 74 68  65 20 63 6f 75 6e 74 20  |y. If the count |
00002a70  69 73 20 7a 65 72 6f 2c  20 69 74 20 72 65 74 75  |is zero, it retu|
00002a80  72 6e 73 20 64 6f 69 6e  67 0a 6e 6f 74 68 69 6e  |rns doing.nothin|
00002a90  67 2e 20 49 66 20 74 68  65 20 63 6f 75 6e 74 20  |g. If the count |
00002aa0  69 73 20 6f 6e 65 20 6f  72 20 67 72 65 61 74 65  |is one or greate|
00002ab0  72 2c 20 74 68 65 20 63  6f 75 6e 74 20 69 73 20  |r, the count is |
00002ac0  64 65 63 72 65 6d 65 6e  74 65 64 2e 20 49 66 20  |decremented. If |
00002ad0  74 68 65 0a 63 6f 75 6e  74 20 69 73 20 6f 6e 65  |the.count is one|
00002ae0  20 65 78 61 63 74 6c 79  20 6f 6e 65 2c 20 74 68  | exactly one, th|
00002af0  65 20 65 66 66 65 63 74  20 6f 66 20 74 68 65 20  |e effect of the |
00002b00  70 6f 73 74 2d 74 72 61  70 20 69 73 20 61 63 74  |post-trap is act|
00002b10  69 76 61 74 65 64 2e 20  54 68 65 72 65 91 73 0a  |ivated. There.s.|
00002b20  61 6e 20 65 78 61 6d 70  6c 65 20 6f 66 20 74 68  |an example of th|
00002b30  69 73 20 69 6e 20 74 68  65 20 45 69 67 65 6e 53  |is in the EigenS|
00002b40  79 73 49 6e 66 6f 20 73  6f 75 72 63 65 2e 0a 0a  |ysInfo source...|
00002b50  20 54 68 69 73 20 69 73  20 66 69 6e 65 20 6e 6f  | This is fine no|
00002b60  72 6d 61 6c 6c 79 2c 20  62 75 74 20 69 74 20 6d  |rmally, but it m|
00002b70  61 6b 65 73 20 74 68 65  20 74 72 61 70 70 69 6e  |akes the trappin|
00002b80  67 20 63 6f 64 65 20 6f  6e 6c 79 20 61 66 66 65  |g code only affe|
00002b90  63 74 20 74 68 65 20 66  69 72 73 74 0a 53 57 49  |ct the first.SWI|
00002ba0  20 74 6f 20 62 65 20 61  66 66 65 63 74 65 64 20  | to be affected |
00002bb0  28 74 68 65 20 22 6f 75  74 65 72 6d 6f 73 74 22  |(the "outermost"|
00002bc0  20 61 66 66 65 63 74 65  64 20 53 57 49 29 2e 20  | affected SWI). |
00002bd0  49 66 20 79 6f 75 20 77  61 6e 74 20 74 6f 20 62  |If you want to b|
00002be0  65 20 74 72 75 6c 79 0a  72 65 2d 65 6e 74 72 61  |e truly.re-entra|
00002bf0  6e 74 2c 20 79 6f 75 91  64 20 68 61 76 65 20 74  |nt, you.d have t|
00002c00  6f 20 73 74 6f 72 65 20  76 61 6c 75 65 73 20 6f  |o store values o|
00002c10  6e 20 74 68 65 20 73 74  61 63 6b 20 74 6f 20 69  |n the stack to i|
00002c20  6e 64 69 63 61 74 65 20  77 68 65 74 68 65 72 20  |ndicate whether |
00002c30  74 6f 0a 70 6f 73 74 2d  74 72 61 70 20 6f 6e 20  |to.post-trap on |
00002c40  65 61 63 68 20 63 61 6c  6c 2e 20 41 6e 64 20 79  |each call. And y|
00002c50  6f 75 20 63 6f 75 6c 64  6e 91 74 20 75 73 65 20  |ou couldn.t use |
00002c60  74 68 65 20 53 56 43 20  73 74 61 63 6b 2c 20 73  |the SVC stack, s|
00002c70  6f 20 79 6f 75 91 64 20  68 61 76 65 20 74 6f 0a  |o you.d have to.|
00002c80  75 73 65 20 61 20 70 72  69 76 61 74 65 20 73 74  |use a private st|
00002c90  61 63 6b 2e 20 41 6e 64  20 79 6f 75 91 64 20 68  |ack. And you.d h|
00002ca0  61 76 65 20 74 6f 20 72  65 76 65 72 74 20 74 6f  |ave to revert to|
00002cb0  20 74 68 65 20 61 62 6f  76 65 20 62 65 68 61 76  | the above behav|
00002cc0  69 6f 75 72 20 69 66 20  74 68 65 0a 73 74 61 63  |iour if the.stac|
00002cd0  6b 20 77 61 73 20 66 69  6c 6c 65 64 20 75 70 2e  |k was filled up.|
00002ce0  20 54 68 65 72 65 66 6f  72 65 2c 20 49 20 64 6f  | Therefore, I do|
00002cf0  6e 91 74 20 72 65 63 6b  6f 6e 20 69 74 91 73 20  |n.t reckon it.s |
00002d00  77 6f 72 74 68 20 62 6f  74 68 65 72 69 6e 67 20  |worth bothering |
00002d10  77 69 74 68 2c 0a 65 73  70 65 63 69 61 6c 6c 79  |with,.especially|
00002d20  20 61 73 20 61 6c 6c 6f  77 69 6e 67 20 74 72 75  | as allowing tru|
00002d30  65 20 72 65 2d 65 6e 74  72 61 6e 63 79 20 6f 70  |e re-entrancy op|
00002d40  65 6e 73 20 74 68 65 20  64 6f 6f 72 20 74 6f 20  |ens the door to |
00002d50  72 65 63 75 72 73 69 76  65 20 70 72 6f 62 6c 65  |recursive proble|
00002d60  6d 73 0a 28 57 69 6d 70  5f 54 68 69 6e 67 20 63  |ms.(Wimp_Thing c|
00002d70  61 6c 6c 73 20 57 69 6d  70 5f 47 75 62 62 69 6e  |alls Wimp_Gubbin|
00002d80  73 20 63 61 6c 6c 73 20  57 69 6d 70 5f 54 68 69  |s calls Wimp_Thi|
00002d90  6e 67 20 63 61 6c 6c 73  20 57 69 6d 70 5f 47 75  |ng calls Wimp_Gu|
00002da0  62 62 69 6e 73 20 65 74  63 2e 29 20 74 6f 6f 2e  |bbins etc.) too.|
00002db0  0a 0a 20 53 6f 72 72 79  20 61 62 6f 75 74 20 74  |.. Sorry about t|
00002dc0  68 65 20 63 6f 6d 70 6c  65 78 69 74 79 20 6f 66  |he complexity of|
00002dd0  20 74 68 69 73 20 66 6f  6f 74 6e 6f 74 65 2e 20  | this footnote. |
00002de0  52 65 6c 61 78 2e 20 59  6f 75 20 64 6f 6e 91 74  |Relax. You don.t|
00002df0  20 6e 65 65 64 20 74 6f  0a 62 6f 74 68 65 72 20  | need to.bother |
00002e00  61 62 6f 75 74 20 61 6c  6c 20 74 68 69 73 20 68  |about all this h|
00002e10  6f 72 72 69 64 20 73 74  75 66 66 2c 20 75 73 75  |orrid stuff, usu|
00002e20  61 6c 6c 79 2e 20 3a 2d  29 0a 0a 0a 20 46 6f 6f  |ally. :-)... Foo|
00002e30  74 6e 6f 74 65 20 32 3a  0a 0a 20 59 6f 75 72 20  |tnote 2:.. Your |
00002e40  70 6f 73 74 2d 74 72 61  70 20 63 6f 64 65 20 77  |post-trap code w|
00002e50  69 6c 6c 20 6f 6e 6c 79  20 62 65 20 63 61 6c 6c  |ill only be call|
00002e60  65 64 20 69 66 20 74 68  65 20 53 57 49 20 64 6f  |ed if the SWI do|
00002e70  65 73 20 72 65 74 75 72  6e 2e 20 54 68 69 73 20  |es return. This |
00002e80  6d 69 67 68 74 0a 6e 6f  74 20 68 61 70 70 65 6e  |might.not happen|
00002e90  20 69 66 20 74 68 65 20  53 57 49 20 69 73 20 6f  | if the SWI is o|
00002ea0  6e 65 20 74 68 61 74 20  64 6f 65 73 6e 91 74 20  |ne that doesn.t |
00002eb0  72 65 74 75 72 6e 20 28  62 75 74 20 49 20 63 61  |return (but I ca|
00002ec0  6e 91 74 20 74 68 69 6e  6b 20 6f 66 20 61 6e 79  |n.t think of any|
00002ed0  0a 57 69 6d 70 5f 20 53  57 49 73 20 74 68 61 74  |.Wimp_ SWIs that|
00002ee0  20 64 6f 6e 91 74 29 2c  20 6f 72 20 69 66 20 61  | don.t), or if a|
00002ef0  20 73 65 72 69 6f 75 73  20 65 72 72 6f 72 20 68  | serious error h|
00002f00  61 70 70 65 6e 73 2e 20  54 68 65 20 6c 61 74 74  |appens. The latt|
00002f10  65 72 20 73 68 6f 75 6c  64 0a 6e 65 76 65 72 20  |er should.never |
00002f20  68 61 70 70 65 6e 20 69  6e 20 61 20 70 65 72 66  |happen in a perf|
00002f30  65 63 74 20 73 79 73 74  65 6d 2c 20 62 75 74 20  |ect system, but |
00002f40  62 75 67 73 20 68 61 70  70 65 6e 20 61 6e 64 20  |bugs happen and |
00002f50  74 68 65 20 53 57 49 20  62 65 69 6e 67 20 74 72  |the SWI being tr|
00002f60  61 70 70 65 64 0a 6d 69  67 68 74 20 62 72 61 6e  |apped.might bran|
00002f70  63 68 20 74 68 72 6f 75  67 68 20 7a 65 72 6f 20  |ch through zero |
00002f80  6f 72 20 73 6f 6d 65 74  68 69 6e 67 2e 20 57 69  |or something. Wi|
00002f90  74 68 20 74 68 65 20 57  69 6d 70 2c 20 74 68 6f  |th the Wimp, tho|
00002fa0  75 67 68 2c 20 61 20 63  72 61 73 68 20 61 74 0a  |ugh, a crash at.|
00002fb0  74 68 69 73 20 73 74 61  67 65 20 6f 66 74 65 6e  |this stage often|
00002fc0  20 6d 65 61 6e 73 20 74  68 65 72 65 20 69 73 20  | means there is |
00002fd0  73 6f 6d 65 74 68 69 6e  67 20 76 65 72 79 20 77  |something very w|
00002fe0  72 6f 6e 67 20 77 69 74  68 20 74 68 65 20 77 68  |rong with the wh|
00002ff0  6f 6c 65 20 64 65 73 6b  74 6f 70 0a 61 6e 64 20  |ole desktop.and |
00003000  65 76 65 72 79 74 68 69  6e 67 20 69 73 20 67 6f  |everything is go|
00003010  69 6e 67 20 74 6f 20 64  69 65 20 61 6e 79 77 61  |ing to die anywa|
00003020  79 2c 20 73 6f 20 79 6f  75 72 20 6d 6f 64 75 6c  |y, so your modul|
00003030  65 20 66 61 69 6c 69 6e  67 20 74 6f 20 70 6f 73  |e failing to pos|
00003040  74 2d 74 72 61 70 0a 69  73 20 75 6e 6c 69 6b 65  |t-trap.is unlike|
00003050  6c 79 20 74 6f 20 61 6e  6e 6f 79 20 74 68 65 20  |ly to annoy the |
00003060  75 73 65 72 20 6d 75 63  68 2e 20 3a 2d 29 0a 0a  |user much. :-)..|
00003070  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000030b0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 0a 0a 20  |-------------.. |
000030c0  54 68 69 73 20 6d 6f 64  75 6c 65 20 69 73 20 73  |This module is s|
000030d0  75 70 70 6c 69 65 64 20  77 69 74 68 20 73 6f 6d  |upplied with som|
000030e0  65 20 65 78 61 6d 70 6c  65 20 70 72 6f 67 72 61  |e example progra|
000030f0  6d 73 3a 0a 0a 20 2d 20  33 44 45 72 72 6f 72 57  |ms:.. - 3DErrorW|
00003100  69 6e 64 6f 77 2e 20 54  68 69 73 20 69 73 20 61  |indow. This is a|
00003110  20 75 73 65 66 75 6c 20  6d 6f 64 75 6c 65 20 74  | useful module t|
00003120  68 61 74 20 72 65 70 6c  61 63 65 73 20 74 68 65  |hat replaces the|
00003130  20 57 49 4d 50 91 73 20  65 72 72 6f 72 0a 20 20  | WIMP.s error.  |
00003140  20 77 69 6e 64 6f 77 73  20 77 69 74 68 20 69 74  | windows with it|
00003150  73 20 6f 77 6e 20 52 69  73 63 20 50 43 61 62 6c  |s own Risc PCabl|
00003160  65 20 33 44 20 6f 6e 65  73 20 28 69 74 20 6e 65  |e 3D ones (it ne|
00003170  65 64 73 20 33 44 45 72  72 6f 72 57 69 6e 64 6f  |eds 3DErrorWindo|
00003180  77 24 50 61 74 68 20 74  6f 0a 20 20 20 70 6f 69  |w$Path to.   poi|
00003190  6e 74 20 74 6f 20 61 20  64 69 72 65 63 74 6f 72  |nt to a director|
000031a0  79 20 63 6f 6e 74 61 69  6e 69 6e 67 20 54 65 6d  |y containing Tem|
000031b0  70 6c 61 74 65 73 20 61  6e 64 20 4d 65 73 73 61  |plates and Messa|
000031c0  67 65 73 20 2d 20 79 6f  75 20 63 61 6e 20 66 69  |ges - you can fi|
000031d0  6e 64 20 6f 6e 65 0a 20  20 20 69 6e 20 53 6f 75  |nd one.   in Sou|
000031e0  72 63 65 73 2e 45 72 72  6f 72 57 69 6e 64 29 20  |rces.ErrorWind) |
000031f0  75 73 69 6e 67 20 70 72  65 2d 74 72 61 70 70 69  |using pre-trappi|
00003200  6e 67 20 28 75 73 75 61  6c 6c 79 20 77 69 74 68  |ng (usually with|
00003210  20 69 6e 74 65 72 63 65  70 74 69 6f 6e 29 2e 20  | interception). |
00003220  54 68 65 0a 20 20 20 77  69 6e 64 6f 77 73 20 63  |The.   windows c|
00003230  6f 75 6c 64 20 64 6f 20  77 69 74 68 20 74 68 65  |ould do with the|
00003240  20 4e 65 77 65 72 4c 6f  6f 6b 20 90 74 69 74 6c  | NewerLook .titl|
00003250  65 6a 6f 69 6e 74 91 20  73 70 72 69 74 65 20 69  |ejoint. sprite i|
00003260  6e 20 74 68 65 20 77 69  6d 70 20 70 6f 6f 6c 2c  |n the wimp pool,|
00003270  0a 20 20 20 61 6c 6f 6e  67 20 77 69 74 68 20 74  |.   along with t|
00003280  68 65 20 52 69 73 63 20  50 43 20 65 72 72 6f 72  |he Risc PC error|
00003290  20 73 79 73 74 65 6d 20  73 70 72 69 74 65 73 2e  | system sprites.|
000032a0  20 4e 6f 74 65 20 74 68  61 74 20 74 68 69 73 20  | Note that this |
000032b0  69 73 20 61 6e 20 4f 4c  44 0a 20 20 20 56 45 52  |is an OLD.   VER|
000032c0  53 49 4f 4e 20 6f 66 20  33 44 45 72 72 6f 72 57  |SION of 3DErrorW|
000032d0  69 6e 64 6f 77 2c 20 77  68 69 63 68 20 79 6f 75  |indow, which you|
000032e0  20 73 68 6f 75 6c 64 20  6e 6f 74 20 61 63 74 75  | should not actu|
000032f0  61 6c 6c 79 20 75 73 65  20 2d 20 67 65 74 0a 20  |ally use - get. |
00003300  20 20 4e 65 77 65 72 4c  6f 6f 6b 20 66 6f 72 20  |  NewerLook for |
00003310  74 68 65 20 66 75 6c 6c  65 73 74 2c 20 6e 65 77  |the fullest, new|
00003320  65 73 74 20 76 65 72 73  69 6f 6e 2e 20 54 68 69  |est version. Thi|
00003330  73 2c 20 68 6f 77 65 76  65 72 2c 20 69 73 20 61  |s, however, is a|
00003340  20 62 65 74 74 65 72 0a  20 20 20 65 78 61 6d 70  | better.   examp|
00003350  6c 65 20 6f 66 20 68 6f  77 20 74 6f 20 75 73 65  |le of how to use|
00003360  20 57 69 6d 70 53 57 49  56 65 2c 20 61 73 20 69  | WimpSWIVe, as i|
00003370  74 20 69 73 20 6c 65 73  73 20 63 6f 6d 70 6c 69  |t is less compli|
00003380  63 61 74 65 64 20 74 68  61 6e 20 74 68 65 0a 20  |cated than the. |
00003390  20 20 6c 61 74 65 73 74  20 76 65 72 73 69 6f 6e  |  latest version|
000033a0  2e 0a 20 2d 20 45 69 67  65 6e 53 79 73 49 6e 66  |.. - EigenSysInf|
000033b0  6f 2e 20 54 68 69 73 20  69 73 20 61 20 70 72 65  |o. This is a pre|
000033c0  74 74 79 20 75 73 65 6c  65 73 73 20 6f 6e 65 20  |tty useless one |
000033d0  74 68 61 74 20 63 68 61  6e 67 65 73 20 57 69 6d  |that changes Wim|
000033e0  70 5f 52 65 61 64 53 79  73 49 6e 66 6f 0a 20 20  |p_ReadSysInfo.  |
000033f0  20 32 20 61 6c 77 61 79  73 20 74 6f 20 72 65 74  | 2 always to ret|
00003400  75 72 6e 20 32 34 20 6f  72 20 32 32 2c 20 61 6e  |urn 24 or 22, an|
00003410  64 20 72 65 74 75 72 6e  20 74 68 65 20 6c 61 74  |d return the lat|
00003420  74 65 72 20 69 66 20 4c  6f 67 32 59 45 69 67 3c  |ter if Log2YEig<|
00003430  32 20 28 74 68 65 0a 20  20 20 57 49 4d 50 20 72  |2 (the.   WIMP r|
00003440  65 74 75 72 6e 73 20 32  32 20 69 66 20 4c 6f 67  |eturns 22 if Log|
00003450  32 59 45 69 67 3d 3d 4c  6f 67 32 58 45 69 67 2c  |2YEig==Log2XEig,|
00003460  20 77 68 69 63 68 20 69  73 20 73 69 6c 6c 79 29  | which is silly)|
00003470  2e 20 49 74 20 61 6c 73  6f 20 67 6f 65 73 0a 20  |. It also goes. |
00003480  20 20 90 62 65 65 70 91  20 69 66 20 74 68 65 20  |  .beep. if the |
00003490  57 69 6d 70 20 72 65 74  75 72 6e 65 64 20 61 20  |Wimp returned a |
000034a0  64 69 66 66 65 72 65 6e  74 20 76 61 6c 75 65 20  |different value |
000034b0  74 6f 20 69 74 20 28 74  72 79 20 6d 6f 64 65 20  |to it (try mode |
000034c0  32 32 20 61 6e 64 20 74  68 65 0a 20 20 20 6c 69  |22 and the.   li|
000034d0  6b 65 29 2e 20 49 74 91  73 20 6e 6f 74 20 70 61  |ke). It.s not pa|
000034e0  72 74 69 63 75 6c 61 72  6c 79 20 67 72 65 61 74  |rticularly great|
000034f0  20 62 65 63 61 75 73 65  20 6d 6f 73 74 20 70 72  | because most pr|
00003500  6f 67 72 61 6d 73 20 64  6f 6e 91 74 20 74 61 6b  |ograms don.t tak|
00003510  65 20 61 6e 79 0a 20 20  20 6e 6f 74 69 63 65 20  |e any.   notice |
00003520  6f 66 20 52 65 61 64 53  79 73 49 6e 66 6f 20 28  |of ReadSysInfo (|
00003530  70 61 72 74 6c 79 20 62  65 63 61 75 73 65 20 6f  |partly because o|
00003540  66 20 69 74 73 20 61 66  6f 72 65 6d 65 6e 74 69  |f its aforementi|
00003550  6f 6e 65 64 20 62 6f 62  62 69 6e 73 6e 65 73 73  |oned bobbinsness|
00003560  29 0a 20 20 20 62 75 74  20 69 74 20 73 68 6f 77  |).   but it show|
00003570  73 20 79 6f 75 20 68 6f  77 20 74 6f 20 70 72 65  |s you how to pre|
00003580  2d 74 72 61 70 20 61 6e  64 20 70 6f 73 74 2d 74  |-trap and post-t|
00003590  72 61 70 20 53 57 49 73  20 61 74 20 74 68 65 20  |rap SWIs at the |
000035a0  73 61 6d 65 20 74 69 6d  65 20 28 61 73 0a 20 20  |same time (as.  |
000035b0  20 69 6e 20 66 6f 6f 74  6e 6f 74 65 20 31 29 2e  | in footnote 1).|
000035c0  0a 0a 20 54 68 65 20 73  6f 75 72 63 65 20 66 6f  |.. The source fo|
000035d0  72 20 74 68 65 73 65 20  70 72 6f 67 72 61 6d 73  |r these programs|
000035e0  2c 20 61 6c 6f 6e 67 20  77 69 74 68 20 74 68 65  |, along with the|
000035f0  20 66 75 6c 6c 20 73 6f  75 72 63 65 20 74 6f 20  | full source to |
00003600  57 69 6d 70 53 57 49 56  65 20 61 6e 64 0a 73 6f  |WimpSWIVe and.so|
00003610  6d 65 20 72 65 73 6f 75  72 63 65 73 20 66 6f 72  |me resources for|
00003620  20 33 44 45 72 72 6f 72  57 69 6e 64 6f 77 20 61  | 3DErrorWindow a|
00003630  72 65 20 74 6f 20 62 65  20 66 6f 75 6e 64 20 69  |re to be found i|
00003640  6e 20 74 68 65 20 53 6f  75 72 63 65 73 20 64 69  |n the Sources di|
00003650  72 65 63 74 6f 72 79 2e  0a 48 6f 77 65 76 65 72  |rectory..However|
00003660  2c 20 74 68 65 73 65 20  70 72 6f 67 72 61 6d 73  |, these programs|
00003670  20 72 65 71 75 69 72 65  20 42 41 58 20 74 6f 20  | require BAX to |
00003680  62 65 20 6c 6f 61 64 65  64 20 66 6f 72 20 74 68  |be loaded for th|
00003690  65 6d 20 74 6f 20 63 6f  6d 70 69 6c 65 2e 20 42  |em to compile. B|
000036a0  41 58 20 69 73 0a 44 6f  67 67 79 53 6f 66 74 91  |AX is.DoggySoft.|
000036b0  73 20 42 61 73 69 63 20  41 73 73 65 6d 62 6c 65  |s Basic Assemble|
000036c0  72 20 45 78 74 65 6e 73  69 6f 6e 2c 20 77 68 69  |r Extension, whi|
000036d0  63 68 20 70 72 6f 76 69  64 65 73 20 61 6c 6c 20  |ch provides all |
000036e0  41 52 4d 33 2c 20 41 52  4d 36 2c 20 46 50 41 31  |ARM3, ARM6, FPA1|
000036f0  30 0a 61 6e 64 20 63 6f  70 72 6f 63 65 73 73 6f  |0.and coprocesso|
00003700  72 20 69 6e 73 74 72 75  63 74 69 6f 6e 73 2c 20  |r instructions, |
00003710  61 6c 6f 6e 67 20 77 69  74 68 20 6d 61 6e 79 20  |along with many |
00003720  75 73 65 66 75 6c 20 70  73 65 75 64 6f 2d 69 6e  |useful pseudo-in|
00003730  73 74 72 75 63 74 69 6f  6e 73 2e 0a 59 6f 75 20  |structions..You |
00003740  63 61 6e 20 67 65 74 20  42 41 58 20 66 72 6f 6d  |can get BAX from|
00003750  20 67 6f 6f 64 20 50 44  20 6c 69 62 72 61 72 69  | good PD librari|
00003760  65 73 20 61 6e 64 20 41  72 63 61 64 65 2c 20 44  |es and Arcade, D|
00003770  69 67 69 74 61 6c 20 44  61 74 61 62 61 6e 6b 20  |igital Databank |
00003780  61 6e 64 0a 46 75 72 7a  65 66 69 65 6c 64 20 48  |and.Furzefield H|
00003790  71 20 42 42 53 73 2e 20  49 74 91 73 20 65 73 73  |q BBSs. It.s ess|
000037a0  65 6e 74 69 61 6c 20 66  6f 72 20 42 61 73 69 63  |ential for Basic|
000037b0  20 61 73 73 65 6d 62 6c  65 72 20 70 72 6f 67 72  | assembler progr|
000037c0  61 6d 6d 65 72 73 21 0a  0a 20 49 66 20 79 6f 75  |ammers!.. If you|
000037d0  20 75 73 65 20 74 68 69  73 20 6d 6f 64 75 6c 65  | use this module|
000037e0  20 69 6e 20 61 20 70 72  6f 67 72 61 6d 2c 20 62  | in a program, b|
000037f0  65 20 73 75 72 65 20 74  6f 20 52 4d 45 6e 73 75  |e sure to RMEnsu|
00003800  72 65 20 76 65 72 73 69  6f 6e 20 30 2e 30 34 20  |re version 0.04 |
00003810  6f 72 0a 6c 61 74 65 72  20 2d 20 76 65 72 73 69  |or.later - versi|
00003820  6f 6e 73 20 30 2e 30 31  20 61 6e 64 20 30 2e 30  |ons 0.01 and 0.0|
00003830  32 20 61 72 65 20 4e 65  77 65 72 4c 6f 6f 6b 20  |2 are NewerLook |
00003840  71 75 69 63 6b 20 72 65  6c 65 61 73 65 73 20 77  |quick releases w|
00003850  69 74 68 20 62 75 67 73  20 69 6e 0a 70 6f 73 74  |ith bugs in.post|
00003860  2d 74 72 61 70 70 69 6e  67 2c 20 61 6e 64 20 76  |-trapping, and v|
00003870  65 72 73 69 6f 6e 20 30  2e 30 33 20 64 6f 65 73  |ersion 0.03 does|
00003880  20 6e 6f 74 20 66 65 61  74 75 72 65 20 68 69 67  | not feature hig|
00003890  68 2d 70 72 69 6f 72 69  74 79 20 53 57 49 20 74  |h-priority SWI t|
000038a0  72 61 70 70 69 6e 67 2c  0a 61 73 20 77 65 6c 6c  |rapping,.as well|
000038b0  20 61 73 20 73 6f 6d 65  74 69 6d 65 73 20 65 6e  | as sometimes en|
000038c0  74 65 72 69 6e 67 20 70  72 65 2d 63 6f 64 65 20  |tering pre-code |
000038d0  77 69 74 68 20 69 6e 74  65 72 72 75 70 74 73 20  |with interrupts |
000038e0  65 6e 61 62 6c 65 64 2e  0a 0a 20 54 68 69 73 20  |enabled... This |
000038f0  6d 6f 64 75 6c 65 20 69  73 20 66 72 65 65 77 61  |module is freewa|
00003900  72 65 2e 20 46 72 65 65  20 66 72 65 65 20 74 6f  |re. Free free to|
00003910  20 64 69 73 74 72 69 62  75 74 65 20 61 6e 64 20  | distribute and |
00003920  75 73 65 2e 20 54 6f 20  63 6f 6e 74 61 63 74 20  |use. To contact |
00003930  6d 65 20 2d 0a 66 6f 72  20 70 72 61 69 73 65 2c  |me -.for praise,|
00003940  20 74 6f 20 73 75 67 67  65 73 74 20 6e 65 77 20  | to suggest new |
00003950  62 69 74 73 20 74 6f 20  61 64 64 2c 20 6f 72 20  |bits to add, or |
00003960  28 68 65 61 76 65 6e 20  66 6f 72 62 69 64 29 20  |(heaven forbid) |
00003970  74 6f 20 72 65 70 6f 72  74 20 61 20 62 75 67 2c  |to report a bug,|
00003980  0a 70 6c 65 61 73 65 20  77 72 69 74 65 20 74 6f  |.please write to|
00003990  3a 0a 0a 20 20 41 6e 64  72 65 77 20 43 6c 6f 76  |:..  Andrew Clov|
000039a0  65 72 2c 0a 20 20 20 37  20 42 6c 61 63 6b 68 6f  |er,.   7 Blackho|
000039b0  72 73 65 20 43 72 65 73  63 65 6e 74 2c 0a 20 20  |rse Crescent,.  |
000039c0  20 20 41 6d 65 72 73 68  61 6d 2c 0a 20 20 20 20  |  Amersham,.    |
000039d0  20 42 75 63 6b 73 2e 2c  0a 20 20 20 20 20 20 48  | Bucks.,.      H|
000039e0  50 36 20 36 48 50 2e 0a  0a 20 4f 72 20 70 68 6f  |P6 6HP... Or pho|
000039f0  6e 65 20 6d 65 20 6f 6e  20 30 31 34 39 34 2d 34  |ne me on 01494-4|
00003a00  33 31 39 31 36 2c 20 73  65 6e 64 20 61 20 66 61  |31916, send a fa|
00003a10  78 20 6f 6e 20 30 31 34  39 34 2d 36 37 35 38 37  |x on 01494-67587|
00003a20  38 2c 20 73 65 6e 64 20  73 6f 6d 65 20 65 6d 61  |8, send some ema|
00003a30  69 6c 20 74 6f 0a 61 6a  63 40 64 6f 67 67 79 73  |il to.ajc@doggys|
00003a40  66 74 2e 64 65 6d 6f 6e  2e 63 6f 2e 75 6b 20 6f  |ft.demon.co.uk o|
00003a50  72 20 65 76 65 6e 20 74  65 6c 65 78 20 6f 6e 20  |r even telex on |
00003a60  38 33 36 37 35 20 42 72  69 74 20 47 2e 0a        |83675 Brit G..|
00003a6e