--- np2/i286c/i286c_0f.c 2003/10/16 17:57:43 1.1.1.1 +++ np2/i286c/i286c_0f.c 2003/12/12 01:04:40 1.12 @@ -1,100 +1,102 @@ #include "compiler.h" -#include "i286.h" +#include "cpucore.h" #include "i286c.h" #include "i286c.mcr" -#include "memory.h" -#include "nevent.h" -I286_0F _sgdt(DWORD op) { +I286_0F _sgdt(UINT op) { - I286_CLOCK(11) + UINT32 seg; + UINT ad; + + I286_WORKCLOCK(11); if (op < 0xc0) { - UINT16 ad = c_get_ea[op](); - i286_memorywrite_w(ad + EA_FIX, GDTR.limit); - ad += 2; - i286_memorywrite_w(ad + EA_FIX, GDTR.base); - ad += 2; - i286_memorywrite_w(ad + EA_FIX, (UINT16)(0xff00 + GDTR.base24)); + ad = GET_EA(op, &seg); + i286_memorywrite_w(seg + ad, I286_GDTR.limit); + i286_memorywrite_w(seg + LOW16(ad + 2), I286_GDTR.base); + i286_memorywrite_w(seg + LOW16(ad + 4), + (REG16)(0xff00 + I286_GDTR.base24)); } else { INT_NUM(6, I286_IP - 2); } } -I286_0F _sidt(DWORD op) { +I286_0F _sidt(UINT op) { + + UINT32 seg; + UINT ad; - I286_CLOCK(12) + I286_WORKCLOCK(12); if (op < 0xc0) { - UINT16 ad = c_get_ea[op](); - i286_memorywrite_w(ad + EA_FIX, IDTR.limit); - ad += 2; - i286_memorywrite_w(ad + EA_FIX, IDTR.base); - ad += 2; - i286_memorywrite_w(ad + EA_FIX, (UINT16)(0xff00 + IDTR.base24)); + ad = GET_EA(op, &seg); + i286_memorywrite_w(seg + ad, I286_IDTR.limit); + i286_memorywrite_w(seg + LOW16(ad + 2), I286_IDTR.base); + i286_memorywrite_w(seg + LOW16(ad + 4), + (REG16)(0xff00 + I286_IDTR.base24)); } else { INT_NUM(6, I286_IP - 2); } } -I286_0F _lgdt(DWORD op) { +I286_0F _lgdt(UINT op) { - I286_CLOCK(11) + UINT32 seg; + UINT ad; + + I286_WORKCLOCK(11); if (op < 0xc0) { - WORD ad = c_get_ea[op](); - GDTR.limit = i286_memoryread_w(ad + EA_FIX); - ad += 2; - GDTR.base = i286_memoryread_w(ad + EA_FIX); - ad += 2; - GDTR.base24 = i286_memoryread(ad + EA_FIX); - ad++; - GDTR.reserved = i286_memoryread(ad + EA_FIX); + ad = GET_EA(op, &seg); + I286_GDTR.limit = i286_memoryread_w(seg + ad); + I286_GDTR.base = i286_memoryread_w(seg + LOW16(ad + 2)); + I286_GDTR.base24 = i286_memoryread(seg + LOW16(ad + 4)); + I286_GDTR.reserved = i286_memoryread(seg + LOW16(ad + 5)); } else { INT_NUM(6, I286_IP - 2); } } -I286_0F _lidt(DWORD op) { +I286_0F _lidt(UINT op) { + + UINT32 seg; + UINT ad; - I286_CLOCK(11) + I286_WORKCLOCK(11); if (op < 0xc0) { - WORD ad = c_get_ea[op](); - IDTR.limit = i286_memoryread_w(ad + EA_FIX); - ad += 2; - IDTR.base = i286_memoryread_w(ad + EA_FIX); - ad += 2; - IDTR.base24 = i286_memoryread(ad + EA_FIX); - ad++; - IDTR.reserved = i286_memoryread(ad + EA_FIX); + ad = GET_EA(op, &seg); + I286_IDTR.limit = i286_memoryread_w(seg + ad); + I286_IDTR.base = i286_memoryread_w(seg + LOW16(ad + 2)); + I286_IDTR.base24 = i286_memoryread(seg + LOW16(ad + 4)); + I286_IDTR.reserved = i286_memoryread(seg + LOW16(ad + 5)); } else { INT_NUM(6, I286_IP - 2); } } -I286_0F _smsw(DWORD op) { +I286_0F _smsw(UINT op) { if (op >= 0xc0) { - I286_CLOCK(3) - *(reg16_b20[op]) = MSW; + I286_WORKCLOCK(3); + *(REG16_B20(op)) = I286_MSW; } else { - I286_CLOCK(6) - i286_memorywrite_w(c_calc_ea_dst[op](), MSW); + I286_WORKCLOCK(6); + i286_memorywrite_w(CALC_EA(op), I286_MSW); } } -I286_0F _lmsw(DWORD op) { +I286_0F _lmsw(UINT op) { if (op >= 0xc0) { - I286_CLOCK(2) - MSW = *(reg16_b20[op]); + I286_WORKCLOCK(2); + I286_MSW = *(REG16_B20(op)); } else { - I286_CLOCK(3) - MSW = i286_memoryread_w(c_calc_ea_dst[op]()); + I286_WORKCLOCK(3); + I286_MSW = i286_memoryread_w(CALC_EA(op)); } } @@ -109,8 +111,8 @@ I286_0F _loadall286(void) { UINT16 tmp; - I286_CLOCK(195); - MSW = LOADINTELWORD(mem + 0x804); + I286_WORKCLOCK(195); + I286_MSW = LOADINTELWORD(mem + 0x804); tmp = LOADINTELWORD(mem + 0x818); I286_OV = tmp & O_FLAG; I286_FLAG = tmp & (0xfff ^ O_FLAG); @@ -139,8 +141,9 @@ I286_0F _loadall286(void) { I286EXT i286c_cts(void) { - WORD ip; - DWORD op, op2; + UINT16 ip; + UINT op; + UINT op2; ip = I286_IP; GET_PCBYTE(op); @@ -153,7 +156,7 @@ I286EXT i286c_cts(void) { _loadall286(); } else { - I286_CLOCK(20) + I286_WORKCLOCK(20); INT_NUM(6, ip - 1); } }