Skip to content

Instantly share code, notes, and snippets.

@tomaes

tomaes/colaconvert.bas

Last active Jun 12, 2020
Embed
What would you like to do?
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
You can’t perform that action at this time.