Hi everyone, I'm starting a slightly more advanced project so I'm using CNROM and have some questions around how bank switching is actually working. I got a full working example going, swapping out the banks with button presses and assembling on ASM6. PPU on emulator looks correct during the switches.
I started with a CNROM template by tokumaru (Thanks for putting this together)
viewtopic.php?t=6160
And I read through CHR bank switching on Nerdy Nights
http://nintendoage.com/forum/messagevie ... adid=17074
I looked on the forums here and the wiki but found a lot of material to assume context is understood (more of reference material or material specific to mappers I'm not using).
First a code snippet:
How does this black magic work? I know that method is used to get around bus issues but that seems very obscure. How would trying to write to ROM, which cannot be written to, change which CHR bank I'm using? And per the template my CHR includes are at the bottom of my file so how does the NES associate $00 with the first, $01 with the second, etc?
Second question is the emulator seems to jump to the first bank, is that expected on CNROM?
Finally, is it safe to swamp CHR banks while the PPU is doing stuff?
I started with a CNROM template by tokumaru (Thanks for putting this together)
viewtopic.php?t=6160
And I read through CHR bank switching on Nerdy Nights
http://nintendoage.com/forum/messagevie ... adid=17074
I looked on the forums here and the wiki but found a lot of material to assume context is understood (more of reference material or material specific to mappers I'm not using).
First a code snippet:
Code:
LDA #$01
JSR Bankswitch
.......................................
Bankswitch:
TAX
STA Bankvalues, x
RTS
Bankvalues:
.db $00, $01, $02, $03
.......................................
; VECTORS
.org $FFFA
.dw NMI
.dw RESET
.dw IRQ
; CHR-ROM BANKS
.incbin "test1.chr"
.incbin "test2.chr"
.incbin "test3.chr"
.incbin "test4.chr"
JSR Bankswitch
.......................................
Bankswitch:
TAX
STA Bankvalues, x
RTS
Bankvalues:
.db $00, $01, $02, $03
.......................................
; VECTORS
.org $FFFA
.dw NMI
.dw RESET
.dw IRQ
; CHR-ROM BANKS
.incbin "test1.chr"
.incbin "test2.chr"
.incbin "test3.chr"
.incbin "test4.chr"
How does this black magic work? I know that method is used to get around bus issues but that seems very obscure. How would trying to write to ROM, which cannot be written to, change which CHR bank I'm using? And per the template my CHR includes are at the bottom of my file so how does the NES associate $00 with the first, $01 with the second, etc?
Second question is the emulator seems to jump to the first bank, is that expected on CNROM?
Finally, is it safe to swamp CHR banks while the PPU is doing stuff?