41 Fast486OpcodeAddByteModrm,
42 Fast486OpcodeAddModrm,
43 Fast486OpcodeAddByteModrm,
44 Fast486OpcodeAddModrm,
49 Fast486OpcodeOrByteModrm,
51 Fast486OpcodeOrByteModrm,
56 Fast486OpcodeExtended,
57 Fast486OpcodeAdcByteModrm,
58 Fast486OpcodeAdcModrm,
59 Fast486OpcodeAdcByteModrm,
60 Fast486OpcodeAdcModrm,
65 Fast486OpcodeSbbByteModrm,
66 Fast486OpcodeSbbModrm,
67 Fast486OpcodeSbbByteModrm,
68 Fast486OpcodeSbbModrm,
73 Fast486OpcodeAndByteModrm,
74 Fast486OpcodeAndModrm,
75 Fast486OpcodeAndByteModrm,
76 Fast486OpcodeAndModrm,
81 Fast486OpcodeCmpSubByteModrm,
82 Fast486OpcodeCmpSubModrm,
83 Fast486OpcodeCmpSubByteModrm,
84 Fast486OpcodeCmpSubModrm,
85 Fast486OpcodeCmpSubAl,
86 Fast486OpcodeCmpSubEax,
89 Fast486OpcodeXorByteModrm,
90 Fast486OpcodeXorModrm,
91 Fast486OpcodeXorByteModrm,
92 Fast486OpcodeXorModrm,
97 Fast486OpcodeCmpSubByteModrm,
98 Fast486OpcodeCmpSubModrm,
99 Fast486OpcodeCmpSubByteModrm,
100 Fast486OpcodeCmpSubModrm,
101 Fast486OpcodeCmpSubAl,
102 Fast486OpcodeCmpSubEax,
105 Fast486OpcodeIncrement,
106 Fast486OpcodeIncrement,
107 Fast486OpcodeIncrement,
108 Fast486OpcodeIncrement,
109 Fast486OpcodeIncrement,
110 Fast486OpcodeIncrement,
111 Fast486OpcodeIncrement,
112 Fast486OpcodeIncrement,
113 Fast486OpcodeDecrement,
114 Fast486OpcodeDecrement,
115 Fast486OpcodeDecrement,
116 Fast486OpcodeDecrement,
117 Fast486OpcodeDecrement,
118 Fast486OpcodeDecrement,
119 Fast486OpcodeDecrement,
120 Fast486OpcodeDecrement,
121 Fast486OpcodePushReg,
122 Fast486OpcodePushReg,
123 Fast486OpcodePushReg,
124 Fast486OpcodePushReg,
125 Fast486OpcodePushReg,
126 Fast486OpcodePushReg,
127 Fast486OpcodePushReg,
128 Fast486OpcodePushReg,
137 Fast486OpcodePushAll,
145 Fast486OpcodePushImm,
146 Fast486OpcodeImulModrmImm,
147 Fast486OpcodePushByteImm,
148 Fast486OpcodeImulModrmImm,
153 Fast486OpcodeShortConditionalJmp,
154 Fast486OpcodeShortConditionalJmp,
155 Fast486OpcodeShortConditionalJmp,
156 Fast486OpcodeShortConditionalJmp,
157 Fast486OpcodeShortConditionalJmp,
158 Fast486OpcodeShortConditionalJmp,
159 Fast486OpcodeShortConditionalJmp,
160 Fast486OpcodeShortConditionalJmp,
161 Fast486OpcodeShortConditionalJmp,
162 Fast486OpcodeShortConditionalJmp,
163 Fast486OpcodeShortConditionalJmp,
164 Fast486OpcodeShortConditionalJmp,
165 Fast486OpcodeShortConditionalJmp,
166 Fast486OpcodeShortConditionalJmp,
167 Fast486OpcodeShortConditionalJmp,
168 Fast486OpcodeShortConditionalJmp,
169 Fast486OpcodeGroup8082,
170 Fast486OpcodeGroup81,
171 Fast486OpcodeGroup8082,
172 Fast486OpcodeGroup83,
173 Fast486OpcodeTestByteModrm,
174 Fast486OpcodeTestModrm,
175 Fast486OpcodeXchgByteModrm,
176 Fast486OpcodeXchgModrm,
177 Fast486OpcodeMovByteModrm,
178 Fast486OpcodeMovModrm,
179 Fast486OpcodeMovByteModrm,
180 Fast486OpcodeMovModrm,
181 Fast486OpcodeMovStoreSeg,
183 Fast486OpcodeMovLoadSeg,
184 Fast486OpcodeGroup8F,
186 Fast486OpcodeExchangeEax,
187 Fast486OpcodeExchangeEax,
188 Fast486OpcodeExchangeEax,
189 Fast486OpcodeExchangeEax,
190 Fast486OpcodeExchangeEax,
191 Fast486OpcodeExchangeEax,
192 Fast486OpcodeExchangeEax,
195 Fast486OpcodeCallAbs,
197 Fast486OpcodePushFlags,
198 Fast486OpcodePopFlags,
201 Fast486OpcodeMovAlOffset,
202 Fast486OpcodeMovEaxOffset,
203 Fast486OpcodeMovOffsetAl,
204 Fast486OpcodeMovOffsetEax,
210 Fast486OpcodeTestEax,
217 Fast486OpcodeMovByteRegImm,
218 Fast486OpcodeMovByteRegImm,
219 Fast486OpcodeMovByteRegImm,
220 Fast486OpcodeMovByteRegImm,
221 Fast486OpcodeMovByteRegImm,
222 Fast486OpcodeMovByteRegImm,
223 Fast486OpcodeMovByteRegImm,
224 Fast486OpcodeMovByteRegImm,
225 Fast486OpcodeMovRegImm,
226 Fast486OpcodeMovRegImm,
227 Fast486OpcodeMovRegImm,
228 Fast486OpcodeMovRegImm,
229 Fast486OpcodeMovRegImm,
230 Fast486OpcodeMovRegImm,
231 Fast486OpcodeMovRegImm,
232 Fast486OpcodeMovRegImm,
233 Fast486OpcodeGroupC0,
234 Fast486OpcodeGroupC1,
239 Fast486OpcodeGroupC6,
240 Fast486OpcodeGroupC7,
249 Fast486OpcodeGroupD0,
250 Fast486OpcodeGroupD1,
251 Fast486OpcodeGroupD2,
252 Fast486OpcodeGroupD3,
271 Fast486OpcodeOutByte,
276 Fast486OpcodeShortJump,
279 Fast486OpcodeOutByte,
282 Fast486OpcodeInvalid,
286 Fast486OpcodeComplCarry,
287 Fast486OpcodeGroupF6,
288 Fast486OpcodeGroupF7,
289 Fast486OpcodeClearCarry,
290 Fast486OpcodeSetCarry,
291 Fast486OpcodeClearInt,
293 Fast486OpcodeClearDir,
295 Fast486OpcodeGroupFE,
296 Fast486OpcodeGroupFF,
308 DPRINT1(
"FAST486 -- Calling ICEBP opcode\n");
309 Fast486Exception(
State, FAST486_EXCEPTION_UD);
320 State->SegmentOverride = FAST486_REG_ES;
328 State->SegmentOverride = FAST486_REG_CS;
336 State->SegmentOverride = FAST486_REG_SS;
344 State->SegmentOverride = FAST486_REG_DS;
352 State->SegmentOverride = FAST486_REG_FS;
360 State->SegmentOverride = FAST486_REG_GS;
390 State->PrefixFlags &= ~FAST486_PREFIX_REP;
399 State->PrefixFlags &= ~FAST486_PREFIX_REPNZ;
524 State->GeneralRegs[Reg].Long =
State->GeneralRegs[FAST486_REG_EAX].Long;
525 State->GeneralRegs[FAST486_REG_EAX].Long =
Value;
532 State->GeneralRegs[Reg].LowWord =
State->GeneralRegs[FAST486_REG_EAX].LowWord;
533 State->GeneralRegs[FAST486_REG_EAX].LowWord =
Value;
555 switch ((
Opcode & 0x0F) >> 1)
560 Jump =
State->Flags.Of;
567 Jump =
State->Flags.Cf;
574 Jump =
State->Flags.Zf;
588 Jump =
State->Flags.Sf;
595 Jump =
State->Flags.Pf;
628 State->InstPtr.Long &= 0xFFFF;
678 if (
State->Flags.Iopl >= Fast486GetCurrentPrivLevel(
State))
686 Fast486Exception(
State, FAST486_EXCEPTION_GP);
708 if (
State->Flags.Iopl >= Fast486GetCurrentPrivLevel(
State))
716 Fast486Exception(
State, FAST486_EXCEPTION_GP);
757 if (Fast486GetCurrentPrivLevel(
State) != 0)
759 Fast486Exception(
State, FAST486_EXCEPTION_GP);
790 Port =
State->GeneralRegs[FAST486_REG_EDX].LowWord;
793 if (!Fast486IoPrivilegeCheck(
State,
Port))
return;
799 State->GeneralRegs[FAST486_REG_EAX].LowByte =
Data;
830 Port =
State->GeneralRegs[FAST486_REG_EDX].LowWord;
833 if (!Fast486IoPrivilegeCheck(
State,
Port))
return;
843 State->GeneralRegs[FAST486_REG_EAX].Long =
Data;
853 State->GeneralRegs[FAST486_REG_EAX].LowWord =
Data;
880 Port =
State->GeneralRegs[FAST486_REG_EDX].LowWord;
883 if (!Fast486IoPrivilegeCheck(
State,
Port))
return;
886 Data =
State->GeneralRegs[FAST486_REG_EAX].LowByte;
920 Port =
State->GeneralRegs[FAST486_REG_EDX].LowWord;
923 if (!Fast486IoPrivilegeCheck(
State,
Port))
return;
966 State->InstPtr.Long &= 0xFFFF;
1042 BOOLEAN AddressSize =
State->SegmentRegs[FAST486_REG_CS].Size;
1050 if (!Fast486ParseModRegRm(
State, AddressSize, &ModRegRm))
1056 if (!Fast486ReadModrmByteOperands(
State,
1066 Result = FirstValue + SecondValue;
1072 State->Flags.Af = ((((FirstValue & 0x0F) + (SecondValue & 0x0F)) & 0x10) != 0);
1078 Fast486WriteModrmByteOperands(
State,
1087 BOOLEAN OperandSize, AddressSize;
1092 OperandSize = AddressSize =
State->SegmentRegs[FAST486_REG_CS].Size;
1098 if (!Fast486ParseModRegRm(
State, AddressSize, &ModRegRm))
1109 if (!Fast486ReadModrmDwordOperands(
State,
1119 Result = FirstValue + SecondValue;
1125 State->Flags.Af = ((((FirstValue & 0x0F) + (SecondValue & 0x0F)) & 0x10) != 0);
1131 Fast486WriteModrmDwordOperands(
State,
1140 if (!Fast486ReadModrmWordOperands(
State,
1150 Result = FirstValue + SecondValue;
1156 State->Flags.Af = ((((FirstValue & 0x0F) + (SecondValue & 0x0F)) & 0x10) != 0);
1162 Fast486WriteModrmWordOperands(
State,
1171 UCHAR FirstValue =
State->GeneralRegs[FAST486_REG_EAX].LowByte;
1179 if (!Fast486FetchByte(
State, &SecondValue))
1186 Result = FirstValue + SecondValue;
1192 State->Flags.Af = ((((FirstValue & 0x0F) + (SecondValue & 0x0F)) & 0x10) != 0);
1198 State->GeneralRegs[FAST486_REG_EAX].LowByte =
Result;
1213 ULONG FirstValue =
State->GeneralRegs[FAST486_REG_EAX].Long;
1216 if (!Fast486FetchDword(
State, &SecondValue))
1223 Result = FirstValue + SecondValue;
1229 State->Flags.Af = ((((FirstValue & 0x0F) + (SecondValue & 0x0F)) & 0x10) != 0);
1235 State->GeneralRegs[FAST486_REG_EAX].Long =
Result;
1239 USHORT FirstValue =
State->GeneralRegs[FAST486_REG_EAX].LowWord;
1242 if (!Fast486FetchWord(
State, &SecondValue))
1249 Result = FirstValue + SecondValue;
1255 State->Flags.Af = ((((FirstValue & 0x0F) + (SecondValue & 0x0F)) & 0x10) != 0);
1261 State->GeneralRegs[FAST486_REG_EAX].LowWord =
Result;
1269 BOOLEAN AddressSize =
State->SegmentRegs[FAST486_REG_CS].Size;
1277 if (!Fast486ParseModRegRm(
State, AddressSize, &ModRegRm))
1283 if (!Fast486ReadModrmByteOperands(
State,
1293 Result = FirstValue | SecondValue;
1303 Fast486WriteModrmByteOperands(
State,
1312 BOOLEAN OperandSize, AddressSize;
1317 OperandSize = AddressSize =
State->SegmentRegs[FAST486_REG_CS].Size;
1323 if (!Fast486ParseModRegRm(
State, AddressSize, &ModRegRm))
1334 if (!Fast486ReadModrmDwordOperands(
State,
1344 Result = FirstValue | SecondValue;
1354 Fast486WriteModrmDwordOperands(
State,
1363 if (!Fast486ReadModrmWordOperands(
State,
1373 Result = FirstValue | SecondValue;
1383 Fast486WriteModrmWordOperands(
State,
1392 UCHAR FirstValue =
State->GeneralRegs[FAST486_REG_EAX].LowByte;
1400 if (!Fast486FetchByte(
State, &SecondValue))
1407 Result = FirstValue | SecondValue;
1417 State->GeneralRegs[FAST486_REG_EAX].LowByte =
Result;
1432 ULONG FirstValue =
State->GeneralRegs[FAST486_REG_EAX].Long;
1435 if (!Fast486FetchDword(
State, &SecondValue))
1442 Result = FirstValue | SecondValue;
1452 State->GeneralRegs[FAST486_REG_EAX].Long =
Result;
1456 USHORT FirstValue =
State->GeneralRegs[FAST486_REG_EAX].LowWord;
1459 if (!Fast486FetchWord(
State, &SecondValue))
1466 Result = FirstValue | SecondValue;
1476 State->GeneralRegs[FAST486_REG_EAX].LowWord =
Result;
1484 BOOLEAN AddressSize =
State->SegmentRegs[FAST486_REG_CS].Size;
1492 if (!Fast486ParseModRegRm(
State, AddressSize, &ModRegRm))
1498 if (!Fast486ReadModrmByteOperands(
State,
1508 Result = FirstValue & SecondValue;
1518 Fast486WriteModrmByteOperands(
State,
1527 BOOLEAN OperandSize, AddressSize;
1532 OperandSize = AddressSize =
State->SegmentRegs[FAST486_REG_CS].Size;
1538 if (!Fast486ParseModRegRm(
State, AddressSize, &ModRegRm))
1549 if (!Fast486ReadModrmDwordOperands(
State,
1559 Result = FirstValue & SecondValue;
1569 Fast486WriteModrmDwordOperands(
State,
1578 if (!Fast486ReadModrmWordOperands(
State,
1588 Result = FirstValue & SecondValue;
1598 Fast486WriteModrmWordOperands(
State,
1607 UCHAR FirstValue =
State->GeneralRegs[FAST486_REG_EAX].LowByte;
1615 if (!Fast486FetchByte(
State, &SecondValue))
1622 Result = FirstValue & SecondValue;
1632 State->GeneralRegs[FAST486_REG_EAX].LowByte =
Result;
1647 ULONG FirstValue =
State->GeneralRegs[FAST486_REG_EAX].Long;
1650 if (!Fast486FetchDword(
State, &SecondValue))
1657 Result = FirstValue & SecondValue;
1667 State->GeneralRegs[FAST486_REG_EAX].Long =
Result;
1671 USHORT FirstValue =
State->GeneralRegs[FAST486_REG_EAX].LowWord;
1674 if (!Fast486FetchWord(
State, &SecondValue))
1681 Result = FirstValue & SecondValue;
1691 State->GeneralRegs[FAST486_REG_EAX].LowWord =
Result;
1699 BOOLEAN AddressSize =
State->SegmentRegs[FAST486_REG_CS].Size;
1707 if (!Fast486ParseModRegRm(
State, AddressSize, &ModRegRm))
1713 if (!Fast486ReadModrmByteOperands(
State,
1723 Result = FirstValue ^ SecondValue;
1733 Fast486WriteModrmByteOperands(
State,
1742 BOOLEAN OperandSize, AddressSize;
1747 OperandSize = AddressSize =
State->SegmentRegs[FAST486_REG_CS].Size;
1753 if (!Fast486ParseModRegRm(
State, AddressSize, &ModRegRm))
1764 if (!Fast486ReadModrmDwordOperands(
State,
1774 Result = FirstValue ^ SecondValue;
1784 Fast486WriteModrmDwordOperands(
State,
1793 if (!Fast486ReadModrmWordOperands(
State,
1803 Result = FirstValue ^ SecondValue;
1813 Fast486WriteModrmWordOperands(
State,
1822 UCHAR FirstValue =
State->GeneralRegs[FAST486_REG_EAX].LowByte;
1830 if (!Fast486FetchByte(
State, &SecondValue))
1837 Result = FirstValue ^ SecondValue;
1847 State->GeneralRegs[FAST486_REG_EAX].LowByte =
Result;
1862 ULONG FirstValue =
State->GeneralRegs[FAST486_REG_EAX].Long;
1865 if (!Fast486FetchDword(
State, &SecondValue))
1872 Result = FirstValue ^ SecondValue;
1882 State->GeneralRegs[FAST486_REG_EAX].Long =
Result;
1886 USHORT FirstValue =
State->GeneralRegs[FAST486_REG_EAX].LowWord;
1889 if (!Fast486FetchWord(
State, &SecondValue))
1896 Result = FirstValue ^ SecondValue;
1906 State->GeneralRegs[FAST486_REG_EAX].LowWord =
Result;
1914 BOOLEAN AddressSize =
State->SegmentRegs[FAST486_REG_CS].Size;
1922 if (!Fast486ParseModRegRm(
State, AddressSize, &ModRegRm))
1928 if (!Fast486ReadModrmByteOperands(
State,
1937 Result = FirstValue & SecondValue;
1950 BOOLEAN OperandSize, AddressSize;
1955 OperandSize = AddressSize =
State->SegmentRegs[FAST486_REG_CS].Size;
1961 if (!Fast486ParseModRegRm(
State, AddressSize, &ModRegRm))
1972 if (!Fast486ReadModrmDwordOperands(
State,
1982 Result = FirstValue & SecondValue;
1995 if (!Fast486ReadModrmWordOperands(
State,
2005 Result = FirstValue & SecondValue;
2018 UCHAR FirstValue =
State->GeneralRegs[FAST486_REG_EAX].LowByte;
2026 if (!Fast486FetchByte(
State, &SecondValue))
2033 Result = FirstValue & SecondValue;
2055 ULONG FirstValue =
State->GeneralRegs[FAST486_REG_EAX].Long;
2058 if (!Fast486FetchDword(
State, &SecondValue))
2065 Result = FirstValue & SecondValue;
2076 USHORT FirstValue =
State->GeneralRegs[FAST486_REG_EAX].LowWord;
2079 if (!Fast486FetchWord(
State, &SecondValue))
2086 Result = FirstValue & SecondValue;
2099 UCHAR FirstValue, SecondValue;
2101 BOOLEAN AddressSize =
State->SegmentRegs[FAST486_REG_CS].Size;
2109 if (!Fast486ParseModRegRm(
State, AddressSize, &ModRegRm))
2115 if (!Fast486ReadModrmByteOperands(
State,
2125 if (!Fast486WriteModrmByteOperands(
State,
2135 Fast486WriteModrmByteOperands(
State,
2144 BOOLEAN OperandSize, AddressSize;
2149 OperandSize = AddressSize =
State->SegmentRegs[FAST486_REG_CS].Size;
2155 if (!Fast486ParseModRegRm(
State, AddressSize, &ModRegRm))
2164 ULONG FirstValue, SecondValue;
2166 if (!Fast486ReadModrmDwordOperands(
State,
2176 if (!Fast486WriteModrmDwordOperands(
State,
2186 Fast486WriteModrmDwordOperands(
State,
2193 USHORT FirstValue, SecondValue;
2195 if (!Fast486ReadModrmWordOperands(
State,
2205 if (!Fast486WriteModrmWordOperands(
State,
2215 Fast486WriteModrmWordOperands(
State,
2225 Fast486StackPush(
State,
State->SegmentRegs[FAST486_REG_ES].Selector);
2232 if (!Fast486StackPop(
State, &NewSelector))
2239 Fast486LoadSegment(
State, FAST486_REG_ES,
LOWORD(NewSelector));
2245 Fast486StackPush(
State,
State->SegmentRegs[FAST486_REG_CS].Selector);
2252 BOOLEAN AddressSize =
State->SegmentRegs[FAST486_REG_CS].Size;
2260 if (!Fast486ParseModRegRm(
State, AddressSize, &ModRegRm))
2266 if (!Fast486ReadModrmByteOperands(
State,
2276 Result = FirstValue + SecondValue +
State->Flags.Cf;
2280 && ((FirstValue == 0xFF) || (SecondValue == 0xFF));
2286 State->Flags.Af = ((FirstValue ^ SecondValue ^
Result) & 0x10) != 0;
2292 Fast486WriteModrmByteOperands(
State,
2301 BOOLEAN OperandSize, AddressSize;
2306 OperandSize = AddressSize =
State->SegmentRegs[FAST486_REG_CS].Size;
2312 if (!Fast486ParseModRegRm(
State, AddressSize, &ModRegRm))
2323 if (!Fast486ReadModrmDwordOperands(
State,
2333 Result = FirstValue + SecondValue +
State->Flags.Cf;
2337 && ((FirstValue == 0xFFFFFFFF) || (SecondValue == 0xFFFFFFFF));
2343 State->Flags.Af = ((FirstValue ^ SecondValue ^
Result) & 0x10) != 0;
2349 Fast486WriteModrmDwordOperands(
State,
2358 if (!Fast486ReadModrmWordOperands(
State,
2368 Result = FirstValue + SecondValue +
State->Flags.Cf;
2372 && ((FirstValue == 0xFFFF) || (SecondValue == 0xFFFF));
2378 State->Flags.Af = ((FirstValue ^ SecondValue ^
Result) & 0x10) != 0;
2384 Fast486WriteModrmWordOperands(
State,
2394 UCHAR FirstValue =
State->GeneralRegs[FAST486_REG_EAX].LowByte;
2402 if (!Fast486FetchByte(
State, &SecondValue))
2409 Result = FirstValue + SecondValue +
State->Flags.Cf;
2413 ((FirstValue == 0xFF) || (SecondValue == 0xFF));
2419 State->Flags.Af = ((FirstValue ^ SecondValue ^
Result) & 0x10) != 0;
2425 State->GeneralRegs[FAST486_REG_EAX].LowByte =
Result;
2440 ULONG FirstValue =
State->GeneralRegs[FAST486_REG_EAX].Long;
2443 if (!Fast486FetchDword(
State, &SecondValue))
2450 Result = FirstValue + SecondValue +
State->Flags.Cf;
2454 ((FirstValue == 0xFFFFFFFF) || (SecondValue == 0xFFFFFFFF));
2460 State->Flags.Af = ((FirstValue ^ SecondValue ^
Result) & 0x10) != 0;
2466 State->GeneralRegs[FAST486_REG_EAX].Long =
Result;
2470 USHORT FirstValue =
State->GeneralRegs[FAST486_REG_EAX].LowWord;
2473 if (!Fast486FetchWord(
State, &SecondValue))
2480 Result = FirstValue + SecondValue +
State->Flags.Cf;
2484 ((FirstValue == 0xFFFF) || (SecondValue == 0xFFFF));
2490 State->Flags.Af = ((FirstValue ^ SecondValue ^
Result) & 0x10) != 0;
2496 State->GeneralRegs[FAST486_REG_EAX].LowWord =
Result;
2503 Fast486StackPush(
State,
State->SegmentRegs[FAST486_REG_SS].Selector);
2510 if (!Fast486StackPop(
State, &NewSelector))
2517 if (Fast486LoadSegment(
State, FAST486_REG_SS,
LOWORD(NewSelector)))
2528 BOOLEAN AddressSize =
State->SegmentRegs[FAST486_REG_CS].Size;
2529 INT Carry =
State->Flags.Cf ? 1 : 0;
2537 if (!Fast486ParseModRegRm(
State, AddressSize, &ModRegRm))
2543 if (!Fast486ReadModrmByteOperands(
State,
2556 SWAP(FirstValue, SecondValue);
2560 Result = FirstValue - SecondValue - Carry;
2563 State->Flags.Cf = Carry ? (FirstValue <= SecondValue) : (FirstValue < SecondValue);
2566 State->Flags.Af = ((FirstValue ^ SecondValue ^
Result) & 0x10) != 0;
2572 Fast486WriteModrmByteOperands(
State,
2581 BOOLEAN OperandSize, AddressSize;
2582 INT Carry =
State->Flags.Cf ? 1 : 0;
2587 OperandSize = AddressSize =
State->SegmentRegs[FAST486_REG_CS].Size;
2593 if (!Fast486ParseModRegRm(
State, AddressSize, &ModRegRm))
2604 if (!Fast486ReadModrmDwordOperands(
State,
2617 SWAP(FirstValue, SecondValue);
2621 Result = FirstValue - SecondValue - Carry;
2624 State->Flags.Cf = Carry ? (FirstValue <= SecondValue) : (FirstValue < SecondValue);
2627 State->Flags.Af = ((FirstValue ^ SecondValue ^
Result) & 0x10) != 0;
2633 Fast486WriteModrmDwordOperands(
State,
2642 if (!Fast486ReadModrmWordOperands(
State,
2655 SWAP(FirstValue, SecondValue);
2659 Result = FirstValue - SecondValue - Carry;
2662 State->Flags.Cf = Carry ? (FirstValue <= SecondValue) : (FirstValue < SecondValue);
2665 State->Flags.Af = ((FirstValue ^ SecondValue ^
Result) & 0x10) != 0;
2671 Fast486WriteModrmWordOperands(
State,
2680 UCHAR FirstValue =
State->GeneralRegs[FAST486_REG_EAX].LowByte;
2682 INT Carry =
State->Flags.Cf ? 1 : 0;
2689 if (!Fast486FetchByte(
State, &SecondValue))
2696 Result = FirstValue - SecondValue - Carry;
2699 State->Flags.Cf = Carry ? (FirstValue <= SecondValue) : (FirstValue < SecondValue);
2702 State->Flags.Af = ((FirstValue ^ SecondValue ^
Result) & 0x10) != 0;
2708 State->GeneralRegs[FAST486_REG_EAX].LowByte =
Result;
2714 INT Carry =
State->Flags.Cf ? 1 : 0;
2724 ULONG FirstValue =
State->GeneralRegs[FAST486_REG_EAX].Long;
2727 if (!Fast486FetchDword(
State, &SecondValue))
2734 Result = FirstValue - SecondValue - Carry;
2737 State->Flags.Cf = Carry ? (FirstValue <= SecondValue) : (FirstValue < SecondValue);
2740 State->Flags.Af = ((FirstValue ^ SecondValue ^
Result) & 0x10) != 0;
2746 State->GeneralRegs[FAST486_REG_EAX].Long =
Result;
2750 USHORT FirstValue =
State->GeneralRegs[FAST486_REG_EAX].LowWord;
2753 if (!Fast486FetchWord(
State, &SecondValue))
2760 Result = FirstValue - SecondValue - Carry;
2763 State->Flags.Cf = Carry ? (FirstValue <= SecondValue) : (FirstValue < SecondValue);
2766 State->Flags.Af = ((FirstValue ^ SecondValue ^
Result) & 0x10) != 0;
2772 State->GeneralRegs[FAST486_REG_EAX].LowWord =
Result;
2779 Fast486StackPush(
State,
State->SegmentRegs[FAST486_REG_DS].Selector);
2786 if (!Fast486StackPop(
State, &NewSelector))
2793 Fast486LoadSegment(
State, FAST486_REG_DS,
LOWORD(NewSelector));
2808 State->GeneralRegs[FAST486_REG_EAX].LowByte += 0x06;
2809 if (
State->GeneralRegs[FAST486_REG_EAX].LowByte < 0x06)
2820 if ((
Value > 0x99) || Carry)
2823 State->GeneralRegs[FAST486_REG_EAX].LowByte += 0x60;
2829 Value =
State->GeneralRegs[FAST486_REG_EAX].LowByte;
2834 State->Flags.Pf = Fast486CalculateParity(
Value);
2841 BOOLEAN AddressSize =
State->SegmentRegs[FAST486_REG_CS].Size;
2849 if (!Fast486ParseModRegRm(
State, AddressSize, &ModRegRm))
2855 if (!Fast486ReadModrmByteOperands(
State,
2868 SWAP(FirstValue, SecondValue);
2872 Result = FirstValue - SecondValue;
2875 State->Flags.Cf = (FirstValue < SecondValue);
2878 State->Flags.Af = (FirstValue & 0x0F) < (SecondValue & 0x0F);
2887 Fast486WriteModrmByteOperands(
State,
2897 BOOLEAN OperandSize, AddressSize;
2902 OperandSize = AddressSize =
State->SegmentRegs[FAST486_REG_CS].Size;
2908 if (!Fast486ParseModRegRm(
State, AddressSize, &ModRegRm))
2919 if (!Fast486ReadModrmDwordOperands(
State,
2932 SWAP(FirstValue, SecondValue);
2936 Result = FirstValue - SecondValue;
2939 State->Flags.Cf = (FirstValue < SecondValue);
2942 State->Flags.Af = (FirstValue & 0x0F) < (SecondValue & 0x0F);
2951 Fast486WriteModrmDwordOperands(
State,
2961 if (!Fast486ReadModrmWordOperands(
State,
2974 SWAP(FirstValue, SecondValue);
2978 Result = FirstValue - SecondValue;
2981 State->Flags.Cf = (FirstValue < SecondValue);
2984 State->Flags.Af = (FirstValue & 0x0F) < (SecondValue & 0x0F);
2993 Fast486WriteModrmWordOperands(
State,
3003 UCHAR FirstValue =
State->GeneralRegs[FAST486_REG_EAX].LowByte;
3011 if (!Fast486FetchByte(
State, &SecondValue))
3018 Result = FirstValue - SecondValue;
3021 State->Flags.Cf = (FirstValue < SecondValue);
3024 State->Flags.Af = (FirstValue & 0x0F) < (SecondValue & 0x0F);
3033 State->GeneralRegs[FAST486_REG_EAX].LowByte =
Result;
3049 ULONG FirstValue =
State->GeneralRegs[FAST486_REG_EAX].Long;
3052 if (!Fast486FetchDword(
State, &SecondValue))
3059 Result = FirstValue - SecondValue;
3062 State->Flags.Cf = (FirstValue < SecondValue);
3065 State->Flags.Af = (FirstValue & 0x0F) < (SecondValue & 0x0F);
3074 State->GeneralRegs[FAST486_REG_EAX].Long =
Result;
3079 USHORT FirstValue =
State->GeneralRegs[FAST486_REG_EAX].LowWord;
3082 if (!Fast486FetchWord(
State, &SecondValue))
3089 Result = FirstValue - SecondValue;
3092 State->Flags.Cf = (FirstValue < SecondValue);
3095 State->Flags.Af = (FirstValue & 0x0F) < (SecondValue & 0x0F);
3104 State->GeneralRegs[FAST486_REG_EAX].LowWord =
Result;
3121 State->GeneralRegs[FAST486_REG_EAX].LowByte -= 0x06;
3122 if (
State->GeneralRegs[FAST486_REG_EAX].LowByte > 0xFB)
3133 if ((
Value > 0x99) || Carry)
3136 State->GeneralRegs[FAST486_REG_EAX].LowByte -= 0x60;
3142 Value =
State->GeneralRegs[FAST486_REG_EAX].LowByte;
3147 State->Flags.Pf = Fast486CalculateParity(
Value);
3161 State->GeneralRegs[FAST486_REG_EAX].LowWord += 0x06;
3162 State->GeneralRegs[FAST486_REG_EAX].HighByte++;
3174 State->GeneralRegs[FAST486_REG_EAX].LowByte &= 0x0F;
3188 State->GeneralRegs[FAST486_REG_EAX].LowWord -= 0x06;
3189 State->GeneralRegs[FAST486_REG_EAX].HighByte--;
3201 State->GeneralRegs[FAST486_REG_EAX].LowByte &= 0x0F;
3208 FAST486_REG SavedEsp =
State->GeneralRegs[FAST486_REG_ESP];
3219 if (
i == FAST486_REG_ESP)
3222 if (!Fast486StackPush(
State,
Size ? SavedEsp.Long : SavedEsp.LowWord))
3232 :
State->GeneralRegs[
i].LowWord))
3264 if (
i != FAST486_REG_ESP)
3274 BOOLEAN OperandSize, AddressSize;
3276 FAST486_SEG_REGS
Segment = FAST486_REG_DS;
3278 OperandSize = AddressSize =
State->SegmentRegs[FAST486_REG_CS].Size;
3284 if (!Fast486ParseModRegRm(
State, AddressSize, &ModRegRm))
3293 Fast486Exception(
State, FAST486_EXCEPTION_UD);
3309 if (!Fast486ReadModrmDwordOperands(
State,
3329 if ((
Index < LowerBound) || (
Index > UpperBound))
3332 Fast486Exception(
State, FAST486_EXCEPTION_BR);
3340 if (!Fast486ReadModrmWordOperands(
State,
3360 if ((
Index < LowerBound) || (
Index > UpperBound))
3363 Fast486Exception(
State, FAST486_EXCEPTION_BR);
3370 USHORT FirstValue, SecondValue;
3372 BOOLEAN AddressSize =
State->SegmentRegs[FAST486_REG_CS].Size;
3379 Fast486Exception(
State, FAST486_EXCEPTION_UD);
3386 if (!Fast486ParseModRegRm(
State, AddressSize, &ModRegRm))
3393 if (!Fast486ReadModrmWordOperands(
State,
3403 if ((SecondValue & 3) < (FirstValue & 3))
3407 SecondValue |= FirstValue & 3;
3413 Fast486WriteModrmWordOperands(
State, &ModRegRm,
FALSE, SecondValue);
3462 BOOLEAN OperandSize, AddressSize;
3469 OperandSize = AddressSize =
State->SegmentRegs[FAST486_REG_CS].Size;
3475 if (!Fast486ParseModRegRm(
State, AddressSize, &ModRegRm))
3520 Multiplier = (
LONG)Word;
3526 LONG RegValue, Multiplicand;
3530 if (!Fast486ReadModrmDwordOperands(
State,
3547 Fast486WriteModrmDwordOperands(
State,
3554 SHORT RegValue, Multiplicand;
3558 if (!Fast486ReadModrmWordOperands(
State,
3568 Product = (
LONG)Multiplicand * (
LONG)Multiplier;
3575 Fast486WriteModrmWordOperands(
State,
3603 BOOLEAN AddressSize =
State->SegmentRegs[FAST486_REG_CS].Size;
3611 if (!Fast486ParseModRegRm(
State, AddressSize, &ModRegRm))
3635 Fast486WriteModrmByteOperands(
State,
3644 BOOLEAN OperandSize, AddressSize;
3649 OperandSize = AddressSize =
State->SegmentRegs[FAST486_REG_CS].Size;
3655 if (!Fast486ParseModRegRm(
State, AddressSize, &ModRegRm))
3686 Fast486WriteModrmDwordOperands(
State,
3713 Fast486WriteModrmWordOperands(
State,
3722 BOOLEAN OperandSize, AddressSize;
3728 OperandSize = AddressSize =
State->SegmentRegs[FAST486_REG_CS].Size;
3734 if (!Fast486ParseModRegRm(
State, AddressSize, &ModRegRm))
3743 Fast486Exception(
State, FAST486_EXCEPTION_UD);
3748 if (OperandSize && !ModRegRm.
Memory)
3750 Fast486WriteModrmDwordOperands(
State,
3757 Fast486WriteModrmWordOperands(
State,
3767 BOOLEAN OperandSize, AddressSize;
3772 OperandSize = AddressSize =
State->SegmentRegs[FAST486_REG_CS].Size;
3778 if (!Fast486ParseModRegRm(
State, AddressSize, &ModRegRm))
3788 Fast486Exception(
State, FAST486_EXCEPTION_UD);
3795 Fast486WriteModrmDwordOperands(
State,
3802 Fast486WriteModrmWordOperands(
State,
3812 BOOLEAN AddressSize =
State->SegmentRegs[FAST486_REG_CS].Size;
3822 if (!Fast486ParseModRegRm(
State, AddressSize, &ModRegRm))
3829 || ((FAST486_SEG_REGS)ModRegRm.
Register == FAST486_REG_CS))
3832 Fast486Exception(
State, FAST486_EXCEPTION_UD);
3836 if (!Fast486ReadModrmWordOperands(
State, &ModRegRm,
NULL, &Selector))
3842 if (!Fast486LoadSegment(
State, ModRegRm.
Register, Selector))
3870 State->GeneralRegs[FAST486_REG_EAX].LowWord,
3878 State->GeneralRegs[FAST486_REG_EAX].HighByte =
3897 State->GeneralRegs[FAST486_REG_EDX].Long =
3899 ? 0xFFFFFFFF : 0x00000000;
3904 State->GeneralRegs[FAST486_REG_EDX].LowWord =
3957 if (!Fast486StackPush(
State,
State->SegmentRegs[FAST486_REG_CS].Selector))
3964 if (!Fast486StackPush(
State,
State->InstPtr.Long))
3971 if (!Fast486LoadSegment(
State, FAST486_REG_CS,
Segment))
3984#ifndef FAST486_NO_FPU
3985 Fast486FpuExceptionCheck(
State);
3997 if (
State->Flags.Vm && (
State->Flags.Iopl != 3))
4012 UINT Cpl = Fast486GetCurrentPrivLevel(
State);
4013 FAST486_FLAGS_REG NewFlags;
4019 if (!Fast486StackPop(
State, &NewFlags.Long))
4026 if (
State->Flags.Vm && (
State->Flags.Iopl != 3))
4033 State->Flags.Cf = NewFlags.Cf;
4034 State->Flags.Pf = NewFlags.Pf;
4035 State->Flags.Af = NewFlags.Af;
4036 State->Flags.Zf = NewFlags.Zf;
4037 State->Flags.Sf = NewFlags.Sf;
4038 State->Flags.Tf = NewFlags.Tf;
4039 State->Flags.Df = NewFlags.Df;
4040 State->Flags.Of = NewFlags.Of;
4041 State->Flags.Nt = NewFlags.Nt;
4042 State->Flags.Ac = NewFlags.Ac;
4044 if (Cpl == 0)
State->Flags.Iopl = NewFlags.Iopl;
4045 if (Cpl <= State->
Flags.Iopl)
State->Flags.If = NewFlags.If;
4054 State->Flags.Long &= 0xFFFFFF00;
4055 State->Flags.Long |=
State->GeneralRegs[FAST486_REG_EAX].HighByte;
4073 ULONG ReturnAddress;
4086 if (!Fast486FetchWord(
State, &BytesToPop))
return;
4090 if (!Fast486StackPop(
State, &ReturnAddress))
return;
4095 State->InstPtr.Long = ReturnAddress;
4096 State->GeneralRegs[FAST486_REG_ESP].Long += BytesToPop;
4101 State->GeneralRegs[FAST486_REG_ESP].LowWord += BytesToPop;
4107 UCHAR FarPointer[6];
4108 BOOLEAN OperandSize, AddressSize;
4114 OperandSize = AddressSize =
State->SegmentRegs[FAST486_REG_CS].Size;
4120 if (!Fast486ParseModRegRm(
State, AddressSize, &ModRegRm))
4130 && (ModRegRm.
Register == FAST486_REG_EAX)
4137 if (!Fast486FetchByte(
State, &BopCode))
4143#ifndef FAST486_NO_PREFETCH
4163 Fast486Exception(
State, FAST486_EXCEPTION_UD);
4169 ?
State->SegmentOverride : FAST486_REG_DS,
4173 OperandSize ? 6 : 4))
4188 Fast486LoadSegment(
State,
4190 ? FAST486_REG_ES : FAST486_REG_DS,
4202 Fast486LoadSegment(
State,
4204 ? FAST486_REG_ES : FAST486_REG_DS,
4215 FAST486_REG FramePointer;
4223 if (!Fast486FetchWord(
State, &FrameSize))
4229 if (!Fast486FetchByte(
State, &NestingLevel))
4236 if (!Fast486StackPush(
State,
State->GeneralRegs[FAST486_REG_EBP].Long))
4243 FramePointer =
State->GeneralRegs[FAST486_REG_ESP];
4246 for (
i = 1;
i < NestingLevel;
i++)
4250 State->GeneralRegs[FAST486_REG_EBP].Long -= 4;
4251 Fast486StackPush(
State,
State->GeneralRegs[FAST486_REG_EBP].Long);
4255 State->GeneralRegs[FAST486_REG_EBP].LowWord -= 2;
4256 Fast486StackPush(
State,
State->GeneralRegs[FAST486_REG_EBP].LowWord);
4260 if (NestingLevel > 0) Fast486StackPush(
State, FramePointer.Long);
4263 if (
Size)
State->GeneralRegs[FAST486_REG_EBP].Long = FramePointer.Long;
4264 else State->GeneralRegs[FAST486_REG_EBP].LowWord = FramePointer.LowWord;
4267 if (
State->SegmentRegs[FAST486_REG_SS].Size)
4269 State->GeneralRegs[FAST486_REG_ESP].Long -= (
ULONG)FrameSize;
4273 State->GeneralRegs[FAST486_REG_ESP].LowWord -= FrameSize;
4288 if (
State->SegmentRegs[FAST486_REG_SS].Size)
4291 State->GeneralRegs[FAST486_REG_ESP].Long =
State->GeneralRegs[FAST486_REG_EBP].Long;
4296 State->GeneralRegs[FAST486_REG_ESP].LowWord =
State->GeneralRegs[FAST486_REG_EBP].LowWord;
4315 UCHAR OldCpl = Fast486GetCurrentPrivLevel(
State);
4326 if (!Fast486FetchWord(
State, &BytesToPop))
return;
4344 if (
State->SegmentRegs[FAST486_REG_SS].Size)
4346 State->GeneralRegs[FAST486_REG_ESP].Long += BytesToPop;
4350 State->GeneralRegs[FAST486_REG_ESP].LowWord += BytesToPop;
4358 if (!Fast486StackPop(
State, &StackPtr))
4365 if (!Fast486StackPop(
State, &StackSel))
4374 if (!Fast486LoadSegment(
State, FAST486_REG_CS,
Segment))
4391 if (
State->Cpl > OldCpl)
4394 if (!Fast486LoadSegment(
State, FAST486_REG_SS, StackSel))
4401 if (
Size)
State->GeneralRegs[FAST486_REG_ESP].Long = StackPtr;
4402 else State->GeneralRegs[FAST486_REG_ESP].LowWord =
LOWORD(StackPtr);
4408 if ((
i == FAST486_REG_CS) || (
i == FAST486_REG_SS))
continue;
4411 && (!
State->SegmentRegs[
i].Executable
4412 || !
State->SegmentRegs[
i].DirConf))
4415 if (!Fast486LoadSegment(
State,
i, 0))
return;
4427 if (
State->Flags.Vm && (
State->Flags.Iopl != 3))
4430 Fast486Exception(
State, FAST486_EXCEPTION_GP);
4446 if (!Fast486FetchByte(
State, &IntNum))
4458 if (!
State->Flags.Of)
return;
4461 IntNum = FAST486_EXCEPTION_OF;
4480 ULONG InstPtr, CodeSel, StackPtr, StackSel;
4481 FAST486_FLAGS_REG NewFlags;
4502 if (!Fast486StackPop(
State, &InstPtr))
4509 if (!Fast486StackPop(
State, &CodeSel))
4516 if (!Fast486StackPop(
State, &NewFlags.Long))
4525 UINT OldCpl = Fast486GetCurrentPrivLevel(
State);
4527 if (
State->Flags.Vm)
4532 if (
State->Flags.Iopl == 3)
4538 if (!Fast486LoadSegment(
State, FAST486_REG_CS, CodeSel))
4548 State->Flags.Iopl = 3;
4563 ULONG Es, Ds, Fs, Gs;
4566 if (!Fast486StackPop(
State, &StackPtr))
return;
4567 if (!Fast486StackPop(
State, &StackSel))
return;
4568 if (!Fast486StackPop(
State, &Es))
return;
4569 if (!Fast486StackPop(
State, &Ds))
return;
4570 if (!Fast486StackPop(
State, &Fs))
return;
4571 if (!Fast486StackPop(
State, &Gs))
return;
4577 State->GeneralRegs[FAST486_REG_ESP].Long = StackPtr;
4588 if (!Fast486LoadSegment(
State, FAST486_REG_CS, CodeSel))
return;
4589 if (!Fast486LoadSegment(
State, FAST486_REG_SS, StackSel))
return;
4590 if (!Fast486LoadSegment(
State, FAST486_REG_ES, Es))
return;
4591 if (!Fast486LoadSegment(
State, FAST486_REG_DS, Ds))
return;
4592 if (!Fast486LoadSegment(
State, FAST486_REG_FS, Fs))
return;
4593 if (!Fast486LoadSegment(
State, FAST486_REG_GS, Gs))
return;
4601 if (!Fast486StackPop(
State, &StackPtr))
4608 if (!Fast486StackPop(
State, &StackSel))
4616 if (!Fast486LoadSegment(
State, FAST486_REG_CS, CodeSel))
4623 if (
Size)
State->InstPtr.Long = InstPtr;
4632 State->Flags.Long = (
State->Flags.Long & ~PROT_MODE_FLAGS_MASK)
4637 State->Flags.LowWord = (
State->Flags.LowWord & ~PROT_MODE_FLAGS_MASK)
4643 if (OldCpl <= State->
Flags.Iopl)
State->Flags.If = NewFlags.If;
4644 if (OldCpl == 0)
State->Flags.Iopl = NewFlags.Iopl;
4646 if (
State->Cpl > OldCpl)
4649 if (!Fast486LoadSegment(
State, FAST486_REG_SS, StackSel))
4656 if (
Size)
State->GeneralRegs[FAST486_REG_ESP].Long = StackPtr;
4657 else State->GeneralRegs[FAST486_REG_ESP].LowWord =
LOWORD(StackPtr);
4663 if ((
i == FAST486_REG_CS) || (
i == FAST486_REG_SS))
continue;
4666 && (!
State->SegmentRegs[
i].Executable
4667 || !
State->SegmentRegs[
i].DirConf))
4670 if (!Fast486LoadSegment(
State,
i, 0))
return;
4677 if (
Size && (InstPtr & 0xFFFF0000))
4685 State->InstPtr.Long = InstPtr;
4688 if (!Fast486LoadSegment(
State, FAST486_REG_CS, CodeSel))
4719 Fast486Exception(
State, FAST486_EXCEPTION_DE);
4731 State->Flags.Pf = Fast486CalculateParity(
Value);
4750 State->GeneralRegs[FAST486_REG_EAX].LowWord =
Value;
4756 State->Flags.Pf = Fast486CalculateParity(
Value);
4762 BOOLEAN AddressSize =
State->SegmentRegs[FAST486_REG_CS].Size;
4769 ?
State->SegmentOverride : FAST486_REG_DS,
4770 (AddressSize ?
State->GeneralRegs[FAST486_REG_EBX].Long
4771 :
State->GeneralRegs[FAST486_REG_EBX].LowWord)
4772 +
State->GeneralRegs[FAST486_REG_EAX].LowByte,
4782 State->GeneralRegs[FAST486_REG_EAX].LowByte =
Value;
4798 else Condition = ((--
State->GeneralRegs[FAST486_REG_ECX].LowWord) != 0);
4839 else Condition = (
State->GeneralRegs[FAST486_REG_ECX].LowWord == 0);
4878 if (!Fast486StackPush(
State,
State->InstPtr.Long))
4899 if (!Fast486StackPush(
State,
State->InstPtr.Long))
4949 State->InstPtr.Long &= 0xFFFF;
5000 if (!Fast486LoadSegment(
State, FAST486_REG_CS,
Segment))
5012 BOOLEAN AddressSize =
State->SegmentRegs[FAST486_REG_CS].Size;
5032 if (!Fast486FetchWord(
State, &WordOffset))
5044 State->SegmentOverride : FAST486_REG_DS,
5047 &
State->GeneralRegs[FAST486_REG_EAX].LowByte,
5053 BOOLEAN OperandSize, AddressSize;
5055 OperandSize = AddressSize =
State->SegmentRegs[FAST486_REG_CS].Size;
5078 State->SegmentOverride : FAST486_REG_DS,
5081 &
State->GeneralRegs[FAST486_REG_EAX].Long,
5088 State->SegmentOverride : FAST486_REG_DS,
5091 &
State->GeneralRegs[FAST486_REG_EAX].LowWord,
5110 State->SegmentOverride : FAST486_REG_DS,
5113 &
State->GeneralRegs[FAST486_REG_EAX].Long,
5120 State->SegmentOverride : FAST486_REG_DS,
5123 &
State->GeneralRegs[FAST486_REG_EAX].LowWord,
5131 BOOLEAN AddressSize =
State->SegmentRegs[FAST486_REG_CS].Size;
5151 if (!Fast486FetchWord(
State, &WordOffset))
5163 State->SegmentOverride : FAST486_REG_DS,
5165 &
State->GeneralRegs[FAST486_REG_EAX].LowByte,
5171 BOOLEAN OperandSize, AddressSize;
5173 OperandSize = AddressSize =
State->SegmentRegs[FAST486_REG_CS].Size;
5196 State->SegmentOverride : FAST486_REG_DS,
5198 &
State->GeneralRegs[FAST486_REG_EAX].Long,
5205 State->SegmentOverride : FAST486_REG_DS,
5207 &
State->GeneralRegs[FAST486_REG_EAX].LowWord,
5226 State->SegmentOverride : FAST486_REG_DS,
5228 &
State->GeneralRegs[FAST486_REG_EAX].Long,
5235 State->SegmentOverride : FAST486_REG_DS,
5237 &
State->GeneralRegs[FAST486_REG_EAX].LowWord,
5256 State->GeneralRegs[FAST486_REG_EAX].LowByte =
State->Flags.Cf ? 0xFF : 0x00;
5262 BOOLEAN OperandSize, AddressSize;
5263 FAST486_SEG_REGS
Segment = FAST486_REG_DS;
5265 OperandSize = AddressSize =
State->SegmentRegs[FAST486_REG_CS].Size;
5281 if ((AddressSize && (
State->GeneralRegs[FAST486_REG_ECX].Long == 0))
5282 || (!AddressSize && (
State->GeneralRegs[FAST486_REG_ECX].LowWord == 0)))
5296 AddressSize ?
State->GeneralRegs[FAST486_REG_ESI].Long
5297 :
State->GeneralRegs[FAST486_REG_ESI].LowWord,
5309 AddressSize ?
State->GeneralRegs[FAST486_REG_EDI].Long
5310 :
State->GeneralRegs[FAST486_REG_EDI].LowWord,
5321 if (!
State->Flags.Df)
5334 if (!
State->Flags.Df)
5351 if (--
State->GeneralRegs[FAST486_REG_ECX].Long)
5359 if (--
State->GeneralRegs[FAST486_REG_ECX].LowWord)
5372 BOOLEAN OperandSize, AddressSize;
5373 FAST486_SEG_REGS
Segment = FAST486_REG_DS;
5375 OperandSize = AddressSize =
State->SegmentRegs[FAST486_REG_CS].Size;
5392 if ((AddressSize && (
State->GeneralRegs[FAST486_REG_ECX].Long == 0))
5393 || (!AddressSize && (
State->GeneralRegs[FAST486_REG_ECX].LowWord == 0)))
5405 SignFlag = 1 << ((
DataSize * 8) - 1);
5406 DataMask = SignFlag | (SignFlag - 1);
5411 AddressSize ?
State->GeneralRegs[FAST486_REG_ESI].Long
5412 :
State->GeneralRegs[FAST486_REG_ESI].LowWord,
5424 AddressSize ?
State->GeneralRegs[FAST486_REG_EDI].Long
5425 :
State->GeneralRegs[FAST486_REG_EDI].LowWord,
5435 FirstValue &= DataMask;
5436 SecondValue &= DataMask;
5437 Result = (FirstValue - SecondValue) & DataMask;
5440 State->Flags.Cf = (FirstValue < SecondValue);
5441 State->Flags.Of = ((FirstValue & SignFlag) != (SecondValue & SignFlag))
5442 && ((FirstValue & SignFlag) != (
Result & SignFlag));
5443 State->Flags.Af = (FirstValue & 0x0F) < (SecondValue & 0x0F);
5451 if (!
State->Flags.Df)
5464 if (!
State->Flags.Df)
5484 if ((--
State->GeneralRegs[FAST486_REG_ECX].Long) == 0)
5492 if ((--
State->GeneralRegs[FAST486_REG_ECX].LowWord) == 0)
5517 BOOLEAN OperandSize, AddressSize;
5519 OperandSize = AddressSize =
State->SegmentRegs[FAST486_REG_CS].Size;
5535 :
State->GeneralRegs[FAST486_REG_ECX].LowWord;
5550 ((
PUSHORT)Block)[
i] =
State->GeneralRegs[FAST486_REG_EAX].LowWord;
5554 ((
PULONG)Block)[
i] =
State->GeneralRegs[FAST486_REG_EAX].Long;
5568 ? (
ULONG)
State->GeneralRegs[FAST486_REG_EDI].LowWord
5569 : (0x10000 - (
ULONG)
State->GeneralRegs[FAST486_REG_EDI].LowWord);
5572 if (Processed == 0) Processed = 1;
5575 if (
State->Flags.Df)
5578 if (AddressSize)
State->GeneralRegs[FAST486_REG_EDI].Long -= (Processed - 1) *
DataSize;
5579 else State->GeneralRegs[FAST486_REG_EDI].LowWord -= (Processed - 1) *
DataSize;
5585 AddressSize ?
State->GeneralRegs[FAST486_REG_EDI].Long
5586 :
State->GeneralRegs[FAST486_REG_EDI].LowWord,
5591 if (AddressSize)
State->GeneralRegs[FAST486_REG_ECX].Long =
Count;
5598 if (!
State->Flags.Df)
5601 if (AddressSize)
State->GeneralRegs[FAST486_REG_EDI].Long += Processed *
DataSize;