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

Author Topic: Nintendo Vs - Game Genie Free Play Codes  (Read 533 times)

Psyklax

  • Sr. Member
  • ****
  • Posts: 412
    • View Profile
    • Psyklax Translations
Nintendo Vs - Game Genie Free Play Codes
« on: October 20, 2017, 03:35:51 am »
A user in another thread asked about a Game Genie code for Vs Ice Climber to make it free play, therefore playable on a real NES using a flash cart, since you don't need to insert coins. The idea intrigued me: I'm a little surprised that Vs games work on the NES at all given that they use different PPUs between games, although the CPU is the same. But the idea intrigued me: I'd never really given Game Genie codes much thought before, as they just change one single byte in a ROM, which seems awfully primitive now. However, there's actually quite a fun challenge in trying to achieve what you want with just three bytes changed (a real Game Genie can only use three codes).

Of course gamehacking.org has thousands of codes for regular NES games, but I couldn't find anything for Vs games. The only ones there are cheats for Vs Super Mario Bros, which doesn't really solve the problem. So I took it upon myself to dive into every Vs game that is in the GoodNES set, and get them working with free play - or if they don't have it, make it as easy as possible to play.

Okay, enough talk, here are the codes. 8)

 Atari RBI Baseball
VTOYZNSX   Adds 1 credit at title screen
SXXNUEVK   Doesn't decrease credits at game start
SXNZKNVK   Doesn't decrease credits at inning break
 Balloon Fight
NOT WORKING ROM
 Baseball
NOT WORKING ROM
 Battle City
VTTKLT      Adds 1 credit at title screen
 Castlevania
OZUAZEPX   Free Play
 Clu Clu Land
OXAVKE      Free Play (must be input together)
LEPVOA      Free Play (must be input together)
 Dr. Mario
OZELEEPX   Free Play
 Duck Hunt
OZIASK      Free Play
 Excitebike
OXPGNN      Free Play
 Freedom Force
OZSVLVPX   Free Play (must be input together)
OZVTIVPX   Free Play (must be input together)
GAVTTVKY   Free Play (must be input together)
 Goonies, The
OXUNAOPX   Free Play
 Gradius
OZONASPX   Free Play
 Gumshoes
NOT WORKING ROM
 Hogan's Alley
OZIOZS      Free Play
 Ice Climber
OXLOIN      Free Play
 Mach Rider
OZPOVK      Free Play
 Mahjong
NOT WORKING ROM
 Mighty Bomb Jack
VTLEOZ      Adds 1 credit at title screen
OXZEXN      Doesn't decrease credits
 Ninja Jajamaru-kun
VTYXXI      Adds 1 credit at title screen
 Pinball
EYLEGA      Free Play
 Platoon
AESIKPPA   Free Play (must be input together)
OZOEEOPX   Free Play (must be input together)
OXNAKEPX   Free Play (must be input together)
 Slalom
XTPEKN      Free Play (must be input together)
OZPESN      Free Play (must be input together)
 Soccer
OZYYGX      Free Play
 Star Luster
VTGEIT      Adds 1 credit at title screen
 Stroke & Match Golf (Ladies or regular)
EYYEZA      Free Play
 Super Mario Bros.
OXLOYX      Free Play
 Super Sky Kid
VTZYUP      Adds 1 credit at title screen
 Super Xevious - GAMP no Nazo
VTXZXXSE   Adds 1 credit at power on
SXKZISVK   Doesn't decrease credits (must be input together)
SXKXASVK   Doesn't decrease credits (must be input together)
 Tennis
NOT WORKING ROM
 Tetris
OZPUVV      Infinite credits
 TKO Boxing
VTELSSSX   Adds 1 credit at title screen
 Top Gun
NOT WORKING ROM
 Wrecking Crew
NOT WORKING ROM but M01 hack does not require patching

Now some more explanation.

As you see, some ROMs from the GoodNES set would just give me a blank screen in FCEUX, so I had no choice but to give up on them. Thankfully most of the games have free play options with the correct dipswitch settings, so they were easy to hack. Usually I would find the part of the code that looks for the specific free play setting, and tell it to do free play anyway. Some games don't have a free play option, however, so I had to get creative to do it in just three bytes or less. The usual method was to somehow add a credit at the title screen or as the game boots, then - if necessary - tell it not to decrease credits after using them. Sometimes that's unnecessary because it will add a new credit anyway.

I hope these codes will be of use to anyone interested in playing Vs games on a NES - in fact, I'm keen to get some feedback of this actually working, since I can't test on a real NES myself. Of course, if you're using a flash drive you could just use hacked ROMs instead of putting in GG codes, but whatever.

