Home » Archimedes archive » Acorn User » AU 1995-10.adf » !CHelp » CHelp/!StrongHlp/Utilities/CleanCopy

CHelp/!StrongHlp/Utilities/CleanCopy

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Acorn User » AU 1995-10.adf » !CHelp
Filename: CHelp/!StrongHlp/Utilities/CleanCopy
Read OK:
File size: 0FA8 bytes
Load address: 0000
Exec address: 0000
File contents
    1REM  >CleanCopy
    2  
    3  REM We dummy-define these variables so that PROC_Error will know them
    4  REM if we should crash before they are actually defined
    5
    6  del% = FALSE
    7  A$   = ""
    8  B$   = ""
    9
   10  ON ERROR PROC_Error
   11
   12  DIM wrk% 255, wrk2% 255
   13
   14  SYS "Hourglass_On"
   15
   16  REM Find parameters
   17
   18  SYS "OS_GetEnv" TO env$
   19
   20  A$ = FN_GetArg(env$,2)
   21  B$ = FN_GetArg(env$,3)
   22
   23REM PRINT "env = ";env$
   24REM PRINT "A = ";A$
   25REM PRINT "B = ";B$
   26
   27  IF A$ = "" THEN ERROR -1,"Needs Manual name"
   28  IF B$ = "" THEN
   29
   30    REM First test whether Wimp$Scrap exists
   31    SYS "XOS_ReadVarVal","Wimp$Scrap",,-1,0,0 TO ,,R2%
   32    IF R2%>=0 THEN ERROR 0,"Wimp$Scrap isn't defined"
   33
   34    REM Remove any old Wimp$Scrap
   35    SYS "OS_File",17,"<Wimp$Scrap>" TO R0%
   36    IF R0% <> 0 THEN OSCLI "Delete <Wimp$Scrap>"
   37
   38    B$ = A$
   39    A$ = "<Wimp$Scrap>"
   40    OSCLI "Rename "+B$+" "+A$
   41    del% = TRUE
   42
   43  ELSE
   44    del% = FALSE
   45  ENDIF
   46
   47  REM We create the new "Manual"
   48
   49  A% = FN_DirSize(A$)
   50  OSCLI "StrongCreate "+B$+" "+STR$ A%
   51
   52  REM Now recursively copy everything
   53
   54  PROC_CopyDir(A$,B$)
   55
   56  REM If we used Wimp$Scrap, we now delete it.
   57
   58  IF del% THEN
   59    OSCLI "Delete "+A$
   60  ENDIF
   61
   62  REM Force Close of new version
   63  REM (So that we don't have to quit !StrongHelp (which closes all) to be safe)
   64
   65  OSCLI "Rename "+B$+" "+B$
   66
   67  SYS "Hourglass_Off"
   68
   69END
   70
   71
   72DEF PROC_CopyDir(From$,To$)
   73LOCAL offset%,read%,x%,A%,F$,T$,S%,strlen%
   74  offset% = 0
   75  REPEAT
   76    SYS "OS_GBPB",10,From$,wrk%,1,offset%,255,"*" TO ,,,read%,offset%
   77    IF read% > 0 THEN
   78      x% = wrk%
   79      FOR A% = 1 TO read%
   80        strlen% = FN_StrLen(x%+20)
   81        ?(x%+20+strlen%) = 13
   82
   83        F$ = From$ + "." + $(x%+20)
   84        T$ = To$   + "." + $(x%+20)
   85        CASE x%!16 OF
   86          WHEN 1 : REM PRINT "Copy ";F$
   87                   SYS "OS_FSControl",26,F$,T$,0
   88          WHEN 2 : S% = FN_DirSize(F$)
   89                   REM PRINT "Create ";T$,S%
   90                   OSCLI "Cdir "+T$+" "+STR$ S%
   91                   PROC_CopyDir(F$,T$)
   92        ENDCASE
   93
   94        x%     += ((strlen%+4) ANDNOT 3) + 20
   95      NEXT
   96    ENDIF
   97  UNTIL offset% = -1
   98
   99ENDPROC
  100
  101DEF FN_DirSize(dir$)
  102LOCAL tot%,offset%,strlen%,A%,x%
  103
  104  REM This routine calculates the size of all the entries in a directory,
  105  REM and all heading info for the dir.
  106  REM The size of heading info is
  107  REM    4 (offset into dir of 1st unused pos)
  108  REM The size of one entry is
  109  REM   24 (offset in image, load, exec, size, flags, compressed size)
  110  REM + word aligned length of name (incl \0)
  111
  112  REM (The 'compressed size' is there for possible future use)
  113
  114  tot% = 4
  115  offset% = 0
  116  REPEAT
  117    SYS "OS_GBPB",10,dir$,wrk2%,255,offset%,255,"*" TO ,,,read%,offset%
  118    IF read% > 0 THEN
  119      x% = wrk2%
  120      FOR A% = 1 TO read%
  121        strlen% = ( FN_StrLen(x%+20) + 4 ) ANDNOT 3
  122        tot%   += strlen% + 24
  123        x%     += strlen% + 20
  124      NEXT
  125    ENDIF
  126  UNTIL offset% = -1
  127= tot%
  128
  129DEF FN_StrLen(A%)
  130LOCAL L%
  131  L% = A%
  132  WHILE ?A% >= 32
  133    A% += 1
  134  ENDWHILE
  135= A% - L%
  136
  137DEF FN_GetArg(arg$,no%)
  138LOCAL a%,b%,x%
  139
  140  REM Find start of the given part
  141  a% = 1
  142  x% = 0
  143  REPEAT
  144    a% = INSTR(arg$," ",a%)
  145    IF a% = 0 THEN
  146      = ""
  147    ENDIF
  148    a% += 1
  149    WHILE (MID$(arg$,a%,1) = " ")
  150      a% += 1
  151    ENDWHILE
  152
  153    IF MID$(arg$,a%,1) = "-" OR MID$(arg$,a%,1) = "@" THEN
  154      no% +=1
  155    ENDIF
  156
  157    x% += 1
  158  UNTIL x% >= no%
  159
  160  REM Find end of the given part
  161
  162  b% = INSTR(arg$," ",a%)
  163  IF b% = 0 THEN
  164    = MID$(arg$,a%)
  165  ELSE
  166    = MID$(arg$,a%,b%-a%)
  167  ENDIF
  168= 0
  169
  170DEF PROC_Error
  171  ON ERROR OFF
  172  SYS "Hourglass_Off"
  173
  174  REM If we have renamed original file to Wimp$Scrap, then we should move
  175  REM it back..
  176
  177  IF del% THEN
  178
  179    REM 1st delete new file (if it exists..)
  180    SYS "OS_File",17,B$ TO R0%
  181    IF R0% <> 0 THEN OSCLI "Delete "+B$
  182
  183    REM Move original file back
  184    OSCLI "Rename "+A$+" "+B$
  185
  186  ENDIF
  187
  188  PRINT REPORT$;" at ";ERL
  189  END
  190ENDPROC
�  >CleanCopy
  
I  � We dummy-define these variables so that PROC_Error will know them
;  � if we should crash before they are actually defined

  del% = �
  A$   = ""
  B$   = ""
	

  � � �_Error

  � wrk% 255, wrk2% 255


  ș "Hourglass_On"

  � Find parameters

  ș "OS_GetEnv" � env$

  A$ = �_GetArg(env$,2)
  B$ = �_GetArg(env$,3)

� PRINT "env = ";env$
� PRINT "A = ";A$
� PRINT "B = ";B$

*  � A$ = "" � � -1,"Needs Manual name"
  � B$ = "" �

.    � First test whether Wimp$Scrap exists
8    ș "XOS_ReadVarVal","Wimp$Scrap",,-1,0,0 � ,,R2%
 1    � R2%>=0 � � 0,"Wimp$Scrap isn't defined"
!
"#    � Remove any old Wimp$Scrap
#,    ș "OS_File",17,"<Wimp$Scrap>" � R0%
$,    � R0% <> 0 � � "Delete <Wimp$Scrap>"
%
&    B$ = A$
'    A$ = "<Wimp$Scrap>"
(    � "Rename "+B$+" "+A$
)    del% = �
*
+  �
,    del% = �
-  �
.
/"  � We create the new "Manual"
0
1  A% = �_DirSize(A$)
2#  � "StrongCreate "+B$+" "+� A%
3
4'  � Now recursively copy everything
5
6  �_CopyDir(A$,B$)
7
80  � If we used Wimp$Scrap, we now delete it.
9
:  � del% �
;    � "Delete "+A$
<  �
=
>"  � Force Close of new version
?Q  � (So that we don't have to quit !StrongHelp (which closes all) to be safe)
@
A  � "Rename "+B$+" "+B$
B
C  ș "Hourglass_Off"
D
E�
F
G
H� �_CopyDir(From$,To$)
I*� offset%,read%,x%,A%,F$,T$,S%,strlen%
J  offset% = 0
K  �
LG    ș "OS_GBPB",10,From$,wrk%,1,offset%,255,"*" � ,,,read%,offset%
M    � read% > 0 �
N      x% = wrk%
O      � A% = 1 � read%
P%        strlen% = �_StrLen(x%+20)
Q!        ?(x%+20+strlen%) = 13
R
S'        F$ = From$ + "." + $(x%+20)
T'        T$ = To$   + "." + $(x%+20)
U        Ȏ x%!16 �
V&          � 1 : � PRINT "Copy ";F$
W3                   ș "OS_FSControl",26,F$,T$,0
X&          � 2 : S% = �_DirSize(F$)
Y.                   � PRINT "Create ";T$,S%
Z,                   � "Cdir "+T$+" "+� S%
['                   �_CopyDir(F$,T$)
\
        �
]
^-        x%     += ((strlen%+4) �� 3) + 20
_      �
`	    �
a  � offset% = -1
b
c�
d
e� �_DirSize(dir$)
f � tot%,offset%,strlen%,A%,x%
g
hK  � This routine calculates the size of all the entries in a directory,
i)  � and all heading info for the dir.
j#  � The size of heading info is
k0  �    4 (offset into dir of 1st unused pos)
l   � The size of one entry is
mH  �   24 (offset in image, load, exec, size, flags, compressed size)
n/  � + word aligned length of name (incl \0)
o
p@  � (The 'compressed size' is there for possible future use)
q
r  tot% = 4
s  offset% = 0
t  �
uI    ș "OS_GBPB",10,dir$,wrk2%,255,offset%,255,"*" � ,,,read%,offset%
v    � read% > 0 �
w      x% = wrk2%
x      � A% = 1 � read%
y2        strlen% = ( �_StrLen(x%+20) + 4 ) �� 3
z"        tot%   += strlen% + 24
{"        x%     += strlen% + 20
|      �
}	    �
~  � offset% = -1

= tot%
�
�� �_StrLen(A%)
�� L%
�
  L% = A%
�  ȕ ?A% >= 32
�    A% += 1
�  �
�
= A% - L%
�
�� �_GetArg(arg$,no%)
�� a%,b%,x%
�
�$  � Find start of the given part
�  a% = 1
�  x% = 0
�  �
�    a% = �arg$," ",a%)
�    � a% = 0 �
�      = ""
�	    �
�    a% += 1
�    ȕ (�arg$,a%,1) = " ")
�      a% += 1
�	    �
�
�1    � �arg$,a%,1) = "-" � �arg$,a%,1) = "@" �
�      no% +=1
�	    �
�
�    x% += 1
�  � x% >= no%
�
�"  � Find end of the given part
�
�  b% = �arg$," ",a%)
�  � b% = 0 �
�    = �arg$,a%)
�  �
�    = �arg$,a%,b%-a%)
�  �
�= 0
�
�
� �_Error
�  � � �
�  ș "Hourglass_Off"
�
�K  � If we have renamed original file to Wimp$Scrap, then we should move
�  � it back..
�
�  � del% �
�
�.    � 1st delete new file (if it exists..)
�     ș "OS_File",17,B$ � R0%
�#    � R0% <> 0 � � "Delete "+B$
�
�!    � Move original file back
�    � "Rename "+A$+" "+B$
�
�  �
�
�  � �$;" at ";�
�  �
��
�
00000000  0d 00 01 11 f4 20 20 3e  43 6c 65 61 6e 43 6f 70  |.....  >CleanCop|
00000010  79 0d 00 02 06 20 20 0d  00 03 49 20 20 f4 20 57  |y....  ...I  . W|
00000020  65 20 64 75 6d 6d 79 2d  64 65 66 69 6e 65 20 74  |e dummy-define t|
00000030  68 65 73 65 20 76 61 72  69 61 62 6c 65 73 20 73  |hese variables s|
00000040  6f 20 74 68 61 74 20 50  52 4f 43 5f 45 72 72 6f  |o that PROC_Erro|
00000050  72 20 77 69 6c 6c 20 6b  6e 6f 77 20 74 68 65 6d  |r will know them|
00000060  0d 00 04 3b 20 20 f4 20  69 66 20 77 65 20 73 68  |...;  . if we sh|
00000070  6f 75 6c 64 20 63 72 61  73 68 20 62 65 66 6f 72  |ould crash befor|
00000080  65 20 74 68 65 79 20 61  72 65 20 61 63 74 75 61  |e they are actua|
00000090  6c 6c 79 20 64 65 66 69  6e 65 64 0d 00 05 04 0d  |lly defined.....|
000000a0  00 06 0e 20 20 64 65 6c  25 20 3d 20 a3 0d 00 07  |...  del% = ....|
000000b0  0f 20 20 41 24 20 20 20  3d 20 22 22 0d 00 08 0f  |.  A$   = ""....|
000000c0  20 20 42 24 20 20 20 3d  20 22 22 0d 00 09 04 0d  |  B$   = "".....|
000000d0  00 0a 11 20 20 ee 20 85  20 f2 5f 45 72 72 6f 72  |...  . . ._Error|
000000e0  0d 00 0b 04 0d 00 0c 1b  20 20 de 20 77 72 6b 25  |........  . wrk%|
000000f0  20 32 35 35 2c 20 77 72  6b 32 25 20 32 35 35 0d  | 255, wrk2% 255.|
00000100  00 0d 04 0d 00 0e 17 20  20 c8 99 20 22 48 6f 75  |.......  .. "Hou|
00000110  72 67 6c 61 73 73 5f 4f  6e 22 0d 00 0f 04 0d 00  |rglass_On"......|
00000120  10 17 20 20 f4 20 46 69  6e 64 20 70 61 72 61 6d  |..  . Find param|
00000130  65 74 65 72 73 0d 00 11  04 0d 00 12 1b 20 20 c8  |eters........  .|
00000140  99 20 22 4f 53 5f 47 65  74 45 6e 76 22 20 b8 20  |. "OS_GetEnv" . |
00000150  65 6e 76 24 0d 00 13 04  0d 00 14 1b 20 20 41 24  |env$........  A$|
00000160  20 3d 20 a4 5f 47 65 74  41 72 67 28 65 6e 76 24  | = ._GetArg(env$|
00000170  2c 32 29 0d 00 15 1b 20  20 42 24 20 3d 20 a4 5f  |,2)....  B$ = ._|
00000180  47 65 74 41 72 67 28 65  6e 76 24 2c 33 29 0d 00  |GetArg(env$,3)..|
00000190  16 04 0d 00 17 19 f4 20  50 52 49 4e 54 20 22 65  |....... PRINT "e|
000001a0  6e 76 20 3d 20 22 3b 65  6e 76 24 0d 00 18 15 f4  |nv = ";env$.....|
000001b0  20 50 52 49 4e 54 20 22  41 20 3d 20 22 3b 41 24  | PRINT "A = ";A$|
000001c0  0d 00 19 15 f4 20 50 52  49 4e 54 20 22 42 20 3d  |..... PRINT "B =|
000001d0  20 22 3b 42 24 0d 00 1a  04 0d 00 1b 2a 20 20 e7  | ";B$.......*  .|
000001e0  20 41 24 20 3d 20 22 22  20 8c 20 85 20 2d 31 2c  | A$ = "" . . -1,|
000001f0  22 4e 65 65 64 73 20 4d  61 6e 75 61 6c 20 6e 61  |"Needs Manual na|
00000200  6d 65 22 0d 00 1c 11 20  20 e7 20 42 24 20 3d 20  |me"....  . B$ = |
00000210  22 22 20 8c 0d 00 1d 04  0d 00 1e 2e 20 20 20 20  |"" .........    |
00000220  f4 20 46 69 72 73 74 20  74 65 73 74 20 77 68 65  |. First test whe|
00000230  74 68 65 72 20 57 69 6d  70 24 53 63 72 61 70 20  |ther Wimp$Scrap |
00000240  65 78 69 73 74 73 0d 00  1f 38 20 20 20 20 c8 99  |exists...8    ..|
00000250  20 22 58 4f 53 5f 52 65  61 64 56 61 72 56 61 6c  | "XOS_ReadVarVal|
00000260  22 2c 22 57 69 6d 70 24  53 63 72 61 70 22 2c 2c  |","Wimp$Scrap",,|
00000270  2d 31 2c 30 2c 30 20 b8  20 2c 2c 52 32 25 0d 00  |-1,0,0 . ,,R2%..|
00000280  20 31 20 20 20 20 e7 20  52 32 25 3e 3d 30 20 8c  | 1    . R2%>=0 .|
00000290  20 85 20 30 2c 22 57 69  6d 70 24 53 63 72 61 70  | . 0,"Wimp$Scrap|
000002a0  20 69 73 6e 27 74 20 64  65 66 69 6e 65 64 22 0d  | isn't defined".|
000002b0  00 21 04 0d 00 22 23 20  20 20 20 f4 20 52 65 6d  |.!..."#    . Rem|
000002c0  6f 76 65 20 61 6e 79 20  6f 6c 64 20 57 69 6d 70  |ove any old Wimp|
000002d0  24 53 63 72 61 70 0d 00  23 2c 20 20 20 20 c8 99  |$Scrap..#,    ..|
000002e0  20 22 4f 53 5f 46 69 6c  65 22 2c 31 37 2c 22 3c  | "OS_File",17,"<|
000002f0  57 69 6d 70 24 53 63 72  61 70 3e 22 20 b8 20 52  |Wimp$Scrap>" . R|
00000300  30 25 0d 00 24 2c 20 20  20 20 e7 20 52 30 25 20  |0%..$,    . R0% |
00000310  3c 3e 20 30 20 8c 20 ff  20 22 44 65 6c 65 74 65  |<> 0 . . "Delete|
00000320  20 3c 57 69 6d 70 24 53  63 72 61 70 3e 22 0d 00  | <Wimp$Scrap>"..|
00000330  25 04 0d 00 26 0f 20 20  20 20 42 24 20 3d 20 41  |%...&.    B$ = A|
00000340  24 0d 00 27 1b 20 20 20  20 41 24 20 3d 20 22 3c  |$..'.    A$ = "<|
00000350  57 69 6d 70 24 53 63 72  61 70 3e 22 0d 00 28 1d  |Wimp$Scrap>"..(.|
00000360  20 20 20 20 ff 20 22 52  65 6e 61 6d 65 20 22 2b  |    . "Rename "+|
00000370  42 24 2b 22 20 22 2b 41  24 0d 00 29 10 20 20 20  |B$+" "+A$..).   |
00000380  20 64 65 6c 25 20 3d 20  b9 0d 00 2a 04 0d 00 2b  | del% = ...*...+|
00000390  07 20 20 cc 0d 00 2c 10  20 20 20 20 64 65 6c 25  |.  ...,.    del%|
000003a0  20 3d 20 a3 0d 00 2d 07  20 20 cd 0d 00 2e 04 0d  | = ...-.  ......|
000003b0  00 2f 22 20 20 f4 20 57  65 20 63 72 65 61 74 65  |./"  . We create|
000003c0  20 74 68 65 20 6e 65 77  20 22 4d 61 6e 75 61 6c  | the new "Manual|
000003d0  22 0d 00 30 04 0d 00 31  18 20 20 41 25 20 3d 20  |"..0...1.  A% = |
000003e0  a4 5f 44 69 72 53 69 7a  65 28 41 24 29 0d 00 32  |._DirSize(A$)..2|
000003f0  23 20 20 ff 20 22 53 74  72 6f 6e 67 43 72 65 61  |#  . "StrongCrea|
00000400  74 65 20 22 2b 42 24 2b  22 20 22 2b c3 20 41 25  |te "+B$+" "+. A%|
00000410  0d 00 33 04 0d 00 34 27  20 20 f4 20 4e 6f 77 20  |..3...4'  . Now |
00000420  72 65 63 75 72 73 69 76  65 6c 79 20 63 6f 70 79  |recursively copy|
00000430  20 65 76 65 72 79 74 68  69 6e 67 0d 00 35 04 0d  | everything..5..|
00000440  00 36 16 20 20 f2 5f 43  6f 70 79 44 69 72 28 41  |.6.  ._CopyDir(A|
00000450  24 2c 42 24 29 0d 00 37  04 0d 00 38 30 20 20 f4  |$,B$)..7...80  .|
00000460  20 49 66 20 77 65 20 75  73 65 64 20 57 69 6d 70  | If we used Wimp|
00000470  24 53 63 72 61 70 2c 20  77 65 20 6e 6f 77 20 64  |$Scrap, we now d|
00000480  65 6c 65 74 65 20 69 74  2e 0d 00 39 04 0d 00 3a  |elete it...9...:|
00000490  0e 20 20 e7 20 64 65 6c  25 20 8c 0d 00 3b 16 20  |.  . del% ...;. |
000004a0  20 20 20 ff 20 22 44 65  6c 65 74 65 20 22 2b 41  |   . "Delete "+A|
000004b0  24 0d 00 3c 07 20 20 cd  0d 00 3d 04 0d 00 3e 22  |$..<.  ...=...>"|
000004c0  20 20 f4 20 46 6f 72 63  65 20 43 6c 6f 73 65 20  |  . Force Close |
000004d0  6f 66 20 6e 65 77 20 76  65 72 73 69 6f 6e 0d 00  |of new version..|
000004e0  3f 51 20 20 f4 20 28 53  6f 20 74 68 61 74 20 77  |?Q  . (So that w|
000004f0  65 20 64 6f 6e 27 74 20  68 61 76 65 20 74 6f 20  |e don't have to |
00000500  71 75 69 74 20 21 53 74  72 6f 6e 67 48 65 6c 70  |quit !StrongHelp|
00000510  20 28 77 68 69 63 68 20  63 6c 6f 73 65 73 20 61  | (which closes a|
00000520  6c 6c 29 20 74 6f 20 62  65 20 73 61 66 65 29 0d  |ll) to be safe).|
00000530  00 40 04 0d 00 41 1b 20  20 ff 20 22 52 65 6e 61  |.@...A.  . "Rena|
00000540  6d 65 20 22 2b 42 24 2b  22 20 22 2b 42 24 0d 00  |me "+B$+" "+B$..|
00000550  42 04 0d 00 43 18 20 20  c8 99 20 22 48 6f 75 72  |B...C.  .. "Hour|
00000560  67 6c 61 73 73 5f 4f 66  66 22 0d 00 44 04 0d 00  |glass_Off"..D...|
00000570  45 05 e0 0d 00 46 04 0d  00 47 04 0d 00 48 1a dd  |E....F...G...H..|
00000580  20 f2 5f 43 6f 70 79 44  69 72 28 46 72 6f 6d 24  | ._CopyDir(From$|
00000590  2c 54 6f 24 29 0d 00 49  2a ea 20 6f 66 66 73 65  |,To$)..I*. offse|
000005a0  74 25 2c 72 65 61 64 25  2c 78 25 2c 41 25 2c 46  |t%,read%,x%,A%,F|
000005b0  24 2c 54 24 2c 53 25 2c  73 74 72 6c 65 6e 25 0d  |$,T$,S%,strlen%.|
000005c0  00 4a 11 20 20 6f 66 66  73 65 74 25 20 3d 20 30  |.J.  offset% = 0|
000005d0  0d 00 4b 07 20 20 f5 0d  00 4c 47 20 20 20 20 c8  |..K.  ...LG    .|
000005e0  99 20 22 4f 53 5f 47 42  50 42 22 2c 31 30 2c 46  |. "OS_GBPB",10,F|
000005f0  72 6f 6d 24 2c 77 72 6b  25 2c 31 2c 6f 66 66 73  |rom$,wrk%,1,offs|
00000600  65 74 25 2c 32 35 35 2c  22 2a 22 20 b8 20 2c 2c  |et%,255,"*" . ,,|
00000610  2c 72 65 61 64 25 2c 6f  66 66 73 65 74 25 0d 00  |,read%,offset%..|
00000620  4d 15 20 20 20 20 e7 20  72 65 61 64 25 20 3e 20  |M.    . read% > |
00000630  30 20 8c 0d 00 4e 13 20  20 20 20 20 20 78 25 20  |0 ...N.      x% |
00000640  3d 20 77 72 6b 25 0d 00  4f 1a 20 20 20 20 20 20  |= wrk%..O.      |
00000650  e3 20 41 25 20 3d 20 31  20 b8 20 72 65 61 64 25  |. A% = 1 . read%|
00000660  0d 00 50 25 20 20 20 20  20 20 20 20 73 74 72 6c  |..P%        strl|
00000670  65 6e 25 20 3d 20 a4 5f  53 74 72 4c 65 6e 28 78  |en% = ._StrLen(x|
00000680  25 2b 32 30 29 0d 00 51  21 20 20 20 20 20 20 20  |%+20)..Q!       |
00000690  20 3f 28 78 25 2b 32 30  2b 73 74 72 6c 65 6e 25  | ?(x%+20+strlen%|
000006a0  29 20 3d 20 31 33 0d 00  52 04 0d 00 53 27 20 20  |) = 13..R...S'  |
000006b0  20 20 20 20 20 20 46 24  20 3d 20 46 72 6f 6d 24  |      F$ = From$|
000006c0  20 2b 20 22 2e 22 20 2b  20 24 28 78 25 2b 32 30  | + "." + $(x%+20|
000006d0  29 0d 00 54 27 20 20 20  20 20 20 20 20 54 24 20  |)..T'        T$ |
000006e0  3d 20 54 6f 24 20 20 20  2b 20 22 2e 22 20 2b 20  |= To$   + "." + |
000006f0  24 28 78 25 2b 32 30 29  0d 00 55 16 20 20 20 20  |$(x%+20)..U.    |
00000700  20 20 20 20 c8 8e 20 78  25 21 31 36 20 ca 0d 00  |    .. x%!16 ...|
00000710  56 26 20 20 20 20 20 20  20 20 20 20 c9 20 31 20  |V&          . 1 |
00000720  3a 20 f4 20 50 52 49 4e  54 20 22 43 6f 70 79 20  |: . PRINT "Copy |
00000730  22 3b 46 24 0d 00 57 33  20 20 20 20 20 20 20 20  |";F$..W3        |
00000740  20 20 20 20 20 20 20 20  20 20 20 c8 99 20 22 4f  |           .. "O|
00000750  53 5f 46 53 43 6f 6e 74  72 6f 6c 22 2c 32 36 2c  |S_FSControl",26,|
00000760  46 24 2c 54 24 2c 30 0d  00 58 26 20 20 20 20 20  |F$,T$,0..X&     |
00000770  20 20 20 20 20 c9 20 32  20 3a 20 53 25 20 3d 20  |     . 2 : S% = |
00000780  a4 5f 44 69 72 53 69 7a  65 28 46 24 29 0d 00 59  |._DirSize(F$)..Y|
00000790  2e 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.               |
000007a0  20 20 20 20 f4 20 50 52  49 4e 54 20 22 43 72 65  |    . PRINT "Cre|
000007b0  61 74 65 20 22 3b 54 24  2c 53 25 0d 00 5a 2c 20  |ate ";T$,S%..Z, |
000007c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000007d0  20 20 ff 20 22 43 64 69  72 20 22 2b 54 24 2b 22  |  . "Cdir "+T$+"|
000007e0  20 22 2b c3 20 53 25 0d  00 5b 27 20 20 20 20 20  | "+. S%..['     |
000007f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 f2 5f  |              ._|
00000800  43 6f 70 79 44 69 72 28  46 24 2c 54 24 29 0d 00  |CopyDir(F$,T$)..|
00000810  5c 0d 20 20 20 20 20 20  20 20 cb 0d 00 5d 04 0d  |\.        ...]..|
00000820  00 5e 2d 20 20 20 20 20  20 20 20 78 25 20 20 20  |.^-        x%   |
00000830  20 20 2b 3d 20 28 28 73  74 72 6c 65 6e 25 2b 34  |  += ((strlen%+4|
00000840  29 20 80 ac 20 33 29 20  2b 20 32 30 0d 00 5f 0b  |) .. 3) + 20.._.|
00000850  20 20 20 20 20 20 ed 0d  00 60 09 20 20 20 20 cd  |      ...`.    .|
00000860  0d 00 61 14 20 20 fd 20  6f 66 66 73 65 74 25 20  |..a.  . offset% |
00000870  3d 20 2d 31 0d 00 62 04  0d 00 63 05 e1 0d 00 64  |= -1..b...c....d|
00000880  04 0d 00 65 15 dd 20 a4  5f 44 69 72 53 69 7a 65  |...e.. ._DirSize|
00000890  28 64 69 72 24 29 0d 00  66 20 ea 20 74 6f 74 25  |(dir$)..f . tot%|
000008a0  2c 6f 66 66 73 65 74 25  2c 73 74 72 6c 65 6e 25  |,offset%,strlen%|
000008b0  2c 41 25 2c 78 25 0d 00  67 04 0d 00 68 4b 20 20  |,A%,x%..g...hK  |
000008c0  f4 20 54 68 69 73 20 72  6f 75 74 69 6e 65 20 63  |. This routine c|
000008d0  61 6c 63 75 6c 61 74 65  73 20 74 68 65 20 73 69  |alculates the si|
000008e0  7a 65 20 6f 66 20 61 6c  6c 20 74 68 65 20 65 6e  |ze of all the en|
000008f0  74 72 69 65 73 20 69 6e  20 61 20 64 69 72 65 63  |tries in a direc|
00000900  74 6f 72 79 2c 0d 00 69  29 20 20 f4 20 61 6e 64  |tory,..i)  . and|
00000910  20 61 6c 6c 20 68 65 61  64 69 6e 67 20 69 6e 66  | all heading inf|
00000920  6f 20 66 6f 72 20 74 68  65 20 64 69 72 2e 0d 00  |o for the dir...|
00000930  6a 23 20 20 f4 20 54 68  65 20 73 69 7a 65 20 6f  |j#  . The size o|
00000940  66 20 68 65 61 64 69 6e  67 20 69 6e 66 6f 20 69  |f heading info i|
00000950  73 0d 00 6b 30 20 20 f4  20 20 20 20 34 20 28 6f  |s..k0  .    4 (o|
00000960  66 66 73 65 74 20 69 6e  74 6f 20 64 69 72 20 6f  |ffset into dir o|
00000970  66 20 31 73 74 20 75 6e  75 73 65 64 20 70 6f 73  |f 1st unused pos|
00000980  29 0d 00 6c 20 20 20 f4  20 54 68 65 20 73 69 7a  |)..l   . The siz|
00000990  65 20 6f 66 20 6f 6e 65  20 65 6e 74 72 79 20 69  |e of one entry i|
000009a0  73 0d 00 6d 48 20 20 f4  20 20 20 32 34 20 28 6f  |s..mH  .   24 (o|
000009b0  66 66 73 65 74 20 69 6e  20 69 6d 61 67 65 2c 20  |ffset in image, |
000009c0  6c 6f 61 64 2c 20 65 78  65 63 2c 20 73 69 7a 65  |load, exec, size|
000009d0  2c 20 66 6c 61 67 73 2c  20 63 6f 6d 70 72 65 73  |, flags, compres|
000009e0  73 65 64 20 73 69 7a 65  29 0d 00 6e 2f 20 20 f4  |sed size)..n/  .|
000009f0  20 2b 20 77 6f 72 64 20  61 6c 69 67 6e 65 64 20  | + word aligned |
00000a00  6c 65 6e 67 74 68 20 6f  66 20 6e 61 6d 65 20 28  |length of name (|
00000a10  69 6e 63 6c 20 5c 30 29  0d 00 6f 04 0d 00 70 40  |incl \0)..o...p@|
00000a20  20 20 f4 20 28 54 68 65  20 27 63 6f 6d 70 72 65  |  . (The 'compre|
00000a30  73 73 65 64 20 73 69 7a  65 27 20 69 73 20 74 68  |ssed size' is th|
00000a40  65 72 65 20 66 6f 72 20  70 6f 73 73 69 62 6c 65  |ere for possible|
00000a50  20 66 75 74 75 72 65 20  75 73 65 29 0d 00 71 04  | future use)..q.|
00000a60  0d 00 72 0e 20 20 74 6f  74 25 20 3d 20 34 0d 00  |..r.  tot% = 4..|
00000a70  73 11 20 20 6f 66 66 73  65 74 25 20 3d 20 30 0d  |s.  offset% = 0.|
00000a80  00 74 07 20 20 f5 0d 00  75 49 20 20 20 20 c8 99  |.t.  ...uI    ..|
00000a90  20 22 4f 53 5f 47 42 50  42 22 2c 31 30 2c 64 69  | "OS_GBPB",10,di|
00000aa0  72 24 2c 77 72 6b 32 25  2c 32 35 35 2c 6f 66 66  |r$,wrk2%,255,off|
00000ab0  73 65 74 25 2c 32 35 35  2c 22 2a 22 20 b8 20 2c  |set%,255,"*" . ,|
00000ac0  2c 2c 72 65 61 64 25 2c  6f 66 66 73 65 74 25 0d  |,,read%,offset%.|
00000ad0  00 76 15 20 20 20 20 e7  20 72 65 61 64 25 20 3e  |.v.    . read% >|
00000ae0  20 30 20 8c 0d 00 77 14  20 20 20 20 20 20 78 25  | 0 ...w.      x%|
00000af0  20 3d 20 77 72 6b 32 25  0d 00 78 1a 20 20 20 20  | = wrk2%..x.    |
00000b00  20 20 e3 20 41 25 20 3d  20 31 20 b8 20 72 65 61  |  . A% = 1 . rea|
00000b10  64 25 0d 00 79 32 20 20  20 20 20 20 20 20 73 74  |d%..y2        st|
00000b20  72 6c 65 6e 25 20 3d 20  28 20 a4 5f 53 74 72 4c  |rlen% = ( ._StrL|
00000b30  65 6e 28 78 25 2b 32 30  29 20 2b 20 34 20 29 20  |en(x%+20) + 4 ) |
00000b40  80 ac 20 33 0d 00 7a 22  20 20 20 20 20 20 20 20  |.. 3..z"        |
00000b50  74 6f 74 25 20 20 20 2b  3d 20 73 74 72 6c 65 6e  |tot%   += strlen|
00000b60  25 20 2b 20 32 34 0d 00  7b 22 20 20 20 20 20 20  |% + 24..{"      |
00000b70  20 20 78 25 20 20 20 20  20 2b 3d 20 73 74 72 6c  |  x%     += strl|
00000b80  65 6e 25 20 2b 20 32 30  0d 00 7c 0b 20 20 20 20  |en% + 20..|.    |
00000b90  20 20 ed 0d 00 7d 09 20  20 20 20 cd 0d 00 7e 14  |  ...}.    ...~.|
00000ba0  20 20 fd 20 6f 66 66 73  65 74 25 20 3d 20 2d 31  |  . offset% = -1|
00000bb0  0d 00 7f 0a 3d 20 74 6f  74 25 0d 00 80 04 0d 00  |....= tot%......|
00000bc0  81 12 dd 20 a4 5f 53 74  72 4c 65 6e 28 41 25 29  |... ._StrLen(A%)|
00000bd0  0d 00 82 08 ea 20 4c 25  0d 00 83 0d 20 20 4c 25  |..... L%....  L%|
00000be0  20 3d 20 41 25 0d 00 84  12 20 20 c8 95 20 3f 41  | = A%....  .. ?A|
00000bf0  25 20 3e 3d 20 33 32 0d  00 85 0f 20 20 20 20 41  |% >= 32....    A|
00000c00  25 20 2b 3d 20 31 0d 00  86 07 20 20 ce 0d 00 87  |% += 1....  ....|
00000c10  0d 3d 20 41 25 20 2d 20  4c 25 0d 00 88 04 0d 00  |.= A% - L%......|
00000c20  89 18 dd 20 a4 5f 47 65  74 41 72 67 28 61 72 67  |... ._GetArg(arg|
00000c30  24 2c 6e 6f 25 29 0d 00  8a 0e ea 20 61 25 2c 62  |$,no%)..... a%,b|
00000c40  25 2c 78 25 0d 00 8b 04  0d 00 8c 24 20 20 f4 20  |%,x%.......$  . |
00000c50  46 69 6e 64 20 73 74 61  72 74 20 6f 66 20 74 68  |Find start of th|
00000c60  65 20 67 69 76 65 6e 20  70 61 72 74 0d 00 8d 0c  |e given part....|
00000c70  20 20 61 25 20 3d 20 31  0d 00 8e 0c 20 20 78 25  |  a% = 1....  x%|
00000c80  20 3d 20 30 0d 00 8f 07  20 20 f5 0d 00 90 1a 20  | = 0....  ..... |
00000c90  20 20 20 61 25 20 3d 20  a7 61 72 67 24 2c 22 20  |   a% = .arg$," |
00000ca0  22 2c 61 25 29 0d 00 91  12 20 20 20 20 e7 20 61  |",a%)....    . a|
00000cb0  25 20 3d 20 30 20 8c 0d  00 92 0e 20 20 20 20 20  |% = 0 .....     |
00000cc0  20 3d 20 22 22 0d 00 93  09 20 20 20 20 cd 0d 00  | = ""....    ...|
00000cd0  94 0f 20 20 20 20 61 25  20 2b 3d 20 31 0d 00 95  |..    a% += 1...|
00000ce0  1e 20 20 20 20 c8 95 20  28 c1 61 72 67 24 2c 61  |.    .. (.arg$,a|
00000cf0  25 2c 31 29 20 3d 20 22  20 22 29 0d 00 96 11 20  |%,1) = " ").... |
00000d00  20 20 20 20 20 61 25 20  2b 3d 20 31 0d 00 97 09  |     a% += 1....|
00000d10  20 20 20 20 ce 0d 00 98  04 0d 00 99 31 20 20 20  |    ........1   |
00000d20  20 e7 20 c1 61 72 67 24  2c 61 25 2c 31 29 20 3d  | . .arg$,a%,1) =|
00000d30  20 22 2d 22 20 84 20 c1  61 72 67 24 2c 61 25 2c  | "-" . .arg$,a%,|
00000d40  31 29 20 3d 20 22 40 22  20 8c 0d 00 9a 11 20 20  |1) = "@" .....  |
00000d50  20 20 20 20 6e 6f 25 20  2b 3d 31 0d 00 9b 09 20  |    no% +=1.... |
00000d60  20 20 20 cd 0d 00 9c 04  0d 00 9d 0f 20 20 20 20  |   .........    |
00000d70  78 25 20 2b 3d 20 31 0d  00 9e 11 20 20 fd 20 78  |x% += 1....  . x|
00000d80  25 20 3e 3d 20 6e 6f 25  0d 00 9f 04 0d 00 a0 22  |% >= no%......."|
00000d90  20 20 f4 20 46 69 6e 64  20 65 6e 64 20 6f 66 20  |  . Find end of |
00000da0  74 68 65 20 67 69 76 65  6e 20 70 61 72 74 0d 00  |the given part..|
00000db0  a1 04 0d 00 a2 18 20 20  62 25 20 3d 20 a7 61 72  |......  b% = .ar|
00000dc0  67 24 2c 22 20 22 2c 61  25 29 0d 00 a3 10 20 20  |g$," ",a%)....  |
00000dd0  e7 20 62 25 20 3d 20 30  20 8c 0d 00 a4 13 20 20  |. b% = 0 .....  |
00000de0  20 20 3d 20 c1 61 72 67  24 2c 61 25 29 0d 00 a5  |  = .arg$,a%)...|
00000df0  07 20 20 cc 0d 00 a6 19  20 20 20 20 3d 20 c1 61  |.  .....    = .a|
00000e00  72 67 24 2c 61 25 2c 62  25 2d 61 25 29 0d 00 a7  |rg$,a%,b%-a%)...|
00000e10  07 20 20 cd 0d 00 a8 07  3d 20 30 0d 00 a9 04 0d  |.  .....= 0.....|
00000e20  00 aa 0d dd 20 f2 5f 45  72 72 6f 72 0d 00 ab 0b  |.... ._Error....|
00000e30  20 20 ee 20 85 20 87 0d  00 ac 18 20 20 c8 99 20  |  . . .....  .. |
00000e40  22 48 6f 75 72 67 6c 61  73 73 5f 4f 66 66 22 0d  |"Hourglass_Off".|
00000e50  00 ad 04 0d 00 ae 4b 20  20 f4 20 49 66 20 77 65  |......K  . If we|
00000e60  20 68 61 76 65 20 72 65  6e 61 6d 65 64 20 6f 72  | have renamed or|
00000e70  69 67 69 6e 61 6c 20 66  69 6c 65 20 74 6f 20 57  |iginal file to W|
00000e80  69 6d 70 24 53 63 72 61  70 2c 20 74 68 65 6e 20  |imp$Scrap, then |
00000e90  77 65 20 73 68 6f 75 6c  64 20 6d 6f 76 65 0d 00  |we should move..|
00000ea0  af 11 20 20 f4 20 69 74  20 62 61 63 6b 2e 2e 0d  |..  . it back...|
00000eb0  00 b0 04 0d 00 b1 0e 20  20 e7 20 64 65 6c 25 20  |.......  . del% |
00000ec0  8c 0d 00 b2 04 0d 00 b3  2e 20 20 20 20 f4 20 31  |.........    . 1|
00000ed0  73 74 20 64 65 6c 65 74  65 20 6e 65 77 20 66 69  |st delete new fi|
00000ee0  6c 65 20 28 69 66 20 69  74 20 65 78 69 73 74 73  |le (if it exists|
00000ef0  2e 2e 29 0d 00 b4 20 20  20 20 20 c8 99 20 22 4f  |..)...     .. "O|
00000f00  53 5f 46 69 6c 65 22 2c  31 37 2c 42 24 20 b8 20  |S_File",17,B$ . |
00000f10  52 30 25 0d 00 b5 23 20  20 20 20 e7 20 52 30 25  |R0%...#    . R0%|
00000f20  20 3c 3e 20 30 20 8c 20  ff 20 22 44 65 6c 65 74  | <> 0 . . "Delet|
00000f30  65 20 22 2b 42 24 0d 00  b6 04 0d 00 b7 21 20 20  |e "+B$.......!  |
00000f40  20 20 f4 20 4d 6f 76 65  20 6f 72 69 67 69 6e 61  |  . Move origina|
00000f50  6c 20 66 69 6c 65 20 62  61 63 6b 0d 00 b8 1d 20  |l file back.... |
00000f60  20 20 20 ff 20 22 52 65  6e 61 6d 65 20 22 2b 41  |   . "Rename "+A|
00000f70  24 2b 22 20 22 2b 42 24  0d 00 b9 04 0d 00 ba 07  |$+" "+B$........|
00000f80  20 20 cd 0d 00 bb 04 0d  00 bc 13 20 20 f1 20 f6  |  .........  . .|
00000f90  24 3b 22 20 61 74 20 22  3b 9e 0d 00 bd 07 20 20  |$;" at ";.....  |
00000fa0  e0 0d 00 be 05 e1 0d ff                           |........|
00000fa8