Diff for /np2/i286c/i286c_mn.c between versions 1.23 and 1.39

version 1.23, 2003/12/11 21:57:38 version 1.39, 2005/03/05 06:02:29
Line 1 Line 1
 #include        "compiler.h"  #include        "compiler.h"
 #include        "cpucore.h"  #include        "cpucore.h"
 #include        "i286c.h"  #include        "i286c.h"
 #include        "memory.h"  
 #include        "pccore.h"  #include        "pccore.h"
 #include        "iocore.h"  #include        "iocore.h"
 #include        "bios.h"  #include        "bios.h"
 #include        "i286c.mcr"  #include        "i286c.mcr"
   #if defined(ENABLE_TRAP)
   #include        "inttrap.h"
   #endif
   
   
 #define MAX_PREFIX              8  #define MAX_PREFIX              8
Line 28 Line 30
   
 I286FN _reserved(void) {  I286FN _reserved(void) {
   
         I286_WORKCLOCK(23);                                                     // ToDo  
         INT_NUM(6, I286_IP - 1);          INT_NUM(6, I286_IP - 1);
 }  }
   
 I286FN _add_ea_r8(void) {                                               // 00: add EA, REG8  I286FN _add_ea_r8(void) {                                               // 00: add EA, REG8
   
         BYTE    *out;          UINT8   *out;
         UINT    op;          UINT    op;
         UINT    src;          UINT    src;
         UINT    dst;          UINT    dst;
Line 59  I286FN _add_ea_r8(void) {      // 00: ad Line 60  I286FN _add_ea_r8(void) {      // 00: ad
         }          }
         dst = *out;          dst = *out;
         ADDBYTE(res, dst, src);          ADDBYTE(res, dst, src);
         *out = (BYTE)res;          *out = (UINT8)res;
 }  }
   
 I286FN _add_ea_r16(void) {                                              // 01: add EA, REG16  I286FN _add_ea_r16(void) {                                              // 01: add EA, REG16
Line 94  I286FN _add_ea_r16(void) {      // 01: a Line 95  I286FN _add_ea_r16(void) {      // 01: a
   
 I286FN _add_r8_ea(void) {                                               // 02: add REG8, EA  I286FN _add_r8_ea(void) {                                               // 02: add REG8, EA
   
         BYTE    *out;          UINT8   *out;
         UINT    op;          UINT    op;
         UINT    src;          UINT    src;
         UINT    dst;          UINT    dst;
Line 103  I286FN _add_r8_ea(void) {      // 02: ad Line 104  I286FN _add_r8_ea(void) {      // 02: ad
         PREPART_REG8_EA(op, src, out, 2, 7);          PREPART_REG8_EA(op, src, out, 2, 7);
         dst = *out;          dst = *out;
         ADDBYTE(res, dst, src);          ADDBYTE(res, dst, src);
         *out = (BYTE)res;          *out = (UINT8)res;
 }  }
   
 I286FN _add_r16_ea(void) {                                              // 03: add REG16, EA  I286FN _add_r16_ea(void) {                                              // 03: add REG16, EA
Line 128  I286FN _add_al_data8(void) {     // 04:  Line 129  I286FN _add_al_data8(void) {     // 04: 
         I286_WORKCLOCK(3);          I286_WORKCLOCK(3);
         GET_PCBYTE(src);          GET_PCBYTE(src);
         ADDBYTE(res, I286_AL, src);          ADDBYTE(res, I286_AL, src);
         I286_AL = (BYTE)res;          I286_AL = (UINT8)res;
 }  }
   
 I286FN _add_ax_data16(void) {                                   // 05: add ax, DATA16  I286FN _add_ax_data16(void) {                                   // 05: add ax, DATA16
Line 149  I286FN _push_es(void) {       // 06: pus Line 150  I286FN _push_es(void) {       // 06: pus
   
 I286FN _pop_es(void) {                                                  // 07: pop es  I286FN _pop_es(void) {                                                  // 07: pop es
   
         REGPOP(I286_ES, 5)          UINT    tmp;
         ES_BASE = (UINT32)I286_ES << 4;  
           REGPOP(tmp, 5)
           I286_ES = tmp;
           ES_BASE = SEGSELECT(tmp);
 }  }
   
 I286FN _or_ea_r8(void) {                                                // 08: or EA, REG8  I286FN _or_ea_r8(void) {                                                // 08: or EA, REG8
   
         BYTE    *out;          UINT8   *out;
         UINT    op;          UINT    op;
         UINT    src;          UINT    src;
         UINT    dst;          UINT    dst;
Line 179  I286FN _or_ea_r8(void) {      // 08: or  Line 183  I286FN _or_ea_r8(void) {      // 08: or 
         }          }
         dst = *out;          dst = *out;
         ORBYTE(dst, src);          ORBYTE(dst, src);
         *out = (BYTE)dst;          *out = (UINT8)dst;
 }  }
   
 I286FN _or_ea_r16(void) {                                                       // 09: or EA, REG16  I286FN _or_ea_r16(void) {                                                       // 09: or EA, REG16
Line 213  I286FN _or_ea_r16(void) {       // 09: o Line 217  I286FN _or_ea_r16(void) {       // 09: o
   
 I286FN _or_r8_ea(void) {                                                // 0a: or REG8, EA  I286FN _or_r8_ea(void) {                                                // 0a: or REG8, EA
   
         BYTE    *out;          UINT8   *out;
         UINT    op;          UINT    op;
         UINT    src;          UINT    src;
         UINT    dst;          UINT    dst;
Line 221  I286FN _or_r8_ea(void) {      // 0a: or  Line 225  I286FN _or_r8_ea(void) {      // 0a: or 
         PREPART_REG8_EA(op, src, out, 2, 7);          PREPART_REG8_EA(op, src, out, 2, 7);
         dst = *out;          dst = *out;
         ORBYTE(dst, src);          ORBYTE(dst, src);
         *out = (BYTE)dst;          *out = (UINT8)dst;
 }  }
   
 I286FN _or_r16_ea(void) {                                               // 0b: or REG16, EA  I286FN _or_r16_ea(void) {                                               // 0b: or REG16, EA
Line 246  I286FN _or_al_data8(void) {      // 0c:  Line 250  I286FN _or_al_data8(void) {      // 0c: 
         GET_PCBYTE(src);          GET_PCBYTE(src);
         dst = I286_AL;          dst = I286_AL;
         ORBYTE(dst, src);          ORBYTE(dst, src);
         I286_AL = (BYTE)dst;          I286_AL = (UINT8)dst;
 }  }
   
 I286FN _or_ax_data16(void) {                                    // 0d: or ax, DATA16  I286FN _or_ax_data16(void) {                                    // 0d: or ax, DATA16
Line 268  I286FN _push_cs(void) {       // 0e: pus Line 272  I286FN _push_cs(void) {       // 0e: pus
   
 I286FN _adc_ea_r8(void) {                                               // 10: adc EA, REG8  I286FN _adc_ea_r8(void) {                                               // 10: adc EA, REG8
   
         BYTE    *out;          UINT8   *out;
         UINT    op;          UINT    op;
         UINT    src;          UINT    src;
         UINT    dst;          UINT    dst;
Line 293  I286FN _adc_ea_r8(void) {      // 10: ad Line 297  I286FN _adc_ea_r8(void) {      // 10: ad
         }          }
         dst = *out;          dst = *out;
         ADCBYTE(res, dst, src);          ADCBYTE(res, dst, src);
         *out = (BYTE)res;          *out = (UINT8)res;
 }  }
   
 I286FN _adc_ea_r16(void) {                                              // 11: adc EA, REG16  I286FN _adc_ea_r16(void) {                                              // 11: adc EA, REG16
Line 328  I286FN _adc_ea_r16(void) {      // 11: a Line 332  I286FN _adc_ea_r16(void) {      // 11: a
   
 I286FN _adc_r8_ea(void) {                                               // 12: adc REG8, EA  I286FN _adc_r8_ea(void) {                                               // 12: adc REG8, EA
   
         BYTE    *out;          UINT8   *out;
         UINT    op;          UINT    op;
         UINT    src;          UINT    src;
         UINT    dst;          UINT    dst;
Line 337  I286FN _adc_r8_ea(void) {      // 12: ad Line 341  I286FN _adc_r8_ea(void) {      // 12: ad
         PREPART_REG8_EA(op, src, out, 2, 7);          PREPART_REG8_EA(op, src, out, 2, 7);
         dst = *out;          dst = *out;
         ADCBYTE(res, dst, src);          ADCBYTE(res, dst, src);
         *out = (BYTE)res;          *out = (UINT8)res;
 }  }
   
 I286FN _adc_r16_ea(void) {                                              // 13: adc REG16, EA  I286FN _adc_r16_ea(void) {                                              // 13: adc REG16, EA
Line 362  I286FN _adc_al_data8(void) {     // 14:  Line 366  I286FN _adc_al_data8(void) {     // 14: 
         I286_WORKCLOCK(3);          I286_WORKCLOCK(3);
         GET_PCBYTE(src);          GET_PCBYTE(src);
         ADCBYTE(res, I286_AL, src);          ADCBYTE(res, I286_AL, src);
         I286_AL = (BYTE)res;          I286_AL = (UINT8)res;
 }  }
   
 I286FN _adc_ax_data16(void) {                                   // 15: adc ax, DATA16  I286FN _adc_ax_data16(void) {                                   // 15: adc ax, DATA16
Line 383  I286FN _push_ss(void) {       // 16: pus Line 387  I286FN _push_ss(void) {       // 16: pus
   
 I286FN _pop_ss(void) {                                                  // 17: pop ss  I286FN _pop_ss(void) {                                                  // 17: pop ss
   
         REGPOP(I286_SS, 5)          UINT    tmp;
         SS_BASE = I286_SS << 4;  
           REGPOP(tmp, 5)
           I286_SS = tmp;
           SS_BASE = SEGSELECT(tmp);
         SS_FIX = SS_BASE;          SS_FIX = SS_BASE;
         NEXT_OPCODE          NEXT_OPCODE
 }  }
   
 I286FN _sbb_ea_r8(void) {                                               // 18: sbb EA, REG8  I286FN _sbb_ea_r8(void) {                                               // 18: sbb EA, REG8
   
         BYTE    *out;          UINT8   *out;
         UINT    op;          UINT    op;
         UINT    src;          UINT    src;
         UINT    dst;          UINT    dst;
Line 416  I286FN _sbb_ea_r8(void) {      // 18: sb Line 423  I286FN _sbb_ea_r8(void) {      // 18: sb
         }          }
         dst = *out;          dst = *out;
         SBBBYTE(res, dst, src);          SBBBYTE(res, dst, src);
         *out = (BYTE)res;          *out = (UINT8)res;
 }  }
   
 I286FN _sbb_ea_r16(void) {                                              // 19: sbb EA, REG16  I286FN _sbb_ea_r16(void) {                                              // 19: sbb EA, REG16
Line 451  I286FN _sbb_ea_r16(void) {      // 19: s Line 458  I286FN _sbb_ea_r16(void) {      // 19: s
   
 I286FN _sbb_r8_ea(void) {                                               // 1a: sbb REG8, EA  I286FN _sbb_r8_ea(void) {                                               // 1a: sbb REG8, EA
   
         BYTE    *out;          UINT8   *out;
         UINT    op;          UINT    op;
         UINT    src;          UINT    src;
         UINT    dst;          UINT    dst;
Line 460  I286FN _sbb_r8_ea(void) {      // 1a: sb Line 467  I286FN _sbb_r8_ea(void) {      // 1a: sb
         PREPART_REG8_EA(op, src, out, 2, 7);          PREPART_REG8_EA(op, src, out, 2, 7);
         dst = *out;          dst = *out;
         SBBBYTE(res, dst, src);          SBBBYTE(res, dst, src);
         *out = (BYTE)res;          *out = (UINT8)res;
 }  }
   
 I286FN _sbb_r16_ea(void) {                                              // 1b: sbb REG16, EA  I286FN _sbb_r16_ea(void) {                                              // 1b: sbb REG16, EA
Line 485  I286FN _sbb_al_data8(void) {     // 1c:  Line 492  I286FN _sbb_al_data8(void) {     // 1c: 
         I286_WORKCLOCK(3);          I286_WORKCLOCK(3);
         GET_PCBYTE(src);          GET_PCBYTE(src);
         SBBBYTE(res, I286_AL, src);          SBBBYTE(res, I286_AL, src);
         I286_AL = (BYTE)res;          I286_AL = (UINT8)res;
 }  }
   
 I286FN _sbb_ax_data16(void) {                                   // 1d: adc ax, DATA16  I286FN _sbb_ax_data16(void) {                                   // 1d: adc ax, DATA16
Line 506  I286FN _push_ds(void) {       // 1e: pus Line 513  I286FN _push_ds(void) {       // 1e: pus
   
 I286FN _pop_ds(void) {                                                  // 1f: pop ds  I286FN _pop_ds(void) {                                                  // 1f: pop ds
   
         REGPOP(I286_DS, 5)          UINT    tmp;
         DS_BASE = I286_DS << 4;  
           REGPOP(tmp, 5)
           I286_DS = tmp;
           DS_BASE = SEGSELECT(tmp);
         DS_FIX = DS_BASE;          DS_FIX = DS_BASE;
 }  }
   
 I286FN _and_ea_r8(void) {                                               // 20: and EA, REG8  I286FN _and_ea_r8(void) {                                               // 20: and EA, REG8
   
         BYTE    *out;          UINT8   *out;
         UINT    op;          UINT    op;
         UINT    src;          UINT    src;
         UINT    dst;          UINT    dst;
Line 537  I286FN _and_ea_r8(void) {      // 20: an Line 547  I286FN _and_ea_r8(void) {      // 20: an
         }          }
         dst = *out;          dst = *out;
         ANDBYTE(dst, src);          ANDBYTE(dst, src);
         *out = (BYTE)dst;          *out = (UINT8)dst;
 }  }
   
 I286FN _and_ea_r16(void) {                                              // 21: and EA, REG16  I286FN _and_ea_r16(void) {                                              // 21: and EA, REG16
Line 571  I286FN _and_ea_r16(void) {      // 21: a Line 581  I286FN _and_ea_r16(void) {      // 21: a
   
 I286FN _and_r8_ea(void) {                                               // 22: and REG8, EA  I286FN _and_r8_ea(void) {                                               // 22: and REG8, EA
   
         BYTE    *out;          UINT8   *out;
         UINT    op;          UINT    op;
         UINT    src;          UINT    src;
         UINT    dst;          UINT    dst;
Line 579  I286FN _and_r8_ea(void) {      // 22: an Line 589  I286FN _and_r8_ea(void) {      // 22: an
         PREPART_REG8_EA(op, src, out, 2, 7);          PREPART_REG8_EA(op, src, out, 2, 7);
         dst = *out;          dst = *out;
         ANDBYTE(dst, src);          ANDBYTE(dst, src);
         *out = (BYTE)dst;          *out = (UINT8)dst;
 }  }
   
 I286FN _and_r16_ea(void) {                                              // 23: and REG16, EA  I286FN _and_r16_ea(void) {                                              // 23: and REG16, EA
Line 604  I286FN _and_al_data8(void) {     // 24:  Line 614  I286FN _and_al_data8(void) {     // 24: 
         GET_PCBYTE(src);          GET_PCBYTE(src);
         dst = I286_AL;          dst = I286_AL;
         ANDBYTE(dst, src);          ANDBYTE(dst, src);
         I286_AL = (BYTE)dst;          I286_AL = (UINT8)dst;
 }  }
   
 I286FN _and_ax_data16(void) {                                   // 25: and ax, DATA16  I286FN _and_ax_data16(void) {                                   // 25: and ax, DATA16
Line 644  I286FN _daa(void) {        // 27: daa Line 654  I286FN _daa(void) {        // 27: daa
                                 ((I286_AL >= 0x1a) && (I286_FLAGL & C_FLAG))));                                  ((I286_AL >= 0x1a) && (I286_FLAGL & C_FLAG))));
         if ((I286_FLAGL & A_FLAG) || ((I286_AL & 0x0f) > 9)) {          if ((I286_FLAGL & A_FLAG) || ((I286_AL & 0x0f) > 9)) {
                 I286_FLAGL |= A_FLAG;                  I286_FLAGL |= A_FLAG;
                 I286_FLAGL |= (BYTE)((I286_AL + 6) >> 8);                  I286_FLAGL |= (UINT8)((I286_AL + 6) >> 8);
                 I286_AL += 6;                  I286_AL += 6;
         }          }
         if ((I286_FLAGL & C_FLAG) || (I286_AL > 0x9f)) {          if ((I286_FLAGL & C_FLAG) || (I286_AL > 0x9f)) {
Line 657  I286FN _daa(void) {        // 27: daa Line 667  I286FN _daa(void) {        // 27: daa
   
 I286FN _sub_ea_r8(void) {                                               // 28: sub EA, REG8  I286FN _sub_ea_r8(void) {                                               // 28: sub EA, REG8
   
         BYTE    *out;          UINT8   *out;
         UINT    op;          UINT    op;
         UINT    src;          UINT    src;
         UINT    dst;          UINT    dst;
Line 682  I286FN _sub_ea_r8(void) {      // 28: su Line 692  I286FN _sub_ea_r8(void) {      // 28: su
         }          }
         dst = *out;          dst = *out;
         SUBBYTE(res, dst, src);          SUBBYTE(res, dst, src);
         *out = (BYTE)res;          *out = (UINT8)res;
 }  }
   
 I286FN _sub_ea_r16(void) {                                              // 29: sub EA, REG16  I286FN _sub_ea_r16(void) {                                              // 29: sub EA, REG16
Line 717  I286FN _sub_ea_r16(void) {      // 29: s Line 727  I286FN _sub_ea_r16(void) {      // 29: s
   
 I286FN _sub_r8_ea(void) {                                               // 2a: sub REG8, EA  I286FN _sub_r8_ea(void) {                                               // 2a: sub REG8, EA
   
         BYTE    *out;          UINT8   *out;
         UINT    op;          UINT    op;
         UINT    src;          UINT    src;
         UINT    dst;          UINT    dst;
Line 726  I286FN _sub_r8_ea(void) {      // 2a: su Line 736  I286FN _sub_r8_ea(void) {      // 2a: su
         PREPART_REG8_EA(op, src, out, 2, 7);          PREPART_REG8_EA(op, src, out, 2, 7);
         dst = *out;          dst = *out;
         SUBBYTE(res, dst, src);          SUBBYTE(res, dst, src);
         *out = (BYTE)res;          *out = (UINT8)res;
 }  }
   
 I286FN _sub_r16_ea(void) {                                              // 2b: sub REG16, EA  I286FN _sub_r16_ea(void) {                                              // 2b: sub REG16, EA
Line 751  I286FN _sub_al_data8(void) {     // 2c:  Line 761  I286FN _sub_al_data8(void) {     // 2c: 
         I286_WORKCLOCK(3);          I286_WORKCLOCK(3);
         GET_PCBYTE(src);          GET_PCBYTE(src);
         SUBBYTE(res, I286_AL, src);          SUBBYTE(res, I286_AL, src);
         I286_AL = (BYTE)res;          I286_AL = (UINT8)res;
 }  }
   
 I286FN _sub_ax_data16(void) {                                   // 2d: sub ax, DATA16  I286FN _sub_ax_data16(void) {                                   // 2d: sub ax, DATA16
Line 800  I286FN _das(void) {        // 2f: das Line 810  I286FN _das(void) {        // 2f: das
   
 I286FN _xor_ea_r8(void) {                                               // 30: xor EA, REG8  I286FN _xor_ea_r8(void) {                                               // 30: xor EA, REG8
   
         BYTE    *out;          UINT8   *out;
         UINT    op;          UINT    op;
         UINT    src;          UINT    src;
         UINT    dst;          UINT    dst;
Line 824  I286FN _xor_ea_r8(void) {      // 30: xo Line 834  I286FN _xor_ea_r8(void) {      // 30: xo
         }          }
         dst = *out;          dst = *out;
         XORBYTE(dst, src);          XORBYTE(dst, src);
         *out = (BYTE)dst;          *out = (UINT8)dst;
 }  }
   
 I286FN _xor_ea_r16(void) {                                              // 31: xor EA, REG16  I286FN _xor_ea_r16(void) {                                              // 31: xor EA, REG16
Line 858  I286FN _xor_ea_r16(void) {      // 31: x Line 868  I286FN _xor_ea_r16(void) {      // 31: x
   
 I286FN _xor_r8_ea(void) {                                               // 32: xor REG8, EA  I286FN _xor_r8_ea(void) {                                               // 32: xor REG8, EA
   
         BYTE    *out;          UINT8   *out;
         UINT    op;          UINT    op;
         UINT    src;          UINT    src;
         UINT    dst;          UINT    dst;
Line 866  I286FN _xor_r8_ea(void) {      // 32: xo Line 876  I286FN _xor_r8_ea(void) {      // 32: xo
         PREPART_REG8_EA(op, src, out, 2, 7);          PREPART_REG8_EA(op, src, out, 2, 7);
         dst = *out;          dst = *out;
         XORBYTE(dst, src);          XORBYTE(dst, src);
         *out = (BYTE)dst;          *out = (UINT8)dst;
 }  }
   
 I286FN _xor_r16_ea(void) {                                              // 33: or REG16, EA  I286FN _xor_r16_ea(void) {                                              // 33: or REG16, EA
Line 891  I286FN _xor_al_data8(void) {     // 34:  Line 901  I286FN _xor_al_data8(void) {     // 34: 
         GET_PCBYTE(src);          GET_PCBYTE(src);
         dst = I286_AL;          dst = I286_AL;
         XORBYTE(dst, src);          XORBYTE(dst, src);
         I286_AL = (BYTE)dst;          I286_AL = (UINT8)dst;
 }  }
   
 I286FN _xor_ax_data16(void) {                                   // 35: or ax, DATA16  I286FN _xor_ax_data16(void) {                                   // 35: or ax, DATA16
Line 979  I286FN _cmp_ea_r16(void) {      // 39: c Line 989  I286FN _cmp_ea_r16(void) {      // 39: c
   
 I286FN _cmp_r8_ea(void) {                                               // 3a: cmp REG8, EA  I286FN _cmp_r8_ea(void) {                                               // 3a: cmp REG8, EA
   
         BYTE    *out;          UINT8   *out;
         UINT    op;          UINT    op;
         UINT    src;          UINT    src;
         UINT    dst;          UINT    dst;
Line 1216  I286FN _arpl(void) {      // 63: arpl Line 1226  I286FN _arpl(void) {      // 63: arpl
   
         GET_PCBYTE(op)          GET_PCBYTE(op)
         tmp = ((op < 0xc0)?1:0);          tmp = ((op < 0xc0)?1:0);
         I286_IP += (BYTE)tmp;          I286_IP += (UINT8)tmp;
         I286_WORKCLOCK(tmp + 10);          I286_WORKCLOCK(tmp + 10);
         INT_NUM(6, I286_IP);          INT_NUM(6, I286_IP);
 }  }
Line 1292  I286FN _outsb(void) {      // 6E: outsb Line 1302  I286FN _outsb(void) {      // 6E: outsb
         I286_WORKCLOCK(3);          I286_WORKCLOCK(3);
         dat = i286_memoryread(I286_SI + DS_FIX);          dat = i286_memoryread(I286_SI + DS_FIX);
         I286_SI += STRING_DIR;          I286_SI += STRING_DIR;
         iocore_out8(I286_DX, (BYTE)dat);          iocore_out8(I286_DX, (UINT8)dat);
 }  }
   
 I286FN _outsw(void) {                                           // 6F:  outsw  I286FN _outsw(void) {                                           // 6F:  outsw
Line 1392  I286FN _jnle_short(void) {     // 7F: jg Line 1402  I286FN _jnle_short(void) {     // 7F: jg
   
 I286FN _calc_ea8_i8(void) {                                     // 80:  op              EA8, DATA8  I286FN _calc_ea8_i8(void) {                                     // 80:  op              EA8, DATA8
                                                                                         // 82:  op              EA8, DATA8                                                                                          // 82:  op              EA8, DATA8
         BYTE    *out;          UINT8   *out;
         UINT    op;          UINT    op;
         UINT32  madr;          UINT32  madr;
   
Line 1467  I286FN _calc_ea16_i8(void) {    // 83: o Line 1477  I286FN _calc_ea16_i8(void) {    // 83: o
   
 I286FN _test_ea_r8(void) {                                      // 84:  test    EA, REG8  I286FN _test_ea_r8(void) {                                      // 84:  test    EA, REG8
   
         BYTE    *out;          UINT8   *out;
         UINT    op;          UINT    op;
         UINT    src;          UINT    src;
         UINT    tmp;          UINT    tmp;
Line 1521  I286FN _test_ea_r16(void) {     // 85: t Line 1531  I286FN _test_ea_r16(void) {     // 85: t
   
 I286FN _xchg_ea_r8(void) {                                      // 86:  xchg    EA, REG8  I286FN _xchg_ea_r8(void) {                                      // 86:  xchg    EA, REG8
   
         BYTE    *out;          UINT8   *out;
         BYTE    *src;          UINT8   *src;
         UINT    op;          UINT    op;
         UINT32  madr;          UINT32  madr;
   
Line 1535  I286FN _xchg_ea_r8(void) {     // 86: xc Line 1545  I286FN _xchg_ea_r8(void) {     // 86: xc
                 I286_WORKCLOCK(5);                  I286_WORKCLOCK(5);
                 madr = CALC_EA(op);                  madr = CALC_EA(op);
                 if (madr >= I286_MEMWRITEMAX) {                  if (madr >= I286_MEMWRITEMAX) {
                         BYTE tmp = i286_memoryread(madr);                          UINT8 tmp = i286_memoryread(madr);
                         i286_memorywrite(madr, *src);                          i286_memorywrite(madr, *src);
                         *src = tmp;                          *src = tmp;
                         return;                          return;
Line 1573  I286FN _xchg_ea_r16(void) {     // 87: x Line 1583  I286FN _xchg_ea_r16(void) {     // 87: x
   
 I286FN _mov_ea_r8(void) {                                       // 88:  mov             EA, REG8  I286FN _mov_ea_r8(void) {                                       // 88:  mov             EA, REG8
   
         BYTE    src;          UINT8   src;
         UINT    op;          UINT    op;
         UINT32  madr;          UINT32  madr;
   
Line 1607  I286FN _mov_ea_r16(void) {     // 89: mo Line 1617  I286FN _mov_ea_r16(void) {     // 89: mo
   
 I286FN _mov_r8_ea(void) {                                       // 8A:  mov             REG8, EA  I286FN _mov_r8_ea(void) {                                       // 8A:  mov             REG8, EA
   
         BYTE    *out;          UINT8   *out;
         BYTE    src;          UINT8   src;
         UINT    op;          UINT    op;
   
         PREPART_REG8_EA(op, src, out, 2, 5);          PREPART_REG8_EA(op, src, out, 2, 5);
Line 1660  I286FN _mov_seg_ea(void) {     // 8E: mo Line 1670  I286FN _mov_seg_ea(void) {     // 8E: mo
   
         UINT    op;          UINT    op;
         UINT    tmp;          UINT    tmp;
           UINT32  base;
         UINT16  ipbak;          UINT16  ipbak;
   
         ipbak = I286_IP;          ipbak = I286_IP;
Line 1672  I286FN _mov_seg_ea(void) {     // 8E: mo Line 1683  I286FN _mov_seg_ea(void) {     // 8E: mo
                 I286_WORKCLOCK(5);                  I286_WORKCLOCK(5);
                 tmp = i286_memoryread_w(CALC_EA(op));                  tmp = i286_memoryread_w(CALC_EA(op));
         }          }
           base = SEGSELECT(tmp);
         switch(op & 0x18) {          switch(op & 0x18) {
                 case 0x00:                      // es                  case 0x00:                      // es
                         I286_ES = (UINT16)tmp;                          I286_ES = (UINT16)tmp;
                         ES_BASE = tmp << 4;                          ES_BASE = base;
                         break;                          break;
   
                 case 0x10:                      // ss                  case 0x10:                      // ss
                         I286_SS = (UINT16)tmp;                          I286_SS = (UINT16)tmp;
                         SS_BASE = tmp << 4;                          SS_BASE = base;
                         SS_FIX = SS_BASE;                          SS_FIX = base;
                         NEXT_OPCODE                          NEXT_OPCODE
                         break;                          break;
   
                 case 0x18:                      // ds                  case 0x18:                      // ds
                         I286_DS = (UINT16)tmp;                          I286_DS = (UINT16)tmp;
                         DS_BASE = tmp << 4;                          DS_BASE = base;
                         DS_FIX = DS_BASE;                          DS_FIX = base;
                         break;                          break;
   
                 default:                        // cs                  default:                        // cs
Line 1795  I286FN _call_far(void) {     // 9A: call Line 1807  I286FN _call_far(void) {     // 9A: call
         REGPUSH0(I286_CS)          REGPUSH0(I286_CS)
         GET_PCWORD(newip)          GET_PCWORD(newip)
         GET_PCWORD(I286_CS)          GET_PCWORD(I286_CS)
         CS_BASE = I286_CS << 4;          CS_BASE = SEGSELECT(I286_CS);
         REGPUSH0(I286_IP)          REGPUSH0(I286_IP)
         I286_IP = newip;          I286_IP = newip;
 }  }
Line 1878  I286FN _mov_m16_ax(void) {     // A3: mo Line 1890  I286FN _mov_m16_ax(void) {     // A3: mo
   
 I286FN _movsb(void) {                                           // A4:  movsb  I286FN _movsb(void) {                                           // A4:  movsb
   
         BYTE    tmp;          UINT8   tmp;
   
         I286_WORKCLOCK(5);          I286_WORKCLOCK(5);
         tmp = i286_memoryread(I286_SI + DS_FIX);          tmp = i286_memoryread(I286_SI + DS_FIX);
Line 2021  I286FN _mov_di_imm(void) MOVIMM16(I286_D Line 2033  I286FN _mov_di_imm(void) MOVIMM16(I286_D
   
 I286FN _shift_ea8_data8(void) {                         // C0:  shift   EA8, DATA8  I286FN _shift_ea8_data8(void) {                         // C0:  shift   EA8, DATA8
   
         BYTE    *out;          UINT8   *out;
         UINT    op;          UINT    op;
         UINT32  madr;          UINT32  madr;
         BYTE    cl;          UINT8   cl;
   
         GET_PCBYTE(op)          GET_PCBYTE(op)
         if (op >= 0xc0) {          if (op >= 0xc0) {
Line 2052  I286FN _shift_ea16_data8(void) {   // C1 Line 2064  I286FN _shift_ea16_data8(void) {   // C1
         UINT16  *out;          UINT16  *out;
         UINT    op;          UINT    op;
         UINT32  madr;          UINT32  madr;
         BYTE    cl;          UINT8   cl;
   
         GET_PCBYTE(op)          GET_PCBYTE(op)
         if (op >= 0xc0) {          if (op >= 0xc0) {
Line 2103  I286FN _les_r16_ea(void) {     // C4: le Line 2115  I286FN _les_r16_ea(void) {     // C4: le
                 ad = GET_EA(op, &seg);                  ad = GET_EA(op, &seg);
                 *(REG16_B53(op)) = i286_memoryread_w(seg + ad);                  *(REG16_B53(op)) = i286_memoryread_w(seg + ad);
                 I286_ES = i286_memoryread_w(seg + LOW16(ad + 2));                  I286_ES = i286_memoryread_w(seg + LOW16(ad + 2));
                 ES_BASE = I286_ES << 4;                  ES_BASE = SEGSELECT(I286_ES);
         }          }
         else {          else {
                 INT_NUM(6, I286_IP - 2);                  INT_NUM(6, I286_IP - 2);
Line 2122  I286FN _lds_r16_ea(void) {     // C5: ld Line 2134  I286FN _lds_r16_ea(void) {     // C5: ld
                 ad = GET_EA(op, &seg);                  ad = GET_EA(op, &seg);
                 *(REG16_B53(op)) = i286_memoryread_w(seg + ad);                  *(REG16_B53(op)) = i286_memoryread_w(seg + ad);
                 I286_DS = i286_memoryread_w(seg + LOW16(ad + 2));                  I286_DS = i286_memoryread_w(seg + LOW16(ad + 2));
                 DS_BASE = I286_DS << 4;                  DS_BASE = SEGSELECT(I286_DS);
                 DS_FIX = DS_BASE;                  DS_FIX = DS_BASE;
         }          }
         else {          else {
Line 2141  I286FN _mov_ea8_data8(void) {    // C6:  Line 2153  I286FN _mov_ea8_data8(void) {    // C6: 
         }          }
         else {                          // 03/11/23          else {                          // 03/11/23
                 UINT32 ad;                  UINT32 ad;
                 BYTE val;                  UINT8 val;
                 I286_WORKCLOCK(3);                  I286_WORKCLOCK(3);
                 ad = CALC_EA(op);                  ad = CALC_EA(op);
                 GET_PCBYTE(val)                  GET_PCBYTE(val)
Line 2171  I286FN _mov_ea16_data16(void) {    // C7 Line 2183  I286FN _mov_ea16_data16(void) {    // C7
 I286FN _enter(void) {                                           // C8:  enter   DATA16, DATA8  I286FN _enter(void) {                                           // C8:  enter   DATA16, DATA8
   
         UINT16  dimsize;          UINT16  dimsize;
         BYTE    level;          UINT8   level;
   
         GET_PCWORD(dimsize)          GET_PCWORD(dimsize)
         GET_PCBYTE(level)          GET_PCBYTE(level)
Line 2233  I286FN _ret_far_data16(void) {    // CA: Line 2245  I286FN _ret_far_data16(void) {    // CA:
         REGPOP0(I286_IP)          REGPOP0(I286_IP)
         REGPOP0(I286_CS)          REGPOP0(I286_CS)
         I286_SP += ad;          I286_SP += ad;
         CS_BASE = I286_CS << 4;          CS_BASE = SEGSELECT(I286_CS);
 }  }
   
 I286FN _ret_far(void) {                                         // CB:  ret far  I286FN _ret_far(void) {                                         // CB:  ret far
Line 2241  I286FN _ret_far(void) {      // CB: ret  Line 2253  I286FN _ret_far(void) {      // CB: ret 
         I286_WORKCLOCK(15);          I286_WORKCLOCK(15);
         REGPOP0(I286_IP)          REGPOP0(I286_IP)
         REGPOP0(I286_CS)          REGPOP0(I286_CS)
         CS_BASE = I286_CS << 4;          CS_BASE = SEGSELECT(I286_CS);
 }  }
   
 I286FN _int_03(void) {                                          // CC:  int             3  I286FN _int_03(void) {                                          // CC:  int             3
   
         I286_WORKCLOCK(23);          I286_WORKCLOCK(3);
         INT_NUM(3, I286_IP);          INT_NUM(3, I286_IP);
 }  }
   
Line 2254  I286FN _int_data8(void) {     // CD: int Line 2266  I286FN _int_data8(void) {     // CD: int
   
         UINT    vect;          UINT    vect;
   
         I286_WORKCLOCK(23);          I286_WORKCLOCK(3);
         GET_PCBYTE(vect)          GET_PCBYTE(vect)
   #if defined(ENABLE_TRAP)
           softinttrap(CPU_CS, CPU_IP - 2, vect);
   #endif
         INT_NUM(vect, I286_IP);          INT_NUM(vect, I286_IP);
 }  }
   
Line 2263  I286FN _into(void) {      // CE: into Line 2278  I286FN _into(void) {      // CE: into
   
         I286_WORKCLOCK(4);          I286_WORKCLOCK(4);
         if (I286_OV) {          if (I286_OV) {
                 I286_WORKCLOCK(24 - 4);  
                 INT_NUM(4, I286_IP);                  INT_NUM(4, I286_IP);
         }          }
 }  }
Line 2272  I286FN _iret(void) {      // CF: iret Line 2286  I286FN _iret(void) {      // CF: iret
   
         UINT    flag;          UINT    flag;
   
         extirq_pop();  
         REGPOP0(I286_IP)          REGPOP0(I286_IP)
         REGPOP0(I286_CS)          REGPOP0(I286_CS)
         REGPOP0(flag)          REGPOP0(flag)
Line 2280  I286FN _iret(void) {      // CF: iret Line 2293  I286FN _iret(void) {      // CF: iret
         I286_FLAG = flag & (0xfff ^ O_FLAG);          I286_FLAG = flag & (0xfff ^ O_FLAG);
         I286_TRAP = ((flag & 0x300) == 0x300);          I286_TRAP = ((flag & 0x300) == 0x300);
         CS_BASE = I286_CS << 4;          CS_BASE = I286_CS << 4;
   //      CS_BASE = SEGSELECT(I286_CS);
         I286_WORKCLOCK(31);          I286_WORKCLOCK(31);
 #if defined(INTR_FAST)  #if defined(INTR_FAST)
         if ((I286_TRAP) || ((flag & I_FLAG) && (PICEXISTINTR))) {          if ((I286_TRAP) || ((flag & I_FLAG) && (PICEXISTINTR))) {
Line 2292  I286FN _iret(void) {      // CF: iret Line 2306  I286FN _iret(void) {      // CF: iret
   
 I286FN _shift_ea8_1(void) {                             // D0:  shift EA8, 1  I286FN _shift_ea8_1(void) {                             // D0:  shift EA8, 1
   
         BYTE    *out;          UINT8   *out;
         UINT    op;          UINT    op;
         UINT32  madr;          UINT32  madr;
   
Line 2338  I286FN _shift_ea16_1(void) {   // D1: sh Line 2352  I286FN _shift_ea16_1(void) {   // D1: sh
   
 I286FN _shift_ea8_cl(void) {                    // D2:  shift EA8, cl  I286FN _shift_ea8_cl(void) {                    // D2:  shift EA8, cl
   
         BYTE    *out;          UINT8   *out;
         UINT    op;          UINT    op;
         UINT32  madr;          UINT32  madr;
         REG8    cl;          REG8    cl;
Line 2394  I286FN _shift_ea16_cl(void) {   // D3: s Line 2408  I286FN _shift_ea16_cl(void) {   // D3: s
   
 I286FN _aam(void) {                                                     // D4:  AAM  I286FN _aam(void) {                                                     // D4:  AAM
   
         BYTE    al;          UINT8   al;
         BYTE    div;          UINT8   div;
   
         I286_WORKCLOCK(16);          I286_WORKCLOCK(16);
         GET_PCBYTE(div);          GET_PCBYTE(div);
Line 2414  I286FN _aam(void) {       // D4: AAM Line 2428  I286FN _aam(void) {       // D4: AAM
   
 I286FN _aad(void) {                                                     // D5:  AAD  I286FN _aad(void) {                                                     // D5:  AAD
   
         BYTE    mul;          UINT8   mul;
   
         I286_WORKCLOCK(14);          I286_WORKCLOCK(14);
         GET_PCBYTE(mul);          GET_PCBYTE(mul);
         I286_AL += (BYTE)(I286_AH * mul);          I286_AL += (UINT8)(I286_AH * mul);
         I286_AH = 0;          I286_AH = 0;
         I286_FLAGL &= ~(S_FLAG | Z_FLAG | P_FLAG);          I286_FLAGL &= ~(S_FLAG | Z_FLAG | P_FLAG);
         I286_FLAGL |= BYTESZPF(I286_AL);          I286_FLAGL |= BYTESZPF(I286_AL);
Line 2533  I286FN _jmp_far(void) {      // EA: jmp  Line 2547  I286FN _jmp_far(void) {      // EA: jmp 
         I286_WORKCLOCK(11);          I286_WORKCLOCK(11);
         GET_PCWORD(ad);          GET_PCWORD(ad);
         GET_PCWORD(I286_CS);          GET_PCWORD(I286_CS);
         CS_BASE = I286_CS << 4;  
         I286_IP = ad;          I286_IP = ad;
           CS_BASE = SEGSELECT(I286_CS);
 }  }
   
 I286FN _jmp_short(void) {                                       // EB:  jmp short  I286FN _jmp_short(void) {                                       // EB:  jmp short

Removed from v.1.23  
changed lines
  Added in v.1.39


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