Mac Classic

Writing a script

Sometimes it’s more useful to put a number of commands into an Open Firmware script rather than entering them directly into the Forth ‘shell’.

Scripts can be written with any text editor that can create .txt files. This is the default file type for the application SimpleText, which is included in most early Mac OS systems.

Below is a script that changes the CPU version and fan speeds for an Apple PowerBook G4. The first line of the script must contain an Open Firmware\ comment, followed by a cr (carriage return).

\ comment
cr

dev /cpus/PowerPC,G4@0
80010201 encode-int " cpu-version" property
device-end

" fan" open-dev constant fan-ih
1 340 " set-speeds" fan-ih $call-method

boot hd:,\\:tbxi
The final line of this script instructs the machine to boot from the default hard drive after running the desired commands.

Running a script

Make sure your script is saved to a convenient location such as the root of your HD. In this example the file has been named ‘bootscript’, and is located at the root of the HD.

To run the script at boot you will need to boot into Open Firmware (by holding the ‘Command’ + ‘Option’ + ‘O’ + ‘F’ keys) and running the following command:

setenv boot-device hd:\bootscript

This sets the boot-device variable to the 'bootscript' rather than the default HD (\\:tbxi).

Finally, run the reset-all command to restart the machine.

Comments

Dr. Allwiser

Dr. Allwiser

07 May 2025

How does one get past the / can’t OPEN hd://,tbxi ? Or the DEFAULT CATCH!, code=fffffff6 ? I am wondering if the system time has anything to do with it being that it says by default: 02/16/1904 but the bootROM build is 07/02/01 ? Any suggestions would be greatly appreciated thanks…

Permalink
Greystash

Greystash - Admin

14 May 2025

Hello!

It looks like you're using forward slashes instead of backslashes for the boot path. Check that your script is using backslashes like this `hd:,\\:tbxi`.

The date shouldn't be effecting this, I don't think it should cause much trouble with Open Firmware.

Permalink

Post a Comment