我知道这是一个很长的镜头,需要有关Open Firmware和旧硬件的建议。
我已经设法在PowerBook G4上安装并启动Mac OS 9(不支持)。由于OS9无法在不支持的硬件上管理冷却,因此在使用约1小时后机器会变得很热。
我已设法使用Open Firmware和以下代码启动风扇!
" fan" open-dev constant fan-ih
" fans-on" fan-ih $call-method
这样可以全速运行风扇,但我只希望它们以50%运行,或者更改硬件临时限制。
但是,我无法弄清楚如何使用任何例程。有很多选项看起来可以修改,但是要确定覆盖默认值的正确语法。例如,'set-speed'和'.set-speed'在使用'see'方法时给出非常不同的输出,并且没有给出可以编辑的内容的很多指示:
> see .speed
1 read-speed cr " TACH1 = " type .d 2 read-speed cr " TACH2 = " type .d 3 read-speed cr " TACH3 = " type .d 4 read-speed cr " TACH4 = type .d ; ok
> see set-speed
>r 40 dup read-reg 8 andc write-reg case
1 of
5c dup read-reg e0 or write-reg 30 r> write-reg
endof
2 of
5d dup read-reg e0 or write-reg 31 r> write-reg
endof
3 of
5e dup read-reg e0 or write-reg 32 r> write-reg
endof
dup of
5e dup read-reg e0 or write-reg 32 r> write-reg
endof
endcase
; ok
> see set-speeds
1 over set-speed 2 over set-speed 3 swap set-speed
任何帮助将不胜感激!
我基本上同意兰迪,但在我看来,设定速度需要两个参数。堆栈的顶部是与所需速度相关的某个值,下面是风扇编号(1,2或3)。
在Forth堆栈图表示法中,这些单词将被描述为:
.speed ( -- ) \ Display the speeds of all the fans
set-speed ( fan# speed -- ) \ Set the speed of one fan
set-speeds ( speed -- ) \ Set the speeds of all the fans
可以肯定的是,.speed显示的数字与可用作设定速度和设定速度的速度参数的数字相同。如果这是正确的,那么可以使用以下咒语将速度减半:
" fan" open-dev constant fan-ih
" fans-on" fan-ih $call-method
TACH1 = <some number>
TACH2 = <some number>
TACH3 = <some number>
为了论证,假设
decimal 46 2 / "set-speeds" fan-ih $call-method
很有可能将所有球迷的速度减半。
通过使用像select-dev这样的单词,有更多简化的方法来编写它,这取决于Apple OFW实现哪些方便词,但上面只使用标准所需的单词,因此它在不同的实现中是可靠的。
如果要查找与扇形控制相关的所有单词,可以编写:
dev fan
words
然后用see反编译它们。
您可以通过将命令放在nvramrc中来自动设置风扇速度。
在Forth和Open Firmware中,以句点开头的单词名称(发音为dot)表示该单词将打印一些内容。例如,要打印(并删除)参数堆栈中的顶部数字,我们调用的单词是。 (是的,那是一个时期,这是第四个字)。
因此.speed意味着“打印速度信息.1读取速度读取tach1的速度,并将值放在参数堆栈上。
cr“TACH1 =”类型打印回车符,字符串TACH1 =
.d打印读取速度放在堆栈上的值。 d表示以十进制形式打印值。
set-speed看起来需要3个参数(在调用set-speed之前在命令行输入它们)。 (速度转速数字地址?)所以它看起来像你输入的最后一个参数(当你调用set-speed时它将位于参数堆栈的顶部)是某种地址,但我有点不清楚这是什么。所以调用设定速度可能是这样的:1设定速度2设定速度
我从你展示的反编译中推断出这一点。
我不认为这是足够的信息,(我对这些东西很生疏)但它可能会让你走得更远。
也许您可以显示以下输出:
见read-reg
并看看write-reg
这可能会有所帮助。
看起来很好。开发风扇和后续设备端线是不必要的,但无害,因为open-dev和$ call-method不需要在设备节点上下文中工作。第一个dev / cpus / PowerPC,G4 @ 0及其关闭设备端是必需的,因为属性必须从设备节点内完成。请享用!
非常感谢Mitch和Randy!我无法在评论中正确格式化,因此我将其作为答案发布。我已经设法使用以下脚本使其工作:
\ comment
cr
dev /cpus/PowerPC,G4@0
80010201 encode-int " cpu-version" property
device-end
dev fan
" fan" open-dev constant fan-ih
1 3B6 " set-speed" fan-ih $call-method
2 3B6 " set-speed" fan-ih $call-method
device-end
boot hd:,\\:tbxi
然后我将启动设备更改为以下内容,以便在启动时自动加载:setenv boot-device hd:\bootscript
非常感谢,我真的很感激!我很高兴有这台PowerBook运行Mac OS 9,它太快了!将继续努力。