home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C!T ROM 5
/
ctrom5b.zip
/
ctrom5b
/
PROGRAM
/
DIVERSEN
/
TIPI2A
/
HELPMATH.TPI
< prev
next >
Wrap
Text File
|
1994-09-13
|
3KB
|
163 lines
define menu
# ( -- choice)
# ( valid$ -- )
# Returns the chosen key or 0 if the user escapes from this menu
0 cursor
ucase$
27 chr$ swap$ +$
begin
inkey$ ucase$ # valid$ key$
len instr *
dup
if dup drop$ endif drop$
until
1 -
1 cursor
enddef
define wait
begin key until cls
enddef
begin cls
|
| ╔═══════════════════════════════════╗
| ║ M A T H I N S T R U C T I O N S ║
| ╠═════════╦═══════════════╦═════════╣
| ║ ║ ║ ║
| ║ [A] ABS ║ [*] * ║ [<] < ║
| ║ ║ ║ ║
| ║ [B] MAX ║ [+] + ║ [=] = ║
| ║ ║ ║ ║
| ║ [C] MIN ║ [-] - ║ [>] > ║
| ║ ║ ║ ║
| ║ [D] MOD ║ [/] / ║ ║
| ╚═════════╩═══════════════╩═════════╝
"abcd*+-/<=>" menu dup cls
case 0 of endof
1 of
|
| ABS
|
| Data Stack: n -- N
| String Stack: --
|
| Replaces the top value on the data stack with its
| absolute value.
|
wait
endof
2 of
|
| MAX
|
| Data Stack: A B -- MAX
| String Stack: --
|
| Places the greater of A or B on the data stack.
|
wait
endof
3 of
|
| MIN
|
| Data Stack: A B -- MIN
| String Stack: --
|
| Places the lesser of A or B on the data stack.
|
wait
endof
4 of
|
| MOD
|
| Data Stack: A B -- C
| String Stack: --
|
| Returns A modulo B.
|
wait
endof
5 of
|
| *
|
| Data Stack: A B -- C
| String Stack: --
|
| Multiplies A times B.
|
wait
endof
6 of
|
| +
|
| Data Stack: A B -- C
| String Stack: --
|
| Adds A and B.
|
wait
endof
7 of
|
| -
|
| Data Stack: A B -- C
| String Stack: --
|
| Subtracts B from A.
|
wait
endof
8 of
|
| /
|
| Data Stack: A B -- C
| String Stack: --
|
| Divides A by B.
|
wait
endof
9 of
|
| <
|
| Data Stack: A B -- C
| String Stack: --
|
| C is TRUE if A is less than B, FALSE otherwise.
|
wait
endof
10 of
|
| =
|
| Data Stack: A B -- C
| String Stack: --
|
| C is TRUE if A equals B, FALSE otherwise.
|
wait
endof
11 of
|
| >
|
| Data Stack: A B -- C
| String Stack: --
|
| C is TRUE if A is greater than B, FALSE
| otherwise.
|
wait
endof
endcase
not until