[FAST486]
authorAleksandar Andrejevic <aandrejevic@reactos.org>
Mon, 11 Nov 2013 20:55:33 +0000 (20:55 +0000)
committerAleksandar Andrejevic <aandrejevic@reactos.org>
Mon, 11 Nov 2013 20:55:33 +0000 (20:55 +0000)
Check for interrupts at the end of a cycle, to avoid confusing
debug output.

svn path=/branches/ntvdm/; revision=60956

lib/fast486/fast486.c

index ac08829..1533662 100644 (file)
@@ -55,42 +55,7 @@ Fast486ExecutionControl(PFAST486_STATE State, INT Command)
     do
     {
         /* Check if this is a new instruction */
-        if (State->PrefixFlags == 0)
-        {
-            State->SavedInstPtr = State->InstPtr;
-
-            /*
-             * Check if there is an interrupt to execute, or a hardware interrupt signal
-             * while interrupts are enabled.
-             */
-            if (State->IntStatus == FAST486_INT_EXECUTE)
-            {
-                FAST486_IDT_ENTRY IdtEntry;
-
-                /* Get the interrupt vector */
-                if (Fast486GetIntVector(State, State->PendingIntNum, &IdtEntry))
-                {
-                    /* Perform the interrupt */
-                    Fast486InterruptInternal(State,
-                                             IdtEntry.Selector,
-                                             MAKELONG(IdtEntry.Offset, IdtEntry.OffsetHigh),
-                                             IdtEntry.Type);
-                }
-
-                /* Clear the interrupt status */
-                State->IntStatus = FAST486_INT_NONE;
-            }
-            else if (State->Flags.If
-                     && (State->IntAckCallback != NULL)
-                     && (State->IntStatus == FAST486_INT_SIGNAL))
-            {
-                /* Acknowledge the interrupt to get the number */
-                State->PendingIntNum = State->IntAckCallback(State);
-
-                /* Set the interrupt status to execute on the next instruction */
-                State->IntStatus = FAST486_INT_EXECUTE;
-            }
-        }
+        if (State->PrefixFlags == 0) State->SavedInstPtr = State->InstPtr;
 
         /* Perform an instruction fetch */
         if (!Fast486FetchByte(State, &Opcode)) continue;
@@ -108,16 +73,46 @@ Fast486ExecutionControl(PFAST486_STATE State, INT Command)
             Fast486Exception(State, FAST486_EXCEPTION_UD);
         }
 
-        if (Fast486OpcodeHandlers[Opcode] != Fast486OpcodePrefix)
-        {
-            /* A non-prefix opcode has been executed, reset the prefix flags */
-            State->PrefixFlags = 0;
-        }
-        else
+        if (Fast486OpcodeHandlers[Opcode] == Fast486OpcodePrefix)
         {
             /* This is a prefix, go to the next instruction immediately */
             continue;
         }
+
+        /* A non-prefix opcode has been executed, reset the prefix flags */
+        State->PrefixFlags = 0;
+
+        /*
+         * Check if there is an interrupt to execute, or a hardware interrupt signal
+         * while interrupts are enabled.
+         */
+        if (State->IntStatus == FAST486_INT_EXECUTE)
+        {
+            FAST486_IDT_ENTRY IdtEntry;
+
+            /* Get the interrupt vector */
+            if (Fast486GetIntVector(State, State->PendingIntNum, &IdtEntry))
+            {
+                /* Perform the interrupt */
+                Fast486InterruptInternal(State,
+                                         IdtEntry.Selector,
+                                         MAKELONG(IdtEntry.Offset, IdtEntry.OffsetHigh),
+                                         IdtEntry.Type);
+            }
+
+            /* Clear the interrupt status */
+            State->IntStatus = FAST486_INT_NONE;
+        }
+        else if (State->Flags.If
+                 && (State->IntAckCallback != NULL)
+                 && (State->IntStatus == FAST486_INT_SIGNAL))
+        {
+            /* Acknowledge the interrupt to get the number */
+            State->PendingIntNum = State->IntAckCallback(State);
+
+            /* Set the interrupt status to execute on the next instruction */
+            State->IntStatus = FAST486_INT_EXECUTE;
+        }
     }
     while ((Command == FAST486_CONTINUE)
            || (Command == FAST486_STEP_OVER && ProcedureCallCount > 0)