home *** CD-ROM | disk | FTP | other *** search
- \ A more informative stack display. By Bill Beers. sfp013086
- comment:
- A more informative stack display. By Bill Beers. sfp013086
- Extracted for the East Coast Forth BBS by Steve Palincsar.
-
- For Laxen & Perry F83 for IBM PC and compatibles.
-
- The user word is ".SS".
- Use instead of '.S'. Gives you a display (in vertical format)
- of what is on the stack in Decimal, Binary and Hex notation,
- and the addresses of the top and bottom of the stack.
- comment;
-
- \ cr .( a more informational stack display web091985)
- : BINARY 2 BASE ! ; HEX
- : FMT-BIT # # # # 2D HOLD # # # # BL HOLD ;
- : BITS S>D <# FMT-BIT FMT-BIT #> TYPE ;
- : .CNT ( n --- ) DECIMAL 3 .R ." ║" ;
- : TOPSTK CR ." ═══╦═ Top of Stack :" SP@ 2+ U. ." ═══════════════════════════════" CR ;
- : BOTSTK ." ═══╩═ Bottom of Stack :" SP0 @ U. ." ════════════════════════════" CR ;
- : <.S> ( n --- ) >R R@ DECIMAL 5 U.R ." dec│"
- hex R@ 5 U.R ." hex│" octal r@ 7 u.r ." oct│" BINARY R> BITS ;
- : .SS BASE @ >R DEPTH ?DUP
- IF TOPSTK
- 0 do i .cnt i pick <.s> cr key? ?leave loop
- R> BASE ! BOTSTK
- ELSE R> BASE ! CR ." <<< Stack Empty >>>"
- THEN ;
- decimal
-