Home » Recent acquisitions » Acorn ADFS disks » adfs_AcornUser_199609.adf » Regulars » StarInfo/Fletcher/Source`1,0

StarInfo/Fletcher/Source`1,0

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

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

Tape/disk: Home » Recent acquisitions » Acorn ADFS disks » adfs_AcornUser_199609.adf » Regulars
Filename: StarInfo/Fletcher/Source`1,0
Read OK:
File size: 1582 bytes
Load address: 0000
Exec address: 0000
File contents
In   -
Out  ExitOut
Type Module
Ver  1.00f

Pre
 `breakkey = 15
REM `breakkey = 14:REM For testing = scroll lock
 `lctrlkey = 59
 `rctrlkey = 97
End Pre

Define Workspace
 Name    Module
 Default r12
  `lctrl   !    Set if left ctrl pressed
  `rctrl   !    Set if right ctrl pressed
  `break   !    Set if break pressed
  `oldbrk  !    Old break type
End Workspace

Define Module
 Name      ExitOut
 Author    Justin Fletcher
 Init      initialise
 Final     finalise

 Commands
  Name     ExitOut
  Help     ...
           The ExitOut module was written for Richard Murray because it would
           appear that he wants a warning before he leaves the desktop via
           Ctrl-Break.|M
           Shift-Break is disabled; to restart, but not reboot, hold down
           Shift whilst agreeing to exit.
 End Commands

 Workspace *`len_Module
End Module

.message
   EQUZ    "Started 17 Feb 1996 - 00:58.10"
   EQUZ    "Finished 17 Feb 1996 -�02:07.40"
   EQUZ    "I think it works now :-)"

.initialise
   STMFD   (sp)!,{r0-r5,link}            ; Stack registers
   MOV     r0,#&10                       ; vector &10 ?
   ADR     r1,keyvector                  ; to be processed at newvector%
   MOV     r2,r12                        ; workspace
   SWI     "XOS_Claim"
   XSWI    "XOS_Byte",14,11              ; enable keypress vector
   XSWI    "XOS_Byte",247,%10101010,0    ; disable all break combinations
   STRW    r1,`oldbrk
   LDMFD   (sp)!,{r0-r5,pc}              ; Return from call

.finalise
   STMFD   (sp)!,{r0-r5,link}            ; Stack registers
   XSWI    "XOS_Byte",13,11              ; disable keypress vector
   MOV     r0,#&10
   ADR     r1,keyvector
   MOV     r2,r12
   SWI     "XOS_Release"                 ; release vector
   LDRW    r1,`oldbrk
   XSWI    "XOS_Byte",247,%10101010,0    ; restore break effect
   LDMFD   (sp)!,{r0-r5,pc}              ; Return from call

; process key transitions
; > r0=11
;   r1=0 if released, 1 if pressed
;   r2=key
.keyvector
   CMP     r0,#&B                        ; is this key transition ?
   MOVNE   pc,link                       ; no, exit
   STMFD   (sp)!,{r0-r5,link}            ; Stack registers
   MOV     r3,#0                         ; mark as not processed
   CMP     r2,#`breakkey                 ; is it break ?
   STRWEQ  r1,`break                      ; store in block
   MOVEQ   r3,#1                          ; mark as processed
   CMP     r2,#`lctrlkey                 ; is it left ctrl ?
   STRWEQ  r1,`lctrl                      ; store in block
   MOVEQ   r3,#1                          ; mark as processed
   CMP     r2,#`rctrlkey                 ; is it right ctrl ?
   STRWEQ  r1,`rctrl                      ; store in block
   MOVEQ   r3,#1                          ; mark as processed
   CMP     r3,#0                         ; are we free to exit ?
   BEQ     $exit                         ; if so return from call with flags

   LDRW    r0,`break                     ; get break pressed
   CMP     r0,#1                         ; is it pressed ?
   BNE     $exit                         ; if not, exit
   LDRW    r1,`lctrl                     ; get left ctrl pressed
   LDRW    r2,`rctrl                     ; get right ctrl pressed
   ADD     r1,r2,r1                      ; add together
   CMP     r1,#0                         ; is neither pressed ?
   BEQ     $exit                         ; if so, exit
   STMFD   (sp)!,{r8,r9}                 ; store r8 and 9
   MODE    +SVC                          ; switch to SVC mode stacking link
   ADR     r0,areyousure                 ; routine to call
   MOV     r1,r12                        ; pass r12 as workspace in r12
   SWI     "OS_AddCallBack"
   MODE    -SVC
   LDMFD   (sp)!,{r8,r9}                 ; restore regs 8 and 9

$exit
   LDMFD   (sp)!,{r0-r5,pc}              ; Return from call with flags

.areyousure
   STMFD   (sp)!,{r0-r5,r8,r9,link}      ; Stack registers
   MODE    +SVC                          ; ensure correct mode
   XSWI    "Wimp_ReadSysInfo",3          ; read desktop state
   CMP     r0,#1                         ; are we in the desktop ?
   BEQ     $desktopcheck                 ; if so, do in dialogue...
   ADR     r0,$message+2                 ; if not, ask politely
   SWI     "OS_Write0"                   ; write message
   SWI     "OS_Confirm"                  ; get mouse click
   SWI     "OS_WriteC"                   ; write the character
   SWI     "OS_NewLine"                  ; and a newline
   CMP     r0,#ASC("y")                  ; is it y ?
$back ; test
   BEQ     $reboot
   MODE    -SVC                          ; restore mode
   LDMFD   (sp)!,{r0-r5,r8,r9,pc}^       ; Return from call

$desktopcheck
   ADR     r0,$message                   ; pointer to error
   MOV     r1,#%11011                    ; no prompt, no prefix on title
   ADR     r2,$title                     ; title of window
   SWI     "Wimp_ReportError"            ; ask you nicely...
   CMP     r1,#1                         ; was OK (Continue) pressed ?
   B       $back                         ; return

