]> git.gir.st - Chiptunes-pms150c.git/blob - bsv.c
f42eff621a82271d2d097e7033870d613931ad66
[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
28 sample = g(1,n,12);
29
30 { u8 tmp;
31 tmp = i2<<3 | i1>>5;
32 tmp ^= n;
33 sample += g(s,tmp,10);
34 } //tmp
35
36 { u8 tmp1 = s/3;
37 u8 tmp2;
38 tmp2 = (i>>11)%3;
39 tmp2 += n;
40 sample += g(tmp1,tmp2,10);
41 } //tmp1, tmp2
42
43 { u8 tmp1 = s/5;
44 u8 tmp2 = n;
45 { u8 tmp3 = (i>>10)%3;
46 tmp2 -= tmp3;
47 } // tmp3
48 tmp2 += 8;
49 sample += g(tmp1,tmp2,9);
50 } //tmp1, tmp2
51
52 putchar(sample<<4);
53
54 i++;
55 i0++;
56 i1 += !i0;
57 i2 += !i1 && !i0;
58 i3 += !i2 && !i1 && !i0;
59 }
60 }
Imprint / Impressum