-- Compatiblity with the FORTH-83 standard.
Copyright (C) Tektronix, Inc. 1998 - 2001. All rights reserved.
description: All FORTH-83-Standard words are included here that are not in the dpANS already. Though most of the "uncontrolled reference words" are omitted.
FORTH
2+
( i -- i )(
)
;
p4:"two-plus";
add 2 to the value on stack (and leave the result there)
simulate: : 2+ 2 + ;
FORTH
2-
( i -- i )(
)
;
p4:"two-minus";
substract 2 from the value on stack (and leave the result there)
simulate: : 2- 2 - ;
FORTH
?TERMINAL
( .. )(
)
;
as:"question-terminal";
ordinary primitive ?TERMINAL
an executable word (no special usage info)
or wrapper call around p4_key_question
FORTH
COMPILE
( 'word' -- )(
)
;
p4:"compile";
compile the next word. The next word should not be immediate, in which case you would have to use [COMPILE]. For this reason, you should use the word POSTPONE, which takes care it.
simulate: : COMPILE R> DUP @ , CELL+ >R ; ( not immediate !!! )
FORTH
NOT
( .. )(
)
;
as:"not";
compiling primitive NOT
an executable word (no special usage info)
or wrapper call around p4_not
FORTH
VOCABULARY
( 'name' -- )(
)
;
p4:"vocabulary";
create a vocabulary of that name. If the named vocabulary is called later, it will run ((VOCABULARY)) , thereby putting it into the current search order. Special pfe-extensions are accessible via CASE-SENSITIVE-VOC and SEARCH-ALSO-VOC
simulate: : VOCABULARY CREATE ALLOT-WORDLIST DOES> ( the ((VOCABULARY)) runtime ) CONTEXT ! ; IMMEDIATE
FORTH
-->
( -- )no-return(
)
;
p4:"next-block";
does increase BLK and refills the input-buffer from there. Does hence break interpretation of the current BLK and starts with the next. Old-style forth mechanism. You should use INCLUDE
FORTH
INTERPRET
( .. )(
)
;
as:"interpret";
ordinary primitive INTERPRET
an executable word (no special usage info)
or wrapper call around p4_interpret
FORTH
K
( -- counter-val )(
)
;
p4:"k";
FORTH
OCTAL
( -- )(
)
;
p4:"octal";
sets BASE to 8. Compare with HEX and DECIMAL
simulate: : OCTAL 8 BASE ! ;
FORTH
SP@
( -- )(
)
;
p4:"s-p-fetch";
the address of the top of stack. Does save it onto the stack. You could do
: DUP SP@ @ ;
FORTH
!BITS
( bits addr mask -- )( | ) ; |
; |
at the cell pointed to by addr, change only the bits that are enabled in mask
simulate: : !BITS >R 2DUP @ R NOT AND SWAP R> AND OR SWAP ! DROP ;
FORTH
@BITS
( addr mask -- value )( | ) ; |
; |
see the companion word !BITS
simulate: : @BITS SWAP @ AND ;
FORTH
><
( a -- a' )(
)
;
p4:"byte-swap";
byte-swap a word
FORTH
>MOVE<
( from-addr to-addr count -- )( | ) ; |
; |
see MOVE , does byte-swap for each word underway
FORTH
**
( a b -- r )(
)
;
p4:"power";
raise second to top power
FORTH
DPL
( .. )(
)
;
as:"dpl";
threadstate variable DPL
dpl (no special usage info)
FORTH
SEAL
( -- )(
)
;
p4:"seal";
looks through the search-order and kills the ONLY wordset - hence you can't access the primary vocabularies from there.