]> git.gir.st - Chiptunes-pms150c.git/blame_incremental - bsv.c
new version
[Chiptunes-pms150c.git] / bsv.c
... / ...
CommitLineData
1typedef unsigned char u8;
2
3int i;
4
5u8 notes[] = {
6 0x84, 0x9d, 0xb0, 0x69, 0x9d, 0x84, 0x69, 0x58,
7 0x75, 0x8c, 0xb0, 0x69, 0x8c, 0x75, 0x69, 0x58
8};
9
10u8 g(u8 x, u8 t, u8 o){
11 u8 notes_ix = t%8 + 8*!!(3&i>>16);
12 u8 result = (i*notes[notes_ix])>>o;
13 result &= x;
14 result &= 3;
15 return result;
16}
17void main(void){
18 i = 0;
19 for(;;) {
20 u8 sample;
21 u8 n = i >> 14;
22 u8 s = i >> 17;
23 sample = g(1,n,12);
24 { u8 tmp = n^i>>13;
25 sample += g(s,tmp,10);
26 } //tmp
27 { u8 tmp1 = s/3;
28 u8 tmp2 = n+((i>>11)%3);
29 sample += g(tmp1,tmp2,10);
30 } //tmp1, tmp2
31 { u8 tmp1 = s/5;
32 u8 tmp2 = 8+n-((i>>10)%3);
33 sample += g(tmp1,tmp2,9);
34 } //tmp1, tmp2
35 putchar(sample<<4);
36 i++;
37 }
38}
Imprint / Impressum