The leaked MMC3 datasheet describes the proper initialization procedure. Its last step is to initialize the interval timer using this code sequence, but without further explanation:
Code: Select all
; DITIRQ(E000H) WR
; 1H clock initialize:
LDA 2002H
LDA #10H
TAX
LP:
STA 2006H
STA 2006H
EOR #10H
DEX
BNE LP
The code sequence is done by all licensed games, and a few unlicensed ones. I understand that by flipping PPU A12 in this way, it basically clocks the MMC3's scanline counter eight times, but why? What would happen if this were not done at reset?
When I compared the Japanese rev0 to the Japanese rev1 of SMB3, I noticed that rev1 inserts the following code sequence at several scene-changing code points:
Code: Select all
LDA #0
STA $2006
STA $2006
LDA #$10
STA $2006
STA $2006
LDA #0
STA $2006
STA $2006
LDA #$10
STA $2006
STA $2006
For some reason, Nintendo deemed it necessary to manually clock the scanline counter twice. Why?