Home » Archimedes archive » Acorn User » AU 1998-03 B.adf » StarInfo » Fletcher/Source`1,0

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 » Archimedes archive » Acorn User » AU 1998-03 B.adf » StarInfo
Filename: Fletcher/Source`1,0
Read OK:
File size: 6C00 bytes
Load address: 0000
Exec address: 0000
File contents
In   -
Out  EE
Type Absolute
Ver  1.00j

Pre
 S_None=0:REM We're outside the states !
 S_AwaitAck=1:REM Awaiting acknowledgement of EE
 S_AwaitSaveAck=2:REM Awaiting a save ack
 S_AwaitLoadAck=3:REM Awaiting a load ack (also 'middle' state)
 S_AwaitESave=4:REM Awaiting an EditDataSave
 S_AwaitLoad=5:REM Awaiting a DataLoad
 S_SendReturn=8:REM Request from application to return data
 S_SendAbort=9:REM Request from application to abort
 TW_Morite=&808C4:REM Sent to task to kill it
 TW_Input=&808C0:REM Sent to give keypresses to it
 DataSaveAck=2:REM Save ok
 DataLoad=3:REM Load this
 DataLoadAck=4:REM Loaded ok
 Ret_None=&1000:REM Result = Not returning yet (if returned is an error)
 Ret_Updated=0:REM Result = 'updated'     (ok)
 Ret_Unchanged=1:REM Result = 'unchanged' (ok)
 Ret_Failed=2:REM Result = 'failed' ;-(   (error)
 Ret_Killed=3:REM Result = 'killed' ;-(   (error)
End Pre

#Rem Off
.start
   SWI     "OS_GetEnv"                   ; read cli/stack
   MOV     r13,r1                        ; there's our stack
$cliloop
   LDRB    r2,[r0,#1]!                   ; read byte and inc
   CMP     r2,#32                        ; is it < space ?
   BGT     $cliloop                      ; go around again
   BEQ     $notnull                      ; not a null cli
$syntax
   SWI     "OS_WriteS"                   ; write this string
   EQUZA   "Syntax: *EE [-t <type>] <filename>"
   SWI     "OS_NewLine"
   SWI     "OS_Exit"                     ; retrun
$notnull
   MVN     r7,#NOT -1                    ; -1 means read filetype
   LDRB    r2,[r0,#1]!                   ; read byte and inc
   CMP     r2,#ASC("-")                  ; is it - ?
   BNE     $notaminus                    ; nope, so skip
   LDRB    r2,[r0,#1]!                   ; read byte and inc
   CMP     r2,#32                        ; is it space (for '- <filename>')
   BEQ     $notaminus
   CMP     r2,#ASC("t")                  ; is it '-t' ?
   CMPNE   r2,#ASC("T")                  ; or '-T' ?
   BNE     $syntax                       ; nope, syntax error
   ADD     r1,r0,#1                      ; r1-> string
   REM     "String (for num) = %$1"
   LMOV    r0,#16+(1<<31)
   XSWI    "OS_ReadUnsigned"             ; read number
   MOV     r7,r2                         ; r6 = filetype
   REM     "Treating as type %&6"
   LDRB    r0,[r1]                       ; read a byte
   CMP     r0,#32                        ; is it space ?
   BLT     $syntax                       ; if ctrl, error...
   ADD     r0,r1,#1                      ; r0-> rest of string
$notaminus
   REM     "Filename = %$0"
   LADR    r1,`static_filename           ; address of our buffer
   BL      strcpy                        ; copy it there
   XSWI    "OS_File",20                  ; get the info for it
   CMP     r0,#0                         ; was it 'not found' ?
   BNE     $gottype                      ; if not, it's ok
   SWI     "OS_WriteS"
   EQUZA   "File not found; edit abandoned"
   SWI     "OS_NewLine"
   SWI     "OS_Exit"                     ; and return
$gottype
   CMN     r7,#1                         ; if -1, then we use the type given
   MOVEQ   r7,r6                         ; edit filetype = real filetype
   STR     r7,`filetype                  ; store filetype
   STR     r6,`oldtype                   ; the original type (to restore)
   XSWI    "OS_Byte",229,1,0             ; disable escape
   STR     r1,`oldescape                 ; store the escape state
$restart
   LDR     r1,$`TASK                     ; the 'TASK' word
   XSWI    "XWimp_Initialise",200,,^$`name ; initialise us as a task
   MOVVS   r0,#0                         ; if error, task handle = 0
   STR     r0,`taskhandle                ; store handle
   MOV     r1,r0                         ; hang on to the handley thing
; check taskwindow
   SWI     "TaskWindow_TaskInfo"         ; are we in a task ?
   CMP     r0,#0                         ; well?
   MOVNE   r0,#1                         ; marks us as a taskwindow
   CMP     r0,#0                         ; are we outside taskwindow ?
   CMPEQ   r1,#0                         ; and did the init fail ?
   BNE     $notatshellcli
   SWI     "XWimp_CloseDown"             ; close us down
   B       $restart
$notatshellcli
   STR     r0,`intaskwindow              ; mark it
   REM     "Taskwindow: %r0"
   BL      addfilter                     ; add our filter
   REM     "Filter added"
   BL      ee_initiate                   ; start the first ee
   REM     "Initiated EE"
   LDR     r0,`intaskwindow
   CMP     r0,#0                         ; are we in taskwindow ?
   BEQ     $notintw                      ; nope, so jump out
   REMP    "Press R to return data, A to abort"
$waitloop
; check state
   LDR     r0,`returnstate               ; read return state
   CMP     r0,#Ret_None                  ; is it 'none' ?
   BNE     taskend                       ; if not, exit
; now check keys
   XSWI    "XOS_Byte",&81,25,0           ; read a character (25cs)
   CMP     r2,#255                       ; was it valid ?
   BEQ     $waitloop                     ; nope, so try again

   CMP     r1,#ASC("R")                  ; was it 'r' to return ?
   CMPNE   r1,#ASC("r")
   MOVEQ   r0,#S_SendReturn              ; let's return
   STREQ   r0,`filterstate               ; store it as the state

   CMP     r1,#ASC("A")                  ; was it 'a' to abort ?
   CMPNE   r1,#ASC("a")
   CMPNE   r1,#27                        ; or escape?
   MOVEQ   r0,#S_SendAbort               ; let's abort
   STREQ   r0,`filterstate               ; store it as the state

   B       $waitloop                     ; go again

; not in a taskwindow
$notintw
   REM     "Non-taskwindow poll"
$pollloop
; check state
   LDR     r0,`returnstate               ; read return state
   CMP     r0,#Ret_None                  ; is it 'none' ?
   BNE     taskend                       ; if not, exit
; now poll
   ADR     r1,`blk                       ; address of our block
   XSWI    "Wimp_Poll",0                 ; poll the wimp
   ADR     link,$pollloop                ; where to return to
   CMP     r0,#17                        ; is it usermessage?
   CMPNE   r0,#18                        ; or usermessagerecorded?
   LDREQ   r0,[r1,#16]                   ; read message type
   CMPEQ   r0,#0                         ; is it 'quit' ?
   MOVEQ   r0,#Ret_Killed                ; mark us as killed
   STREQ   r0,`returnstate               ; store as returnstate
   BEQ     taskend                       ; if so, end nicely
   B       $pollloop                     ; jump back to poll again

$`TASK
   EQUS    "TASK"                        ; word 'task'
$`name
   EQUZA   "EE-Task"

>taskend
   BL      removefilter                  ; remove the filter
   LDR     r0,`taskhandle                ; read the taskhandle
   CMP     r0,#0                         ; was it valid ?
   SWINE   "Wimp_CloseDown"              ; yep, so shut us down
   LDR     r1,`oldescape                 ; read old escape state
   XSWI    "OS_Byte",229,,0              ; restore it
   LDR     r2,`returnstate               ; read the return code
   REM     "Exiting... code = %r2"
   REM     ""
   CMP     r2,#Ret_Failed                ; did it fail ?
   CMPNE   r2,#Ret_Killed                ; or was it killed ?
   BNE     $exit
   SWI     "OS_WriteS"
   EQUZA   "External edit failed"
   SWI     "OS_NewLine"
$exit
   SWI     "OS_Exit"                     ; return to top level

.`oldescape
   EQUD    0                             ; old escape state
.`taskhandle
   EQUD    0                             ; task handle, or 0 if 'inside' task
.`realtaskhandle
   EQUD    0                             ; real task handle
.`intaskwindow
   EQUD    0                             ; 1 if we're in a taskwindow
.`filteraddr
   EQUD    0                             ; address of filtermanager code

>addfilter
   STMFD   (sp)!,{r0-r5,link}            ; Stack registers
   MOV     r0,#Ret_None                  ; make sure we can do multiple ee's
   STR     r0,`returnstate               ; store as return state
   XSWI    "XWimp_AddMessages",^`ee_msgs ; add the messages we need
   XSWI    "Wimp_ReadSysInfo",5          ; read task handle
   STR     r0,`realtaskhandle            ; store real task handle
   MOV     r3,r0                         ; r3 = task handle
   LADR    r0,`filtername                ; filter name
   BL      strdup                        ; copy it to the module area
   STR     r0,`filtername_ptr            ; store it for later
   LADR    r1,filter                     ; filter code
   XSWI    "Filter_RegisterPostFilter",,,0,,0 ; install it
   LDMFD   (sp)!,{r0-r5,pc}              ; Return from call

>removefilter
   STMFD   (sp)!,{r0-r5,link}            ; Stack registers
   XSWI    "Wimp_ReadSysInfo",5          ; read task handle
   MOV     r3,r0                         ; r3 = task handle
   LDR     r0,`filtername_ptr            ; filter name pointer
   CMP     r0,#0                         ; is it 0 ?
   BEQ     $exit                         ; if so, we've already released
   LADR    r1,filter
   XSWI    "Filter_DeRegisterPostFilter",,,0,,0 ; remove
   BL      release                       ; release the filtername block
   MOV     r0,#0
   STR     r0,`filtername_ptr            ; zero the name pointer
$exit
   LDMFD   (sp)!,{r0-r5,pc}              ; Return from call

.`blk
   RES     256                           ; just a few bytes

>ee_initiate
   STMFD   (sp)!,{r0-r5,link}            ; Stack registers
   ADR     r5,`blk                       ; the block base
   LDR     r0,`editname                  ; the name for the editor
   BL      strlen                        ; find len to r1
   ADD     r1,r1,#52+3+1                 ; 52 for base, 3 to align, 1 term
   BIC     r1,r1,#3                      ; align
   STR     r1,[r5,#0]                    ; store as block length
   LDR     r3,`ee_editrq
   STR     r3,[r5,#16]                   ; store as message
   ADD     r1,r5,#52                     ; r1-> block + 52
   BL      strcpy                        ; copy edit name there
   LDR     r0,`parent                    ; read -> parent name
   ADD     r1,r5,#32                     ; r1-> block + 32
   BL      strcpy                        ; copy parent name there
   LDR     r0,`filetype                  ; filetype
   STR     r0,[r5,#20]                   ; store as datatype
   SWI     "OS_ReadMonotonicTime"
   BIC     r0,r0,#&FF000000              ; clear top bits
   BIC     r0,r0,#&00FF0000              ; clear top-mid bits
   STR     r0,[r5,#24]                   ; store as job handle
   MOV     r0,#0                         ; just edit and return on save
   STR     r0,[r5,#28]                   ; store as flags
   STR     r0,[r5,#12]                   ; store as ourref
   XSWI    "Wimp_SendMessage",18,^`blk,0 ; broadcast recorded
; set new state
   MOV     r0,#S_AwaitAck                ; awaiting 'ack' message
   STR     r0,`filterstate               ; store it
   LDMFD   (sp)!,{r0-r5,pc}              ; Return from call

.`parent
   EQUD    `static_parent
.`editname
   EQUD    `static_editname
.`filename
   EQUD    `static_filename
.`filetype
   EQUD    &FFF                          ; text file
.`oldtype
   EQUD    &FFF                          ; it's original type
.`tempname
   EQUZ    "<Wimp$Scrap>"

.`static_editname
   EQUZ    "Edit"
.`static_filename
   RES     256                           ; reserve some room
.`static_parent
   EQUZA   "EETask"

; Messages we /need/�to receive to work properly
.`ee_msgs
   EQUD    2                             ; datasaveack (for returns)
   EQUD    3                             ; dataload (for sends)
   EQUD    4                             ; dataloadack (for returns)
.`ee_editrq
   EQUD    &45d80                        ; Message_EditRq
.`ee_editack
   EQUD    &45d81                        ; Message_EditAck
.`ee_return
   EQUD    &45d82                        ; Message_EditReturn
.`ee_abort
   EQUD    &45d83                        ; Message_EditAbort
.`ee_datasave
   EQUD    &45d84                        ; Message_EditDataSave
; end of list
   EQUD    0

.`ee_jobhandle
   EQUD    0                             ; the job handle
.`ee_taskhandle
   EQUD    0                             ; their task handle

.`filtername_ptr
   EQUD    0                             ; name pointer (for release)
.`filterstate
   EQUD    0                             ; the state of the filter manager
.`returnstate
   EQUD    Ret_None                      ; the state we're returning
.`filtername
   EQUZA   "ExternalEdit filter"

; abort the edit
>ee_abort
   STMFD   (sp)!,{r0-r5,link}            ; Stack registers
   REM     "Sending abort message"
   ADR     r5,`blk                       ; our workspace
   MOV     r0,#28                        ; length of message
   STR     r0,[r5,#0]                    ; store len
   MOV     r0,#0
   STR     r0,[r5,#20]                   ; store 0 value
   LDR     r0,`ee_jobhandle
   STR     r0,[r5,#24]                   ; store job handle
   LDR     r0,`ee_abort                  ; edit abort
   STR     r0,[r5,#16]                   ; store it
   LDR     r2,`ee_taskhandle             ; their handle
   XSWI    "Wimp_SendMessage",17,r5      ; send it
; set new state
   MOV     r0,#S_None                    ; we're not in any state
   STR     r0,`filterstate               ; store it
   LDMFD   (sp)!,{r0-r5,pc}              ; Return from call

; try to return the file to us
>ee_return
   STMFD   (sp)!,{r0-r5,link}            ; Stack registers
   REM     "Attempting get data back from Zap"
   MOV     r5,r1                         ; r5-> block
   LDR     r0,`filetype                  ; filetype
   STR     r0,[r5,#20]                   ; store that
   MOV     r0,#0                         ; not reply
   STR     r0,[r5,#12]                   ; store as ourref
   LDR     r0,`ee_jobhandle
   STR     r0,[r5,#24]                   ; store job handle
   LDR     r0,`ee_return                 ; return request
   STR     r0,[r5,#16]                   ; store it
   LDR     r2,`ee_taskhandle             ; their handle
   XSWI    "Wimp_SendMessage",17,r5      ; send it
; set new state
   MOV     r0,#S_AwaitESave              ; awaiting 'editdatasave' message
   STR     r0,`filterstate               ; store it
   LDMFD   (sp)!,{r0-r5,pc}              ; Return from call

; try to send the file
>ee_startsendfile
   STMFD   (sp)!,{r0-r5,link}            ; Stack registers
   REM     "Attempting to send a file at Zap"
   MOV     r5,r1                         ; r5-> block
   LDR     r0,`editname                  ; the name to use
   BL      strlen                        ; find it's len (to r1)
   ADD     r2,r1,#44+3+1                 ; len+ base + align + term
   BIC     r2,r2,#3                      ; align now!
   STR     r2,[r5,#0]                    ; store as blk len
   ADD     r1,r5,#44                     ; base
   BL      strcpy                        ; copy leafname
   LDR     r0,`filetype                  ; filetype
   STR     r0,[r5,#40]                   ; store that
   MOV     r0,#0                         ; unknown size
   STR     r0,[r5,#36]                   ; store as size
   STR     r0,[r5,#12]                   ; store as ourref
   LDR     r0,`ee_jobhandle
   STR     r0,[r5,#20]                   ; store job handle
   LDR     r0,`ee_datasave               ; datasave request
   STR     r0,[r5,#16]                   ; store it
   LDR     r2,`ee_taskhandle             ; their handle
   XSWI    "Wimp_SendMessage",18,r5      ; send it
; set new state
   MOV     r0,#S_AwaitSaveAck            ; awaiting 'ack' message
   STR     r0,`filterstate               ; store it
   LDMFD   (sp)!,{r0-r5,pc}              ; Return from call

; try to give them a file to save to (for return)
>ee_sendsaveack
   STMFD   (sp)!,{r0-r5,link}            ; Stack registers
   ADR     r1,`tempname                  ; the temporary name to use
   XSWI    "XOS_File",6                  ; delete it
   LDR     r5,[sp,#4*1]                  ; re-read r1
   MOV     r0,r1                         ; r1
   BL      strlen                        ; find it's len (to r1)
   ADD     r2,r1,#44+3+1                 ; len+ base + align + term
   BIC     r2,r2,#3                      ; align now!
   STR     r2,[r5,#0]                    ; store as blk len
   ADD     r1,r5,#44                     ; base
   BL      strcpy                        ; copy leafname
   REM     "Attempting to send save to Zap"
   MVN     r0,#NOT -1                    ; not safe
   STR     r0,[r5,#36]                   ; store as size
   LDR     r0,`filetype                  ; filetype
   STR     r0,[r5,#40]                   ; store as size
   LDR     r0,[r5,#8]                    ; their ref
   STR     r0,[r5,#12]                   ; store as ourref
   MOV     r0,#DataSaveAck               ; datasave request
   STR     r0,[r5,#16]                   ; store it
   LDR     r2,`ee_taskhandle             ; their handle
   XSWI    "Wimp_SendMessage",17,r5      ; send it
; set new state
   MOV     r0,#S_AwaitLoad               ; awaiting 'ack' message
   STR     r0,`filterstate               ; store it
   LDMFD   (sp)!,{r0-r5,pc}              ; Return from call

>ee_sendloadack
   STMFD   (sp)!,{r0-r5,link}            ; Stack registers
   MOV     r5,r1                         ; r1-> workspace
   ADD     r1,r5,#44                     ; pointer to filename
   REM     "Attempting to copy file to original location"
   LDR     r2,`filename                  ; -> filename
   XSWI    "XOS_FSControl",26,,,%10000011
   BVS     $failed                       ; argh.
   MOV     r1,r2                         ; r1-> filename
   LDR     r2,`oldtype                   ; read the original type
   XSWI    "XOS_File",18
   LDR     r0,[r5,#8]                    ; their ref
   STR     r0,[r5,#12]                   ; store as ourref
   MOV     r0,#DataLoadAck               ; dataload request
   STR     r0,[r5,#16]                   ; store it
   LDR     r2,`ee_taskhandle             ; their handle
   XSWI    "Wimp_SendMessage",17,r5      ; send it
   LDMFD   (sp)!,{r0-r5,pc}              ; Return from call
$failed
   REM     "LoadAck copy failed"
   XBL     returnfromfilter,Ret_Failed   ; we failed to launch edit
   XBL     ee_abort                      ; and send the abort
   LDMFD   (sp)!,{r0-r5,pc}              ; Return from call

; try to give them the file to load
>ee_sendload
   STMFD   (sp)!,{r0-r5,link}            ; Stack registers
   MOV     r5,r1                         ; r1-> workspace
   ADD     r2,r5,#44                     ; pointer to filename
   REM     "Attempting to send load to Zap"
   LDR     r1,`filename                  ; read -> filename
   XSWI    "XOS_FSControl",26,,,%11
   BVS     $failed                       ; argh.
   MOV     r0,#0                         ; unknown size
   STR     r0,[r5,#36]                   ; store as size
   LDR     r0,[r5,#8]                    ; their ref
   STR     r0,[r5,#12]                   ; store as ourref
   MOV     r0,#DataLoad                  ; dataload request
   STR     r0,[r5,#16]                   ; store it
   LDR     r2,`ee_taskhandle             ; their handle
   XSWI    "Wimp_SendMessage",17,r5      ; send it
; set new state
   MOV     r0,#S_AwaitLoadAck            ; awaiting 'ack' message
   STR     r0,`filterstate               ; store it
   LDMFD   (sp)!,{r0-r5,pc}              ; Return from call
$failed
   REM     "Load copy failed"
   XBL     returnfromfilter,Ret_Failed   ; we failed to launch edit
   XBL     ee_abort                      ; and send the abort
   LDMFD   (sp)!,{r0-r5,pc}              ; Return from call

; the filter to handle things
>filter
   STMFD   (sp)!,{r1-r5,link}            ; Stack registers
   STR     r0,`reason                    ; hang on to reason
;    REM     "%c04%c30Filter: reason= %r0"
   ADR     link,$return                  ; address to return to
   CMP     r0,#0                         ; is it null ?
   BEQ     null                          ; handle it
   CMP     r0,#17                        ; is it usermessage ?
   CMPNE   r0,#18                        ; or usermessagerecorded ?
   BEQ     usermessage                   ; it's a usermessage
   CMP     r0,#19                        ; is it usermessageack ?
   BEQ     usermessageack
$return
   LDR     r0,`reason                    ; re-read reason
;    REM     "Returning reason %r0"
   LDMFD   (sp)!,{r1-r5,pc}^             ; Return from call

.`reason
   EQUD    0                             ; reason for it all

>null
   STMFD   (sp)!,{r0,link}               ; Stack registers
   LDR     r0,`filterstate               ; read state
   CMP     r0,#S_SendReturn              ; we need to return
   XBLEQ   ee_return                     ; send the 'editreturn'
   CMP     r0,#S_SendAbort               ; we need to abort and return
   XBLEQ   returnfromfilter,Ret_Unchanged ; the file wasn't changed
   XBLEQ   ee_abort                      ; and send the abort
   LDMFD   (sp)!,{r0,pc}                 ; Return from call

>usermessageack
   LDR     r2,[r1,#16]                   ; read message type

   MOV     r4,link
   REM     "ReceivedAck message %&2"
   MOV     link,r4

   LDR     r3,`ee_editrq                 ; EditRq bounced ?
   CMP     r2,r3                         ; was that it ?
   BEQ     um_editrq_bounced             ; ok, so deal with it
   LDR     r3,`ee_datasave               ; EditDataSave bounced ?
   CMP     r2,r3                         ; was that it ?
   BEQ     um_editds_bounced             ; ok, so deal with it
   MOV     pc,link

>um_editrq_bounced
   STMFD   (sp)!,{r0-r5,link}            ; Stack registers
   REM     "EditRq bounced"
   LDR     r0,`filterstate               ; read the state
   CMP     r0,#S_AwaitAck                ; are we waiting for ack ?
   XBLEQ   returnfromfilter,Ret_Failed   ; with the code 'failed'
   REM     "Back to Editrq_bounced"
   MVN     r0,#NOT -1                    ; don't pass on
   STR     r0,`reason                    ; store as reason
   LDMFD   (sp)!,{r0-r5,pc}              ; Return from call

>um_editds_bounced
   STMFD   (sp)!,{r0-r5,link}            ; Stack registers
   REM     "EDS bounced"
   LDR     r0,`filterstate               ; read the state
   CMP     r0,#S_AwaitSaveAck            ; are we waiting for saveack ?
   XBLEQ   returnfromfilter,Ret_Failed   ; we've failed
   XBLEQ   ee_abort                      ; and send the abort
   MVN     r0,#NOT -1                    ; don't pass on
   STR     r0,`reason                    ; store as reason
   LDMFD   (sp)!,{r0-r5,pc}              ; Return from call

>usermessage
   LDR     r2,[r1,#16]                   ; read message type

   MOV     r4,link
   REM     "Received message %&2"
   MOV     link,r4

   CMP     r2,#0                         ; is it 'quit' ?
   LDRNE   r3,$`TW_Morite                ; have to read as a word
   CMPNE   r2,r3                         ; or tw_morite ?
   BEQ     um_quit                       ; we've been told to quit
   LDR     r3,`ee_editack                ; EditAck
   CMP     r2,r3                         ; was that it ?
   BEQ     um_editack                    ; yeah, we got it !
   LDR     r3,`ee_abort                  ; EditAbort
   CMP     r2,r3                         ; was that it ?
   BEQ     um_editabort                  ; yeah, we got it !
   LDR     r3,`ee_datasave               ; EditDataSave
   CMP     r2,r3                         ; was that it ?
   BEQ     um_editds                     ; yeah, we got it !
   CMP     r2,#DataSaveAck               ; is it DataSaveAck ?
   BEQ     um_datasaveack                ; ooh, ok !
   CMP     r2,#DataLoad                  ; is it DataLoad ?
   BEQ     um_dataload                   ; hey, things returing !
   MOV     pc,link

$`TW_Morite
   EQUD    TW_Morite

>um_editds
   STMFD   (sp)!,{link}                  ; Stack registers
   ADD     r3,r1,#44
   LDR     r4,[r1,#40]
   REM     "Their filename was %$3, type=%&4"
   LDR     r0,`filterstate               ; read filterstate
   REM     "Received EditDataSave, state=%r0"
   CMP     r0,#S_AwaitLoadAck            ; are we awaiting a save ? (middle)
   CMPNE   r0,#S_AwaitESave              ; or explicitly awaiting one ?
   LDMNEFD (sp)!,{pc}                    ; if not, return
   BL      ee_sendsaveack                ; send a datasaveack at the task
   MVN     r0,#NOT -1                    ; don't pass on
   STR     r0,`reason                    ; store as reason
   LDMFD   (sp)!,{pc}                    ; Return from call

>um_editabort
   STMFD   (sp)!,{r0,link}               ; Stack registers
   XBL     returnfromfilter,Ret_Unchanged ; the file wasn't changed
   MVN     r0,#NOT -1                    ; don't pass on
   STR     r0,`reason                    ; store as reason
   LDMFD   (sp)!,{r0,pc}                 ; Stack registers

>um_datasaveack
   STMFD   (sp)!,{link}                  ; Stack registers
   LDR     r0,`filterstate               ; read filterstate
   REM     "Received SaveAck, state=%r0"
   CMP     r0,#S_AwaitSaveAck            ; are we awaiting a save ?
   LDMNEFD (sp)!,{pc}                    ; if not, return
   BL      ee_sendload                   ; send a dataload at the task
   MVN     r0,#NOT -1                    ; don't pass on
   STR     r0,`reason                    ; store as reason
   LDMFD   (sp)!,{pc}                    ; Return from call

>um_dataload
   STMFD   (sp)!,{link}                  ; Stack registers
   LDR     r0,`filterstate               ; read filterstate
   REM     "Received Load, state=%r0"
   CMP     r0,#S_AwaitLoad               ; are we awaiting a save ?
   LDMNEFD (sp)!,{pc}                    ; if not, return
   BL      ee_sendloadack                ; send a dataloadack at the task
   XBL     returnfromfilter,Ret_Updated  ; the file WAS changed
   MVN     r0,#NOT -1                    ; don't pass on
   STR     r0,`reason                    ; store as reason
   LDMFD   (sp)!,{pc}                    ; Return from call

>um_editack
   STMFD   (sp)!,{r0-r5,link}            ; Stack registers
   LDR     r0,`filterstate               ; read filterstate
   REM     "Received Ack, state=%r0"
   CMP     r0,#S_AwaitAck                ; are we awaiting an ack ?
   LDMNEFD (sp)!,{r0-r5,pc}              ; if not, return
   REM     "Storing handles and things"
   LDR     r0,[r1,#24]                   ; read jobhandle
   STR     r0,`ee_jobhandle              ; store it
   LDR     r0,[r1,#4]                    ; read taskhandle
   STR     r0,`ee_taskhandle             ; store it
   BL      ee_startsendfile              ; send the file
   MVN     r0,#NOT -1                    ; don't pass on
   STR     r0,`reason                    ; store as reason
   LDMFD   (sp)!,{r0-r5,pc}              ; Return from call

>um_quit
   STMFD   (sp)!,{link}                  ; Stack registers
   BL      ee_abort                      ; send an abort
   BL      removefilter                  ; remove the filter
   MVN     r0,#NOT -1                    ; don't pass on
   STR     r0,`reason                    ; store as reason
   LDMFD   (sp)!,{pc}                    ; Return from call

; call this to return to main program
>returnfromfilter
   STMFD   (sp)!,{r0-r5,link}            ; Stack registers
   STR     r0,`returnstate               ; store the return state
   REM     "Attempting to send 'done' message %r0"
   LDMFD   (sp)!,{r0-r5,pc}^             ; Return from call

#library "strings",strlen.strcpy
#library "memory",strdup.release.claim
#Here Libraries
00000000  49 6e 20 20 20 2d 0a 4f  75 74 20 20 45 45 0a 54  |In   -.Out  EE.T|
00000010  79 70 65 20 41 62 73 6f  6c 75 74 65 0a 56 65 72  |ype Absolute.Ver|
00000020  20 20 31 2e 30 30 6a 0a  0a 50 72 65 0a 20 53 5f  |  1.00j..Pre. S_|
00000030  4e 6f 6e 65 3d 30 3a 52  45 4d 20 57 65 27 72 65  |None=0:REM We're|
00000040  20 6f 75 74 73 69 64 65  20 74 68 65 20 73 74 61  | outside the sta|
00000050  74 65 73 20 21 0a 20 53  5f 41 77 61 69 74 41 63  |tes !. S_AwaitAc|
00000060  6b 3d 31 3a 52 45 4d 20  41 77 61 69 74 69 6e 67  |k=1:REM Awaiting|
00000070  20 61 63 6b 6e 6f 77 6c  65 64 67 65 6d 65 6e 74  | acknowledgement|
00000080  20 6f 66 20 45 45 0a 20  53 5f 41 77 61 69 74 53  | of EE. S_AwaitS|
00000090  61 76 65 41 63 6b 3d 32  3a 52 45 4d 20 41 77 61  |aveAck=2:REM Awa|
000000a0  69 74 69 6e 67 20 61 20  73 61 76 65 20 61 63 6b  |iting a save ack|
000000b0  0a 20 53 5f 41 77 61 69  74 4c 6f 61 64 41 63 6b  |. S_AwaitLoadAck|
000000c0  3d 33 3a 52 45 4d 20 41  77 61 69 74 69 6e 67 20  |=3:REM Awaiting |
000000d0  61 20 6c 6f 61 64 20 61  63 6b 20 28 61 6c 73 6f  |a load ack (also|
000000e0  20 27 6d 69 64 64 6c 65  27 20 73 74 61 74 65 29  | 'middle' state)|
000000f0  0a 20 53 5f 41 77 61 69  74 45 53 61 76 65 3d 34  |. S_AwaitESave=4|
00000100  3a 52 45 4d 20 41 77 61  69 74 69 6e 67 20 61 6e  |:REM Awaiting an|
00000110  20 45 64 69 74 44 61 74  61 53 61 76 65 0a 20 53  | EditDataSave. S|
00000120  5f 41 77 61 69 74 4c 6f  61 64 3d 35 3a 52 45 4d  |_AwaitLoad=5:REM|
00000130  20 41 77 61 69 74 69 6e  67 20 61 20 44 61 74 61  | Awaiting a Data|
00000140  4c 6f 61 64 0a 20 53 5f  53 65 6e 64 52 65 74 75  |Load. S_SendRetu|
00000150  72 6e 3d 38 3a 52 45 4d  20 52 65 71 75 65 73 74  |rn=8:REM Request|
00000160  20 66 72 6f 6d 20 61 70  70 6c 69 63 61 74 69 6f  | from applicatio|
00000170  6e 20 74 6f 20 72 65 74  75 72 6e 20 64 61 74 61  |n to return data|
00000180  0a 20 53 5f 53 65 6e 64  41 62 6f 72 74 3d 39 3a  |. S_SendAbort=9:|
00000190  52 45 4d 20 52 65 71 75  65 73 74 20 66 72 6f 6d  |REM Request from|
000001a0  20 61 70 70 6c 69 63 61  74 69 6f 6e 20 74 6f 20  | application to |
000001b0  61 62 6f 72 74 0a 20 54  57 5f 4d 6f 72 69 74 65  |abort. TW_Morite|
000001c0  3d 26 38 30 38 43 34 3a  52 45 4d 20 53 65 6e 74  |=&808C4:REM Sent|
000001d0  20 74 6f 20 74 61 73 6b  20 74 6f 20 6b 69 6c 6c  | to task to kill|
000001e0  20 69 74 0a 20 54 57 5f  49 6e 70 75 74 3d 26 38  | it. TW_Input=&8|
000001f0  30 38 43 30 3a 52 45 4d  20 53 65 6e 74 20 74 6f  |08C0:REM Sent to|
00000200  20 67 69 76 65 20 6b 65  79 70 72 65 73 73 65 73  | give keypresses|
00000210  20 74 6f 20 69 74 0a 20  44 61 74 61 53 61 76 65  | to it. DataSave|
00000220  41 63 6b 3d 32 3a 52 45  4d 20 53 61 76 65 20 6f  |Ack=2:REM Save o|
00000230  6b 0a 20 44 61 74 61 4c  6f 61 64 3d 33 3a 52 45  |k. DataLoad=3:RE|
00000240  4d 20 4c 6f 61 64 20 74  68 69 73 0a 20 44 61 74  |M Load this. Dat|
00000250  61 4c 6f 61 64 41 63 6b  3d 34 3a 52 45 4d 20 4c  |aLoadAck=4:REM L|
00000260  6f 61 64 65 64 20 6f 6b  0a 20 52 65 74 5f 4e 6f  |oaded ok. Ret_No|
00000270  6e 65 3d 26 31 30 30 30  3a 52 45 4d 20 52 65 73  |ne=&1000:REM Res|
00000280  75 6c 74 20 3d 20 4e 6f  74 20 72 65 74 75 72 6e  |ult = Not return|
00000290  69 6e 67 20 79 65 74 20  28 69 66 20 72 65 74 75  |ing yet (if retu|
000002a0  72 6e 65 64 20 69 73 20  61 6e 20 65 72 72 6f 72  |rned is an error|
000002b0  29 0a 20 52 65 74 5f 55  70 64 61 74 65 64 3d 30  |). Ret_Updated=0|
000002c0  3a 52 45 4d 20 52 65 73  75 6c 74 20 3d 20 27 75  |:REM Result = 'u|
000002d0  70 64 61 74 65 64 27 20  20 20 20 20 28 6f 6b 29  |pdated'     (ok)|
000002e0  0a 20 52 65 74 5f 55 6e  63 68 61 6e 67 65 64 3d  |. Ret_Unchanged=|
000002f0  31 3a 52 45 4d 20 52 65  73 75 6c 74 20 3d 20 27  |1:REM Result = '|
00000300  75 6e 63 68 61 6e 67 65  64 27 20 28 6f 6b 29 0a  |unchanged' (ok).|
00000310  20 52 65 74 5f 46 61 69  6c 65 64 3d 32 3a 52 45  | Ret_Failed=2:RE|
00000320  4d 20 52 65 73 75 6c 74  20 3d 20 27 66 61 69 6c  |M Result = 'fail|
00000330  65 64 27 20 3b 2d 28 20  20 20 28 65 72 72 6f 72  |ed' ;-(   (error|
00000340  29 0a 20 52 65 74 5f 4b  69 6c 6c 65 64 3d 33 3a  |). Ret_Killed=3:|
00000350  52 45 4d 20 52 65 73 75  6c 74 20 3d 20 27 6b 69  |REM Result = 'ki|
00000360  6c 6c 65 64 27 20 3b 2d  28 20 20 20 28 65 72 72  |lled' ;-(   (err|
00000370  6f 72 29 0a 45 6e 64 20  50 72 65 0a 0a 23 52 65  |or).End Pre..#Re|
00000380  6d 20 4f 66 66 0a 2e 73  74 61 72 74 0a 20 20 20  |m Off..start.   |
00000390  53 57 49 20 20 20 20 20  22 4f 53 5f 47 65 74 45  |SWI     "OS_GetE|
000003a0  6e 76 22 20 20 20 20 20  20 20 20 20 20 20 20 20  |nv"             |
000003b0  20 20 20 20 20 20 3b 20  72 65 61 64 20 63 6c 69  |      ; read cli|
000003c0  2f 73 74 61 63 6b 0a 20  20 20 4d 4f 56 20 20 20  |/stack.   MOV   |
000003d0  20 20 72 31 33 2c 72 31  20 20 20 20 20 20 20 20  |  r13,r1        |
000003e0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000003f0  3b 20 74 68 65 72 65 27  73 20 6f 75 72 20 73 74  |; there's our st|
00000400  61 63 6b 0a 24 63 6c 69  6c 6f 6f 70 0a 20 20 20  |ack.$cliloop.   |
00000410  4c 44 52 42 20 20 20 20  72 32 2c 5b 72 30 2c 23  |LDRB    r2,[r0,#|
00000420  31 5d 21 20 20 20 20 20  20 20 20 20 20 20 20 20  |1]!             |
00000430  20 20 20 20 20 20 3b 20  72 65 61 64 20 62 79 74  |      ; read byt|
00000440  65 20 61 6e 64 20 69 6e  63 0a 20 20 20 43 4d 50  |e and inc.   CMP|
00000450  20 20 20 20 20 72 32 2c  23 33 32 20 20 20 20 20  |     r2,#32     |
00000460  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000470  20 20 20 3b 20 69 73 20  69 74 20 3c 20 73 70 61  |   ; is it < spa|
00000480  63 65 20 3f 0a 20 20 20  42 47 54 20 20 20 20 20  |ce ?.   BGT     |
00000490  24 63 6c 69 6c 6f 6f 70  20 20 20 20 20 20 20 20  |$cliloop        |
000004a0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
000004b0  67 6f 20 61 72 6f 75 6e  64 20 61 67 61 69 6e 0a  |go around again.|
000004c0  20 20 20 42 45 51 20 20  20 20 20 24 6e 6f 74 6e  |   BEQ     $notn|
000004d0  75 6c 6c 20 20 20 20 20  20 20 20 20 20 20 20 20  |ull             |
000004e0  20 20 20 20 20 20 20 20  20 3b 20 6e 6f 74 20 61  |         ; not a|
000004f0  20 6e 75 6c 6c 20 63 6c  69 0a 24 73 79 6e 74 61  | null cli.$synta|
00000500  78 0a 20 20 20 53 57 49  20 20 20 20 20 22 4f 53  |x.   SWI     "OS|
00000510  5f 57 72 69 74 65 53 22  20 20 20 20 20 20 20 20  |_WriteS"        |
00000520  20 20 20 20 20 20 20 20  20 20 20 3b 20 77 72 69  |           ; wri|
00000530  74 65 20 74 68 69 73 20  73 74 72 69 6e 67 0a 20  |te this string. |
00000540  20 20 45 51 55 5a 41 20  20 20 22 53 79 6e 74 61  |  EQUZA   "Synta|
00000550  78 3a 20 2a 45 45 20 5b  2d 74 20 3c 74 79 70 65  |x: *EE [-t <type|
00000560  3e 5d 20 3c 66 69 6c 65  6e 61 6d 65 3e 22 0a 20  |>] <filename>". |
00000570  20 20 53 57 49 20 20 20  20 20 22 4f 53 5f 4e 65  |  SWI     "OS_Ne|
00000580  77 4c 69 6e 65 22 0a 20  20 20 53 57 49 20 20 20  |wLine".   SWI   |
00000590  20 20 22 4f 53 5f 45 78  69 74 22 20 20 20 20 20  |  "OS_Exit"     |
000005a0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000005b0  3b 20 72 65 74 72 75 6e  0a 24 6e 6f 74 6e 75 6c  |; retrun.$notnul|
000005c0  6c 0a 20 20 20 4d 56 4e  20 20 20 20 20 72 37 2c  |l.   MVN     r7,|
000005d0  23 4e 4f 54 20 2d 31 20  20 20 20 20 20 20 20 20  |#NOT -1         |
000005e0  20 20 20 20 20 20 20 20  20 20 20 3b 20 2d 31 20  |           ; -1 |
000005f0  6d 65 61 6e 73 20 72 65  61 64 20 66 69 6c 65 74  |means read filet|
00000600  79 70 65 0a 20 20 20 4c  44 52 42 20 20 20 20 72  |ype.   LDRB    r|
00000610  32 2c 5b 72 30 2c 23 31  5d 21 20 20 20 20 20 20  |2,[r0,#1]!      |
00000620  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 72  |             ; r|
00000630  65 61 64 20 62 79 74 65  20 61 6e 64 20 69 6e 63  |ead byte and inc|
00000640  0a 20 20 20 43 4d 50 20  20 20 20 20 72 32 2c 23  |.   CMP     r2,#|
00000650  41 53 43 28 22 2d 22 29  20 20 20 20 20 20 20 20  |ASC("-")        |
00000660  20 20 20 20 20 20 20 20  20 20 3b 20 69 73 20 69  |          ; is i|
00000670  74 20 2d 20 3f 0a 20 20  20 42 4e 45 20 20 20 20  |t - ?.   BNE    |
00000680  20 24 6e 6f 74 61 6d 69  6e 75 73 20 20 20 20 20  | $notaminus     |
00000690  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
000006a0  20 6e 6f 70 65 2c 20 73  6f 20 73 6b 69 70 0a 20  | nope, so skip. |
000006b0  20 20 4c 44 52 42 20 20  20 20 72 32 2c 5b 72 30  |  LDRB    r2,[r0|
000006c0  2c 23 31 5d 21 20 20 20  20 20 20 20 20 20 20 20  |,#1]!           |
000006d0  20 20 20 20 20 20 20 20  3b 20 72 65 61 64 20 62  |        ; read b|
000006e0  79 74 65 20 61 6e 64 20  69 6e 63 0a 20 20 20 43  |yte and inc.   C|
000006f0  4d 50 20 20 20 20 20 72  32 2c 23 33 32 20 20 20  |MP     r2,#32   |
00000700  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000710  20 20 20 20 20 3b 20 69  73 20 69 74 20 73 70 61  |     ; is it spa|
00000720  63 65 20 28 66 6f 72 20  27 2d 20 3c 66 69 6c 65  |ce (for '- <file|
00000730  6e 61 6d 65 3e 27 29 0a  20 20 20 42 45 51 20 20  |name>').   BEQ  |
00000740  20 20 20 24 6e 6f 74 61  6d 69 6e 75 73 0a 20 20  |   $notaminus.  |
00000750  20 43 4d 50 20 20 20 20  20 72 32 2c 23 41 53 43  | CMP     r2,#ASC|
00000760  28 22 74 22 29 20 20 20  20 20 20 20 20 20 20 20  |("t")           |
00000770  20 20 20 20 20 20 20 3b  20 69 73 20 69 74 20 27  |       ; is it '|
00000780  2d 74 27 20 3f 0a 20 20  20 43 4d 50 4e 45 20 20  |-t' ?.   CMPNE  |
00000790  20 72 32 2c 23 41 53 43  28 22 54 22 29 20 20 20  | r2,#ASC("T")   |
000007a0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
000007b0  20 6f 72 20 27 2d 54 27  20 3f 0a 20 20 20 42 4e  | or '-T' ?.   BN|
000007c0  45 20 20 20 20 20 24 73  79 6e 74 61 78 20 20 20  |E     $syntax   |
000007d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000007e0  20 20 20 20 3b 20 6e 6f  70 65 2c 20 73 79 6e 74  |    ; nope, synt|
000007f0  61 78 20 65 72 72 6f 72  0a 20 20 20 41 44 44 20  |ax error.   ADD |
00000800  20 20 20 20 72 31 2c 72  30 2c 23 31 20 20 20 20  |    r1,r0,#1    |
00000810  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000820  20 20 3b 20 72 31 2d 3e  20 73 74 72 69 6e 67 0a  |  ; r1-> string.|
00000830  20 20 20 52 45 4d 20 20  20 20 20 22 53 74 72 69  |   REM     "Stri|
00000840  6e 67 20 28 66 6f 72 20  6e 75 6d 29 20 3d 20 25  |ng (for num) = %|
00000850  24 31 22 0a 20 20 20 4c  4d 4f 56 20 20 20 20 72  |$1".   LMOV    r|
00000860  30 2c 23 31 36 2b 28 31  3c 3c 33 31 29 0a 20 20  |0,#16+(1<<31).  |
00000870  20 58 53 57 49 20 20 20  20 22 4f 53 5f 52 65 61  | XSWI    "OS_Rea|
00000880  64 55 6e 73 69 67 6e 65  64 22 20 20 20 20 20 20  |dUnsigned"      |
00000890  20 20 20 20 20 20 20 3b  20 72 65 61 64 20 6e 75  |       ; read nu|
000008a0  6d 62 65 72 0a 20 20 20  4d 4f 56 20 20 20 20 20  |mber.   MOV     |
000008b0  72 37 2c 72 32 20 20 20  20 20 20 20 20 20 20 20  |r7,r2           |
000008c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
000008d0  72 36 20 3d 20 66 69 6c  65 74 79 70 65 0a 20 20  |r6 = filetype.  |
000008e0  20 52 45 4d 20 20 20 20  20 22 54 72 65 61 74 69  | REM     "Treati|
000008f0  6e 67 20 61 73 20 74 79  70 65 20 25 26 36 22 0a  |ng as type %&6".|
00000900  20 20 20 4c 44 52 42 20  20 20 20 72 30 2c 5b 72  |   LDRB    r0,[r|
00000910  31 5d 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |1]              |
00000920  20 20 20 20 20 20 20 20  20 3b 20 72 65 61 64 20  |         ; read |
00000930  61 20 62 79 74 65 0a 20  20 20 43 4d 50 20 20 20  |a byte.   CMP   |
00000940  20 20 72 30 2c 23 33 32  20 20 20 20 20 20 20 20  |  r0,#32        |
00000950  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000960  3b 20 69 73 20 69 74 20  73 70 61 63 65 20 3f 0a  |; is it space ?.|
00000970  20 20 20 42 4c 54 20 20  20 20 20 24 73 79 6e 74  |   BLT     $synt|
00000980  61 78 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |ax              |
00000990  20 20 20 20 20 20 20 20  20 3b 20 69 66 20 63 74  |         ; if ct|
000009a0  72 6c 2c 20 65 72 72 6f  72 2e 2e 2e 0a 20 20 20  |rl, error....   |
000009b0  41 44 44 20 20 20 20 20  72 30 2c 72 31 2c 23 31  |ADD     r0,r1,#1|
000009c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000009d0  20 20 20 20 20 20 3b 20  72 30 2d 3e 20 72 65 73  |      ; r0-> res|
000009e0  74 20 6f 66 20 73 74 72  69 6e 67 0a 24 6e 6f 74  |t of string.$not|
000009f0  61 6d 69 6e 75 73 0a 20  20 20 52 45 4d 20 20 20  |aminus.   REM   |
00000a00  20 20 22 46 69 6c 65 6e  61 6d 65 20 3d 20 25 24  |  "Filename = %$|
00000a10  30 22 0a 20 20 20 4c 41  44 52 20 20 20 20 72 31  |0".   LADR    r1|
00000a20  2c 60 73 74 61 74 69 63  5f 66 69 6c 65 6e 61 6d  |,`static_filenam|
00000a30  65 20 20 20 20 20 20 20  20 20 20 20 3b 20 61 64  |e           ; ad|
00000a40  64 72 65 73 73 20 6f 66  20 6f 75 72 20 62 75 66  |dress of our buf|
00000a50  66 65 72 0a 20 20 20 42  4c 20 20 20 20 20 20 73  |fer.   BL      s|
00000a60  74 72 63 70 79 20 20 20  20 20 20 20 20 20 20 20  |trcpy           |
00000a70  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 63  |             ; c|
00000a80  6f 70 79 20 69 74 20 74  68 65 72 65 0a 20 20 20  |opy it there.   |
00000a90  58 53 57 49 20 20 20 20  22 4f 53 5f 46 69 6c 65  |XSWI    "OS_File|
00000aa0  22 2c 32 30 20 20 20 20  20 20 20 20 20 20 20 20  |",20            |
00000ab0  20 20 20 20 20 20 3b 20  67 65 74 20 74 68 65 20  |      ; get the |
00000ac0  69 6e 66 6f 20 66 6f 72  20 69 74 0a 20 20 20 43  |info for it.   C|
00000ad0  4d 50 20 20 20 20 20 72  30 2c 23 30 20 20 20 20  |MP     r0,#0    |
00000ae0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000af0  20 20 20 20 20 3b 20 77  61 73 20 69 74 20 27 6e  |     ; was it 'n|
00000b00  6f 74 20 66 6f 75 6e 64  27 20 3f 0a 20 20 20 42  |ot found' ?.   B|
00000b10  4e 45 20 20 20 20 20 24  67 6f 74 74 79 70 65 20  |NE     $gottype |
00000b20  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000b30  20 20 20 20 20 3b 20 69  66 20 6e 6f 74 2c 20 69  |     ; if not, i|
00000b40  74 27 73 20 6f 6b 0a 20  20 20 53 57 49 20 20 20  |t's ok.   SWI   |
00000b50  20 20 22 4f 53 5f 57 72  69 74 65 53 22 0a 20 20  |  "OS_WriteS".  |
00000b60  20 45 51 55 5a 41 20 20  20 22 46 69 6c 65 20 6e  | EQUZA   "File n|
00000b70  6f 74 20 66 6f 75 6e 64  3b 20 65 64 69 74 20 61  |ot found; edit a|
00000b80  62 61 6e 64 6f 6e 65 64  22 0a 20 20 20 53 57 49  |bandoned".   SWI|
00000b90  20 20 20 20 20 22 4f 53  5f 4e 65 77 4c 69 6e 65  |     "OS_NewLine|
00000ba0  22 0a 20 20 20 53 57 49  20 20 20 20 20 22 4f 53  |".   SWI     "OS|
00000bb0  5f 45 78 69 74 22 20 20  20 20 20 20 20 20 20 20  |_Exit"          |
00000bc0  20 20 20 20 20 20 20 20  20 20 20 3b 20 61 6e 64  |           ; and|
00000bd0  20 72 65 74 75 72 6e 0a  24 67 6f 74 74 79 70 65  | return.$gottype|
00000be0  0a 20 20 20 43 4d 4e 20  20 20 20 20 72 37 2c 23  |.   CMN     r7,#|
00000bf0  31 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |1               |
00000c00  20 20 20 20 20 20 20 20  20 20 3b 20 69 66 20 2d  |          ; if -|
00000c10  31 2c 20 74 68 65 6e 20  77 65 20 75 73 65 20 74  |1, then we use t|
00000c20  68 65 20 74 79 70 65 20  67 69 76 65 6e 0a 20 20  |he type given.  |
00000c30  20 4d 4f 56 45 51 20 20  20 72 37 2c 72 36 20 20  | MOVEQ   r7,r6  |
00000c40  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000c50  20 20 20 20 20 20 20 3b  20 65 64 69 74 20 66 69  |       ; edit fi|
00000c60  6c 65 74 79 70 65 20 3d  20 72 65 61 6c 20 66 69  |letype = real fi|
00000c70  6c 65 74 79 70 65 0a 20  20 20 53 54 52 20 20 20  |letype.   STR   |
00000c80  20 20 72 37 2c 60 66 69  6c 65 74 79 70 65 20 20  |  r7,`filetype  |
00000c90  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000ca0  3b 20 73 74 6f 72 65 20  66 69 6c 65 74 79 70 65  |; store filetype|
00000cb0  0a 20 20 20 53 54 52 20  20 20 20 20 72 36 2c 60  |.   STR     r6,`|
00000cc0  6f 6c 64 74 79 70 65 20  20 20 20 20 20 20 20 20  |oldtype         |
00000cd0  20 20 20 20 20 20 20 20  20 20 3b 20 74 68 65 20  |          ; the |
00000ce0  6f 72 69 67 69 6e 61 6c  20 74 79 70 65 20 28 74  |original type (t|
00000cf0  6f 20 72 65 73 74 6f 72  65 29 0a 20 20 20 58 53  |o restore).   XS|
00000d00  57 49 20 20 20 20 22 4f  53 5f 42 79 74 65 22 2c  |WI    "OS_Byte",|
00000d10  32 32 39 2c 31 2c 30 20  20 20 20 20 20 20 20 20  |229,1,0         |
00000d20  20 20 20 20 3b 20 64 69  73 61 62 6c 65 20 65 73  |    ; disable es|
00000d30  63 61 70 65 0a 20 20 20  53 54 52 20 20 20 20 20  |cape.   STR     |
00000d40  72 31 2c 60 6f 6c 64 65  73 63 61 70 65 20 20 20  |r1,`oldescape   |
00000d50  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
00000d60  73 74 6f 72 65 20 74 68  65 20 65 73 63 61 70 65  |store the escape|
00000d70  20 73 74 61 74 65 0a 24  72 65 73 74 61 72 74 0a  | state.$restart.|
00000d80  20 20 20 4c 44 52 20 20  20 20 20 72 31 2c 24 60  |   LDR     r1,$`|
00000d90  54 41 53 4b 20 20 20 20  20 20 20 20 20 20 20 20  |TASK            |
00000da0  20 20 20 20 20 20 20 20  20 3b 20 74 68 65 20 27  |         ; the '|
00000db0  54 41 53 4b 27 20 77 6f  72 64 0a 20 20 20 58 53  |TASK' word.   XS|
00000dc0  57 49 20 20 20 20 22 58  57 69 6d 70 5f 49 6e 69  |WI    "XWimp_Ini|
00000dd0  74 69 61 6c 69 73 65 22  2c 32 30 30 2c 2c 5e 24  |tialise",200,,^$|
00000de0  60 6e 61 6d 65 20 3b 20  69 6e 69 74 69 61 6c 69  |`name ; initiali|
00000df0  73 65 20 75 73 20 61 73  20 61 20 74 61 73 6b 0a  |se us as a task.|
00000e00  20 20 20 4d 4f 56 56 53  20 20 20 72 30 2c 23 30  |   MOVVS   r0,#0|
00000e10  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000e20  20 20 20 20 20 20 20 20  20 3b 20 69 66 20 65 72  |         ; if er|
00000e30  72 6f 72 2c 20 74 61 73  6b 20 68 61 6e 64 6c 65  |ror, task handle|
00000e40  20 3d 20 30 0a 20 20 20  53 54 52 20 20 20 20 20  | = 0.   STR     |
00000e50  72 30 2c 60 74 61 73 6b  68 61 6e 64 6c 65 20 20  |r0,`taskhandle  |
00000e60  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
00000e70  73 74 6f 72 65 20 68 61  6e 64 6c 65 0a 20 20 20  |store handle.   |
00000e80  4d 4f 56 20 20 20 20 20  72 31 2c 72 30 20 20 20  |MOV     r1,r0   |
00000e90  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000ea0  20 20 20 20 20 20 3b 20  68 61 6e 67 20 6f 6e 20  |      ; hang on |
00000eb0  74 6f 20 74 68 65 20 68  61 6e 64 6c 65 79 20 74  |to the handley t|
00000ec0  68 69 6e 67 0a 3b 20 63  68 65 63 6b 20 74 61 73  |hing.; check tas|
00000ed0  6b 77 69 6e 64 6f 77 0a  20 20 20 53 57 49 20 20  |kwindow.   SWI  |
00000ee0  20 20 20 22 54 61 73 6b  57 69 6e 64 6f 77 5f 54  |   "TaskWindow_T|
00000ef0  61 73 6b 49 6e 66 6f 22  20 20 20 20 20 20 20 20  |askInfo"        |
00000f00  20 3b 20 61 72 65 20 77  65 20 69 6e 20 61 20 74  | ; are we in a t|
00000f10  61 73 6b 20 3f 0a 20 20  20 43 4d 50 20 20 20 20  |ask ?.   CMP    |
00000f20  20 72 30 2c 23 30 20 20  20 20 20 20 20 20 20 20  | r0,#0          |
00000f30  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00000f40  20 77 65 6c 6c 3f 0a 20  20 20 4d 4f 56 4e 45 20  | well?.   MOVNE |
00000f50  20 20 72 30 2c 23 31 20  20 20 20 20 20 20 20 20  |  r0,#1         |
00000f60  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000f70  3b 20 6d 61 72 6b 73 20  75 73 20 61 73 20 61 20  |; marks us as a |
00000f80  74 61 73 6b 77 69 6e 64  6f 77 0a 20 20 20 43 4d  |taskwindow.   CM|
00000f90  50 20 20 20 20 20 72 30  2c 23 30 20 20 20 20 20  |P     r0,#0     |
00000fa0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000fb0  20 20 20 20 3b 20 61 72  65 20 77 65 20 6f 75 74  |    ; are we out|
00000fc0  73 69 64 65 20 74 61 73  6b 77 69 6e 64 6f 77 20  |side taskwindow |
00000fd0  3f 0a 20 20 20 43 4d 50  45 51 20 20 20 72 31 2c  |?.   CMPEQ   r1,|
00000fe0  23 30 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |#0              |
00000ff0  20 20 20 20 20 20 20 20  20 20 20 3b 20 61 6e 64  |           ; and|
00001000  20 64 69 64 20 74 68 65  20 69 6e 69 74 20 66 61  | did the init fa|
00001010  69 6c 20 3f 0a 20 20 20  42 4e 45 20 20 20 20 20  |il ?.   BNE     |
00001020  24 6e 6f 74 61 74 73 68  65 6c 6c 63 6c 69 0a 20  |$notatshellcli. |
00001030  20 20 53 57 49 20 20 20  20 20 22 58 57 69 6d 70  |  SWI     "XWimp|
00001040  5f 43 6c 6f 73 65 44 6f  77 6e 22 20 20 20 20 20  |_CloseDown"     |
00001050  20 20 20 20 20 20 20 20  3b 20 63 6c 6f 73 65 20  |        ; close |
00001060  75 73 20 64 6f 77 6e 0a  20 20 20 42 20 20 20 20  |us down.   B    |
00001070  20 20 20 24 72 65 73 74  61 72 74 0a 24 6e 6f 74  |   $restart.$not|
00001080  61 74 73 68 65 6c 6c 63  6c 69 0a 20 20 20 53 54  |atshellcli.   ST|
00001090  52 20 20 20 20 20 72 30  2c 60 69 6e 74 61 73 6b  |R     r0,`intask|
000010a0  77 69 6e 64 6f 77 20 20  20 20 20 20 20 20 20 20  |window          |
000010b0  20 20 20 20 3b 20 6d 61  72 6b 20 69 74 0a 20 20  |    ; mark it.  |
000010c0  20 52 45 4d 20 20 20 20  20 22 54 61 73 6b 77 69  | REM     "Taskwi|
000010d0  6e 64 6f 77 3a 20 25 72  30 22 0a 20 20 20 42 4c  |ndow: %r0".   BL|
000010e0  20 20 20 20 20 20 61 64  64 66 69 6c 74 65 72 20  |      addfilter |
000010f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001100  20 20 20 20 3b 20 61 64  64 20 6f 75 72 20 66 69  |    ; add our fi|
00001110  6c 74 65 72 0a 20 20 20  52 45 4d 20 20 20 20 20  |lter.   REM     |
00001120  22 46 69 6c 74 65 72 20  61 64 64 65 64 22 0a 20  |"Filter added". |
00001130  20 20 42 4c 20 20 20 20  20 20 65 65 5f 69 6e 69  |  BL      ee_ini|
00001140  74 69 61 74 65 20 20 20  20 20 20 20 20 20 20 20  |tiate           |
00001150  20 20 20 20 20 20 20 20  3b 20 73 74 61 72 74 20  |        ; start |
00001160  74 68 65 20 66 69 72 73  74 20 65 65 0a 20 20 20  |the first ee.   |
00001170  52 45 4d 20 20 20 20 20  22 49 6e 69 74 69 61 74  |REM     "Initiat|
00001180  65 64 20 45 45 22 0a 20  20 20 4c 44 52 20 20 20  |ed EE".   LDR   |
00001190  20 20 72 30 2c 60 69 6e  74 61 73 6b 77 69 6e 64  |  r0,`intaskwind|
000011a0  6f 77 0a 20 20 20 43 4d  50 20 20 20 20 20 72 30  |ow.   CMP     r0|
000011b0  2c 23 30 20 20 20 20 20  20 20 20 20 20 20 20 20  |,#0             |
000011c0  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 61 72  |            ; ar|
000011d0  65 20 77 65 20 69 6e 20  74 61 73 6b 77 69 6e 64  |e we in taskwind|
000011e0  6f 77 20 3f 0a 20 20 20  42 45 51 20 20 20 20 20  |ow ?.   BEQ     |
000011f0  24 6e 6f 74 69 6e 74 77  20 20 20 20 20 20 20 20  |$notintw        |
00001200  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
00001210  6e 6f 70 65 2c 20 73 6f  20 6a 75 6d 70 20 6f 75  |nope, so jump ou|
00001220  74 0a 20 20 20 52 45 4d  50 20 20 20 20 22 50 72  |t.   REMP    "Pr|
00001230  65 73 73 20 52 20 74 6f  20 72 65 74 75 72 6e 20  |ess R to return |
00001240  64 61 74 61 2c 20 41 20  74 6f 20 61 62 6f 72 74  |data, A to abort|
00001250  22 0a 24 77 61 69 74 6c  6f 6f 70 0a 3b 20 63 68  |".$waitloop.; ch|
00001260  65 63 6b 20 73 74 61 74  65 0a 20 20 20 4c 44 52  |eck state.   LDR|
00001270  20 20 20 20 20 72 30 2c  60 72 65 74 75 72 6e 73  |     r0,`returns|
00001280  74 61 74 65 20 20 20 20  20 20 20 20 20 20 20 20  |tate            |
00001290  20 20 20 3b 20 72 65 61  64 20 72 65 74 75 72 6e  |   ; read return|
000012a0  20 73 74 61 74 65 0a 20  20 20 43 4d 50 20 20 20  | state.   CMP   |
000012b0  20 20 72 30 2c 23 52 65  74 5f 4e 6f 6e 65 20 20  |  r0,#Ret_None  |
000012c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000012d0  3b 20 69 73 20 69 74 20  27 6e 6f 6e 65 27 20 3f  |; is it 'none' ?|
000012e0  0a 20 20 20 42 4e 45 20  20 20 20 20 74 61 73 6b  |.   BNE     task|
000012f0  65 6e 64 20 20 20 20 20  20 20 20 20 20 20 20 20  |end             |
00001300  20 20 20 20 20 20 20 20  20 20 3b 20 69 66 20 6e  |          ; if n|
00001310  6f 74 2c 20 65 78 69 74  0a 3b 20 6e 6f 77 20 63  |ot, exit.; now c|
00001320  68 65 63 6b 20 6b 65 79  73 0a 20 20 20 58 53 57  |heck keys.   XSW|
00001330  49 20 20 20 20 22 58 4f  53 5f 42 79 74 65 22 2c  |I    "XOS_Byte",|
00001340  26 38 31 2c 32 35 2c 30  20 20 20 20 20 20 20 20  |&81,25,0        |
00001350  20 20 20 3b 20 72 65 61  64 20 61 20 63 68 61 72  |   ; read a char|
00001360  61 63 74 65 72 20 28 32  35 63 73 29 0a 20 20 20  |acter (25cs).   |
00001370  43 4d 50 20 20 20 20 20  72 32 2c 23 32 35 35 20  |CMP     r2,#255 |
00001380  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001390  20 20 20 20 20 20 3b 20  77 61 73 20 69 74 20 76  |      ; was it v|
000013a0  61 6c 69 64 20 3f 0a 20  20 20 42 45 51 20 20 20  |alid ?.   BEQ   |
000013b0  20 20 24 77 61 69 74 6c  6f 6f 70 20 20 20 20 20  |  $waitloop     |
000013c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000013d0  3b 20 6e 6f 70 65 2c 20  73 6f 20 74 72 79 20 61  |; nope, so try a|
000013e0  67 61 69 6e 0a 0a 20 20  20 43 4d 50 20 20 20 20  |gain..   CMP    |
000013f0  20 72 31 2c 23 41 53 43  28 22 52 22 29 20 20 20  | r1,#ASC("R")   |
00001400  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00001410  20 77 61 73 20 69 74 20  27 72 27 20 74 6f 20 72  | was it 'r' to r|
00001420  65 74 75 72 6e 20 3f 0a  20 20 20 43 4d 50 4e 45  |eturn ?.   CMPNE|
00001430  20 20 20 72 31 2c 23 41  53 43 28 22 72 22 29 0a  |   r1,#ASC("r").|
00001440  20 20 20 4d 4f 56 45 51  20 20 20 72 30 2c 23 53  |   MOVEQ   r0,#S|
00001450  5f 53 65 6e 64 52 65 74  75 72 6e 20 20 20 20 20  |_SendReturn     |
00001460  20 20 20 20 20 20 20 20  20 3b 20 6c 65 74 27 73  |         ; let's|
00001470  20 72 65 74 75 72 6e 0a  20 20 20 53 54 52 45 51  | return.   STREQ|
00001480  20 20 20 72 30 2c 60 66  69 6c 74 65 72 73 74 61  |   r0,`filtersta|
00001490  74 65 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |te              |
000014a0  20 3b 20 73 74 6f 72 65  20 69 74 20 61 73 20 74  | ; store it as t|
000014b0  68 65 20 73 74 61 74 65  0a 0a 20 20 20 43 4d 50  |he state..   CMP|
000014c0  20 20 20 20 20 72 31 2c  23 41 53 43 28 22 41 22  |     r1,#ASC("A"|
000014d0  29 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |)               |
000014e0  20 20 20 3b 20 77 61 73  20 69 74 20 27 61 27 20  |   ; was it 'a' |
000014f0  74 6f 20 61 62 6f 72 74  20 3f 0a 20 20 20 43 4d  |to abort ?.   CM|
00001500  50 4e 45 20 20 20 72 31  2c 23 41 53 43 28 22 61  |PNE   r1,#ASC("a|
00001510  22 29 0a 20 20 20 43 4d  50 4e 45 20 20 20 72 31  |").   CMPNE   r1|
00001520  2c 23 32 37 20 20 20 20  20 20 20 20 20 20 20 20  |,#27            |
00001530  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 6f 72  |            ; or|
00001540  20 65 73 63 61 70 65 3f  0a 20 20 20 4d 4f 56 45  | escape?.   MOVE|
00001550  51 20 20 20 72 30 2c 23  53 5f 53 65 6e 64 41 62  |Q   r0,#S_SendAb|
00001560  6f 72 74 20 20 20 20 20  20 20 20 20 20 20 20 20  |ort             |
00001570  20 20 3b 20 6c 65 74 27  73 20 61 62 6f 72 74 0a  |  ; let's abort.|
00001580  20 20 20 53 54 52 45 51  20 20 20 72 30 2c 60 66  |   STREQ   r0,`f|
00001590  69 6c 74 65 72 73 74 61  74 65 20 20 20 20 20 20  |ilterstate      |
000015a0  20 20 20 20 20 20 20 20  20 3b 20 73 74 6f 72 65  |         ; store|
000015b0  20 69 74 20 61 73 20 74  68 65 20 73 74 61 74 65  | it as the state|
000015c0  0a 0a 20 20 20 42 20 20  20 20 20 20 20 24 77 61  |..   B       $wa|
000015d0  69 74 6c 6f 6f 70 20 20  20 20 20 20 20 20 20 20  |itloop          |
000015e0  20 20 20 20 20 20 20 20  20 20 20 3b 20 67 6f 20  |           ; go |
000015f0  61 67 61 69 6e 0a 0a 3b  20 6e 6f 74 20 69 6e 20  |again..; not in |
00001600  61 20 74 61 73 6b 77 69  6e 64 6f 77 0a 24 6e 6f  |a taskwindow.$no|
00001610  74 69 6e 74 77 0a 20 20  20 52 45 4d 20 20 20 20  |tintw.   REM    |
00001620  20 22 4e 6f 6e 2d 74 61  73 6b 77 69 6e 64 6f 77  | "Non-taskwindow|
00001630  20 70 6f 6c 6c 22 0a 24  70 6f 6c 6c 6c 6f 6f 70  | poll".$pollloop|
00001640  0a 3b 20 63 68 65 63 6b  20 73 74 61 74 65 0a 20  |.; check state. |
00001650  20 20 4c 44 52 20 20 20  20 20 72 30 2c 60 72 65  |  LDR     r0,`re|
00001660  74 75 72 6e 73 74 61 74  65 20 20 20 20 20 20 20  |turnstate       |
00001670  20 20 20 20 20 20 20 20  3b 20 72 65 61 64 20 72  |        ; read r|
00001680  65 74 75 72 6e 20 73 74  61 74 65 0a 20 20 20 43  |eturn state.   C|
00001690  4d 50 20 20 20 20 20 72  30 2c 23 52 65 74 5f 4e  |MP     r0,#Ret_N|
000016a0  6f 6e 65 20 20 20 20 20  20 20 20 20 20 20 20 20  |one             |
000016b0  20 20 20 20 20 3b 20 69  73 20 69 74 20 27 6e 6f  |     ; is it 'no|
000016c0  6e 65 27 20 3f 0a 20 20  20 42 4e 45 20 20 20 20  |ne' ?.   BNE    |
000016d0  20 74 61 73 6b 65 6e 64  20 20 20 20 20 20 20 20  | taskend        |
000016e0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
000016f0  20 69 66 20 6e 6f 74 2c  20 65 78 69 74 0a 3b 20  | if not, exit.; |
00001700  6e 6f 77 20 70 6f 6c 6c  0a 20 20 20 41 44 52 20  |now poll.   ADR |
00001710  20 20 20 20 72 31 2c 60  62 6c 6b 20 20 20 20 20  |    r1,`blk     |
00001720  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001730  20 20 3b 20 61 64 64 72  65 73 73 20 6f 66 20 6f  |  ; address of o|
00001740  75 72 20 62 6c 6f 63 6b  0a 20 20 20 58 53 57 49  |ur block.   XSWI|
00001750  20 20 20 20 22 57 69 6d  70 5f 50 6f 6c 6c 22 2c  |    "Wimp_Poll",|
00001760  30 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |0               |
00001770  20 20 3b 20 70 6f 6c 6c  20 74 68 65 20 77 69 6d  |  ; poll the wim|
00001780  70 0a 20 20 20 41 44 52  20 20 20 20 20 6c 69 6e  |p.   ADR     lin|
00001790  6b 2c 24 70 6f 6c 6c 6c  6f 6f 70 20 20 20 20 20  |k,$pollloop     |
000017a0  20 20 20 20 20 20 20 20  20 20 20 3b 20 77 68 65  |           ; whe|
000017b0  72 65 20 74 6f 20 72 65  74 75 72 6e 20 74 6f 0a  |re to return to.|
000017c0  20 20 20 43 4d 50 20 20  20 20 20 72 30 2c 23 31  |   CMP     r0,#1|
000017d0  37 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |7               |
000017e0  20 20 20 20 20 20 20 20  20 3b 20 69 73 20 69 74  |         ; is it|
000017f0  20 75 73 65 72 6d 65 73  73 61 67 65 3f 0a 20 20  | usermessage?.  |
00001800  20 43 4d 50 4e 45 20 20  20 72 30 2c 23 31 38 20  | CMPNE   r0,#18 |
00001810  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001820  20 20 20 20 20 20 20 3b  20 6f 72 20 75 73 65 72  |       ; or user|
00001830  6d 65 73 73 61 67 65 72  65 63 6f 72 64 65 64 3f  |messagerecorded?|
00001840  0a 20 20 20 4c 44 52 45  51 20 20 20 72 30 2c 5b  |.   LDREQ   r0,[|
00001850  72 31 2c 23 31 36 5d 20  20 20 20 20 20 20 20 20  |r1,#16]         |
00001860  20 20 20 20 20 20 20 20  20 20 3b 20 72 65 61 64  |          ; read|
00001870  20 6d 65 73 73 61 67 65  20 74 79 70 65 0a 20 20  | message type.  |
00001880  20 43 4d 50 45 51 20 20  20 72 30 2c 23 30 20 20  | CMPEQ   r0,#0  |
00001890  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000018a0  20 20 20 20 20 20 20 3b  20 69 73 20 69 74 20 27  |       ; is it '|
000018b0  71 75 69 74 27 20 3f 0a  20 20 20 4d 4f 56 45 51  |quit' ?.   MOVEQ|
000018c0  20 20 20 72 30 2c 23 52  65 74 5f 4b 69 6c 6c 65  |   r0,#Ret_Kille|
000018d0  64 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |d               |
000018e0  20 3b 20 6d 61 72 6b 20  75 73 20 61 73 20 6b 69  | ; mark us as ki|
000018f0  6c 6c 65 64 0a 20 20 20  53 54 52 45 51 20 20 20  |lled.   STREQ   |
00001900  72 30 2c 60 72 65 74 75  72 6e 73 74 61 74 65 20  |r0,`returnstate |
00001910  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
00001920  73 74 6f 72 65 20 61 73  20 72 65 74 75 72 6e 73  |store as returns|
00001930  74 61 74 65 0a 20 20 20  42 45 51 20 20 20 20 20  |tate.   BEQ     |
00001940  74 61 73 6b 65 6e 64 20  20 20 20 20 20 20 20 20  |taskend         |
00001950  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
00001960  69 66 20 73 6f 2c 20 65  6e 64 20 6e 69 63 65 6c  |if so, end nicel|
00001970  79 0a 20 20 20 42 20 20  20 20 20 20 20 24 70 6f  |y.   B       $po|
00001980  6c 6c 6c 6f 6f 70 20 20  20 20 20 20 20 20 20 20  |llloop          |
00001990  20 20 20 20 20 20 20 20  20 20 20 3b 20 6a 75 6d  |           ; jum|
000019a0  70 20 62 61 63 6b 20 74  6f 20 70 6f 6c 6c 20 61  |p back to poll a|
000019b0  67 61 69 6e 0a 0a 24 60  54 41 53 4b 0a 20 20 20  |gain..$`TASK.   |
000019c0  45 51 55 53 20 20 20 20  22 54 41 53 4b 22 20 20  |EQUS    "TASK"  |
000019d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000019e0  20 20 20 20 20 20 3b 20  77 6f 72 64 20 27 74 61  |      ; word 'ta|
000019f0  73 6b 27 0a 24 60 6e 61  6d 65 0a 20 20 20 45 51  |sk'.$`name.   EQ|
00001a00  55 5a 41 20 20 20 22 45  45 2d 54 61 73 6b 22 0a  |UZA   "EE-Task".|
00001a10  0a 3e 74 61 73 6b 65 6e  64 0a 20 20 20 42 4c 20  |.>taskend.   BL |
00001a20  20 20 20 20 20 72 65 6d  6f 76 65 66 69 6c 74 65  |     removefilte|
00001a30  72 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |r               |
00001a40  20 20 20 3b 20 72 65 6d  6f 76 65 20 74 68 65 20  |   ; remove the |
00001a50  66 69 6c 74 65 72 0a 20  20 20 4c 44 52 20 20 20  |filter.   LDR   |
00001a60  20 20 72 30 2c 60 74 61  73 6b 68 61 6e 64 6c 65  |  r0,`taskhandle|
00001a70  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001a80  3b 20 72 65 61 64 20 74  68 65 20 74 61 73 6b 68  |; read the taskh|
00001a90  61 6e 64 6c 65 0a 20 20  20 43 4d 50 20 20 20 20  |andle.   CMP    |
00001aa0  20 72 30 2c 23 30 20 20  20 20 20 20 20 20 20 20  | r0,#0          |
00001ab0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00001ac0  20 77 61 73 20 69 74 20  76 61 6c 69 64 20 3f 0a  | was it valid ?.|
00001ad0  20 20 20 53 57 49 4e 45  20 20 20 22 57 69 6d 70  |   SWINE   "Wimp|
00001ae0  5f 43 6c 6f 73 65 44 6f  77 6e 22 20 20 20 20 20  |_CloseDown"     |
00001af0  20 20 20 20 20 20 20 20  20 3b 20 79 65 70 2c 20  |         ; yep, |
00001b00  73 6f 20 73 68 75 74 20  75 73 20 64 6f 77 6e 0a  |so shut us down.|
00001b10  20 20 20 4c 44 52 20 20  20 20 20 72 31 2c 60 6f  |   LDR     r1,`o|
00001b20  6c 64 65 73 63 61 70 65  20 20 20 20 20 20 20 20  |ldescape        |
00001b30  20 20 20 20 20 20 20 20  20 3b 20 72 65 61 64 20  |         ; read |
00001b40  6f 6c 64 20 65 73 63 61  70 65 20 73 74 61 74 65  |old escape state|
00001b50  0a 20 20 20 58 53 57 49  20 20 20 20 22 4f 53 5f  |.   XSWI    "OS_|
00001b60  42 79 74 65 22 2c 32 32  39 2c 2c 30 20 20 20 20  |Byte",229,,0    |
00001b70  20 20 20 20 20 20 20 20  20 20 3b 20 72 65 73 74  |          ; rest|
00001b80  6f 72 65 20 69 74 0a 20  20 20 4c 44 52 20 20 20  |ore it.   LDR   |
00001b90  20 20 72 32 2c 60 72 65  74 75 72 6e 73 74 61 74  |  r2,`returnstat|
00001ba0  65 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |e               |
00001bb0  3b 20 72 65 61 64 20 74  68 65 20 72 65 74 75 72  |; read the retur|
00001bc0  6e 20 63 6f 64 65 0a 20  20 20 52 45 4d 20 20 20  |n code.   REM   |
00001bd0  20 20 22 45 78 69 74 69  6e 67 2e 2e 2e 20 63 6f  |  "Exiting... co|
00001be0  64 65 20 3d 20 25 72 32  22 0a 20 20 20 52 45 4d  |de = %r2".   REM|
00001bf0  20 20 20 20 20 22 22 0a  20 20 20 43 4d 50 20 20  |     "".   CMP  |
00001c00  20 20 20 72 32 2c 23 52  65 74 5f 46 61 69 6c 65  |   r2,#Ret_Faile|
00001c10  64 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |d               |
00001c20  20 3b 20 64 69 64 20 69  74 20 66 61 69 6c 20 3f  | ; did it fail ?|
00001c30  0a 20 20 20 43 4d 50 4e  45 20 20 20 72 32 2c 23  |.   CMPNE   r2,#|
00001c40  52 65 74 5f 4b 69 6c 6c  65 64 20 20 20 20 20 20  |Ret_Killed      |
00001c50  20 20 20 20 20 20 20 20  20 20 3b 20 6f 72 20 77  |          ; or w|
00001c60  61 73 20 69 74 20 6b 69  6c 6c 65 64 20 3f 0a 20  |as it killed ?. |
00001c70  20 20 42 4e 45 20 20 20  20 20 24 65 78 69 74 0a  |  BNE     $exit.|
00001c80  20 20 20 53 57 49 20 20  20 20 20 22 4f 53 5f 57  |   SWI     "OS_W|
00001c90  72 69 74 65 53 22 0a 20  20 20 45 51 55 5a 41 20  |riteS".   EQUZA |
00001ca0  20 20 22 45 78 74 65 72  6e 61 6c 20 65 64 69 74  |  "External edit|
00001cb0  20 66 61 69 6c 65 64 22  0a 20 20 20 53 57 49 20  | failed".   SWI |
00001cc0  20 20 20 20 22 4f 53 5f  4e 65 77 4c 69 6e 65 22  |    "OS_NewLine"|
00001cd0  0a 24 65 78 69 74 0a 20  20 20 53 57 49 20 20 20  |.$exit.   SWI   |
00001ce0  20 20 22 4f 53 5f 45 78  69 74 22 20 20 20 20 20  |  "OS_Exit"     |
00001cf0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001d00  3b 20 72 65 74 75 72 6e  20 74 6f 20 74 6f 70 20  |; return to top |
00001d10  6c 65 76 65 6c 0a 0a 2e  60 6f 6c 64 65 73 63 61  |level...`oldesca|
00001d20  70 65 0a 20 20 20 45 51  55 44 20 20 20 20 30 20  |pe.   EQUD    0 |
00001d30  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001d40  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 6f 6c  |            ; ol|
00001d50  64 20 65 73 63 61 70 65  20 73 74 61 74 65 0a 2e  |d escape state..|
00001d60  60 74 61 73 6b 68 61 6e  64 6c 65 0a 20 20 20 45  |`taskhandle.   E|
00001d70  51 55 44 20 20 20 20 30  20 20 20 20 20 20 20 20  |QUD    0        |
00001d80  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001d90  20 20 20 20 20 3b 20 74  61 73 6b 20 68 61 6e 64  |     ; task hand|
00001da0  6c 65 2c 20 6f 72 20 30  20 69 66 20 27 69 6e 73  |le, or 0 if 'ins|
00001db0  69 64 65 27 20 74 61 73  6b 0a 2e 60 72 65 61 6c  |ide' task..`real|
00001dc0  74 61 73 6b 68 61 6e 64  6c 65 0a 20 20 20 45 51  |taskhandle.   EQ|
00001dd0  55 44 20 20 20 20 30 20  20 20 20 20 20 20 20 20  |UD    0         |
00001de0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001df0  20 20 20 20 3b 20 72 65  61 6c 20 74 61 73 6b 20  |    ; real task |
00001e00  68 61 6e 64 6c 65 0a 2e  60 69 6e 74 61 73 6b 77  |handle..`intaskw|
00001e10  69 6e 64 6f 77 0a 20 20  20 45 51 55 44 20 20 20  |indow.   EQUD   |
00001e20  20 30 20 20 20 20 20 20  20 20 20 20 20 20 20 20  | 0              |
00001e30  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00001e40  20 31 20 69 66 20 77 65  27 72 65 20 69 6e 20 61  | 1 if we're in a|
00001e50  20 74 61 73 6b 77 69 6e  64 6f 77 0a 2e 60 66 69  | taskwindow..`fi|
00001e60  6c 74 65 72 61 64 64 72  0a 20 20 20 45 51 55 44  |lteraddr.   EQUD|
00001e70  20 20 20 20 30 20 20 20  20 20 20 20 20 20 20 20  |    0           |
00001e80  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001e90  20 20 3b 20 61 64 64 72  65 73 73 20 6f 66 20 66  |  ; address of f|
00001ea0  69 6c 74 65 72 6d 61 6e  61 67 65 72 20 63 6f 64  |iltermanager cod|
00001eb0  65 0a 0a 3e 61 64 64 66  69 6c 74 65 72 0a 20 20  |e..>addfilter.  |
00001ec0  20 53 54 4d 46 44 20 20  20 28 73 70 29 21 2c 7b  | STMFD   (sp)!,{|
00001ed0  72 30 2d 72 35 2c 6c 69  6e 6b 7d 20 20 20 20 20  |r0-r5,link}     |
00001ee0  20 20 20 20 20 20 20 3b  20 53 74 61 63 6b 20 72  |       ; Stack r|
00001ef0  65 67 69 73 74 65 72 73  0a 20 20 20 4d 4f 56 20  |egisters.   MOV |
00001f00  20 20 20 20 72 30 2c 23  52 65 74 5f 4e 6f 6e 65  |    r0,#Ret_None|
00001f10  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001f20  20 20 3b 20 6d 61 6b 65  20 73 75 72 65 20 77 65  |  ; make sure we|
00001f30  20 63 61 6e 20 64 6f 20  6d 75 6c 74 69 70 6c 65  | can do multiple|
00001f40  20 65 65 27 73 0a 20 20  20 53 54 52 20 20 20 20  | ee's.   STR    |
00001f50  20 72 30 2c 60 72 65 74  75 72 6e 73 74 61 74 65  | r0,`returnstate|
00001f60  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00001f70  20 73 74 6f 72 65 20 61  73 20 72 65 74 75 72 6e  | store as return|
00001f80  20 73 74 61 74 65 0a 20  20 20 58 53 57 49 20 20  | state.   XSWI  |
00001f90  20 20 22 58 57 69 6d 70  5f 41 64 64 4d 65 73 73  |  "XWimp_AddMess|
00001fa0  61 67 65 73 22 2c 5e 60  65 65 5f 6d 73 67 73 20  |ages",^`ee_msgs |
00001fb0  3b 20 61 64 64 20 74 68  65 20 6d 65 73 73 61 67  |; add the messag|
00001fc0  65 73 20 77 65 20 6e 65  65 64 0a 20 20 20 58 53  |es we need.   XS|
00001fd0  57 49 20 20 20 20 22 57  69 6d 70 5f 52 65 61 64  |WI    "Wimp_Read|
00001fe0  53 79 73 49 6e 66 6f 22  2c 35 20 20 20 20 20 20  |SysInfo",5      |
00001ff0  20 20 20 20 3b 20 72 65  61 64 20 74 61 73 6b 20  |    ; read task |
00002000  68 61 6e 64 6c 65 0a 20  20 20 53 54 52 20 20 20  |handle.   STR   |
00002010  20 20 72 30 2c 60 72 65  61 6c 74 61 73 6b 68 61  |  r0,`realtaskha|
00002020  6e 64 6c 65 20 20 20 20  20 20 20 20 20 20 20 20  |ndle            |
00002030  3b 20 73 74 6f 72 65 20  72 65 61 6c 20 74 61 73  |; store real tas|
00002040  6b 20 68 61 6e 64 6c 65  0a 20 20 20 4d 4f 56 20  |k handle.   MOV |
00002050  20 20 20 20 72 33 2c 72  30 20 20 20 20 20 20 20  |    r3,r0       |
00002060  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002070  20 20 3b 20 72 33 20 3d  20 74 61 73 6b 20 68 61  |  ; r3 = task ha|
00002080  6e 64 6c 65 0a 20 20 20  4c 41 44 52 20 20 20 20  |ndle.   LADR    |
00002090  72 30 2c 60 66 69 6c 74  65 72 6e 61 6d 65 20 20  |r0,`filtername  |
000020a0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
000020b0  66 69 6c 74 65 72 20 6e  61 6d 65 0a 20 20 20 42  |filter name.   B|
000020c0  4c 20 20 20 20 20 20 73  74 72 64 75 70 20 20 20  |L      strdup   |
000020d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000020e0  20 20 20 20 20 3b 20 63  6f 70 79 20 69 74 20 74  |     ; copy it t|
000020f0  6f 20 74 68 65 20 6d 6f  64 75 6c 65 20 61 72 65  |o the module are|
00002100  61 0a 20 20 20 53 54 52  20 20 20 20 20 72 30 2c  |a.   STR     r0,|
00002110  60 66 69 6c 74 65 72 6e  61 6d 65 5f 70 74 72 20  |`filtername_ptr |
00002120  20 20 20 20 20 20 20 20  20 20 20 3b 20 73 74 6f  |           ; sto|
00002130  72 65 20 69 74 20 66 6f  72 20 6c 61 74 65 72 0a  |re it for later.|
00002140  20 20 20 4c 41 44 52 20  20 20 20 72 31 2c 66 69  |   LADR    r1,fi|
00002150  6c 74 65 72 20 20 20 20  20 20 20 20 20 20 20 20  |lter            |
00002160  20 20 20 20 20 20 20 20  20 3b 20 66 69 6c 74 65  |         ; filte|
00002170  72 20 63 6f 64 65 0a 20  20 20 58 53 57 49 20 20  |r code.   XSWI  |
00002180  20 20 22 46 69 6c 74 65  72 5f 52 65 67 69 73 74  |  "Filter_Regist|
00002190  65 72 50 6f 73 74 46 69  6c 74 65 72 22 2c 2c 2c  |erPostFilter",,,|
000021a0  30 2c 2c 30 20 3b 20 69  6e 73 74 61 6c 6c 20 69  |0,,0 ; install i|
000021b0  74 0a 20 20 20 4c 44 4d  46 44 20 20 20 28 73 70  |t.   LDMFD   (sp|
000021c0  29 21 2c 7b 72 30 2d 72  35 2c 70 63 7d 20 20 20  |)!,{r0-r5,pc}   |
000021d0  20 20 20 20 20 20 20 20  20 20 20 3b 20 52 65 74  |           ; Ret|
000021e0  75 72 6e 20 66 72 6f 6d  20 63 61 6c 6c 0a 0a 3e  |urn from call..>|
000021f0  72 65 6d 6f 76 65 66 69  6c 74 65 72 0a 20 20 20  |removefilter.   |
00002200  53 54 4d 46 44 20 20 20  28 73 70 29 21 2c 7b 72  |STMFD   (sp)!,{r|
00002210  30 2d 72 35 2c 6c 69 6e  6b 7d 20 20 20 20 20 20  |0-r5,link}      |
00002220  20 20 20 20 20 20 3b 20  53 74 61 63 6b 20 72 65  |      ; Stack re|
00002230  67 69 73 74 65 72 73 0a  20 20 20 58 53 57 49 20  |gisters.   XSWI |
00002240  20 20 20 22 57 69 6d 70  5f 52 65 61 64 53 79 73  |   "Wimp_ReadSys|
00002250  49 6e 66 6f 22 2c 35 20  20 20 20 20 20 20 20 20  |Info",5         |
00002260  20 3b 20 72 65 61 64 20  74 61 73 6b 20 68 61 6e  | ; read task han|
00002270  64 6c 65 0a 20 20 20 4d  4f 56 20 20 20 20 20 72  |dle.   MOV     r|
00002280  33 2c 72 30 20 20 20 20  20 20 20 20 20 20 20 20  |3,r0            |
00002290  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 72  |             ; r|
000022a0  33 20 3d 20 74 61 73 6b  20 68 61 6e 64 6c 65 0a  |3 = task handle.|
000022b0  20 20 20 4c 44 52 20 20  20 20 20 72 30 2c 60 66  |   LDR     r0,`f|
000022c0  69 6c 74 65 72 6e 61 6d  65 5f 70 74 72 20 20 20  |iltername_ptr   |
000022d0  20 20 20 20 20 20 20 20  20 3b 20 66 69 6c 74 65  |         ; filte|
000022e0  72 20 6e 61 6d 65 20 70  6f 69 6e 74 65 72 0a 20  |r name pointer. |
000022f0  20 20 43 4d 50 20 20 20  20 20 72 30 2c 23 30 20  |  CMP     r0,#0 |
00002300  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002310  20 20 20 20 20 20 20 20  3b 20 69 73 20 69 74 20  |        ; is it |
00002320  30 20 3f 0a 20 20 20 42  45 51 20 20 20 20 20 24  |0 ?.   BEQ     $|
00002330  65 78 69 74 20 20 20 20  20 20 20 20 20 20 20 20  |exit            |
00002340  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 69  |             ; i|
00002350  66 20 73 6f 2c 20 77 65  27 76 65 20 61 6c 72 65  |f so, we've alre|
00002360  61 64 79 20 72 65 6c 65  61 73 65 64 0a 20 20 20  |ady released.   |
00002370  4c 41 44 52 20 20 20 20  72 31 2c 66 69 6c 74 65  |LADR    r1,filte|
00002380  72 0a 20 20 20 58 53 57  49 20 20 20 20 22 46 69  |r.   XSWI    "Fi|
00002390  6c 74 65 72 5f 44 65 52  65 67 69 73 74 65 72 50  |lter_DeRegisterP|
000023a0  6f 73 74 46 69 6c 74 65  72 22 2c 2c 2c 30 2c 2c  |ostFilter",,,0,,|
000023b0  30 20 3b 20 72 65 6d 6f  76 65 0a 20 20 20 42 4c  |0 ; remove.   BL|
000023c0  20 20 20 20 20 20 72 65  6c 65 61 73 65 20 20 20  |      release   |
000023d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000023e0  20 20 20 20 3b 20 72 65  6c 65 61 73 65 20 74 68  |    ; release th|
000023f0  65 20 66 69 6c 74 65 72  6e 61 6d 65 20 62 6c 6f  |e filtername blo|
00002400  63 6b 0a 20 20 20 4d 4f  56 20 20 20 20 20 72 30  |ck.   MOV     r0|
00002410  2c 23 30 0a 20 20 20 53  54 52 20 20 20 20 20 72  |,#0.   STR     r|
00002420  30 2c 60 66 69 6c 74 65  72 6e 61 6d 65 5f 70 74  |0,`filtername_pt|
00002430  72 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 7a  |r            ; z|
00002440  65 72 6f 20 74 68 65 20  6e 61 6d 65 20 70 6f 69  |ero the name poi|
00002450  6e 74 65 72 0a 24 65 78  69 74 0a 20 20 20 4c 44  |nter.$exit.   LD|
00002460  4d 46 44 20 20 20 28 73  70 29 21 2c 7b 72 30 2d  |MFD   (sp)!,{r0-|
00002470  72 35 2c 70 63 7d 20 20  20 20 20 20 20 20 20 20  |r5,pc}          |
00002480  20 20 20 20 3b 20 52 65  74 75 72 6e 20 66 72 6f  |    ; Return fro|
00002490  6d 20 63 61 6c 6c 0a 0a  2e 60 62 6c 6b 0a 20 20  |m call...`blk.  |
000024a0  20 52 45 53 20 20 20 20  20 32 35 36 20 20 20 20  | RES     256    |
000024b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000024c0  20 20 20 20 20 20 20 3b  20 6a 75 73 74 20 61 20  |       ; just a |
000024d0  66 65 77 20 62 79 74 65  73 0a 0a 3e 65 65 5f 69  |few bytes..>ee_i|
000024e0  6e 69 74 69 61 74 65 0a  20 20 20 53 54 4d 46 44  |nitiate.   STMFD|
000024f0  20 20 20 28 73 70 29 21  2c 7b 72 30 2d 72 35 2c  |   (sp)!,{r0-r5,|
00002500  6c 69 6e 6b 7d 20 20 20  20 20 20 20 20 20 20 20  |link}           |
00002510  20 3b 20 53 74 61 63 6b  20 72 65 67 69 73 74 65  | ; Stack registe|
00002520  72 73 0a 20 20 20 41 44  52 20 20 20 20 20 72 35  |rs.   ADR     r5|
00002530  2c 60 62 6c 6b 20 20 20  20 20 20 20 20 20 20 20  |,`blk           |
00002540  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 74 68  |            ; th|
00002550  65 20 62 6c 6f 63 6b 20  62 61 73 65 0a 20 20 20  |e block base.   |
00002560  4c 44 52 20 20 20 20 20  72 30 2c 60 65 64 69 74  |LDR     r0,`edit|
00002570  6e 61 6d 65 20 20 20 20  20 20 20 20 20 20 20 20  |name            |
00002580  20 20 20 20 20 20 3b 20  74 68 65 20 6e 61 6d 65  |      ; the name|
00002590  20 66 6f 72 20 74 68 65  20 65 64 69 74 6f 72 0a  | for the editor.|
000025a0  20 20 20 42 4c 20 20 20  20 20 20 73 74 72 6c 65  |   BL      strle|
000025b0  6e 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |n               |
000025c0  20 20 20 20 20 20 20 20  20 3b 20 66 69 6e 64 20  |         ; find |
000025d0  6c 65 6e 20 74 6f 20 72  31 0a 20 20 20 41 44 44  |len to r1.   ADD|
000025e0  20 20 20 20 20 72 31 2c  72 31 2c 23 35 32 2b 33  |     r1,r1,#52+3|
000025f0  2b 31 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |+1              |
00002600  20 20 20 3b 20 35 32 20  66 6f 72 20 62 61 73 65  |   ; 52 for base|
00002610  2c 20 33 20 74 6f 20 61  6c 69 67 6e 2c 20 31 20  |, 3 to align, 1 |
00002620  74 65 72 6d 0a 20 20 20  42 49 43 20 20 20 20 20  |term.   BIC     |
00002630  72 31 2c 72 31 2c 23 33  20 20 20 20 20 20 20 20  |r1,r1,#3        |
00002640  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
00002650  61 6c 69 67 6e 0a 20 20  20 53 54 52 20 20 20 20  |align.   STR    |
00002660  20 72 31 2c 5b 72 35 2c  23 30 5d 20 20 20 20 20  | r1,[r5,#0]     |
00002670  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00002680  20 73 74 6f 72 65 20 61  73 20 62 6c 6f 63 6b 20  | store as block |
00002690  6c 65 6e 67 74 68 0a 20  20 20 4c 44 52 20 20 20  |length.   LDR   |
000026a0  20 20 72 33 2c 60 65 65  5f 65 64 69 74 72 71 0a  |  r3,`ee_editrq.|
000026b0  20 20 20 53 54 52 20 20  20 20 20 72 33 2c 5b 72  |   STR     r3,[r|
000026c0  35 2c 23 31 36 5d 20 20  20 20 20 20 20 20 20 20  |5,#16]          |
000026d0  20 20 20 20 20 20 20 20  20 3b 20 73 74 6f 72 65  |         ; store|
000026e0  20 61 73 20 6d 65 73 73  61 67 65 0a 20 20 20 41  | as message.   A|
000026f0  44 44 20 20 20 20 20 72  31 2c 72 35 2c 23 35 32  |DD     r1,r5,#52|
00002700  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002710  20 20 20 20 20 3b 20 72  31 2d 3e 20 62 6c 6f 63  |     ; r1-> bloc|
00002720  6b 20 2b 20 35 32 0a 20  20 20 42 4c 20 20 20 20  |k + 52.   BL    |
00002730  20 20 73 74 72 63 70 79  20 20 20 20 20 20 20 20  |  strcpy        |
00002740  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002750  3b 20 63 6f 70 79 20 65  64 69 74 20 6e 61 6d 65  |; copy edit name|
00002760  20 74 68 65 72 65 0a 20  20 20 4c 44 52 20 20 20  | there.   LDR   |
00002770  20 20 72 30 2c 60 70 61  72 65 6e 74 20 20 20 20  |  r0,`parent    |
00002780  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002790  3b 20 72 65 61 64 20 2d  3e 20 70 61 72 65 6e 74  |; read -> parent|
000027a0  20 6e 61 6d 65 0a 20 20  20 41 44 44 20 20 20 20  | name.   ADD    |
000027b0  20 72 31 2c 72 35 2c 23  33 32 20 20 20 20 20 20  | r1,r5,#32      |
000027c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
000027d0  20 72 31 2d 3e 20 62 6c  6f 63 6b 20 2b 20 33 32  | r1-> block + 32|
000027e0  0a 20 20 20 42 4c 20 20  20 20 20 20 73 74 72 63  |.   BL      strc|
000027f0  70 79 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |py              |
00002800  20 20 20 20 20 20 20 20  20 20 3b 20 63 6f 70 79  |          ; copy|
00002810  20 70 61 72 65 6e 74 20  6e 61 6d 65 20 74 68 65  | parent name the|
00002820  72 65 0a 20 20 20 4c 44  52 20 20 20 20 20 72 30  |re.   LDR     r0|
00002830  2c 60 66 69 6c 65 74 79  70 65 20 20 20 20 20 20  |,`filetype      |
00002840  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 66 69  |            ; fi|
00002850  6c 65 74 79 70 65 0a 20  20 20 53 54 52 20 20 20  |letype.   STR   |
00002860  20 20 72 30 2c 5b 72 35  2c 23 32 30 5d 20 20 20  |  r0,[r5,#20]   |
00002870  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002880  3b 20 73 74 6f 72 65 20  61 73 20 64 61 74 61 74  |; store as datat|
00002890  79 70 65 0a 20 20 20 53  57 49 20 20 20 20 20 22  |ype.   SWI     "|
000028a0  4f 53 5f 52 65 61 64 4d  6f 6e 6f 74 6f 6e 69 63  |OS_ReadMonotonic|
000028b0  54 69 6d 65 22 0a 20 20  20 42 49 43 20 20 20 20  |Time".   BIC    |
000028c0  20 72 30 2c 72 30 2c 23  26 46 46 30 30 30 30 30  | r0,r0,#&FF00000|
000028d0  30 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |0              ;|
000028e0  20 63 6c 65 61 72 20 74  6f 70 20 62 69 74 73 0a  | clear top bits.|
000028f0  20 20 20 42 49 43 20 20  20 20 20 72 30 2c 72 30  |   BIC     r0,r0|
00002900  2c 23 26 30 30 46 46 30  30 30 30 20 20 20 20 20  |,#&00FF0000     |
00002910  20 20 20 20 20 20 20 20  20 3b 20 63 6c 65 61 72  |         ; clear|
00002920  20 74 6f 70 2d 6d 69 64  20 62 69 74 73 0a 20 20  | top-mid bits.  |
00002930  20 53 54 52 20 20 20 20  20 72 30 2c 5b 72 35 2c  | STR     r0,[r5,|
00002940  23 32 34 5d 20 20 20 20  20 20 20 20 20 20 20 20  |#24]            |
00002950  20 20 20 20 20 20 20 3b  20 73 74 6f 72 65 20 61  |       ; store a|
00002960  73 20 6a 6f 62 20 68 61  6e 64 6c 65 0a 20 20 20  |s job handle.   |
00002970  4d 4f 56 20 20 20 20 20  72 30 2c 23 30 20 20 20  |MOV     r0,#0   |
00002980  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002990  20 20 20 20 20 20 3b 20  6a 75 73 74 20 65 64 69  |      ; just edi|
000029a0  74 20 61 6e 64 20 72 65  74 75 72 6e 20 6f 6e 20  |t and return on |
000029b0  73 61 76 65 0a 20 20 20  53 54 52 20 20 20 20 20  |save.   STR     |
000029c0  72 30 2c 5b 72 35 2c 23  32 38 5d 20 20 20 20 20  |r0,[r5,#28]     |
000029d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
000029e0  73 74 6f 72 65 20 61 73  20 66 6c 61 67 73 0a 20  |store as flags. |
000029f0  20 20 53 54 52 20 20 20  20 20 72 30 2c 5b 72 35  |  STR     r0,[r5|
00002a00  2c 23 31 32 5d 20 20 20  20 20 20 20 20 20 20 20  |,#12]           |
00002a10  20 20 20 20 20 20 20 20  3b 20 73 74 6f 72 65 20  |        ; store |
00002a20  61 73 20 6f 75 72 72 65  66 0a 20 20 20 58 53 57  |as ourref.   XSW|
00002a30  49 20 20 20 20 22 57 69  6d 70 5f 53 65 6e 64 4d  |I    "Wimp_SendM|
00002a40  65 73 73 61 67 65 22 2c  31 38 2c 5e 60 62 6c 6b  |essage",18,^`blk|
00002a50  2c 30 20 3b 20 62 72 6f  61 64 63 61 73 74 20 72  |,0 ; broadcast r|
00002a60  65 63 6f 72 64 65 64 0a  3b 20 73 65 74 20 6e 65  |ecorded.; set ne|
00002a70  77 20 73 74 61 74 65 0a  20 20 20 4d 4f 56 20 20  |w state.   MOV  |
00002a80  20 20 20 72 30 2c 23 53  5f 41 77 61 69 74 41 63  |   r0,#S_AwaitAc|
00002a90  6b 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |k               |
00002aa0  20 3b 20 61 77 61 69 74  69 6e 67 20 27 61 63 6b  | ; awaiting 'ack|
00002ab0  27 20 6d 65 73 73 61 67  65 0a 20 20 20 53 54 52  |' message.   STR|
00002ac0  20 20 20 20 20 72 30 2c  60 66 69 6c 74 65 72 73  |     r0,`filters|
00002ad0  74 61 74 65 20 20 20 20  20 20 20 20 20 20 20 20  |tate            |
00002ae0  20 20 20 3b 20 73 74 6f  72 65 20 69 74 0a 20 20  |   ; store it.  |
00002af0  20 4c 44 4d 46 44 20 20  20 28 73 70 29 21 2c 7b  | LDMFD   (sp)!,{|
00002b00  72 30 2d 72 35 2c 70 63  7d 20 20 20 20 20 20 20  |r0-r5,pc}       |
00002b10  20 20 20 20 20 20 20 3b  20 52 65 74 75 72 6e 20  |       ; Return |
00002b20  66 72 6f 6d 20 63 61 6c  6c 0a 0a 2e 60 70 61 72  |from call...`par|
00002b30  65 6e 74 0a 20 20 20 45  51 55 44 20 20 20 20 60  |ent.   EQUD    `|
00002b40  73 74 61 74 69 63 5f 70  61 72 65 6e 74 0a 2e 60  |static_parent..`|
00002b50  65 64 69 74 6e 61 6d 65  0a 20 20 20 45 51 55 44  |editname.   EQUD|
00002b60  20 20 20 20 60 73 74 61  74 69 63 5f 65 64 69 74  |    `static_edit|
00002b70  6e 61 6d 65 0a 2e 60 66  69 6c 65 6e 61 6d 65 0a  |name..`filename.|
00002b80  20 20 20 45 51 55 44 20  20 20 20 60 73 74 61 74  |   EQUD    `stat|
00002b90  69 63 5f 66 69 6c 65 6e  61 6d 65 0a 2e 60 66 69  |ic_filename..`fi|
00002ba0  6c 65 74 79 70 65 0a 20  20 20 45 51 55 44 20 20  |letype.   EQUD  |
00002bb0  20 20 26 46 46 46 20 20  20 20 20 20 20 20 20 20  |  &FFF          |
00002bc0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002bd0  3b 20 74 65 78 74 20 66  69 6c 65 0a 2e 60 6f 6c  |; text file..`ol|
00002be0  64 74 79 70 65 0a 20 20  20 45 51 55 44 20 20 20  |dtype.   EQUD   |
00002bf0  20 26 46 46 46 20 20 20  20 20 20 20 20 20 20 20  | &FFF           |
00002c00  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00002c10  20 69 74 27 73 20 6f 72  69 67 69 6e 61 6c 20 74  | it's original t|
00002c20  79 70 65 0a 2e 60 74 65  6d 70 6e 61 6d 65 0a 20  |ype..`tempname. |
00002c30  20 20 45 51 55 5a 20 20  20 20 22 3c 57 69 6d 70  |  EQUZ    "<Wimp|
00002c40  24 53 63 72 61 70 3e 22  0a 0a 2e 60 73 74 61 74  |$Scrap>"...`stat|
00002c50  69 63 5f 65 64 69 74 6e  61 6d 65 0a 20 20 20 45  |ic_editname.   E|
00002c60  51 55 5a 20 20 20 20 22  45 64 69 74 22 0a 2e 60  |QUZ    "Edit"..`|
00002c70  73 74 61 74 69 63 5f 66  69 6c 65 6e 61 6d 65 0a  |static_filename.|
00002c80  20 20 20 52 45 53 20 20  20 20 20 32 35 36 20 20  |   RES     256  |
00002c90  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002ca0  20 20 20 20 20 20 20 20  20 3b 20 72 65 73 65 72  |         ; reser|
00002cb0  76 65 20 73 6f 6d 65 20  72 6f 6f 6d 0a 2e 60 73  |ve some room..`s|
00002cc0  74 61 74 69 63 5f 70 61  72 65 6e 74 0a 20 20 20  |tatic_parent.   |
00002cd0  45 51 55 5a 41 20 20 20  22 45 45 54 61 73 6b 22  |EQUZA   "EETask"|
00002ce0  0a 0a 3b 20 4d 65 73 73  61 67 65 73 20 77 65 20  |..; Messages we |
00002cf0  2f 6e 65 65 64 2f a0 74  6f 20 72 65 63 65 69 76  |/need/.to receiv|
00002d00  65 20 74 6f 20 77 6f 72  6b 20 70 72 6f 70 65 72  |e to work proper|
00002d10  6c 79 0a 2e 60 65 65 5f  6d 73 67 73 0a 20 20 20  |ly..`ee_msgs.   |
00002d20  45 51 55 44 20 20 20 20  32 20 20 20 20 20 20 20  |EQUD    2       |
00002d30  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002d40  20 20 20 20 20 20 3b 20  64 61 74 61 73 61 76 65  |      ; datasave|
00002d50  61 63 6b 20 28 66 6f 72  20 72 65 74 75 72 6e 73  |ack (for returns|
00002d60  29 0a 20 20 20 45 51 55  44 20 20 20 20 33 20 20  |).   EQUD    3  |
00002d70  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002d80  20 20 20 20 20 20 20 20  20 20 20 3b 20 64 61 74  |           ; dat|
00002d90  61 6c 6f 61 64 20 28 66  6f 72 20 73 65 6e 64 73  |aload (for sends|
00002da0  29 0a 20 20 20 45 51 55  44 20 20 20 20 34 20 20  |).   EQUD    4  |
00002db0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002dc0  20 20 20 20 20 20 20 20  20 20 20 3b 20 64 61 74  |           ; dat|
00002dd0  61 6c 6f 61 64 61 63 6b  20 28 66 6f 72 20 72 65  |aloadack (for re|
00002de0  74 75 72 6e 73 29 0a 2e  60 65 65 5f 65 64 69 74  |turns)..`ee_edit|
00002df0  72 71 0a 20 20 20 45 51  55 44 20 20 20 20 26 34  |rq.   EQUD    &4|
00002e00  35 64 38 30 20 20 20 20  20 20 20 20 20 20 20 20  |5d80            |
00002e10  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 4d 65  |            ; Me|
00002e20  73 73 61 67 65 5f 45 64  69 74 52 71 0a 2e 60 65  |ssage_EditRq..`e|
00002e30  65 5f 65 64 69 74 61 63  6b 0a 20 20 20 45 51 55  |e_editack.   EQU|
00002e40  44 20 20 20 20 26 34 35  64 38 31 20 20 20 20 20  |D    &45d81     |
00002e50  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002e60  20 20 20 3b 20 4d 65 73  73 61 67 65 5f 45 64 69  |   ; Message_Edi|
00002e70  74 41 63 6b 0a 2e 60 65  65 5f 72 65 74 75 72 6e  |tAck..`ee_return|
00002e80  0a 20 20 20 45 51 55 44  20 20 20 20 26 34 35 64  |.   EQUD    &45d|
00002e90  38 32 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |82              |
00002ea0  20 20 20 20 20 20 20 20  20 20 3b 20 4d 65 73 73  |          ; Mess|
00002eb0  61 67 65 5f 45 64 69 74  52 65 74 75 72 6e 0a 2e  |age_EditReturn..|
00002ec0  60 65 65 5f 61 62 6f 72  74 0a 20 20 20 45 51 55  |`ee_abort.   EQU|
00002ed0  44 20 20 20 20 26 34 35  64 38 33 20 20 20 20 20  |D    &45d83     |
00002ee0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002ef0  20 20 20 3b 20 4d 65 73  73 61 67 65 5f 45 64 69  |   ; Message_Edi|
00002f00  74 41 62 6f 72 74 0a 2e  60 65 65 5f 64 61 74 61  |tAbort..`ee_data|
00002f10  73 61 76 65 0a 20 20 20  45 51 55 44 20 20 20 20  |save.   EQUD    |
00002f20  26 34 35 64 38 34 20 20  20 20 20 20 20 20 20 20  |&45d84          |
00002f30  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
00002f40  4d 65 73 73 61 67 65 5f  45 64 69 74 44 61 74 61  |Message_EditData|
00002f50  53 61 76 65 0a 3b 20 65  6e 64 20 6f 66 20 6c 69  |Save.; end of li|
00002f60  73 74 0a 20 20 20 45 51  55 44 20 20 20 20 30 0a  |st.   EQUD    0.|
00002f70  0a 2e 60 65 65 5f 6a 6f  62 68 61 6e 64 6c 65 0a  |..`ee_jobhandle.|
00002f80  20 20 20 45 51 55 44 20  20 20 20 30 20 20 20 20  |   EQUD    0    |
00002f90  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002fa0  20 20 20 20 20 20 20 20  20 3b 20 74 68 65 20 6a  |         ; the j|
00002fb0  6f 62 20 68 61 6e 64 6c  65 0a 2e 60 65 65 5f 74  |ob handle..`ee_t|
00002fc0  61 73 6b 68 61 6e 64 6c  65 0a 20 20 20 45 51 55  |askhandle.   EQU|
00002fd0  44 20 20 20 20 30 20 20  20 20 20 20 20 20 20 20  |D    0          |
00002fe0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002ff0  20 20 20 3b 20 74 68 65  69 72 20 74 61 73 6b 20  |   ; their task |
00003000  68 61 6e 64 6c 65 0a 0a  2e 60 66 69 6c 74 65 72  |handle...`filter|
00003010  6e 61 6d 65 5f 70 74 72  0a 20 20 20 45 51 55 44  |name_ptr.   EQUD|
00003020  20 20 20 20 30 20 20 20  20 20 20 20 20 20 20 20  |    0           |
00003030  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003040  20 20 3b 20 6e 61 6d 65  20 70 6f 69 6e 74 65 72  |  ; name pointer|
00003050  20 28 66 6f 72 20 72 65  6c 65 61 73 65 29 0a 2e  | (for release)..|
00003060  60 66 69 6c 74 65 72 73  74 61 74 65 0a 20 20 20  |`filterstate.   |
00003070  45 51 55 44 20 20 20 20  30 20 20 20 20 20 20 20  |EQUD    0       |
00003080  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003090  20 20 20 20 20 20 3b 20  74 68 65 20 73 74 61 74  |      ; the stat|
000030a0  65 20 6f 66 20 74 68 65  20 66 69 6c 74 65 72 20  |e of the filter |
000030b0  6d 61 6e 61 67 65 72 0a  2e 60 72 65 74 75 72 6e  |manager..`return|
000030c0  73 74 61 74 65 0a 20 20  20 45 51 55 44 20 20 20  |state.   EQUD   |
000030d0  20 52 65 74 5f 4e 6f 6e  65 20 20 20 20 20 20 20  | Ret_None       |
000030e0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
000030f0  20 74 68 65 20 73 74 61  74 65 20 77 65 27 72 65  | the state we're|
00003100  20 72 65 74 75 72 6e 69  6e 67 0a 2e 60 66 69 6c  | returning..`fil|
00003110  74 65 72 6e 61 6d 65 0a  20 20 20 45 51 55 5a 41  |tername.   EQUZA|
00003120  20 20 20 22 45 78 74 65  72 6e 61 6c 45 64 69 74  |   "ExternalEdit|
00003130  20 66 69 6c 74 65 72 22  0a 0a 3b 20 61 62 6f 72  | filter"..; abor|
00003140  74 20 74 68 65 20 65 64  69 74 0a 3e 65 65 5f 61  |t the edit.>ee_a|
00003150  62 6f 72 74 0a 20 20 20  53 54 4d 46 44 20 20 20  |bort.   STMFD   |
00003160  28 73 70 29 21 2c 7b 72  30 2d 72 35 2c 6c 69 6e  |(sp)!,{r0-r5,lin|
00003170  6b 7d 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |k}            ; |
00003180  53 74 61 63 6b 20 72 65  67 69 73 74 65 72 73 0a  |Stack registers.|
00003190  20 20 20 52 45 4d 20 20  20 20 20 22 53 65 6e 64  |   REM     "Send|
000031a0  69 6e 67 20 61 62 6f 72  74 20 6d 65 73 73 61 67  |ing abort messag|
000031b0  65 22 0a 20 20 20 41 44  52 20 20 20 20 20 72 35  |e".   ADR     r5|
000031c0  2c 60 62 6c 6b 20 20 20  20 20 20 20 20 20 20 20  |,`blk           |
000031d0  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 6f 75  |            ; ou|
000031e0  72 20 77 6f 72 6b 73 70  61 63 65 0a 20 20 20 4d  |r workspace.   M|
000031f0  4f 56 20 20 20 20 20 72  30 2c 23 32 38 20 20 20  |OV     r0,#28   |
00003200  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003210  20 20 20 20 20 3b 20 6c  65 6e 67 74 68 20 6f 66  |     ; length of|
00003220  20 6d 65 73 73 61 67 65  0a 20 20 20 53 54 52 20  | message.   STR |
00003230  20 20 20 20 72 30 2c 5b  72 35 2c 23 30 5d 20 20  |    r0,[r5,#0]  |
00003240  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003250  20 20 3b 20 73 74 6f 72  65 20 6c 65 6e 0a 20 20  |  ; store len.  |
00003260  20 4d 4f 56 20 20 20 20  20 72 30 2c 23 30 0a 20  | MOV     r0,#0. |
00003270  20 20 53 54 52 20 20 20  20 20 72 30 2c 5b 72 35  |  STR     r0,[r5|
00003280  2c 23 32 30 5d 20 20 20  20 20 20 20 20 20 20 20  |,#20]           |
00003290  20 20 20 20 20 20 20 20  3b 20 73 74 6f 72 65 20  |        ; store |
000032a0  30 20 76 61 6c 75 65 0a  20 20 20 4c 44 52 20 20  |0 value.   LDR  |
000032b0  20 20 20 72 30 2c 60 65  65 5f 6a 6f 62 68 61 6e  |   r0,`ee_jobhan|
000032c0  64 6c 65 0a 20 20 20 53  54 52 20 20 20 20 20 72  |dle.   STR     r|
000032d0  30 2c 5b 72 35 2c 23 32  34 5d 20 20 20 20 20 20  |0,[r5,#24]      |
000032e0  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 73  |             ; s|
000032f0  74 6f 72 65 20 6a 6f 62  20 68 61 6e 64 6c 65 0a  |tore job handle.|
00003300  20 20 20 4c 44 52 20 20  20 20 20 72 30 2c 60 65  |   LDR     r0,`e|
00003310  65 5f 61 62 6f 72 74 20  20 20 20 20 20 20 20 20  |e_abort         |
00003320  20 20 20 20 20 20 20 20  20 3b 20 65 64 69 74 20  |         ; edit |
00003330  61 62 6f 72 74 0a 20 20  20 53 54 52 20 20 20 20  |abort.   STR    |
00003340  20 72 30 2c 5b 72 35 2c  23 31 36 5d 20 20 20 20  | r0,[r5,#16]    |
00003350  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00003360  20 73 74 6f 72 65 20 69  74 0a 20 20 20 4c 44 52  | store it.   LDR|
00003370  20 20 20 20 20 72 32 2c  60 65 65 5f 74 61 73 6b  |     r2,`ee_task|
00003380  68 61 6e 64 6c 65 20 20  20 20 20 20 20 20 20 20  |handle          |
00003390  20 20 20 3b 20 74 68 65  69 72 20 68 61 6e 64 6c  |   ; their handl|
000033a0  65 0a 20 20 20 58 53 57  49 20 20 20 20 22 57 69  |e.   XSWI    "Wi|
000033b0  6d 70 5f 53 65 6e 64 4d  65 73 73 61 67 65 22 2c  |mp_SendMessage",|
000033c0  31 37 2c 72 35 20 20 20  20 20 20 3b 20 73 65 6e  |17,r5      ; sen|
000033d0  64 20 69 74 0a 3b 20 73  65 74 20 6e 65 77 20 73  |d it.; set new s|
000033e0  74 61 74 65 0a 20 20 20  4d 4f 56 20 20 20 20 20  |tate.   MOV     |
000033f0  72 30 2c 23 53 5f 4e 6f  6e 65 20 20 20 20 20 20  |r0,#S_None      |
00003400  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
00003410  77 65 27 72 65 20 6e 6f  74 20 69 6e 20 61 6e 79  |we're not in any|
00003420  20 73 74 61 74 65 0a 20  20 20 53 54 52 20 20 20  | state.   STR   |
00003430  20 20 72 30 2c 60 66 69  6c 74 65 72 73 74 61 74  |  r0,`filterstat|
00003440  65 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |e               |
00003450  3b 20 73 74 6f 72 65 20  69 74 0a 20 20 20 4c 44  |; store it.   LD|
00003460  4d 46 44 20 20 20 28 73  70 29 21 2c 7b 72 30 2d  |MFD   (sp)!,{r0-|
00003470  72 35 2c 70 63 7d 20 20  20 20 20 20 20 20 20 20  |r5,pc}          |
00003480  20 20 20 20 3b 20 52 65  74 75 72 6e 20 66 72 6f  |    ; Return fro|
00003490  6d 20 63 61 6c 6c 0a 0a  3b 20 74 72 79 20 74 6f  |m call..; try to|
000034a0  20 72 65 74 75 72 6e 20  74 68 65 20 66 69 6c 65  | return the file|
000034b0  20 74 6f 20 75 73 0a 3e  65 65 5f 72 65 74 75 72  | to us.>ee_retur|
000034c0  6e 0a 20 20 20 53 54 4d  46 44 20 20 20 28 73 70  |n.   STMFD   (sp|
000034d0  29 21 2c 7b 72 30 2d 72  35 2c 6c 69 6e 6b 7d 20  |)!,{r0-r5,link} |
000034e0  20 20 20 20 20 20 20 20  20 20 20 3b 20 53 74 61  |           ; Sta|
000034f0  63 6b 20 72 65 67 69 73  74 65 72 73 0a 20 20 20  |ck registers.   |
00003500  52 45 4d 20 20 20 20 20  22 41 74 74 65 6d 70 74  |REM     "Attempt|
00003510  69 6e 67 20 67 65 74 20  64 61 74 61 20 62 61 63  |ing get data bac|
00003520  6b 20 66 72 6f 6d 20 5a  61 70 22 0a 20 20 20 4d  |k from Zap".   M|
00003530  4f 56 20 20 20 20 20 72  35 2c 72 31 20 20 20 20  |OV     r5,r1    |
00003540  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003550  20 20 20 20 20 3b 20 72  35 2d 3e 20 62 6c 6f 63  |     ; r5-> bloc|
00003560  6b 0a 20 20 20 4c 44 52  20 20 20 20 20 72 30 2c  |k.   LDR     r0,|
00003570  60 66 69 6c 65 74 79 70  65 20 20 20 20 20 20 20  |`filetype       |
00003580  20 20 20 20 20 20 20 20  20 20 20 3b 20 66 69 6c  |           ; fil|
00003590  65 74 79 70 65 0a 20 20  20 53 54 52 20 20 20 20  |etype.   STR    |
000035a0  20 72 30 2c 5b 72 35 2c  23 32 30 5d 20 20 20 20  | r0,[r5,#20]    |
000035b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
000035c0  20 73 74 6f 72 65 20 74  68 61 74 0a 20 20 20 4d  | store that.   M|
000035d0  4f 56 20 20 20 20 20 72  30 2c 23 30 20 20 20 20  |OV     r0,#0    |
000035e0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000035f0  20 20 20 20 20 3b 20 6e  6f 74 20 72 65 70 6c 79  |     ; not reply|
00003600  0a 20 20 20 53 54 52 20  20 20 20 20 72 30 2c 5b  |.   STR     r0,[|
00003610  72 35 2c 23 31 32 5d 20  20 20 20 20 20 20 20 20  |r5,#12]         |
00003620  20 20 20 20 20 20 20 20  20 20 3b 20 73 74 6f 72  |          ; stor|
00003630  65 20 61 73 20 6f 75 72  72 65 66 0a 20 20 20 4c  |e as ourref.   L|
00003640  44 52 20 20 20 20 20 72  30 2c 60 65 65 5f 6a 6f  |DR     r0,`ee_jo|
00003650  62 68 61 6e 64 6c 65 0a  20 20 20 53 54 52 20 20  |bhandle.   STR  |
00003660  20 20 20 72 30 2c 5b 72  35 2c 23 32 34 5d 20 20  |   r0,[r5,#24]  |
00003670  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003680  20 3b 20 73 74 6f 72 65  20 6a 6f 62 20 68 61 6e  | ; store job han|
00003690  64 6c 65 0a 20 20 20 4c  44 52 20 20 20 20 20 72  |dle.   LDR     r|
000036a0  30 2c 60 65 65 5f 72 65  74 75 72 6e 20 20 20 20  |0,`ee_return    |
000036b0  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 72  |             ; r|
000036c0  65 74 75 72 6e 20 72 65  71 75 65 73 74 0a 20 20  |eturn request.  |
000036d0  20 53 54 52 20 20 20 20  20 72 30 2c 5b 72 35 2c  | STR     r0,[r5,|
000036e0  23 31 36 5d 20 20 20 20  20 20 20 20 20 20 20 20  |#16]            |
000036f0  20 20 20 20 20 20 20 3b  20 73 74 6f 72 65 20 69  |       ; store i|
00003700  74 0a 20 20 20 4c 44 52  20 20 20 20 20 72 32 2c  |t.   LDR     r2,|
00003710  60 65 65 5f 74 61 73 6b  68 61 6e 64 6c 65 20 20  |`ee_taskhandle  |
00003720  20 20 20 20 20 20 20 20  20 20 20 3b 20 74 68 65  |           ; the|
00003730  69 72 20 68 61 6e 64 6c  65 0a 20 20 20 58 53 57  |ir handle.   XSW|
00003740  49 20 20 20 20 22 57 69  6d 70 5f 53 65 6e 64 4d  |I    "Wimp_SendM|
00003750  65 73 73 61 67 65 22 2c  31 37 2c 72 35 20 20 20  |essage",17,r5   |
00003760  20 20 20 3b 20 73 65 6e  64 20 69 74 0a 3b 20 73  |   ; send it.; s|
00003770  65 74 20 6e 65 77 20 73  74 61 74 65 0a 20 20 20  |et new state.   |
00003780  4d 4f 56 20 20 20 20 20  72 30 2c 23 53 5f 41 77  |MOV     r0,#S_Aw|
00003790  61 69 74 45 53 61 76 65  20 20 20 20 20 20 20 20  |aitESave        |
000037a0  20 20 20 20 20 20 3b 20  61 77 61 69 74 69 6e 67  |      ; awaiting|
000037b0  20 27 65 64 69 74 64 61  74 61 73 61 76 65 27 20  | 'editdatasave' |
000037c0  6d 65 73 73 61 67 65 0a  20 20 20 53 54 52 20 20  |message.   STR  |
000037d0  20 20 20 72 30 2c 60 66  69 6c 74 65 72 73 74 61  |   r0,`filtersta|
000037e0  74 65 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |te              |
000037f0  20 3b 20 73 74 6f 72 65  20 69 74 0a 20 20 20 4c  | ; store it.   L|
00003800  44 4d 46 44 20 20 20 28  73 70 29 21 2c 7b 72 30  |DMFD   (sp)!,{r0|
00003810  2d 72 35 2c 70 63 7d 20  20 20 20 20 20 20 20 20  |-r5,pc}         |
00003820  20 20 20 20 20 3b 20 52  65 74 75 72 6e 20 66 72  |     ; Return fr|
00003830  6f 6d 20 63 61 6c 6c 0a  0a 3b 20 74 72 79 20 74  |om call..; try t|
00003840  6f 20 73 65 6e 64 20 74  68 65 20 66 69 6c 65 0a  |o send the file.|
00003850  3e 65 65 5f 73 74 61 72  74 73 65 6e 64 66 69 6c  |>ee_startsendfil|
00003860  65 0a 20 20 20 53 54 4d  46 44 20 20 20 28 73 70  |e.   STMFD   (sp|
00003870  29 21 2c 7b 72 30 2d 72  35 2c 6c 69 6e 6b 7d 20  |)!,{r0-r5,link} |
00003880  20 20 20 20 20 20 20 20  20 20 20 3b 20 53 74 61  |           ; Sta|
00003890  63 6b 20 72 65 67 69 73  74 65 72 73 0a 20 20 20  |ck registers.   |
000038a0  52 45 4d 20 20 20 20 20  22 41 74 74 65 6d 70 74  |REM     "Attempt|
000038b0  69 6e 67 20 74 6f 20 73  65 6e 64 20 61 20 66 69  |ing to send a fi|
000038c0  6c 65 20 61 74 20 5a 61  70 22 0a 20 20 20 4d 4f  |le at Zap".   MO|
000038d0  56 20 20 20 20 20 72 35  2c 72 31 20 20 20 20 20  |V     r5,r1     |
000038e0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000038f0  20 20 20 20 3b 20 72 35  2d 3e 20 62 6c 6f 63 6b  |    ; r5-> block|
00003900  0a 20 20 20 4c 44 52 20  20 20 20 20 72 30 2c 60  |.   LDR     r0,`|
00003910  65 64 69 74 6e 61 6d 65  20 20 20 20 20 20 20 20  |editname        |
00003920  20 20 20 20 20 20 20 20  20 20 3b 20 74 68 65 20  |          ; the |
00003930  6e 61 6d 65 20 74 6f 20  75 73 65 0a 20 20 20 42  |name to use.   B|
00003940  4c 20 20 20 20 20 20 73  74 72 6c 65 6e 20 20 20  |L      strlen   |
00003950  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003960  20 20 20 20 20 3b 20 66  69 6e 64 20 69 74 27 73  |     ; find it's|
00003970  20 6c 65 6e 20 28 74 6f  20 72 31 29 0a 20 20 20  | len (to r1).   |
00003980  41 44 44 20 20 20 20 20  72 32 2c 72 31 2c 23 34  |ADD     r2,r1,#4|
00003990  34 2b 33 2b 31 20 20 20  20 20 20 20 20 20 20 20  |4+3+1           |
000039a0  20 20 20 20 20 20 3b 20  6c 65 6e 2b 20 62 61 73  |      ; len+ bas|
000039b0  65 20 2b 20 61 6c 69 67  6e 20 2b 20 74 65 72 6d  |e + align + term|
000039c0  0a 20 20 20 42 49 43 20  20 20 20 20 72 32 2c 72  |.   BIC     r2,r|
000039d0  32 2c 23 33 20 20 20 20  20 20 20 20 20 20 20 20  |2,#3            |
000039e0  20 20 20 20 20 20 20 20  20 20 3b 20 61 6c 69 67  |          ; alig|
000039f0  6e 20 6e 6f 77 21 0a 20  20 20 53 54 52 20 20 20  |n now!.   STR   |
00003a00  20 20 72 32 2c 5b 72 35  2c 23 30 5d 20 20 20 20  |  r2,[r5,#0]    |
00003a10  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003a20  3b 20 73 74 6f 72 65 20  61 73 20 62 6c 6b 20 6c  |; store as blk l|
00003a30  65 6e 0a 20 20 20 41 44  44 20 20 20 20 20 72 31  |en.   ADD     r1|
00003a40  2c 72 35 2c 23 34 34 20  20 20 20 20 20 20 20 20  |,r5,#44         |
00003a50  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 62 61  |            ; ba|
00003a60  73 65 0a 20 20 20 42 4c  20 20 20 20 20 20 73 74  |se.   BL      st|
00003a70  72 63 70 79 20 20 20 20  20 20 20 20 20 20 20 20  |rcpy            |
00003a80  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 63 6f  |            ; co|
00003a90  70 79 20 6c 65 61 66 6e  61 6d 65 0a 20 20 20 4c  |py leafname.   L|
00003aa0  44 52 20 20 20 20 20 72  30 2c 60 66 69 6c 65 74  |DR     r0,`filet|
00003ab0  79 70 65 20 20 20 20 20  20 20 20 20 20 20 20 20  |ype             |
00003ac0  20 20 20 20 20 3b 20 66  69 6c 65 74 79 70 65 0a  |     ; filetype.|
00003ad0  20 20 20 53 54 52 20 20  20 20 20 72 30 2c 5b 72  |   STR     r0,[r|
00003ae0  35 2c 23 34 30 5d 20 20  20 20 20 20 20 20 20 20  |5,#40]          |
00003af0  20 20 20 20 20 20 20 20  20 3b 20 73 74 6f 72 65  |         ; store|
00003b00  20 74 68 61 74 0a 20 20  20 4d 4f 56 20 20 20 20  | that.   MOV    |
00003b10  20 72 30 2c 23 30 20 20  20 20 20 20 20 20 20 20  | r0,#0          |
00003b20  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00003b30  20 75 6e 6b 6e 6f 77 6e  20 73 69 7a 65 0a 20 20  | unknown size.  |
00003b40  20 53 54 52 20 20 20 20  20 72 30 2c 5b 72 35 2c  | STR     r0,[r5,|
00003b50  23 33 36 5d 20 20 20 20  20 20 20 20 20 20 20 20  |#36]            |
00003b60  20 20 20 20 20 20 20 3b  20 73 74 6f 72 65 20 61  |       ; store a|
00003b70  73 20 73 69 7a 65 0a 20  20 20 53 54 52 20 20 20  |s size.   STR   |
00003b80  20 20 72 30 2c 5b 72 35  2c 23 31 32 5d 20 20 20  |  r0,[r5,#12]   |
00003b90  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003ba0  3b 20 73 74 6f 72 65 20  61 73 20 6f 75 72 72 65  |; store as ourre|
00003bb0  66 0a 20 20 20 4c 44 52  20 20 20 20 20 72 30 2c  |f.   LDR     r0,|
00003bc0  60 65 65 5f 6a 6f 62 68  61 6e 64 6c 65 0a 20 20  |`ee_jobhandle.  |
00003bd0  20 53 54 52 20 20 20 20  20 72 30 2c 5b 72 35 2c  | STR     r0,[r5,|
00003be0  23 32 30 5d 20 20 20 20  20 20 20 20 20 20 20 20  |#20]            |
00003bf0  20 20 20 20 20 20 20 3b  20 73 74 6f 72 65 20 6a  |       ; store j|
00003c00  6f 62 20 68 61 6e 64 6c  65 0a 20 20 20 4c 44 52  |ob handle.   LDR|
00003c10  20 20 20 20 20 72 30 2c  60 65 65 5f 64 61 74 61  |     r0,`ee_data|
00003c20  73 61 76 65 20 20 20 20  20 20 20 20 20 20 20 20  |save            |
00003c30  20 20 20 3b 20 64 61 74  61 73 61 76 65 20 72 65  |   ; datasave re|
00003c40  71 75 65 73 74 0a 20 20  20 53 54 52 20 20 20 20  |quest.   STR    |
00003c50  20 72 30 2c 5b 72 35 2c  23 31 36 5d 20 20 20 20  | r0,[r5,#16]    |
00003c60  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00003c70  20 73 74 6f 72 65 20 69  74 0a 20 20 20 4c 44 52  | store it.   LDR|
00003c80  20 20 20 20 20 72 32 2c  60 65 65 5f 74 61 73 6b  |     r2,`ee_task|
00003c90  68 61 6e 64 6c 65 20 20  20 20 20 20 20 20 20 20  |handle          |
00003ca0  20 20 20 3b 20 74 68 65  69 72 20 68 61 6e 64 6c  |   ; their handl|
00003cb0  65 0a 20 20 20 58 53 57  49 20 20 20 20 22 57 69  |e.   XSWI    "Wi|
00003cc0  6d 70 5f 53 65 6e 64 4d  65 73 73 61 67 65 22 2c  |mp_SendMessage",|
00003cd0  31 38 2c 72 35 20 20 20  20 20 20 3b 20 73 65 6e  |18,r5      ; sen|
00003ce0  64 20 69 74 0a 3b 20 73  65 74 20 6e 65 77 20 73  |d it.; set new s|
00003cf0  74 61 74 65 0a 20 20 20  4d 4f 56 20 20 20 20 20  |tate.   MOV     |
00003d00  72 30 2c 23 53 5f 41 77  61 69 74 53 61 76 65 41  |r0,#S_AwaitSaveA|
00003d10  63 6b 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |ck            ; |
00003d20  61 77 61 69 74 69 6e 67  20 27 61 63 6b 27 20 6d  |awaiting 'ack' m|
00003d30  65 73 73 61 67 65 0a 20  20 20 53 54 52 20 20 20  |essage.   STR   |
00003d40  20 20 72 30 2c 60 66 69  6c 74 65 72 73 74 61 74  |  r0,`filterstat|
00003d50  65 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |e               |
00003d60  3b 20 73 74 6f 72 65 20  69 74 0a 20 20 20 4c 44  |; store it.   LD|
00003d70  4d 46 44 20 20 20 28 73  70 29 21 2c 7b 72 30 2d  |MFD   (sp)!,{r0-|
00003d80  72 35 2c 70 63 7d 20 20  20 20 20 20 20 20 20 20  |r5,pc}          |
00003d90  20 20 20 20 3b 20 52 65  74 75 72 6e 20 66 72 6f  |    ; Return fro|
00003da0  6d 20 63 61 6c 6c 0a 0a  3b 20 74 72 79 20 74 6f  |m call..; try to|
00003db0  20 67 69 76 65 20 74 68  65 6d 20 61 20 66 69 6c  | give them a fil|
00003dc0  65 20 74 6f 20 73 61 76  65 20 74 6f 20 28 66 6f  |e to save to (fo|
00003dd0  72 20 72 65 74 75 72 6e  29 0a 3e 65 65 5f 73 65  |r return).>ee_se|
00003de0  6e 64 73 61 76 65 61 63  6b 0a 20 20 20 53 54 4d  |ndsaveack.   STM|
00003df0  46 44 20 20 20 28 73 70  29 21 2c 7b 72 30 2d 72  |FD   (sp)!,{r0-r|
00003e00  35 2c 6c 69 6e 6b 7d 20  20 20 20 20 20 20 20 20  |5,link}         |
00003e10  20 20 20 3b 20 53 74 61  63 6b 20 72 65 67 69 73  |   ; Stack regis|
00003e20  74 65 72 73 0a 20 20 20  41 44 52 20 20 20 20 20  |ters.   ADR     |
00003e30  72 31 2c 60 74 65 6d 70  6e 61 6d 65 20 20 20 20  |r1,`tempname    |
00003e40  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
00003e50  74 68 65 20 74 65 6d 70  6f 72 61 72 79 20 6e 61  |the temporary na|
00003e60  6d 65 20 74 6f 20 75 73  65 0a 20 20 20 58 53 57  |me to use.   XSW|
00003e70  49 20 20 20 20 22 58 4f  53 5f 46 69 6c 65 22 2c  |I    "XOS_File",|
00003e80  36 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |6               |
00003e90  20 20 20 3b 20 64 65 6c  65 74 65 20 69 74 0a 20  |   ; delete it. |
00003ea0  20 20 4c 44 52 20 20 20  20 20 72 35 2c 5b 73 70  |  LDR     r5,[sp|
00003eb0  2c 23 34 2a 31 5d 20 20  20 20 20 20 20 20 20 20  |,#4*1]          |
00003ec0  20 20 20 20 20 20 20 20  3b 20 72 65 2d 72 65 61  |        ; re-rea|
00003ed0  64 20 72 31 0a 20 20 20  4d 4f 56 20 20 20 20 20  |d r1.   MOV     |
00003ee0  72 30 2c 72 31 20 20 20  20 20 20 20 20 20 20 20  |r0,r1           |
00003ef0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
00003f00  72 31 0a 20 20 20 42 4c  20 20 20 20 20 20 73 74  |r1.   BL      st|
00003f10  72 6c 65 6e 20 20 20 20  20 20 20 20 20 20 20 20  |rlen            |
00003f20  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 66 69  |            ; fi|
00003f30  6e 64 20 69 74 27 73 20  6c 65 6e 20 28 74 6f 20  |nd it's len (to |
00003f40  72 31 29 0a 20 20 20 41  44 44 20 20 20 20 20 72  |r1).   ADD     r|
00003f50  32 2c 72 31 2c 23 34 34  2b 33 2b 31 20 20 20 20  |2,r1,#44+3+1    |
00003f60  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 6c  |             ; l|
00003f70  65 6e 2b 20 62 61 73 65  20 2b 20 61 6c 69 67 6e  |en+ base + align|
00003f80  20 2b 20 74 65 72 6d 0a  20 20 20 42 49 43 20 20  | + term.   BIC  |
00003f90  20 20 20 72 32 2c 72 32  2c 23 33 20 20 20 20 20  |   r2,r2,#3     |
00003fa0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003fb0  20 3b 20 61 6c 69 67 6e  20 6e 6f 77 21 0a 20 20  | ; align now!.  |
00003fc0  20 53 54 52 20 20 20 20  20 72 32 2c 5b 72 35 2c  | STR     r2,[r5,|
00003fd0  23 30 5d 20 20 20 20 20  20 20 20 20 20 20 20 20  |#0]             |
00003fe0  20 20 20 20 20 20 20 3b  20 73 74 6f 72 65 20 61  |       ; store a|
00003ff0  73 20 62 6c 6b 20 6c 65  6e 0a 20 20 20 41 44 44  |s blk len.   ADD|
00004000  20 20 20 20 20 72 31 2c  72 35 2c 23 34 34 20 20  |     r1,r5,#44  |
00004010  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004020  20 20 20 3b 20 62 61 73  65 0a 20 20 20 42 4c 20  |   ; base.   BL |
00004030  20 20 20 20 20 73 74 72  63 70 79 20 20 20 20 20  |     strcpy     |
00004040  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004050  20 20 20 3b 20 63 6f 70  79 20 6c 65 61 66 6e 61  |   ; copy leafna|
00004060  6d 65 0a 20 20 20 52 45  4d 20 20 20 20 20 22 41  |me.   REM     "A|
00004070  74 74 65 6d 70 74 69 6e  67 20 74 6f 20 73 65 6e  |ttempting to sen|
00004080  64 20 73 61 76 65 20 74  6f 20 5a 61 70 22 0a 20  |d save to Zap". |
00004090  20 20 4d 56 4e 20 20 20  20 20 72 30 2c 23 4e 4f  |  MVN     r0,#NO|
000040a0  54 20 2d 31 20 20 20 20  20 20 20 20 20 20 20 20  |T -1            |
000040b0  20 20 20 20 20 20 20 20  3b 20 6e 6f 74 20 73 61  |        ; not sa|
000040c0  66 65 0a 20 20 20 53 54  52 20 20 20 20 20 72 30  |fe.   STR     r0|
000040d0  2c 5b 72 35 2c 23 33 36  5d 20 20 20 20 20 20 20  |,[r5,#36]       |
000040e0  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 73 74  |            ; st|
000040f0  6f 72 65 20 61 73 20 73  69 7a 65 0a 20 20 20 4c  |ore as size.   L|
00004100  44 52 20 20 20 20 20 72  30 2c 60 66 69 6c 65 74  |DR     r0,`filet|
00004110  79 70 65 20 20 20 20 20  20 20 20 20 20 20 20 20  |ype             |
00004120  20 20 20 20 20 3b 20 66  69 6c 65 74 79 70 65 0a  |     ; filetype.|
00004130  20 20 20 53 54 52 20 20  20 20 20 72 30 2c 5b 72  |   STR     r0,[r|
00004140  35 2c 23 34 30 5d 20 20  20 20 20 20 20 20 20 20  |5,#40]          |
00004150  20 20 20 20 20 20 20 20  20 3b 20 73 74 6f 72 65  |         ; store|
00004160  20 61 73 20 73 69 7a 65  0a 20 20 20 4c 44 52 20  | as size.   LDR |
00004170  20 20 20 20 72 30 2c 5b  72 35 2c 23 38 5d 20 20  |    r0,[r5,#8]  |
00004180  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004190  20 20 3b 20 74 68 65 69  72 20 72 65 66 0a 20 20  |  ; their ref.  |
000041a0  20 53 54 52 20 20 20 20  20 72 30 2c 5b 72 35 2c  | STR     r0,[r5,|
000041b0  23 31 32 5d 20 20 20 20  20 20 20 20 20 20 20 20  |#12]            |
000041c0  20 20 20 20 20 20 20 3b  20 73 74 6f 72 65 20 61  |       ; store a|
000041d0  73 20 6f 75 72 72 65 66  0a 20 20 20 4d 4f 56 20  |s ourref.   MOV |
000041e0  20 20 20 20 72 30 2c 23  44 61 74 61 53 61 76 65  |    r0,#DataSave|
000041f0  41 63 6b 20 20 20 20 20  20 20 20 20 20 20 20 20  |Ack             |
00004200  20 20 3b 20 64 61 74 61  73 61 76 65 20 72 65 71  |  ; datasave req|
00004210  75 65 73 74 0a 20 20 20  53 54 52 20 20 20 20 20  |uest.   STR     |
00004220  72 30 2c 5b 72 35 2c 23  31 36 5d 20 20 20 20 20  |r0,[r5,#16]     |
00004230  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
00004240  73 74 6f 72 65 20 69 74  0a 20 20 20 4c 44 52 20  |store it.   LDR |
00004250  20 20 20 20 72 32 2c 60  65 65 5f 74 61 73 6b 68  |    r2,`ee_taskh|
00004260  61 6e 64 6c 65 20 20 20  20 20 20 20 20 20 20 20  |andle           |
00004270  20 20 3b 20 74 68 65 69  72 20 68 61 6e 64 6c 65  |  ; their handle|
00004280  0a 20 20 20 58 53 57 49  20 20 20 20 22 57 69 6d  |.   XSWI    "Wim|
00004290  70 5f 53 65 6e 64 4d 65  73 73 61 67 65 22 2c 31  |p_SendMessage",1|
000042a0  37 2c 72 35 20 20 20 20  20 20 3b 20 73 65 6e 64  |7,r5      ; send|
000042b0  20 69 74 0a 3b 20 73 65  74 20 6e 65 77 20 73 74  | it.; set new st|
000042c0  61 74 65 0a 20 20 20 4d  4f 56 20 20 20 20 20 72  |ate.   MOV     r|
000042d0  30 2c 23 53 5f 41 77 61  69 74 4c 6f 61 64 20 20  |0,#S_AwaitLoad  |
000042e0  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 61  |             ; a|
000042f0  77 61 69 74 69 6e 67 20  27 61 63 6b 27 20 6d 65  |waiting 'ack' me|
00004300  73 73 61 67 65 0a 20 20  20 53 54 52 20 20 20 20  |ssage.   STR    |
00004310  20 72 30 2c 60 66 69 6c  74 65 72 73 74 61 74 65  | r0,`filterstate|
00004320  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00004330  20 73 74 6f 72 65 20 69  74 0a 20 20 20 4c 44 4d  | store it.   LDM|
00004340  46 44 20 20 20 28 73 70  29 21 2c 7b 72 30 2d 72  |FD   (sp)!,{r0-r|
00004350  35 2c 70 63 7d 20 20 20  20 20 20 20 20 20 20 20  |5,pc}           |
00004360  20 20 20 3b 20 52 65 74  75 72 6e 20 66 72 6f 6d  |   ; Return from|
00004370  20 63 61 6c 6c 0a 0a 3e  65 65 5f 73 65 6e 64 6c  | call..>ee_sendl|
00004380  6f 61 64 61 63 6b 0a 20  20 20 53 54 4d 46 44 20  |oadack.   STMFD |
00004390  20 20 28 73 70 29 21 2c  7b 72 30 2d 72 35 2c 6c  |  (sp)!,{r0-r5,l|
000043a0  69 6e 6b 7d 20 20 20 20  20 20 20 20 20 20 20 20  |ink}            |
000043b0  3b 20 53 74 61 63 6b 20  72 65 67 69 73 74 65 72  |; Stack register|
000043c0  73 0a 20 20 20 4d 4f 56  20 20 20 20 20 72 35 2c  |s.   MOV     r5,|
000043d0  72 31 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |r1              |
000043e0  20 20 20 20 20 20 20 20  20 20 20 3b 20 72 31 2d  |           ; r1-|
000043f0  3e 20 77 6f 72 6b 73 70  61 63 65 0a 20 20 20 41  |> workspace.   A|
00004400  44 44 20 20 20 20 20 72  31 2c 72 35 2c 23 34 34  |DD     r1,r5,#44|
00004410  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004420  20 20 20 20 20 3b 20 70  6f 69 6e 74 65 72 20 74  |     ; pointer t|
00004430  6f 20 66 69 6c 65 6e 61  6d 65 0a 20 20 20 52 45  |o filename.   RE|
00004440  4d 20 20 20 20 20 22 41  74 74 65 6d 70 74 69 6e  |M     "Attemptin|
00004450  67 20 74 6f 20 63 6f 70  79 20 66 69 6c 65 20 74  |g to copy file t|
00004460  6f 20 6f 72 69 67 69 6e  61 6c 20 6c 6f 63 61 74  |o original locat|
00004470  69 6f 6e 22 0a 20 20 20  4c 44 52 20 20 20 20 20  |ion".   LDR     |
00004480  72 32 2c 60 66 69 6c 65  6e 61 6d 65 20 20 20 20  |r2,`filename    |
00004490  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
000044a0  2d 3e 20 66 69 6c 65 6e  61 6d 65 0a 20 20 20 58  |-> filename.   X|
000044b0  53 57 49 20 20 20 20 22  58 4f 53 5f 46 53 43 6f  |SWI    "XOS_FSCo|
000044c0  6e 74 72 6f 6c 22 2c 32  36 2c 2c 2c 25 31 30 30  |ntrol",26,,,%100|
000044d0  30 30 30 31 31 0a 20 20  20 42 56 53 20 20 20 20  |00011.   BVS    |
000044e0  20 24 66 61 69 6c 65 64  20 20 20 20 20 20 20 20  | $failed        |
000044f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00004500  20 61 72 67 68 2e 0a 20  20 20 4d 4f 56 20 20 20  | argh..   MOV   |
00004510  20 20 72 31 2c 72 32 20  20 20 20 20 20 20 20 20  |  r1,r2         |
00004520  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004530  3b 20 72 31 2d 3e 20 66  69 6c 65 6e 61 6d 65 0a  |; r1-> filename.|
00004540  20 20 20 4c 44 52 20 20  20 20 20 72 32 2c 60 6f  |   LDR     r2,`o|
00004550  6c 64 74 79 70 65 20 20  20 20 20 20 20 20 20 20  |ldtype          |
00004560  20 20 20 20 20 20 20 20  20 3b 20 72 65 61 64 20  |         ; read |
00004570  74 68 65 20 6f 72 69 67  69 6e 61 6c 20 74 79 70  |the original typ|
00004580  65 0a 20 20 20 58 53 57  49 20 20 20 20 22 58 4f  |e.   XSWI    "XO|
00004590  53 5f 46 69 6c 65 22 2c  31 38 0a 20 20 20 4c 44  |S_File",18.   LD|
000045a0  52 20 20 20 20 20 72 30  2c 5b 72 35 2c 23 38 5d  |R     r0,[r5,#8]|
000045b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000045c0  20 20 20 20 3b 20 74 68  65 69 72 20 72 65 66 0a  |    ; their ref.|
000045d0  20 20 20 53 54 52 20 20  20 20 20 72 30 2c 5b 72  |   STR     r0,[r|
000045e0  35 2c 23 31 32 5d 20 20  20 20 20 20 20 20 20 20  |5,#12]          |
000045f0  20 20 20 20 20 20 20 20  20 3b 20 73 74 6f 72 65  |         ; store|
00004600  20 61 73 20 6f 75 72 72  65 66 0a 20 20 20 4d 4f  | as ourref.   MO|
00004610  56 20 20 20 20 20 72 30  2c 23 44 61 74 61 4c 6f  |V     r0,#DataLo|
00004620  61 64 41 63 6b 20 20 20  20 20 20 20 20 20 20 20  |adAck           |
00004630  20 20 20 20 3b 20 64 61  74 61 6c 6f 61 64 20 72  |    ; dataload r|
00004640  65 71 75 65 73 74 0a 20  20 20 53 54 52 20 20 20  |equest.   STR   |
00004650  20 20 72 30 2c 5b 72 35  2c 23 31 36 5d 20 20 20  |  r0,[r5,#16]   |
00004660  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004670  3b 20 73 74 6f 72 65 20  69 74 0a 20 20 20 4c 44  |; store it.   LD|
00004680  52 20 20 20 20 20 72 32  2c 60 65 65 5f 74 61 73  |R     r2,`ee_tas|
00004690  6b 68 61 6e 64 6c 65 20  20 20 20 20 20 20 20 20  |khandle         |
000046a0  20 20 20 20 3b 20 74 68  65 69 72 20 68 61 6e 64  |    ; their hand|
000046b0  6c 65 0a 20 20 20 58 53  57 49 20 20 20 20 22 57  |le.   XSWI    "W|
000046c0  69 6d 70 5f 53 65 6e 64  4d 65 73 73 61 67 65 22  |imp_SendMessage"|
000046d0  2c 31 37 2c 72 35 20 20  20 20 20 20 3b 20 73 65  |,17,r5      ; se|
000046e0  6e 64 20 69 74 0a 20 20  20 4c 44 4d 46 44 20 20  |nd it.   LDMFD  |
000046f0  20 28 73 70 29 21 2c 7b  72 30 2d 72 35 2c 70 63  | (sp)!,{r0-r5,pc|
00004700  7d 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |}              ;|
00004710  20 52 65 74 75 72 6e 20  66 72 6f 6d 20 63 61 6c  | Return from cal|
00004720  6c 0a 24 66 61 69 6c 65  64 0a 20 20 20 52 45 4d  |l.$failed.   REM|
00004730  20 20 20 20 20 22 4c 6f  61 64 41 63 6b 20 63 6f  |     "LoadAck co|
00004740  70 79 20 66 61 69 6c 65  64 22 0a 20 20 20 58 42  |py failed".   XB|
00004750  4c 20 20 20 20 20 72 65  74 75 72 6e 66 72 6f 6d  |L     returnfrom|
00004760  66 69 6c 74 65 72 2c 52  65 74 5f 46 61 69 6c 65  |filter,Ret_Faile|
00004770  64 20 20 20 3b 20 77 65  20 66 61 69 6c 65 64 20  |d   ; we failed |
00004780  74 6f 20 6c 61 75 6e 63  68 20 65 64 69 74 0a 20  |to launch edit. |
00004790  20 20 58 42 4c 20 20 20  20 20 65 65 5f 61 62 6f  |  XBL     ee_abo|
000047a0  72 74 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |rt              |
000047b0  20 20 20 20 20 20 20 20  3b 20 61 6e 64 20 73 65  |        ; and se|
000047c0  6e 64 20 74 68 65 20 61  62 6f 72 74 0a 20 20 20  |nd the abort.   |
000047d0  4c 44 4d 46 44 20 20 20  28 73 70 29 21 2c 7b 72  |LDMFD   (sp)!,{r|
000047e0  30 2d 72 35 2c 70 63 7d  20 20 20 20 20 20 20 20  |0-r5,pc}        |
000047f0  20 20 20 20 20 20 3b 20  52 65 74 75 72 6e 20 66  |      ; Return f|
00004800  72 6f 6d 20 63 61 6c 6c  0a 0a 3b 20 74 72 79 20  |rom call..; try |
00004810  74 6f 20 67 69 76 65 20  74 68 65 6d 20 74 68 65  |to give them the|
00004820  20 66 69 6c 65 20 74 6f  20 6c 6f 61 64 0a 3e 65  | file to load.>e|
00004830  65 5f 73 65 6e 64 6c 6f  61 64 0a 20 20 20 53 54  |e_sendload.   ST|
00004840  4d 46 44 20 20 20 28 73  70 29 21 2c 7b 72 30 2d  |MFD   (sp)!,{r0-|
00004850  72 35 2c 6c 69 6e 6b 7d  20 20 20 20 20 20 20 20  |r5,link}        |
00004860  20 20 20 20 3b 20 53 74  61 63 6b 20 72 65 67 69  |    ; Stack regi|
00004870  73 74 65 72 73 0a 20 20  20 4d 4f 56 20 20 20 20  |sters.   MOV    |
00004880  20 72 35 2c 72 31 20 20  20 20 20 20 20 20 20 20  | r5,r1          |
00004890  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
000048a0  20 72 31 2d 3e 20 77 6f  72 6b 73 70 61 63 65 0a  | r1-> workspace.|
000048b0  20 20 20 41 44 44 20 20  20 20 20 72 32 2c 72 35  |   ADD     r2,r5|
000048c0  2c 23 34 34 20 20 20 20  20 20 20 20 20 20 20 20  |,#44            |
000048d0  20 20 20 20 20 20 20 20  20 3b 20 70 6f 69 6e 74  |         ; point|
000048e0  65 72 20 74 6f 20 66 69  6c 65 6e 61 6d 65 0a 20  |er to filename. |
000048f0  20 20 52 45 4d 20 20 20  20 20 22 41 74 74 65 6d  |  REM     "Attem|
00004900  70 74 69 6e 67 20 74 6f  20 73 65 6e 64 20 6c 6f  |pting to send lo|
00004910  61 64 20 74 6f 20 5a 61  70 22 0a 20 20 20 4c 44  |ad to Zap".   LD|
00004920  52 20 20 20 20 20 72 31  2c 60 66 69 6c 65 6e 61  |R     r1,`filena|
00004930  6d 65 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |me              |
00004940  20 20 20 20 3b 20 72 65  61 64 20 2d 3e 20 66 69  |    ; read -> fi|
00004950  6c 65 6e 61 6d 65 0a 20  20 20 58 53 57 49 20 20  |lename.   XSWI  |
00004960  20 20 22 58 4f 53 5f 46  53 43 6f 6e 74 72 6f 6c  |  "XOS_FSControl|
00004970  22 2c 32 36 2c 2c 2c 25  31 31 0a 20 20 20 42 56  |",26,,,%11.   BV|
00004980  53 20 20 20 20 20 24 66  61 69 6c 65 64 20 20 20  |S     $failed   |
00004990  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000049a0  20 20 20 20 3b 20 61 72  67 68 2e 0a 20 20 20 4d  |    ; argh..   M|
000049b0  4f 56 20 20 20 20 20 72  30 2c 23 30 20 20 20 20  |OV     r0,#0    |
000049c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000049d0  20 20 20 20 20 3b 20 75  6e 6b 6e 6f 77 6e 20 73  |     ; unknown s|
000049e0  69 7a 65 0a 20 20 20 53  54 52 20 20 20 20 20 72  |ize.   STR     r|
000049f0  30 2c 5b 72 35 2c 23 33  36 5d 20 20 20 20 20 20  |0,[r5,#36]      |
00004a00  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 73  |             ; s|
00004a10  74 6f 72 65 20 61 73 20  73 69 7a 65 0a 20 20 20  |tore as size.   |
00004a20  4c 44 52 20 20 20 20 20  72 30 2c 5b 72 35 2c 23  |LDR     r0,[r5,#|
00004a30  38 5d 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |8]              |
00004a40  20 20 20 20 20 20 3b 20  74 68 65 69 72 20 72 65  |      ; their re|
00004a50  66 0a 20 20 20 53 54 52  20 20 20 20 20 72 30 2c  |f.   STR     r0,|
00004a60  5b 72 35 2c 23 31 32 5d  20 20 20 20 20 20 20 20  |[r5,#12]        |
00004a70  20 20 20 20 20 20 20 20  20 20 20 3b 20 73 74 6f  |           ; sto|
00004a80  72 65 20 61 73 20 6f 75  72 72 65 66 0a 20 20 20  |re as ourref.   |
00004a90  4d 4f 56 20 20 20 20 20  72 30 2c 23 44 61 74 61  |MOV     r0,#Data|
00004aa0  4c 6f 61 64 20 20 20 20  20 20 20 20 20 20 20 20  |Load            |
00004ab0  20 20 20 20 20 20 3b 20  64 61 74 61 6c 6f 61 64  |      ; dataload|
00004ac0  20 72 65 71 75 65 73 74  0a 20 20 20 53 54 52 20  | request.   STR |
00004ad0  20 20 20 20 72 30 2c 5b  72 35 2c 23 31 36 5d 20  |    r0,[r5,#16] |
00004ae0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004af0  20 20 3b 20 73 74 6f 72  65 20 69 74 0a 20 20 20  |  ; store it.   |
00004b00  4c 44 52 20 20 20 20 20  72 32 2c 60 65 65 5f 74  |LDR     r2,`ee_t|
00004b10  61 73 6b 68 61 6e 64 6c  65 20 20 20 20 20 20 20  |askhandle       |
00004b20  20 20 20 20 20 20 3b 20  74 68 65 69 72 20 68 61  |      ; their ha|
00004b30  6e 64 6c 65 0a 20 20 20  58 53 57 49 20 20 20 20  |ndle.   XSWI    |
00004b40  22 57 69 6d 70 5f 53 65  6e 64 4d 65 73 73 61 67  |"Wimp_SendMessag|
00004b50  65 22 2c 31 37 2c 72 35  20 20 20 20 20 20 3b 20  |e",17,r5      ; |
00004b60  73 65 6e 64 20 69 74 0a  3b 20 73 65 74 20 6e 65  |send it.; set ne|
00004b70  77 20 73 74 61 74 65 0a  20 20 20 4d 4f 56 20 20  |w state.   MOV  |
00004b80  20 20 20 72 30 2c 23 53  5f 41 77 61 69 74 4c 6f  |   r0,#S_AwaitLo|
00004b90  61 64 41 63 6b 20 20 20  20 20 20 20 20 20 20 20  |adAck           |
00004ba0  20 3b 20 61 77 61 69 74  69 6e 67 20 27 61 63 6b  | ; awaiting 'ack|
00004bb0  27 20 6d 65 73 73 61 67  65 0a 20 20 20 53 54 52  |' message.   STR|
00004bc0  20 20 20 20 20 72 30 2c  60 66 69 6c 74 65 72 73  |     r0,`filters|
00004bd0  74 61 74 65 20 20 20 20  20 20 20 20 20 20 20 20  |tate            |
00004be0  20 20 20 3b 20 73 74 6f  72 65 20 69 74 0a 20 20  |   ; store it.  |
00004bf0  20 4c 44 4d 46 44 20 20  20 28 73 70 29 21 2c 7b  | LDMFD   (sp)!,{|
00004c00  72 30 2d 72 35 2c 70 63  7d 20 20 20 20 20 20 20  |r0-r5,pc}       |
00004c10  20 20 20 20 20 20 20 3b  20 52 65 74 75 72 6e 20  |       ; Return |
00004c20  66 72 6f 6d 20 63 61 6c  6c 0a 24 66 61 69 6c 65  |from call.$faile|
00004c30  64 0a 20 20 20 52 45 4d  20 20 20 20 20 22 4c 6f  |d.   REM     "Lo|
00004c40  61 64 20 63 6f 70 79 20  66 61 69 6c 65 64 22 0a  |ad copy failed".|
00004c50  20 20 20 58 42 4c 20 20  20 20 20 72 65 74 75 72  |   XBL     retur|
00004c60  6e 66 72 6f 6d 66 69 6c  74 65 72 2c 52 65 74 5f  |nfromfilter,Ret_|
00004c70  46 61 69 6c 65 64 20 20  20 3b 20 77 65 20 66 61  |Failed   ; we fa|
00004c80  69 6c 65 64 20 74 6f 20  6c 61 75 6e 63 68 20 65  |iled to launch e|
00004c90  64 69 74 0a 20 20 20 58  42 4c 20 20 20 20 20 65  |dit.   XBL     e|
00004ca0  65 5f 61 62 6f 72 74 20  20 20 20 20 20 20 20 20  |e_abort         |
00004cb0  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 61  |             ; a|
00004cc0  6e 64 20 73 65 6e 64 20  74 68 65 20 61 62 6f 72  |nd send the abor|
00004cd0  74 0a 20 20 20 4c 44 4d  46 44 20 20 20 28 73 70  |t.   LDMFD   (sp|
00004ce0  29 21 2c 7b 72 30 2d 72  35 2c 70 63 7d 20 20 20  |)!,{r0-r5,pc}   |
00004cf0  20 20 20 20 20 20 20 20  20 20 20 3b 20 52 65 74  |           ; Ret|
00004d00  75 72 6e 20 66 72 6f 6d  20 63 61 6c 6c 0a 0a 3b  |urn from call..;|
00004d10  20 74 68 65 20 66 69 6c  74 65 72 20 74 6f 20 68  | the filter to h|
00004d20  61 6e 64 6c 65 20 74 68  69 6e 67 73 0a 3e 66 69  |andle things.>fi|
00004d30  6c 74 65 72 0a 20 20 20  53 54 4d 46 44 20 20 20  |lter.   STMFD   |
00004d40  28 73 70 29 21 2c 7b 72  31 2d 72 35 2c 6c 69 6e  |(sp)!,{r1-r5,lin|
00004d50  6b 7d 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |k}            ; |
00004d60  53 74 61 63 6b 20 72 65  67 69 73 74 65 72 73 0a  |Stack registers.|
00004d70  20 20 20 53 54 52 20 20  20 20 20 72 30 2c 60 72  |   STR     r0,`r|
00004d80  65 61 73 6f 6e 20 20 20  20 20 20 20 20 20 20 20  |eason           |
00004d90  20 20 20 20 20 20 20 20  20 3b 20 68 61 6e 67 20  |         ; hang |
00004da0  6f 6e 20 74 6f 20 72 65  61 73 6f 6e 0a 3b 20 20  |on to reason.;  |
00004db0  20 20 52 45 4d 20 20 20  20 20 22 25 63 30 34 25  |  REM     "%c04%|
00004dc0  63 33 30 46 69 6c 74 65  72 3a 20 72 65 61 73 6f  |c30Filter: reaso|
00004dd0  6e 3d 20 25 72 30 22 0a  20 20 20 41 44 52 20 20  |n= %r0".   ADR  |
00004de0  20 20 20 6c 69 6e 6b 2c  24 72 65 74 75 72 6e 20  |   link,$return |
00004df0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004e00  20 3b 20 61 64 64 72 65  73 73 20 74 6f 20 72 65  | ; address to re|
00004e10  74 75 72 6e 20 74 6f 0a  20 20 20 43 4d 50 20 20  |turn to.   CMP  |
00004e20  20 20 20 72 30 2c 23 30  20 20 20 20 20 20 20 20  |   r0,#0        |
00004e30  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004e40  20 3b 20 69 73 20 69 74  20 6e 75 6c 6c 20 3f 0a  | ; is it null ?.|
00004e50  20 20 20 42 45 51 20 20  20 20 20 6e 75 6c 6c 20  |   BEQ     null |
00004e60  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004e70  20 20 20 20 20 20 20 20  20 3b 20 68 61 6e 64 6c  |         ; handl|
00004e80  65 20 69 74 0a 20 20 20  43 4d 50 20 20 20 20 20  |e it.   CMP     |
00004e90  72 30 2c 23 31 37 20 20  20 20 20 20 20 20 20 20  |r0,#17          |
00004ea0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
00004eb0  69 73 20 69 74 20 75 73  65 72 6d 65 73 73 61 67  |is it usermessag|
00004ec0  65 20 3f 0a 20 20 20 43  4d 50 4e 45 20 20 20 72  |e ?.   CMPNE   r|
00004ed0  30 2c 23 31 38 20 20 20  20 20 20 20 20 20 20 20  |0,#18           |
00004ee0  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 6f  |             ; o|
00004ef0  72 20 75 73 65 72 6d 65  73 73 61 67 65 72 65 63  |r usermessagerec|
00004f00  6f 72 64 65 64 20 3f 0a  20 20 20 42 45 51 20 20  |orded ?.   BEQ  |
00004f10  20 20 20 75 73 65 72 6d  65 73 73 61 67 65 20 20  |   usermessage  |
00004f20  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004f30  20 3b 20 69 74 27 73 20  61 20 75 73 65 72 6d 65  | ; it's a userme|
00004f40  73 73 61 67 65 0a 20 20  20 43 4d 50 20 20 20 20  |ssage.   CMP    |
00004f50  20 72 30 2c 23 31 39 20  20 20 20 20 20 20 20 20  | r0,#19         |
00004f60  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00004f70  20 69 73 20 69 74 20 75  73 65 72 6d 65 73 73 61  | is it usermessa|
00004f80  67 65 61 63 6b 20 3f 0a  20 20 20 42 45 51 20 20  |geack ?.   BEQ  |
00004f90  20 20 20 75 73 65 72 6d  65 73 73 61 67 65 61 63  |   usermessageac|
00004fa0  6b 0a 24 72 65 74 75 72  6e 0a 20 20 20 4c 44 52  |k.$return.   LDR|
00004fb0  20 20 20 20 20 72 30 2c  60 72 65 61 73 6f 6e 20  |     r0,`reason |
00004fc0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004fd0  20 20 20 3b 20 72 65 2d  72 65 61 64 20 72 65 61  |   ; re-read rea|
00004fe0  73 6f 6e 0a 3b 20 20 20  20 52 45 4d 20 20 20 20  |son.;    REM    |
00004ff0  20 22 52 65 74 75 72 6e  69 6e 67 20 72 65 61 73  | "Returning reas|
00005000  6f 6e 20 25 72 30 22 0a  20 20 20 4c 44 4d 46 44  |on %r0".   LDMFD|
00005010  20 20 20 28 73 70 29 21  2c 7b 72 31 2d 72 35 2c  |   (sp)!,{r1-r5,|
00005020  70 63 7d 5e 20 20 20 20  20 20 20 20 20 20 20 20  |pc}^            |
00005030  20 3b 20 52 65 74 75 72  6e 20 66 72 6f 6d 20 63  | ; Return from c|
00005040  61 6c 6c 0a 0a 2e 60 72  65 61 73 6f 6e 0a 20 20  |all...`reason.  |
00005050  20 45 51 55 44 20 20 20  20 30 20 20 20 20 20 20  | EQUD    0      |
00005060  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00005070  20 20 20 20 20 20 20 3b  20 72 65 61 73 6f 6e 20  |       ; reason |
00005080  66 6f 72 20 69 74 20 61  6c 6c 0a 0a 3e 6e 75 6c  |for it all..>nul|
00005090  6c 0a 20 20 20 53 54 4d  46 44 20 20 20 28 73 70  |l.   STMFD   (sp|
000050a0  29 21 2c 7b 72 30 2c 6c  69 6e 6b 7d 20 20 20 20  |)!,{r0,link}    |
000050b0  20 20 20 20 20 20 20 20  20 20 20 3b 20 53 74 61  |           ; Sta|
000050c0  63 6b 20 72 65 67 69 73  74 65 72 73 0a 20 20 20  |ck registers.   |
000050d0  4c 44 52 20 20 20 20 20  72 30 2c 60 66 69 6c 74  |LDR     r0,`filt|
000050e0  65 72 73 74 61 74 65 20  20 20 20 20 20 20 20 20  |erstate         |
000050f0  20 20 20 20 20 20 3b 20  72 65 61 64 20 73 74 61  |      ; read sta|
00005100  74 65 0a 20 20 20 43 4d  50 20 20 20 20 20 72 30  |te.   CMP     r0|
00005110  2c 23 53 5f 53 65 6e 64  52 65 74 75 72 6e 20 20  |,#S_SendReturn  |
00005120  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 77 65  |            ; we|
00005130  20 6e 65 65 64 20 74 6f  20 72 65 74 75 72 6e 0a  | need to return.|
00005140  20 20 20 58 42 4c 45 51  20 20 20 65 65 5f 72 65  |   XBLEQ   ee_re|
00005150  74 75 72 6e 20 20 20 20  20 20 20 20 20 20 20 20  |turn            |
00005160  20 20 20 20 20 20 20 20  20 3b 20 73 65 6e 64 20  |         ; send |
00005170  74 68 65 20 27 65 64 69  74 72 65 74 75 72 6e 27  |the 'editreturn'|
00005180  0a 20 20 20 43 4d 50 20  20 20 20 20 72 30 2c 23  |.   CMP     r0,#|
00005190  53 5f 53 65 6e 64 41 62  6f 72 74 20 20 20 20 20  |S_SendAbort     |
000051a0  20 20 20 20 20 20 20 20  20 20 3b 20 77 65 20 6e  |          ; we n|
000051b0  65 65 64 20 74 6f 20 61  62 6f 72 74 20 61 6e 64  |eed to abort and|
000051c0  20 72 65 74 75 72 6e 0a  20 20 20 58 42 4c 45 51  | return.   XBLEQ|
000051d0  20 20 20 72 65 74 75 72  6e 66 72 6f 6d 66 69 6c  |   returnfromfil|
000051e0  74 65 72 2c 52 65 74 5f  55 6e 63 68 61 6e 67 65  |ter,Ret_Unchange|
000051f0  64 20 3b 20 74 68 65 20  66 69 6c 65 20 77 61 73  |d ; the file was|
00005200  6e 27 74 20 63 68 61 6e  67 65 64 0a 20 20 20 58  |n't changed.   X|
00005210  42 4c 45 51 20 20 20 65  65 5f 61 62 6f 72 74 20  |BLEQ   ee_abort |
00005220  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00005230  20 20 20 20 20 3b 20 61  6e 64 20 73 65 6e 64 20  |     ; and send |
00005240  74 68 65 20 61 62 6f 72  74 0a 20 20 20 4c 44 4d  |the abort.   LDM|
00005250  46 44 20 20 20 28 73 70  29 21 2c 7b 72 30 2c 70  |FD   (sp)!,{r0,p|
00005260  63 7d 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |c}              |
00005270  20 20 20 3b 20 52 65 74  75 72 6e 20 66 72 6f 6d  |   ; Return from|
00005280  20 63 61 6c 6c 0a 0a 3e  75 73 65 72 6d 65 73 73  | call..>usermess|
00005290  61 67 65 61 63 6b 0a 20  20 20 4c 44 52 20 20 20  |ageack.   LDR   |
000052a0  20 20 72 32 2c 5b 72 31  2c 23 31 36 5d 20 20 20  |  r2,[r1,#16]   |
000052b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000052c0  3b 20 72 65 61 64 20 6d  65 73 73 61 67 65 20 74  |; read message t|
000052d0  79 70 65 0a 0a 20 20 20  4d 4f 56 20 20 20 20 20  |ype..   MOV     |
000052e0  72 34 2c 6c 69 6e 6b 0a  20 20 20 52 45 4d 20 20  |r4,link.   REM  |
000052f0  20 20 20 22 52 65 63 65  69 76 65 64 41 63 6b 20  |   "ReceivedAck |
00005300  6d 65 73 73 61 67 65 20  25 26 32 22 0a 20 20 20  |message %&2".   |
00005310  4d 4f 56 20 20 20 20 20  6c 69 6e 6b 2c 72 34 0a  |MOV     link,r4.|
00005320  0a 20 20 20 4c 44 52 20  20 20 20 20 72 33 2c 60  |.   LDR     r3,`|
00005330  65 65 5f 65 64 69 74 72  71 20 20 20 20 20 20 20  |ee_editrq       |
00005340  20 20 20 20 20 20 20 20  20 20 3b 20 45 64 69 74  |          ; Edit|
00005350  52 71 20 62 6f 75 6e 63  65 64 20 3f 0a 20 20 20  |Rq bounced ?.   |
00005360  43 4d 50 20 20 20 20 20  72 32 2c 72 33 20 20 20  |CMP     r2,r3   |
00005370  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00005380  20 20 20 20 20 20 3b 20  77 61 73 20 74 68 61 74  |      ; was that|
00005390  20 69 74 20 3f 0a 20 20  20 42 45 51 20 20 20 20  | it ?.   BEQ    |
000053a0  20 75 6d 5f 65 64 69 74  72 71 5f 62 6f 75 6e 63  | um_editrq_bounc|
000053b0  65 64 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |ed             ;|
000053c0  20 6f 6b 2c 20 73 6f 20  64 65 61 6c 20 77 69 74  | ok, so deal wit|
000053d0  68 20 69 74 0a 20 20 20  4c 44 52 20 20 20 20 20  |h it.   LDR     |
000053e0  72 33 2c 60 65 65 5f 64  61 74 61 73 61 76 65 20  |r3,`ee_datasave |
000053f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
00005400  45 64 69 74 44 61 74 61  53 61 76 65 20 62 6f 75  |EditDataSave bou|
00005410  6e 63 65 64 20 3f 0a 20  20 20 43 4d 50 20 20 20  |nced ?.   CMP   |
00005420  20 20 72 32 2c 72 33 20  20 20 20 20 20 20 20 20  |  r2,r3         |
00005430  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00005440  3b 20 77 61 73 20 74 68  61 74 20 69 74 20 3f 0a  |; was that it ?.|
00005450  20 20 20 42 45 51 20 20  20 20 20 75 6d 5f 65 64  |   BEQ     um_ed|
00005460  69 74 64 73 5f 62 6f 75  6e 63 65 64 20 20 20 20  |itds_bounced    |
00005470  20 20 20 20 20 20 20 20  20 3b 20 6f 6b 2c 20 73  |         ; ok, s|
00005480  6f 20 64 65 61 6c 20 77  69 74 68 20 69 74 0a 20  |o deal with it. |
00005490  20 20 4d 4f 56 20 20 20  20 20 70 63 2c 6c 69 6e  |  MOV     pc,lin|
000054a0  6b 0a 0a 3e 75 6d 5f 65  64 69 74 72 71 5f 62 6f  |k..>um_editrq_bo|
000054b0  75 6e 63 65 64 0a 20 20  20 53 54 4d 46 44 20 20  |unced.   STMFD  |
000054c0  20 28 73 70 29 21 2c 7b  72 30 2d 72 35 2c 6c 69  | (sp)!,{r0-r5,li|
000054d0  6e 6b 7d 20 20 20 20 20  20 20 20 20 20 20 20 3b  |nk}            ;|
000054e0  20 53 74 61 63 6b 20 72  65 67 69 73 74 65 72 73  | Stack registers|
000054f0  0a 20 20 20 52 45 4d 20  20 20 20 20 22 45 64 69  |.   REM     "Edi|
00005500  74 52 71 20 62 6f 75 6e  63 65 64 22 0a 20 20 20  |tRq bounced".   |
00005510  4c 44 52 20 20 20 20 20  72 30 2c 60 66 69 6c 74  |LDR     r0,`filt|
00005520  65 72 73 74 61 74 65 20  20 20 20 20 20 20 20 20  |erstate         |
00005530  20 20 20 20 20 20 3b 20  72 65 61 64 20 74 68 65  |      ; read the|
00005540  20 73 74 61 74 65 0a 20  20 20 43 4d 50 20 20 20  | state.   CMP   |
00005550  20 20 72 30 2c 23 53 5f  41 77 61 69 74 41 63 6b  |  r0,#S_AwaitAck|
00005560  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00005570  3b 20 61 72 65 20 77 65  20 77 61 69 74 69 6e 67  |; are we waiting|
00005580  20 66 6f 72 20 61 63 6b  20 3f 0a 20 20 20 58 42  | for ack ?.   XB|
00005590  4c 45 51 20 20 20 72 65  74 75 72 6e 66 72 6f 6d  |LEQ   returnfrom|
000055a0  66 69 6c 74 65 72 2c 52  65 74 5f 46 61 69 6c 65  |filter,Ret_Faile|
000055b0  64 20 20 20 3b 20 77 69  74 68 20 74 68 65 20 63  |d   ; with the c|
000055c0  6f 64 65 20 27 66 61 69  6c 65 64 27 0a 20 20 20  |ode 'failed'.   |
000055d0  52 45 4d 20 20 20 20 20  22 42 61 63 6b 20 74 6f  |REM     "Back to|
000055e0  20 45 64 69 74 72 71 5f  62 6f 75 6e 63 65 64 22  | Editrq_bounced"|
000055f0  0a 20 20 20 4d 56 4e 20  20 20 20 20 72 30 2c 23  |.   MVN     r0,#|
00005600  4e 4f 54 20 2d 31 20 20  20 20 20 20 20 20 20 20  |NOT -1          |
00005610  20 20 20 20 20 20 20 20  20 20 3b 20 64 6f 6e 27  |          ; don'|
00005620  74 20 70 61 73 73 20 6f  6e 0a 20 20 20 53 54 52  |t pass on.   STR|
00005630  20 20 20 20 20 72 30 2c  60 72 65 61 73 6f 6e 20  |     r0,`reason |
00005640  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00005650  20 20 20 3b 20 73 74 6f  72 65 20 61 73 20 72 65  |   ; store as re|
00005660  61 73 6f 6e 0a 20 20 20  4c 44 4d 46 44 20 20 20  |ason.   LDMFD   |
00005670  28 73 70 29 21 2c 7b 72  30 2d 72 35 2c 70 63 7d  |(sp)!,{r0-r5,pc}|
00005680  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
00005690  52 65 74 75 72 6e 20 66  72 6f 6d 20 63 61 6c 6c  |Return from call|
000056a0  0a 0a 3e 75 6d 5f 65 64  69 74 64 73 5f 62 6f 75  |..>um_editds_bou|
000056b0  6e 63 65 64 0a 20 20 20  53 54 4d 46 44 20 20 20  |nced.   STMFD   |
000056c0  28 73 70 29 21 2c 7b 72  30 2d 72 35 2c 6c 69 6e  |(sp)!,{r0-r5,lin|
000056d0  6b 7d 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |k}            ; |
000056e0  53 74 61 63 6b 20 72 65  67 69 73 74 65 72 73 0a  |Stack registers.|
000056f0  20 20 20 52 45 4d 20 20  20 20 20 22 45 44 53 20  |   REM     "EDS |
00005700  62 6f 75 6e 63 65 64 22  0a 20 20 20 4c 44 52 20  |bounced".   LDR |
00005710  20 20 20 20 72 30 2c 60  66 69 6c 74 65 72 73 74  |    r0,`filterst|
00005720  61 74 65 20 20 20 20 20  20 20 20 20 20 20 20 20  |ate             |
00005730  20 20 3b 20 72 65 61 64  20 74 68 65 20 73 74 61  |  ; read the sta|
00005740  74 65 0a 20 20 20 43 4d  50 20 20 20 20 20 72 30  |te.   CMP     r0|
00005750  2c 23 53 5f 41 77 61 69  74 53 61 76 65 41 63 6b  |,#S_AwaitSaveAck|
00005760  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 61 72  |            ; ar|
00005770  65 20 77 65 20 77 61 69  74 69 6e 67 20 66 6f 72  |e we waiting for|
00005780  20 73 61 76 65 61 63 6b  20 3f 0a 20 20 20 58 42  | saveack ?.   XB|
00005790  4c 45 51 20 20 20 72 65  74 75 72 6e 66 72 6f 6d  |LEQ   returnfrom|
000057a0  66 69 6c 74 65 72 2c 52  65 74 5f 46 61 69 6c 65  |filter,Ret_Faile|
000057b0  64 20 20 20 3b 20 77 65  27 76 65 20 66 61 69 6c  |d   ; we've fail|
000057c0  65 64 0a 20 20 20 58 42  4c 45 51 20 20 20 65 65  |ed.   XBLEQ   ee|
000057d0  5f 61 62 6f 72 74 20 20  20 20 20 20 20 20 20 20  |_abort          |
000057e0  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 61 6e  |            ; an|
000057f0  64 20 73 65 6e 64 20 74  68 65 20 61 62 6f 72 74  |d send the abort|
00005800  0a 20 20 20 4d 56 4e 20  20 20 20 20 72 30 2c 23  |.   MVN     r0,#|
00005810  4e 4f 54 20 2d 31 20 20  20 20 20 20 20 20 20 20  |NOT -1          |
00005820  20 20 20 20 20 20 20 20  20 20 3b 20 64 6f 6e 27  |          ; don'|
00005830  74 20 70 61 73 73 20 6f  6e 0a 20 20 20 53 54 52  |t pass on.   STR|
00005840  20 20 20 20 20 72 30 2c  60 72 65 61 73 6f 6e 20  |     r0,`reason |
00005850  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00005860  20 20 20 3b 20 73 74 6f  72 65 20 61 73 20 72 65  |   ; store as re|
00005870  61 73 6f 6e 0a 20 20 20  4c 44 4d 46 44 20 20 20  |ason.   LDMFD   |
00005880  28 73 70 29 21 2c 7b 72  30 2d 72 35 2c 70 63 7d  |(sp)!,{r0-r5,pc}|
00005890  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
000058a0  52 65 74 75 72 6e 20 66  72 6f 6d 20 63 61 6c 6c  |Return from call|
000058b0  0a 0a 3e 75 73 65 72 6d  65 73 73 61 67 65 0a 20  |..>usermessage. |
000058c0  20 20 4c 44 52 20 20 20  20 20 72 32 2c 5b 72 31  |  LDR     r2,[r1|
000058d0  2c 23 31 36 5d 20 20 20  20 20 20 20 20 20 20 20  |,#16]           |
000058e0  20 20 20 20 20 20 20 20  3b 20 72 65 61 64 20 6d  |        ; read m|
000058f0  65 73 73 61 67 65 20 74  79 70 65 0a 0a 20 20 20  |essage type..   |
00005900  4d 4f 56 20 20 20 20 20  72 34 2c 6c 69 6e 6b 0a  |MOV     r4,link.|
00005910  20 20 20 52 45 4d 20 20  20 20 20 22 52 65 63 65  |   REM     "Rece|
00005920  69 76 65 64 20 6d 65 73  73 61 67 65 20 25 26 32  |ived message %&2|
00005930  22 0a 20 20 20 4d 4f 56  20 20 20 20 20 6c 69 6e  |".   MOV     lin|
00005940  6b 2c 72 34 0a 0a 20 20  20 43 4d 50 20 20 20 20  |k,r4..   CMP    |
00005950  20 72 32 2c 23 30 20 20  20 20 20 20 20 20 20 20  | r2,#0          |
00005960  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00005970  20 69 73 20 69 74 20 27  71 75 69 74 27 20 3f 0a  | is it 'quit' ?.|
00005980  20 20 20 4c 44 52 4e 45  20 20 20 72 33 2c 24 60  |   LDRNE   r3,$`|
00005990  54 57 5f 4d 6f 72 69 74  65 20 20 20 20 20 20 20  |TW_Morite       |
000059a0  20 20 20 20 20 20 20 20  20 3b 20 68 61 76 65 20  |         ; have |
000059b0  74 6f 20 72 65 61 64 20  61 73 20 61 20 77 6f 72  |to read as a wor|
000059c0  64 0a 20 20 20 43 4d 50  4e 45 20 20 20 72 32 2c  |d.   CMPNE   r2,|
000059d0  72 33 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |r3              |
000059e0  20 20 20 20 20 20 20 20  20 20 20 3b 20 6f 72 20  |           ; or |
000059f0  74 77 5f 6d 6f 72 69 74  65 20 3f 0a 20 20 20 42  |tw_morite ?.   B|
00005a00  45 51 20 20 20 20 20 75  6d 5f 71 75 69 74 20 20  |EQ     um_quit  |
00005a10  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00005a20  20 20 20 20 20 3b 20 77  65 27 76 65 20 62 65 65  |     ; we've bee|
00005a30  6e 20 74 6f 6c 64 20 74  6f 20 71 75 69 74 0a 20  |n told to quit. |
00005a40  20 20 4c 44 52 20 20 20  20 20 72 33 2c 60 65 65  |  LDR     r3,`ee|
00005a50  5f 65 64 69 74 61 63 6b  20 20 20 20 20 20 20 20  |_editack        |
00005a60  20 20 20 20 20 20 20 20  3b 20 45 64 69 74 41 63  |        ; EditAc|
00005a70  6b 0a 20 20 20 43 4d 50  20 20 20 20 20 72 32 2c  |k.   CMP     r2,|
00005a80  72 33 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |r3              |
00005a90  20 20 20 20 20 20 20 20  20 20 20 3b 20 77 61 73  |           ; was|
00005aa0  20 74 68 61 74 20 69 74  20 3f 0a 20 20 20 42 45  | that it ?.   BE|
00005ab0  51 20 20 20 20 20 75 6d  5f 65 64 69 74 61 63 6b  |Q     um_editack|
00005ac0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00005ad0  20 20 20 20 3b 20 79 65  61 68 2c 20 77 65 20 67  |    ; yeah, we g|
00005ae0  6f 74 20 69 74 20 21 0a  20 20 20 4c 44 52 20 20  |ot it !.   LDR  |
00005af0  20 20 20 72 33 2c 60 65  65 5f 61 62 6f 72 74 20  |   r3,`ee_abort |
00005b00  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00005b10  20 3b 20 45 64 69 74 41  62 6f 72 74 0a 20 20 20  | ; EditAbort.   |
00005b20  43 4d 50 20 20 20 20 20  72 32 2c 72 33 20 20 20  |CMP     r2,r3   |
00005b30  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00005b40  20 20 20 20 20 20 3b 20  77 61 73 20 74 68 61 74  |      ; was that|
00005b50  20 69 74 20 3f 0a 20 20  20 42 45 51 20 20 20 20  | it ?.   BEQ    |
00005b60  20 75 6d 5f 65 64 69 74  61 62 6f 72 74 20 20 20  | um_editabort   |
00005b70  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00005b80  20 79 65 61 68 2c 20 77  65 20 67 6f 74 20 69 74  | yeah, we got it|
00005b90  20 21 0a 20 20 20 4c 44  52 20 20 20 20 20 72 33  | !.   LDR     r3|
00005ba0  2c 60 65 65 5f 64 61 74  61 73 61 76 65 20 20 20  |,`ee_datasave   |
00005bb0  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 45 64  |            ; Ed|
00005bc0  69 74 44 61 74 61 53 61  76 65 0a 20 20 20 43 4d  |itDataSave.   CM|
00005bd0  50 20 20 20 20 20 72 32  2c 72 33 20 20 20 20 20  |P     r2,r3     |
00005be0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00005bf0  20 20 20 20 3b 20 77 61  73 20 74 68 61 74 20 69  |    ; was that i|
00005c00  74 20 3f 0a 20 20 20 42  45 51 20 20 20 20 20 75  |t ?.   BEQ     u|
00005c10  6d 5f 65 64 69 74 64 73  20 20 20 20 20 20 20 20  |m_editds        |
00005c20  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 79  |             ; y|
00005c30  65 61 68 2c 20 77 65 20  67 6f 74 20 69 74 20 21  |eah, we got it !|
00005c40  0a 20 20 20 43 4d 50 20  20 20 20 20 72 32 2c 23  |.   CMP     r2,#|
00005c50  44 61 74 61 53 61 76 65  41 63 6b 20 20 20 20 20  |DataSaveAck     |
00005c60  20 20 20 20 20 20 20 20  20 20 3b 20 69 73 20 69  |          ; is i|
00005c70  74 20 44 61 74 61 53 61  76 65 41 63 6b 20 3f 0a  |t DataSaveAck ?.|
00005c80  20 20 20 42 45 51 20 20  20 20 20 75 6d 5f 64 61  |   BEQ     um_da|
00005c90  74 61 73 61 76 65 61 63  6b 20 20 20 20 20 20 20  |tasaveack       |
00005ca0  20 20 20 20 20 20 20 20  20 3b 20 6f 6f 68 2c 20  |         ; ooh, |
00005cb0  6f 6b 20 21 0a 20 20 20  43 4d 50 20 20 20 20 20  |ok !.   CMP     |
00005cc0  72 32 2c 23 44 61 74 61  4c 6f 61 64 20 20 20 20  |r2,#DataLoad    |
00005cd0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
00005ce0  69 73 20 69 74 20 44 61  74 61 4c 6f 61 64 20 3f  |is it DataLoad ?|
00005cf0  0a 20 20 20 42 45 51 20  20 20 20 20 75 6d 5f 64  |.   BEQ     um_d|
00005d00  61 74 61 6c 6f 61 64 20  20 20 20 20 20 20 20 20  |ataload         |
00005d10  20 20 20 20 20 20 20 20  20 20 3b 20 68 65 79 2c  |          ; hey,|
00005d20  20 74 68 69 6e 67 73 20  72 65 74 75 72 69 6e 67  | things returing|
00005d30  20 21 0a 20 20 20 4d 4f  56 20 20 20 20 20 70 63  | !.   MOV     pc|
00005d40  2c 6c 69 6e 6b 0a 0a 24  60 54 57 5f 4d 6f 72 69  |,link..$`TW_Mori|
00005d50  74 65 0a 20 20 20 45 51  55 44 20 20 20 20 54 57  |te.   EQUD    TW|
00005d60  5f 4d 6f 72 69 74 65 0a  0a 3e 75 6d 5f 65 64 69  |_Morite..>um_edi|
00005d70  74 64 73 0a 20 20 20 53  54 4d 46 44 20 20 20 28  |tds.   STMFD   (|
00005d80  73 70 29 21 2c 7b 6c 69  6e 6b 7d 20 20 20 20 20  |sp)!,{link}     |
00005d90  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 53  |             ; S|
00005da0  74 61 63 6b 20 72 65 67  69 73 74 65 72 73 0a 20  |tack registers. |
00005db0  20 20 41 44 44 20 20 20  20 20 72 33 2c 72 31 2c  |  ADD     r3,r1,|
00005dc0  23 34 34 0a 20 20 20 4c  44 52 20 20 20 20 20 72  |#44.   LDR     r|
00005dd0  34 2c 5b 72 31 2c 23 34  30 5d 0a 20 20 20 52 45  |4,[r1,#40].   RE|
00005de0  4d 20 20 20 20 20 22 54  68 65 69 72 20 66 69 6c  |M     "Their fil|
00005df0  65 6e 61 6d 65 20 77 61  73 20 25 24 33 2c 20 74  |ename was %$3, t|
00005e00  79 70 65 3d 25 26 34 22  0a 20 20 20 4c 44 52 20  |ype=%&4".   LDR |
00005e10  20 20 20 20 72 30 2c 60  66 69 6c 74 65 72 73 74  |    r0,`filterst|
00005e20  61 74 65 20 20 20 20 20  20 20 20 20 20 20 20 20  |ate             |
00005e30  20 20 3b 20 72 65 61 64  20 66 69 6c 74 65 72 73  |  ; read filters|
00005e40  74 61 74 65 0a 20 20 20  52 45 4d 20 20 20 20 20  |tate.   REM     |
00005e50  22 52 65 63 65 69 76 65  64 20 45 64 69 74 44 61  |"Received EditDa|
00005e60  74 61 53 61 76 65 2c 20  73 74 61 74 65 3d 25 72  |taSave, state=%r|
00005e70  30 22 0a 20 20 20 43 4d  50 20 20 20 20 20 72 30  |0".   CMP     r0|
00005e80  2c 23 53 5f 41 77 61 69  74 4c 6f 61 64 41 63 6b  |,#S_AwaitLoadAck|
00005e90  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 61 72  |            ; ar|
00005ea0  65 20 77 65 20 61 77 61  69 74 69 6e 67 20 61 20  |e we awaiting a |
00005eb0  73 61 76 65 20 3f 20 28  6d 69 64 64 6c 65 29 0a  |save ? (middle).|
00005ec0  20 20 20 43 4d 50 4e 45  20 20 20 72 30 2c 23 53  |   CMPNE   r0,#S|
00005ed0  5f 41 77 61 69 74 45 53  61 76 65 20 20 20 20 20  |_AwaitESave     |
00005ee0  20 20 20 20 20 20 20 20  20 3b 20 6f 72 20 65 78  |         ; or ex|
00005ef0  70 6c 69 63 69 74 6c 79  20 61 77 61 69 74 69 6e  |plicitly awaitin|
00005f00  67 20 6f 6e 65 20 3f 0a  20 20 20 4c 44 4d 4e 45  |g one ?.   LDMNE|
00005f10  46 44 20 28 73 70 29 21  2c 7b 70 63 7d 20 20 20  |FD (sp)!,{pc}   |
00005f20  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00005f30  20 3b 20 69 66 20 6e 6f  74 2c 20 72 65 74 75 72  | ; if not, retur|
00005f40  6e 0a 20 20 20 42 4c 20  20 20 20 20 20 65 65 5f  |n.   BL      ee_|
00005f50  73 65 6e 64 73 61 76 65  61 63 6b 20 20 20 20 20  |sendsaveack     |
00005f60  20 20 20 20 20 20 20 20  20 20 20 3b 20 73 65 6e  |           ; sen|
00005f70  64 20 61 20 64 61 74 61  73 61 76 65 61 63 6b 20  |d a datasaveack |
00005f80  61 74 20 74 68 65 20 74  61 73 6b 0a 20 20 20 4d  |at the task.   M|
00005f90  56 4e 20 20 20 20 20 72  30 2c 23 4e 4f 54 20 2d  |VN     r0,#NOT -|
00005fa0  31 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |1               |
00005fb0  20 20 20 20 20 3b 20 64  6f 6e 27 74 20 70 61 73  |     ; don't pas|
00005fc0  73 20 6f 6e 0a 20 20 20  53 54 52 20 20 20 20 20  |s on.   STR     |
00005fd0  72 30 2c 60 72 65 61 73  6f 6e 20 20 20 20 20 20  |r0,`reason      |
00005fe0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
00005ff0  73 74 6f 72 65 20 61 73  20 72 65 61 73 6f 6e 0a  |store as reason.|
00006000  20 20 20 4c 44 4d 46 44  20 20 20 28 73 70 29 21  |   LDMFD   (sp)!|
00006010  2c 7b 70 63 7d 20 20 20  20 20 20 20 20 20 20 20  |,{pc}           |
00006020  20 20 20 20 20 20 20 20  20 3b 20 52 65 74 75 72  |         ; Retur|
00006030  6e 20 66 72 6f 6d 20 63  61 6c 6c 0a 0a 3e 75 6d  |n from call..>um|
00006040  5f 65 64 69 74 61 62 6f  72 74 0a 20 20 20 53 54  |_editabort.   ST|
00006050  4d 46 44 20 20 20 28 73  70 29 21 2c 7b 72 30 2c  |MFD   (sp)!,{r0,|
00006060  6c 69 6e 6b 7d 20 20 20  20 20 20 20 20 20 20 20  |link}           |
00006070  20 20 20 20 3b 20 53 74  61 63 6b 20 72 65 67 69  |    ; Stack regi|
00006080  73 74 65 72 73 0a 20 20  20 58 42 4c 20 20 20 20  |sters.   XBL    |
00006090  20 72 65 74 75 72 6e 66  72 6f 6d 66 69 6c 74 65  | returnfromfilte|
000060a0  72 2c 52 65 74 5f 55 6e  63 68 61 6e 67 65 64 20  |r,Ret_Unchanged |
000060b0  3b 20 74 68 65 20 66 69  6c 65 20 77 61 73 6e 27  |; the file wasn'|
000060c0  74 20 63 68 61 6e 67 65  64 0a 20 20 20 4d 56 4e  |t changed.   MVN|
000060d0  20 20 20 20 20 72 30 2c  23 4e 4f 54 20 2d 31 20  |     r0,#NOT -1 |
000060e0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000060f0  20 20 20 3b 20 64 6f 6e  27 74 20 70 61 73 73 20  |   ; don't pass |
00006100  6f 6e 0a 20 20 20 53 54  52 20 20 20 20 20 72 30  |on.   STR     r0|
00006110  2c 60 72 65 61 73 6f 6e  20 20 20 20 20 20 20 20  |,`reason        |
00006120  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 73 74  |            ; st|
00006130  6f 72 65 20 61 73 20 72  65 61 73 6f 6e 0a 20 20  |ore as reason.  |
00006140  20 4c 44 4d 46 44 20 20  20 28 73 70 29 21 2c 7b  | LDMFD   (sp)!,{|
00006150  72 30 2c 70 63 7d 20 20  20 20 20 20 20 20 20 20  |r0,pc}          |
00006160  20 20 20 20 20 20 20 3b  20 53 74 61 63 6b 20 72  |       ; Stack r|
00006170  65 67 69 73 74 65 72 73  0a 0a 3e 75 6d 5f 64 61  |egisters..>um_da|
00006180  74 61 73 61 76 65 61 63  6b 0a 20 20 20 53 54 4d  |tasaveack.   STM|
00006190  46 44 20 20 20 28 73 70  29 21 2c 7b 6c 69 6e 6b  |FD   (sp)!,{link|
000061a0  7d 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |}               |
000061b0  20 20 20 3b 20 53 74 61  63 6b 20 72 65 67 69 73  |   ; Stack regis|
000061c0  74 65 72 73 0a 20 20 20  4c 44 52 20 20 20 20 20  |ters.   LDR     |
000061d0  72 30 2c 60 66 69 6c 74  65 72 73 74 61 74 65 20  |r0,`filterstate |
000061e0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
000061f0  72 65 61 64 20 66 69 6c  74 65 72 73 74 61 74 65  |read filterstate|
00006200  0a 20 20 20 52 45 4d 20  20 20 20 20 22 52 65 63  |.   REM     "Rec|
00006210  65 69 76 65 64 20 53 61  76 65 41 63 6b 2c 20 73  |eived SaveAck, s|
00006220  74 61 74 65 3d 25 72 30  22 0a 20 20 20 43 4d 50  |tate=%r0".   CMP|
00006230  20 20 20 20 20 72 30 2c  23 53 5f 41 77 61 69 74  |     r0,#S_Await|
00006240  53 61 76 65 41 63 6b 20  20 20 20 20 20 20 20 20  |SaveAck         |
00006250  20 20 20 3b 20 61 72 65  20 77 65 20 61 77 61 69  |   ; are we awai|
00006260  74 69 6e 67 20 61 20 73  61 76 65 20 3f 0a 20 20  |ting a save ?.  |
00006270  20 4c 44 4d 4e 45 46 44  20 28 73 70 29 21 2c 7b  | LDMNEFD (sp)!,{|
00006280  70 63 7d 20 20 20 20 20  20 20 20 20 20 20 20 20  |pc}             |
00006290  20 20 20 20 20 20 20 3b  20 69 66 20 6e 6f 74 2c  |       ; if not,|
000062a0  20 72 65 74 75 72 6e 0a  20 20 20 42 4c 20 20 20  | return.   BL   |
000062b0  20 20 20 65 65 5f 73 65  6e 64 6c 6f 61 64 20 20  |   ee_sendload  |
000062c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000062d0  20 3b 20 73 65 6e 64 20  61 20 64 61 74 61 6c 6f  | ; send a datalo|
000062e0  61 64 20 61 74 20 74 68  65 20 74 61 73 6b 0a 20  |ad at the task. |
000062f0  20 20 4d 56 4e 20 20 20  20 20 72 30 2c 23 4e 4f  |  MVN     r0,#NO|
00006300  54 20 2d 31 20 20 20 20  20 20 20 20 20 20 20 20  |T -1            |
00006310  20 20 20 20 20 20 20 20  3b 20 64 6f 6e 27 74 20  |        ; don't |
00006320  70 61 73 73 20 6f 6e 0a  20 20 20 53 54 52 20 20  |pass on.   STR  |
00006330  20 20 20 72 30 2c 60 72  65 61 73 6f 6e 20 20 20  |   r0,`reason   |
00006340  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00006350  20 3b 20 73 74 6f 72 65  20 61 73 20 72 65 61 73  | ; store as reas|
00006360  6f 6e 0a 20 20 20 4c 44  4d 46 44 20 20 20 28 73  |on.   LDMFD   (s|
00006370  70 29 21 2c 7b 70 63 7d  20 20 20 20 20 20 20 20  |p)!,{pc}        |
00006380  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 52 65  |            ; Re|
00006390  74 75 72 6e 20 66 72 6f  6d 20 63 61 6c 6c 0a 0a  |turn from call..|
000063a0  3e 75 6d 5f 64 61 74 61  6c 6f 61 64 0a 20 20 20  |>um_dataload.   |
000063b0  53 54 4d 46 44 20 20 20  28 73 70 29 21 2c 7b 6c  |STMFD   (sp)!,{l|
000063c0  69 6e 6b 7d 20 20 20 20  20 20 20 20 20 20 20 20  |ink}            |
000063d0  20 20 20 20 20 20 3b 20  53 74 61 63 6b 20 72 65  |      ; Stack re|
000063e0  67 69 73 74 65 72 73 0a  20 20 20 4c 44 52 20 20  |gisters.   LDR  |
000063f0  20 20 20 72 30 2c 60 66  69 6c 74 65 72 73 74 61  |   r0,`filtersta|
00006400  74 65 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |te              |
00006410  20 3b 20 72 65 61 64 20  66 69 6c 74 65 72 73 74  | ; read filterst|
00006420  61 74 65 0a 20 20 20 52  45 4d 20 20 20 20 20 22  |ate.   REM     "|
00006430  52 65 63 65 69 76 65 64  20 4c 6f 61 64 2c 20 73  |Received Load, s|
00006440  74 61 74 65 3d 25 72 30  22 0a 20 20 20 43 4d 50  |tate=%r0".   CMP|
00006450  20 20 20 20 20 72 30 2c  23 53 5f 41 77 61 69 74  |     r0,#S_Await|
00006460  4c 6f 61 64 20 20 20 20  20 20 20 20 20 20 20 20  |Load            |
00006470  20 20 20 3b 20 61 72 65  20 77 65 20 61 77 61 69  |   ; are we awai|
00006480  74 69 6e 67 20 61 20 73  61 76 65 20 3f 0a 20 20  |ting a save ?.  |
00006490  20 4c 44 4d 4e 45 46 44  20 28 73 70 29 21 2c 7b  | LDMNEFD (sp)!,{|
000064a0  70 63 7d 20 20 20 20 20  20 20 20 20 20 20 20 20  |pc}             |
000064b0  20 20 20 20 20 20 20 3b  20 69 66 20 6e 6f 74 2c  |       ; if not,|
000064c0  20 72 65 74 75 72 6e 0a  20 20 20 42 4c 20 20 20  | return.   BL   |
000064d0  20 20 20 65 65 5f 73 65  6e 64 6c 6f 61 64 61 63  |   ee_sendloadac|
000064e0  6b 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |k               |
000064f0  20 3b 20 73 65 6e 64 20  61 20 64 61 74 61 6c 6f  | ; send a datalo|
00006500  61 64 61 63 6b 20 61 74  20 74 68 65 20 74 61 73  |adack at the tas|
00006510  6b 0a 20 20 20 58 42 4c  20 20 20 20 20 72 65 74  |k.   XBL     ret|
00006520  75 72 6e 66 72 6f 6d 66  69 6c 74 65 72 2c 52 65  |urnfromfilter,Re|
00006530  74 5f 55 70 64 61 74 65  64 20 20 3b 20 74 68 65  |t_Updated  ; the|
00006540  20 66 69 6c 65 20 57 41  53 20 63 68 61 6e 67 65  | file WAS change|
00006550  64 0a 20 20 20 4d 56 4e  20 20 20 20 20 72 30 2c  |d.   MVN     r0,|
00006560  23 4e 4f 54 20 2d 31 20  20 20 20 20 20 20 20 20  |#NOT -1         |
00006570  20 20 20 20 20 20 20 20  20 20 20 3b 20 64 6f 6e  |           ; don|
00006580  27 74 20 70 61 73 73 20  6f 6e 0a 20 20 20 53 54  |'t pass on.   ST|
00006590  52 20 20 20 20 20 72 30  2c 60 72 65 61 73 6f 6e  |R     r0,`reason|
000065a0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000065b0  20 20 20 20 3b 20 73 74  6f 72 65 20 61 73 20 72  |    ; store as r|
000065c0  65 61 73 6f 6e 0a 20 20  20 4c 44 4d 46 44 20 20  |eason.   LDMFD  |
000065d0  20 28 73 70 29 21 2c 7b  70 63 7d 20 20 20 20 20  | (sp)!,{pc}     |
000065e0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
000065f0  20 52 65 74 75 72 6e 20  66 72 6f 6d 20 63 61 6c  | Return from cal|
00006600  6c 0a 0a 3e 75 6d 5f 65  64 69 74 61 63 6b 0a 20  |l..>um_editack. |
00006610  20 20 53 54 4d 46 44 20  20 20 28 73 70 29 21 2c  |  STMFD   (sp)!,|
00006620  7b 72 30 2d 72 35 2c 6c  69 6e 6b 7d 20 20 20 20  |{r0-r5,link}    |
00006630  20 20 20 20 20 20 20 20  3b 20 53 74 61 63 6b 20  |        ; Stack |
00006640  72 65 67 69 73 74 65 72  73 0a 20 20 20 4c 44 52  |registers.   LDR|
00006650  20 20 20 20 20 72 30 2c  60 66 69 6c 74 65 72 73  |     r0,`filters|
00006660  74 61 74 65 20 20 20 20  20 20 20 20 20 20 20 20  |tate            |
00006670  20 20 20 3b 20 72 65 61  64 20 66 69 6c 74 65 72  |   ; read filter|
00006680  73 74 61 74 65 0a 20 20  20 52 45 4d 20 20 20 20  |state.   REM    |
00006690  20 22 52 65 63 65 69 76  65 64 20 41 63 6b 2c 20  | "Received Ack, |
000066a0  73 74 61 74 65 3d 25 72  30 22 0a 20 20 20 43 4d  |state=%r0".   CM|
000066b0  50 20 20 20 20 20 72 30  2c 23 53 5f 41 77 61 69  |P     r0,#S_Awai|
000066c0  74 41 63 6b 20 20 20 20  20 20 20 20 20 20 20 20  |tAck            |
000066d0  20 20 20 20 3b 20 61 72  65 20 77 65 20 61 77 61  |    ; are we awa|
000066e0  69 74 69 6e 67 20 61 6e  20 61 63 6b 20 3f 0a 20  |iting an ack ?. |
000066f0  20 20 4c 44 4d 4e 45 46  44 20 28 73 70 29 21 2c  |  LDMNEFD (sp)!,|
00006700  7b 72 30 2d 72 35 2c 70  63 7d 20 20 20 20 20 20  |{r0-r5,pc}      |
00006710  20 20 20 20 20 20 20 20  3b 20 69 66 20 6e 6f 74  |        ; if not|
00006720  2c 20 72 65 74 75 72 6e  0a 20 20 20 52 45 4d 20  |, return.   REM |
00006730  20 20 20 20 22 53 74 6f  72 69 6e 67 20 68 61 6e  |    "Storing han|
00006740  64 6c 65 73 20 61 6e 64  20 74 68 69 6e 67 73 22  |dles and things"|
00006750  0a 20 20 20 4c 44 52 20  20 20 20 20 72 30 2c 5b  |.   LDR     r0,[|
00006760  72 31 2c 23 32 34 5d 20  20 20 20 20 20 20 20 20  |r1,#24]         |
00006770  20 20 20 20 20 20 20 20  20 20 3b 20 72 65 61 64  |          ; read|
00006780  20 6a 6f 62 68 61 6e 64  6c 65 0a 20 20 20 53 54  | jobhandle.   ST|
00006790  52 20 20 20 20 20 72 30  2c 60 65 65 5f 6a 6f 62  |R     r0,`ee_job|
000067a0  68 61 6e 64 6c 65 20 20  20 20 20 20 20 20 20 20  |handle          |
000067b0  20 20 20 20 3b 20 73 74  6f 72 65 20 69 74 0a 20  |    ; store it. |
000067c0  20 20 4c 44 52 20 20 20  20 20 72 30 2c 5b 72 31  |  LDR     r0,[r1|
000067d0  2c 23 34 5d 20 20 20 20  20 20 20 20 20 20 20 20  |,#4]            |
000067e0  20 20 20 20 20 20 20 20  3b 20 72 65 61 64 20 74  |        ; read t|
000067f0  61 73 6b 68 61 6e 64 6c  65 0a 20 20 20 53 54 52  |askhandle.   STR|
00006800  20 20 20 20 20 72 30 2c  60 65 65 5f 74 61 73 6b  |     r0,`ee_task|
00006810  68 61 6e 64 6c 65 20 20  20 20 20 20 20 20 20 20  |handle          |
00006820  20 20 20 3b 20 73 74 6f  72 65 20 69 74 0a 20 20  |   ; store it.  |
00006830  20 42 4c 20 20 20 20 20  20 65 65 5f 73 74 61 72  | BL      ee_star|
00006840  74 73 65 6e 64 66 69 6c  65 20 20 20 20 20 20 20  |tsendfile       |
00006850  20 20 20 20 20 20 20 3b  20 73 65 6e 64 20 74 68  |       ; send th|
00006860  65 20 66 69 6c 65 0a 20  20 20 4d 56 4e 20 20 20  |e file.   MVN   |
00006870  20 20 72 30 2c 23 4e 4f  54 20 2d 31 20 20 20 20  |  r0,#NOT -1    |
00006880  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00006890  3b 20 64 6f 6e 27 74 20  70 61 73 73 20 6f 6e 0a  |; don't pass on.|
000068a0  20 20 20 53 54 52 20 20  20 20 20 72 30 2c 60 72  |   STR     r0,`r|
000068b0  65 61 73 6f 6e 20 20 20  20 20 20 20 20 20 20 20  |eason           |
000068c0  20 20 20 20 20 20 20 20  20 3b 20 73 74 6f 72 65  |         ; store|
000068d0  20 61 73 20 72 65 61 73  6f 6e 0a 20 20 20 4c 44  | as reason.   LD|
000068e0  4d 46 44 20 20 20 28 73  70 29 21 2c 7b 72 30 2d  |MFD   (sp)!,{r0-|
000068f0  72 35 2c 70 63 7d 20 20  20 20 20 20 20 20 20 20  |r5,pc}          |
00006900  20 20 20 20 3b 20 52 65  74 75 72 6e 20 66 72 6f  |    ; Return fro|
00006910  6d 20 63 61 6c 6c 0a 0a  3e 75 6d 5f 71 75 69 74  |m call..>um_quit|
00006920  0a 20 20 20 53 54 4d 46  44 20 20 20 28 73 70 29  |.   STMFD   (sp)|
00006930  21 2c 7b 6c 69 6e 6b 7d  20 20 20 20 20 20 20 20  |!,{link}        |
00006940  20 20 20 20 20 20 20 20  20 20 3b 20 53 74 61 63  |          ; Stac|
00006950  6b 20 72 65 67 69 73 74  65 72 73 0a 20 20 20 42  |k registers.   B|
00006960  4c 20 20 20 20 20 20 65  65 5f 61 62 6f 72 74 20  |L      ee_abort |
00006970  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00006980  20 20 20 20 20 3b 20 73  65 6e 64 20 61 6e 20 61  |     ; send an a|
00006990  62 6f 72 74 0a 20 20 20  42 4c 20 20 20 20 20 20  |bort.   BL      |
000069a0  72 65 6d 6f 76 65 66 69  6c 74 65 72 20 20 20 20  |removefilter    |
000069b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
000069c0  72 65 6d 6f 76 65 20 74  68 65 20 66 69 6c 74 65  |remove the filte|
000069d0  72 0a 20 20 20 4d 56 4e  20 20 20 20 20 72 30 2c  |r.   MVN     r0,|
000069e0  23 4e 4f 54 20 2d 31 20  20 20 20 20 20 20 20 20  |#NOT -1         |
000069f0  20 20 20 20 20 20 20 20  20 20 20 3b 20 64 6f 6e  |           ; don|
00006a00  27 74 20 70 61 73 73 20  6f 6e 0a 20 20 20 53 54  |'t pass on.   ST|
00006a10  52 20 20 20 20 20 72 30  2c 60 72 65 61 73 6f 6e  |R     r0,`reason|
00006a20  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00006a30  20 20 20 20 3b 20 73 74  6f 72 65 20 61 73 20 72  |    ; store as r|
00006a40  65 61 73 6f 6e 0a 20 20  20 4c 44 4d 46 44 20 20  |eason.   LDMFD  |
00006a50  20 28 73 70 29 21 2c 7b  70 63 7d 20 20 20 20 20  | (sp)!,{pc}     |
00006a60  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00006a70  20 52 65 74 75 72 6e 20  66 72 6f 6d 20 63 61 6c  | Return from cal|
00006a80  6c 0a 0a 3b 20 63 61 6c  6c 20 74 68 69 73 20 74  |l..; call this t|
00006a90  6f 20 72 65 74 75 72 6e  20 74 6f 20 6d 61 69 6e  |o return to main|
00006aa0  20 70 72 6f 67 72 61 6d  0a 3e 72 65 74 75 72 6e  | program.>return|
00006ab0  66 72 6f 6d 66 69 6c 74  65 72 0a 20 20 20 53 54  |fromfilter.   ST|
00006ac0  4d 46 44 20 20 20 28 73  70 29 21 2c 7b 72 30 2d  |MFD   (sp)!,{r0-|
00006ad0  72 35 2c 6c 69 6e 6b 7d  20 20 20 20 20 20 20 20  |r5,link}        |
00006ae0  20 20 20 20 3b 20 53 74  61 63 6b 20 72 65 67 69  |    ; Stack regi|
00006af0  73 74 65 72 73 0a 20 20  20 53 54 52 20 20 20 20  |sters.   STR    |
00006b00  20 72 30 2c 60 72 65 74  75 72 6e 73 74 61 74 65  | r0,`returnstate|
00006b10  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00006b20  20 73 74 6f 72 65 20 74  68 65 20 72 65 74 75 72  | store the retur|
00006b30  6e 20 73 74 61 74 65 0a  20 20 20 52 45 4d 20 20  |n state.   REM  |
00006b40  20 20 20 22 41 74 74 65  6d 70 74 69 6e 67 20 74  |   "Attempting t|
00006b50  6f 20 73 65 6e 64 20 27  64 6f 6e 65 27 20 6d 65  |o send 'done' me|
00006b60  73 73 61 67 65 20 25 72  30 22 0a 20 20 20 4c 44  |ssage %r0".   LD|
00006b70  4d 46 44 20 20 20 28 73  70 29 21 2c 7b 72 30 2d  |MFD   (sp)!,{r0-|
00006b80  72 35 2c 70 63 7d 5e 20  20 20 20 20 20 20 20 20  |r5,pc}^         |
00006b90  20 20 20 20 3b 20 52 65  74 75 72 6e 20 66 72 6f  |    ; Return fro|
00006ba0  6d 20 63 61 6c 6c 0a 0a  23 6c 69 62 72 61 72 79  |m call..#library|
00006bb0  20 22 73 74 72 69 6e 67  73 22 2c 73 74 72 6c 65  | "strings",strle|
00006bc0  6e 2e 73 74 72 63 70 79  0a 23 6c 69 62 72 61 72  |n.strcpy.#librar|
00006bd0  79 20 22 6d 65 6d 6f 72  79 22 2c 73 74 72 64 75  |y "memory",strdu|
00006be0  70 2e 72 65 6c 65 61 73  65 2e 63 6c 61 69 6d 0a  |p.release.claim.|
00006bf0  23 48 65 72 65 20 4c 69  62 72 61 72 69 65 73 0a  |#Here Libraries.|
00006c00