[FAST486]
authorAleksandar Andrejevic <aandrejevic@reactos.org>
Tue, 14 Jul 2015 23:29:23 +0000 (23:29 +0000)
committerAleksandar Andrejevic <aandrejevic@reactos.org>
Tue, 14 Jul 2015 23:29:23 +0000 (23:29 +0000)
Combine FPREM and FPREM1 into one case.

svn path=/trunk/; revision=68400

reactos/lib/fast486/fpu.c

index fd81b3a..8e78e7a 100644 (file)
@@ -2418,6 +2418,8 @@ FAST486_OPCODE_HANDLER(Fast486FpuOpcodeD9)
 
             /* FPREM1 */
             case 0x35:
+            /* FPREM */
+            case 0x38:
             {
                 LONGLONG Quotient;
 
@@ -2430,7 +2432,12 @@ FAST486_OPCODE_HANDLER(Fast486FpuOpcodeD9)
                     break;
                 }
 
-                if (Fast486FpuRemainder(State, &FPU_ST(0), &FPU_ST(1), TRUE, &FPU_ST(0), &Quotient))
+                if (Fast486FpuRemainder(State,
+                                        &FPU_ST(0),
+                                        &FPU_ST(1),
+                                        ModRegRm.Register == 6, /* TRUE if it's FPREM1 */
+                                        &FPU_ST(0),
+                                        &Quotient))
                 {
                     FPU_UPDATE_TAG(0);
 
@@ -2457,33 +2464,6 @@ FAST486_OPCODE_HANDLER(Fast486FpuOpcodeD9)
                 break;
             }
 
-            /* FPREM */
-            case 0x38:
-            {
-                LONGLONG Quotient;
-
-                Fast486FpuExceptionCheck(State);
-                FPU_SAVE_LAST_INST();
-
-                if (FPU_GET_TAG(0) == FPU_TAG_EMPTY || FPU_GET_TAG(1) == FPU_TAG_EMPTY)
-                {
-                    State->FpuStatus.Ie = TRUE;
-                    break;
-                }
-
-                if (Fast486FpuRemainder(State, &FPU_ST(0), &FPU_ST(1), FALSE, &FPU_ST(0), &Quotient))
-                {
-                    FPU_UPDATE_TAG(0);
-
-                    /* Return the lowest 3 bits of the quotient in C1, C3, C0 */
-                    State->FpuStatus.Code1 = Quotient & 1;
-                    State->FpuStatus.Code3 = (Quotient >> 1) & 1;
-                    State->FpuStatus.Code0 = (Quotient >> 2) & 1;
-                }
-
-                break;
-            }
-
             /* FYL2XP1 */
             case 0x39:
             {