I'm playing around with creating a 4-way scrolling background with a status bar using the MMC3's IRQ. The IRQ itself is running fine, but for some reason it's drawing pixels from the area about 5 scanlines (not tile-aligned, even though the status bar itself is supposed to be) above where I want it to. Here's the pertinent code:
vblank:
lda #$D8 ; Start the status bar at scaline D8
sta $C000
sta $C001
sta $E001
; Reset the window location
lda #$20
sta $2006
lda #0
sta $2006
lda bgX
sta $2005
lda bgY
sec
sbc #8 ; to account for NTSC
sta $2005
rti
irq:
lda #$23 ; status bar exists @ $2360 in the nametable
sta $2006
lda #$60
sta $2006
sta $E000
rti
I've tried using $2005 to offset it to the right spot, but it doesn't seem to have any effect. Any ideas on why it's behaving this way and if it's possible to work around it? Thanks!
vblank:
lda #$D8 ; Start the status bar at scaline D8
sta $C000
sta $C001
sta $E001
; Reset the window location
lda #$20
sta $2006
lda #0
sta $2006
lda bgX
sta $2005
lda bgY
sec
sbc #8 ; to account for NTSC
sta $2005
rti
irq:
lda #$23 ; status bar exists @ $2360 in the nametable
sta $2006
lda #$60
sta $2006
sta $E000
rti
I've tried using $2005 to offset it to the right spot, but it doesn't seem to have any effect. Any ideas on why it's behaving this way and if it's possible to work around it? Thanks!