+ Reply to Thread
Page 1 of 3 123 LastLast
Results 1 to 20 of 47

Thread: FPForth

  1. #1

    Default FPForth

    "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
    Attached Files Attached Files
    Last edited by ForumTools; 10-01-2010 at 01:12 AM. Reason: Forum Migration

  2. #2

    Default

    deSilva,

    Thanks for all of your contributions to the forum.

    Would it be possible to add a "bignum" function to FPForth... I would like to do completely unscaled integer math on the Prop. For example... adding two integers the size of the Encyclopedia Britanica together.

    Rich
    Last edited by ForumTools; 10-01-2010 at 01:12 AM. Reason: Forum Migration

  3. #3

    Default

    Twoquick notes on FPForth:
    1. If you are using HyperTerminal you have to disable flow control. I will be trying PuTTY this weekend because I hate HyperTerminal.
    2. The German thread has more information. You can use thisBabelfish link for something that looks like English.

    It has been years since I have done anything in Forth so I have some relearning to do. Someone else might have some better recommendations but I am starting by reading twoof Leo Brodie's booksthat are available on the Internet
    1. "Starting Forth"
    2. "Thinking Forth"

    Thanks frohf for developing this and thanks deSilva for keeping up informed!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    BioProp: Robotics - Powered by Bioloids and controlled by the Propeller
    Last edited by ForumTools; 10-01-2010 at 01:12 AM. Reason: Forum Migration

  4. #4

    Default

    Here's another book "Programming Forth" by Stephen Pelcwww.mpeforth.com/arena/ProgramForth.pdf

    Any chance that this propeller forth will support CREATE ... DOES> ? Last that I looked on the German forum I didn't see DOES> present. I don't know if it's missing due to technical difficulty, ideology (e.g. Ting's eForth), or maybe I just missed it.
    Last edited by ForumTools; 10-01-2010 at 01:12 AM. Reason: Forum Migration

  5. #5

    Default

    Good references!

    I added the list of implemented words. There is no specific limit to it: Frohf will will most likely implement what he needs and where a request is for...

    Note that there is a small kernel of words totally implemented inside the COG.

    It might be important to know that the complete stack is also allocated inside the COG, limiting its size considerably, but without any bad effects so far....
    Last edited by ForumTools; 10-01-2010 at 01:12 AM. Reason: Forum Migration

  6. #6

    Default

    I've just tried it. It executes the first command OK, but subsequent commands don't get executed properly. I can't get a colon definition to work because of this problem.

    Leon

    Edit:

    I had the terminal program set for CR/LF. Changing it to CR only got it working properly.

    Leon



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle

    Post Edited (Leon) : 9/29/2007 5:44:24 PM GMT
    Last edited by ForumTools; 10-01-2010 at 01:12 AM. Reason: Forum Migration

  7. #7

    Default

    Is there a version that runs on the Hydra?
    Last edited by ForumTools; 10-01-2010 at 01:12 AM. Reason: Forum Migration

  8. #8

    Default

    As it uses pins 30 and 31 only at the moment the difference is just the 10 MHz crystal. I think Frohf will make a version
    Last edited by ForumTools; 10-01-2010 at 01:13 AM. Reason: Forum Migration

  9. #9

    Default

    I just uploaded v0.70 - see posting #1. There is now a 5MHz (checked on the Protoboard) and a 10MHz crystal version (checked on the Hydra)
    Last edited by ForumTools; 10-01-2010 at 01:13 AM. Reason: Forum Migration

  10. #10

    Default

    Is the source available?

    I don't wont my time to be wasted like it was on the last Forth I tried...


    LewisD
    Last edited by ForumTools; 10-01-2010 at 01:13 AM. Reason: Forum Migration

  11. #11

    Default

    Be patient!
    FPForth will undergoe still some basic revisions.
    And you cannot waste too much time as long as there is just a binary
    Last edited by ForumTools; 10-01-2010 at 01:13 AM. Reason: Forum Migration

  12. #12

    Default

    I think what LewisD meant was that without the source code, this could become another abandonded project like Cliff's Forth. It sounds like frohf will be publishing source as soon as the first full release is ready. As I understand it, this will include SD/EEPROM file support and the ability to access spin/asm objects running on other cogs.

    Personally I am waiting for Propeller Terminal support via PC_Interface and the ability to call my own Bioloid communication driver code. In the mean time, I am re-learning Forth and working on my driver and sensor code.

    By the way, What was changed in version 0.70 other than thecrystal speed?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    BioProp: Robotics - Powered by Bioloids and controlled by the Propeller
    Last edited by ForumTools; 10-01-2010 at 01:13 AM. Reason: Forum Migration

  13. #13

    Default

    See the first message in this thread, bug fixes in 0.70 are listed.

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle
    Last edited by ForumTools; 10-01-2010 at 01:13 AM. Reason: Forum Migration

  14. #14

    Default

    Thanks lnielsen

    I am concerned that it may be abandoned.

    I am very interested in using a Forth for my robot projects...

    LewisD
    Last edited by ForumTools; 10-01-2010 at 01:13 AM. Reason: Forum Migration

  15. #15

    Default

    Don't fear!
    Of course this can always happen with any one-man-project...
    But we think it has first to get some internal stabiliity before it should be allowed to "spawn" into variants...

    The community is small.. In fact I have no idea how large at all!? This forum has 10,000 users, so 20k to 30 k may be a good guess - but may be not...


    <Edit> My mistake!! 10 k is the count for ALL Parallax forums, impossible to separate them. So according to popularity, history, and the "feeling" from the Propeller forum, I should say there are 1k interested in propeller rather than 10k ... So there is no justification for jumping to 20k to 30k as I did the other day... </Edit>

    I should say - and this is again a guess, not even an "educated" one:

    75% SPIN only

    10% SPIN with mixture of assembly language

    10% with high interest in C-Compiler, now messing arround with SPIN and assembly

    4% interested in an alternative high performance development system for dedicated and customized Propeller solutions; FORTH being their favourit, but willing to change to C when it's good, or stay with assembly if FORTH does not perform...

    1% FORTH addicts

    Well 1% is around 200.. not so bad
    <Edit> But after a reconsideration by far less :-( </Edit>

    Post Edited (deSilva) : 10/5/2007 7:00:34 PM GMT
    Last edited by ForumTools; 10-01-2010 at 01:13 AM. Reason: Forum Migration

  16. #16

    Default

    I just load forthhydra_070.binary on my hydra and all
    I get is a blank screen? What am I missing?

    Thanx
    Last edited by ForumTools; 10-01-2010 at 01:13 AM. Reason: Forum Migration

  17. #17

    Default

    This Forth uses the serial connection to the PC for its console. You need to run a program like Hyperterminal on the PC with a connection at 19.2KBaud. There's no support currently for VGA or TV and the PS/2 keyboard.
    Last edited by ForumTools; 10-01-2010 at 01:13 AM. Reason: Forum Migration

  18. #18

    Default

    I load the Hrydra with forth.
    I have started Hyper terminal @ 19.2K and still no joy....
    Last edited by ForumTools; 10-01-2010 at 01:13 AM. Reason: Forum Migration

  19. #19

    Default

    Sorry to hear :-( You can be sure I checked it...
    But with Aribas new PropTerminal only, which autoconfigures to FPForth and also shows a larger screen.

    When you use Hyperterminal the Propeller is reset, so if you have loaded Forth to RAM rather than saved it to EEPROM there is nothing to see....

    19.2k, 8 bits, no parity, no handshake!
    Last edited by ForumTools; 10-01-2010 at 01:13 AM. Reason: Forum Migration

  20. #20

    Default

    You also need upper-case, and CR at the end of a line.

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle
    Last edited by ForumTools; 10-01-2010 at 01:13 AM. Reason: Forum Migration

+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts