199 lines
5.0 KiB
Plaintext
199 lines
5.0 KiB
Plaintext
|
|
||
|
|
||
|
|
||
|
|
||
|
13. DOUBLE NUMBER EXTENSION WORD SET
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
13. DOUBLE NUMBER EXTENSION WORD SET
|
||
|
|
||
|
|
||
|
|
||
|
13.1 The Double Number Extension Word Set Layers
|
||
|
|
||
|
|
||
|
Nucleus layer
|
||
|
|
||
|
2! 2@ 2DROP 2DUP 2OVER 2ROT 2SWAP D+ D- D0= D2/
|
||
|
D< D= DABS DMAX DMIN DNEGATE DU<
|
||
|
|
||
|
|
||
|
Device layer
|
||
|
|
||
|
none
|
||
|
|
||
|
|
||
|
Interpreter layer
|
||
|
|
||
|
D. D.R
|
||
|
|
||
|
|
||
|
Compiler layer
|
||
|
|
||
|
2CONSTANT 2VARIABLE
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
45
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
13. DOUBLE NUMBER EXTENSION WORD SET
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
13.2 The Double Number Extension Word Set Glossary
|
||
|
|
||
|
2! 32b addr -- 79 "two-store"
|
||
|
32b is stored at addr. See: "number"
|
||
|
|
||
|
2@ addr -- 32b 79 "two-fetch"
|
||
|
32b is the value at addr. See: "number"
|
||
|
|
||
|
2CONSTANT 32b -- M,83 "two-constant"
|
||
|
A defining word executed in the form:
|
||
|
32b 2CONSTANT <name>
|
||
|
Creates a dictionary entry for <name> so that when <name> is
|
||
|
later executed, 32b will be left on the stack.
|
||
|
|
||
|
2DROP 32b -- 79 "two-drop"
|
||
|
32b is removed from the stack.
|
||
|
|
||
|
2DUP 32b -- 32b 32b 79 "two-dupe"
|
||
|
Duplicate 32b.
|
||
|
|
||
|
2OVER 32b1 32b2 -- 32b1 32b2 32b3 79 "two-over"
|
||
|
32b3 is a copy of 32b1.
|
||
|
|
||
|
2ROT 32b1 32b2 32b3 -- 32b2 32b3 32b1 79 "two-rote"
|
||
|
The top three double numbers on the stack are rotated,
|
||
|
bringing the third double number number to the top of the
|
||
|
stack.
|
||
|
|
||
|
2SWAP 32b1 32b2 -- 32b2 32b1 79 "two-swap"
|
||
|
The top two double numbers are exchanged.
|
||
|
|
||
|
2VARIABLE -- M,79 "two-variable"
|
||
|
A defining word executed in the form:
|
||
|
2VARIABLE <name>
|
||
|
A dictionary entry for <name> is created and four bytes are
|
||
|
ALLOTted in its parameter field. This parameter field is to
|
||
|
be used for contents of the variable. The application is
|
||
|
responsible for initializing the contents of the variable
|
||
|
which it creates. When <name> is later executed, the
|
||
|
address of its parameter field is placed on the stack. See:
|
||
|
VARIABLE
|
||
|
|
||
|
D+ wd1 wd2 -- wd3 79
|
||
|
See the complete definition in the Required Word Set.
|
||
|
|
||
|
D- wd1 wd2 -- wd3 79 "d-minus"
|
||
|
wd3 is the result of subtracting wd2 from wd1.
|
||
|
|
||
|
D. d -- M,79 "d-dot"
|
||
|
The absolute value of d is displayed in a free field format.
|
||
|
A leading negative sign is displayed if d is negative.
|
||
|
|
||
|
|
||
|
|
||
|
46
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
13. DOUBLE NUMBER EXTENSION WORD SET
|
||
|
|
||
|
|
||
|
D.R d +n -- M,83 "d-dot-r"
|
||
|
d is converted using the value of BASE and then displayed
|
||
|
right aligned in a field +n characters wide. A leading
|
||
|
minus sign is displayed if d is negative. If the number of
|
||
|
characters required to display d is greater than +n, an
|
||
|
error condition exists. See: "number conversion"
|
||
|
|
||
|
D0= wd -- flag 83 "d-zero-equals"
|
||
|
flag is true if wd is zero.
|
||
|
|
||
|
D2/ d1 -- d2 83 "d-two-divide"
|
||
|
d2 is the result of d1 arithmetically shifted right one bit.
|
||
|
The sign is included in the shift and remains unchanged.
|
||
|
|
||
|
D< d1 d2 -- flag 83
|
||
|
See the complete definition in the Required Word Set.
|
||
|
|
||
|
D= wd1 wd2 -- flag 83 "d-equal"
|
||
|
flag is true if wd1 equals wd2.
|
||
|
|
||
|
DABS d -- ud 79 "d-absolute"
|
||
|
ud is the absolute value of d. If d is -2,147,483,648 then
|
||
|
ud is the same value. See: "arithmetic, two's complement"
|
||
|
|
||
|
DMAX d1 d2 -- d3 79 "d-max"
|
||
|
d3 is the greater of d1 and d2.
|
||
|
|
||
|
DMIN d1 d2 -- d3 79 "d-min"
|
||
|
d3 is the lesser of d1 and d2.
|
||
|
|
||
|
DNEGATE d1 -- d2 79
|
||
|
See the complete definition in the Required Word Set.
|
||
|
|
||
|
DU< ud1 ud2 -- flag 83 "d-u-less"
|
||
|
flag is true if ud1 is less than ud2. Both numbers are
|
||
|
unsigned.
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
47
|
||
|
|