X-Git-Url: https://git.gir.st/Chiptunes.git/blobdiff_plain/e57156546369c9e59107c358e4b73419c6499d7c..44e34da036f83d3efd6384cdc37ec9bd3e234e3a:/fakeasm.h diff --git a/fakeasm.h b/fakeasm.h index cfb4598..e548517 100644 --- a/fakeasm.h +++ b/fakeasm.h @@ -15,17 +15,24 @@ #define SUB(x,y) x -= y; //TODO: carry #define SUBI(x,n) x -= (u8)n; //TODO: carry #define INC(x) x++; //WARN: does not set carry +#define DEC(x) x--; sr_zero=!x; #define MOV(x,y) x = y; #define LDI(x,n) x = n; -#define SBRC(x,b) if (x & b) //skip if cleared => do if set +#define SBRC(x,b) if (x & 1< do if set +#define SBRS(x,b) if (!(x & 1< do if not #define CLR(x) x = 0; #define RET return; #define RCALL //pseudo int sr_zero = 0; //status register zero bit #define TST(x) if(x==0)sr_zero=1;else sr_zero=0; //WARN: not a complete TST mockup #define BREQ(l) if(sr_zero) goto l; +#define BRNE(l) if(!sr_zero) goto l; 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; +int sr_neg = 0; +#define CPI(x,n) sr_neg = (x-n < 0);sr_zero = (x-n == 0); //WARN: not a complete CPI mockup +#define BRPL(l) if (sr_neg) goto l; +#define RJMP(l) goto l;