Page 1 of 1

IRQ Issues

Posted: Thu Jan 29, 2015 3:40 am
by Tsutarja
I was trying to get MMC3 IRQ to change horizontal scroll position according to a lookup table, but for some reason the IRQ split is not working and I don't know why. The mistake may be obvious, but I just can't see it...

Code:
http://pastebin.com/rn6RZgqr

Re: IRQ Issues

Posted: Fri Jan 30, 2015 1:00 am
by nostromo
sway_offset is always the same value which is pointing to zero in SwayTable causing no visual change on the screen.

Code: Select all

MainLoop:
 ...
 LDA #$00
 STA sway_offset
 ...
 RTS

IRQ:
 ...
 LDX #$00
 LDY sway_offset; Y = 0
 LDA (SwayTable), y; A = 0
 STA scroll_x
 STA PPUScroll; A = 0
 STX scroll_y
 STX PPUScroll; X = 0
 ...
 RTI

SwayTable:
 .db $00,$03,$06,$09,$0C,$0F,$12,$14,$15,$14,$12,$0F,$0C,$09,$06,$03
 .db $00,$FC,$F9,$F6,$F3,$F0,$ED,$EB,$EA,$EB,$ED,$F0,$F3,$F6,$F9,$FC

also you have some addresses with incorrect names which could cause confusion later.

Code: Select all

IRQLatch = $C000
IRQReload = $C001
Wiki.
$C000: [IIII IIII] IRQ Reload value
$C001: [.... ....] IRQ Clear
$E000: [.... ....] IRQ Acknowledge / Disable
$E001: [.... ....] IRQ Enable

Re: IRQ Issues

Posted: Fri Jan 30, 2015 2:36 am
by Tsutarja
Ok, now I get the visual effect, but I need to edit the table a bit because now it's going all over the place (lol).

Also, I got the $C000 and $C001 names from nesdev wiki's MMC3 page, so thought that those were correct names.