new version
[Chiptunes-pms150c.git] / bsv.c
CommitLineData
b3a565e1
TG
1typedef unsigned char u8;
2
f3768c26 3int i;
ac66812d 4u8 i0, i1, i2, i3;
f3768c26 5
c1873bed
TG
6u8 notes[] = {
7 0x84, 0x9d, 0xb0, 0x69, 0x9d, 0x84, 0x69, 0x58,
8 0x75, 0x8c, 0xb0, 0x69, 0x8c, 0x75, 0x69, 0x58
9};
c320426f 10
f3768c26 11u8 g(u8 x, u8 t, u8 o){
ac66812d
TG
12 u8 notes_ix = t & 0x7;
13 if(3&i2)
14 notes_ix += 8;
8a26e976
TG
15 u8 result = (i*notes[notes_ix])>>o;
16 result &= x;
17 result &= 3;
18 return result;
c395d5c8 19}
f3768c26
TG
20void main(void){
21 i = 0;
ac66812d 22 i0 = i1 = i2 = i3 = 0;
f3768c26 23 for(;;) {
fef0e35b 24 u8 sample;
ac66812d
TG
25 u8 n = i2<<2 | i1>>6;
26 u8 s = i3<<7 | i2>>1;
f3768c26
TG
27 sample = g(1,n,12);
28 { u8 tmp = n^i>>13;
29 sample += g(s,tmp,10);
30 } //tmp
31 { u8 tmp1 = s/3;
32 u8 tmp2 = n+((i>>11)%3);
33 sample += g(tmp1,tmp2,10);
34 } //tmp1, tmp2
35 { u8 tmp1 = s/5;
36 u8 tmp2 = 8+n-((i>>10)%3);
37 sample += g(tmp1,tmp2,9);
38 } //tmp1, tmp2
8a26e976 39 putchar(sample<<4);
ac66812d 40
f3768c26 41 i++;
ac66812d
TG
42 i0++;
43 i1 += !i0;
44 i2 += !i1 && !i0;
45 i3 += !i2 && !i1 && !i0;
fef0e35b 46 }
c395d5c8 47}
Imprint / Impressum