|
|
| version 1.16, 2003/12/03 07:59:57 | version 1.19, 2004/02/18 18:29:29 |
|---|---|
| Line 24 | Line 24 |
| #if defined(I286C_TEST) | #if defined(I286C_TEST) |
| extern BYTE BYTESZPF(UINT r); | extern UINT8 BYTESZPF(UINT r); |
| extern BYTE BYTESZPCF(UINT r); | extern UINT8 BYTESZPCF(UINT r); |
| #define BYTESZPCF2(a) BYTESZPCF((a) & 0x1ff) | #define BYTESZPCF2(a) BYTESZPCF((a) & 0x1ff) |
| extern BYTE WORDSZPF(UINT32 r); | extern UINT8 WORDSZPF(UINT32 r); |
| extern BYTE WORDSZPCF(UINT32 r); | extern UINT8 WORDSZPCF(UINT32 r); |
| #elif !defined(MEMOPTIMIZE) | #elif !defined(MEMOPTIMIZE) |
| extern BYTE _szpcflag8[0x200]; | extern UINT8 _szpflag16[0x10000]; |
| extern BYTE _szpflag16[0x10000]; | #define BYTESZPF(a) (iflags[(a)]) |
| #define BYTESZPF(a) (_szpcflag8[(a)]) | #define BYTESZPCF(a) (iflags[(a)]) |
| #define BYTESZPCF(a) (_szpcflag8[(a)]) | #define BYTESZPCF2(a) (iflags[(a) & 0x1ff]) |
| #define BYTESZPCF2(a) (_szpcflag8[(a) & 0x1ff]) | |
| #define WORDSZPF(a) (_szpflag16[(a)]) | #define WORDSZPF(a) (_szpflag16[(a)]) |
| #define WORDSZPCF(a) (_szpflag16[LOW16(a)] + (((a) >> 16) & 1)) | #define WORDSZPCF(a) (_szpflag16[LOW16(a)] + (((a) >> 16) & 1)) |
| #else | #else |
| extern BYTE _szpcflag8[0x200]; | #define BYTESZPF(a) (iflags[(a)]) |
| #define BYTESZPCF(a) (iflags[(a)]) | |
| #define BYTESZPF(a) (_szpcflag8[(a)]) | #define BYTESZPCF2(a) (iflags[(a) & 0x1ff]) |
| #define BYTESZPCF(a) (_szpcflag8[(a)]) | #define WORDSZPF(a) ((iflags[(a) & 0xff] & P_FLAG) + \ |
| #define BYTESZPCF2(a) (_szpcflag8[(a) & 0x1ff]) | |
| #define WORDSZPF(a) ((_szpcflag8[(a) & 0xff] & P_FLAG) + \ | |
| (((a))?0:Z_FLAG) + (((a) >> 8) & S_FLAG)) | (((a))?0:Z_FLAG) + (((a) >> 8) & S_FLAG)) |
| #define WORDSZPCF(a) ((_szpcflag8[(a) & 0xff] & P_FLAG) + \ | #define WORDSZPCF(a) ((iflags[(a) & 0xff] & P_FLAG) + \ |
| ((LOW16(a))?0:Z_FLAG) + (((a) >> 8) & S_FLAG) + \ | ((LOW16(a))?0:Z_FLAG) + (((a) >> 8) & S_FLAG) + \ |
| (((a) >> 16) & 1)) | (((a) >> 16) & 1)) |
| Line 59 extern BYTE _szpcflag8[0x200]; | Line 56 extern BYTE _szpcflag8[0x200]; |
| // ---- reg position | // ---- reg position |
| #if !defined(MEMOPTIMIZE) || (MEMOPTIMIZE < 2) | #if !defined(MEMOPTIMIZE) || (MEMOPTIMIZE < 2) |
| extern BYTE *_reg8_b53[256]; | extern UINT8 *_reg8_b53[256]; |
| extern BYTE *_reg8_b20[256]; | extern UINT8 *_reg8_b20[256]; |
| #define REG8_B53(op) _reg8_b53[(op)] | #define REG8_B53(op) _reg8_b53[(op)] |
| #define REG8_B20(op) _reg8_b20[(op)] | #define REG8_B20(op) _reg8_b20[(op)] |
| #else | #else |
| #if defined(BYTESEX_LITTLE) | #if defined(BYTESEX_LITTLE) |
| #define REG8_B53(op) \ | #define REG8_B53(op) \ |
| (((BYTE *)&I286_REG) + (((op) >> 2) & 6) + (((op) >> 5) & 1)) | (((UINT8 *)&I286_REG) + (((op) >> 2) & 6) + (((op) >> 5) & 1)) |
| #define REG8_B20(op) \ | #define REG8_B20(op) \ |
| (((BYTE *)&I286_REG) + (((op) & 3) * 2) + (((op) >> 2) & 1)) | (((UINT8 *)&I286_REG) + (((op) & 3) * 2) + (((op) >> 2) & 1)) |
| #else | #else |
| #define REG8_B53(op) (((BYTE *)&I286_REG) + (((op) >> 2) & 6) + \ | #define REG8_B53(op) (((UINT8 *)&I286_REG) + (((op) >> 2) & 6) + \ |
| ((((op) >> 5) & 1) ^ 1)) | ((((op) >> 5) & 1) ^ 1)) |
| #define REG8_B20(op) (((BYTE *)&I286_REG) + (((op) & 3) * 2) + \ | #define REG8_B20(op) (((UINT8 *)&I286_REG) + (((op) & 3) * 2) + \ |
| ((((op) >> 2) & 1) ^ 1)) | ((((op) >> 2) & 1) ^ 1)) |
| #endif | #endif |
| #endif | #endif |
| Line 111 extern UINT calc_a(UINT op, UINT32 *seg) | Line 108 extern UINT calc_a(UINT op, UINT32 *seg) |
| #define SWAPBYTE(p, q) { \ | #define SWAPBYTE(p, q) { \ |
| BYTE tmp = (p); \ | REG8 tmp; \ |
| tmp = (p); \ | |
| (p) = (q); \ | (p) = (q); \ |
| (q) = tmp; \ | (q) = tmp; \ |
| } | } |
| #define SWAPWORD(p, q) { \ | #define SWAPWORD(p, q) { \ |
| UINT16 tmp; \ | REG16 tmp; \ |
| tmp = (p); \ | tmp = (p); \ |
| (p) = (q); \ | (p) = (q); \ |
| (q) = tmp; \ | (q) = tmp; \ |
| Line 214 extern UINT calc_a(UINT op, UINT32 *seg) | Line 212 extern UINT calc_a(UINT op, UINT32 *seg) |
| #define ADDWORD(r, d, s) \ | #define ADDWORD(r, d, s) \ |
| (r) = (s) + (d); \ | (r) = (s) + (d); \ |
| I286_OV = ((r) ^ (s)) & ((r) ^ (d)) & 0x8000; \ | I286_OV = ((r) ^ (s)) & ((r) ^ (d)) & 0x8000; \ |
| I286_FLAGL = (BYTE)(((r) ^ (d) ^ (s)) & A_FLAG); \ | I286_FLAGL = (UINT8)(((r) ^ (d) ^ (s)) & A_FLAG); \ |
| I286_FLAGL |= WORDSZPCF(r); | I286_FLAGL |= WORDSZPCF(r); |
| Line 233 extern UINT calc_a(UINT op, UINT32 *seg) | Line 231 extern UINT calc_a(UINT op, UINT32 *seg) |
| #define ADCBYTE(r, d, s) \ | #define ADCBYTE(r, d, s) \ |
| (r) = (I286_FLAGL & 1) + (s) + (d); \ | (r) = (I286_FLAGL & 1) + (s) + (d); \ |
| I286_OV = ((r) ^ (s)) & ((r) ^ (d)) & 0x80; \ | I286_OV = ((r) ^ (s)) & ((r) ^ (d)) & 0x80; \ |
| I286_FLAGL = (BYTE)(((r) ^ (d) ^ (s)) & A_FLAG); \ | I286_FLAGL = (UINT8)(((r) ^ (d) ^ (s)) & A_FLAG); \ |
| I286_FLAGL |= BYTESZPCF(r); | I286_FLAGL |= BYTESZPCF(r); |
| #define ADCWORD(r, d, s) \ | #define ADCWORD(r, d, s) \ |
| (r) = (I286_FLAGL & 1) + (s) + (d); \ | (r) = (I286_FLAGL & 1) + (s) + (d); \ |
| I286_OV = ((r) ^ (s)) & ((r) ^ (d)) & 0x8000; \ | I286_OV = ((r) ^ (s)) & ((r) ^ (d)) & 0x8000; \ |
| I286_FLAGL = (BYTE)(((r) ^ (d) ^ (s)) & A_FLAG); \ | I286_FLAGL = (UINT8)(((r) ^ (d) ^ (s)) & A_FLAG); \ |
| I286_FLAGL |= WORDSZPCF(r); | I286_FLAGL |= WORDSZPCF(r); |
| Line 247 extern UINT calc_a(UINT op, UINT32 *seg) | Line 245 extern UINT calc_a(UINT op, UINT32 *seg) |
| #define SBBBYTE(r, d, s) \ | #define SBBBYTE(r, d, s) \ |
| (r) = (d) - (s) - (I286_FLAGL & 1); \ | (r) = (d) - (s) - (I286_FLAGL & 1); \ |
| I286_OV = ((d) ^ (r)) & ((d) ^ (s)) & 0x80; \ | I286_OV = ((d) ^ (r)) & ((d) ^ (s)) & 0x80; \ |
| I286_FLAGL = (BYTE)(((r) ^ (d) ^ (s)) & A_FLAG); \ | I286_FLAGL = (UINT8)(((r) ^ (d) ^ (s)) & A_FLAG); \ |
| I286_FLAGL |= BYTESZPCF2(r); | I286_FLAGL |= BYTESZPCF2(r); |
| #define SBBWORD(r, d, s) \ | #define SBBWORD(r, d, s) \ |
| (r) = (d) - (s) - (I286_FLAGL & 1); \ | (r) = (d) - (s) - (I286_FLAGL & 1); \ |
| I286_OV = ((d) ^ (r)) & ((d) ^ (s)) & 0x8000; \ | I286_OV = ((d) ^ (r)) & ((d) ^ (s)) & 0x8000; \ |
| I286_FLAGL = (BYTE)(((r) ^ (d) ^ (s)) & A_FLAG); \ | I286_FLAGL = (UINT8)(((r) ^ (d) ^ (s)) & A_FLAG); \ |
| I286_FLAGL |= WORDSZPCF(r); | I286_FLAGL |= WORDSZPCF(r); |
| Line 273 extern UINT calc_a(UINT op, UINT32 *seg) | Line 271 extern UINT calc_a(UINT op, UINT32 *seg) |
| #define SUBBYTE(r, d, s) \ | #define SUBBYTE(r, d, s) \ |
| (r) = (d) - (s); \ | (r) = (d) - (s); \ |
| I286_OV = ((d) ^ (r)) & ((d) ^ (s)) & 0x80; \ | I286_OV = ((d) ^ (r)) & ((d) ^ (s)) & 0x80; \ |
| I286_FLAGL = (BYTE)(((r) ^ (d) ^ (s)) & A_FLAG); \ | I286_FLAGL = (UINT8)(((r) ^ (d) ^ (s)) & A_FLAG); \ |
| I286_FLAGL |= BYTESZPCF2(r); | I286_FLAGL |= BYTESZPCF2(r); |
| #define SUBWORD(r, d, s) \ | #define SUBWORD(r, d, s) \ |
| Line 298 extern UINT calc_a(UINT op, UINT32 *seg) | Line 296 extern UINT calc_a(UINT op, UINT32 *seg) |
| #define NEGBYTE(d, s) \ | #define NEGBYTE(d, s) \ |
| (d) = 0 - (s); \ | (d) = 0 - (s); \ |
| I286_OV = ((d) & (s)) & 0x80; \ | I286_OV = ((d) & (s)) & 0x80; \ |
| I286_FLAGL = (BYTE)(((d) ^ (s)) & A_FLAG); \ | I286_FLAGL = (UINT8)(((d) ^ (s)) & A_FLAG); \ |
| I286_FLAGL |= BYTESZPCF2(d); | I286_FLAGL |= BYTESZPCF2(d); |
| #define NEGWORD(d, s) \ | #define NEGWORD(d, s) \ |
| (d) = 0 - (s); \ | (d) = 0 - (s); \ |
| I286_OV = ((d) & (s)) & 0x8000; \ | I286_OV = ((d) & (s)) & 0x8000; \ |
| I286_FLAGL = (BYTE)(((d) ^ (s)) & A_FLAG); \ | I286_FLAGL = (UINT8)(((d) ^ (s)) & A_FLAG); \ |
| I286_FLAGL |= WORDSZPCF(d); | I286_FLAGL |= WORDSZPCF(d); |
| #define BYTE_MUL(r, d, s) \ | #define BYTE_MUL(r, d, s) \ |
| I286_FLAGL &= (Z_FLAG | S_FLAG | A_FLAG | P_FLAG); \ | I286_FLAGL &= (Z_FLAG | S_FLAG | A_FLAG | P_FLAG); \ |
| (r) = (BYTE)(d) * (BYTE)(s); \ | (r) = (UINT8)(d) * (UINT8)(s); \ |
| I286_OV = (r) >> 8; \ | I286_OV = (r) >> 8; \ |
| if (I286_OV) { \ | if (I286_OV) { \ |
| I286_FLAGL |= C_FLAG; \ | I286_FLAGL |= C_FLAG; \ |
| Line 348 extern UINT calc_a(UINT op, UINT32 *seg) | Line 346 extern UINT calc_a(UINT op, UINT32 *seg) |
| (s)++; \ | (s)++; \ |
| I286_OV = (s) & (b ^ (s)) & 0x80; \ | I286_OV = (s) & (b ^ (s)) & 0x80; \ |
| I286_FLAGL &= C_FLAG; \ | I286_FLAGL &= C_FLAG; \ |
| I286_FLAGL |= (BYTE)((b ^ (s)) & A_FLAG); \ | I286_FLAGL |= (UINT8)((b ^ (s)) & A_FLAG); \ |
| I286_FLAGL |= BYTESZPF((BYTE)(s)); \ | I286_FLAGL |= BYTESZPF((UINT8)(s)); \ |
| } | } |
| #define INCWORD(s) { \ | #define INCWORD(s) { \ |
| Line 357 extern UINT calc_a(UINT op, UINT32 *seg) | Line 355 extern UINT calc_a(UINT op, UINT32 *seg) |
| (s)++; \ | (s)++; \ |
| I286_OV = (s) & (b ^ (s)) & 0x8000; \ | I286_OV = (s) & (b ^ (s)) & 0x8000; \ |
| I286_FLAGL &= C_FLAG; \ | I286_FLAGL &= C_FLAG; \ |
| I286_FLAGL |= (BYTE)((b ^ (s)) & A_FLAG); \ | I286_FLAGL |= (UINT8)((b ^ (s)) & A_FLAG); \ |
| I286_FLAGL |= WORDSZPF((UINT16)(s)); \ | I286_FLAGL |= WORDSZPF((UINT16)(s)); \ |
| } | } |
| Line 368 extern UINT calc_a(UINT op, UINT32 *seg) | Line 366 extern UINT calc_a(UINT op, UINT32 *seg) |
| b--; \ | b--; \ |
| I286_OV = (s) & (b ^ (s)) & 0x80; \ | I286_OV = (s) & (b ^ (s)) & 0x80; \ |
| I286_FLAGL &= C_FLAG; \ | I286_FLAGL &= C_FLAG; \ |
| I286_FLAGL |= (BYTE)((b ^ (s)) & A_FLAG); \ | I286_FLAGL |= (UINT8)((b ^ (s)) & A_FLAG); \ |
| I286_FLAGL |= BYTESZPF((BYTE)b); \ | I286_FLAGL |= BYTESZPF((UINT8)b); \ |
| (s) = b; \ | (s) = b; \ |
| } | } |
| Line 378 extern UINT calc_a(UINT op, UINT32 *seg) | Line 376 extern UINT calc_a(UINT op, UINT32 *seg) |
| b--; \ | b--; \ |
| I286_OV = (s) & (b ^ (s)) & 0x8000; \ | I286_OV = (s) & (b ^ (s)) & 0x8000; \ |
| I286_FLAGL &= C_FLAG; \ | I286_FLAGL &= C_FLAG; \ |
| I286_FLAGL |= (BYTE)((b ^ (s)) & A_FLAG); \ | I286_FLAGL |= (UINT8)((b ^ (s)) & A_FLAG); \ |
| I286_FLAGL |= WORDSZPF((UINT16)b); \ | I286_FLAGL |= WORDSZPF((UINT16)b); \ |
| (s) = b; \ | (s) = b; \ |
| } | } |
| Line 392 extern UINT calc_a(UINT op, UINT32 *seg) | Line 390 extern UINT calc_a(UINT op, UINT32 *seg) |
| (r) = (UINT16)d; \ | (r) = (UINT16)d; \ |
| I286_OV = d & (d ^ s) & 0x8000; \ | I286_OV = d & (d ^ s) & 0x8000; \ |
| I286_FLAGL &= C_FLAG; \ | I286_FLAGL &= C_FLAG; \ |
| I286_FLAGL |= (BYTE)((d ^ s) & A_FLAG); \ | I286_FLAGL |= (UINT8)((d ^ s) & A_FLAG); \ |
| I286_FLAGL |= WORDSZPF((UINT16)d); \ | I286_FLAGL |= WORDSZPF((UINT16)d); \ |
| I286_WORKCLOCK(clock); \ | I286_WORKCLOCK(clock); \ |
| } | } |
| Line 404 extern UINT calc_a(UINT op, UINT32 *seg) | Line 402 extern UINT calc_a(UINT op, UINT32 *seg) |
| (r) = (UINT16)d; \ | (r) = (UINT16)d; \ |
| I286_OV = s & (d ^ s) & 0x8000; \ | I286_OV = s & (d ^ s) & 0x8000; \ |
| I286_FLAGL &= C_FLAG; \ | I286_FLAGL &= C_FLAG; \ |
| I286_FLAGL |= (BYTE)((d ^ s) & A_FLAG); \ | I286_FLAGL |= (UINT8)((d ^ s) & A_FLAG); \ |
| I286_FLAGL |= WORDSZPF((UINT16)d); \ | I286_FLAGL |= WORDSZPF((UINT16)d); \ |
| I286_WORKCLOCK(clock); \ | I286_WORKCLOCK(clock); \ |
| } | } |
| Line 502 extern UINT calc_a(UINT op, UINT32 *seg) | Line 500 extern UINT calc_a(UINT op, UINT32 *seg) |
| } | } |
| #define INT_NUM(a, b) i286_intnum((a), (REG16)(b)) | #define SEGSELECT(c) ((I286_MSW & MSW_PE)?i286c_selector(c):((c) << 4)) |
| #define INT_NUM(a, b) i286c_intnum((a), (REG16)(b)) | |