- for (i = 0; psxRegs.pc != 0x80030000 && i < 5000000; i++)
- psxCpu->ExecuteBlock();
- if (psxRegs.pc == 0x80030000)
- BiosBooted = TRUE;
- else
- SysPrintf("BIOS boot timeout - custom BIOS?\n");
+ for (i = 0; i < 5000000; i++) {
+ psxCpu->ExecuteBlock(EXEC_CALLER_BOOT);
+ if ((psxRegs.pc & 0xff800000) == 0x80000000)
+ break;
+ }
+ if (psxRegs.pc != 0x80030000)
+ SysPrintf("non-standard BIOS detected (%d, %08x)\n", i, psxRegs.pc);
+}
+
+// irq10 stuff, very preliminary
+static int irq10count;
+
+static void psxScheduleIrq10One(u32 cycles_abs) {
+ // schedule relative to frame start
+ u32 c = cycles_abs - rcnts[3].cycleStart;
+ assert((s32)c >= 0);
+ psxRegs.interrupt |= 1 << PSXINT_IRQ10;
+ psxRegs.intCycle[PSXINT_IRQ10].cycle = c;
+ psxRegs.intCycle[PSXINT_IRQ10].sCycle = rcnts[3].cycleStart;
+ new_dyna_set_event_abs(PSXINT_IRQ10, cycles_abs);
+}
+
+void irq10Interrupt() {
+ u32 prevc = psxRegs.intCycle[PSXINT_IRQ10].sCycle
+ + psxRegs.intCycle[PSXINT_IRQ10].cycle;
+
+ psxHu32ref(0x1070) |= SWAPu32(0x400);
+
+#if 0
+ s32 framec = psxRegs.cycle - rcnts[3].cycleStart;
+ printf("%d:%03d irq10 #%d %3d m=%d,%d\n", frame_counter,
+ (s32)((float)framec / (PSXCLK / 60 / 263.0f)),
+ irq10count, psxRegs.cycle - prevc,
+ (psxRegs.CP0.n.SR & 0x401) != 0x401, !(psxHu32(0x1074) & 0x400));
+#endif
+ if (--irq10count > 0)
+ psxScheduleIrq10One(prevc + PSXCLK / 60 / 263);