Diff for /np2/i286c/i286c.c between versions 1.14 and 1.21

version 1.14, 2003/12/12 01:04:40 version 1.21, 2004/01/05 15:47:18
Line 10 Line 10
   
         I286CORE        i286core;          I286CORE        i286core;
   
 const UINT8 iflags[256] = {                                     // Z_FLAG, S_FLAG, P_FLAG  const UINT8 iflags[512] = {                                     // Z_FLAG, S_FLAG, P_FLAG
                         0x44, 0x00, 0x00, 0x04, 0x00, 0x04, 0x04, 0x00,                          0x44, 0x00, 0x00, 0x04, 0x00, 0x04, 0x04, 0x00,
                         0x00, 0x04, 0x04, 0x00, 0x04, 0x00, 0x00, 0x04,                          0x00, 0x04, 0x04, 0x00, 0x04, 0x00, 0x00, 0x04,
                         0x00, 0x04, 0x04, 0x00, 0x04, 0x00, 0x00, 0x04,                          0x00, 0x04, 0x04, 0x00, 0x04, 0x00, 0x00, 0x04,
Line 42  const UINT8 iflags[256] = {     // Z_FLA Line 42  const UINT8 iflags[256] = {     // Z_FLA
                         0x80, 0x84, 0x84, 0x80, 0x84, 0x80, 0x80, 0x84,                          0x80, 0x84, 0x84, 0x80, 0x84, 0x80, 0x80, 0x84,
                         0x84, 0x80, 0x80, 0x84, 0x80, 0x84, 0x84, 0x80,                          0x84, 0x80, 0x80, 0x84, 0x80, 0x84, 0x84, 0x80,
                         0x84, 0x80, 0x80, 0x84, 0x80, 0x84, 0x84, 0x80,                          0x84, 0x80, 0x80, 0x84, 0x80, 0x84, 0x84, 0x80,
                         0x80, 0x84, 0x84, 0x80, 0x84, 0x80, 0x80, 0x84};                          0x80, 0x84, 0x84, 0x80, 0x84, 0x80, 0x80, 0x84,
                           0x45, 0x01, 0x01, 0x05, 0x01, 0x05, 0x05, 0x01,
                           0x01, 0x05, 0x05, 0x01, 0x05, 0x01, 0x01, 0x05,
                           0x01, 0x05, 0x05, 0x01, 0x05, 0x01, 0x01, 0x05,
                           0x05, 0x01, 0x01, 0x05, 0x01, 0x05, 0x05, 0x01,
                           0x01, 0x05, 0x05, 0x01, 0x05, 0x01, 0x01, 0x05,
                           0x05, 0x01, 0x01, 0x05, 0x01, 0x05, 0x05, 0x01,
                           0x05, 0x01, 0x01, 0x05, 0x01, 0x05, 0x05, 0x01,
                           0x01, 0x05, 0x05, 0x01, 0x05, 0x01, 0x01, 0x05,
                           0x01, 0x05, 0x05, 0x01, 0x05, 0x01, 0x01, 0x05,
                           0x05, 0x01, 0x01, 0x05, 0x01, 0x05, 0x05, 0x01,
                           0x05, 0x01, 0x01, 0x05, 0x01, 0x05, 0x05, 0x01,
                           0x01, 0x05, 0x05, 0x01, 0x05, 0x01, 0x01, 0x05,
                           0x05, 0x01, 0x01, 0x05, 0x01, 0x05, 0x05, 0x01,
                           0x01, 0x05, 0x05, 0x01, 0x05, 0x01, 0x01, 0x05,
                           0x01, 0x05, 0x05, 0x01, 0x05, 0x01, 0x01, 0x05,
                           0x05, 0x01, 0x01, 0x05, 0x01, 0x05, 0x05, 0x01,
                           0x81, 0x85, 0x85, 0x81, 0x85, 0x81, 0x81, 0x85,
                           0x85, 0x81, 0x81, 0x85, 0x81, 0x85, 0x85, 0x81,
                           0x85, 0x81, 0x81, 0x85, 0x81, 0x85, 0x85, 0x81,
                           0x81, 0x85, 0x85, 0x81, 0x85, 0x81, 0x81, 0x85,
                           0x85, 0x81, 0x81, 0x85, 0x81, 0x85, 0x85, 0x81,
                           0x81, 0x85, 0x85, 0x81, 0x85, 0x81, 0x81, 0x85,
                           0x81, 0x85, 0x85, 0x81, 0x85, 0x81, 0x81, 0x85,
                           0x85, 0x81, 0x81, 0x85, 0x81, 0x85, 0x85, 0x81,
                           0x85, 0x81, 0x81, 0x85, 0x81, 0x85, 0x85, 0x81,
                           0x81, 0x85, 0x85, 0x81, 0x85, 0x81, 0x81, 0x85,
                           0x81, 0x85, 0x85, 0x81, 0x85, 0x81, 0x81, 0x85,
                           0x85, 0x81, 0x81, 0x85, 0x81, 0x85, 0x85, 0x81,
                           0x81, 0x85, 0x85, 0x81, 0x85, 0x81, 0x81, 0x85,
                           0x85, 0x81, 0x81, 0x85, 0x81, 0x85, 0x85, 0x81,
                           0x85, 0x81, 0x81, 0x85, 0x81, 0x85, 0x85, 0x81,
                           0x81, 0x85, 0x85, 0x81, 0x85, 0x81, 0x81, 0x85};
   
   
 // ----  // ----
   
         UINT8   _szpcflag8[0x200];  
   
 #if !defined(MEMOPTIMIZE)  #if !defined(MEMOPTIMIZE)
         UINT8   _szpflag16[0x10000];          UINT8   _szpflag16[0x10000];
 #endif  #endif
