home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / forth / compiler / fpc / source / p3_8bs.seq < prev    next >
Text File  |  1990-04-07  |  911b  |  30 lines

  1. \ Balraj Sidhu   Set: 14D4
  2. \ Comp 462 - Forth
  3. \ Date: April 7, 1990
  4. \ Problem 3.8
  5.  
  6. \ Illustration of Number Bases and formatted display operators
  7.  
  8. : binary ( -- ) 2 base ! ;
  9.  
  10. : ntable ( dn -- )
  11.         cr ."    Unsigned"  ."     Signed" ."      Unsigned"
  12.            ."                Signed"  ."    Unsigned" ."      Signed"
  13.         cr ."     Decimal"  ."    Decimal" ."        Binary"
  14.            ."                Binary"  ."      Hex   " ."        Hex  "
  15.         cr ." ----------------------------------------------"
  16.            ." -------------------------------------------------------"
  17.         20 0 do
  18.              cr
  19.              decimal dup 10 u.r
  20.                      dup 10  .r
  21.              binary  dup 18 u.r
  22.                      dup 17  .r
  23.              hex     dup 10 u.r
  24.                      dup 10  .r
  25.              1 +
  26.              loop
  27.              drop decimal cr ;
  28.  
  29.  
  30.