News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Question about Metal Gear NES  (Read 937 times)

Dracula X

  • Full Member
  • ***
  • Posts: 115
    • View Profile
    • My YouTube Page for ROM hacking
Question about Metal Gear NES
« on: June 06, 2020, 05:33:17 pm »
Is this RAM location $FFDD - $FFE5 used for something or is it just an empty space to use it for anything?

I found the location on where to put the code but it's 8 bytes long.

If I enter this code as I did for The Guardian Legend:

Code: [Select]
 
Bankswitch:
        ASL
ORA #$80
STA $5115
RTS

Some things on the game might not work correctly. The Guardian Legend for example, on corridor 0, the first comment didn't appear because of that bankswitch code.
I might go back to Thunder Force II hacking again.

Bregalad

  • Hero Member
  • *****
  • Posts: 2736
    • View Profile
Re: Question about Metal Gear NES
« Reply #1 on: June 07, 2020, 08:07:44 am »
$FFDD-$FFE5 is not RAM. It is part of the ROM area at $8000-$FFFF. On this particular case of Metal Gear, it uses a mapper so that when writing back to $8000-$FFFF it will bankswitch (mapper #2 or UNROM board).

To avoid bus conflicts however the ROM has to contian the same vaules as the one used for bankwitching, so that to switch bank #0 you have to write $00 to a ROM location already containing $00, same for bank 1, 2,... until 6 or 7. (Bank #7 is already present at $C000-$FFFF so there's no reason to swap a second copy of it at $8000-$BFFF). There's various ways of handling this, and apparently the game has a table with the values 0, 1, 2, 3, 4, 5, 6 ,7 at this particular location you mentionned.

Quote
Bankswitch:
        ASL
   ORA #$80
   STA $5115
   RTS
$5115 is an unused location except if you use MMC5. However you cannot change from mapper #2 to MMC5 just by changing the bankswitch code, MMC5 needs a lot of complex initialization, in particular to set the appropriate PRG and CHR switching mode, the appropriate nametable mirroring mode, and to disable some features such as IRQs, sound, etc...

I do not recommand mapper hacking the game to use MMC5 mapper unless you're actually going to use MMC5 features.