home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / forth / compiler / fpc / source / p4_10bs.seq < prev    next >
Text File  |  1990-04-14  |  614b  |  45 lines

  1. \ Balraj Sidhu   Set: 14D4
  2. \ Comp 462 - Forth
  3. \ Date: April 12, 1990
  4. \ Problem 4.10
  5.  
  6. \ Part a
  7. \ ------
  8.  
  9. \ set cell at adr to value true or -1.
  10. : on ( adr -- )
  11.         255 swap ! ;
  12.  
  13. \ set cell at adr to value false or 0.
  14. : off ( adr -- )
  15.         0 swap ! ;
  16.  
  17. \ Part b
  18. \ ------
  19.  
  20. \ add n to the value found at address adr
  21. : +! ( n adr -- )
  22.         dup @ 2 roll + swap ! ;
  23.  
  24. \ display contents of cell at adr
  25. : ? ( adr -- )
  26.         @ .  ;
  27.  
  28. \ Part c
  29. \ ------
  30.  
  31. variable temperature
  32.  
  33. : warmer ( -- )
  34.         5 temperature +! ;
  35.  
  36. : cooler ( -- )
  37.         -5 temperature +! ;
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.