• We've made some quality of life improvements to the Trading Post. More info here.

Reverse-Engineered ROM sources for Mac 128K, 512K, Plus and SE

Hi there,

I had a look at the available Mac Plus ROM listing the other day and thought I would give Claude Code a try at making a fully-commented source tree out of this, which would be able to be assembled again into a bit-identical copy of the ROM using modern open-source tooling.
As you can imagine, this spiraled a bit out of control, and a few(*) nights later, we have this:


This source tree builds the ROMs for:
  • Macintosh 128K
  • Macintosh 512K
  • Macintosh Plus (3 versions)
The source code is fully commented - that being said, the quality/accuracy of these comments varies wildly, so consider them with a grain of salt.
The comments and label names have been derived from whatever I could find online in terms of documentation/reverse engineering/... on this topic.

Note that I am by no means an expert in 68k Macs.
I have a few at home and every blue moon I do manage to find some time to play around with them.
This is is why I faithfully turn to the expert community in this forum to help me out with aligning the comments in said source tree with actual reality.
Feel free to fork and place PRs against this source tree, or just open an issue to point out further sources of (ideally machine-readable) information that I could ask the AI to feed into this project.

Otherwise, just have fun exploring - maybe this might be useful for someone out there some time.
It certainly was a fun exercise for me in getting AI to do something useful.

Looking forward to seeing what you think about this :)

Best,
Jon

*I know at least one person who would disagree with this.
 
Have to admit, this is pretty darn cool! It really is amazing what we can do with AI these days. Thank you for sharing this.

Earlier I posted the hack below to bypass the memory test on the MacPlus. Looking at the memtest.s in your GitHub, this absolutely lines up with what I did to trick the system into treating it as a warm boot. So maybe I could have saved the time and just asked AI how to do this :)

 
Last edited:
Have you compared the names with the MacPlusROM.lst?
https://github.com/joevt/68k-mac-ro...m-mpw-gm-3.5/ROM Maps/ROM.List/MacPlusROM.lst

Are you able to create a rom map from the compiled result that looks like MacPlusROM.lst?

The 3 Mac Plus ROMs are very similar - I think each version is just a patched version of the previous. Therefore, the MacPlusROM.lst ROM map is suitable for all versions (though the patched parts may be incorrect).

I understand that https://github.com/elliotnunn/supermario is from the Power Mac 6100 era. I wonder what parts still match those earlier 68K ROMs?
 
@joevt
1. I had a first look and started to push Claude to align the names with the linked MacPlusROM.lst, but did not find the time yet to pull this through cleanly and publish it. Aligning these names might actually just be a matter of find-and-replace? Would you be up to get this working and post a PR in the repo with this fixed?
2. Yes, I think that would be possible - that is probably most relevant for the original (128K, 512K) ROM variants?
3. Indeed, the changes are rather small. The README in the repo's root details what exactly differs where among the three Plus variants.
4. I did use the SuperMario sources as a guidance for Claude to figure out label names, context for comments, and overall functioning of this ROM.

@demik
I used Claude Opus 4.6 and 4.7 for this work in a Claude Code setup on my Linux desktop computer.

I don't want to get ahead of myself, but maybe it is interesting for some people that an extension of this codebase to also cover the Mac SE is on the way. I am thankful for the reverse engineering posted on this forum, e.g., the firmware for the RTC and ADB chip replacements.

Please always LMK if you know of further (ideally machine-readable) information sources that I could feed to the AI to improve on the documentation/naming/... of this source tree.
 
1. I had a first look and started to push Claude to align the names with the linked MacPlusROM.lst, but did not find the time yet to pull this through cleanly and publish it. Aligning these names might actually just be a matter of find-and-replace? Would you be up to get this working and post a PR in the repo with this fixed?
2. Yes, I think that would be possible - that is probably most relevant for the original (128K, 512K) ROM variants?
I think that #2 should be done first (unless you already have an address name map somewhere?). Then #1 can be compared with that using a script. This would apply to the Mac Plus since there's no Apple supplied rom map for the earlier Macs. The same source code in your repository is used for 128K and 512K and Plus so the corrections made for Plus would automatically be made for the 128K/512K.
 
@demik
I used Claude Opus 4.6 and 4.7 for this work in a Claude Code setup on my Linux desktop computer.

I don't want to get ahead of myself, but maybe it is interesting for some people that an extension of this codebase to also cover the Mac SE is on the way. I am thankful for the reverse engineering posted on this forum, e.g., the firmware for the RTC and ADB chip replacements.

Please always LMK if you know of further (ideally machine-readable) information sources that I could feed to the AI to improve on the documentation/naming/... of this source tree.

Got it, make sense. Tried to do something similar with Sonnet 4.6 (CC harness as well), it was stuck sometimes on some function calls. (My use case was trying to make it rename a ghidra disassembly output, I managed to have it off by giving it three different disassembly sources), otherwise the output wasn't decent enough.

For naming first pass it was allowed to propose names by understanding what each function does, along will call parameters, then gave it either manual hints or more context for each routines. Other than the SuperMario source I gave it C headers from MPW or other, but that was for C. No idea for ASM. Sonnet kinda surprised me as he knew part of the QuickDraw Toolbox

Anyway, nice job!
 
This is quite interesting. I'm taking small steps towards a related goal, decompiling and documenting the system software as a stepping stone to a source-buildable codebase based on 7.5.5 with longevity-related modifications (primarily date rollover and possibly IP networking stack). I would like the core source code to be faithful transformations of the original bits (no replacement with leaked code etc). If successful, I'm hopeful this will help keep a wide range of 68k machines usable, and provide an empirically verified reference for further patching, porting, and emulation work.

