Sunday, November 5, 2017

Analogue Nt Mini - Vs. System Support

Originally I was going to post a conclusion to my Analogue Nt series, but then I had an epiphany that was too long to attach to one of the prior posts.  Yesterday I was thinking about the Nintendo Vs. System and lack of comprehensive hacks available for the games that were released for that system.  I wondered if it was possible, given the Nt Mini's extraordinary capabilities, to get the pure Vs. System ROMs running on the system through its Flashcart functionality.  About six hours of testing later, I think can present a solution that can get many of these games working now.




I have already written a blog article giving an overview of the Nintendo Vs. System, you could do worse as an introduction : http://nerdlypleasures.blogspot.com/2015/07/nintendos-vs-system-just-like-at-home.html  If that is TL:DR, here is what you need to know :

The Nintendo Vs. System was an arcade cabinet that originally bolted together two monitors, each with their own set of joystick controls.  These monitors were directed by one PCB.  On this PCB were more than two Nintendo Entertainment Systems.  There were two CPUs and two PPUs.  Each PPU had a 4K RAM chip for video memory so that they could draw screens independently on the monitor to which they were connected.  The CPUs each had their usual 2KB of work RAM plus they could share a single battery-backed 2K RAM chip.  Each CPU and PPU pair were governed by six 8KB EPROM sockets, four for PRG-ROM, two for CHR-ROM.

Nintendo modified many of its more simple games into harder versions that were fit into these EPROM sockets.  The home cartridge version of Super Mario Bros., a 32K/8K game, turned into Vs. Super Mario Bros., a 32K/16K game.  While the home versions could only take advantage of two independent background screens and usually had hardwired mirroring, the Vs. System versions could use the 4KB from the PPU to which they were assigned for four-screen mirroring.

Nintendo also modified certain games to allow for two player head-to-head gameplay with each player viewing a different monitor.  These games are called the Vs. Dualsystem games and have a single set of ROMs for both CPU/PPU pair.  Each CPU could interrupt each other and had to work in tandem to make the game work for each player.  I am not aware of any NES emulator that ever attempted emulation of Vs. Dualsystem games, they are generally emulated only by MAME.  Confirmed Vs. Dualsystem games are Balloon Fight, Baseball, Ice Climber, Mahjong, Tennis and Wrecking Crew.  Raid on Bungeling Bay is also effectively a Dualsystem game due to how it functions.  Non Dualsystem games are sometimes called Unisystem games, but only Ice Climber comes in Dualsystem and Unisystem varieties. 

In the iNES 1.0 header format, most Vs. System games are assigned Mapper 99, indicating that they use the memory mapping hardware found on the main PCB.  Some more advanced games, instead of coming as ROM chips, come as full daughterboards with a PPU, PRG-ROM and CHR-ROM or RAM and mapper chips like the Nintendo MMC1, Konami VRC-1, Sunsoft-3 or Namco 108.  I am not sure whether these games really use the four-screen mirroring functionality of the base PCB.

Like most arcade games, Vs. System games had protection mechanisms.  The first line of defense were the multiple PPU chips used.  A Vs. System game could use one of nine RGB-based PPUs, the 2C03, 2C04-0001, 2C04-0002, 2C04-0003 & 2C04-0004, the 2C05-01, 2C05-02, 2C05-03, 2C05-04.  The 2C03s and 2C04s functioned identically but had colors in their palettes assigned differently.  The 2C03 and 2C05 use the same color palette.  The 2C04 000x chips use the same colors in their palettes but arrange them differently in the palette matrix.  The colors are close to, but not necessarily identical to the 2C03/2C05.  Using a game with the wrong PPU would result in very wrong colors.

The second line of defense was the 2C05 PPUs, which have the same palette as the 2C03.  2C05s swapped a pair of registers and output a special signature that the game would read or fail to load.  Four games use 2C05s, Gumshoe, Mighty Bomb Jack, Ninja Jajamaru Kun and Top Gun.

The third defense was protection ICs used on certain games, if the IC is not present, the game will not work.   Atari RBI Baseball, Super Xevious and TKO Boxing used protection ICs.

Four light gun games, Duck Hunt, Freedom Force, Gumshoe and Hogan's Alley were released for the Vs. System, but the Vs. Light Gun is read very differently than the regular Zapper light gun, so these games are unusable in their unhacked form.

Given all this information, how can we get some of these Vs. System games working on the Nt Mini without advanced hacking ability?  The Nt Mini has two big advantages over every other console and flash cart.  The first is the ability to load a custom palette easily.  Most palettes tend to look like the standard 2C02 composite PPU palette, but they can look like anything.  A palette file is just 192 bytes consisting of 64 entries.  Each entry is made up of an 8-bit Red, an 8-bit Green and an 8-bit Blue value.  I was able to use Nestopia to extract the 2C03 and 2C04 palettes, but it turns out that in the MAME ROMset for each game, the palette the game uses is already present.  Extract the 192 byte .pal file and make sure you have five of them, 2C03, 2C04-0001, 2C04-0002, 2C04-0003 and 2C04-0004.  The true 2C03 palette only has two gray entries, but the Nt Mini and most emulators add another two gray entries where they would be on a 2C02.

When you start a Vs System game, the colors may be bizarre and you may see glitchy tiles.  Use the following table to select the correct palette for your game :

GoodNES v3.23b ROM Name Mapper Mirroring Palette Notes
Battle City (VS).nes 99 4 2C04-02 Dip Switches can change colors to suit multiple palettes
Castlevania (VS).nes 2 V 2C04-02 Fix Header
Clu Clu Land (VS).nes 99 4 2C04-04
Dr. Mario (VS).nes 1 M 2C04-03 Use 2nd Controller for 1 Player Game
Excitebike (VS).nes 99 4 2C04-03
Goonies, The (VS).nes 151 M/4 2C04-03 Can also be mapper 75
Gradius (VS).nes 151 M/4 2C04-01 Can also be mapper 75
Ice Climber (VS).nes 99 4 2C04-04
Mach Rider (VS) [Endurance Course].nes 99 4 2C04-02
Pinball (VS).nes 99 4 2C04-01
Platoon (VS).nes 67 M 2C04-01
Soccer (VS).nes 99 4 2C04-03
Star Luster (VS).nes 99 4 2C03
Stroke & Match Golf (VS) [(J)] [!].nes 99 4 2C03 Remove 2nd Controller to avoid Uncontrolled Swings
Stroke & Match Golf (Ladies) (VS).nes 99 4 2C04-02 Remove 2nd Controller to avoid Uncontrolled Swings
Super Sky Kid (VS).nes 4 M 2C04-02 Use 2nd Controller for 1 Player Game, may need to be changed to mapper 206
Tetris (VS).nes 99 4 2C03 Dip Switches can change colors to suit multiple palettes, Use 2nd Controller for 1 Player Game
VS. Slalom (VS).nes 0 4 2C04-02 May need to be changed to mapper 99
VS. Super Mario Bros. (VS).nes 99 4 2C04-04
Mach Rider [Fighting Course] (J).nes 99 4 2C04-01 Does not exist in GoodNES, make one with MAME ROMset nvs_machridera.zip
Pinball (J).nes 99 4 2C03 Does not exist in GoodNES, make one with MAME ROMset vspinbalj.zip
Soccer (J).nes 99 4 2C04-02 Does not exist in GoodNES, make one with MAME ROMset vssoccer.zip
Excitebike (J).nes 99 4 2C04-04 Does not exist in GoodNES, make one with MAME ROMset excitebkj.zip
Stroke & Match Golf.nes 99 4 2C04-02 Does not exist in GoodNES, make one with MAME ROMset smgolf.zip





Super Xevious - Gump no Nazo (VS) [H Protect IC].nes 206 M 2C04-01 Can also be mapper 4, hack is here : http://johnsarcade.com/nintendo_vs_ppu_info.php

Most of the VS System games can be found in the latest/last GoodNES set, but not all of them made it there.  I had to make a few .nes ROMs myself with the MAME ROM sets.  I combined them all using a command like this :

