new version
[Chiptunes-pms150c.git] / fakeasm.h
1 int flag_z = 0;
2 int flag_c = 0;
3 //ignoring flag_ov, flag_ac
4 #define MOV(dst, src) dst = src;
5 #define SL(dst) flag_c = (dst>>7); dst <<= 1;
6 #define SR(dst) flag_c = (dst&01); dst >>= 1;
7 #define SWAP(dst) dst = (dst<<4 | dst>>4);
8 #define AND(dst, src) dst &= src; flag_z = (dst==0);
9 #define OR(dst, src) dst |= src; flag_z = (dst==0);
10 #define CLEAR(dst) dst = 0;
11 #define ADD(dst, src) flag_c = (src+dst)>>8; dst += src; flag_z = (dst==0);
12 #define INC(dst) dst += 1; flag_c = flag_z = (dst==0);
13 #define ADDC0(dst) dst += flag_c; flag_c = flag_z = (dst==0);
14 #define CALL(addr) addr();
15 #define XOR(dst, src) dst ^= src; flag_z = (dst==0);
16 #define SUB(dst, src) flag_c = (src > dst); dst -= src; flag_z = (dst==0);
17 #define XCH(dst) acc ^= dst; dst ^= acc; acc ^= dst;
18 #define DEC(dst) dst -= 1; flag_c = flag_z = (dst==0);
19 #define NEG(dst) dst *= -1; flag_z = (dst==0);
20 #define SET1(dst, n) dst |= 1<<n;
21 #define IDXM(dst, ix) dst = *(ix); //xxx: requires passing array+index
22 #define SRC(dst) dst >>= 1; dst |= flag_c<<7;
23 #define ADDC(dst, src) dst += src+flag_c;
24 #define RET return;
Imprint / Impressum