new version
[Chiptunes-pms150c.git] / bsv.c
1 typedef unsigned char u8;
2
3 int i;
4 u8 i0, i1, i2, i3;
5
6 u8 notes[] = {
7 0x84, 0x9d, 0xb0, 0x69, 0x9d, 0x84, 0x69, 0x58,
8 0x75, 0x8c, 0xb0, 0x69, 0x8c, 0x75, 0x69, 0x58
9 };
10
11 u8 g(u8 x, u8 t, u8 o){
12 u8 notes_ix = t & 0x7;
13 if(3&i2)
14 notes_ix += 8;
15 u8 result = (i*notes[notes_ix])>>o;
16 result &= x;
17 result &= 3;
18 return result;
19 }
20 void main(void){
21 i = 0;
22 i0 = i1 = i2 = i3 = 0;
23 for(;;) {
24 u8 sample;
25 u8 n = i2<<2 | i1>>6;
26 u8 s = i3<<7 | i2>>1;
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
39 putchar(sample<<4);
40
41 i++;
42 i0++;
43 i1 += !i0;
44 i2 += !i1 && !i0;
45 i3 += !i2 && !i1 && !i0;
46 }
47 }
Imprint / Impressum