Home » Archimedes archive » Acorn User » AU 1996-Xmas.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-Xmas.adf » Regulars
Filename: StarInfo/Fletcher/PatchBas
Read OK:
File size: 179F bytes
Load address: 0000
Exec address: 0000
File contents
   10REM > Patch for memory compilation
   20REM Created by JFPatch v2.24DRAW (22 May 1996) LEN Justin Fletcher
   30REM Intermediate code file created 24 May 1996
   40ON ERROR PROCError:END
   50PROCpatch_loadfile
   60sp=13:link=14:pc=15
   70vbit=1<<28:cbit=1<<29:zbit=1<<30:nbit=1<<31
   80P%=&0:O%=MC%
   90FOR pass%=4 TO 6 STEP2
  100REM **** Start of main code ****
  110PROCpatch_setpc(&0)
  120[ OPT pass%
  130.start
  140   STMFD   (sp)!,{r0-r7,link}            ; Stack registers
  150   MOV     r6,#0                         ; 0 if no errors, 1 if errors
  160   MOV     r5,#&7d0                      ; this probably won't work on a RPC
  170:
  180.__z0_loop
  190   MOV     r7,r5                         ; r7 = old pointer
  200   LDR     r5,[r5]                       ; get pointer to next module
  210   CMP     r5,#0                         ; end of list ?
  220   BEQ     __z0_exit                         ; if so, exit
  230   LDR     r1,[r5,#12]                   ; read the workspace pointer
  240   CMP     r1,#0                         ; is it 0 (DEAD) ?
  250   BNE     __z0_next                         ; if not, ignore it
  260:
  270   LDR     r1,[r5,#4]                    ; offset to module base
  280   LDR     r2,[r1,#16]                   ; offset within module of name
  290   ADD     r4,r2,r1                      ; r4-> name
  300:
  310 FNmess("Module %$4 is dead, kill it ?")
  320   SWI     "XOS_Confirm"                 ; ask the user nicely
  330   BVS     __z0_exit                         ; if error, exit gracefully
  340   CMP     r0,#ASC("y")                  ; did they say yes ?
  350   MOVNE   r6,#1                         ; mark as unfixed if not
  360   BNE     __z0_next                         ; if not, get the next
  370:
  380   LDR     r1,[r5]                       ; read the next module pointer
  390   STR     r1,[r7]                       ; store at the old pointer
  400:
  410   B       __z0_loop                         ; and look at the next module
  420:
  430.__z0_next
  440   B       __z0_loop
  450:
  460.__z0_exit
  470   MOVVS   r6,#1                         ; if there was an error, mark it
  480   CMP     r6,#0                         ; was there an error ?
  490   BEQ     __z0_noerrors                     ; if not, tell the user
  500 FNmess("Module area was not fixed")
  510   B       __z0_realexit                     ; and exit safely
  520:
  530.__z0_noerrors
  540 FNmess("Module area is stable")
  550:
  560.__z0_realexit
  570   LDMFD   (sp)!,{r0-r7,pc}^             ; Return from call
  580]
  590REM **** End of main code ****
  600REM Set final pointer to find the length of the code
  610PROCpatch_setpc(0)
  620NEXT pass%
  630PROCpatch_savefile
  660END
  670:
  680REM **** Filing procedures ****
  690:
  700DEF PROCpatch_loadfile
  710codelen=0
  720DIM MC% &1400
  730endofcode=(codelen+&0+3) AND -4:max=codelen
  740L%=endofcode:__cap%=FALSE
  890ENDPROC
  900:
  910DEF PROCpatch_savefile
  920outfile$="<NewRMTidy$Dir>.RMTidy"
  930OSCLI("Save "+outfile$+" "+STR$~MC%+" "+STR$~(max+MC%))
  940OSCLI("Settype "+outfile$+" Utility")
  950patchdir$="<NewRMTidy$Dir>"
 1000ENDPROC
 1010:
 1020REM **** Error Handler ****
 1030:
 1040DEFPROCError
 1050LOCAL ERROR
 1060ON ERROR LOCAL:RESTORE ERROR:ERROR EXT ERR,REPORT$+" whilst in error handler at line "+STR$ERL
 1170ERROR EXT ERR,REPORT$+" at line "+STR$ERL
 1180ENDPROC
 1190:
 1300REM **** Utility procedures ****
 1310:
 1320DEFPROCpatch_setpc(n)
 1330IF P%-&0>max THENmax=P%-&0
 1340P%=n:O%=MC%+n-&0
 1350ENDPROC
 1360:
 1370DEFFNfindfreereg(a,b,c,d):LOCAL n:n=0
 1380WHILE n=a OR n=b OR n=c OR n=d
 1390 n+=1
 1400ENDWHILE
 1410=n
 1420:
 1430REM **** REM macro procedures ****
 1440:
 1450REM FNmess2 : Generate a textual message on the screen
 1460REM Don't, however expand code 13 (allows control codes!)
 1470REM Include % Codes
 1480REM %%  Translate to %
 1490REM %I  Ignore code (So that control string can be embedded)
 1500REM %r# Display register number (followed by space)
 1510REM %R  Display all registers (r## : ## <CR><LF>)
 1520DEFFNmess2(n$):LOCAL l$,o,i
 1530[OPT pass%:STMFD (sp)!,{r0-r12}:]
 1540IF INSTR(n$,"%")=0 THEN
 1550 [OPT pass%
 1560 SWI "OS_WriteS"
 1570 EQUS n$+CHR$0
 1580 ALIGN
 1590 ]
 1600ELSE
 1610 FORo=1TOLEN(n$)
 1620  l$=MID$(n$,o,1)
 1630  IF l$="%" THEN
 1640   o+=1:l$=MID$(n$,o,1)
 1650   CASE l$ OF
 1660    WHEN "%":[OPT pass%:SWI &100+ASC("%"):]
 1670    WHEN "I":REM Ignore
 1680    WHEN "c":REM Constant - ie embedded control
 1690     o+=1:[OPT pass%:SWI &100+VAL(MID$(n$,o,2)):]:o+=1
 1700    WHEN "r":REM Print a register
 1710     o+=1:dummy=FNshowreg(EVAL("&"+MID$(n$,o,1)))
 1720    WHEN "&":REM Print a register
 1730     o+=1:dummy=FNshowhex(EVAL("&"+MID$(n$,o,1)))
 1740    WHEN "$":REM Print a string
 1750     o+=1:dummy=FNshowstrctrl(EVAL("&"+MID$(n$,o,1)))
 1760    WHEN "R":REM Print all registers
 1770     FORi=0TO15
 1780      dummy=FNmess2("r"+STR$i+" : "):dummy=FNshowhex(i)
 1790      dummy=FNmess("%I")
 1800     NEXT
 1810   ENDCASE
 1820  ELSE
 1830   [OPT pass%
 1840   SWI &100+ASC(l$)
 1850   ]
 1860  ENDIF
 1870 NEXT
 1880ENDIF
 1890[OPT pass%:LDMFD (sp)!,{r0-r12}:]
 1900=pass%
 1910:
 1920REM FNmess : Print a message as above, but expand returns and add
 1930REM a return to end
 1940DEFFNmess(a$)
 1950IF INSTR(a$,"%C")=0 THENa$+=CHR$13
 1960WHILE INSTR(a$,CHR$13)>0
 1970 a$=LEFT$(a$,INSTR(a$,CHR$13)-1)+CHR$0+CHR$10+MID$(a$,INSTR(a$,CHR$13)+1)
 1980ENDWHILE
 1990WHILE INSTR(a$,CHR$0)>0
 2000 MID$(a$,INSTR(a$,CHR$0),1)=CHR$13
 2010ENDWHILE
 2020=FNmess2(a$)
 2030:
 2040REM FNshowreg : Print the contents of reg n to screen (signed)
 2050DEFFNshowreg(n)
 2060[OPT pass%
 2070   STMFD   (sp)!,{r0-r2}
 2080   MOV     r0,n
 2090   CMP     r0,#0
 2100   RSBMI   r0,r0,#0
 2110   SWIMI   &100+ASC("-")
 2120   ADR     r1,P%+4*7
 2130   MOV     r2,#8+8
 2140   SWI     "OS_ConvertCardinal4"
 2150   SWI     "OS_Write0"
 2160   LDMFD   (sp)!,{r0-r2}
 2170   B       P%+12+8
 2180   EQUD    0:EQUD 0:EQUD0:EQUD 0
 2190]:=0
 2200:
 2210REM FNshowhex : Print the contents of reg
 2220DEFFNshowhex(n)
 2230[OPT pass%
 2240   STMFD   (sp)!,{r0-r2}
 2250   MOV     r0,n
 2260   SWI     &100+ASC("&")
 2270   ADR     r1,P%+4*7
 2280   MOV     r2,#8+8
 2290   SWI     "OS_ConvertHex8"
 2300   SWI     "OS_Write0"
 2310   LDMFD   (sp)!,{r0-r2}
 2320   B       P%+12+8
 2330   EQUD    0:EQUD 0:EQUD0:EQUD 0:EQUD 0
 2340]:=0
 2350:
 2360REM FNshowstr0 : Show the string pointed to, end =0
 2370DEFFNshowstr0(n)
 2380[OPT pass%
 2390   STMFD   (sp)!,{r0}
 2400   MOV     r0,n
 2410   SWI     "OS_Write0"
 2420   LDMFD   (sp)!,{r0}
 2430]:=0
 2440:
 2450REM FNshowstrctrl : Show the ctrl ended string
 2460DEFFNshowstrctrl(n)
 2470[OPT pass%
 2480   STMFD   (sp)!,{r0,r1}
 2490   MOV     r1,n
 2500   LDRB    r0,[r1],#1
 2510   CMP     r0,#32
 2520   SWIGE   "OS_WriteC"
 2530   BGE     P%-12
 2540   LDMFD   (sp)!,{r0,r1}
 2550]:=0
 2560:
32639REM JFPatch

$� > Patch for memory compilation
?� Created by JFPatch v2.24� (22 May 1996) � Justin Fletcher
0� Intermediate code file created 24 May 1996
(� � �Error:�
2�patch_loadfile
<sp=13:link=14:pc=15
F/vbit=1<<28:cbit=1<<29:zbit=1<<30:nbit=1<<31
PP%=&0:O%=MC%
Z� pass%=4 � 6 �2
d"� **** Start of main code ****
n�patch_setpc(&0)
x[ OPT pass%
�
.start
�>   STMFD   (sp)!,{r0-r7,link}            ; Stack registers
�J   MOV     r6,#0                         ; 0 if no errors, 1 if errors
�P   MOV     r5,#&7d0                      ; this probably won't work on a RPC
�:
�.__z0_loop
�?   MOV     r7,r5                         ; r7 = old pointer
�I   LDR     r5,[r5]                       ; get pointer to next module
�<   CMP     r5,#0                         ; end of list ?
�>   BEQ     __z0_exit                         ; if so, exit
�I   LDR     r1,[r5,#12]                   ; read the workspace pointer
�?   CMP     r1,#0                         ; is it 0 (DEAD) ?
�D   BNE     __z0_next                         ; if not, ignore it
:
D   LDR     r1,[r5,#4]                    ; offset to module base
K   LDR     r2,[r1,#16]                   ; offset within module of name
"8   ADD     r4,r2,r1                      ; r4-> name
,:
6+ �mess("Module %$4 is dead, kill it ?")
@B   SWI     "XOS_Confirm"                 ; ask the user nicely
JL   BVS     __z0_exit                         ; if error, exit gracefully
T?   CMP     r0,#�("y")                  ; did they say yes ?
^E   MOVNE   r6,#1                         ; mark as unfixed if not
hG   BNE     __z0_next                         ; if not, get the next
r:
|K   LDR     r1,[r5]                       ; read the next module pointer
�G   STR     r1,[r7]                       ; store at the old pointer
�:
�N   B       __z0_loop                         ; and look at the next module
�:
�.__z0_next
�   B       __z0_loop
�:
�.__z0_exit
�M   MOVVS   r6,#1                         ; if there was an error, mark it
�C   CMP     r6,#0                         ; was there an error ?
�H   BEQ     __z0_noerrors                     ; if not, tell the user
�' �mess("Module area was not fixed")
�B   B       __z0_realexit                     ; and exit safely
:
.__z0_noerrors
# �mess("Module area is stable")
&:
0.__z0_realexit
:?   LDMFD   (sp)!,{r0-r7,pc}^             ; Return from call
D]
N � **** End of main code ****
X6� Set final pointer to find the length of the code
b�patch_setpc(0)
l� pass%
v�patch_savefile
��
�:
�!� **** Filing procedures ****
�:
�� �patch_loadfile
�
codelen=0
�� MC% &1400
�-endofcode=(codelen+&0+3) � -4:max=codelen
�L%=endofcode:__cap%=�
z�
�:
�� �patch_savefile
�%outfile$="<NewRMTidy$Dir>.RMTidy"
�1�("Save "+outfile$+" "+�~MC%+" "+�~(max+MC%))
�%�("Settype "+outfile$+" Utility")
�patchdir$="<NewRMTidy$Dir>"
��
�:
�� **** Error Handler ****
:
��Error
� �
$=� � �:� �:� � �,�$+" whilst in error handler at line "+Þ
�� � �,�$+" at line "+Þ
��
�:
"� **** Utility procedures ****
:
(��patch_setpc(n)
2� P%-&0>max �max=P%-&0
<P%=n:O%=MC%+n-&0
F�
P:
Z"ݤfindfreereg(a,b,c,d):� n:n=0
dȕ n=a � n=b � n=c � n=d
n	 n+=1
x�
�=n
�:
�$� **** REM macro procedures ****
�:
�8� FNmess2 : Generate a textual message on the screen
�;� Don't, however expand code 13 (allows control codes!)
�� Include % Codes
�� %%  Translate to %
�>� %I  Ignore code (So that control string can be embedded)
�5� %r# Display register number (followed by space)
�3� %R  Display all registers (r## : ## <CR><LF>)
�ݤmess2(n$):� l$,o,i
�%[OPT pass%:STMFD (sp)!,{r0-r12}:]
� �n$,"%")=0 �
 [OPT pass%
 SWI "OS_WriteS"
" EQUS n$+�0
,
 ALIGN
6 ]
@�
J �o=1��(n$)
T  l$=�n$,o,1)
^  � l$="%" �
h   o+=1:l$=�n$,o,1)
r   Ȏ l$ �
|*    � "%":[OPT pass%:SWI &100+�("%"):]
�    � "I":� Ignore
�.    � "c":� Constant - ie embedded control
�4     o+=1:[OPT pass%:SWI &100+�(�n$,o,2)):]:o+=1
�     � "r":� Print a register
�-     o+=1:dummy=�showreg(�("&"+�n$,o,1)))
�     � "&":� Print a register
�-     o+=1:dummy=�showhex(�("&"+�n$,o,1)))
�    � "$":� Print a string
�1     o+=1:dummy=�showstrctrl(�("&"+�n$,o,1)))
�#    � "R":� Print all registers
�     �i=0�15
�6      dummy=�mess2("r"+�i+" : "):dummy=�showhex(i)
�      dummy=�mess("%I")

     �
   �
  �
&   [OPT pass%
0   SWI &100+�(l$)
:   ]
D  �
N �
X�
b%[OPT pass%:LDMFD (sp)!,{r0-r12}:]
l
=pass%
v:
�C� FNmess : Print a message as above, but expand returns and add
�� a return to end
�ݤmess(a$)
�� �a$,"%C")=0 �a$+=�13
�ȕ �a$,�13)>0
�. a$=�a$,�a$,�13)-1)+�0+�10+�a$,�a$,�13)+1)
��
�ȕ �a$,�0)>0
� �a$,�a$,�0),1)=�13
��
�=�mess2(a$)
�:
�@� FNshowreg : Print the contents of reg n to screen (signed)
ݤshowreg(n)
[OPT pass%
   STMFD   (sp)!,{r0-r2}
    MOV     r0,n
*   CMP     r0,#0
4   RSBMI   r0,r0,#0
>   SWIMI   &100+�("-")
H   ADR     r1,P%+4*7
R   MOV     r2,#8+8
\$   SWI     "OS_ConvertCardinal4"
f   SWI     "OS_Write0"
p   LDMFD   (sp)!,{r0-r2}
z   B       P%+12+8
�$   EQUD    0:EQUD 0:EQUD0:EQUD 0
�]:=0
�:
�+� FNshowhex : Print the contents of reg
�ݤshowhex(n)
�[OPT pass%
�   STMFD   (sp)!,{r0-r2}
�   MOV     r0,n
�   SWI     &100+�("&")
�   ADR     r1,P%+4*7
�   MOV     r2,#8+8
�   SWI     "OS_ConvertHex8"
�   SWI     "OS_Write0"
	   LDMFD   (sp)!,{r0-r2}
	   B       P%+12+8
	+   EQUD    0:EQUD 0:EQUD0:EQUD 0:EQUD 0
	$]:=0
	.:
	85� FNshowstr0 : Show the string pointed to, end =0
	Bݤshowstr0(n)
	L[OPT pass%
	V   STMFD   (sp)!,{r0}
	`   MOV     r0,n
	j   SWI     "OS_Write0"
	t   LDMFD   (sp)!,{r0}
	~]:=0
	�:
	�0� FNshowstrctrl : Show the ctrl ended string
	�ݤshowstrctrl(n)
	�[OPT pass%
	�   STMFD   (sp)!,{r0,r1}
	�   MOV     r1,n
	�   LDRB    r0,[r1],#1
	�   CMP     r0,#32
	�   SWIGE   "OS_WriteC"
	�   BGE     P%-12
	�   LDMFD   (sp)!,{r0,r1}
	�]:=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 3f  f4 20 43 72 65 61 74 65  |tion...?. Create|
00000030  64 20 62 79 20 4a 46 50  61 74 63 68 20 76 32 2e  |d by JFPatch v2.|
00000040  32 34 df 20 28 32 32 20  4d 61 79 20 31 39 39 36  |24. (22 May 1996|
00000050  29 20 a9 20 4a 75 73 74  69 6e 20 46 6c 65 74 63  |) . Justin Fletc|
00000060  68 65 72 0d 00 1e 30 f4  20 49 6e 74 65 72 6d 65  |her...0. Interme|
00000070  64 69 61 74 65 20 63 6f  64 65 20 66 69 6c 65 20  |diate code file |
00000080  63 72 65 61 74 65 64 20  32 34 20 4d 61 79 20 31  |created 24 May 1|
00000090  39 39 36 0d 00 28 10 ee  20 85 20 f2 45 72 72 6f  |996..(.. . .Erro|
000000a0  72 3a e0 0d 00 32 13 f2  70 61 74 63 68 5f 6c 6f  |r:...2..patch_lo|
000000b0  61 64 66 69 6c 65 0d 00  3c 17 73 70 3d 31 33 3a  |adfile..<.sp=13:|
000000c0  6c 69 6e 6b 3d 31 34 3a  70 63 3d 31 35 0d 00 46  |link=14:pc=15..F|
000000d0  2f 76 62 69 74 3d 31 3c  3c 32 38 3a 63 62 69 74  |/vbit=1<<28:cbit|
000000e0  3d 31 3c 3c 32 39 3a 7a  62 69 74 3d 31 3c 3c 33  |=1<<29:zbit=1<<3|
000000f0  30 3a 6e 62 69 74 3d 31  3c 3c 33 31 0d 00 50 10  |0:nbit=1<<31..P.|
00000100  50 25 3d 26 30 3a 4f 25  3d 4d 43 25 0d 00 5a 14  |P%=&0:O%=MC%..Z.|
00000110  e3 20 70 61 73 73 25 3d  34 20 b8 20 36 20 88 32  |. pass%=4 . 6 .2|
00000120  0d 00 64 22 f4 20 2a 2a  2a 2a 20 53 74 61 72 74  |..d". **** Start|
00000130  20 6f 66 20 6d 61 69 6e  20 63 6f 64 65 20 2a 2a  | of main code **|
00000140  2a 2a 0d 00 6e 14 f2 70  61 74 63 68 5f 73 65 74  |**..n..patch_set|
00000150  70 63 28 26 30 29 0d 00  78 0f 5b 20 4f 50 54 20  |pc(&0)..x.[ OPT |
00000160  70 61 73 73 25 0d 00 82  0a 2e 73 74 61 72 74 0d  |pass%.....start.|
00000170  00 8c 3e 20 20 20 53 54  4d 46 44 20 20 20 28 73  |..>   STMFD   (s|
00000180  70 29 21 2c 7b 72 30 2d  72 37 2c 6c 69 6e 6b 7d  |p)!,{r0-r7,link}|
00000190  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 53 74  |            ; St|
000001a0  61 63 6b 20 72 65 67 69  73 74 65 72 73 0d 00 96  |ack registers...|
000001b0  4a 20 20 20 4d 4f 56 20  20 20 20 20 72 36 2c 23  |J   MOV     r6,#|
000001c0  30 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |0               |
000001d0  20 20 20 20 20 20 20 20  20 20 3b 20 30 20 69 66  |          ; 0 if|
000001e0  20 6e 6f 20 65 72 72 6f  72 73 2c 20 31 20 69 66  | no errors, 1 if|
000001f0  20 65 72 72 6f 72 73 0d  00 a0 50 20 20 20 4d 4f  | errors...P   MO|
00000200  56 20 20 20 20 20 72 35  2c 23 26 37 64 30 20 20  |V     r5,#&7d0  |
00000210  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000220  20 20 20 20 3b 20 74 68  69 73 20 70 72 6f 62 61  |    ; this proba|
00000230  62 6c 79 20 77 6f 6e 27  74 20 77 6f 72 6b 20 6f  |bly won't work o|
00000240  6e 20 61 20 52 50 43 0d  00 aa 05 3a 0d 00 b4 0e  |n a RPC....:....|
00000250  2e 5f 5f 7a 30 5f 6c 6f  6f 70 0d 00 be 3f 20 20  |.__z0_loop...?  |
00000260  20 4d 4f 56 20 20 20 20  20 72 37 2c 72 35 20 20  | MOV     r7,r5  |
00000270  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000280  20 20 20 20 20 20 20 3b  20 72 37 20 3d 20 6f 6c  |       ; r7 = ol|
00000290  64 20 70 6f 69 6e 74 65  72 0d 00 c8 49 20 20 20  |d pointer...I   |
000002a0  4c 44 52 20 20 20 20 20  72 35 2c 5b 72 35 5d 20  |LDR     r5,[r5] |
000002b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000002c0  20 20 20 20 20 20 3b 20  67 65 74 20 70 6f 69 6e  |      ; get poin|
000002d0  74 65 72 20 74 6f 20 6e  65 78 74 20 6d 6f 64 75  |ter to next modu|
000002e0  6c 65 0d 00 d2 3c 20 20  20 43 4d 50 20 20 20 20  |le...<   CMP    |
000002f0  20 72 35 2c 23 30 20 20  20 20 20 20 20 20 20 20  | r5,#0          |
00000300  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00000310  20 65 6e 64 20 6f 66 20  6c 69 73 74 20 3f 0d 00  | end of list ?..|
00000320  dc 3e 20 20 20 42 45 51  20 20 20 20 20 5f 5f 7a  |.>   BEQ     __z|
00000330  30 5f 65 78 69 74 20 20  20 20 20 20 20 20 20 20  |0_exit          |
00000340  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00000350  20 69 66 20 73 6f 2c 20  65 78 69 74 0d 00 e6 49  | if so, exit...I|
00000360  20 20 20 4c 44 52 20 20  20 20 20 72 31 2c 5b 72  |   LDR     r1,[r|
00000370  35 2c 23 31 32 5d 20 20  20 20 20 20 20 20 20 20  |5,#12]          |
00000380  20 20 20 20 20 20 20 20  20 3b 20 72 65 61 64 20  |         ; read |
00000390  74 68 65 20 77 6f 72 6b  73 70 61 63 65 20 70 6f  |the workspace po|
000003a0  69 6e 74 65 72 0d 00 f0  3f 20 20 20 43 4d 50 20  |inter...?   CMP |
000003b0  20 20 20 20 72 31 2c 23  30 20 20 20 20 20 20 20  |    r1,#0       |
000003c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000003d0  20 20 3b 20 69 73 20 69  74 20 30 20 28 44 45 41  |  ; is it 0 (DEA|
000003e0  44 29 20 3f 0d 00 fa 44  20 20 20 42 4e 45 20 20  |D) ?...D   BNE  |
000003f0  20 20 20 5f 5f 7a 30 5f  6e 65 78 74 20 20 20 20  |   __z0_next    |
00000400  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000410  20 20 20 20 20 3b 20 69  66 20 6e 6f 74 2c 20 69  |     ; if not, i|
00000420  67 6e 6f 72 65 20 69 74  0d 01 04 05 3a 0d 01 0e  |gnore it....:...|
00000430  44 20 20 20 4c 44 52 20  20 20 20 20 72 31 2c 5b  |D   LDR     r1,[|
00000440  72 35 2c 23 34 5d 20 20  20 20 20 20 20 20 20 20  |r5,#4]          |
00000450  20 20 20 20 20 20 20 20  20 20 3b 20 6f 66 66 73  |          ; offs|
00000460  65 74 20 74 6f 20 6d 6f  64 75 6c 65 20 62 61 73  |et to module bas|
00000470  65 0d 01 18 4b 20 20 20  4c 44 52 20 20 20 20 20  |e...K   LDR     |
00000480  72 32 2c 5b 72 31 2c 23  31 36 5d 20 20 20 20 20  |r2,[r1,#16]     |
00000490  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
000004a0  6f 66 66 73 65 74 20 77  69 74 68 69 6e 20 6d 6f  |offset within mo|
000004b0  64 75 6c 65 20 6f 66 20  6e 61 6d 65 0d 01 22 38  |dule of name.."8|
000004c0  20 20 20 41 44 44 20 20  20 20 20 72 34 2c 72 32  |   ADD     r4,r2|
000004d0  2c 72 31 20 20 20 20 20  20 20 20 20 20 20 20 20  |,r1             |
000004e0  20 20 20 20 20 20 20 20  20 3b 20 72 34 2d 3e 20  |         ; r4-> |
000004f0  6e 61 6d 65 0d 01 2c 05  3a 0d 01 36 2b 20 a4 6d  |name..,.:..6+ .m|
00000500  65 73 73 28 22 4d 6f 64  75 6c 65 20 25 24 34 20  |ess("Module %$4 |
00000510  69 73 20 64 65 61 64 2c  20 6b 69 6c 6c 20 69 74  |is dead, kill it|
00000520  20 3f 22 29 0d 01 40 42  20 20 20 53 57 49 20 20  | ?")..@B   SWI  |
00000530  20 20 20 22 58 4f 53 5f  43 6f 6e 66 69 72 6d 22  |   "XOS_Confirm"|
00000540  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000550  20 3b 20 61 73 6b 20 74  68 65 20 75 73 65 72 20  | ; ask the user |
00000560  6e 69 63 65 6c 79 0d 01  4a 4c 20 20 20 42 56 53  |nicely..JL   BVS|
00000570  20 20 20 20 20 5f 5f 7a  30 5f 65 78 69 74 20 20  |     __z0_exit  |
00000580  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000590  20 20 20 20 20 20 20 3b  20 69 66 20 65 72 72 6f  |       ; if erro|
000005a0  72 2c 20 65 78 69 74 20  67 72 61 63 65 66 75 6c  |r, exit graceful|
000005b0  6c 79 0d 01 54 3f 20 20  20 43 4d 50 20 20 20 20  |ly..T?   CMP    |
000005c0  20 72 30 2c 23 97 28 22  79 22 29 20 20 20 20 20  | r0,#.("y")     |
000005d0  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 64  |             ; d|
000005e0  69 64 20 74 68 65 79 20  73 61 79 20 79 65 73 20  |id they say yes |
000005f0  3f 0d 01 5e 45 20 20 20  4d 4f 56 4e 45 20 20 20  |?..^E   MOVNE   |
00000600  72 36 2c 23 31 20 20 20  20 20 20 20 20 20 20 20  |r6,#1           |
00000610  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
00000620  6d 61 72 6b 20 61 73 20  75 6e 66 69 78 65 64 20  |mark as unfixed |
00000630  69 66 20 6e 6f 74 0d 01  68 47 20 20 20 42 4e 45  |if not..hG   BNE|
00000640  20 20 20 20 20 5f 5f 7a  30 5f 6e 65 78 74 20 20  |     __z0_next  |
00000650  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000660  20 20 20 20 20 20 20 3b  20 69 66 20 6e 6f 74 2c  |       ; if not,|
00000670  20 67 65 74 20 74 68 65  20 6e 65 78 74 0d 01 72  | get the next..r|
00000680  05 3a 0d 01 7c 4b 20 20  20 4c 44 52 20 20 20 20  |.:..|K   LDR    |
00000690  20 72 31 2c 5b 72 35 5d  20 20 20 20 20 20 20 20  | r1,[r5]        |
000006a0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
000006b0  20 72 65 61 64 20 74 68  65 20 6e 65 78 74 20 6d  | read the next m|
000006c0  6f 64 75 6c 65 20 70 6f  69 6e 74 65 72 0d 01 86  |odule pointer...|
000006d0  47 20 20 20 53 54 52 20  20 20 20 20 72 31 2c 5b  |G   STR     r1,[|
000006e0  72 37 5d 20 20 20 20 20  20 20 20 20 20 20 20 20  |r7]             |
000006f0  20 20 20 20 20 20 20 20  20 20 3b 20 73 74 6f 72  |          ; stor|
00000700  65 20 61 74 20 74 68 65  20 6f 6c 64 20 70 6f 69  |e at the old poi|
00000710  6e 74 65 72 0d 01 90 05  3a 0d 01 9a 4e 20 20 20  |nter....:...N   |
00000720  42 20 20 20 20 20 20 20  5f 5f 7a 30 5f 6c 6f 6f  |B       __z0_loo|
00000730  70 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |p               |
00000740  20 20 20 20 20 20 20 20  20 20 3b 20 61 6e 64 20  |          ; and |
00000750  6c 6f 6f 6b 20 61 74 20  74 68 65 20 6e 65 78 74  |look at the next|
00000760  20 6d 6f 64 75 6c 65 0d  01 a4 05 3a 0d 01 ae 0e  | module....:....|
00000770  2e 5f 5f 7a 30 5f 6e 65  78 74 0d 01 b8 18 20 20  |.__z0_next....  |
00000780  20 42 20 20 20 20 20 20  20 5f 5f 7a 30 5f 6c 6f  | B       __z0_lo|
00000790  6f 70 0d 01 c2 05 3a 0d  01 cc 0e 2e 5f 5f 7a 30  |op....:.....__z0|
000007a0  5f 65 78 69 74 0d 01 d6  4d 20 20 20 4d 4f 56 56  |_exit...M   MOVV|
000007b0  53 20 20 20 72 36 2c 23  31 20 20 20 20 20 20 20  |S   r6,#1       |
000007c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000007d0  20 20 3b 20 69 66 20 74  68 65 72 65 20 77 61 73  |  ; if there was|
000007e0  20 61 6e 20 65 72 72 6f  72 2c 20 6d 61 72 6b 20  | an error, mark |
000007f0  69 74 0d 01 e0 43 20 20  20 43 4d 50 20 20 20 20  |it...C   CMP    |
00000800  20 72 36 2c 23 30 20 20  20 20 20 20 20 20 20 20  | r6,#0          |
00000810  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00000820  20 77 61 73 20 74 68 65  72 65 20 61 6e 20 65 72  | was there an er|
00000830  72 6f 72 20 3f 0d 01 ea  48 20 20 20 42 45 51 20  |ror ?...H   BEQ |
00000840  20 20 20 20 5f 5f 7a 30  5f 6e 6f 65 72 72 6f 72  |    __z0_noerror|
00000850  73 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |s               |
00000860  20 20 20 20 20 20 3b 20  69 66 20 6e 6f 74 2c 20  |      ; if not, |
00000870  74 65 6c 6c 20 74 68 65  20 75 73 65 72 0d 01 f4  |tell the user...|
00000880  27 20 a4 6d 65 73 73 28  22 4d 6f 64 75 6c 65 20  |' .mess("Module |
00000890  61 72 65 61 20 77 61 73  20 6e 6f 74 20 66 69 78  |area was not fix|
000008a0  65 64 22 29 0d 01 fe 42  20 20 20 42 20 20 20 20  |ed")...B   B    |
000008b0  20 20 20 5f 5f 7a 30 5f  72 65 61 6c 65 78 69 74  |   __z0_realexit|
000008c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000008d0  20 20 20 20 20 3b 20 61  6e 64 20 65 78 69 74 20  |     ; and exit |
000008e0  73 61 66 65 6c 79 0d 02  08 05 3a 0d 02 12 12 2e  |safely....:.....|
000008f0  5f 5f 7a 30 5f 6e 6f 65  72 72 6f 72 73 0d 02 1c  |__z0_noerrors...|
00000900  23 20 a4 6d 65 73 73 28  22 4d 6f 64 75 6c 65 20  |# .mess("Module |
00000910  61 72 65 61 20 69 73 20  73 74 61 62 6c 65 22 29  |area is stable")|
00000920  0d 02 26 05 3a 0d 02 30  12 2e 5f 5f 7a 30 5f 72  |..&.:..0..__z0_r|
00000930  65 61 6c 65 78 69 74 0d  02 3a 3f 20 20 20 4c 44  |ealexit..:?   LD|
00000940  4d 46 44 20 20 20 28 73  70 29 21 2c 7b 72 30 2d  |MFD   (sp)!,{r0-|
00000950  72 37 2c 70 63 7d 5e 20  20 20 20 20 20 20 20 20  |r7,pc}^         |
00000960  20 20 20 20 3b 20 52 65  74 75 72 6e 20 66 72 6f  |    ; Return fro|
00000970  6d 20 63 61 6c 6c 0d 02  44 05 5d 0d 02 4e 20 f4  |m call..D.]..N .|
00000980  20 2a 2a 2a 2a 20 45 6e  64 20 6f 66 20 6d 61 69  | **** End of mai|
00000990  6e 20 63 6f 64 65 20 2a  2a 2a 2a 0d 02 58 36 f4  |n code ****..X6.|
000009a0  20 53 65 74 20 66 69 6e  61 6c 20 70 6f 69 6e 74  | Set final point|
000009b0  65 72 20 74 6f 20 66 69  6e 64 20 74 68 65 20 6c  |er to find the l|
000009c0  65 6e 67 74 68 20 6f 66  20 74 68 65 20 63 6f 64  |ength of the cod|
000009d0  65 0d 02 62 13 f2 70 61  74 63 68 5f 73 65 74 70  |e..b..patch_setp|
000009e0  63 28 30 29 0d 02 6c 0b  ed 20 70 61 73 73 25 0d  |c(0)..l.. pass%.|
000009f0  02 76 13 f2 70 61 74 63  68 5f 73 61 76 65 66 69  |.v..patch_savefi|
00000a00  6c 65 0d 02 94 05 e0 0d  02 9e 05 3a 0d 02 a8 21  |le.........:...!|
00000a10  f4 20 2a 2a 2a 2a 20 46  69 6c 69 6e 67 20 70 72  |. **** Filing pr|
00000a20  6f 63 65 64 75 72 65 73  20 2a 2a 2a 2a 0d 02 b2  |ocedures ****...|
00000a30  05 3a 0d 02 bc 15 dd 20  f2 70 61 74 63 68 5f 6c  |.:..... .patch_l|
00000a40  6f 61 64 66 69 6c 65 0d  02 c6 0d 63 6f 64 65 6c  |oadfile....codel|
00000a50  65 6e 3d 30 0d 02 d0 0f  de 20 4d 43 25 20 26 31  |en=0..... MC% &1|
00000a60  34 30 30 0d 02 da 2d 65  6e 64 6f 66 63 6f 64 65  |400...-endofcode|
00000a70  3d 28 63 6f 64 65 6c 65  6e 2b 26 30 2b 33 29 20  |=(codelen+&0+3) |
00000a80  80 20 2d 34 3a 6d 61 78  3d 63 6f 64 65 6c 65 6e  |. -4:max=codelen|
00000a90  0d 02 e4 19 4c 25 3d 65  6e 64 6f 66 63 6f 64 65  |....L%=endofcode|
00000aa0  3a 5f 5f 63 61 70 25 3d  a3 0d 03 7a 05 e1 0d 03  |:__cap%=...z....|
00000ab0  84 05 3a 0d 03 8e 15 dd  20 f2 70 61 74 63 68 5f  |..:..... .patch_|
00000ac0  73 61 76 65 66 69 6c 65  0d 03 98 25 6f 75 74 66  |savefile...%outf|
00000ad0  69 6c 65 24 3d 22 3c 4e  65 77 52 4d 54 69 64 79  |ile$="<NewRMTidy|
00000ae0  24 44 69 72 3e 2e 52 4d  54 69 64 79 22 0d 03 a2  |$Dir>.RMTidy"...|
00000af0  31 ff 28 22 53 61 76 65  20 22 2b 6f 75 74 66 69  |1.("Save "+outfi|
00000b00  6c 65 24 2b 22 20 22 2b  c3 7e 4d 43 25 2b 22 20  |le$+" "+.~MC%+" |
00000b10  22 2b c3 7e 28 6d 61 78  2b 4d 43 25 29 29 0d 03  |"+.~(max+MC%))..|
00000b20  ac 25 ff 28 22 53 65 74  74 79 70 65 20 22 2b 6f  |.%.("Settype "+o|
00000b30  75 74 66 69 6c 65 24 2b  22 20 55 74 69 6c 69 74  |utfile$+" Utilit|
00000b40  79 22 29 0d 03 b6 1f 70  61 74 63 68 64 69 72 24  |y")....patchdir$|
00000b50  3d 22 3c 4e 65 77 52 4d  54 69 64 79 24 44 69 72  |="<NewRMTidy$Dir|
00000b60  3e 22 0d 03 e8 05 e1 0d  03 f2 05 3a 0d 03 fc 1d  |>".........:....|
00000b70  f4 20 2a 2a 2a 2a 20 45  72 72 6f 72 20 48 61 6e  |. **** Error Han|
00000b80  64 6c 65 72 20 2a 2a 2a  2a 0d 04 06 05 3a 0d 04  |dler ****....:..|
00000b90  10 0b dd f2 45 72 72 6f  72 0d 04 1a 07 ea 20 85  |....Error..... .|
00000ba0  0d 04 24 3d ee 20 85 20  ea 3a f7 20 85 3a 85 20  |..$=. . .:. .:. |
00000bb0  a2 20 9f 2c f6 24 2b 22  20 77 68 69 6c 73 74 20  |. .,.$+" whilst |
00000bc0  69 6e 20 65 72 72 6f 72  20 68 61 6e 64 6c 65 72  |in error handler|
00000bd0  20 61 74 20 6c 69 6e 65  20 22 2b c3 9e 0d 04 92  | at line "+.....|
00000be0  1b 85 20 a2 20 9f 2c f6  24 2b 22 20 61 74 20 6c  |.. . .,.$+" at l|
00000bf0  69 6e 65 20 22 2b c3 9e  0d 04 9c 05 e1 0d 04 a6  |ine "+..........|
00000c00  05 3a 0d 05 14 22 f4 20  2a 2a 2a 2a 20 55 74 69  |.:...". **** Uti|
00000c10  6c 69 74 79 20 70 72 6f  63 65 64 75 72 65 73 20  |lity procedures |
00000c20  2a 2a 2a 2a 0d 05 1e 05  3a 0d 05 28 14 dd f2 70  |****....:..(...p|
00000c30  61 74 63 68 5f 73 65 74  70 63 28 6e 29 0d 05 32  |atch_setpc(n)..2|
00000c40  1a e7 20 50 25 2d 26 30  3e 6d 61 78 20 8c 6d 61  |.. P%-&0>max .ma|
00000c50  78 3d 50 25 2d 26 30 0d  05 3c 14 50 25 3d 6e 3a  |x=P%-&0..<.P%=n:|
00000c60  4f 25 3d 4d 43 25 2b 6e  2d 26 30 0d 05 46 05 e1  |O%=MC%+n-&0..F..|
00000c70  0d 05 50 05 3a 0d 05 5a  22 dd a4 66 69 6e 64 66  |..P.:..Z"..findf|
00000c80  72 65 65 72 65 67 28 61  2c 62 2c 63 2c 64 29 3a  |reereg(a,b,c,d):|
00000c90  ea 20 6e 3a 6e 3d 30 0d  05 64 1c c8 95 20 6e 3d  |. n:n=0..d... n=|
00000ca0  61 20 84 20 6e 3d 62 20  84 20 6e 3d 63 20 84 20  |a . n=b . n=c . |
00000cb0  6e 3d 64 0d 05 6e 09 20  6e 2b 3d 31 0d 05 78 05  |n=d..n. n+=1..x.|
00000cc0  ce 0d 05 82 06 3d 6e 0d  05 8c 05 3a 0d 05 96 24  |.....=n....:...$|
00000cd0  f4 20 2a 2a 2a 2a 20 52  45 4d 20 6d 61 63 72 6f  |. **** REM macro|
00000ce0  20 70 72 6f 63 65 64 75  72 65 73 20 2a 2a 2a 2a  | procedures ****|
00000cf0  0d 05 a0 05 3a 0d 05 aa  38 f4 20 46 4e 6d 65 73  |....:...8. FNmes|
00000d00  73 32 20 3a 20 47 65 6e  65 72 61 74 65 20 61 20  |s2 : Generate a |
00000d10  74 65 78 74 75 61 6c 20  6d 65 73 73 61 67 65 20  |textual message |
00000d20  6f 6e 20 74 68 65 20 73  63 72 65 65 6e 0d 05 b4  |on the screen...|
00000d30  3b f4 20 44 6f 6e 27 74  2c 20 68 6f 77 65 76 65  |;. Don't, howeve|
00000d40  72 20 65 78 70 61 6e 64  20 63 6f 64 65 20 31 33  |r expand code 13|
00000d50  20 28 61 6c 6c 6f 77 73  20 63 6f 6e 74 72 6f 6c  | (allows control|
00000d60  20 63 6f 64 65 73 21 29  0d 05 be 15 f4 20 49 6e  | codes!)..... In|
00000d70  63 6c 75 64 65 20 25 20  43 6f 64 65 73 0d 05 c8  |clude % Codes...|
00000d80  18 f4 20 25 25 20 20 54  72 61 6e 73 6c 61 74 65  |.. %%  Translate|
00000d90  20 74 6f 20 25 0d 05 d2  3e f4 20 25 49 20 20 49  | to %...>. %I  I|
00000da0  67 6e 6f 72 65 20 63 6f  64 65 20 28 53 6f 20 74  |gnore code (So t|
00000db0  68 61 74 20 63 6f 6e 74  72 6f 6c 20 73 74 72 69  |hat control stri|
00000dc0  6e 67 20 63 61 6e 20 62  65 20 65 6d 62 65 64 64  |ng can be embedd|
00000dd0  65 64 29 0d 05 dc 35 f4  20 25 72 23 20 44 69 73  |ed)...5. %r# Dis|
00000de0  70 6c 61 79 20 72 65 67  69 73 74 65 72 20 6e 75  |play register nu|
00000df0  6d 62 65 72 20 28 66 6f  6c 6c 6f 77 65 64 20 62  |mber (followed b|
00000e00  79 20 73 70 61 63 65 29  0d 05 e6 33 f4 20 25 52  |y space)...3. %R|
00000e10  20 20 44 69 73 70 6c 61  79 20 61 6c 6c 20 72 65  |  Display all re|
00000e20  67 69 73 74 65 72 73 20  28 72 23 23 20 3a 20 23  |gisters (r## : #|
00000e30  23 20 3c 43 52 3e 3c 4c  46 3e 29 0d 05 f0 18 dd  |# <CR><LF>).....|
00000e40  a4 6d 65 73 73 32 28 6e  24 29 3a ea 20 6c 24 2c  |.mess2(n$):. l$,|
00000e50  6f 2c 69 0d 05 fa 25 5b  4f 50 54 20 70 61 73 73  |o,i...%[OPT pass|
00000e60  25 3a 53 54 4d 46 44 20  28 73 70 29 21 2c 7b 72  |%:STMFD (sp)!,{r|
00000e70  30 2d 72 31 32 7d 3a 5d  0d 06 04 12 e7 20 a7 6e  |0-r12}:]..... .n|
00000e80  24 2c 22 25 22 29 3d 30  20 8c 0d 06 0e 0f 20 5b  |$,"%")=0 ..... [|
00000e90  4f 50 54 20 70 61 73 73  25 0d 06 18 14 20 53 57  |OPT pass%.... SW|
00000ea0  49 20 22 4f 53 5f 57 72  69 74 65 53 22 0d 06 22  |I "OS_WriteS".."|
00000eb0  0f 20 45 51 55 53 20 6e  24 2b bd 30 0d 06 2c 0a  |. EQUS n$+.0..,.|
00000ec0  20 41 4c 49 47 4e 0d 06  36 06 20 5d 0d 06 40 05  | ALIGN..6. ]..@.|
00000ed0  cc 0d 06 4a 0f 20 e3 6f  3d 31 b8 a9 28 6e 24 29  |...J. .o=1..(n$)|
00000ee0  0d 06 54 11 20 20 6c 24  3d c1 6e 24 2c 6f 2c 31  |..T.  l$=.n$,o,1|
00000ef0  29 0d 06 5e 10 20 20 e7  20 6c 24 3d 22 25 22 20  |)..^.  . l$="%" |
00000f00  8c 0d 06 68 17 20 20 20  6f 2b 3d 31 3a 6c 24 3d  |...h.   o+=1:l$=|
00000f10  c1 6e 24 2c 6f 2c 31 29  0d 06 72 0e 20 20 20 c8  |.n$,o,1)..r.   .|
00000f20  8e 20 6c 24 20 ca 0d 06  7c 2a 20 20 20 20 c9 20  |. l$ ...|*    . |
00000f30  22 25 22 3a 5b 4f 50 54  20 70 61 73 73 25 3a 53  |"%":[OPT pass%:S|
00000f40  57 49 20 26 31 30 30 2b  97 28 22 25 22 29 3a 5d  |WI &100+.("%"):]|
00000f50  0d 06 86 16 20 20 20 20  c9 20 22 49 22 3a f4 20  |....    . "I":. |
00000f60  49 67 6e 6f 72 65 0d 06  90 2e 20 20 20 20 c9 20  |Ignore....    . |
00000f70  22 63 22 3a f4 20 43 6f  6e 73 74 61 6e 74 20 2d  |"c":. Constant -|
00000f80  20 69 65 20 65 6d 62 65  64 64 65 64 20 63 6f 6e  | ie embedded con|
00000f90  74 72 6f 6c 0d 06 9a 34  20 20 20 20 20 6f 2b 3d  |trol...4     o+=|
00000fa0  31 3a 5b 4f 50 54 20 70  61 73 73 25 3a 53 57 49  |1:[OPT pass%:SWI|
00000fb0  20 26 31 30 30 2b bb 28  c1 6e 24 2c 6f 2c 32 29  | &100+.(.n$,o,2)|
00000fc0  29 3a 5d 3a 6f 2b 3d 31  0d 06 a4 20 20 20 20 20  |):]:o+=1...     |
00000fd0  c9 20 22 72 22 3a f4 20  50 72 69 6e 74 20 61 20  |. "r":. Print a |
00000fe0  72 65 67 69 73 74 65 72  0d 06 ae 2d 20 20 20 20  |register...-    |
00000ff0  20 6f 2b 3d 31 3a 64 75  6d 6d 79 3d a4 73 68 6f  | o+=1:dummy=.sho|
00001000  77 72 65 67 28 a0 28 22  26 22 2b c1 6e 24 2c 6f  |wreg(.("&"+.n$,o|
00001010  2c 31 29 29 29 0d 06 b8  20 20 20 20 20 c9 20 22  |,1)))...     . "|
00001020  26 22 3a f4 20 50 72 69  6e 74 20 61 20 72 65 67  |&":. Print a reg|
00001030  69 73 74 65 72 0d 06 c2  2d 20 20 20 20 20 6f 2b  |ister...-     o+|
00001040  3d 31 3a 64 75 6d 6d 79  3d a4 73 68 6f 77 68 65  |=1:dummy=.showhe|
00001050  78 28 a0 28 22 26 22 2b  c1 6e 24 2c 6f 2c 31 29  |x(.("&"+.n$,o,1)|
00001060  29 29 0d 06 cc 1e 20 20  20 20 c9 20 22 24 22 3a  |))....    . "$":|
00001070  f4 20 50 72 69 6e 74 20  61 20 73 74 72 69 6e 67  |. Print a string|
00001080  0d 06 d6 31 20 20 20 20  20 6f 2b 3d 31 3a 64 75  |...1     o+=1:du|
00001090  6d 6d 79 3d a4 73 68 6f  77 73 74 72 63 74 72 6c  |mmy=.showstrctrl|
000010a0  28 a0 28 22 26 22 2b c1  6e 24 2c 6f 2c 31 29 29  |(.("&"+.n$,o,1))|
000010b0  29 0d 06 e0 23 20 20 20  20 c9 20 22 52 22 3a f4  |)...#    . "R":.|
000010c0  20 50 72 69 6e 74 20 61  6c 6c 20 72 65 67 69 73  | Print all regis|
000010d0  74 65 72 73 0d 06 ea 10  20 20 20 20 20 e3 69 3d  |ters....     .i=|
000010e0  30 b8 31 35 0d 06 f4 36  20 20 20 20 20 20 64 75  |0.15...6      du|
000010f0  6d 6d 79 3d a4 6d 65 73  73 32 28 22 72 22 2b c3  |mmy=.mess2("r"+.|
00001100  69 2b 22 20 3a 20 22 29  3a 64 75 6d 6d 79 3d a4  |i+" : "):dummy=.|
00001110  73 68 6f 77 68 65 78 28  69 29 0d 06 fe 1b 20 20  |showhex(i)....  |
00001120  20 20 20 20 64 75 6d 6d  79 3d a4 6d 65 73 73 28  |    dummy=.mess(|
00001130  22 25 49 22 29 0d 07 08  0a 20 20 20 20 20 ed 0d  |"%I")....     ..|
00001140  07 12 08 20 20 20 cb 0d  07 1c 07 20 20 cc 0d 07  |...   .....  ...|
00001150  26 11 20 20 20 5b 4f 50  54 20 70 61 73 73 25 0d  |&.   [OPT pass%.|
00001160  07 30 15 20 20 20 53 57  49 20 26 31 30 30 2b 97  |.0.   SWI &100+.|
00001170  28 6c 24 29 0d 07 3a 08  20 20 20 5d 0d 07 44 07  |(l$)..:.   ]..D.|
00001180  20 20 cd 0d 07 4e 06 20  ed 0d 07 58 05 cd 0d 07  |  ...N. ...X....|
00001190  62 25 5b 4f 50 54 20 70  61 73 73 25 3a 4c 44 4d  |b%[OPT pass%:LDM|
000011a0  46 44 20 28 73 70 29 21  2c 7b 72 30 2d 72 31 32  |FD (sp)!,{r0-r12|
000011b0  7d 3a 5d 0d 07 6c 0a 3d  70 61 73 73 25 0d 07 76  |}:]..l.=pass%..v|
000011c0  05 3a 0d 07 80 43 f4 20  46 4e 6d 65 73 73 20 3a  |.:...C. FNmess :|
000011d0  20 50 72 69 6e 74 20 61  20 6d 65 73 73 61 67 65  | Print a message|
000011e0  20 61 73 20 61 62 6f 76  65 2c 20 62 75 74 20 65  | as above, but e|
000011f0  78 70 61 6e 64 20 72 65  74 75 72 6e 73 20 61 6e  |xpand returns an|
00001200  64 20 61 64 64 0d 07 8a  15 f4 20 61 20 72 65 74  |d add..... a ret|
00001210  75 72 6e 20 74 6f 20 65  6e 64 0d 07 94 0e dd a4  |urn to end......|
00001220  6d 65 73 73 28 61 24 29  0d 07 9e 1a e7 20 a7 61  |mess(a$)..... .a|
00001230  24 2c 22 25 43 22 29 3d  30 20 8c 61 24 2b 3d bd  |$,"%C")=0 .a$+=.|
00001240  31 33 0d 07 a8 11 c8 95  20 a7 61 24 2c bd 31 33  |13...... .a$,.13|
00001250  29 3e 30 0d 07 b2 2e 20  61 24 3d c0 61 24 2c a7  |)>0.... a$=.a$,.|
00001260  61 24 2c bd 31 33 29 2d  31 29 2b bd 30 2b bd 31  |a$,.13)-1)+.0+.1|
00001270  30 2b c1 61 24 2c a7 61  24 2c bd 31 33 29 2b 31  |0+.a$,.a$,.13)+1|
00001280  29 0d 07 bc 05 ce 0d 07  c6 10 c8 95 20 a7 61 24  |)........... .a$|
00001290  2c bd 30 29 3e 30 0d 07  d0 17 20 c1 61 24 2c a7  |,.0)>0.... .a$,.|
000012a0  61 24 2c bd 30 29 2c 31  29 3d bd 31 33 0d 07 da  |a$,.0),1)=.13...|
000012b0  05 ce 0d 07 e4 0f 3d a4  6d 65 73 73 32 28 61 24  |......=.mess2(a$|
000012c0  29 0d 07 ee 05 3a 0d 07  f8 40 f4 20 46 4e 73 68  |)....:...@. FNsh|
000012d0  6f 77 72 65 67 20 3a 20  50 72 69 6e 74 20 74 68  |owreg : Print th|
000012e0  65 20 63 6f 6e 74 65 6e  74 73 20 6f 66 20 72 65  |e contents of re|
000012f0  67 20 6e 20 74 6f 20 73  63 72 65 65 6e 20 28 73  |g n to screen (s|
00001300  69 67 6e 65 64 29 0d 08  02 10 dd a4 73 68 6f 77  |igned)......show|
00001310  72 65 67 28 6e 29 0d 08  0c 0e 5b 4f 50 54 20 70  |reg(n)....[OPT p|
00001320  61 73 73 25 0d 08 16 1c  20 20 20 53 54 4d 46 44  |ass%....   STMFD|
00001330  20 20 20 28 73 70 29 21  2c 7b 72 30 2d 72 32 7d  |   (sp)!,{r0-r2}|
00001340  0d 08 20 13 20 20 20 4d  4f 56 20 20 20 20 20 72  |.. .   MOV     r|
00001350  30 2c 6e 0d 08 2a 14 20  20 20 43 4d 50 20 20 20  |0,n..*.   CMP   |
00001360  20 20 72 30 2c 23 30 0d  08 34 17 20 20 20 52 53  |  r0,#0..4.   RS|
00001370  42 4d 49 20 20 20 72 30  2c 72 30 2c 23 30 0d 08  |BMI   r0,r0,#0..|
00001380  3e 1a 20 20 20 53 57 49  4d 49 20 20 20 26 31 30  |>.   SWIMI   &10|
00001390  30 2b 97 28 22 2d 22 29  0d 08 48 18 20 20 20 41  |0+.("-")..H.   A|
000013a0  44 52 20 20 20 20 20 72  31 2c 50 25 2b 34 2a 37  |DR     r1,P%+4*7|
000013b0  0d 08 52 16 20 20 20 4d  4f 56 20 20 20 20 20 72  |..R.   MOV     r|
000013c0  32 2c 23 38 2b 38 0d 08  5c 24 20 20 20 53 57 49  |2,#8+8..\$   SWI|
000013d0  20 20 20 20 20 22 4f 53  5f 43 6f 6e 76 65 72 74  |     "OS_Convert|
000013e0  43 61 72 64 69 6e 61 6c  34 22 0d 08 66 1a 20 20  |Cardinal4"..f.  |
000013f0  20 53 57 49 20 20 20 20  20 22 4f 53 5f 57 72 69  | SWI     "OS_Wri|
00001400  74 65 30 22 0d 08 70 1c  20 20 20 4c 44 4d 46 44  |te0"..p.   LDMFD|
00001410  20 20 20 28 73 70 29 21  2c 7b 72 30 2d 72 32 7d  |   (sp)!,{r0-r2}|
00001420  0d 08 7a 16 20 20 20 42  20 20 20 20 20 20 20 50  |..z.   B       P|
00001430  25 2b 31 32 2b 38 0d 08  84 24 20 20 20 45 51 55  |%+12+8...$   EQU|
00001440  44 20 20 20 20 30 3a 45  51 55 44 20 30 3a 45 51  |D    0:EQUD 0:EQ|
00001450  55 44 30 3a 45 51 55 44  20 30 0d 08 8e 08 5d 3a  |UD0:EQUD 0....]:|
00001460  3d 30 0d 08 98 05 3a 0d  08 a2 2b f4 20 46 4e 73  |=0....:...+. FNs|
00001470  68 6f 77 68 65 78 20 3a  20 50 72 69 6e 74 20 74  |howhex : Print t|
00001480  68 65 20 63 6f 6e 74 65  6e 74 73 20 6f 66 20 72  |he contents of r|
00001490  65 67 0d 08 ac 10 dd a4  73 68 6f 77 68 65 78 28  |eg......showhex(|
000014a0  6e 29 0d 08 b6 0e 5b 4f  50 54 20 70 61 73 73 25  |n)....[OPT pass%|
000014b0  0d 08 c0 1c 20 20 20 53  54 4d 46 44 20 20 20 28  |....   STMFD   (|
000014c0  73 70 29 21 2c 7b 72 30  2d 72 32 7d 0d 08 ca 13  |sp)!,{r0-r2}....|
000014d0  20 20 20 4d 4f 56 20 20  20 20 20 72 30 2c 6e 0d  |   MOV     r0,n.|
000014e0  08 d4 1a 20 20 20 53 57  49 20 20 20 20 20 26 31  |...   SWI     &1|
000014f0  30 30 2b 97 28 22 26 22  29 0d 08 de 18 20 20 20  |00+.("&")....   |
00001500  41 44 52 20 20 20 20 20  72 31 2c 50 25 2b 34 2a  |ADR     r1,P%+4*|
00001510  37 0d 08 e8 16 20 20 20  4d 4f 56 20 20 20 20 20  |7....   MOV     |
00001520  72 32 2c 23 38 2b 38 0d  08 f2 1f 20 20 20 53 57  |r2,#8+8....   SW|
00001530  49 20 20 20 20 20 22 4f  53 5f 43 6f 6e 76 65 72  |I     "OS_Conver|
00001540  74 48 65 78 38 22 0d 08  fc 1a 20 20 20 53 57 49  |tHex8"....   SWI|
00001550  20 20 20 20 20 22 4f 53  5f 57 72 69 74 65 30 22  |     "OS_Write0"|
00001560  0d 09 06 1c 20 20 20 4c  44 4d 46 44 20 20 20 28  |....   LDMFD   (|
00001570  73 70 29 21 2c 7b 72 30  2d 72 32 7d 0d 09 10 16  |sp)!,{r0-r2}....|
00001580  20 20 20 42 20 20 20 20  20 20 20 50 25 2b 31 32  |   B       P%+12|
00001590  2b 38 0d 09 1a 2b 20 20  20 45 51 55 44 20 20 20  |+8...+   EQUD   |
000015a0  20 30 3a 45 51 55 44 20  30 3a 45 51 55 44 30 3a  | 0:EQUD 0:EQUD0:|
000015b0  45 51 55 44 20 30 3a 45  51 55 44 20 30 0d 09 24  |EQUD 0:EQUD 0..$|
000015c0  08 5d 3a 3d 30 0d 09 2e  05 3a 0d 09 38 35 f4 20  |.]:=0....:..85. |
000015d0  46 4e 73 68 6f 77 73 74  72 30 20 3a 20 53 68 6f  |FNshowstr0 : Sho|
000015e0  77 20 74 68 65 20 73 74  72 69 6e 67 20 70 6f 69  |w the string poi|
000015f0  6e 74 65 64 20 74 6f 2c  20 65 6e 64 20 3d 30 0d  |nted to, end =0.|
00001600  09 42 11 dd a4 73 68 6f  77 73 74 72 30 28 6e 29  |.B...showstr0(n)|
00001610  0d 09 4c 0e 5b 4f 50 54  20 70 61 73 73 25 0d 09  |..L.[OPT pass%..|
00001620  56 19 20 20 20 53 54 4d  46 44 20 20 20 28 73 70  |V.   STMFD   (sp|
00001630  29 21 2c 7b 72 30 7d 0d  09 60 13 20 20 20 4d 4f  |)!,{r0}..`.   MO|
00001640  56 20 20 20 20 20 72 30  2c 6e 0d 09 6a 1a 20 20  |V     r0,n..j.  |
00001650  20 53 57 49 20 20 20 20  20 22 4f 53 5f 57 72 69  | SWI     "OS_Wri|
00001660  74 65 30 22 0d 09 74 19  20 20 20 4c 44 4d 46 44  |te0"..t.   LDMFD|
00001670  20 20 20 28 73 70 29 21  2c 7b 72 30 7d 0d 09 7e  |   (sp)!,{r0}..~|
00001680  08 5d 3a 3d 30 0d 09 88  05 3a 0d 09 92 30 f4 20  |.]:=0....:...0. |
00001690  46 4e 73 68 6f 77 73 74  72 63 74 72 6c 20 3a 20  |FNshowstrctrl : |
000016a0  53 68 6f 77 20 74 68 65  20 63 74 72 6c 20 65 6e  |Show the ctrl en|
000016b0  64 65 64 20 73 74 72 69  6e 67 0d 09 9c 14 dd a4  |ded string......|
000016c0  73 68 6f 77 73 74 72 63  74 72 6c 28 6e 29 0d 09  |showstrctrl(n)..|
000016d0  a6 0e 5b 4f 50 54 20 70  61 73 73 25 0d 09 b0 1c  |..[OPT pass%....|
000016e0  20 20 20 53 54 4d 46 44  20 20 20 28 73 70 29 21  |   STMFD   (sp)!|
000016f0  2c 7b 72 30 2c 72 31 7d  0d 09 ba 13 20 20 20 4d  |,{r0,r1}....   M|
00001700  4f 56 20 20 20 20 20 72  31 2c 6e 0d 09 c4 19 20  |OV     r1,n.... |
00001710  20 20 4c 44 52 42 20 20  20 20 72 30 2c 5b 72 31  |  LDRB    r0,[r1|
00001720  5d 2c 23 31 0d 09 ce 15  20 20 20 43 4d 50 20 20  |],#1....   CMP  |
00001730  20 20 20 72 30 2c 23 33  32 0d 09 d8 1a 20 20 20  |   r0,#32....   |
00001740  53 57 49 47 45 20 20 20  22 4f 53 5f 57 72 69 74  |SWIGE   "OS_Writ|
00001750  65 43 22 0d 09 e2 14 20  20 20 42 47 45 20 20 20  |eC"....   BGE   |
00001760  20 20 50 25 2d 31 32 0d  09 ec 1c 20 20 20 4c 44  |  P%-12....   LD|
00001770  4d 46 44 20 20 20 28 73  70 29 21 2c 7b 72 30 2c  |MFD   (sp)!,{r0,|
00001780  72 31 7d 0d 09 f6 08 5d  3a 3d 30 0d 0a 00 05 3a  |r1}....]:=0....:|
00001790  0d 7f 7f 0d f4 20 4a 46  50 61 74 63 68 0d ff     |..... JFPatch..|
0000179f