"frohf" has now finally posted his first Forth for the Propeller.
(a) Use it from a terminal window @19,200 baud. Ariba is just testing a new PropTerminal for it
(b) Details see below; some "FORTH for Dummies" will follow
(c) There are obviously some problems with the early versions... I try to keep you up to date so you need not wonder
Status FPForth 0.72
- stack underflow issue has been fixed
- auto Hydra recognition, so there is no extra binary for the hydra any longer!
- Frohf has prepared a short but comprehensiv PDF with a list of all implemented WORDs
Issues
- ." does not work correctly
Some WORDs explained - (0.71):
WORD ( Stack before -- Stack after ; <string> ) C/I/COG
C = Compile only
I = Immediate
COG = executed inside the COG without any internal reference to the HUB
"Stack Notation" as standard with FORTH, using the following data descriptors:
Code:a Aligned Address b Byte Address c Character f Flag, TRUE or FALSE n Signed integer t Flag, TRUE or FALSE u Unsigned integer w general value T TRUE F FALSE na Name Address la Link Address ca Code Address cca COG Address <string> indicates a specific use of the trailing characters, e.g. SEE WORDS
! ( w a -- ) COG
Stores 16 bit of a value value w to address a
# ( d -- d )
Converts one character of a number. The number is converted according to actual number base
#> ( d -- b u )
Limits output string. Yields string address u and length b.
#S ( ud -- 0 0 )
Generates number string by calling # until the number is converted.
' ( -- ca ; <string> )
Displays code address ca of the trailing word <string>
( ( -- ; <string> ) I
Starts a comment upto next ')'
* ( n n -- n ) COG
16 bit (!) multiplication
+ ( w w -- w ) COG
addition
+! ( n a -- )
Add n to (16 bit??) cell at address a.
- ( w w -- w )
Subtraction
. ( n -- )
Display 32bit number after convertion according to actual number base
/ ( n n -- q )
32 bit division
/MOD ( n1 n2 -- n3 n4 ) COG
n1/n2 = n3 remainder n4.
0< ( n -- t ) COG
TRUE if n<0
< ( n1 n2 -- t ) COG
TRUE if n1<n2
= ( w1 w2 -- t ) COG
TRUE if W1==w2
@ ( a -- w ) COG
pushes the 16bit value from address a
2/ ( n -- n ) COG
fast divide by 2
2* ( n -- n ) COG
fast multiply with 2
2! ( w a -- ) COG
Store 32bit value w to address a
2@ ( a -- w ) COG
pushes the 32 bit value from address a
0 1 2 -1 COG
the very numbers 0, 1, 2, and -1
1+ ( n -- n ) COG
fast plus 1
1- ( n -- n ) COG
fast minus 1
2+ ( n -- n ) COG
fast plus 2
2- ( n -- n ) COG
fast minus 2
@EXECUTE ( a -- ) COG
executes any token <> 0 at address a.
ABS ( n -- +n ) COG.
AND ( w w -- w ) COG
BL ( -- c )
pushes a space ("blank character")
C! ( c b -- ) COG
stores 8 bit value c at address b
C@ ( b -- c ) COG
pushes 8 bit value from address b
COG! ( w cca -- ) COG
stores a 32bit value w to COG register cca.
COG@ ( cca -- w ) COG
pushes a 32bit value w from COG register cca.
BINARY ( -- )
Set number base to 2
DIRA ( n -- ) COG
EMIT ( w -- )
send w to the standard serial port
DECIMAL ( -- )
Set number base to 10
DROP ( w -- ) COG
DUMP ( a u -- )
Display u characters starting at address a
DUP ( w -- w w ) COG
HEX ( -- )
set number base to 16
I ( -- w ;R -- ) COG
copies value w from the return stack to the data stack.
I+ ( R n -- n+ )
increment return address
I- ( R n -- n- )
decrement return address
OUTA ( -- n ) COG
MAX ( n1 n2 -- n )
MIN ( n1 n2 -- n )
MOD ( n1 n2 -- n )
remainder
NEGATE ( n -- n )
NOP ( -- )
no operation
NOT ( n -- n ) COG
inverts each bit
OUTA ( n -- ) COG
OR ( w w -- w ) COG
OCTAL ( -- )
Set numbert base to 8
OVER ( w1 w2 -- w1 w2 w1 ) COG
R> ( -- w ;R w -- ) COG
removes return address and pushes it to the data stack.
R@ ( -- w ;R -- ) COG
pushes return address to the data stack without removing it
ROT ( w1 w2 w3 -- w2 w3 w1 ) COG
SWAP ( w1 w2 -- w2 w1 ) COG
TRUE ( -- T ) COG
same as -1
WITHIN ( u lo hi -- t )
TRUE if lo<=u<=hi
WAITTICKS ( n -- ) COG
as WAITCNT(CNT+n)
WORDS ( -- )
lists all defined words
XOR ( w w -- w ) COG
Post Edited (deSilva) : 10/16/2007 6:31:54 PM GMT




Reply With Quote





Bookmarks