X-Git-Url: https://git.gir.st/Chiptunes.git/blobdiff_plain/965274e21f31a95689f0e1d46cbba876c158adbb..5d4207f9a0b24eec52054fa1674cded926f06a72:/foo.c?ds=inline diff --git a/foo.c b/foo.c index e70f5cf..4caddea 100644 --- a/foo.c +++ b/foo.c @@ -31,13 +31,21 @@ void g(void) { }; int main(void) { - unsigned short n; - unsigned short s; + u8 n; + u8 s; u8 acc; //TODO: clear all vars/registers for (;;) { - acc = 0; - n = (i2<<2 | i1>>6); + MOV (n, i2) + LSL (n) + LSL (n) + #define tmp acc + MOV (tmp, i1) + SWAP (tmp) + ANDI (tmp, 0x0f) + tmp >>= 2; + OR (n, tmp) + #undef tmp s = (i3<<7 | i2>>1); //voice 1: @@ -49,7 +57,18 @@ int main(void) { //voice 2: MOV (x, s) - t = n ^ (i2<<3 | i1>>5); + #define tmp o + MOV (tmp, i2) + LSL (tmp) + LSL (tmp) + LSL (tmp) + MOV (t, i1) + SWAP (t) + ANDI (t, 0xf) + LSR (t) + OR (t, tmp) + #undef tmp + EOR (t, n) LDI (o, 10) RCALL g(); ADD (acc, t) @@ -75,5 +94,6 @@ int main(void) { ADC (i1, tmp, !i0) ADC (i2, tmp, !i0&&!i1) ADC (i3, tmp, !i0&&!i1&&!i2) + #undef tmp } }