Shop OBEX P1 Docs P2 Docs Learn Events
PropForth 3.2 is available - Page 2 — Parallax Forums

PropForth 3.2 is available

24

Comments

  • caskazcaskaz Posts: 957
    edited 2010-07-21 07:56
    Hi.

    After buffer_write, Forth don't recognizesome words(2+,+ * st?).
    I operate step by step.
    No problem buffer_make & buffer_display.
    Forth don't recognize st? on third inside do - loop of buffer_write
    Value for buffer & buffer+2 & buffer+4 are 0.
    Where is mistake?

    variable buffer
    : buffer_make create buffer a allot drop ;
    : buffer_display buffer a 0 do dup W@ . 2+ loop drop ;
    : buffer_write buffer 2- a 0 do 2+ over over W! loop ;
    
    buffer_make 
    buffer_display
    0 0 3CF2 628B 6675 6566 5F72 616D 656B 271C Cog6 ok
    0 buffer_write
    buffer_display
    0 0 0 0 0 0 0 0 0 0 Cog6 ok
    st?
    UNDEFINED WORD ???
    reboot
    UNDEFINED WORD ???
    
    
    
  • kuronekokuroneko Posts: 3,623
    edited 2010-07-21 08:56
    It's been a while but I don't think you should mix variable and create. Also, the space you add with allot is in bytes so if nothing else buffer_write will corrupt your dictionary/memory (10 words vs (4 + 10) bytes). You're better off creating your array like this:

    variable buffer 10 allot
    


    That's 4 bytes initial size + 16 extra bytes (10 hex -> 16 dec). buffer_display and buffer_write look OK but buffer_write should clean up the stack (drop drop).

    Post Edited (kuroneko) : 7/21/2010 1:29:47 PM GMT
  • prof_brainoprof_braino Posts: 4,313
    edited 2010-07-21 12:50
    When you execute st? and it responds with UNDEFINED WORD, it means there was an error in you code that trashed the dictionary.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    There are 10 types of people in the world: those who understand binary, and those who don't
  • prof_brainoprof_braino Posts: 4,313
    edited 2010-07-21 12:57
    Look in PropForthPart1.f to see how create is used. It is in general making an EXECUTABLE word

    create <name> <$code_address> w, forthentry freedcit

    So after the
    create <name>

    put the code to execute and write it to the definition in the dictionary
    <$code_address> w,

    forthentry freedcit
    finish the definition. This is like what the ';' normally does in a colon definition.

    In your case, you just want an array, so use

    variable <name> <bytes> allot

    as kuroneko said. Also note that variable reserves 4 bytes for a long, and wvariable reserves 2 bytes for a word, so you need to be aware of how many bytes are already there when you 'allot' the additional bytes. kuroneko's example has a typo, it allocate 10 (hex) bytes which is 16 (decimal) for a total of 20 (decimal) bytes.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    There are 10 types of people in the world: those who understand binary, and those who don't
  • prof_brainoprof_braino Posts: 4,313
    edited 2010-07-21 13:07
    ALSO I think we found something kooky.

    When I look in the dictionary with
    words
    
    



    I see that there is no entry for '*' in the dictionary, and see that

    4 5 *
    
    



    responds with UNDEFINED WORD.

    So there is no signed multiply in the dictionary(!)

    There IS however the entry for u* which is the unsigned multiply.

    4 5 u* .
    14
    decimal
    4 -5 u* .
    -20 
    hex
    
    



    behave as expected. I think the definition
    : * u* ;
    
    



    which just make * do u* will function correctly, but there might be something going on in the flags or carry bits that needs attention. pi'd actually pointed this out earlier in a PM, and I asked Sal about it, but he's not back from vacation yet. He should be back this weekend.

    I figure Sal just wanted to to keep thinks clear in the code that everything was unsigned multiplies at that point, and it's just and oversight.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    There are 10 types of people in the world: those who understand binary, and those who don't
  • kuronekokuroneko Posts: 3,623
    edited 2010-07-21 13:23
    prof_braino said...
    kuroneko's example has a typo, it allocate 10 (hex) bytes which is 16 (decimal) for a total of 20 (decimal) bytes.
    Well, caskaz is accessing 10 word entries in his array which boils down to 20 bytes in my book ... although I can see how the comment is slightly confusing. I'll adjust that.

    Post Edited (kuroneko) : 7/21/2010 2:04:48 PM GMT
  • caskazcaskaz Posts: 957
    edited 2010-07-29 05:29
    Hi.
    I have problem.
    I'm going to make lcd_demo,now.
    Now, I copy/paste word step by step to TeraTerm .
    Usually no error, but sometimes error occure. (when I copied many word)

    How can I send words to Prop without error?
  • prof_brainoprof_braino Posts: 4,313
    edited 2010-07-29 22:47
    caskaz said...
    Hi.
    I have problem.
    I'm going to make lcd_demo,now.
    Now, I copy/paste word step by step to TeraTerm .
    Usually no error, but sometimes error occure. (when I copied many word)

    How can I send words to Prop without error?

    The symptoms you describe are consistent with not including the 'fl' word at the being of the pasted text as described in the documentation. If you don't, pasting won't work for the reasons described.

    Let me know where the documentation is not clear and I will attempt to correct it.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    There are 10 types of people in the world: those who understand binary, and those who don't

    Post Edited (prof_braino) : 7/29/2010 11:14:31 PM GMT
  • caskazcaskaz Posts: 957
    edited 2010-07-29 23:20
    Thanks.

    I paste adding "fl"word at top of word.
    But error always occure "UNDEFINED WORD when word are many.

    Therefore I copy/past 10-line step by step.
    Very inconvenient.

    I use PSPad.
    I copy word on PSPad's window and paste on TeraTerm's window.
    I select "OK" on TeraTerm's ClipBoard confirmation.
    Incorrect?

    Post Edited (caskaz) : 7/30/2010 2:07:23 AM GMT
  • caskazcaskaz Posts: 957
    edited 2010-07-30 07:40
    hi.
    I made lcd_demo.

    Needing about 10 copy/paste to load on Prop.

    attachment.php?attachmentid=72063&stc=1&d=1281181225
    1024 x 768 - 170K
  • caskazcaskaz Posts: 957
    edited 2010-07-30 08:28
    Hi.
    How does font-datas define for PropForth?
  • caskazcaskaz Posts: 957
    edited 2010-07-30 12:25
    Hi.
    I deleted every comments and spaces character in front of words on LQ020B8UB02_demo.
    I did copy/paste whole file(adding fl).
    Successed without errors.

    But after "LQ020"word, error occured "COG6 RESET - last status: MAIN Stack OVERFLOW".
    I use prot board.
    Anything idea?

    caskaz
  • prof_brainoprof_braino Posts: 4,313
    edited 2010-07-30 14:05
    caskaz said...
    Thanks.

    I paste adding "fl"word at top of word.
    But error always occure "UNDEFINED WORD when word are many.

    Therefore I copy/past 10-line step by step.
    Very inconvenient.

    I use PSPad.
    I copy word on PSPad's window and paste on TeraTerm's window.
    I select "OK" on TeraTerm's ClipBoard confirmation.
    Incorrect?

    Yes, ok on teraterm's clipboard confirmation is the final step,
    BUT
    No, if you are getting 'undefined word' your are still not doing it correctly.

    the fl word goes at the BEGINNING ALL TEXT PASTEs. The form indicated in the following code boxes is the required composition of a source text paste into the teraterm window:

    fl    / this must always be the begining of every paste
    : MyWord  / ( stack comment) 
    <...code...>
       ;
    
    : anotherWord
                         MyWord  <...more code...> ;
    
    



    The blue led will flash as fl loads the code into eeprom, then the red led will flash after fl points the interpreter at the code in the eeprom buffer and text scrolls across the screen

    Subsequent pastes ALSO must be in the same form:

    fl    / this must always be the begining of every paste
    : MyWord-2  / ( stack comment) 
    <...code...>     ;
    
    : anotherWord-2   MyWord  Myword-2  <...more code...> ;
    
    



    If you still have problems, please PM me and I will set up a time to talk you through it using skype or something.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    There are 10 types of people in the world: those who understand binary, and those who don't
  • Brian RileyBrian Riley Posts: 626
    edited 2010-07-30 15:24
    prof_braino said...

    No, if you are getting 'undefined word' your are still not doing it correctly.

    the fl word goes at the BEGINNING ALL TEXT PASTEs. The form indicated in the following code boxes is the required composition of a source text paste into the teraterm window:

    fl    / this must always be the begining of every paste
    : MyWord  / ( stack comment) 
    <...code...>
       ;
    
    : anotherWord
                         MyWord  <...more code...> ;
    
    



    I did not know about the FL command, until this part of the thread it wasn't very well documented. Now, in my ignorance I thought it was some kind of command for TeraTerm and ignored it.


    I am using ZTerm, an ancient but still oh-so-useful program, under Mac OS X Snow Leopard. I was just taking large hunks of code and copy/paste sans the FL command, and having no problems. The only thing I can think of is that ZTerm's "pacing" parameters are in increments on 1/60th of a second so a 1 and 1 setting would be 17 ms per char and per line end. PropForth seems to be able to keep up with that.

    Does that make sense?

    cheers ... BBR

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    cheers ... brian riley, n1bq, underhill center, vermont
    The Shoppe at Wulfden
    www.wulfden.org/TheShoppe/
    www.wulfden.org/TheShoppe/prop/ - Propeller Products
    www.wulfden.org/TheShoppe/k107/ - Serial LCD Display Gear
  • prof_brainoprof_braino Posts: 4,313
    edited 2010-07-30 18:25
    Brian Riley said...
    prof_braino said...

    No, if you are getting 'undefined word' your are still not doing it correctly.

    the fl word goes at the BEGINNING ALL TEXT PASTEs. The form indicated in the following code boxes is the required composition of a source text paste into the teraterm window:

    fl    / this must always be the begining of every paste
    : MyWord  / ( stack comment) <...code...>    ;
    
    



    I did not know about the FL command, until this part of the thread it wasn't very well documented. Now, in my ignorance I thought it was some kind of command for TeraTerm and ignored it

    Now I'm getting worried. I thought I put a section about pasting text and 'fl' on one of the getting started pages, and in the FAQ.

    There was also an explanation about flow control and lag spike when a definition is committed to the dictionary, to explain why the garbled characters ocure and what Sal did to overcome all this.

    Has nobody found these?

    How can I organize the material better so this is more in the forefront?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    There are 10 types of people in the world: those who understand binary, and those who don't
  • prof_brainoprof_braino Posts: 4,313
    edited 2010-07-30 22:14
    OK, it seems I haven't mastered google code yet.

    I update the FAQ correctly this time, now the explanation for the file load command should be there.

    Also, I put another link to the page detailing what going on and why it was done this way.

    Please give a look at http://code.google.com/p/propforth/wiki/PropForthFAQ

    and let me know if I should change it further

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    There are 10 types of people in the world: those who understand binary, and those who don't
  • prof_brainoprof_braino Posts: 4,313
    edited 2010-07-30 22:26
    caskaz said...
    Hi.
    How does font-datas define for PropForth?

    Right now the serial communication uses VT100 type ascii codes, that's why there is the 1b emit 5b emit etc in PropForthPart1.f to turn text lines red.
    It uses whatever font your terminal program uses.

    Propforth uses the internal font for VGA, at the moment. This may change in version 3.3+

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    There are 10 types of people in the world: those who understand binary, and those who don't
  • Brian RileyBrian Riley Posts: 626
    edited 2010-07-30 23:15
    The FAQ is much clearer now ... great ....

    I have been puzzling over this;

    NOTE
    
    10 base w! / in hex, sets the base to 16 (decimal)
    
    10 base w! / in decimal, sets the base to 16 (decimal)
    
    



    Is this a typo? If it isn't, please explain what I am suppose to learn from it.

    I know that I can use the words hex and decimal to set the base, but is there a word that will cause what the current base value is to be displayed?

    cheers ... BBR

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    cheers ... brian riley, n1bq, underhill center, vermont
    The Shoppe at Wulfden
    www.wulfden.org/TheShoppe/
    www.wulfden.org/TheShoppe/prop/ - Propeller Products
    www.wulfden.org/TheShoppe/k107/ - Serial LCD Display Gear
  • kuronekokuroneko Posts: 3,623
    edited 2010-07-31 00:11
    Brian Riley said...
    NOTE
    
    10 base w! / in hex, sets the base to 16 (decimal)
    
    10 base w! / in decimal, sets the base to 16 (decimal)
    
    

    That looks slightly off (probably suffers from copy/paste). If you're in decimal mode then the last word sequence does effectively nothing.

    I posted this in the PropForth 2.7 thread a while back. It displays the current base in decimal. There is also a more verbose word somewhere in this thread.

    : current_base mcwBase dup w@ dup decimal . swap w! ;
    


    Given that a number of words have been renamed the above word should probably now read:

    : current_base base dup w@ dup decimal . swap w! ;
    
  • caskazcaskaz Posts: 957
    edited 2010-07-31 00:33
    Hi prof_braino.
    I deleted every comments and spaces character in front of words on LQ020B8UB02_demo.
    I did copy/paste whole file(adding fl).
    After I paste on TearTerm, fl displayed on TearTerm while blue LED lit on prot board.
    Then red LED lit.
    Words are displayed on Tearterm.

    fl
    C77 chars
    
    many word displayed
    : LQ020
      ..
      ..
    ;
    Cog6 ok
    LQ020
    
    COG6 RESET - last status: MAIN STACK OVERFLOW
    Cog6 ok
    
    
    


    It shoud load fine because it don't stop loading.
    But not work.

    I copy/paste LQ020B8UB02_demo with 10-lines step by step. This works fine.
    WHY? I don't have idea.

    About "How does font-datas define for PropForth?"
    Sorry, My question was bad.
    for example, PropBasic define font character by using DATA statement. (word for spin)
    How does PropForth?

    Post Edited (caskaz) : 7/31/2010 12:39:32 AM GMT
  • caskazcaskaz Posts: 957
    edited 2010-07-31 01:17
    Hi prof_braino.
    My proto board has reset problem.(refer to http://forums.parallax.com/showthread.php?p=847290
    When board is removeed from PC, problem occured.
    Isn' t it relation?
  • caskazcaskaz Posts: 957
    edited 2010-07-31 06:15
    Hi.
    I have question.
    Code below not work.
    Value for cnt L@ is akways 64FE0A03.

    What wrong?

    clkfreq 10000 u/ dT L!
    dT L@ cnt L@ + T L!
    10 0 do
       ..
       ..
       T L@ dT L@ waitcnt
    loop
    
    
  • kuronekokuroneko Posts: 3,623
    edited 2010-07-31 06:27
    Shouldn't that be

    cnt @
    


    At least that's how it worked under 2.7
  • caskazcaskaz Posts: 957
    edited 2010-07-31 06:32
    Hi, kuroneko-san
    Propforth v3.2
    cnt @ .
    UNDEFINED WORD
    
    
  • kuronekokuroneko Posts: 3,623
    edited 2010-07-31 06:34
    Yes, I just noticed. Try this

    cnt COG@
    
  • caskazcaskaz Posts: 957
    edited 2010-07-31 08:33
    Thanks kuroneko-san.
    But code below don't work.
    It takes 53seconds to display next figure. Counter pass through..
    What's wrong?

    clkfreq 1000 u/ dT L!
    dT L@ cnt COG@ + T L!
    10 0 do
       i  .
       T L@ dT L@ waitcnt
    loop
    
    

    Post Edited (caskaz) : 7/31/2010 8:41:31 AM GMT
  • kuronekokuroneko Posts: 3,623
    edited 2010-07-31 09:58
    waitcnt behaviour is (T I -- N) where N = T + I
    clkfreq1000u/dTL!
    dTL@cntCOG@+
    100do
    i.
    dTL@waitcnt
    loopdrop</CODE>
  • caskazcaskaz Posts: 957
    edited 2010-07-31 13:40
    Thanks kuroneko-san.
    But same result.
    It takes 53seconds to display next figure. Counter pass through..
  • kuronekokuroneko Posts: 3,623
    edited 2010-07-31 13:45
    caskaz said...
    It takes 53seconds to display next figure. Counter pass through..
    Make sure that you run in decimal mode then. For hex (default) the clkfreq/1000 is simply too small.
  • caskazcaskaz Posts: 957
    edited 2010-07-31 14:19
    Hi
    I use default.
    My misunderstanding.
    minumum is clkfreq/40e(about 1msec)

    PropForth is very slow?

    Post Edited (caskaz) : 7/31/2010 3:37:20 PM GMT
Sign In or Register to comment.