Here is a patch that converts Ninja Gaiden's mapper from MMC1 to MMC3. Documentation is included.
7/18-25/13
infidelity
Converting Ninja Gaiden from MMC1 to MMC3
RED BOLD INDICATES START OF MY ACTUAL FINALIZED PASTES. FOR NOW THESE ARE JUST MY RANDOM NOTES/TESTS.
MMC1 Bankswap for Ninja Gaiden is at $1C03A
MMC3 Bankswap at $1FFC8 = 0A48A9068D0080688D0180090148A9078D0080688D018060
20B8FF is new jsr bankswap routine
decyphering the rom, trickier than i predicted
$1F9A8 = A556 8DFFBF
$1F9BD = A559 8DFFDF
$1F9F9 = A201 8EFFFF
$1002F looks to be 1E into the $9FFF
chr mode = 4kb
prg mode = 16kb
$8000 swappable
vertical mirror
$56 = Change Entire Left PPU (deals with portion of hud, looks to be the Sprite 0)
$57 = PPU Page For Sprites
$58 = ???
$59 = Change Entire Right PPU (deals with all of hud)
$5A = PPU Page For Background
hmm, put 60 at $101F9, and it will do the flash Act intro.
i might need to have the CHR routine located at $1FA2F, it needs to be constant.
sound engine initiation is located at $1F9F9, i need to put A903, then jsr to bankswap, and now the game has sound.
so this is what i have..............
$1FFC8 = 0A48A9068D0080688D0180090148A9078D0080688D018060
$1C03A = 20B8FF 60
$1C03E = 00000000000000000000000000000000
$1C05E = CA8E15404C62C000000000000000000000000000
$1F9A8 = left alone, this is the original ppu setup
$1F9F9 = A90320B8FF4CFBF900000000000000000000(enable sound engine)
$1FA10 = 20B8FF4C13FA00000000000000000000000000
$101F9 = 60000000000000000000000000000000000000(this enables the fly-by act sequence, and it also plays the cutscenes, like after the title screen)
At this point it's semi playable, but garbage looking, and no way to setup the chr
$1F5BC = A55A this is the ppu chr setup for ; $5A = PPU Page For Background
$1F5D1 = A557 this is the ppu chr setup for ; $57 = PPU Page For Sprites
$1F9A8 = A556 this is the ppu chr setup for ; $56 = Change Entire Left PPU (deals with portion of hud)
$1F9BD = A559 this is the ppu chr setup for ; $59 = Change Entire Right PPU (and major portion of hud)
Need to create a new ppu engine since the old chr-rom is obsolete. tiles 00-FF represent 1 full page. There are total of 1F pages within Ninja Gaiden.
For the mmc3 ppu, 00-01 represents 00-7F tiles. 02-03 represents 80-FF tiles.
Original New
---------- ------
00 00 & 02
01 04 & 06
02 08 & 0A
03 0C & 0E
04 10 & 12
05 14 & 16
06 18 & 1A
07 1C & 1E
08 20 & 22
09 24 & 26
0A 28 & 2A
0B 2C & 2E
0C 30 & 32
0D 34 & 36
0E 38 & 3A
0F 3C & 3E
10 40 & 42
11 44 & 46
12 48 & 4A
13 4C & 4E
14 50 & 52
15 54 & 56
16 58 & 5A
17 5C & 5E
18 60 & 62
19 64 & 66
1A 68 & 6A
1B 6C & 6E
1C 70 & 72
1D 74 & 76
1E 78 & 7A
1F 7C & 7E
I have created a custom chr routine for Ninja Gaiden. Right now here is a bare setup for just the 2 registers $56 & $59
$1F9A8 = 2020FA 4CC2F9 000000000000000000000000000000000000000000000000000000000000000000000000
$1FA30 = A456 B9B0FB 8DFA07 B9D0FB 8DFB07 A459 B9B0FB 8DFC07 38 6901 8DFE07 B9D0FB 38 E901 8DFD07 38 6901 8DFF07 A205 8E0080 BDFA07 8D0180 CA 10F4 60
$1FBC0 (new mmc3 chr table) = 0004080C1014181C2024282C3034383C4044484C5054585C6064686C7074787C
$1FBE0 (new mmc3 chr table) = 02060A0E12161A1E22262A2E32363A3E42464A4E52565A5E62666A6E72767A7E
$1C062 = A900 8D00A0 4C62C0 (set boot up mirroring and $8000)
$1C06A = A980 8D01A0 EAEAEA (set wram)
$1FFBC = A900 8D00A0 60 (vertical mirroring)
$1FFC2 = A901 8D00A0 60 (horizontal mirroring)
With that going, the story mode shows all the right gfx, but i need to figure out where the text is being read from, cause that is not being read correctly, the text comes up as sprite pieces....
OK, $38A deals with the dialog chr. Cant do nothing with it though, idk how to make 2 separate chr routines go on without an irq engine...
Trying to find where the original mirroring is...
$1C controls the current nametable
$1C08B sets $1C as B0
$1F9D7 reads $1C and stores it into $2000
But what controls the mirroring...
A91E 851D 20E981(to 8DFF9F) soooo
CHR Size = 4kb mode
PRG Size = 16kb mode
$8000 swappable
Mirroring Vertical
idk, it looks like the A9 1E 20E981 is the culprit, but when i try to change it to 1F, i don't get the desired nametable change....I have to add it after it, like inserting a custom jsr...
$10032 is the first 20E981
$10456 is the second 20E981
ok, i found a table that has certain values in it, and some of them contain 1E & 1F, and if i change certain ones, it does change the mirroring!
Mirroring
-----------
$10F0F = Title Screen (1E)
$10F97 = Story (1F)
$127A5 = Ninja Gaiden Act - #
$10179 = (within asm) Start Level (1E)
So i'm doing more research, $10EF0 - $10F0B loads a 1C byte table, with 2 bytes each, low/high addresses, and from the starting address, it looks to be the 4th byte as the mirroring/$8000-$9FFF value, but that's from the title screen so it may be different for other things....
The asm from $1068F-$1069C is what is loading the indirect address values from $0A, that is getting the mirroring byte within all that other data, so maybe when this string of asm is finished, i should setup some kind of special mirroring table? or, do some checks of 1E/1F, and have it branch to the appropiate mmc3 $A000 mirroring setup?....And most likely do the sae for the 20E981 parts as well.
$1002E = A91E 851D 20E981
$10453 = 8C8503 20E981
$10178 = A91E 20E981
Again, from MMC1, here is 1E/1F being stored into $9FFF
CHR Size = 4kb mode ;mmc1 $9FFF ;mmc3 $8000
PRG Size = 16kb mode ;mmc1 $9FFF ;mmc3 $8000
$8000 swappable ;mmc1 $9FFF ;mmc3 $8000
Mirroring Vertical ;mmc1 $9FFF ;mmc3 $A000
add maybe A980 8D01A0
20ACFF = vertical mirroring
20B2FF = horizontal mirroring
OK SO HERE IS THE FIXED MIRRORING
$10032 = 20E981
$101F9 = A900 20ACFF 60
$10178 = A900 20ACFF
$10456 = 20E0BE
$13EF0 = C91E F004 C91F F006 A901 20ACFF 60 A900 20B2FF 60
So with these changes so far, the title screen, story, ninja gaiden act - #, all work and appear correctly.
NOW, it is the in-game play that is horrifficly screwed up.
HERE ARE MY FINALIZED PASTES
SETUP BANKSWAP ROUTINE/SOUND ENGINE INITIATE/HUD & SPRITE CHR
$1C03A = 20B8FF 60 00000000000000000000000000000000
$1C05D = E8 CA 4C5FC0 00000000000000000000000000
$1F9A8 = (chr asm) 2020FA 4CC2F9 000000000000000000000000000000000000000000000000000000000000000000000000
$1F9F9 = A903 20B8FF 4CFBF9 00000000000000000000
$1FA10 = 20B8FF 4C13FA 00000000000000000000000000
$1FA30 = (chr routine) A456 B9B0FB 8DFA07 B9D0FB 8DFB07 A459 B9B0FB 8DFC07 38 6901 8DFE07 B9D0FB 38 E901 8DFD07 38 6901 8DFF07 A205 8E0080 BDFA07 8D0180 CA 10F4 60
$1FBC0 = (chr table) 0004080C1014181C2024282C3034383C4044484C5054585C6064686C7074787C
$1FBE0 = (chr table) 02060A0E12161A1E22262A2E32363A3E42464A4E52565A5E62666A6E72767A7E
$1FFBC = (mirroring) A900 8D00A0 60 A901 8D00A0 60
$1FFC8 = (mmc3 bankswap) 0A 48 A906 8D0080 68 8D0180 0901 48 A907 8D0080 68 8D0180 60
END
ENABLE PROPER MIRRORING
$10178 = A900 20ACFF
$101F9 = A900 20ACFF 60 00000000000000000000000000
$10456 = 20E0BE
$13EF0 = C91E F004 C91F F006 A901 20ACFF 60 A900 20B2FF 60
END
$1F496 = 20B8FF 4C95F4 000000000000000000
FIX PROPER IN-GAME NAMETABLE TILE CONSTRUCTION
$1F509 = A901 20B8FF 4C0BF5 00000000000000000000
END
$1F5FC = 20B8FF 4CFBF5 000000000000000000
$1F94A = 4C4AF9
FIX IN-GAME PALETTE FADE IN SEQUENCE (using $7F9 as a toggle register to allow/not allow reset of indirect address at $13, which is needed for proper HUD palette fade out)
$1F6E2 = 20A0FB
$1FBB0 = A900 8DF907 98 2045F7 60
$1F6D6 = 20AAFB
$1FBBA = A9008D010760
END
FIX THE IN-GAME PALETTE FADE OUT (HUD) ISSUE
$1F769 = 2080FA EAEA
$1FA90 = ADF907 D009 A900 8513 A901 8DF907 B113 9D0007 60
FIX STRIKEABLE ITEMS TO APPEAR PROPERLY THROUGHOUT GAME
$1F527 = 2070FA EAEA
$1FA80 = A902 20B8FF A996 8D1807 60
$1D8E5 = A902 20B8FF 4CE8D8 0000000000000000000000
END
ENABLE 2 SETS OF CHR ROTUINES AT ONCE (for cutscenes)
$1029F = 20B0BE
$13EC0 = A2058E0080BDC0BE8D0180CA10F460
$13ED0 = 00 00 40 41 42 43
$1029F = 20A0BE
$13EB0 = A900 8DEA07 8DEB07 AC8A03 B9B0FB 8DEC07 38 6901 8DEE07 B9D0FB 38 E901 8DED07 38 6901 8DEF07 A205 8E0080 BDEA07 8D0180 CA 10F4 60
END
I NEED TO REDO CERTAIN PARTS OF THE HW BANK. I GET ODD RTI RETURNS WHICH FREEZE THE ROM. PARTICULARY DURING THE ACT-II SCENE WHEN RYU RECEIVES THE STATUE
$1F9A8 = 4C20FA EAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEA
$1FA30 = A456 B9B0FB 8DFA07 B9D0FB 8DFB07 A459 B9B0FB 8DFC07 38 6901 8DFE07 B9D0FB 38 E901 8DFD07 38 6901 8DFF07 A205 8E0080 BDFA07 8D0180 CA 10F4 4C9BF9
$1F9F9 = A903 20B8FF EAEAEAEAEAEAEAEAEAEAEAEAEA
$1FA10 = 20B8FF EAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEA
END
ENABLE 2 SETS OF CHR ROTUINES AT ONCE (for in-game play) HORRIFICLY LONG, BUT IT WAS THE ONLY WAY TO MAKE IT HAPPEN, MY OTHER ATTEMPTS FROZE THE GAME....
$1F5BC = 4CA0FA 000000000000000000000000000000000000000000000000000000000000000000000000000000
$1FAB0 = A900 20B8FF 2000B8 4CD6F5
$3810-$38EF (CMP & JMP Tables for 00-1F within $57) = A557 F07C C901 F07B C902 F07A C903 F079 C904 F078 C905 F077 C906 F076 C907 F075 C908 F074 C909 F073 C90A F072 C90B F071 C90C F070 C90D F06F C90E F06E C90F F06D C910 F06C C911 F06B C912 F06A C913 F069 C914 F068 C915 F067 C916 F066 C917 F065 C918 F064 C919 F063 C91A F062 C91B F061 C91C F060 C91D F05F C91E F05E C91F F05D 4CE0B9 4CF7B9 4C0EBA 4C25BA 4C3CBA 4C53BA 4C6ABA 4C81BA 4C98BA 4CAFBA 4CC6BA 4CDDBA 4CF4BA 4C0BBB 4C22BB 4C39BB 4C50BB 4C67BB 4C7EBB 4C95BB 4CACBB 4CC3BB 4CDABB 4CF1BB 4C08BC 4C1FBC 4C36BC 4C4DBC 4C64BC 4C7BBC 4C92BC 4CA9BC
$3900-$39DF (CMP & JMP Tables for 00-1F within $5A) = A55A F07C C901 F07B C902 F07A C903 F079 C904 F078 C905 F077 C906 F076 C907 F075 C908 F074 C909 F073 C90A F072 C90B F071 C90C F070 C90D F06F C90E F06E C90F F06D C910 F06C C911 F06B C912 F06A C913 F069 C914 F068 C915 F067 C916 F066 C917 F065 C918 F064 C919 F063 C91A F062 C91B F061 C91C F060 C91D F05F C91E F05E C91F F05D 4CD0BC 4CF1BC 4C12BD 4C33BD 4C54BD 4C75BD 4C96BD 4CB7BD 4CD8BD 4CF9BD 4C1ABE 4C3BBE 4C5CBE 4C7DBE 4C9EBE 4CBFBE 4CE0BE 4C01BF 4C22BF 4C43BF 4C64BF 4C85BF 4C00B6 4C21B6 4C42B6 4C63B6 4C84B6 4CA5B6 4CC6B6 4CE7B6 4C08B7 4C29B7
$39F0-$3CCF (Proper CHR Setup For $57 Sprites) = A9008D0080A9008D0180A9018D0080A9028D01804CF0B8A9008D0080A9048D0180A9018D0080A9068D01804CF0B8A9008D0080A9088D0180A9018D0080A90A8D01804CF0B8A9008D0080A90C8D0180A9018D0080A90E8D01804CF0B8A9008D0080A9108D0180A9018D0080A9128D01804CF0B8A9008D0080A9148D0180A9018D0080A9168D01804CF0B8A9008D0080A9188D0180A9018D0080A91A8D01804CF0B8A9008D0080A91C8D0180A9018D0080A91E8D01804CF0B8A9008D0080A9208D0180A9018D0080A9228D01804CF0B8A9008D0080A9248D0180A9018D0080A9268D01804CF0B8A9008D0080A9288D0180A9018D0080A92A8D01804CF0B8A9008D0080A92C8D0180A9018D0080A92E8D01804CF0B8A9008D0080A9308D0180A9018D0080A9328D01804CF0B8A9008D0080A9348D0180A9018D0080A9368D01804CF0B8A9008D0080A9388D0180A9018D0080A93A8D01804CF0B8A9008D0080A93C8D0180A9018D0080A93E8D01804CF0B8A9008D0080A9408D0180A9018D0080A9428D01804CF0B8A9008D0080A9448D0180A9018D0080A9468D01804CF0B8A9008D0080A9488D0180A9018D0080A94A8D01804CF0B8A9008D0080A94C8D0180A9018D0080A94E8D01804CF0B8A9008D0080A9508D0180A9018D0080A9528D01804CF0B8A9008D0080A9548D0180A9018D0080A9568D01804CF0B8A9008D0080A9588D0180A9018D0080A95A8D01804CF0B8A9008D0080A95C8D0180A9018D0080A95E8D01804CF0B8A9008D0080A9608D0180A9018D0080A9628D01804CF0B8A9008D0080A9648D0180A9018D0080A9668D01804CF0B8A9008D0080A9688D0180A9018D0080A96A8D01804CF0B8A9008D0080A96C8D0180A9018D0080A96E8D01804CF0B8A9008D0080A9708D0180A9018D0080A9728D01804CF0B8A9008D0080A9748D0180A9018D0080A9768D01804CF0B8A9008D0080A9788D0180A9018D0080A97A8D01804CF0B8A9008D0080A97C8D0180A9018D0080A97E8D01804CF0B8
$3CE0-$3FB5 (Proper CHR Setup For $5A BG Part 1of2) = 20B8BFA9008D018020BEBFA9018D018020C4BFA9028D018020CABFA9038D01806020B8BFA9048D018020BEBFA9058D018020C4BFA9068D018020CABFA9078D01806020B8BFA9088D018020BEBFA9098D018020C4BFA90A8D018020CABFA90B8D01806020B8BFA90C8D018020BEBFA90D8D018020C4BFA90E8D018020CABFA90F8D01806020B8BFA9108D018020BEBFA9118D018020C4BFA9128D018020CABFA9138D01806020B8BFA9148D018020BEBFA9158D018020C4BFA9168D018020CABFA9178D01806020B8BFA9188D018020BEBFA9198D018020C4BFA91A8D018020CABFA91B8D01806020B8BFA91C8D018020BEBFA91D8D018020C4BFA91E8D018020CABFA91F8D01806020B8BFA9208D018020BEBFA9218D018020C4BFA9228D018020CABFA9238D01806020B8BFA9248D018020BEBFA9258D018020C4BFA9268D018020CABFA9278D01806020B8BFA9288D018020BEBFA9298D018020C4BFA92A8D018020CABFA92B8D01806020B8BFA92C8D018020BEBFA92D8D018020C4BFA92E8D018020CABFA92F8D01806020B8BFA9308D018020BEBFA9318D018020C4BFA9328D018020CABFA9338D01806020B8BFA9348D018020BEBFA9358D018020C4BFA9368D018020CABFA9378D01806020B8BFA9388D018020BEBFA9398D018020C4BFA93A8D018020CABFA93B8D01806020B8BFA93C8D018020BEBFA93D8D018020C4BFA93E8D018020CABFA93F8D01806020B8BFA9408D018020BEBFA9418D018020C4BFA9428D018020CABFA9438D01806020B8BFA9448D018020BEBFA9458D018020C4BFA9468D018020CABFA9478D01806020B8BFA9488D018020BEBFA9498D018020C4BFA94A8D018020CABFA94B8D01806020B8BFA94C8D018020BEBFA94D8D018020C4BFA94E8D018020CABFA94F8D01806020B8BFA9508D018020BEBFA9518D018020C4BFA9528D018020CABFA9538D01806020B8BFA9548D018020BEBFA9558D018020C4BFA9568D018020CABFA9578D018060
$3610-$3759 (Proper CHR Setup For $5A BG Part 2of2) = 20B8BFA9588D018020BEBFA9598D018020C4BFA95A8D018020CABFA95B8D01806020B8BFA95C8D018020BEBFA95D8D018020C4BFA95E8D018020CABFA95F8D01806020B8BFA9608D018020BEBFA9618D018020C4BFA9628D018020CABFA9638D01806020B8BFA9648D018020BEBFA9658D018020C4BFA9668D018020CABFA9678D01806020B8BFA9688D018020BEBFA9698D018020C4BFA96A8D018020CABFA96B8D01806020B8BFA96C8D018020BEBFA96D8D018020C4BFA96E8D018020CABFA96F8D01806020B8BFA9708D018020BEBFA9718D018020C4BFA9728D018020CABFA9738D01806020B8BFA9748D018020BEBFA9758D018020C4BFA9768D018020CABFA9778D01806020B8BFA9788D018020BEBFA9798D018020C4BFA97A8D018020CABFA97B8D01806020B8BFA97C8D018020BEBFA97D8D018020C4BFA97E8D018020CABFA97F8D018060
END
NOW WITH MY NEW $57 & $5A SETUPS, THE SPRITE 0 IRQ SHOWS A THIN LINE OF GLITCHINESS. SO I WILL RAISE THE SPRITE 0'S Y POSITION BY 1. SO IT WILL GO FROM A VALUE OF 26, TO 25
$1EB23 = 25
END
Ninja Gaiden is now a fully working MMC3 rom!
-infidelity
Ninja Gaiden (USA).nes - NOINTRO
CRC32: 11F953F6
MD5: 0C2CCCDA6BA6CAB7BEDE0FF05E7F6852
SHA-1: CA513F841D75EFEB33BB8099FB02BEEB39F6BB9C
SHA-256: 07D9E57E35184667C7B89E30857A44C5C404B48332AD12E66BE91100ECCD4F5E