What is a trainer in iNES format?

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic

by on (#27869)
In reply to this post:

Hi.

Thanks very much for clearing that up for me. The way it works makes a lot more sense than the way I thought it worked :D.

I was sure I replied to this a few days ago but looks like the post didn't get through. :?

I've got a couple more questions if anybody can help me. They're not related to the PPU but I thought it may be better to put it here rather than start another thread.

I was wondering what NES trainers did? I've had a look online and can't find much information on them.

Also, what are VS-system cartridges?

Thank you very much.

:)

by on (#27870)
NES trainers are 512 bytes of code which is loaded into $7000 before the game starts. Famicom copiers used them to hold code to translate mapper writes into the copier's own mapper system. The games were altered so that instead of writing to the original mapper, they jumped to a subroutine in the trainer. They probably aren't necessary to emulate today now that we have non-hacked ROM dumps of all games. There might be some old hacks which use them because the hackers couldn't allocate static space in the ROM for their new code.

http://en.wikipedia.org/wiki/Nintendo_Vs._Series

by on (#27874)
Isn't there a hacked version of super mario bros as a cartridge which uses a trainer?

by on (#27876)
A few SMB ROM hacks make use of the trainer. I doubt there are any on a cartridge though (simply because the trainer doesn't exist on a cartridge).

I ignore trainers completely in my emu (skip over them if they're there). I haven't had any problems with this. Trainers conflict with other things that may actually exist at $7xxx anyway (like PRG-RAM).... so ignoring them saves some headaches.

As far as I'm concerned trainers are a defunct and deprecated feature of the iNES format and should be disregarded/avoided.

by on (#27877)
Disch wrote:
A few SMB ROM hacks make use of the trainer. I doubt there are any on a cartridge though (simply because the trainer doesn't exist on a cartridge).

Don't some mappers (e.g. the SMB2j pirate mapper and Sunsoft FME-7) put ROM where the trainer goes? Start with an NROM/CNROM/UNROM, add another PRG ROM chip, put in a bit of 7400-series logic to decode $6000-$7FFF reads, and you have a hardware implementation of an iNES trainer. But you're right that it's unlikely that anyone has built such a reproduction.

Quote:
Trainers conflict with other things that may actually exist at $7xxx anyway (like PRG-RAM)

Unless you treat the trainer as the initial contents of PRG-RAM when either 1. the header doesn't have the battery bit set or 2. the .sav file is not found.

by on (#27878)
tepples wrote:
Unless you treat the trainer as the initial contents of PRG-RAM

Right, that's how it works on the real system, not to mention that games with PRG-RAM often don't use trainers (UOROM Final Fantasy) or are modified so that the WRAM data doesn't conflict with the trainer. Every game with a trainer is altered afterall.

by on (#27879)
Does anyone with more emulator development experience want to go flesh out the discussion of trainers in the wiki page?