News:

11 March 2016 - Forum Rules

Main Menu

Determining SNES Entry Points

Started by Omnigamer, May 23, 2011, 02:03:09 PM

Previous topic - Next topic

Omnigamer

Hello all,

I'm working on a project that looks at several of the generic features of SNES ROMs, and I've hit a bit of a stumbling block. I've been observing the initial assembly instructions for a variety of games via several SNES emulators/debuggers, and many of them start at $8000, as would be expected (HiROM/LoROM differences aside). However, there are also a fair number of games that begin at arbitrary locations, such as $814C or $FF30. The emulator obviously can tell that these locations are the correct entry points, but I haven't been able to find any documentation relating to how this is done. There isn't a relevant field for it in the SNES header, and I can't seem to find any common locations that would indicate a starting offset. Any insight into how this entry point is determined solely from the ROM file would be greatly appreciated.

Thanks,
~Omnigamer

MathOnNapkins

#1
What you're referring are called "vectors" usually. "Vector" in this context is equivalent to "pointer. I can't really say why vector is the name used. The vector you're referring to is the "reset vector". If you can't find these vectors in the header, it's because you're looking in the wrong header. The external headers are 0x200 byte blocks at the start of most roms available on the internet. These are proprietary headers added by and used by copier machines that were used to dump the roms in the first place. The vector table itself is located in the rom's real internal header. See http://romhack.wikia.com/wiki/SNES_header for more info.

Omnigamer

I had been using headerless ROMs, but it didn't occur to me that it would be in the interrupt vector table. I skipped over the vector sections on the assumption that it would instead be placed as hard data elsewhere, but it does make sense if it's followed from a reset interrupt. I guess I had just been looking for it under the wrong assumptions/terminology. Thanks!

Nightcrawler

As an added note, reset vectors are used to determine the start of code execution on most processors (consoles or otherwise).

Also note you can't just start anywhere on the SNES. The reset vector is 16-bits, so you're limited to starting  between 00:0000 and 00:FFFF. Some of that is even off limits as it is not be mapped to ROM.
TransCorp - Over 20 years of community dedication.
Dual Orb 2, Wozz, Emerald Dragon, Tenshi No Uta, Glory of Heracles IV SFC/SNES Translations