Home » Archimedes archive » Acorn User » AU 1996-08.adf » Regulars » StarInfo/Fletcher/PatchBas

StarInfo/Fletcher/PatchBas

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 1996-08.adf » Regulars
Filename: StarInfo/Fletcher/PatchBas
Read OK:
File size: 1E9D bytes
Load address: 0000
Exec address: 0000
File contents
   10REM > Patch for memory compilation
   20REM Created by JFPatch LEN Justin Fletcher, 05 Sep 1995
   30REM Intermediate code file created 12 Nov 1995
   40ON ERROR PROCError:END
   50PROCpatch_loadfile
   60:
   70REM **** User pre-assembly ****
   80`delay=5
   90:
  100REM **** Main assembly routine ****
  110REM **** Workspace structures ****
  120:
  130ptr=0:REM Start structure of workspace
  140`count=ptr:ptr+=4
  150`pointer=ptr:ptr+=4
  160`len_workspace=ptr
  170:
  180sp=13:link=14:pc=15
  190vbit=1<<28:cbit=1<<29:zbit=1<<30:nbit=1<<31
  200P%=&0:O%=MC%
  210FOR pass%=4 TO 6 STEP2
  220REM **** Start of main code ****
  230PROCpatch_setpc(0)
  240[OPT pass%
  250          ; **** Add module header ****
  260   EQUD 0                  ; Start offset
  270   EQUD module_init        ; Initialisation offset
  280   EQUD module_final       ; Finalisation offset
  290   EQUD module_service     ; Service request offset
  300   EQUD module_title       ; Title string offset
  310   EQUD module_help        ; Help string offset
  320   EQUD module_commands    ; Help and command keyword table offset
  330:
  340.module_title
  350   EQUS "Ellipsis"+CHR$0
  360   ALIGN
  370:
  380.module_help
  390   EQUS "� Conversion"+CHR$9+"1.01 ("+MID$(TIME$,5,11)+") � Justin Fletcher"+CHR$0
  400   ALIGN
  410:
  420.module_service
  430   LDR     r12,[r12]
  440   MOVS    pc,link
  450:
  460.module_init
  470   STMFD   (sp)!,{r0-r4,link}     ; Stack registers
  480   MOV     r0,#6
  490 FNLMOV("",3,`len_workspace)
  500   SWI     "XOS_Module"           ; Claim private workspace
  510   ADDVS   sp,sp,#4               ; if error return r0
  520   LDMVSFD (sp)!,{r1-r4,pc}       ; return error
  530   STR     r2,[r12]               ; store in private word
  540   MOV     r12,r2                 ; r12=space
  550   LDMFD   (sp)!,{r0-r4,link}     ; restore registers
  560   B       initialise
  570:
  580.module_final
  590   STMFD   (sp)!,{r0-r4,r12,link} ; Stack registers
  600   LDR     r12,[r12]
  610   BL      finalise
  620   ADDVS   sp,sp,#4
  630   LDMVSFD (sp)!,{r1-r4,r12,pc}    ; Return if error
  640   MOV     r0,#7
  650   MOV     r2,r12
  660   SWI     "XOS_Module"           ; Release workspace
  670   ADDVS   sp,sp,#4
  680   LDMVSFD (sp)!,{r1-r4,r12,pc}   ; Return if error
  690   LDMFD   (sp)!,{r0-r4,r12,pc}   ; Return
  700:
  710; ***** Module commands table
  720.module_commands
  730   EQUS "Ellipsis"         ; Command name
  740   EQUB 0:ALIGN
  750   EQUD 0                  ; Code to call
  760   EQUD &0                 ; Flags
  770   EQUD 0                  ; Syntax pointer
  780   EQUD help_ellipsis      ; Help pointer
  790   EQUB 0
  800   ALIGN
  810:
  820; ***** Help and Syntax messages
  830.help_ellipsis
  840   EQUS "The Ellipsis module provides a special key sequence to "
  850   EQUS "add � into the keyboard buffer. Press . three times to "
  860   EQUS "activate. "
  870   EQUB 0
  880   ALIGN
  890:
  900          ; **** End of module header ****
  910:
  920.initialise
  930    STMFD   (sp)!,{link}
  940    MOV     r0,#&14               ; vector &14 - insert vector
  950    ADR     r1,insvector          ; to be processed at insvector
  960   MOV     r2,r12
  970   SWI     "XOS_Claim"
  980    MOV     r0,#0
  990   STR     r0,[r12,#`count]
 1000    LDMFD   (sp)!,{pc}
 1010:
 1020.finalise
 1030    STMFD   (sp)!,{r0-r2,link}
 1040    MOV     r0,#&14               ; vector &14 - insert vector
 1050    ADR     r1,insvector          ; to be processed at insvector
 1060   MOV     r2,r12
 1070   SWI     "XOS_Release"
 1080    LDMFD   (sp)!,{r0-r2,pc}
 1090:
 1100.insvector
 1110    STMFD   (sp)!,{r1-r2,r8-r9,link}
 1120    CMP     r1,#0                 ; is it insert vector ?
 1130    BNE     __z0_exit                 ; if not, forget itTHEN
 1140   LDR     r2,[r12,#`count]
 1150          ; get the count
 1160    CMP     r0,#ASC(".")          ; is it a . insert ?
 1170    ADDEQ   r2,r2,#1              ; if so, inc count
 1180    MOVNE   r2,#0                 ; otherwise, zero count
 1190    CMP     r2,#3                 ; is it 3 ?
 1200    MOVEQ   r2,#0                 ; if so, reset to zero
 1210   STR     r2,[r12,#`count]
 1220          ; store count back
 1230    BNE     __z0_exit                 ; if not 3rd, exit
 1240    ADR     r0,__z0_tosend            ; pointer to data to send
 1250   STR     r0,[r12,#`pointer]
 1260          ; store in workspace
 1270    MOV     r0,#`delay            ; call every x cs
 1280    ADR     r1,callbackroutine    ; the address of the code
 1290    MOV     r2,r12                ; workspace
 1300          ; Preserve r14_svc
 1310   MOV     r7,pc
 1320   ORR     r6,r7,#3
 1330   TEQP    r6,#0
 1340   MOV     r0,r0
 1350   STMFD   (sp)!,{link}
 1360          ; set SVC mode and stack link
 1370    SWI     "OS_CallAfter"        ; setup call back
 1380          ; Restore r14_svc
 1390   LDMFD   (sp)!,{link}
 1400   TEQP    r7,#0
 1410   MOV     r0,r0
 1420          ; release SVC mode and unstack link
 1430    LDMFD   (sp)!,{r1-r2,r8-r9,link,pc} ; return without adding anything to insert
 1440.__z0_exit
 1450    LDMFD   (sp)!,{r1-r2,r8-r9,pc}
 1460:
 1470.__z0_tosend
 1480;     EQUS    "ABCD"+CHR$2
 1490    EQUB    127
 1500    EQUB    127
 1510    EQUB    0
 1520    EQUB    ASC("�")
 1530    EQUB    2
 1540    ALIGN
 1550:
 1560.callbackroutine
 1570    STMFD   (sp)!,{r0-r4,r8-r9,link}            ; Stack registers
 1580          ; Preserve r14_svc
 1590   MOV     r9,pc
 1600   ORR     r8,r9,#3
 1610   TEQP    r8,#0
 1620   MOV     r0,r0
 1630   STMFD   (sp)!,{link}
 1640          ; set SVC mode and stack link
 1650   LDR     r3,[r12,#`pointer]
 1660          ; get pointer to char
 1670.__z1_next
 1680    LDRB    r4,[r3]                       ; get character
 1690;     REM     "%r2"
 1700    ADD     r3,r3,#1                      ; add 1 to pointer
 1710    CMP     r4,#2                         ; is character 2 (EOL) ?
 1720    BEQ     __z1_remove                       ; y=remove callback
 1730    MOV     r2,r4
 1740   MOV     r0,#153
 1750   MOV     r1,#0
 1760   SWI     "XOS_Byte"
 1770          ; insert into buffeer
 1780    CMP     r4,#0                         ; is it control ?
 1790    BEQ     __z1_next                         ; if so, get next
 1800   STR     r3,[r12,#`pointer]
 1810          ; store back in workspace
 1820    MOV     r0,#`delay
 1830    ADR     r1,callbackroutine
 1840   MOV     r2,r12
 1850   SWI     "XOS_CallAfter"
 1860.__z1_exit
 1870.__z1_remove
 1880          ; Restore r14_svc
 1890   LDMFD   (sp)!,{link}
 1900   TEQP    r9,#0
 1910   MOV     r0,r0
 1920          ; release SVC mode and unstack link
 1930    LDMFD   (sp)!,{r0-r4,r8-r9,pc}              ; Return from call
 1940:
 1950]
 1960REM **** End of main code ****
 1970REM Set final pointer to find the length of the code
 1980PROCpatch_setpc(0)
 1990NEXT pass%
 2000PROCpatch_savefile
 2030REM **** Post-assembly user code *****
 2040*Run <Ellipsis$Dir>.DotDotDot
 2050END
 2060:
 2070REM **** Filing procedures ****
 2080:
 2090DEF PROCpatch_loadfile
 2100codelen=0
 2110DIM MC% &1400
 2120endofcode=codelen+&0:max=codelen
 2130L%=endofcode:__cap%=FALSE
 2230ENDPROC
 2240:
 2250DEF PROCpatch_savefile
 2260outfile$="<Ellipsis$Dir>.DotDotDot"
 2270OSCLI("Save "+outfile$+" "+STR$~MC%+" "+STR$~(max+MC%))
 2280OSCLI("Settype "+outfile$+" Module")
 2290patchdir$="<Ellipsis$Dir>"
 2330ENDPROC
 2340:
 2350REM **** Error Handler ****
 2360:
 2370DEFPROCError
 2450ERROR EXT ERR,REPORT$+" at line "+STR$ERL
 2460ENDPROC
 2470:
 2480REM **** Utility procedures ****
 2490:
 2500DEFPROCpatch_setpc(n)
 2510IF P%-&0>max THENmax=P%-&0
 2520P%=n:O%=MC%+n-&0
 2530ENDPROC
 2540:
 2550DEFFNfindfreereg(a,b,c,d):LOCAL n:n=0
 2560WHILE n=a OR n=b OR n=c OR n=d
 2570 n+=1
 2580ENDWHILE
 2590=n
 2600:
 2610REM **** Long MOV macro instruction ****
 2620:
 2630DEFFNLMOV(cond$,reg,value)
 2640IF cond$="" OR cond$="  " THENcond$="AL"
 2650cond=(INSTR("EQNECSCCMIPLVSVCHILSGELTGTLEALNV",cond$)-1)/2
 2660mov=(&3A<<20)+(reg<<12)+(cond<<28)
 2670add=(&28<<20)+(reg<<12)+(reg<<16)+(cond<<28)
 2680IF value<0 THENneg=TRUE:mov=mov OR (1<<22):add=add EOR (12<<20):value=-value-1 ELSEneg=FALSE
 2690shift=0
 2700REPEAT
 2710 WHILE (value AND 3)=0 AND shift<16
 2720  shift+=1:value=value DIV4
 2730 ENDWHILE
 2740 xshift=16-shift:IF xshift=16 THENxshift=0
 2750 IF mov<>0 THEN
 2760  [OPT pass%:EQUD mov+(xshift<<8)+(value AND 255):]
 2770  mov=0
 2780 ELSE
 2790  [OPT pass%:EQUD add+(xshift<<8)+(value AND 255):]
 2800 ENDIF
 2810 value=value DIV256:shift+=4
 2820UNTILvalue=0
 2830=0
 2840:
32639REM JFPatch

$� > Patch for memory compilation
7� Created by JFPatch � Justin Fletcher, 05 Sep 1995
0� Intermediate code file created 12 Nov 1995
(� � �Error:�
2�patch_loadfile
<:
F!� **** User pre-assembly ****
P`delay=5
Z:
d%� **** Main assembly routine ****
n$� **** Workspace structures ****
x:
�(ptr=0:� Start structure of workspace
�`count=ptr:ptr+=4
�`pointer=ptr:ptr+=4
�`len_workspace=ptr
�:
�sp=13:link=14:pc=15
�/vbit=1<<28:cbit=1<<29:zbit=1<<30:nbit=1<<31
�P%=&0:O%=MC%
�� pass%=4 � 6 �2
�"� **** Start of main code ****
��patch_setpc(0)
�[OPT pass%
�+          ; **** Add module header ****
-   EQUD 0                  ; Start offset
6   EQUD module_init        ; Initialisation offset
4   EQUD module_final       ; Finalisation offset
"7   EQUD module_service     ; Service request offset
,4   EQUD module_title       ; Title string offset
63   EQUD module_help        ; Help string offset
@F   EQUD module_commands    ; Help and command keyword table offset
J:
T.module_title
^   EQUS "Ellipsis"+�0
h   ALIGN
r:
|.module_help
�I   EQUS "� Conversion"+�9+"1.01 ("+��$,5,11)+") � Justin Fletcher"+�0
�   ALIGN
�:
�.module_service
�   LDR     r12,[r12]
�   MOVS    pc,link
�:
�.module_init
�7   STMFD   (sp)!,{r0-r4,link}     ; Stack registers
�   MOV     r0,#6
� �LMOV("",3,`len_workspace)
�?   SWI     "XOS_Module"           ; Claim private workspace
�:   ADDVS   sp,sp,#4               ; if error return r0
4   LDMVSFD (sp)!,{r1-r4,pc}       ; return error
=   STR     r2,[r12]               ; store in private word
1   MOV     r12,r2                 ; r12=space
&9   LDMFD   (sp)!,{r0-r4,link}     ; restore registers
0   B       initialise
::
D.module_final
N7   STMFD   (sp)!,{r0-r4,r12,link} ; Stack registers
X   LDR     r12,[r12]
b   BL      finalise
l   ADDVS   sp,sp,#4
v8   LDMVSFD (sp)!,{r1-r4,r12,pc}    ; Return if error
�   MOV     r0,#7
�   MOV     r2,r12
�9   SWI     "XOS_Module"           ; Release workspace
�   ADDVS   sp,sp,#4
�7   LDMVSFD (sp)!,{r1-r4,r12,pc}   ; Return if error
�.   LDMFD   (sp)!,{r0-r4,r12,pc}   ; Return
�:
�!; ***** Module commands table
�.module_commands
�-   EQUS "Ellipsis"         ; Command name
�   EQUB 0:ALIGN
�-   EQUD 0                  ; Code to call
�&   EQUD &0                 ; Flags
/   EQUD 0                  ; Syntax pointer
-   EQUD help_ellipsis      ; Help pointer

   EQUB 0
    ALIGN
*:
4$; ***** Help and Syntax messages
>.help_ellipsis
HE   EQUS "The Ellipsis module provides a special key sequence to "
RE   EQUS "add � into the keyboard buffer. Press . three times to "
\   EQUS "activate. "
f
   EQUB 0
p   ALIGN
z:
�.          ; **** End of module header ****
�:
�.initialise
�    STMFD   (sp)!,{link}
�B    MOV     r0,#&14               ; vector &14 - insert vector
�D    ADR     r1,insvector          ; to be processed at insvector
�   MOV     r2,r12
�   SWI     "XOS_Claim"
�    MOV     r0,#0
�   STR     r0,[r12,#`count]
�    LDMFD   (sp)!,{pc}
�:
�
.finalise
"    STMFD   (sp)!,{r0-r2,link}
B    MOV     r0,#&14               ; vector &14 - insert vector
D    ADR     r1,insvector          ; to be processed at insvector
$   MOV     r2,r12
.   SWI     "XOS_Release"
8     LDMFD   (sp)!,{r0-r2,pc}
B:
L.insvector
V(    STMFD   (sp)!,{r1-r2,r8-r9,link}
`=    CMP     r1,#0                 ; is it insert vector ?
j>    BNE     __z0_exit                 ; if not, forget it�
t   LDR     r2,[r12,#`count]
~          ; get the count
�8    CMP     r0,#�(".")          ; is it a . insert ?
�8    ADDEQ   r2,r2,#1              ; if so, inc count
�=    MOVNE   r2,#0                 ; otherwise, zero count
�1    CMP     r2,#3                 ; is it 3 ?
�9    �Q   r2,#0                 ; if so, reset to zero
�   STR     r2,[r12,#`count]
�           ; store count back
�<    BNE     __z0_exit                 ; if not 3rd, exit
�C    ADR     r0,__z0_tosend            ; pointer to data to send
�!   STR     r0,[r12,#`pointer]
�"          ; store in workspace
�7    MOV     r0,#`delay            ; call every x cs
?    ADR     r1,callbackroutine    ; the address of the code

1    MOV     r2,r12                ; workspace
           ; Preserve r14_svc
   MOV     r7,pc
(   �R     r6,r7,#3
2   TEQP    r6,#0
<   MOV     r0,r0
F   STMFD   (sp)!,{link}
P+          ; set SVC mode and stack link
Z7    SWI     "OS_CallAfter"        ; setup call back
d          ; Restore r14_svc
n   LDMFD   (sp)!,{link}
x   TEQP    r7,#0
�   MOV     r0,r0
�1          ; release SVC mode and unstack link
�V    LDMFD   (sp)!,{r1-r2,r8-r9,link,pc} ; return without adding anything to insert
�.__z0_exit
�&    LDMFD   (sp)!,{r1-r2,r8-r9,pc}
�:
�.__z0_tosend
�;     EQUS    "ABCD"+�2
�    EQUB    127
�    EQUB    127
�    EQUB    0
�    EQUB    �("�")
�    EQUB    2

    ALIGN
:
.callbackroutine
"E    STMFD   (sp)!,{r0-r4,r8-r9,link}            ; Stack registers
,           ; Preserve r14_svc
6   MOV     r9,pc
@   �R     r8,r9,#3
J   TEQP    r8,#0
T   MOV     r0,r0
^   STMFD   (sp)!,{link}
h+          ; set SVC mode and stack link
r!   LDR     r3,[r12,#`pointer]
|#          ; get pointer to char
�.__z1_next
�=    LDRB    r4,[r3]                       ; get character
�;     �     "%r2"
�@    ADD     r3,r3,#1                      ; add 1 to pointer
�F    CMP     r4,#2                         ; is character 2 (EOL) ?
�E    BEQ     __z1_remove                       ; y=remove callback
�    MOV     r2,r4
�   MOV     r0,#153
�   MOV     r1,#0
�   SWI     "XOS_Byte"
�#          ; insert into buffeer
�?    CMP     r4,#0                         ; is it control ?
�C    BEQ     __z1_next                         ; if so, get next
!   STR     r3,[r12,#`pointer]
'          ; store back in workspace
    MOV     r0,#`delay
&"    ADR     r1,callbackroutine
0   MOV     r2,r12
:   SWI     "XOS_CallAfter"
D.__z1_exit
N.__z1_remove
X          ; Restore r14_svc
b   LDMFD   (sp)!,{link}
l   TEQP    r9,#0
v   MOV     r0,r0
�1          ; release SVC mode and unstack link
�F    LDMFD   (sp)!,{r0-r4,r8-r9,pc}              ; Return from call
�:
�]
� � **** End of main code ****
�6� Set final pointer to find the length of the code
��patch_setpc(0)
�� pass%
��patch_savefile
�(� **** Post-assembly user code *****
�!*Run <Ellipsis$Dir>.DotDotDot
�
:
!� **** Filing procedures ****
 :
*� �patch_loadfile
4
codelen=0
>� MC% &1400
H$endofcode=codelen+&0:max=codelen
RL%=endofcode:__cap%=�
��
�:
�� �patch_savefile
�'outfile$="<Ellipsis$Dir>.DotDotDot"
�1�("Save "+outfile$+" "+�~MC%+" "+�~(max+MC%))
�$�("Settype "+outfile$+" Module")
�patchdir$="<Ellipsis$Dir>"
	�
	$:
	.� **** Error Handler ****
	8:
	B��Error
	�� � �,�$+" at line "+Þ
	��
	�:
	�"� **** Utility procedures ****
	�:
	���patch_setpc(n)
	�� P%-&0>max �max=P%-&0
	�P%=n:O%=MC%+n-&0
	��
	�:
	�"ݤfindfreereg(a,b,c,d):� n:n=0
ȕ n=a � n=b � n=c � n=d

	 n+=1
�
=n
(:
2*� **** Long MOV macro instruction ****
<:
FݤLMOV(cond$,reg,value)
P'� cond$="" � cond$="  " �cond$="AL"
Z9cond=(�"EQNECSCCMIPLVSVCHILSGELTGTLEALNV",cond$)-1)/2
d&mov=(&3A<<20)+(reg<<12)+(cond<<28)
n0add=(&28<<20)+(reg<<12)+(reg<<16)+(cond<<28)
xO� value<0 �neg=�:mov=mov � (1<<22):add=add � (12<<20):value=-value-1 �neg=�
�shift=0
��
�  ȕ (value � 3)=0 � shift<16
�  shift+=1:value=value �4
� �
�* xshift=16-shift:� xshift=16 �xshift=0
� � mov<>0 �
�5  [OPT pass%:EQUD mov+(xshift<<8)+(value � 255):]
�  mov=0
� �
�5  [OPT pass%:EQUD add+(xshift<<8)+(value � 255):]
� �
� value=value �256:shift+=4
�value=0
=0
:

� JFPatch
�
00000000  0d 00 0a 24 f4 20 3e 20  50 61 74 63 68 20 66 6f  |...$. > Patch fo|
00000010  72 20 6d 65 6d 6f 72 79  20 63 6f 6d 70 69 6c 61  |r memory compila|
00000020  74 69 6f 6e 0d 00 14 37  f4 20 43 72 65 61 74 65  |tion...7. Create|
00000030  64 20 62 79 20 4a 46 50  61 74 63 68 20 a9 20 4a  |d by JFPatch . J|
00000040  75 73 74 69 6e 20 46 6c  65 74 63 68 65 72 2c 20  |ustin Fletcher, |
00000050  30 35 20 53 65 70 20 31  39 39 35 0d 00 1e 30 f4  |05 Sep 1995...0.|
00000060  20 49 6e 74 65 72 6d 65  64 69 61 74 65 20 63 6f  | Intermediate co|
00000070  64 65 20 66 69 6c 65 20  63 72 65 61 74 65 64 20  |de file created |
00000080  31 32 20 4e 6f 76 20 31  39 39 35 0d 00 28 10 ee  |12 Nov 1995..(..|
00000090  20 85 20 f2 45 72 72 6f  72 3a e0 0d 00 32 13 f2  | . .Error:...2..|
000000a0  70 61 74 63 68 5f 6c 6f  61 64 66 69 6c 65 0d 00  |patch_loadfile..|
000000b0  3c 05 3a 0d 00 46 21 f4  20 2a 2a 2a 2a 20 55 73  |<.:..F!. **** Us|
000000c0  65 72 20 70 72 65 2d 61  73 73 65 6d 62 6c 79 20  |er pre-assembly |
000000d0  2a 2a 2a 2a 0d 00 50 0c  60 64 65 6c 61 79 3d 35  |****..P.`delay=5|
000000e0  0d 00 5a 05 3a 0d 00 64  25 f4 20 2a 2a 2a 2a 20  |..Z.:..d%. **** |
000000f0  4d 61 69 6e 20 61 73 73  65 6d 62 6c 79 20 72 6f  |Main assembly ro|
00000100  75 74 69 6e 65 20 2a 2a  2a 2a 0d 00 6e 24 f4 20  |utine ****..n$. |
00000110  2a 2a 2a 2a 20 57 6f 72  6b 73 70 61 63 65 20 73  |**** Workspace s|
00000120  74 72 75 63 74 75 72 65  73 20 2a 2a 2a 2a 0d 00  |tructures ****..|
00000130  78 05 3a 0d 00 82 28 70  74 72 3d 30 3a f4 20 53  |x.:...(ptr=0:. S|
00000140  74 61 72 74 20 73 74 72  75 63 74 75 72 65 20 6f  |tart structure o|
00000150  66 20 77 6f 72 6b 73 70  61 63 65 0d 00 8c 15 60  |f workspace....`|
00000160  63 6f 75 6e 74 3d 70 74  72 3a 70 74 72 2b 3d 34  |count=ptr:ptr+=4|
00000170  0d 00 96 17 60 70 6f 69  6e 74 65 72 3d 70 74 72  |....`pointer=ptr|
00000180  3a 70 74 72 2b 3d 34 0d  00 a0 16 60 6c 65 6e 5f  |:ptr+=4....`len_|
00000190  77 6f 72 6b 73 70 61 63  65 3d 70 74 72 0d 00 aa  |workspace=ptr...|
000001a0  05 3a 0d 00 b4 17 73 70  3d 31 33 3a 6c 69 6e 6b  |.:....sp=13:link|
000001b0  3d 31 34 3a 70 63 3d 31  35 0d 00 be 2f 76 62 69  |=14:pc=15.../vbi|
000001c0  74 3d 31 3c 3c 32 38 3a  63 62 69 74 3d 31 3c 3c  |t=1<<28:cbit=1<<|
000001d0  32 39 3a 7a 62 69 74 3d  31 3c 3c 33 30 3a 6e 62  |29:zbit=1<<30:nb|
000001e0  69 74 3d 31 3c 3c 33 31  0d 00 c8 10 50 25 3d 26  |it=1<<31....P%=&|
000001f0  30 3a 4f 25 3d 4d 43 25  0d 00 d2 14 e3 20 70 61  |0:O%=MC%..... pa|
00000200  73 73 25 3d 34 20 b8 20  36 20 88 32 0d 00 dc 22  |ss%=4 . 6 .2..."|
00000210  f4 20 2a 2a 2a 2a 20 53  74 61 72 74 20 6f 66 20  |. **** Start of |
00000220  6d 61 69 6e 20 63 6f 64  65 20 2a 2a 2a 2a 0d 00  |main code ****..|
00000230  e6 13 f2 70 61 74 63 68  5f 73 65 74 70 63 28 30  |...patch_setpc(0|
00000240  29 0d 00 f0 0e 5b 4f 50  54 20 70 61 73 73 25 0d  |)....[OPT pass%.|
00000250  00 fa 2b 20 20 20 20 20  20 20 20 20 20 3b 20 2a  |..+          ; *|
00000260  2a 2a 2a 20 41 64 64 20  6d 6f 64 75 6c 65 20 68  |*** Add module h|
00000270  65 61 64 65 72 20 2a 2a  2a 2a 0d 01 04 2d 20 20  |eader ****...-  |
00000280  20 45 51 55 44 20 30 20  20 20 20 20 20 20 20 20  | EQUD 0         |
00000290  20 20 20 20 20 20 20 20  20 3b 20 53 74 61 72 74  |         ; Start|
000002a0  20 6f 66 66 73 65 74 0d  01 0e 36 20 20 20 45 51  | offset...6   EQ|
000002b0  55 44 20 6d 6f 64 75 6c  65 5f 69 6e 69 74 20 20  |UD module_init  |
000002c0  20 20 20 20 20 20 3b 20  49 6e 69 74 69 61 6c 69  |      ; Initiali|
000002d0  73 61 74 69 6f 6e 20 6f  66 66 73 65 74 0d 01 18  |sation offset...|
000002e0  34 20 20 20 45 51 55 44  20 6d 6f 64 75 6c 65 5f  |4   EQUD module_|
000002f0  66 69 6e 61 6c 20 20 20  20 20 20 20 3b 20 46 69  |final       ; Fi|
00000300  6e 61 6c 69 73 61 74 69  6f 6e 20 6f 66 66 73 65  |nalisation offse|
00000310  74 0d 01 22 37 20 20 20  45 51 55 44 20 6d 6f 64  |t.."7   EQUD mod|
00000320  75 6c 65 5f 73 65 72 76  69 63 65 20 20 20 20 20  |ule_service     |
00000330  3b 20 53 65 72 76 69 63  65 20 72 65 71 75 65 73  |; Service reques|
00000340  74 20 6f 66 66 73 65 74  0d 01 2c 34 20 20 20 45  |t offset..,4   E|
00000350  51 55 44 20 6d 6f 64 75  6c 65 5f 74 69 74 6c 65  |QUD module_title|
00000360  20 20 20 20 20 20 20 3b  20 54 69 74 6c 65 20 73  |       ; Title s|
00000370  74 72 69 6e 67 20 6f 66  66 73 65 74 0d 01 36 33  |tring offset..63|
00000380  20 20 20 45 51 55 44 20  6d 6f 64 75 6c 65 5f 68  |   EQUD module_h|
00000390  65 6c 70 20 20 20 20 20  20 20 20 3b 20 48 65 6c  |elp        ; Hel|
000003a0  70 20 73 74 72 69 6e 67  20 6f 66 66 73 65 74 0d  |p string offset.|
000003b0  01 40 46 20 20 20 45 51  55 44 20 6d 6f 64 75 6c  |.@F   EQUD modul|
000003c0  65 5f 63 6f 6d 6d 61 6e  64 73 20 20 20 20 3b 20  |e_commands    ; |
000003d0  48 65 6c 70 20 61 6e 64  20 63 6f 6d 6d 61 6e 64  |Help and command|
000003e0  20 6b 65 79 77 6f 72 64  20 74 61 62 6c 65 20 6f  | keyword table o|
000003f0  66 66 73 65 74 0d 01 4a  05 3a 0d 01 54 11 2e 6d  |ffset..J.:..T..m|
00000400  6f 64 75 6c 65 5f 74 69  74 6c 65 0d 01 5e 19 20  |odule_title..^. |
00000410  20 20 45 51 55 53 20 22  45 6c 6c 69 70 73 69 73  |  EQUS "Ellipsis|
00000420  22 2b bd 30 0d 01 68 0c  20 20 20 41 4c 49 47 4e  |"+.0..h.   ALIGN|
00000430  0d 01 72 05 3a 0d 01 7c  10 2e 6d 6f 64 75 6c 65  |..r.:..|..module|
00000440  5f 68 65 6c 70 0d 01 86  49 20 20 20 45 51 55 53  |_help...I   EQUS|
00000450  20 22 8c 20 43 6f 6e 76  65 72 73 69 6f 6e 22 2b  | ". Conversion"+|
00000460  bd 39 2b 22 31 2e 30 31  20 28 22 2b c1 91 24 2c  |.9+"1.01 ("+..$,|
00000470  35 2c 31 31 29 2b 22 29  20 a9 20 4a 75 73 74 69  |5,11)+") . Justi|
00000480  6e 20 46 6c 65 74 63 68  65 72 22 2b bd 30 0d 01  |n Fletcher"+.0..|
00000490  90 0c 20 20 20 41 4c 49  47 4e 0d 01 9a 05 3a 0d  |..   ALIGN....:.|
000004a0  01 a4 13 2e 6d 6f 64 75  6c 65 5f 73 65 72 76 69  |....module_servi|
000004b0  63 65 0d 01 ae 18 20 20  20 4c 44 52 20 20 20 20  |ce....   LDR    |
000004c0  20 72 31 32 2c 5b 72 31  32 5d 0d 01 b8 16 20 20  | r12,[r12]....  |
000004d0  20 4d 4f 56 53 20 20 20  20 70 63 2c 6c 69 6e 6b  | MOVS    pc,link|
000004e0  0d 01 c2 05 3a 0d 01 cc  10 2e 6d 6f 64 75 6c 65  |....:.....module|
000004f0  5f 69 6e 69 74 0d 01 d6  37 20 20 20 53 54 4d 46  |_init...7   STMF|
00000500  44 20 20 20 28 73 70 29  21 2c 7b 72 30 2d 72 34  |D   (sp)!,{r0-r4|
00000510  2c 6c 69 6e 6b 7d 20 20  20 20 20 3b 20 53 74 61  |,link}     ; Sta|
00000520  63 6b 20 72 65 67 69 73  74 65 72 73 0d 01 e0 14  |ck registers....|
00000530  20 20 20 4d 4f 56 20 20  20 20 20 72 30 2c 23 36  |   MOV     r0,#6|
00000540  0d 01 ea 1f 20 a4 4c 4d  4f 56 28 22 22 2c 33 2c  |.... .LMOV("",3,|
00000550  60 6c 65 6e 5f 77 6f 72  6b 73 70 61 63 65 29 0d  |`len_workspace).|
00000560  01 f4 3f 20 20 20 53 57  49 20 20 20 20 20 22 58  |..?   SWI     "X|
00000570  4f 53 5f 4d 6f 64 75 6c  65 22 20 20 20 20 20 20  |OS_Module"      |
00000580  20 20 20 20 20 3b 20 43  6c 61 69 6d 20 70 72 69  |     ; Claim pri|
00000590  76 61 74 65 20 77 6f 72  6b 73 70 61 63 65 0d 01  |vate workspace..|
000005a0  fe 3a 20 20 20 41 44 44  56 53 20 20 20 73 70 2c  |.:   ADDVS   sp,|
000005b0  73 70 2c 23 34 20 20 20  20 20 20 20 20 20 20 20  |sp,#4           |
000005c0  20 20 20 20 3b 20 69 66  20 65 72 72 6f 72 20 72  |    ; if error r|
000005d0  65 74 75 72 6e 20 72 30  0d 02 08 34 20 20 20 4c  |eturn r0...4   L|
000005e0  44 4d 56 53 46 44 20 28  73 70 29 21 2c 7b 72 31  |DMVSFD (sp)!,{r1|
000005f0  2d 72 34 2c 70 63 7d 20  20 20 20 20 20 20 3b 20  |-r4,pc}       ; |
00000600  72 65 74 75 72 6e 20 65  72 72 6f 72 0d 02 12 3d  |return error...=|
00000610  20 20 20 53 54 52 20 20  20 20 20 72 32 2c 5b 72  |   STR     r2,[r|
00000620  31 32 5d 20 20 20 20 20  20 20 20 20 20 20 20 20  |12]             |
00000630  20 20 3b 20 73 74 6f 72  65 20 69 6e 20 70 72 69  |  ; store in pri|
00000640  76 61 74 65 20 77 6f 72  64 0d 02 1c 31 20 20 20  |vate word...1   |
00000650  4d 4f 56 20 20 20 20 20  72 31 32 2c 72 32 20 20  |MOV     r12,r2  |
00000660  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00000670  20 72 31 32 3d 73 70 61  63 65 0d 02 26 39 20 20  | r12=space..&9  |
00000680  20 4c 44 4d 46 44 20 20  20 28 73 70 29 21 2c 7b  | LDMFD   (sp)!,{|
00000690  72 30 2d 72 34 2c 6c 69  6e 6b 7d 20 20 20 20 20  |r0-r4,link}     |
000006a0  3b 20 72 65 73 74 6f 72  65 20 72 65 67 69 73 74  |; restore regist|
000006b0  65 72 73 0d 02 30 19 20  20 20 42 20 20 20 20 20  |ers..0.   B     |
000006c0  20 20 69 6e 69 74 69 61  6c 69 73 65 0d 02 3a 05  |  initialise..:.|
000006d0  3a 0d 02 44 11 2e 6d 6f  64 75 6c 65 5f 66 69 6e  |:..D..module_fin|
000006e0  61 6c 0d 02 4e 37 20 20  20 53 54 4d 46 44 20 20  |al..N7   STMFD  |
000006f0  20 28 73 70 29 21 2c 7b  72 30 2d 72 34 2c 72 31  | (sp)!,{r0-r4,r1|
00000700  32 2c 6c 69 6e 6b 7d 20  3b 20 53 74 61 63 6b 20  |2,link} ; Stack |
00000710  72 65 67 69 73 74 65 72  73 0d 02 58 18 20 20 20  |registers..X.   |
00000720  4c 44 52 20 20 20 20 20  72 31 32 2c 5b 72 31 32  |LDR     r12,[r12|
00000730  5d 0d 02 62 17 20 20 20  42 4c 20 20 20 20 20 20  |]..b.   BL      |
00000740  66 69 6e 61 6c 69 73 65  0d 02 6c 17 20 20 20 41  |finalise..l.   A|
00000750  44 44 56 53 20 20 20 73  70 2c 73 70 2c 23 34 0d  |DDVS   sp,sp,#4.|
00000760  02 76 38 20 20 20 4c 44  4d 56 53 46 44 20 28 73  |.v8   LDMVSFD (s|
00000770  70 29 21 2c 7b 72 31 2d  72 34 2c 72 31 32 2c 70  |p)!,{r1-r4,r12,p|
00000780  63 7d 20 20 20 20 3b 20  52 65 74 75 72 6e 20 69  |c}    ; Return i|
00000790  66 20 65 72 72 6f 72 0d  02 80 14 20 20 20 4d 4f  |f error....   MO|
000007a0  56 20 20 20 20 20 72 30  2c 23 37 0d 02 8a 15 20  |V     r0,#7.... |
000007b0  20 20 4d 4f 56 20 20 20  20 20 72 32 2c 72 31 32  |  MOV     r2,r12|
000007c0  0d 02 94 39 20 20 20 53  57 49 20 20 20 20 20 22  |...9   SWI     "|
000007d0  58 4f 53 5f 4d 6f 64 75  6c 65 22 20 20 20 20 20  |XOS_Module"     |
000007e0  20 20 20 20 20 20 3b 20  52 65 6c 65 61 73 65 20  |      ; Release |
000007f0  77 6f 72 6b 73 70 61 63  65 0d 02 9e 17 20 20 20  |workspace....   |
00000800  41 44 44 56 53 20 20 20  73 70 2c 73 70 2c 23 34  |ADDVS   sp,sp,#4|
00000810  0d 02 a8 37 20 20 20 4c  44 4d 56 53 46 44 20 28  |...7   LDMVSFD (|
00000820  73 70 29 21 2c 7b 72 31  2d 72 34 2c 72 31 32 2c  |sp)!,{r1-r4,r12,|
00000830  70 63 7d 20 20 20 3b 20  52 65 74 75 72 6e 20 69  |pc}   ; Return i|
00000840  66 20 65 72 72 6f 72 0d  02 b2 2e 20 20 20 4c 44  |f error....   LD|
00000850  4d 46 44 20 20 20 28 73  70 29 21 2c 7b 72 30 2d  |MFD   (sp)!,{r0-|
00000860  72 34 2c 72 31 32 2c 70  63 7d 20 20 20 3b 20 52  |r4,r12,pc}   ; R|
00000870  65 74 75 72 6e 0d 02 bc  05 3a 0d 02 c6 21 3b 20  |eturn....:...!; |
00000880  2a 2a 2a 2a 2a 20 4d 6f  64 75 6c 65 20 63 6f 6d  |***** Module com|
00000890  6d 61 6e 64 73 20 74 61  62 6c 65 0d 02 d0 14 2e  |mands table.....|
000008a0  6d 6f 64 75 6c 65 5f 63  6f 6d 6d 61 6e 64 73 0d  |module_commands.|
000008b0  02 da 2d 20 20 20 45 51  55 53 20 22 45 6c 6c 69  |..-   EQUS "Elli|
000008c0  70 73 69 73 22 20 20 20  20 20 20 20 20 20 3b 20  |psis"         ; |
000008d0  43 6f 6d 6d 61 6e 64 20  6e 61 6d 65 0d 02 e4 13  |Command name....|
000008e0  20 20 20 45 51 55 42 20  30 3a 41 4c 49 47 4e 0d  |   EQUB 0:ALIGN.|
000008f0  02 ee 2d 20 20 20 45 51  55 44 20 30 20 20 20 20  |..-   EQUD 0    |
00000900  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
00000910  43 6f 64 65 20 74 6f 20  63 61 6c 6c 0d 02 f8 26  |Code to call...&|
00000920  20 20 20 45 51 55 44 20  26 30 20 20 20 20 20 20  |   EQUD &0      |
00000930  20 20 20 20 20 20 20 20  20 20 20 3b 20 46 6c 61  |           ; Fla|
00000940  67 73 0d 03 02 2f 20 20  20 45 51 55 44 20 30 20  |gs.../   EQUD 0 |
00000950  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000960  20 3b 20 53 79 6e 74 61  78 20 70 6f 69 6e 74 65  | ; Syntax pointe|
00000970  72 0d 03 0c 2d 20 20 20  45 51 55 44 20 68 65 6c  |r...-   EQUD hel|
00000980  70 5f 65 6c 6c 69 70 73  69 73 20 20 20 20 20 20  |p_ellipsis      |
00000990  3b 20 48 65 6c 70 20 70  6f 69 6e 74 65 72 0d 03  |; Help pointer..|
000009a0  16 0d 20 20 20 45 51 55  42 20 30 0d 03 20 0c 20  |..   EQUB 0.. . |
000009b0  20 20 41 4c 49 47 4e 0d  03 2a 05 3a 0d 03 34 24  |  ALIGN..*.:..4$|
000009c0  3b 20 2a 2a 2a 2a 2a 20  48 65 6c 70 20 61 6e 64  |; ***** Help and|
000009d0  20 53 79 6e 74 61 78 20  6d 65 73 73 61 67 65 73  | Syntax messages|
000009e0  0d 03 3e 12 2e 68 65 6c  70 5f 65 6c 6c 69 70 73  |..>..help_ellips|
000009f0  69 73 0d 03 48 45 20 20  20 45 51 55 53 20 22 54  |is..HE   EQUS "T|
00000a00  68 65 20 45 6c 6c 69 70  73 69 73 20 6d 6f 64 75  |he Ellipsis modu|
00000a10  6c 65 20 70 72 6f 76 69  64 65 73 20 61 20 73 70  |le provides a sp|
00000a20  65 63 69 61 6c 20 6b 65  79 20 73 65 71 75 65 6e  |ecial key sequen|
00000a30  63 65 20 74 6f 20 22 0d  03 52 45 20 20 20 45 51  |ce to "..RE   EQ|
00000a40  55 53 20 22 61 64 64 20  8c 20 69 6e 74 6f 20 74  |US "add . into t|
00000a50  68 65 20 6b 65 79 62 6f  61 72 64 20 62 75 66 66  |he keyboard buff|
00000a60  65 72 2e 20 50 72 65 73  73 20 2e 20 74 68 72 65  |er. Press . thre|
00000a70  65 20 74 69 6d 65 73 20  74 6f 20 22 0d 03 5c 18  |e times to "..\.|
00000a80  20 20 20 45 51 55 53 20  22 61 63 74 69 76 61 74  |   EQUS "activat|
00000a90  65 2e 20 22 0d 03 66 0d  20 20 20 45 51 55 42 20  |e. "..f.   EQUB |
00000aa0  30 0d 03 70 0c 20 20 20  41 4c 49 47 4e 0d 03 7a  |0..p.   ALIGN..z|
00000ab0  05 3a 0d 03 84 2e 20 20  20 20 20 20 20 20 20 20  |.:....          |
00000ac0  3b 20 2a 2a 2a 2a 20 45  6e 64 20 6f 66 20 6d 6f  |; **** End of mo|
00000ad0  64 75 6c 65 20 68 65 61  64 65 72 20 2a 2a 2a 2a  |dule header ****|
00000ae0  0d 03 8e 05 3a 0d 03 98  0f 2e 69 6e 69 74 69 61  |....:.....initia|
00000af0  6c 69 73 65 0d 03 a2 1c  20 20 20 20 53 54 4d 46  |lise....    STMF|
00000b00  44 20 20 20 28 73 70 29  21 2c 7b 6c 69 6e 6b 7d  |D   (sp)!,{link}|
00000b10  0d 03 ac 42 20 20 20 20  4d 4f 56 20 20 20 20 20  |...B    MOV     |
00000b20  72 30 2c 23 26 31 34 20  20 20 20 20 20 20 20 20  |r0,#&14         |
00000b30  20 20 20 20 20 20 3b 20  76 65 63 74 6f 72 20 26  |      ; vector &|
00000b40  31 34 20 2d 20 69 6e 73  65 72 74 20 76 65 63 74  |14 - insert vect|
00000b50  6f 72 0d 03 b6 44 20 20  20 20 41 44 52 20 20 20  |or...D    ADR   |
00000b60  20 20 72 31 2c 69 6e 73  76 65 63 74 6f 72 20 20  |  r1,insvector  |
00000b70  20 20 20 20 20 20 20 20  3b 20 74 6f 20 62 65 20  |        ; to be |
00000b80  70 72 6f 63 65 73 73 65  64 20 61 74 20 69 6e 73  |processed at ins|
00000b90  76 65 63 74 6f 72 0d 03  c0 15 20 20 20 4d 4f 56  |vector....   MOV|
00000ba0  20 20 20 20 20 72 32 2c  72 31 32 0d 03 ca 1a 20  |     r2,r12.... |
00000bb0  20 20 53 57 49 20 20 20  20 20 22 58 4f 53 5f 43  |  SWI     "XOS_C|
00000bc0  6c 61 69 6d 22 0d 03 d4  15 20 20 20 20 4d 4f 56  |laim"....    MOV|
00000bd0  20 20 20 20 20 72 30 2c  23 30 0d 03 de 1f 20 20  |     r0,#0....  |
00000be0  20 53 54 52 20 20 20 20  20 72 30 2c 5b 72 31 32  | STR     r0,[r12|
00000bf0  2c 23 60 63 6f 75 6e 74  5d 0d 03 e8 1a 20 20 20  |,#`count]....   |
00000c00  20 4c 44 4d 46 44 20 20  20 28 73 70 29 21 2c 7b  | LDMFD   (sp)!,{|
00000c10  70 63 7d 0d 03 f2 05 3a  0d 03 fc 0d 2e 66 69 6e  |pc}....:.....fin|
00000c20  61 6c 69 73 65 0d 04 06  22 20 20 20 20 53 54 4d  |alise..."    STM|
00000c30  46 44 20 20 20 28 73 70  29 21 2c 7b 72 30 2d 72  |FD   (sp)!,{r0-r|
00000c40  32 2c 6c 69 6e 6b 7d 0d  04 10 42 20 20 20 20 4d  |2,link}...B    M|
00000c50  4f 56 20 20 20 20 20 72  30 2c 23 26 31 34 20 20  |OV     r0,#&14  |
00000c60  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 76  |             ; v|
00000c70  65 63 74 6f 72 20 26 31  34 20 2d 20 69 6e 73 65  |ector &14 - inse|
00000c80  72 74 20 76 65 63 74 6f  72 0d 04 1a 44 20 20 20  |rt vector...D   |
00000c90  20 41 44 52 20 20 20 20  20 72 31 2c 69 6e 73 76  | ADR     r1,insv|
00000ca0  65 63 74 6f 72 20 20 20  20 20 20 20 20 20 20 3b  |ector          ;|
00000cb0  20 74 6f 20 62 65 20 70  72 6f 63 65 73 73 65 64  | to be processed|
00000cc0  20 61 74 20 69 6e 73 76  65 63 74 6f 72 0d 04 24  | at insvector..$|
00000cd0  15 20 20 20 4d 4f 56 20  20 20 20 20 72 32 2c 72  |.   MOV     r2,r|
00000ce0  31 32 0d 04 2e 1c 20 20  20 53 57 49 20 20 20 20  |12....   SWI    |
00000cf0  20 22 58 4f 53 5f 52 65  6c 65 61 73 65 22 0d 04  | "XOS_Release"..|
00000d00  38 20 20 20 20 20 4c 44  4d 46 44 20 20 20 28 73  |8     LDMFD   (s|
00000d10  70 29 21 2c 7b 72 30 2d  72 32 2c 70 63 7d 0d 04  |p)!,{r0-r2,pc}..|
00000d20  42 05 3a 0d 04 4c 0e 2e  69 6e 73 76 65 63 74 6f  |B.:..L..insvecto|
00000d30  72 0d 04 56 28 20 20 20  20 53 54 4d 46 44 20 20  |r..V(    STMFD  |
00000d40  20 28 73 70 29 21 2c 7b  72 31 2d 72 32 2c 72 38  | (sp)!,{r1-r2,r8|
00000d50  2d 72 39 2c 6c 69 6e 6b  7d 0d 04 60 3d 20 20 20  |-r9,link}..`=   |
00000d60  20 43 4d 50 20 20 20 20  20 72 31 2c 23 30 20 20  | CMP     r1,#0  |
00000d70  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00000d80  20 69 73 20 69 74 20 69  6e 73 65 72 74 20 76 65  | is it insert ve|
00000d90  63 74 6f 72 20 3f 0d 04  6a 3e 20 20 20 20 42 4e  |ctor ?..j>    BN|
00000da0  45 20 20 20 20 20 5f 5f  7a 30 5f 65 78 69 74 20  |E     __z0_exit |
00000db0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000dc0  3b 20 69 66 20 6e 6f 74  2c 20 66 6f 72 67 65 74  |; if not, forget|
00000dd0  20 69 74 8c 0d 04 74 1f  20 20 20 4c 44 52 20 20  | it...t.   LDR  |
00000de0  20 20 20 72 32 2c 5b 72  31 32 2c 23 60 63 6f 75  |   r2,[r12,#`cou|
00000df0  6e 74 5d 0d 04 7e 1d 20  20 20 20 20 20 20 20 20  |nt]..~.         |
00000e00  20 3b 20 67 65 74 20 74  68 65 20 63 6f 75 6e 74  | ; get the count|
00000e10  0d 04 88 38 20 20 20 20  43 4d 50 20 20 20 20 20  |...8    CMP     |
00000e20  72 30 2c 23 97 28 22 2e  22 29 20 20 20 20 20 20  |r0,#.(".")      |
00000e30  20 20 20 20 3b 20 69 73  20 69 74 20 61 20 2e 20  |    ; is it a . |
00000e40  69 6e 73 65 72 74 20 3f  0d 04 92 38 20 20 20 20  |insert ?...8    |
00000e50  41 44 44 45 51 20 20 20  72 32 2c 72 32 2c 23 31  |ADDEQ   r2,r2,#1|
00000e60  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
00000e70  69 66 20 73 6f 2c 20 69  6e 63 20 63 6f 75 6e 74  |if so, inc count|
00000e80  0d 04 9c 3d 20 20 20 20  4d 4f 56 4e 45 20 20 20  |...=    MOVNE   |
00000e90  72 32 2c 23 30 20 20 20  20 20 20 20 20 20 20 20  |r2,#0           |
00000ea0  20 20 20 20 20 20 3b 20  6f 74 68 65 72 77 69 73  |      ; otherwis|
00000eb0  65 2c 20 7a 65 72 6f 20  63 6f 75 6e 74 0d 04 a6  |e, zero count...|
00000ec0  31 20 20 20 20 43 4d 50  20 20 20 20 20 72 32 2c  |1    CMP     r2,|
00000ed0  23 33 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |#3              |
00000ee0  20 20 20 3b 20 69 73 20  69 74 20 33 20 3f 0d 04  |   ; is it 3 ?..|
00000ef0  b0 39 20 20 20 20 ec 51  20 20 20 72 32 2c 23 30  |.9    .Q   r2,#0|
00000f00  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000f10  20 3b 20 69 66 20 73 6f  2c 20 72 65 73 65 74 20  | ; if so, reset |
00000f20  74 6f 20 7a 65 72 6f 0d  04 ba 1f 20 20 20 53 54  |to zero....   ST|
00000f30  52 20 20 20 20 20 72 32  2c 5b 72 31 32 2c 23 60  |R     r2,[r12,#`|
00000f40  63 6f 75 6e 74 5d 0d 04  c4 20 20 20 20 20 20 20  |count]...       |
00000f50  20 20 20 20 3b 20 73 74  6f 72 65 20 63 6f 75 6e  |    ; store coun|
00000f60  74 20 62 61 63 6b 0d 04  ce 3c 20 20 20 20 42 4e  |t back...<    BN|
00000f70  45 20 20 20 20 20 5f 5f  7a 30 5f 65 78 69 74 20  |E     __z0_exit |
00000f80  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000f90  3b 20 69 66 20 6e 6f 74  20 33 72 64 2c 20 65 78  |; if not 3rd, ex|
00000fa0  69 74 0d 04 d8 43 20 20  20 20 41 44 52 20 20 20  |it...C    ADR   |
00000fb0  20 20 72 30 2c 5f 5f 7a  30 5f 74 6f 73 65 6e 64  |  r0,__z0_tosend|
00000fc0  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 70 6f  |            ; po|
00000fd0  69 6e 74 65 72 20 74 6f  20 64 61 74 61 20 74 6f  |inter to data to|
00000fe0  20 73 65 6e 64 0d 04 e2  21 20 20 20 53 54 52 20  | send...!   STR |
00000ff0  20 20 20 20 72 30 2c 5b  72 31 32 2c 23 60 70 6f  |    r0,[r12,#`po|
00001000  69 6e 74 65 72 5d 0d 04  ec 22 20 20 20 20 20 20  |inter]..."      |
00001010  20 20 20 20 3b 20 73 74  6f 72 65 20 69 6e 20 77  |    ; store in w|
00001020  6f 72 6b 73 70 61 63 65  0d 04 f6 37 20 20 20 20  |orkspace...7    |
00001030  4d 4f 56 20 20 20 20 20  72 30 2c 23 60 64 65 6c  |MOV     r0,#`del|
00001040  61 79 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |ay            ; |
00001050  63 61 6c 6c 20 65 76 65  72 79 20 78 20 63 73 0d  |call every x cs.|
00001060  05 00 3f 20 20 20 20 41  44 52 20 20 20 20 20 72  |..?    ADR     r|
00001070  31 2c 63 61 6c 6c 62 61  63 6b 72 6f 75 74 69 6e  |1,callbackroutin|
00001080  65 20 20 20 20 3b 20 74  68 65 20 61 64 64 72 65  |e    ; the addre|
00001090  73 73 20 6f 66 20 74 68  65 20 63 6f 64 65 0d 05  |ss of the code..|
000010a0  0a 31 20 20 20 20 4d 4f  56 20 20 20 20 20 72 32  |.1    MOV     r2|
000010b0  2c 72 31 32 20 20 20 20  20 20 20 20 20 20 20 20  |,r12            |
000010c0  20 20 20 20 3b 20 77 6f  72 6b 73 70 61 63 65 0d  |    ; workspace.|
000010d0  05 14 20 20 20 20 20 20  20 20 20 20 20 3b 20 50  |..           ; P|
000010e0  72 65 73 65 72 76 65 20  72 31 34 5f 73 76 63 0d  |reserve r14_svc.|
000010f0  05 1e 14 20 20 20 4d 4f  56 20 20 20 20 20 72 37  |...   MOV     r7|
00001100  2c 70 63 0d 05 28 16 20  20 20 84 52 20 20 20 20  |,pc..(.   .R    |
00001110  20 72 36 2c 72 37 2c 23  33 0d 05 32 14 20 20 20  | r6,r7,#3..2.   |
00001120  54 45 51 50 20 20 20 20  72 36 2c 23 30 0d 05 3c  |TEQP    r6,#0..<|
00001130  14 20 20 20 4d 4f 56 20  20 20 20 20 72 30 2c 72  |.   MOV     r0,r|
00001140  30 0d 05 46 1b 20 20 20  53 54 4d 46 44 20 20 20  |0..F.   STMFD   |
00001150  28 73 70 29 21 2c 7b 6c  69 6e 6b 7d 0d 05 50 2b  |(sp)!,{link}..P+|
00001160  20 20 20 20 20 20 20 20  20 20 3b 20 73 65 74 20  |          ; set |
00001170  53 56 43 20 6d 6f 64 65  20 61 6e 64 20 73 74 61  |SVC mode and sta|
00001180  63 6b 20 6c 69 6e 6b 0d  05 5a 37 20 20 20 20 53  |ck link..Z7    S|
00001190  57 49 20 20 20 20 20 22  4f 53 5f 43 61 6c 6c 41  |WI     "OS_CallA|
000011a0  66 74 65 72 22 20 20 20  20 20 20 20 20 3b 20 73  |fter"        ; s|
000011b0  65 74 75 70 20 63 61 6c  6c 20 62 61 63 6b 0d 05  |etup call back..|
000011c0  64 1f 20 20 20 20 20 20  20 20 20 20 3b 20 52 65  |d.          ; Re|
000011d0  73 74 6f 72 65 20 72 31  34 5f 73 76 63 0d 05 6e  |store r14_svc..n|
000011e0  1b 20 20 20 4c 44 4d 46  44 20 20 20 28 73 70 29  |.   LDMFD   (sp)|
000011f0  21 2c 7b 6c 69 6e 6b 7d  0d 05 78 14 20 20 20 54  |!,{link}..x.   T|
00001200  45 51 50 20 20 20 20 72  37 2c 23 30 0d 05 82 14  |EQP    r7,#0....|
00001210  20 20 20 4d 4f 56 20 20  20 20 20 72 30 2c 72 30  |   MOV     r0,r0|
00001220  0d 05 8c 31 20 20 20 20  20 20 20 20 20 20 3b 20  |...1          ; |
00001230  72 65 6c 65 61 73 65 20  53 56 43 20 6d 6f 64 65  |release SVC mode|
00001240  20 61 6e 64 20 75 6e 73  74 61 63 6b 20 6c 69 6e  | and unstack lin|
00001250  6b 0d 05 96 56 20 20 20  20 4c 44 4d 46 44 20 20  |k...V    LDMFD  |
00001260  20 28 73 70 29 21 2c 7b  72 31 2d 72 32 2c 72 38  | (sp)!,{r1-r2,r8|
00001270  2d 72 39 2c 6c 69 6e 6b  2c 70 63 7d 20 3b 20 72  |-r9,link,pc} ; r|
00001280  65 74 75 72 6e 20 77 69  74 68 6f 75 74 20 61 64  |eturn without ad|
00001290  64 69 6e 67 20 61 6e 79  74 68 69 6e 67 20 74 6f  |ding anything to|
000012a0  20 69 6e 73 65 72 74 0d  05 a0 0e 2e 5f 5f 7a 30  | insert.....__z0|
000012b0  5f 65 78 69 74 0d 05 aa  26 20 20 20 20 4c 44 4d  |_exit...&    LDM|
000012c0  46 44 20 20 20 28 73 70  29 21 2c 7b 72 31 2d 72  |FD   (sp)!,{r1-r|
000012d0  32 2c 72 38 2d 72 39 2c  70 63 7d 0d 05 b4 05 3a  |2,r8-r9,pc}....:|
000012e0  0d 05 be 10 2e 5f 5f 7a  30 5f 74 6f 73 65 6e 64  |.....__z0_tosend|
000012f0  0d 05 c8 1b 3b 20 20 20  20 20 45 51 55 53 20 20  |....;     EQUS  |
00001300  20 20 22 41 42 43 44 22  2b bd 32 0d 05 d2 13 20  |  "ABCD"+.2.... |
00001310  20 20 20 45 51 55 42 20  20 20 20 31 32 37 0d 05  |   EQUB    127..|
00001320  dc 13 20 20 20 20 45 51  55 42 20 20 20 20 31 32  |..    EQUB    12|
00001330  37 0d 05 e6 11 20 20 20  20 45 51 55 42 20 20 20  |7....    EQUB   |
00001340  20 30 0d 05 f0 16 20 20  20 20 45 51 55 42 20 20  | 0....    EQUB  |
00001350  20 20 97 28 22 8c 22 29  0d 05 fa 11 20 20 20 20  |  .(".")....    |
00001360  45 51 55 42 20 20 20 20  32 0d 06 04 0d 20 20 20  |EQUB    2....   |
00001370  20 41 4c 49 47 4e 0d 06  0e 05 3a 0d 06 18 14 2e  | ALIGN....:.....|
00001380  63 61 6c 6c 62 61 63 6b  72 6f 75 74 69 6e 65 0d  |callbackroutine.|
00001390  06 22 45 20 20 20 20 53  54 4d 46 44 20 20 20 28  |."E    STMFD   (|
000013a0  73 70 29 21 2c 7b 72 30  2d 72 34 2c 72 38 2d 72  |sp)!,{r0-r4,r8-r|
000013b0  39 2c 6c 69 6e 6b 7d 20  20 20 20 20 20 20 20 20  |9,link}         |
000013c0  20 20 20 3b 20 53 74 61  63 6b 20 72 65 67 69 73  |   ; Stack regis|
000013d0  74 65 72 73 0d 06 2c 20  20 20 20 20 20 20 20 20  |ters..,         |
000013e0  20 20 3b 20 50 72 65 73  65 72 76 65 20 72 31 34  |  ; Preserve r14|
000013f0  5f 73 76 63 0d 06 36 14  20 20 20 4d 4f 56 20 20  |_svc..6.   MOV  |
00001400  20 20 20 72 39 2c 70 63  0d 06 40 16 20 20 20 84  |   r9,pc..@.   .|
00001410  52 20 20 20 20 20 72 38  2c 72 39 2c 23 33 0d 06  |R     r8,r9,#3..|
00001420  4a 14 20 20 20 54 45 51  50 20 20 20 20 72 38 2c  |J.   TEQP    r8,|
00001430  23 30 0d 06 54 14 20 20  20 4d 4f 56 20 20 20 20  |#0..T.   MOV    |
00001440  20 72 30 2c 72 30 0d 06  5e 1b 20 20 20 53 54 4d  | r0,r0..^.   STM|
00001450  46 44 20 20 20 28 73 70  29 21 2c 7b 6c 69 6e 6b  |FD   (sp)!,{link|
00001460  7d 0d 06 68 2b 20 20 20  20 20 20 20 20 20 20 3b  |}..h+          ;|
00001470  20 73 65 74 20 53 56 43  20 6d 6f 64 65 20 61 6e  | set SVC mode an|
00001480  64 20 73 74 61 63 6b 20  6c 69 6e 6b 0d 06 72 21  |d stack link..r!|
00001490  20 20 20 4c 44 52 20 20  20 20 20 72 33 2c 5b 72  |   LDR     r3,[r|
000014a0  31 32 2c 23 60 70 6f 69  6e 74 65 72 5d 0d 06 7c  |12,#`pointer]..||
000014b0  23 20 20 20 20 20 20 20  20 20 20 3b 20 67 65 74  |#          ; get|
000014c0  20 70 6f 69 6e 74 65 72  20 74 6f 20 63 68 61 72  | pointer to char|
000014d0  0d 06 86 0e 2e 5f 5f 7a  31 5f 6e 65 78 74 0d 06  |.....__z1_next..|
000014e0  90 3d 20 20 20 20 4c 44  52 42 20 20 20 20 72 34  |.=    LDRB    r4|
000014f0  2c 5b 72 33 5d 20 20 20  20 20 20 20 20 20 20 20  |,[r3]           |
00001500  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 67 65  |            ; ge|
00001510  74 20 63 68 61 72 61 63  74 65 72 0d 06 9a 15 3b  |t character....;|
00001520  20 20 20 20 20 f4 20 20  20 20 20 22 25 72 32 22  |     .     "%r2"|
00001530  0d 06 a4 40 20 20 20 20  41 44 44 20 20 20 20 20  |...@    ADD     |
00001540  72 33 2c 72 33 2c 23 31  20 20 20 20 20 20 20 20  |r3,r3,#1        |
00001550  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
00001560  61 64 64 20 31 20 74 6f  20 70 6f 69 6e 74 65 72  |add 1 to pointer|
00001570  0d 06 ae 46 20 20 20 20  43 4d 50 20 20 20 20 20  |...F    CMP     |
00001580  72 34 2c 23 32 20 20 20  20 20 20 20 20 20 20 20  |r4,#2           |
00001590  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
000015a0  69 73 20 63 68 61 72 61  63 74 65 72 20 32 20 28  |is character 2 (|
000015b0  45 4f 4c 29 20 3f 0d 06  b8 45 20 20 20 20 42 45  |EOL) ?...E    BE|
000015c0  51 20 20 20 20 20 5f 5f  7a 31 5f 72 65 6d 6f 76  |Q     __z1_remov|
000015d0  65 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |e               |
000015e0  20 20 20 20 20 20 20 20  3b 20 79 3d 72 65 6d 6f  |        ; y=remo|
000015f0  76 65 20 63 61 6c 6c 62  61 63 6b 0d 06 c2 15 20  |ve callback.... |
00001600  20 20 20 4d 4f 56 20 20  20 20 20 72 32 2c 72 34  |   MOV     r2,r4|
00001610  0d 06 cc 16 20 20 20 4d  4f 56 20 20 20 20 20 72  |....   MOV     r|
00001620  30 2c 23 31 35 33 0d 06  d6 14 20 20 20 4d 4f 56  |0,#153....   MOV|
00001630  20 20 20 20 20 72 31 2c  23 30 0d 06 e0 19 20 20  |     r1,#0....  |
00001640  20 53 57 49 20 20 20 20  20 22 58 4f 53 5f 42 79  | SWI     "XOS_By|
00001650  74 65 22 0d 06 ea 23 20  20 20 20 20 20 20 20 20  |te"...#         |
00001660  20 3b 20 69 6e 73 65 72  74 20 69 6e 74 6f 20 62  | ; insert into b|
00001670  75 66 66 65 65 72 0d 06  f4 3f 20 20 20 20 43 4d  |uffeer...?    CM|
00001680  50 20 20 20 20 20 72 34  2c 23 30 20 20 20 20 20  |P     r4,#0     |
00001690  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000016a0  20 20 20 20 3b 20 69 73  20 69 74 20 63 6f 6e 74  |    ; is it cont|
000016b0  72 6f 6c 20 3f 0d 06 fe  43 20 20 20 20 42 45 51  |rol ?...C    BEQ|
000016c0  20 20 20 20 20 5f 5f 7a  31 5f 6e 65 78 74 20 20  |     __z1_next  |
000016d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000016e0  20 20 20 20 20 20 20 3b  20 69 66 20 73 6f 2c 20  |       ; if so, |
000016f0  67 65 74 20 6e 65 78 74  0d 07 08 21 20 20 20 53  |get next...!   S|
00001700  54 52 20 20 20 20 20 72  33 2c 5b 72 31 32 2c 23  |TR     r3,[r12,#|
00001710  60 70 6f 69 6e 74 65 72  5d 0d 07 12 27 20 20 20  |`pointer]...'   |
00001720  20 20 20 20 20 20 20 3b  20 73 74 6f 72 65 20 62  |       ; store b|
00001730  61 63 6b 20 69 6e 20 77  6f 72 6b 73 70 61 63 65  |ack in workspace|
00001740  0d 07 1c 1a 20 20 20 20  4d 4f 56 20 20 20 20 20  |....    MOV     |
00001750  72 30 2c 23 60 64 65 6c  61 79 0d 07 26 22 20 20  |r0,#`delay..&"  |
00001760  20 20 41 44 52 20 20 20  20 20 72 31 2c 63 61 6c  |  ADR     r1,cal|
00001770  6c 62 61 63 6b 72 6f 75  74 69 6e 65 0d 07 30 15  |lbackroutine..0.|
00001780  20 20 20 4d 4f 56 20 20  20 20 20 72 32 2c 72 31  |   MOV     r2,r1|
00001790  32 0d 07 3a 1e 20 20 20  53 57 49 20 20 20 20 20  |2..:.   SWI     |
000017a0  22 58 4f 53 5f 43 61 6c  6c 41 66 74 65 72 22 0d  |"XOS_CallAfter".|
000017b0  07 44 0e 2e 5f 5f 7a 31  5f 65 78 69 74 0d 07 4e  |.D..__z1_exit..N|
000017c0  10 2e 5f 5f 7a 31 5f 72  65 6d 6f 76 65 0d 07 58  |..__z1_remove..X|
000017d0  1f 20 20 20 20 20 20 20  20 20 20 3b 20 52 65 73  |.          ; Res|
000017e0  74 6f 72 65 20 72 31 34  5f 73 76 63 0d 07 62 1b  |tore r14_svc..b.|
000017f0  20 20 20 4c 44 4d 46 44  20 20 20 28 73 70 29 21  |   LDMFD   (sp)!|
00001800  2c 7b 6c 69 6e 6b 7d 0d  07 6c 14 20 20 20 54 45  |,{link}..l.   TE|
00001810  51 50 20 20 20 20 72 39  2c 23 30 0d 07 76 14 20  |QP    r9,#0..v. |
00001820  20 20 4d 4f 56 20 20 20  20 20 72 30 2c 72 30 0d  |  MOV     r0,r0.|
00001830  07 80 31 20 20 20 20 20  20 20 20 20 20 3b 20 72  |..1          ; r|
00001840  65 6c 65 61 73 65 20 53  56 43 20 6d 6f 64 65 20  |elease SVC mode |
00001850  61 6e 64 20 75 6e 73 74  61 63 6b 20 6c 69 6e 6b  |and unstack link|
00001860  0d 07 8a 46 20 20 20 20  4c 44 4d 46 44 20 20 20  |...F    LDMFD   |
00001870  28 73 70 29 21 2c 7b 72  30 2d 72 34 2c 72 38 2d  |(sp)!,{r0-r4,r8-|
00001880  72 39 2c 70 63 7d 20 20  20 20 20 20 20 20 20 20  |r9,pc}          |
00001890  20 20 20 20 3b 20 52 65  74 75 72 6e 20 66 72 6f  |    ; Return fro|
000018a0  6d 20 63 61 6c 6c 0d 07  94 05 3a 0d 07 9e 05 5d  |m call....:....]|
000018b0  0d 07 a8 20 f4 20 2a 2a  2a 2a 20 45 6e 64 20 6f  |... . **** End o|
000018c0  66 20 6d 61 69 6e 20 63  6f 64 65 20 2a 2a 2a 2a  |f main code ****|
000018d0  0d 07 b2 36 f4 20 53 65  74 20 66 69 6e 61 6c 20  |...6. Set final |
000018e0  70 6f 69 6e 74 65 72 20  74 6f 20 66 69 6e 64 20  |pointer to find |
000018f0  74 68 65 20 6c 65 6e 67  74 68 20 6f 66 20 74 68  |the length of th|
00001900  65 20 63 6f 64 65 0d 07  bc 13 f2 70 61 74 63 68  |e code.....patch|
00001910  5f 73 65 74 70 63 28 30  29 0d 07 c6 0b ed 20 70  |_setpc(0)..... p|
00001920  61 73 73 25 0d 07 d0 13  f2 70 61 74 63 68 5f 73  |ass%.....patch_s|
00001930  61 76 65 66 69 6c 65 0d  07 ee 28 f4 20 2a 2a 2a  |avefile...(. ***|
00001940  2a 20 50 6f 73 74 2d 61  73 73 65 6d 62 6c 79 20  |* Post-assembly |
00001950  75 73 65 72 20 63 6f 64  65 20 2a 2a 2a 2a 2a 0d  |user code *****.|
00001960  07 f8 21 2a 52 75 6e 20  3c 45 6c 6c 69 70 73 69  |..!*Run <Ellipsi|
00001970  73 24 44 69 72 3e 2e 44  6f 74 44 6f 74 44 6f 74  |s$Dir>.DotDotDot|
00001980  0d 08 02 05 e0 0d 08 0c  05 3a 0d 08 16 21 f4 20  |.........:...!. |
00001990  2a 2a 2a 2a 20 46 69 6c  69 6e 67 20 70 72 6f 63  |**** Filing proc|
000019a0  65 64 75 72 65 73 20 2a  2a 2a 2a 0d 08 20 05 3a  |edures ****.. .:|
000019b0  0d 08 2a 15 dd 20 f2 70  61 74 63 68 5f 6c 6f 61  |..*.. .patch_loa|
000019c0  64 66 69 6c 65 0d 08 34  0d 63 6f 64 65 6c 65 6e  |dfile..4.codelen|
000019d0  3d 30 0d 08 3e 0f de 20  4d 43 25 20 26 31 34 30  |=0..>.. MC% &140|
000019e0  30 0d 08 48 24 65 6e 64  6f 66 63 6f 64 65 3d 63  |0..H$endofcode=c|
000019f0  6f 64 65 6c 65 6e 2b 26  30 3a 6d 61 78 3d 63 6f  |odelen+&0:max=co|
00001a00  64 65 6c 65 6e 0d 08 52  19 4c 25 3d 65 6e 64 6f  |delen..R.L%=endo|
00001a10  66 63 6f 64 65 3a 5f 5f  63 61 70 25 3d a3 0d 08  |fcode:__cap%=...|
00001a20  b6 05 e1 0d 08 c0 05 3a  0d 08 ca 15 dd 20 f2 70  |.......:..... .p|
00001a30  61 74 63 68 5f 73 61 76  65 66 69 6c 65 0d 08 d4  |atch_savefile...|
00001a40  27 6f 75 74 66 69 6c 65  24 3d 22 3c 45 6c 6c 69  |'outfile$="<Elli|
00001a50  70 73 69 73 24 44 69 72  3e 2e 44 6f 74 44 6f 74  |psis$Dir>.DotDot|
00001a60  44 6f 74 22 0d 08 de 31  ff 28 22 53 61 76 65 20  |Dot"...1.("Save |
00001a70  22 2b 6f 75 74 66 69 6c  65 24 2b 22 20 22 2b c3  |"+outfile$+" "+.|
00001a80  7e 4d 43 25 2b 22 20 22  2b c3 7e 28 6d 61 78 2b  |~MC%+" "+.~(max+|
00001a90  4d 43 25 29 29 0d 08 e8  24 ff 28 22 53 65 74 74  |MC%))...$.("Sett|
00001aa0  79 70 65 20 22 2b 6f 75  74 66 69 6c 65 24 2b 22  |ype "+outfile$+"|
00001ab0  20 4d 6f 64 75 6c 65 22  29 0d 08 f2 1e 70 61 74  | Module")....pat|
00001ac0  63 68 64 69 72 24 3d 22  3c 45 6c 6c 69 70 73 69  |chdir$="<Ellipsi|
00001ad0  73 24 44 69 72 3e 22 0d  09 1a 05 e1 0d 09 24 05  |s$Dir>".......$.|
00001ae0  3a 0d 09 2e 1d f4 20 2a  2a 2a 2a 20 45 72 72 6f  |:..... **** Erro|
00001af0  72 20 48 61 6e 64 6c 65  72 20 2a 2a 2a 2a 0d 09  |r Handler ****..|
00001b00  38 05 3a 0d 09 42 0b dd  f2 45 72 72 6f 72 0d 09  |8.:..B...Error..|
00001b10  92 1b 85 20 a2 20 9f 2c  f6 24 2b 22 20 61 74 20  |... . .,.$+" at |
00001b20  6c 69 6e 65 20 22 2b c3  9e 0d 09 9c 05 e1 0d 09  |line "+.........|
00001b30  a6 05 3a 0d 09 b0 22 f4  20 2a 2a 2a 2a 20 55 74  |..:...". **** Ut|
00001b40  69 6c 69 74 79 20 70 72  6f 63 65 64 75 72 65 73  |ility procedures|
00001b50  20 2a 2a 2a 2a 0d 09 ba  05 3a 0d 09 c4 14 dd f2  | ****....:......|
00001b60  70 61 74 63 68 5f 73 65  74 70 63 28 6e 29 0d 09  |patch_setpc(n)..|
00001b70  ce 1a e7 20 50 25 2d 26  30 3e 6d 61 78 20 8c 6d  |... P%-&0>max .m|
00001b80  61 78 3d 50 25 2d 26 30  0d 09 d8 14 50 25 3d 6e  |ax=P%-&0....P%=n|
00001b90  3a 4f 25 3d 4d 43 25 2b  6e 2d 26 30 0d 09 e2 05  |:O%=MC%+n-&0....|
00001ba0  e1 0d 09 ec 05 3a 0d 09  f6 22 dd a4 66 69 6e 64  |.....:..."..find|
00001bb0  66 72 65 65 72 65 67 28  61 2c 62 2c 63 2c 64 29  |freereg(a,b,c,d)|
00001bc0  3a ea 20 6e 3a 6e 3d 30  0d 0a 00 1c c8 95 20 6e  |:. n:n=0...... n|
00001bd0  3d 61 20 84 20 6e 3d 62  20 84 20 6e 3d 63 20 84  |=a . n=b . n=c .|
00001be0  20 6e 3d 64 0d 0a 0a 09  20 6e 2b 3d 31 0d 0a 14  | n=d.... n+=1...|
00001bf0  05 ce 0d 0a 1e 06 3d 6e  0d 0a 28 05 3a 0d 0a 32  |......=n..(.:..2|
00001c00  2a f4 20 2a 2a 2a 2a 20  4c 6f 6e 67 20 4d 4f 56  |*. **** Long MOV|
00001c10  20 6d 61 63 72 6f 20 69  6e 73 74 72 75 63 74 69  | macro instructi|
00001c20  6f 6e 20 2a 2a 2a 2a 0d  0a 3c 05 3a 0d 0a 46 1b  |on ****..<.:..F.|
00001c30  dd a4 4c 4d 4f 56 28 63  6f 6e 64 24 2c 72 65 67  |..LMOV(cond$,reg|
00001c40  2c 76 61 6c 75 65 29 0d  0a 50 27 e7 20 63 6f 6e  |,value)..P'. con|
00001c50  64 24 3d 22 22 20 84 20  63 6f 6e 64 24 3d 22 20  |d$="" . cond$=" |
00001c60  20 22 20 8c 63 6f 6e 64  24 3d 22 41 4c 22 0d 0a  | " .cond$="AL"..|
00001c70  5a 39 63 6f 6e 64 3d 28  a7 22 45 51 4e 45 43 53  |Z9cond=(."EQNECS|
00001c80  43 43 4d 49 50 4c 56 53  56 43 48 49 4c 53 47 45  |CCMIPLVSVCHILSGE|
00001c90  4c 54 47 54 4c 45 41 4c  4e 56 22 2c 63 6f 6e 64  |LTGTLEALNV",cond|
00001ca0  24 29 2d 31 29 2f 32 0d  0a 64 26 6d 6f 76 3d 28  |$)-1)/2..d&mov=(|
00001cb0  26 33 41 3c 3c 32 30 29  2b 28 72 65 67 3c 3c 31  |&3A<<20)+(reg<<1|
00001cc0  32 29 2b 28 63 6f 6e 64  3c 3c 32 38 29 0d 0a 6e  |2)+(cond<<28)..n|
00001cd0  30 61 64 64 3d 28 26 32  38 3c 3c 32 30 29 2b 28  |0add=(&28<<20)+(|
00001ce0  72 65 67 3c 3c 31 32 29  2b 28 72 65 67 3c 3c 31  |reg<<12)+(reg<<1|
00001cf0  36 29 2b 28 63 6f 6e 64  3c 3c 32 38 29 0d 0a 78  |6)+(cond<<28)..x|
00001d00  4f e7 20 76 61 6c 75 65  3c 30 20 8c 6e 65 67 3d  |O. value<0 .neg=|
00001d10  b9 3a 6d 6f 76 3d 6d 6f  76 20 84 20 28 31 3c 3c  |.:mov=mov . (1<<|
00001d20  32 32 29 3a 61 64 64 3d  61 64 64 20 82 20 28 31  |22):add=add . (1|
00001d30  32 3c 3c 32 30 29 3a 76  61 6c 75 65 3d 2d 76 61  |2<<20):value=-va|
00001d40  6c 75 65 2d 31 20 8b 6e  65 67 3d a3 0d 0a 82 0b  |lue-1 .neg=.....|
00001d50  73 68 69 66 74 3d 30 0d  0a 8c 05 f5 0d 0a 96 20  |shift=0........ |
00001d60  20 c8 95 20 28 76 61 6c  75 65 20 80 20 33 29 3d  | .. (value . 3)=|
00001d70  30 20 80 20 73 68 69 66  74 3c 31 36 0d 0a a0 1d  |0 . shift<16....|
00001d80  20 20 73 68 69 66 74 2b  3d 31 3a 76 61 6c 75 65  |  shift+=1:value|
00001d90  3d 76 61 6c 75 65 20 81  34 0d 0a aa 06 20 ce 0d  |=value .4.... ..|
00001da0  0a b4 2a 20 78 73 68 69  66 74 3d 31 36 2d 73 68  |..* xshift=16-sh|
00001db0  69 66 74 3a e7 20 78 73  68 69 66 74 3d 31 36 20  |ift:. xshift=16 |
00001dc0  8c 78 73 68 69 66 74 3d  30 0d 0a be 0f 20 e7 20  |.xshift=0.... . |
00001dd0  6d 6f 76 3c 3e 30 20 8c  0d 0a c8 35 20 20 5b 4f  |mov<>0 ....5  [O|
00001de0  50 54 20 70 61 73 73 25  3a 45 51 55 44 20 6d 6f  |PT pass%:EQUD mo|
00001df0  76 2b 28 78 73 68 69 66  74 3c 3c 38 29 2b 28 76  |v+(xshift<<8)+(v|
00001e00  61 6c 75 65 20 80 20 32  35 35 29 3a 5d 0d 0a d2  |alue . 255):]...|
00001e10  0b 20 20 6d 6f 76 3d 30  0d 0a dc 06 20 cc 0d 0a  |.  mov=0.... ...|
00001e20  e6 35 20 20 5b 4f 50 54  20 70 61 73 73 25 3a 45  |.5  [OPT pass%:E|
00001e30  51 55 44 20 61 64 64 2b  28 78 73 68 69 66 74 3c  |QUD add+(xshift<|
00001e40  3c 38 29 2b 28 76 61 6c  75 65 20 80 20 32 35 35  |<8)+(value . 255|
00001e50  29 3a 5d 0d 0a f0 06 20  cd 0d 0a fa 1e 20 76 61  |):].... ..... va|
00001e60  6c 75 65 3d 76 61 6c 75  65 20 81 32 35 36 3a 73  |lue=value .256:s|
00001e70  68 69 66 74 2b 3d 34 0d  0b 04 0c fd 76 61 6c 75  |hift+=4.....valu|
00001e80  65 3d 30 0d 0b 0e 06 3d  30 0d 0b 18 05 3a 0d 7f  |e=0....=0....:..|
00001e90  7f 0d f4 20 4a 46 50 61  74 63 68 0d ff           |... JFPatch..|
00001e9d