A pointer is a number that refers to a specific location in a ROM
. For example, if you wanted to reference the 155,387th byte of the ROM, the address would be 155387, or 0x25EFB. They may also be referred to as addresses or offsets. |+|
A pointeris a number that refers to a specific location in a ROM or . They may also be referred to as addressesor offsets.
| || |
|−|Some games, like Earthbound, use a slightly different way of addressing. In Earthbound's case, it ignores the first 512 bytes of the ROM, which is the header; thus, making the pointer have an actual value of 512 bytes less. As well, the pointers need to have 0xC00000 added to them to have the SNES read it properly. So, if we were going to reference the 155, 387th byte of the ROM, you would subtract 512 and add 0xC00000, resulting in C25CFB. Finally, a dollar sign is added to the beginning of the pointer to show that it is a SNES pointer: $C25CFB. |+|
different pointer . , of of .
| || |
|−|For most games, the pointers are stored in a reversed format. This catches many starters and can cause confusing situations. If we take our pointer from before, $C25CFB, each pair of numbers would be separated. This becomes C2 5C FB. Then, the order of the pairs are reversed. This results in FB 5C C2. Those are the bytes that would appear in a ROM that would point to $C25CFB. |+|
are in . can . pointer of
be . . , the of the in . the that a that to .
Revision as of 23:44, 20 September 2005
A pointer is a number that refers to a specific location in a ROM or memory. They may also be referred to as addresses or offsets. The exact way pointers work vary among different systems, and, in fact, some systems have multiple pointer schemes. It has become convention, at least within the PK Hack Community to use the 0x prefix to indicate a pointer referring to the ROM file and to use the $ prefix to indicate a pointer in the format used by the machine. Both prefixes indicate the following number is in Hexadecimal. Different machines may use different byte orders, be careful.
The SNES has serveral different pointer schemes. The main two are #LoROM for smaller ROMs and #HiROM for larger ROMs, but extensions of both of those exist.
SNES pointers are little endian. Therefore, if you find your pointer comes out to $123456, then your pointer will be written to the ROM as 56 34 12 or, more likely, as 56 34 12 00.
Some information on LoROM would be nice. No LoROM games are currently in the database. For now, the information can be found at Zophar's Domain. Perhaps the author of the SNES pointer document there should be contacted about the use of that information.
Supports games up to 4 megabytes or 32 megabits. An extension called #ExHiROM can be used for ROMs as large as 8 megabytes or 64 megabits. One game which uses HiROM is Earthbound. For pointers to ROM data, just add 0xC00000, but note that most ROMs have a 512 byte header, so you will also have to subtract 0x200 to adjust for the header. So, if we were going to reference the 155,387th byte of the ROM, you would subtract 512 and add 0xC00000, resulting in C25CFB. Finally, a dollar sign is added to the beginning of the pointer to show that it is a SNES pointer: $C25CFB. Remember that will be written to the ROM as FB 5C C2 00, since SNES pointers are little endian.