Home » Archimedes archive » Acorn User » AU 1993-10.adf » !3DGraphic_3DGraphic » BAU3DSrce

BAU3DSrce

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 1993-10.adf » !3DGraphic_3DGraphic
Filename: BAU3DSrce
Read OK:
File size: 1F5C bytes
Load address: 0000
Exec address: 0000
File contents
   10REM     >BAU3DSrce
   20REM By  DCA
   30REM For 32-bit machines
   40REM (c) BAU July 1993
   50:
   60debug=TRUE
   70DIM code% &10000,swi$(64),swi(64),def(64)
   80def()=FALSE
   90max_swi=-1
  100i%=0
  110REPEAT
  120 SYS "OS_GBPB",9,"Source",code%,1,i%,&100,"*" TO ,,,read%,i%
  130 IF read%=1 THEN
  140  j%=code%
  150  WHILE ?j%>=32
  160   j%+=1
  170  ENDWHILE
  180  ?j%=13
  190  f$=FNlc($code%)
  200  IF LEFT$(f$,3)="swi" THEN
  210   swi_no=VAL(MID$(f$,4))
  220   def(swi_no)=TRUE
  230   IF swi_no>max_swi max_swi=swi_no
  240   swi$(swi_no)="Source."+f$
  250  ENDIF
  260 ENDIF
  270UNTIL i%=-1
  280IF max_swi=-1 ERROR 0,"No source files found!"
  290swi$(64)="Source.Version"
  300OVERLAY swi$()
  310swi_chunk=&CE440
  320vbit=1<<28
  330wp=12:sp=13:link=14:pc=15
  340wk=0
  350FOR swi=0 TO max_swi:REM ***
  360 IF def(swi) THEN z=EVAL("FNswi"+RIGHT$("0"+STR$swi,2)+"_vars"):REM ***
  370NEXT:REM ***
  380FOR pass%=4 TO 6 STEP 2
  390P%=0
  400O%=code%
  410[OPT pass%
  420.module_base
  430        DCD     0
  440        DCD     init
  450        DCD     final
  460        DCD     service
  470        DCD     title
  480        DCD     help
  490        DCD     0
  500        DCD     swi_chunk
  510        DCD     swi_handler
  520        DCD     swi_table
  530        DCD     0
  540
  550.init   STMFD   (sp)!,{link}
  560        MOV     r0,#6
  570        MOV     r2,#0
  580        MOV     r3,#wk AND &FF
  590        ORR     r3,r3,#wk AND &FF00
  600        SWI     "XOS_Module"
  610        MOVVS   r2,#0
  620        LDMFD   (sp)!,{link}
  630        CMP     r2,#0
  640        ADREQ   r0,cant_init
  650        ORREQS  pc,link,#vbit
  660        STR     r2,[wp]
  670        FNinit_code:REM ***
  680        BICS    pc,link,#vbit
  690
  700.cant_init
  710        DCD     0
  720        EQUS    "BAU3D cannot initialise"
  730        DCB     0
  740        ALIGN
  750
  760.final  STMFD   (sp)!,{link}
  770        FNfinal_code:REM ***
  780        MOV     r0,#7
  790        LDR     r2,[wp]
  800        SWI     "XOS_Module"
  810        LDMFD   (sp)!,{pc}
  820
  830.service
  840        STMFD   (sp)!,{link}
  850        LDMFD   (sp)!,{pc}
  860
  870.title  EQUS    "BAU3D"
  880        DCB     0
  890        ALIGN
  900
  910.help   EQUS    "BAU3D"
  920        DCB     9
  930        DCB     9
  940        EQUS    FNversion
  950        DCB     0
  960        ALIGN
  970
  980.swi_handler
  990        LDR     wp,[wp]
 1000        CMP     r11,#max_swi+1
 1010        ADDCC   pc,pc,r11,LSL #2
 1020        B       unknown_swi
 1030]
 1040FOR swi=0 TO max_swi
 1050 [OPT pass%
 1060        B       swi(swi)
 1070 ]
 1080NEXT
 1090[OPT pass%
 1100.unknown_swi
 1110        ADR     r0,bad_swi_err
 1120        ORRS    pc,link,#vbit
 1130.bad_swi_err
 1140        DCD     &1E6
 1150        EQUS    "Unknown BAU3D operation"
 1160        DCB     0
 1170        ALIGN
 1180
 1190.swi_table
 1200        EQUS     "BAU3D"
 1210        DCB     0
 1220]
 1230FOR swi=0 TO max_swi
 1240 IF def(swi) THEN
 1250  [OPT pass%
 1260        EQUS    EVAL("FNswi"+RIGHT$("0"+STR$swi,2)+"_name")
 1270        DCB     0
 1280  ]
 1290 ELSE
 1300  [OPT pass%
 1310        EQUS    "Unused"+RIGHT$("0"+STR$swi,2)
 1320        DCB     0
 1330  ]
 1340 ENDIF
 1350NEXT
 1360[OPT pass%
 1370        DCB     0
 1380        ALIGN
 1390
 1400]
 1410FOR swi=0 TO max_swi
 1420 swi(swi)=P%
 1430 IF def(swi) THEN
 1440  k=EVAL("FNswi"+RIGHT$("0"+STR$swi,2)+"_code")
 1450 ELSE
 1460  [OPT pass%
 1470        MOV     pc,link
 1480  ]
 1490 ENDIF
 1500NEXT
 1510[OPT pass%
 1520.divide
 1530        STMFD   (sp)!,{r3,link}
 1540        EOR     r3,r0,r1
 1550        CMP     r0,#0
 1560        RSBLT   r0,r0,#0
 1570        CMP     r1,#0
 1580        RSBLT   r1,r1,#0
 1590        MOV     r14,r1
 1600        CMP     r14,r0,LSR #1
 1610.div1   MOVLS   r14,r14,LSL #1
 1620        CMPLS   r14,r0,LSR #1
 1630        BLS     div1
 1640        MOV     r2,#0
 1650.div2   CMP     r0,r14
 1660        SUBCS   r0,r0,r14
 1670        ADC     r2,r2,r2
 1680        MOV     r14,r14,LSR #1
 1690        CMP     r14,r1
 1700        BCS     div2
 1710        TST     r3,#1<<31
 1720        RSBNE   r2,r2,#0
 1730        LDMFD   (sp)!,{r3,pc}
 1740]
 1750PROCassemble_debug
 1760NEXT pass%
 1770SYS "OS_File",10,"BAU3D",&FFA,,code%,O%
 1780END
 1790:
 1800DEF FNtable(size%)
 1810P%+=size%
 1820O%+=size%
 1830=0
 1840:
 1850DEF FNswap(a,b)
 1860[OPT pass%
 1870        EOR     a,a,b
 1880        EOR     b,a,b
 1890        EOR     a,a,b
 1900]
 1910=0
 1920:
 1930DEF FNadrl(reg,off)
 1940[OPT pass%
 1950        ADD     reg,wp,#(off AND &FF)
 1960        ADD     reg,reg,#(off AND &FF00)
 1970]
 1980=0
 1990:
 2000DEF FNadreql(reg,off)
 2010[OPT pass%
 2020        ADDEQ   reg,wp,#(off AND &FF)
 2030        ADDEQ   reg,reg,#(off AND &FF00)
 2040]
 2050=0
 2060:
 2070DEF FNwk(req)
 2080wk+=req
 2090=wk-req
 2100:
 2110DEF FNlc(a$)
 2120LOCAL b$,i,c
 2130FOR i=1 TO LEN(a$)
 2140 c=ASCMID$(a$,i)
 2150 IF c>=ASC"A" AND c<=ASC"Z" c+=32
 2160 b$+=CHR$c
 2170NEXT
 2180=b$
 2190:
 2200DEF FNassert(a$):REM ***
 2210IF pass%>4 THEN IF NOT EVAL(a$) PRINT"Assertion '"a$"' failed":END
 2220=0
 2230:
 2240REM ************************************************************************
 2250REM FNdebug
 2260REM Somewhere in your program include PROCassemble_debug
 2270REM Set the variable debug to TRUE or FALSE
 2280REM IF debug=FALSE then FNdebug will do nothing and PROCassemble_debug
 2290REM will assemble no code.
 2300REM IF debug=TRUE then
 2310REM Pass a string to FNdebug and it will be printed
 2320REM Any occurrences of \<command>\ will be interpreted
 2330REM \\ - prints \
 2340REM \<register alias>\ - prints the register value in decimal
 2350REM \&<register alias>\ - prints the register value in hex
 2360REM \$<register alias>\ - prints the null terminated string
 2370REM \n\ or \N\ - prints a newline
 2380REM
 2390REM FNdebug preserves all registers (including R14) and flags
 2400REM (Just uses a bit of stack space!)
 2410REM Can be used in USR or SVC mode (not checked for)
 2420REM ************************************************************************
 2430
 2440
 2450REM This is so you can call assemble_debug after Fndebug if desired
 2460DEF PROCdebug_constants
 2470debug_decimal = 128 OR (%000 << 4)
 2480debug_hex     = 128 OR (%001 << 4)
 2490debug_string  = 128 OR (%010 << 4)
 2500ENDPROC
 2510
 2520DEF PROCassemble_debug
 2530IF NOT debug THEN ENDPROC
 2540PROCdebug_constants
 2550[OPT pass%
 2560.debug_
 2570STMFD R13!,{R0-R13}        ;store all the registers R14,R15 already on stack
 2580AND R10,R14,#&FC000003     ;R10 holds processor flags
 2590BIC R9,R14,#&FC000003      ;R9 is string pointer with no flags
 2600.debugloop
 2610LDRB R0,[R9],#1
 2620CMP R0,#0
 2630BEQ debugdone
 2640CMP R0,#128
 2650SWILT "OS_WriteC"
 2660BLT debugloop
 2670AND R8,R0,#%01110000
 2680AND R0,R0,#%00001111
 2690LDR R0,[R13,R0,LSL #2]
 2700ADD PC,PC,R8,LSR #2
 2710DCD 0
 2720B debug_type_decimal
 2730B debug_type_hex
 2740B debug_type_string
 2750B debug_type011
 2760B debug_type100
 2770B debug_type101
 2780B debug_type110
 2790B debug_type111
 2800.debugdone
 2810ADD R9,R9,#3
 2820BIC R9,R9,#3            ;align R9 for return address
 2830ORR R14,R10,R9          ;glue flags onto return address
 2840LDMFD R13!,{R0-R12}     ;restore registers
 2850ADD R13,R13,#4          ;drop R13
 2860MOVS PC,R14             ;return with flags unchanged
 2870:
 2880.debug_type011
 2890.debug_type100
 2900.debug_type101
 2910.debug_type110
 2920.debug_type111
 2930B debugloop
 2940:
 2950.debug_type_decimal
 2960ADR R1,debugnumbuf
 2970MOV R2,#16
 2980SWI "OS_ConvertInteger4"
 2990SWI "OS_Write0"
 3000B debugloop
 3010:
 3020.debug_type_hex
 3030ADR R1,debugnumbuf
 3040MOV R2,#16
 3050SWI "OS_ConvertHex8"
 3060SWI "OS_Write0"
 3070B debugloop
 3080:
 3090.debug_type_string
 3100mov r4,r0
 3110.debug_stringloop
 3120ldrb r0,[r4],#1
 3130cmp r0,#0
 3140beq debugloop
 3150cmp r0,#32
 3160blt debugstrhex
 3170cmp r0,#127
 3180beq debugstrhex
 3190swi "OS_WriteC"
 3200b debug_stringloop
 3210
 3220.debugstrhex
 3230swi 256+ASC"["
 3240ADR R1,debugnumbuf
 3250MOV R2,#16
 3260SWI "OS_ConvertHex2"
 3270SWI "OS_Write0"
 3280swi 256+ASC"]"
 3290b debug_stringloop
 3300:
 3310.debugnumbuf
 3320EQUD 0:EQUD 0:EQUD 0:EQUD 0
 3330]
 3340ENDPROC
 3350
 3360
 3370DEF FNdebug(str$)
 3380LOCAL base,a,b,a$
 3390IF NOT debug THEN =""
 3400PROCdebug_constants
 3410[OPT pass%
 3420STMFD R13 !,{R14,R15}  ;Save R14 for later and R15 for printout
 3430BL debug_
 3440]
 3450WHILE INSTR(str$,"\")>0
 3460 a=INSTR(str$,"\")
 3470 b=INSTR(str$,"\",a+1)-a-1
 3480 a$=MID$(str$,a+1,b)
 3490 CASE a$ OF
 3500  WHEN "" :str$=LEFT$(str$,a)+MID$(str$,a+2)
 3510  WHEN "n","N" : str$=LEFT$(str$,a-1)+CHR$13+CHR$10+MID$(str$,a+3)
 3520  OTHERWISE:
 3530   CASE LEFT$(a$,1) OF
 3540     WHEN "&": base=debug_hex: a$=MID$(a$,2)
 3550     WHEN "$": base=debug_string: a$=MID$(a$,2)
 3560     OTHERWISE: base=debug_decimal
 3570   ENDCASE
 3580   str$=LEFT$(str$,a-1)+CHR$(base OR EVALa$)+MID$(str$,a+b+2)
 3590 ENDCASE
 3600ENDWHILE
 3610[OPT pass%
 3620 EQUS str$
 3630 EQUB 0
 3640 ALIGN
 3650 LDMFD R13 !,{R14}  ;restore R14
 3660 ADD R13,R13,#4     ;drop R15
 3670]
 3680=""

�     >BAU3DSrce

� By  DCA
� For 32-bit machines
(� (c) BAU July 1993
2:
<debug=�
F+� code% &10000,swi$(64),swi(64),def(64)
Pdef()=�
Zmax_swi=-1
di%=0
n�
x> ș "OS_GBPB",9,"Source",code%,1,i%,&100,"*" � ,,,read%,i%
� � read%=1 �
�  j%=code%
�  ȕ ?j%>=32
�   j%+=1
�  �
�  ?j%=13
�  f$=�lc($code%)
�  � �f$,3)="swi" �
�   swi_no=�(�f$,4))
�   def(swi_no)=�
�&   � swi_no>max_swi max_swi=swi_no
�    swi$(swi_no)="Source."+f$
�  �
 �
� i%=-1
-� max_swi=-1 � 0,"No source files found!"
"swi$(64)="Source.Version"
,
ȣ swi$()
6swi_chunk=&CE440
@vbit=1<<28
Jwp=12:sp=13:link=14:pc=15
Twk=0
^� swi=0 � max_swi:� ***
h9 � def(swi) � z=�("FNswi"+�"0"+�swi,2)+"_vars"):� ***
r�:� ***
|� pass%=4 � 6 � 2
�P%=0
�O%=code%
�[OPT pass%
�.module_base
�        DCD     0
�        DCD     init
�        DCD     final
�        DCD     service
�        DCD     title
�        DCD     help
�        DCD     0
�        DCD     swi_chunk
�        DCD     swi_handler
        DCD     swi_table
        DCD     0

& .init   STMFD   (sp)!,{link}
0        MOV     r0,#6
:        MOV     r2,#0
D         MOV     r3,#wk � &FF
N$        �R     r3,r3,#wk � &FF00
X         SWI     "XOS_Module"
b        MOVVS   r2,#0
l         LDMFD   (sp)!,{link}
v        CMP     r2,#0
�         ADREQ   r0,cant_init
�         �REQS  pc,link,#vbit
�        STR     r2,[wp]
�        �init_code:� ***
�!        BICS    pc,link,#vbit
�
�.cant_init
�        DCD     0
�-        EQUS    "BAU3D cannot initialise"
�        DCB     0
�        ALIGN
�
� .final  STMFD   (sp)!,{link}
        �final_code:� ***
        MOV     r0,#7
        LDR     r2,[wp]
          SWI     "XOS_Module"
*        LDMFD   (sp)!,{pc}
4
>.service
H         STMFD   (sp)!,{link}
R        LDMFD   (sp)!,{pc}
\
f.title  EQUS    "BAU3D"
p        DCB     0
z        ALIGN
�
�.help   EQUS    "BAU3D"
�        DCB     9
�        DCB     9
�        EQUS    �version
�        DCB     0
�        ALIGN
�
�.swi_handler
�        LDR     wp,[wp]
�"        CMP     r11,#max_swi+1
�$        ADDCC   pc,pc,r11,LSL #2
�        B       unknown_swi
]
� swi=0 � max_swi
 [OPT pass%
$        B       swi(swi)
. ]
8�
B[OPT pass%
L.unknown_swi
V"        ADR     r0,bad_swi_err
`         �RS    pc,link,#vbit
j.bad_swi_err
t        DCD     &1E6
~-        EQUS    "Unknown BAU3D operation"
�        DCB     0
�        ALIGN
�
�.swi_table
�        EQUS     "BAU3D"
�        DCB     0
�]
�� swi=0 � max_swi
� � def(swi) �
�  [OPT pass%
�3        EQUS    �("FNswi"+�"0"+�swi,2)+"_name")
�        DCB     0
  ]

 �
  [OPT pass%
)        EQUS    "Unused"+�"0"+�swi,2)
(        DCB     0
2  ]
< �
F�
P[OPT pass%
Z        DCB     0
d        ALIGN
n
x]
�� swi=0 � max_swi
� swi(swi)=P%
� � def(swi) �
�'  k=�("FNswi"+�"0"+�swi,2)+"_code")
� �
�  [OPT pass%
�        MOV     pc,link
�  ]
� �
��
�[OPT pass%
�.divide
�#        STMFD   (sp)!,{r3,link}
        �     r3,r0,r1
        CMP     r0,#0
        RSBLT   r0,r0,#0
"        CMP     r1,#0
,        RSBLT   r1,r1,#0
6        MOV     r14,r1
@!        CMP     r14,r0,LSR #1
J".div1   MOVLS   r14,r14,LSL #1
T!        CMPLS   r14,r0,LSR #1
^        BLS     div1
h        MOV     r2,#0
r.div2   CMP     r0,r14
|        SUBCS   r0,r0,r14
�        ADC     r2,r2,r2
�"        MOV     r14,r14,LSR #1
�        CMP     r14,r1
�        BCS     div2
�        TST     r3,#1<<31
�        RSBNE   r2,r2,#0
�!        LDMFD   (sp)!,{r3,pc}
�]
��assemble_debug
�� pass%
�*ș "OS_File",10,"BAU3D",&FFA,,code%,O%
��
�:
� �table(size%)

P%+=size%

O%+=size%
&=0
0:
:� �swap(a,b)
D[OPT pass%
N        �     a,a,b
X        �     b,a,b
b        �     a,a,b
l]
v=0
�:
�� �adrl(reg,off)
�[OPT pass%
�'        ADD     reg,wp,#(off � &FF)
�*        ADD     reg,reg,#(off � &FF00)
�]
�=0
�:
�� �adreql(reg,off)
�[OPT pass%
�'        ADDEQ   reg,wp,#(off � &FF)
�*        ADDEQ   reg,reg,#(off � &FF00)
�]
=0
:
� �wk(req)
 wk+=req
*=wk-req
4:
>
� �lc(a$)
H� b$,i,c
R� i=1 � �(a$)
\ c=��a$,i)
f � c>=�"A" � c<=�"Z" c+=32
p b$+=�c
z�
�=b$
�:
�� �assert(a$):� ***
�6� pass%>4 � � � �(a$) �"Assertion '"a$"' failed":�
�=0
�:
�N� ************************************************************************
�
� FNdebug
�:� Somewhere in your program include PROCassemble_debug
�-� Set the variable debug to TRUE or FALSE
�H� IF debug=FALSE then FNdebug will do nothing and PROCassemble_debug
�� will assemble no code.
�� IF debug=TRUE then
	5� Pass a string to FNdebug and it will be printed
	8� Any occurrences of \<command>\ will be interpreted
	� \\ - prints \
	$?� \<register alias>\ - prints the register value in decimal
	.<� \&<register alias>\ - prints the register value in hex
	8=� \$<register alias>\ - prints the null terminated string
	B#� \n\ or \N\ - prints a newline
	L�
	V?� FNdebug preserves all registers (including R14) and flags
	`'� (Just uses a bit of stack space!)
	j6� Can be used in USR or SVC mode (not checked for)
	tN� ************************************************************************
	~
	�
	�E� This is so you can call assemble_debug after Fndebug if desired
	�� �debug_constants
	�%debug_decimal = 128 � (%000 << 4)
	�%debug_hex     = 128 � (%001 << 4)
	�%debug_string  = 128 � (%010 << 4)
	��
	�
	�� �assemble_debug
	�� � debug � �
	��debug_constants
	�[OPT pass%
.debug_

PSTMFD R13!,{R0-R13}        ;store all the registers R14,R15 already on stack
7� R10,R14,#&FC000003     ;R10 holds processor flags
BBIC R9,R14,#&FC000003      ;R9 is string pointer with no flags
(.debugloop
2LDRB R0,[R9],#1
<
CMP R0,#0
FBEQ debugdone
PCMP R0,#128
ZSWILT "OS_WriteC"
dBLT debugloop
n� R8,R0,#%01110000
x� R0,R0,#%00001111
�LDR R0,[R13,R0,LSL #2]
�ADD PC,PC,R8,LSR #2
�	DCD 0
�B debug_type_decimal
�B debug_type_hex
�B debug_type_string
�B debug_type011
�B debug_type100
�B debug_type101
�B debug_type110
�B debug_type111
�.debugdone
�ADD R9,R9,#3
8BIC R9,R9,#3            ;align R9 for return address
:�R R14,R10,R9          ;glue flags onto return address
.LDMFD R13!,{R0-R12}     ;restore registers
"%ADD R13,R13,#4          ;drop R13
,8MOVS PC,R14             ;return with flags unchanged
6:
@.debug_type011
J.debug_type100
T.debug_type101
^.debug_type110
h.debug_type111
rB debugloop
|:
�.debug_type_decimal
�ADR R1,debugnumbuf
�MOV R2,#16
�SWI "OS_ConvertInteger4"
�SWI "OS_Write0"
�B debugloop
�:
�.debug_type_hex
�ADR R1,debugnumbuf
�MOV R2,#16
�SWI "OS_ConvertHex8"
�SWI "OS_Write0"
�B debugloop
:
.debug_type_string

mov r4,r0
&.debug_stringloop
0ldrb r0,[r4],#1
:
cmp r0,#0
Dbeq debugloop
Ncmp r0,#32
Xblt debugstrhex
bcmp r0,#127
lbeq debugstrhex
vswi "OS_WriteC"
�b debug_stringloop
�
�.debugstrhex
�swi 256+�"["
�ADR R1,debugnumbuf
�MOV R2,#16
�SWI "OS_ConvertHex2"
�SWI "OS_Write0"
�swi 256+�"]"
�b debug_stringloop
�:
�.debugnumbuf
�EQUD 0:EQUD 0:EQUD 0:EQUD 0

]

�



 

*� �debug(str$)

4� base,a,b,a$

>� � debug � =""

H�debug_constants

R[OPT pass%

\CSTMFD R13 !,{R14,R15}  ;Save R14 for later and R15 for printout

f
BL debug_

p]

zȕ �str$,"\")>0

� a=�str$,"\")

� b=�str$,"\",a+1)-a-1

� a$=�str$,a+1,b)

� Ȏ a$ �

�$  � "" :str$=�str$,a)+�str$,a+2)

�4  � "n","N" : str$=�str$,a-1)+�13+�10+�str$,a+3)