A note: in the case of most of the non-free play games, you only get one credit, which is fine for a one player game but does mean you can't play two player - and since it's called the "Vs System", I imagine that that's part of the point. Adding more than one credit is a bit trickier than just adding one. Sometimes I would hack it so that it would keep adding credits ad infinitum, but that's not very elegant, especially since it would wrap around. If anyone finds having one credit to be a problem they can let me know, but I think it'll be fine for most people. :)

(also, Wrecking Crew has an M01 mapper hack in the GoodNES set that adds credits with Select, therefore a hack is unnecessary)

EDIT: another note. Using these codes will often mean you don't see the title screen/attract mode. I know that a more pleasant solution will be changing the coin mechanism to be the NES Start button (as Select is used to start the game here) but that would require telling the program to check a different register for a different value, and would need more than Game Genie to do properly. Plus, I still don't understand how the NES reads controller input...
« Last Edit: October 20, 2017, 04:14:44 am by Psyklax »

KingMike

  • Forum Moderator
  • Hero Member
  • *****
  • Posts: 6174
  • *sigh* A changed avatar. Big deal.
    • View Profile
Re: Nintendo Vs - Game Genie Free Play Codes
« Reply #1 on: October 20, 2017, 10:58:50 pm »
I'm surprised flash cart mappers don't have something in the VS mappers to support that.

I remember one of the NES Test Carts would respond to the coin input button with a Famicom microphone input. Though I don't know if that's something that should normally happen or just a fluke with whatever emulator someone was using to report on it.

As to how the NES controller is read:
It sends input one button each time it is read. You will pretty much always write 1 then 0 to the controller port (or was is the reverse?) to reset or "strobe" it (so you can tell what button each read corresponds to, as the order is fixed once you strobe it, so the next read will be A, the first button in the sequence).
You need to do 8 reads of the controller port to get the 8 buttons/directions.
A good routine will follow each read with an AND so that only the relevant bits are read from the controller port, and then they will usually ROL or ROR that into a memory address.
So that after 8 reads, the RAM byte used will be filled with the status of all 8 buttons in a single byte.

The good news is that most games store their data together. Typically four bytes: P1 "held" (the raw data from the controller port), P1 "pushed" (the data after some filtering to get only the buttons newly pushed on the current frame) as well as P2 counterparts. So you can set a read breakpoint for 4016/4017 and see the RAM addresses used for the controller input right there in the debugger.

While games developed for the NES might do an AND #$01 after reading 4016/4017 to filter only the controller data pin, Famicom games should take data from either bit 0 (lowest bit) or bit 1 of the port. Supposedly that was a mandate from Nintendo for compatibility with external controllers. (some right-shifting to read a button as "pushed" if either bit 0 or bit 1 is 1)
Quote
Sir Howard Stringer, chief executive of Sony, on Christmas sales of the PS3:
"It's a little fortuitous that the Wii is running out of hardware."

Asaki

  • RHDN Patreon Supporter!
  • Full Member
  • *****
  • Posts: 141
    • View Profile
Re: Nintendo Vs - Game Genie Free Play Codes
« Reply #2 on: October 21, 2017, 02:46:58 am »
I can test them on real hardware, but I believe with VS games you have to hack the palettes as well.

Psyklax

  • Sr. Member
  • ****
  • Posts: 412
    • View Profile
    • Psyklax Translations
Re: Nintendo Vs - Game Genie Free Play Codes
« Reply #3 on: October 21, 2017, 02:53:00 am »
I can test them on real hardware, but I believe with VS games you have to hack the palettes as well.

This is precisely why I'm curious about it working on real hardware. :) Every game looks fine in FCEUX, but who knows if it's correct on the real thing. Of course, they were originally on arcade ROM boards, so maybe the .nes files in the GoodNES set are adapted versions or something. Only one way to find out...

KingMike: thanks for the info on controller input, though I'm still not sure how it works. It confused me that the $4016 register could get info about all eight buttons from one bit. I'll have to do a bit of messing around with the debugger to figure it all out.

Asaki

  • RHDN Patreon Supporter!
  • Full Member
  • *****
  • Posts: 141
    • View Profile
Re: Nintendo Vs - Game Genie Free Play Codes
« Reply #4 on: October 21, 2017, 04:00:07 am »
The emulators must be programmed to adjust the palettes based on the ROM's CRC. I used GGGuy to hard-patch the ROMs, and now Nestopia loads them all with garbled palettes, like on a real NES.

