Listing of file='@TO.CREF' on disk='vmedia/734-8446-A.wvd.zip'
# Sector 1921, program filename = '@TO.CREF' 0010 REM !.@TO.CREF 04/13/90 Create Ref file : REM !.Copyright Wang Laboratories, Inc., 1989, 1990 0015 REM Variable descriptions in %TO.CREF 0025 REM Changes ---> version 2.0 : REM .E is COM value with max entries set in @TO.CRE0 0030 COM F$8,D$3,D0 : DIM Z,Z$50,E0,N$(E)8,N1$(E)3,S$(E)2,L$(E)2,W$(E)4,I$(16),J8$1,J9$1,K$1,F1 $8,D1$3,Y$1,J$8,L$2,I$12,K1$2,F8$8,Q$1,S$3 0035 PRINT HEX(03020402040E);AT(0,0);" Make a Reference List of File Names -- (c) Copr. Wang Laboratories, Inc. 1990 " : PRINT HEX(0202020E0F) 0038 PRINT "This partition has room for";E;"items" 0040 GOSUB 1240 : J$="@JUNKAAA" : E1=0 0041 MAT REDIM N$(E)8 0042 GOSUB 49 : L$()=ALL(00) : N1$()=ALL(J8$) : N$()=ALL(FF) : J=1 : GOTO 80 0045 PRINT AT(3,0,);"No files found" : GOTO 42 0048 REM %.S.R. Prompt disk 0049 PRINT AT(23,55,);"Press FN/TAB to exit";HEX(01) 0050 IF D$=" "OR D$="RUN"THEN D$="D11" : PRINT AT(2,0);HEX(020402000F); : LINPUT "Source disk address ",D$ : $TRAN(D$,"DdBb")R : PRINT HEX(06);AT(2,25,);HEX(05) : GOSUB '100(D$) : IF Q$<>" "THEN 50 : SELECT #2<D$> : ERRORA=1 : GOTO 60 0055 VERIFY T#2,(0,0)A : ERRORA=1 0060 IF A=0THEN RETURN : A=ERR : Z$=ERR$(A) : PRINT AT(2,25);"Error ";A;Z$;HEX(07) : GOTO 50 0069 REM %.FN/TAB 0070 DEFFN'126 0071 DEFFN'127 : IF E1>0THEN 30 : PRINT HEX(0E06);AT(23,0,);"(Returning to System Menu)";HEX(01) : COM CLEAR : $PSTAT=" " : LOAD T#0,"@MENU" 0078 REM %.Prompt ref file 0080 F,J0,S0,S,S9=0 : E1=1 : F$=" " : LINPUT "Existing Reference File Name, if any"F$ : IF F$=" "THEN 98 0082 REM %.Existing file might be one of three types : REM .1 Prog file of DATA stmts : REM .2 DATA file of names : REM .3 DATA disk.image file 0084 LIMITS T#2,F$,S9,B,B,B : ERRORA=ERR : Z$=ERR$(A) : PRINT AT(2,25);"Error ";A;Z$;HEX(07) : GOTO 42 0085 ON BGOTO 86,88 : PRINT HEX(07);"ERROR: File "; : IF B=0THEN PRINT "not found" : ELSE PRINT "is scratched" : GOTO 80 0086 S0=1 : DATA LOAD BA T#2,(S9+1)I$() : IF STR(I$(),,4)<>HEX(00FF9000)THEN 87 : IF STR(I$(),5,1)=HEX(A2)OR STR(I$(),5,1)=HEX(D8)THEN 1200 0087 PRINT "Program file is not the correct format" : GOTO 80 0088 S0=3 : DATA LOAD DC OPEN T#2,F$ : DATA LOAD BA T#2,(S9)I$() : IF STR(I$(),7,10)="Disk.Image"THEN 96 : IF STR(I$(),2,2)=HEX(0183)THEN 1300 : PRINT "DATA file is improper format" : GOTO 80 0095 REM %^.Get names from index 0096 PRINT HEX(03020402040E);AT(0,25);"RETRIEVE FILES" : PRINT HEX(0202020E0F) 0098 PRINT HEX(06);"Sorting disk catalog - please wait ..." 0100 DATA LOAD BA T#2,(S9)I$() : C=VAL(STR(I$(),2)) : FOR A=0TO C-1 : IF A>0THEN DATA LOAD BA T#2,(S9+A)I$() : FOR B=1TO 16 : IF A=0AND B=1THEN NEXT B 0105 MAT SEARCHI$,=STR(I$(B),1,2)TO L$STEP 2 : IF VAL(L$,2)=0THEN 170 : RESTORE LINE730,1+(VAL(L$,2)/2) : READ STR(N1$(J),2,2) 0160 STR(N1$(J),1,1)=J8$ : STR(N$(J),1,8)=STR(I$(B),9,8) : J1=VAL(STR(I$(B),5,2),2)-VAL(STR(I$(B),3,2),2)+1 : S$(J)=BIN(J1,2) : S=S+J1 0162 IF STR(I$(B),,2)<>HEX(1080)THEN 165 : DIM Z9$(16)16 : L$=STR(I$(B),3,2) : DATA LOAD BA T#2,(L$)Z9$() : IF STR(Z9$(),,1)>HEX(5F)THEN N1$,STR(N1$(J),2,1)=HEX(22) 0165 J=J+1 : IF J<=ETHEN 170 0168 PRINT AT(4,0,);"Cannot handle more than ";E;"entries in index" : PRINT "Use Larger Partition or Backup Platter to Tape" : KEYIN K$ : IF D0>=0THEN 10 : PRINT AT(1,0,) : D0=0 : LOAD T#0,"@TO.CRE0" 0170 NEXT B : $IF OFF /001,172 : KEYIN K$ : IF K$=HEX(7D)OR K$=HEX(7E)THEN 70 0172 NEXT A 0174 REM %.Names gathered now show them 0175 J=J-1 : P=INT(J/16) : IF P<>J/16THEN P=P+1 0180 IF J<1THEN 45 : E9=J : MAT REDIM N$(E9)8 : MAT SORTN$()TO W$(),L$() : GOSUB 1410 0190 PRINT AT(5,58);HEX(020402000E);"ACTIVE KEYS";HEX(0F) : PRINT AT(6,55);"Cursor Up/Down" : PRINT AT(7,55);"Space/Backspace" : PRINT AT(8,55);"N / See Next Screen" : PRINT AT(9,55);"P / See Previous Screen" 0192 PRINT AT(11,55);"Insert/Delete picks" : PRINT AT(12,55);"A / Pick all files" : PRINT AT(13,55);"M / Pick via mask" 0195 PRINT AT(14,55);"SF '00 - Pick all P" : PRINT AT(15,55);"SF '01 - Pick all D" : PRINT AT(16,55);"SF '02 - Pick all SP" : PRINT AT(17,55);"SF '03 - Pick all SD" 0196 PRINT AT(18,55);"SF '04 - Pick all 'P" : PRINT AT(19,55);"ERASE - Erase all picks" 0200 PRINT AT(21,55);HEX(0E);"Press RUN when done";HEX(0F) 0210 PRINT AT(1,55);"Disk address ";D$;AT(2,0);"Total sectors";AT(2,55);" Total files";AT(3,0);"Sectors selected";AT(3,55);"Files selected";AT(4,5) ;HEX(020402000E);" Name Type Sectors";HEX(0F0D) : J1=1 : P1=0 0220 PRINT AT(2,22); : PRINTUSING 470;S 0222 PRINT AT(2,71); : PRINTUSING 470;J 0230 FOR A=6TO 22 : PRINT HEX(06);AT(A,0,35); : NEXT A 0235 PRINT AT(1,30);"Page ";P1+1;" of ";INT(J/16)+1 0240 C=1 0260 X=VAL(L$(J1+P1*16),2) : F8$=N$(X) : $TRAN(F8$,"................") 0270 PRINT AT(J1+5,C); : IF S$(X)=HEX(0000)THEN PRINTUSING 275,STR(N1$(X),,1),F8$,"None"; : ELSE PRINTUSING 275,STR(N1$(X),,1),F8$,STR(N1$(X),2,2),VAL(S$(X),2); 0275 % # ######## #### ##### 0280 J1=J1+1 : IF J1+P1*16>JTHEN 290 : IF J1<17THEN 260 0290 J1=1 : C=2 : IF N1$>" "THEN PRINT AT(22,21);HEX(22);" new format / wrong index type" 0299 REM %.Treat table update keystrokes 0300 X=VAL(L$(J1+P1*16),2) : PRINT AT(J1+5,C);HEX(02050F); : KEYIN K$,,330 : PRINT HEX(06); : ON POS(HEX(504E200841824944E54D)=K$)GOTO 340,350,370,390,440,490,460,480, 486,310 : PRINT HEX(07) : GOTO 300 0310 DIM M8$8,X8$8,I8$8 : M8$="????????" : PRINT AT(22,0,40); : LINPUT "by Mask",M8$ : IF M8$="????????"OR M8$=" "THEN 300 : I8$=ALL(00) : $TRAN(M8$,HEX(003F0020))R : FOR A=1TO 8 : IF STR(M8$,A,1)>HEX(00)THEN STR(I8$,A,1)=HEX(FF) : NEXT A 0320 FOR J2=1TO J : X8$=N$(J2) : $TRAN(X8$,HEX(0020))R : X8$=X8$AND I8$ : IF X8$<>M8$THEN 325 : Y$=N1$(J2) : STR(N1$(J2),1,1)=J9$ : IF Y$=J8$THEN DO : F=F+1 : J0=J0+VAL(S$(J2),2) : END DO 0325 NEXT J2 : PRINT AT(3,22); : PRINTUSING 470,J0 : PRINT AT(3,71); : PRINTUSING 470,F : GOTO 220 0330 PRINT HEX(06); : ON POS(HEX(064605450A4A09494243000102034804)=K$)GOTO 390,390,370,370,460, 460,480,480,340,350,440,440,440,440,486,440 : PRINT HEX(07) : GOTO 300 0340 IF P1=0THEN 290 : REM ON FIRST SCREEN : P1=P1-1 : J1=1 : GOTO 230 0350 IF P1+1<PTHEN 360 : J1=1 : GOTO 240 0360 P1=P1+1 : J1=1 : GOTO 230 0370 J1=J1+1 : IF J1+P1*16>JTHEN 380 : IF J1<17THEN 300 0380 J1=1 : GOTO 300 0390 IF J1=1THEN 400 : J1=J1-1 : GOTO 300 0400 IF P1+1=PTHEN 410 : J1=16 : GOTO 300 0410 J1=MOD(J,16) : GOTO 300 0440 IF K$="A"THEN 442 : RESTORE LINE730,VAL(K$)+1 : READ K1$ 0442 FOR J2=1TO J : IF K$<>"A"THEN 444 : IF STR(N1$(J2),2,2)=" "THEN 446 : GOTO 445 0444 IF K1$="'P"AND STR(N1$(J2),2,2)=HEX(2250)THEN 445 : IF K1$<>STR(N1$(J2),2,2)THEN 446 0445 Y$=N1$(J2) : STR(N1$(J2),1,1)=J9$ : IF Y$=J8$THEN DO : F=F+1 : J0=J0+VAL(S$(J2),2) : END DO 0446 NEXT J2 0450 PRINT AT(3,22); : PRINTUSING 470,J0 : PRINT AT(3,71); : PRINTUSING 470,F : GOTO 210 0460 X=VAL(L$(J1+P1*16),2) : IF STR(N1$(X),2,2)=" "THEN 485 : Y$=N1$(X) : STR(N1$(X),1,1)=J9$ : IF Y$=J8$THEN DO : F=F+1 : J0=J0+VAL(S$(X),2) : END DO : PRINT AT(J1+5,C);J9$ : GOTO 485 0470 %##### 0480 X=VAL(L$(J1+P1*16),2) : Y$=N1$(X) : STR(N1$(X),1,1)=J8$ : IF Y$=J9$THEN DO : F=F-1 : J0=J0-VAL(S$(X),2) : END DO : PRINT AT(J1+5,C);J8$ 0485 PRINT AT(3,22); : PRINTUSING 470,J0 : PRINT AT(3,71); : PRINTUSING 470,F : GOTO 370 0486 REM .ERASE : FOR A=1TO E9 : STR(N1$(A),,1)=HEX(80) : NEXT A : F,J0=0 : GOTO 180 0488 REM %^.RUN keyed 0490 PRINT HEX(06);AT(4,0,) : G,G1=1 0500 IF STR(N1$(G1),1,1)=J8$THEN 510 : N$(G)=N$(G1) : N1$(G)=N1$(G1) : G=G+1 0510 G1=G1+1 : IF G1<=E9THEN 500 : G=G-1 : IF G=0THEN 720 0515 E9=G : MAT REDIM N$(E9)8 : MAT SORTN$()TO W$(),L$() 0520 PRINT HEX(060202000F);AT(5,0,);AT(23,55,);"Press FN/TAB to exit";HEX(01) : PRINT AT(5,0);"You have made a list of";G;"file names." : PRINT : PRINT "You have the option to copy files now, or else make a permanent re ference list." : PRINT 0521 PRINT "Options 1 or 2 are to copy files now." : PRINT "1). Replace or add files selected to an existing surface." : PRINT "2). Copy files selected to a Disk.Image file." : PRINT : PRINT "Options 3 or 4 are to make a permanent reference list." 0522 F1$="DATA" : G1=INT(E9/27)+3 : PRINT "3). A list in a DATA file will need ";G1;"sectors of disk." 0523 A=INT(E9/7)+5 : E8=400 : IF E9<E8THEN PRINT "4). A list in a Program file of DATA statements will need ";A;"sectors of disk." : ELSE PRINT "4). Maximum items of ";E8;"for this option are exceeded" : C=4 0525 PRINT AT(13+C,0);" Key in option 1 "; : FOR K=2TO C : PRINT "or";K; : NEXT K : PRINT HEX(0D); : K$=" " : SELECT #3/000 0526 PRINT K$;HEX(0508); : KEYIN K$,,527 : K=VAL(K$)-48 : IF K$<" "THEN K$="." : GOTO 528 0527 IF POS(HEX(F0507E7F)=K$)=0THEN 525 : GOTO 30 0528 IF K<1OR K>4THEN 526 : IF K=4AND E9>E8THEN 526 : PRINT AT(6,0,14*80);"Option ";K : ON KGOTO 810,810,530,529 : GOTO 526 0529 G1=A : F1$="PROGRAM" 0530 PRINT AT(8,0);"Your referenced list ";F1$;" file will require";G1;"sector s on disk." : LINPUT "Reference file name",-F$ : IF F$=" "THEN 530 : K=K-2 0535 PRINT AT(8,0,12*80);"Reference file name ";HEX(0E);STR(F$,,8);HEX(0F);" w ill require ";G1;"sectors in a ";F1$;" file" 0540 IF D1$="RUN"THEN D1$=" " : PRINT AT(9,0); : LINPUT "Reference file address ",-D1$ : GOSUB '100(D1$) : IF Q$<>" "THEN 540 : SELECT #3<D1$> : ERRORA=ERR : GOTO 560 0550 PRINT AT(9,30,40); : VERIFY T#3,(0,0)A : ERRORA=ERR 0560 IF A=0THEN 570 : Z$=ERR$(A) : PRINT "Error ";A;Z$;HEX(07) : GOTO 540 0570 LIMITS T#3,F$,A,B,C,D : ERRORA=ERR : GOTO 560 0572 PRINT AT(10,0,80);F$;" on ";D1$;" "; : IF D=0THEN 590 : PRINT "is currently a "; : IF D<0THEN PRINT "SCRATCHED "; : IF ABS(D)=1THEN PRINT "PROGRAM"; : IF ABS(D)=2THEN PRINT "DATA"; : PRINT " file" 0575 IF D=0THEN 590 : IF K=ABS(D)THEN PRINT HEX(07);"ERROR - WRONG KIND OF FILE" : IF G1>B-A+1THEN 620 : GOTO 610 0590 PRINT "does not exist - OK to create new file (Y/N)"; : Y$="Y" : LINPUT -Y$ : IF Y$="Y"OR Y$="y"THEN 600 : GOTO 520 0600 DATA SAVE DC OPEN T#3,(G1)F$ : ERRORA=ERR : GOTO 560 0602 LIMITS T#3,F$,A,B,C,D : GOTO 670 0610 PRINT F$;" already exists with ";B-A+1;" sectors" : PRINT "Can file be overwritten (Y OR N)"; : Y$="N" : LINPUT -Y$ : IF Y$="Y"OR Y$="y"THEN 620 : GOTO 520 0620 IF G1<=B-A+1THEN 660 : PRINT "Old file is too small. " : J$="@JUNKAAA" 0630 LIMITS T#3,J$,A,A,A,A : IF A=0THEN 640 : A=POS(-J$<"Z") : STR(J$,A,1)=ADDHEX(01) : IF A<8THEN STR(J$,A+1)=ALL("A") : GOTO 630 0640 PRINT "Can the file be junked (renamed to ";J$;" & scratched)?"; : Y$="N" : LINPUT -Y$ : IF Y$="Y"OR Y$="y"THEN 650 : GOTO 520 0650 SCRATCH T#3,F$ : DATA SAVE DC OPEN T#3,F$,J$ : SCRATCH T#3,J$ : GOTO 600 0660 SCRATCH T#3,F$ : DATA SAVE DC OPEN T#3,(F$)F$ 0670 MAT REDIM N$(G)8 : DATA LOAD DC OPEN T#3,F$ : ERRORREM 0675 IF K$="4"THEN 900 : REM /.Make DATA stmts 0680 DATA SAVE DC #3,D$,N$() : ERRORREM 0690 DATA SAVE DC #3,END : ERRORREM 0700 DATA SAVE DC CLOSEALL : Z$="Completed file create" 0710 PRINT AT(23,0);Z$;" -- Key anything"; : KEYIN K$ : GOTO 30 0720 Z$="No file names selected" : F$=" " : GOTO 710 0730 DATA " P"," D","SP","SD","'P" 0790 REM %^.Exit to move files 0800 REM .1=to DISK 2=to Disk.Image 0810 I=K : E=G : MAT REDIM N$(G)8 : COM CLEAR N1$() 0820 IF I=1THEN Z$="@TO.DISK@TO.SUBS" : IF I=2THEN Z$="@TOIMAGE@TO.SUBS" 0822 IF I=2THEN E0=INT(E/16)+1 0825 IF S0=3THEN I=I+2 : D0=I : REM =1 Disk to Disk =2 Disk to Img. =3 Img. to disk =4 Img. to Img. 0830 PRINT HEX(030E05);"Loading ";BOX(1,LEN(Z$)+1);" ";Z$;HEX(0F) 0840 Z=INT((LEN(Z$)-1)/8)+1 : LOAD T#0,<Z>Z$ 0890 REM %^.Subroutine to make DATA stmt file 0900 PRINT "Making DATA stmts" 0910 DIM D(4),D0$80,D0$(16)16,L9$2,L9 : L9=9000 0915 I=10 : IF E9>90THEN I=5 : IF E9>195THEN I=2 : IF E9>495THEN I=1 : IF E9>998THEN STOP "Logic needed to combine REM lines "# 0920 I0=1 0930 I9=G 0940 L8=2 : INIT(00)D0$() 0950 LIMITS T#3,F$,D(1),D(2),D(3),D(4) : J=D(1) : T0=I9-I0 0955 INIT(00)D0$() : STR(D0$(),,10)=HEX(40)&STR(F$,,8)&HEX(FD) : DATA SAVE BA T#3,(J)D0$() 0960 D0$()=HEX(00FF9000A2)&".Sys File '"&STR(F$,,8)&"'.From "&D$&HEX(3AA22E)&" DATA statements created by 'Create Reference File' utility."&HEX(3AA22E22 )&"FileName.Description....!....3....!....4....!....5....!....6....ddd"&H EX(220D0000) 0965 T1=LEN(D0$()) : L8=L8+T1-1 : INIT(00)STR(D0$(),T1) 0970 FOR T0=I0TO I9 0980 L9=L9+I : CONVERT L9TO D0$,(####) : HEXPACKL9$FROMD0$ : REM PRINT "Line ";HEXOF(L9$);" "; 0990 X=VAL(L$(T0),2) : Z$=N$(X) 1000 D0$=HEX(FF)&STR(L9$,,2)&HEX(9722)&STR(Z$,,8)&" "&STR(N1$(X),2,2)&" Descri ption.."&HEX(220D0000FD) 1010 T1=LEN(D0$) : IF L8+T1<255THEN 1020 : J=J+1 : DATA SAVE BA T#3,(J)D0$() : L8=2 : INIT(00)D0$() 1020 STR(D0$(),L8,T1)=D0$ : L8=L8+T1-1 1030 NEXT T0 1035 IF L8=2THEN 1050 : J=J+1 : DATA SAVE BA T#3,(J)D0$() 1050 D0$=HEX(20FF9990972220220D0000FE) : INIT(00)D0$() : STR(D0$(),,LEN(D0$))=D0$ : DATA SAVE BA T#3,(J+1)D0$() 1060 D0$=HEX(20)&BIN(J-D(1),2) : INIT(00)D0$() : STR(D0$(),,LEN(D0$))=D0$ : DATA SAVE BA T#3,(D(2))D0$() 1065 PRINT F$;" contains program lines 9000 -";L9 1066 D0=D(1) : D$=SELECT #3 : LOAD T#0,"@TO.CRE0" 1070 LOAD DA T#3,(D(1))9000,9999BEG 1080 1080 D1$=SELECT #3 1085 RESAVE DC T#3,F$9000,9999 1090 PRINT "Program reference file of DATA statements ";HEX(0E22);F$;HEX(220F) ;" on disk ";HEX(0E);D1$ 1100 GOTO 700 1190 REM %^.Retrieve names from DATA stmts 1200 D0=-E : LOAD T#0,"@TO.CRE0" 1210 LOAD DC T#2,F$9000,9999BEG 1220 1220 J,S0=1 : N$()=ALL(FF) : RESTORE LINE9000 : L$()=ALL(00) : GOSUB 1240 : N1$()=ALL(J8$) 1222 PRINT AT(1,27,20);E;"PROGRAM items" 1230 READ J$ : IF J$=" "THEN 1325 : N$(J)=J$ : J=J+1 : IF J<ETHEN 1230 : GOTO 168 1240 J8$=HEX(80) : J9$=HEX(96) : I$=HEX(10801000118011001040) : RETURN 1290 REM %^.Retrieve names from DATA file 1300 C=7 : S0=2 1310 IF STR(I$(),C,1)=HEX(FD)THEN 1320 : IF STR(I$(),C,1)<>HEX(88)THEN 80 : C=C+9 : IF C<256THEN 1310 : GOTO 80 1320 DBACKSPACE #2,BEG : DATA LOAD DC #2,A$,N$() 1325 GOSUB 1410 : GOSUB 49 : J=1 : PRINT HEX(06);"Sorting disk catalog - please wait ..." 1330 IF J>ETHEN 168 : J$=N$(J) : IF J$=HEX(FFFFFFFFFFFFFFFF)OR F$=" "THEN 1400 : LIMITS T#2,J$,A1,B1,C1,D1 1340 N1$(J)=J8$ : IF D1<0THEN STR(N1$(J),2)="S" : IF ABS(D1)=2THEN STR(N1$(J),3)="D" : IF ABS(D1)=1THEN STR(N1$(J),3)="P" 1350 J1=B1-A1+1 : IF D1=0THEN J1=0 : S$(J)=BIN(J1,2) : S=S+J1 1360 J=J+1 : $IF OFF /001,1370 : KEYIN K$ : IF K$=HEX(7E)OR K$=HEX(7F)THEN 30 1370 GOTO 1330 1400 J$="@JUNKAAA" : GOTO 175 1410 PRINT HEX(06),AT(1,0,) : IF S0=0THEN RETURN : PRINT AT(1,1,50);"from "; : IF S0=1THEN PRINT "DATA stmts"; : IF S0=2THEN PRINT "DATA file"; : IF S0=3THEN PRINT "Disk.Image"; : PRINT HEX(2022);F$;HEX(22) : RETURN 5025 DEFFN'100(S$) : IF S$="340"THEN 5035 : $TRAN(S$,"AaBbCcDdEeFf")R : IF POS("DB3"=S$)>0AND POS("123567"=STR(S$,2))>0AND VER(STR(S$,3),"H")>0TH EN 5030 : Q$="I" : RETURN 5030 IF POS("3B"=S$)=0OR POS("123"=STR(S$,2))=0OR STR(S$,3)<>"0"THEN 5035 : IF STR(S$,,1)="3"THEN STR(S$,3)="1" : STR(S$,,1)="D" 5035 Q$=" " : RETURN 9000 REM .Sys File 'TEST '.From D11 : REM .DATA statements created by 'Create Reference File' utility. : REM ."FileName.Description....!....3....!....4....!....5....!....6....ddd " 9990 DATA " "