Table Files are files which are pretty much essential for any budding ROM hackers to get their heads round. Basically, in the code of a video game ROM, data is usually stored in hexadecimal format. This data, among many other things, is often used to relate to blocks of text (since there are blocks of text in almost every game, even if it is only the copyright text on the title screen). But with only 16 different hex values, and any number of characters to be displayed (for example: some games have a full lower case alphabet, a full upper case alphabet, full set of punctuation (including all those signs you have on your number keys on the keyboard), Spaces, a load of other random signs...). So clearly, using one hexadecimal character for each letter to be displayed will not work.
However, using two hex values together gives us a rang of $00 - $FF. If you can't work it out for yourself, in decimal, that's 256 values ($00 is decimal 0, $FF is decimal 255). And that's more than enough for any game - you could almost have ten complete alphabets with that system.
So when hacking a ROM, it's useful, to say the least, to know which two hex values mean which character. In fact, if you're doing any text replacement at all, it's essential.
So Table Files were created. They simply contain values that the game displays (such as A, B, C.... X, Y, Z, a, b, c... x, y, z) together with a hex value which represents them. Most games have the alphabet stored in ascending order, so if the hex for A is $28, the hex fo B will be $29, the hex for C will be $2A, and so on.
But naturally, it often gets a lot more difficult. Sometimes, a hex value is used to store sets of two commonly used letters (such as "th" etc.). This is called DTE (stands for Dual Text Encryption) and can make building a Table File very hard. Most of the early Final Fantasy games used DTE. And that isn't the only advanced text storage routine. There is also dictionary compression - this uses a set of hex values (usually four) to represent a word. This can be illustrated in the Robotrek file below, where common names and words (like the character's name, and names of towns) have hex values of $E000 to $E3FFF.
Table files are saved as <game name>.TBL format files, but can be read and edited with any text editor.
The benefit of using table files is that if you have a compatible hex editor such as Thingy, when you open a ROM in the same directory as a table file of the same name, it will load that as well, and you will be able to search for text strings nice and easy. The Hex will appear on the left hand side, and the text which it translates to (translates using the Table File) will appear on the right. You can then edit either the raw hex or the text.
yerricde says "Some games, such as Lode Runner, GNOME vs KDE, and Tetanus On Drugs, don't need a table file because they use ASCII as their native character encoding. I'm pretty sure Mega Man 5 uses ASCII as well." - thanks for pointing this out.
Below is a table file for the SNES game Robotrek. I didn't make it myself, and I'm sorry that it's cut and paste, but it illustrates the points about dictionary compression etc. very well, so I'm using it. The table file was downloaded from Zophar's Domain, where it is in a database of Table Files. It was originally made by Niiru of Partial Translations. I assume that since they put the table file up for download on a popular emulation site they have no problem with me using it here. If they do, then please get in touch with me either here or by email (address is on my home node) and I'll remove it.
If you want to use it, copy and paste into a text file, save as robotrek.tbl, and make sure your ROM is called robotrek.smc. Any compatible hex editor such as Thingy should detect it and use it.
Table file downloaded from Zophar's Domain (www.zophar.net).
Made by Niiru from Partial Translations (pt.parodius.com).