Hi,
Im working on a MMC3 game, it requires an IRQ to split the screen.
The split and all works quite nice, but game crashes at seemingly random intervals, which can be influenced by having player do stuff.
I was able to trace the problem to IRQ getting triggered during a bank swap:
The problem is IRQ code *needs* to swap banks for its own uses.
I was able to minimalize the frequency of crashes by:
But crashes can still hapen, albeit rarely.
Does anyone more familiar with MMC3 have a workaround for this kind of thing?
I guess I could disable irqs before swapping banks and enabling them after swap is done, but that would be slow. Any ideas?
Im working on a MMC3 game, it requires an IRQ to split the screen.
The split and all works quite nice, but game crashes at seemingly random intervals, which can be influenced by having player do stuff.
I was able to trace the problem to IRQ getting triggered during a bank swap:
Code:
lda #somevalue
sta $8000
----IRQ happens here
lda #somevalue
----or here
sta $8001
sta $8000
----IRQ happens here
lda #somevalue
----or here
sta $8001
The problem is IRQ code *needs* to swap banks for its own uses.
I was able to minimalize the frequency of crashes by:
Code:
lda #somevalue
ldx #somevalue
sta $8000
----IRQ can still happen here
stx $8001
ldx #somevalue
sta $8000
----IRQ can still happen here
stx $8001
But crashes can still hapen, albeit rarely.
Does anyone more familiar with MMC3 have a workaround for this kind of thing?
I guess I could disable irqs before swapping banks and enabling them after swap is done, but that would be slow. Any ideas?