Diff for /np2/i286c/i286c.mcr between versions 1.4 and 1.8

version 1.4, 2003/10/17 12:49:52 version 1.8, 2003/11/24 09:14:01
Line 6 Line 6
 #define WORD2LONG(src)  ((short)(src))  #define WORD2LONG(src)  ((short)(src))
   
   
 #define SEGMENTPTR(s)   ((UINT16 *)(&I286_SEGREG) + (s))  #define SEGMENTPTR(s)   (((UINT16 *)&I286_SEGREG) + (s))
   
 #define REAL_FLAGREG    (UINT16)((I286_FLAG & 0x7ff) | (I286_OV?O_FLAG:0))  #define REAL_FLAGREG    (UINT16)((I286_FLAG & 0x7ff) | (I286_OV?O_FLAG:0))
   
 #define STRING_DIR              ((I286_FLAG & D_FLAG)?-1:1)  #define STRING_DIR              ((I286_FLAG & D_FLAG)?-1:1)
 #define STRING_DIRx2    ((I286_FLAG & D_FLAG)?-2:2)  #define STRING_DIRx2    ((I286_FLAG & D_FLAG)?-2:2)
   
 #if defined(CPUW2TEST)  #if !defined(MEMOPTIMIZE)
   extern  BYTE    szpflag_w[0x10000];
   #define WORDSZPF(a)             szpflag_w[(a)]
   #else
 #define WORDSZPF(a)             ((szpcflag[(a) & 0xff] & P_FLAG) | \  #define WORDSZPF(a)             ((szpcflag[(a) & 0xff] & P_FLAG) | \
                                                                         (((a))?0:Z_FLAG) | (((a) >> 8) & S_FLAG))                                                                          (((a))?0:Z_FLAG) | (((a) >> 8) & S_FLAG))
   #endif
   
   #if !defined(MEMOPTIMIZE) || (MEMOPTIMIZE < 2)
   extern  BYTE    *_reg8_b53[256];
   extern  BYTE    *_reg8_b20[256];
   #define REG8_B53(op)            _reg8_b53[(op)]
   #define REG8_B20(op)            _reg8_b20[(op)]
 #else  #else
 #define WORDSZPF(a)             szpflag_w[(a)]  #if defined(BYTESEX_LITTLE)
   #define REG8_B53(op)            \
                                   (((BYTE *)&I286_REG) + (((op) >> 2) & 6) + (((op) >> 5) & 1))
   #define REG8_B20(op)            \
                                   (((BYTE *)&I286_REG) + (((op) & 3) * 2) + (((op) >> 2) & 1))
   #else
   #define REG8_B53(op)            (((BYTE *)&I286_REG) + (((op) >> 2) & 6) +      \
                                                                                                           ((((op) >> 5) & 1) ^ 1))
   #define REG8_B20(op)            (((BYTE *)&I286_REG) + (((op) & 3) * 2) +       \
                                                                                                           ((((op) >> 2) & 1) ^ 1))
   #endif
   #endif
   
   #if !defined(MEMOPTIMIZE) || (MEMOPTIMIZE < 2)
   extern  UINT16  *_reg16_b53[256];
   extern  UINT16  *_reg16_b20[256];
   #define REG16_B53(op)           _reg16_b53[(op)]
   #define REG16_B20(op)           _reg16_b20[(op)]
   #else
   #define REG16_B53(op)           (((UINT16 *)&I286_REG) + (((op) >> 3) & 7))
   #define REG16_B20(op)           (((UINT16 *)&I286_REG) + ((op) & 7))
   #endif
   
   #if !defined(MEMOPTIMIZE) || (MEMOPTIMIZE < 2)
   extern  CALCEA  _calc_ea_dst[];
   extern  CALCLEA _calc_lea[];
   extern  GETLEA  _get_ea[];
   #define CALC_EA(o)              (_calc_ea_dst[(o)]())
   #define CALC_LEA(o)             (_calc_lea[(o)]())
   #define GET_EA(o, s)    (_get_ea[(o)](s))
   #else
   extern UINT32 calc_ea_dst(UINT op);
   extern UINT16 calc_lea(UINT op);
   extern UINT16 calc_a(UINT op, UINT32 *seg);
   #define CALC_EA(o)              (calc_ea_dst(o))
   #define CALC_LEA(o)             (calc_lea(o))
   #define GET_EA(o, s)    (calc_a(o, s))
 #endif  #endif
   
 #define SWAPBYTE(p, q) {                                                                                        \  #define SWAPBYTE(p, q) {                                                                                        \
