Look at http://wiki.laptop.org/go/Forth_Lessons
The first few lessons are basic Forth, then around lesson 9 it starts to talk about Open Firmware specifics.
Open Firmware device drivers are object oriented. Before you can use them, you must select the "instance" of the object that you wish to use. The reason for this complexity is so that you can use the same device driver for multiple instances of a device - for example you might have two different disks that use the same driver.
The terminal emulator package is used by the screen object, so you must select the screen context before you can use terminal emulator methods. The "stdout" variable contains a pointer to an already-open screen object, so you can select it by writing
ok stdout @ iselect
After you do that, you can write, for example:
ok foreground-color . f ok 2 to foreground-color
which should change the text color to green.
On 5/23/2011 3:01 PM, 胡松涛 wrote:
Hi,
I want to write some application when I go into the interpreter, I follow these tutorial: http://www.openfirmware.org/1275/practice/
But when I learn the first one: 16 Color Text Extension, I met problem. I want to have a try on foreground-color, but it seemed can't run and returned some information:
ok foreground-color Tried to access instance-specific data with no current instance ok
I have this one on my laptop /packages/terminal-emulator
Did I miss some thing when I read the documents?
I'm pretty new with Open Firmware, are there easier tutorial for beginners?
references: http://www.openfirmware.org/1275/practice/ http://www.openfirmware.org/1275/proposals/index.html