home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compute! Gazette 1992 December
/
1992-12.d64
/
scrapmaker
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
3KB
|
102 lines
10 poke52,32:poke56,32:clr:print"[147][154]";:poke53281,6:poke53280,14:ad=8192
20 hd$="[147] [199][197][207][211] [212]ext [211]crap [205]aker (file converter) ":mc=6000
30 printhd$
40 goto200
50 rem ---- search dir for track and sector
60 ff=0:print#15,"u1:2 0"+str$(t)+str$(s)
70 get#2,a$:tn=asc(a$+chr$(0)):get#2,a$:sn=asc(a$+chr$(0))
80 forn=0to7:print#15,"b-p:2,"+str$(32*n+2)
90 get#2,a$:ifa$<>chr$(131)then160
100 get#2,a$:tp=asc(a$+chr$(0)):get#2,a$:sp=asc(a$+chr$(0)):h$=""
110 get#2,a$:ifa$<>chr$(160)thenh$=h$+a$:goto110
120 ifh$<>di$then160
130 ff=1:kp=n:n=7
140 print#15,"b-p:2,"+str$(32*kp+30)
150 get#2,a$:sl=asc(a$+chr$(0)):get#2,a$:sh=asc(a$+chr$(0))
160 next:iftn=0thenreturn
170 ifff=1thenreturn
180 t=tn:s=sn:goto60
190 rem ---- request for conversion type
200 print"[201]nsert disk with file to be converted."
210 print"[211]elect conversion:"
220 print" 1) [211]peed[211]cript to [199][197][207][211]"
230 print" 2) [195]ommodore [193][211][195][201][201] to [199][197][207][211]"
240 print" 3) [212]rue [193][211][195][201][201] to [199][197][207][211][145][145][145][145]"
250 getz$:ifz$<"1"orz$>"3"then250
260 ifz$="1"thenx$=",p,r"
270 ifz$="2"thenx$=",s,r"
280 ifz$="3"thenx$=",s,r"
290 forn=1toval(z$):print:next:print"*";:forn=1to4-val(z$):print:next
300 rem ---- read file into memory
310 n$="":input"[198]ilename";n$:ifn$=""then310
320 open15,8,15:open8,8,0,n$+x$:input#15,en,eb$,et,es
330 ifen<>0thenclose8:close15:print"";eb$:n$="":goto210
340 printhd$:print"[204]oading [159]";n$
350 poke185,0:poke780,0:poke781,0:poke782,32:sys65493:close8:close15:si=0
360 ea=peek(781)+peek(782)*256:if(ea-ad)>mcthen970
370 print"[154][208]lease wait, translating":print"[159]";n$;"[154] ..."
380 print" 0% complete[145]":forn=adtoea-1:c=peek(n):onval(z$)goto390,470,520
390 ifc=0thenc=64:goto520
400 ifc>=1andc<=26thenc=c+96:goto520
410 ifc=27thenc=91:goto520
420 ifc=29thenc=93:goto520
430 ifc=30thenc=94:goto520
440 ifc=31thenc=13:goto520
450 if(c>=32andc<=63)or(c>=65andc<=90)then520
460 goto530:rem speedscript control codes can't translate
470 ifc=13or(c>=32andc<=64)or(c>=91andc<=95)then520
480 ifc>=65andc<=90thenc=c+32:goto520
490 ifc>=97andc<=122thenc=c-32:goto520
500 ifc>=193andc<=218thenc=c-128:goto520
510 goto530:rem weird commodore ascii can't translate
520 pokead+si,c:si=si+1
530 printint((n-ad)/(ea-1-ad)*100)"[157]%[145]":next:si=si+4
540 print"[159] [212]ext scrap will be"int(si/1024+.5)"[157][203]"
550 rem ---- request for geos work disk with text scrap file
560 print"[154][201]nsert [199][197][207][211] work disk in drive, hit"
570 print"[210][197][212][213][210][206][146] when ready."
580 geta$:ifa$<>chr$(13)then580
590 print"[211]aving [159][212]ext [211]crap[154] file...":print" 0% complete[145]"
600 rem ---- write file called 's'
610 open15,8,15,"i0":input#15,en,eb$,et,es:ifen<>0then940
620 open2,8,2,"s,u,w":input#15,en,eb$,et,es:ifen<>0then940
630 hs=int(si/256):ls=si-hs*256:sf=hs
640 print#2,chr$(ls)chr$(hs)chr$(23)chr$(9)chr$(0)chr$(0);
650 forn=0tosi-5:print#2,chr$(peek(ad+n));:printint(n/(si-5)*100)"[157]%[145]"
660 next:close2
670 data84,101,120,116,32,32,83,99,114,97,112
680 p$="":forn=0to10:readx:p$=p$+chr$(x):next
690 open2,8,2,"#":t=18:s=1:di$=p$:gosub60
700 ifff=0thenprint"[206]o [212]ext [211]crap file":goto870
710 t1=t:s1=s:fs=256*sh+sl-1:t2=tp:s2=sp:k1=kp
720 rem ---- swap t/s pointers and delete 's' file
730 t=18:s=1:di$="s":gosub60
740 print#15,"b-p:2,"+str$(32*kp+3)
750 print#2,chr$(t2)chr$(s2);
760 print#15,"b-p:2,"+str$(32*kp+30)
770 fh=int(fs/256):fl=fs-256*fh
780 print#2,chr$(fl)chr$(fh);
790 print#15,"u2:2 0"+str$(t)+str$(s)
800 print#15,"u1:2 0"+str$(t1)+str$(s1)
810 print#15,"b-p:2,"+str$(32*k1+3)
820 print#2,chr$(tp)chr$(sp);
830 print#15,"b-p:2,"+str$(32*k1+30)
840 print#2,chr$(sf+1)chr$(0);
850 print#15,"u2:2 0"+str$(t1)+str$(s1)
860 print#15,"s0:s"
870 close2:close15
880 print"[154][196]one... [201]nsert [199][197][207][211] master disk in"
890 print"drive then hit [210][197][212][213][210][206][146] to boot."
900 geta$:ifa$<>chr$(13)then900
910 print"[147]"chr$(142):load"geos",8,1
920 end
930 rem ---- in case of disk error....
940 print"[147]";spc(20-len(eb$)/2)"[158]"+eb$
950 print" resetting drive...[154]"
960 print#15,"uj":forn=1to1500:next:close15:close2:goto590
970 print""spc(8)"[158]** [207][214][197][210][198][204][207][215] [197][210][210][207][210] **[154]"
980 print"[212]he requested file exceeds the"mc
990 print"character maximum. [208]ress [210][197][212][213][210][206][146] to":print"retry."
1000 geta$:ifa$<>chr$(13)then1000
1010 goto30