cheesestraws
Well-known member
I spent the last couple of evenings tracking this down so I thought I'd leave a note here in case anyone else needs to know for whatever bizarre reason. This may, of course, be common knowledge and I was just looking with the wrong keywords. If so, it's been a learning experience.
A certain amount of the code to allow Mac software to run under A/UX is in the files in /mac/lib/Patches. These files are, technically, ROM patches, but following the usual Apple tradition, "Patch" grows to contain quite a lot of software. So it goes. And they're not patches in the sense of modifying the ROM data: they're libraries that contain reimplementations of various ROM routines.
Under A/UX 3.x, there are two patch files, and I didn't know why.
Turns out, the patch loaded depends on the ROM. Specifically, the two bytes after the dot in the name correspond to the two bytes at offset 8 of the ROM, which are a ROM version consisting of apparently the machine number and some kind of machine class?
The IIcx ROM has 0178 in this location, which means that the first patch file will be loaded. The Quadra 650 ROM has 067C, which means the second will be.
I found this out by digging into
Much of these startmac binaries are, unsurprisingly, black magic. But usefully, debugging symbols were left in, including a suspicious looking routine called getPatches. getPatches uses good old
A2 at this point points to the middle of a big struct for which we have, irritatingly, no field names. But a quick look for other points where offset $7C is written to takes us into a function called getROMImage. getROMImage does some shared memory shenanigans I do not properly understand to convince the kernel to hand over a copy of the ROM. But at the bottom, we find this:
A0 at this point seems to point to the base of the ROM copy that the kernel has handed over.
There also seems to be an undocumented TBPATCHES environment variable that you can use to override (?) this process, if I'm reading this correctly. Braver souls than I will need to descend down that road...
Trying to work out why on earth they did it like this rather than just having a compatibility environment that didn't depend on the ROM in the machine. The amount of mucking about here, surely that wouldn't have been much more work? Dunno.
A certain amount of the code to allow Mac software to run under A/UX is in the files in /mac/lib/Patches. These files are, technically, ROM patches, but following the usual Apple tradition, "Patch" grows to contain quite a lot of software. So it goes. And they're not patches in the sense of modifying the ROM data: they're libraries that contain reimplementations of various ROM routines.
Under A/UX 3.x, there are two patch files, and I didn't know why.
Turns out, the patch loaded depends on the ROM. Specifically, the two bytes after the dot in the name correspond to the two bytes at offset 8 of the ROM, which are a ROM version consisting of apparently the machine number and some kind of machine class?
The IIcx ROM has 0178 in this location, which means that the first patch file will be loaded. The Quadra 650 ROM has 067C, which means the second will be.
I found this out by digging into
/mac/bin/startmac24
: initial forays into /mac/bin/startmac
were unsuccessful.Much of these startmac binaries are, unsurprisingly, black magic. But usefully, debugging symbols were left in, including a suspicious looking routine called getPatches. getPatches uses good old
sprintf
to generate the path to the patch file:A2 at this point points to the middle of a big struct for which we have, irritatingly, no field names. But a quick look for other points where offset $7C is written to takes us into a function called getROMImage. getROMImage does some shared memory shenanigans I do not properly understand to convince the kernel to hand over a copy of the ROM. But at the bottom, we find this:
A0 at this point seems to point to the base of the ROM copy that the kernel has handed over.
There also seems to be an undocumented TBPATCHES environment variable that you can use to override (?) this process, if I'm reading this correctly. Braver souls than I will need to descend down that road...
Trying to work out why on earth they did it like this rather than just having a compatibility environment that didn't depend on the ROM in the machine. The amount of mucking about here, surely that wouldn't have been much more work? Dunno.