Home » Personal collection » Acorn hard disk » unzip_tools » !Infozip » Source/codesource

Source/codesource

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 » Personal collection » Acorn hard disk » unzip_tools » !Infozip
Filename: Source/codesource
Read OK:
File size: 3444 bytes
Load address: 0000
Exec address: 0000
File contents
    1REM StrongED$mode = BasAsm
    2ON ERROR: ON ERROR OFF: PRINT REPORT$;" at line ";ERL:CLOSE#handle%:END
    3
    4LIBRARY "<Infozip$Dir>.SHeap.SHeap"
    5LIBRARY "<Reporter$Dir>.AsmLib"
    6
    7PROCReportInit(10)
    8
    9PROCinitheaps(128,128)
   10icon_names%=FNcreate_anchor("icon names")
   11icon_index%=FNcreate_anchor("icon index")
   12
   13DIM block% 255,wimp% 700
   14
   15
   16*Key 1 Continue|MY
   17*ReportClear
   18REM *BreakClr
   19PROCassemble(1600)
   20REM SYS"OS_File",10,"<Infozip$Dir>.Resources.code",&FFD,,ourcode%,P%
   21REM stuff for testing
   22handle%=OPENIN"RAM:CAT"
   23
   24PROCtest(handle%,ourcode%)
   25CLOSE#handle%
   26
   27END
   28
   29
   30
   31DEF PROCtest(in%,arrayscan%)
   32F%=EXT#in%/100
   33PROCextend_named_sliding_block(icon_names%,EXT#in%)
   34REM claim enough icon_names% space to hold the *whole file* - guaranteed to be enough
   35PROCextend_named_sliding_block(icon_index%,4*(EXT#in%/29))
   36REM claim icon_index% space by calculating no. of lines, at 29 bytes per line
   37REM (this is minimum possible length of line up to start of name)
   38REM allocate one word for pointer per line
   39REM (i.e. max possible icons if all in root)
   40name_ptr%=!icon_names%
   41index_ptr%=(!icon_index%)+8
   42index_start%=index_ptr%
   43maxlenptr%=(!icon_index%)
   44maxlenptr%!4=0
   45REM We will store no of files and length of longest name at start of block
   46max_icon_width%=0:REM reset
   47
   48no_of_files%=0
   49commonpath$="ScrapFile/*"
   50REM *ReportTrace On
   51PTR#in%=0
   52j$=GET$#in%
   53n%=BGET#in%
   54REPEAT
   55  a$=GET$#in%:n%=BGET#in%
   56UNTIL a$=" --------    ----   ----    ----"
   57filesize%=EXT#in%/100
   58H%=index_ptr%:REM set R7 to point to index block
   59G%=block%:REM set R6 to point to temporary buffer
   60B%=in%:REM set R1 to file handle
   61F%=filesize%:REM  set R5 to file size (DIV 100)
   62$wimp%=commonpath$:REM so we don't have to look it up again at every CALL
   63
   64arrayscan%!4=0:REM reset flag words
   65arrayscan%!8=0
   66REM PTR#i%=713:REM testing ONLY!!! - skip to given place in CAT file
   67PRINT~G%
   68  CALL arrayscan%,name_ptr%,wimp%,index_start%
   69  REM pass parameters:
   70  REM 1st - start of block in which to store pointers to names found
   71  REM 2nd - start of block holding "common path" string
   72  REM 3rd - start of output block into which to write names found
   73  REM R1,R5,R6 and R7 are also initialised with frequently-used values
   74PRINT j$
   75no_of_files%=arrayscan%!4
   76maxlenptr%!0=no_of_files%
   77PROCshow(no_of_files%)
   78max_icon_width%=maxlenptr%!4
   79IF no_of_files% PRINT"Longest name: ";$max_icon_width%
   80ENDPROC
   81
   82DEF PROCshow(element%)
   83LOCAL n%
   84PRINT element%;" files found"
   85IF element%=0 THEN ENDPROC
   86FOR n%=0 TO element%-1
   87PRINT":"+FNgetfakeleafname(n%,FALSE)
   88NEXT n%
   89ENDPROC
   90
   91DEF PROCassemble(size%)
   92LOCAL index%,buffer%
   93DIM ourcode% size%
   94L%=ourcode%+size%
   95index%=7
   96buffer%=6
   97lastctrlchar%=31:REM we aren't fussy about catalogue line terminators
   98REM implement two passes and set up
   99REM values for OPT at the same time
  100REM first pass - enable only range check
  101REM i.e. OPT 8
  102REM second pass - enable error report,
  103REM range check and listing, i.e. OPT 11
  104
  105
  106FOR pass% = 8 TO 10 STEP 2
  107 REM set P% to start of our code
  108 REM on each pass
  109 PROCReportStart(pass%)
  110 P% = ourcode%
  111 REM now invoke the assembler
  112 [OPT pass% ; set value of OPT as appropriate
  113 B getstartofline ;jump over reserved words at start of code
  114;.truefalse                  ;use this word as a flag on exit to indicate if a
  115; EQUD     0                 ;new entry needs to be made in root$(no_of_files%)
  116.num_found                  ;use this word to keep track of how many files
  117 EQUD     0                 ;are found and to pass the value back on exit
  118.maxlen
  119 EQUD     0                 ;length of longest name in OS units
  120;-------------------------------------------------------------------------------
  121.getstartofline
  122 SWI      "XOS_BGet"        ;get byte from file R1 into R0
  123 BCS      exit_and_die      ;exit routine on EOF error (penultimate line
  124                            ;contains no colon!)
  125 CMP      R0,#ASC(":")      ;check for colon
  126 BNE      getstartofline    ;skip all characters before colon
  127;(cannot use field widths - very large files are too wide to fit)
  128  MOV      R11,R6              ;point R11 to start of block%
  129.rest_of_line
  130 SWI      "OS_BGet"         ;get byte from file R1 into R0
  131 CMP      R0,#lastctrlchar%
  132 STRB     R0,[R11],#1        ;store byte in block%
  133 BGT      rest_of_line    ;store all characters up to end-of-line
  134
  135 ; $block% is now in format "mm   pathname"+["/"]+ctrlchar
  136 ; wimp% is in format "rootpath/*"+CR (because it comes from BASIC)
  137 ADD       R11,R6,#4    ;reload R11 with block%+4 (char before start of name)
  138
  139 LDR      R10,[R9,#8] ;address of second parameter
  140 LDR      R10,[R10]
  141 SUB      R10,R10,#1   ;point R10 to char before start of wimp% (commonpath$)
  142
  143.comparestrings
  144 LDRB     R2,[R11,#1]!      ;get byte from block% (R11 points to byte just loaded)
  145 LDRB     R3,[R10,#1]!     ;get byte from wimp% (R10 points to byte just loaded)
  146 CMP      R2,R3            ;Are the two strings equal so far?
  147 BEQ      comparestrings
  148
  149 STMFD    R13!,{0-12,14}
  150 BL       testtime         ;stack registers and call hourglass
  151 LDMFD    R13!,{0-12,14}
  152 CMP      R3,#ASC("*")      ;have we reached asterisk (end of commonpath$) then?
  153 BNE      getstartofline    ;if not, this file does not show up in fakefiler%
  154                            ;try the next line of input
  155
  156 CMP      R2,#lastctrlchar%  ; If we matched up to $nameblock% terminator,
  157                             ; then this is the commonpath directory itself
  158 BLE      getstartofline     ; - skip this line
  159;----------------scan contents of array-----------------------------------------
  160;Otherwise, scan root$ for this file/dir name
  161
  162  LDR       R0,[R9]          ;address of first parameter
  163  LDR       R3,[R0]          ;start of block holding pointers
  164  LDR       R10,num_found        ;no of entries already in block
  165  CMP       R10,#0
  166  BEQ       updateflag      ;if block is empty, we know this is a new entry
  167.getarrayentry
  168  LDR       R12,[R3],#4      ;load next pointer into R12
  169
  170                           ;R12 now points to start of actual array string
  171                           ;R11 still stores start of file/dir name
  172 MOV       R8,R11
  173;FNReport_TextS("\r current in block")
  174;FNReport_Text0(12)
  175;FNReport_TextS("\r searching for")
  176;FNReport_Text0(8)
  177;-----------------compare strings-----------------------------------------------
  178.scan
  179 LDRB      R0,[R12],#1
  180 LDRB      R2,[R8],#1
  181 CMP       R2,R0
  182 BEQ       scan             ;scan this element of array for file/dir name
  183
  184.check
  185
  186   ; check whether we have reached the end of the file/dir name...
  187   CMP     R0,#lastctrlchar% ; is char at end of old leafname a line terminator?
  188   LDRlsB   R2,[R8,#-2]
  189   CMPls    R2,#ASC("/")       ; if it is, then was the last matching char
  190; in the line being checked a slash,  i.e. have we found a duplicate directory?
  191   MOVeq     R10,#0            ; if so, this is a match -
  192                               ; ensure we exit loop early
  193;Note that *only* directories can be duplicate!
  194
  195 SUBS      R10,R10,#1     ;decrement counter
  196 BHI       getarrayentry  ;exit loop if string matched or if all entries checked
  197
  198.updateflag
  199 ;STR       R10,truefalse  ;R10 is -1 if match was made, else 0
  200 Bne       getstartofline ;if zero flag set, we scanned all entries but found no
  201                          ;match, so we need to copy the leafname into block%
  202                          ;and CR-terminate it.
  203                          ;Otherwise, we return to the start of the loop.
  204
  205;--------------copy file/dir name into block%-----------------------------------
  206  MOV       R2,#0           ;we are using R2 as a length counter
  207  LDR       R0,[R9,#16]     ;address of third parameter (name_ptr%)
  208  LDR       R10,[R0]        ;point to output block
  209
  210  STR       R10,[index%],#4 ;add this pointer to index of name pointers
  211  MOV       R8,R11          ;R11 still points to start of leafname
  212.leafname
  213 LDRB      R0,[R8],#1 
  214 CMP       R0,#ASC("/")   ; is char a slash?
  215 CMPne     R0,#lastctrlchar%
  216 ADD       R2,R2,#1         ;increment length counter
  217 STRB      R0,[R10],#1
  218 Bgt       leafname
  219
  220 MOV       R0,#&0D ; BBC BASIC $x strings must be CR terminated
  221 SUBmi     R10,R10,#1 ; minus flag here indicates CTRL-char found above
  222 ; in which case we want to *overwrite* CTRL-char with CR
  223 ; not add it after end of string
  224 SUBmi     R2,R2,#1; also decrement length counter (for system font string)
  225 STRB      R0,[R10],#1 ; terminate the string
  226 LDR       R3,[R9,#16]     ;address of third parameter (name_ptr%)
  227 STR       R10,[R3]        ;store the current position of the output pointer
  228                           ;back in here
  229 STMFD    R13!,{1,2,6,14} ; note R0 also corrupted
  230 BL measure_text
  231 LDMFD    R13!,{1,2,6,14} ;but don't restore R0 - we need the result in there!
  232
  233;-------------------------------------------------------------------------------
  234;During the following section, R2 holds length of filename found
  235;R10 points to output block (name_ptr%)
  236;R3 and R0 are available for use as temporary registers
  237;-------------------------------------------------------------------------------
  238
  239  LDR       R3,maxlen        ;we keep maximum length in here
  240  CMP       R3,R0            ;is it greater than old length?
  241  STRlt     R0,maxlen
  242  LDRlt     R0,[R9]          ;address of first parameter
  243  LDRlt     R0,[R0]          ;start of pointers block (index_ptr%!8)
  244  
  245  SUBlt     R10,R10,R2       ;R2 still holds length
  246  SUBlt     R10,R10,#1       ;so go back to start of string just output
  247  STRlt     R10,[R0,#-4]     ;and store it at index_ptr%!4
  248
  249
  250  LDR       R3,num_found    ;load no. of entries already in block
  251  ADD       R3,R3,#1       ;increment count
  252  STR       R3,num_found
  253B          getstartofline
  254MOV      R15, R14          ;exit routine
  255;---------------exit with error-------------------------------------------------
  256.exit_and_die
  257; MOV       R0,index%
  258; STR       R0,truefalse     ;signal error on exit
  259 MOV      R15, R14          ;exit routine
  260;================display hourglass with calculated percentage===================
  261.testtime
  262 SWI      "OS_ReadMonotonicTime"
  263
  264 TST      R0,#%1000
  265 MOVNE    R15, R14          ;return
  266                            ;don't call this long-winded routine every time
  267 MOV      R0,#0
  268 SWI      "OS_Args"         ;R1 holds file handle; PTR#i% returned into R2
  269 ;divide R2 by R5
  270 MOV       R3,#1
  271 ;set bit 0 in R3, which will be shifted left then right
  272 MOV      R0,#0
  273 ;clear R0 to accumulate result
  274 CMP      R5,#0:MOVEQ    PC,R14
  275 ;check for divide by zero
  276
  277.start
  278 CMP       R5,R2
  279 MOVCC     R5,R5,ASL#1
  280 MOVCC     R3,R3,ASL#1
  281 BCC       start
  282 ;shift R5 left until it is bigger than R2
  283 ;shift R3 left in parallel in order to flag how far we have to go
  284
  285.next
  286 CMP      R2,R5
  287 ;carry is set if R2>R5 (don't ask me why)
  288 SUBCS    R2,R2,R5
  289 ;subtract R5 from R2 if this would give a positive answer
  290 ADDCS    R0,R0,R3
  291 ;and add the current bit in R3 to the accumulating answer in R0
  292 MOVS     R3,R3,LSR#1
  293 ;Rotate R3 right
  294 MOVNE    R5,R5,LSR#1
  295 ;and if it has not reached zero, also rotate R5 right
  296 BNE      next
  297 ;If R3=zero, we have rotated back as many bits as we started, and can now end
  298 ;Result in R0
  299 SWI      "Hourglass_Percentage"
  300 MOV      R15, R14          ;return
  301
  302.measure_text
  303 MOV     R1,R11
  304 MOV     R6,R2 ;move length value elsewhere in case we need it later
  305; MOV     R2,#0
  306 MOV     R0,#1
  307 SWI     &600F9
  308 ;SWI Wimp_TextOp 1 - measure width of string
  309 ;If no error, result in R0
  310 MOVvc      R15, R14          ;return with result if no error
  311 ;otherwise do system font calculation
  312 MVN     R0,#0 ;current screen mode
  313 MOV     R1,#4
  314 SWI     "OS_ReadModeVariable" ; SWI OS_ReadModeVariable 4 - x-eigenfactor
  315;eigenfactor returned in R2
  316 MOV     R6,R6,LSL#3  ;*8
  317 MOV     R0,R6,LSL R2 ;<< xeig
  318 MOV      R15, R14          ;return
  319
  320 FNReportGen
  321 ]
  322REM we have now left the assembler
  323NEXT pass%
  324REM OSCLI"BreakSet "+STR$~(check)
  325REM move .check to the relevant place and unREM the BreakSet to set breakpoint there
  326PRINT " Length of code = ";P%-ourcode%
  327PRINT " Block allocated = ";size%
  328ENDPROC
  329
  330DEF FNgetfakeleafname(icon%,clip%):REM get string given offset in block
  331LOCAL ptr%,a$
  332ptr%=(!icon_index%)+8
  333a$=$(ptr%!(icon%*4))
  334IF RIGHT$(a$)="/" AND clip%=TRUE THEN a$=LEFT$(a$)
  335=a$
  336
  337DEF FNstringlength(text$):REM returns width of string in OS units
  338LOCAL width%,xeig%
  339  SYS "OS_ReadModeVariable",-1,4 TO ,,xeig%
  340  width%=(8*LEN(text$)) << xeig%
  341=width%
  342
  343DEF FNbits(s$):REM return value containing relevant bits set to 1
  344REM s$ holds list of bits to set, separated by any non-alphanumeric character
  345REM To obtain a value where bits 22,8 and 0 are set, use FNbits(0,8,22) or
  346REM FNbits(22;8;0) or FNbits(0+22,8) or FNbits(8-22!0) if you really want!
  347LOCAL total%,c%
  348WHILE LEN(s$)
  349  c%=VAL(s$)
  350  total%+=1<<c%
  351  s$=MID$(s$,LEN(STR$(c%))+2)
  352ENDWHILE
  353=total%
� StrongED$mode = BasAsm
.� �: � � �: � �$;" at line ";�:�#handle%:�

"ț "<Infozip$Dir>.SHeap.SHeap"
ț "<Reporter$Dir>.AsmLib"

�ReportInit(10)

	�initheaps(128,128)

,icon_names%=�create_anchor("icon names")
,icon_index%=�create_anchor("icon index")


� block% 255,wimp% 700


*Key 1 Continue|MY
*ReportClear
� *BreakClr
�assemble(1600)
F� SYS"OS_File",10,"<Infozip$Dir>.Resources.code",&FFD,,ourcode%,P%
� stuff for testing
handle%=�"RAM:CAT"

�test(handle%,ourcode%)

�#handle%

�



� �test(in%,arrayscan%)
 F%=�#in%/100
!2�extend_named_sliding_block(icon_names%,�#in%)
"W� claim enough icon_names% space to hold the *whole file* - guaranteed to be enough
#9�extend_named_sliding_block(icon_index%,4*(�#in%/29))
$O� claim icon_index% space by calculating no. of lines, at 29 bytes per line
%C� (this is minimum possible length of line up to start of name)
&,� allocate one word for pointer per line
'.� (i.e. max possible icons if all in root)
(name_ptr%=!icon_names%
)index_ptr%=(!icon_index%)+8
*index_start%=index_ptr%
+maxlenptr%=(!icon_index%)
,maxlenptr%!4=0
-L� We will store no of files and length of longest name at start of block
.max_icon_width%=0:� reset
/
0no_of_files%=0
1commonpath$="ScrapFile/*"
2� *ReportTrace On
3�#in%=0
4j$=�#in%
5n%=�#in%
6�
7  a$=�#in%:n%=�#in%
8+� a$=" --------    ----   ----    ----"
9filesize%=�#in%/100
:2H%=index_ptr%:� set R7 to point to index block
;3G%=block%:� set R6 to point to temporary buffer
<"B%=in%:� set R1 to file handle
=1F%=filesize%:�  set R5 to file size (DIV 100)
>K$wimp%=commonpath$:� so we don't have to look it up again at every CALL
?
@%arrayscan%!4=0:� reset flag words
Aarrayscan%!8=0
BF� PTR#i%=713:REM testing ONLY!!! - skip to given place in CAT file
C�~G%
D/  � arrayscan%,name_ptr%,wimp%,index_start%
E  � pass parameters:
FF  � 1st - start of block in which to store pointers to names found
G9  � 2nd - start of block holding "common path" string
HC  � 3rd - start of output block into which to write names found
IH  � R1,R5,R6 and R7 are also initialised with frequently-used values
J� j$
Kno_of_files%=arrayscan%!4
Lmaxlenptr%!0=no_of_files%
M�show(no_of_files%)
N max_icon_width%=maxlenptr%!4
O5� no_of_files% �"Longest name: ";$max_icon_width%
P�
Q
R� �show(element%)
S� n%
T� element%;" files found"
U� element%=0 � �
V� n%=0 � element%-1
W�":"+�getfakeleafname(n%,�)
X� n%
Y�
Z
[� �assemble(size%)
\� index%,buffer%
]� ourcode% size%
^L%=ourcode%+size%
_index%=7
`
buffer%=6
aGlastctrlchar%=31:� we aren't fussy about catalogue line terminators
b%� implement two passes and set up
c%� values for OPT at the same time
d*� first pass - enable only range check
e� i.e. OPT 8
f(� second pass - enable error report,
g*� range check and listing, i.e. OPT 11
h
i
j� pass% = 8 � 10 � 2
k" � set P% to start of our code
l � on each pass
m �ReportStart(pass%)
n P% = ourcode%
o � now invoke the assembler
p1 [OPT pass% ; set value of OPT as appropriate
q@ B getstartofline ;jump over reserved words at start of code
rR;.truefalse                  ;use this word as a flag on exit to indicate if a
sS; EQUD     0                 ;new entry needs to be made in root$(no_of_files%)
tN.num_found                  ;use this word to keep track of how many files
uM EQUD     0                 ;are found and to pass the value back on exit
v.maxlen
wC EQUD     0                 ;length of longest name in OS units
xT;-------------------------------------------------------------------------------
y.getstartofline
z> SWI      "XOS_BGet"        ;get byte from file R1 into R0
{J BCS      exit_and_die      ;exit routine on � error (penultimate line
|4                            ;contains no colon!)
}. CMP      R0,#�(":")      ;check for colon
~A BNE      getstartofline    ;skip all characters before colon
E;(cannot use field widths - very large files are too wide to fit)
�@  MOV      R11,R6              ;point R11 to start of block%
�.rest_of_line
�> SWI      "OS_BGet"         ;get byte from file R1 into R0
� CMP      R0,#lastctrlchar%
�6 STRB     R0,[R11],#1        ;store byte in block%
�E BGT      rest_of_line    ;store all characters up to end-of-line
�
�> ; $block% is now in format "mm   pathname"+["/"]+ctrlchar
�G ; wimp% is in format "rootpath/*"+CR (because it comes from BASIC)
�Q ADD       R11,R6,#4    ;reload R11 with block%+4 (char before start of name)
�
�6 LDR      R10,[R9,#8] ;address of second parameter
� LDR      R10,[R10]
�Q SUB      R10,R10,#1   ;point R10 to char before start of wimp% (commonpath$)
�
�.comparestrings
�V LDRB     R2,[R11,#1]!      ;get byte from block% (R11 points to byte just loaded)
�T LDRB     R3,[R10,#1]!     ;get byte from wimp% (R10 points to byte just loaded)
�A CMP      R2,R3            ;Are the two strings equal so far?
� BEQ      comparestrings
�
� STMFD    R13!,{0-12,14}
�B BL       testtime         ;stack registers and call hourglass
� LDMFD    R13!,{0-12,14}
�R CMP      R3,#�("*")      ;have we reached asterisk (end of commonpath$) then?
�Q BNE      getstartofline    ;if not, this file does not show up in fakefiler%
�;                            ;try the next line of input
�
�N CMP      R2,#lastctrlchar%  ; If we matched up to $nameblock% terminator,
�O                             ; then this is the commonpath directory itself
�3 BLE      getstartofline     ; - skip this line
�T;----------------scan contents of array-----------------------------------------
�1;Otherwise, scan root$ for this file/dir name
�
�<  LDR       R0,[R9]          ;address of first parameter
�A  LDR       R3,[R0]          ;start of block holding pointers
�D  LDR       R10,num_found        ;no of entries already in block
�  CMP       R10,#0
�O  BEQ       updateflag      ;if block is empty, we know this is a new entry
�.getarrayentry
�<  LDR       R12,[R3],#4      ;load next pointer into R12
�
�N                           ;R12 now points to start of actual array string
�G                           ;R11 still stores start of file/dir name
� MOV       R8,R11
�);�Report_TextS("\r current in block")
�;�Report_Text0(12)
�&;�Report_TextS("\r searching for")
�;�Report_Text0(8)
�T;-----------------compare strings-----------------------------------------------
�	.scan
� LDRB      R0,[R12],#1
� LDRB      R2,[R8],#1
� CMP       R2,R0
�M BEQ       scan             ;scan this element of array for file/dir name
�
�
.check
�
�F   ; check whether we have reached the end of the file/dir name...
�T   CMP     R0,#lastctrlchar% ; is char at end of old leafname a line terminator?
�   LDRlsB   R2,[R8,#-2]
�L   CMPls    R2,#�("/")       ; if it is, then was the last matching char
�S; in the line being checked a slash,  i.e. have we found a duplicate directory?
�=   MOVeq     R10,#0            ; if so, this is a match -
�>                               ; ensure we exit loop early
�3;Note that *only* directories can be duplicate!
�
�0 SUBS      R10,R10,#1     ;decrement counter
�T BHI       getarrayentry  ;exit loop if string matched or if all entries checked
�
�.updateflag
�C ;STR       R10,truefalse  ;R10 is -1 if match was made, else 0
�T Bne       getstartofline ;if zero flag set, we scanned all entries but found no
�Q                          ;match, so we need to copy the leafname into block%
�3                          ;and CR-terminate it.
�M                          ;Otherwise, we return to the start of the loop.
�
�T;--------------copy file/dir name into block%-----------------------------------
�D  MOV       R2,#0           ;we are using R2 as a length counter
�G  LDR       R0,[R9,#16]     ;address of third parameter (name_ptr%)
�6  LDR       R10,[R0]        ;point to output block
�
�K  STR       R10,[index%],#4 ;add this pointer to index of name pointers
�F  MOV       R8,R11          ;R11 still points to start of leafname
�
.leafname
� LDRB      R0,[R8],#1 
�. CMP       R0,#�("/")   ; is char a slash?
�  CMPne     R0,#lastctrlchar%
�9 ADD       R2,R2,#1         ;increment length counter
� STRB      R0,[R10],#1
� Bgt       leafname
�
�C MOV       R0,#&0D ; BBC BASIC $x strings must be CR terminated
�K SUBmi     R10,R10,#1 ; minus flag here indicates CTRL-char found above
�= ; in which case we want to *overwrite* CTRL-char with CR
�% ; not add it after end of string
�O SUBmi     R2,R2,#1; also decrement length counter (for system font string)
�1 STRB      R0,[R10],#1 ; terminate the string
�F LDR       R3,[R9,#16]     ;address of third parameter (name_ptr%)
�P STR       R10,[R3]        ;store the current position of the output pointer
�,                           ;back in here
�6 STMFD    R13!,{1,2,6,14} ; note R0 also corrupted
� BL measure_text
�R LDMFD    R13!,{1,2,6,14} ;but don't restore R0 - we need the result in there!
�
�T;-------------------------------------------------------------------------------
�D;During the following section, R2 holds length of filename found
�+;R10 points to output block (name_ptr%)
�;;R3 and R0 are available for use as temporary registers
�T;-------------------------------------------------------------------------------
�
�@  LDR       R3,maxlen        ;we keep maximum length in here
�@  CMP       R3,R0            ;is it greater than old length?
�  STRlt     R0,maxlen
�<  LDRlt     R0,[R9]          ;address of first parameter
�H  LDRlt     R0,[R0]          ;start of pointers block (index_ptr%!8)
�  
�7  SUBlt     R10,R10,R2       ;R2 still holds length
�K  SUBlt     R10,R10,#1       ;so go back to start of string just output
�>  STRlt     R10,[R0,#-4]     ;and store it at index_ptr%!4
�
�
�E  LDR       R3,num_found    ;load no. of entries already in block
�/  ADD       R3,R3,#1       ;increment count
�  STR       R3,num_found
�B          getstartofline
�,MOV      R15, R14          ;exit routine
�T;---------------exit with error-------------------------------------------------
.exit_and_die
; MOV       R0,index%
6; STR       R0,truefalse     ;signal error on exit
- MOV      R15, R14          ;exit routine
T;================display hourglass with calculated percentage===================

.testtime
$ SWI      "OS_ReadMonotonicTime"

 TST      R0,#%1000
	' MOVNE    R15, R14          ;return

O                            ;don't call this long-winded routine every time
 MOV      R0,#0
L SWI      "OS_Args"         ;R1 holds file handle; �#i% returned into R2

 ;divide R2 by R5
 MOV       R3,#1
< ;set bit 0 in R3, which will be shifted left then right
 MOV      R0,#0
# ;clear R0 to accumulate result
  CMP      R5,#0:�Q    PC,R14
 ;check for divide by zero


.start
 CMP       R5,R2
 MOVCC     R5,R5,ASL#1
 MOVCC     R3,R3,ASL#1
 BCC       start
. ;shift R5 left until it is bigger than R2
F ;shift R3 left in parallel in order to flag how far we have to go

	.next
 CMP      R2,R5
. ;carry is set if R2>R5 (don't ask me why)
  SUBCS    R2,R2,R5
!> ;subtract R5 from R2 if this would give a positive answer
" ADDCS    R0,R0,R3
#D ;and add the current bit in R3 to the accumulating answer in R0
$ MOVS     R3,R3,LSR#1
% ;Rotate R3 right
& MOVNE    R5,R5,LSR#1
': ;and if it has not reached zero, also rotate R5 right
( BNE      next
)R ;If R3=zero, we have rotated back as many bits as we started, and can now end
* ;Result in R0
+$ SWI      "Hourglass_Percentage"
,' MOV      R15, R14          ;return
-
..measure_text
/ MOV     R1,R11
0H MOV     R6,R2 ;move length value elsewhere in case we need it later
1; MOV     R2,#0
2 MOV     R0,#1
3 SWI     &600F9
41 ;SWI Wimp_TextOp 1 - measure width of string
5 ;If no error, result in R0
6A MOVvc      R15, R14          ;return with result if no error
7* ;otherwise do system font calculation
8' MVN     R0,#0 ;current screen mode
9 MOV     R1,#4
:N SWI     "OS_ReadModeVariable" ; SWI OS_ReadModeVariable 4 - x-eigenfactor
;;eigenfactor returned in R2
< MOV     R6,R6,LSL#3  ;*8
=" MOV     R0,R6,LSL R2 ;<< xeig
>' MOV      R15, R14          ;return
?
@ �ReportGen
A ]
B$� we have now left the assembler
C� pass%
D#� OSCLI"BreakSet "+STR$~(check)
EV� move .check to the relevant place and unREM the BreakSet to set breakpoint there
F&� " Length of code = ";P%-ourcode%
G!� " Block allocated = ";size%
H�
I
JF� �getfakeleafname(icon%,clip%):� get string given offset in block
K
� ptr%,a$
Lptr%=(!icon_index%)+8
Ma$=$(ptr%!(icon%*4))
N"� �a$)="/" � clip%=� � a$=�a$)
O=a$
P
Q@� �stringlength(text$):� returns width of string in OS units
R� width%,xeig%
S-  ș "OS_ReadModeVariable",-1,4 � ,,xeig%
T"  width%=(8*�(text$)) << xeig%
U=width%
V
W@� �bits(s$):� return value containing relevant bits set to 1
XO� s$ holds list of bits to set, separated by any non-alphanumeric character
YL� To obtain a value where bits 22,8 and 0 are set, use FNbits(0,8,22) or
ZL� FNbits(22;8;0) or FNbits(0+22,8) or FNbits(8-22!0) if you really want!
[� total%,c%
\ȕ �(s$)
]  c%=�(s$)
^  total%+=1<<c%
_  s$=�s$,�(�(c%))+2)
`�
a=total%
�
00000000  0d 00 01 1c f4 20 53 74  72 6f 6e 67 45 44 24 6d  |..... StrongED$m|
00000010  6f 64 65 20 3d 20 42 61  73 41 73 6d 0d 00 02 2e  |ode = BasAsm....|
00000020  ee 20 85 3a 20 ee 20 85  20 87 3a 20 f1 20 f6 24  |. .: . . .: . .$|
00000030  3b 22 20 61 74 20 6c 69  6e 65 20 22 3b 9e 3a d9  |;" at line ";.:.|
00000040  23 68 61 6e 64 6c 65 25  3a e0 0d 00 03 04 0d 00  |#handle%:.......|
00000050  04 22 c8 9b 20 22 3c 49  6e 66 6f 7a 69 70 24 44  |.".. "<Infozip$D|
00000060  69 72 3e 2e 53 48 65 61  70 2e 53 48 65 61 70 22  |ir>.SHeap.SHeap"|
00000070  0d 00 05 1e c8 9b 20 22  3c 52 65 70 6f 72 74 65  |...... "<Reporte|
00000080  72 24 44 69 72 3e 2e 41  73 6d 4c 69 62 22 0d 00  |r$Dir>.AsmLib"..|
00000090  06 04 0d 00 07 13 f2 52  65 70 6f 72 74 49 6e 69  |.......ReportIni|
000000a0  74 28 31 30 29 0d 00 08  04 0d 00 09 17 f2 69 6e  |t(10).........in|
000000b0  69 74 68 65 61 70 73 28  31 32 38 2c 31 32 38 29  |itheaps(128,128)|
000000c0  0d 00 0a 2c 69 63 6f 6e  5f 6e 61 6d 65 73 25 3d  |...,icon_names%=|
000000d0  a4 63 72 65 61 74 65 5f  61 6e 63 68 6f 72 28 22  |.create_anchor("|
000000e0  69 63 6f 6e 20 6e 61 6d  65 73 22 29 0d 00 0b 2c  |icon names")...,|
000000f0  69 63 6f 6e 5f 69 6e 64  65 78 25 3d a4 63 72 65  |icon_index%=.cre|
00000100  61 74 65 5f 61 6e 63 68  6f 72 28 22 69 63 6f 6e  |ate_anchor("icon|
00000110  20 69 6e 64 65 78 22 29  0d 00 0c 04 0d 00 0d 1a  | index")........|
00000120  de 20 62 6c 6f 63 6b 25  20 32 35 35 2c 77 69 6d  |. block% 255,wim|
00000130  70 25 20 37 30 30 0d 00  0e 04 0d 00 0f 04 0d 00  |p% 700..........|
00000140  10 16 2a 4b 65 79 20 31  20 43 6f 6e 74 69 6e 75  |..*Key 1 Continu|
00000150  65 7c 4d 59 0d 00 11 10  2a 52 65 70 6f 72 74 43  |e|MY....*ReportC|
00000160  6c 65 61 72 0d 00 12 0f  f4 20 2a 42 72 65 61 6b  |lear..... *Break|
00000170  43 6c 72 0d 00 13 13 f2  61 73 73 65 6d 62 6c 65  |Clr.....assemble|
00000180  28 31 36 30 30 29 0d 00  14 46 f4 20 53 59 53 22  |(1600)...F. SYS"|
00000190  4f 53 5f 46 69 6c 65 22  2c 31 30 2c 22 3c 49 6e  |OS_File",10,"<In|
000001a0  66 6f 7a 69 70 24 44 69  72 3e 2e 52 65 73 6f 75  |fozip$Dir>.Resou|
000001b0  72 63 65 73 2e 63 6f 64  65 22 2c 26 46 46 44 2c  |rces.code",&FFD,|
000001c0  2c 6f 75 72 63 6f 64 65  25 2c 50 25 0d 00 15 17  |,ourcode%,P%....|
000001d0  f4 20 73 74 75 66 66 20  66 6f 72 20 74 65 73 74  |. stuff for test|
000001e0  69 6e 67 0d 00 16 16 68  61 6e 64 6c 65 25 3d 8e  |ing....handle%=.|
000001f0  22 52 41 4d 3a 43 41 54  22 0d 00 17 04 0d 00 18  |"RAM:CAT".......|
00000200  1b f2 74 65 73 74 28 68  61 6e 64 6c 65 25 2c 6f  |..test(handle%,o|
00000210  75 72 63 6f 64 65 25 29  0d 00 19 0d d9 23 68 61  |urcode%).....#ha|
00000220  6e 64 6c 65 25 0d 00 1a  04 0d 00 1b 05 e0 0d 00  |ndle%...........|
00000230  1c 04 0d 00 1d 04 0d 00  1e 04 0d 00 1f 1b dd 20  |............... |
00000240  f2 74 65 73 74 28 69 6e  25 2c 61 72 72 61 79 73  |.test(in%,arrays|
00000250  63 61 6e 25 29 0d 00 20  10 46 25 3d a2 23 69 6e  |can%).. .F%=.#in|
00000260  25 2f 31 30 30 0d 00 21  32 f2 65 78 74 65 6e 64  |%/100..!2.extend|
00000270  5f 6e 61 6d 65 64 5f 73  6c 69 64 69 6e 67 5f 62  |_named_sliding_b|
00000280  6c 6f 63 6b 28 69 63 6f  6e 5f 6e 61 6d 65 73 25  |lock(icon_names%|
00000290  2c a2 23 69 6e 25 29 0d  00 22 57 f4 20 63 6c 61  |,.#in%).."W. cla|
000002a0  69 6d 20 65 6e 6f 75 67  68 20 69 63 6f 6e 5f 6e  |im enough icon_n|
000002b0  61 6d 65 73 25 20 73 70  61 63 65 20 74 6f 20 68  |ames% space to h|
000002c0  6f 6c 64 20 74 68 65 20  2a 77 68 6f 6c 65 20 66  |old the *whole f|
000002d0  69 6c 65 2a 20 2d 20 67  75 61 72 61 6e 74 65 65  |ile* - guarantee|
000002e0  64 20 74 6f 20 62 65 20  65 6e 6f 75 67 68 0d 00  |d to be enough..|
000002f0  23 39 f2 65 78 74 65 6e  64 5f 6e 61 6d 65 64 5f  |#9.extend_named_|
00000300  73 6c 69 64 69 6e 67 5f  62 6c 6f 63 6b 28 69 63  |sliding_block(ic|
00000310  6f 6e 5f 69 6e 64 65 78  25 2c 34 2a 28 a2 23 69  |on_index%,4*(.#i|
00000320  6e 25 2f 32 39 29 29 0d  00 24 4f f4 20 63 6c 61  |n%/29))..$O. cla|
00000330  69 6d 20 69 63 6f 6e 5f  69 6e 64 65 78 25 20 73  |im icon_index% s|
00000340  70 61 63 65 20 62 79 20  63 61 6c 63 75 6c 61 74  |pace by calculat|
00000350  69 6e 67 20 6e 6f 2e 20  6f 66 20 6c 69 6e 65 73  |ing no. of lines|
00000360  2c 20 61 74 20 32 39 20  62 79 74 65 73 20 70 65  |, at 29 bytes pe|
00000370  72 20 6c 69 6e 65 0d 00  25 43 f4 20 28 74 68 69  |r line..%C. (thi|
00000380  73 20 69 73 20 6d 69 6e  69 6d 75 6d 20 70 6f 73  |s is minimum pos|
00000390  73 69 62 6c 65 20 6c 65  6e 67 74 68 20 6f 66 20  |sible length of |
000003a0  6c 69 6e 65 20 75 70 20  74 6f 20 73 74 61 72 74  |line up to start|
000003b0  20 6f 66 20 6e 61 6d 65  29 0d 00 26 2c f4 20 61  | of name)..&,. a|
000003c0  6c 6c 6f 63 61 74 65 20  6f 6e 65 20 77 6f 72 64  |llocate one word|
000003d0  20 66 6f 72 20 70 6f 69  6e 74 65 72 20 70 65 72  | for pointer per|
000003e0  20 6c 69 6e 65 0d 00 27  2e f4 20 28 69 2e 65 2e  | line..'.. (i.e.|
000003f0  20 6d 61 78 20 70 6f 73  73 69 62 6c 65 20 69 63  | max possible ic|
00000400  6f 6e 73 20 69 66 20 61  6c 6c 20 69 6e 20 72 6f  |ons if all in ro|
00000410  6f 74 29 0d 00 28 1a 6e  61 6d 65 5f 70 74 72 25  |ot)..(.name_ptr%|
00000420  3d 21 69 63 6f 6e 5f 6e  61 6d 65 73 25 0d 00 29  |=!icon_names%..)|
00000430  1f 69 6e 64 65 78 5f 70  74 72 25 3d 28 21 69 63  |.index_ptr%=(!ic|
00000440  6f 6e 5f 69 6e 64 65 78  25 29 2b 38 0d 00 2a 1b  |on_index%)+8..*.|
00000450  69 6e 64 65 78 5f 73 74  61 72 74 25 3d 69 6e 64  |index_start%=ind|
00000460  65 78 5f 70 74 72 25 0d  00 2b 1d 6d 61 78 6c 65  |ex_ptr%..+.maxle|
00000470  6e 70 74 72 25 3d 28 21  69 63 6f 6e 5f 69 6e 64  |nptr%=(!icon_ind|
00000480  65 78 25 29 0d 00 2c 12  6d 61 78 6c 65 6e 70 74  |ex%)..,.maxlenpt|
00000490  72 25 21 34 3d 30 0d 00  2d 4c f4 20 57 65 20 77  |r%!4=0..-L. We w|
000004a0  69 6c 6c 20 73 74 6f 72  65 20 6e 6f 20 6f 66 20  |ill store no of |
000004b0  66 69 6c 65 73 20 61 6e  64 20 6c 65 6e 67 74 68  |files and length|
000004c0  20 6f 66 20 6c 6f 6e 67  65 73 74 20 6e 61 6d 65  | of longest name|
000004d0  20 61 74 20 73 74 61 72  74 20 6f 66 20 62 6c 6f  | at start of blo|
000004e0  63 6b 0d 00 2e 1d 6d 61  78 5f 69 63 6f 6e 5f 77  |ck....max_icon_w|
000004f0  69 64 74 68 25 3d 30 3a  f4 20 72 65 73 65 74 0d  |idth%=0:. reset.|
00000500  00 2f 04 0d 00 30 12 6e  6f 5f 6f 66 5f 66 69 6c  |./...0.no_of_fil|
00000510  65 73 25 3d 30 0d 00 31  1d 63 6f 6d 6d 6f 6e 70  |es%=0..1.commonp|
00000520  61 74 68 24 3d 22 53 63  72 61 70 46 69 6c 65 2f  |ath$="ScrapFile/|
00000530  2a 22 0d 00 32 15 f4 20  2a 52 65 70 6f 72 74 54  |*"..2.. *ReportT|
00000540  72 61 63 65 20 4f 6e 0d  00 33 0b cf 23 69 6e 25  |race On..3..#in%|
00000550  3d 30 0d 00 34 0c 6a 24  3d be 23 69 6e 25 0d 00  |=0..4.j$=.#in%..|
00000560  35 0c 6e 25 3d 9a 23 69  6e 25 0d 00 36 05 f5 0d  |5.n%=.#in%..6...|
00000570  00 37 17 20 20 61 24 3d  be 23 69 6e 25 3a 6e 25  |.7.  a$=.#in%:n%|
00000580  3d 9a 23 69 6e 25 0d 00  38 2b fd 20 61 24 3d 22  |=.#in%..8+. a$="|
00000590  20 2d 2d 2d 2d 2d 2d 2d  2d 20 20 20 20 2d 2d 2d  | --------    ---|
000005a0  2d 20 20 20 2d 2d 2d 2d  20 20 20 20 2d 2d 2d 2d  |-   ----    ----|
000005b0  22 0d 00 39 17 66 69 6c  65 73 69 7a 65 25 3d a2  |"..9.filesize%=.|
000005c0  23 69 6e 25 2f 31 30 30  0d 00 3a 32 48 25 3d 69  |#in%/100..:2H%=i|
000005d0  6e 64 65 78 5f 70 74 72  25 3a f4 20 73 65 74 20  |ndex_ptr%:. set |
000005e0  52 37 20 74 6f 20 70 6f  69 6e 74 20 74 6f 20 69  |R7 to point to i|
000005f0  6e 64 65 78 20 62 6c 6f  63 6b 0d 00 3b 33 47 25  |ndex block..;3G%|
00000600  3d 62 6c 6f 63 6b 25 3a  f4 20 73 65 74 20 52 36  |=block%:. set R6|
00000610  20 74 6f 20 70 6f 69 6e  74 20 74 6f 20 74 65 6d  | to point to tem|
00000620  70 6f 72 61 72 79 20 62  75 66 66 65 72 0d 00 3c  |porary buffer..<|
00000630  22 42 25 3d 69 6e 25 3a  f4 20 73 65 74 20 52 31  |"B%=in%:. set R1|
00000640  20 74 6f 20 66 69 6c 65  20 68 61 6e 64 6c 65 0d  | to file handle.|
00000650  00 3d 31 46 25 3d 66 69  6c 65 73 69 7a 65 25 3a  |.=1F%=filesize%:|
00000660  f4 20 20 73 65 74 20 52  35 20 74 6f 20 66 69 6c  |.  set R5 to fil|
00000670  65 20 73 69 7a 65 20 28  44 49 56 20 31 30 30 29  |e size (DIV 100)|
00000680  0d 00 3e 4b 24 77 69 6d  70 25 3d 63 6f 6d 6d 6f  |..>K$wimp%=commo|
00000690  6e 70 61 74 68 24 3a f4  20 73 6f 20 77 65 20 64  |npath$:. so we d|
000006a0  6f 6e 27 74 20 68 61 76  65 20 74 6f 20 6c 6f 6f  |on't have to loo|
000006b0  6b 20 69 74 20 75 70 20  61 67 61 69 6e 20 61 74  |k it up again at|
000006c0  20 65 76 65 72 79 20 43  41 4c 4c 0d 00 3f 04 0d  | every CALL..?..|
000006d0  00 40 25 61 72 72 61 79  73 63 61 6e 25 21 34 3d  |.@%arrayscan%!4=|
000006e0  30 3a f4 20 72 65 73 65  74 20 66 6c 61 67 20 77  |0:. reset flag w|
000006f0  6f 72 64 73 0d 00 41 12  61 72 72 61 79 73 63 61  |ords..A.arraysca|
00000700  6e 25 21 38 3d 30 0d 00  42 46 f4 20 50 54 52 23  |n%!8=0..BF. PTR#|
00000710  69 25 3d 37 31 33 3a 52  45 4d 20 74 65 73 74 69  |i%=713:REM testi|
00000720  6e 67 20 4f 4e 4c 59 21  21 21 20 2d 20 73 6b 69  |ng ONLY!!! - ski|
00000730  70 20 74 6f 20 67 69 76  65 6e 20 70 6c 61 63 65  |p to given place|
00000740  20 69 6e 20 43 41 54 20  66 69 6c 65 0d 00 43 08  | in CAT file..C.|
00000750  f1 7e 47 25 0d 00 44 2f  20 20 d6 20 61 72 72 61  |.~G%..D/  . arra|
00000760  79 73 63 61 6e 25 2c 6e  61 6d 65 5f 70 74 72 25  |yscan%,name_ptr%|
00000770  2c 77 69 6d 70 25 2c 69  6e 64 65 78 5f 73 74 61  |,wimp%,index_sta|
00000780  72 74 25 0d 00 45 18 20  20 f4 20 70 61 73 73 20  |rt%..E.  . pass |
00000790  70 61 72 61 6d 65 74 65  72 73 3a 0d 00 46 46 20  |parameters:..FF |
000007a0  20 f4 20 31 73 74 20 2d  20 73 74 61 72 74 20 6f  | . 1st - start o|
000007b0  66 20 62 6c 6f 63 6b 20  69 6e 20 77 68 69 63 68  |f block in which|
000007c0  20 74 6f 20 73 74 6f 72  65 20 70 6f 69 6e 74 65  | to store pointe|
000007d0  72 73 20 74 6f 20 6e 61  6d 65 73 20 66 6f 75 6e  |rs to names foun|
000007e0  64 0d 00 47 39 20 20 f4  20 32 6e 64 20 2d 20 73  |d..G9  . 2nd - s|
000007f0  74 61 72 74 20 6f 66 20  62 6c 6f 63 6b 20 68 6f  |tart of block ho|
00000800  6c 64 69 6e 67 20 22 63  6f 6d 6d 6f 6e 20 70 61  |lding "common pa|
00000810  74 68 22 20 73 74 72 69  6e 67 0d 00 48 43 20 20  |th" string..HC  |
00000820  f4 20 33 72 64 20 2d 20  73 74 61 72 74 20 6f 66  |. 3rd - start of|
00000830  20 6f 75 74 70 75 74 20  62 6c 6f 63 6b 20 69 6e  | output block in|
00000840  74 6f 20 77 68 69 63 68  20 74 6f 20 77 72 69 74  |to which to writ|
00000850  65 20 6e 61 6d 65 73 20  66 6f 75 6e 64 0d 00 49  |e names found..I|
00000860  48 20 20 f4 20 52 31 2c  52 35 2c 52 36 20 61 6e  |H  . R1,R5,R6 an|
00000870  64 20 52 37 20 61 72 65  20 61 6c 73 6f 20 69 6e  |d R7 are also in|
00000880  69 74 69 61 6c 69 73 65  64 20 77 69 74 68 20 66  |itialised with f|
00000890  72 65 71 75 65 6e 74 6c  79 2d 75 73 65 64 20 76  |requently-used v|
000008a0  61 6c 75 65 73 0d 00 4a  08 f1 20 6a 24 0d 00 4b  |alues..J.. j$..K|
000008b0  1d 6e 6f 5f 6f 66 5f 66  69 6c 65 73 25 3d 61 72  |.no_of_files%=ar|
000008c0  72 61 79 73 63 61 6e 25  21 34 0d 00 4c 1d 6d 61  |rayscan%!4..L.ma|
000008d0  78 6c 65 6e 70 74 72 25  21 30 3d 6e 6f 5f 6f 66  |xlenptr%!0=no_of|
000008e0  5f 66 69 6c 65 73 25 0d  00 4d 17 f2 73 68 6f 77  |_files%..M..show|
000008f0  28 6e 6f 5f 6f 66 5f 66  69 6c 65 73 25 29 0d 00  |(no_of_files%)..|
00000900  4e 20 6d 61 78 5f 69 63  6f 6e 5f 77 69 64 74 68  |N max_icon_width|
00000910  25 3d 6d 61 78 6c 65 6e  70 74 72 25 21 34 0d 00  |%=maxlenptr%!4..|
00000920  4f 35 e7 20 6e 6f 5f 6f  66 5f 66 69 6c 65 73 25  |O5. no_of_files%|
00000930  20 f1 22 4c 6f 6e 67 65  73 74 20 6e 61 6d 65 3a  | ."Longest name:|
00000940  20 22 3b 24 6d 61 78 5f  69 63 6f 6e 5f 77 69 64  | ";$max_icon_wid|
00000950  74 68 25 0d 00 50 05 e1  0d 00 51 04 0d 00 52 15  |th%..P....Q...R.|
00000960  dd 20 f2 73 68 6f 77 28  65 6c 65 6d 65 6e 74 25  |. .show(element%|
00000970  29 0d 00 53 08 ea 20 6e  25 0d 00 54 1d f1 20 65  |)..S.. n%..T.. e|
00000980  6c 65 6d 65 6e 74 25 3b  22 20 66 69 6c 65 73 20  |lement%;" files |
00000990  66 6f 75 6e 64 22 0d 00  55 14 e7 20 65 6c 65 6d  |found"..U.. elem|
000009a0  65 6e 74 25 3d 30 20 8c  20 e1 0d 00 56 17 e3 20  |ent%=0 . ...V.. |
000009b0  6e 25 3d 30 20 b8 20 65  6c 65 6d 65 6e 74 25 2d  |n%=0 . element%-|
000009c0  31 0d 00 57 1f f1 22 3a  22 2b a4 67 65 74 66 61  |1..W..":"+.getfa|
000009d0  6b 65 6c 65 61 66 6e 61  6d 65 28 6e 25 2c a3 29  |keleafname(n%,.)|
000009e0  0d 00 58 08 ed 20 6e 25  0d 00 59 05 e1 0d 00 5a  |..X.. n%..Y....Z|
000009f0  04 0d 00 5b 16 dd 20 f2  61 73 73 65 6d 62 6c 65  |...[.. .assemble|
00000a00  28 73 69 7a 65 25 29 0d  00 5c 14 ea 20 69 6e 64  |(size%)..\.. ind|
00000a10  65 78 25 2c 62 75 66 66  65 72 25 0d 00 5d 14 de  |ex%,buffer%..]..|
00000a20  20 6f 75 72 63 6f 64 65  25 20 73 69 7a 65 25 0d  | ourcode% size%.|
00000a30  00 5e 15 4c 25 3d 6f 75  72 63 6f 64 65 25 2b 73  |.^.L%=ourcode%+s|
00000a40  69 7a 65 25 0d 00 5f 0c  69 6e 64 65 78 25 3d 37  |ize%.._.index%=7|
00000a50  0d 00 60 0d 62 75 66 66  65 72 25 3d 36 0d 00 61  |..`.buffer%=6..a|
00000a60  47 6c 61 73 74 63 74 72  6c 63 68 61 72 25 3d 33  |Glastctrlchar%=3|
00000a70  31 3a f4 20 77 65 20 61  72 65 6e 27 74 20 66 75  |1:. we aren't fu|
00000a80  73 73 79 20 61 62 6f 75  74 20 63 61 74 61 6c 6f  |ssy about catalo|
00000a90  67 75 65 20 6c 69 6e 65  20 74 65 72 6d 69 6e 61  |gue line termina|
00000aa0  74 6f 72 73 0d 00 62 25  f4 20 69 6d 70 6c 65 6d  |tors..b%. implem|
00000ab0  65 6e 74 20 74 77 6f 20  70 61 73 73 65 73 20 61  |ent two passes a|
00000ac0  6e 64 20 73 65 74 20 75  70 0d 00 63 25 f4 20 76  |nd set up..c%. v|
00000ad0  61 6c 75 65 73 20 66 6f  72 20 4f 50 54 20 61 74  |alues for OPT at|
00000ae0  20 74 68 65 20 73 61 6d  65 20 74 69 6d 65 0d 00  | the same time..|
00000af0  64 2a f4 20 66 69 72 73  74 20 70 61 73 73 20 2d  |d*. first pass -|
00000b00  20 65 6e 61 62 6c 65 20  6f 6e 6c 79 20 72 61 6e  | enable only ran|
00000b10  67 65 20 63 68 65 63 6b  0d 00 65 10 f4 20 69 2e  |ge check..e.. i.|
00000b20  65 2e 20 4f 50 54 20 38  0d 00 66 28 f4 20 73 65  |e. OPT 8..f(. se|
00000b30  63 6f 6e 64 20 70 61 73  73 20 2d 20 65 6e 61 62  |cond pass - enab|
00000b40  6c 65 20 65 72 72 6f 72  20 72 65 70 6f 72 74 2c  |le error report,|
00000b50  0d 00 67 2a f4 20 72 61  6e 67 65 20 63 68 65 63  |..g*. range chec|
00000b60  6b 20 61 6e 64 20 6c 69  73 74 69 6e 67 2c 20 69  |k and listing, i|
00000b70  2e 65 2e 20 4f 50 54 20  31 31 0d 00 68 04 0d 00  |.e. OPT 11..h...|
00000b80  69 04 0d 00 6a 18 e3 20  70 61 73 73 25 20 3d 20  |i...j.. pass% = |
00000b90  38 20 b8 20 31 30 20 88  20 32 0d 00 6b 22 20 f4  |8 . 10 . 2..k" .|
00000ba0  20 73 65 74 20 50 25 20  74 6f 20 73 74 61 72 74  | set P% to start|
00000bb0  20 6f 66 20 6f 75 72 20  63 6f 64 65 0d 00 6c 13  | of our code..l.|
00000bc0  20 f4 20 6f 6e 20 65 61  63 68 20 70 61 73 73 0d  | . on each pass.|
00000bd0  00 6d 18 20 f2 52 65 70  6f 72 74 53 74 61 72 74  |.m. .ReportStart|
00000be0  28 70 61 73 73 25 29 0d  00 6e 12 20 50 25 20 3d  |(pass%)..n. P% =|
00000bf0  20 6f 75 72 63 6f 64 65  25 0d 00 6f 1f 20 f4 20  | ourcode%..o. . |
00000c00  6e 6f 77 20 69 6e 76 6f  6b 65 20 74 68 65 20 61  |now invoke the a|
00000c10  73 73 65 6d 62 6c 65 72  0d 00 70 31 20 5b 4f 50  |ssembler..p1 [OP|
00000c20  54 20 70 61 73 73 25 20  3b 20 73 65 74 20 76 61  |T pass% ; set va|
00000c30  6c 75 65 20 6f 66 20 4f  50 54 20 61 73 20 61 70  |lue of OPT as ap|
00000c40  70 72 6f 70 72 69 61 74  65 0d 00 71 40 20 42 20  |propriate..q@ B |
00000c50  67 65 74 73 74 61 72 74  6f 66 6c 69 6e 65 20 3b  |getstartofline ;|
00000c60  6a 75 6d 70 20 6f 76 65  72 20 72 65 73 65 72 76  |jump over reserv|
00000c70  65 64 20 77 6f 72 64 73  20 61 74 20 73 74 61 72  |ed words at star|
00000c80  74 20 6f 66 20 63 6f 64  65 0d 00 72 52 3b 2e 74  |t of code..rR;.t|
00000c90  72 75 65 66 61 6c 73 65  20 20 20 20 20 20 20 20  |ruefalse        |
00000ca0  20 20 20 20 20 20 20 20  20 20 3b 75 73 65 20 74  |          ;use t|
00000cb0  68 69 73 20 77 6f 72 64  20 61 73 20 61 20 66 6c  |his word as a fl|
00000cc0  61 67 20 6f 6e 20 65 78  69 74 20 74 6f 20 69 6e  |ag on exit to in|
00000cd0  64 69 63 61 74 65 20 69  66 20 61 0d 00 73 53 3b  |dicate if a..sS;|
00000ce0  20 45 51 55 44 20 20 20  20 20 30 20 20 20 20 20  | EQUD     0     |
00000cf0  20 20 20 20 20 20 20 20  20 20 20 20 3b 6e 65 77  |            ;new|
00000d00  20 65 6e 74 72 79 20 6e  65 65 64 73 20 74 6f 20  | entry needs to |
00000d10  62 65 20 6d 61 64 65 20  69 6e 20 72 6f 6f 74 24  |be made in root$|
00000d20  28 6e 6f 5f 6f 66 5f 66  69 6c 65 73 25 29 0d 00  |(no_of_files%)..|
00000d30  74 4e 2e 6e 75 6d 5f 66  6f 75 6e 64 20 20 20 20  |tN.num_found    |
00000d40  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 75  |              ;u|
00000d50  73 65 20 74 68 69 73 20  77 6f 72 64 20 74 6f 20  |se this word to |
00000d60  6b 65 65 70 20 74 72 61  63 6b 20 6f 66 20 68 6f  |keep track of ho|
00000d70  77 20 6d 61 6e 79 20 66  69 6c 65 73 0d 00 75 4d  |w many files..uM|
00000d80  20 45 51 55 44 20 20 20  20 20 30 20 20 20 20 20  | EQUD     0     |
00000d90  20 20 20 20 20 20 20 20  20 20 20 20 3b 61 72 65  |            ;are|
00000da0  20 66 6f 75 6e 64 20 61  6e 64 20 74 6f 20 70 61  | found and to pa|
00000db0  73 73 20 74 68 65 20 76  61 6c 75 65 20 62 61 63  |ss the value bac|
00000dc0  6b 20 6f 6e 20 65 78 69  74 0d 00 76 0b 2e 6d 61  |k on exit..v..ma|
00000dd0  78 6c 65 6e 0d 00 77 43  20 45 51 55 44 20 20 20  |xlen..wC EQUD   |
00000de0  20 20 30 20 20 20 20 20  20 20 20 20 20 20 20 20  |  0             |
00000df0  20 20 20 20 3b 6c 65 6e  67 74 68 20 6f 66 20 6c  |    ;length of l|
00000e00  6f 6e 67 65 73 74 20 6e  61 6d 65 20 69 6e 20 4f  |ongest name in O|
00000e10  53 20 75 6e 69 74 73 0d  00 78 54 3b 2d 2d 2d 2d  |S units..xT;----|
00000e20  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000e60  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 0d 00 79 13 2e  |-----------..y..|
00000e70  67 65 74 73 74 61 72 74  6f 66 6c 69 6e 65 0d 00  |getstartofline..|
00000e80  7a 3e 20 53 57 49 20 20  20 20 20 20 22 58 4f 53  |z> SWI      "XOS|
00000e90  5f 42 47 65 74 22 20 20  20 20 20 20 20 20 3b 67  |_BGet"        ;g|
00000ea0  65 74 20 62 79 74 65 20  66 72 6f 6d 20 66 69 6c  |et byte from fil|
00000eb0  65 20 52 31 20 69 6e 74  6f 20 52 30 0d 00 7b 4a  |e R1 into R0..{J|
00000ec0  20 42 43 53 20 20 20 20  20 20 65 78 69 74 5f 61  | BCS      exit_a|
00000ed0  6e 64 5f 64 69 65 20 20  20 20 20 20 3b 65 78 69  |nd_die      ;exi|
00000ee0  74 20 72 6f 75 74 69 6e  65 20 6f 6e 20 c5 20 65  |t routine on . e|
00000ef0  72 72 6f 72 20 28 70 65  6e 75 6c 74 69 6d 61 74  |rror (penultimat|
00000f00  65 20 6c 69 6e 65 0d 00  7c 34 20 20 20 20 20 20  |e line..|4      |
00000f10  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000f20  20 20 20 20 20 20 3b 63  6f 6e 74 61 69 6e 73 20  |      ;contains |
00000f30  6e 6f 20 63 6f 6c 6f 6e  21 29 0d 00 7d 2e 20 43  |no colon!)..}. C|
00000f40  4d 50 20 20 20 20 20 20  52 30 2c 23 97 28 22 3a  |MP      R0,#.(":|
00000f50  22 29 20 20 20 20 20 20  3b 63 68 65 63 6b 20 66  |")      ;check f|
00000f60  6f 72 20 63 6f 6c 6f 6e  0d 00 7e 41 20 42 4e 45  |or colon..~A BNE|
00000f70  20 20 20 20 20 20 67 65  74 73 74 61 72 74 6f 66  |      getstartof|
00000f80  6c 69 6e 65 20 20 20 20  3b 73 6b 69 70 20 61 6c  |line    ;skip al|
00000f90  6c 20 63 68 61 72 61 63  74 65 72 73 20 62 65 66  |l characters bef|
00000fa0  6f 72 65 20 63 6f 6c 6f  6e 0d 00 7f 45 3b 28 63  |ore colon...E;(c|
00000fb0  61 6e 6e 6f 74 20 75 73  65 20 66 69 65 6c 64 20  |annot use field |
00000fc0  77 69 64 74 68 73 20 2d  20 76 65 72 79 20 6c 61  |widths - very la|
00000fd0  72 67 65 20 66 69 6c 65  73 20 61 72 65 20 74 6f  |rge files are to|
00000fe0  6f 20 77 69 64 65 20 74  6f 20 66 69 74 29 0d 00  |o wide to fit)..|
00000ff0  80 40 20 20 4d 4f 56 20  20 20 20 20 20 52 31 31  |.@  MOV      R11|
00001000  2c 52 36 20 20 20 20 20  20 20 20 20 20 20 20 20  |,R6             |
00001010  20 3b 70 6f 69 6e 74 20  52 31 31 20 74 6f 20 73  | ;point R11 to s|
00001020  74 61 72 74 20 6f 66 20  62 6c 6f 63 6b 25 0d 00  |tart of block%..|
00001030  81 11 2e 72 65 73 74 5f  6f 66 5f 6c 69 6e 65 0d  |...rest_of_line.|
00001040  00 82 3e 20 53 57 49 20  20 20 20 20 20 22 4f 53  |..> SWI      "OS|
00001050  5f 42 47 65 74 22 20 20  20 20 20 20 20 20 20 3b  |_BGet"         ;|
00001060  67 65 74 20 62 79 74 65  20 66 72 6f 6d 20 66 69  |get byte from fi|
00001070  6c 65 20 52 31 20 69 6e  74 6f 20 52 30 0d 00 83  |le R1 into R0...|
00001080  1f 20 43 4d 50 20 20 20  20 20 20 52 30 2c 23 6c  |. CMP      R0,#l|
00001090  61 73 74 63 74 72 6c 63  68 61 72 25 0d 00 84 36  |astctrlchar%...6|
000010a0  20 53 54 52 42 20 20 20  20 20 52 30 2c 5b 52 31  | STRB     R0,[R1|
000010b0  31 5d 2c 23 31 20 20 20  20 20 20 20 20 3b 73 74  |1],#1        ;st|
000010c0  6f 72 65 20 62 79 74 65  20 69 6e 20 62 6c 6f 63  |ore byte in bloc|
000010d0  6b 25 0d 00 85 45 20 42  47 54 20 20 20 20 20 20  |k%...E BGT      |
000010e0  72 65 73 74 5f 6f 66 5f  6c 69 6e 65 20 20 20 20  |rest_of_line    |
000010f0  3b 73 74 6f 72 65 20 61  6c 6c 20 63 68 61 72 61  |;store all chara|
00001100  63 74 65 72 73 20 75 70  20 74 6f 20 65 6e 64 2d  |cters up to end-|
00001110  6f 66 2d 6c 69 6e 65 0d  00 86 04 0d 00 87 3e 20  |of-line.......> |
00001120  3b 20 24 62 6c 6f 63 6b  25 20 69 73 20 6e 6f 77  |; $block% is now|
00001130  20 69 6e 20 66 6f 72 6d  61 74 20 22 6d 6d 20 20  | in format "mm  |
00001140  20 70 61 74 68 6e 61 6d  65 22 2b 5b 22 2f 22 5d  | pathname"+["/"]|
00001150  2b 63 74 72 6c 63 68 61  72 0d 00 88 47 20 3b 20  |+ctrlchar...G ; |
00001160  77 69 6d 70 25 20 69 73  20 69 6e 20 66 6f 72 6d  |wimp% is in form|
00001170  61 74 20 22 72 6f 6f 74  70 61 74 68 2f 2a 22 2b  |at "rootpath/*"+|
00001180  43 52 20 28 62 65 63 61  75 73 65 20 69 74 20 63  |CR (because it c|
00001190  6f 6d 65 73 20 66 72 6f  6d 20 42 41 53 49 43 29  |omes from BASIC)|
000011a0  0d 00 89 51 20 41 44 44  20 20 20 20 20 20 20 52  |...Q ADD       R|
000011b0  31 31 2c 52 36 2c 23 34  20 20 20 20 3b 72 65 6c  |11,R6,#4    ;rel|
000011c0  6f 61 64 20 52 31 31 20  77 69 74 68 20 62 6c 6f  |oad R11 with blo|
000011d0  63 6b 25 2b 34 20 28 63  68 61 72 20 62 65 66 6f  |ck%+4 (char befo|
000011e0  72 65 20 73 74 61 72 74  20 6f 66 20 6e 61 6d 65  |re start of name|
000011f0  29 0d 00 8a 04 0d 00 8b  36 20 4c 44 52 20 20 20  |).......6 LDR   |
00001200  20 20 20 52 31 30 2c 5b  52 39 2c 23 38 5d 20 3b  |   R10,[R9,#8] ;|
00001210  61 64 64 72 65 73 73 20  6f 66 20 73 65 63 6f 6e  |address of secon|
00001220  64 20 70 61 72 61 6d 65  74 65 72 0d 00 8c 17 20  |d parameter.... |
00001230  4c 44 52 20 20 20 20 20  20 52 31 30 2c 5b 52 31  |LDR      R10,[R1|
00001240  30 5d 0d 00 8d 51 20 53  55 42 20 20 20 20 20 20  |0]...Q SUB      |
00001250  52 31 30 2c 52 31 30 2c  23 31 20 20 20 3b 70 6f  |R10,R10,#1   ;po|
00001260  69 6e 74 20 52 31 30 20  74 6f 20 63 68 61 72 20  |int R10 to char |
00001270  62 65 66 6f 72 65 20 73  74 61 72 74 20 6f 66 20  |before start of |
00001280  77 69 6d 70 25 20 28 63  6f 6d 6d 6f 6e 70 61 74  |wimp% (commonpat|
00001290  68 24 29 0d 00 8e 04 0d  00 8f 13 2e 63 6f 6d 70  |h$).........comp|
000012a0  61 72 65 73 74 72 69 6e  67 73 0d 00 90 56 20 4c  |arestrings...V L|
000012b0  44 52 42 20 20 20 20 20  52 32 2c 5b 52 31 31 2c  |DRB     R2,[R11,|
000012c0  23 31 5d 21 20 20 20 20  20 20 3b 67 65 74 20 62  |#1]!      ;get b|
000012d0  79 74 65 20 66 72 6f 6d  20 62 6c 6f 63 6b 25 20  |yte from block% |
000012e0  28 52 31 31 20 70 6f 69  6e 74 73 20 74 6f 20 62  |(R11 points to b|
000012f0  79 74 65 20 6a 75 73 74  20 6c 6f 61 64 65 64 29  |yte just loaded)|
00001300  0d 00 91 54 20 4c 44 52  42 20 20 20 20 20 52 33  |...T LDRB     R3|
00001310  2c 5b 52 31 30 2c 23 31  5d 21 20 20 20 20 20 3b  |,[R10,#1]!     ;|
00001320  67 65 74 20 62 79 74 65  20 66 72 6f 6d 20 77 69  |get byte from wi|
00001330  6d 70 25 20 28 52 31 30  20 70 6f 69 6e 74 73 20  |mp% (R10 points |
00001340  74 6f 20 62 79 74 65 20  6a 75 73 74 20 6c 6f 61  |to byte just loa|
00001350  64 65 64 29 0d 00 92 41  20 43 4d 50 20 20 20 20  |ded)...A CMP    |
00001360  20 20 52 32 2c 52 33 20  20 20 20 20 20 20 20 20  |  R2,R3         |
00001370  20 20 20 3b 41 72 65 20  74 68 65 20 74 77 6f 20  |   ;Are the two |
00001380  73 74 72 69 6e 67 73 20  65 71 75 61 6c 20 73 6f  |strings equal so|
00001390  20 66 61 72 3f 0d 00 93  1c 20 42 45 51 20 20 20  | far?.... BEQ   |
000013a0  20 20 20 63 6f 6d 70 61  72 65 73 74 72 69 6e 67  |   comparestring|
000013b0  73 0d 00 94 04 0d 00 95  1c 20 53 54 4d 46 44 20  |s........ STMFD |
000013c0  20 20 20 52 31 33 21 2c  7b 30 2d 31 32 2c 31 34  |   R13!,{0-12,14|
000013d0  7d 0d 00 96 42 20 42 4c  20 20 20 20 20 20 20 74  |}...B BL       t|
000013e0  65 73 74 74 69 6d 65 20  20 20 20 20 20 20 20 20  |esttime         |
000013f0  3b 73 74 61 63 6b 20 72  65 67 69 73 74 65 72 73  |;stack registers|
00001400  20 61 6e 64 20 63 61 6c  6c 20 68 6f 75 72 67 6c  | and call hourgl|
00001410  61 73 73 0d 00 97 1c 20  4c 44 4d 46 44 20 20 20  |ass.... LDMFD   |
00001420  20 52 31 33 21 2c 7b 30  2d 31 32 2c 31 34 7d 0d  | R13!,{0-12,14}.|
00001430  00 98 52 20 43 4d 50 20  20 20 20 20 20 52 33 2c  |..R CMP      R3,|
00001440  23 97 28 22 2a 22 29 20  20 20 20 20 20 3b 68 61  |#.("*")      ;ha|
00001450  76 65 20 77 65 20 72 65  61 63 68 65 64 20 61 73  |ve we reached as|
00001460  74 65 72 69 73 6b 20 28  65 6e 64 20 6f 66 20 63  |terisk (end of c|
00001470  6f 6d 6d 6f 6e 70 61 74  68 24 29 20 74 68 65 6e  |ommonpath$) then|
00001480  3f 0d 00 99 51 20 42 4e  45 20 20 20 20 20 20 67  |?...Q BNE      g|
00001490  65 74 73 74 61 72 74 6f  66 6c 69 6e 65 20 20 20  |etstartofline   |
000014a0  20 3b 69 66 20 6e 6f 74  2c 20 74 68 69 73 20 66  | ;if not, this f|
000014b0  69 6c 65 20 64 6f 65 73  20 6e 6f 74 20 73 68 6f  |ile does not sho|
000014c0  77 20 75 70 20 69 6e 20  66 61 6b 65 66 69 6c 65  |w up in fakefile|
000014d0  72 25 0d 00 9a 3b 20 20  20 20 20 20 20 20 20 20  |r%...;          |
000014e0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000014f0  20 20 3b 74 72 79 20 74  68 65 20 6e 65 78 74 20  |  ;try the next |
00001500  6c 69 6e 65 20 6f 66 20  69 6e 70 75 74 0d 00 9b  |line of input...|
00001510  04 0d 00 9c 4e 20 43 4d  50 20 20 20 20 20 20 52  |....N CMP      R|
00001520  32 2c 23 6c 61 73 74 63  74 72 6c 63 68 61 72 25  |2,#lastctrlchar%|
00001530  20 20 3b 20 49 66 20 77  65 20 6d 61 74 63 68 65  |  ; If we matche|
00001540  64 20 75 70 20 74 6f 20  24 6e 61 6d 65 62 6c 6f  |d up to $nameblo|
00001550  63 6b 25 20 74 65 72 6d  69 6e 61 74 6f 72 2c 0d  |ck% terminator,.|
00001560  00 9d 4f 20 20 20 20 20  20 20 20 20 20 20 20 20  |..O             |
00001570  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001580  3b 20 74 68 65 6e 20 74  68 69 73 20 69 73 20 74  |; then this is t|
00001590  68 65 20 63 6f 6d 6d 6f  6e 70 61 74 68 20 64 69  |he commonpath di|
000015a0  72 65 63 74 6f 72 79 20  69 74 73 65 6c 66 0d 00  |rectory itself..|
000015b0  9e 33 20 42 4c 45 20 20  20 20 20 20 67 65 74 73  |.3 BLE      gets|
000015c0  74 61 72 74 6f 66 6c 69  6e 65 20 20 20 20 20 3b  |tartofline     ;|
000015d0  20 2d 20 73 6b 69 70 20  74 68 69 73 20 6c 69 6e  | - skip this lin|
000015e0  65 0d 00 9f 54 3b 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |e...T;----------|
000015f0  2d 2d 2d 2d 2d 2d 73 63  61 6e 20 63 6f 6e 74 65  |------scan conte|
00001600  6e 74 73 20 6f 66 20 61  72 72 61 79 2d 2d 2d 2d  |nts of array----|
00001610  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00001630  2d 2d 2d 2d 2d 0d 00 a0  31 3b 4f 74 68 65 72 77  |-----...1;Otherw|
00001640  69 73 65 2c 20 73 63 61  6e 20 72 6f 6f 74 24 20  |ise, scan root$ |
00001650  66 6f 72 20 74 68 69 73  20 66 69 6c 65 2f 64 69  |for this file/di|
00001660  72 20 6e 61 6d 65 0d 00  a1 04 0d 00 a2 3c 20 20  |r name.......<  |
00001670  4c 44 52 20 20 20 20 20  20 20 52 30 2c 5b 52 39  |LDR       R0,[R9|
00001680  5d 20 20 20 20 20 20 20  20 20 20 3b 61 64 64 72  |]          ;addr|
00001690  65 73 73 20 6f 66 20 66  69 72 73 74 20 70 61 72  |ess of first par|
000016a0  61 6d 65 74 65 72 0d 00  a3 41 20 20 4c 44 52 20  |ameter...A  LDR |
000016b0  20 20 20 20 20 20 52 33  2c 5b 52 30 5d 20 20 20  |      R3,[R0]   |
000016c0  20 20 20 20 20 20 20 3b  73 74 61 72 74 20 6f 66  |       ;start of|
000016d0  20 62 6c 6f 63 6b 20 68  6f 6c 64 69 6e 67 20 70  | block holding p|
000016e0  6f 69 6e 74 65 72 73 0d  00 a4 44 20 20 4c 44 52  |ointers...D  LDR|
000016f0  20 20 20 20 20 20 20 52  31 30 2c 6e 75 6d 5f 66  |       R10,num_f|
00001700  6f 75 6e 64 20 20 20 20  20 20 20 20 3b 6e 6f 20  |ound        ;no |
00001710  6f 66 20 65 6e 74 72 69  65 73 20 61 6c 72 65 61  |of entries alrea|
00001720  64 79 20 69 6e 20 62 6c  6f 63 6b 0d 00 a5 16 20  |dy in block.... |
00001730  20 43 4d 50 20 20 20 20  20 20 20 52 31 30 2c 23  | CMP       R10,#|
00001740  30 0d 00 a6 4f 20 20 42  45 51 20 20 20 20 20 20  |0...O  BEQ      |
00001750  20 75 70 64 61 74 65 66  6c 61 67 20 20 20 20 20  | updateflag     |
00001760  20 3b 69 66 20 62 6c 6f  63 6b 20 69 73 20 65 6d  | ;if block is em|
00001770  70 74 79 2c 20 77 65 20  6b 6e 6f 77 20 74 68 69  |pty, we know thi|
00001780  73 20 69 73 20 61 20 6e  65 77 20 65 6e 74 72 79  |s is a new entry|
00001790  0d 00 a7 12 2e 67 65 74  61 72 72 61 79 65 6e 74  |.....getarrayent|
000017a0  72 79 0d 00 a8 3c 20 20  4c 44 52 20 20 20 20 20  |ry...<  LDR     |
000017b0  20 20 52 31 32 2c 5b 52  33 5d 2c 23 34 20 20 20  |  R12,[R3],#4   |
000017c0  20 20 20 3b 6c 6f 61 64  20 6e 65 78 74 20 70 6f  |   ;load next po|
000017d0  69 6e 74 65 72 20 69 6e  74 6f 20 52 31 32 0d 00  |inter into R12..|
000017e0  a9 04 0d 00 aa 4e 20 20  20 20 20 20 20 20 20 20  |.....N          |
000017f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001800  20 3b 52 31 32 20 6e 6f  77 20 70 6f 69 6e 74 73  | ;R12 now points|
00001810  20 74 6f 20 73 74 61 72  74 20 6f 66 20 61 63 74  | to start of act|
00001820  75 61 6c 20 61 72 72 61  79 20 73 74 72 69 6e 67  |ual array string|
00001830  0d 00 ab 47 20 20 20 20  20 20 20 20 20 20 20 20  |...G            |
00001840  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00001850  52 31 31 20 73 74 69 6c  6c 20 73 74 6f 72 65 73  |R11 still stores|
00001860  20 73 74 61 72 74 20 6f  66 20 66 69 6c 65 2f 64  | start of file/d|
00001870  69 72 20 6e 61 6d 65 0d  00 ac 15 20 4d 4f 56 20  |ir name.... MOV |
00001880  20 20 20 20 20 20 52 38  2c 52 31 31 0d 00 ad 29  |      R8,R11...)|
00001890  3b a4 52 65 70 6f 72 74  5f 54 65 78 74 53 28 22  |;.Report_TextS("|
000018a0  5c 72 20 63 75 72 72 65  6e 74 20 69 6e 20 62 6c  |\r current in bl|
000018b0  6f 63 6b 22 29 0d 00 ae  16 3b a4 52 65 70 6f 72  |ock")....;.Repor|
000018c0  74 5f 54 65 78 74 30 28  31 32 29 0d 00 af 26 3b  |t_Text0(12)...&;|
000018d0  a4 52 65 70 6f 72 74 5f  54 65 78 74 53 28 22 5c  |.Report_TextS("\|
000018e0  72 20 73 65 61 72 63 68  69 6e 67 20 66 6f 72 22  |r searching for"|
000018f0  29 0d 00 b0 15 3b a4 52  65 70 6f 72 74 5f 54 65  |)....;.Report_Te|
00001900  78 74 30 28 38 29 0d 00  b1 54 3b 2d 2d 2d 2d 2d  |xt0(8)...T;-----|
00001910  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 63 6f 6d 70  |------------comp|
00001920  61 72 65 20 73 74 72 69  6e 67 73 2d 2d 2d 2d 2d  |are strings-----|
00001930  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00001950  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 0d 00 b2 09 2e 73  |----------.....s|
00001960  63 61 6e 0d 00 b3 1a 20  4c 44 52 42 20 20 20 20  |can.... LDRB    |
00001970  20 20 52 30 2c 5b 52 31  32 5d 2c 23 31 0d 00 b4  |  R0,[R12],#1...|
00001980  19 20 4c 44 52 42 20 20  20 20 20 20 52 32 2c 5b  |. LDRB      R2,[|
00001990  52 38 5d 2c 23 31 0d 00  b5 14 20 43 4d 50 20 20  |R8],#1.... CMP  |
000019a0  20 20 20 20 20 52 32 2c  52 30 0d 00 b6 4d 20 42  |     R2,R0...M B|
000019b0  45 51 20 20 20 20 20 20  20 73 63 61 6e 20 20 20  |EQ       scan   |
000019c0  20 20 20 20 20 20 20 20  20 20 3b 73 63 61 6e 20  |          ;scan |
000019d0  74 68 69 73 20 65 6c 65  6d 65 6e 74 20 6f 66 20  |this element of |
000019e0  61 72 72 61 79 20 66 6f  72 20 66 69 6c 65 2f 64  |array for file/d|
000019f0  69 72 20 6e 61 6d 65 0d  00 b7 04 0d 00 b8 0a 2e  |ir name.........|
00001a00  63 68 65 63 6b 0d 00 b9  04 0d 00 ba 46 20 20 20  |check.......F   |
00001a10  3b 20 63 68 65 63 6b 20  77 68 65 74 68 65 72 20  |; check whether |
00001a20  77 65 20 68 61 76 65 20  72 65 61 63 68 65 64 20  |we have reached |
00001a30  74 68 65 20 65 6e 64 20  6f 66 20 74 68 65 20 66  |the end of the f|
00001a40  69 6c 65 2f 64 69 72 20  6e 61 6d 65 2e 2e 2e 0d  |ile/dir name....|
00001a50  00 bb 54 20 20 20 43 4d  50 20 20 20 20 20 52 30  |..T   CMP     R0|
00001a60  2c 23 6c 61 73 74 63 74  72 6c 63 68 61 72 25 20  |,#lastctrlchar% |
00001a70  3b 20 69 73 20 63 68 61  72 20 61 74 20 65 6e 64  |; is char at end|
00001a80  20 6f 66 20 6f 6c 64 20  6c 65 61 66 6e 61 6d 65  | of old leafname|
00001a90  20 61 20 6c 69 6e 65 20  74 65 72 6d 69 6e 61 74  | a line terminat|
00001aa0  6f 72 3f 0d 00 bc 1b 20  20 20 4c 44 52 6c 73 42  |or?....   LDRlsB|
00001ab0  20 20 20 52 32 2c 5b 52  38 2c 23 2d 32 5d 0d 00  |   R2,[R8,#-2]..|
00001ac0  bd 4c 20 20 20 43 4d 50  6c 73 20 20 20 20 52 32  |.L   CMPls    R2|
00001ad0  2c 23 97 28 22 2f 22 29  20 20 20 20 20 20 20 3b  |,#.("/")       ;|
00001ae0  20 69 66 20 69 74 20 69  73 2c 20 74 68 65 6e 20  | if it is, then |
00001af0  77 61 73 20 74 68 65 20  6c 61 73 74 20 6d 61 74  |was the last mat|
00001b00  63 68 69 6e 67 20 63 68  61 72 0d 00 be 53 3b 20  |ching char...S; |
00001b10  69 6e 20 74 68 65 20 6c  69 6e 65 20 62 65 69 6e  |in the line bein|
00001b20  67 20 63 68 65 63 6b 65  64 20 61 20 73 6c 61 73  |g checked a slas|
00001b30  68 2c 20 20 69 2e 65 2e  20 68 61 76 65 20 77 65  |h,  i.e. have we|
00001b40  20 66 6f 75 6e 64 20 61  20 64 75 70 6c 69 63 61  | found a duplica|
00001b50  74 65 20 64 69 72 65 63  74 6f 72 79 3f 0d 00 bf  |te directory?...|
00001b60  3d 20 20 20 4d 4f 56 65  71 20 20 20 20 20 52 31  |=   MOVeq     R1|
00001b70  30 2c 23 30 20 20 20 20  20 20 20 20 20 20 20 20  |0,#0            |
00001b80  3b 20 69 66 20 73 6f 2c  20 74 68 69 73 20 69 73  |; if so, this is|
00001b90  20 61 20 6d 61 74 63 68  20 2d 0d 00 c0 3e 20 20  | a match -...>  |
00001ba0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001bb0  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 65  |             ; e|
00001bc0  6e 73 75 72 65 20 77 65  20 65 78 69 74 20 6c 6f  |nsure we exit lo|
00001bd0  6f 70 20 65 61 72 6c 79  0d 00 c1 33 3b 4e 6f 74  |op early...3;Not|
00001be0  65 20 74 68 61 74 20 2a  6f 6e 6c 79 2a 20 64 69  |e that *only* di|
00001bf0  72 65 63 74 6f 72 69 65  73 20 63 61 6e 20 62 65  |rectories can be|
00001c00  20 64 75 70 6c 69 63 61  74 65 21 0d 00 c2 04 0d  | duplicate!.....|
00001c10  00 c3 30 20 53 55 42 53  20 20 20 20 20 20 52 31  |..0 SUBS      R1|
00001c20  30 2c 52 31 30 2c 23 31  20 20 20 20 20 3b 64 65  |0,R10,#1     ;de|
00001c30  63 72 65 6d 65 6e 74 20  63 6f 75 6e 74 65 72 0d  |crement counter.|
00001c40  00 c4 54 20 42 48 49 20  20 20 20 20 20 20 67 65  |..T BHI       ge|
00001c50  74 61 72 72 61 79 65 6e  74 72 79 20 20 3b 65 78  |tarrayentry  ;ex|
00001c60  69 74 20 6c 6f 6f 70 20  69 66 20 73 74 72 69 6e  |it loop if strin|
00001c70  67 20 6d 61 74 63 68 65  64 20 6f 72 20 69 66 20  |g matched or if |
00001c80  61 6c 6c 20 65 6e 74 72  69 65 73 20 63 68 65 63  |all entries chec|
00001c90  6b 65 64 0d 00 c5 04 0d  00 c6 0f 2e 75 70 64 61  |ked.........upda|
00001ca0  74 65 66 6c 61 67 0d 00  c7 43 20 3b 53 54 52 20  |teflag...C ;STR |
00001cb0  20 20 20 20 20 20 52 31  30 2c 74 72 75 65 66 61  |      R10,truefa|
00001cc0  6c 73 65 20 20 3b 52 31  30 20 69 73 20 2d 31 20  |lse  ;R10 is -1 |
00001cd0  69 66 20 6d 61 74 63 68  20 77 61 73 20 6d 61 64  |if match was mad|
00001ce0  65 2c 20 65 6c 73 65 20  30 0d 00 c8 54 20 42 6e  |e, else 0...T Bn|
00001cf0  65 20 20 20 20 20 20 20  67 65 74 73 74 61 72 74  |e       getstart|
00001d00  6f 66 6c 69 6e 65 20 3b  69 66 20 7a 65 72 6f 20  |ofline ;if zero |
00001d10  66 6c 61 67 20 73 65 74  2c 20 77 65 20 73 63 61  |flag set, we sca|
00001d20  6e 6e 65 64 20 61 6c 6c  20 65 6e 74 72 69 65 73  |nned all entries|
00001d30  20 62 75 74 20 66 6f 75  6e 64 20 6e 6f 0d 00 c9  | but found no...|
00001d40  51 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |Q               |
00001d50  20 20 20 20 20 20 20 20  20 20 20 3b 6d 61 74 63  |           ;matc|
00001d60  68 2c 20 73 6f 20 77 65  20 6e 65 65 64 20 74 6f  |h, so we need to|
00001d70  20 63 6f 70 79 20 74 68  65 20 6c 65 61 66 6e 61  | copy the leafna|
00001d80  6d 65 20 69 6e 74 6f 20  62 6c 6f 63 6b 25 0d 00  |me into block%..|
00001d90  ca 33 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.3              |
00001da0  20 20 20 20 20 20 20 20  20 20 20 20 3b 61 6e 64  |            ;and|
00001db0  20 43 52 2d 74 65 72 6d  69 6e 61 74 65 20 69 74  | CR-terminate it|
00001dc0  2e 0d 00 cb 4d 20 20 20  20 20 20 20 20 20 20 20  |....M           |
00001dd0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00001de0  4f 74 68 65 72 77 69 73  65 2c 20 77 65 20 72 65  |Otherwise, we re|
00001df0  74 75 72 6e 20 74 6f 20  74 68 65 20 73 74 61 72  |turn to the star|
00001e00  74 20 6f 66 20 74 68 65  20 6c 6f 6f 70 2e 0d 00  |t of the loop...|
00001e10  cc 04 0d 00 cd 54 3b 2d  2d 2d 2d 2d 2d 2d 2d 2d  |.....T;---------|
00001e20  2d 2d 2d 2d 2d 63 6f 70  79 20 66 69 6c 65 2f 64  |-----copy file/d|
00001e30  69 72 20 6e 61 6d 65 20  69 6e 74 6f 20 62 6c 6f  |ir name into blo|
00001e40  63 6b 25 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |ck%-------------|
00001e50  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00001e60  2d 2d 2d 2d 2d 2d 0d 00  ce 44 20 20 4d 4f 56 20  |------...D  MOV |
00001e70  20 20 20 20 20 20 52 32  2c 23 30 20 20 20 20 20  |      R2,#0     |
00001e80  20 20 20 20 20 20 3b 77  65 20 61 72 65 20 75 73  |      ;we are us|
00001e90  69 6e 67 20 52 32 20 61  73 20 61 20 6c 65 6e 67  |ing R2 as a leng|
00001ea0  74 68 20 63 6f 75 6e 74  65 72 0d 00 cf 47 20 20  |th counter...G  |
00001eb0  4c 44 52 20 20 20 20 20  20 20 52 30 2c 5b 52 39  |LDR       R0,[R9|
00001ec0  2c 23 31 36 5d 20 20 20  20 20 3b 61 64 64 72 65  |,#16]     ;addre|
00001ed0  73 73 20 6f 66 20 74 68  69 72 64 20 70 61 72 61  |ss of third para|
00001ee0  6d 65 74 65 72 20 28 6e  61 6d 65 5f 70 74 72 25  |meter (name_ptr%|
00001ef0  29 0d 00 d0 36 20 20 4c  44 52 20 20 20 20 20 20  |)...6  LDR      |
00001f00  20 52 31 30 2c 5b 52 30  5d 20 20 20 20 20 20 20  | R10,[R0]       |
00001f10  20 3b 70 6f 69 6e 74 20  74 6f 20 6f 75 74 70 75  | ;point to outpu|
00001f20  74 20 62 6c 6f 63 6b 0d  00 d1 04 0d 00 d2 4b 20  |t block.......K |
00001f30  20 53 54 52 20 20 20 20  20 20 20 52 31 30 2c 5b  | STR       R10,[|
00001f40  69 6e 64 65 78 25 5d 2c  23 34 20 3b 61 64 64 20  |index%],#4 ;add |
00001f50  74 68 69 73 20 70 6f 69  6e 74 65 72 20 74 6f 20  |this pointer to |
00001f60  69 6e 64 65 78 20 6f 66  20 6e 61 6d 65 20 70 6f  |index of name po|
00001f70  69 6e 74 65 72 73 0d 00  d3 46 20 20 4d 4f 56 20  |inters...F  MOV |
00001f80  20 20 20 20 20 20 52 38  2c 52 31 31 20 20 20 20  |      R8,R11    |
00001f90  20 20 20 20 20 20 3b 52  31 31 20 73 74 69 6c 6c  |      ;R11 still|
00001fa0  20 70 6f 69 6e 74 73 20  74 6f 20 73 74 61 72 74  | points to start|
00001fb0  20 6f 66 20 6c 65 61 66  6e 61 6d 65 0d 00 d4 0d  | of leafname....|
00001fc0  2e 6c 65 61 66 6e 61 6d  65 0d 00 d5 1a 20 4c 44  |.leafname.... LD|
00001fd0  52 42 20 20 20 20 20 20  52 30 2c 5b 52 38 5d 2c  |RB      R0,[R8],|
00001fe0  23 31 20 0d 00 d6 2e 20  43 4d 50 20 20 20 20 20  |#1 .... CMP     |
00001ff0  20 20 52 30 2c 23 97 28  22 2f 22 29 20 20 20 3b  |  R0,#.("/")   ;|
00002000  20 69 73 20 63 68 61 72  20 61 20 73 6c 61 73 68  | is char a slash|
00002010  3f 0d 00 d7 20 20 43 4d  50 6e 65 20 20 20 20 20  |?...  CMPne     |
00002020  52 30 2c 23 6c 61 73 74  63 74 72 6c 63 68 61 72  |R0,#lastctrlchar|
00002030  25 0d 00 d8 39 20 41 44  44 20 20 20 20 20 20 20  |%...9 ADD       |
00002040  52 32 2c 52 32 2c 23 31  20 20 20 20 20 20 20 20  |R2,R2,#1        |
00002050  20 3b 69 6e 63 72 65 6d  65 6e 74 20 6c 65 6e 67  | ;increment leng|
00002060  74 68 20 63 6f 75 6e 74  65 72 0d 00 d9 1a 20 53  |th counter.... S|
00002070  54 52 42 20 20 20 20 20  20 52 30 2c 5b 52 31 30  |TRB      R0,[R10|
00002080  5d 2c 23 31 0d 00 da 17  20 42 67 74 20 20 20 20  |],#1.... Bgt    |
00002090  20 20 20 6c 65 61 66 6e  61 6d 65 0d 00 db 04 0d  |   leafname.....|
000020a0  00 dc 43 20 4d 4f 56 20  20 20 20 20 20 20 52 30  |..C MOV       R0|
000020b0  2c 23 26 30 44 20 3b 20  42 42 43 20 42 41 53 49  |,#&0D ; BBC BASI|
000020c0  43 20 24 78 20 73 74 72  69 6e 67 73 20 6d 75 73  |C $x strings mus|
000020d0  74 20 62 65 20 43 52 20  74 65 72 6d 69 6e 61 74  |t be CR terminat|
000020e0  65 64 0d 00 dd 4b 20 53  55 42 6d 69 20 20 20 20  |ed...K SUBmi    |
000020f0  20 52 31 30 2c 52 31 30  2c 23 31 20 3b 20 6d 69  | R10,R10,#1 ; mi|
00002100  6e 75 73 20 66 6c 61 67  20 68 65 72 65 20 69 6e  |nus flag here in|
00002110  64 69 63 61 74 65 73 20  43 54 52 4c 2d 63 68 61  |dicates CTRL-cha|
00002120  72 20 66 6f 75 6e 64 20  61 62 6f 76 65 0d 00 de  |r found above...|
00002130  3d 20 3b 20 69 6e 20 77  68 69 63 68 20 63 61 73  |= ; in which cas|
00002140  65 20 77 65 20 77 61 6e  74 20 74 6f 20 2a 6f 76  |e we want to *ov|
00002150  65 72 77 72 69 74 65 2a  20 43 54 52 4c 2d 63 68  |erwrite* CTRL-ch|
00002160  61 72 20 77 69 74 68 20  43 52 0d 00 df 25 20 3b  |ar with CR...% ;|
00002170  20 6e 6f 74 20 61 64 64  20 69 74 20 61 66 74 65  | not add it afte|
00002180  72 20 65 6e 64 20 6f 66  20 73 74 72 69 6e 67 0d  |r end of string.|
00002190  00 e0 4f 20 53 55 42 6d  69 20 20 20 20 20 52 32  |..O SUBmi     R2|
000021a0  2c 52 32 2c 23 31 3b 20  61 6c 73 6f 20 64 65 63  |,R2,#1; also dec|
000021b0  72 65 6d 65 6e 74 20 6c  65 6e 67 74 68 20 63 6f  |rement length co|
000021c0  75 6e 74 65 72 20 28 66  6f 72 20 73 79 73 74 65  |unter (for syste|
000021d0  6d 20 66 6f 6e 74 20 73  74 72 69 6e 67 29 0d 00  |m font string)..|
000021e0  e1 31 20 53 54 52 42 20  20 20 20 20 20 52 30 2c  |.1 STRB      R0,|
000021f0  5b 52 31 30 5d 2c 23 31  20 3b 20 74 65 72 6d 69  |[R10],#1 ; termi|
00002200  6e 61 74 65 20 74 68 65  20 73 74 72 69 6e 67 0d  |nate the string.|
00002210  00 e2 46 20 4c 44 52 20  20 20 20 20 20 20 52 33  |..F LDR       R3|
00002220  2c 5b 52 39 2c 23 31 36  5d 20 20 20 20 20 3b 61  |,[R9,#16]     ;a|
00002230  64 64 72 65 73 73 20 6f  66 20 74 68 69 72 64 20  |ddress of third |
00002240  70 61 72 61 6d 65 74 65  72 20 28 6e 61 6d 65 5f  |parameter (name_|
00002250  70 74 72 25 29 0d 00 e3  50 20 53 54 52 20 20 20  |ptr%)...P STR   |
00002260  20 20 20 20 52 31 30 2c  5b 52 33 5d 20 20 20 20  |    R10,[R3]    |
00002270  20 20 20 20 3b 73 74 6f  72 65 20 74 68 65 20 63  |    ;store the c|
00002280  75 72 72 65 6e 74 20 70  6f 73 69 74 69 6f 6e 20  |urrent position |
00002290  6f 66 20 74 68 65 20 6f  75 74 70 75 74 20 70 6f  |of the output po|
000022a0  69 6e 74 65 72 0d 00 e4  2c 20 20 20 20 20 20 20  |inter...,       |
000022b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000022c0  20 20 20 20 3b 62 61 63  6b 20 69 6e 20 68 65 72  |    ;back in her|
000022d0  65 0d 00 e5 36 20 53 54  4d 46 44 20 20 20 20 52  |e...6 STMFD    R|
000022e0  31 33 21 2c 7b 31 2c 32  2c 36 2c 31 34 7d 20 3b  |13!,{1,2,6,14} ;|
000022f0  20 6e 6f 74 65 20 52 30  20 61 6c 73 6f 20 63 6f  | note R0 also co|
00002300  72 72 75 70 74 65 64 0d  00 e6 14 20 42 4c 20 6d  |rrupted.... BL m|
00002310  65 61 73 75 72 65 5f 74  65 78 74 0d 00 e7 52 20  |easure_text...R |
00002320  4c 44 4d 46 44 20 20 20  20 52 31 33 21 2c 7b 31  |LDMFD    R13!,{1|
00002330  2c 32 2c 36 2c 31 34 7d  20 3b 62 75 74 20 64 6f  |,2,6,14} ;but do|
00002340  6e 27 74 20 72 65 73 74  6f 72 65 20 52 30 20 2d  |n't restore R0 -|
00002350  20 77 65 20 6e 65 65 64  20 74 68 65 20 72 65 73  | we need the res|
00002360  75 6c 74 20 69 6e 20 74  68 65 72 65 21 0d 00 e8  |ult in there!...|
00002370  04 0d 00 e9 54 3b 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |....T;----------|
00002380  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000023c0  2d 2d 2d 2d 2d 0d 00 ea  44 3b 44 75 72 69 6e 67  |-----...D;During|
000023d0  20 74 68 65 20 66 6f 6c  6c 6f 77 69 6e 67 20 73  | the following s|
000023e0  65 63 74 69 6f 6e 2c 20  52 32 20 68 6f 6c 64 73  |ection, R2 holds|
000023f0  20 6c 65 6e 67 74 68 20  6f 66 20 66 69 6c 65 6e  | length of filen|
00002400  61 6d 65 20 66 6f 75 6e  64 0d 00 eb 2b 3b 52 31  |ame found...+;R1|
00002410  30 20 70 6f 69 6e 74 73  20 74 6f 20 6f 75 74 70  |0 points to outp|
00002420  75 74 20 62 6c 6f 63 6b  20 28 6e 61 6d 65 5f 70  |ut block (name_p|
00002430  74 72 25 29 0d 00 ec 3b  3b 52 33 20 61 6e 64 20  |tr%)...;;R3 and |
00002440  52 30 20 61 72 65 20 61  76 61 69 6c 61 62 6c 65  |R0 are available|
00002450  20 66 6f 72 20 75 73 65  20 61 73 20 74 65 6d 70  | for use as temp|
00002460  6f 72 61 72 79 20 72 65  67 69 73 74 65 72 73 0d  |orary registers.|
00002470  00 ed 54 3b 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |..T;------------|
00002480  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000024c0  2d 2d 2d 0d 00 ee 04 0d  00 ef 40 20 20 4c 44 52  |---.......@  LDR|
000024d0  20 20 20 20 20 20 20 52  33 2c 6d 61 78 6c 65 6e  |       R3,maxlen|
000024e0  20 20 20 20 20 20 20 20  3b 77 65 20 6b 65 65 70  |        ;we keep|
000024f0  20 6d 61 78 69 6d 75 6d  20 6c 65 6e 67 74 68 20  | maximum length |
00002500  69 6e 20 68 65 72 65 0d  00 f0 40 20 20 43 4d 50  |in here...@  CMP|
00002510  20 20 20 20 20 20 20 52  33 2c 52 30 20 20 20 20  |       R3,R0    |
00002520  20 20 20 20 20 20 20 20  3b 69 73 20 69 74 20 67  |        ;is it g|
00002530  72 65 61 74 65 72 20 74  68 61 6e 20 6f 6c 64 20  |reater than old |
00002540  6c 65 6e 67 74 68 3f 0d  00 f1 19 20 20 53 54 52  |length?....  STR|
00002550  6c 74 20 20 20 20 20 52  30 2c 6d 61 78 6c 65 6e  |lt     R0,maxlen|
00002560  0d 00 f2 3c 20 20 4c 44  52 6c 74 20 20 20 20 20  |...<  LDRlt     |
00002570  52 30 2c 5b 52 39 5d 20  20 20 20 20 20 20 20 20  |R0,[R9]         |
00002580  20 3b 61 64 64 72 65 73  73 20 6f 66 20 66 69 72  | ;address of fir|
00002590  73 74 20 70 61 72 61 6d  65 74 65 72 0d 00 f3 48  |st parameter...H|
000025a0  20 20 4c 44 52 6c 74 20  20 20 20 20 52 30 2c 5b  |  LDRlt     R0,[|
000025b0  52 30 5d 20 20 20 20 20  20 20 20 20 20 3b 73 74  |R0]          ;st|
000025c0  61 72 74 20 6f 66 20 70  6f 69 6e 74 65 72 73 20  |art of pointers |
000025d0  62 6c 6f 63 6b 20 28 69  6e 64 65 78 5f 70 74 72  |block (index_ptr|
000025e0  25 21 38 29 0d 00 f4 06  20 20 0d 00 f5 37 20 20  |%!8)....  ...7  |
000025f0  53 55 42 6c 74 20 20 20  20 20 52 31 30 2c 52 31  |SUBlt     R10,R1|
00002600  30 2c 52 32 20 20 20 20  20 20 20 3b 52 32 20 73  |0,R2       ;R2 s|
00002610  74 69 6c 6c 20 68 6f 6c  64 73 20 6c 65 6e 67 74  |till holds lengt|
00002620  68 0d 00 f6 4b 20 20 53  55 42 6c 74 20 20 20 20  |h...K  SUBlt    |
00002630  20 52 31 30 2c 52 31 30  2c 23 31 20 20 20 20 20  | R10,R10,#1     |
00002640  20 20 3b 73 6f 20 67 6f  20 62 61 63 6b 20 74 6f  |  ;so go back to|
00002650  20 73 74 61 72 74 20 6f  66 20 73 74 72 69 6e 67  | start of string|
00002660  20 6a 75 73 74 20 6f 75  74 70 75 74 0d 00 f7 3e  | just output...>|
00002670  20 20 53 54 52 6c 74 20  20 20 20 20 52 31 30 2c  |  STRlt     R10,|
00002680  5b 52 30 2c 23 2d 34 5d  20 20 20 20 20 3b 61 6e  |[R0,#-4]     ;an|
00002690  64 20 73 74 6f 72 65 20  69 74 20 61 74 20 69 6e  |d store it at in|
000026a0  64 65 78 5f 70 74 72 25  21 34 0d 00 f8 04 0d 00  |dex_ptr%!4......|
000026b0  f9 04 0d 00 fa 45 20 20  4c 44 52 20 20 20 20 20  |.....E  LDR     |
000026c0  20 20 52 33 2c 6e 75 6d  5f 66 6f 75 6e 64 20 20  |  R3,num_found  |
000026d0  20 20 3b 6c 6f 61 64 20  6e 6f 2e 20 6f 66 20 65  |  ;load no. of e|
000026e0  6e 74 72 69 65 73 20 61  6c 72 65 61 64 79 20 69  |ntries already i|
000026f0  6e 20 62 6c 6f 63 6b 0d  00 fb 2f 20 20 41 44 44  |n block.../  ADD|
00002700  20 20 20 20 20 20 20 52  33 2c 52 33 2c 23 31 20  |       R3,R3,#1 |
00002710  20 20 20 20 20 20 3b 69  6e 63 72 65 6d 65 6e 74  |      ;increment|
00002720  20 63 6f 75 6e 74 0d 00  fc 1c 20 20 53 54 52 20  | count....  STR |
00002730  20 20 20 20 20 20 52 33  2c 6e 75 6d 5f 66 6f 75  |      R3,num_fou|
00002740  6e 64 0d 00 fd 1d 42 20  20 20 20 20 20 20 20 20  |nd....B         |
00002750  20 67 65 74 73 74 61 72  74 6f 66 6c 69 6e 65 0d  | getstartofline.|
00002760  00 fe 2c 4d 4f 56 20 20  20 20 20 20 52 31 35 2c  |..,MOV      R15,|
00002770  20 52 31 34 20 20 20 20  20 20 20 20 20 20 3b 65  | R14          ;e|
00002780  78 69 74 20 72 6f 75 74  69 6e 65 0d 00 ff 54 3b  |xit routine...T;|
00002790  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 65  |---------------e|
000027a0  78 69 74 20 77 69 74 68  20 65 72 72 6f 72 2d 2d  |xit with error--|
000027b0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000027d0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 0d  |---------------.|
000027e0  01 00 11 2e 65 78 69 74  5f 61 6e 64 5f 64 69 65  |....exit_and_die|
000027f0  0d 01 01 19 3b 20 4d 4f  56 20 20 20 20 20 20 20  |....; MOV       |
00002800  52 30 2c 69 6e 64 65 78  25 0d 01 02 36 3b 20 53  |R0,index%...6; S|
00002810  54 52 20 20 20 20 20 20  20 52 30 2c 74 72 75 65  |TR       R0,true|
00002820  66 61 6c 73 65 20 20 20  20 20 3b 73 69 67 6e 61  |false     ;signa|
00002830  6c 20 65 72 72 6f 72 20  6f 6e 20 65 78 69 74 0d  |l error on exit.|
00002840  01 03 2d 20 4d 4f 56 20  20 20 20 20 20 52 31 35  |..- MOV      R15|
00002850  2c 20 52 31 34 20 20 20  20 20 20 20 20 20 20 3b  |, R14          ;|
00002860  65 78 69 74 20 72 6f 75  74 69 6e 65 0d 01 04 54  |exit routine...T|
00002870  3b 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |;===============|
00002880  3d 64 69 73 70 6c 61 79  20 68 6f 75 72 67 6c 61  |=display hourgla|
00002890  73 73 20 77 69 74 68 20  63 61 6c 63 75 6c 61 74  |ss with calculat|
000028a0  65 64 20 70 65 72 63 65  6e 74 61 67 65 3d 3d 3d  |ed percentage===|
000028b0  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
000028c0  0d 01 05 0d 2e 74 65 73  74 74 69 6d 65 0d 01 06  |.....testtime...|
000028d0  24 20 53 57 49 20 20 20  20 20 20 22 4f 53 5f 52  |$ SWI      "OS_R|
000028e0  65 61 64 4d 6f 6e 6f 74  6f 6e 69 63 54 69 6d 65  |eadMonotonicTime|
000028f0  22 0d 01 07 04 0d 01 08  17 20 54 53 54 20 20 20  |"........ TST   |
00002900  20 20 20 52 30 2c 23 25  31 30 30 30 0d 01 09 27  |   R0,#%1000...'|
00002910  20 4d 4f 56 4e 45 20 20  20 20 52 31 35 2c 20 52  | MOVNE    R15, R|
00002920  31 34 20 20 20 20 20 20  20 20 20 20 3b 72 65 74  |14          ;ret|
00002930  75 72 6e 0d 01 0a 4f 20  20 20 20 20 20 20 20 20  |urn...O         |
00002940  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002950  20 20 20 3b 64 6f 6e 27  74 20 63 61 6c 6c 20 74  |   ;don't call t|
00002960  68 69 73 20 6c 6f 6e 67  2d 77 69 6e 64 65 64 20  |his long-winded |
00002970  72 6f 75 74 69 6e 65 20  65 76 65 72 79 20 74 69  |routine every ti|
00002980  6d 65 0d 01 0b 13 20 4d  4f 56 20 20 20 20 20 20  |me.... MOV      |
00002990  52 30 2c 23 30 0d 01 0c  4c 20 53 57 49 20 20 20  |R0,#0...L SWI   |
000029a0  20 20 20 22 4f 53 5f 41  72 67 73 22 20 20 20 20  |   "OS_Args"    |
000029b0  20 20 20 20 20 3b 52 31  20 68 6f 6c 64 73 20 66  |     ;R1 holds f|
000029c0  69 6c 65 20 68 61 6e 64  6c 65 3b 20 8f 23 69 25  |ile handle; .#i%|
000029d0  20 72 65 74 75 72 6e 65  64 20 69 6e 74 6f 20 52  | returned into R|
000029e0  32 0d 01 0d 15 20 3b 64  69 76 69 64 65 20 52 32  |2.... ;divide R2|
000029f0  20 62 79 20 52 35 0d 01  0e 14 20 4d 4f 56 20 20  | by R5.... MOV  |
00002a00  20 20 20 20 20 52 33 2c  23 31 0d 01 0f 3c 20 3b  |     R3,#1...< ;|
00002a10  73 65 74 20 62 69 74 20  30 20 69 6e 20 52 33 2c  |set bit 0 in R3,|
00002a20  20 77 68 69 63 68 20 77  69 6c 6c 20 62 65 20 73  | which will be s|
00002a30  68 69 66 74 65 64 20 6c  65 66 74 20 74 68 65 6e  |hifted left then|
00002a40  20 72 69 67 68 74 0d 01  10 13 20 4d 4f 56 20 20  | right.... MOV  |
00002a50  20 20 20 20 52 30 2c 23  30 0d 01 11 23 20 3b 63  |    R0,#0...# ;c|
00002a60  6c 65 61 72 20 52 30 20  74 6f 20 61 63 63 75 6d  |lear R0 to accum|
00002a70  75 6c 61 74 65 20 72 65  73 75 6c 74 0d 01 12 20  |ulate result... |
00002a80  20 43 4d 50 20 20 20 20  20 20 52 35 2c 23 30 3a  | CMP      R5,#0:|
00002a90  ec 51 20 20 20 20 50 43  2c 52 31 34 0d 01 13 1e  |.Q    PC,R14....|
00002aa0  20 3b 63 68 65 63 6b 20  66 6f 72 20 64 69 76 69  | ;check for divi|
00002ab0  64 65 20 62 79 20 7a 65  72 6f 0d 01 14 04 0d 01  |de by zero......|
00002ac0  15 0a 2e 73 74 61 72 74  0d 01 16 14 20 43 4d 50  |...start.... CMP|
00002ad0  20 20 20 20 20 20 20 52  35 2c 52 32 0d 01 17 1a  |       R5,R2....|
00002ae0  20 4d 4f 56 43 43 20 20  20 20 20 52 35 2c 52 35  | MOVCC     R5,R5|
00002af0  2c 41 53 4c 23 31 0d 01  18 1a 20 4d 4f 56 43 43  |,ASL#1.... MOVCC|
00002b00  20 20 20 20 20 52 33 2c  52 33 2c 41 53 4c 23 31  |     R3,R3,ASL#1|
00002b10  0d 01 19 14 20 42 43 43  20 20 20 20 20 20 20 73  |.... BCC       s|
00002b20  74 61 72 74 0d 01 1a 2e  20 3b 73 68 69 66 74 20  |tart.... ;shift |
00002b30  52 35 20 6c 65 66 74 20  75 6e 74 69 6c 20 69 74  |R5 left until it|
00002b40  20 69 73 20 62 69 67 67  65 72 20 74 68 61 6e 20  | is bigger than |
00002b50  52 32 0d 01 1b 46 20 3b  73 68 69 66 74 20 52 33  |R2...F ;shift R3|
00002b60  20 6c 65 66 74 20 69 6e  20 70 61 72 61 6c 6c 65  | left in paralle|
00002b70  6c 20 69 6e 20 6f 72 64  65 72 20 74 6f 20 66 6c  |l in order to fl|
00002b80  61 67 20 68 6f 77 20 66  61 72 20 77 65 20 68 61  |ag how far we ha|
00002b90  76 65 20 74 6f 20 67 6f  0d 01 1c 04 0d 01 1d 09  |ve to go........|
00002ba0  2e 6e 65 78 74 0d 01 1e  13 20 43 4d 50 20 20 20  |.next.... CMP   |
00002bb0  20 20 20 52 32 2c 52 35  0d 01 1f 2e 20 3b 63 61  |   R2,R5.... ;ca|
00002bc0  72 72 79 20 69 73 20 73  65 74 20 69 66 20 52 32  |rry is set if R2|
00002bd0  3e 52 35 20 28 64 6f 6e  27 74 20 61 73 6b 20 6d  |>R5 (don't ask m|
00002be0  65 20 77 68 79 29 0d 01  20 16 20 53 55 42 43 53  |e why).. . SUBCS|
00002bf0  20 20 20 20 52 32 2c 52  32 2c 52 35 0d 01 21 3e  |    R2,R2,R5..!>|
00002c00  20 3b 73 75 62 74 72 61  63 74 20 52 35 20 66 72  | ;subtract R5 fr|
00002c10  6f 6d 20 52 32 20 69 66  20 74 68 69 73 20 77 6f  |om R2 if this wo|
00002c20  75 6c 64 20 67 69 76 65  20 61 20 70 6f 73 69 74  |uld give a posit|
00002c30  69 76 65 20 61 6e 73 77  65 72 0d 01 22 16 20 41  |ive answer..". A|
00002c40  44 44 43 53 20 20 20 20  52 30 2c 52 30 2c 52 33  |DDCS    R0,R0,R3|
00002c50  0d 01 23 44 20 3b 61 6e  64 20 61 64 64 20 74 68  |..#D ;and add th|
00002c60  65 20 63 75 72 72 65 6e  74 20 62 69 74 20 69 6e  |e current bit in|
00002c70  20 52 33 20 74 6f 20 74  68 65 20 61 63 63 75 6d  | R3 to the accum|
00002c80  75 6c 61 74 69 6e 67 20  61 6e 73 77 65 72 20 69  |ulating answer i|
00002c90  6e 20 52 30 0d 01 24 19  20 4d 4f 56 53 20 20 20  |n R0..$. MOVS   |
00002ca0  20 20 52 33 2c 52 33 2c  4c 53 52 23 31 0d 01 25  |  R3,R3,LSR#1..%|
00002cb0  15 20 3b 52 6f 74 61 74  65 20 52 33 20 72 69 67  |. ;Rotate R3 rig|
00002cc0  68 74 0d 01 26 19 20 4d  4f 56 4e 45 20 20 20 20  |ht..&. MOVNE    |
00002cd0  52 35 2c 52 35 2c 4c 53  52 23 31 0d 01 27 3a 20  |R5,R5,LSR#1..': |
00002ce0  3b 61 6e 64 20 69 66 20  69 74 20 68 61 73 20 6e  |;and if it has n|
00002cf0  6f 74 20 72 65 61 63 68  65 64 20 7a 65 72 6f 2c  |ot reached zero,|
00002d00  20 61 6c 73 6f 20 72 6f  74 61 74 65 20 52 35 20  | also rotate R5 |
00002d10  72 69 67 68 74 0d 01 28  12 20 42 4e 45 20 20 20  |right..(. BNE   |
00002d20  20 20 20 6e 65 78 74 0d  01 29 52 20 3b 49 66 20  |   next..)R ;If |
00002d30  52 33 3d 7a 65 72 6f 2c  20 77 65 20 68 61 76 65  |R3=zero, we have|
00002d40  20 72 6f 74 61 74 65 64  20 62 61 63 6b 20 61 73  | rotated back as|
00002d50  20 6d 61 6e 79 20 62 69  74 73 20 61 73 20 77 65  | many bits as we|
00002d60  20 73 74 61 72 74 65 64  2c 20 61 6e 64 20 63 61  | started, and ca|
00002d70  6e 20 6e 6f 77 20 65 6e  64 0d 01 2a 12 20 3b 52  |n now end..*. ;R|
00002d80  65 73 75 6c 74 20 69 6e  20 52 30 0d 01 2b 24 20  |esult in R0..+$ |
00002d90  53 57 49 20 20 20 20 20  20 22 48 6f 75 72 67 6c  |SWI      "Hourgl|
00002da0  61 73 73 5f 50 65 72 63  65 6e 74 61 67 65 22 0d  |ass_Percentage".|
00002db0  01 2c 27 20 4d 4f 56 20  20 20 20 20 20 52 31 35  |.,' MOV      R15|
00002dc0  2c 20 52 31 34 20 20 20  20 20 20 20 20 20 20 3b  |, R14          ;|
00002dd0  72 65 74 75 72 6e 0d 01  2d 04 0d 01 2e 11 2e 6d  |return..-......m|
00002de0  65 61 73 75 72 65 5f 74  65 78 74 0d 01 2f 13 20  |easure_text../. |
00002df0  4d 4f 56 20 20 20 20 20  52 31 2c 52 31 31 0d 01  |MOV     R1,R11..|
00002e00  30 48 20 4d 4f 56 20 20  20 20 20 52 36 2c 52 32  |0H MOV     R6,R2|
00002e10  20 3b 6d 6f 76 65 20 6c  65 6e 67 74 68 20 76 61  | ;move length va|
00002e20  6c 75 65 20 65 6c 73 65  77 68 65 72 65 20 69 6e  |lue elsewhere in|
00002e30  20 63 61 73 65 20 77 65  20 6e 65 65 64 20 69 74  | case we need it|
00002e40  20 6c 61 74 65 72 0d 01  31 13 3b 20 4d 4f 56 20  | later..1.; MOV |
00002e50  20 20 20 20 52 32 2c 23  30 0d 01 32 12 20 4d 4f  |    R2,#0..2. MO|
00002e60  56 20 20 20 20 20 52 30  2c 23 31 0d 01 33 13 20  |V     R0,#1..3. |
00002e70  53 57 49 20 20 20 20 20  26 36 30 30 46 39 0d 01  |SWI     &600F9..|
00002e80  34 31 20 3b 53 57 49 20  57 69 6d 70 5f 54 65 78  |41 ;SWI Wimp_Tex|
00002e90  74 4f 70 20 31 20 2d 20  6d 65 61 73 75 72 65 20  |tOp 1 - measure |
00002ea0  77 69 64 74 68 20 6f 66  20 73 74 72 69 6e 67 0d  |width of string.|
00002eb0  01 35 1f 20 3b 49 66 20  6e 6f 20 65 72 72 6f 72  |.5. ;If no error|
00002ec0  2c 20 72 65 73 75 6c 74  20 69 6e 20 52 30 0d 01  |, result in R0..|
00002ed0  36 41 20 4d 4f 56 76 63  20 20 20 20 20 20 52 31  |6A MOVvc      R1|
00002ee0  35 2c 20 52 31 34 20 20  20 20 20 20 20 20 20 20  |5, R14          |
00002ef0  3b 72 65 74 75 72 6e 20  77 69 74 68 20 72 65 73  |;return with res|
00002f00  75 6c 74 20 69 66 20 6e  6f 20 65 72 72 6f 72 0d  |ult if no error.|
00002f10  01 37 2a 20 3b 6f 74 68  65 72 77 69 73 65 20 64  |.7* ;otherwise d|
00002f20  6f 20 73 79 73 74 65 6d  20 66 6f 6e 74 20 63 61  |o system font ca|
00002f30  6c 63 75 6c 61 74 69 6f  6e 0d 01 38 27 20 4d 56  |lculation..8' MV|
00002f40  4e 20 20 20 20 20 52 30  2c 23 30 20 3b 63 75 72  |N     R0,#0 ;cur|
00002f50  72 65 6e 74 20 73 63 72  65 65 6e 20 6d 6f 64 65  |rent screen mode|
00002f60  0d 01 39 12 20 4d 4f 56  20 20 20 20 20 52 31 2c  |..9. MOV     R1,|
00002f70  23 34 0d 01 3a 4e 20 53  57 49 20 20 20 20 20 22  |#4..:N SWI     "|
00002f80  4f 53 5f 52 65 61 64 4d  6f 64 65 56 61 72 69 61  |OS_ReadModeVaria|
00002f90  62 6c 65 22 20 3b 20 53  57 49 20 4f 53 5f 52 65  |ble" ; SWI OS_Re|
00002fa0  61 64 4d 6f 64 65 56 61  72 69 61 62 6c 65 20 34  |adModeVariable 4|
00002fb0  20 2d 20 78 2d 65 69 67  65 6e 66 61 63 74 6f 72  | - x-eigenfactor|
00002fc0  0d 01 3b 1f 3b 65 69 67  65 6e 66 61 63 74 6f 72  |..;.;eigenfactor|
00002fd0  20 72 65 74 75 72 6e 65  64 20 69 6e 20 52 32 0d  | returned in R2.|
00002fe0  01 3c 1d 20 4d 4f 56 20  20 20 20 20 52 36 2c 52  |.<. MOV     R6,R|
00002ff0  36 2c 4c 53 4c 23 33 20  20 3b 2a 38 0d 01 3d 22  |6,LSL#3  ;*8..="|
00003000  20 4d 4f 56 20 20 20 20  20 52 30 2c 52 36 2c 4c  | MOV     R0,R6,L|
00003010  53 4c 20 52 32 20 3b 3c  3c 20 78 65 69 67 0d 01  |SL R2 ;<< xeig..|
00003020  3e 27 20 4d 4f 56 20 20  20 20 20 20 52 31 35 2c  |>' MOV      R15,|
00003030  20 52 31 34 20 20 20 20  20 20 20 20 20 20 3b 72  | R14          ;r|
00003040  65 74 75 72 6e 0d 01 3f  04 0d 01 40 0f 20 a4 52  |eturn..?...@. .R|
00003050  65 70 6f 72 74 47 65 6e  0d 01 41 06 20 5d 0d 01  |eportGen..A. ]..|
00003060  42 24 f4 20 77 65 20 68  61 76 65 20 6e 6f 77 20  |B$. we have now |
00003070  6c 65 66 74 20 74 68 65  20 61 73 73 65 6d 62 6c  |left the assembl|
00003080  65 72 0d 01 43 0b ed 20  70 61 73 73 25 0d 01 44  |er..C.. pass%..D|
00003090  23 f4 20 4f 53 43 4c 49  22 42 72 65 61 6b 53 65  |#. OSCLI"BreakSe|
000030a0  74 20 22 2b 53 54 52 24  7e 28 63 68 65 63 6b 29  |t "+STR$~(check)|
000030b0  0d 01 45 56 f4 20 6d 6f  76 65 20 2e 63 68 65 63  |..EV. move .chec|
000030c0  6b 20 74 6f 20 74 68 65  20 72 65 6c 65 76 61 6e  |k to the relevan|
000030d0  74 20 70 6c 61 63 65 20  61 6e 64 20 75 6e 52 45  |t place and unRE|
000030e0  4d 20 74 68 65 20 42 72  65 61 6b 53 65 74 20 74  |M the BreakSet t|
000030f0  6f 20 73 65 74 20 62 72  65 61 6b 70 6f 69 6e 74  |o set breakpoint|
00003100  20 74 68 65 72 65 0d 01  46 26 f1 20 22 20 4c 65  | there..F&. " Le|
00003110  6e 67 74 68 20 6f 66 20  63 6f 64 65 20 3d 20 22  |ngth of code = "|
00003120  3b 50 25 2d 6f 75 72 63  6f 64 65 25 0d 01 47 21  |;P%-ourcode%..G!|
00003130  f1 20 22 20 42 6c 6f 63  6b 20 61 6c 6c 6f 63 61  |. " Block alloca|
00003140  74 65 64 20 3d 20 22 3b  73 69 7a 65 25 0d 01 48  |ted = ";size%..H|
00003150  05 e1 0d 01 49 04 0d 01  4a 46 dd 20 a4 67 65 74  |....I...JF. .get|
00003160  66 61 6b 65 6c 65 61 66  6e 61 6d 65 28 69 63 6f  |fakeleafname(ico|
00003170  6e 25 2c 63 6c 69 70 25  29 3a f4 20 67 65 74 20  |n%,clip%):. get |
00003180  73 74 72 69 6e 67 20 67  69 76 65 6e 20 6f 66 66  |string given off|
00003190  73 65 74 20 69 6e 20 62  6c 6f 63 6b 0d 01 4b 0d  |set in block..K.|
000031a0  ea 20 70 74 72 25 2c 61  24 0d 01 4c 19 70 74 72  |. ptr%,a$..L.ptr|
000031b0  25 3d 28 21 69 63 6f 6e  5f 69 6e 64 65 78 25 29  |%=(!icon_index%)|
000031c0  2b 38 0d 01 4d 18 61 24  3d 24 28 70 74 72 25 21  |+8..M.a$=$(ptr%!|
000031d0  28 69 63 6f 6e 25 2a 34  29 29 0d 01 4e 22 e7 20  |(icon%*4))..N". |
000031e0  c2 61 24 29 3d 22 2f 22  20 80 20 63 6c 69 70 25  |.a$)="/" . clip%|
000031f0  3d b9 20 8c 20 61 24 3d  c0 61 24 29 0d 01 4f 07  |=. . a$=.a$)..O.|
00003200  3d 61 24 0d 01 50 04 0d  01 51 40 dd 20 a4 73 74  |=a$..P...Q@. .st|
00003210  72 69 6e 67 6c 65 6e 67  74 68 28 74 65 78 74 24  |ringlength(text$|
00003220  29 3a f4 20 72 65 74 75  72 6e 73 20 77 69 64 74  |):. returns widt|
00003230  68 20 6f 66 20 73 74 72  69 6e 67 20 69 6e 20 4f  |h of string in O|
00003240  53 20 75 6e 69 74 73 0d  01 52 12 ea 20 77 69 64  |S units..R.. wid|
00003250  74 68 25 2c 78 65 69 67  25 0d 01 53 2d 20 20 c8  |th%,xeig%..S-  .|
00003260  99 20 22 4f 53 5f 52 65  61 64 4d 6f 64 65 56 61  |. "OS_ReadModeVa|
00003270  72 69 61 62 6c 65 22 2c  2d 31 2c 34 20 b8 20 2c  |riable",-1,4 . ,|
00003280  2c 78 65 69 67 25 0d 01  54 22 20 20 77 69 64 74  |,xeig%..T"  widt|
00003290  68 25 3d 28 38 2a a9 28  74 65 78 74 24 29 29 20  |h%=(8*.(text$)) |
000032a0  3c 3c 20 78 65 69 67 25  0d 01 55 0b 3d 77 69 64  |<< xeig%..U.=wid|
000032b0  74 68 25 0d 01 56 04 0d  01 57 40 dd 20 a4 62 69  |th%..V...W@. .bi|
000032c0  74 73 28 73 24 29 3a f4  20 72 65 74 75 72 6e 20  |ts(s$):. return |
000032d0  76 61 6c 75 65 20 63 6f  6e 74 61 69 6e 69 6e 67  |value containing|
000032e0  20 72 65 6c 65 76 61 6e  74 20 62 69 74 73 20 73  | relevant bits s|
000032f0  65 74 20 74 6f 20 31 0d  01 58 4f f4 20 73 24 20  |et to 1..XO. s$ |
00003300  68 6f 6c 64 73 20 6c 69  73 74 20 6f 66 20 62 69  |holds list of bi|
00003310  74 73 20 74 6f 20 73 65  74 2c 20 73 65 70 61 72  |ts to set, separ|
00003320  61 74 65 64 20 62 79 20  61 6e 79 20 6e 6f 6e 2d  |ated by any non-|
00003330  61 6c 70 68 61 6e 75 6d  65 72 69 63 20 63 68 61  |alphanumeric cha|
00003340  72 61 63 74 65 72 0d 01  59 4c f4 20 54 6f 20 6f  |racter..YL. To o|
00003350  62 74 61 69 6e 20 61 20  76 61 6c 75 65 20 77 68  |btain a value wh|
00003360  65 72 65 20 62 69 74 73  20 32 32 2c 38 20 61 6e  |ere bits 22,8 an|
00003370  64 20 30 20 61 72 65 20  73 65 74 2c 20 75 73 65  |d 0 are set, use|
00003380  20 46 4e 62 69 74 73 28  30 2c 38 2c 32 32 29 20  | FNbits(0,8,22) |
00003390  6f 72 0d 01 5a 4c f4 20  46 4e 62 69 74 73 28 32  |or..ZL. FNbits(2|
000033a0  32 3b 38 3b 30 29 20 6f  72 20 46 4e 62 69 74 73  |2;8;0) or FNbits|
000033b0  28 30 2b 32 32 2c 38 29  20 6f 72 20 46 4e 62 69  |(0+22,8) or FNbi|
000033c0  74 73 28 38 2d 32 32 21  30 29 20 69 66 20 79 6f  |ts(8-22!0) if yo|
000033d0  75 20 72 65 61 6c 6c 79  20 77 61 6e 74 21 0d 01  |u really want!..|
000033e0  5b 0f ea 20 74 6f 74 61  6c 25 2c 63 25 0d 01 5c  |[.. total%,c%..\|
000033f0  0c c8 95 20 a9 28 73 24  29 0d 01 5d 0e 20 20 63  |... .(s$)..].  c|
00003400  25 3d bb 28 73 24 29 0d  01 5e 13 20 20 74 6f 74  |%=.(s$)..^.  tot|
00003410  61 6c 25 2b 3d 31 3c 3c  63 25 0d 01 5f 18 20 20  |al%+=1<<c%.._.  |
00003420  73 24 3d c1 73 24 2c a9  28 c3 28 63 25 29 29 2b  |s$=.s$,.(.(c%))+|
00003430  32 29 0d 01 60 05 ce 0d  01 61 0b 3d 74 6f 74 61  |2)..`....a.=tota|
00003440  6c 25 0d ff                                       |l%..|
00003444