home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1992 December / 1992-12.d64 / scrapmaker (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  3KB  |  102 lines

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