Right now my focus is on building up the toolchain, testing on small applications. As much of it as possible is deterministic utilities for parsing, annotating, and formatting progress data, interfacing with Ghidra and Capstone, etc, and then a locally hosted language model to do additional automation. ubuntuor's m68k_mac_reversing_tools project has been very helpful, and this ROM reference looks promising too. Currently I have decompilation and annotation in a promising state, and socket controllable control and inspection working in Snow. I hope to start in on recompilation with Retro68 soon.
 
Hi all, small update today on this project.
I finally found time to clean up the initial release a bit - fix some mis-interpretations, comments, ...
The source tree is now fully independent from the original ROMs being available - this repo can be built stand-alone on any Linux system that has the m68k binutils installed.
Also, the ROMs for the Mac SE and SE FDHD are now generated fully.

@joevt Please find the requested ROM maps in the repo here: https://github.com/jonathanschilling/mac_rom/tree/main/maps
I hope this is what you are looking for?

As usual, feedback is appreciated :)
Happy hacking!
 
@joevt Please find the requested ROM maps in the repo here: https://github.com/jonathanschilling/mac_rom/tree/main/maps
I hope this is what you are looking for?

As usual, feedback is appreciated :)
Looks great! There's a lot more names in your maps than in the Apple maps. Does the Apple maps have any names or offsets that are not in your map? This might be a good validation step for the ROMs that do have an Apple map. Your existing validation steps validates the bytes, but this validation step would validate the info between the bytes.

One nitpick: For resource headers, you have hard coded the size and relative handle offset. There ought to be a way to calculate those programatically, like how they're done in the Rez files in the supermario source code. The res_map is also hard-coded. The format of the resource map is described somewhere or you can look at my rom_fiend fork. For the resource tag, you can use enums for the bits of the tag. Hmm, rom_fiend skips the tag (memory block bits from Memory Manager?) and skips the relative handle offset...

The resource map contains lists of resource types which each have a list of resources with ID, name offset, Resource Manager attributes, and data offset. rom_fiend doesn't show the resource map as a resource map. It shows the info per resource type and resource, jumping around the rom for each bit of info.

Maybe some assembler macros can be added for some of the resource map and resource data structs.

The linux 68K build tools don't include a Rez compiler?
Well, I guess this is a problem for someone who is going to add additional resources. But I think that's one of the more common reasons to edit a ROM - is to modify the ROM resources.
 
Hi @joevt, thanks for your feedback.

I had a look at the Apple maps - indeed there were some omissions in my maps, and naming conflicts. This should be resolved now - could you have a look again?
Indeed there are many more labels (AI-generated) than provided by Apple, but at least the original Apple ones should now all be properly conserved.

For the resource headers, there is now an automated process in place, based on macros and a Python Rez implementation, which (at least) is capable of dealing with the ROM resources for the Plus and SE.

Also, tooling is added and was modified to be able to update the ROM checksum in case of modifications - allowing to keep the built-in checksum test working even if the ROM is modified.

The thing I am not sure about yet is the way the ROM resource contents are expressed at the moment.
Keep in mind that I am really no expert in writing 68k assembly (for Mac).
It seems that at least the resource headers are now auto-generated, but what is in these resources still seems (mostly) defined inline as assembly in the source tree - is that how it is supposed to be done?
 
I had a look at the Apple maps - indeed there were some omissions in my maps, and naming conflicts. This should be resolved now - could you have a look again?
Looks good.

Labels at the beginning of a source file that are marked end marker of the module before should probably be moved to the end of the previous source file? For example, TE68KEND is at the beginning of scrap_mgr.s and should be moved to the end of the previous source file which rom_se.s says is textedit.s.

rom_map_flags.txt has a header that says it's generated by a script so it should be excluded from the repository? Or there should be a better way to divide the types of files:
- original files - not to be edited if there are any? such as if you had a source folder for the original rom map files.
- editable files - the source files used to build a new rom and rom map which may differ from original files.
- generated files - generated files are your new ROM maps, and the rom_map_flags.txt file?.
or I should just accept that I need to read the header of a file to see if it has a "generated" comment.

The ROM_RESOURCE macro makes sense in each res_****.s file.

I saw that the plus_rsrc.inc has hard coded information, but I see that this is a generated file, so it's ok. If there's no way for the assembler's preprocessor to create the needed data structures than the use of an external preprocessor (or just another compiler or build step) such as your python scripts is the way to go such as how rezc.py creates plus_rsrc.inc from plus/RomResources.r.
 
I'm doing similar project, focused in Quadra 800 rom. Still very early, but you may wish to take a look. https://github.com/escarneiro/q800rom
You may want to rebase off the leaked "Super Mario" sources: https://github.com/elliotnunn/supermario/tree/master/base/SuperMarioProj.1994-02-09

These correspond to the last 68K machines (AV); the Q650/800 ROM is very similar meaning much can be used verbatim. If I might suggest an alternate approach, it'd be better to migrate SuperMario to a modern build process and figure out the regression preventing the AV ROM from properly booting on 650/800 hardware. That'd certainly have made my 68060 experiments simpler!
 
You may want to rebase off the leaked "Super Mario" sources: https://github.com/elliotnunn/supermario/tree/master/base/SuperMarioProj.1994-02-09

These correspond to the last 68K machines (AV); the Q650/800 ROM is very similar meaning much can be used verbatim. If I might suggest an alternate approach, it'd be better to migrate SuperMario to a modern build process and figure out the regression preventing the AV ROM from properly booting on 650/800 hardware. That'd certainly have made my 68060 experiments simpler!
I'm doing it nicely by now, and it's almost working, without touching leaked source. I'll do this way to evict any legal problem.
 
Back
Top