home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nibble Magazine
/
nib33a.dsk
/
MARCH.1988
/
BINARY.UP.bas
< prev
next >
Wrap
BASIC Source File
|
2023-02-26
|
5KB
|
111 lines
10 REM ***************************
20 REM * BINARY.UP *
30 REM * BY GARY LITTLE *
40 REM ***************************
100 NORMAL : TEXT : NOTRACE : HOME
110 IF PEEK(48896) = 76 THEN 130
120 PRINT "THIS PROGRAM REQUIRES PRODOS.": END
130 D$ = CHR$(4)
140 PRINT D$;"PREFIX": INPUT PX$
150 CD = 8192: REM CODE START
160 EC = CD +21: REM ERROR CODE LOCATION
170 PN = CD +22: REM PATHNAME LOCATION
180 DT = 10752: REM BLOCK BUFFER ADDRESS ($2A00)
190 DIM F$(255): REM FILENAMES
200 FOR I = CD TO CD +360: READ X: POKE I,X: NEXT
210 PRINT "[BINARY.UP]": PRINT
220 PRINT "PRODOS TO BINARY II FILE CONVERTER"
230 PRINT "(VERSION 1.50 --- APRIL 5, 1987)"
240 PRINT "BY ";: INVERSE : PRINT "GARY B. LITTLE": NORMAL
250 PRINT : PRINT "THIS IS A PUBLIC DOMAIN PROGRAM.": PRINT
260 PRINT "THIS PROGRAM CREATES A BINARY II"
270 PRINT "FILE FROM A GROUP OF PRODOS FILES."
280 PRINT : PRINT "ENTER THE NAME OF THE DIRECTORY IN"
290 PRINT "WHICH THE PRODOS FILES ARE STORED"
300 PRINT "( E.G. /MYDISK/MYFILES/ ):": PRINT
310 INPUT "";PF$: IF PF$ = "" THEN HOME : END
320 ONERR GOTO 340
330 PRINT D$;"PREFIX";PF$: POKE 216,0: GOTO 360
340 PRINT : PRINT "THAT DIRECTORY DOES NOT EXIST."
350 PRINT "PRESS ANY KEY TO CONTINUE:";: GET A$: PRINT A$: PRINT : GOTO 280
360 HOME : PRINT "ENTER THE NAMES OF THE PRODOS FILES"
370 PRINT "(PRESS [RETURN] WHEN DONE):"
380 NF = 1
390 PRINT : PRINT "ENTER THE NAME OF PRODOS FILE #";NF;": ";
400 INPUT "";F$(NF):L = LEN(F$(NF))
410 IF L >15 THEN PRINT "ERROR: ILLEGAL FILENAME.": GOTO 390
420 IF L = 0 THEN 470
430 POKE PN,L: FOR I = 1 TO L: POKE PN +I, ASC( MID$ (F$(NF),I,1)): NEXT
440 CALL CD +18: REM GET SIZE OF FILE
450 IF PEEK(EC) < >0 THEN PRINT "ERROR: CAN'T FIND FILE.": GOTO 390
460 NF = NF +1: GOTO 390
470 NF = NF -1: IF NF = 0 THEN HOME : END
480 PRINT : PRINT "ENTER THE PATHNAME OF THE BINARY II"
490 PRINT "FILE TO BE CREATED: ";: INPUT "";AB$
500 IF AB$ = "" THEN HOME : GOTO 1060
510 L = LEN(AB$): IF L >64 THEN 480
520 ONERR GOTO 540
530 PRINT D$;"CREATE";AB$;",TBIN": POKE 216,0: GOTO 560
540 IF PEEK(222) = 19 THEN PRINT D$;"DELETE";AB$: GOTO 530
550 GOTO 830
560 POKE PN,L: FOR I = 1 TO L: POKE PN +I, ASC( MID$ (AB$,I,1)): NEXT
570 CALL CD +0: GOSUB 1000: REM OPEN BINARY II FILE
580 HOME
590 FOR J = 1 TO NF
600 L = LEN(F$(J))
610 POKE PN,L: FOR I = 1 TO L: POKE PN +I, ASC( MID$ (F$(J),I,1)): NEXT
620 PRINT "STORING... ";
630 FOR I = 1 TO L
640 CH = ASC( MID$ (F$(J),I,1)): IF CH <128 THEN CH = CH +128
650 PRINT CHR$(CH);: NEXT : PRINT
660 REM CREATE THE HEADER
670 CALL CD +3: GOSUB 1000: REM OPEN/FORM HEADER
680 POKE DT +127,NF -J: REM FILES TO FOLLOW
690 REM WRITE THE HEADER
700 CALL CD +9: GOSUB 1000
710 EF = PEEK(DT +20) +256 * PEEK(DT +21) +65536 * PEEK(DT +22)
720 IF EF = 0 THEN 780
730 CALL CD +6: REM READ 128 BYTES
740 IF PEEK(EC) = 76 THEN 780: REM BRANCH IF EOF
750 GOSUB 1000
760 CALL CD +9: GOSUB 1000: REM WRITE 128 BYTES
770 GOTO 730
780 CALL CD +15: GOSUB 1000: REM CLOSE PRODOS FILE
790 NEXT J
800 CALL CD +12: REM CLOSE BINARY II FILE
810 PRINT : PRINT "THE BINARY II FILE, ";AB$;","
820 PRINT "HAS NOW BEEN CREATED.": GOTO 1060
830 PRINT : PRINT "ERROR: CAN'T CREATE ";AB$
840 PRINT "APPLESOFT ERROR #"; PEEK(222): GOTO 1060
1000 EN = PEEK(EC): REM GET ERROR CODE
1010 IF EN = 0 THEN RETURN
1020 POP : PRINT D$;"CLOSE"
1030 IF EN = 70 OR EN = 64 THEN PRINT : PRINT "ERROR: FILE NOT FOUND": GOTO 1060
1040 IF EN = 72 THEN PRINT : PRINT "ERROR: DISK IS FULL": GOTO 1060
1050 POP : PRINT : PRINT "ERROR: MLI CODE #";EN: GOTO 1060
1060 PRINT D$;"PREFIX";PX$: END
5000 DATA 76,116,32,76,132,32,76,247,32,76,11,33,76,21,33
5010 DATA 76,27,33,76,87,32,0,0,0,0,0,0,0,0,0
5020 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5030 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5040 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5050 DATA 0,0,0,0,0,0,0,0,0,0,0,0,32,0,191
5060 DATA 196,85,33,32,39,33,24,173,103,33,109,93,33,141,103
5070 DATA 33,173,104,33,109,94,33,141,104,33,96,32,0,191,200
5080 DATA 57,33,32,39,33,173,62,33,141,78,33,96,32,236,32
5090 DATA 169,10,141,0,42,169,2,141,18,42,173,103,33,141,117
5100 DATA 42,173,104,33,141,118,42,169,23,141,1,42,169,42,141
5110 DATA 2,42,174,22,32,189,22,32,157,23,42,202,16,247,32
5120 DATA 0,191,196,0,42,32,39,33,169,71,141,1,42,169,76
5130 DATA 141,2,42,32,0,191,200,63,33,32,39,33,173,68,33
5140 DATA 141,70,33,141,56,33,141,19,42,173,4,42,201,15,240
5150 DATA 9,32,0,191,209,18,42,32,39,33,96,162,127,169,0
5160 DATA 157,0,42,202,16,250,96,32,236,32,32,0,191,202,69
5170 DATA 33,144,5,201,76,208,1,24,32,39,33,96,32,0,191
5180 DATA 203,77,33,32,39,33,96,169,0,56,32,39,33,169,0
5190 DATA 141,21,32,32,0,191,204,55,33,96,141,21,32,144,8
5200 DATA 104,104,32,0,191,204,53,33,96,1,0,1,0,3,22
5210 DATA 32,0,34,0,3,22,32,0,38,0,4,0,0,42,128
5220 DATA 0,0,0,4,0,0,42,128,0,0,0,10,22,32,0
5230 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5240 DATA 0