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);
c1873bed 12 return((3&x&(i*(notes[notes_ix])>>o))<<4);
c395d5c8 13}
f3768c26
TG
14void main(void){
15 i = 0;
16 for(;;) {
fef0e35b 17 u8 sample;
f3768c26
TG
18 u8 n = i >> 14;
19 u8 s = i >> 17;
20 sample = g(1,n,12);
21 { u8 tmp = n^i>>13;
22 sample += g(s,tmp,10);
23 } //tmp
24 { u8 tmp1 = s/3;
25 u8 tmp2 = n+((i>>11)%3);
26 sample += g(tmp1,tmp2,10);
27 } //tmp1, tmp2
28 { u8 tmp1 = s/5;
29 u8 tmp2 = 8+n-((i>>10)%3);
30 sample += g(tmp1,tmp2,9);
31 } //tmp1, tmp2
fef0e35b 32 putchar(sample);
f3768c26 33 i++;
fef0e35b 34 }
c395d5c8 35}
Imprint / Impressum