new 1rem appbin.to 10normal:text:notrace:home 15d$=chr$(4) 18cd=8192:rem code start 20ec=cd+18:rem error code location 25pn=cd+19:rem pathname location 30dt=10752:rem block buffer address ($2a00) 32dimf$(255):rem filenames 33fori=cdtocd+296:readx:pokei,x:next 35?"prodos to appbinary file converter" 37?"(version 1.00 --- november 10, 1986)" 40?"by gary b. little" 42?:?"this is a public domain program.":? 45?"this program creates an appbinary" 46?"file from a group of prodos files." 50?:?"enter the name of the directory in" 60?"which the prodos files are stored" 70?"( e.g. /mydisk/myfiles/ ):":? 80input"";pf$:ifpf$=""thenhome:end 90onerrgoto110 100?d$;"prefix";pf$:poke216,0:goto190 110?:?"that directory does not exist." 120?"press any key to continue:";:geta$:?a$:?:goto50 190home:?"enter the names of the prodos files" 192?"(press [return] when done):" 195nf=1 200?:?"enter the name of prodos file #";nf;": "; 210input"";f$(nf) 215iflen(f$(nf))>15then?"error: illegal filename.":goto200 220iff$(nf)<>""thennf=nf+1:goto200 230nf=nf-1:ifnf=0thenhome:end 232?:?"enter a name for the appbinary file: ";:input"";ab$ 234ifab$=""thenhome:end 236l=len(ab$):ifl>15then232 238onerrgoto242 240?d$;"create";ab$;",tbin":poke216,0:goto245 242ifpeek(222)=19then?d$;"delete";ab$:goto240 243goto600 245pokepn,l:fori=1tol:pokepn+i,asc(mid$(ab$,i,1)):next 250callcd+0:gosub5000:rem open appbinary file 260home 270forj=1tonf 280l=len(f$(j)) 290pokepn,l:fori=1tol:pokepn+i,asc(mid$(f$(j),i,1)):next 300?"storing... "; 310fori=1tol 320ch=asc(mid$(f$(j),i,1)):ifch<128thench=ch+128 330?chr$(ch);:next:? 340rem create the header 350callcd+3:gosub5000:rem open/form header 360pokedt+127,nf-j:rem files to follow 370rem write the header 380callcd+9:gosub5000 390ef=peek(dt+20)+256*peek(dt+21)+65536*peek(dt+22) 400ifef=0then460 420callcd+6:rem read 128 bytes 425ifpeek(ec)=76then460:rem branch if eof 430gosub5000 440callcd+9:gosub5000:rem write 128 bytes 450goto420 460callcd+15:gosub5000:rem close prodos file 470nextj 480callcd+12:rem close appbinary file 500?:?"the appbinary file, ";ab$;"," 510?"has how been created.":end 600?:?"error: can't create ";ab$ 610?"applesoft error #";peek(222):end 5000en=peek(ec):rem get error code 5010ifen=0thenreturn 5015ifen=70oren=64then?:?"error: file not found":end 5020pop:?:?"error: mli code #";en:end 6000data 76,84,32,76,100,32,76,203,32,76,223,32,76,233,32,76,239 6001data 32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 6002data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 6003data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 6004data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32 6005data 0,191,200,13,33,32,251,32,173,18,33,141,34,33,96,32,192 6006data 32,169,10,141,0,42,169,2,141,18,42,169,23,141,1,42,169 6007data 42,141,2,42,174,19,32,189,19,32,157,23,42,202,16,247,32 6008data 0,191,196,0,42,32,251,32,169,71,141,1,42,169,76,141,2 6009data 42,173,4,42,201,15,240,30,32,0,191,200,19,33,32,251,32 6010data 173,24,33,141,26,33,141,12,33,141,19,42,32,0,191,209,18 6011data 42,32,251,32,96,162,127,169,0,157,0,42,202,16,250,96,32 6012data 192,32,32,0,191,202,25,33,144,5,201,76,208,1,24,32,251 6013data 32,96,32,0,191,203,33,33,32,251,32,96,169,0,56,32,251 6014data 32,169,0,141,18,32,32,0,191,204,11,33,96,141,18,32,144 6015data 8,104,104,32,0,191,204,9,33,96,1,0,1,0,3,19,32 6016data 0,34,0,3,19,32,0,38,0,4,0,0,42,128,0,0,0 6017data 4,0,0,42,128,0,0,0 save to.bny new 1rem binary.dwn 10normal:text:notrace:home 12ifpeek(48896)=76then15 13?"this program requires prodos.":end 15d$=chr$(4) 18cd=8192:rem code start 20ec=cd+21:rem error code location 25pn=cd+22:rem pathname location 30dt=10752:rem block buffer address ($2a00) 32ll=dt+20:rem eof location 35?"binary ii to prodos file converter" 37?"(version 1.20 --- november 19, 1986)" 40?"by gary b. little":? 45?"this program extracts prodos files" 46?"from a file in binary ii form." 48?:?"this program is in the public domain." 50?:?"enter the name of the directory in" 60?"which the binary ii file is stored" 70?"(e.g., /mydisk/myfiles/ ):":? 80input"";pf$:ifpf$=""thenhome:end 90onerrgoto5100 100?d$;"prefix";pf$:poke216,0 150fori=0to297:readx:pokecd+i,x:next 200?:?"enter the name of the binary ii file" 210?"you want to convert:";:input"";f$ 220iff$=""thenhome:end 230l=len(f$):ifl>15then5200 235pokepn,l 240fori=1tol:pokepn+i,asc(mid$(f$,i,1)):next 250home 300callcd+0:gosub5000:rem open binary ii file 305?"scanning the binary ii file:":? 310rem read header and check id bytes 320callcd+6:gosub5000:rem read 128 bytes 330i1=peek(dt+0):i2=peek(dt+1) 335i3=peek(dt+2):i4=peek(dt+18) 340ifi1<>10ori2<>71ori3<>76ori4<>2then1000 345ft=peek(dt+4):rem file type 347df=peek(dt+125):rem data flags 350rem calculate number of blocks to read 360ef=peek(ll)+256*peek(ll+1)+65536*peek(ll+2) 370nb=int(ef/128)+((ef-128*int(ef/128))<>0) 380rem display name of file 383l=peek(dt+23):fori=1tol 384ch=peek(dt+23+i):ifch<128thench=ch+128 385?chr$(ch);:next:htab17 386ifdf>127thendf=df-128:?"compressed "; 387ifdf>63thendf=df-64:?"encrypted "; 388ifdf=1then?"packed "; 389? 390tf=peek(dt+127):rem number of files to follow 400callcd+3:gosub5000:rem open prodos file 405ifnb=0orft=15then460 410fori=1tonb 420callcd+6:gosub5000:rem read 128 bytes 430callcd+9:gosub5000:rem write 128 bytes 440nexti 450callcd+18:gosub5000:rem set exact eof 460callcd+15:gosub5000:rem close prodos file 470iftf<>0then320 480callcd+12:rem close binary ii file 500?:?"conversion completed.":end 1000callcd+12:rem close binary ii file 1010home:?"error: ";f$;" is not a binary ii file":end 5000en=peek(ec):rem get error code 5010ifen=0thenreturn 5020pop:?:?"error: mli code #";en 5030ifen=70then?"file not found" 5040ifen=71then?"duplicate filename" 5050end 5100home:?"error: directory not found.":poke216,0:end 5200home:?"error: illegal file name.":poke216,0:end 6000data 76,87,32,76,103,32,76,199,32,76,209,32,76,219,32,76,225 6001data 32,76,237,32,0,0,0,0,0,0,0,0,0,0,0,0,0 6002data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 6003data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 6004data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 6005data 0,0,32,0,191,200,9,33,32,247,32,173,14,33,141,22,33 6006data 96,169,7,141,0,42,169,23,141,1,42,169,42,141,2,42,173 6007data 3,42,9,2,141,3,42,162,2,189,20,42,157,39,33,202,16 6008data 247,48,23,162,3,189,14,42,157,8,42,202,16,247,32,0,191 6009data 192,0,42,32,247,32,76,170,32,32,0,191,195,0,42,176,21 6010data 32,0,191,200,15,33,176,13,173,20,33,141,30,33,141,38,33 6011data 141,8,33,96,201,70,240,200,56,32,247,32,32,0,191,202,21 6012data 33,32,247,32,96,32,0,191,203,29,33,32,247,32,96,169,0 6013data 56,32,247,32,169,0,141,21,32,32,0,191,204,7,33,96,32 6014data 0,191,208,37,33,32,247,32,96,141,21,32,144,8,104,104,32 6015data 0,191,204,5,33,96,1,0,1,0,3,22,32,0,34,0,3 6016data 23,42,0,38,0,4,0,0,42,128,0,0,0,4,0,0,42 6017data 128,0,0,0,2,0,0,0,0 save undo.bin2 rem that's all.