Skip to content

Instantly share code, notes, and snippets.

@tomaes
Last active June 12, 2020 12:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomaes/476212726f88d3c0771f4d427371abac to your computer and use it in GitHub Desktop.
Save tomaes/476212726f88d3c0771f4d427371abac to your computer and use it in GitHub Desktop.
Filters and converts Petscii Cola data to chr$() codes when exported to BASIC.
0 rem petscii cola chr$() filter/converter stub code
1 print "wait.": n=999: f=32: dim d(1000), cc(1000)
2 for i=0 to n: read a: d(i)=a: next: i=-1
3 i=i+1: on -(d(i)=f) goto 3: s=i: i=1000
4 i=i-1: on -(d(i)=f) goto 4: e=i
5 print "start:"s;"end:"e: print "ok. converting data": j=0
6 for i=s to e: re=0
7 : if d(i) >= 128 then re=1: d(i)=d(i)-128
8 : if d(i) < 32 then cc(j) = d(i)+64
9 : if d(i) <= 63 and d(i) >= 32 then cc(j) = d(i)
10 : if d(i) <= 95 and d(i) > 64 then cc(j) = d(i)+32
11 : if d(i) <=127 and d(i) >= 96 then cc(j) = d(i)+64
12 : if re=1 then cc(j)=256+cc(j): rem decoding: 18,value-256,146
13 j=j+1: next
14 print chr$(147)j"chr$()+ values:";
15 for i=0 to j-1: print str$(cc(i)); :next: print: print "key for pic"
16 poke198,.: wait198,1: for i=0 to j-1
17 : if cc(i)>=256 then print chr$(18)chr$(cc(i)-256)chr$(146);
18 : if cc(i)<=255 then print chr$(cc(i));
19 next: end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment