home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
forth
/
compiler
/
fpc
/
source
/
p4_2bs.seq
< prev
next >
Wrap
Text File
|
1990-04-10
|
917b
|
45 lines
\ Balraj Sidhu Set: 14D4
\ Comp 462 - Forth
\ Date: April 10, 1990
\ Problem 4.2
: binary ( -- )
2 base ! ;
: anding ( a b -- )
and 17 .r ;
: oring ( a b -- )
or 17 .r ;
: xoring ( a b -- )
xor 17 .r ;
: noting ( a -- )
not 17 u.r ;
: table ( -- )
cr
." AND OR XOR NOT "
cr
." ----------------- ---------------- ---------------- ---------------- "
cr ;
: display ( a b -- )
dup 17 .r dup 17 .r dup 17 .r
swap cr
dup 17 .r dup 17 .r dup 17 .r dup 17 .r cr ;
: bottomline ( -- )
." ----------------- ---------------- ---------------- ---------------- "
cr ;
: ltest ( a b -- )
binary table display bottomline
2dup anding 2dup oring 2dup xoring dup noting
decimal cr ;