Forth Words Flashcards

(102 cards)

1
Q

: xxx yyy ;

A

( – )

Creates a new definition with the name xxx, consisting of word or words yyy.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

cr

A

( – )

Performs a carriage return and line feed at the current output device.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

spaces

A

( n – )

Displays the given number of blank spaces.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

space

A

( – )

Displays one blank space.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

emit

A

( c – )

Transmits a character to the output device.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

.” xxx”

A

( – )

Displays the character string xxx. The “ character terminates the string.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

+

A

( n1 n2 – sum )

Adds.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

.

A

( n – )

Displays a number, followed by one space.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

( xxx)

A

( – )

Begins a comment that will be ignored by the text interpreter. The character ) is the delimiter.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

-

A

( n1 n2 – diff )

Subtracts.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

*

A

( n1 n2 – prod )

Multiplies.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

/

A

( n1 n2 – quot )

Divides.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

mod

A

( n1 n2 – n-rem )

Returns the remainder from division.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

/mod

A

( n1 n2 – n-rem n-quot )

Divides. Returns the remainder and quotient.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

swap

A

( n1 n2 – n2 n1 )

Reverses the top two stack items.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

dup

A

( n – n n )

Duplicates the top stack item.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

over

A

( n1 n2 – n1 n2 n1 )

Makes a copy of the second item and pushed it on top.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

drop

A

( n – )

Discards the top stack item.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

2swap

A

( d1 d2 – d2 d1 )

Reverses the top two pairs of numbers.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

2dup

A

( d – d d )

Duplicates the top pairs of numbers.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

2over

A

( d1 d2 – d1 d2 d1 )

Makes a copy of the second pair of numbers and pushes it on top.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

2drop

A

( d – )

Discards the top pair of numbers.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

if xxx else yyy then

A

if: ( ? – )

If ? is true, execute xxx; otherwise execute yyy. The phrase else yy is option.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

=

A

( n1 n2 – ? )

