Post #3694684
2026-07-02 00:40 UTC
got rid of the dynamic lookups by keeping the state in an array of ints instead of a struct, with an enum for offsets into the array to access particular registers etc., which gave me a 2x speed increase. i think the only sustainable solution here is to literally never let python allocate an object anywhere in the "inner loop" (which was honestly obvious from the beginning but i was Hopeful)
Replies (1)
-
@aparrish@friend.camp 2026-07-03 21:23
so issuing an "illegal" opcode on the game boy cpu essentially shuts the cpu down (illegal opcodes don't set the fetch flag, so the pc won't increment—and the cpu only services interrupts at the beginning of a fetch). BUT all the other peripherals on the SoC keep running! i feel like between the PPU, APU, timers, DMA, etc. there MUST be a way to "program" the game boy to do something even when the cpu is in illegal opcode zombie mode. this has no practical purpose of course but—food for thought!