home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
forth
/
compiler
/
fpc
/
source
/
p4_10bs.seq
< prev
next >
Wrap
Text File
|
1990-04-14
|
614b
|
45 lines
\ Balraj Sidhu Set: 14D4
\ Comp 462 - Forth
\ Date: April 12, 1990
\ Problem 4.10
\ Part a
\ ------
\ set cell at adr to value true or -1.
: on ( adr -- )
255 swap ! ;
\ set cell at adr to value false or 0.
: off ( adr -- )
0 swap ! ;
\ Part b
\ ------
\ add n to the value found at address adr
: +! ( n adr -- )
dup @ 2 roll + swap ! ;
\ display contents of cell at adr
: ? ( adr -- )
@ . ;
\ Part c
\ ------
variable temperature
: warmer ( -- )
5 temperature +! ;
: cooler ( -- )
-5 temperature +! ;