Huang Di (NES) mystery - jumping glitch and Powerpak mappers

Started by RetroProf, May 11, 2023, 05:11:27 AM

Previous topic - Next topic

RetroProf

I've got a weird mystery here and it's been driving me crazy. Does anyone have any information regarding this?

Huang Di: Zhuo Lu Zhi Zhan is an unlicensed NES game developed and published by Asder on 1994. HG101 article on it written by me.

Infamously when using an emulator the internal timing is off and your jumping is infinite.

This RHDN user wanted to make a Game Genie code to fix it.

Playing the original cartridge on a real Famicom fixes this.

In 2012, I bought an NTSC American NES and Powerpak cartridge and confirmed that the game works normally when played on actual hardware.

I bought the cartridge used. I do not remember what version of mappers came pre-installed. I just know they were the original official mappers, and not one of the forks by Loopy or TheFox or the other programmers adding to it. Since then I've updated the Powerpak mappers as revised or modified editions came out and...

At some point the newer sets broke the game again, and the jumping glitch has returned.

The logical solution then would be to erase the POWERPAK folder container the mappers and revert to an older set. This is where stuff gets weird.

THIS is the page for the Powerpak listing the official mappers. Latest official is 1.34. They also have a legacy set from 1.20. However by playing with the URL address I managed to find 1.00 (direct ZIP download).

None of these correct the problem. I have erased the mapper folder and installed the 1.00 set, and each incremental set above that as listed in the changes TXT. All the way up to the 1.35 beta set, plus Loopy and other contributors additions.

NONE of them replicate the functionality I had in 2012. I am amazed and baffled at the fact I cannot revert to whatever set-up I had back then.

* The NES Powerpak has firmware which can be upgraded
* My ROMs are unchanged (it is not a ROM issue)
* My NES is the same as before, unchanged

The mapper for Huang Di is Mapper 112.

In the Powerpak folder this is the file MAP70 . MAP since the file names convert the mapper number to hexadecimal (112 = 70).

Can someone, anyone, explain any of this? At one point it absolutely worked, and now it doesn't, and unless my cart came with mapper sets earlier than 1.00, none of this makes any sense.

QUESTIONS:
1) Is this a firmware issue? Have I borked my cartridge by upgrading the firmware to 1.11? Can you downgrade the Powerpak firmware? I found the old 1.00 firmware but I fear I might destroy the cartridge downgrading it.

2) Can anyone confirm if an EverDrive N8 Pro runs the game correctly? Might be time to upgrade.

3) If you have a Powerpak, does yours run Huang Di correctly? If so can you please tell me which mapper sets you are using so I can replicate it?

4) Does anyone have any idea which Powerpak files are responsible for this change? I have been replacing the entire Powerpak mapper folder each time, since there are some files like B . MAP and I . MAP and Q . MAP, which I assumed were needed for the cartridge to function? If anyone has any experience with the Powerpak, do I need to replace everything each time I try a new set, or can I just drop a different MAP70 . MAP file in the folder?

5) Does anyone have any idea why or how this is happening? Emulators flat out cannot run it correctly. The original cartridge on Famicom works fine. The ROM on a flashcart used to work, but only with a very specific mapper version. Is the cause of the change in behaviour going to be mapper 112 (ie: MAP70 . MAP) or could there be other causes? Dirty connectors? Different memory card in the cart?

If anyone wants more information please ask.

Huang Di is one of the absolute best unlicensed games on the NES, and the mystery surrounding this is maddening. I wish I had never updated my mappers folder or firmware, because for a brief time it worked and now I can't go back!  :'(

EDIT:
This post apparently explains a bit more:
https://forums.nesdev.org/viewtopic.php?p=178159#p178159

"Huang Di, which expects $100 to be non-zero or else it believes it has debug cheats enabled, giving you moon jump and other great but likely unwanted things"

So in theory one could fix this with a Game Genie code, to force $100 to have a value of 1. Thing is, i don't know what $100 means in hex. Is it literally 0000:FF ?

Cyneprepou4uk

It's a RAM address $0100.

Game Genie doesn't modify RAM directly. Emulator cheats do.

RetroProf

Quote from: Cyneprepou4uk on May 11, 2023, 06:44:18 AMIt's a RAM address $0100.

Game Genie doesn't modify RAM directly. Emulator cheats do.

I see. Many thanks! I loaded my NES emu on Xbox and created a "cheat" at that address and it immediately fixed the problem.

30000100 0001 Adr:0x0100 val:1

But if this is the cause, then it's not a glitch at all, it's a built in debug mode that is accidentally triggered.

Which would imply it has nothing to do with the mappers, but is the result of the 1.11 firmware changing how RAM is initialised.

Does this mean there basically is no solution, since Game Genie can't modify startup RAM? Also a ROM patch isn't possible since it's inherently how the NES is being booted at startup?

Can anyone with an N8 Pro check to see how that works?

What the heck did they change with firmware 1.11 to break the RAM initialisation??

Cyneprepou4uk

#3
You can use these Game Genie codes to invert ingame checks for debug mode (make it think that debug mode is off while it's on, and vice versa)

EYOKIZEI (BNE -> BEQ)
ESOSLPEY (BEQ -> BNE)
EYOSZLEI (BNE -> BEQ)
EYKVALEI (BNE -> BEQ)

Or you can make a hack to disable debug mode when the game loads (set FF at $0100)

At 0x1D391 replace 8D 0F 01 with 20 A3 F7
At 0x1F7B3 replace 00 00 00 00 00 00 00 00 00 with 8D 0F 01 A9 FF 8D 00 01 60

Which results in

0x1D391 ($D381):
STA $010F -> JSR $F7A3

0x1F7B3 ($F7A3):
STA $010F
LDA #$FF
STA $0100
RTS

RetroProf

OH MY GOD.

It works! And I just made an IPS patch! And it works with the translation!

With your permission I'd like to submit the IPS patch to RHDN and credit you as author.

Or you can submit it. Either way I just want to see rhis accessible to all.

For years this mystery has weighed on my mind.

Others too, based on forum posts.

Thank you, sincerely.

Cyneprepou4uk

#5
Yeah, you can use it in any way you want.

RetroProf

It's up!

https://www.romhacking.net/hacks/7792/

I gave my name as the releaser (producer?), and Dwedit and Cyn as hackers, but Dwedit ended up as the front-person on the upload.

I personally don't care either way - the point is, AT LAST! THE GAME CAN BE PLAYED RIGHT!

Let me know if you feel there are mistakes in the Readme.

Many thanks to Cyn for the hacking!  :beer: