home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / FPC225_2.ZIP / MISC.ZIP / DOTSS.SEQ < prev    next >
Encoding:
Text File  |  1988-01-28  |  1.7 KB  |  31 lines

  1. \ A more informative stack display.  By Bill Beers.    sfp013086
  2. comment:
  3. A more informative stack display.  By Bill Beers.    sfp013086
  4. Extracted for the East Coast Forth BBS by Steve Palincsar.      
  5.                                                                 
  6. For Laxen & Perry F83 for IBM PC and compatibles.               
  7.                                                                 
  8. The user word is ".SS".                                         
  9. Use instead of '.S'.   Gives you a display (in vertical format) 
  10. of what is on the stack in Decimal, Binary and Hex notation,    
  11. and the addresses of the top and bottom of the stack.           
  12.  comment;
  13.  
  14. \ cr .( a more informational stack display              web091985)
  15. : BINARY 2 BASE ! ;    HEX                                      
  16. : FMT-BIT # # # # 2D HOLD # # # # BL HOLD ;                     
  17. : BITS   S>D <# FMT-BIT FMT-BIT #> TYPE ;                       
  18. : .CNT    (  n --- ) DECIMAL 3 .R ." ║" ;
  19. : TOPSTK CR ." ═══╦═ Top of Stack :" SP@ 2+ U. ." ═══════════════════════════════" CR ;
  20. : BOTSTK ." ═══╩═ Bottom of Stack :" SP0 @ U. ." ════════════════════════════" CR ;
  21. : <.S>  ( n --- ) >R   R@ DECIMAL 5 U.R ."  dec│"
  22.         hex R@ 5 U.R ."  hex│" octal r@ 7 u.r ."  oct│"  BINARY R> BITS ;
  23. : .SS   BASE @ >R   DEPTH ?DUP
  24.      IF   TOPSTK                                                
  25.           0 do i .cnt i pick <.s> cr key? ?leave  loop          
  26.           R> BASE !   BOTSTK                                    
  27.      ELSE R> BASE !   CR ." <<< Stack Empty >>>"                
  28.      THEN ;                                                     
  29. decimal                                                         
  30.  
  31.