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

Author Topic: Castlevania (PRG 1) Mapper Change  (Read 2112 times)

Whipon

  • Jr. Member
  • **
  • Posts: 15
    • View Profile
Castlevania (PRG 1) Mapper Change
« on: October 29, 2019, 10:03:42 pm »
Hello, good night!.

Recently I played some Castlevania hacks I had in my collection that I downloaded from this site.
Between those hacks, I have Castlevania - The Holy Relics, by Optomon.
http://www.romhacking.net/hacks/3759/
I must say he made an excellent work. But sadly its not compatible with NaOH Improved Controls hack.
http://www.romhacking.net/hacks/3867/
I managed to integrate this last hack in several Castlevania hacks, because there is free rom space avalaible. But The Holy Relics has almost all empty space used.

Then I tought about using one of the mapper hacks already avalaible:
MMC3:
http://www.romhacking.net/hacks/2457/
MMC5:
http://www.romhacking.net/hacks/2360/

That would increase the avalaible space. But I cannot use any of them, because Optomon's hack uses the PRG 1 rom, and these mapper hacks are for PRG 0.

I will really appreciate any help. I have a good 6502 asm understanding, but mapper change hacks are something that I find very difficult.

Regards ;).

Whipon.

Disch

  • Hero Member
  • *****
  • Posts: 2746
  • NES Junkie
    • View Profile
Re: Castlevania (PRG 1) Mapper Change
« Reply #1 on: October 29, 2019, 11:57:22 pm »
My first approach would be to compare PRG0 and PRG1 ROMs, see where the differences are (turns out there are quite a lot) and then look at one of the mapper hacks to see which patched areas, if any, overlap those differences.

Basically, I'd adapt the mapper hack to work with a PRG1 ROM.


-----  Goes do actually do that -----

So it looks like the MMC5 hack changes very little.  The only conflict with PRG1 is there's a swapping routine that moved forward $40 bytes into the ROM.

I'm willing to bet if you modify the ips to move where that routine gets patched to, it'll work very easily for PRG1


----- Goes to actually try that -----

Ack, that didn't work.  There must be some other swapping routine that got added.


Then it looks like the best way to go, here would just be to make a new mapper hack that works with PRG1 or whatever ROM hacks you're using.  I'm not willing to put that much effort into this myself, but it shouldn't be too hard.


Quote
but mapper change hacks are something that I find very difficult.

They're really quite simple.  Don't be too intimidated by them!  This seems like a perfect opportunity to learn how to do it!

Honestly, I've always said that anyone able to make use of a changed mapper would be able to change the mapper themselves, as the former is considerably more difficult.  If you're confident in your 6502 skills, then you're already 95% of the way there.



Mapper hacks basically consist of two parts:

1) Add/Modify code in the game's startup section (ie:  reset vector) to prep/initialize the new mapper instead of the old one.  Mapper 2 doesn't really have any initialization code, but any new mapper you pick probably will, so you'll likely have to add new code.

"initalization" code just means setting all mapper configuration stuff into a known state.  For example, MMC3 has multiple swapping mode options, mirroring mode settings, etc.  At startup, you'll want to set all those to be what the game expects.  Don't just assume things will be in the proper state when starting up -- you have to explicitly set them.



2) Any time the game writes to a mapper register, replace that code with new code that has the same effect on the new mapper.  In Castlevania's case, the only code that writes to a mapper reg will be PRG swap code, which means you'll just need to write one PRG swap routine, and whenever the original game writes to the mapper regs, just replace that with a JSR to your new routine.



And that's really it.  As long as you understand how both mappers work, there's not really a whole lot that can go wrong.

Whipon

  • Jr. Member
  • **
  • Posts: 15
    • View Profile
Re: Castlevania (PRG 1) Mapper Change
« Reply #2 on: October 30, 2019, 08:24:12 pm »
Thank you very much, Disch ;).

I'll give it a try and then I'll update this topic.

Have a nice day!.