Line 64  const UINT8 iflags[256] = {     // Z_FLA Line 94  const UINT8 iflags[256] = {     // Z_FLA
   
 void i286c_initialize(void) {  void i286c_initialize(void) {
   
   #if !defined(MEMOPTIMIZE) || (MEMOPTIMIZE < 2)
         UINT    i;          UINT    i;
         UINT    bit;  #endif
         REG8    f;  
   
         for (i=0; i<0x100; i++) {  
                 f = P_FLAG;  
                 for (bit=0x80; bit; bit>>=1) {  
                         if (i & bit) {  
                                 f ^= P_FLAG;  
                         }  
                 }  
                 if (!(i & 0xff)) {  
                         f |= Z_FLAG;  
                 }  
                 if (i & 0x80) {  
                         f |= S_FLAG;  
                 }  
                 _szpcflag8[i+0x000] = f;  
                 _szpcflag8[i+0x100] = f | C_FLAG;  
         }  
   
 #if !defined(MEMOPTIMIZE) || (MEMOPTIMIZE < 2)  #if !defined(MEMOPTIMIZE) || (MEMOPTIMIZE < 2)
         for (i=0; i<0x100; i++) {          for (i=0; i<0x100; i++) {
Line 111  void i286c_initialize(void) { Line 124  void i286c_initialize(void) {
   
 #if !defined(MEMOPTIMIZE)  #if !defined(MEMOPTIMIZE)
         for (i=0; i<0x10000; i++) {          for (i=0; i<0x10000; i++) {
                   REG8 f;
                   UINT bit;
                 f = P_FLAG;                  f = P_FLAG;
                 for (bit=0x80; bit; bit>>=1) {                  for (bit=0x80; bit; bit>>=1) {
                         if (i & bit) {                          if (i & bit) {
Line 132  void i286c_initialize(void) { Line 147  void i286c_initialize(void) {
         v30cinit();          v30cinit();
 }  }
   
 void i286c_reset(void) {  static void i286c_initreg(void) {
   
         ZeroMemory(&I286_STAT, sizeof(I286_STAT));          I286_CS = 0xf000;
         I286_CS = 0x1fc0;          CS_BASE = 0xf0000;
         CS_BASE = 0x1fc00;          I286_IP = 0xfff0;
         I286_ADRSMASK = 0xfffff;          I286_ADRSMASK = 0xfffff;
 }  }
   
   void i286c_reset(void) {
   
           ZeroMemory(&i286core.s, sizeof(i286core.s));
           i286c_initreg();
   }
   
   void i286c_shut(void) {
   
           ZeroMemory(&i286core.s, offsetof(I286STAT, cpu_type));
           i286c_initreg();
   }
   
 void CPUCALL i286c_intnum(UINT vect, REG16 IP) {  void CPUCALL i286c_intnum(UINT vect, REG16 IP) {
   
 const BYTE      *ptr;  const BYTE      *ptr;
Line 228  void i286c_step(void) { Line 255  void i286c_step(void) {
 }  }
   
   
   UINT32 i286c_selector(UINT sel) {
   
           I286DTR *dtr;
           UINT32  addr;
           UINT32  ret;
   
           dtr = (sel & 4)?&I286_LDTRC:&I286_GDTR;
           addr = (dtr->base24 << 16) + dtr->base + (sel & (~7));
           ret = i286_memoryread_w(addr+2);
           ret += i286_memoryread(addr+4) << 16;
           TRACEOUT(("selector idx=%x %s rpl=%d - real addr = %.6x",
                                           (sel >> 3), (sel & 4)?"LDT":"GDT", sel & 3, ret));
           return(ret);
   }
   
   
 // ---- test  // ---- test
   
 #if defined(I286C_TEST)  #if defined(I286C_TEST)
Line 236  BYTE BYTESZPF(UINT r) { Line 279  BYTE BYTESZPF(UINT r) {
         if (r & (~0xff)) {          if (r & (~0xff)) {
                 TRACEOUT(("BYTESZPF bound error: %x", r));                  TRACEOUT(("BYTESZPF bound error: %x", r));
         }          }
         return(_szpcflag8[r & 0xff]);          return(iflags[r & 0xff]);
 }  }
   
 BYTE BYTESZPCF(UINT r) {  BYTE BYTESZPCF(UINT r) {
Line 244  BYTE BYTESZPCF(UINT r) { Line 287  BYTE BYTESZPCF(UINT r) {
         if (r & (~0x1ff)) {          if (r & (~0x1ff)) {
                 TRACEOUT(("BYTESZPCF bound error: %x", r));                  TRACEOUT(("BYTESZPCF bound error: %x", r));
         }          }
         return(_szpcflag8[r & 0x1ff]);          return(iflags[r & 0x1ff]);
 }  }
   
 BYTE WORDSZPF(UINT32 r) {  BYTE WORDSZPF(UINT32 r) {
Line 256  BYTE WORDSZPF(UINT32 r) { Line 299  BYTE WORDSZPF(UINT32 r) {
                 TRACEOUT(("WORDSZPF bound error: %x", r));                  TRACEOUT(("WORDSZPF bound error: %x", r));
         }          }
         f1 = _szpflag16[r & 0xffff];          f1 = _szpflag16[r & 0xffff];
         f2 = _szpcflag8[r & 0xff] & P_FLAG;          f2 = iflags[r & 0xff] & P_FLAG;
         f2 += (r)?0:Z_FLAG;          f2 += (r)?0:Z_FLAG;
         f2 += (r >> 8) & S_FLAG;          f2 += (r >> 8) & S_FLAG;
         if (f1 != f2) {          if (f1 != f2) {
Line 276  BYTE WORDSZPCF(UINT32 r) { Line 319  BYTE WORDSZPCF(UINT32 r) {
         f1 = (r >> 16) & 1;          f1 = (r >> 16) & 1;
         f1 += _szpflag16[LOW16(r)];          f1 += _szpflag16[LOW16(r)];
   
         f2 = _szpcflag8[r & 0xff] & P_FLAG;          f2 = iflags[r & 0xff] & P_FLAG;
         f2 += (LOW16(r))?0:Z_FLAG;          f2 += (LOW16(r))?0:Z_FLAG;
         f2 += (r >> 8) & S_FLAG;          f2 += (r >> 8) & S_FLAG;
         f2 += (r >> 16) & 1;          f2 += (r >> 16) & 1;

Removed from v.1.14  
changed lines
  Added in v.1.21


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