Psyklax

  • Sr. Member
  • ****
  • Posts: 412
    • View Profile
    • Psyklax Translations
Re: Nintendo Vs - Game Genie Free Play Codes
« Reply #5 on: October 21, 2017, 04:16:24 am »
The emulators must be programmed to adjust the palettes based on the ROM's CRC. I used GGGuy to hard-patch the ROMs, and now Nestopia loads them all with garbled palettes, like on a real NES.

Interesting. Changing the palettes could simply be a case of copying them from the original ROM to the Vs ROM, though that kind of negates the whole Game Genie thing. On the other hand...

I just had a play with controller inputs and it was easier than I thought. I loaded up Mega Man knowing that it just waits for a Start button press and does nothing else. Sure enough, doing a read of $4016 shows the result being stored in RAM and then a check is done to see if $08 is there (the bit for the Start button). So I changed it to $01 (the A button), and hey presto, it starts the game when you press the A button.

Given the combination of wrong palette and needing to mess with coin settings, I think it would be a good idea to make patches instead so that Select inserts coins and Start, er, starts. I'm gonna have a look later...

Asaki

  • RHDN Patreon Supporter!
  • Full Member
  • *****
  • Posts: 141
    • View Profile
Re: Nintendo Vs - Game Genie Free Play Codes
« Reply #6 on: October 21, 2017, 04:53:39 am »
If you do go that route, some of the VS games have already been patched: http://krikzz.com/forum/index.php?topic=524.0
Maybe you could ask him how he tackled the palettes?

Psyklax

  • Sr. Member
  • ****
  • Posts: 412
    • View Profile
    • Psyklax Translations
Re: Nintendo Vs - Game Genie Free Play Codes
« Reply #7 on: October 21, 2017, 05:16:09 am »
If you do go that route, some of the VS games have already been patched: http://krikzz.com/forum/index.php?topic=524.0
Maybe you could ask him how he tackled the palettes?

Yeah, I saw that site already, but I'm the kind of person who likes to do things myself. :)

I've just had a look at the palette situation. I hardpatched my Dr Mario fix and the palette got messed up in FCEUX (I really should've noticed that somewhere along the line). I compared it with the retail version and noticed the palettes do have totally different values. I tried copy-pasting the entire $90 bytes of palette data from the retail to the Vs version, and the title screen was fixed! But then the main game still looked wrong.

Clearly it's a case of swapping colours, so for example $0A on a real NES is $38 on the Dr Mario PPU. Nesdev suggests that there were several different PPUs used on several games and gives the apparent list of colours.

I think it would be pretty straightforward to see what colour corresponds to each colour between the games. I think I'll go through each game and make patches that I can upload to RHDN. Sure, you could go to other sites to get patches, but I'd rather do it myself and put them here. :)

EDIT: and I've just figured out a simple way to do it: table files. Use the info from nesdev to make a table file, then use it to convert the palette to the correct one. I'm definitely gonna give this a try later...
« Last Edit: October 21, 2017, 05:38:31 am by Psyklax »

KingMike

  • Forum Moderator
  • Hero Member
  • *****
  • Posts: 6174
  • *sigh* A changed avatar. Big deal.
    • View Profile
Re: Nintendo Vs - Game Genie Free Play Codes
« Reply #8 on: October 21, 2017, 02:44:54 pm »
KingMike: thanks for the info on controller input, though I'm still not sure how it works. It confused me that the $4016 register could get info about all eight buttons from one bit. I'll have to do a bit of messing around with the debugger to figure it all out.
Means that after doing the "strobe" command, the first time you read $4016 will return A in the lowest bit, the second time it is read it will return B, I think the third is Select, etc.
(the second-lowest bit on each read is used on Famicom games to check the corresponding button on the expansion port at the same time)
At least that is with normal controllers. Odd ones like the gun or Arkanoid paddle will be different.

Explains why when my NES acted up, most of the buttons stopped responding except that pushing A acted as everything pushed at once.

