My Brill Game Site My Brill Game Site
Megadrive

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 minute comments and updates.

Current State (Last updated - 29 July 2020)

Ongoing

The project continues to go from strength to strength.

Cutscenes, menus, player controls, level seed generation and more are amongst the areas that have been the focus of the disassembly process recently and the process itself has underwent another round of scrutiny and refinement.

Easy68K is no longer the assembler of choice for the project, having been replaced with VASM, a commandline based assembler. By moving away from Easy68K and it's GUI only assembler the project can now be completely managed from within Visual Studio Code, including keyboard shortcuts to rebuild the ROM and launch it automatically in your favourite debugging emulator. It may not seem a lot but this saves a huge amount of time while working out what the code is doing as it runs.

If you are interested in knowing more about VASM and 68K in general (and a wealth of other processors from the SEGA / Nintendo 8bit and 16bit generations) then I highly recommend ChibiAkumas videos over on YouTube and his accompanying website.

Updates to this site are far and between, and that isn't because things aren't happening, quite the opposite! Things are happening so fast that updating this site is becoming the slowest part of the process! So to stay up to date with the latest and greatest updates keep checking the BitBucket repository, the Wiki, and the Issue Tracker (which I'm using as a task list).

Of course I've still got 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.

The high level next steps are still the same they were previously, in roughly this order:

If there is anything you have a particular interest in let me know on the RHDN topic and I'll see what I can find.

ROM (1MB, approx 4.62% deciphered as at 11-Apr-2019):
Key: Game Dynamics Data Block Graphics General Routine Error Handling ROM Header Empty Space
+/- 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):
Key: Game Dynamics General Routine Unused
RAM Offset Length (hex) Original Value Useful Values Description
A248 1 03 00-09 Toejam's lives.
A249 1 03 00-09 Earl's lives.
A24A 1 Unknown 00-?? Toejam's cash.
A24B 1 Unknown 00-?? Earl's cash.
A24C-A24D 2 0000 0000-???? Toejam's score.
A24E-A24F 2 0000 0000-???? Earl's score.
A250 1 00 00-09 Toejam's promotion level. (See note 1)
A251 1 00 00-09 Earl's promotion level. (See note 1)
A298-A29B 4 Unknown ??-?? Toejam's health.
A29C-A29F 4 Unknown ??-?? Earl's health.
DA8A-DAC1 37 00 00-01 Stores whether presents are identified or not. (See note 3)
DAC2-DAE1 1F 1B or FF 00-1B Stores Toejam and Earl's inventory. (See note 2)
DAE2-DAF1 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 believe 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):

Screenshots

Lava Hack Land Where You Fell From

Want To Know More?

If you want to know more about this project you can email me using the details in the About 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. Screenshot of T.E.S.S.E