Line 36 Line 82
   
   
 #define I286IRQCHECKTERM                                                                                        \  #define I286IRQCHECKTERM                                                                                        \
                 if (nevent.remainclock > 0) {                                                           \                  if (I286_REMCLOCK > 0) {                                                                        \
                         nevent.baseclock -= nevent.remainclock;                                 \                          I286_BASECLOCK -= I286_REMCLOCK;                                                \
                         nevent.remainclock = 0;                                                                 \                          I286_REMCLOCK = 0;                                                                              \
                 }                  }
   
   
Line 47 Line 93
                 DS_FIX = DS_BASE;                  DS_FIX = DS_BASE;
   
   
 #define I286_CLOCK(clock)       nevent.remainclock -= (clock);  #define I286_WORKCLOCK(c)       I286_REMCLOCK -= (c)
   
   
 #define GET_PCBYTE(b)                                                                                           \  #define GET_PCBYTE(b)                                                                                           \
Line 72 Line 118
   
 #define PREPART_EA_REG8(b, d_s)                                                                         \  #define PREPART_EA_REG8(b, d_s)                                                                         \
                 GET_PCBYTE((b))                                                                                         \                  GET_PCBYTE((b))                                                                                         \
                 (d_s) = *(reg8_b53[(b)]);                  (d_s) = *(REG8_B53(b));
   
   
 #define PREPART_EA_REG8P(b, d_s)                                                                        \  #define PREPART_EA_REG8P(b, d_s)                                                                        \
                 GET_PCBYTE((b))                                                                                         \                  GET_PCBYTE((b))                                                                                         \
                 (d_s) = reg8_b53[(b)];                  (d_s) = REG8_B53(b);
   
   
 #define PREPART_EA_REG16(b, d_s)                                                                        \  #define PREPART_EA_REG16(b, d_s)                                                                        \
                 GET_PCBYTE((b))                                                                                         \                  GET_PCBYTE((b))                                                                                         \
                 (d_s) = *(reg16_b53[(b)]);                  (d_s) = *(REG16_B53(b));
   
   
 #define PREPART_EA_REG16P(b, d_s)                                                                       \  #define PREPART_EA_REG16P(b, d_s)                                                                       \
                 GET_PCBYTE((b))                                                                                         \                  GET_PCBYTE((b))                                                                                         \
                 (d_s) = reg16_b53[(b)];                  (d_s) = REG16_B53(b);
   
   
 #define PREPART_REG8_EA(b, s, d, regclk, memclk)                                        \  #define PREPART_REG8_EA(b, s, d, regclk, memclk)                                        \
                 GET_PCBYTE((b))                                                                                         \                  GET_PCBYTE((b))                                                                                         \
                 if ((b) >= 0xc0) {                                                                                      \                  if ((b) >= 0xc0) {                                                                                      \
                         I286_CLOCK(regclk)                                                                              \                          I286_WORKCLOCK(regclk);                                                                 \
                         (s) = *(reg8_b20[b]);                                                                   \                          (s) = *(REG8_B20(b));                                                                   \
                 }                                                                                                                       \                  }                                                                                                                       \
                 else {                                                                                                          \                  else {                                                                                                          \
                         I286_CLOCK(memclk)                                                                              \                          I286_WORKCLOCK(memclk);                                                                 \
                         (s) = i286_memoryread(c_calc_ea_dst[(b)]());                    \                          (s) = i286_memoryread(CALC_EA(b));                                              \
                 }                                                                                                                       \                  }                                                                                                                       \
                 (d) = reg8_b53[(b)];                  (d) = REG8_B53(b);
   
   
 #define PREPART_REG16_EA(b, s, d, regclk, memclk)                                       \  #define PREPART_REG16_EA(b, s, d, regclk, memclk)                                       \
                 GET_PCBYTE(b)                                                                                           \                  GET_PCBYTE(b)                                                                                           \
                 if (b >= 0xc0) {                                                                                        \                  if (b >= 0xc0) {                                                                                        \
                         I286_CLOCK(regclk)                                                                              \                          I286_WORKCLOCK(regclk);                                                                 \
                         s = *(reg16_b20[b]);                                                                    \                          s = *(REG16_B20(b));                                                                    \
                 }                                                                                                                       \                  }                                                                                                                       \
                 else {                                                                                                          \                  else {                                                                                                          \
                         I286_CLOCK(memclk)                                                                              \                          I286_WORKCLOCK(memclk);                                                                 \
                         s = i286_memoryread_w(c_calc_ea_dst[b]());                              \                          s = i286_memoryread_w(CALC_EA(b));                                              \
                 }                                                                                                                       \                  }                                                                                                                       \
                 d = reg16_b53[b];                  d = REG16_B53(b);
   
   
 #define ADDBYTE(r, d, s)                                                                                        \  #define ADDBYTE(r, d, s)                                                                                        \
