Home » Archimedes archive » Acorn User » AU 1998-13 (Christmas).adf » Regulars » StarInfo/Stirling/!MityMouse/MightySrc

StarInfo/Stirling/!MityMouse/MightySrc

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-13 (Christmas).adf » Regulars
Filename: StarInfo/Stirling/!MityMouse/MightySrc
Read OK:
File size: 5287 bytes
Load address: 0000
Exec address: 0000
File contents
    1REM>MightySrc
    2REM By Michael Stirling
    3REM Object code v1.01 - SUN 16/08/1998
    4REM Object code v1.00 - WED 01/03/1995
    5REM
    6REM Source code for module MightyMouse
    7REM Editor work area = 111
    8
    9ON ERROR REPORT:PRINT" at line ";ERL:END
   10
   11REM ************************************************************************************
   12REM ALTER THE FOLLOWING 3 VARIABLES TO DEFINE LOCATION, BIT TO STORE BUTTONS STATUS
   13REM AND THE SWI CHUNK NUMBER IN CASE OF A CLASH WITH OTHER SOFTWARE
   14SwiChunk% =2047 :REM Range: 0 to 2047      NOTE: 0 is reserved for development modules
   15CMOSloc%  =30   :REM Range: 30 to 45       NOTE: User range reserved by Acorn
   16CMOSbit%  =0    :REM Range: 0 to 7
   17REM ************************************************************************************
   18
   19MODE MODE
   20OFF
   21
   22PROCSetUp
   23PROCasm
   24PROCsave
   25END
   26
   27DEF PROCSetUp
   28SYS "OS_ReadRAMFsLimits" TO R0,R1
   29IF R1-R0=0 PRINT"MightySrc requires a RAM disc of at least 8K to run.":END
   30version$="1.01"
   31
   32REM Perform range checking
   33range=FALSE
   34IF (SwiChunk% AND &7FF) <> SwiChunk% PRINT"SwiChunk% out of range 0 to &7FF":range=TRUE
   35IF (CMOSloc%  AND &0FF) <> CMOSloc%  PRINT"CMOSloc% out of range 0 to &FF"  :range=TRUE
   36IF (CMOSbit%  AND &007) <> CMOSbit%  PRINT"CMOSbit% out of range 0 to 7"    :range=TRUE
   37IF range=TRUE THEN END
   38
   39bit=CMOSbit%
   40CMOSbit%=1<<CMOSbit%
   41
   42REM Module variables
   43ModuleName$ ="MightyMouse"
   44SwiHeader$  ="MightyMouse"
   45
   46Bits1819%=%01
   47IF (Bits1819% AND %11) <> Bits1819% PRINT"Bits1819% out of range 0 to 3. See PRM for details of correct values to use.":END
   48Bits1819%=Bits1819%<<18
   49SwiChunk%=SwiChunk%<<06
   50SwiBase=Bits1819%+SwiChunk% :REM SwiBase must be MOD 64
   51REM SwiBase can never be anything other than MOD 64, but the following error check is kept for good measure
   52IF SwiBase MOD 64<>0 PRINT"SwiBase=&";~SwiBase". Must be MOD 64.":END
   53
   54REM Assembler variables
   55save        =TRUE
   56OptLo       =%1100
   57OptHi       =%1110
   58CodeSize    =4096
   59DIM code CodeSize, L%-1
   60
   61LK          =14
   62ENDPROC
   63
   64DEF PROCasm
   65PRINT'"Assembling module..."
   66FOR pass= OptLo TO OptHi STEP (OptHi - OptLo)
   67IF OptLo AND %100 THEN P%=0:O%=code ELSE P%=code:O%=0
   68
   69[   OPT     pass
   70    EQUD    0                   \Start code
   71    EQUD    init                \Initialisation code
   72    EQUD    final               \Finalisation code
   73    EQUD    service             \Service call handler
   74    EQUD    title               \Title string
   75    EQUD    help                \Help string
   76    EQUD    commands            \Help and command keyword table
   77    EQUD    SwiBase             \SWI chunk base number (optional)
   78    EQUD    SwiHandler          \SWI handler code      (optional)
   79    EQUD    SwiNames            \SWI decoding table    (optional)
   80    EQUD    0                   \SWI decoding code     (optional)
   81
   82.init
   83    STMFD   13!,{7-11,LK}       \Must preserve R7-R11 & R13
   84    MOV     1,#CMOSloc%         \Read status
   85    MOV     4,#0                \at location CMOSloc%,
   86    BL      ReadWriteCmos       \bit CMOSbit%
   87    TST     2,#CMOSbit%
   88    BLNE    claim               \Swap buttons if configured swapped in CMOS RAM
   89    MOVEQ   0,#0
   90    STREQ   0,InterceptFlag     \Setting flag here is only important for initialisation after soft reset
   91    ADRVS   0,ClaimErrorMsg     \Report MouseV claim failed, if it was not successful and
   92    LDMFD   13!,{7-11,PC}       \do not initialise module
   93
   94.ClaimErrorMsg
   95    EQUD    0
   96    EQUS    "MightyMouse module initialisation failed."
   97    EQUB    0
   98    ALIGN
   99
  100.final
  101    STMFD   13!,{7-11,LK}
  102    BL      release
  103    LDMFD   13!,{7-11,PC}^      \NOTE - Do not want to generate error on exit as module will refuse to die.
  104                                \       Of course this means the computer might crash, if intercept routine
  105                                \       is still running, but it is unlikely to be.
  106
  107.service                        \Re-initialise module & display post-reset message
  108    STMFD   13!,{0-11,LK}
  109    CMP     1,#&27
  110    LDMNEFD 13!,{0-11,PC}
  111    BL      init
  112
  113    LDR     0,InterceptFlag
  114    CMP     0,#0
  115    ADREQ   0,normal
  116    ADRNE   0,swop
  117    SWI     "OS_Write0"
  118    LDMFD   13!,{0-11,PC}^
  119
  120.normal
  121    EQUS    "Mouse buttons normal"
  122    EQUW    &0A0D
  123    EQUB    0
  124    ALIGN
  125
  126.swop
  127    EQUS    "Mouse buttons swapped"
  128    EQUW    &0A0D
  129    EQUB    0
  130    ALIGN
  131
  132.title
  133    EQUS    ModuleName$
  134    EQUB    0
  135    ALIGN
  136
  137.help
  138    EQUS    "MightyMouse	"+version$+" StrongArm Aware ("+MID$(TIME$,5,11)+") � Michael Stirling"
  139    EQUB    0
  140    ALIGN
  141
  142.commands
  143    EQUS    "Buttons"
  144    EQUB    0
  145    ALIGN
  146
  147    EQUD    decode
  148    EQUD    &00010100           \Information word
  149    EQUD    SyntaxMessage       \Error message
  150    EQUD    CommandHelp         \Help message
  151
  152    EQUS    "Buttons"
  153    EQUB    0
  154    ALIGN
  155
  156    EQUD    DecodeStatus
  157    EQUD    &40000000
  158    EQUD    0
  159    EQUD    0
  160
  161    EQUS    "MightyInfo"
  162    EQUB    0
  163    ALIGN
  164
  165    EQUD    0
  166    EQUD    &20000000
  167    EQUD    0
  168    EQUD    HelpCode
  169
  170    EQUD    0                   \Terminator
  171
  172.decode
  173    STMFD   13!,{7-11,LK}       \R7-R11 must be preserved. R0=error pointer if anything goes wrong
  174
  175    CMP     1,#0                \If command has no parameters, then show CMOS button status
  176    BEQ     ShowStatus
  177
  178    CMP     1,#1                \If command has more than 1 parameter,
  179    BHI     BadSyntax           \then terminate with an error message
  180
  181    LDRB    1,[0,#2]            \Note - OS always terminates parameters with &0D20
  182    CMP     1,#13               \If R1<>13 then parameter is not 1 character long,
  183    BNE     BadSyntax           \so terminate command with an error message
  184
  185    LDRB    0,[0]               \Get parameter, command has only 1 character, letter or digit
  186
  187    CMP     0,#ASC"0"           \If parameter is not one of characters 0,1,2,3
  188    BLT     BadSyntax           \then terminate command with an error message,
  189                                \otherwise command is valid & can be processed
  190    CMP     0,#ASC"3"
  191    BHI     BadSyntax
  192
  193\PROCESS BUTTONS PARAMETER
  194
  195    SUB     0,0,#ASC"0"         \Get numeric value of ascii code. Note only bits 0 & 1 are actually required
  196    STR     0,args              \Save decoded argument parameter for later
  197
  198    TST     0,#%10              \Configure new setting?
  199    BEQ     SetCurrent          \NO - Jump straight to SetCurrent
  200
  201    TST     0,#%01              \swap or not?
  202    MOVEQ   3,#0                \NO
  203    MOVNE   3,#CMOSbit%         \YES
  204
  205    MOV     1,#CMOSloc%         \Store status in CMOS RAM
  206    MOV     4,#CMOSbit%
  207    BL      ReadWriteCmos
  208
  209.SetCurrent
  210    LDR     1,InterceptFlag     \Get current intercept status
  211    LDR     0,args              \Retrieve argument parameter
  212    TST     0,#%01
  213    BNE     swap
  214
  215\NORMAL ROUTINE - RELEASE VECTOR IF NOT ALREADY RELEASED
  216    TST     1,#1                \Z=0, claimed  Z=1, not claimed
  217    BLNE    release             \Quit if not claimed, else release vector
  218    ADRVS   0,CantRelease
  219    LDMFD   13!,{7-11,PC}
  220
  221.CantRelease
  222    EQUD    0
  223    EQUS    "Cannot return mouse buttons to normal, try reloading MightyMouse module."
  224    EQUW    &0A0D
  225    EQUB    0
  226    ALIGN
  227
  228\SWAP ROUTINE - CLAIM VECTOR IF NOT ALREADY CLAIMED
  229.swap
  230    TST     1,#1                \Z=0, claimed  Z=1, not claimed
  231    BLEQ    claim               \Quit if claimed, else release vector
  232    ADRVS   0,CantClaim
  233    LDMFD   13!,{7-11,PC}
  234
  235.CantClaim
  236    EQUD    0
  237    EQUS    "Cannot swap mouse buttons, try reloading MightyMouse module."
  238    EQUB    0
  239    ALIGN
  240
  241.ShowStatus
  242    LDR     7,InterceptFlag
  243    TST     7,#1                \Z=0, claimed  Z=1, not claimed
  244    BNE     currently
  245
  246    SWI     "XOS_WriteS"
  247    EQUS    "Mouse buttons normal & "
  248    EQUB    0
  249    ALIGN
  250
  251    B       cmos
  252
  253.currently
  254    SWI     "XOS_WriteS"
  255    EQUS    "Mouse buttons swapped & "
  256    EQUB    0
  257    ALIGN
  258
  259.cmos
  260    MOV     1,#CMOSloc%
  261    MOV     4,#0                \Mask=0 to read CMOS status
  262    BL      ReadWriteCmos
  263
  264    TST     2,#CMOSbit%
  265    BNE     swapped
  266
  267    SWI     "XOS_WriteS"
  268    EQUS    "configured normal."
  269    EQUW    &0A0D
  270    EQUB    0
  271    ALIGN
  272
  273    LDMFD   13!,{7-11,PC}^
  274
  275.swapped
  276    SWI     "XOS_WriteS"
  277    EQUS    "configured swapped."
  278    EQUW    &0A0D
  279    EQUB    0
  280    ALIGN
  281
  282    LDMFD   13!,{7-11,PC}^
  283
  284.BadSyntax
  285    ADR     0,SyntaxError
  286    TEQP    PC,#&10000003       \Set V, remembering processor state
  287    LDMFD   13!,{7-11,PC}
  288
  289.SyntaxError
  290    EQUD    0
  291.SyntaxMessage
  292    EQUS    "Syntax: Buttons [0|1|2|3]"
  293    EQUB    0
  294    ALIGN
  295
  296.CommandHelp
  297    EQUS    "*Buttons configures the mouse buttons for right or left-handed operation."
  298    EQUW    &0A0D
  299    EQUS    "*Buttons with no parameters displays the current & configured normal/swapped mouse buttons status."
  300    EQUW    &0A0D
  301    EQUW    &0A0D
  302    EQUS    "Syntax: Buttons [0|1|2|3]"
  303    EQUW    &0A0D
  304    EQUS    "��������0 = Buttons normal"
  305    EQUW    &0A0D
  306    EQUS    "��������1 = Buttons swapped"
  307    EQUW    &0A0D
  308    EQUS    "��������2 = Buttons normal��& setting stored in CMOS RAM"
  309    EQUW    &0A0D
  310    EQUS    "��������3 = Buttons swapped & setting stored in CMOS RAM"
  311    EQUB    0
  312    ALIGN
  313
  314.DecodeStatus
  315    STMFD   13!,{7-11,LK}       \R7-R11 must be preserved. R0=error pointer if anything goes wrong
  316
  317    CMP     0,#0                \Has *Configure by itself been entered?
  318    ADREQ   0,config            \YES - display configuration message & quit
  319    SWIEQ   "XOS_Write0"        \NO  - check R0 is not command tail pointer
  320    LDMEQFD 13!,{7-11,PC}^
  321
  322    CMP     0,#1                \Has *Configure Buttons been attempted?
  323    ADRHI   0,BadConfig         \YES - display error message & quit
  324    TEQHIP  PC,#&30000003       \Set C&V, remembering processor state
  325    LDMHIFD 13!,{7-11,PC}
  326
  327    MOV     0,#161              \Get CMOS RAM buttons setting
  328    MOV     1,#CMOSloc%
  329    SWI     "XOS_Byte"
  330
  331    TST     2,#CMOSbit%         \Reflect buttons setting with screen message
  332    ADREQ   0,NormalMSG
  333    ADRNE   0,SwappedMSG
  334    SWI     "XOS_Write0"
  335
  336    LDMFD   13!,{7-11,PC}^
  337
  338.config
  339    EQUS    "*Buttons   <2|3>"
  340    EQUW    &0A0D
  341    EQUB    0
  342    ALIGN
  343
  344.BadConfig
  345    EQUD    0
  346    EQUS    "Use *Buttons <2|3> to set the CMOS configuration."
  347    EQUB    0
  348    ALIGN
  349
  350.NormalMSG
  351    EQUS    "Mouse buttons normal."
  352    EQUW    &0A0D
  353    EQUB    0
  354    ALIGN
  355
  356.SwappedMSG
  357    EQUS    "Mouse buttons swapped."
  358    EQUW    &0A0D
  359    EQUB    0
  360    ALIGN
  361
  362.HelpCode
  363    ADR     0,info
  364    MOVS    PC,LK
  365
  366.info
  367    EQUS    "Module MightyMouse swaps the Select & Adjust mouse buttons for left-handed users."
  368    EQUW    &0A0D
  369    EQUS    "SWI base��= &"+STR$~SwiBase
  370    EQUW    &0A0D
  371    EQUS    "SWI chunk = "+STR$ (SwiChunk%>>>6)
  372    EQUW    &0A0D
  373    EQUS    "Configuration stored at CMOS RAM location "+STR$ CMOSloc%+", bit "+STR$(bit)+"."
  374    EQUW    &0A0D
  375    EQUS    "*** THIS SOFTWARE IS PUBLIC DOMAIN ***"
  376    EQUD    &0A0D0A0D
  377    EQUS    "v"+version$+" � Michael Stirling ("+MID$(TIME$,5,11)+")"
  378    EQUW    &0A0D
  379    EQUB    0
  380    ALIGN
  381
  382.SwiHandler
  383    LDR     12,[12]             \Get workspace pointer
  384
  385    CMP     11,#(EndSwiTable-SwiTable)/4
  386    ADDCC   PC,PC,11,LSL#2      \Dispatch if in range
  387    B       UnknownSWI          \Unknown SWI
  388
  389.SwiTable
  390    B       buttons             \Jump to SWI 0
  391    B       ReadWriteCmos       \Jump to SWI 1
  392
  393.EndSwiTable
  394
  395.UnknownSWI
  396    ADR     0,RangeError
  397    ORRS    PC,LK,#1<<28        \Exit with overflow flag set
  398
  399.RangeError
  400    EQUD    &1E6
  401    EQUS    "Module MightyMouse v"+version$+" supports only two SWIs (SWI base = &"+STR$~SwiBase+")"
  402    EQUB    0
  403    ALIGN
  404
  405.SwiNames
  406    EQUS    SwiHeader$
  407    EQUB    0
  408
  409    EQUS    "Buttons"
  410    EQUB    0
  411
  412    EQUS    "CmosAccess"
  413    EQUB    0
  414
  415    EQUB    0                   \Terminator
  416    ALIGN
  417
  418.buttons
  419    STMFD   13!,{1-9,LK}
  420    TEQP    PC,#3               \Clear flags
  421
  422\REFLECT PREVIOUS SETTINGS IN R0
  423    STR     0,reg0              \Preserve input
  424    STR     1,reg1              \parameters for later
  425
  426    MOV     0,#161              \Get configured normal/swapped buttons state
  427    MOV     1,#CMOSloc%
  428    SWI     "XOS_Byte"          \State returned in R2 at CMOSbit%
  429
  430    LDR     0,reg0              \Get input parameter R0
  431    TST     2,#CMOSbit%         \Configured buttons swapped?
  432    ORRNE   0,0,#%10            \YES - set   bit 1 preserving all other bits
  433    BICEQ   0,0,#%10            \NO  - reset bit 1 preserving all other bits
  434
  435    LDR     2,InterceptFlag     \Get current normal/swapped buttons state
  436    TST     2,#%01              \Buttons swapped?
  437    ORRNE   0,0,#%01            \YES - set   bit 0 preserving all other bits
  438    BICEQ   0,0,#%01            \NO  - reset bit 0 preserving all other bits
  439
  440    STR     0,reg0old           \This value of R0 to be returned on exit from SWI
  441
  442\MOD IF Y CURRENT & CONFIGURED BUTTONS STATUS AS PER INPUT PARAMETERS
  443    LDR     0,reg0              \Retrieve input parameters
  444    LDR     1,reg1              \from earlier
  445
  446    TST     1,#%10              \Is R1 bit 1 = 1? (mask=write)
  447    BEQ     R1bit1zero          \NO  - check R1 bit 0
  448
  449    TST     0,#%10              \YES - Is R0 bit 1 = 0?
  450    MOVEQ   3,#0                \YES - CMOS RAM = 0
  451    MOVNE   3,#CMOSbit%         \NO  - CMOS RAM = 1
  452
  453    MOV     1,#CMOSloc%
  454    MOV     4,#CMOSbit%         \Get mask for ReadWriteCmos
  455    BL      ReadWriteCmos       \Write value to CMOS RAM
  456    LDR     0,reg0              \Retrieve input parameters
  457    LDR     1,reg1              \overwritten by ReadWriteCmos
  458
  459.R1bit1zero
  460    TST     1,#%01              \Is R1 bit 0 = 1?
  461    BEQ     R1bit0zero          \NO  - exit SWI
  462                                \YES - do below
  463    LDR     1,InterceptFlag     \Get current buttons status
  464    TST     0,#%01              \Is R0 bit 0 = 0?
  465    BNE     R0bit0one           \NO  - claim   mouse vector
  466                                \YES - release mouse vector
  467
  468    TST     1,#1                \Is vector already released? (InterceptFlag=0)
  469    BLNE    release             \NO  - flag=1, release vector
  470
  471    ADRVS   0,SwiCantRelease    \Abort with error message if vector cannot be released
  472    LDMVSFD 13!,{1-9,LK}        \Set V, while preserving
  473    ORRVSS  PC,LK,#1<<28        \the other flags
  474
  475    B       R1bit0zero          \YES - exit SWI
  476
  477.R0bit0one
  478    TST     1,#1                \Is vector already claimed?  (InterceptFlag=1)
  479    BLEQ    claim               \NO  - flag=0, claim vector
  480                                \YES - exit SWI
  481    ADRVS   0,SwiCantClaim      \Abort with error message if vector cannot be claimed
  482    LDMVSFD 13!,{1-9,LK}        \Set V, while preserving
  483    ORRVSS  PC,LK,#1<<28        \the other flags
  484
  485.R1bit0zero
  486    LDR     0,reg0old
  487    LDMFD   13!,{1-9,PC}^       \Return to SWI caller, preserving flags
  488
  489.SwiCantClaim
  490    EQUD    &1A0                \Use this error number as no 'User' error numbers have been allocated
  491    EQUS    "MightyMouse SWI could not claim mouse vector, try reloading MightyMouse module."
  492    EQUB    0
  493    ALIGN
  494
  495.SwiCantRelease
  496    EQUD    &1A1                \Use this error number as no 'User' error numbers have been allocated
  497                                \This number is generated by OS_Release, the SWI most likely to fail
  498    EQUS    "MightyMouse SWI could not release mouse vector. Try reloading MightyMouse module."
  499    EQUB    0
  500    ALIGN
  501
  502.claim
  503    STMFD   13!,{0-2,LK}
  504    MOV     0,#&1A
  505    ADR     1,intercept
  506    MOV     2,#0
  507    SWI     "XOS_Claim"
  508    MVNVC   0,#0                \Claim with flag=-1 if OS_Claim was successful,
  509    MOVVS   0,#0                \else release with 0
  510    STR     0,InterceptFlag
  511    LDMFD   13!,{0-2,PC}        \Allow V flag to be passed on if OS_Claim failed
  512
  513.release
  514    STMFD   13!,{0-2,LK}
  515    MOV     0,#&1A
  516    ADR     1,intercept
  517    MOV     2,#0
  518    SWI     "XOS_Release"
  519    MOVVC   0,#0                \Release with flag=0 if OS_Release was successful,
  520    MVNVS   0,#0                \else claim with -1
  521    STR     0,InterceptFlag
  522    LDMFD   13!,{0-2,PC}        \Allow V flag to be passed on if OS_Release failed
  523
  524.intercept
  525    STMFD   13!,{9,10-12,LK}
  526
  527\CALL SWI OS_MOUSE, MOD IF YING RETURN ADDRESS
  528\SO THAT MY ROUTINE IS EXECUTED ON EXIT
  529
  530\The following 3 instructions and the NOP are the fix to allow SWI post-processing on a StrongArm.  
  531\They ensure that the StrongArm PC points to the right instruction (at .delta2) after the SWI has executed
  532\by calculating the correct offset.
  533
  534.delta1
  535    MOV     12,PC               \Cannot stack PC here because it will point to one instruction too soon
  536                                \on return from SWI
  537    ADD     12,12,#(delta2-delta1-8)   \Sub=8 for StrongArm PC
  538    STMFD   13!,{12}
  539
  540    ADD     12,13,#8            \Align stack pointer with correct registers to execute SWI
  541    LDMIA   12,{10-12,PC}       \SWI OS_Mouse executed here
  542
  543.delta2                         \SWI returns here on StrongArm, one instruction further otherwise
  544    EQUD    0                   \NOP prevents SA fix from falling over on earlier processors (PC+8/+12 issue)
  545    LDR     12,[13,#12]         \Reload workspace pointer
  546
  547\OS_MOUSE POST-PROCESSED HERE - BUTTONS SWAP PED
  548    TST       2,#%001           \Move R2 bit 0 to R9 bit 2
  549    ORRNE   9,2,#%100           \Move 1
  550    BICEQ   9,2,#%100           \Move 0
  551
  552    TST       2,#%100           \Move R9 bit 2 to R2 bit 0
  553    ORRNE   2,9,#%001           \Move 1
  554    BICEQ   2,9,#%001           \Move 0
  555
  556    LDMFD   13!,{9,10-12,LK,PC}
  557
  558.ReadWriteCmos                  \ReadWriteCmos v1.00 - WED 01/03/1995
  559    STMFD   13!,{1,3,4,LK}      \Preserve registers as per spec for ReadWriteCmos
  560
  561    AND     1,1,#&FF            \Ensure all input data is 8 bits wide
  562    AND     3,3,#&FF
  563    AND     4,4,#&FF
  564
  565    MOV     0,#161              \Get value from CMOS RAM location
  566    SWI     "XOS_Byte"
  567
  568    STMFD   13!,{2}             \To be reloaded into R0 at the end. R0 = old CMOS RAM contents as per spec.
  569
  570    CMP     4,#0                \Is mask=0?
  571    BEQ     nWriteCMOS          \YES - all done, quit SWI
  572                                \NO  - process and store new CMOS value
  573\PERFORM READ/WRITE FUNCTION
  574    AND     3,4,3               \Store (R3 AND R4) in working register
  575    MVN     4,4                 \NOT R3
  576    AND     2,2,4               \(OldButtons AND NOT R4)
  577    ORR     2,2,3               \(Oldbuttons AND NOT R4) OR (R3 AND R4)
  578
  579    CMP     0,2                 \Is new value=old value?
  580    MOVNE   0,#162              \YES - do not write to CMOS RAM (improves performance)
  581    MOVNE   1,#CMOSloc%
  582    SWINE   "XOS_Byte"
  583
  584.nWriteCMOS
  585    LDMFD   13!,{0}             \R0 = old CMOS RAM contents
  586    LDMFD   13!,{1,3,4,PC}^
  587
  588\WORKING DATA STORED HERE
  589.InterceptFlag                  \0=routine not engaged, -1=engaged
  590    EQUD    0
  591.args                           \Temporary store for decoded argument parameter
  592    EQUD    0
  593.reg0old
  594    EQUD    0
  595.reg0
  596    EQUD    0
  597.reg1
  598    EQUD    0
  599
  600EQUS " MightyMouse v"+version$+" AWAX"
  601.CodeEnd                        \Do not put anything else after this terminator, as it will not be saved
  602]
  603NEXT
  604SYS "OS_Module",11,code,CodeEnd
  605PRINT"Module transferred to RMA"'
  606
  607PRINT"Module name:        "ModuleName$
  608PRINT"Module help string: ";:SYS "OS_PrettyPrint",code+help
  609PRINT'"Module start:       &";~code
  610PRINT"Module end:         &";~code+CodeEnd
  611PRINT"Module length:      ";CodeEnd" bytes"
  612IF save=FALSE PRINT'"Module save OFF"
  613ENDPROC
  614
  615DEF PROCsave
  616IF save AND (OptLo AND %100) THEN
  617  FileName$="RAM::RamDisc0.$.MityMouse"
  618  PRINT'"Press a key to save module as '"FileName$"' Escape to abort.";
  619  key=GET
  620  PRINT
  621  SYS "OS_File",10,FileName$,&FFA,,code,code+CodeEnd
  622  PRINT"Saved"
  623ENDIF
  624ENDPROC
�>MightySrc
� By Michael Stirling
(� Object code v1.01 - SUN 16/08/1998
(� Object code v1.00 - WED 01/03/1995
�
(� Source code for module MightyMouse
� Editor work area = 111

	� � �:�" at line ";�:�


Z� ************************************************************************************
U� ALTER THE FOLLOWING 3 VARIABLES TO DEFINE LOCATION, BIT TO STORE BUTTONS STATUS

E� AND THE SWI CHUNK NUMBER IN CASE OF A CLASH WITH OTHER SOFTWARE
XSwiChunk% =2047 :� Range: 0 to 2047      NOTE: 0 is reserved for development modules
OCMOSloc%  =30   :� Range: 30 to 45       NOTE: User range reserved by Acorn
$CMOSbit%  =0    :� Range: 0 to 7
Z� ************************************************************************************

� �
�


�SetUp
�asm
	�save
�

� �SetUp
#ș "OS_ReadRAMFsLimits" � R0,R1
G� R1-R0=0 �"MightySrc requires a RAM disc of at least 8K to run.":�
version$="1.01"

 � Perform range checking
!range=�
"Q� (SwiChunk% � &7FF) <> SwiChunk% �"SwiChunk% out of range 0 to &7FF":range=�
#Q� (CMOSloc%  � &0FF) <> CMOSloc%  �"CMOSloc% out of range 0 to &FF"  :range=�
$Q� (CMOSbit%  � &007) <> CMOSbit%  �"CMOSbit% out of range 0 to 7"    :range=�
%� range=� � �
&
'bit=CMOSbit%
(CMOSbit%=1<<CMOSbit%
)
*� Module variables
+ModuleName$ ="MightyMouse"
,SwiHeader$  ="MightyMouse"
-
.Bits1819%=%01
/v� (Bits1819% � %11) <> Bits1819% �"Bits1819% out of range 0 to 3. See PRM for details of correct values to use.":�
0Bits1819%=Bits1819%<<18
1SwiChunk%=SwiChunk%<<06
29SwiBase=Bits1819%+SwiChunk% :� SwiBase must be MOD 64
3m� SwiBase can never be anything other than MOD 64, but the following error check is kept for good measure
4@� SwiBase � 64<>0 �"SwiBase=&";~SwiBase". Must be MOD 64.":�
5
6� Assembler variables
7save        =�
8OptLo       =%1100
9OptHi       =%1110
:CodeSize    =4096
;� code CodeSize, L%-1
<
=LK          =14
>�
?
@
� �asm
A�'"Assembling module..."
B+� pass= OptLo � OptHi � (OptHi - OptLo)
C0� OptLo � %100 � P%=0:O%=code � P%=code:O%=0
D
E[   OPT     pass
F/    EQUD    0                   \Start code
G8    EQUD    init                \Initialisation code
H6    EQUD    final               \Finalisation code
I9    EQUD    service             \Service call handler
J1    EQUD    title               \Title string
K0    EQUD    help                \Help string
LC    EQUD    commands            \Help and command keyword table
ME    EQUD    SwiBase             \SWI chunk base number (optional)
NE    EQUD    SwiHandler          \SWI handler code      (optional)
OE    EQUD    SwiNames            \SWI decoding table    (optional)
PE    EQUD    0                   \SWI decoding code     (optional)
Q
R	.init
S?    STMFD   13!,{7-11,LK}       \Must preserve R7-R11 & R13
T0    MOV     1,#CMOSloc%         \Read status
U:    MOV     4,#0                \at location CMOSloc%,
V1    BL      ReadWriteCmos       \bit CMOSbit%
W    TST     2,#CMOSbit%
XS    BLNE    claim               \Swap buttons if configured swapped in CMOS RAM
Y    �Q   0,#0
Zl    STREQ   0,InterceptFlag     \Setting flag here is only important for initialisation after soft reset
[]    ADRVS   0,ClaimErrorMsg     \Report MouseV claim failed, if it was not successful and
\=    LDMFD   13!,{7-11,PC}       \do not initialise module
]
^.ClaimErrorMsg
_    EQUD    0
`;    EQUS    "MightyMouse module initialisation failed."
a    EQUB    0
b
    ALIGN
c
d
.final
e    STMFD   13!,{7-11,LK}
f    BL      release
gm    LDMFD   13!,{7-11,PC}^      \�E - Do not want to generate error on exit as module will refuse to die.
ho                                \       Of course this means the computer might crash, if intercept routine
iW                                \       is still running, but it is unlikely to be.
j
kV.service                        \Re-initialise module & display post-reset message
l    STMFD   13!,{0-11,LK}
m    CMP     1,#&27
n    LDMNEFD 13!,{0-11,PC}
o    BL      init
p
q    LDR     0,InterceptFlag
r    CMP     0,#0
s    ADREQ   0,normal
t    ADRNE   0,swop
u    SWI     "OS_Write0"
v    LDMFD   13!,{0-11,PC}^
w
x.normal
y&    EQUS    "Mouse buttons normal"
z    EQUW    &0A0D
{    EQUB    0
|
    ALIGN
}
~	.swop
'    EQUS    "Mouse buttons swapped"
�    EQUW    &0A0D
�    EQUB    0
�
    ALIGN
�
�
.title
�    EQUS    ModuleName$
�    EQUB    0
�
    ALIGN
�
�	.help
�]    EQUS    "MightyMouse	"+version$+" StrongArm Aware ("+��$,5,11)+") � Michael Stirling"
�    EQUB    0
�
    ALIGN
�
�
.commands
�    EQUS    "Buttons"
�    EQUB    0
�
    ALIGN
�
�    EQUD    decode
�5    EQUD    &00010100           \Information word
�2    EQUD    SyntaxMessage       \Error message
�1    EQUD    CommandHelp         \Help message
�
�    EQUS    "Buttons"
�    EQUB    0
�
    ALIGN
�
�    EQUD    DecodeStatus
�    EQUD    &40000000
�    EQUD    0
�    EQUD    0
�
�    EQUS    "MightyInfo"
�    EQUB    0
�
    ALIGN
�
�    EQUD    0
�    EQUD    &20000000
�    EQUD    0
�    EQUD    HelpCode
�
�/    EQUD    0                   \Terminator
�
�.decode
�f    STMFD   13!,{7-11,LK}       \R7-R11 must be preserved. R0=error pointer if anything goes wrong
�
�_    CMP     1,#0                \If command has no parameters, then show CMOS button status
�    BEQ     ShowStatus
�
�J    CMP     1,#1                \If command has more than 1 parameter,
�I    BHI     BadSyntax           \then terminate with an error message
�
�V    LDRB    1,[0,#2]            \Note - OS always terminates parameters with &0D20
�V    CMP     1,#13               \If R1<>13 then parameter is not 1 character long,
�O    BNE     BadSyntax           \so terminate command with an error message
�
�a    LDRB    0,[0]               \Get parameter, command has only 1 character, letter or digit
�
�P    CMP     0,#�"0"           \If parameter is not one of characters 0,1,2,3
�R    BLT     BadSyntax           \then terminate command with an error message,
�R                                \otherwise command is valid & can be processed
�    CMP     0,#�"3"
�    BHI     BadSyntax
�
�\�ESS BUTTONS PARAMETER
�
�n    SUB     0,0,#�"0"         \Get numeric value of ascii code. Note only bits 0 & 1 are actually required
�N    STR     0,args              \Save decoded argument parameter for later
�
�;    TST     0,#%10              \Configure new setting?
�E    BEQ     SetCurrent          \NO - Jump straight to SetCurrent
�
�1    TST     0,#%01              \swap or not?
�$    �Q   3,#0                \NO
�(    MOVNE   3,#CMOSbit%         \YES
�
�=    MOV     1,#CMOSloc%         \Store status in CMOS RAM
�    MOV     4,#CMOSbit%
�    BL      ReadWriteCmos
�
�.SetCurrent
�A    LDR     1,InterceptFlag     \Get current intercept status
�@    LDR     0,args              \Retrieve argument parameter
�    TST     0,#%01
�    BNE     swap
�
�9\NORMAL ROUTINE - RELEASE VECTOR � � ALREADY RELEASED
�C    TST     1,#1                \Z=0, claimed  Z=1, not claimed
�M    BLNE    release             \Quit if not claimed, else release vector
�    ADRVS   0,CantRelease
�    LDMFD   13!,{7-11,PC}
�
�.CantRelease
�    EQUD    0
�Z    EQUS    "Cannot return mouse buttons to normal, try reloading MightyMouse module."
�    EQUW    &0A0D
�    EQUB    0
�
    ALIGN
�
�2\Ȕ ROUTINE - CLAIM VECTOR � � ALREADY CLAIMED
�	.swap
�C    TST     1,#1                \Z=0, claimed  Z=1, not claimed
�I    BLEQ    claim               \Quit if claimed, else release vector
�    ADRVS   0,CantClaim
�    LDMFD   13!,{7-11,PC}
�
�.CantClaim
�    EQUD    0
�N    EQUS    "Cannot swap mouse buttons, try reloading MightyMouse module."
�    EQUB    0
�
    ALIGN
�
�.ShowStatus
�    LDR     7,InterceptFlag
�C    TST     7,#1                \Z=0, claimed  Z=1, not claimed
�    BNE     currently
�
�    SWI     "XOS_WriteS"
�)    EQUS    "Mouse buttons normal & "
�    EQUB    0
�
    ALIGN
�
�    B       cmos
�
�.currently
�    SWI     "XOS_WriteS"
�*    EQUS    "Mouse buttons swapped & "
    EQUB    0

    ALIGN

	.cmos
    MOV     1,#CMOSloc%
?    MOV     4,#0                \Mask=0 to read CMOS status
    BL      ReadWriteCmos

    TST     2,#CMOSbit%
	    BNE     swapped


    SWI     "XOS_WriteS"
$    EQUS    "configured normal."

    EQUW    &0A0D
    EQUB    0

    ALIGN

    LDMFD   13!,{7-11,PC}^

.swapped
    SWI     "XOS_WriteS"
%    EQUS    "configured swapped."
    EQUW    &0A0D
    EQUB    0

    ALIGN

    LDMFD   13!,{7-11,PC}^

.BadSyntax
    ADR     0,SyntaxError
G    TEQP    PC,#&10000003       \Set V, remembering processor state
    LDMFD   13!,{7-11,PC}
 
!.SyntaxError
"    EQUD    0
#.SyntaxMessage
$+    EQUS    "Syntax: Buttons [0|1|2|3]"
%    EQUB    0
&
    ALIGN
'
(.CommandHelp
)[    EQUS    "*Buttons configures the mouse buttons for right or left-handed operation."
*    EQUW    &0A0D
+t    EQUS    "*Buttons with no parameters displays the current & configured normal/swapped mouse buttons status."
,    EQUW    &0A0D
-    EQUW    &0A0D
.+    EQUS    "Syntax: Buttons [0|1|2|3]"
/    EQUW    &0A0D
0,    EQUS    "��������0 = Buttons normal"
1    EQUW    &0A0D
2-    EQUS    "��������1 = Buttons swapped"
3    EQUW    &0A0D
4J    EQUS    "��������2 = Buttons normal��& setting stored in CMOS RAM"
5    EQUW    &0A0D
6J    EQUS    "��������3 = Buttons swapped & setting stored in CMOS RAM"
7    EQUB    0
8
    ALIGN
9
:.DecodeStatus
;f    STMFD   13!,{7-11,LK}       \R7-R11 must be preserved. R0=error pointer if anything goes wrong
<
=K    CMP     0,#0                \Has *Configure by itself been entered?
>O    ADREQ   0,config            \YES - display configuration message & quit
?O    SWIEQ   "XOS_Write0"        \NO  - check R0 is not command tail pointer
@    LDMEQFD 13!,{7-11,PC}^
A
BK    CMP     0,#1                \Has *Configure Buttons been attempted?
CG    ADRHI   0,BadConfig         \YES - display error message & quit
DI    TEQHIP  PC,#&30000003       \Set C&V, remembering processor state
E    LDMHIFD 13!,{7-11,PC}
F
GA    MOV     0,#161              \Get CMOS RAM buttons setting
H    MOV     1,#CMOSloc%
I    SWI     "XOS_Byte"
J
KP    TST     2,#CMOSbit%         \Reflect buttons setting with screen message
L    ADREQ   0,NormalMSG
M    ADRNE   0,SwappedMSG
N    SWI     "XOS_Write0"
O
P    LDMFD   13!,{7-11,PC}^
Q
R.config
S"    EQUS    "*Buttons   <2|3>"
T    EQUW    &0A0D
U    EQUB    0
V
    ALIGN
W
X.BadConfig
Y    EQUD    0
ZC    EQUS    "Use *Buttons <2|3> to set the CMOS configuration."
[    EQUB    0
\
    ALIGN
]
^.NormalMSG
_'    EQUS    "Mouse buttons normal."
`    EQUW    &0A0D
a    EQUB    0
b
    ALIGN
c
d.SwappedMSG
e(    EQUS    "Mouse buttons swapped."
f    EQUW    &0A0D
g    EQUB    0
h
    ALIGN
i
j
.HelpCode
k    ADR     0,info
l    MOVS    PC,LK
m
n	.info
oc    EQUS    "Module MightyMouse swaps the Select & Adjust mouse buttons for left-handed users."
p    EQUW    &0A0D
q)    EQUS    "SWI base��= &"+�~SwiBase
r    EQUW    &0A0D
s0    EQUS    "SWI chunk = "+� (SwiChunk%>>>6)
t    EQUW    &0A0D
u[    EQUS    "Configuration stored at CMOS RAM location "+� CMOSloc%+", bit "+�(bit)+"."
v    EQUW    &0A0D
w8    EQUS    "*** THIS SOFTWARE IS PUBLIC DOMAIN ***"
x    EQUD    &0A0D0A0D
yB    EQUS    "v"+version$+" � Michael Stirling ("+��$,5,11)+")"
z    EQUW    &0A0D
{    EQUB    0
|
    ALIGN
}
~.SwiHandler
:    LDR     12,[12]             \Get workspace pointer
�
�,    CMP     11,#(EndSwiTable-SwiTable)/4
�9    ADDCC   PC,PC,11,LSL#2      \Dispatch if in range
�0    B       UnknownSWI          \Unknown SWI
�
�
.SwiTable
�2    B       buttons             \Jump to SWI 0
�2    B       ReadWriteCmos       \Jump to SWI 1
�
�.EndSwiTable
�
�.UnknownSWI
�    ADR     0,RangeError
�?    �RS    PC,LK,#1<<28        \Exit with overflow flag set
�
�.RangeError
�    EQUD    &1E6
�e    EQUS    "Module MightyMouse v"+version$+" supports only two SWIs (SWI base = &"+�~SwiBase+")"
�    EQUB    0
�
    ALIGN
�
�
.SwiNames
�    EQUS    SwiHeader$
�    EQUB    0
�
�    EQUS    "Buttons"
�    EQUB    0
�
�    EQUS    "CmosAccess"
�    EQUB    0
�
�/    EQUB    0                   \Terminator
�
    ALIGN
�
�.buttons
�    STMFD   13!,{1-9,LK}
�0    TEQP    PC,#3               \Clear flags
�
�$\REFLECT PREVIOUS SETTINGS IN R0
�3    STR     0,reg0              \Preserve input
�9    STR     1,reg1              \parameters for later
�
�P    MOV     0,#161              \Get configured normal/swapped buttons state
�    MOV     1,#CMOSloc%
�E    SWI     "XOS_Byte"          \State returned in R2 at CMOSbit%
�
�;    LDR     0,reg0              \Get input parameter R0
�@    TST     2,#CMOSbit%         \Configured buttons swapped?
�O    �RNE   0,0,#%10            \YES - set   bit 1 preserving all other bits
�P    BICEQ   0,0,#%10            \NO  - reset bit 1 preserving all other bits
�
�M    LDR     2,InterceptFlag     \Get current normal/swapped buttons state
�5    TST     2,#%01              \Buttons swapped?
�O    �RNE   0,0,#%01            \YES - set   bit 0 preserving all other bits
�P    BICEQ   0,0,#%01            \NO  - reset bit 0 preserving all other bits
�
�U    STR     0,reg0old           \This value of R0 to be returned on exit from SWI
�
�B\� � Y CURRENT & CONFIGURED BUTTONS STATUS AS PER � PARAMETERS
�>    LDR     0,reg0              \Retrieve input parameters
�1    LDR     1,reg1              \from earlier
�
�B    TST     1,#%10              \Is R1 bit 1 = 1? (mask=write)
�9    BEQ     R1bit1zero          \NO  - check R1 bit 0
�
�;    TST     0,#%10              \YES - Is R0 bit 1 = 0?
�4    �Q   3,#0                \YES - CMOS RAM = 0
�7    MOVNE   3,#CMOSbit%         \NO  - CMOS RAM = 1
�
�    MOV     1,#CMOSloc%
�?    MOV     4,#CMOSbit%         \Get mask for ReadWriteCmos
�<    BL      ReadWriteCmos       \Write value to CMOS RAM
�>    LDR     0,reg0              \Retrieve input parameters
�A    LDR     1,reg1              \overwritten by ReadWriteCmos
�
�.R1bit1zero
�5    TST     1,#%01              \Is R1 bit 0 = 1?
�3    BEQ     R1bit0zero          \NO  - exit SWI
�3                                \YES - do below
�?    LDR     1,InterceptFlag     \Get current buttons status
�5    TST     0,#%01              \Is R0 bit 0 = 0?
�?    BNE     R0bit0one           \NO  - claim   mouse vector
�?                                \YES - release mouse vector
�
�R    TST     1,#1                \Is vector already released? (InterceptFlag=0)
�A    BLNE    release             \NO  - flag=1, release vector
�
�Z    ADRVS   0,SwiCantRelease    \Abort with error message if vector cannot be released
�<    LDMVSFD 13!,{1-9,LK}        \Set V, while preserving
�3    �RVSS  PC,LK,#1<<28        \the other flags
�
�3    B       R1bit0zero          \YES - exit SWI
�
�.R0bit0one
�R    TST     1,#1                \Is vector already claimed?  (InterceptFlag=1)
�?    BLEQ    claim               \NO  - flag=0, claim vector
�3                                \YES - exit SWI
�Y    ADRVS   0,SwiCantClaim      \Abort with error message if vector cannot be claimed
�<    LDMVSFD 13!,{1-9,LK}        \Set V, while preserving
�3    �RVSS  PC,LK,#1<<28        \the other flags
�
�.R1bit0zero
�    LDR     0,reg0old
�K    LDMFD   13!,{1-9,PC}^       \Return to SWI caller, preserving flags
�
�.SwiCantClaim
�i    EQUD    &1A0                \Use this error number as no 'User' error numbers have been allocated
�a    EQUS    "MightyMouse SWI could not claim mouse vector, try reloading MightyMouse module."
�    EQUB    0
�
    ALIGN
�
�.SwiCantRelease
�i    EQUD    &1A1                \Use this error number as no 'User' error numbers have been allocated
�h                                \This number is generated by OS_Release, the SWI most likely to fail
�c    EQUS    "MightyMouse SWI could not release mouse vector. Try reloading MightyMouse module."
�    EQUB    0
�
    ALIGN
�
�
.claim
�    STMFD   13!,{0-2,LK}
�    MOV     0,#&1A
�    ADR     1,intercept
�    MOV     2,#0
�    SWI     "XOS_Claim"
�S    MVNVC   0,#0                \Claim with flag=-1 if OS_Claim was successful,
�8    MOVVS   0,#0                \else release with 0
�    STR     0,InterceptFlag
�T    LDMFD   13!,{0-2,PC}        \Allow V flag to be passed on if OS_Claim failed

.release
    STMFD   13!,{0-2,LK}
    MOV     0,#&1A
    ADR     1,intercept
    MOV     2,#0
    SWI     "XOS_Release"
V    MOVVC   0,#0                \Release with flag=0 if OS_Release was successful,
7    MVNVS   0,#0                \else claim with -1
	    STR     0,InterceptFlag

V    LDMFD   13!,{0-2,PC}        \Allow V flag to be passed on if OS_Release failed

.intercept

     STMFD   13!,{9,10-12,LK}

'\� SWI OS_MOUSE, � � YING � ADDRESS
*\SO THAT MY ROUTINE IS EXECUTED � EXIT

h\The following 3 instructions and the NOP are the fix to allow SWI post-processing on a StrongArm.  
n\They ensure that the StrongArm PC points to the right instruction (at .delta2) after the SWI has executed
'\by calculating the correct offset.

.delta1
k    MOV     12,PC               \Cannot stack PC here because it will point to one instruction too soon
7                                \on return from SWI
B    ADD     12,12,#(delta2-delta1-8)   \Sub=8 for StrongArm PC
    STMFD   13!,{12}

^    ADD     12,13,#8            \Align stack pointer with correct registers to execute SWI
?    LDMIA   12,{10-12,PC}       \SWI OS_Mouse executed here

e.delta2                         \SWI returns here on StrongArm, one instruction further otherwise
 q    EQUD    0                   \NOP prevents SA fix from falling over on earlier processors (PC+8/+12 issue)
!=    LDR     12,[13,#12]         \Reload workspace pointer
"
#/\OS_MOUSE POST-�ESSED HERE - BUTTONS Ȕ PED
$>    TST       2,#%001           \Move R2 bit 0 to R9 bit 2
%*    �RNE   9,2,#%100           \Move 1
&+    BICEQ   9,2,#%100           \Move 0
'
(>    TST       2,#%100           \Move R9 bit 2 to R2 bit 0
)*    �RNE   2,9,#%001           \Move 1
*+    BICEQ   2,9,#%001           \Move 0
+
,#    LDMFD   13!,{9,10-12,LK,PC}
-
.I.ReadWriteCmos                  \ReadWriteCmos v1.00 - WED 01/03/1995
/U    STMFD   13!,{1,3,4,LK}      \Preserve registers as per spec for ReadWriteCmos
0
1G    �     1,1,#&FF            \Ensure all input data is 8 bits wide
2    �     3,3,#&FF
3    �     4,4,#&FF
4
5E    MOV     0,#161              \Get value from CMOS RAM location
6    SWI     "XOS_Byte"
7
8o    STMFD   13!,{2}             \To be reloaded into R0 at the end. R0 = old CMOS RAM contents as per spec.
9
:/    CMP     4,#0                \Is mask=0?
;=    BEQ     nWriteCMOS          \YES - all done, quit SWI
<K                                \NO  - process and store new CMOS value
=\PERFORM �/WRITE FUNCTION
>F    �     3,4,3               \Store (R3 � R4) in working register
?)    MVN     4,4                 \� R3
@6    �     2,2,4               \(OldButtons � � R4)
AC    �R     2,2,3               \(Oldbuttons � � R4) � (R3 � R4)
B
C<    CMP     0,2                 \Is new value=old value?
DZ    MOVNE   0,#162              \YES - do not write to CMOS RAM (improves performance)
E    MOVNE   1,#CMOSloc%
F    SWINE   "XOS_Byte"
G
H.nWriteCMOS
I?    LDMFD   13!,{0}             \R0 = old CMOS RAM contents
J    LDMFD   13!,{1,3,4,PC}^
K
L\WORKING � STORED HERE
MF.InterceptFlag                  \0=routine not engaged, -1=engaged
N    EQUD    0
OS.args                           \Temporary store for decoded argument parameter
P    EQUD    0
Q.reg0old
R    EQUD    0
S	.reg0
T    EQUD    0
U	.reg1
V    EQUD    0
W
X*EQUS " MightyMouse v"+version$+" AWAX"
Yl.CodeEnd                        \Do not put anything else after this terminator, as it will not be saved
Z]
[�
\"ș "OS_Module",11,code,CodeEnd
]!�"Module transferred to RMA"'
^
_&�"Module name:        "ModuleName$
`:�"Module help string: ";:ș "OS_PrettyPrint",code+help
a#�'"Module start:       &";~code
b*�"Module end:         &";~code+CodeEnd
c+�"Module length:      ";CodeEnd" bytes"
d � save=� �'"Module save OFF"
e�
f
g� �save
h� save � (OptLo � %100) �
i+  FileName$="RAM::RamDisc0.$.MityMouse"
jG  �'"Press a key to save module as '"FileName$"' Escape to abort.";
k  key=�
l  �
m7  ș "OS_File",10,FileName$,&FFA,,code,code+CodeEnd
n  �"Saved"
o�
p�
�
00000000  0d 00 01 0f f4 3e 4d 69  67 68 74 79 53 72 63 0d  |.....>MightySrc.|
00000010  00 02 19 f4 20 42 79 20  4d 69 63 68 61 65 6c 20  |.... By Michael |
00000020  53 74 69 72 6c 69 6e 67  0d 00 03 28 f4 20 4f 62  |Stirling...(. Ob|
00000030  6a 65 63 74 20 63 6f 64  65 20 76 31 2e 30 31 20  |ject code v1.01 |
00000040  2d 20 53 55 4e 20 31 36  2f 30 38 2f 31 39 39 38  |- SUN 16/08/1998|
00000050  0d 00 04 28 f4 20 4f 62  6a 65 63 74 20 63 6f 64  |...(. Object cod|
00000060  65 20 76 31 2e 30 30 20  2d 20 57 45 44 20 30 31  |e v1.00 - WED 01|
00000070  2f 30 33 2f 31 39 39 35  0d 00 05 05 f4 0d 00 06  |/03/1995........|
00000080  28 f4 20 53 6f 75 72 63  65 20 63 6f 64 65 20 66  |(. Source code f|
00000090  6f 72 20 6d 6f 64 75 6c  65 20 4d 69 67 68 74 79  |or module Mighty|
000000a0  4d 6f 75 73 65 0d 00 07  1c f4 20 45 64 69 74 6f  |Mouse..... Edito|
000000b0  72 20 77 6f 72 6b 20 61  72 65 61 20 3d 20 31 31  |r work area = 11|
000000c0  31 0d 00 08 04 0d 00 09  1a ee 20 85 20 f6 3a f1  |1......... . .:.|
000000d0  22 20 61 74 20 6c 69 6e  65 20 22 3b 9e 3a e0 0d  |" at line ";.:..|
000000e0  00 0a 04 0d 00 0b 5a f4  20 2a 2a 2a 2a 2a 2a 2a  |......Z. *******|
000000f0  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
00000130  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 0d 00 0c  |*************...|
00000140  55 f4 20 41 4c 54 45 52  20 54 48 45 20 46 4f 4c  |U. ALTER THE FOL|
00000150  4c 4f 57 49 4e 47 20 33  20 56 41 52 49 41 42 4c  |LOWING 3 VARIABL|
00000160  45 53 20 54 4f 20 44 45  46 49 4e 45 20 4c 4f 43  |ES TO DEFINE LOC|
00000170  41 54 49 4f 4e 2c 20 42  49 54 20 54 4f 20 53 54  |ATION, BIT TO ST|
00000180  4f 52 45 20 42 55 54 54  4f 4e 53 20 53 54 41 54  |ORE BUTTONS STAT|
00000190  55 53 0d 00 0d 45 f4 20  41 4e 44 20 54 48 45 20  |US...E. AND THE |
000001a0  53 57 49 20 43 48 55 4e  4b 20 4e 55 4d 42 45 52  |SWI CHUNK NUMBER|
000001b0  20 49 4e 20 43 41 53 45  20 4f 46 20 41 20 43 4c  | IN CASE OF A CL|
000001c0  41 53 48 20 57 49 54 48  20 4f 54 48 45 52 20 53  |ASH WITH OTHER S|
000001d0  4f 46 54 57 41 52 45 0d  00 0e 58 53 77 69 43 68  |OFTWARE...XSwiCh|
000001e0  75 6e 6b 25 20 3d 32 30  34 37 20 3a f4 20 52 61  |unk% =2047 :. Ra|
000001f0  6e 67 65 3a 20 30 20 74  6f 20 32 30 34 37 20 20  |nge: 0 to 2047  |
00000200  20 20 20 20 4e 4f 54 45  3a 20 30 20 69 73 20 72  |    NOTE: 0 is r|
00000210  65 73 65 72 76 65 64 20  66 6f 72 20 64 65 76 65  |eserved for deve|
00000220  6c 6f 70 6d 65 6e 74 20  6d 6f 64 75 6c 65 73 0d  |lopment modules.|
00000230  00 0f 4f 43 4d 4f 53 6c  6f 63 25 20 20 3d 33 30  |..OCMOSloc%  =30|
00000240  20 20 20 3a f4 20 52 61  6e 67 65 3a 20 33 30 20  |   :. Range: 30 |
00000250  74 6f 20 34 35 20 20 20  20 20 20 20 4e 4f 54 45  |to 45       NOTE|
00000260  3a 20 55 73 65 72 20 72  61 6e 67 65 20 72 65 73  |: User range res|
00000270  65 72 76 65 64 20 62 79  20 41 63 6f 72 6e 0d 00  |erved by Acorn..|
00000280  10 24 43 4d 4f 53 62 69  74 25 20 20 3d 30 20 20  |.$CMOSbit%  =0  |
00000290  20 20 3a f4 20 52 61 6e  67 65 3a 20 30 20 74 6f  |  :. Range: 0 to|
000002a0  20 37 0d 00 11 5a f4 20  2a 2a 2a 2a 2a 2a 2a 2a  | 7...Z. ********|
000002b0  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
000002f0  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 0d 00 12 04  |************....|
00000300  0d 00 13 07 eb 20 eb 0d  00 14 05 87 0d 00 15 04  |..... ..........|
00000310  0d 00 16 0a f2 53 65 74  55 70 0d 00 17 08 f2 61  |.....SetUp.....a|
00000320  73 6d 0d 00 18 09 f2 73  61 76 65 0d 00 19 05 e0  |sm.....save.....|
00000330  0d 00 1a 04 0d 00 1b 0c  dd 20 f2 53 65 74 55 70  |......... .SetUp|
00000340  0d 00 1c 23 c8 99 20 22  4f 53 5f 52 65 61 64 52  |...#.. "OS_ReadR|
00000350  41 4d 46 73 4c 69 6d 69  74 73 22 20 b8 20 52 30  |AMFsLimits" . R0|
00000360  2c 52 31 0d 00 1d 47 e7  20 52 31 2d 52 30 3d 30  |,R1...G. R1-R0=0|
00000370  20 f1 22 4d 69 67 68 74  79 53 72 63 20 72 65 71  | ."MightySrc req|
00000380  75 69 72 65 73 20 61 20  52 41 4d 20 64 69 73 63  |uires a RAM disc|
00000390  20 6f 66 20 61 74 20 6c  65 61 73 74 20 38 4b 20  | of at least 8K |
000003a0  74 6f 20 72 75 6e 2e 22  3a e0 0d 00 1e 13 76 65  |to run.":.....ve|
000003b0  72 73 69 6f 6e 24 3d 22  31 2e 30 31 22 0d 00 1f  |rsion$="1.01"...|
000003c0  04 0d 00 20 1c f4 20 50  65 72 66 6f 72 6d 20 72  |... .. Perform r|
000003d0  61 6e 67 65 20 63 68 65  63 6b 69 6e 67 0d 00 21  |ange checking..!|
000003e0  0b 72 61 6e 67 65 3d a3  0d 00 22 51 e7 20 28 53  |.range=..."Q. (S|
000003f0  77 69 43 68 75 6e 6b 25  20 80 20 26 37 46 46 29  |wiChunk% . &7FF)|
00000400  20 3c 3e 20 53 77 69 43  68 75 6e 6b 25 20 f1 22  | <> SwiChunk% ."|
00000410  53 77 69 43 68 75 6e 6b  25 20 6f 75 74 20 6f 66  |SwiChunk% out of|
00000420  20 72 61 6e 67 65 20 30  20 74 6f 20 26 37 46 46  | range 0 to &7FF|
00000430  22 3a 72 61 6e 67 65 3d  b9 0d 00 23 51 e7 20 28  |":range=...#Q. (|
00000440  43 4d 4f 53 6c 6f 63 25  20 20 80 20 26 30 46 46  |CMOSloc%  . &0FF|
00000450  29 20 3c 3e 20 43 4d 4f  53 6c 6f 63 25 20 20 f1  |) <> CMOSloc%  .|
00000460  22 43 4d 4f 53 6c 6f 63  25 20 6f 75 74 20 6f 66  |"CMOSloc% out of|
00000470  20 72 61 6e 67 65 20 30  20 74 6f 20 26 46 46 22  | range 0 to &FF"|
00000480  20 20 3a 72 61 6e 67 65  3d b9 0d 00 24 51 e7 20  |  :range=...$Q. |
00000490  28 43 4d 4f 53 62 69 74  25 20 20 80 20 26 30 30  |(CMOSbit%  . &00|
000004a0  37 29 20 3c 3e 20 43 4d  4f 53 62 69 74 25 20 20  |7) <> CMOSbit%  |
000004b0  f1 22 43 4d 4f 53 62 69  74 25 20 6f 75 74 20 6f  |."CMOSbit% out o|
000004c0  66 20 72 61 6e 67 65 20  30 20 74 6f 20 37 22 20  |f range 0 to 7" |
000004d0  20 20 20 3a 72 61 6e 67  65 3d b9 0d 00 25 11 e7  |   :range=...%..|
000004e0  20 72 61 6e 67 65 3d b9  20 8c 20 e0 0d 00 26 04  | range=. . ...&.|
000004f0  0d 00 27 10 62 69 74 3d  43 4d 4f 53 62 69 74 25  |..'.bit=CMOSbit%|
00000500  0d 00 28 18 43 4d 4f 53  62 69 74 25 3d 31 3c 3c  |..(.CMOSbit%=1<<|
00000510  43 4d 4f 53 62 69 74 25  0d 00 29 04 0d 00 2a 16  |CMOSbit%..)...*.|
00000520  f4 20 4d 6f 64 75 6c 65  20 76 61 72 69 61 62 6c  |. Module variabl|
00000530  65 73 0d 00 2b 1e 4d 6f  64 75 6c 65 4e 61 6d 65  |es..+.ModuleName|
00000540  24 20 3d 22 4d 69 67 68  74 79 4d 6f 75 73 65 22  |$ ="MightyMouse"|
00000550  0d 00 2c 1e 53 77 69 48  65 61 64 65 72 24 20 20  |..,.SwiHeader$  |
00000560  3d 22 4d 69 67 68 74 79  4d 6f 75 73 65 22 0d 00  |="MightyMouse"..|
00000570  2d 04 0d 00 2e 11 42 69  74 73 31 38 31 39 25 3d  |-.....Bits1819%=|
00000580  25 30 31 0d 00 2f 76 e7  20 28 42 69 74 73 31 38  |%01../v. (Bits18|
00000590  31 39 25 20 80 20 25 31  31 29 20 3c 3e 20 42 69  |19% . %11) <> Bi|
000005a0  74 73 31 38 31 39 25 20  f1 22 42 69 74 73 31 38  |ts1819% ."Bits18|
000005b0  31 39 25 20 6f 75 74 20  6f 66 20 72 61 6e 67 65  |19% out of range|
000005c0  20 30 20 74 6f 20 33 2e  20 53 65 65 20 50 52 4d  | 0 to 3. See PRM|
000005d0  20 66 6f 72 20 64 65 74  61 69 6c 73 20 6f 66 20  | for details of |
000005e0  63 6f 72 72 65 63 74 20  76 61 6c 75 65 73 20 74  |correct values t|
000005f0  6f 20 75 73 65 2e 22 3a  e0 0d 00 30 1b 42 69 74  |o use.":...0.Bit|
00000600  73 31 38 31 39 25 3d 42  69 74 73 31 38 31 39 25  |s1819%=Bits1819%|
00000610  3c 3c 31 38 0d 00 31 1b  53 77 69 43 68 75 6e 6b  |<<18..1.SwiChunk|
00000620  25 3d 53 77 69 43 68 75  6e 6b 25 3c 3c 30 36 0d  |%=SwiChunk%<<06.|
00000630  00 32 39 53 77 69 42 61  73 65 3d 42 69 74 73 31  |.29SwiBase=Bits1|
00000640  38 31 39 25 2b 53 77 69  43 68 75 6e 6b 25 20 3a  |819%+SwiChunk% :|
00000650  f4 20 53 77 69 42 61 73  65 20 6d 75 73 74 20 62  |. SwiBase must b|
00000660  65 20 4d 4f 44 20 36 34  0d 00 33 6d f4 20 53 77  |e MOD 64..3m. Sw|
00000670  69 42 61 73 65 20 63 61  6e 20 6e 65 76 65 72 20  |iBase can never |
00000680  62 65 20 61 6e 79 74 68  69 6e 67 20 6f 74 68 65  |be anything othe|
00000690  72 20 74 68 61 6e 20 4d  4f 44 20 36 34 2c 20 62  |r than MOD 64, b|
000006a0  75 74 20 74 68 65 20 66  6f 6c 6c 6f 77 69 6e 67  |ut the following|
000006b0  20 65 72 72 6f 72 20 63  68 65 63 6b 20 69 73 20  | error check is |
000006c0  6b 65 70 74 20 66 6f 72  20 67 6f 6f 64 20 6d 65  |kept for good me|
000006d0  61 73 75 72 65 0d 00 34  40 e7 20 53 77 69 42 61  |asure..4@. SwiBa|
000006e0  73 65 20 83 20 36 34 3c  3e 30 20 f1 22 53 77 69  |se . 64<>0 ."Swi|
000006f0  42 61 73 65 3d 26 22 3b  7e 53 77 69 42 61 73 65  |Base=&";~SwiBase|
00000700  22 2e 20 4d 75 73 74 20  62 65 20 4d 4f 44 20 36  |". Must be MOD 6|
00000710  34 2e 22 3a e0 0d 00 35  04 0d 00 36 19 f4 20 41  |4.":...5...6.. A|
00000720  73 73 65 6d 62 6c 65 72  20 76 61 72 69 61 62 6c  |ssembler variabl|
00000730  65 73 0d 00 37 12 73 61  76 65 20 20 20 20 20 20  |es..7.save      |
00000740  20 20 3d b9 0d 00 38 16  4f 70 74 4c 6f 20 20 20  |  =...8.OptLo   |
00000750  20 20 20 20 3d 25 31 31  30 30 0d 00 39 16 4f 70  |    =%1100..9.Op|
00000760  74 48 69 20 20 20 20 20  20 20 3d 25 31 31 31 30  |tHi       =%1110|
00000770  0d 00 3a 15 43 6f 64 65  53 69 7a 65 20 20 20 20  |..:.CodeSize    |
00000780  3d 34 30 39 36 0d 00 3b  19 de 20 63 6f 64 65 20  |=4096..;.. code |
00000790  43 6f 64 65 53 69 7a 65  2c 20 4c 25 2d 31 0d 00  |CodeSize, L%-1..|
000007a0  3c 04 0d 00 3d 13 4c 4b  20 20 20 20 20 20 20 20  |<...=.LK        |
000007b0  20 20 3d 31 34 0d 00 3e  05 e1 0d 00 3f 04 0d 00  |  =14..>....?...|
000007c0  40 0a dd 20 f2 61 73 6d  0d 00 41 1c f1 27 22 41  |@.. .asm..A..'"A|
000007d0  73 73 65 6d 62 6c 69 6e  67 20 6d 6f 64 75 6c 65  |ssembling module|
000007e0  2e 2e 2e 22 0d 00 42 2b  e3 20 70 61 73 73 3d 20  |..."..B+. pass= |
000007f0  4f 70 74 4c 6f 20 b8 20  4f 70 74 48 69 20 88 20  |OptLo . OptHi . |
00000800  28 4f 70 74 48 69 20 2d  20 4f 70 74 4c 6f 29 0d  |(OptHi - OptLo).|
00000810  00 43 30 e7 20 4f 70 74  4c 6f 20 80 20 25 31 30  |.C0. OptLo . %10|
00000820  30 20 8c 20 50 25 3d 30  3a 4f 25 3d 63 6f 64 65  |0 . P%=0:O%=code|
00000830  20 8b 20 50 25 3d 63 6f  64 65 3a 4f 25 3d 30 0d  | . P%=code:O%=0.|
00000840  00 44 04 0d 00 45 14 5b  20 20 20 4f 50 54 20 20  |.D...E.[   OPT  |
00000850  20 20 20 70 61 73 73 0d  00 46 2f 20 20 20 20 45  |   pass..F/    E|
00000860  51 55 44 20 20 20 20 30  20 20 20 20 20 20 20 20  |QUD    0        |
00000870  20 20 20 20 20 20 20 20  20 20 20 5c 53 74 61 72  |           \Star|
00000880  74 20 63 6f 64 65 0d 00  47 38 20 20 20 20 45 51  |t code..G8    EQ|
00000890  55 44 20 20 20 20 69 6e  69 74 20 20 20 20 20 20  |UD    init      |
000008a0  20 20 20 20 20 20 20 20  20 20 5c 49 6e 69 74 69  |          \Initi|
000008b0  61 6c 69 73 61 74 69 6f  6e 20 63 6f 64 65 0d 00  |alisation code..|
000008c0  48 36 20 20 20 20 45 51  55 44 20 20 20 20 66 69  |H6    EQUD    fi|
000008d0  6e 61 6c 20 20 20 20 20  20 20 20 20 20 20 20 20  |nal             |
000008e0  20 20 5c 46 69 6e 61 6c  69 73 61 74 69 6f 6e 20  |  \Finalisation |
000008f0  63 6f 64 65 0d 00 49 39  20 20 20 20 45 51 55 44  |code..I9    EQUD|
00000900  20 20 20 20 73 65 72 76  69 63 65 20 20 20 20 20  |    service     |
00000910  20 20 20 20 20 20 20 20  5c 53 65 72 76 69 63 65  |        \Service|
00000920  20 63 61 6c 6c 20 68 61  6e 64 6c 65 72 0d 00 4a  | call handler..J|
00000930  31 20 20 20 20 45 51 55  44 20 20 20 20 74 69 74  |1    EQUD    tit|
00000940  6c 65 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |le              |
00000950  20 5c 54 69 74 6c 65 20  73 74 72 69 6e 67 0d 00  | \Title string..|
00000960  4b 30 20 20 20 20 45 51  55 44 20 20 20 20 68 65  |K0    EQUD    he|
00000970  6c 70 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |lp              |
00000980  20 20 5c 48 65 6c 70 20  73 74 72 69 6e 67 0d 00  |  \Help string..|
00000990  4c 43 20 20 20 20 45 51  55 44 20 20 20 20 63 6f  |LC    EQUD    co|
000009a0  6d 6d 61 6e 64 73 20 20  20 20 20 20 20 20 20 20  |mmands          |
000009b0  20 20 5c 48 65 6c 70 20  61 6e 64 20 63 6f 6d 6d  |  \Help and comm|
000009c0  61 6e 64 20 6b 65 79 77  6f 72 64 20 74 61 62 6c  |and keyword tabl|
000009d0  65 0d 00 4d 45 20 20 20  20 45 51 55 44 20 20 20  |e..ME    EQUD   |
000009e0  20 53 77 69 42 61 73 65  20 20 20 20 20 20 20 20  | SwiBase        |
000009f0  20 20 20 20 20 5c 53 57  49 20 63 68 75 6e 6b 20  |     \SWI chunk |
00000a00  62 61 73 65 20 6e 75 6d  62 65 72 20 28 6f 70 74  |base number (opt|
00000a10  69 6f 6e 61 6c 29 0d 00  4e 45 20 20 20 20 45 51  |ional)..NE    EQ|
00000a20  55 44 20 20 20 20 53 77  69 48 61 6e 64 6c 65 72  |UD    SwiHandler|
00000a30  20 20 20 20 20 20 20 20  20 20 5c 53 57 49 20 68  |          \SWI h|
00000a40  61 6e 64 6c 65 72 20 63  6f 64 65 20 20 20 20 20  |andler code     |
00000a50  20 28 6f 70 74 69 6f 6e  61 6c 29 0d 00 4f 45 20  | (optional)..OE |
00000a60  20 20 20 45 51 55 44 20  20 20 20 53 77 69 4e 61  |   EQUD    SwiNa|
00000a70  6d 65 73 20 20 20 20 20  20 20 20 20 20 20 20 5c  |mes            \|
00000a80  53 57 49 20 64 65 63 6f  64 69 6e 67 20 74 61 62  |SWI decoding tab|
00000a90  6c 65 20 20 20 20 28 6f  70 74 69 6f 6e 61 6c 29  |le    (optional)|
00000aa0  0d 00 50 45 20 20 20 20  45 51 55 44 20 20 20 20  |..PE    EQUD    |
00000ab0  30 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |0               |
00000ac0  20 20 20 20 5c 53 57 49  20 64 65 63 6f 64 69 6e  |    \SWI decodin|
00000ad0  67 20 63 6f 64 65 20 20  20 20 20 28 6f 70 74 69  |g code     (opti|
00000ae0  6f 6e 61 6c 29 0d 00 51  04 0d 00 52 09 2e 69 6e  |onal)..Q...R..in|
00000af0  69 74 0d 00 53 3f 20 20  20 20 53 54 4d 46 44 20  |it..S?    STMFD |
00000b00  20 20 31 33 21 2c 7b 37  2d 31 31 2c 4c 4b 7d 20  |  13!,{7-11,LK} |
00000b10  20 20 20 20 20 20 5c 4d  75 73 74 20 70 72 65 73  |      \Must pres|
00000b20  65 72 76 65 20 52 37 2d  52 31 31 20 26 20 52 31  |erve R7-R11 & R1|
00000b30  33 0d 00 54 30 20 20 20  20 4d 4f 56 20 20 20 20  |3..T0    MOV    |
00000b40  20 31 2c 23 43 4d 4f 53  6c 6f 63 25 20 20 20 20  | 1,#CMOSloc%    |
00000b50  20 20 20 20 20 5c 52 65  61 64 20 73 74 61 74 75  |     \Read statu|
00000b60  73 0d 00 55 3a 20 20 20  20 4d 4f 56 20 20 20 20  |s..U:    MOV    |
00000b70  20 34 2c 23 30 20 20 20  20 20 20 20 20 20 20 20  | 4,#0           |
00000b80  20 20 20 20 20 5c 61 74  20 6c 6f 63 61 74 69 6f  |     \at locatio|
00000b90  6e 20 43 4d 4f 53 6c 6f  63 25 2c 0d 00 56 31 20  |n CMOSloc%,..V1 |
00000ba0  20 20 20 42 4c 20 20 20  20 20 20 52 65 61 64 57  |   BL      ReadW|
00000bb0  72 69 74 65 43 6d 6f 73  20 20 20 20 20 20 20 5c  |riteCmos       \|
00000bc0  62 69 74 20 43 4d 4f 53  62 69 74 25 0d 00 57 1b  |bit CMOSbit%..W.|
00000bd0  20 20 20 20 54 53 54 20  20 20 20 20 32 2c 23 43  |    TST     2,#C|
00000be0  4d 4f 53 62 69 74 25 0d  00 58 53 20 20 20 20 42  |MOSbit%..XS    B|
00000bf0  4c 4e 45 20 20 20 20 63  6c 61 69 6d 20 20 20 20  |LNE    claim    |
00000c00  20 20 20 20 20 20 20 20  20 20 20 5c 53 77 61 70  |           \Swap|
00000c10  20 62 75 74 74 6f 6e 73  20 69 66 20 63 6f 6e 66  | buttons if conf|
00000c20  69 67 75 72 65 64 20 73  77 61 70 70 65 64 20 69  |igured swapped i|
00000c30  6e 20 43 4d 4f 53 20 52  41 4d 0d 00 59 11 20 20  |n CMOS RAM..Y.  |
00000c40  20 20 ec 51 20 20 20 30  2c 23 30 0d 00 5a 6c 20  |  .Q   0,#0..Zl |
00000c50  20 20 20 53 54 52 45 51  20 20 20 30 2c 49 6e 74  |   STREQ   0,Int|
00000c60  65 72 63 65 70 74 46 6c  61 67 20 20 20 20 20 5c  |erceptFlag     \|
00000c70  53 65 74 74 69 6e 67 20  66 6c 61 67 20 68 65 72  |Setting flag her|
00000c80  65 20 69 73 20 6f 6e 6c  79 20 69 6d 70 6f 72 74  |e is only import|
00000c90  61 6e 74 20 66 6f 72 20  69 6e 69 74 69 61 6c 69  |ant for initiali|
00000ca0  73 61 74 69 6f 6e 20 61  66 74 65 72 20 73 6f 66  |sation after sof|
00000cb0  74 20 72 65 73 65 74 0d  00 5b 5d 20 20 20 20 41  |t reset..[]    A|
00000cc0  44 52 56 53 20 20 20 30  2c 43 6c 61 69 6d 45 72  |DRVS   0,ClaimEr|
00000cd0  72 6f 72 4d 73 67 20 20  20 20 20 5c 52 65 70 6f  |rorMsg     \Repo|
00000ce0  72 74 20 4d 6f 75 73 65  56 20 63 6c 61 69 6d 20  |rt MouseV claim |
00000cf0  66 61 69 6c 65 64 2c 20  69 66 20 69 74 20 77 61  |failed, if it wa|
00000d00  73 20 6e 6f 74 20 73 75  63 63 65 73 73 66 75 6c  |s not successful|
00000d10  20 61 6e 64 0d 00 5c 3d  20 20 20 20 4c 44 4d 46  | and..\=    LDMF|
00000d20  44 20 20 20 31 33 21 2c  7b 37 2d 31 31 2c 50 43  |D   13!,{7-11,PC|
00000d30  7d 20 20 20 20 20 20 20  5c 64 6f 20 6e 6f 74 20  |}       \do not |
00000d40  69 6e 69 74 69 61 6c 69  73 65 20 6d 6f 64 75 6c  |initialise modul|
00000d50  65 0d 00 5d 04 0d 00 5e  12 2e 43 6c 61 69 6d 45  |e..]...^..ClaimE|
00000d60  72 72 6f 72 4d 73 67 0d  00 5f 11 20 20 20 20 45  |rrorMsg.._.    E|
00000d70  51 55 44 20 20 20 20 30  0d 00 60 3b 20 20 20 20  |QUD    0..`;    |
00000d80  45 51 55 53 20 20 20 20  22 4d 69 67 68 74 79 4d  |EQUS    "MightyM|
00000d90  6f 75 73 65 20 6d 6f 64  75 6c 65 20 69 6e 69 74  |ouse module init|
00000da0  69 61 6c 69 73 61 74 69  6f 6e 20 66 61 69 6c 65  |ialisation faile|
00000db0  64 2e 22 0d 00 61 11 20  20 20 20 45 51 55 42 20  |d."..a.    EQUB |
00000dc0  20 20 20 30 0d 00 62 0d  20 20 20 20 41 4c 49 47  |   0..b.    ALIG|
00000dd0  4e 0d 00 63 04 0d 00 64  0a 2e 66 69 6e 61 6c 0d  |N..c...d..final.|
00000de0  00 65 1d 20 20 20 20 53  54 4d 46 44 20 20 20 31  |.e.    STMFD   1|
00000df0  33 21 2c 7b 37 2d 31 31  2c 4c 4b 7d 0d 00 66 17  |3!,{7-11,LK}..f.|
00000e00  20 20 20 20 42 4c 20 20  20 20 20 20 72 65 6c 65  |    BL      rele|
00000e10  61 73 65 0d 00 67 6d 20  20 20 20 4c 44 4d 46 44  |ase..gm    LDMFD|
00000e20  20 20 20 31 33 21 2c 7b  37 2d 31 31 2c 50 43 7d  |   13!,{7-11,PC}|
00000e30  5e 20 20 20 20 20 20 5c  ac 45 20 2d 20 44 6f 20  |^      \.E - Do |
00000e40  6e 6f 74 20 77 61 6e 74  20 74 6f 20 67 65 6e 65  |not want to gene|
00000e50  72 61 74 65 20 65 72 72  6f 72 20 6f 6e 20 65 78  |rate error on ex|
00000e60  69 74 20 61 73 20 6d 6f  64 75 6c 65 20 77 69 6c  |it as module wil|
00000e70  6c 20 72 65 66 75 73 65  20 74 6f 20 64 69 65 2e  |l refuse to die.|
00000e80  0d 00 68 6f 20 20 20 20  20 20 20 20 20 20 20 20  |..ho            |
00000e90  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000ea0  20 20 20 20 5c 20 20 20  20 20 20 20 4f 66 20 63  |    \       Of c|
00000eb0  6f 75 72 73 65 20 74 68  69 73 20 6d 65 61 6e 73  |ourse this means|
00000ec0  20 74 68 65 20 63 6f 6d  70 75 74 65 72 20 6d 69  | the computer mi|
00000ed0  67 68 74 20 63 72 61 73  68 2c 20 69 66 20 69 6e  |ght crash, if in|
00000ee0  74 65 72 63 65 70 74 20  72 6f 75 74 69 6e 65 0d  |tercept routine.|
00000ef0  00 69 57 20 20 20 20 20  20 20 20 20 20 20 20 20  |.iW             |
00000f00  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000f10  20 20 20 5c 20 20 20 20  20 20 20 69 73 20 73 74  |   \       is st|
00000f20  69 6c 6c 20 72 75 6e 6e  69 6e 67 2c 20 62 75 74  |ill running, but|
00000f30  20 69 74 20 69 73 20 75  6e 6c 69 6b 65 6c 79 20  | it is unlikely |
00000f40  74 6f 20 62 65 2e 0d 00  6a 04 0d 00 6b 56 2e 73  |to be...j...kV.s|
00000f50  65 72 76 69 63 65 20 20  20 20 20 20 20 20 20 20  |ervice          |
00000f60  20 20 20 20 20 20 20 20  20 20 20 20 20 20 5c 52  |              \R|
00000f70  65 2d 69 6e 69 74 69 61  6c 69 73 65 20 6d 6f 64  |e-initialise mod|
00000f80  75 6c 65 20 26 20 64 69  73 70 6c 61 79 20 70 6f  |ule & display po|
00000f90  73 74 2d 72 65 73 65 74  20 6d 65 73 73 61 67 65  |st-reset message|
00000fa0  0d 00 6c 1d 20 20 20 20  53 54 4d 46 44 20 20 20  |..l.    STMFD   |
00000fb0  31 33 21 2c 7b 30 2d 31  31 2c 4c 4b 7d 0d 00 6d  |13!,{0-11,LK}..m|
00000fc0  16 20 20 20 20 43 4d 50  20 20 20 20 20 31 2c 23  |.    CMP     1,#|
00000fd0  26 32 37 0d 00 6e 1d 20  20 20 20 4c 44 4d 4e 45  |&27..n.    LDMNE|
00000fe0  46 44 20 31 33 21 2c 7b  30 2d 31 31 2c 50 43 7d  |FD 13!,{0-11,PC}|
00000ff0  0d 00 6f 14 20 20 20 20  42 4c 20 20 20 20 20 20  |..o.    BL      |
00001000  69 6e 69 74 0d 00 70 04  0d 00 71 1f 20 20 20 20  |init..p...q.    |
00001010  4c 44 52 20 20 20 20 20  30 2c 49 6e 74 65 72 63  |LDR     0,Interc|
00001020  65 70 74 46 6c 61 67 0d  00 72 14 20 20 20 20 43  |eptFlag..r.    C|
00001030  4d 50 20 20 20 20 20 30  2c 23 30 0d 00 73 18 20  |MP     0,#0..s. |
00001040  20 20 20 41 44 52 45 51  20 20 20 30 2c 6e 6f 72  |   ADREQ   0,nor|
00001050  6d 61 6c 0d 00 74 16 20  20 20 20 41 44 52 4e 45  |mal..t.    ADRNE|
00001060  20 20 20 30 2c 73 77 6f  70 0d 00 75 1b 20 20 20  |   0,swop..u.   |
00001070  20 53 57 49 20 20 20 20  20 22 4f 53 5f 57 72 69  | SWI     "OS_Wri|
00001080  74 65 30 22 0d 00 76 1e  20 20 20 20 4c 44 4d 46  |te0"..v.    LDMF|
00001090  44 20 20 20 31 33 21 2c  7b 30 2d 31 31 2c 50 43  |D   13!,{0-11,PC|
000010a0  7d 5e 0d 00 77 04 0d 00  78 0b 2e 6e 6f 72 6d 61  |}^..w...x..norma|
000010b0  6c 0d 00 79 26 20 20 20  20 45 51 55 53 20 20 20  |l..y&    EQUS   |
000010c0  20 22 4d 6f 75 73 65 20  62 75 74 74 6f 6e 73 20  | "Mouse buttons |
000010d0  6e 6f 72 6d 61 6c 22 0d  00 7a 15 20 20 20 20 45  |normal"..z.    E|
000010e0  51 55 57 20 20 20 20 26  30 41 30 44 0d 00 7b 11  |QUW    &0A0D..{.|
000010f0  20 20 20 20 45 51 55 42  20 20 20 20 30 0d 00 7c  |    EQUB    0..||
00001100  0d 20 20 20 20 41 4c 49  47 4e 0d 00 7d 04 0d 00  |.    ALIGN..}...|
00001110  7e 09 2e 73 77 6f 70 0d  00 7f 27 20 20 20 20 45  |~..swop...'    E|
00001120  51 55 53 20 20 20 20 22  4d 6f 75 73 65 20 62 75  |QUS    "Mouse bu|
00001130  74 74 6f 6e 73 20 73 77  61 70 70 65 64 22 0d 00  |ttons swapped"..|
00001140  80 15 20 20 20 20 45 51  55 57 20 20 20 20 26 30  |..    EQUW    &0|
00001150  41 30 44 0d 00 81 11 20  20 20 20 45 51 55 42 20  |A0D....    EQUB |
00001160  20 20 20 30 0d 00 82 0d  20 20 20 20 41 4c 49 47  |   0....    ALIG|
00001170  4e 0d 00 83 04 0d 00 84  0a 2e 74 69 74 6c 65 0d  |N.........title.|
00001180  00 85 1b 20 20 20 20 45  51 55 53 20 20 20 20 4d  |...    EQUS    M|
00001190  6f 64 75 6c 65 4e 61 6d  65 24 0d 00 86 11 20 20  |oduleName$....  |
000011a0  20 20 45 51 55 42 20 20  20 20 30 0d 00 87 0d 20  |  EQUB    0.... |
000011b0  20 20 20 41 4c 49 47 4e  0d 00 88 04 0d 00 89 09  |   ALIGN........|
000011c0  2e 68 65 6c 70 0d 00 8a  5d 20 20 20 20 45 51 55  |.help...]    EQU|
000011d0  53 20 20 20 20 22 4d 69  67 68 74 79 4d 6f 75 73  |S    "MightyMous|
000011e0  65 09 22 2b 76 65 72 73  69 6f 6e 24 2b 22 20 53  |e."+version$+" S|
000011f0  74 72 6f 6e 67 41 72 6d  20 41 77 61 72 65 20 28  |trongArm Aware (|
00001200  22 2b c1 91 24 2c 35 2c  31 31 29 2b 22 29 20 a9  |"+..$,5,11)+") .|
00001210  20 4d 69 63 68 61 65 6c  20 53 74 69 72 6c 69 6e  | Michael Stirlin|
00001220  67 22 0d 00 8b 11 20 20  20 20 45 51 55 42 20 20  |g"....    EQUB  |
00001230  20 20 30 0d 00 8c 0d 20  20 20 20 41 4c 49 47 4e  |  0....    ALIGN|
00001240  0d 00 8d 04 0d 00 8e 0d  2e 63 6f 6d 6d 61 6e 64  |.........command|
00001250  73 0d 00 8f 19 20 20 20  20 45 51 55 53 20 20 20  |s....    EQUS   |
00001260  20 22 42 75 74 74 6f 6e  73 22 0d 00 90 11 20 20  | "Buttons"....  |
00001270  20 20 45 51 55 42 20 20  20 20 30 0d 00 91 0d 20  |  EQUB    0.... |
00001280  20 20 20 41 4c 49 47 4e  0d 00 92 04 0d 00 93 16  |   ALIGN........|
00001290  20 20 20 20 45 51 55 44  20 20 20 20 64 65 63 6f  |    EQUD    deco|
000012a0  64 65 0d 00 94 35 20 20  20 20 45 51 55 44 20 20  |de...5    EQUD  |
000012b0  20 20 26 30 30 30 31 30  31 30 30 20 20 20 20 20  |  &00010100     |
000012c0  20 20 20 20 20 20 5c 49  6e 66 6f 72 6d 61 74 69  |      \Informati|
000012d0  6f 6e 20 77 6f 72 64 0d  00 95 32 20 20 20 20 45  |on word...2    E|
000012e0  51 55 44 20 20 20 20 53  79 6e 74 61 78 4d 65 73  |QUD    SyntaxMes|
000012f0  73 61 67 65 20 20 20 20  20 20 20 5c 45 72 72 6f  |sage       \Erro|
00001300  72 20 6d 65 73 73 61 67  65 0d 00 96 31 20 20 20  |r message...1   |
00001310  20 45 51 55 44 20 20 20  20 43 6f 6d 6d 61 6e 64  | EQUD    Command|
00001320  48 65 6c 70 20 20 20 20  20 20 20 20 20 5c 48 65  |Help         \He|
00001330  6c 70 20 6d 65 73 73 61  67 65 0d 00 97 04 0d 00  |lp message......|
00001340  98 19 20 20 20 20 45 51  55 53 20 20 20 20 22 42  |..    EQUS    "B|
00001350  75 74 74 6f 6e 73 22 0d  00 99 11 20 20 20 20 45  |uttons"....    E|
00001360  51 55 42 20 20 20 20 30  0d 00 9a 0d 20 20 20 20  |QUB    0....    |
00001370  41 4c 49 47 4e 0d 00 9b  04 0d 00 9c 1c 20 20 20  |ALIGN........   |
00001380  20 45 51 55 44 20 20 20  20 44 65 63 6f 64 65 53  | EQUD    DecodeS|
00001390  74 61 74 75 73 0d 00 9d  19 20 20 20 20 45 51 55  |tatus....    EQU|
000013a0  44 20 20 20 20 26 34 30  30 30 30 30 30 30 0d 00  |D    &40000000..|
000013b0  9e 11 20 20 20 20 45 51  55 44 20 20 20 20 30 0d  |..    EQUD    0.|
000013c0  00 9f 11 20 20 20 20 45  51 55 44 20 20 20 20 30  |...    EQUD    0|
000013d0  0d 00 a0 04 0d 00 a1 1c  20 20 20 20 45 51 55 53  |........    EQUS|
000013e0  20 20 20 20 22 4d 69 67  68 74 79 49 6e 66 6f 22  |    "MightyInfo"|
000013f0  0d 00 a2 11 20 20 20 20  45 51 55 42 20 20 20 20  |....    EQUB    |
00001400  30 0d 00 a3 0d 20 20 20  20 41 4c 49 47 4e 0d 00  |0....    ALIGN..|
00001410  a4 04 0d 00 a5 11 20 20  20 20 45 51 55 44 20 20  |......    EQUD  |
00001420  20 20 30 0d 00 a6 19 20  20 20 20 45 51 55 44 20  |  0....    EQUD |
00001430  20 20 20 26 32 30 30 30  30 30 30 30 0d 00 a7 11  |   &20000000....|
00001440  20 20 20 20 45 51 55 44  20 20 20 20 30 0d 00 a8  |    EQUD    0...|
00001450  18 20 20 20 20 45 51 55  44 20 20 20 20 48 65 6c  |.    EQUD    Hel|
00001460  70 43 6f 64 65 0d 00 a9  04 0d 00 aa 2f 20 20 20  |pCode......./   |
00001470  20 45 51 55 44 20 20 20  20 30 20 20 20 20 20 20  | EQUD    0      |
00001480  20 20 20 20 20 20 20 20  20 20 20 20 20 5c 54 65  |             \Te|
00001490  72 6d 69 6e 61 74 6f 72  0d 00 ab 04 0d 00 ac 0b  |rminator........|
000014a0  2e 64 65 63 6f 64 65 0d  00 ad 66 20 20 20 20 53  |.decode...f    S|
000014b0  54 4d 46 44 20 20 20 31  33 21 2c 7b 37 2d 31 31  |TMFD   13!,{7-11|
000014c0  2c 4c 4b 7d 20 20 20 20  20 20 20 5c 52 37 2d 52  |,LK}       \R7-R|
000014d0  31 31 20 6d 75 73 74 20  62 65 20 70 72 65 73 65  |11 must be prese|
000014e0  72 76 65 64 2e 20 52 30  3d 65 72 72 6f 72 20 70  |rved. R0=error p|
000014f0  6f 69 6e 74 65 72 20 69  66 20 61 6e 79 74 68 69  |ointer if anythi|
00001500  6e 67 20 67 6f 65 73 20  77 72 6f 6e 67 0d 00 ae  |ng goes wrong...|
00001510  04 0d 00 af 5f 20 20 20  20 43 4d 50 20 20 20 20  |...._    CMP    |
00001520  20 31 2c 23 30 20 20 20  20 20 20 20 20 20 20 20  | 1,#0           |
00001530  20 20 20 20 20 5c 49 66  20 63 6f 6d 6d 61 6e 64  |     \If command|
00001540  20 68 61 73 20 6e 6f 20  70 61 72 61 6d 65 74 65  | has no paramete|
00001550  72 73 2c 20 74 68 65 6e  20 73 68 6f 77 20 43 4d  |rs, then show CM|
00001560  4f 53 20 62 75 74 74 6f  6e 20 73 74 61 74 75 73  |OS button status|
00001570  0d 00 b0 1a 20 20 20 20  42 45 51 20 20 20 20 20  |....    BEQ     |
00001580  53 68 6f 77 53 74 61 74  75 73 0d 00 b1 04 0d 00  |ShowStatus......|
00001590  b2 4a 20 20 20 20 43 4d  50 20 20 20 20 20 31 2c  |.J    CMP     1,|
000015a0  23 31 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |#1              |
000015b0  20 20 5c 49 66 20 63 6f  6d 6d 61 6e 64 20 68 61  |  \If command ha|
000015c0  73 20 6d 6f 72 65 20 74  68 61 6e 20 31 20 70 61  |s more than 1 pa|
000015d0  72 61 6d 65 74 65 72 2c  0d 00 b3 49 20 20 20 20  |rameter,...I    |
000015e0  42 48 49 20 20 20 20 20  42 61 64 53 79 6e 74 61  |BHI     BadSynta|
000015f0  78 20 20 20 20 20 20 20  20 20 20 20 5c 74 68 65  |x           \the|
00001600  6e 20 74 65 72 6d 69 6e  61 74 65 20 77 69 74 68  |n terminate with|
00001610  20 61 6e 20 65 72 72 6f  72 20 6d 65 73 73 61 67  | an error messag|
00001620  65 0d 00 b4 04 0d 00 b5  56 20 20 20 20 4c 44 52  |e.......V    LDR|
00001630  42 20 20 20 20 31 2c 5b  30 2c 23 32 5d 20 20 20  |B    1,[0,#2]   |
00001640  20 20 20 20 20 20 20 20  20 5c 4e 6f 74 65 20 2d  |         \Note -|
00001650  20 4f 53 20 61 6c 77 61  79 73 20 74 65 72 6d 69  | OS always termi|
00001660  6e 61 74 65 73 20 70 61  72 61 6d 65 74 65 72 73  |nates parameters|
00001670  20 77 69 74 68 20 26 30  44 32 30 0d 00 b6 56 20  | with &0D20...V |
00001680  20 20 20 43 4d 50 20 20  20 20 20 31 2c 23 31 33  |   CMP     1,#13|
00001690  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 5c  |               \|
000016a0  49 66 20 52 31 3c 3e 31  33 20 74 68 65 6e 20 70  |If R1<>13 then p|
000016b0  61 72 61 6d 65 74 65 72  20 69 73 20 6e 6f 74 20  |arameter is not |
000016c0  31 20 63 68 61 72 61 63  74 65 72 20 6c 6f 6e 67  |1 character long|
000016d0  2c 0d 00 b7 4f 20 20 20  20 42 4e 45 20 20 20 20  |,...O    BNE    |
000016e0  20 42 61 64 53 79 6e 74  61 78 20 20 20 20 20 20  | BadSyntax      |
000016f0  20 20 20 20 20 5c 73 6f  20 74 65 72 6d 69 6e 61  |     \so termina|
00001700  74 65 20 63 6f 6d 6d 61  6e 64 20 77 69 74 68 20  |te command with |
00001710  61 6e 20 65 72 72 6f 72  20 6d 65 73 73 61 67 65  |an error message|
00001720  0d 00 b8 04 0d 00 b9 61  20 20 20 20 4c 44 52 42  |.......a    LDRB|
00001730  20 20 20 20 30 2c 5b 30  5d 20 20 20 20 20 20 20  |    0,[0]       |
00001740  20 20 20 20 20 20 20 20  5c 47 65 74 20 70 61 72  |        \Get par|
00001750  61 6d 65 74 65 72 2c 20  63 6f 6d 6d 61 6e 64 20  |ameter, command |
00001760  68 61 73 20 6f 6e 6c 79  20 31 20 63 68 61 72 61  |has only 1 chara|
00001770  63 74 65 72 2c 20 6c 65  74 74 65 72 20 6f 72 20  |cter, letter or |
00001780  64 69 67 69 74 0d 00 ba  04 0d 00 bb 50 20 20 20  |digit.......P   |
00001790  20 43 4d 50 20 20 20 20  20 30 2c 23 97 22 30 22  | CMP     0,#."0"|
000017a0  20 20 20 20 20 20 20 20  20 20 20 5c 49 66 20 70  |           \If p|
000017b0  61 72 61 6d 65 74 65 72  20 69 73 20 6e 6f 74 20  |arameter is not |
000017c0  6f 6e 65 20 6f 66 20 63  68 61 72 61 63 74 65 72  |one of character|
000017d0  73 20 30 2c 31 2c 32 2c  33 0d 00 bc 52 20 20 20  |s 0,1,2,3...R   |
000017e0  20 42 4c 54 20 20 20 20  20 42 61 64 53 79 6e 74  | BLT     BadSynt|
000017f0  61 78 20 20 20 20 20 20  20 20 20 20 20 5c 74 68  |ax           \th|
00001800  65 6e 20 74 65 72 6d 69  6e 61 74 65 20 63 6f 6d  |en terminate com|
00001810  6d 61 6e 64 20 77 69 74  68 20 61 6e 20 65 72 72  |mand with an err|
00001820  6f 72 20 6d 65 73 73 61  67 65 2c 0d 00 bd 52 20  |or message,...R |
00001830  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001840  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 5c  |               \|
00001850  6f 74 68 65 72 77 69 73  65 20 63 6f 6d 6d 61 6e  |otherwise comman|
00001860  64 20 69 73 20 76 61 6c  69 64 20 26 20 63 61 6e  |d is valid & can|
00001870  20 62 65 20 70 72 6f 63  65 73 73 65 64 0d 00 be  | be processed...|
00001880  17 20 20 20 20 43 4d 50  20 20 20 20 20 30 2c 23  |.    CMP     0,#|
00001890  97 22 33 22 0d 00 bf 19  20 20 20 20 42 48 49 20  |."3"....    BHI |
000018a0  20 20 20 20 42 61 64 53  79 6e 74 61 78 0d 00 c0  |    BadSyntax...|
000018b0  04 0d 00 c1 1b 5c f2 45  53 53 20 42 55 54 54 4f  |.....\.ESS BUTTO|
000018c0  4e 53 20 50 41 52 41 4d  45 54 45 52 0d 00 c2 04  |NS PARAMETER....|
000018d0  0d 00 c3 6e 20 20 20 20  53 55 42 20 20 20 20 20  |...n    SUB     |
000018e0  30 2c 30 2c 23 97 22 30  22 20 20 20 20 20 20 20  |0,0,#."0"       |
000018f0  20 20 5c 47 65 74 20 6e  75 6d 65 72 69 63 20 76  |  \Get numeric v|
00001900  61 6c 75 65 20 6f 66 20  61 73 63 69 69 20 63 6f  |alue of ascii co|
00001910  64 65 2e 20 4e 6f 74 65  20 6f 6e 6c 79 20 62 69  |de. Note only bi|
00001920  74 73 20 30 20 26 20 31  20 61 72 65 20 61 63 74  |ts 0 & 1 are act|
00001930  75 61 6c 6c 79 20 72 65  71 75 69 72 65 64 0d 00  |ually required..|
00001940  c4 4e 20 20 20 20 53 54  52 20 20 20 20 20 30 2c  |.N    STR     0,|
00001950  61 72 67 73 20 20 20 20  20 20 20 20 20 20 20 20  |args            |
00001960  20 20 5c 53 61 76 65 20  64 65 63 6f 64 65 64 20  |  \Save decoded |
00001970  61 72 67 75 6d 65 6e 74  20 70 61 72 61 6d 65 74  |argument paramet|
00001980  65 72 20 66 6f 72 20 6c  61 74 65 72 0d 00 c5 04  |er for later....|
00001990  0d 00 c6 3b 20 20 20 20  54 53 54 20 20 20 20 20  |...;    TST     |
000019a0  30 2c 23 25 31 30 20 20  20 20 20 20 20 20 20 20  |0,#%10          |
000019b0  20 20 20 20 5c 43 6f 6e  66 69 67 75 72 65 20 6e  |    \Configure n|
000019c0  65 77 20 73 65 74 74 69  6e 67 3f 0d 00 c7 45 20  |ew setting?...E |
000019d0  20 20 20 42 45 51 20 20  20 20 20 53 65 74 43 75  |   BEQ     SetCu|
000019e0  72 72 65 6e 74 20 20 20  20 20 20 20 20 20 20 5c  |rrent          \|
000019f0  4e 4f 20 2d 20 4a 75 6d  70 20 73 74 72 61 69 67  |NO - Jump straig|
00001a00  68 74 20 74 6f 20 53 65  74 43 75 72 72 65 6e 74  |ht to SetCurrent|
00001a10  0d 00 c8 04 0d 00 c9 31  20 20 20 20 54 53 54 20  |.......1    TST |
00001a20  20 20 20 20 30 2c 23 25  30 31 20 20 20 20 20 20  |    0,#%01      |
00001a30  20 20 20 20 20 20 20 20  5c 73 77 61 70 20 6f 72  |        \swap or|
00001a40  20 6e 6f 74 3f 0d 00 ca  24 20 20 20 20 ec 51 20  | not?...$    .Q |
00001a50  20 20 33 2c 23 30 20 20  20 20 20 20 20 20 20 20  |  3,#0          |
00001a60  20 20 20 20 20 20 5c 4e  4f 0d 00 cb 28 20 20 20  |      \NO...(   |
00001a70  20 4d 4f 56 4e 45 20 20  20 33 2c 23 43 4d 4f 53  | MOVNE   3,#CMOS|
00001a80  62 69 74 25 20 20 20 20  20 20 20 20 20 5c 59 45  |bit%         \YE|
00001a90  53 0d 00 cc 04 0d 00 cd  3d 20 20 20 20 4d 4f 56  |S.......=    MOV|
00001aa0  20 20 20 20 20 31 2c 23  43 4d 4f 53 6c 6f 63 25  |     1,#CMOSloc%|
00001ab0  20 20 20 20 20 20 20 20  20 5c 53 74 6f 72 65 20  |         \Store |
00001ac0  73 74 61 74 75 73 20 69  6e 20 43 4d 4f 53 20 52  |status in CMOS R|
00001ad0  41 4d 0d 00 ce 1b 20 20  20 20 4d 4f 56 20 20 20  |AM....    MOV   |
00001ae0  20 20 34 2c 23 43 4d 4f  53 62 69 74 25 0d 00 cf  |  4,#CMOSbit%...|
00001af0  1d 20 20 20 20 42 4c 20  20 20 20 20 20 52 65 61  |.    BL      Rea|
00001b00  64 57 72 69 74 65 43 6d  6f 73 0d 00 d0 04 0d 00  |dWriteCmos......|
00001b10  d1 0f 2e 53 65 74 43 75  72 72 65 6e 74 0d 00 d2  |...SetCurrent...|
00001b20  41 20 20 20 20 4c 44 52  20 20 20 20 20 31 2c 49  |A    LDR     1,I|
00001b30  6e 74 65 72 63 65 70 74  46 6c 61 67 20 20 20 20  |nterceptFlag    |
00001b40  20 5c 47 65 74 20 63 75  72 72 65 6e 74 20 69 6e  | \Get current in|
00001b50  74 65 72 63 65 70 74 20  73 74 61 74 75 73 0d 00  |tercept status..|
00001b60  d3 40 20 20 20 20 4c 44  52 20 20 20 20 20 30 2c  |.@    LDR     0,|
00001b70  61 72 67 73 20 20 20 20  20 20 20 20 20 20 20 20  |args            |
00001b80  20 20 5c 52 65 74 72 69  65 76 65 20 61 72 67 75  |  \Retrieve argu|
00001b90  6d 65 6e 74 20 70 61 72  61 6d 65 74 65 72 0d 00  |ment parameter..|
00001ba0  d4 16 20 20 20 20 54 53  54 20 20 20 20 20 30 2c  |..    TST     0,|
00001bb0  23 25 30 31 0d 00 d5 14  20 20 20 20 42 4e 45 20  |#%01....    BNE |
00001bc0  20 20 20 20 73 77 61 70  0d 00 d6 04 0d 00 d7 39  |    swap.......9|
00001bd0  5c 4e 4f 52 4d 41 4c 20  52 4f 55 54 49 4e 45 20  |\NORMAL ROUTINE |
00001be0  2d 20 52 45 4c 45 41 53  45 20 56 45 43 54 4f 52  |- RELEASE VECTOR|
00001bf0  20 e7 20 ac 20 41 4c 52  45 41 44 59 20 52 45 4c  | . . ALREADY REL|
00001c00  45 41 53 45 44 0d 00 d8  43 20 20 20 20 54 53 54  |EASED...C    TST|
00001c10  20 20 20 20 20 31 2c 23  31 20 20 20 20 20 20 20  |     1,#1       |
00001c20  20 20 20 20 20 20 20 20  20 5c 5a 3d 30 2c 20 63  |         \Z=0, c|
00001c30  6c 61 69 6d 65 64 20 20  5a 3d 31 2c 20 6e 6f 74  |laimed  Z=1, not|
00001c40  20 63 6c 61 69 6d 65 64  0d 00 d9 4d 20 20 20 20  | claimed...M    |
00001c50  42 4c 4e 45 20 20 20 20  72 65 6c 65 61 73 65 20  |BLNE    release |
00001c60  20 20 20 20 20 20 20 20  20 20 20 20 5c 51 75 69  |            \Qui|
00001c70  74 20 69 66 20 6e 6f 74  20 63 6c 61 69 6d 65 64  |t if not claimed|
00001c80  2c 20 65 6c 73 65 20 72  65 6c 65 61 73 65 20 76  |, else release v|
00001c90  65 63 74 6f 72 0d 00 da  1d 20 20 20 20 41 44 52  |ector....    ADR|
00001ca0  56 53 20 20 20 30 2c 43  61 6e 74 52 65 6c 65 61  |VS   0,CantRelea|
00001cb0  73 65 0d 00 db 1d 20 20  20 20 4c 44 4d 46 44 20  |se....    LDMFD |
00001cc0  20 20 31 33 21 2c 7b 37  2d 31 31 2c 50 43 7d 0d  |  13!,{7-11,PC}.|
00001cd0  00 dc 04 0d 00 dd 10 2e  43 61 6e 74 52 65 6c 65  |........CantRele|
00001ce0  61 73 65 0d 00 de 11 20  20 20 20 45 51 55 44 20  |ase....    EQUD |
00001cf0  20 20 20 30 0d 00 df 5a  20 20 20 20 45 51 55 53  |   0...Z    EQUS|
00001d00  20 20 20 20 22 43 61 6e  6e 6f 74 20 72 65 74 75  |    "Cannot retu|
00001d10  72 6e 20 6d 6f 75 73 65  20 62 75 74 74 6f 6e 73  |rn mouse buttons|
00001d20  20 74 6f 20 6e 6f 72 6d  61 6c 2c 20 74 72 79 20  | to normal, try |
00001d30  72 65 6c 6f 61 64 69 6e  67 20 4d 69 67 68 74 79  |reloading Mighty|
00001d40  4d 6f 75 73 65 20 6d 6f  64 75 6c 65 2e 22 0d 00  |Mouse module."..|
00001d50  e0 15 20 20 20 20 45 51  55 57 20 20 20 20 26 30  |..    EQUW    &0|
00001d60  41 30 44 0d 00 e1 11 20  20 20 20 45 51 55 42 20  |A0D....    EQUB |
00001d70  20 20 20 30 0d 00 e2 0d  20 20 20 20 41 4c 49 47  |   0....    ALIG|
00001d80  4e 0d 00 e3 04 0d 00 e4  32 5c c8 94 20 52 4f 55  |N.......2\.. ROU|
00001d90  54 49 4e 45 20 2d 20 43  4c 41 49 4d 20 56 45 43  |TINE - CLAIM VEC|
00001da0  54 4f 52 20 e7 20 ac 20  41 4c 52 45 41 44 59 20  |TOR . . ALREADY |
00001db0  43 4c 41 49 4d 45 44 0d  00 e5 09 2e 73 77 61 70  |CLAIMED.....swap|
00001dc0  0d 00 e6 43 20 20 20 20  54 53 54 20 20 20 20 20  |...C    TST     |
00001dd0  31 2c 23 31 20 20 20 20  20 20 20 20 20 20 20 20  |1,#1            |
00001de0  20 20 20 20 5c 5a 3d 30  2c 20 63 6c 61 69 6d 65  |    \Z=0, claime|
00001df0  64 20 20 5a 3d 31 2c 20  6e 6f 74 20 63 6c 61 69  |d  Z=1, not clai|
00001e00  6d 65 64 0d 00 e7 49 20  20 20 20 42 4c 45 51 20  |med...I    BLEQ |
00001e10  20 20 20 63 6c 61 69 6d  20 20 20 20 20 20 20 20  |   claim        |
00001e20  20 20 20 20 20 20 20 5c  51 75 69 74 20 69 66 20  |       \Quit if |
00001e30  63 6c 61 69 6d 65 64 2c  20 65 6c 73 65 20 72 65  |claimed, else re|
00001e40  6c 65 61 73 65 20 76 65  63 74 6f 72 0d 00 e8 1b  |lease vector....|
00001e50  20 20 20 20 41 44 52 56  53 20 20 20 30 2c 43 61  |    ADRVS   0,Ca|
00001e60  6e 74 43 6c 61 69 6d 0d  00 e9 1d 20 20 20 20 4c  |ntClaim....    L|
00001e70  44 4d 46 44 20 20 20 31  33 21 2c 7b 37 2d 31 31  |DMFD   13!,{7-11|
00001e80  2c 50 43 7d 0d 00 ea 04  0d 00 eb 0e 2e 43 61 6e  |,PC}.........Can|
00001e90  74 43 6c 61 69 6d 0d 00  ec 11 20 20 20 20 45 51  |tClaim....    EQ|
00001ea0  55 44 20 20 20 20 30 0d  00 ed 4e 20 20 20 20 45  |UD    0...N    E|
00001eb0  51 55 53 20 20 20 20 22  43 61 6e 6e 6f 74 20 73  |QUS    "Cannot s|
00001ec0  77 61 70 20 6d 6f 75 73  65 20 62 75 74 74 6f 6e  |wap mouse button|
00001ed0  73 2c 20 74 72 79 20 72  65 6c 6f 61 64 69 6e 67  |s, try reloading|
00001ee0  20 4d 69 67 68 74 79 4d  6f 75 73 65 20 6d 6f 64  | MightyMouse mod|
00001ef0  75 6c 65 2e 22 0d 00 ee  11 20 20 20 20 45 51 55  |ule."....    EQU|
00001f00  42 20 20 20 20 30 0d 00  ef 0d 20 20 20 20 41 4c  |B    0....    AL|
00001f10  49 47 4e 0d 00 f0 04 0d  00 f1 0f 2e 53 68 6f 77  |IGN.........Show|
00001f20  53 74 61 74 75 73 0d 00  f2 1f 20 20 20 20 4c 44  |Status....    LD|
00001f30  52 20 20 20 20 20 37 2c  49 6e 74 65 72 63 65 70  |R     7,Intercep|
00001f40  74 46 6c 61 67 0d 00 f3  43 20 20 20 20 54 53 54  |tFlag...C    TST|
00001f50  20 20 20 20 20 37 2c 23  31 20 20 20 20 20 20 20  |     7,#1       |
00001f60  20 20 20 20 20 20 20 20  20 5c 5a 3d 30 2c 20 63  |         \Z=0, c|
00001f70  6c 61 69 6d 65 64 20 20  5a 3d 31 2c 20 6e 6f 74  |laimed  Z=1, not|
00001f80  20 63 6c 61 69 6d 65 64  0d 00 f4 19 20 20 20 20  | claimed....    |
00001f90  42 4e 45 20 20 20 20 20  63 75 72 72 65 6e 74 6c  |BNE     currentl|
00001fa0  79 0d 00 f5 04 0d 00 f6  1c 20 20 20 20 53 57 49  |y........    SWI|
00001fb0  20 20 20 20 20 22 58 4f  53 5f 57 72 69 74 65 53  |     "XOS_WriteS|
00001fc0  22 0d 00 f7 29 20 20 20  20 45 51 55 53 20 20 20  |"...)    EQUS   |
00001fd0  20 22 4d 6f 75 73 65 20  62 75 74 74 6f 6e 73 20  | "Mouse buttons |
00001fe0  6e 6f 72 6d 61 6c 20 26  20 22 0d 00 f8 11 20 20  |normal & "....  |
00001ff0  20 20 45 51 55 42 20 20  20 20 30 0d 00 f9 0d 20  |  EQUB    0.... |
00002000  20 20 20 41 4c 49 47 4e  0d 00 fa 04 0d 00 fb 14  |   ALIGN........|
00002010  20 20 20 20 42 20 20 20  20 20 20 20 63 6d 6f 73  |    B       cmos|
00002020  0d 00 fc 04 0d 00 fd 0e  2e 63 75 72 72 65 6e 74  |.........current|
00002030  6c 79 0d 00 fe 1c 20 20  20 20 53 57 49 20 20 20  |ly....    SWI   |
00002040  20 20 22 58 4f 53 5f 57  72 69 74 65 53 22 0d 00  |  "XOS_WriteS"..|
00002050  ff 2a 20 20 20 20 45 51  55 53 20 20 20 20 22 4d  |.*    EQUS    "M|
00002060  6f 75 73 65 20 62 75 74  74 6f 6e 73 20 73 77 61  |ouse buttons swa|
00002070  70 70 65 64 20 26 20 22  0d 01 00 11 20 20 20 20  |pped & "....    |
00002080  45 51 55 42 20 20 20 20  30 0d 01 01 0d 20 20 20  |EQUB    0....   |
00002090  20 41 4c 49 47 4e 0d 01  02 04 0d 01 03 09 2e 63  | ALIGN.........c|
000020a0  6d 6f 73 0d 01 04 1b 20  20 20 20 4d 4f 56 20 20  |mos....    MOV  |
000020b0  20 20 20 31 2c 23 43 4d  4f 53 6c 6f 63 25 0d 01  |   1,#CMOSloc%..|
000020c0  05 3f 20 20 20 20 4d 4f  56 20 20 20 20 20 34 2c  |.?    MOV     4,|
000020d0  23 30 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |#0              |
000020e0  20 20 5c 4d 61 73 6b 3d  30 20 74 6f 20 72 65 61  |  \Mask=0 to rea|
000020f0  64 20 43 4d 4f 53 20 73  74 61 74 75 73 0d 01 06  |d CMOS status...|
00002100  1d 20 20 20 20 42 4c 20  20 20 20 20 20 52 65 61  |.    BL      Rea|
00002110  64 57 72 69 74 65 43 6d  6f 73 0d 01 07 04 0d 01  |dWriteCmos......|
00002120  08 1b 20 20 20 20 54 53  54 20 20 20 20 20 32 2c  |..    TST     2,|
00002130  23 43 4d 4f 53 62 69 74  25 0d 01 09 17 20 20 20  |#CMOSbit%....   |
00002140  20 42 4e 45 20 20 20 20  20 73 77 61 70 70 65 64  | BNE     swapped|
00002150  0d 01 0a 04 0d 01 0b 1c  20 20 20 20 53 57 49 20  |........    SWI |
00002160  20 20 20 20 22 58 4f 53  5f 57 72 69 74 65 53 22  |    "XOS_WriteS"|
00002170  0d 01 0c 24 20 20 20 20  45 51 55 53 20 20 20 20  |...$    EQUS    |
00002180  22 63 6f 6e 66 69 67 75  72 65 64 20 6e 6f 72 6d  |"configured norm|
00002190  61 6c 2e 22 0d 01 0d 15  20 20 20 20 45 51 55 57  |al."....    EQUW|
000021a0  20 20 20 20 26 30 41 30  44 0d 01 0e 11 20 20 20  |    &0A0D....   |
000021b0  20 45 51 55 42 20 20 20  20 30 0d 01 0f 0d 20 20  | EQUB    0....  |
000021c0  20 20 41 4c 49 47 4e 0d  01 10 04 0d 01 11 1e 20  |  ALIGN........ |
000021d0  20 20 20 4c 44 4d 46 44  20 20 20 31 33 21 2c 7b  |   LDMFD   13!,{|
000021e0  37 2d 31 31 2c 50 43 7d  5e 0d 01 12 04 0d 01 13  |7-11,PC}^.......|
000021f0  0c 2e 73 77 61 70 70 65  64 0d 01 14 1c 20 20 20  |..swapped....   |
00002200  20 53 57 49 20 20 20 20  20 22 58 4f 53 5f 57 72  | SWI     "XOS_Wr|
00002210  69 74 65 53 22 0d 01 15  25 20 20 20 20 45 51 55  |iteS"...%    EQU|
00002220  53 20 20 20 20 22 63 6f  6e 66 69 67 75 72 65 64  |S    "configured|
00002230  20 73 77 61 70 70 65 64  2e 22 0d 01 16 15 20 20  | swapped."....  |
00002240  20 20 45 51 55 57 20 20  20 20 26 30 41 30 44 0d  |  EQUW    &0A0D.|
00002250  01 17 11 20 20 20 20 45  51 55 42 20 20 20 20 30  |...    EQUB    0|
00002260  0d 01 18 0d 20 20 20 20  41 4c 49 47 4e 0d 01 19  |....    ALIGN...|
00002270  04 0d 01 1a 1e 20 20 20  20 4c 44 4d 46 44 20 20  |.....    LDMFD  |
00002280  20 31 33 21 2c 7b 37 2d  31 31 2c 50 43 7d 5e 0d  | 13!,{7-11,PC}^.|
00002290  01 1b 04 0d 01 1c 0e 2e  42 61 64 53 79 6e 74 61  |........BadSynta|
000022a0  78 0d 01 1d 1d 20 20 20  20 41 44 52 20 20 20 20  |x....    ADR    |
000022b0  20 30 2c 53 79 6e 74 61  78 45 72 72 6f 72 0d 01  | 0,SyntaxError..|
000022c0  1e 47 20 20 20 20 54 45  51 50 20 20 20 20 50 43  |.G    TEQP    PC|
000022d0  2c 23 26 31 30 30 30 30  30 30 33 20 20 20 20 20  |,#&10000003     |
000022e0  20 20 5c 53 65 74 20 56  2c 20 72 65 6d 65 6d 62  |  \Set V, rememb|
000022f0  65 72 69 6e 67 20 70 72  6f 63 65 73 73 6f 72 20  |ering processor |
00002300  73 74 61 74 65 0d 01 1f  1d 20 20 20 20 4c 44 4d  |state....    LDM|
00002310  46 44 20 20 20 31 33 21  2c 7b 37 2d 31 31 2c 50  |FD   13!,{7-11,P|
00002320  43 7d 0d 01 20 04 0d 01  21 10 2e 53 79 6e 74 61  |C}.. ...!..Synta|
00002330  78 45 72 72 6f 72 0d 01  22 11 20 20 20 20 45 51  |xError..".    EQ|
00002340  55 44 20 20 20 20 30 0d  01 23 12 2e 53 79 6e 74  |UD    0..#..Synt|
00002350  61 78 4d 65 73 73 61 67  65 0d 01 24 2b 20 20 20  |axMessage..$+   |
00002360  20 45 51 55 53 20 20 20  20 22 53 79 6e 74 61 78  | EQUS    "Syntax|
00002370  3a 20 42 75 74 74 6f 6e  73 20 5b 30 7c 31 7c 32  |: Buttons [0|1|2|
00002380  7c 33 5d 22 0d 01 25 11  20 20 20 20 45 51 55 42  ||3]"..%.    EQUB|
00002390  20 20 20 20 30 0d 01 26  0d 20 20 20 20 41 4c 49  |    0..&.    ALI|
000023a0  47 4e 0d 01 27 04 0d 01  28 10 2e 43 6f 6d 6d 61  |GN..'...(..Comma|
000023b0  6e 64 48 65 6c 70 0d 01  29 5b 20 20 20 20 45 51  |ndHelp..)[    EQ|
000023c0  55 53 20 20 20 20 22 2a  42 75 74 74 6f 6e 73 20  |US    "*Buttons |
000023d0  63 6f 6e 66 69 67 75 72  65 73 20 74 68 65 20 6d  |configures the m|
000023e0  6f 75 73 65 20 62 75 74  74 6f 6e 73 20 66 6f 72  |ouse buttons for|
000023f0  20 72 69 67 68 74 20 6f  72 20 6c 65 66 74 2d 68  | right or left-h|
00002400  61 6e 64 65 64 20 6f 70  65 72 61 74 69 6f 6e 2e  |anded operation.|
00002410  22 0d 01 2a 15 20 20 20  20 45 51 55 57 20 20 20  |"..*.    EQUW   |
00002420  20 26 30 41 30 44 0d 01  2b 74 20 20 20 20 45 51  | &0A0D..+t    EQ|
00002430  55 53 20 20 20 20 22 2a  42 75 74 74 6f 6e 73 20  |US    "*Buttons |
00002440  77 69 74 68 20 6e 6f 20  70 61 72 61 6d 65 74 65  |with no paramete|
00002450  72 73 20 64 69 73 70 6c  61 79 73 20 74 68 65 20  |rs displays the |
00002460  63 75 72 72 65 6e 74 20  26 20 63 6f 6e 66 69 67  |current & config|
00002470  75 72 65 64 20 6e 6f 72  6d 61 6c 2f 73 77 61 70  |ured normal/swap|
00002480  70 65 64 20 6d 6f 75 73  65 20 62 75 74 74 6f 6e  |ped mouse button|
00002490  73 20 73 74 61 74 75 73  2e 22 0d 01 2c 15 20 20  |s status."..,.  |
000024a0  20 20 45 51 55 57 20 20  20 20 26 30 41 30 44 0d  |  EQUW    &0A0D.|
000024b0  01 2d 15 20 20 20 20 45  51 55 57 20 20 20 20 26  |.-.    EQUW    &|
000024c0  30 41 30 44 0d 01 2e 2b  20 20 20 20 45 51 55 53  |0A0D...+    EQUS|
000024d0  20 20 20 20 22 53 79 6e  74 61 78 3a 20 42 75 74  |    "Syntax: But|
000024e0  74 6f 6e 73 20 5b 30 7c  31 7c 32 7c 33 5d 22 0d  |tons [0|1|2|3]".|
000024f0  01 2f 15 20 20 20 20 45  51 55 57 20 20 20 20 26  |./.    EQUW    &|
00002500  30 41 30 44 0d 01 30 2c  20 20 20 20 45 51 55 53  |0A0D..0,    EQUS|
00002510  20 20 20 20 22 a0 a0 a0  a0 a0 a0 a0 a0 30 20 3d  |    "........0 =|
00002520  20 42 75 74 74 6f 6e 73  20 6e 6f 72 6d 61 6c 22  | Buttons normal"|
00002530  0d 01 31 15 20 20 20 20  45 51 55 57 20 20 20 20  |..1.    EQUW    |
00002540  26 30 41 30 44 0d 01 32  2d 20 20 20 20 45 51 55  |&0A0D..2-    EQU|
00002550  53 20 20 20 20 22 a0 a0  a0 a0 a0 a0 a0 a0 31 20  |S    "........1 |
00002560  3d 20 42 75 74 74 6f 6e  73 20 73 77 61 70 70 65  |= Buttons swappe|
00002570  64 22 0d 01 33 15 20 20  20 20 45 51 55 57 20 20  |d"..3.    EQUW  |
00002580  20 20 26 30 41 30 44 0d  01 34 4a 20 20 20 20 45  |  &0A0D..4J    E|
00002590  51 55 53 20 20 20 20 22  a0 a0 a0 a0 a0 a0 a0 a0  |QUS    "........|
000025a0  32 20 3d 20 42 75 74 74  6f 6e 73 20 6e 6f 72 6d  |2 = Buttons norm|
000025b0  61 6c a0 a0 26 20 73 65  74 74 69 6e 67 20 73 74  |al..& setting st|
000025c0  6f 72 65 64 20 69 6e 20  43 4d 4f 53 20 52 41 4d  |ored in CMOS RAM|
000025d0  22 0d 01 35 15 20 20 20  20 45 51 55 57 20 20 20  |"..5.    EQUW   |
000025e0  20 26 30 41 30 44 0d 01  36 4a 20 20 20 20 45 51  | &0A0D..6J    EQ|
000025f0  55 53 20 20 20 20 22 a0  a0 a0 a0 a0 a0 a0 a0 33  |US    "........3|
00002600  20 3d 20 42 75 74 74 6f  6e 73 20 73 77 61 70 70  | = Buttons swapp|
00002610  65 64 20 26 20 73 65 74  74 69 6e 67 20 73 74 6f  |ed & setting sto|
00002620  72 65 64 20 69 6e 20 43  4d 4f 53 20 52 41 4d 22  |red in CMOS RAM"|
00002630  0d 01 37 11 20 20 20 20  45 51 55 42 20 20 20 20  |..7.    EQUB    |
00002640  30 0d 01 38 0d 20 20 20  20 41 4c 49 47 4e 0d 01  |0..8.    ALIGN..|
00002650  39 04 0d 01 3a 11 2e 44  65 63 6f 64 65 53 74 61  |9...:..DecodeSta|
00002660  74 75 73 0d 01 3b 66 20  20 20 20 53 54 4d 46 44  |tus..;f    STMFD|
00002670  20 20 20 31 33 21 2c 7b  37 2d 31 31 2c 4c 4b 7d  |   13!,{7-11,LK}|
00002680  20 20 20 20 20 20 20 5c  52 37 2d 52 31 31 20 6d  |       \R7-R11 m|
00002690  75 73 74 20 62 65 20 70  72 65 73 65 72 76 65 64  |ust be preserved|
000026a0  2e 20 52 30 3d 65 72 72  6f 72 20 70 6f 69 6e 74  |. R0=error point|
000026b0  65 72 20 69 66 20 61 6e  79 74 68 69 6e 67 20 67  |er if anything g|
000026c0  6f 65 73 20 77 72 6f 6e  67 0d 01 3c 04 0d 01 3d  |oes wrong..<...=|
000026d0  4b 20 20 20 20 43 4d 50  20 20 20 20 20 30 2c 23  |K    CMP     0,#|
000026e0  30 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |0               |
000026f0  20 5c 48 61 73 20 2a 43  6f 6e 66 69 67 75 72 65  | \Has *Configure|
00002700  20 62 79 20 69 74 73 65  6c 66 20 62 65 65 6e 20  | by itself been |
00002710  65 6e 74 65 72 65 64 3f  0d 01 3e 4f 20 20 20 20  |entered?..>O    |
00002720  41 44 52 45 51 20 20 20  30 2c 63 6f 6e 66 69 67  |ADREQ   0,config|
00002730  20 20 20 20 20 20 20 20  20 20 20 20 5c 59 45 53  |            \YES|
00002740  20 2d 20 64 69 73 70 6c  61 79 20 63 6f 6e 66 69  | - display confi|
00002750  67 75 72 61 74 69 6f 6e  20 6d 65 73 73 61 67 65  |guration message|
00002760  20 26 20 71 75 69 74 0d  01 3f 4f 20 20 20 20 53  | & quit..?O    S|
00002770  57 49 45 51 20 20 20 22  58 4f 53 5f 57 72 69 74  |WIEQ   "XOS_Writ|
00002780  65 30 22 20 20 20 20 20  20 20 20 5c 4e 4f 20 20  |e0"        \NO  |
00002790  2d 20 63 68 65 63 6b 20  52 30 20 69 73 20 6e 6f  |- check R0 is no|
000027a0  74 20 63 6f 6d 6d 61 6e  64 20 74 61 69 6c 20 70  |t command tail p|
000027b0  6f 69 6e 74 65 72 0d 01  40 1e 20 20 20 20 4c 44  |ointer..@.    LD|
000027c0  4d 45 51 46 44 20 31 33  21 2c 7b 37 2d 31 31 2c  |MEQFD 13!,{7-11,|
000027d0  50 43 7d 5e 0d 01 41 04  0d 01 42 4b 20 20 20 20  |PC}^..A...BK    |
000027e0  43 4d 50 20 20 20 20 20  30 2c 23 31 20 20 20 20  |CMP     0,#1    |
000027f0  20 20 20 20 20 20 20 20  20 20 20 20 5c 48 61 73  |            \Has|
00002800  20 2a 43 6f 6e 66 69 67  75 72 65 20 42 75 74 74  | *Configure Butt|
00002810  6f 6e 73 20 62 65 65 6e  20 61 74 74 65 6d 70 74  |ons been attempt|
00002820  65 64 3f 0d 01 43 47 20  20 20 20 41 44 52 48 49  |ed?..CG    ADRHI|
00002830  20 20 20 30 2c 42 61 64  43 6f 6e 66 69 67 20 20  |   0,BadConfig  |
00002840  20 20 20 20 20 20 20 5c  59 45 53 20 2d 20 64 69  |       \YES - di|
00002850  73 70 6c 61 79 20 65 72  72 6f 72 20 6d 65 73 73  |splay error mess|
00002860  61 67 65 20 26 20 71 75  69 74 0d 01 44 49 20 20  |age & quit..DI  |
00002870  20 20 54 45 51 48 49 50  20 20 50 43 2c 23 26 33  |  TEQHIP  PC,#&3|
00002880  30 30 30 30 30 30 33 20  20 20 20 20 20 20 5c 53  |0000003       \S|
00002890  65 74 20 43 26 56 2c 20  72 65 6d 65 6d 62 65 72  |et C&V, remember|
000028a0  69 6e 67 20 70 72 6f 63  65 73 73 6f 72 20 73 74  |ing processor st|
000028b0  61 74 65 0d 01 45 1d 20  20 20 20 4c 44 4d 48 49  |ate..E.    LDMHI|
000028c0  46 44 20 31 33 21 2c 7b  37 2d 31 31 2c 50 43 7d  |FD 13!,{7-11,PC}|
000028d0  0d 01 46 04 0d 01 47 41  20 20 20 20 4d 4f 56 20  |..F...GA    MOV |
000028e0  20 20 20 20 30 2c 23 31  36 31 20 20 20 20 20 20  |    0,#161      |
000028f0  20 20 20 20 20 20 20 20  5c 47 65 74 20 43 4d 4f  |        \Get CMO|
00002900  53 20 52 41 4d 20 62 75  74 74 6f 6e 73 20 73 65  |S RAM buttons se|
00002910  74 74 69 6e 67 0d 01 48  1b 20 20 20 20 4d 4f 56  |tting..H.    MOV|
00002920  20 20 20 20 20 31 2c 23  43 4d 4f 53 6c 6f 63 25  |     1,#CMOSloc%|
00002930  0d 01 49 1a 20 20 20 20  53 57 49 20 20 20 20 20  |..I.    SWI     |
00002940  22 58 4f 53 5f 42 79 74  65 22 0d 01 4a 04 0d 01  |"XOS_Byte"..J...|
00002950  4b 50 20 20 20 20 54 53  54 20 20 20 20 20 32 2c  |KP    TST     2,|
00002960  23 43 4d 4f 53 62 69 74  25 20 20 20 20 20 20 20  |#CMOSbit%       |
00002970  20 20 5c 52 65 66 6c 65  63 74 20 62 75 74 74 6f  |  \Reflect butto|
00002980  6e 73 20 73 65 74 74 69  6e 67 20 77 69 74 68 20  |ns setting with |
00002990  73 63 72 65 65 6e 20 6d  65 73 73 61 67 65 0d 01  |screen message..|
000029a0  4c 1b 20 20 20 20 41 44  52 45 51 20 20 20 30 2c  |L.    ADREQ   0,|
000029b0  4e 6f 72 6d 61 6c 4d 53  47 0d 01 4d 1c 20 20 20  |NormalMSG..M.   |
000029c0  20 41 44 52 4e 45 20 20  20 30 2c 53 77 61 70 70  | ADRNE   0,Swapp|
000029d0  65 64 4d 53 47 0d 01 4e  1c 20 20 20 20 53 57 49  |edMSG..N.    SWI|
000029e0  20 20 20 20 20 22 58 4f  53 5f 57 72 69 74 65 30  |     "XOS_Write0|
000029f0  22 0d 01 4f 04 0d 01 50  1e 20 20 20 20 4c 44 4d  |"..O...P.    LDM|
00002a00  46 44 20 20 20 31 33 21  2c 7b 37 2d 31 31 2c 50  |FD   13!,{7-11,P|
00002a10  43 7d 5e 0d 01 51 04 0d  01 52 0b 2e 63 6f 6e 66  |C}^..Q...R..conf|
00002a20  69 67 0d 01 53 22 20 20  20 20 45 51 55 53 20 20  |ig..S"    EQUS  |
00002a30  20 20 22 2a 42 75 74 74  6f 6e 73 20 20 20 3c 32  |  "*Buttons   <2|
00002a40  7c 33 3e 22 0d 01 54 15  20 20 20 20 45 51 55 57  ||3>"..T.    EQUW|
00002a50  20 20 20 20 26 30 41 30  44 0d 01 55 11 20 20 20  |    &0A0D..U.   |
00002a60  20 45 51 55 42 20 20 20  20 30 0d 01 56 0d 20 20  | EQUB    0..V.  |
00002a70  20 20 41 4c 49 47 4e 0d  01 57 04 0d 01 58 0e 2e  |  ALIGN..W...X..|
00002a80  42 61 64 43 6f 6e 66 69  67 0d 01 59 11 20 20 20  |BadConfig..Y.   |
00002a90  20 45 51 55 44 20 20 20  20 30 0d 01 5a 43 20 20  | EQUD    0..ZC  |
00002aa0  20 20 45 51 55 53 20 20  20 20 22 55 73 65 20 2a  |  EQUS    "Use *|
00002ab0  42 75 74 74 6f 6e 73 20  3c 32 7c 33 3e 20 74 6f  |Buttons <2|3> to|
00002ac0  20 73 65 74 20 74 68 65  20 43 4d 4f 53 20 63 6f  | set the CMOS co|
00002ad0  6e 66 69 67 75 72 61 74  69 6f 6e 2e 22 0d 01 5b  |nfiguration."..[|
00002ae0  11 20 20 20 20 45 51 55  42 20 20 20 20 30 0d 01  |.    EQUB    0..|
00002af0  5c 0d 20 20 20 20 41 4c  49 47 4e 0d 01 5d 04 0d  |\.    ALIGN..]..|
00002b00  01 5e 0e 2e 4e 6f 72 6d  61 6c 4d 53 47 0d 01 5f  |.^..NormalMSG.._|
00002b10  27 20 20 20 20 45 51 55  53 20 20 20 20 22 4d 6f  |'    EQUS    "Mo|
00002b20  75 73 65 20 62 75 74 74  6f 6e 73 20 6e 6f 72 6d  |use buttons norm|
00002b30  61 6c 2e 22 0d 01 60 15  20 20 20 20 45 51 55 57  |al."..`.    EQUW|
00002b40  20 20 20 20 26 30 41 30  44 0d 01 61 11 20 20 20  |    &0A0D..a.   |
00002b50  20 45 51 55 42 20 20 20  20 30 0d 01 62 0d 20 20  | EQUB    0..b.  |
00002b60  20 20 41 4c 49 47 4e 0d  01 63 04 0d 01 64 0f 2e  |  ALIGN..c...d..|
00002b70  53 77 61 70 70 65 64 4d  53 47 0d 01 65 28 20 20  |SwappedMSG..e(  |
00002b80  20 20 45 51 55 53 20 20  20 20 22 4d 6f 75 73 65  |  EQUS    "Mouse|
00002b90  20 62 75 74 74 6f 6e 73  20 73 77 61 70 70 65 64  | buttons swapped|
00002ba0  2e 22 0d 01 66 15 20 20  20 20 45 51 55 57 20 20  |."..f.    EQUW  |
00002bb0  20 20 26 30 41 30 44 0d  01 67 11 20 20 20 20 45  |  &0A0D..g.    E|
00002bc0  51 55 42 20 20 20 20 30  0d 01 68 0d 20 20 20 20  |QUB    0..h.    |
00002bd0  41 4c 49 47 4e 0d 01 69  04 0d 01 6a 0d 2e 48 65  |ALIGN..i...j..He|
00002be0  6c 70 43 6f 64 65 0d 01  6b 16 20 20 20 20 41 44  |lpCode..k.    AD|
00002bf0  52 20 20 20 20 20 30 2c  69 6e 66 6f 0d 01 6c 15  |R     0,info..l.|
00002c00  20 20 20 20 4d 4f 56 53  20 20 20 20 50 43 2c 4c  |    MOVS    PC,L|
00002c10  4b 0d 01 6d 04 0d 01 6e  09 2e 69 6e 66 6f 0d 01  |K..m...n..info..|
00002c20  6f 63 20 20 20 20 45 51  55 53 20 20 20 20 22 4d  |oc    EQUS    "M|
00002c30  6f 64 75 6c 65 20 4d 69  67 68 74 79 4d 6f 75 73  |odule MightyMous|
00002c40  65 20 73 77 61 70 73 20  74 68 65 20 53 65 6c 65  |e swaps the Sele|
00002c50  63 74 20 26 20 41 64 6a  75 73 74 20 6d 6f 75 73  |ct & Adjust mous|
00002c60  65 20 62 75 74 74 6f 6e  73 20 66 6f 72 20 6c 65  |e buttons for le|
00002c70  66 74 2d 68 61 6e 64 65  64 20 75 73 65 72 73 2e  |ft-handed users.|
00002c80  22 0d 01 70 15 20 20 20  20 45 51 55 57 20 20 20  |"..p.    EQUW   |
00002c90  20 26 30 41 30 44 0d 01  71 29 20 20 20 20 45 51  | &0A0D..q)    EQ|
00002ca0  55 53 20 20 20 20 22 53  57 49 20 62 61 73 65 a0  |US    "SWI base.|
00002cb0  a0 3d 20 26 22 2b c3 7e  53 77 69 42 61 73 65 0d  |.= &"+.~SwiBase.|
00002cc0  01 72 15 20 20 20 20 45  51 55 57 20 20 20 20 26  |.r.    EQUW    &|
00002cd0  30 41 30 44 0d 01 73 30  20 20 20 20 45 51 55 53  |0A0D..s0    EQUS|
00002ce0  20 20 20 20 22 53 57 49  20 63 68 75 6e 6b 20 3d  |    "SWI chunk =|
00002cf0  20 22 2b c3 20 28 53 77  69 43 68 75 6e 6b 25 3e  | "+. (SwiChunk%>|
00002d00  3e 3e 36 29 0d 01 74 15  20 20 20 20 45 51 55 57  |>>6)..t.    EQUW|
00002d10  20 20 20 20 26 30 41 30  44 0d 01 75 5b 20 20 20  |    &0A0D..u[   |
00002d20  20 45 51 55 53 20 20 20  20 22 43 6f 6e 66 69 67  | EQUS    "Config|
00002d30  75 72 61 74 69 6f 6e 20  73 74 6f 72 65 64 20 61  |uration stored a|
00002d40  74 20 43 4d 4f 53 20 52  41 4d 20 6c 6f 63 61 74  |t CMOS RAM locat|
00002d50  69 6f 6e 20 22 2b c3 20  43 4d 4f 53 6c 6f 63 25  |ion "+. CMOSloc%|
00002d60  2b 22 2c 20 62 69 74 20  22 2b c3 28 62 69 74 29  |+", bit "+.(bit)|
00002d70  2b 22 2e 22 0d 01 76 15  20 20 20 20 45 51 55 57  |+"."..v.    EQUW|
00002d80  20 20 20 20 26 30 41 30  44 0d 01 77 38 20 20 20  |    &0A0D..w8   |
00002d90  20 45 51 55 53 20 20 20  20 22 2a 2a 2a 20 54 48  | EQUS    "*** TH|
00002da0  49 53 20 53 4f 46 54 57  41 52 45 20 49 53 20 50  |IS SOFTWARE IS P|
00002db0  55 42 4c 49 43 20 44 4f  4d 41 49 4e 20 2a 2a 2a  |UBLIC DOMAIN ***|
00002dc0  22 0d 01 78 19 20 20 20  20 45 51 55 44 20 20 20  |"..x.    EQUD   |
00002dd0  20 26 30 41 30 44 30 41  30 44 0d 01 79 42 20 20  | &0A0D0A0D..yB  |
00002de0  20 20 45 51 55 53 20 20  20 20 22 76 22 2b 76 65  |  EQUS    "v"+ve|
00002df0  72 73 69 6f 6e 24 2b 22  20 a9 20 4d 69 63 68 61  |rsion$+" . Micha|
00002e00  65 6c 20 53 74 69 72 6c  69 6e 67 20 28 22 2b c1  |el Stirling ("+.|
00002e10  91 24 2c 35 2c 31 31 29  2b 22 29 22 0d 01 7a 15  |.$,5,11)+")"..z.|
00002e20  20 20 20 20 45 51 55 57  20 20 20 20 26 30 41 30  |    EQUW    &0A0|
00002e30  44 0d 01 7b 11 20 20 20  20 45 51 55 42 20 20 20  |D..{.    EQUB   |
00002e40  20 30 0d 01 7c 0d 20 20  20 20 41 4c 49 47 4e 0d  | 0..|.    ALIGN.|
00002e50  01 7d 04 0d 01 7e 0f 2e  53 77 69 48 61 6e 64 6c  |.}...~..SwiHandl|
00002e60  65 72 0d 01 7f 3a 20 20  20 20 4c 44 52 20 20 20  |er...:    LDR   |
00002e70  20 20 31 32 2c 5b 31 32  5d 20 20 20 20 20 20 20  |  12,[12]       |
00002e80  20 20 20 20 20 20 5c 47  65 74 20 77 6f 72 6b 73  |      \Get works|
00002e90  70 61 63 65 20 70 6f 69  6e 74 65 72 0d 01 80 04  |pace pointer....|
00002ea0  0d 01 81 2c 20 20 20 20  43 4d 50 20 20 20 20 20  |...,    CMP     |
00002eb0  31 31 2c 23 28 45 6e 64  53 77 69 54 61 62 6c 65  |11,#(EndSwiTable|
00002ec0  2d 53 77 69 54 61 62 6c  65 29 2f 34 0d 01 82 39  |-SwiTable)/4...9|
00002ed0  20 20 20 20 41 44 44 43  43 20 20 20 50 43 2c 50  |    ADDCC   PC,P|
00002ee0  43 2c 31 31 2c 4c 53 4c  23 32 20 20 20 20 20 20  |C,11,LSL#2      |
00002ef0  5c 44 69 73 70 61 74 63  68 20 69 66 20 69 6e 20  |\Dispatch if in |
00002f00  72 61 6e 67 65 0d 01 83  30 20 20 20 20 42 20 20  |range...0    B  |
00002f10  20 20 20 20 20 55 6e 6b  6e 6f 77 6e 53 57 49 20  |     UnknownSWI |
00002f20  20 20 20 20 20 20 20 20  20 5c 55 6e 6b 6e 6f 77  |         \Unknow|
00002f30  6e 20 53 57 49 0d 01 84  04 0d 01 85 0d 2e 53 77  |n SWI.........Sw|
00002f40  69 54 61 62 6c 65 0d 01  86 32 20 20 20 20 42 20  |iTable...2    B |
00002f50  20 20 20 20 20 20 62 75  74 74 6f 6e 73 20 20 20  |      buttons   |
00002f60  20 20 20 20 20 20 20 20  20 20 5c 4a 75 6d 70 20  |          \Jump |
00002f70  74 6f 20 53 57 49 20 30  0d 01 87 32 20 20 20 20  |to SWI 0...2    |
00002f80  42 20 20 20 20 20 20 20  52 65 61 64 57 72 69 74  |B       ReadWrit|
00002f90  65 43 6d 6f 73 20 20 20  20 20 20 20 5c 4a 75 6d  |eCmos       \Jum|
00002fa0  70 20 74 6f 20 53 57 49  20 31 0d 01 88 04 0d 01  |p to SWI 1......|
00002fb0  89 10 2e 45 6e 64 53 77  69 54 61 62 6c 65 0d 01  |...EndSwiTable..|
00002fc0  8a 04 0d 01 8b 0f 2e 55  6e 6b 6e 6f 77 6e 53 57  |.......UnknownSW|
00002fd0  49 0d 01 8c 1c 20 20 20  20 41 44 52 20 20 20 20  |I....    ADR    |
00002fe0  20 30 2c 52 61 6e 67 65  45 72 72 6f 72 0d 01 8d  | 0,RangeError...|
00002ff0  3f 20 20 20 20 84 52 53  20 20 20 20 50 43 2c 4c  |?    .RS    PC,L|
00003000  4b 2c 23 31 3c 3c 32 38  20 20 20 20 20 20 20 20  |K,#1<<28        |
00003010  5c 45 78 69 74 20 77 69  74 68 20 6f 76 65 72 66  |\Exit with overf|
00003020  6c 6f 77 20 66 6c 61 67  20 73 65 74 0d 01 8e 04  |low flag set....|
00003030  0d 01 8f 0f 2e 52 61 6e  67 65 45 72 72 6f 72 0d  |.....RangeError.|
00003040  01 90 14 20 20 20 20 45  51 55 44 20 20 20 20 26  |...    EQUD    &|
00003050  31 45 36 0d 01 91 65 20  20 20 20 45 51 55 53 20  |1E6...e    EQUS |
00003060  20 20 20 22 4d 6f 64 75  6c 65 20 4d 69 67 68 74  |   "Module Might|
00003070  79 4d 6f 75 73 65 20 76  22 2b 76 65 72 73 69 6f  |yMouse v"+versio|
00003080  6e 24 2b 22 20 73 75 70  70 6f 72 74 73 20 6f 6e  |n$+" supports on|
00003090  6c 79 20 74 77 6f 20 53  57 49 73 20 28 53 57 49  |ly two SWIs (SWI|
000030a0  20 62 61 73 65 20 3d 20  26 22 2b c3 7e 53 77 69  | base = &"+.~Swi|
000030b0  42 61 73 65 2b 22 29 22  0d 01 92 11 20 20 20 20  |Base+")"....    |
000030c0  45 51 55 42 20 20 20 20  30 0d 01 93 0d 20 20 20  |EQUB    0....   |
000030d0  20 41 4c 49 47 4e 0d 01  94 04 0d 01 95 0d 2e 53  | ALIGN.........S|
000030e0  77 69 4e 61 6d 65 73 0d  01 96 1a 20 20 20 20 45  |wiNames....    E|
000030f0  51 55 53 20 20 20 20 53  77 69 48 65 61 64 65 72  |QUS    SwiHeader|
00003100  24 0d 01 97 11 20 20 20  20 45 51 55 42 20 20 20  |$....    EQUB   |
00003110  20 30 0d 01 98 04 0d 01  99 19 20 20 20 20 45 51  | 0........    EQ|
00003120  55 53 20 20 20 20 22 42  75 74 74 6f 6e 73 22 0d  |US    "Buttons".|
00003130  01 9a 11 20 20 20 20 45  51 55 42 20 20 20 20 30  |...    EQUB    0|
00003140  0d 01 9b 04 0d 01 9c 1c  20 20 20 20 45 51 55 53  |........    EQUS|
00003150  20 20 20 20 22 43 6d 6f  73 41 63 63 65 73 73 22  |    "CmosAccess"|
00003160  0d 01 9d 11 20 20 20 20  45 51 55 42 20 20 20 20  |....    EQUB    |
00003170  30 0d 01 9e 04 0d 01 9f  2f 20 20 20 20 45 51 55  |0......./    EQU|
00003180  42 20 20 20 20 30 20 20  20 20 20 20 20 20 20 20  |B    0          |
00003190  20 20 20 20 20 20 20 20  20 5c 54 65 72 6d 69 6e  |         \Termin|
000031a0  61 74 6f 72 0d 01 a0 0d  20 20 20 20 41 4c 49 47  |ator....    ALIG|
000031b0  4e 0d 01 a1 04 0d 01 a2  0c 2e 62 75 74 74 6f 6e  |N.........button|
000031c0  73 0d 01 a3 1c 20 20 20  20 53 54 4d 46 44 20 20  |s....    STMFD  |
000031d0  20 31 33 21 2c 7b 31 2d  39 2c 4c 4b 7d 0d 01 a4  | 13!,{1-9,LK}...|
000031e0  30 20 20 20 20 54 45 51  50 20 20 20 20 50 43 2c  |0    TEQP    PC,|
000031f0  23 33 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |#3              |
00003200  20 5c 43 6c 65 61 72 20  66 6c 61 67 73 0d 01 a5  | \Clear flags...|
00003210  04 0d 01 a6 24 5c 52 45  46 4c 45 43 54 20 50 52  |....$\REFLECT PR|
00003220  45 56 49 4f 55 53 20 53  45 54 54 49 4e 47 53 20  |EVIOUS SETTINGS |
00003230  49 4e 20 52 30 0d 01 a7  33 20 20 20 20 53 54 52  |IN R0...3    STR|
00003240  20 20 20 20 20 30 2c 72  65 67 30 20 20 20 20 20  |     0,reg0     |
00003250  20 20 20 20 20 20 20 20  20 5c 50 72 65 73 65 72  |         \Preser|
00003260  76 65 20 69 6e 70 75 74  0d 01 a8 39 20 20 20 20  |ve input...9    |
00003270  53 54 52 20 20 20 20 20  31 2c 72 65 67 31 20 20  |STR     1,reg1  |
00003280  20 20 20 20 20 20 20 20  20 20 20 20 5c 70 61 72  |            \par|
00003290  61 6d 65 74 65 72 73 20  66 6f 72 20 6c 61 74 65  |ameters for late|
000032a0  72 0d 01 a9 04 0d 01 aa  50 20 20 20 20 4d 4f 56  |r.......P    MOV|
000032b0  20 20 20 20 20 30 2c 23  31 36 31 20 20 20 20 20  |     0,#161     |
000032c0  20 20 20 20 20 20 20 20  20 5c 47 65 74 20 63 6f  |         \Get co|
000032d0  6e 66 69 67 75 72 65 64  20 6e 6f 72 6d 61 6c 2f  |nfigured normal/|
000032e0  73 77 61 70 70 65 64 20  62 75 74 74 6f 6e 73 20  |swapped buttons |
000032f0  73 74 61 74 65 0d 01 ab  1b 20 20 20 20 4d 4f 56  |state....    MOV|
00003300  20 20 20 20 20 31 2c 23  43 4d 4f 53 6c 6f 63 25  |     1,#CMOSloc%|
00003310  0d 01 ac 45 20 20 20 20  53 57 49 20 20 20 20 20  |...E    SWI     |
00003320  22 58 4f 53 5f 42 79 74  65 22 20 20 20 20 20 20  |"XOS_Byte"      |
00003330  20 20 20 20 5c 53 74 61  74 65 20 72 65 74 75 72  |    \State retur|
00003340  6e 65 64 20 69 6e 20 52  32 20 61 74 20 43 4d 4f  |ned in R2 at CMO|
00003350  53 62 69 74 25 0d 01 ad  04 0d 01 ae 3b 20 20 20  |Sbit%.......;   |
00003360  20 4c 44 52 20 20 20 20  20 30 2c 72 65 67 30 20  | LDR     0,reg0 |
00003370  20 20 20 20 20 20 20 20  20 20 20 20 20 5c 47 65  |             \Ge|
00003380  74 20 69 6e 70 75 74 20  70 61 72 61 6d 65 74 65  |t input paramete|
00003390  72 20 52 30 0d 01 af 40  20 20 20 20 54 53 54 20  |r R0...@    TST |
000033a0  20 20 20 20 32 2c 23 43  4d 4f 53 62 69 74 25 20  |    2,#CMOSbit% |
000033b0  20 20 20 20 20 20 20 20  5c 43 6f 6e 66 69 67 75  |        \Configu|
000033c0  72 65 64 20 62 75 74 74  6f 6e 73 20 73 77 61 70  |red buttons swap|
000033d0  70 65 64 3f 0d 01 b0 4f  20 20 20 20 84 52 4e 45  |ped?...O    .RNE|
000033e0  20 20 20 30 2c 30 2c 23  25 31 30 20 20 20 20 20  |   0,0,#%10     |
000033f0  20 20 20 20 20 20 20 5c  59 45 53 20 2d 20 73 65  |       \YES - se|
00003400  74 20 20 20 62 69 74 20  31 20 70 72 65 73 65 72  |t   bit 1 preser|
00003410  76 69 6e 67 20 61 6c 6c  20 6f 74 68 65 72 20 62  |ving all other b|
00003420  69 74 73 0d 01 b1 50 20  20 20 20 42 49 43 45 51  |its...P    BICEQ|
00003430  20 20 20 30 2c 30 2c 23  25 31 30 20 20 20 20 20  |   0,0,#%10     |
00003440  20 20 20 20 20 20 20 5c  4e 4f 20 20 2d 20 72 65  |       \NO  - re|
00003450  73 65 74 20 62 69 74 20  31 20 70 72 65 73 65 72  |set bit 1 preser|
00003460  76 69 6e 67 20 61 6c 6c  20 6f 74 68 65 72 20 62  |ving all other b|
00003470  69 74 73 0d 01 b2 04 0d  01 b3 4d 20 20 20 20 4c  |its.......M    L|
00003480  44 52 20 20 20 20 20 32  2c 49 6e 74 65 72 63 65  |DR     2,Interce|
00003490  70 74 46 6c 61 67 20 20  20 20 20 5c 47 65 74 20  |ptFlag     \Get |
000034a0  63 75 72 72 65 6e 74 20  6e 6f 72 6d 61 6c 2f 73  |current normal/s|
000034b0  77 61 70 70 65 64 20 62  75 74 74 6f 6e 73 20 73  |wapped buttons s|
000034c0  74 61 74 65 0d 01 b4 35  20 20 20 20 54 53 54 20  |tate...5    TST |
000034d0  20 20 20 20 32 2c 23 25  30 31 20 20 20 20 20 20  |    2,#%01      |
000034e0  20 20 20 20 20 20 20 20  5c 42 75 74 74 6f 6e 73  |        \Buttons|
000034f0  20 73 77 61 70 70 65 64  3f 0d 01 b5 4f 20 20 20  | swapped?...O   |
00003500  20 84 52 4e 45 20 20 20  30 2c 30 2c 23 25 30 31  | .RNE   0,0,#%01|
00003510  20 20 20 20 20 20 20 20  20 20 20 20 5c 59 45 53  |            \YES|
00003520  20 2d 20 73 65 74 20 20  20 62 69 74 20 30 20 70  | - set   bit 0 p|
00003530  72 65 73 65 72 76 69 6e  67 20 61 6c 6c 20 6f 74  |reserving all ot|
00003540  68 65 72 20 62 69 74 73  0d 01 b6 50 20 20 20 20  |her bits...P    |
00003550  42 49 43 45 51 20 20 20  30 2c 30 2c 23 25 30 31  |BICEQ   0,0,#%01|
00003560  20 20 20 20 20 20 20 20  20 20 20 20 5c 4e 4f 20  |            \NO |
00003570  20 2d 20 72 65 73 65 74  20 62 69 74 20 30 20 70  | - reset bit 0 p|
00003580  72 65 73 65 72 76 69 6e  67 20 61 6c 6c 20 6f 74  |reserving all ot|
00003590  68 65 72 20 62 69 74 73  0d 01 b7 04 0d 01 b8 55  |her bits.......U|
000035a0  20 20 20 20 53 54 52 20  20 20 20 20 30 2c 72 65  |    STR     0,re|
000035b0  67 30 6f 6c 64 20 20 20  20 20 20 20 20 20 20 20  |g0old           |
000035c0  5c 54 68 69 73 20 76 61  6c 75 65 20 6f 66 20 52  |\This value of R|
000035d0  30 20 74 6f 20 62 65 20  72 65 74 75 72 6e 65 64  |0 to be returned|
000035e0  20 6f 6e 20 65 78 69 74  20 66 72 6f 6d 20 53 57  | on exit from SW|
000035f0  49 0d 01 b9 04 0d 01 ba  42 5c 83 20 e7 20 59 20  |I.......B\. . Y |
00003600  43 55 52 52 45 4e 54 20  26 20 43 4f 4e 46 49 47  |CURRENT & CONFIG|
00003610  55 52 45 44 20 42 55 54  54 4f 4e 53 20 53 54 41  |URED BUTTONS STA|
00003620  54 55 53 20 41 53 20 50  45 52 20 e8 20 50 41 52  |TUS AS PER . PAR|
00003630  41 4d 45 54 45 52 53 0d  01 bb 3e 20 20 20 20 4c  |AMETERS...>    L|
00003640  44 52 20 20 20 20 20 30  2c 72 65 67 30 20 20 20  |DR     0,reg0   |
00003650  20 20 20 20 20 20 20 20  20 20 20 5c 52 65 74 72  |           \Retr|
00003660  69 65 76 65 20 69 6e 70  75 74 20 70 61 72 61 6d  |ieve input param|
00003670  65 74 65 72 73 0d 01 bc  31 20 20 20 20 4c 44 52  |eters...1    LDR|
00003680  20 20 20 20 20 31 2c 72  65 67 31 20 20 20 20 20  |     1,reg1     |
00003690  20 20 20 20 20 20 20 20  20 5c 66 72 6f 6d 20 65  |         \from e|
000036a0  61 72 6c 69 65 72 0d 01  bd 04 0d 01 be 42 20 20  |arlier.......B  |
000036b0  20 20 54 53 54 20 20 20  20 20 31 2c 23 25 31 30  |  TST     1,#%10|
000036c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 5c 49  |              \I|
000036d0  73 20 52 31 20 62 69 74  20 31 20 3d 20 31 3f 20  |s R1 bit 1 = 1? |
000036e0  28 6d 61 73 6b 3d 77 72  69 74 65 29 0d 01 bf 39  |(mask=write)...9|
000036f0  20 20 20 20 42 45 51 20  20 20 20 20 52 31 62 69  |    BEQ     R1bi|
00003700  74 31 7a 65 72 6f 20 20  20 20 20 20 20 20 20 20  |t1zero          |
00003710  5c 4e 4f 20 20 2d 20 63  68 65 63 6b 20 52 31 20  |\NO  - check R1 |
00003720  62 69 74 20 30 0d 01 c0  04 0d 01 c1 3b 20 20 20  |bit 0.......;   |
00003730  20 54 53 54 20 20 20 20  20 30 2c 23 25 31 30 20  | TST     0,#%10 |
00003740  20 20 20 20 20 20 20 20  20 20 20 20 20 5c 59 45  |             \YE|
00003750  53 20 2d 20 49 73 20 52  30 20 62 69 74 20 31 20  |S - Is R0 bit 1 |
00003760  3d 20 30 3f 0d 01 c2 34  20 20 20 20 ec 51 20 20  |= 0?...4    .Q  |
00003770  20 33 2c 23 30 20 20 20  20 20 20 20 20 20 20 20  | 3,#0           |
00003780  20 20 20 20 20 5c 59 45  53 20 2d 20 43 4d 4f 53  |     \YES - CMOS|
00003790  20 52 41 4d 20 3d 20 30  0d 01 c3 37 20 20 20 20  | RAM = 0...7    |
000037a0  4d 4f 56 4e 45 20 20 20  33 2c 23 43 4d 4f 53 62  |MOVNE   3,#CMOSb|
000037b0  69 74 25 20 20 20 20 20  20 20 20 20 5c 4e 4f 20  |it%         \NO |
000037c0  20 2d 20 43 4d 4f 53 20  52 41 4d 20 3d 20 31 0d  | - CMOS RAM = 1.|
000037d0  01 c4 04 0d 01 c5 1b 20  20 20 20 4d 4f 56 20 20  |.......    MOV  |
000037e0  20 20 20 31 2c 23 43 4d  4f 53 6c 6f 63 25 0d 01  |   1,#CMOSloc%..|
000037f0  c6 3f 20 20 20 20 4d 4f  56 20 20 20 20 20 34 2c  |.?    MOV     4,|
00003800  23 43 4d 4f 53 62 69 74  25 20 20 20 20 20 20 20  |#CMOSbit%       |
00003810  20 20 5c 47 65 74 20 6d  61 73 6b 20 66 6f 72 20  |  \Get mask for |
00003820  52 65 61 64 57 72 69 74  65 43 6d 6f 73 0d 01 c7  |ReadWriteCmos...|
00003830  3c 20 20 20 20 42 4c 20  20 20 20 20 20 52 65 61  |<    BL      Rea|
00003840  64 57 72 69 74 65 43 6d  6f 73 20 20 20 20 20 20  |dWriteCmos      |
00003850  20 5c 57 72 69 74 65 20  76 61 6c 75 65 20 74 6f  | \Write value to|
00003860  20 43 4d 4f 53 20 52 41  4d 0d 01 c8 3e 20 20 20  | CMOS RAM...>   |
00003870  20 4c 44 52 20 20 20 20  20 30 2c 72 65 67 30 20  | LDR     0,reg0 |
00003880  20 20 20 20 20 20 20 20  20 20 20 20 20 5c 52 65  |             \Re|
00003890  74 72 69 65 76 65 20 69  6e 70 75 74 20 70 61 72  |trieve input par|
000038a0  61 6d 65 74 65 72 73 0d  01 c9 41 20 20 20 20 4c  |ameters...A    L|
000038b0  44 52 20 20 20 20 20 31  2c 72 65 67 31 20 20 20  |DR     1,reg1   |
000038c0  20 20 20 20 20 20 20 20  20 20 20 5c 6f 76 65 72  |           \over|
000038d0  77 72 69 74 74 65 6e 20  62 79 20 52 65 61 64 57  |written by ReadW|
000038e0  72 69 74 65 43 6d 6f 73  0d 01 ca 04 0d 01 cb 0f  |riteCmos........|
000038f0  2e 52 31 62 69 74 31 7a  65 72 6f 0d 01 cc 35 20  |.R1bit1zero...5 |
00003900  20 20 20 54 53 54 20 20  20 20 20 31 2c 23 25 30  |   TST     1,#%0|
00003910  31 20 20 20 20 20 20 20  20 20 20 20 20 20 20 5c  |1              \|
00003920  49 73 20 52 31 20 62 69  74 20 30 20 3d 20 31 3f  |Is R1 bit 0 = 1?|
00003930  0d 01 cd 33 20 20 20 20  42 45 51 20 20 20 20 20  |...3    BEQ     |
00003940  52 31 62 69 74 30 7a 65  72 6f 20 20 20 20 20 20  |R1bit0zero      |
00003950  20 20 20 20 5c 4e 4f 20  20 2d 20 65 78 69 74 20  |    \NO  - exit |
00003960  53 57 49 0d 01 ce 33 20  20 20 20 20 20 20 20 20  |SWI...3         |
00003970  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003980  20 20 20 20 20 20 20 5c  59 45 53 20 2d 20 64 6f  |       \YES - do|
00003990  20 62 65 6c 6f 77 0d 01  cf 3f 20 20 20 20 4c 44  | below...?    LD|
000039a0  52 20 20 20 20 20 31 2c  49 6e 74 65 72 63 65 70  |R     1,Intercep|
000039b0  74 46 6c 61 67 20 20 20  20 20 5c 47 65 74 20 63  |tFlag     \Get c|
000039c0  75 72 72 65 6e 74 20 62  75 74 74 6f 6e 73 20 73  |urrent buttons s|
000039d0  74 61 74 75 73 0d 01 d0  35 20 20 20 20 54 53 54  |tatus...5    TST|
000039e0  20 20 20 20 20 30 2c 23  25 30 31 20 20 20 20 20  |     0,#%01     |
000039f0  20 20 20 20 20 20 20 20  20 5c 49 73 20 52 30 20  |         \Is R0 |
00003a00  62 69 74 20 30 20 3d 20  30 3f 0d 01 d1 3f 20 20  |bit 0 = 0?...?  |
00003a10  20 20 42 4e 45 20 20 20  20 20 52 30 62 69 74 30  |  BNE     R0bit0|
00003a20  6f 6e 65 20 20 20 20 20  20 20 20 20 20 20 5c 4e  |one           \N|
00003a30  4f 20 20 2d 20 63 6c 61  69 6d 20 20 20 6d 6f 75  |O  - claim   mou|
00003a40  73 65 20 76 65 63 74 6f  72 0d 01 d2 3f 20 20 20  |se vector...?   |
00003a50  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003a60  20 20 20 20 20 20 20 20  20 20 20 20 20 5c 59 45  |             \YE|
00003a70  53 20 2d 20 72 65 6c 65  61 73 65 20 6d 6f 75 73  |S - release mous|
00003a80  65 20 76 65 63 74 6f 72  0d 01 d3 04 0d 01 d4 52  |e vector.......R|
00003a90  20 20 20 20 54 53 54 20  20 20 20 20 31 2c 23 31  |    TST     1,#1|
00003aa0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003ab0  5c 49 73 20 76 65 63 74  6f 72 20 61 6c 72 65 61  |\Is vector alrea|
00003ac0  64 79 20 72 65 6c 65 61  73 65 64 3f 20 28 49 6e  |dy released? (In|
00003ad0  74 65 72 63 65 70 74 46  6c 61 67 3d 30 29 0d 01  |terceptFlag=0)..|
00003ae0  d5 41 20 20 20 20 42 4c  4e 45 20 20 20 20 72 65  |.A    BLNE    re|
00003af0  6c 65 61 73 65 20 20 20  20 20 20 20 20 20 20 20  |lease           |
00003b00  20 20 5c 4e 4f 20 20 2d  20 66 6c 61 67 3d 31 2c  |  \NO  - flag=1,|
00003b10  20 72 65 6c 65 61 73 65  20 76 65 63 74 6f 72 0d  | release vector.|
00003b20  01 d6 04 0d 01 d7 5a 20  20 20 20 41 44 52 56 53  |......Z    ADRVS|
00003b30  20 20 20 30 2c 53 77 69  43 61 6e 74 52 65 6c 65  |   0,SwiCantRele|
00003b40  61 73 65 20 20 20 20 5c  41 62 6f 72 74 20 77 69  |ase    \Abort wi|
00003b50  74 68 20 65 72 72 6f 72  20 6d 65 73 73 61 67 65  |th error message|
00003b60  20 69 66 20 76 65 63 74  6f 72 20 63 61 6e 6e 6f  | if vector canno|
00003b70  74 20 62 65 20 72 65 6c  65 61 73 65 64 0d 01 d8  |t be released...|
00003b80  3c 20 20 20 20 4c 44 4d  56 53 46 44 20 31 33 21  |<    LDMVSFD 13!|
00003b90  2c 7b 31 2d 39 2c 4c 4b  7d 20 20 20 20 20 20 20  |,{1-9,LK}       |
00003ba0  20 5c 53 65 74 20 56 2c  20 77 68 69 6c 65 20 70  | \Set V, while p|
00003bb0  72 65 73 65 72 76 69 6e  67 0d 01 d9 33 20 20 20  |reserving...3   |
00003bc0  20 84 52 56 53 53 20 20  50 43 2c 4c 4b 2c 23 31  | .RVSS  PC,LK,#1|
00003bd0  3c 3c 32 38 20 20 20 20  20 20 20 20 5c 74 68 65  |<<28        \the|
00003be0  20 6f 74 68 65 72 20 66  6c 61 67 73 0d 01 da 04  | other flags....|
00003bf0  0d 01 db 33 20 20 20 20  42 20 20 20 20 20 20 20  |...3    B       |
00003c00  52 31 62 69 74 30 7a 65  72 6f 20 20 20 20 20 20  |R1bit0zero      |
00003c10  20 20 20 20 5c 59 45 53  20 2d 20 65 78 69 74 20  |    \YES - exit |
00003c20  53 57 49 0d 01 dc 04 0d  01 dd 0e 2e 52 30 62 69  |SWI.........R0bi|
00003c30  74 30 6f 6e 65 0d 01 de  52 20 20 20 20 54 53 54  |t0one...R    TST|
00003c40  20 20 20 20 20 31 2c 23  31 20 20 20 20 20 20 20  |     1,#1       |
00003c50  20 20 20 20 20 20 20 20  20 5c 49 73 20 76 65 63  |         \Is vec|
00003c60  74 6f 72 20 61 6c 72 65  61 64 79 20 63 6c 61 69  |tor already clai|
00003c70  6d 65 64 3f 20 20 28 49  6e 74 65 72 63 65 70 74  |med?  (Intercept|
00003c80  46 6c 61 67 3d 31 29 0d  01 df 3f 20 20 20 20 42  |Flag=1)...?    B|
00003c90  4c 45 51 20 20 20 20 63  6c 61 69 6d 20 20 20 20  |LEQ    claim    |
00003ca0  20 20 20 20 20 20 20 20  20 20 20 5c 4e 4f 20 20  |           \NO  |
00003cb0  2d 20 66 6c 61 67 3d 30  2c 20 63 6c 61 69 6d 20  |- flag=0, claim |
00003cc0  76 65 63 74 6f 72 0d 01  e0 33 20 20 20 20 20 20  |vector...3      |
00003cd0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003ce0  20 20 20 20 20 20 20 20  20 20 5c 59 45 53 20 2d  |          \YES -|
00003cf0  20 65 78 69 74 20 53 57  49 0d 01 e1 59 20 20 20  | exit SWI...Y   |
00003d00  20 41 44 52 56 53 20 20  20 30 2c 53 77 69 43 61  | ADRVS   0,SwiCa|
00003d10  6e 74 43 6c 61 69 6d 20  20 20 20 20 20 5c 41 62  |ntClaim      \Ab|
00003d20  6f 72 74 20 77 69 74 68  20 65 72 72 6f 72 20 6d  |ort with error m|
00003d30  65 73 73 61 67 65 20 69  66 20 76 65 63 74 6f 72  |essage if vector|
00003d40  20 63 61 6e 6e 6f 74 20  62 65 20 63 6c 61 69 6d  | cannot be claim|
00003d50  65 64 0d 01 e2 3c 20 20  20 20 4c 44 4d 56 53 46  |ed...<    LDMVSF|
00003d60  44 20 31 33 21 2c 7b 31  2d 39 2c 4c 4b 7d 20 20  |D 13!,{1-9,LK}  |
00003d70  20 20 20 20 20 20 5c 53  65 74 20 56 2c 20 77 68  |      \Set V, wh|
00003d80  69 6c 65 20 70 72 65 73  65 72 76 69 6e 67 0d 01  |ile preserving..|
00003d90  e3 33 20 20 20 20 84 52  56 53 53 20 20 50 43 2c  |.3    .RVSS  PC,|
00003da0  4c 4b 2c 23 31 3c 3c 32  38 20 20 20 20 20 20 20  |LK,#1<<28       |
00003db0  20 5c 74 68 65 20 6f 74  68 65 72 20 66 6c 61 67  | \the other flag|
00003dc0  73 0d 01 e4 04 0d 01 e5  0f 2e 52 31 62 69 74 30  |s.........R1bit0|
00003dd0  7a 65 72 6f 0d 01 e6 19  20 20 20 20 4c 44 52 20  |zero....    LDR |
00003de0  20 20 20 20 30 2c 72 65  67 30 6f 6c 64 0d 01 e7  |    0,reg0old...|
00003df0  4b 20 20 20 20 4c 44 4d  46 44 20 20 20 31 33 21  |K    LDMFD   13!|
00003e00  2c 7b 31 2d 39 2c 50 43  7d 5e 20 20 20 20 20 20  |,{1-9,PC}^      |
00003e10  20 5c 52 65 74 75 72 6e  20 74 6f 20 53 57 49 20  | \Return to SWI |
00003e20  63 61 6c 6c 65 72 2c 20  70 72 65 73 65 72 76 69  |caller, preservi|
00003e30  6e 67 20 66 6c 61 67 73  0d 01 e8 04 0d 01 e9 11  |ng flags........|
00003e40  2e 53 77 69 43 61 6e 74  43 6c 61 69 6d 0d 01 ea  |.SwiCantClaim...|
00003e50  69 20 20 20 20 45 51 55  44 20 20 20 20 26 31 41  |i    EQUD    &1A|
00003e60  30 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |0               |
00003e70  20 5c 55 73 65 20 74 68  69 73 20 65 72 72 6f 72  | \Use this error|
00003e80  20 6e 75 6d 62 65 72 20  61 73 20 6e 6f 20 27 55  | number as no 'U|
00003e90  73 65 72 27 20 65 72 72  6f 72 20 6e 75 6d 62 65  |ser' error numbe|
00003ea0  72 73 20 68 61 76 65 20  62 65 65 6e 20 61 6c 6c  |rs have been all|
00003eb0  6f 63 61 74 65 64 0d 01  eb 61 20 20 20 20 45 51  |ocated...a    EQ|
00003ec0  55 53 20 20 20 20 22 4d  69 67 68 74 79 4d 6f 75  |US    "MightyMou|
00003ed0  73 65 20 53 57 49 20 63  6f 75 6c 64 20 6e 6f 74  |se SWI could not|
00003ee0  20 63 6c 61 69 6d 20 6d  6f 75 73 65 20 76 65 63  | claim mouse vec|
00003ef0  74 6f 72 2c 20 74 72 79  20 72 65 6c 6f 61 64 69  |tor, try reloadi|
00003f00  6e 67 20 4d 69 67 68 74  79 4d 6f 75 73 65 20 6d  |ng MightyMouse m|
00003f10  6f 64 75 6c 65 2e 22 0d  01 ec 11 20 20 20 20 45  |odule."....    E|
00003f20  51 55 42 20 20 20 20 30  0d 01 ed 0d 20 20 20 20  |QUB    0....    |
00003f30  41 4c 49 47 4e 0d 01 ee  04 0d 01 ef 13 2e 53 77  |ALIGN.........Sw|
00003f40  69 43 61 6e 74 52 65 6c  65 61 73 65 0d 01 f0 69  |iCantRelease...i|
00003f50  20 20 20 20 45 51 55 44  20 20 20 20 26 31 41 31  |    EQUD    &1A1|
00003f60  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003f70  5c 55 73 65 20 74 68 69  73 20 65 72 72 6f 72 20  |\Use this error |
00003f80  6e 75 6d 62 65 72 20 61  73 20 6e 6f 20 27 55 73  |number as no 'Us|
00003f90  65 72 27 20 65 72 72 6f  72 20 6e 75 6d 62 65 72  |er' error number|
00003fa0  73 20 68 61 76 65 20 62  65 65 6e 20 61 6c 6c 6f  |s have been allo|
00003fb0  63 61 74 65 64 0d 01 f1  68 20 20 20 20 20 20 20  |cated...h       |
00003fc0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003fd0  20 20 20 20 20 20 20 20  20 5c 54 68 69 73 20 6e  |         \This n|
00003fe0  75 6d 62 65 72 20 69 73  20 67 65 6e 65 72 61 74  |umber is generat|
00003ff0  65 64 20 62 79 20 4f 53  5f 52 65 6c 65 61 73 65  |ed by OS_Release|
00004000  2c 20 74 68 65 20 53 57  49 20 6d 6f 73 74 20 6c  |, the SWI most l|
00004010  69 6b 65 6c 79 20 74 6f  20 66 61 69 6c 0d 01 f2  |ikely to fail...|
00004020  63 20 20 20 20 45 51 55  53 20 20 20 20 22 4d 69  |c    EQUS    "Mi|
00004030  67 68 74 79 4d 6f 75 73  65 20 53 57 49 20 63 6f  |ghtyMouse SWI co|
00004040  75 6c 64 20 6e 6f 74 20  72 65 6c 65 61 73 65 20  |uld not release |
00004050  6d 6f 75 73 65 20 76 65  63 74 6f 72 2e 20 54 72  |mouse vector. Tr|
00004060  79 20 72 65 6c 6f 61 64  69 6e 67 20 4d 69 67 68  |y reloading Migh|
00004070  74 79 4d 6f 75 73 65 20  6d 6f 64 75 6c 65 2e 22  |tyMouse module."|
00004080  0d 01 f3 11 20 20 20 20  45 51 55 42 20 20 20 20  |....    EQUB    |
00004090  30 0d 01 f4 0d 20 20 20  20 41 4c 49 47 4e 0d 01  |0....    ALIGN..|
000040a0  f5 04 0d 01 f6 0a 2e 63  6c 61 69 6d 0d 01 f7 1c  |.......claim....|
000040b0  20 20 20 20 53 54 4d 46  44 20 20 20 31 33 21 2c  |    STMFD   13!,|
000040c0  7b 30 2d 32 2c 4c 4b 7d  0d 01 f8 16 20 20 20 20  |{0-2,LK}....    |
000040d0  4d 4f 56 20 20 20 20 20  30 2c 23 26 31 41 0d 01  |MOV     0,#&1A..|
000040e0  f9 1b 20 20 20 20 41 44  52 20 20 20 20 20 31 2c  |..    ADR     1,|
000040f0  69 6e 74 65 72 63 65 70  74 0d 01 fa 14 20 20 20  |intercept....   |
00004100  20 4d 4f 56 20 20 20 20  20 32 2c 23 30 0d 01 fb  | MOV     2,#0...|
00004110  1b 20 20 20 20 53 57 49  20 20 20 20 20 22 58 4f  |.    SWI     "XO|
00004120  53 5f 43 6c 61 69 6d 22  0d 01 fc 53 20 20 20 20  |S_Claim"...S    |
00004130  4d 56 4e 56 43 20 20 20  30 2c 23 30 20 20 20 20  |MVNVC   0,#0    |
00004140  20 20 20 20 20 20 20 20  20 20 20 20 5c 43 6c 61  |            \Cla|
00004150  69 6d 20 77 69 74 68 20  66 6c 61 67 3d 2d 31 20  |im with flag=-1 |
00004160  69 66 20 4f 53 5f 43 6c  61 69 6d 20 77 61 73 20  |if OS_Claim was |
00004170  73 75 63 63 65 73 73 66  75 6c 2c 0d 01 fd 38 20  |successful,...8 |
00004180  20 20 20 4d 4f 56 56 53  20 20 20 30 2c 23 30 20  |   MOVVS   0,#0 |
00004190  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 5c  |               \|
000041a0  65 6c 73 65 20 72 65 6c  65 61 73 65 20 77 69 74  |else release wit|
000041b0  68 20 30 0d 01 fe 1f 20  20 20 20 53 54 52 20 20  |h 0....    STR  |
000041c0  20 20 20 30 2c 49 6e 74  65 72 63 65 70 74 46 6c  |   0,InterceptFl|
000041d0  61 67 0d 01 ff 54 20 20  20 20 4c 44 4d 46 44 20  |ag...T    LDMFD |
000041e0  20 20 31 33 21 2c 7b 30  2d 32 2c 50 43 7d 20 20  |  13!,{0-2,PC}  |
000041f0  20 20 20 20 20 20 5c 41  6c 6c 6f 77 20 56 20 66  |      \Allow V f|
00004200  6c 61 67 20 74 6f 20 62  65 20 70 61 73 73 65 64  |lag to be passed|
00004210  20 6f 6e 20 69 66 20 4f  53 5f 43 6c 61 69 6d 20  | on if OS_Claim |
00004220  66 61 69 6c 65 64 0d 02  00 04 0d 02 01 0c 2e 72  |failed.........r|
00004230  65 6c 65 61 73 65 0d 02  02 1c 20 20 20 20 53 54  |elease....    ST|
00004240  4d 46 44 20 20 20 31 33  21 2c 7b 30 2d 32 2c 4c  |MFD   13!,{0-2,L|
00004250  4b 7d 0d 02 03 16 20 20  20 20 4d 4f 56 20 20 20  |K}....    MOV   |
00004260  20 20 30 2c 23 26 31 41  0d 02 04 1b 20 20 20 20  |  0,#&1A....    |
00004270  41 44 52 20 20 20 20 20  31 2c 69 6e 74 65 72 63  |ADR     1,interc|
00004280  65 70 74 0d 02 05 14 20  20 20 20 4d 4f 56 20 20  |ept....    MOV  |
00004290  20 20 20 32 2c 23 30 0d  02 06 1d 20 20 20 20 53  |   2,#0....    S|
000042a0  57 49 20 20 20 20 20 22  58 4f 53 5f 52 65 6c 65  |WI     "XOS_Rele|
000042b0  61 73 65 22 0d 02 07 56  20 20 20 20 4d 4f 56 56  |ase"...V    MOVV|
000042c0  43 20 20 20 30 2c 23 30  20 20 20 20 20 20 20 20  |C   0,#0        |
000042d0  20 20 20 20 20 20 20 20  5c 52 65 6c 65 61 73 65  |        \Release|
000042e0  20 77 69 74 68 20 66 6c  61 67 3d 30 20 69 66 20  | with flag=0 if |
000042f0  4f 53 5f 52 65 6c 65 61  73 65 20 77 61 73 20 73  |OS_Release was s|
00004300  75 63 63 65 73 73 66 75  6c 2c 0d 02 08 37 20 20  |uccessful,...7  |
00004310  20 20 4d 56 4e 56 53 20  20 20 30 2c 23 30 20 20  |  MVNVS   0,#0  |
00004320  20 20 20 20 20 20 20 20  20 20 20 20 20 20 5c 65  |              \e|
00004330  6c 73 65 20 63 6c 61 69  6d 20 77 69 74 68 20 2d  |lse claim with -|
00004340  31 0d 02 09 1f 20 20 20  20 53 54 52 20 20 20 20  |1....    STR    |
00004350  20 30 2c 49 6e 74 65 72  63 65 70 74 46 6c 61 67  | 0,InterceptFlag|
00004360  0d 02 0a 56 20 20 20 20  4c 44 4d 46 44 20 20 20  |...V    LDMFD   |
00004370  31 33 21 2c 7b 30 2d 32  2c 50 43 7d 20 20 20 20  |13!,{0-2,PC}    |
00004380  20 20 20 20 5c 41 6c 6c  6f 77 20 56 20 66 6c 61  |    \Allow V fla|
00004390  67 20 74 6f 20 62 65 20  70 61 73 73 65 64 20 6f  |g to be passed o|
000043a0  6e 20 69 66 20 4f 53 5f  52 65 6c 65 61 73 65 20  |n if OS_Release |
000043b0  66 61 69 6c 65 64 0d 02  0b 04 0d 02 0c 0e 2e 69  |failed.........i|
000043c0  6e 74 65 72 63 65 70 74  0d 02 0d 20 20 20 20 20  |ntercept...     |
000043d0  53 54 4d 46 44 20 20 20  31 33 21 2c 7b 39 2c 31  |STMFD   13!,{9,1|
000043e0  30 2d 31 32 2c 4c 4b 7d  0d 02 0e 04 0d 02 0f 27  |0-12,LK}.......'|
000043f0  5c d6 20 53 57 49 20 4f  53 5f 4d 4f 55 53 45 2c  |\. SWI OS_MOUSE,|
00004400  20 83 20 e7 20 59 49 4e  47 20 f8 20 41 44 44 52  | . . YING . ADDR|
00004410  45 53 53 0d 02 10 2a 5c  53 4f 20 54 48 41 54 20  |ESS...*\SO THAT |
00004420  4d 59 20 52 4f 55 54 49  4e 45 20 49 53 20 45 58  |MY ROUTINE IS EX|
00004430  45 43 55 54 45 44 20 ee  20 45 58 49 54 0d 02 11  |ECUTED . EXIT...|
00004440  04 0d 02 12 68 5c 54 68  65 20 66 6f 6c 6c 6f 77  |....h\The follow|
00004450  69 6e 67 20 33 20 69 6e  73 74 72 75 63 74 69 6f  |ing 3 instructio|
00004460  6e 73 20 61 6e 64 20 74  68 65 20 4e 4f 50 20 61  |ns and the NOP a|
00004470  72 65 20 74 68 65 20 66  69 78 20 74 6f 20 61 6c  |re the fix to al|
00004480  6c 6f 77 20 53 57 49 20  70 6f 73 74 2d 70 72 6f  |low SWI post-pro|
00004490  63 65 73 73 69 6e 67 20  6f 6e 20 61 20 53 74 72  |cessing on a Str|
000044a0  6f 6e 67 41 72 6d 2e 20  20 0d 02 13 6e 5c 54 68  |ongArm.  ...n\Th|
000044b0  65 79 20 65 6e 73 75 72  65 20 74 68 61 74 20 74  |ey ensure that t|
000044c0  68 65 20 53 74 72 6f 6e  67 41 72 6d 20 50 43 20  |he StrongArm PC |
000044d0  70 6f 69 6e 74 73 20 74  6f 20 74 68 65 20 72 69  |points to the ri|
000044e0  67 68 74 20 69 6e 73 74  72 75 63 74 69 6f 6e 20  |ght instruction |
000044f0  28 61 74 20 2e 64 65 6c  74 61 32 29 20 61 66 74  |(at .delta2) aft|
00004500  65 72 20 74 68 65 20 53  57 49 20 68 61 73 20 65  |er the SWI has e|
00004510  78 65 63 75 74 65 64 0d  02 14 27 5c 62 79 20 63  |xecuted...'\by c|
00004520  61 6c 63 75 6c 61 74 69  6e 67 20 74 68 65 20 63  |alculating the c|
00004530  6f 72 72 65 63 74 20 6f  66 66 73 65 74 2e 0d 02  |orrect offset...|
00004540  15 04 0d 02 16 0b 2e 64  65 6c 74 61 31 0d 02 17  |.......delta1...|
00004550  6b 20 20 20 20 4d 4f 56  20 20 20 20 20 31 32 2c  |k    MOV     12,|
00004560  50 43 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |PC              |
00004570  20 5c 43 61 6e 6e 6f 74  20 73 74 61 63 6b 20 50  | \Cannot stack P|
00004580  43 20 68 65 72 65 20 62  65 63 61 75 73 65 20 69  |C here because i|
00004590  74 20 77 69 6c 6c 20 70  6f 69 6e 74 20 74 6f 20  |t will point to |
000045a0  6f 6e 65 20 69 6e 73 74  72 75 63 74 69 6f 6e 20  |one instruction |
000045b0  74 6f 6f 20 73 6f 6f 6e  0d 02 18 37 20 20 20 20  |too soon...7    |
000045c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000045d0  20 20 20 20 20 20 20 20  20 20 20 20 5c 6f 6e 20  |            \on |
000045e0  72 65 74 75 72 6e 20 66  72 6f 6d 20 53 57 49 0d  |return from SWI.|
000045f0  02 19 42 20 20 20 20 41  44 44 20 20 20 20 20 31  |..B    ADD     1|
00004600  32 2c 31 32 2c 23 28 64  65 6c 74 61 32 2d 64 65  |2,12,#(delta2-de|
00004610  6c 74 61 31 2d 38 29 20  20 20 5c 53 75 62 3d 38  |lta1-8)   \Sub=8|
00004620  20 66 6f 72 20 53 74 72  6f 6e 67 41 72 6d 20 50  | for StrongArm P|
00004630  43 0d 02 1a 18 20 20 20  20 53 54 4d 46 44 20 20  |C....    STMFD  |
00004640  20 31 33 21 2c 7b 31 32  7d 0d 02 1b 04 0d 02 1c  | 13!,{12}.......|
00004650  5e 20 20 20 20 41 44 44  20 20 20 20 20 31 32 2c  |^    ADD     12,|
00004660  31 33 2c 23 38 20 20 20  20 20 20 20 20 20 20 20  |13,#8           |
00004670  20 5c 41 6c 69 67 6e 20  73 74 61 63 6b 20 70 6f  | \Align stack po|
00004680  69 6e 74 65 72 20 77 69  74 68 20 63 6f 72 72 65  |inter with corre|
00004690  63 74 20 72 65 67 69 73  74 65 72 73 20 74 6f 20  |ct registers to |
000046a0  65 78 65 63 75 74 65 20  53 57 49 0d 02 1d 3f 20  |execute SWI...? |
000046b0  20 20 20 4c 44 4d 49 41  20 20 20 31 32 2c 7b 31  |   LDMIA   12,{1|
000046c0  30 2d 31 32 2c 50 43 7d  20 20 20 20 20 20 20 5c  |0-12,PC}       \|
000046d0  53 57 49 20 4f 53 5f 4d  6f 75 73 65 20 65 78 65  |SWI OS_Mouse exe|
000046e0  63 75 74 65 64 20 68 65  72 65 0d 02 1e 04 0d 02  |cuted here......|
000046f0  1f 65 2e 64 65 6c 74 61  32 20 20 20 20 20 20 20  |.e.delta2       |
00004700  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004710  20 20 5c 53 57 49 20 72  65 74 75 72 6e 73 20 68  |  \SWI returns h|
00004720  65 72 65 20 6f 6e 20 53  74 72 6f 6e 67 41 72 6d  |ere on StrongArm|
00004730  2c 20 6f 6e 65 20 69 6e  73 74 72 75 63 74 69 6f  |, one instructio|
00004740  6e 20 66 75 72 74 68 65  72 20 6f 74 68 65 72 77  |n further otherw|
00004750  69 73 65 0d 02 20 71 20  20 20 20 45 51 55 44 20  |ise.. q    EQUD |
00004760  20 20 20 30 20 20 20 20  20 20 20 20 20 20 20 20  |   0            |
00004770  20 20 20 20 20 20 20 5c  4e 4f 50 20 70 72 65 76  |       \NOP prev|
00004780  65 6e 74 73 20 53 41 20  66 69 78 20 66 72 6f 6d  |ents SA fix from|
00004790  20 66 61 6c 6c 69 6e 67  20 6f 76 65 72 20 6f 6e  | falling over on|
000047a0  20 65 61 72 6c 69 65 72  20 70 72 6f 63 65 73 73  | earlier process|
000047b0  6f 72 73 20 28 50 43 2b  38 2f 2b 31 32 20 69 73  |ors (PC+8/+12 is|
000047c0  73 75 65 29 0d 02 21 3d  20 20 20 20 4c 44 52 20  |sue)..!=    LDR |
000047d0  20 20 20 20 31 32 2c 5b  31 33 2c 23 31 32 5d 20  |    12,[13,#12] |
000047e0  20 20 20 20 20 20 20 20  5c 52 65 6c 6f 61 64 20  |        \Reload |
000047f0  77 6f 72 6b 73 70 61 63  65 20 70 6f 69 6e 74 65  |workspace pointe|
00004800  72 0d 02 22 04 0d 02 23  2f 5c 4f 53 5f 4d 4f 55  |r.."...#/\OS_MOU|
00004810  53 45 20 50 4f 53 54 2d  f2 45 53 53 45 44 20 48  |SE POST-.ESSED H|
00004820  45 52 45 20 2d 20 42 55  54 54 4f 4e 53 20 c8 94  |ERE - BUTTONS ..|
00004830  20 50 45 44 0d 02 24 3e  20 20 20 20 54 53 54 20  | PED..$>    TST |
00004840  20 20 20 20 20 20 32 2c  23 25 30 30 31 20 20 20  |      2,#%001   |
00004850  20 20 20 20 20 20 20 20  5c 4d 6f 76 65 20 52 32  |        \Move R2|
00004860  20 62 69 74 20 30 20 74  6f 20 52 39 20 62 69 74  | bit 0 to R9 bit|
00004870  20 32 0d 02 25 2a 20 20  20 20 84 52 4e 45 20 20  | 2..%*    .RNE  |
00004880  20 39 2c 32 2c 23 25 31  30 30 20 20 20 20 20 20  | 9,2,#%100      |
00004890  20 20 20 20 20 5c 4d 6f  76 65 20 31 0d 02 26 2b  |     \Move 1..&+|
000048a0  20 20 20 20 42 49 43 45  51 20 20 20 39 2c 32 2c  |    BICEQ   9,2,|
000048b0  23 25 31 30 30 20 20 20  20 20 20 20 20 20 20 20  |#%100           |
000048c0  5c 4d 6f 76 65 20 30 0d  02 27 04 0d 02 28 3e 20  |\Move 0..'...(> |
000048d0  20 20 20 54 53 54 20 20  20 20 20 20 20 32 2c 23  |   TST       2,#|
000048e0  25 31 30 30 20 20 20 20  20 20 20 20 20 20 20 5c  |%100           \|
000048f0  4d 6f 76 65 20 52 39 20  62 69 74 20 32 20 74 6f  |Move R9 bit 2 to|
00004900  20 52 32 20 62 69 74 20  30 0d 02 29 2a 20 20 20  | R2 bit 0..)*   |
00004910  20 84 52 4e 45 20 20 20  32 2c 39 2c 23 25 30 30  | .RNE   2,9,#%00|
00004920  31 20 20 20 20 20 20 20  20 20 20 20 5c 4d 6f 76  |1           \Mov|
00004930  65 20 31 0d 02 2a 2b 20  20 20 20 42 49 43 45 51  |e 1..*+    BICEQ|
00004940  20 20 20 32 2c 39 2c 23  25 30 30 31 20 20 20 20  |   2,9,#%001    |
00004950  20 20 20 20 20 20 20 5c  4d 6f 76 65 20 30 0d 02  |       \Move 0..|
00004960  2b 04 0d 02 2c 23 20 20  20 20 4c 44 4d 46 44 20  |+...,#    LDMFD |
00004970  20 20 31 33 21 2c 7b 39  2c 31 30 2d 31 32 2c 4c  |  13!,{9,10-12,L|
00004980  4b 2c 50 43 7d 0d 02 2d  04 0d 02 2e 49 2e 52 65  |K,PC}..-....I.Re|
00004990  61 64 57 72 69 74 65 43  6d 6f 73 20 20 20 20 20  |adWriteCmos     |
000049a0  20 20 20 20 20 20 20 20  20 20 20 20 20 5c 52 65  |             \Re|
000049b0  61 64 57 72 69 74 65 43  6d 6f 73 20 76 31 2e 30  |adWriteCmos v1.0|
000049c0  30 20 2d 20 57 45 44 20  30 31 2f 30 33 2f 31 39  |0 - WED 01/03/19|
000049d0  39 35 0d 02 2f 55 20 20  20 20 53 54 4d 46 44 20  |95../U    STMFD |
000049e0  20 20 31 33 21 2c 7b 31  2c 33 2c 34 2c 4c 4b 7d  |  13!,{1,3,4,LK}|
000049f0  20 20 20 20 20 20 5c 50  72 65 73 65 72 76 65 20  |      \Preserve |
00004a00  72 65 67 69 73 74 65 72  73 20 61 73 20 70 65 72  |registers as per|
00004a10  20 73 70 65 63 20 66 6f  72 20 52 65 61 64 57 72  | spec for ReadWr|
00004a20  69 74 65 43 6d 6f 73 0d  02 30 04 0d 02 31 47 20  |iteCmos..0...1G |
00004a30  20 20 20 80 20 20 20 20  20 31 2c 31 2c 23 26 46  |   .     1,1,#&F|
00004a40  46 20 20 20 20 20 20 20  20 20 20 20 20 5c 45 6e  |F            \En|
00004a50  73 75 72 65 20 61 6c 6c  20 69 6e 70 75 74 20 64  |sure all input d|
00004a60  61 74 61 20 69 73 20 38  20 62 69 74 73 20 77 69  |ata is 8 bits wi|
00004a70  64 65 0d 02 32 16 20 20  20 20 80 20 20 20 20 20  |de..2.    .     |
00004a80  33 2c 33 2c 23 26 46 46  0d 02 33 16 20 20 20 20  |3,3,#&FF..3.    |
00004a90  80 20 20 20 20 20 34 2c  34 2c 23 26 46 46 0d 02  |.     4,4,#&FF..|
00004aa0  34 04 0d 02 35 45 20 20  20 20 4d 4f 56 20 20 20  |4...5E    MOV   |
00004ab0  20 20 30 2c 23 31 36 31  20 20 20 20 20 20 20 20  |  0,#161        |
00004ac0  20 20 20 20 20 20 5c 47  65 74 20 76 61 6c 75 65  |      \Get value|
00004ad0  20 66 72 6f 6d 20 43 4d  4f 53 20 52 41 4d 20 6c  | from CMOS RAM l|
00004ae0  6f 63 61 74 69 6f 6e 0d  02 36 1a 20 20 20 20 53  |ocation..6.    S|
00004af0  57 49 20 20 20 20 20 22  58 4f 53 5f 42 79 74 65  |WI     "XOS_Byte|
00004b00  22 0d 02 37 04 0d 02 38  6f 20 20 20 20 53 54 4d  |"..7...8o    STM|
00004b10  46 44 20 20 20 31 33 21  2c 7b 32 7d 20 20 20 20  |FD   13!,{2}    |
00004b20  20 20 20 20 20 20 20 20  20 5c 54 6f 20 62 65 20  |         \To be |
00004b30  72 65 6c 6f 61 64 65 64  20 69 6e 74 6f 20 52 30  |reloaded into R0|
00004b40  20 61 74 20 74 68 65 20  65 6e 64 2e 20 52 30 20  | at the end. R0 |
00004b50  3d 20 6f 6c 64 20 43 4d  4f 53 20 52 41 4d 20 63  |= old CMOS RAM c|
00004b60  6f 6e 74 65 6e 74 73 20  61 73 20 70 65 72 20 73  |ontents as per s|
00004b70  70 65 63 2e 0d 02 39 04  0d 02 3a 2f 20 20 20 20  |pec...9...:/    |
00004b80  43 4d 50 20 20 20 20 20  34 2c 23 30 20 20 20 20  |CMP     4,#0    |
00004b90  20 20 20 20 20 20 20 20  20 20 20 20 5c 49 73 20  |            \Is |
00004ba0  6d 61 73 6b 3d 30 3f 0d  02 3b 3d 20 20 20 20 42  |mask=0?..;=    B|
00004bb0  45 51 20 20 20 20 20 6e  57 72 69 74 65 43 4d 4f  |EQ     nWriteCMO|
00004bc0  53 20 20 20 20 20 20 20  20 20 20 5c 59 45 53 20  |S          \YES |
00004bd0  2d 20 61 6c 6c 20 64 6f  6e 65 2c 20 71 75 69 74  |- all done, quit|
00004be0  20 53 57 49 0d 02 3c 4b  20 20 20 20 20 20 20 20  | SWI..<K        |
00004bf0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004c00  20 20 20 20 20 20 20 20  5c 4e 4f 20 20 2d 20 70  |        \NO  - p|
00004c10  72 6f 63 65 73 73 20 61  6e 64 20 73 74 6f 72 65  |rocess and store|
00004c20  20 6e 65 77 20 43 4d 4f  53 20 76 61 6c 75 65 0d  | new CMOS value.|
00004c30  02 3d 1d 5c 50 45 52 46  4f 52 4d 20 f3 2f 57 52  |.=.\PERFORM ./WR|
00004c40  49 54 45 20 46 55 4e 43  54 49 4f 4e 0d 02 3e 46  |ITE FUNCTION..>F|
00004c50  20 20 20 20 80 20 20 20  20 20 33 2c 34 2c 33 20  |    .     3,4,3 |
00004c60  20 20 20 20 20 20 20 20  20 20 20 20 20 20 5c 53  |              \S|
00004c70  74 6f 72 65 20 28 52 33  20 80 20 52 34 29 20 69  |tore (R3 . R4) i|
00004c80  6e 20 77 6f 72 6b 69 6e  67 20 72 65 67 69 73 74  |n working regist|
00004c90  65 72 0d 02 3f 29 20 20  20 20 4d 56 4e 20 20 20  |er..?)    MVN   |
00004ca0  20 20 34 2c 34 20 20 20  20 20 20 20 20 20 20 20  |  4,4           |
00004cb0  20 20 20 20 20 20 5c ac  20 52 33 0d 02 40 36 20  |      \. R3..@6 |
00004cc0  20 20 20 80 20 20 20 20  20 32 2c 32 2c 34 20 20  |   .     2,2,4  |
00004cd0  20 20 20 20 20 20 20 20  20 20 20 20 20 5c 28 4f  |             \(O|
00004ce0  6c 64 42 75 74 74 6f 6e  73 20 80 20 ac 20 52 34  |ldButtons . . R4|
00004cf0  29 0d 02 41 43 20 20 20  20 84 52 20 20 20 20 20  |)..AC    .R     |
00004d00  32 2c 32 2c 33 20 20 20  20 20 20 20 20 20 20 20  |2,2,3           |
00004d10  20 20 20 20 5c 28 4f 6c  64 62 75 74 74 6f 6e 73  |    \(Oldbuttons|
00004d20  20 80 20 ac 20 52 34 29  20 84 20 28 52 33 20 80  | . . R4) . (R3 .|
00004d30  20 52 34 29 0d 02 42 04  0d 02 43 3c 20 20 20 20  | R4)..B...C<    |
00004d40  43 4d 50 20 20 20 20 20  30 2c 32 20 20 20 20 20  |CMP     0,2     |
00004d50  20 20 20 20 20 20 20 20  20 20 20 20 5c 49 73 20  |            \Is |
00004d60  6e 65 77 20 76 61 6c 75  65 3d 6f 6c 64 20 76 61  |new value=old va|
00004d70  6c 75 65 3f 0d 02 44 5a  20 20 20 20 4d 4f 56 4e  |lue?..DZ    MOVN|
00004d80  45 20 20 20 30 2c 23 31  36 32 20 20 20 20 20 20  |E   0,#162      |
00004d90  20 20 20 20 20 20 20 20  5c 59 45 53 20 2d 20 64  |        \YES - d|
00004da0  6f 20 6e 6f 74 20 77 72  69 74 65 20 74 6f 20 43  |o not write to C|
00004db0  4d 4f 53 20 52 41 4d 20  28 69 6d 70 72 6f 76 65  |MOS RAM (improve|
00004dc0  73 20 70 65 72 66 6f 72  6d 61 6e 63 65 29 0d 02  |s performance)..|
00004dd0  45 1b 20 20 20 20 4d 4f  56 4e 45 20 20 20 31 2c  |E.    MOVNE   1,|
00004de0  23 43 4d 4f 53 6c 6f 63  25 0d 02 46 1a 20 20 20  |#CMOSloc%..F.   |
00004df0  20 53 57 49 4e 45 20 20  20 22 58 4f 53 5f 42 79  | SWINE   "XOS_By|
00004e00  74 65 22 0d 02 47 04 0d  02 48 0f 2e 6e 57 72 69  |te"..G...H..nWri|
00004e10  74 65 43 4d 4f 53 0d 02  49 3f 20 20 20 20 4c 44  |teCMOS..I?    LD|
00004e20  4d 46 44 20 20 20 31 33  21 2c 7b 30 7d 20 20 20  |MFD   13!,{0}   |
00004e30  20 20 20 20 20 20 20 20  20 20 5c 52 30 20 3d 20  |          \R0 = |
00004e40  6f 6c 64 20 43 4d 4f 53  20 52 41 4d 20 63 6f 6e  |old CMOS RAM con|
00004e50  74 65 6e 74 73 0d 02 4a  1f 20 20 20 20 4c 44 4d  |tents..J.    LDM|
00004e60  46 44 20 20 20 31 33 21  2c 7b 31 2c 33 2c 34 2c  |FD   13!,{1,3,4,|
00004e70  50 43 7d 5e 0d 02 4b 04  0d 02 4c 1a 5c 57 4f 52  |PC}^..K...L.\WOR|
00004e80  4b 49 4e 47 20 dc 20 53  54 4f 52 45 44 20 48 45  |KING . STORED HE|
00004e90  52 45 0d 02 4d 46 2e 49  6e 74 65 72 63 65 70 74  |RE..MF.Intercept|
00004ea0  46 6c 61 67 20 20 20 20  20 20 20 20 20 20 20 20  |Flag            |
00004eb0  20 20 20 20 20 20 5c 30  3d 72 6f 75 74 69 6e 65  |      \0=routine|
00004ec0  20 6e 6f 74 20 65 6e 67  61 67 65 64 2c 20 2d 31  | not engaged, -1|
00004ed0  3d 65 6e 67 61 67 65 64  0d 02 4e 11 20 20 20 20  |=engaged..N.    |
00004ee0  45 51 55 44 20 20 20 20  30 0d 02 4f 53 2e 61 72  |EQUD    0..OS.ar|
00004ef0  67 73 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |gs              |
00004f00  20 20 20 20 20 20 20 20  20 20 20 20 20 5c 54 65  |             \Te|
00004f10  6d 70 6f 72 61 72 79 20  73 74 6f 72 65 20 66 6f  |mporary store fo|
00004f20  72 20 64 65 63 6f 64 65  64 20 61 72 67 75 6d 65  |r decoded argume|
00004f30  6e 74 20 70 61 72 61 6d  65 74 65 72 0d 02 50 11  |nt parameter..P.|
00004f40  20 20 20 20 45 51 55 44  20 20 20 20 30 0d 02 51  |    EQUD    0..Q|
00004f50  0c 2e 72 65 67 30 6f 6c  64 0d 02 52 11 20 20 20  |..reg0old..R.   |
00004f60  20 45 51 55 44 20 20 20  20 30 0d 02 53 09 2e 72  | EQUD    0..S..r|
00004f70  65 67 30 0d 02 54 11 20  20 20 20 45 51 55 44 20  |eg0..T.    EQUD |
00004f80  20 20 20 30 0d 02 55 09  2e 72 65 67 31 0d 02 56  |   0..U..reg1..V|
00004f90  11 20 20 20 20 45 51 55  44 20 20 20 20 30 0d 02  |.    EQUD    0..|
00004fa0  57 04 0d 02 58 2a 45 51  55 53 20 22 20 4d 69 67  |W...X*EQUS " Mig|
00004fb0  68 74 79 4d 6f 75 73 65  20 76 22 2b 76 65 72 73  |htyMouse v"+vers|
00004fc0  69 6f 6e 24 2b 22 20 41  57 41 58 22 0d 02 59 6c  |ion$+" AWAX"..Yl|
00004fd0  2e 43 6f 64 65 45 6e 64  20 20 20 20 20 20 20 20  |.CodeEnd        |
00004fe0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004ff0  5c 44 6f 20 6e 6f 74 20  70 75 74 20 61 6e 79 74  |\Do not put anyt|
00005000  68 69 6e 67 20 65 6c 73  65 20 61 66 74 65 72 20  |hing else after |
00005010  74 68 69 73 20 74 65 72  6d 69 6e 61 74 6f 72 2c  |this terminator,|
00005020  20 61 73 20 69 74 20 77  69 6c 6c 20 6e 6f 74 20  | as it will not |
00005030  62 65 20 73 61 76 65 64  0d 02 5a 05 5d 0d 02 5b  |be saved..Z.]..[|
00005040  05 ed 0d 02 5c 22 c8 99  20 22 4f 53 5f 4d 6f 64  |....\".. "OS_Mod|
00005050  75 6c 65 22 2c 31 31 2c  63 6f 64 65 2c 43 6f 64  |ule",11,code,Cod|
00005060  65 45 6e 64 0d 02 5d 21  f1 22 4d 6f 64 75 6c 65  |eEnd..]!."Module|
00005070  20 74 72 61 6e 73 66 65  72 72 65 64 20 74 6f 20  | transferred to |
00005080  52 4d 41 22 27 0d 02 5e  04 0d 02 5f 26 f1 22 4d  |RMA"'..^..._&."M|
00005090  6f 64 75 6c 65 20 6e 61  6d 65 3a 20 20 20 20 20  |odule name:     |
000050a0  20 20 20 22 4d 6f 64 75  6c 65 4e 61 6d 65 24 0d  |   "ModuleName$.|
000050b0  02 60 3a f1 22 4d 6f 64  75 6c 65 20 68 65 6c 70  |.`:."Module help|
000050c0  20 73 74 72 69 6e 67 3a  20 22 3b 3a c8 99 20 22  | string: ";:.. "|
000050d0  4f 53 5f 50 72 65 74 74  79 50 72 69 6e 74 22 2c  |OS_PrettyPrint",|
000050e0  63 6f 64 65 2b 68 65 6c  70 0d 02 61 23 f1 27 22  |code+help..a#.'"|
000050f0  4d 6f 64 75 6c 65 20 73  74 61 72 74 3a 20 20 20  |Module start:   |
00005100  20 20 20 20 26 22 3b 7e  63 6f 64 65 0d 02 62 2a  |    &";~code..b*|
00005110  f1 22 4d 6f 64 75 6c 65  20 65 6e 64 3a 20 20 20  |."Module end:   |
00005120  20 20 20 20 20 20 26 22  3b 7e 63 6f 64 65 2b 43  |      &";~code+C|
00005130  6f 64 65 45 6e 64 0d 02  63 2b f1 22 4d 6f 64 75  |odeEnd..c+."Modu|
00005140  6c 65 20 6c 65 6e 67 74  68 3a 20 20 20 20 20 20  |le length:      |
00005150  22 3b 43 6f 64 65 45 6e  64 22 20 62 79 74 65 73  |";CodeEnd" bytes|
00005160  22 0d 02 64 20 e7 20 73  61 76 65 3d a3 20 f1 27  |"..d . save=. .'|
00005170  22 4d 6f 64 75 6c 65 20  73 61 76 65 20 4f 46 46  |"Module save OFF|
00005180  22 0d 02 65 05 e1 0d 02  66 04 0d 02 67 0b dd 20  |"..e....f...g.. |
00005190  f2 73 61 76 65 0d 02 68  1d e7 20 73 61 76 65 20  |.save..h.. save |
000051a0  80 20 28 4f 70 74 4c 6f  20 80 20 25 31 30 30 29  |. (OptLo . %100)|
000051b0  20 8c 0d 02 69 2b 20 20  46 69 6c 65 4e 61 6d 65  | ...i+  FileName|
000051c0  24 3d 22 52 41 4d 3a 3a  52 61 6d 44 69 73 63 30  |$="RAM::RamDisc0|
000051d0  2e 24 2e 4d 69 74 79 4d  6f 75 73 65 22 0d 02 6a  |.$.MityMouse"..j|
000051e0  47 20 20 f1 27 22 50 72  65 73 73 20 61 20 6b 65  |G  .'"Press a ke|
000051f0  79 20 74 6f 20 73 61 76  65 20 6d 6f 64 75 6c 65  |y to save module|
00005200  20 61 73 20 27 22 46 69  6c 65 4e 61 6d 65 24 22  | as '"FileName$"|
00005210  27 20 45 73 63 61 70 65  20 74 6f 20 61 62 6f 72  |' Escape to abor|
00005220  74 2e 22 3b 0d 02 6b 0b  20 20 6b 65 79 3d a5 0d  |t.";..k.  key=..|
00005230  02 6c 07 20 20 f1 0d 02  6d 37 20 20 c8 99 20 22  |.l.  ...m7  .. "|
00005240  4f 53 5f 46 69 6c 65 22  2c 31 30 2c 46 69 6c 65  |OS_File",10,File|
00005250  4e 61 6d 65 24 2c 26 46  46 41 2c 2c 63 6f 64 65  |Name$,&FFA,,code|
00005260  2c 63 6f 64 65 2b 43 6f  64 65 45 6e 64 0d 02 6e  |,code+CodeEnd..n|
00005270  0e 20 20 f1 22 53 61 76  65 64 22 0d 02 6f 05 cd  |.  ."Saved"..o..|
00005280  0d 02 70 05 e1 0d ff                              |..p....|
00005287