Shop OBEX P1 Docs P2 Docs Learn Events
Propforth 3.5 includes Low Res VGA - Page 3 — Parallax Forums

Propforth 3.5 includes Low Res VGA

135

Comments

  • prof_brainoprof_braino Posts: 4,313
    edited 2010-10-30 10:14
    caskaz wrote: »
    Hi prof_braino.

    _fcog is valid (first forth) cog.
    _fcog W@ wvariable _fcog _fcog W!

    I don't think we are intended to set the words with an underscore, in general. I remember something about those being used internally by the kernel, it might get confused if you manually set it.
  • prof_brainoprof_braino Posts: 4,313
    edited 2010-10-30 15:14
    Support for ANSI Escape Sequences for Serial Terminal has been added to the PropForth package

    http://code.google.com/p/propforth/downloads/detail?name=ANSI%20Escape%20Sequences.f&can=2&q=

    The escape codes send color/formatting requests to the PC serial terminal program, and the PC does the work.

    No noticeable impact to to performance. Very small code size. Handy in debugging if you like when Status=Good displays in green and Status=ERROR displays in RED.

    Control text display color, foreground and background, 8 colors
    Control cursor position on screen (up to 99 character wide, if somebody has need I can increase it to 999, but I'm saving 6 bytes)
    Control underscore, reverse, bold, normal
    Support cls (clearscreen), home, clear to end of screen, clear to end of line

    Requires a serial terminal program that supports ANSI escape codes (TeraTerm works great)

    Does not support italics, faint, cross-out, blink, or alternate fonts (unless you show me how they work, I never use them)

    If anybody knows how to get the ANSI BLINK stuff to work with a serial term, please let me know. I really want the DANGER messages to flash in red.
  • prof_brainoprof_braino Posts: 4,313
    edited 2010-10-30 15:20
    caskaz wrote: »
    Hi salsanci & prof_braino.

    I found out very little mistake on PropForth.spin.

    \ lockclr (n1 -- n2) set lock n1...........the lock was set ... --> clear lock n1 .... the lock was clear ...

    : checkdict here W@ + dictend W@ >=
    if cr here W@ . dictend . _eoom clearkeys reset then ; --> if cr here W@ . dictend W@ . _eoom clearkeys reset then ;

    Thanks caskaz

    Issue 16 has been opened

    http://code.google.com/p/propforth/issues/detail?id=16

    I'll have Sal look at it tomorrow. I have the new ALPHA release, the updates might be in as soon as tomorrow.
  • caskazcaskaz Posts: 957
    edited 2010-10-30 23:48
    Hi prof_braino.

    I do experiments to see PropForthDictionaryStructure of PropForth Wiki.
    fl
    : dictEntryDump
    dup .word 3a emit space
    dup .strname cr 
    nfa>pfa                         
    \ do i dup .word 3a emit space W@ dup .word space _forthpfa>nfa dup .word space .strname cr 2 +loop
    do i dup .word 3a emit space W@ dup dup .word d72 >= if
                                                                space _forthpfa>nfa dup .word space .strname 
                                                             else
                                                                drop
                                                             then                                                         
                                                             cr 2 
    +loop
    cr
    ;
    
    : dictDump
    here W@ wlastnfa W@
    begin 2dup dictEntryDump nip nfa>lfa dup W@ dup 0= until
    2drop
    ;
    
    
    result about word'dictDump' below:
    Address   name
      |       |
    3DC4: dictDump        3DC4 <-- nfa ddress
    
    address address's content(here's pfa-address) here's nfs-address from pfa   name
      |        |                                       |                          |
    3DCE:    0D78                                     0D72                      here  3CDE <-- dictDump's pfa address
    
    3DD0: 139A 1396 W@
    3DD2: 3D58 3D4E wlastnfa
    3DD4: 139A 1396 W@
    3DD6: 1AEC 1AE6 2dup
    3DD8: 3D6C 3D5E dictEntryDump
    3DDA: 1AD0 1ACC nip
    3DDC: 222E 2226 nfa>lfa
    3DDE: 0032
    3DE0: 139A 1396 W@
    3DE2: 0032
    3DE4: 1BE0 1BDC 0=
    3DE6: 00D8
    3DE8: FFEE 7FEC
    3DEA: 1AFA 1AF4 2drop
    3DEC: 0073
    

    There is not forth-word'begin' inside dictDump.
    Where is wrong?
  • prof_brainoprof_braino Posts: 4,313
    edited 2010-10-31 12:20
    caskaz wrote: »
    I do experiments to see PropForthDictionaryStructure of PropForth Wiki.
    : dictEntryDump
    
    There is not forth-word'begin' inside dictDump. Where is wrong?

    I haven't been running your examples, so I'm a little off in my understanding


    Have run the dictionary dump ' words ' ?
    words
    

    This does contain
    begin
    
    , and lists ' begin' as a Forth word, and an Immediate word. Immediate words cannot be executed from the command line, only executed during compilation of a colon definition.

    Is this the issue?
  • prof_brainoprof_braino Posts: 4,313
    edited 2010-10-31 12:33
    caskaz wrote: »
    is correct way?
    Cog6 ok
    4 _fcog W!
    Cog6 ok
    

    I finally checked
    4_fcog W!
    

    _fcog is set internally by propforth to hold the last running forth cog.

    It is only manually set by the user when you something running in for example cog 3 and you want to lock it off from propforth. In this case,
    4_fcog W!
    
    to no long consider cog 3 as next available cog; and also lock off cog2 cog1 cog0, leaving only 5 and 6 for forth. (and 7 for the serial driver).

    So I think what you did in the example is not correct, I think you should not use
    _fcog
    
    at all in this example.
  • prof_brainoprof_braino Posts: 4,313
    edited 2010-10-31 13:15
    @caskaz

    I sent you a PM, please check your inbox
  • caskazcaskaz Posts: 957
    edited 2010-10-31 18:43
    Hi prof_braino.

    I attached dictionary_log.txt.
    word"emit" include "begin".
    But dictDump doesn't display word"begin" is included in another word.
    dictDump display word"begin".
    1A48: emit
    1A4E: 1A26 1A20 emit?
    1A50: 00D8
    1A52: FFFC 7FFA
    1A54: 006A
    1A56: 00FF
    1A58: 132C 1328 and
    1A5A: 1754 174C emitptr
    1A5C: 139A 1396 W@
    1A5E: 0032
    1A60: 00D8
    1A62: 0008
    1A64: 13C8 13C4 W!
    1A66: 001B
    1A68: 0004
    1A6A: 1AFA 1AF4 2drop
    1A6C: 0073
    
    
    
    2A98: begin
    2A9E: 0D78 0D72 here
    2AA0: 139A 1396 W@
    2AA2: 006A
    2AA4: 1317 1312 cstr=
    2AA6: 2914 2910 w>l
    2AA8: 0073
    
    I think "dict_Dump" should display whole dictionary.
    But not displaying word"begin".
    I think "dict_Dump" has bugs.
  • caskazcaskaz Posts: 957
    edited 2010-11-01 05:22
    Hi prof_braino.

    I'm reading spinmaker.f.
    I have question.
    lfa is "`word @***NFA + $10".

    What does $10 mean?
  • caskazcaskaz Posts: 957
    edited 2010-11-02 20:39
    Hi prop_braino.

    I have read PropForthStatus on Wiki.
    I think PropForth3.6 is very interesting.
    I don't understyand what is it below:
    8 channel? ROM-less slaves?

    3.6's release is next week?
  • prof_brainoprof_braino Posts: 4,313
    edited 2010-11-03 20:30
    caskaz wrote: »
    Hi prop_braino.

    I have read PropForthStatus on Wiki.
    I think PropForth3.6 is very interesting.
    I don't understyand what is it below:
    8 channel? ROM-less slaves?

    3.6's release is next week?

    I received the beta, I am testing it (trying to figure out what Sal did) so I can write the instructions; to prove to myself that I know what is going on.

    The idea is to connect many props using fast serial channels to do parallel programs, so there can be more processor - cogs and more shared resources (like your SD function, or the Hive's 1 meg external RAM)

    Unfortunately, I am too busy with my day job. The serial communication is the first thing on the list, SD is next; ethernet and external ram are also waiting for attention.
  • caskazcaskaz Posts: 957
    edited 2010-11-04 17:49
    Hi prof_braino.

    I have question about words on forth dictionary.

    Using _words below;
    Cog6 ok
    0 _words
    NFA(Forth/Asm Immediate eXecute)Name
    3D4F F wlastnfa           3D1E F lasm       3CD8 F rs?          3CA2 F pfa?
       :                                                               :
       :                                                               :
    0D9A F _forthinitialized  0D8C F memend     0D7E F dictend      0D72 F here
    
    Cog6 ok
    c" par" _words
    NFA(Forth/Asm Immediate eXecute)Name
    2486 F parsenw            2466 F parsebl    243C F parseword    23A4 F parse
    1702 F parat
    Cog6 ok
    

    But result of words ia same as "0 _words".
    : words parsenw _words ;
    

    Although I read comments of words, I can't understand its meaning.
    How to use "words"?
  • prof_brainoprof_braino Posts: 4,313
    edited 2010-11-04 19:49
    caskaz wrote: »

    question about words

    _words
    c" par" _words
    But result of words ia same as "0 _words".
    Although I read comments of words, I can't understand its meaning.
    How to use "words"?

    words does a dump of the forth dictionary. This correctly prints the whole dictionary, and prints flag to show if the word is F (forth) , I (immediate), or X (executes and consumes the next string in the input stream. Using the name X is a little weird but I couldn't suggest anything better.

    When use with a parameter, words will print all the dictionary entries starting with the letter given in theinput stream for example
    words b
    
    will display all the words starting with b, including begin bl base between

    The word "underscore words"
    _words 
    
    is used internally by words and we should not use it, unless we know how to compile words into the input buffer or we will make weird things happen. You figured this out, congratulations!

    Previously, you were using dict_dump and had problems. This is because you wanted to use "words" instead, I think.

    You figured out the hard part, which is how to use _words, but missed the easy part, which is words displays the whole dictionary, or filters on one letter, give AFTER words in the input stream.

    Very good!
  • caskazcaskaz Posts: 957
    edited 2010-11-05 07:10
    Hi prof_braino.

    I'm making word's manual.
    I read Control Structures word(if,do begin ..).
    They have number. For example if->1235,else->1239,dothen->1235/1239 etc.
    What is these number?
    How are they determined?
  • prof_brainoprof_braino Posts: 4,313
    edited 2010-11-06 20:05
    caskaz wrote: »
    Hi prof_braino.

    I'm making word's manual.
    I read Control Structures word(if,do begin ..).
    They have number. For example if->1235,else->1239,dothen->1235/1239 etc.
    What is these number?
    How are they determined?

    Sorry, where are you seeing this number?
  • caskazcaskaz Posts: 957
    edited 2010-11-06 20:44
    Hi prof_braino.

    There are from line No 955 in PropForthPart1.f.
    : dothen l>w dup 1235 = swap 1239 = or if dup here W@ swap - swap W! else _mmcs then ;
    : then dothen ; immediate
    : thens begin dup FFFF and dup 1235 = swap 1239 = or if dothen 0 else -1 then until ; immediate
    : if $C_a_0branch w, here W@ 1235 w>l 0 w, ; immediate
    : else $C_a_branch w, 0 w, dothen here W@ 2- 1239 w>l ; immediate
    : until l>w 1317 = if $C_a_0branch w, here W@ - w, else _mmcs then ; immediate
    : begin here W@ 1317 w>l ; immediate
    : doloop swap l>w 2329 = if swap w, here W@ - w, else _mmcs then ;
    : loop  $C_a_(loop) doloop ; immediate
    : +loop  $C_a_(+loop) doloop ; immediate
    : do $C_a_2>r w, here W@ 2329 w>l ; immediate
    
  • prof_brainoprof_braino Posts: 4,313
    edited 2010-11-06 21:38
    caskaz wrote: »
    Hi prof_braino.

    There are from line No 955 in PropForthPart1.f.
    : dothen l>w dup 1235 = swap 1239 = or if dup here W@ swap - swap W! else _mmcs then ;
    : then dothen ; immediate
    : thens begin dup FFFF and dup 1235 = swap 1239 = or if dothen 0 else -1 then until ; immediate
    : if $C_a_0branch w, here W@ 1235 w>l 0 w, ; immediate
    : else $C_a_branch w, 0 w, dothen here W@ 2- 1239 w>l ; immediate
    : until l>w 1317 = if $C_a_0branch w, here W@ - w, else _mmcs then ; immediate
    : begin here W@ 1317 w>l ; immediate
    : doloop swap l>w 2329 = if swap w, here W@ - w, else _mmcs then ;
    : loop  $C_a_(loop) doloop ; immediate
    : +loop  $C_a_(+loop) doloop ; immediate
    : do $C_a_2>r w, here W@ 2329 w>l ; immediate
    

    Ok, you ask hard questions. Already you know more about propforth than I do.

    I don't know. This stuff is crazy complicated.

    My GUESS is that these are the hex values of the assembler instructions that must be tested to do these branches.

    For example, dothens is as support word for THENS which resolves (n) multiple THEN statements. So it has to determine which type of branch or if its the last one. So, if this is true, these are the opcodes for the branch instructions from the propeller manual.

    Please let me know if this is correct or not, I could update the documentation

    Otherwise I will ask Sal on the next call. What is it you are trying to do?
  • hinvhinv Posts: 1,255
    edited 2010-11-20 20:09
    Where are ! and @ ?

    how about +! ?

    Thanks, Doug
  • hinvhinv Posts: 1,255
    edited 2010-11-20 20:43
    If I define up as
    : up 0 do 1 + dup . loop ;
    if I say "20 up", it counts to 20
    If i say "20 up" again, it counds 21 to 40
    the stack is empty when I check with st?
    Why is this happening, and where is the count stored?

    Sorry for the noob questions.

    Doug
  • caskazcaskaz Posts: 957
    edited 2010-11-21 07:10
  • prof_brainoprof_braino Posts: 4,313
    edited 2010-11-21 07:14
    hinv wrote: »
    Where are ! and @ ?

    how about +! ?

    Thanks, Doug

    Most architectures (used to) support one kind of memory access by default.
    For example, most 8 bit micro controllers were byte access.
    So fetch and store
    @
    !
    
    were obviously byte access.

    Prop is different in that COG memory is mostly longs, and HUB memory tends to be most efficient when used as words, but also support byte and long access. So which to make the default?

    Originally, Sal had @ and ! default to WORD in HUB memory, and Long in COG memory. We decided that in the case of the prop this was not making things clearer. so we did this:

    COG access is always LONG and uses COG@ and COG!
    HUB memory can be byte, word or long and is defined as
    C@ C!
    W@ W!
    L@ L!

    Nearly ALL of propforth kernel words are lower case EXCEPT for these words.
    As you can guess, we tried using lowercase for these as well but the lowercase 'L' was a major irritation.

    There is no @ or ! defined by default, the user can define these as a reference to one of the others or something else according to their needs.
  • prof_brainoprof_braino Posts: 4,313
    edited 2010-11-21 07:40
    hinv wrote: »
    : up 0 do 1 + dup . loop ;
    if I say "20 up", it counts to 20
    If i say "20 up" again, it counds 21 to 40
    the stack is empty when I check with st?
    Why is this happening, and where is the count stored?

    This is an important question.

    First, try this:

    : up2 0 do i . loop ;

    The loop counter variable 'i' is an artifact from the days when people only had three character to use for variable names, and it was acceptable to use stupid names in programs. Everybody is just supposed to know the I and J are the loop iteration counter variables. SOME folks get MIGHTY UPSET if we try to change these to "iteration-count" or something informative, probably because their fingers would fall off if they had to type the extra characters, and they don't know how to do a string replace. But Sal likes to go with the flow, so we left it as i.

    In your example, there is nothing that you put on the stack to add 1 to.
    There IS something on the stack, and that is stuff that the loop structure uses internally. AND you can mess with it, as you can see, but you shouldn't unless you know EXACTLY what you are doing, or you will bring trouble to yourself. You WILL know what this is all about in a short time, but for now, know that a loop is a boundary that can only be crossed at the beginning and at the end. Later you will see how to get around this rule and use it to your advantage, but not just yet.

    Ok, so now try:

    : up2 1 do i dup . +loop ;

    : up3 1 do i 1 + dup +loop ;
  • prof_brainoprof_braino Posts: 4,313
    edited 2010-11-21 07:44
    caskaz wrote: »
    I made sd_viewer_2.1.

    Got it!

    Today is SD day for me, finally
  • prof_brainoprof_braino Posts: 4,313
    edited 2010-11-21 09:53
    caskaz, this is amazing.

    I tried everything on the menu with SDSC 1Gig.
    Everything works as expected.
    I could not find any errors, did you already fix the issue you had ?

    I will try SDHC in a bit.

    My only comment is that there are no stack or usage comments.

    For example, before the definition for SD_INIT there should be a comment line that says

    / sd_init - this word must be called first to initialize all sd functions.

    for collect_info is should say something like

    / collect_info - requires sd_init to have been executed. Needed for MBR, RTE

    If you want I can got through and put in these type of comments and you can check them?

    Other than that, this stuff is perfect.

    Great work!
  • prof_brainoprof_braino Posts: 4,313
    edited 2010-11-21 10:13
    OK, found the errors

    tested a 2 Gig Transend micro SD card, giving me problems.
    My SDHC adapter identified this as SDHC, but could not format it.

    My SDSC adapter was able to format it as FAT.
    Using your code, sd_init works, the menu displays reasonable values
    until MBR, which says it is formatted to DOS5.0

    Bios boot block is all 0000's
    FAT is all 0000's
    Root is all .u.u (AA55's)
    U - file detail gives 384 entries of -u
    entry 385 is the text of the first file in the first subdirectory

    T -
    Clusters 00 - 29 - AA55 .u
    clusters 2a - 38 - A5A5 ..
    clusters 39 - Onward: 0000 ....

    Also tested SDHC 4 gig card; h, j, k , l gives expected results
    m - gives master boot record similar to successful sdsc card
    b - all 0000's
    f - FAT is all 0000's
    r - all 0000's
    u - no file (and windows does display files)
    t - all 0000's
  • prof_brainoprof_braino Posts: 4,313
    edited 2010-11-21 18:17
    hinv wrote: »
    how about +! ?


    There is a W+!

    There is no +!, as there is no clear default

    W+! was used in creating propforth, but no need arose for character or long. If you need these, they can be added to the kernel, but they turn out to be no used very often.

    Same goes for the coma operator.
  • caskazcaskaz Posts: 957
    edited 2010-11-21 19:17
    Hi prof_braino.

    I added comments to sources.
    And I made PDF.
    I think you feel a little strange because my english is japanease-english.

    sd-viewer can initialize your SD-CARD?
    message is SDSC seccess?
    I think sd_init don't works finely on your 2G/4G.
    or collect_info may collect information finely.

    Both can't display csd/cid?

    Did you format SD-CARDS by Windows?
    Formatted by Windows, I think its SD-CARD don't work finely on sd_viewer.

    Pleaase send your log.
  • caskazcaskaz Posts: 957
    edited 2010-11-21 23:12
    Hi hinv.

    I did experiment.

    Cog6 ok
    1 + dup . st?
    1 ST:
    Cog6 ok
    1 + dup . st?
    2 ST:
    Cog6 ok
    1 + dup . st?
    3 ST:


    There is no data to add on data stack.

    I think WORD"dup" has temprally data in somewhere.
    Or "dup" may change stack top.
    We may merely watch no data on stack.
  • prof_brainoprof_braino Posts: 4,313
    edited 2010-11-22 04:35
    caskaz wrote: »
    Hi hinv.

    I did experiment.

    Cog6 ok
    1 + dup . st?
    1 ST:

    There is no data to add on data stack.

    I think WORD"dup" has temprally data in somewhere.
    Or "dup" may change stack top.
    We may merely watch no data on stack.

    This is the case where the TOP element is buffered, and does NOT register as an underflow (or overflow).
    This is a design decision, as it would too much (slow things down) to test this case all the time, and most computations involve another stack element eventually anyway.

    Just need to be aware that single element operations do not detect under/overflow.
  • caskazcaskaz Posts: 957
    edited 2010-11-22 06:43
    Hi prof_braino.

    I'm going to try asembler WORD. ( It merely put out pulse to P0)
    But it don't work at all.
    test.f
    fl
    
    0 wconstant _data
    1 _data lshift constant _datam
    
    152 asmlabel a_pulse
    lockdict variable def_014F 0159 l, 014F l,
    00000001 l,
    E4FE1B50 l,
    5C7C0000 l,
    68BFED4F l,
    A27E1D00 l,
    7CBFE94F l,
    5CFEA350 l,
    78BFE94F l,
    5CFEA350 l,
    E4FE1D54 l,
    
    freedict
    def_014F lasm
    
    : test 100 0 do a_pulse loop ;
    
    {
    fl
    
    :asm
    __1datam
              _datam
    
    __Edelay  mov  _treg5 ,   # 10
    __C
              djnz _treg5 ,   # __C
    
    __Ddelayret
              ret
    
    a_pulse
    \ set __1datam to output
              or        dira ,     __1datam
    
    \ set loop-counter to 100     
              mov       _treg6 ,    # 100   nr wz
    __F 
    \ set __1datam to high         
              muxnz     outa ,     __1datam
              jmpret    __Ddelayret , # __Edelay       
    
    \ set __1datam to low
              muxz      outa ,     __1datam
              jmpret    __Ddelayret , # __Edelay
    
              djnz      _treg6 ,  # __F
    ;asm
    }
    

    I did how to:
    1 Loading below:
    0 wconstant _data
    1 _data lshift constant _datam
    2 Loading asm.f
    3 Loading codes from :asm to ;asm for test.f.
    4 Paste outputs-code that asm.f print out to test.f

    Where is wrong?
Sign In or Register to comment.