(the extra filtering it does after reading all eight buttons, using with like XORs and such, is so that it can detect when a button is "pushed" and only count it as one press. As even when you mean to push the button only one time, the game will probably still read the input many times in the time it takes you to press and remove your finger, so it has to account for that.
A bad example of that would be Winter Games. Of the other problems AVGN had about the game, he didn't bring up that even the PAUSE function is broken. It only allows a certain delay for you to remove your finger from Start and if you hadn't moved it by then, the game will count it as another tap and unpause the game.
Compare that to a good game like Mario, which will wait until the button is released (at least once cycle where it is NOT pressed) before it will allow the game to be paused again. Meaning you can press and hold Start for a ridiculous length like 10 seconds and it will still properly recognize it as a single press.
« Last Edit: October 21, 2017, 02:56:55 pm by KingMike »
Quote
Sir Howard Stringer, chief executive of Sony, on Christmas sales of the PS3:
"It's a little fortuitous that the Wii is running out of hardware."

Psyklax

  • Sr. Member
  • ****
  • Posts: 412
    • View Profile
    • Psyklax Translations
Re: Nintendo Vs - Game Genie Free Play Codes
« Reply #9 on: October 21, 2017, 02:49:24 pm »
Means that after doing the "strobe" command, the first time you read $4016 will return A in the lowest bit, the second time it is read it will return B, I think the third is Select, etc.

I see. Still seems a bit odd to me, but registers are weird things.

I've actually started a new thread in Personal Projects because I decided to hack the Vs games properly. And even if I don't fully understand how registers work, what you've said has enabled me to find and change particular inputs, so thanks for that. :)

Asaki

  • RHDN Patreon Supporter!
  • Full Member
  • *****
  • Posts: 141
    • View Profile
Re: Nintendo Vs - Game Genie Free Play Codes
« Reply #10 on: October 21, 2017, 06:50:44 pm »
A bad example of that would be Winter Games.

Ha ha, I didn't know that. I thought the game was just supposed to make no sense =) My friend has it, and sometimes we'll pop it in for a quick laugh.

pcfreak324

  • Jr. Member
  • **
  • Posts: 7
    • View Profile
Re: Nintendo Vs - Game Genie Free Play Codes
« Reply #11 on: October 22, 2017, 10:13:39 am »
Thank you Psyklax for the Game Genie Free Play Codes. They are very much appreciated.

Is it also possible to change other DIP switch settings by using Game Genie Codes? In some games you can change the colour palettes for different PPUs (e.g. Vs. RBI Baseball, Vs. Battle City, Vs. Tetris, Vs. Sky Kid, Vs. Star Luster, Vs. TKO Boxing, Vs. Super Xevious), change the difficulty or set the games to free play (as you already did).

Instructions on the DIP switch settings can be found in the mame source code: https://github.com/mamedev/mame/blob/master/src/mame/drivers/vsnes.cpp

October 25, 2017, 02:15:55 pm - (Auto Merged - Double Posts are not allowed before 7 days.)
The cheat code OXZEXN (Doesn't decrease credits) for Vs. Mighty Bomb Jack prevents you from finishing the first bonus round. The score counter is counting forever. With only the cheat VTLEOZ (Adds 1 credit at title screen) active, the game is working on my Analogue Nt mini.
« Last Edit: October 25, 2017, 02:15:55 pm by pcfreak324 »

firedropdl

  • Jr. Member
  • **
  • Posts: 72
    • View Profile
Re: Nintendo Vs - Game Genie Free Play Codes
« Reply #12 on: October 27, 2017, 01:00:33 pm »
I'm not sure if this is any help to you Psyklax, or anybody else, but I just figured I'd mention that the following VS games DO work on both MednafenX and NestopiaX on the XBOX:

Battle City
Gumshoe
Top Gun

Not sure about any of the other ones you've marked as non-working.  There's probably a good chance that they didn't work since they're not on my list.  It was made 10 or so years ago, so my memory is a bit foggy on that. :)

Psyklax

  • Sr. Member
  • ****
  • Posts: 412
    • View Profile
    • Psyklax Translations
Re: Nintendo Vs - Game Genie Free Play Codes
« Reply #13 on: October 27, 2017, 02:15:18 pm »
The cheat code OXZEXN (Doesn't decrease credits) for Vs. Mighty Bomb Jack prevents you from finishing the first bonus round. The score counter is counting forever. With only the cheat VTLEOZ (Adds 1 credit at title screen) active, the game is working on my Analogue Nt mini.

I didn't do much play testing on these codes so I didn't know that the bonus rounds were affected. I've stopped updating this thread because I've started doing proper ROM hacks of the games especially to hack the palettes, and if I can figure out how to change the coin mechanism then I'll do that:
http://www.romhacking.net/forum/index.php?topic=25148.0

Not sure about any of the other ones you've marked as non-working.  There's probably a good chance that they didn't work since they're not on my list.  It was made 10 or so years ago, so my memory is a bit foggy on that. :)

I wrote non working because the ROMs don't work in FCEUX, so i can't hack them. I tried Balloon Fight in MAME and it works, but the NES file in GoodNES seems broken. Again, check my project thread for updates.