Hi. Today my question is about mapper MMC3. My emu fails to execute double dragon 3 (sacred stones).
My emu executes all good (title screen) until where it is starting to say press start. I did debug my emu.
Problem I think is that bankswitch in order that BANK_A=$1A000 never is completed.. Then take a look to my
comments in debug:
(Note: branches are ok, they are relative, but i did a simple debug
and i want minus kb for the file, then any op dont have registers or addresses)
Only the most importants parts for understand are here.
We are executing code
Code: Select all
$FF25: A9 LDA #$1 A:0 X:BC Y:5F P:32
$FF27: 8D STA $6D8 A:1 X:BC Y:5F P:30
$FF2A: A9 LDA #$7 A:1 X:BC Y:5F P:30
$FF2C: 8D STA $A2 A:7 X:BC Y:5F P:30
$FF2F: 8D STA $8000 A:7 X:BC Y:5F P:30
(We can see that STA $8000 is sended with command number 7, then i will be waiting STA $8001 to select BANK A)..
Theorically for select bank A=$1A000, i have to send value 13 ($0D) because DD3 has around(8*2)=16 banks of 8kb..
But after $FF2F is executed, one NMI is triggered!
***NMI TRIGGERED***
Code: Select all
$FF5F: 24 BIT $A3 A:7 X:BC Y:5F P:34
$FF61: 10 BPL
$FF6B: 50 BVC
$FF6D: 4C JMP $E070 A:7 X:BC Y:5F P:76
$E070: 48 PHA
$E071: 8A TXA
$E072: 48 PHA
$E073: 98 TYA
$E074: 48 PHA
$E075: 20 JSR $FE75 A:5F X:BC Y:5F P:74
$FE75: A9 LDA #$0 A:5F X:BC Y:5F P:74
$FE77: 8D STA $2003 A:0 X:BC Y:5F P:76
$FE7A: A9 LDA #$2 A:0 X:BC Y:5F P:76
$FE7C: 8D STA $4014 A:2 X:BC Y:5F P:74
$FE7F: 60 RTS
$E078: E6 INC $A8 A:2 X:BC Y:5F P:74
$E07A: A6 LDX $AB A:2 X:BC Y:5F P:74
*
$FC59: 20 JSR $FF1B A:5 X:FF Y:0 P:74
*
* We still in NMI, i think that this code is called from NMI, too
$FF2F: 8D STA $8000 A:7 X:FF Y:0 P:74
$FF32: BA TSX
$FF33: BD LDA $1ED,X A:7 X:EB Y:0 P:F4
$FF36: A ASL A
$FF37: 9 ORA #$1 A:2 X:EB Y:0 P:74 (registers before opcode processed)
$FF39: 8D STA $8001 A:3 X:EB Y:0 P:74 (registers before opcode processed)
(here STA $8001 send 3 in order to BANK_A=$6000
$FF3C: A9 LDA #$6 A:3 X:EB Y:0 P:74
$FF3E: 8D STA $A2 A:6 X:EB Y:0 P:74
$FF41: 8D STA $8000 A:6 X:EB Y:0 P:74
$FF44: BD LDA $1ED,X A:6 X:EB Y:0 P:74
$FF47: A ASL A
$FF48: 8D STA $8001 A:2 X:EB Y:0 P:74
$FF4B: A9 LDA #$0 A:2 X:EB Y:0 P:74
$FF4D: 8D STA $6D8 A:0 X:EB Y:0 P:76
$FF50: 68 PLA
$FF51: AA TAX
$FF52: 68 PLA
$FF53: CD CMP $BFFF A:1 X:FF Y:0 P:74
$FF56: D0 BNE
$FF58: 60 RTS
$FC52: 60 RTS
$E0A2: 4C JMP $E169 A:1 X:FF Y:0 P:77
$E169: 68 PLA
$E16A: A8 TAY
$E16B: 68 PLA
$E16C: AA TAX
$E16D: 68 PLA
$E16E: 40 RTI
***NMI ENDS***
$FF32: BA TSX
$FF33: BD LDA $1F9,X A:7 X:F7 Y:5F P:A0
$FF36: A ASL A
$FF37: 9 ORA #$1 A:C X:F7 Y:5F P:20
$FF39: 8D STA $8001 A:D X:F7 Y:5F P:20
(Here is right value=13 to select in bank A. Remember $8000 at start of code (It is the complement of this!),
but since NMI was triggered. NMI did send value 3 to $8001, also NMI change $8000 command number to 6!
and now BANK_A=$6000 (3*8192) (incorrect address), then game crashes)
How can i repair it?.
If i write to $8000 command 7, but just after it NMI is triggered and i cannot complete my next $8001
to execute command. And NMI uses $8000 and $8001 newly. what can i do?. My problem is bad timing?
I am ok with nmi supression.
Know guys?, when dd3 rom crashes, i patch it doing PC=$FF53 and manually doing a bankswitch using $0D for A=$1A000
and game run good!, but i dont like patches...