Returns true if n1 and n2 are equal.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
<>
( n1 n2 -- ? ) | Returns true if n1 and n2 are not equal.
26
( n1 n2 -- ? ) | Returns true if n1 is less than n2.
27
>
( n1 n2 -- ? ) | Returns true if n1 is greater than n2.
28
0=
( n -- ? ) | Returns true if n is zero.
29
0﹤
( n -- ? ) | Returns true if n is negative.
30
0>
( n -- ? ) | Returns true if n is positive.
31
not
( ? -- ? ) | Reverses the sense of a flag.
32
and
( n1 n2 -- and ) | Returns the logical "and".
33
or
( n1 n2 -- or ) | Returns the logical "or".
34
xor
( n1 n2 -- xor ) | Returns the logical "xor".
35
?dup
( n -- n n ) or ( 0 -- 0 ) | Duplicates only if n is nonzero.
36
abort" xxx"
( ? -- ) If the flag is true, types out the last word interpreted, followed by the text. Also clears the user's stacks and returns control to the terminal. If false, takes no action.
37
1+
( n -- n+1 ) | Adds one.
38
1-
( n -- n-1 ) | Subtracts one.
39
2+
( n -- n+2 ) | Adds two.
40
2-
( n -- n-2 ) | Subtracts two.
41
2*
( n -- n*2 ) | Multiplies by two.
42
2/
( n -- n/2 ) | Divides by two.
43
abs
( n -- |n| ) | Returns the absolute value.
44
negate
( n -- -n ) | Changes the sign.
45
min
( n1 n2 -- min ) | Returns the minimum.
46
max
( n1 n2 -- max ) | Returns the maximum.
47
>r
( n -- ) | Takes a value off the data stack and pushes it onto the return stack.
48
r>
( -- n ) | Takes a values off the return stack and pushes it onto the data stack.
49
r@
( -- n ) | Copies the top of the return stack without affecting it.
50
*/
( n1 n2 n3 -- result ) | n1 * n2 / n3
51
*/mod
( n1 n2 n3 -- n-rem n-result) | n1 * n2 / n3
52
do .. loop
do: ( limit index -- ) loop: ( -- ) Sets up a finite loop, given the index range.
53
do ... +loop
do: ( limit index -- ) +loop: ( n -- ) Finite loop, adds the value of n to the index.
54
leave
( -- ) | Terminates the loop at the next loop or +loop. Must appear within the loop.
55
begin ... until
until: ( ? -- ) | Sets up an indefinite loop that ends when ? is true.
56
begin xxx while yyy repeat
while: ( ? -- ) | Sets up an indefinite loop which always executes yyy if ? is true. Ends when ? is false.
57
.r
( n width -- ) | Prints the number, right-justified within the field width.
58
page
( -- ) | Clears the display screen and resets the cursor to the upper left-hand corner.
59
quit
( -- ) | Terminates execution for the current task and returns control to the terminal.
60
u.
( u -- ) | Prints the unsigned number, followed by one space.
61
u.r
( u width -- ) | Displays the unsigned number, right-justified within the field width.
62
u
( u1 u2 -- ? ) | Unsigned '
63
constant xxx
( n -- ) xxx: ( --- n ) Creates a constant named xxx with the value n; the word xxx returns n when executed.
64
variable xxx
( -- ) xxx: ( -- a ) Creates a variable named xxx; the word xxx returns its address when executed.
65
create xxx
( -- ) xxx: ( -- a ) Creates a dictionary header named xxx; the word xxx returns its address when executed.
66
!
( n a -- ) | Stores a single-length number into the address.
67
@
( a -- n ) | Replaces the address with its contents.
68
?
( a -- ) | Prints the contents of the address, followed by one space.
69
+!
( n a -- ) | Adds a single-length number to the sontents of the address.
70
allot
( n -- ) | Adds n bytes to the parameter field of the most recently defined word.
71
,
( n -- ) | Compiles n into the next available cell in the dictionary.
72
c,
( b -- ) | Compiles b into the next available byte in the dictionary.
73
c!
( b a -- ) | Stores an 8-bit value into the address.
74
c@
( a -- b ) | Fetches an 8-bit value from the address.
75
fill
( a u b -- ) | Fills u bytes of memory, beginning at the address, with value b.
76
erase
( a u -- ) | Stores zeroes into n bytes of memory, beginning at a.
77
base
( -- a ) | A variable that contains the value of the number base being used by the system.
78
dump
( a u -- ) | Displays u bytes of memory, starting at the address.
79
2variable xxx
( -- ) xxx: ( -- a ) Creates a double-length variable named xxx; the word xxx returns its address when executed.
80
2constant xxx
( d -- ) xxx: ( -- d ) Creates a double-length constant named xxx with the value d; the word xxx returns the value d when executed.
81
2!
( d a -- ) | Stores a double-length number into the address.
82
2@
( a -- d ) | Returns the double-length contents of the address.
83
false
( -- f ) | Returns logical false (0).
84
true
( -- t ) | Returns logical true (-1).
85
' xxx
( -- a ) | Attempts to find the dictionary address of xxx, the word that follows in the input stream.
86
[']
compile-time ( -- ) run-time: ( -- a ) Used only in a colon definition, compiles the address of the next word in the definition as a literal.
87
execute
( a -- ) | Executes the dictionary entry whose parameter field address is on the stack.
88
@execute
( a -- ) Executes the dictionary entry whose pfa is pointed to by the contents of a. If address contains zero, @execute does nothing.
89
>body
( cfa -- pfa ) | Computes the parameter field address of the definition whose compilation address is on the stack.
90
exit
( -- ) Removes a return address from atop the return stack, restoring it to the address interpreter pointer. When compiled within a colon definition, terminates execution of that definition at that point.
91
quit
( -- ) | Clears the return stack and returns control to the monitor, awaiting input. No message is given.
92
abort
( -- ) | Clears the data stack and performs the function of quit. No message is given.
93
h
( -- a ) | returns the address of the dictionary pointer.
94
here
( -- a ) | Returns the next available dictionary location.
95
pad
( -- a ) | Returns the beginning address of a scratch area used to hold character strings for intermediate processing.
96
sp@
( -- a ) | Returns the address of the top of the data stack before sp@ is executed.
97
s0
( -- a ) | Contains the address of the bottom of the data stack.
98
tib
( -- a ) | Returns the starting address of the text input buffer.
99
forth
( -- ) | Makes Forth the context vocabulary.
100
editor
( -- ) | Makes the editor vocabulary the context vocabulary.
101
assembler
( -- ) | Makes the assembler vocabulary the context vocabulary.
102
context
( -- a ) | Returns the address of a variable that specifies the dictionary search order.