Line 338 Line 384
                 I286_FLAGL &= C_FLAG;                                                                           \                  I286_FLAGL &= C_FLAG;                                                                           \
                 I286_FLAGL |= (BYTE)(((w) ^ bak) & A_FLAG);                                     \                  I286_FLAGL |= (BYTE)(((w) ^ bak) & A_FLAG);                                     \
                 I286_FLAGL |= WORDSZPF(w);                                                                      \                  I286_FLAGL |= WORDSZPF(w);                                                                      \
                 I286_CLOCK(clock);                                                                                      \                  I286_WORKCLOCK(clock);                                                                          \
         }          }
   
   
Line 350 Line 396
                 I286_FLAGL &= C_FLAG;                                                                           \                  I286_FLAGL &= C_FLAG;                                                                           \
                 I286_FLAGL |= (BYTE)((w ^ bak) & A_FLAG);                                       \                  I286_FLAGL |= (BYTE)((w ^ bak) & A_FLAG);                                       \
                 I286_FLAGL |= WORDSZPF(w);                                                                      \                  I286_FLAGL |= WORDSZPF(w);                                                                      \
                 I286_CLOCK(clock);                                                                                      \                  I286_WORKCLOCK(clock);                                                                          \
         }          }
   
   
 #define REGPUSH(reg, clock)     {                                                                               \  #define REGPUSH(reg, clock)     {                                                                               \
                 I286_CLOCK(clock);                                                                                      \                  I286_WORKCLOCK(clock);                                                                          \
                 I286_SP -= 2;                                                                                           \                  I286_SP -= 2;                                                                                           \
                 i286_memorywrite_w(I286_SP + SS_BASE, reg);                                     \                  i286_memorywrite_w(I286_SP + SS_BASE, reg);                                     \
         }          }
Line 370 Line 416
                 UINT16 sp = reg;                                                                                        \                  UINT16 sp = reg;                                                                                        \
                 I286_SP -= 2;                                                                                           \                  I286_SP -= 2;                                                                                           \
                 i286_memorywrite_w(I286_SP + SS_BASE, sp);                                      \                  i286_memorywrite_w(I286_SP + SS_BASE, sp);                                      \
                 I286_CLOCK(clock);                                                                                      \                  I286_WORKCLOCK(clock);                                                                          \
         }          }
   
   
 #define REGPOP(reg, clock) {                                                                            \  #define REGPOP(reg, clock) {                                                                            \
                 I286_CLOCK(clock);                                                                                      \                  I286_WORKCLOCK(clock);                                                                          \
                 reg = i286_memoryread_w(I286_SP + SS_BASE);                                     \                  reg = i286_memoryread_w(I286_SP + SS_BASE);                                     \
                 I286_SP += 2;                                                                                           \                  I286_SP += 2;                                                                                           \
         }          }
   
   #define SP_POP(reg, clock) {                                                                            \
                   I286_WORKCLOCK(clock);                                                                          \
                   reg = i286_memoryread_w(I286_SP + SS_BASE);                                     \
           }
   
   
 #define REGPOP0(reg)                                                                                            \  #define REGPOP0(reg)                                                                                            \
                 reg = i286_memoryread_w(I286_SP + SS_BASE);                                     \                  reg = i286_memoryread_w(I286_SP + SS_BASE);                                     \
Line 388 Line 439
   
   
 #define JMPSHORT(clock) {                                                                                       \  #define JMPSHORT(clock) {                                                                                       \
                 I286_CLOCK(clock);                                                                                      \                  I286_WORKCLOCK(clock);                                                                          \
                 I286_IP += __CBW(i286_memoryread(CS_BASE + I286_IP));           \                  I286_IP += __CBW(i286_memoryread(CS_BASE + I286_IP));           \
                 I286_IP++;                                                                                                      \                  I286_IP++;                                                                                                      \
         }          }
   
   
 #define JMPNOP(clock) {                                                                                         \  #define JMPNOP(clock) {                                                                                         \
                 I286_CLOCK(clock);                                                                                      \                  I286_WORKCLOCK(clock);                                                                          \
                 I286_IP++;                                                                                                      \                  I286_IP++;                                                                                                      \
         }          }
   
   
 #define MOVIMM8(reg) {                                                                                          \  #define MOVIMM8(reg) {                                                                                          \
                 I286_CLOCK(2)                                                                                           \                  I286_WORKCLOCK(2);                                                                                      \
                 GET_PCBYTE(reg)                                                                                         \                  GET_PCBYTE(reg)                                                                                         \
         }          }
   
   
 #define MOVIMM16(reg) {                                                                                         \  #define MOVIMM16(reg) {                                                                                         \
                 I286_CLOCK(2)                                                                                           \                  I286_WORKCLOCK(2);                                                                                      \
                 GET_PCWORD(reg)                                                                                         \                  GET_PCWORD(reg)                                                                                         \
         }          }
   

Removed from v.1.4  
changed lines
  Added in v.1.8


RetroPC.NET-CVS <cvs@retropc.net>