|
|
| version 1.4, 2003/10/19 14:56:15 | version 1.9, 2003/11/29 00:36:00 |
|---|---|
| Line 1 | Line 1 |
| #include "compiler.h" | #include "compiler.h" |
| #include "i286.h" | #include "i286.h" |
| #include "i286c.h" | #include "i286c.h" |
| #include "i286c.mcr" | |
| #include "memory.h" | #include "memory.h" |
| #include "nevent.h" | #include "i286c.mcr" |
| I286_0F _sgdt(UINT op) { | I286_0F _sgdt(UINT op) { |
| UINT32 seg; | |
| UINT ad; | |
| I286_WORKCLOCK(11); | I286_WORKCLOCK(11); |
| if (op < 0xc0) { | if (op < 0xc0) { |
| UINT16 ad = c_get_ea[op](); | ad = GET_EA(op, &seg); |
| i286_memorywrite_w(ad + EA_FIX, i286reg.GDTR.limit); | i286_memorywrite_w(seg + ad, i286reg.GDTR.limit); |
| ad += 2; | i286_memorywrite_w(seg + LOW16(ad + 2), i286reg.GDTR.base); |
| i286_memorywrite_w(ad + EA_FIX, i286reg.GDTR.base); | i286_memorywrite_w(seg + LOW16(ad + 4), |
| ad += 2; | (REG16)(0xff00 + i286reg.GDTR.base24)); |
| i286_memorywrite_w(ad + EA_FIX, | |
| (UINT16)(0xff00 + i286reg.GDTR.base24)); | |
| } | } |
| else { | else { |
| INT_NUM(6, I286_IP - 2); | INT_NUM(6, I286_IP - 2); |
| Line 25 I286_0F _sgdt(UINT op) { | Line 25 I286_0F _sgdt(UINT op) { |
| I286_0F _sidt(UINT op) { | I286_0F _sidt(UINT op) { |
| UINT32 seg; | |
| UINT ad; | |
| I286_WORKCLOCK(12); | I286_WORKCLOCK(12); |
| if (op < 0xc0) { | if (op < 0xc0) { |
| UINT16 ad = c_get_ea[op](); | ad = GET_EA(op, &seg); |
| i286_memorywrite_w(ad + EA_FIX, i286reg.IDTR.limit); | i286_memorywrite_w(seg + ad, i286reg.IDTR.limit); |
| ad += 2; | i286_memorywrite_w(seg + LOW16(ad + 2), i286reg.IDTR.base); |
| i286_memorywrite_w(ad + EA_FIX, i286reg.IDTR.base); | i286_memorywrite_w(seg + LOW16(ad + 4), |
| ad += 2; | (REG16)(0xff00 + i286reg.IDTR.base24)); |
| i286_memorywrite_w(ad + EA_FIX, | |
| (UINT16)(0xff00 + i286reg.IDTR.base24)); | |
| } | } |
| else { | else { |
| INT_NUM(6, I286_IP - 2); | INT_NUM(6, I286_IP - 2); |
| Line 42 I286_0F _sidt(UINT op) { | Line 43 I286_0F _sidt(UINT op) { |
| I286_0F _lgdt(UINT op) { | I286_0F _lgdt(UINT op) { |
| UINT32 seg; | |
| UINT ad; | |
| I286_WORKCLOCK(11); | I286_WORKCLOCK(11); |
| if (op < 0xc0) { | if (op < 0xc0) { |
| UINT16 ad = c_get_ea[op](); | ad = GET_EA(op, &seg); |
| i286reg.GDTR.limit = i286_memoryread_w(ad + EA_FIX); | i286reg.GDTR.limit = i286_memoryread_w(seg + ad); |
| ad += 2; | i286reg.GDTR.base = i286_memoryread_w(seg + LOW16(ad + 2)); |
| i286reg.GDTR.base = i286_memoryread_w(ad + EA_FIX); | i286reg.GDTR.base24 = i286_memoryread(seg + LOW16(ad + 4)); |
| ad += 2; | i286reg.GDTR.reserved = i286_memoryread(seg + LOW16(ad + 5)); |
| i286reg.GDTR.base24 = i286_memoryread(ad + EA_FIX); | |
| ad++; | |
| i286reg.GDTR.reserved = i286_memoryread(ad + EA_FIX); | |
| } | } |
| else { | else { |
| INT_NUM(6, I286_IP - 2); | INT_NUM(6, I286_IP - 2); |
| Line 60 I286_0F _lgdt(UINT op) { | Line 61 I286_0F _lgdt(UINT op) { |
| I286_0F _lidt(UINT op) { | I286_0F _lidt(UINT op) { |
| UINT32 seg; | |
| UINT ad; | |
| I286_WORKCLOCK(11); | I286_WORKCLOCK(11); |
| if (op < 0xc0) { | if (op < 0xc0) { |
| UINT16 ad = c_get_ea[op](); | ad = GET_EA(op, &seg); |
| i286reg.IDTR.limit = i286_memoryread_w(ad + EA_FIX); | i286reg.IDTR.limit = i286_memoryread_w(seg + ad); |
| ad += 2; | i286reg.IDTR.base = i286_memoryread_w(seg + LOW16(ad + 2)); |
| i286reg.IDTR.base = i286_memoryread_w(ad + EA_FIX); | i286reg.IDTR.base24 = i286_memoryread(seg + LOW16(ad + 4)); |
| ad += 2; | i286reg.IDTR.reserved = i286_memoryread(seg + LOW16(ad + 5)); |
| i286reg.IDTR.base24 = i286_memoryread(ad + EA_FIX); | |
| ad++; | |
| i286reg.IDTR.reserved = i286_memoryread(ad + EA_FIX); | |
| } | } |
| else { | else { |
| INT_NUM(6, I286_IP - 2); | INT_NUM(6, I286_IP - 2); |
| Line 80 I286_0F _smsw(UINT op) { | Line 81 I286_0F _smsw(UINT op) { |
| if (op >= 0xc0) { | if (op >= 0xc0) { |
| I286_WORKCLOCK(3); | I286_WORKCLOCK(3); |
| *(reg16_b20[op]) = i286reg.MSW; | *(REG16_B20(op)) = i286reg.MSW; |
| } | } |
| else { | else { |
| I286_WORKCLOCK(6); | I286_WORKCLOCK(6); |
| i286_memorywrite_w(c_calc_ea_dst[op](), i286reg.MSW); | i286_memorywrite_w(CALC_EA(op), i286reg.MSW); |
| } | } |
| } | } |
| Line 92 I286_0F _lmsw(UINT op) { | Line 93 I286_0F _lmsw(UINT op) { |
| if (op >= 0xc0) { | if (op >= 0xc0) { |
| I286_WORKCLOCK(2); | I286_WORKCLOCK(2); |
| i286reg.MSW = *(reg16_b20[op]); | i286reg.MSW = *(REG16_B20(op)); |
| } | } |
| else { | else { |
| I286_WORKCLOCK(3); | I286_WORKCLOCK(3); |
| i286reg.MSW = i286_memoryread_w(c_calc_ea_dst[op]()); | i286reg.MSW = i286_memoryread_w(CALC_EA(op)); |
| } | } |
| } | } |