kernelthread.com

Open Firmware (Macintosh)

The Towers of Hanoi as a FORTH program for the Open Firmware found on "new world" Macintosh systems. This program is essentially the same as the one for Sun OpenBOOT, except that 2r@ and 2r> are not implemented on Apple's PROM.

: movedisk ." move " . ." --> " . ; : dohanoi dup 0 > if 1 - 2over 2over >r >r >r >r 1 roll 2 roll 3 roll 3 roll recurse r> r> 2dup >r >r swap swap movedisk 2drop 2drop r> r> swap r> r> swap swap 3 roll swap recurse then ; : hanoi 3 1 2 3 roll dohanoi 2drop 2drop ;

Download

hanoi.macprom