PATH 
ADC Home > Documentation > Hardware > Device Managers and Drivers > PCI Card Services > Designing PCI Cards and Drivers for Power Macintosh Computers


  

Open Firmware Forth Usage Examples

Here are a few short examples that show what can be done with the Forth language while in the Open Firmware interface.

The following example maps the physical address 8000 to virtual memory space for 0x1000 bytes for access.

8000 8000 1000 0 do-map

The next example dumps the contents of address 8000 continuously until any key press.

begin 8000 l@ . key? until

The next example stores 0x12345678 at location 8000.

12345678 8000 l!

The next example dumps 16 longs starting from location 8000.

8000 40 bounds do cr i u. i l@ . 4 +loop

The next example writes 0xaa55 to location 8000 until keypress.

begin aa55 8000 l! key? until
© 1999 Apple Computer, Inc. – (Last Updated 26 March 99)