Diff for /np2/i286c/i286c.c between versions 1.3 and 1.8

version 1.3, 2003/10/17 11:10:02 version 1.8, 2003/11/24 09:14:01
Line 1 Line 1
 #include        "compiler.h"  #include        "compiler.h"
 #include        "i286.h"  #include        "i286.h"
 #include        "i286c.h"  #include        "i286c.h"
   #include        "v30patch.h"
 #include        "memory.h"  #include        "memory.h"
 #include        "pccore.h"  #include        "pccore.h"
 #include        "iocore.h"  #include        "iocore.h"
Line 47  const BYTE iflags[256] = {     // Z_FLAG Line 48  const BYTE iflags[256] = {     // Z_FLAG
   
 // ----  // ----
   
         UINT32  EA_FIX;  
         BYTE    *reg8_b53[256];  
         BYTE    *reg8_b20[256];  
         UINT16  *reg16_b53[256];  
         UINT16  *reg16_b20[256];  
         BYTE    szpcflag[0x200];          BYTE    szpcflag[0x200];
         BYTE    szpflag_w[0x10000];  
         CALCEA  c_calc_ea_dst[256];  
         CALCLEA c_calc_lea[192];  
         GETLEA  c_get_ea[192];  
   
   
 static UINT32 ea_nop(void) {  #if !defined(MEMOPTIMIZE)
           BYTE    szpflag_w[0x10000];
   #endif
   
         return(0);  #if !defined(MEMOPTIMIZE) || (MEMOPTIMIZE < 2)
 }          BYTE    *_reg8_b53[256];
           BYTE    *_reg8_b20[256];
   #endif
   #if !defined(MEMOPTIMIZE) || (MEMOPTIMIZE < 2)
           UINT16  *_reg16_b53[256];
           UINT16  *_reg16_b20[256];
   #endif
   
 void i286_initialize(void) {  void i286_initialize(void) {
   
         UINT    i;          UINT    i;
         UINT    bit;          UINT    bit;
         BYTE    f;          BYTE    f;
         int             pos;  
   
         for (i=0; i<0x100; i++) {          for (i=0; i<0x100; i++) {
                 f = P_FLAG;                  f = P_FLAG;
Line 88  void i286_initialize(void) { Line 86  void i286_initialize(void) {
                 szpcflag[i+0x100] = f | C_FLAG;                  szpcflag[i+0x100] = f | C_FLAG;
         }          }
   
   #if !defined(MEMOPTIMIZE) || (MEMOPTIMIZE < 2)
         for (i=0; i<0x100; i++) {          for (i=0; i<0x100; i++) {
                   int pos;
 #if defined(BYTESEX_LITTLE)  #if defined(BYTESEX_LITTLE)
                 pos = ((i & 0x20)?1:0);                  pos = ((i & 0x20)?1:0);
 #else  #else
                 pos = ((i & 0x20)?0:1);                  pos = ((i & 0x20)?0:1);
 #endif  #endif
                 pos += ((i >> 3) & 3) * 2;                  pos += ((i >> 3) & 3) * 2;
                 reg8_b53[i] = ((BYTE *)&I286_REG) + pos;                  _reg8_b53[i] = ((BYTE *)&I286_REG) + pos;
 #if defined(BYTESEX_LITTLE)  #if defined(BYTESEX_LITTLE)
                 pos = ((i & 0x4)?1:0);                  pos = ((i & 0x4)?1:0);
 #else  #else
                 pos = ((i & 0x4)?0:1);                  pos = ((i & 0x4)?0:1);
 #endif  #endif
                 pos += (i & 3) * 2;                  pos += (i & 3) * 2;
                 reg8_b20[i] = ((BYTE *)&I286_REG) + pos;                  _reg8_b20[i] = ((BYTE *)&I286_REG) + pos;
                 reg16_b53[i] = ((UINT16 *)&I286_REG) + ((i >> 3) & 7);  #if !defined(MEMOPTIMIZE) || (MEMOPTIMIZE < 2)
                 reg16_b20[i] = ((UINT16 *)&I286_REG) + (i & 7);                  _reg16_b53[i] = ((UINT16 *)&I286_REG) + ((i >> 3) & 7);
                   _reg16_b20[i] = ((UINT16 *)&I286_REG) + (i & 7);
   #endif
         }          }
   #endif
   
         for (i=0; i<0xc0; i++) {  #if !defined(MEMOPTIMIZE)
                 pos = ((i >> 3) & 0x18) + (i & 0x07);  
                 c_calc_ea_dst[i] = i286c_ea_dst_tbl[pos];  
                 c_calc_lea[i] = i286c_lea_tbl[pos];  
                 c_get_ea[i] = i286c_ea_tbl[pos];  
         }  
         for (; i<0x100; i++) {  
                 c_calc_ea_dst[i] = ea_nop;  
         }  
         for (i=0; i<0x10000; i++) {          for (i=0; i<0x10000; i++) {
                 f = P_FLAG;                  f = P_FLAG;
                 for (bit=0x80; bit; bit>>=1) {                  for (bit=0x80; bit; bit>>=1) {
Line 131  void i286_initialize(void) { Line 126  void i286_initialize(void) {
                 }                  }
                 szpflag_w[i] = f;                  szpflag_w[i] = f;
         }          }
   #endif
   #if !defined(MEMOPTIMIZE) || (MEMOPTIMIZE < 2)
           i286cea_initialize();
   #endif
           v30init();
 }  }
   
 void i286_reset(void) {  void i286_reset(void) {
Line 159  const BYTE *ptr; Line 159  const BYTE *ptr;
         I286_IP = LOADINTELWORD(ptr+0);                         // real mode!          I286_IP = LOADINTELWORD(ptr+0);                         // real mode!
         I286_CS = LOADINTELWORD(ptr+2);                         // real mode!          I286_CS = LOADINTELWORD(ptr+2);                         // real mode!
         CS_BASE = I286_CS << 4;          CS_BASE = I286_CS << 4;
         I286_CLOCK(20)          I286_WORKCLOCK(20);
 }  }
   
 void CPUCALL i286_interrupt(BYTE vect) {  void CPUCALL i286_interrupt(BYTE vect) {
Line 171  const BYTE *ptr; Line 171  const BYTE *ptr;
         if (op == 0xf4) {                                                       // hlt          if (op == 0xf4) {                                                       // hlt
                 I286_IP++;                  I286_IP++;
         }          }
         REGPUSH0(REAL_FLAGREG)          REGPUSH0(REAL_FLAGREG)                                          // ここV30で辻褄が合わない
         REGPUSH0(I286_CS)          REGPUSH0(I286_CS)
         REGPUSH0(I286_IP)          REGPUSH0(I286_IP)
   
Line 182  const BYTE *ptr; Line 182  const BYTE *ptr;
         I286_IP = LOADINTELWORD(ptr+0);                         // real mode!          I286_IP = LOADINTELWORD(ptr+0);                         // real mode!
         I286_CS = LOADINTELWORD(ptr+2);                         // real mode!          I286_CS = LOADINTELWORD(ptr+2);                         // real mode!
         CS_BASE = I286_CS << 4;          CS_BASE = I286_CS << 4;
         I286_CLOCK(20)          I286_WORKCLOCK(20);
 }  }
   
 void i286(void) {  void i286(void) {
Line 197  void i286(void) { Line 197  void i286(void) {
                                 i286_interrupt(1);                                  i286_interrupt(1);
                         }                          }
                         dmap_i286();                          dmap_i286();
                 } while(nevent.remainclock > 0);                  } while(I286_REMCLOCK > 0);
         }          }
         else if (dmac.working) {          else if (dmac.working) {
                 do {                  do {
                         GET_PCBYTE(opcode);                          GET_PCBYTE(opcode);
                         i286op[opcode]();                          i286op[opcode]();
                         dmap_i286();                          dmap_i286();
                 } while(nevent.remainclock > 0);                  } while(I286_REMCLOCK > 0);
         }          }
         else {          else {
                 do {                  do {
                         GET_PCBYTE(opcode);                          GET_PCBYTE(opcode);
                         i286op[opcode]();                          i286op[opcode]();
                 } while(nevent.remainclock > 0);                  } while(I286_REMCLOCK > 0);
         }          }
 }  }
   

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


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