git://git.gir.st
/
Chiptunes.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
new version
[Chiptunes.git]
/
foo.c
diff --git
a/foo.c
b/foo.c
index e70f5cf65e55cf8dd446b5e9bf24c5b3ead2fdf8..c8eacfffa85f8c2a74a08e5298305192b0542924 100644
(file)
--- a/
foo.c
+++ b/
foo.c
@@
-24,21
+24,38
@@
void g(void) {
SUBI (t, -8)
skip:
t = data[t];
SUBI (t, -8)
skip:
t = data[t];
- t = ((
i3<<24|i2<<16|i1
<<8|i0)*t) >> o;
+ t = ((
(i1&0x1f)
<<8|i0)*t) >> o;
AND (t, x)
ANDI (t, 3)
RET
};
int main(void) {
AND (t, x)
ANDI (t, 3)
RET
};
int main(void) {
- u
nsigned short
n;
- u
nsigned short
s;
+ u
8
n;
+ u
8
s;
u8 acc;
//TODO: clear all vars/registers
for (;;) {
u8 acc;
//TODO: clear all vars/registers
for (;;) {
- acc = 0;
- n = (i2<<2 | i1>>6);
- s = (i3<<7 | i2>>1);
+ MOV (n, i2)
+ LSL (n)
+ LSL (n)
+ #define tmp acc
+ MOV (tmp, i1)
+ SWAP (tmp)
+ ANDI (tmp, 0x0f)
+ LSR (tmp)
+ LSR (tmp)
+ OR (n, tmp)
+ #undef tmp
+ MOV (s, i3)
+ ROR (s)
+ ROR (s)
+ ANDI (s, 0x80)
+ #define tmp acc
+ MOV (tmp, i2)
+ LSR (tmp)
+ OR (s, tmp)
+ #undef tmp
//voice 1:
LDI (x, 1)
//voice 1:
LDI (x, 1)
@@
-49,21
+66,44
@@
int main(void) {
//voice 2:
MOV (x, s)
//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)
//voice 3:
LDI (o, 10)
RCALL g();
ADD (acc, t)
//voice 3:
- x = s / 3;
- t = n + ((i3<<13 | i2<<5 | i1>>3) % 3);
+ MOV (x, s)
+ INC (x)
+ #define tmp o
+ x = (x*0x55)>>8;
+ #undef tmp
+ t = ((i3&0x01)<<13 | i2<<5 | i1>>3) % 3;
+ ADD (t, n)
LDI (o, 10)
RCALL g();
ADD (acc, t)
//voice 4:
LDI (o, 10)
RCALL g();
ADD (acc, t)
//voice 4:
- x = s / 5;
- t = 8 + n - ((i3<<14 | i2<<6 | i1>>2) % 3);
+ MOV (x, s)
+ INC (x)
+ #define tmp o
+ x = (x*0x33)>>8;
+ #undef tmp
+ t = ((i3&0x01)<<14 | i2<<6 | i1>>2) % 3;
+ SUB (t, n)
+ NEG (t)
+ SUBI (t, -8)
LDI (o, 9)
RCALL g();
ADD (acc, t)
LDI (o, 9)
RCALL g();
ADD (acc, t)
@@
-75,5
+115,6
@@
int main(void) {
ADC (i1, tmp, !i0)
ADC (i2, tmp, !i0&&!i1)
ADC (i3, tmp, !i0&&!i1&&!i2)
ADC (i1, tmp, !i0)
ADC (i2, tmp, !i0&&!i1)
ADC (i3, tmp, !i0&&!i1&&!i2)
+ #undef tmp
}
}
}
}