So, I'm working on the Shogi hack, and so far have a version with Kanji and a version with English training pieces. The only difference between the two are the CHR banks. The ROM is Naitou 9 Dan Shougi Hiden (J).nes.
So what I want to do is have the player be able to toggle between the CHR banks while playing. The original game is Mapper 0.
So my attempts so far have been to:
Check out the docs
NES Rom Expansion 101 and
102 by TFG, along with
King Mike's also.
Afterward, using nflate, I've expanded the ROM's CHR bank, changed the mapper to CNROM, and placed the correct graphics into the freely available space.
Then, from the Nerdy Nights tutorials,
there is an example in the tutorial that uses Start and Select to swap CHR banks back and forth.
I figured this control scheme would work well because the Shogi game uses neither start nor select during gameplay, and if the CHR bank were to also be swapped during the title screen, the only time start or select are used, it wouldn't make a difference.
So, like a monkey with a screwdriver, I crudely try to identify the relevant code, remove the segments between asterisks below...
LatchController:
LDA #$01
STA $4016
LDA #$00
STA $4016 ; tell both the controllers to latch buttons
ReadA:
LDA $4016 ; player 1 - A
AND #%00000001 ; only look at bit 0
****BEQ ReadADone ; branch to ReadADone if button is NOT pressed (0)
; add instructions here to do something when button IS pressed (1)
LDA $0203 ; load sprite X position
CLC ; make sure the carry flag is clear
ADC #$01 ; A = A + 1
STA $0203 ; save sprite X position****
ReadADone: ; handling this button is done
ReadB:
LDA $4016 ; player 1 - B
AND #%00000001 ; only look at bit 0
***BEQ ReadBDone ; branch to ReadBDone if button is NOT pressed (0)
; add instructions here to do something when button IS pressed (1)
LDA $0203 ; load sprite X position
SEC ; make sure carry flag is set
SBC #$01 ; A = A - 1
STA $0203 ; save sprite X position[/s]****
ReadBDone: ; handling this button is done
ReadSelect:
LDA $4016 ; player 1 - select
AND #%00000001 ; only look at bit 0
BEQ ReadSelectDone ; branch to ReadSelectDone if button is NOT pressed (0)
; add instructions here to do something when button IS pressed (1)
LDA #$00
JSR Bankswitch ; change to graphics bank 0
ReadSelectDone: ; handling this button is done
ReadStart:
LDA $4016 ; player 1 - start
AND #%00000001 ; only look at bit 0
BEQ ReadStartDone ; branch to ReadStartDone if button is NOT pressed (0)
; add instructions here to do something when button IS pressed (1)
LDA #$01
JSR Bankswitch ; change to graphics bank 1
ReadStartDone: ; handling this button is done
RTI ; return from interrupt
Bankswitch:
TAX ;;copy A into X
STA Bankvalues, X ;;new bank to use
RTS
Bankvalues:
.db $00, $01, $02, $03 ;;bank numbers
And after assembly, copy and paste it into what I am guessing is free space in the PRG-ROM, (A long consecutive string of $AAs near the end) and as expected, no results.
This is my first time attempting something like this, so I'm pretty sure I'm going about it wrong.
Any advice?