new version
[Chiptunes-pms150c.git] / bsv.c
CommitLineData
b3a565e1
TG
1typedef unsigned char u8;
2
f3768c26
TG
3int i;
4
c1873bed
TG
5u8 notes[] = {
6 0x84, 0x9d, 0xb0, 0x69, 0x9d, 0x84, 0x69, 0x58,
7 0x75, 0x8c, 0xb0, 0x69, 0x8c, 0x75, 0x69, 0x58
8};
c320426f 9
f3768c26
TG
10u8 g(u8 x, u8 t, u8 o){
11 u8 notes_ix = t%8 + 8*!!(3&i>>16);
8a26e976
TG
12 u8 result = (i*notes[notes_ix])>>o;
13 result &= x;
14 result &= 3;
15 return result;
c395d5c8 16}
f3768c26
TG
17void main(void){
18 i = 0;
19 for(;;) {
fef0e35b 20 u8 sample;
f3768c26
TG
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
8a26e976 35 putchar(sample<<4);
f3768c26 36 i++;
fef0e35b 37 }
c395d5c8 38}
Imprint / Impressum