copy /b header + "mds-gf4-2 f.1d or 6d" + "mds-gf4-2 f.1c or 6c" + "mds-gf4-2 f.1b or 6b" + "mds-gf4-2 f.1a or 6a" + "mds-gf4-2 f.2b or 8b" + "mds-gf4-2 f.2a or 8a" smgolfvs.nes

This command joins the separate ROMs in one particular MAME ROMset into a combined .nes ROM with a proper header.  The file names will be different for every game you make.  When joining the separate files, the order is 1d to 1a or 6d to 6a and 2b or 8b to 2a or 8a.  "Header" is a 16 byte file containing all the header you will need to get non-MAME emulators to recognize the game.  

Even though you may have the game displaying the correct colors, unless you can tell it that you have inserted a coin, you will not be able to play it.  Now the second great benefit of the Nt Mini, as it applies to Vs. System games, is its support for the microphone.  While the coin inputs for the Vs. System are not accessible on the Nt Mini or any Nintendo home console, the service button shares the input bit with the microphone.  Yesterday I came across the information again that for most games, pressing the service button will give you a credit.  If you hook up a microphone to the Nt Mini and blow into it, you can simulate the press of the service button.  All the games listed above will accept a service button in lieu of a true coin inserted signal, but some games may require you to blow harder than others.  Have the microphone sensitivity turned all the way up in the Core Settings Menu.  A few games default to free play, but most do not.  Most games require you to press select to start a game.  

While most games boot instantly, the Konami games go through a ROM checking process first.  They will boot up to a solid color, which should change at some point.  Then the game will state that the ROM(s) is/are OK and you will see the title screen a moment later.  

The Nt Mini does not support dip switch setting for Vs. System games at present, so you will only be able to play the game as if all the dip switches were turned off.  Theoretically, you can access Dip Switches 0-1 via the first controller port and Dip Switches 2-4 via the Famicom Expansion Port.  Vs Super Mario Bros. supports saving high scores, but the Nt Mini will not create a save file even when it is designated in the header.  The page with the Super Xevious hack also had a hack for Mighty Bomb Jack, but I was unable to get it to accept a coin with the service switch method.  That page was a great help to me both in my original Vs. System blog article as well as this one.

This method really is only practical on the Nt Mini.  The RetroUSB AVS may have the ability to upload custom palettes, but I'm not sure about that and it is not something that sounds like you would want to do on a regular basis.  Even if it did, it cannot support the microphone.  The original Analogue Nt uses the Hi-Def NES Mod for HDMI, but the Hi-Def NES Mod does not support custom palettes.  The NESRGB does allow for uploading three palettes through a JTAG programming cable, but unless you wish to keep your system open all the time, it is not something that you can expect to do on a regular basis.  

The Smokemonster Nt Mini ROM pack has most of the available VS System hacks.  Some, like Hogan's Alley, simply do not work.  Others, like Gradius, have serious graphics glitches.  The Duck Hunt and Super Mario Bros hacks, allow you to set the dipswitches and for the latter, save your scores.  But they use a 2C02 palette, so if you want to see what these games really looked like, you should use this method to the extent you can.  

In this post on the AtariAge thread, http://atariage.com/forums/topic/242970-fpga-based-videogame-system/?p=3884369  I have included the palette files needed for the true 2C03 palette and the four 2C04 palettes.  I have also included a 16-byte header file which has the information for mapper 99 games.  The header does not turn on the Vs. System flag, the Nt Mini will refuse to let you change palettes when the flag is on and does not apply the correct colors by default for most games.  Finally, I have included a sample of a batch file you can use to avoid lots of typing (but not cutting and pasting :)  Finally, I included the table above as a more-readable spreadsheet.  Enjoy!  

1 comment:

Anonymous said...

Thanks for the article.

Psyklax at romhacking.net has found out some Game Genie codes to insert coins or to change the games to Free Play:
http://www.romhacking.net/forum/index.php?topic=25137.0

These codes can be patched into the roms with the tool Game Genie Guy! (https://www.romhacking.net/utilities/1054/).