Turn VBL break point list into a structure to make game stop at various events
[mercenary-reloaded.git] / src / libcpu / execute.c
index fdbe8fc..d7421f3 100644 (file)
@@ -135,7 +135,7 @@ void reset_cpu(void)
        m68k_pulse_reset();
 }
 
-int execute_cpu(int irq, const uint32_t stop_at[])
+int execute_cpu(int irq, const struct cpu_stop stop_at[], int *event)
 {
        int cycle_count = 0;
        int instruction_count = 0;
@@ -169,16 +169,16 @@ int execute_cpu(int irq, const uint32_t stop_at[])
                                        break;
                        }
 
-                       for (i = 0; stop_at[i]; i++) {
-                               if (REG_PC == stop_at[i])
-                                       break;
-                       }
-                       if (stop_at[i])
-                               break;
-               } while (42);
+                       for (i = 0; stop_at[i].event; i++) {
+                               if (REG_PC == stop_at[i].pc) {
 #ifdef DEBUG_CPU
-               printf("execution to address 0x%06x took %d opcodes\n", REG_PC, instruction_count);
+                                       printf("execution to address 0x%06x took %d opcodes\n", REG_PC, instruction_count);
 #endif
+                                       *event = stop_at[i].event;
+                                       return cycle_count;
+                               }
+                       }
+               } while (42);
        }
 
        return cycle_count;