CarbonLib on NewWorld Mac OS 7.6?

cc333

New Tinkerer
Dec 22, 2021
29
15
3
California, USA
Now that NewWorld System 7 is a thing, has anyone successfully made CarbonLib work on it?

I copied it over from 9.2.2, and it doesn't seem to work, but perhaps an earlier version could. I believe the initial version ran on versions as low as 8.1, so My guess is that version would have the best chances of working, and then once that's accomplished, perhaps newer versions could be patched to work as well.

Thoughts?

c
 

cluster_fsck

New Tinkerer
Oct 9, 2022
14
6
3
One area to look at is what else CarbonLib depends on. I’m not near an old Mac right now, but if you use PEFViewer to check out CarbonLib’s dependencies you might be able to “upgrade” System 7.6 to satisfy enough of the missing dependencies. For instance, it might require Appearance Manager, which can run on System 7.6.
 

cc333

New Tinkerer
Dec 22, 2021
29
15
3
California, USA
That's a good idea.

Where can I find PEFViewer? Does it also work on the Mac OS ROM file?

I'm trying to start another project that involves patching Mac OS ROM 3.7 and/or 3.9 (included with Mac Os 9.0.4 retail and Internal Edition, respectively) to fix an odd and little noticed bug that breaks the backlight control and clamshell mode on the Powerbook G3 FireWire. The bug was fixed in Mac OS ROM 6.1 (Mac OS 9.1), so all that is needed is to somehow figure out which bits represent the fix(es) and backport it(them) to the older ROM.

It's a rather mundane feature to care about, but it can possibly serve as an example patch that could be used to port other features to various ROMs and enable older versions with newer features and vice versa.

c
 

joevt

Tinkerer
Mar 5, 2023
211
79
28
Where can I find PEFViewer? Does it also work on the Mac OS ROM file?

I'm trying to start another project that involves patching Mac OS ROM 3.7 and/or 3.9 (included with Mac Os 9.0.4 retail and Internal Edition, respectively) to fix an odd and little noticed bug that breaks the backlight control and clamshell mode on the Powerbook G3 FireWire. The bug was fixed in Mac OS ROM 6.1 (Mac OS 9.1), so all that is needed is to somehow figure out which bits represent the fix(es) and backport it(them) to the older ROM.

It's a rather mundane feature to care about, but it can possibly serve as an example patch that could be used to port other features to various ROMs and enable older versions with newer features and vice versa.

My MacROMan fork has all the New World ROMs (except maybe the ones created to boot System 7 or 8 on New World Macs).

I have a script decompressrom.sh that has a command dumponerom that uses the tbxi dump command to take apart the ROMs.
https://github.com/elliotnunn/tbxi

It then uses MPW's DumpPEF commands on all the PEFs of the ROMs. You need to setup MPW on modern macOS using
https://github.com/ksherlock/mpw

Below is an example how to loop through all the ROMs, decode them from MacBinary III, and dump all their contents.
Rename the directories where you have cloned the forks or copied the scripts.

Code:
#=========================================================================================
# Setup

OpenBIOSStuff="/Volumes/Updates/Docs/Open_Firmware_and_Forth/OpenBIOS/joevt-OpenBIOSStuff"
PATH="$OpenBIOSStuff"/detok/obj-amd64:"$OpenBIOSStuff"/toke/obj-amd64:"$OpenBIOSStuff"/macOS:/Volumes/Work/Programming/lzss/joevt-lzss:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/joevt/Library/Python/2.7/bin:/opt/X11/bin:/Library/Apple/usr/bin
cd "/Volumes/Work/Open Firmware and Name Registry"
source "ROM PowerPC Mac/decompressrom.sh"
source "ROM Apple/mac_rom_checksums.sh"
MacROMandir="/Volumes/Work/Programming/XcodeProjects/MacROMan"

#=========================================================================================
# Use dumponerom to extract 4MB ROMs (using tbxi) from New World ROM files

cd "$MacROMandir"

# Dump the ROMs into a new folder by renaming the old folder and making a new folder
mv "New World ROM Dumps" "New World ROM Dumps Old" 2> /dev/null
cd "$MacROMandir"
mkdir -p "New World ROM Dumps"

printf "" > "/tmp/lbrarynames.txt"
IFS=$'\n'
for thebin in $(find "joevt-MacROMan/TestImages/New World ROM" -type f -name 'Mac OS ROM.bin'); do
    therom="${thebin/.bin/}"
    echo "$therom" 1>&2
    [[ -f "$therom" ]] && rm "$therom"
    macbinary decode "$thebin"
    parentname="$(perl -pe 's|.*/||' <<< "$(dirname $therom)")"
    if ((1)) || [[ ! -d "$MacROMandir/New World ROM Dumps/${parentname}.src" ]]; then
        dumponerom "$therom"
        mv "$MacROMandir/${therom}.src" "$MacROMandir/New World ROM Dumps/${parentname}.src"
    fi
done | sort > "${MacROMandir}/rom_tbxi_list2.txt"

# Compare the list of ROMs with the old list
bbdiff "${MacROMandir}/rom_tbxi_list.txt" "${MacROMandir}/rom_tbxi_list2.txt"

#=========================================================================================
# If the differences are acceptable then replace the old list with the new list

mv "${MacROMandir}/rom_tbxi_list2.txt" "${MacROMandir}/rom_tbxi_list.txt"

# View the new list
bbedit "${MacROMandir}/rom_tbxi_list.txt"

# View and differences with the old dumps (in case new ROMs were added, or improvements to the dump scripts were made
#diff -r "New World ROM Dumps Old" "New World ROM Dumps" | sed "/.DS_Store/d" > /tmp/diffs.txt
bbdiff  "New World ROM Dumps Old" "New World ROM Dumps"

# If the changes are satisfactory, then remove the old dumps.
rm -R "New World ROM Dumps Old"
 

Attachments

  • joevt ROM scripts.zip
    9.9 KB · Views: 4

cluster_fsck

New Tinkerer
Oct 9, 2022
14
6
3
Looks like PEF Viewer wasn't available on Macintosh Garden, so I added it today. It will run on just about PowerPC-based Mac and you could use it to open CarbonLib and see what it imports from to determine what other libraries are necessary for it to function. I added screenshots and explainer text to the Garden's entry. I haven't tried it on ROM images, but in theory it should work and will show you the TVector of every symbol and it has a code viewer as well, so it might help you with the project above if you want to experiment on a classic Mac OS system.
 
  • Like
Reactions: bakkus

joevt

Tinkerer
Mar 5, 2023
211
79
28
MPW's DumpPEF is a command line utility and therefore scriptable which is useful if you are researching multiple PEFs. It produces text output that can by processed by scripts or compared.