From: Tobias Girstmair Date: Tue, 13 Nov 2018 00:31:03 +0000 (+0100) Subject: new version X-Git-Tag: attiny9~96 X-Git-Url: https://git.gir.st/Chiptunes.git/commitdiff_plain/e4f7baf085f9080e41d12d4a5166e3fde0135da5 new version --- diff --git a/fakeasm.h b/fakeasm.h index a5b0e8d..c000612 100644 --- a/fakeasm.h +++ b/fakeasm.h @@ -24,7 +24,8 @@ int zero = 0; //status register zero bit #define TST(x) if(x==0)zero=1;else zero=0; //WARN: not a complete TST mockup #define BREQ(l) if(zero) goto l; -int carry = 0; //status register carry bit +int carry = 0; //status register carry bit //WARN: not respected by all mocked instructions int asmtmp = 0; #define ROL(x) asmtmp = x>>7; x <<= 1; x |= carry; carry = asmtmp; #define ROR(x) asmtmp = x&0x1; x >>= 1; x |= carry<<7; carry = asmtmp; +#define NEG(x) x *= -1; diff --git a/foo.c b/foo.c index dc9d62e..c8eacff 100644 --- a/foo.c +++ b/foo.c @@ -100,7 +100,9 @@ int main(void) { #define tmp o x = (x*0x33)>>8; #undef tmp - t = n - (((i3&0x01)<<14 | i2<<6 | i1>>2) % 3); + t = ((i3&0x01)<<14 | i2<<6 | i1>>2) % 3; + SUB (t, n) + NEG (t) SUBI (t, -8) LDI (o, 9) RCALL g();