|
|
| version 1.10, 2003/11/29 03:38:26 | version 1.16, 2003/12/03 07:59:57 |
|---|---|
| Line 1 | Line 1 |
| #if defined(X11) && (defined(i386) || defined(__i386__)) | |
| #define INHIBIT_WORDP(m) ((m) >= (I286_MEMWRITEMAX - 1)) | |
| #elif (defined(ARM) || defined(X11)) && defined(BYTESEX_LITTLE) | |
| #define INHIBIT_WORDP(m) (((m) & 1) || ((m) >= I286_MEMWRITEMAX)) | |
| #else | |
| #define INHIBIT_WORDP(m) (1) | #define INHIBIT_WORDP(m) (1) |
| #endif | |
| #define __CBW(src) (UINT16)((char)(src)) | #define __CBW(src) (UINT16)((SINT8)(src)) |
| #define __CBD(src) ((char)(src)) | #define __CBD(src) ((SINT8)(src)) |
| #define WORD2LONG(src) ((short)(src)) | #define WORD2LONG(src) ((SINT16)(src)) |
| #define SEGMENTPTR(s) (((UINT16 *)&I286_SEGREG) + (s)) | #define SEGMENTPTR(s) (((UINT16 *)&I286_SEGREG) + (s)) |
| Line 321 extern UINT calc_a(UINT op, UINT32 *seg) | Line 327 extern UINT calc_a(UINT op, UINT32 *seg) |
| #define BYTE_IMUL(r, d, s) \ | #define BYTE_IMUL(r, d, s) \ |
| I286_FLAGL &= (Z_FLAG | S_FLAG | A_FLAG | P_FLAG); \ | I286_FLAGL &= (Z_FLAG | S_FLAG | A_FLAG | P_FLAG); \ |
| (r) = (char)(d) * (char)(s); \ | (r) = (SINT8)(d) * (SINT8)(s); \ |
| I286_OV = ((r) + 0x80) & 0xffffff00; \ | I286_OV = ((r) + 0x80) & 0xffffff00; \ |
| if (I286_OV) { \ | if (I286_OV) { \ |
| I286_FLAGL |= C_FLAG; \ | I286_FLAGL |= C_FLAG; \ |
| Line 329 extern UINT calc_a(UINT op, UINT32 *seg) | Line 335 extern UINT calc_a(UINT op, UINT32 *seg) |
| #define WORD_IMUL(r, d, s) \ | #define WORD_IMUL(r, d, s) \ |
| I286_FLAGL &= (Z_FLAG | S_FLAG | A_FLAG | P_FLAG); \ | I286_FLAGL &= (Z_FLAG | S_FLAG | A_FLAG | P_FLAG); \ |
| (r) = (short)(d) * (short)(s); \ | (r) = (SINT16)(d) * (SINT16)(s); \ |
| I286_OV = ((r) + 0x8000) & 0xffff0000; \ | I286_OV = ((r) + 0x8000) & 0xffff0000; \ |
| if (I286_OV) { \ | if (I286_OV) { \ |
| I286_FLAGL |= C_FLAG; \ | I286_FLAGL |= C_FLAG; \ |
| Line 404 extern UINT calc_a(UINT op, UINT32 *seg) | Line 410 extern UINT calc_a(UINT op, UINT32 *seg) |
| } | } |
| #define REGPUSH(reg, clock) { \ | // ---- stack |
| I286_WORKCLOCK(clock); \ | |
| I286_SP -= 2; \ | |
| i286_memorywrite_w(I286_SP + SS_BASE, reg); \ | |
| } | |
| #define REGPUSH0(reg) \ | #define REGPUSH0(reg) \ |
| I286_SP -= 2; \ | I286_SP -= 2; \ |
| i286_memorywrite_w(I286_SP + SS_BASE, reg); | i286_memorywrite_w(I286_SP + SS_BASE, reg); |
| #define REGPOP0(reg) \ | |
| reg = i286_memoryread_w(I286_SP + SS_BASE); \ | |
| I286_SP += 2; | |
| #define SP_PUSH(reg, clock) { \ | #if (defined(ARM) || defined(X11)) && defined(BYTESEX_LITTLE) |
| UINT16 sp = reg; \ | |
| #define REGPUSH(reg, clock) { \ | |
| UINT32 addr; \ | |
| I286_WORKCLOCK(clock); \ | |
| I286_SP -= 2; \ | I286_SP -= 2; \ |
| i286_memorywrite_w(I286_SP + SS_BASE, sp); \ | addr = I286_SP + SS_BASE; \ |
| if (INHIBIT_WORDP(addr)) { \ | |
| i286_memorywrite_w(addr, reg); \ | |
| } \ | |
| else { \ | |
| *(UINT16 *)(mem + addr) = (reg); \ | |
| } \ | |
| } | |
| #define REGPOP(reg, clock) { \ | |
| UINT32 addr; \ | |
| I286_WORKCLOCK(clock); \ | I286_WORKCLOCK(clock); \ |
| addr = I286_SP + SS_BASE; \ | |
| if (INHIBIT_WORDP(addr)) { \ | |
| (reg) = i286_memoryread_w(addr); \ | |
| } \ | |
| else { \ | |
| (reg) = *(UINT16 *)(mem + addr); \ | |
| } \ | |
| I286_SP += 2; \ | |
| } | } |
| #else | |
| #define REGPUSH(reg, clock) { \ | |
| I286_WORKCLOCK(clock); \ | |
| I286_SP -= 2; \ | |
| i286_memorywrite_w(I286_SP + SS_BASE, reg); \ | |
| } | |
| #define REGPOP(reg, clock) { \ | #define REGPOP(reg, clock) { \ |
| I286_WORKCLOCK(clock); \ | I286_WORKCLOCK(clock); \ |
| Line 430 extern UINT calc_a(UINT op, UINT32 *seg) | Line 462 extern UINT calc_a(UINT op, UINT32 *seg) |
| I286_SP += 2; \ | I286_SP += 2; \ |
| } | } |
| #define SP_POP(reg, clock) { \ | #endif |
| #define SP_PUSH(reg, clock) { \ | |
| REG16 sp = (reg); \ | |
| I286_SP -= 2; \ | |
| i286_memorywrite_w(I286_SP + SS_BASE, sp); \ | |
| I286_WORKCLOCK(clock); \ | I286_WORKCLOCK(clock); \ |
| reg = i286_memoryread_w(I286_SP + SS_BASE); \ | |
| } | } |
| #define SP_POP(reg, clock) { \ | |
| #define REGPOP0(reg) \ | I286_WORKCLOCK(clock); \ |
| reg = i286_memoryread_w(I286_SP + SS_BASE); \ | reg = i286_memoryread_w(I286_SP + SS_BASE); \ |
| I286_SP += 2; | } |
| #define JMPSHORT(clock) { \ | #define JMPSHORT(clock) { \ |
| Line 467 extern UINT calc_a(UINT op, UINT32 *seg) | Line 502 extern UINT calc_a(UINT op, UINT32 *seg) |
| } | } |
| #define INT_NUM(a, b) i286_intnum(a, b) | #define INT_NUM(a, b) i286_intnum((a), (REG16)(b)) |