Writing Device Drivers

Forth Commands

The Open Boot PROM uses the Forth programming language. Forth is a stack-based language. Arguments must be pushed on the stack before running the correct command (called a word), and the result is left on the stack.

To place a number on the stack, type its value.


ok 57
ok 68

To add the two top values on the stack, use the + operator.


ok +

The result remains on the stack. The stack is shown with the .s word.


ok .s
bf

The default base is hexadecimal. The hex and decimal words can be used to switch bases.


ok decimal
ok .s
191

See the Forth User's Guide for more information.