Shop OBEX P1 Docs P2 Docs Learn Events
FORTH on Propeller update? — Parallax Forums

FORTH on Propeller update?

prof_brainoprof_braino Posts: 4,313
edited 2008-06-24 02:17 in Propeller 1
I noticed a several interesting postings about FORTH for the propeller, but none in the last couple months. M. deSilva describes the FORTH projects as "failed" in his post of 2008-02-23. Have you guys stopped FORTHing around, or is work continuing but just not showing up in the forums?

I downloaded the binary from January 29 2008 from http://code.google.com/p/propellerforth/downloads/list
Also January 24 2008 http://code.google.com/p/spinforth/downloads/list
What was it about Janaury for FORTH on the the propeller?
There was mention that there were 4 FORTHs for the propeller, I cannot locate the other two forth versions. What conditions indicate the use of one over the others?

I am really interested in this device and FORTH is always the most fun for programming. But I only have a few hours to spent reading the forums. Is there a central location for discussion on using FORTH on the propeller for development and education? Is there a moderator or maintainer that is partial to FORTH?

Thanks!

Comments

  • JoannaKJoannaK Posts: 44
    edited 2008-06-02 12:06
    I have not had much time for propeller last half-year, but as far as can tell, PropellerForth has been in active development in May2008 (at least somewhat).. See author's blog.
    http://cliffhacks.blogspot.com/search/label/propellerforth

    I wish there were more Forth users with propeller, but apparently it's quite quiet atm..

    Post Edited (JoannaK) : 6/2/2008 12:46:52 PM GMT
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2008-06-02 13:14
    First thing I wanted when I got hold of the Propeller was to implement a Forth, I mean, how hard could that be? It turns out the prop is a very different architecture and there is really only one development tool at present which is the Spin IDE. Now some have written their own assemblers like Cliff which makes it easier I guess to implement a Forth while others have stuck with Spin and PASM.

    While the Forths that have been released are admirable efforts I have not been able to use them for anything serious yet. I really would like one that makes it easy to link to other Spin objects such as VGA and SD card drivers etc. I mean, there is more appeal to the Propeller than just the hardware, it is also in the Spin objects (some ingenious, all useful) that have been contributed. If you can't use them then you have to reinvent the wheel each time.

    Also, I have found the Forth implementations neither fast nor compact and the serial driver which is the main user link to the Forth is limited. This isn't meant as a snipe at these Forths, it's just my reasons as to why I am not using them at present. Mind you, once I can get out of this insane hardware design cycle I would really love to sit down and tinker with a Forth, especially after my experience to date with the Propeller. I have very definite ideas on how this Forth should be but I am also aware that various compromises have to be made due to the limited memory.

    One of my aims is to utilize SD memory as an integral part of the Forth system so that it holds the source code plus the headers and help files with the possibility of executing code from there as well. This would require a dedicated cog to handle the memory management and allocate virtual memory space but it's something similar to what I have done before and it's doable. The trick to making it fast is trying to keep the code in RAM which means it has to be composed of compact byte tokens, all headers and linkages etc are relegated to SD as that won't impact runtime speed.

    I had originally used and modified Mike Green's FemtoBasic and found that easy to work with especially with the SD File system running and also since I could easily link in other objects easily. So that is how I want it to feel except in Forth and faster and of course more compact. So at the moment I'm "gonna get a round tuit" which is not good enough really. But you never know, I could put all the new hardware projects on hold for a week or two and concentrate on Forth, I know I could definitely use it myself.

    In saying all this I must also say that I am getting quite used to Spin and don't mind it a bit. Of course Forth is an OS and not just a language though.

    *Peter*
  • prof_brainoprof_braino Posts: 4,313
    edited 2008-06-03 05:14
    Thanks for the responses.

    I really would like one that makes it easy to link to other Spin objects such as VGA and SD card drivers etc. I mean, there is more appeal to the Propeller than just the hardware, it is also in the Spin objects (some ingenious, all useful) that have been contributed. If you can't use them then you have to reinvent the wheel each time.

    This is what I had in mind as well. Has anyone suggested a generic interface to spin objects from forth? For example, using a cog as a spin object librarian and pass results back to the tasks on other cogs?
  • JoannaKJoannaK Posts: 44
    edited 2008-06-04 09:52
    Since it's not recommended (at least according Propeller manual) to try starting Spin runtime from Assembler I doubt it would be much better to try squeeze both Spin and Forth to same chip. It might work, but IMHO it's not likely to be worth the effort unless both systems are re-build to mutual respect&co-exists from the ground.

    IIRC Imagecraft C has this same limitation (no mixing with spin).


    For personal Forth update.. Since last post I've done some coding with PropellerForth at Demoboard and it seems to be quite nice for 10kilobyte binary. It's not full system yet (no propeller side editor+videoscreen+keyboard+assembler) but it interacts ok via USB-serial port.

    I have made some tool-words that are missing from PF 8.01. I have intention (time allowing) to make SEE ( small forth decompiler) and perhaps try to build nice compact inline-assembler.
    ( these 4 are done )
    dump ( addr u -- )
    .kindof ( xt -- ) ( what kind of definition)
    .word ( xt -- ) ( print word name + info )
    words ( -- ) ( Print available words )

    Post Edited (JoannaK) : 6/4/2008 10:19:13 AM GMT
  • JoannaKJoannaK Posts: 44
    edited 2008-06-10 08:34
    I have build a small interactive In-propeller assembler atop of PF ... it's nothing fancy but seems to be working and should soon be enough for making basic drivers.

    Note, this is first version asm syntax, so it may well change in time.

    SI = SourceImmediate flag
    ASM, = compiles assembler instructions line at a time

    I also have WZ, WC WR and NR flags (and most common condition codes) defined, but those are not used in this small test.

    
    16 asmpar !
    5000000 asmpar 4 + !
       
    \ MY first interactive PF-assembler program
    \
    \ r0 indexer for main mem addresses
    \ r1 led bitnum 
    \ r2 countervalue 
    \ r3 led bitmask
    
    0 ORG
      r0   par mov     asm, \ 0
      r3   1   mov si  asm, \ 1
      r1   r0  rdlong  asm, \ 2
      r0   4   add si  asm, \ 3
      r3   r1  shl     asm, \ 4
      r2   r0  rdlong  asm, \ 5
      dira r3  mov     asm, \ 6
      outa r3  or      asm, \ 7
      0    0   nop     asm, \ 8
      r2   7   djnz si asm, \ 9
      r2   r0  rdlong  asm, \ 10
      outa 0   andn    asm, \ 11
      0    0   nop     asm, \ 12
      r2   11  djnz si asm, \ 13
      0    0   jmp  si asm, \ 14
    FIT
    
    ASMPAR ASMBASE @   cognew
    

    Post Edited (JoannaK) : 6/10/2008 8:39:21 AM GMT
  • prof_brainoprof_braino Posts: 4,313
    edited 2008-06-15 05:05
    Well, I got PropellerForth and SpinForth to come up. Time to dust off the old books and see how much forth I retained.
    Has anybody started a Functional spec for a forth environment on the propeller?
    Would this be interesting or useful?
  • JoannaKJoannaK Posts: 44
    edited 2008-06-19 10:48
    I have sent couple E-mails to PropellerForth author, but have not yet seen any reply.. I was hoping to hear from him considering the possible update (don't want to duplicate his work), and mention some issues (minor, like the >number not using double precision).

    At the moment I've become a bit preoccupied and thus need to slow down tinkering with PF for coule more weeks. But I'll be happy to help if there is any project on documenting. I'm considering releasing my Forth-words in source form (if anyone is interested), but some of them (SEE among others) needs serious rewrite.
    words
    asm, if_NC if_C if_NZ if_Z if_alw2&& if_neve& asmCond WZ WC NR WR SI flagbit NOP waitvid waitcnt waitpne waitpeq tjz tjnz djnz 
    cmpsub subsx ddsx subs adds subs adds s cmpx addx cmpsx cmps negnz negz negnc negc absneg abs neg mov sumnz sumz 
    sumnc sumc sub addabs sub cmp add muxnz muxz muxnc muxc or andn testn and test jmpret jmp movi movd m max min maxs 
    mins rev sar rcl rcr shl shr rol ror hubop rdlong wrlong rdword wrword rdbyte wrbyte opcode FIT ORG ASMBASE ASMPAR 
    R15 R14 R13 R12 R11 R10 R9 R8 R7 R6 R5 R4 R3 R2 R1 R0  ok
    forth words
    assembl&& see rel16. tmpcode tmpxt .word .kindof words .name % u%. %. $ u$. $. binary dump dumphex dumpasc ldump .s S.S 
    $8. $4. $2. .r sign #s #> <# # hold hld abs spaces JKTAG  .... 
    
    
  • prof_brainoprof_braino Posts: 4,313
    edited 2008-06-22 13:20
    I notice with Propellerforth, the .s word seems to be unaware of the stack depth, and Spinforth has no .s word at all. Am I missing something, or is there a different word used to non-destructively show the state of the stack?
  • JoannaKJoannaK Posts: 44
    edited 2008-06-23 09:10
    Propeller Forth has a slight omission at inner interpreter.. Interpret should check Stack underflow after Each interpreted word, but it does not do so.. I have made these as a part of my save image ..

    ( safer version of .S )
    : S.S SP@ sp0 @ <
      if ." Stack underflow"
      else .s
      then ;
    
    : .s s.s ;
    
    



    Also PF does not hide the name of currently compilied word from search so if one tries simply to redefine word with same name it'll leads to recursion.. (Not according the standard)

    Second point to note concerning stacks: in PF parameter stack grows upwards. Usually (though not mandatory) Forth stacks grow downwards.
  • Fred HawkinsFred Hawkins Posts: 997
    edited 2008-06-24 02:17
    prof-braino,
    spinforth has a printstack that is in the debug code in cog zero's spin program. It looks like it is invoked by trace.
Sign In or Register to comment.