home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C!T ROM 5
/
ctrom5b.zip
/
ctrom5b
/
PROGRAM
/
DIVERSEN
/
TIPI2A
/
HELPSTAK.TPI
< prev
next >
Wrap
Text File
|
1994-09-14
|
4KB
|
227 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
|
| ╔══════════════════════════════════════╗
| ║ S T A C K I N S T R U C T I O N S ║
| ╠═════════════╦═══════════╦════════════╣
| ║ ║ ║ ║
| ║ [A] DEPTH ║ [G] OVER ║ [M] ROT ║
| ║ ║ ║ ║
| ║ [B] DEPTH$ ║ [H] OVER$ ║ [N] ROT$ ║
| ║ ║ ║ ║
| ║ [C] DROP ║ [I] PICK ║ [O] SWAP ║
| ║ ║ ║ ║
| ║ [D] DROP$ ║ [J] PICK$ ║ [P] SWAP$ ║
| ║ ║ ║ ║
| ║ [E] DUP ║ [K] POP ║ ║
| ║ ║ ║ ║
| ║ [F] DUP$ ║ [L] PUSH ║ ║
| ╚═════════════╩═══════════╩════════════╝
"abcdefghijklmnop" menu dup cls
case 0 of endof
1 of
|
| DEPTH
|
| Data Stack: -- N
| String Stack: --
|
| Places N on the data stack, where N is the
| depth of the data stack.
|
wait
endof
2 of
|
| DEPTH$
|
| Data Stack: -- N
| String Stack: --
|
| Places N on the data stack, where N is the
| depth of the string stack.
|
wait
endof
3 of
|
| DROP
|
| Data Stack: N --
| String Stack: --
|
| Removes the top value from the data stack.
|
wait
endof
4 of
|
| DROP$
|
| Data Stack: --
| String Stack: A$ --
|
| Removes the top value from the string stack.
|
wait
endof
5 of
|
| DUP
|
| Data Stack: N -- N N
| String Stack: --
|
| Duplicates the top value on the data stack.
|
wait
endof
6 of
|
| DUP$
|
| Data Stack: --
| String Stack: A$ -- A$ A$
|
| Duplicates the top value on the string stack.
|
wait
endof
7 of
|
| OVER
|
| Data Stack: a b -- a b a
| String Stack: --
|
| Copies the second item on the data stack to the
| top.
|
wait
endof
8 of
|
| OVER$
|
| Data Stack: --
| String Stack: a$ b$ -- a$ b$ a$
|
| Copies the second item on the string stack to
| the top.
|
wait
endof
9 of
|
| PICK
|
| Data Stack: n -- m
| String Stack: --
|
| Places a copy of the data stack's nth item on the
| top of the data stack.
|
wait
endof
10 of
|
| PICK$
|
| Data Stack: n --
| String Stack: -- m$
|
| Places a copy of the string stack's nth item on
| the top of the string stack.
|
wait
endof
11 of
|
| POP
|
| Data Stack: -- n
| String Stack: --
|
| Pops a value off the return stack.
|
wait
endof
12 of
|
| PUSH
|
| Data Stack: n --
| String Stack: --
|
| Pushes a value to the return stack.
|
wait
endof
13 of
|
| ROT
|
| Data Stack: a b c -- b c a
| String Stack: --
|
| Rotates the top three values on the data stack.
|
wait
endof
14 of
|
| ROT$
|
| Data Stack: --
| String Stack: a$ b$ c$ -- b$ c$ a$
|
| Rotates the top three values on the string
| stack.
|
wait
endof
15 of
|
| SWAP
|
| Data Stack: a b -- b a
| String Stack: --
|
| Swaps the top two values on the data stack.
|
wait
endof
16 of
|
| SWAP$
|
| Data Stack: --
| String Stack: a$ b$ -- b$ a$
|
| Swaps the top two values on the string stack.
|
wait
endof
endcase
not until