MMC1-based game has code like this, located in the last bank (hard-wired to $C000-FFFF):
Code: Select all
and #$0F
sta $11
sta $FFFF
lsr A
sta $FFFF
lsr A
sta $FFFF
lsr A
sta $FFFF
lsr A
sta $FFFF
rts
If I use something like this:
Code: Select all
range { start $c2a7; end $c318; type code; name "NMI"; };
range { start $fef4; end $ff0b; type code; name "PRG_BANK_SWAP"; };
range { start $ffd8; end $ffdf; type code; name "RESET"; };
range { start $fffa; end $ffff; type addrtable; };
Code: Select all
PRG_BANK_SWAP:
and #$0F
sta $11
sta LFFFA+5
lsr a
sta LFFFA+5
lsr a
sta LFFFA+5
lsr a
sta LFFFA+5
lsr a
sta LFFFA+5
rts
...
LFFFA: .addr NMI
.addr RESET
.addr LFFFA+5
Code: Select all
label { addr $ffff; size 1; name "MMC1_PRG_SELECT"; };
Code: Select all
PRG_BANK_SWAP:
and #$0F
sta $11
sta MMC1_PRG_SELECT
lsr a
sta MMC1_PRG_SELECT
lsr a
sta MMC1_PRG_SELECT
lsr a
sta MMC1_PRG_SELECT
lsr a
sta MMC1_PRG_SELECT
rts
...
.addr NMI
.addr RESET
MMC1_PRG_SELECT := * + 1
.addr MMC1_PRG_SELECT
One cannot hand-modify the disassembly file because as one works out what's data vs. code, one needs to re-run da65 to get an updated disassembly, losing hand-hacked changes.
Along the same lines: the game reads from ROM regions that contain data/whatever, but obviously writes to those regions go to MMC1; da65 thinks they're essentially one in the same, which makes for some really nasty disassembled results.
This is all with da65 V2.17 - Git c2568d8.
Advice/thoughts?
P.S. -- Do inline comments actually work for labels? I've been futzing around with COMMENT in label and range, but I can't quite get the latter to work how I'd expect, and the former always seems to generate comments like ; thing\nlabelname := $addr rather than what one of the examples shows.
Edit -- minor copy-paste mistake on my part pertaining to the PRG swap routine. Thing has the same routine in several places...