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

version 1.23, 2003/12/11 21:57:38 version 1.36, 2005/02/04 05:32:23
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"
Line 28 Line 27
   
 I286FN _reserved(void) {  I286FN _reserved(void) {
   
         I286_WORKCLOCK(23);                                                     // ToDo  
         INT_NUM(6, I286_IP - 1);          INT_NUM(6, I286_IP - 1);
 }  }
   
Line 149  I286FN _push_es(void) {       // 06: pus Line 147  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
Line 383  I286FN _push_ss(void) {       // 16: pus Line 384  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
 }  }
Line 506  I286FN _push_ds(void) {       // 1e: pus Line 510  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;
 }  }
   
Line 1660  I286FN _mov_seg_ea(void) {     // 8E: mo Line 1667  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 1680  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 1804  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 2103  I286FN _les_r16_ea(void) {     // C4: le Line 2112  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 2131  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 2233  I286FN _ret_far_data16(void) {    // CA: Line 2242  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 2250  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 2263  I286FN _int_data8(void) {     // CD: int
   
         UINT    vect;          UINT    vect;
   
         I286_WORKCLOCK(23);          I286_WORKCLOCK(3);
         GET_PCBYTE(vect)          GET_PCBYTE(vect)
   #if 0
           if ((vect == 0x42) && (CPU_AL != 6)) {
                   TRACEOUT(("%.4x:%.4x INT-42 AL=%.2x", CPU_CS, CPU_IP, CPU_AL));
           }
   #endif
   #if 0
           if (vect == 0x2f) {
                   TRACEOUT(("%.4x:%.4x INT-2f BX=%.4x/DX=%.4x", CPU_CS, CPU_IP, CPU_BX, CPU_DX));
           }
   #endif
   #if 1
           if (vect == 0xd2) {
                   TRACEOUT(("%.4x:%.4x INT-d2 AX=%.4x", CPU_CS, CPU_IP, CPU_AX));
           }
   #endif
   #if 0
           if (vect == 0x60) {
                   TRACEOUT(("%.4x:%.4x INT-60 AX=%.4x", CPU_CS, CPU_IP, CPU_AX));
           }
   #endif
   #if 0
           if (vect == 0xa0) {
                   TRACEOUT(("%.4x:%.4x INT-a0 AX=%.4x", CPU_CS, CPU_IP, CPU_AX));
           }
           if (vect == 0xa2) {
                   TRACEOUT(("%.4x:%.4x INT-a2", CPU_CS, CPU_IP));
           }
           if (vect == 0xa4) {
                   TRACEOUT(("%.4x:%.4x INT-a4", CPU_CS, CPU_IP));
           }
   #endif
   #if 0
           if (vect == 0x60) {
                   TRACEOUT(("%.4x:%.4x INT-60 AH=%.2x", CPU_CS, CPU_IP, CPU_AH));
                   if (CPU_AH == 1) {
                           TRACEOUT(("->%.4x:%.4x", CPU_ES, CPU_BX));
                   }
           }
   #endif
   #if 0
           if (vect == 0x40) {
                   TRACEOUT(("%.4x:%.4x INT-40 AH=%.2x", CPU_CS, CPU_IP, CPU_AH));
           }
           if (vect == 0x66) {
                   switch(CPU_AL) {
                           case 1:
                                   TRACEOUT(("%.4x:%.4x INT-66:01 play", CPU_CS, CPU_IP));
                                   break;
                           case 2:
                                   TRACEOUT(("%.4x:%.4x INT-66:02 stop", CPU_CS, CPU_IP));
                                   break;
                           case 9:
                                   TRACEOUT(("%.4x:%.4x INT-66:09 setdata AH=%.2x ES:BX=%.4x:%.4x DX=%.4x", CPU_CS, CPU_IP, CPU_AH, CPU_ES, CPU_BX, CPU_DX));
                                   break;
                           case 0x0d:
                                   TRACEOUT(("%.4x:%.4x INT-66:0d setdata ES:BX=%.4x:%.4x", CPU_CS, CPU_IP, CPU_ES, CPU_BX));
                                   break;
   
                           default:
                                   TRACEOUT(("%.4x:%.4x INT-66 AX=%.4x", CPU_CS, CPU_IP, CPU_AX));
                                   break;
                   }
           }
   #endif
   #if 0
           if (vect == 0x40) {
                   TRACEOUT(("%.4x:%.4x INT-40 AX=%.4x DS=%.4x DI=%.4x", CPU_CS, CPU_IP, CPU_AX, CPU_DS, CPU_DI));
           }
           if (vect == 0x41) {
                   TRACEOUT(("%.4x:%.4x INT-41 AX=%.4x DX=%.4x", CPU_CS, CPU_IP, CPU_AX, CPU_DX));
           }
   #endif
   #if 0
           if (vect == 0x41) {
                   TRACEOUT(("%.4x:%.4x INT-41 AX=%.4x %.4x:%.4x",
                                                           CPU_CS, CPU_IP, CPU_AX, CPU_DS, CPU_SI));
           }
           if (vect == 0x42) {
                   switch(CPU_AH) {
                           case 0xd3:
                           case 0xd0:
                                   break;
   
                           case 0xfd:
                           case 0xfc:
                           case 0xfa:
                           case 0xf8:
                           case 0xe3:
                                   TRACEOUT(("%.4x:%.4x INT-42 AX=%.4x %.4x:%.4x",
                                                           CPU_CS, CPU_IP, CPU_AX, CPU_BX, CPU_BP));
                                   break;
   
                           default:
                                   TRACEOUT(("%.4x:%.4x INT-42 AX=%.4x", CPU_CS, CPU_IP, CPU_AX));
                                   break;
                   }
           }
   #endif
   #if 0
           if (vect == 0x40) {
                   TRACEOUT(("%.4x:%.4x INT-40 SI=%.4x %.4x:%.4x:%.4x",
                                                                           CPU_CS, CPU_IP, CPU_SI,
                                                                           MEML_READ16(CPU_DS, CPU_SI + 0),
                                                                           MEML_READ16(CPU_DS, CPU_SI + 2),
                                                                           MEML_READ16(CPU_DS, CPU_SI + 4)));
           }
           if (vect == 0xd2) {
                   TRACEOUT(("%.4x:%.4x INT-D2 AX=%.4x", CPU_CS, CPU_IP, CPU_AX));
           }
   #endif
   #if 0
           if (vect == 0x40) {
                   TRACEOUT(("INT 40H - AL=%.2x", CPU_AL));
           }
   #endif
   #if defined(TRACE)
           if (vect == 0x21) {
                   char f[128];
                   UINT i;
                   char c;
                   switch(CPU_AH) {
                           case 0x3d:
                                   for (i=0; i<127; i++) {
                                           c = MEML_READ8(CPU_DS, CPU_DX + i);
                                           if (c == '\0') break;
                                           f[i] = c;
                                   }
                                   f[i] = 0;
                                   TRACEOUT(("DOS: %.4x:%.4x Open Handle AL=%.2x DS:DX=%.4x:%.4x[%s]", CPU_CS, CPU_IP, CPU_AL, CPU_DS, CPU_DX, f));
                                   break;
   
                           case 0x3f:
                                   TRACEOUT(("DOS: %.4x:%.4x Read Handle BX=%.4x DS:DX=%.4x:%.4x CX=%.4x", CPU_CS, CPU_IP, CPU_BX, CPU_DS, CPU_DX, CPU_CX));
                                   break;
   
                           case 0x42:
                                   TRACEOUT(("DOS: %.4x:%.4x Move File Pointer BX=%.4x CX:DX=%.4x:%.4x AL=%.2x", CPU_CS, CPU_IP, CPU_BX, CPU_CX, CPU_DX, CPU_AL));
                                   break;
                   }
           }
   #endif
   #if 0
           if (vect == 0xf5) {
                   TRACEOUT(("%.4x:%.4x INT-F5 AH=%.2x STACK=%.4x", CPU_CS, CPU_IP, 
                                                                   CPU_AH, MEML_READ16(CPU_SS, CPU_SP + 2)));
           }
   #endif
   #if 0
           if (vect == 0x69) {
                   TRACEOUT(("%.4x:%.4x INT-69 AX=%.4x", CPU_CS, CPU_IP, CPU_AX));
           }
   #endif
   #if 0
           if ((vect == 0x40) && (CPU_AX != 4)) {
                   TRACEOUT(("%.4x:%.4x INT-40 AX=%.4x", CPU_CS, CPU_IP, CPU_AX));
           }
   #endif
   #if 0
           if (vect == 0x7f) {
                   switch(CPU_AH) {
                           case 0:
                                   TRACEOUT(("INT-7F AH=00 Load data DS:DX = %.4x:%.4x", CPU_DS, CPU_DX));
                                   break;
   
                           case 1:
                                   TRACEOUT(("INT-7F AH=01 Play data AL=%.2x", CPU_AL));
                                   break;
   
                           case 2:
                                   TRACEOUT(("INT-7F AH=02 Stop Data"));
                                   break;
   
                           case 3:
                                   TRACEOUT(("INT-7F AH=03 Get Status"));
                                   break;
   
                           case 4:
                                   TRACEOUT(("INT-7F AH=04 Set Parameter AL=%.2x", CPU_AL));
                                   break;
                   }
           }
   #endif
   #if defined(TRACE)
           if (vect == 0x7f) {
                   UINT i, j;
                   switch(CPU_AH) {
                           case 0:
                                   TRACEOUT(("INT-7F AH=00 Load data DS:DX = %.4x:%.4x", CPU_DS, CPU_DX));
                                   for (i=0; i<16; i+=4) {
                                           char buf[256];
                                           for (j=0; j<4; j++) {
                                                   sprintf(buf + (j * 6), "0x%.2x, ",
                                                                                   MEML_READ8(CPU_DS, CPU_DX + i + j));
                                           }
                                           TRACEOUT(("%s", buf));
                                   }
                                   break;
   
                           case 1:
                                   TRACEOUT(("INT-7F AH=01 Play data AL=%.2x", CPU_AL));
                                   break;
   
                           case 2:
                                   TRACEOUT(("INT-7F AH=02 Stop Data"));
                                   break;
   
                           case 3:
   //                              TRACEOUT(("INT-7F AH=03 Get Status"));
                                   break;
   
                           case 4:
                                   TRACEOUT(("INT-7F AH=04 Set Parameter AL=%.2x", CPU_AL));
                                   break;
   
                           default:
                                   TRACEOUT(("INT-7F AH=%.2x", CPU_AH));
                                   break;
                   }
           }
   #endif
   #if 0 // defined(TRACE)
           if ((vect >= 0xa0) && (vect < 0xb0)) {
   extern void lio_look(UINT vect);
                   lio_look(vect);
           }
   #endif
         INT_NUM(vect, I286_IP);          INT_NUM(vect, I286_IP);
 }  }
   
Line 2263  I286FN _into(void) {      // CE: into Line 2498  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 2506  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 2513  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 2533  I286FN _jmp_far(void) {      // EA: jmp  Line 2767  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.36


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