Toejam and Earl
ROM File: Toejam & Earl (REV 00) (U) [!].bin
The disassembled source code to Toejam and Earl on the Sega Megadrive, my favourite game on my favourite console.
Warning! - I'm constantly working on this game so some info may not be perfectly accurate, it is constantly being refined!
This project has its own public BitBucket repository where you can view (and download) the latest copy of the source code and see up to the minutes comments and updates.
Current State (Last updated - 01 July 2019)
This project is progressing on in leaps and bounds!
If you check the repo, linked above, you'll see there is now a file called GameConstants.X68 which contains all the known RAM addresses and is filling out nicely. Some of the in game graphics are also in their own .bin files now which can be opened and edited in an application called Retro Graphics Toolkit (I know where more are but separating them out hasn't been a key focus to date).
There is information on VBlanks and HBlanks, and even a little explanation on how the game sometimes skips these! Input reading is in there, starting presents and stats are figured out as well and there is even some example code on how to overwrite these.
Even better than overwiting existing code is the example of how to extend the ROM to contain and use your own code!
I still have my dedicated topic over at RHDN that gives a play by play blow on the development so far and can also be used for comments, questions and suggestions. In conjunction with that I've also started using the Wiki on BitBucket to give more details on discoveries so far and future plans.
The high level next steps are still the same they were previously, in roughly this order:
- Presents related data (how do Rocket Skates work, what sets how long tomatoes last, etc).
- Random map generation routine.
- Enemy related data (A.I., sprites, attributes like health, speed, damage, etc)
- Player (Toejam and Earl) related data (Health, speed, sprites, etc)
- Everything else...
There is one more thing worth mentioning in this update, I've found some friends! A group of very talented Toejam and Earl speedrunners have been kind enough to welcome me into their Discord group and share their knowledge of the game with me!
HoodyTwoShoes, MyTwoDogs and a fellow ROM Hacker and speedrunner known as Slab (who even started his own disassembly of T&E, believing mine to be abandoned!) have all happily answered any question on the game and even been there to just shoot the breeze when I need a break from coding but don't want to stop thinking about the game.
You can check out their Twitch channels here: HoodyTwoShoes, MyTwoDogs, Slab.
If there is anything you have a particular interest in let me know either on the comments here or on the RHDN topic and I'll see what I can find.
ROM (1MB, approx 4.62% deciphered as at 11-Apr-2019):+/- | Offset | Length (hex) | Opcode / Hexcode | Instruction / ASCII | Description |
+ |
00000-001FF |
200 |
00FF 8000 0000 ... |
.ÿ€..... |
Standard rom header with the following details: Initial stack pointer value: 00FF 8000 Entry Point: 0000 0202 ROM Details: SEGA GENESIS (C)SEGA 1991.JULTOEJAM & EARL TOEJAM & EARL GM MK-1020 -00 |
+ |
00200-00201 |
2 |
60FE |
BRA $00000200 |
1 line infinite loop, used for exceptions. |
+ |
00202-0028F |
8E |
4AB9 00A10008 ... |
TST.L $00A10008 ... |
Megadrive initialisation routine... |
+ |
00290-002FB |
6C |
8000 3FFF 0100 ... |
N/A |
Setup values |
+ |
002FC-00305 |
A |
4A79 00C00004 ... |
TST.W $00C00004 ... |
Game Entry Point. |
+ |
00306-00321 |
1C |
4E71 ... |
NOP ... |
Clear RAM Routine. |
+ |
0BB78-0BC27 |
AB |
207C 00FFA248 ... |
MOVE.L #$00FFA248,A0 ... |
Sets Toejam and Earl's Starting Stats... |
+ |
2C52C-2E72B |
21FF |
N/A |
N/A |
Graphics |
+ |
FFDE7-FFFFF |
219 |
FFFF FFFF FFFF ... |
N/A |
Empty space |
RAM (64KB, approx 1.00% deciphered as at 11-Apr-2019):
Offset | GENS Savestate Offset | Length (hex) | Original Value | Useful Values | Description |
A248 | C6C0 | 1 | 03 | 00-09 | Toejam's lives. |
A249 | C6C1 | 1 | 03 | 00-09 | Earl's lives. |
A24A | C6C2 | 1 | Unknown | 00-?? | Toejam's cash. |
A24B | C6C3 | 1 | Unknown | 00-?? | Earl's cash. |
A24C-A24D | C6C4-C6C5 | 2 | 0000 | 0000-???? | Toejam's score. |
A24E-A24F | C6C6-C6C7 | 2 | 0000 | 0000-???? | Earl's score. |
A250 | C6C8 | 1 | 00 | 00-09 | Toejam's promotion level. (See note 1) |
A251 | C6C9 | 1 | 00 | 00-09 | Earl's promotion level. (See note 1) |
A298-A29B | C710-C713 | 4 | Unknown | ??-?? | Toejam's health. |
A29C-A29F | C714-C717 | 4 | Unknown | ??-?? | Earl's health. |
DA8A-DAC1 | FF02-FF39 | 37 | 00 | 00-01 | Stores whether presents are identified or not. (See note 3) |
DAC2-DAE1 | FF3A-FF59 | 1F | 1B or FF | 00-1B | Stores Toejam and Earl's inventory. (See note 2) |
DAE2-DAF1 | FF5A-FF69 | 10 | Mixed | Unknown | Present 1 data. |
ADDITIONAL INFO:
Offset | GENS Savestate Offset | Length (hex) | Original Value | Useful Values | Description |
CRAM Maybe? (TBC) | A622-A9FD | 3DD | Mixed | Unknown | Contains the level layout of the current level. |
CRAM Maybe? (TBC) | A9FE-ADD9 | 3DC | Mixed | Unknown | Contains the level layout of level 1. |
CRAM Maybe? (TBC) | ADDA-B1B5 | 3DD | Mixed | Unknown | Contains the level layout of level 2 while your on level 3. |
CRAM Maybe? (TBC) | B800-C6BF | EBF | Mixed | Unknown | Moving letter graphics. |
Notes:
Note 1:
00 = Wiener | 05 = Bro |
01 = Dufus | 06 = Homey |
02 = Poindexter | 07 = Rapmaster |
03 = Peanut | 08 = Funk Lord |
04 = Dude | 09 = Goner |
Note 2:
00 = Icarus Wings | 0A = Rootbeer | 14= Extra Buck |
01 = Spring Shoes | 0B = Promotion | 15 = Jackpot |
02 = Innertube | 0C = Un-fall (Togetherness in 2 player) | 16 = Tomato Rain |
03 = Tomatoes | 0D = Rain Cloud | 17 = Earthling |
04 = Sling Shot | 0E = Fudge Sundae | 18 = School Book |
05 = Rocket Skates | 0F = Decoy | 19 = BoomBox |
06 = Rose Bushes | 10 = Total Bummer | 1A = Random |
07 = Super Hitops | 11 = Extra Life | 1B = Bonus Hi Tops |
08 = Doorway | 12 = Randomizer | FF = Empty |
09 = Food | 13 = Telephone |
Note 3:
These come it pairs with the value in the even offsets representing the present and the value in the following odd offset representing if it is identified or not. 00 means it's not, 01 means it is. |
History
Back in October 2015 I was contacted by a fellow Toejam and Earl fan going by the name of Juan Perez. Juan had created what he believed to be a disassembly of Toejam and Earl by running the original ROM file through a program called Disasm.exe (which I beleive is part of Sega-asm.zip). The disassembly, having been ran over the entire ROM file, was pretty messy containing a lot of nonsense code as a result of disassembling data (images, music, sound effects, etc) as if it were code, however, it was enough to peak my interest as a fun, interesting, long-term project.
Since then I've been working to turn this disassembly into a fully assemblable, editable and commented source code.
Credits and Thanks
The following people and pages have been of great help during the completion of this project. Huge thanks to them and their respective authors (listed in order of discovery):
- Marc at DarkDust.net - Great info on ROM headers and initialising the Sega Megadrive.
- Big Evil Corporation - Very accessible info on ROM headers, initialising and programming the Sega Megadrive.
- MarkeyJester’s Motorola 68K Tutorial - Really good guide to the 68K processor.
- Hivebrain's Sonic 1 Disassembly at SonicRetro - A clear and well commented disassembly of Sonic 1.
Screenshots
Nothing to see here, yet...
Want To Know More?
If you want to know more about this project you can email me using the details in the contact page or drop by my dedicated topic on Romhacking.net.
Downloads
T.E.S.S.E. | Toejam and Earl SaveState Editor created by me in VisualBasic.Net back when I was first learning about ROM hacking. Easy to use, lets you edit inventory and stats using simple menus. Works on GENS savestates. |
![]() |