So I know that the MMC3 works with 8k banks and that there are two different bankswitching modes. I know that $E000-$FFFF will always be the last 8k of ROM, and either $C000-$DFFF or $8000-$9FFF will be the second to last depending on the PRG mode.
I'm wondering about the state of the banks on reset. Is it unpredictable/random? I want to put my reset code in $C000-$FFFF, and I think always keep it on mode 0. In order to be safe, will I have to make the reset address somewhere in $E000-$FFFF and then turn on mode 0, at which point I will jump somewhere in $C000-$DFFF? Or is the PRG mode by default 0 on reset, in which case I could make the reset address $C000-$DFFF safely?
MMC3 PRG banks on reset
Moderator: Moderators
Re: MMC3 PRG banks on reset
That'd be the safest way. I'd toss something like this next to the vectors (untested):Celius wrote:I'm wondering about the state of the banks on reset. Is it unpredictable/random? I want to put my reset code in $C000-$FFFF, and I think always keep it on mode 0. In order to be safe, will I have to make the reset address somewhere in $E000-$FFFF and then turn on mode 0, at which point I will jump somewhere in $C000-$DFFF?
Code: Select all
PPUCTRL = $2000
PPUMASK = $2001
MMC3CTRL = $8000
MMC3BANK = $8001
MMC3IRQOFF = $E000
P2 = $4017
.segment "ROM_FFE0"
reset:
sei
ldx #0
stx PPUCTRL ; disable nmi
stx PPUMASK ; disable rendering (and mmc3 irq)
stx MMC3IRQOFF ; ack/disable mmc3 irq
stx MMC3CTRL ; set normal banking mode
dex
txs
lda #$40
sta P2 ; ack/disable apu frame irq
jmp main
.pad (reset+$1A)-*
.addr nmi, reset, irq
-
Celius
- Posts: 2159
- Joined: Sun Jun 05, 2005 2:04 pm
- Location: Minneapolis, Minnesota, United States
- Contact:
Okay, I guess I'll have to implement that then. It's okay though; my current projects aren't at all in their final stages.
I guess I never thought about the advantages of using $8000-$9FFF as the fixed bank. But thank you for mentioning that, I will definitely reconsider why I use $C000-$DFFF as fixed. I guess I wanted to be able to treat it as one big 16k bank, but then again, I can have:
$9FFD: JMP $E000
which would only cost 3 cycles. It would just not have to be in the middle of any timed code.
I guess I never thought about the advantages of using $8000-$9FFF as the fixed bank. But thank you for mentioning that, I will definitely reconsider why I use $C000-$DFFF as fixed. I guess I wanted to be able to treat it as one big 16k bank, but then again, I can have:
$9FFD: JMP $E000
which would only cost 3 cycles. It would just not have to be in the middle of any timed code.
You may not want to waste a whole 8kb bank area of memory to be constantly dedicated to samples, leaving only $a000-$bfff as "normal" bankswitched mem.But then I don't know why you're using $C000-$DFFF as a fixed bank. If you use $8000-$9FFF as a fixed bank, you can bankswitch DPCM samples.
Also, there is many you may want to use vitrual 16kb banks, having the last 16kb always at $c000-$ffff and banskwitch two consecutive banks at $8000-$bfff, having the more standard U*ROM configuration.
With WLA-DX, if you want the Reset code to be in $e000-$ffff, you'd have to do something like that :
Code: Select all
.org $e000
.section RESET SEMIFREE
sei
cld
.....
MainLoop
jsr WaitVBl
jsr Gameplay
lda GameOver
bne +
jmp MainLoop
+ jmp GameOver
.endsAlso, if you can do test on real MMC3 cards and proof experimentally that $c000-$dfff are always the second last bank at power on, then you are legit to use that to your advantage. It would have to be tested on all revisions of MMC3 to be safe tough. Also this may or may not break compatibility with emulators and powerpak.
Useless, lumbering half-wits don't scare us.