Fx3 wrote:
It doesn't work yet. The banks "-2" and "-1" mean the last 16k of PRG data, right?
Yes. -1 would be the last bank ($FF), and -2 would be the second last ($FE)
Quote:
In fact, I had it working, but with broken IRQ due to the major timing fixes. If you want to see the mapper21 source, I can paste it here.
That would help. If it's very large perhaps upload it somewhere and provide a link to it so you don't have a really huge post.
One thing I can think of that might be causing trouble is that the PRG regs are mirrored across several addresses. $8000, $8002, $8004, and $8006 all change the same PRG register. I probably could have made this more clear in my doc.
Quote:
Additionally, what do you mean by "acknowledge IRQ"? AFAIK, "irq enable" means the IRQ counter clocks; "irq disable" means to stop the IRQ counter. When the counter expires, an IRQ is requested & triggered on the next instruction. I didn't get the "acknowledge" thing.
IRQs are level-triggered, not edge-triggered like NMIs. Meaning that once an IRQ is pending (requested)... it continues to be pending until acknowleged -- even after the IRQ trips.
Example:
Code:
someroutine:
SEI ; IRQs masked
NOP
NOP
NOP ; IRQ happens here, but since I is set
NOP ; nothing happens yet.. but IRQ is *still* pending
NOP
NOP
NOP
CLI ; unmask IRQs
; IRQ trips now -- because it was still pending (was not acknowledged)
vs:
Code:
SEI ; IRQs masked
NOP
NOP
NOP ; IRQ happens here, but since I is set
NOP ; nothing happens yet
NOP
NOP
STA $F006 ; acknowledge IRQ -- IRQ is no longer pending
NOP
CLI ; unmask IRQs
; IRQ does not happen after the CLI, because it is no longer pending
; (it has been acknowledged)
Enable/Disable is slightly different from Pending/Acknowledged. Disabled
prevents an IRQ from pending... whereas acknowledging stop an IRQ from pending once it happens. Usually, disabling also acknowledges, though.
edit: "line" triggered? wtf was I on. That's what I get for posting so late at night XD