$reboot
   XSWI    "XOS_Byte",200,3,0            ; set power on reset
   MOV     r0,#&03800000
   LDR     r1,[r0,#0]
   STR     r1,[r1,-r1]
   SWI     "XOS_EnterOS"
   TEQP    pc,#&FC000003
   MOV     pc,#0
   EQUS    "********"

$message
   EQUD    &0D0A0000                     ; error number, doubling as newline
   EQUZ    "Are you sure you want to exit this way ? "

$title
   EQUZA   "Reboot the computer"

#Post
#Run <CODE>
00000000  49 6e 20 20 20 2d 0a 4f  75 74 20 20 45 78 69 74  |In   -.Out  Exit|
00000010  4f 75 74 0a 54 79 70 65  20 4d 6f 64 75 6c 65 0a  |Out.Type Module.|
00000020  56 65 72 20 20 31 2e 30  30 66 0a 0a 50 72 65 0a  |Ver  1.00f..Pre.|
00000030  20 60 62 72 65 61 6b 6b  65 79 20 3d 20 31 35 0a  | `breakkey = 15.|
00000040  52 45 4d 20 60 62 72 65  61 6b 6b 65 79 20 3d 20  |REM `breakkey = |
00000050  31 34 3a 52 45 4d 20 46  6f 72 20 74 65 73 74 69  |14:REM For testi|
00000060  6e 67 20 3d 20 73 63 72  6f 6c 6c 20 6c 6f 63 6b  |ng = scroll lock|
00000070  0a 20 60 6c 63 74 72 6c  6b 65 79 20 3d 20 35 39  |. `lctrlkey = 59|
00000080  0a 20 60 72 63 74 72 6c  6b 65 79 20 3d 20 39 37  |. `rctrlkey = 97|
00000090  0a 45 6e 64 20 50 72 65  0a 0a 44 65 66 69 6e 65  |.End Pre..Define|
000000a0  20 57 6f 72 6b 73 70 61  63 65 0a 20 4e 61 6d 65  | Workspace. Name|
000000b0  20 20 20 20 4d 6f 64 75  6c 65 0a 20 44 65 66 61  |    Module. Defa|
000000c0  75 6c 74 20 72 31 32 0a  20 20 60 6c 63 74 72 6c  |ult r12.  `lctrl|
000000d0  20 20 20 21 20 20 20 20  53 65 74 20 69 66 20 6c  |   !    Set if l|
000000e0  65 66 74 20 63 74 72 6c  20 70 72 65 73 73 65 64  |eft ctrl pressed|
000000f0  0a 20 20 60 72 63 74 72  6c 20 20 20 21 20 20 20  |.  `rctrl   !   |
00000100  20 53 65 74 20 69 66 20  72 69 67 68 74 20 63 74  | Set if right ct|
00000110  72 6c 20 70 72 65 73 73  65 64 0a 20 20 60 62 72  |rl pressed.  `br|
00000120  65 61 6b 20 20 20 21 20  20 20 20 53 65 74 20 69  |eak   !    Set i|
00000130  66 20 62 72 65 61 6b 20  70 72 65 73 73 65 64 0a  |f break pressed.|
00000140  20 20 60 6f 6c 64 62 72  6b 20 20 21 20 20 20 20  |  `oldbrk  !    |
00000150  4f 6c 64 20 62 72 65 61  6b 20 74 79 70 65 0a 45  |Old break type.E|
00000160  6e 64 20 57 6f 72 6b 73  70 61 63 65 0a 0a 44 65  |nd Workspace..De|
00000170  66 69 6e 65 20 4d 6f 64  75 6c 65 0a 20 4e 61 6d  |fine Module. Nam|
00000180  65 20 20 20 20 20 20 45  78 69 74 4f 75 74 0a 20  |e      ExitOut. |
00000190  41 75 74 68 6f 72 20 20  20 20 4a 75 73 74 69 6e  |Author    Justin|
000001a0  20 46 6c 65 74 63 68 65  72 0a 20 49 6e 69 74 20  | Fletcher. Init |
000001b0  20 20 20 20 20 69 6e 69  74 69 61 6c 69 73 65 0a  |     initialise.|
000001c0  20 46 69 6e 61 6c 20 20  20 20 20 66 69 6e 61 6c  | Final     final|
000001d0  69 73 65 0a 0a 20 43 6f  6d 6d 61 6e 64 73 0a 20  |ise.. Commands. |
000001e0  20 4e 61 6d 65 20 20 20  20 20 45 78 69 74 4f 75  | Name     ExitOu|
000001f0  74 0a 20 20 48 65 6c 70  20 20 20 20 20 2e 2e 2e  |t.  Help     ...|
00000200  0a 20 20 20 20 20 20 20  20 20 20 20 54 68 65 20  |.           The |
00000210  45 78 69 74 4f 75 74 20  6d 6f 64 75 6c 65 20 77  |ExitOut module w|
00000220  61 73 20 77 72 69 74 74  65 6e 20 66 6f 72 20 52  |as written for R|
00000230  69 63 68 61 72 64 20 4d  75 72 72 61 79 20 62 65  |ichard Murray be|
00000240  63 61 75 73 65 20 69 74  20 77 6f 75 6c 64 0a 20  |cause it would. |
00000250  20 20 20 20 20 20 20 20  20 20 61 70 70 65 61 72  |          appear|
00000260  20 74 68 61 74 20 68 65  20 77 61 6e 74 73 20 61  | that he wants a|
00000270  20 77 61 72 6e 69 6e 67  20 62 65 66 6f 72 65 20  | warning before |
00000280  68 65 20 6c 65 61 76 65  73 20 74 68 65 20 64 65  |he leaves the de|
00000290  73 6b 74 6f 70 20 76 69  61 0a 20 20 20 20 20 20  |sktop via.      |
000002a0  20 20 20 20 20 43 74 72  6c 2d 42 72 65 61 6b 2e  |     Ctrl-Break.|
000002b0  7c 4d 0a 20 20 20 20 20  20 20 20 20 20 20 53 68  ||M.           Sh|
000002c0  69 66 74 2d 42 72 65 61  6b 20 69 73 20 64 69 73  |ift-Break is dis|
000002d0  61 62 6c 65 64 3b 20 74  6f 20 72 65 73 74 61 72  |abled; to restar|
000002e0  74 2c 20 62 75 74 20 6e  6f 74 20 72 65 62 6f 6f  |t, but not reboo|
000002f0  74 2c 20 68 6f 6c 64 20  64 6f 77 6e 0a 20 20 20  |t, hold down.   |
00000300  20 20 20 20 20 20 20 20  53 68 69 66 74 20 77 68  |        Shift wh|
00000310  69 6c 73 74 20 61 67 72  65 65 69 6e 67 20 74 6f  |ilst agreeing to|
00000320  20 65 78 69 74 2e 0a 20  45 6e 64 20 43 6f 6d 6d  | exit.. End Comm|
00000330  61 6e 64 73 0a 0a 20 57  6f 72 6b 73 70 61 63 65  |ands.. Workspace|
00000340  20 2a 60 6c 65 6e 5f 4d  6f 64 75 6c 65 0a 45 6e  | *`len_Module.En|
00000350  64 20 4d 6f 64 75 6c 65  0a 0a 2e 6d 65 73 73 61  |d Module...messa|
00000360  67 65 0a 20 20 20 45 51  55 5a 20 20 20 20 22 53  |ge.   EQUZ    "S|
00000370  74 61 72 74 65 64 20 31  37 20 46 65 62 20 31 39  |tarted 17 Feb 19|
00000380  39 36 20 2d 20 30 30 3a  35 38 2e 31 30 22 0a 20  |96 - 00:58.10". |
00000390  20 20 45 51 55 5a 20 20  20 20 22 46 69 6e 69 73  |  EQUZ    "Finis|
000003a0  68 65 64 20 31 37 20 46  65 62 20 31 39 39 36 20  |hed 17 Feb 1996 |
000003b0  2d a0 30 32 3a 30 37 2e  34 30 22 0a 20 20 20 45  |-.02:07.40".   E|
000003c0  51 55 5a 20 20 20 20 22  49 20 74 68 69 6e 6b 20  |QUZ    "I think |
000003d0  69 74 20 77 6f 72 6b 73  20 6e 6f 77 20 3a 2d 29  |it works now :-)|
000003e0  22 0a 0a 2e 69 6e 69 74  69 61 6c 69 73 65 0a 20  |"...initialise. |
000003f0  20 20 53 54 4d 46 44 20  20 20 28 73 70 29 21 2c  |  STMFD   (sp)!,|
00000400  7b 72 30 2d 72 35 2c 6c  69 6e 6b 7d 20 20 20 20  |{r0-r5,link}    |
00000410  20 20 20 20 20 20 20 20  3b 20 53 74 61 63 6b 20  |        ; Stack |
00000420  72 65 67 69 73 74 65 72  73 0a 20 20 20 4d 4f 56  |registers.   MOV|
00000430  20 20 20 20 20 72 30 2c  23 26 31 30 20 20 20 20  |     r0,#&10    |
00000440  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000450  20 20 20 3b 20 76 65 63  74 6f 72 20 26 31 30 20  |   ; vector &10 |
00000460  3f 0a 20 20 20 41 44 52  20 20 20 20 20 72 31 2c  |?.   ADR     r1,|
00000470  6b 65 79 76 65 63 74 6f  72 20 20 20 20 20 20 20  |keyvector       |
00000480  20 20 20 20 20 20 20 20  20 20 20 3b 20 74 6f 20  |           ; to |
00000490  62 65 20 70 72 6f 63 65  73 73 65 64 20 61 74 20  |be processed at |
000004a0  6e 65 77 76 65 63 74 6f  72 25 0a 20 20 20 4d 4f  |newvector%.   MO|
000004b0  56 20 20 20 20 20 72 32  2c 72 31 32 20 20 20 20  |V     r2,r12    |
000004c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000004d0  20 20 20 20 3b 20 77 6f  72 6b 73 70 61 63 65 0a  |    ; workspace.|
000004e0  20 20 20 53 57 49 20 20  20 20 20 22 58 4f 53 5f  |   SWI     "XOS_|
000004f0  43 6c 61 69 6d 22 0a 20  20 20 58 53 57 49 20 20  |Claim".   XSWI  |
00000500  20 20 22 58 4f 53 5f 42  79 74 65 22 2c 31 34 2c  |  "XOS_Byte",14,|
00000510  31 31 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |11              |
00000520  3b 20 65 6e 61 62 6c 65  20 6b 65 79 70 72 65 73  |; enable keypres|
00000530  73 20 76 65 63 74 6f 72  0a 20 20 20 58 53 57 49  |s vector.   XSWI|
00000540  20 20 20 20 22 58 4f 53  5f 42 79 74 65 22 2c 32  |    "XOS_Byte",2|
00000550  34 37 2c 25 31 30 31 30  31 30 31 30 2c 30 20 20  |47,%10101010,0  |
00000560  20 20 3b 20 64 69 73 61  62 6c 65 20 61 6c 6c 20  |  ; disable all |
00000570  62 72 65 61 6b 20 63 6f  6d 62 69 6e 61 74 69 6f  |break combinatio|
00000580  6e 73 0a 20 20 20 53 54  52 57 20 20 20 20 72 31  |ns.   STRW    r1|
00000590  2c 60 6f 6c 64 62 72 6b  0a 20 20 20 4c 44 4d 46  |,`oldbrk.   LDMF|
000005a0  44 20 20 20 28 73 70 29  21 2c 7b 72 30 2d 72 35  |D   (sp)!,{r0-r5|
000005b0  2c 70 63 7d 20 20 20 20  20 20 20 20 20 20 20 20  |,pc}            |
000005c0  20 20 3b 20 52 65 74 75  72 6e 20 66 72 6f 6d 20  |  ; Return from |
000005d0  63 61 6c 6c 0a 0a 2e 66  69 6e 61 6c 69 73 65 0a  |call...finalise.|
000005e0  20 20 20 53 54 4d 46 44  20 20 20 28 73 70 29 21  |   STMFD   (sp)!|
000005f0  2c 7b 72 30 2d 72 35 2c  6c 69 6e 6b 7d 20 20 20  |,{r0-r5,link}   |
00000600  20 20 20 20 20 20 20 20  20 3b 20 53 74 61 63 6b  |         ; Stack|
00000610  20 72 65 67 69 73 74 65  72 73 0a 20 20 20 58 53  | registers.   XS|
00000620  57 49 20 20 20 20 22 58  4f 53 5f 42 79 74 65 22  |WI    "XOS_Byte"|
00000630  2c 31 33 2c 31 31 20 20  20 20 20 20 20 20 20 20  |,13,11          |
00000640  20 20 20 20 3b 20 64 69  73 61 62 6c 65 20 6b 65  |    ; disable ke|
00000650  79 70 72 65 73 73 20 76  65 63 74 6f 72 0a 20 20  |ypress vector.  |
00000660  20 4d 4f 56 20 20 20 20  20 72 30 2c 23 26 31 30  | MOV     r0,#&10|
00000670  0a 20 20 20 41 44 52 20  20 20 20 20 72 31 2c 6b  |.   ADR     r1,k|
00000680  65 79 76 65 63 74 6f 72  0a 20 20 20 4d 4f 56 20  |eyvector.   MOV |
00000690  20 20 20 20 72 32 2c 72  31 32 0a 20 20 20 53 57  |    r2,r12.   SW|
000006a0  49 20 20 20 20 20 22 58  4f 53 5f 52 65 6c 65 61  |I     "XOS_Relea|
000006b0  73 65 22 20 20 20 20 20  20 20 20 20 20 20 20 20  |se"             |
000006c0  20 20 20 20 3b 20 72 65  6c 65 61 73 65 20 76 65  |    ; release ve|
000006d0  63 74 6f 72 0a 20 20 20  4c 44 52 57 20 20 20 20  |ctor.   LDRW    |
000006e0  72 31 2c 60 6f 6c 64 62  72 6b 0a 20 20 20 58 53  |r1,`oldbrk.   XS|
000006f0  57 49 20 20 20 20 22 58  4f 53 5f 42 79 74 65 22  |WI    "XOS_Byte"|
00000700  2c 32 34 37 2c 25 31 30  31 30 31 30 31 30 2c 30  |,247,%10101010,0|
00000710  20 20 20 20 3b 20 72 65  73 74 6f 72 65 20 62 72  |    ; restore br|
00000720  65 61 6b 20 65 66 66 65  63 74 0a 20 20 20 4c 44  |eak effect.   LD|
00000730  4d 46 44 20 20 20 28 73  70 29 21 2c 7b 72 30 2d  |MFD   (sp)!,{r0-|
00000740  72 35 2c 70 63 7d 20 20  20 20 20 20 20 20 20 20  |r5,pc}          |
00000750  20 20 20 20 3b 20 52 65  74 75 72 6e 20 66 72 6f  |    ; Return fro|
00000760  6d 20 63 61 6c 6c 0a 0a  3b 20 70 72 6f 63 65 73  |m call..; proces|
00000770  73 20 6b 65 79 20 74 72  61 6e 73 69 74 69 6f 6e  |s key transition|
00000780  73 0a 3b 20 3e 20 72 30  3d 31 31 0a 3b 20 20 20  |s.; > r0=11.;   |
00000790  72 31 3d 30 20 69 66 20  72 65 6c 65 61 73 65 64  |r1=0 if released|
000007a0  2c 20 31 20 69 66 20 70  72 65 73 73 65 64 0a 3b  |, 1 if pressed.;|
000007b0  20 20 20 72 32 3d 6b 65  79 0a 2e 6b 65 79 76 65  |   r2=key..keyve|
000007c0  63 74 6f 72 0a 20 20 20  43 4d 50 20 20 20 20 20  |ctor.   CMP     |
000007d0  72 30 2c 23 26 42 20 20  20 20 20 20 20 20 20 20  |r0,#&B          |
000007e0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
000007f0  69 73 20 74 68 69 73 20  6b 65 79 20 74 72 61 6e  |is this key tran|
00000800  73 69 74 69 6f 6e 20 3f  0a 20 20 20 4d 4f 56 4e  |sition ?.   MOVN|
00000810  45 20 20 20 70 63 2c 6c  69 6e 6b 20 20 20 20 20  |E   pc,link     |
00000820  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000830  20 20 3b 20 6e 6f 2c 20  65 78 69 74 0a 20 20 20  |  ; no, exit.   |
00000840  53 54 4d 46 44 20 20 20  28 73 70 29 21 2c 7b 72  |STMFD   (sp)!,{r|
00000850  30 2d 72 35 2c 6c 69 6e  6b 7d 20 20 20 20 20 20  |0-r5,link}      |
00000860  20 20 20 20 20 20 3b 20  53 74 61 63 6b 20 72 65  |      ; Stack re|
00000870  67 69 73 74 65 72 73 0a  20 20 20 4d 4f 56 20 20  |gisters.   MOV  |
00000880  20 20 20 72 33 2c 23 30  20 20 20 20 20 20 20 20  |   r3,#0        |
00000890  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000008a0  20 3b 20 6d 61 72 6b 20  61 73 20 6e 6f 74 20 70  | ; mark as not p|
000008b0  72 6f 63 65 73 73 65 64  0a 20 20 20 43 4d 50 20  |rocessed.   CMP |
000008c0  20 20 20 20 72 32 2c 23  60 62 72 65 61 6b 6b 65  |    r2,#`breakke|
000008d0  79 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |y               |
000008e0  20 20 3b 20 69 73 20 69  74 20 62 72 65 61 6b 20  |  ; is it break |
000008f0  3f 0a 20 20 20 53 54 52  57 45 51 20 20 72 31 2c  |?.   STRWEQ  r1,|
00000900  60 62 72 65 61 6b 20 20  20 20 20 20 20 20 20 20  |`break          |
00000910  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 73 74  |            ; st|
00000920  6f 72 65 20 69 6e 20 62  6c 6f 63 6b 0a 20 20 20  |ore in block.   |
00000930  4d 4f 56 45 51 20 20 20  72 33 2c 23 31 20 20 20  |MOVEQ   r3,#1   |
00000940  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000950  20 20 20 20 20 20 20 3b  20 6d 61 72 6b 20 61 73  |       ; mark as|
00000960  20 70 72 6f 63 65 73 73  65 64 0a 20 20 20 43 4d  | processed.   CM|
00000970  50 20 20 20 20 20 72 32  2c 23 60 6c 63 74 72 6c  |P     r2,#`lctrl|
00000980  6b 65 79 20 20 20 20 20  20 20 20 20 20 20 20 20  |key             |
00000990  20 20 20 20 3b 20 69 73  20 69 74 20 6c 65 66 74  |    ; is it left|
000009a0  20 63 74 72 6c 20 3f 0a  20 20 20 53 54 52 57 45  | ctrl ?.   STRWE|
000009b0  51 20 20 72 31 2c 60 6c  63 74 72 6c 20 20 20 20  |Q  r1,`lctrl    |
000009c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000009d0  20 20 3b 20 73 74 6f 72  65 20 69 6e 20 62 6c 6f  |  ; store in blo|
000009e0  63 6b 0a 20 20 20 4d 4f  56 45 51 20 20 20 72 33  |ck.   MOVEQ   r3|
000009f0  2c 23 31 20 20 20 20 20  20 20 20 20 20 20 20 20  |,#1             |
00000a00  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 6d  |             ; m|
00000a10  61 72 6b 20 61 73 20 70  72 6f 63 65 73 73 65 64  |ark as processed|
00000a20  0a 20 20 20 43 4d 50 20  20 20 20 20 72 32 2c 23  |.   CMP     r2,#|
00000a30  60 72 63 74 72 6c 6b 65  79 20 20 20 20 20 20 20  |`rctrlkey       |
00000a40  20 20 20 20 20 20 20 20  20 20 3b 20 69 73 20 69  |          ; is i|
00000a50  74 20 72 69 67 68 74 20  63 74 72 6c 20 3f 0a 20  |t right ctrl ?. |
00000a60  20 20 53 54 52 57 45 51  20 20 72 31 2c 60 72 63  |  STRWEQ  r1,`rc|
00000a70  74 72 6c 20 20 20 20 20  20 20 20 20 20 20 20 20  |trl             |
00000a80  20 20 20 20 20 20 20 20  20 3b 20 73 74 6f 72 65  |         ; store|
00000a90  20 69 6e 20 62 6c 6f 63  6b 0a 20 20 20 4d 4f 56  | in block.   MOV|
00000aa0  45 51 20 20 20 72 33 2c  23 31 20 20 20 20 20 20  |EQ   r3,#1      |
00000ab0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000ac0  20 20 20 20 3b 20 6d 61  72 6b 20 61 73 20 70 72  |    ; mark as pr|
00000ad0  6f 63 65 73 73 65 64 0a  20 20 20 43 4d 50 20 20  |ocessed.   CMP  |
00000ae0  20 20 20 72 33 2c 23 30  20 20 20 20 20 20 20 20  |   r3,#0        |
00000af0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000b00  20 3b 20 61 72 65 20 77  65 20 66 72 65 65 20 74  | ; are we free t|
00000b10  6f 20 65 78 69 74 20 3f  0a 20 20 20 42 45 51 20  |o exit ?.   BEQ |
00000b20  20 20 20 20 24 65 78 69  74 20 20 20 20 20 20 20  |    $exit       |
00000b30  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000b40  20 20 3b 20 69 66 20 73  6f 20 72 65 74 75 72 6e  |  ; if so return|
00000b50  20 66 72 6f 6d 20 63 61  6c 6c 20 77 69 74 68 20  | from call with |
00000b60  66 6c 61 67 73 0a 0a 20  20 20 4c 44 52 57 20 20  |flags..   LDRW  |
00000b70  20 20 72 30 2c 60 62 72  65 61 6b 20 20 20 20 20  |  r0,`break     |
00000b80  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000b90  3b 20 67 65 74 20 62 72  65 61 6b 20 70 72 65 73  |; get break pres|
00000ba0  73 65 64 0a 20 20 20 43  4d 50 20 20 20 20 20 72  |sed.   CMP     r|
00000bb0  30 2c 23 31 20 20 20 20  20 20 20 20 20 20 20 20  |0,#1            |
00000bc0  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 69  |             ; i|
00000bd0  73 20 69 74 20 70 72 65  73 73 65 64 20 3f 0a 20  |s it pressed ?. |
00000be0  20 20 42 4e 45 20 20 20  20 20 24 65 78 69 74 20  |  BNE     $exit |
00000bf0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000c00  20 20 20 20 20 20 20 20  3b 20 69 66 20 6e 6f 74  |        ; if not|
00000c10  2c 20 65 78 69 74 0a 20  20 20 4c 44 52 57 20 20  |, exit.   LDRW  |
00000c20  20 20 72 31 2c 60 6c 63  74 72 6c 20 20 20 20 20  |  r1,`lctrl     |
00000c30  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000c40  3b 20 67 65 74 20 6c 65  66 74 20 63 74 72 6c 20  |; get left ctrl |
00000c50  70 72 65 73 73 65 64 0a  20 20 20 4c 44 52 57 20  |pressed.   LDRW |
00000c60  20 20 20 72 32 2c 60 72  63 74 72 6c 20 20 20 20  |   r2,`rctrl    |
00000c70  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000c80  20 3b 20 67 65 74 20 72  69 67 68 74 20 63 74 72  | ; get right ctr|
00000c90  6c 20 70 72 65 73 73 65  64 0a 20 20 20 41 44 44  |l pressed.   ADD|
00000ca0  20 20 20 20 20 72 31 2c  72 32 2c 72 31 20 20 20  |     r1,r2,r1   |
00000cb0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000cc0  20 20 20 3b 20 61 64 64  20 74 6f 67 65 74 68 65  |   ; add togethe|
00000cd0  72 0a 20 20 20 43 4d 50  20 20 20 20 20 72 31 2c  |r.   CMP     r1,|
00000ce0  23 30 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |#0              |
00000cf0  20 20 20 20 20 20 20 20  20 20 20 3b 20 69 73 20  |           ; is |
00000d00  6e 65 69 74 68 65 72 20  70 72 65 73 73 65 64 20  |neither pressed |
00000d10  3f 0a 20 20 20 42 45 51  20 20 20 20 20 24 65 78  |?.   BEQ     $ex|
00000d20  69 74 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |it              |
00000d30  20 20 20 20 20 20 20 20  20 20 20 3b 20 69 66 20  |           ; if |
00000d40  73 6f 2c 20 65 78 69 74  0a 20 20 20 53 54 4d 46  |so, exit.   STMF|
00000d50  44 20 20 20 28 73 70 29  21 2c 7b 72 38 2c 72 39  |D   (sp)!,{r8,r9|
00000d60  7d 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |}               |
00000d70  20 20 3b 20 73 74 6f 72  65 20 72 38 20 61 6e 64  |  ; store r8 and|
00000d80  20 39 0a 20 20 20 4d 4f  44 45 20 20 20 20 2b 53  | 9.   MODE    +S|
00000d90  56 43 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |VC              |
00000da0  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 73 77  |            ; sw|
00000db0  69 74 63 68 20 74 6f 20  53 56 43 20 6d 6f 64 65  |itch to SVC mode|
00000dc0  20 73 74 61 63 6b 69 6e  67 20 6c 69 6e 6b 0a 20  | stacking link. |
00000dd0  20 20 41 44 52 20 20 20  20 20 72 30 2c 61 72 65  |  ADR     r0,are|
00000de0  79 6f 75 73 75 72 65 20  20 20 20 20 20 20 20 20  |yousure         |
00000df0  20 20 20 20 20 20 20 20  3b 20 72 6f 75 74 69 6e  |        ; routin|
00000e00  65 20 74 6f 20 63 61 6c  6c 0a 20 20 20 4d 4f 56  |e to call.   MOV|
00000e10  20 20 20 20 20 72 31 2c  72 31 32 20 20 20 20 20  |     r1,r12     |
00000e20  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000e30  20 20 20 3b 20 70 61 73  73 20 72 31 32 20 61 73  |   ; pass r12 as|
00000e40  20 77 6f 72 6b 73 70 61  63 65 20 69 6e 20 72 31  | workspace in r1|
00000e50  32 0a 20 20 20 53 57 49  20 20 20 20 20 22 4f 53  |2.   SWI     "OS|
00000e60  5f 41 64 64 43 61 6c 6c  42 61 63 6b 22 0a 20 20  |_AddCallBack".  |
00000e70  20 4d 4f 44 45 20 20 20  20 2d 53 56 43 0a 20 20  | MODE    -SVC.  |
00000e80  20 4c 44 4d 46 44 20 20  20 28 73 70 29 21 2c 7b  | LDMFD   (sp)!,{|
00000e90  72 38 2c 72 39 7d 20 20  20 20 20 20 20 20 20 20  |r8,r9}          |
00000ea0  20 20 20 20 20 20 20 3b  20 72 65 73 74 6f 72 65  |       ; restore|
00000eb0  20 72 65 67 73 20 38 20  61 6e 64 20 39 0a 0a 24  | regs 8 and 9..$|
00000ec0  65 78 69 74 0a 20 20 20  4c 44 4d 46 44 20 20 20  |exit.   LDMFD   |
00000ed0  28 73 70 29 21 2c 7b 72  30 2d 72 35 2c 70 63 7d  |(sp)!,{r0-r5,pc}|
00000ee0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
00000ef0  52 65 74 75 72 6e 20 66  72 6f 6d 20 63 61 6c 6c  |Return from call|
00000f00  20 77 69 74 68 20 66 6c  61 67 73 0a 0a 2e 61 72  | with flags...ar|
00000f10  65 79 6f 75 73 75 72 65  0a 20 20 20 53 54 4d 46  |eyousure.   STMF|
00000f20  44 20 20 20 28 73 70 29  21 2c 7b 72 30 2d 72 35  |D   (sp)!,{r0-r5|
00000f30  2c 72 38 2c 72 39 2c 6c  69 6e 6b 7d 20 20 20 20  |,r8,r9,link}    |
00000f40  20 20 3b 20 53 74 61 63  6b 20 72 65 67 69 73 74  |  ; Stack regist|
00000f50  65 72 73 0a 20 20 20 4d  4f 44 45 20 20 20 20 2b  |ers.   MODE    +|
00000f60  53 56 43 20 20 20 20 20  20 20 20 20 20 20 20 20  |SVC             |
00000f70  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 65  |             ; e|
00000f80  6e 73 75 72 65 20 63 6f  72 72 65 63 74 20 6d 6f  |nsure correct mo|
00000f90  64 65 0a 20 20 20 58 53  57 49 20 20 20 20 22 57  |de.   XSWI    "W|
00000fa0  69 6d 70 5f 52 65 61 64  53 79 73 49 6e 66 6f 22  |imp_ReadSysInfo"|
00000fb0  2c 33 20 20 20 20 20 20  20 20 20 20 3b 20 72 65  |,3          ; re|
00000fc0  61 64 20 64 65 73 6b 74  6f 70 20 73 74 61 74 65  |ad desktop state|
00000fd0  0a 20 20 20 43 4d 50 20  20 20 20 20 72 30 2c 23  |.   CMP     r0,#|
00000fe0  31 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |1               |
00000ff0  20 20 20 20 20 20 20 20  20 20 3b 20 61 72 65 20  |          ; are |
00001000  77 65 20 69 6e 20 74 68  65 20 64 65 73 6b 74 6f  |we in the deskto|
00001010  70 20 3f 0a 20 20 20 42  45 51 20 20 20 20 20 24  |p ?.   BEQ     $|
00001020  64 65 73 6b 74 6f 70 63  68 65 63 6b 20 20 20 20  |desktopcheck    |
00001030  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 69  |             ; i|
00001040  66 20 73 6f 2c 20 64 6f  20 69 6e 20 64 69 61 6c  |f so, do in dial|
00001050  6f 67 75 65 2e 2e 2e 0a  20 20 20 41 44 52 20 20  |ogue....   ADR  |
00001060  20 20 20 72 30 2c 24 6d  65 73 73 61 67 65 2b 32  |   r0,$message+2|
00001070  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001080  20 3b 20 69 66 20 6e 6f  74 2c 20 61 73 6b 20 70  | ; if not, ask p|
00001090  6f 6c 69 74 65 6c 79 0a  20 20 20 53 57 49 20 20  |olitely.   SWI  |
000010a0  20 20 20 22 4f 53 5f 57  72 69 74 65 30 22 20 20  |   "OS_Write0"  |
000010b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000010c0  20 3b 20 77 72 69 74 65  20 6d 65 73 73 61 67 65  | ; write message|
000010d0  0a 20 20 20 53 57 49 20  20 20 20 20 22 4f 53 5f  |.   SWI     "OS_|
000010e0  43 6f 6e 66 69 72 6d 22  20 20 20 20 20 20 20 20  |Confirm"        |
000010f0  20 20 20 20 20 20 20 20  20 20 3b 20 67 65 74 20  |          ; get |
00001100  6d 6f 75 73 65 20 63 6c  69 63 6b 0a 20 20 20 53  |mouse click.   S|
00001110  57 49 20 20 20 20 20 22  4f 53 5f 57 72 69 74 65  |WI     "OS_Write|
00001120  43 22 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |C"              |
00001130  20 20 20 20 20 3b 20 77  72 69 74 65 20 74 68 65  |     ; write the|
00001140  20 63 68 61 72 61 63 74  65 72 0a 20 20 20 53 57  | character.   SW|
00001150  49 20 20 20 20 20 22 4f  53 5f 4e 65 77 4c 69 6e  |I     "OS_NewLin|
00001160  65 22 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |e"              |
00001170  20 20 20 20 3b 20 61 6e  64 20 61 20 6e 65 77 6c  |    ; and a newl|
00001180  69 6e 65 0a 20 20 20 43  4d 50 20 20 20 20 20 72  |ine.   CMP     r|
00001190  30 2c 23 41 53 43 28 22  79 22 29 20 20 20 20 20  |0,#ASC("y")     |
000011a0  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 69  |             ; i|
000011b0  73 20 69 74 20 79 20 3f  0a 24 62 61 63 6b 20 3b  |s it y ?.$back ;|
000011c0  20 74 65 73 74 0a 20 20  20 42 45 51 20 20 20 20  | test.   BEQ    |
000011d0  20 24 72 65 62 6f 6f 74  0a 20 20 20 4d 4f 44 45  | $reboot.   MODE|
000011e0  20 20 20 20 2d 53 56 43  20 20 20 20 20 20 20 20  |    -SVC        |
000011f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001200  20 20 3b 20 72 65 73 74  6f 72 65 20 6d 6f 64 65  |  ; restore mode|
00001210  0a 20 20 20 4c 44 4d 46  44 20 20 20 28 73 70 29  |.   LDMFD   (sp)|
00001220  21 2c 7b 72 30 2d 72 35  2c 72 38 2c 72 39 2c 70  |!,{r0-r5,r8,r9,p|
00001230  63 7d 5e 20 20 20 20 20  20 20 3b 20 52 65 74 75  |c}^       ; Retu|
00001240  72 6e 20 66 72 6f 6d 20  63 61 6c 6c 0a 0a 24 64  |rn from call..$d|
00001250  65 73 6b 74 6f 70 63 68  65 63 6b 0a 20 20 20 41  |esktopcheck.   A|
00001260  44 52 20 20 20 20 20 72  30 2c 24 6d 65 73 73 61  |DR     r0,$messa|
00001270  67 65 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |ge              |
00001280  20 20 20 20 20 3b 20 70  6f 69 6e 74 65 72 20 74  |     ; pointer t|
00001290  6f 20 65 72 72 6f 72 0a  20 20 20 4d 4f 56 20 20  |o error.   MOV  |
000012a0  20 20 20 72 31 2c 23 25  31 31 30 31 31 20 20 20  |   r1,#%11011   |
000012b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000012c0  20 3b 20 6e 6f 20 70 72  6f 6d 70 74 2c 20 6e 6f  | ; no prompt, no|
000012d0  20 70 72 65 66 69 78 20  6f 6e 20 74 69 74 6c 65  | prefix on title|
000012e0  0a 20 20 20 41 44 52 20  20 20 20 20 72 32 2c 24  |.   ADR     r2,$|
000012f0  74 69 74 6c 65 20 20 20  20 20 20 20 20 20 20 20  |title           |
00001300  20 20 20 20 20 20 20 20  20 20 3b 20 74 69 74 6c  |          ; titl|
00001310  65 20 6f 66 20 77 69 6e  64 6f 77 0a 20 20 20 53  |e of window.   S|
00001320  57 49 20 20 20 20 20 22  57 69 6d 70 5f 52 65 70  |WI     "Wimp_Rep|
00001330  6f 72 74 45 72 72 6f 72  22 20 20 20 20 20 20 20  |ortError"       |
00001340  20 20 20 20 20 3b 20 61  73 6b 20 79 6f 75 20 6e  |     ; ask you n|
00001350  69 63 65 6c 79 2e 2e 2e  0a 20 20 20 43 4d 50 20  |icely....   CMP |
00001360  20 20 20 20 72 31 2c 23  31 20 20 20 20 20 20 20  |    r1,#1       |
00001370  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001380  20 20 3b 20 77 61 73 20  4f 4b 20 28 43 6f 6e 74  |  ; was OK (Cont|
00001390  69 6e 75 65 29 20 70 72  65 73 73 65 64 20 3f 0a  |inue) pressed ?.|
000013a0  20 20 20 42 20 20 20 20  20 20 20 24 62 61 63 6b  |   B       $back|
000013b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000013c0  20 20 20 20 20 20 20 20  20 3b 20 72 65 74 75 72  |         ; retur|
000013d0  6e 0a 0a 24 72 65 62 6f  6f 74 0a 20 20 20 58 53  |n..$reboot.   XS|
000013e0  57 49 20 20 20 20 22 58  4f 53 5f 42 79 74 65 22  |WI    "XOS_Byte"|
000013f0  2c 32 30 30 2c 33 2c 30  20 20 20 20 20 20 20 20  |,200,3,0        |
00001400  20 20 20 20 3b 20 73 65  74 20 70 6f 77 65 72 20  |    ; set power |
00001410  6f 6e 20 72 65 73 65 74  0a 20 20 20 4d 4f 56 20  |on reset.   MOV |
00001420  20 20 20 20 72 30 2c 23  26 30 33 38 30 30 30 30  |    r0,#&0380000|
00001430  30 0a 20 20 20 4c 44 52  20 20 20 20 20 72 31 2c  |0.   LDR     r1,|
00001440  5b 72 30 2c 23 30 5d 0a  20 20 20 53 54 52 20 20  |[r0,#0].   STR  |
00001450  20 20 20 72 31 2c 5b 72  31 2c 2d 72 31 5d 0a 20  |   r1,[r1,-r1]. |
00001460  20 20 53 57 49 20 20 20  20 20 22 58 4f 53 5f 45  |  SWI     "XOS_E|
00001470  6e 74 65 72 4f 53 22 0a  20 20 20 54 45 51 50 20  |nterOS".   TEQP |
00001480  20 20 20 70 63 2c 23 26  46 43 30 30 30 30 30 33  |   pc,#&FC000003|
00001490  0a 20 20 20 4d 4f 56 20  20 20 20 20 70 63 2c 23  |.   MOV     pc,#|
000014a0  30 0a 20 20 20 45 51 55  53 20 20 20 20 22 2a 2a  |0.   EQUS    "**|
000014b0  2a 2a 2a 2a 2a 2a 22 0a  0a 24 6d 65 73 73 61 67  |******"..$messag|
000014c0  65 0a 20 20 20 45 51 55  44 20 20 20 20 26 30 44  |e.   EQUD    &0D|
000014d0  30 41 30 30 30 30 20 20  20 20 20 20 20 20 20 20  |0A0000          |
000014e0  20 20 20 20 20 20 20 20  20 20 20 3b 20 65 72 72  |           ; err|
000014f0  6f 72 20 6e 75 6d 62 65  72 2c 20 64 6f 75 62 6c  |or number, doubl|
00001500  69 6e 67 20 61 73 20 6e  65 77 6c 69 6e 65 0a 20  |ing as newline. |
00001510  20 20 45 51 55 5a 20 20  20 20 22 41 72 65 20 79  |  EQUZ    "Are y|
00001520  6f 75 20 73 75 72 65 20  79 6f 75 20 77 61 6e 74  |ou sure you want|
00001530  20 74 6f 20 65 78 69 74  20 74 68 69 73 20 77 61  | to exit this wa|
00001540  79 20 3f 20 22 0a 0a 24  74 69 74 6c 65 0a 20 20  |y ? "..$title.  |
00001550  20 45 51 55 5a 41 20 20  20 22 52 65 62 6f 6f 74  | EQUZA   "Reboot|
00001560  20 74 68 65 20 63 6f 6d  70 75 74 65 72 22 0a 0a  | the computer"..|
00001570  23 50 6f 73 74 0a 23 52  75 6e 20 3c 43 4f 44 45  |#Post.#Run <CODE|
00001580  3e 0a                                             |>.|
00001582