Implement WAIT (0x9B) opcode support
authorRobert Pengelly <robertapengelly@hotmail.com>
Fri, 23 Oct 2026 08:03:13 +0000 (09:03 +0100)
committerRobert Pengelly <robertapengelly@hotmail.com>
Fri, 23 Oct 2026 08:03:13 +0000 (09:03 +0100)
cpu.c

diff --git a/cpu.c b/cpu.c
index eb9d789984b5b24b908a25de2e5c07de7a848c20..086ee311c840d67c8a70491847440526f7010ce4 100644 (file)
--- a/cpu.c
+++ b/cpu.c
@@ -4260,6 +4260,26 @@ fetch_instruction:
         
         }
         
+        case 0x9B:                      /* WAIT / FWAIT */
+        
+            if ((cpu->cr0 & 0x0000000AUL) == 0x0000000AUL) {
+            
+                cpu->ip = (uint32_t) old_ip;
+                
+                if (cpu->cr0 & 1) {
+                
+                    if (cpu_protected_interrupt (cpu, 7) != 0) {
+                        return -1;
+                    }
+                
+                } else {
+                    handle_interrupt (cpu, 7);
+                }
+            
+            }
+            
+            break;
+        
         case 0x9C:                      /* PUSHF (Push Flags onto Stack) */
         
             if (cpu->has_operand_override) {