�  :

�   Ȏ �a$,1) �

�)     � "&": base=debug_hex: a$=�a$,2)

�,     � "$": base=debug_string: a$=�a$,2)

�     : base=debug_decimal

�   �

�1   str$=�str$,a-1)+�(base � �a$)+�str$,a+b+2)
 �
�
[OPT pass%
$ EQUS str$
. EQUB 0
8
 ALIGN
B$ LDMFD R13 !,{R14}  ;restore R14
L! ADD R13,R13,#4     ;drop R15
V]
`=""
�
00000000  0d 00 0a 14 f4 20 20 20  20 20 3e 42 41 55 33 44  |.....     >BAU3D|
00000010  53 72 63 65 0d 00 14 0d  f4 20 42 79 20 20 44 43  |Srce..... By  DC|
00000020  41 0d 00 1e 19 f4 20 46  6f 72 20 33 32 2d 62 69  |A..... For 32-bi|
00000030  74 20 6d 61 63 68 69 6e  65 73 0d 00 28 17 f4 20  |t machines..(.. |
00000040  28 63 29 20 42 41 55 20  4a 75 6c 79 20 31 39 39  |(c) BAU July 199|
00000050  33 0d 00 32 05 3a 0d 00  3c 0b 64 65 62 75 67 3d  |3..2.:..<.debug=|
00000060  b9 0d 00 46 2b de 20 63  6f 64 65 25 20 26 31 30  |...F+. code% &10|
00000070  30 30 30 2c 73 77 69 24  28 36 34 29 2c 73 77 69  |000,swi$(64),swi|
00000080  28 36 34 29 2c 64 65 66  28 36 34 29 0d 00 50 0b  |(64),def(64)..P.|
00000090  64 65 66 28 29 3d a3 0d  00 5a 0e 6d 61 78 5f 73  |def()=...Z.max_s|
000000a0  77 69 3d 2d 31 0d 00 64  08 69 25 3d 30 0d 00 6e  |wi=-1..d.i%=0..n|
000000b0  05 f5 0d 00 78 3e 20 c8  99 20 22 4f 53 5f 47 42  |....x> .. "OS_GB|
000000c0  50 42 22 2c 39 2c 22 53  6f 75 72 63 65 22 2c 63  |PB",9,"Source",c|
000000d0  6f 64 65 25 2c 31 2c 69  25 2c 26 31 30 30 2c 22  |ode%,1,i%,&100,"|
000000e0  2a 22 20 b8 20 2c 2c 2c  72 65 61 64 25 2c 69 25  |*" . ,,,read%,i%|
000000f0  0d 00 82 10 20 e7 20 72  65 61 64 25 3d 31 20 8c  |.... . read%=1 .|
00000100  0d 00 8c 0e 20 20 6a 25  3d 63 6f 64 65 25 0d 00  |....  j%=code%..|
00000110  96 10 20 20 c8 95 20 3f  6a 25 3e 3d 33 32 0d 00  |..  .. ?j%>=32..|
00000120  a0 0c 20 20 20 6a 25 2b  3d 31 0d 00 aa 07 20 20  |..   j%+=1....  |
00000130  ce 0d 00 b4 0c 20 20 3f  6a 25 3d 31 33 0d 00 be  |.....  ?j%=13...|
00000140  14 20 20 66 24 3d a4 6c  63 28 24 63 6f 64 65 25  |.  f$=.lc($code%|
00000150  29 0d 00 c8 16 20 20 e7  20 c0 66 24 2c 33 29 3d  |)....  . .f$,3)=|
00000160  22 73 77 69 22 20 8c 0d  00 d2 17 20 20 20 73 77  |"swi" .....   sw|
00000170  69 5f 6e 6f 3d bb 28 c1  66 24 2c 34 29 29 0d 00  |i_no=.(.f$,4))..|
00000180  dc 14 20 20 20 64 65 66  28 73 77 69 5f 6e 6f 29  |..   def(swi_no)|
00000190  3d b9 0d 00 e6 26 20 20  20 e7 20 73 77 69 5f 6e  |=....&   . swi_n|
000001a0  6f 3e 6d 61 78 5f 73 77  69 20 6d 61 78 5f 73 77  |o>max_swi max_sw|
000001b0  69 3d 73 77 69 5f 6e 6f  0d 00 f0 20 20 20 20 73  |i=swi_no...    s|
000001c0  77 69 24 28 73 77 69 5f  6e 6f 29 3d 22 53 6f 75  |wi$(swi_no)="Sou|
000001d0  72 63 65 2e 22 2b 66 24  0d 00 fa 07 20 20 cd 0d  |rce."+f$....  ..|
000001e0  01 04 06 20 cd 0d 01 0e  0b fd 20 69 25 3d 2d 31  |... ...... i%=-1|
000001f0  0d 01 18 2d e7 20 6d 61  78 5f 73 77 69 3d 2d 31  |...-. max_swi=-1|
00000200  20 85 20 30 2c 22 4e 6f  20 73 6f 75 72 63 65 20  | . 0,"No source |
00000210  66 69 6c 65 73 20 66 6f  75 6e 64 21 22 0d 01 22  |files found!".."|
00000220  1d 73 77 69 24 28 36 34  29 3d 22 53 6f 75 72 63  |.swi$(64)="Sourc|
00000230  65 2e 56 65 72 73 69 6f  6e 22 0d 01 2c 0d c8 a3  |e.Version"..,...|
00000240  20 73 77 69 24 28 29 0d  01 36 14 73 77 69 5f 63  | swi$()..6.swi_c|
00000250  68 75 6e 6b 3d 26 43 45  34 34 30 0d 01 40 0e 76  |hunk=&CE440..@.v|
00000260  62 69 74 3d 31 3c 3c 32  38 0d 01 4a 1d 77 70 3d  |bit=1<<28..J.wp=|
00000270  31 32 3a 73 70 3d 31 33  3a 6c 69 6e 6b 3d 31 34  |12:sp=13:link=14|
00000280  3a 70 63 3d 31 35 0d 01  54 08 77 6b 3d 30 0d 01  |:pc=15..T.wk=0..|
00000290  5e 1b e3 20 73 77 69 3d  30 20 b8 20 6d 61 78 5f  |^.. swi=0 . max_|
000002a0  73 77 69 3a f4 20 2a 2a  2a 0d 01 68 39 20 e7 20  |swi:. ***..h9 . |
000002b0  64 65 66 28 73 77 69 29  20 8c 20 7a 3d a0 28 22  |def(swi) . z=.("|
000002c0  46 4e 73 77 69 22 2b c2  22 30 22 2b c3 73 77 69  |FNswi"+."0"+.swi|
000002d0  2c 32 29 2b 22 5f 76 61  72 73 22 29 3a f4 20 2a  |,2)+"_vars"):. *|
000002e0  2a 2a 0d 01 72 0b ed 3a  f4 20 2a 2a 2a 0d 01 7c  |**..r..:. ***..||
000002f0  15 e3 20 70 61 73 73 25  3d 34 20 b8 20 36 20 88  |.. pass%=4 . 6 .|
00000300  20 32 0d 01 86 08 50 25  3d 30 0d 01 90 0c 4f 25  | 2....P%=0....O%|
00000310  3d 63 6f 64 65 25 0d 01  9a 0e 5b 4f 50 54 20 70  |=code%....[OPT p|
00000320  61 73 73 25 0d 01 a4 10  2e 6d 6f 64 75 6c 65 5f  |ass%.....module_|
00000330  62 61 73 65 0d 01 ae 15  20 20 20 20 20 20 20 20  |base....        |
00000340  44 43 44 20 20 20 20 20  30 0d 01 b8 18 20 20 20  |DCD     0....   |
00000350  20 20 20 20 20 44 43 44  20 20 20 20 20 69 6e 69  |     DCD     ini|
00000360  74 0d 01 c2 19 20 20 20  20 20 20 20 20 44 43 44  |t....        DCD|
00000370  20 20 20 20 20 66 69 6e  61 6c 0d 01 cc 1b 20 20  |     final....  |
00000380  20 20 20 20 20 20 44 43  44 20 20 20 20 20 73 65  |      DCD     se|
00000390  72 76 69 63 65 0d 01 d6  19 20 20 20 20 20 20 20  |rvice....       |
000003a0  20 44 43 44 20 20 20 20  20 74 69 74 6c 65 0d 01  | DCD     title..|
000003b0  e0 18 20 20 20 20 20 20  20 20 44 43 44 20 20 20  |..        DCD   |
000003c0  20 20 68 65 6c 70 0d 01  ea 15 20 20 20 20 20 20  |  help....      |
000003d0  20 20 44 43 44 20 20 20  20 20 30 0d 01 f4 1d 20  |  DCD     0.... |
000003e0  20 20 20 20 20 20 20 44  43 44 20 20 20 20 20 73  |       DCD     s|
000003f0  77 69 5f 63 68 75 6e 6b  0d 01 fe 1f 20 20 20 20  |wi_chunk....    |
00000400  20 20 20 20 44 43 44 20  20 20 20 20 73 77 69 5f  |    DCD     swi_|
00000410  68 61 6e 64 6c 65 72 0d  02 08 1d 20 20 20 20 20  |handler....     |
00000420  20 20 20 44 43 44 20 20  20 20 20 73 77 69 5f 74  |   DCD     swi_t|
00000430  61 62 6c 65 0d 02 12 15  20 20 20 20 20 20 20 20  |able....        |
00000440  44 43 44 20 20 20 20 20  30 0d 02 1c 04 0d 02 26  |DCD     0......&|
00000450  20 2e 69 6e 69 74 20 20  20 53 54 4d 46 44 20 20  | .init   STMFD  |
00000460  20 28 73 70 29 21 2c 7b  6c 69 6e 6b 7d 0d 02 30  | (sp)!,{link}..0|
00000470  19 20 20 20 20 20 20 20  20 4d 4f 56 20 20 20 20  |.        MOV    |
00000480  20 72 30 2c 23 36 0d 02  3a 19 20 20 20 20 20 20  | r0,#6..:.      |
00000490  20 20 4d 4f 56 20 20 20  20 20 72 32 2c 23 30 0d  |  MOV     r2,#0.|
000004a0  02 44 20 20 20 20 20 20  20 20 20 4d 4f 56 20 20  |.D         MOV  |
000004b0  20 20 20 72 33 2c 23 77  6b 20 80 20 26 46 46 0d  |   r3,#wk . &FF.|
000004c0  02 4e 24 20 20 20 20 20  20 20 20 84 52 20 20 20  |.N$        .R   |
000004d0  20 20 72 33 2c 72 33 2c  23 77 6b 20 80 20 26 46  |  r3,r3,#wk . &F|
000004e0  46 30 30 0d 02 58 20 20  20 20 20 20 20 20 20 53  |F00..X         S|
000004f0  57 49 20 20 20 20 20 22  58 4f 53 5f 4d 6f 64 75  |WI     "XOS_Modu|
00000500  6c 65 22 0d 02 62 19 20  20 20 20 20 20 20 20 4d  |le"..b.        M|
00000510  4f 56 56 53 20 20 20 72  32 2c 23 30 0d 02 6c 20  |OVVS   r2,#0..l |
00000520  20 20 20 20 20 20 20 20  4c 44 4d 46 44 20 20 20  |        LDMFD   |
00000530  28 73 70 29 21 2c 7b 6c  69 6e 6b 7d 0d 02 76 19  |(sp)!,{link}..v.|
00000540  20 20 20 20 20 20 20 20  43 4d 50 20 20 20 20 20  |        CMP     |
00000550  72 32 2c 23 30 0d 02 80  20 20 20 20 20 20 20 20  |r2,#0...        |
00000560  20 41 44 52 45 51 20 20  20 72 30 2c 63 61 6e 74  | ADREQ   r0,cant|
00000570  5f 69 6e 69 74 0d 02 8a  20 20 20 20 20 20 20 20  |_init...        |
00000580  20 84 52 45 51 53 20 20  70 63 2c 6c 69 6e 6b 2c  | .REQS  pc,link,|
00000590  23 76 62 69 74 0d 02 94  1b 20 20 20 20 20 20 20  |#vbit....       |
000005a0  20 53 54 52 20 20 20 20  20 72 32 2c 5b 77 70 5d  | STR     r2,[wp]|
000005b0  0d 02 9e 1c 20 20 20 20  20 20 20 20 a4 69 6e 69  |....        .ini|
000005c0  74 5f 63 6f 64 65 3a f4  20 2a 2a 2a 0d 02 a8 21  |t_code:. ***...!|
000005d0  20 20 20 20 20 20 20 20  42 49 43 53 20 20 20 20  |        BICS    |
000005e0  70 63 2c 6c 69 6e 6b 2c  23 76 62 69 74 0d 02 b2  |pc,link,#vbit...|
000005f0  04 0d 02 bc 0e 2e 63 61  6e 74 5f 69 6e 69 74 0d  |......cant_init.|
00000600  02 c6 15 20 20 20 20 20  20 20 20 44 43 44 20 20  |...        DCD  |
00000610  20 20 20 30 0d 02 d0 2d  20 20 20 20 20 20 20 20  |   0...-        |
00000620  45 51 55 53 20 20 20 20  22 42 41 55 33 44 20 63  |EQUS    "BAU3D c|
00000630  61 6e 6e 6f 74 20 69 6e  69 74 69 61 6c 69 73 65  |annot initialise|
00000640  22 0d 02 da 15 20 20 20  20 20 20 20 20 44 43 42  |"....        DCB|
00000650  20 20 20 20 20 30 0d 02  e4 11 20 20 20 20 20 20  |     0....      |
00000660  20 20 41 4c 49 47 4e 0d  02 ee 04 0d 02 f8 20 2e  |  ALIGN....... .|
00000670  66 69 6e 61 6c 20 20 53  54 4d 46 44 20 20 20 28  |final  STMFD   (|
00000680  73 70 29 21 2c 7b 6c 69  6e 6b 7d 0d 03 02 1d 20  |sp)!,{link}.... |
00000690  20 20 20 20 20 20 20 a4  66 69 6e 61 6c 5f 63 6f  |       .final_co|
000006a0  64 65 3a f4 20 2a 2a 2a  0d 03 0c 19 20 20 20 20  |de:. ***....    |
000006b0  20 20 20 20 4d 4f 56 20  20 20 20 20 72 30 2c 23  |    MOV     r0,#|
000006c0  37 0d 03 16 1b 20 20 20  20 20 20 20 20 4c 44 52  |7....        LDR|
000006d0  20 20 20 20 20 72 32 2c  5b 77 70 5d 0d 03 20 20  |     r2,[wp]..  |
000006e0  20 20 20 20 20 20 20 20  53 57 49 20 20 20 20 20  |        SWI     |
000006f0  22 58 4f 53 5f 4d 6f 64  75 6c 65 22 0d 03 2a 1e  |"XOS_Module"..*.|
00000700  20 20 20 20 20 20 20 20  4c 44 4d 46 44 20 20 20  |        LDMFD   |
00000710  28 73 70 29 21 2c 7b 70  63 7d 0d 03 34 04 0d 03  |(sp)!,{pc}..4...|
00000720  3e 0c 2e 73 65 72 76 69  63 65 0d 03 48 20 20 20  |>..service..H   |
00000730  20 20 20 20 20 20 53 54  4d 46 44 20 20 20 28 73  |      STMFD   (s|
00000740  70 29 21 2c 7b 6c 69 6e  6b 7d 0d 03 52 1e 20 20  |p)!,{link}..R.  |
00000750  20 20 20 20 20 20 4c 44  4d 46 44 20 20 20 28 73  |      LDMFD   (s|
00000760  70 29 21 2c 7b 70 63 7d  0d 03 5c 04 0d 03 66 1b  |p)!,{pc}..\...f.|
00000770  2e 74 69 74 6c 65 20 20  45 51 55 53 20 20 20 20  |.title  EQUS    |
00000780  22 42 41 55 33 44 22 0d  03 70 15 20 20 20 20 20  |"BAU3D"..p.     |
00000790  20 20 20 44 43 42 20 20  20 20 20 30 0d 03 7a 11  |   DCB     0..z.|
000007a0  20 20 20 20 20 20 20 20  41 4c 49 47 4e 0d 03 84  |        ALIGN...|
000007b0  04 0d 03 8e 1b 2e 68 65  6c 70 20 20 20 45 51 55  |......help   EQU|
000007c0  53 20 20 20 20 22 42 41  55 33 44 22 0d 03 98 15  |S    "BAU3D"....|
000007d0  20 20 20 20 20 20 20 20  44 43 42 20 20 20 20 20  |        DCB     |
000007e0  39 0d 03 a2 15 20 20 20  20 20 20 20 20 44 43 42  |9....        DCB|
000007f0  20 20 20 20 20 39 0d 03  ac 1c 20 20 20 20 20 20  |     9....      |
00000800  20 20 45 51 55 53 20 20  20 20 a4 76 65 72 73 69  |  EQUS    .versi|
00000810  6f 6e 0d 03 b6 15 20 20  20 20 20 20 20 20 44 43  |on....        DC|
00000820  42 20 20 20 20 20 30 0d  03 c0 11 20 20 20 20 20  |B     0....     |
00000830  20 20 20 41 4c 49 47 4e  0d 03 ca 04 0d 03 d4 10  |   ALIGN........|
00000840  2e 73 77 69 5f 68 61 6e  64 6c 65 72 0d 03 de 1b  |.swi_handler....|
00000850  20 20 20 20 20 20 20 20  4c 44 52 20 20 20 20 20  |        LDR     |
00000860  77 70 2c 5b 77 70 5d 0d  03 e8 22 20 20 20 20 20  |wp,[wp]..."     |
00000870  20 20 20 43 4d 50 20 20  20 20 20 72 31 31 2c 23  |   CMP     r11,#|
00000880  6d 61 78 5f 73 77 69 2b  31 0d 03 f2 24 20 20 20  |max_swi+1...$   |
00000890  20 20 20 20 20 41 44 44  43 43 20 20 20 70 63 2c  |     ADDCC   pc,|
000008a0  70 63 2c 72 31 31 2c 4c  53 4c 20 23 32 0d 03 fc  |pc,r11,LSL #2...|
000008b0  1f 20 20 20 20 20 20 20  20 42 20 20 20 20 20 20  |.        B      |
000008c0  20 75 6e 6b 6e 6f 77 6e  5f 73 77 69 0d 04 06 05  | unknown_swi....|
000008d0  5d 0d 04 10 15 e3 20 73  77 69 3d 30 20 b8 20 6d  |]..... swi=0 . m|
000008e0  61 78 5f 73 77 69 0d 04  1a 0f 20 5b 4f 50 54 20  |ax_swi.... [OPT |
000008f0  70 61 73 73 25 0d 04 24  1c 20 20 20 20 20 20 20  |pass%..$.       |
00000900  20 42 20 20 20 20 20 20  20 73 77 69 28 73 77 69  | B       swi(swi|
00000910  29 0d 04 2e 06 20 5d 0d  04 38 05 ed 0d 04 42 0e  |).... ]..8....B.|
00000920  5b 4f 50 54 20 70 61 73  73 25 0d 04 4c 10 2e 75  |[OPT pass%..L..u|
00000930  6e 6b 6e 6f 77 6e 5f 73  77 69 0d 04 56 22 20 20  |nknown_swi..V"  |
00000940  20 20 20 20 20 20 41 44  52 20 20 20 20 20 72 30  |      ADR     r0|
00000950  2c 62 61 64 5f 73 77 69  5f 65 72 72 0d 04 60 20  |,bad_swi_err..` |
00000960  20 20 20 20 20 20 20 20  84 52 53 20 20 20 20 70  |        .RS    p|
00000970  63 2c 6c 69 6e 6b 2c 23  76 62 69 74 0d 04 6a 10  |c,link,#vbit..j.|
00000980  2e 62 61 64 5f 73 77 69  5f 65 72 72 0d 04 74 18  |.bad_swi_err..t.|
00000990  20 20 20 20 20 20 20 20  44 43 44 20 20 20 20 20  |        DCD     |
000009a0  26 31 45 36 0d 04 7e 2d  20 20 20 20 20 20 20 20  |&1E6..~-        |
000009b0  45 51 55 53 20 20 20 20  22 55 6e 6b 6e 6f 77 6e  |EQUS    "Unknown|
000009c0  20 42 41 55 33 44 20 6f  70 65 72 61 74 69 6f 6e  | BAU3D operation|
000009d0  22 0d 04 88 15 20 20 20  20 20 20 20 20 44 43 42  |"....        DCB|
000009e0  20 20 20 20 20 30 0d 04  92 11 20 20 20 20 20 20  |     0....      |
000009f0  20 20 41 4c 49 47 4e 0d  04 9c 04 0d 04 a6 0e 2e  |  ALIGN.........|
00000a00  73 77 69 5f 74 61 62 6c  65 0d 04 b0 1c 20 20 20  |swi_table....   |
00000a10  20 20 20 20 20 45 51 55  53 20 20 20 20 20 22 42  |     EQUS     "B|
00000a20  41 55 33 44 22 0d 04 ba  15 20 20 20 20 20 20 20  |AU3D"....       |
00000a30  20 44 43 42 20 20 20 20  20 30 0d 04 c4 05 5d 0d  | DCB     0....].|
00000a40  04 ce 15 e3 20 73 77 69  3d 30 20 b8 20 6d 61 78  |.... swi=0 . max|
00000a50  5f 73 77 69 0d 04 d8 11  20 e7 20 64 65 66 28 73  |_swi.... . def(s|
00000a60  77 69 29 20 8c 0d 04 e2  10 20 20 5b 4f 50 54 20  |wi) .....  [OPT |
00000a70  70 61 73 73 25 0d 04 ec  33 20 20 20 20 20 20 20  |pass%...3       |
00000a80  20 45 51 55 53 20 20 20  20 a0 28 22 46 4e 73 77  | EQUS    .("FNsw|
00000a90  69 22 2b c2 22 30 22 2b  c3 73 77 69 2c 32 29 2b  |i"+."0"+.swi,2)+|
00000aa0  22 5f 6e 61 6d 65 22 29  0d 04 f6 15 20 20 20 20  |"_name")....    |
00000ab0  20 20 20 20 44 43 42 20  20 20 20 20 30 0d 05 00  |    DCB     0...|
00000ac0  07 20 20 5d 0d 05 0a 06  20 cc 0d 05 14 10 20 20  |.  ].... .....  |
00000ad0  5b 4f 50 54 20 70 61 73  73 25 0d 05 1e 29 20 20  |[OPT pass%...)  |
00000ae0  20 20 20 20 20 20 45 51  55 53 20 20 20 20 22 55  |      EQUS    "U|
00000af0  6e 75 73 65 64 22 2b c2  22 30 22 2b c3 73 77 69  |nused"+."0"+.swi|
00000b00  2c 32 29 0d 05 28 15 20  20 20 20 20 20 20 20 44  |,2)..(.        D|
00000b10  43 42 20 20 20 20 20 30  0d 05 32 07 20 20 5d 0d  |CB     0..2.  ].|
00000b20  05 3c 06 20 cd 0d 05 46  05 ed 0d 05 50 0e 5b 4f  |.<. ...F....P.[O|
00000b30  50 54 20 70 61 73 73 25  0d 05 5a 15 20 20 20 20  |PT pass%..Z.    |
00000b40  20 20 20 20 44 43 42 20  20 20 20 20 30 0d 05 64  |    DCB     0..d|
00000b50  11 20 20 20 20 20 20 20  20 41 4c 49 47 4e 0d 05  |.        ALIGN..|
00000b60  6e 04 0d 05 78 05 5d 0d  05 82 15 e3 20 73 77 69  |n...x.]..... swi|
00000b70  3d 30 20 b8 20 6d 61 78  5f 73 77 69 0d 05 8c 10  |=0 . max_swi....|
00000b80  20 73 77 69 28 73 77 69  29 3d 50 25 0d 05 96 11  | swi(swi)=P%....|
00000b90  20 e7 20 64 65 66 28 73  77 69 29 20 8c 0d 05 a0  | . def(swi) ....|
00000ba0  27 20 20 6b 3d a0 28 22  46 4e 73 77 69 22 2b c2  |'  k=.("FNswi"+.|
00000bb0  22 30 22 2b c3 73 77 69  2c 32 29 2b 22 5f 63 6f  |"0"+.swi,2)+"_co|
00000bc0  64 65 22 29 0d 05 aa 06  20 cc 0d 05 b4 10 20 20  |de").... .....  |
00000bd0  5b 4f 50 54 20 70 61 73  73 25 0d 05 be 1b 20 20  |[OPT pass%....  |
00000be0  20 20 20 20 20 20 4d 4f  56 20 20 20 20 20 70 63  |      MOV     pc|
00000bf0  2c 6c 69 6e 6b 0d 05 c8  07 20 20 5d 0d 05 d2 06  |,link....  ]....|
00000c00  20 cd 0d 05 dc 05 ed 0d  05 e6 0e 5b 4f 50 54 20  | ..........[OPT |
00000c10  70 61 73 73 25 0d 05 f0  0b 2e 64 69 76 69 64 65  |pass%.....divide|
00000c20  0d 05 fa 23 20 20 20 20  20 20 20 20 53 54 4d 46  |...#        STMF|
00000c30  44 20 20 20 28 73 70 29  21 2c 7b 72 33 2c 6c 69  |D   (sp)!,{r3,li|
00000c40  6e 6b 7d 0d 06 04 1a 20  20 20 20 20 20 20 20 82  |nk}....        .|
00000c50  20 20 20 20 20 72 33 2c  72 30 2c 72 31 0d 06 0e  |     r3,r0,r1...|
00000c60  19 20 20 20 20 20 20 20  20 43 4d 50 20 20 20 20  |.        CMP    |
00000c70  20 72 30 2c 23 30 0d 06  18 1c 20 20 20 20 20 20  | r0,#0....      |
00000c80  20 20 52 53 42 4c 54 20  20 20 72 30 2c 72 30 2c  |  RSBLT   r0,r0,|
00000c90  23 30 0d 06 22 19 20 20  20 20 20 20 20 20 43 4d  |#0..".        CM|
00000ca0  50 20 20 20 20 20 72 31  2c 23 30 0d 06 2c 1c 20  |P     r1,#0..,. |
00000cb0  20 20 20 20 20 20 20 52  53 42 4c 54 20 20 20 72  |       RSBLT   r|
00000cc0  31 2c 72 31 2c 23 30 0d  06 36 1a 20 20 20 20 20  |1,r1,#0..6.     |
00000cd0  20 20 20 4d 4f 56 20 20  20 20 20 72 31 34 2c 72  |   MOV     r14,r|
00000ce0  31 0d 06 40 21 20 20 20  20 20 20 20 20 43 4d 50  |1..@!        CMP|
00000cf0  20 20 20 20 20 72 31 34  2c 72 30 2c 4c 53 52 20  |     r14,r0,LSR |
00000d00  23 31 0d 06 4a 22 2e 64  69 76 31 20 20 20 4d 4f  |#1..J".div1   MO|
00000d10  56 4c 53 20 20 20 72 31  34 2c 72 31 34 2c 4c 53  |VLS   r14,r14,LS|
00000d20  4c 20 23 31 0d 06 54 21  20 20 20 20 20 20 20 20  |L #1..T!        |
00000d30  43 4d 50 4c 53 20 20 20  72 31 34 2c 72 30 2c 4c  |CMPLS   r14,r0,L|
00000d40  53 52 20 23 31 0d 06 5e  18 20 20 20 20 20 20 20  |SR #1..^.       |
00000d50  20 42 4c 53 20 20 20 20  20 64 69 76 31 0d 06 68  | BLS     div1..h|
00000d60  19 20 20 20 20 20 20 20  20 4d 4f 56 20 20 20 20  |.        MOV    |
00000d70  20 72 32 2c 23 30 0d 06  72 1a 2e 64 69 76 32 20  | r2,#0..r..div2 |
00000d80  20 20 43 4d 50 20 20 20  20 20 72 30 2c 72 31 34  |  CMP     r0,r14|
00000d90  0d 06 7c 1d 20 20 20 20  20 20 20 20 53 55 42 43  |..|.        SUBC|
00000da0  53 20 20 20 72 30 2c 72  30 2c 72 31 34 0d 06 86  |S   r0,r0,r14...|
00000db0  1c 20 20 20 20 20 20 20  20 41 44 43 20 20 20 20  |.        ADC    |
00000dc0  20 72 32 2c 72 32 2c 72  32 0d 06 90 22 20 20 20  | r2,r2,r2..."   |
00000dd0  20 20 20 20 20 4d 4f 56  20 20 20 20 20 72 31 34  |     MOV     r14|
00000de0  2c 72 31 34 2c 4c 53 52  20 23 31 0d 06 9a 1a 20  |,r14,LSR #1.... |
00000df0  20 20 20 20 20 20 20 43  4d 50 20 20 20 20 20 72  |       CMP     r|
00000e00  31 34 2c 72 31 0d 06 a4  18 20 20 20 20 20 20 20  |14,r1....       |
00000e10  20 42 43 53 20 20 20 20  20 64 69 76 32 0d 06 ae  | BCS     div2...|
00000e20  1d 20 20 20 20 20 20 20  20 54 53 54 20 20 20 20  |.        TST    |
00000e30  20 72 33 2c 23 31 3c 3c  33 31 0d 06 b8 1c 20 20  | r3,#1<<31....  |
00000e40  20 20 20 20 20 20 52 53  42 4e 45 20 20 20 72 32  |      RSBNE   r2|
00000e50  2c 72 32 2c 23 30 0d 06  c2 21 20 20 20 20 20 20  |,r2,#0...!      |
00000e60  20 20 4c 44 4d 46 44 20  20 20 28 73 70 29 21 2c  |  LDMFD   (sp)!,|
00000e70  7b 72 33 2c 70 63 7d 0d  06 cc 05 5d 0d 06 d6 13  |{r3,pc}....]....|
00000e80  f2 61 73 73 65 6d 62 6c  65 5f 64 65 62 75 67 0d  |.assemble_debug.|
00000e90  06 e0 0b ed 20 70 61 73  73 25 0d 06 ea 2a c8 99  |.... pass%...*..|
00000ea0  20 22 4f 53 5f 46 69 6c  65 22 2c 31 30 2c 22 42  | "OS_File",10,"B|
00000eb0  41 55 33 44 22 2c 26 46  46 41 2c 2c 63 6f 64 65  |AU3D",&FFA,,code|
00000ec0  25 2c 4f 25 0d 06 f4 05  e0 0d 06 fe 05 3a 0d 07  |%,O%.........:..|
00000ed0  08 13 dd 20 a4 74 61 62  6c 65 28 73 69 7a 65 25  |... .table(size%|
00000ee0  29 0d 07 12 0d 50 25 2b  3d 73 69 7a 65 25 0d 07  |)....P%+=size%..|
00000ef0  1c 0d 4f 25 2b 3d 73 69  7a 65 25 0d 07 26 06 3d  |..O%+=size%..&.=|
00000f00  30 0d 07 30 05 3a 0d 07  3a 10 dd 20 a4 73 77 61  |0..0.:..:.. .swa|
00000f10  70 28 61 2c 62 29 0d 07  44 0e 5b 4f 50 54 20 70  |p(a,b)..D.[OPT p|
00000f20  61 73 73 25 0d 07 4e 17  20 20 20 20 20 20 20 20  |ass%..N.        |
00000f30  82 20 20 20 20 20 61 2c  61 2c 62 0d 07 58 17 20  |.     a,a,b..X. |
00000f40  20 20 20 20 20 20 20 82  20 20 20 20 20 62 2c 61  |       .     b,a|
00000f50  2c 62 0d 07 62 17 20 20  20 20 20 20 20 20 82 20  |,b..b.        . |
00000f60  20 20 20 20 61 2c 61 2c  62 0d 07 6c 05 5d 0d 07  |    a,a,b..l.]..|
00000f70  76 06 3d 30 0d 07 80 05  3a 0d 07 8a 14 dd 20 a4  |v.=0....:..... .|
00000f80  61 64 72 6c 28 72 65 67  2c 6f 66 66 29 0d 07 94  |adrl(reg,off)...|
00000f90  0e 5b 4f 50 54 20 70 61  73 73 25 0d 07 9e 27 20  |.[OPT pass%...' |
00000fa0  20 20 20 20 20 20 20 41  44 44 20 20 20 20 20 72  |       ADD     r|
00000fb0  65 67 2c 77 70 2c 23 28  6f 66 66 20 80 20 26 46  |eg,wp,#(off . &F|
00000fc0  46 29 0d 07 a8 2a 20 20  20 20 20 20 20 20 41 44  |F)...*        AD|
00000fd0  44 20 20 20 20 20 72 65  67 2c 72 65 67 2c 23 28  |D     reg,reg,#(|
00000fe0  6f 66 66 20 80 20 26 46  46 30 30 29 0d 07 b2 05  |off . &FF00)....|
00000ff0  5d 0d 07 bc 06 3d 30 0d  07 c6 05 3a 0d 07 d0 16  |]....=0....:....|
00001000  dd 20 a4 61 64 72 65 71  6c 28 72 65 67 2c 6f 66  |. .adreql(reg,of|
00001010  66 29 0d 07 da 0e 5b 4f  50 54 20 70 61 73 73 25  |f)....[OPT pass%|
00001020  0d 07 e4 27 20 20 20 20  20 20 20 20 41 44 44 45  |...'        ADDE|
00001030  51 20 20 20 72 65 67 2c  77 70 2c 23 28 6f 66 66  |Q   reg,wp,#(off|
00001040  20 80 20 26 46 46 29 0d  07 ee 2a 20 20 20 20 20  | . &FF)...*     |
00001050  20 20 20 41 44 44 45 51  20 20 20 72 65 67 2c 72  |   ADDEQ   reg,r|
00001060  65 67 2c 23 28 6f 66 66  20 80 20 26 46 46 30 30  |eg,#(off . &FF00|
00001070  29 0d 07 f8 05 5d 0d 08  02 06 3d 30 0d 08 0c 05  |)....]....=0....|
00001080  3a 0d 08 16 0e dd 20 a4  77 6b 28 72 65 71 29 0d  |:..... .wk(req).|
00001090  08 20 0b 77 6b 2b 3d 72  65 71 0d 08 2a 0b 3d 77  |. .wk+=req..*.=w|
000010a0  6b 2d 72 65 71 0d 08 34  05 3a 0d 08 3e 0d dd 20  |k-req..4.:..>.. |
000010b0  a4 6c 63 28 61 24 29 0d  08 48 0c ea 20 62 24 2c  |.lc(a$)..H.. b$,|
000010c0  69 2c 63 0d 08 52 11 e3  20 69 3d 31 20 b8 20 a9  |i,c..R.. i=1 . .|
000010d0  28 61 24 29 0d 08 5c 0e  20 63 3d 97 c1 61 24 2c  |(a$)..\. c=..a$,|
000010e0  69 29 0d 08 66 1e 20 e7  20 63 3e 3d 97 22 41 22  |i)..f. . c>=."A"|
000010f0  20 80 20 63 3c 3d 97 22  5a 22 20 63 2b 3d 33 32  | . c<=."Z" c+=32|
00001100  0d 08 70 0b 20 62 24 2b  3d bd 63 0d 08 7a 05 ed  |..p. b$+=.c..z..|
00001110  0d 08 84 07 3d 62 24 0d  08 8e 05 3a 0d 08 98 17  |....=b$....:....|
00001120  dd 20 a4 61 73 73 65 72  74 28 61 24 29 3a f4 20  |. .assert(a$):. |
00001130  2a 2a 2a 0d 08 a2 36 e7  20 70 61 73 73 25 3e 34  |***...6. pass%>4|
00001140  20 8c 20 e7 20 ac 20 a0  28 61 24 29 20 f1 22 41  | . . . .(a$) ."A|
00001150  73 73 65 72 74 69 6f 6e  20 27 22 61 24 22 27 20  |ssertion '"a$"' |
00001160  66 61 69 6c 65 64 22 3a  e0 0d 08 ac 06 3d 30 0d  |failed":.....=0.|
00001170  08 b6 05 3a 0d 08 c0 4e  f4 20 2a 2a 2a 2a 2a 2a  |...:...N. ******|
00001180  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
000011c0  2a 2a 0d 08 ca 0d f4 20  46 4e 64 65 62 75 67 0d  |**..... FNdebug.|
000011d0  08 d4 3a f4 20 53 6f 6d  65 77 68 65 72 65 20 69  |..:. Somewhere i|
000011e0  6e 20 79 6f 75 72 20 70  72 6f 67 72 61 6d 20 69  |n your program i|
000011f0  6e 63 6c 75 64 65 20 50  52 4f 43 61 73 73 65 6d  |nclude PROCassem|
00001200  62 6c 65 5f 64 65 62 75  67 0d 08 de 2d f4 20 53  |ble_debug...-. S|
00001210  65 74 20 74 68 65 20 76  61 72 69 61 62 6c 65 20  |et the variable |
00001220  64 65 62 75 67 20 74 6f  20 54 52 55 45 20 6f 72  |debug to TRUE or|
00001230  20 46 41 4c 53 45 0d 08  e8 48 f4 20 49 46 20 64  | FALSE...H. IF d|
00001240  65 62 75 67 3d 46 41 4c  53 45 20 74 68 65 6e 20  |ebug=FALSE then |
00001250  46 4e 64 65 62 75 67 20  77 69 6c 6c 20 64 6f 20  |FNdebug will do |
00001260  6e 6f 74 68 69 6e 67 20  61 6e 64 20 50 52 4f 43  |nothing and PROC|
00001270  61 73 73 65 6d 62 6c 65  5f 64 65 62 75 67 0d 08  |assemble_debug..|
00001280  f2 1c f4 20 77 69 6c 6c  20 61 73 73 65 6d 62 6c  |... will assembl|
00001290  65 20 6e 6f 20 63 6f 64  65 2e 0d 08 fc 18 f4 20  |e no code...... |
000012a0  49 46 20 64 65 62 75 67  3d 54 52 55 45 20 74 68  |IF debug=TRUE th|
000012b0  65 6e 0d 09 06 35 f4 20  50 61 73 73 20 61 20 73  |en...5. Pass a s|
000012c0  74 72 69 6e 67 20 74 6f  20 46 4e 64 65 62 75 67  |tring to FNdebug|
000012d0  20 61 6e 64 20 69 74 20  77 69 6c 6c 20 62 65 20  | and it will be |
000012e0  70 72 69 6e 74 65 64 0d  09 10 38 f4 20 41 6e 79  |printed...8. Any|
000012f0  20 6f 63 63 75 72 72 65  6e 63 65 73 20 6f 66 20  | occurrences of |
00001300  5c 3c 63 6f 6d 6d 61 6e  64 3e 5c 20 77 69 6c 6c  |\<command>\ will|
00001310  20 62 65 20 69 6e 74 65  72 70 72 65 74 65 64 0d  | be interpreted.|
00001320  09 1a 13 f4 20 5c 5c 20  2d 20 70 72 69 6e 74 73  |.... \\ - prints|
00001330  20 5c 0d 09 24 3f f4 20  5c 3c 72 65 67 69 73 74  | \..$?. \<regist|
00001340  65 72 20 61 6c 69 61 73  3e 5c 20 2d 20 70 72 69  |er alias>\ - pri|
00001350  6e 74 73 20 74 68 65 20  72 65 67 69 73 74 65 72  |nts the register|
00001360  20 76 61 6c 75 65 20 69  6e 20 64 65 63 69 6d 61  | value in decima|
00001370  6c 0d 09 2e 3c f4 20 5c  26 3c 72 65 67 69 73 74  |l...<. \&<regist|
00001380  65 72 20 61 6c 69 61 73  3e 5c 20 2d 20 70 72 69  |er alias>\ - pri|
00001390  6e 74 73 20 74 68 65 20  72 65 67 69 73 74 65 72  |nts the register|
000013a0  20 76 61 6c 75 65 20 69  6e 20 68 65 78 0d 09 38  | value in hex..8|
000013b0  3d f4 20 5c 24 3c 72 65  67 69 73 74 65 72 20 61  |=. \$<register a|
000013c0  6c 69 61 73 3e 5c 20 2d  20 70 72 69 6e 74 73 20  |lias>\ - prints |
000013d0  74 68 65 20 6e 75 6c 6c  20 74 65 72 6d 69 6e 61  |the null termina|
000013e0  74 65 64 20 73 74 72 69  6e 67 0d 09 42 23 f4 20  |ted string..B#. |
000013f0  5c 6e 5c 20 6f 72 20 5c  4e 5c 20 2d 20 70 72 69  |\n\ or \N\ - pri|
00001400  6e 74 73 20 61 20 6e 65  77 6c 69 6e 65 0d 09 4c  |nts a newline..L|
00001410  05 f4 0d 09 56 3f f4 20  46 4e 64 65 62 75 67 20  |....V?. FNdebug |
00001420  70 72 65 73 65 72 76 65  73 20 61 6c 6c 20 72 65  |preserves all re|
00001430  67 69 73 74 65 72 73 20  28 69 6e 63 6c 75 64 69  |gisters (includi|
00001440  6e 67 20 52 31 34 29 20  61 6e 64 20 66 6c 61 67  |ng R14) and flag|
00001450  73 0d 09 60 27 f4 20 28  4a 75 73 74 20 75 73 65  |s..`'. (Just use|
00001460  73 20 61 20 62 69 74 20  6f 66 20 73 74 61 63 6b  |s a bit of stack|
00001470  20 73 70 61 63 65 21 29  0d 09 6a 36 f4 20 43 61  | space!)..j6. Ca|
00001480  6e 20 62 65 20 75 73 65  64 20 69 6e 20 55 53 52  |n be used in USR|
00001490  20 6f 72 20 53 56 43 20  6d 6f 64 65 20 28 6e 6f  | or SVC mode (no|
000014a0  74 20 63 68 65 63 6b 65  64 20 66 6f 72 29 0d 09  |t checked for)..|
000014b0  74 4e f4 20 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |tN. ************|
000014c0  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
000014f0  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 0d 09 7e 04  |************..~.|
00001500  0d 09 88 04 0d 09 92 45  f4 20 54 68 69 73 20 69  |.......E. This i|
00001510  73 20 73 6f 20 79 6f 75  20 63 61 6e 20 63 61 6c  |s so you can cal|
00001520  6c 20 61 73 73 65 6d 62  6c 65 5f 64 65 62 75 67  |l assemble_debug|
00001530  20 61 66 74 65 72 20 46  6e 64 65 62 75 67 20 69  | after Fndebug i|
00001540  66 20 64 65 73 69 72 65  64 0d 09 9c 16 dd 20 f2  |f desired..... .|
00001550  64 65 62 75 67 5f 63 6f  6e 73 74 61 6e 74 73 0d  |debug_constants.|
00001560  09 a6 25 64 65 62 75 67  5f 64 65 63 69 6d 61 6c  |..%debug_decimal|
00001570  20 3d 20 31 32 38 20 84  20 28 25 30 30 30 20 3c  | = 128 . (%000 <|
00001580  3c 20 34 29 0d 09 b0 25  64 65 62 75 67 5f 68 65  |< 4)...%debug_he|
00001590  78 20 20 20 20 20 3d 20  31 32 38 20 84 20 28 25  |x     = 128 . (%|
000015a0  30 30 31 20 3c 3c 20 34  29 0d 09 ba 25 64 65 62  |001 << 4)...%deb|
000015b0  75 67 5f 73 74 72 69 6e  67 20 20 3d 20 31 32 38  |ug_string  = 128|
000015c0  20 84 20 28 25 30 31 30  20 3c 3c 20 34 29 0d 09  | . (%010 << 4)..|
000015d0  c4 05 e1 0d 09 ce 04 0d  09 d8 15 dd 20 f2 61 73  |............ .as|
000015e0  73 65 6d 62 6c 65 5f 64  65 62 75 67 0d 09 e2 11  |semble_debug....|
000015f0  e7 20 ac 20 64 65 62 75  67 20 8c 20 e1 0d 09 ec  |. . debug . ....|
00001600  14 f2 64 65 62 75 67 5f  63 6f 6e 73 74 61 6e 74  |..debug_constant|
00001610  73 0d 09 f6 0e 5b 4f 50  54 20 70 61 73 73 25 0d  |s....[OPT pass%.|
00001620  0a 00 0b 2e 64 65 62 75  67 5f 0d 0a 0a 50 53 54  |....debug_...PST|
00001630  4d 46 44 20 52 31 33 21  2c 7b 52 30 2d 52 31 33  |MFD R13!,{R0-R13|
00001640  7d 20 20 20 20 20 20 20  20 3b 73 74 6f 72 65 20  |}        ;store |
00001650  61 6c 6c 20 74 68 65 20  72 65 67 69 73 74 65 72  |all the register|
00001660  73 20 52 31 34 2c 52 31  35 20 61 6c 72 65 61 64  |s R14,R15 alread|
00001670  79 20 6f 6e 20 73 74 61  63 6b 0d 0a 14 37 80 20  |y on stack...7. |
00001680  52 31 30 2c 52 31 34 2c  23 26 46 43 30 30 30 30  |R10,R14,#&FC0000|
00001690  30 33 20 20 20 20 20 3b  52 31 30 20 68 6f 6c 64  |03     ;R10 hold|
000016a0  73 20 70 72 6f 63 65 73  73 6f 72 20 66 6c 61 67  |s processor flag|
000016b0  73 0d 0a 1e 42 42 49 43  20 52 39 2c 52 31 34 2c  |s...BBIC R9,R14,|
000016c0  23 26 46 43 30 30 30 30  30 33 20 20 20 20 20 20  |#&FC000003      |
000016d0  3b 52 39 20 69 73 20 73  74 72 69 6e 67 20 70 6f  |;R9 is string po|
000016e0  69 6e 74 65 72 20 77 69  74 68 20 6e 6f 20 66 6c  |inter with no fl|
000016f0  61 67 73 0d 0a 28 0e 2e  64 65 62 75 67 6c 6f 6f  |ags..(..debugloo|
00001700  70 0d 0a 32 13 4c 44 52  42 20 52 30 2c 5b 52 39  |p..2.LDRB R0,[R9|
00001710  5d 2c 23 31 0d 0a 3c 0d  43 4d 50 20 52 30 2c 23  |],#1..<.CMP R0,#|
00001720  30 0d 0a 46 11 42 45 51  20 64 65 62 75 67 64 6f  |0..F.BEQ debugdo|
00001730  6e 65 0d 0a 50 0f 43 4d  50 20 52 30 2c 23 31 32  |ne..P.CMP R0,#12|
00001740  38 0d 0a 5a 15 53 57 49  4c 54 20 22 4f 53 5f 57  |8..Z.SWILT "OS_W|
00001750  72 69 74 65 43 22 0d 0a  64 11 42 4c 54 20 64 65  |riteC"..d.BLT de|
00001760  62 75 67 6c 6f 6f 70 0d  0a 6e 16 80 20 52 38 2c  |bugloop..n.. R8,|
00001770  52 30 2c 23 25 30 31 31  31 30 30 30 30 0d 0a 78  |R0,#%01110000..x|
00001780  16 80 20 52 30 2c 52 30  2c 23 25 30 30 30 30 31  |.. R0,R0,#%00001|
00001790  31 31 31 0d 0a 82 1a 4c  44 52 20 52 30 2c 5b 52  |111....LDR R0,[R|
000017a0  31 33 2c 52 30 2c 4c 53  4c 20 23 32 5d 0d 0a 8c  |13,R0,LSL #2]...|
000017b0  17 41 44 44 20 50 43 2c  50 43 2c 52 38 2c 4c 53  |.ADD PC,PC,R8,LS|
000017c0  52 20 23 32 0d 0a 96 09  44 43 44 20 30 0d 0a a0  |R #2....DCD 0...|
000017d0  18 42 20 64 65 62 75 67  5f 74 79 70 65 5f 64 65  |.B debug_type_de|
000017e0  63 69 6d 61 6c 0d 0a aa  14 42 20 64 65 62 75 67  |cimal....B debug|
000017f0  5f 74 79 70 65 5f 68 65  78 0d 0a b4 17 42 20 64  |_type_hex....B d|
00001800  65 62 75 67 5f 74 79 70  65 5f 73 74 72 69 6e 67  |ebug_type_string|
00001810  0d 0a be 13 42 20 64 65  62 75 67 5f 74 79 70 65  |....B debug_type|
00001820  30 31 31 0d 0a c8 13 42  20 64 65 62 75 67 5f 74  |011....B debug_t|
00001830  79 70 65 31 30 30 0d 0a  d2 13 42 20 64 65 62 75  |ype100....B debu|
00001840  67 5f 74 79 70 65 31 30  31 0d 0a dc 13 42 20 64  |g_type101....B d|
00001850  65 62 75 67 5f 74 79 70  65 31 31 30 0d 0a e6 13  |ebug_type110....|
00001860  42 20 64 65 62 75 67 5f  74 79 70 65 31 31 31 0d  |B debug_type111.|
00001870  0a f0 0e 2e 64 65 62 75  67 64 6f 6e 65 0d 0a fa  |....debugdone...|
00001880  10 41 44 44 20 52 39 2c  52 39 2c 23 33 0d 0b 04  |.ADD R9,R9,#3...|
00001890  38 42 49 43 20 52 39 2c  52 39 2c 23 33 20 20 20  |8BIC R9,R9,#3   |
000018a0  20 20 20 20 20 20 20 20  20 3b 61 6c 69 67 6e 20  |         ;align |
000018b0  52 39 20 66 6f 72 20 72  65 74 75 72 6e 20 61 64  |R9 for return ad|
000018c0  64 72 65 73 73 0d 0b 0e  3a 84 52 20 52 31 34 2c  |dress...:.R R14,|
000018d0  52 31 30 2c 52 39 20 20  20 20 20 20 20 20 20 20  |R10,R9          |
000018e0  3b 67 6c 75 65 20 66 6c  61 67 73 20 6f 6e 74 6f  |;glue flags onto|
000018f0  20 72 65 74 75 72 6e 20  61 64 64 72 65 73 73 0d  | return address.|
00001900  0b 18 2e 4c 44 4d 46 44  20 52 31 33 21 2c 7b 52  |...LDMFD R13!,{R|
00001910  30 2d 52 31 32 7d 20 20  20 20 20 3b 72 65 73 74  |0-R12}     ;rest|
00001920  6f 72 65 20 72 65 67 69  73 74 65 72 73 0d 0b 22  |ore registers.."|
00001930  25 41 44 44 20 52 31 33  2c 52 31 33 2c 23 34 20  |%ADD R13,R13,#4 |
00001940  20 20 20 20 20 20 20 20  20 3b 64 72 6f 70 20 52  |         ;drop R|
00001950  31 33 0d 0b 2c 38 4d 4f  56 53 20 50 43 2c 52 31  |13..,8MOVS PC,R1|
00001960  34 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 72  |4             ;r|
00001970  65 74 75 72 6e 20 77 69  74 68 20 66 6c 61 67 73  |eturn with flags|
00001980  20 75 6e 63 68 61 6e 67  65 64 0d 0b 36 05 3a 0d  | unchanged..6.:.|
00001990  0b 40 12 2e 64 65 62 75  67 5f 74 79 70 65 30 31  |.@..debug_type01|
000019a0  31 0d 0b 4a 12 2e 64 65  62 75 67 5f 74 79 70 65  |1..J..debug_type|
000019b0  31 30 30 0d 0b 54 12 2e  64 65 62 75 67 5f 74 79  |100..T..debug_ty|
000019c0  70 65 31 30 31 0d 0b 5e  12 2e 64 65 62 75 67 5f  |pe101..^..debug_|
000019d0  74 79 70 65 31 31 30 0d  0b 68 12 2e 64 65 62 75  |type110..h..debu|
000019e0  67 5f 74 79 70 65 31 31  31 0d 0b 72 0f 42 20 64  |g_type111..r.B d|
000019f0  65 62 75 67 6c 6f 6f 70  0d 0b 7c 05 3a 0d 0b 86  |ebugloop..|.:...|
00001a00  17 2e 64 65 62 75 67 5f  74 79 70 65 5f 64 65 63  |..debug_type_dec|
00001a10  69 6d 61 6c 0d 0b 90 16  41 44 52 20 52 31 2c 64  |imal....ADR R1,d|
00001a20  65 62 75 67 6e 75 6d 62  75 66 0d 0b 9a 0e 4d 4f  |ebugnumbuf....MO|
00001a30  56 20 52 32 2c 23 31 36  0d 0b a4 1c 53 57 49 20  |V R2,#16....SWI |
00001a40  22 4f 53 5f 43 6f 6e 76  65 72 74 49 6e 74 65 67  |"OS_ConvertInteg|
00001a50  65 72 34 22 0d 0b ae 13  53 57 49 20 22 4f 53 5f  |er4"....SWI "OS_|
00001a60  57 72 69 74 65 30 22 0d  0b b8 0f 42 20 64 65 62  |Write0"....B deb|
00001a70  75 67 6c 6f 6f 70 0d 0b  c2 05 3a 0d 0b cc 13 2e  |ugloop....:.....|
00001a80  64 65 62 75 67 5f 74 79  70 65 5f 68 65 78 0d 0b  |debug_type_hex..|
00001a90  d6 16 41 44 52 20 52 31  2c 64 65 62 75 67 6e 75  |..ADR R1,debugnu|
00001aa0  6d 62 75 66 0d 0b e0 0e  4d 4f 56 20 52 32 2c 23  |mbuf....MOV R2,#|
00001ab0  31 36 0d 0b ea 18 53 57  49 20 22 4f 53 5f 43 6f  |16....SWI "OS_Co|
00001ac0  6e 76 65 72 74 48 65 78  38 22 0d 0b f4 13 53 57  |nvertHex8"....SW|
00001ad0  49 20 22 4f 53 5f 57 72  69 74 65 30 22 0d 0b fe  |I "OS_Write0"...|
00001ae0  0f 42 20 64 65 62 75 67  6c 6f 6f 70 0d 0c 08 05  |.B debugloop....|
00001af0  3a 0d 0c 12 16 2e 64 65  62 75 67 5f 74 79 70 65  |:.....debug_type|
00001b00  5f 73 74 72 69 6e 67 0d  0c 1c 0d 6d 6f 76 20 72  |_string....mov r|
00001b10  34 2c 72 30 0d 0c 26 15  2e 64 65 62 75 67 5f 73  |4,r0..&..debug_s|
00001b20  74 72 69 6e 67 6c 6f 6f  70 0d 0c 30 13 6c 64 72  |tringloop..0.ldr|
00001b30  62 20 72 30 2c 5b 72 34  5d 2c 23 31 0d 0c 3a 0d  |b r0,[r4],#1..:.|
00001b40  63 6d 70 20 72 30 2c 23  30 0d 0c 44 11 62 65 71  |cmp r0,#0..D.beq|
00001b50  20 64 65 62 75 67 6c 6f  6f 70 0d 0c 4e 0e 63 6d  | debugloop..N.cm|
00001b60  70 20 72 30 2c 23 33 32  0d 0c 58 13 62 6c 74 20  |p r0,#32..X.blt |
00001b70  64 65 62 75 67 73 74 72  68 65 78 0d 0c 62 0f 63  |debugstrhex..b.c|
00001b80  6d 70 20 72 30 2c 23 31  32 37 0d 0c 6c 13 62 65  |mp r0,#127..l.be|
00001b90  71 20 64 65 62 75 67 73  74 72 68 65 78 0d 0c 76  |q debugstrhex..v|
00001ba0  13 73 77 69 20 22 4f 53  5f 57 72 69 74 65 43 22  |.swi "OS_WriteC"|
00001bb0  0d 0c 80 16 62 20 64 65  62 75 67 5f 73 74 72 69  |....b debug_stri|
00001bc0  6e 67 6c 6f 6f 70 0d 0c  8a 04 0d 0c 94 10 2e 64  |ngloop.........d|
00001bd0  65 62 75 67 73 74 72 68  65 78 0d 0c 9e 10 73 77  |ebugstrhex....sw|
00001be0  69 20 32 35 36 2b 97 22  5b 22 0d 0c a8 16 41 44  |i 256+."["....AD|
00001bf0  52 20 52 31 2c 64 65 62  75 67 6e 75 6d 62 75 66  |R R1,debugnumbuf|
00001c00  0d 0c b2 0e 4d 4f 56 20  52 32 2c 23 31 36 0d 0c  |....MOV R2,#16..|
00001c10  bc 18 53 57 49 20 22 4f  53 5f 43 6f 6e 76 65 72  |..SWI "OS_Conver|
00001c20  74 48 65 78 32 22 0d 0c  c6 13 53 57 49 20 22 4f  |tHex2"....SWI "O|
00001c30  53 5f 57 72 69 74 65 30  22 0d 0c d0 10 73 77 69  |S_Write0"....swi|
00001c40  20 32 35 36 2b 97 22 5d  22 0d 0c da 16 62 20 64  | 256+."]"....b d|
00001c50  65 62 75 67 5f 73 74 72  69 6e 67 6c 6f 6f 70 0d  |ebug_stringloop.|
00001c60  0c e4 05 3a 0d 0c ee 10  2e 64 65 62 75 67 6e 75  |...:.....debugnu|
00001c70  6d 62 75 66 0d 0c f8 1f  45 51 55 44 20 30 3a 45  |mbuf....EQUD 0:E|
00001c80  51 55 44 20 30 3a 45 51  55 44 20 30 3a 45 51 55  |QUD 0:EQUD 0:EQU|
00001c90  44 20 30 0d 0d 02 05 5d  0d 0d 0c 05 e1 0d 0d 16  |D 0....]........|
00001ca0  04 0d 0d 20 04 0d 0d 2a  12 dd 20 a4 64 65 62 75  |... ...*.. .debu|
00001cb0  67 28 73 74 72 24 29 0d  0d 34 11 ea 20 62 61 73  |g(str$)..4.. bas|
00001cc0  65 2c 61 2c 62 2c 61 24  0d 0d 3e 13 e7 20 ac 20  |e,a,b,a$..>.. . |
00001cd0  64 65 62 75 67 20 8c 20  3d 22 22 0d 0d 48 14 f2  |debug . =""..H..|
00001ce0  64 65 62 75 67 5f 63 6f  6e 73 74 61 6e 74 73 0d  |debug_constants.|
00001cf0  0d 52 0e 5b 4f 50 54 20  70 61 73 73 25 0d 0d 5c  |.R.[OPT pass%..\|
00001d00  43 53 54 4d 46 44 20 52  31 33 20 21 2c 7b 52 31  |CSTMFD R13 !,{R1|
00001d10  34 2c 52 31 35 7d 20 20  3b 53 61 76 65 20 52 31  |4,R15}  ;Save R1|
00001d20  34 20 66 6f 72 20 6c 61  74 65 72 20 61 6e 64 20  |4 for later and |
00001d30  52 31 35 20 66 6f 72 20  70 72 69 6e 74 6f 75 74  |R15 for printout|
00001d40  0d 0d 66 0d 42 4c 20 64  65 62 75 67 5f 0d 0d 70  |..f.BL debug_..p|
00001d50  05 5d 0d 0d 7a 13 c8 95  20 a7 73 74 72 24 2c 22  |.]..z... .str$,"|
00001d60  5c 22 29 3e 30 0d 0d 84  11 20 61 3d a7 73 74 72  |\")>0.... a=.str|
00001d70  24 2c 22 5c 22 29 0d 0d  8e 19 20 62 3d a7 73 74  |$,"\").... b=.st|
00001d80  72 24 2c 22 5c 22 2c 61  2b 31 29 2d 61 2d 31 0d  |r$,"\",a+1)-a-1.|
00001d90  0d 98 14 20 61 24 3d c1  73 74 72 24 2c 61 2b 31  |... a$=.str$,a+1|
00001da0  2c 62 29 0d 0d a2 0c 20  c8 8e 20 61 24 20 ca 0d  |,b).... .. a$ ..|
00001db0  0d ac 24 20 20 c9 20 22  22 20 3a 73 74 72 24 3d  |..$  . "" :str$=|
00001dc0  c0 73 74 72 24 2c 61 29  2b c1 73 74 72 24 2c 61  |.str$,a)+.str$,a|
00001dd0  2b 32 29 0d 0d b6 34 20  20 c9 20 22 6e 22 2c 22  |+2)...4  . "n","|
00001de0  4e 22 20 3a 20 73 74 72  24 3d c0 73 74 72 24 2c  |N" : str$=.str$,|
00001df0  61 2d 31 29 2b bd 31 33  2b bd 31 30 2b c1 73 74  |a-1)+.13+.10+.st|
00001e00  72 24 2c 61 2b 33 29 0d  0d c0 08 20 20 7f 3a 0d  |r$,a+3)....  .:.|
00001e10  0d ca 12 20 20 20 c8 8e  20 c0 61 24 2c 31 29 20  |...   .. .a$,1) |
00001e20  ca 0d 0d d4 29 20 20 20  20 20 c9 20 22 26 22 3a  |....)     . "&":|
00001e30  20 62 61 73 65 3d 64 65  62 75 67 5f 68 65 78 3a  | base=debug_hex:|
00001e40  20 61 24 3d c1 61 24 2c  32 29 0d 0d de 2c 20 20  | a$=.a$,2)...,  |
00001e50  20 20 20 c9 20 22 24 22  3a 20 62 61 73 65 3d 64  |   . "$": base=d|
00001e60  65 62 75 67 5f 73 74 72  69 6e 67 3a 20 61 24 3d  |ebug_string: a$=|
00001e70  c1 61 24 2c 32 29 0d 0d  e8 1e 20 20 20 20 20 7f  |.a$,2)....     .|
00001e80  3a 20 62 61 73 65 3d 64  65 62 75 67 5f 64 65 63  |: base=debug_dec|
00001e90  69 6d 61 6c 0d 0d f2 08  20 20 20 cb 0d 0d fc 31  |imal....   ....1|
00001ea0  20 20 20 73 74 72 24 3d  c0 73 74 72 24 2c 61 2d  |   str$=.str$,a-|
00001eb0  31 29 2b bd 28 62 61 73  65 20 84 20 a0 61 24 29  |1)+.(base . .a$)|
00001ec0  2b c1 73 74 72 24 2c 61  2b 62 2b 32 29 0d 0e 06  |+.str$,a+b+2)...|
00001ed0  06 20 cb 0d 0e 10 05 ce  0d 0e 1a 0e 5b 4f 50 54  |. ..........[OPT|
00001ee0  20 70 61 73 73 25 0d 0e  24 0e 20 45 51 55 53 20  | pass%..$. EQUS |
00001ef0  73 74 72 24 0d 0e 2e 0b  20 45 51 55 42 20 30 0d  |str$.... EQUB 0.|
00001f00  0e 38 0a 20 41 4c 49 47  4e 0d 0e 42 24 20 4c 44  |.8. ALIGN..B$ LD|
00001f10  4d 46 44 20 52 31 33 20  21 2c 7b 52 31 34 7d 20  |MFD R13 !,{R14} |
00001f20  20 3b 72 65 73 74 6f 72  65 20 52 31 34 0d 0e 4c  | ;restore R14..L|
00001f30  21 20 41 44 44 20 52 31  33 2c 52 31 33 2c 23 34  |! ADD R13,R13,#4|
00001f40  20 20 20 20 20 3b 64 72  6f 70 20 52 31 35 0d 0e  |     ;drop R15..|
00001f50  56 05 5d 0d 0e 60 07 3d  22 22 0d ff              |V.]..`.=""..|
00001f5c