Shop OBEX P1 Docs P2 Docs Learn Events
Tachyon NEON V5 (FAT32 and Ethernet Servers in 32kB EEPROM!) - Page 25 — Parallax Forums

Tachyon NEON V5 (FAT32 and Ethernet Servers in 32kB EEPROM!)

1192021222325»

Comments

  • Peter,
    Sounds great! Did you forward these files to Bob?
    Jim
  • MJB - You mentioned a long time back that you had a tachyon 'language definition' for Notepad++
    Any chance of a copy please?
    Regards, Bob
  • bob_g4bby wrote: »
    MJB - You mentioned a long time back that you had a tachyon 'language definition' for Notepad++
    Any chance of a copy please?
    Regards, Bob

    yes please!
  • MJBMJB Posts: 1,235
    Shawn Lowe wrote: »
    bob_g4bby wrote: »
    MJB - You mentioned a long time back that you had a tachyon 'language definition' for Notepad++
    Any chance of a copy please?
    Regards, Bob

    yes please!

    yes - really long ago.

    I will have a look when I am at the other computer tomorrow
  • MJBMJB Posts: 1,235
    edited 2020-11-12 20:33
    MJB wrote: »
    Shawn Lowe wrote: »
    bob_g4bby wrote: »
    MJB - You mentioned a long time back that you had a tachyon 'language definition' for Notepad++
    Any chance of a copy please?
    Regards, Bob

    yes please!
    yes - really long ago.

    I will have a look when I am at the other computer tomorrow

    @"Shawn Lowe" , @bob_g4bby

    OK - this is from 2014-08-10

    --- just testet it with EXTEND and looks ok.

    Tachyon has changed a bit since then.
    So you might want to go through the keywords lists and update them.
    This can easily be done directly from Notepad++ menu Language/user defined language/Define your language
    after putting this file as NPP Tachyon Style File.xml in the \Notepad++\userDefineLangs folder.
    CORRECTION: you need to use IMPORT for the XML, that was created with EXPORT

    I you make a better / newer version please repost here for everyone.

    can'T see how to attach a file here ... strange

    so I put it inside a CODE block
    <NotepadPlus>
        <UserLang name="TachyonForth" ext="fth" udlVersion="2.1">
            <Settings>
                <Global caseIgnored="no" allowFoldOfComments="yes" foldCompact="no" forcePureLC="0" decimalSeparator="0" />
                <Prefix Keywords1="no" Keywords2="no" Keywords3="no" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" />
            </Settings>
            <KeywordLists>
                <Keywords name="Comments">00\ 01 02 03{ 04}</Keywords>
                <Keywords name="Numbers, prefix1">#</Keywords>
                <Keywords name="Numbers, prefix2">$</Keywords>
                <Keywords name="Numbers, extras1"></Keywords>
                <Keywords name="Numbers, extras2"></Keywords>
                <Keywords name="Numbers, suffix1"></Keywords>
                <Keywords name="Numbers, suffix2"></Keywords>
                <Keywords name="Numbers, range"></Keywords>
                <Keywords name="Operators1">- * / +</Keywords>
                <Keywords name="Operators2"></Keywords>
                <Keywords name="Folders in code1, open">: compiler definer pub pri</Keywords>
                <Keywords name="Folders in code1, middle"></Keywords>
                <Keywords name="Folders in code1, close">;</Keywords>
                <Keywords name="Folders in code2, open"></Keywords>
                <Keywords name="Folders in code2, middle"></Keywords>
                <Keywords name="Folders in code2, close"></Keywords>
                <Keywords name="Folders in comment, open"></Keywords>
                <Keywords name="Folders in comment, middle"></Keywords>
                <Keywords name="Folders in comment, close"></Keywords>
                <Keywords name="Keywords1">DROP DUP ?DUP OVER PICK ROLL ROT SWAP 0&lt; 0 0&gt; U&lt; D&lt; MAX MIN AND XOR OR MOD /MOD ABS NEGATE U* U/MOD D+ DNEGATE INKEY U R&gt; &gt;R ! @</Keywords>
                <Keywords name="Keywords2">IF ELSE THEN DO LOOP +LOOP I I&apos; J LEAVE BEGIN UNTIL WHILE REPEAT , C,</Keywords>
                <Keywords name="Keywords3">BASE VARIABLE ASCII DECIMAL CREATE CONSTANT DOES&gt; RUNS&gt; C ALLOT [ ] EXIT EXECUTE CALL ABORT QUIT TABLE</Keywords>
                <Keywords name="Keywords4">BEEP IN OUT VIS CLS AT HERE PAD SLOW FAST LINE PLOT LOAD SAVE VERIFY BLOAD BSAVE BVERIFY INVIS INKEY CR</Keywords>
                <Keywords name="Keywords5">IFDEF IFNDEF</Keywords>
                <Keywords name="Keywords6"></Keywords>
                <Keywords name="Keywords7"></Keywords>
                <Keywords name="Keywords8"></Keywords>
                <Keywords name="Delimiters">00( 01 02) 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23</Keywords>
            </KeywordLists>
            <Styles>
                <WordsStyle name="DEFAULT" fgColor="000000" bgColor="FFFFFF" fontName="Courier New" fontStyle="1" fontSize="10" nesting="0" />
                <WordsStyle name="COMMENTS" fgColor="800080" bgColor="FFFFFF" fontName="Courier New" fontStyle="1" fontSize="10" nesting="0" />
                <WordsStyle name="LINE COMMENTS" fgColor="008000" bgColor="FFFFFF" fontName="Courier New" fontStyle="1" fontSize="10" nesting="0" />
                <WordsStyle name="NUMBERS" fgColor="0000FF" bgColor="FFFFFF" fontName="Courier New" fontStyle="1" fontSize="10" nesting="0" />
                <WordsStyle name="KEYWORDS1" fgColor="804000" bgColor="FFFFFF" fontName="Courier New" fontStyle="1" fontSize="10" nesting="0" />
                <WordsStyle name="KEYWORDS2" fgColor="800040" bgColor="FFFFFF" fontName="Courier New" fontStyle="3" fontSize="10" nesting="0" />
                <WordsStyle name="KEYWORDS3" fgColor="FF0000" bgColor="FFFFFF" fontName="Courier New" fontStyle="1" fontSize="10" nesting="0" />
                <WordsStyle name="KEYWORDS4" fgColor="800000" bgColor="FFFFFF" fontName="Courier New" fontStyle="1" fontSize="10" nesting="0" />
                <WordsStyle name="KEYWORDS5" fgColor="FF8000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
                <WordsStyle name="KEYWORDS6" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
                <WordsStyle name="KEYWORDS7" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
                <WordsStyle name="KEYWORDS8" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
                <WordsStyle name="OPERATORS" fgColor="0000FF" bgColor="FFFFFF" fontName="Courier New" fontStyle="1" fontSize="10" nesting="0" />
                <WordsStyle name="FOLDER IN CODE1" fgColor="0000FF" bgColor="FFFFFF" fontName="Courier New" fontStyle="1" fontSize="10" nesting="0" />
                <WordsStyle name="FOLDER IN CODE2" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
                <WordsStyle name="FOLDER IN COMMENT" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
                <WordsStyle name="DELIMITERS1" fgColor="0000FF" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                <WordsStyle name="DELIMITERS2" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                <WordsStyle name="DELIMITERS3" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                <WordsStyle name="DELIMITERS4" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
                <WordsStyle name="DELIMITERS5" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
                <WordsStyle name="DELIMITERS6" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
                <WordsStyle name="DELIMITERS7" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
                <WordsStyle name="DELIMITERS8" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
            </Styles>
        </UserLang>
    </NotepadPlus>
    
    
    

    p.s.: if you want to change it - it is good to have a large forth file open - I recommend EXTEND. Then you can immediately see the changes you make.
    actually I am just at it ;-)
  • I have a highlighter for VS Code that I modified from a general Forth grammar if you want it. I keep it in my Tachyon Dropbox but I will move it to a more easily accessed folder in the root under utilities.
  • bob_g4bbybob_g4bby Posts: 401
    edited 2020-11-13 14:33
    Many thanks for the 2 options, both. I'll have a go with the Notepad++ file and repost any updated version.
  • hinvhinv Posts: 1,252
    I'm looking to get started with Tachyon with my QuickStart board while I am waiting for my RetroBlade2 and P2D2 to come in. Do you have a binary I could load up?
    Alternatively, I have:
    DemoBoard
    PropDongle
    ProtoBoard USB

    Initially I just want something that I can play with over usb/serial without dependence on a SDcard.
    I downloaded the 500+MB of Peter's "The LOT" link above, but that is a bit of bewildering overkill to figure out a simple way to get started. I looked at sourceforge, and was similarly confused as to where to start.

    Any help appreciated.
  • hinv wrote: »
    I'm looking to get started with Tachyon with my QuickStart board while I am waiting for my RetroBlade2 and P2D2 to come in. Do you have a binary I could load up?
    Alternatively, I have:
    DemoBoard
    PropDongle
    ProtoBoard USB

    Initially I just want something that I can play with over usb/serial without dependence on a SDcard.
    I downloaded the 500+MB of Peter's "The LOT" link above, but that is a bit of bewildering overkill to figure out a simple way to get started. I looked at sourceforge, and was similarly confused as to where to start.

    Any help appreciated.
    There are a lot of links in my sig but you can use this copy here.
  • hinvhinv Posts: 1,252
    There are a lot of links in my sig but you can use this copy here.

    Yes, there are. That is the problem, information overload and not a clear place to start for someone with no experience with it.

    Thanks for the binary, but proploader won't load it. It just gives "internal error". I'm guessing it is too big to fit in ram so proploader just dies with a poor error description. Is that a .eeprom file instead?

    I would like to dump the contents of the eeprom that are there first so I can put it back later, and was going to use your message on ROM dumping to do it https://forums.parallax.com/discussion/171064/rom-dumping. Do you have a binary to get me up and running in ram so I can dump the eeprom with that?
  • I just tried this binary with BST and also Proptool, so I'm not sure what loader you are using. However if the loader has some kind of limitation then maybe this 32k version of the binary might work.
  • hinvhinv Posts: 1,252
    I just tried this binary with BST and also Proptool, so I'm not sure what loader you are using. However if the loader has some kind of limitation then maybe this 32k version of the binary might work.

    Yes, thanks! That worked great. Now I just need to learn Tachyon. Seems pretty cool! The stack looks upside down compared to my HP calculator.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2020-11-16 02:58
    Compared to anything it's different :)
    The top of the stack is the top and the bottom is the bottom.
    TF5> 12 34 56 ---  ok                                                                                           
    TF5> .S ---  Data Stack (3)                                                                                     
    $0000.0038 - 56                                                                                                 
    $0000.0022 - 34                                                                                                 
    $0000.000C - 12
    

    If you are using an ANSI terminal then Tachyon will detect this at reset and switch to ANSI mode for bold and colors.
    Use WORDS for a plain text listing of the dictionary or use WWORDS for a formatted colored listing.

    Unlike other Forth's, whatever you type in interactively is compiled word by word in a temporary area, so you can't backspace to the previous word (hit esc to cancel the whole line), and once you hit the enter key it will execute the compiled code. Because it is compiled it means that you can use all the stuff that you normally would inside a definition such as DO LOOP IF THEN etc. Try this:
    $7F $20 DO I EMIT LOOP
    
    Check the wiki and blogs on my Source Forge page as well as the other links for some more intro stuff.
    Use number prefix to force hex $F000 or binary %1011 otherwise the default is decimal.
  • bob_g4bbybob_g4bby Posts: 401
    edited 2020-11-16 13:35
    Message removed
  • hinvhinv Posts: 1,252
    Compared to anything it's different :)
    The top of the stack is the top and the bottom is the bottom.
    TF5> 12 34 56 ---  ok                                                                                           
    TF5> .S ---  Data Stack (3)                                                                                     
    $0000.0038 - 56                                                                                                 
    $0000.0022 - 34                                                                                                 
    $0000.000C - 12
    

    ...
    $7F $20 DO I EMIT LOOP
    

    What is the stack limitation? I added a DUP and it looked like it reset just after the output
    ...  $7F $20 DO I DUP EMIT LOOP -->  !"#$%&'()*+,-./0123456789:;<
    
      Propeller .:.:--TACHYON--:.:. Forth V5r6 NEON 560190915.1000
      *** MODULES ***  Propeller .:.:--TACHYON--:.:. Forth V5r6 NEON 560190915.1000
    
  • MJBMJB Posts: 1,235
    hinv wrote: »
    Compared to anything it's different :)
    The top of the stack is the top and the bottom is the bottom.
    TF5> 12 34 56 ---  ok                                                                                           
    TF5> .S ---  Data Stack (3)                                                                                     
    $0000.0038 - 56                                                                                                 
    $0000.0022 - 34                                                                                                 
    $0000.000C - 12
    

    ...
    $7F $20 DO I EMIT LOOP
    

    What is the stack limitation? I added a DUP and it looked like it reset just after the output
    ...  $7F $20 DO I DUP EMIT LOOP -->  !"#$%&'()*+,-./0123456789:;<
    
      Propeller .:.:--TACHYON--:.:. Forth V5r6 NEON 560190915.1000
      *** MODULES ***  Propeller .:.:--TACHYON--:.:. Forth V5r6 NEON 560190915.1000
    

    If you are not sure what is going on it is a good idea to do some debugging.
    Make the loop run shorter so you are not overwhelmed.
    Then put some .S print stack in there

    $7F $5 DO I .S DUP .S EMIT .S LOOP

    Then investigate and have fun

    Better than giving you the answer ;-)
  • hinvhinv Posts: 1,252
    So Tachyon only has a 20 element stack?
  • ErNaErNa Posts: 1,738
    edited 2020-11-26 19:32
    As far as I recall Tachyon has different stacks for program, loops, and something else. When you remember the HP45 calculator, the stack depth was only 4 levels, but you could do a lot with those four places. The same is true for Tachyon, I think, 3 to 4 levels can be accessed extremely fast and more space is available to grow the stack, but then the speed will go down as the addressing mechanism is more complicated.
    Anyway it is a good practice to make heavy use of the stack but limit the actual stack depth to the minimum.
    If much stack is needed, the programming style should be revised.
  • @hinv
    While there are limits to all things in life, they are not the same thing as limitations.
    Same too with the stack in that you could fill the largest stack just as easily with a simple loop, yet the Tachyon stack is large enough if you are not trying to fill it. Don't misuse it, just use it and it will be fine.

    From a technical angle though the top of the stack is implemented partly as 4 fixed cog registers since the Prop does not have instructions that efficiently index into cog or hub memory, nor does it have any stack instructions. This allows fast and direct operation to fixed registers without having to calculate the address of each item for every access. As data is pushed onto the stack the 4th register is pushed onto a software stack implemented in cog memory, the same cog memory that must hold working registers and the Tachyon kernel. All kernel operations are limited to these 4 registers which is more than sufficient, plus code should be factored anyway into smaller bite size pieces with minimal and clearly defined stack usage.

    This is the code to push a value onto the data stack.
    PUSHX                   movd    _stkpsh_,stkptr	        ' update push index from pop index
                            add     stkptr,#1             ' update pop index
    _stkpsh_                mov     datastk,d            ' save last fixed stack reg - stack grows in cog memory
                            mov     d,c             ' ripple push the cog stack registers (4)
                            mov     c,b
                            mov     b,a
                            mov     a,X              	' replace tos
    			mov	acc,#0
    
    Note that the first three instructions implement a software stack but need self-modifying code to achieve indexing which most CPUs achieve with a single instruction, as does the P2. The next four instructions are a brute force register ripple push and finally I maintain an accumulator that is cleared after every instruction that simplifies a number of operations, and this is a good place to clear it.

    Not having to work out where the data is makes most operation very simple and fast. Have a look at fetching from memory:
    ' @  ( addr -- long ) Fetch a long from hub memory
    FETCH                   rdlong  a,a
                            jmp     unext
    

    But in view of the cost of actually pushing and popping I try to avoid that as much as possible which is why there are a lot of instructions that do not push/pop.
  • MJBMJB Posts: 1,235
    edited 2020-11-27 01:55
    hinv wrote: »
    So Tachyon only has a 20 element stack?

    just open Tachyon.spin and search for STACK

    CON { *** STACK DEFINITIONS etc *** }

    ' Stack sizes
    datsz = 32-4
    retsz = 28

    then search on and you will find interesting comments

    if you want to run the Tachyon interpreter in a second COG you can specify the stack size. I never tried to extend the stack in the main COG.
    EDIT: no stack is fixed - but you have to specify space for the task registers
  • The stack is, 28 levels deep but you can't fill it and still used the console to check it at the same time as all that requires stack space too
  • Only is a subjective word. We are only human after all.
  • MJBMJB Posts: 1,235
    edited 2020-11-27 02:12
    @hinv
    While there are limits to all things in life, they are not the same thing as limitations.
    Same too with the stack in that you could fill the largest stack just as easily with a simple loop, yet the Tachyon stack is large enough if you are not trying to fill it. Don't misuse it, just use it and it will be fine.

    From a technical angle though the top of the stack is implemented partly as 4 fixed cog registers since the Prop does not have instructions that efficiently index into cog or hub memory, nor does it have any stack instructions. This allows fast and direct operation to fixed registers without having to calculate the address of each item for every access. As data is pushed onto the stack the 4th register is pushed onto a software stack implemented in cog memory, the same cog memory that must hold working registers and the Tachyon kernel. All kernel operations are limited to these 4 registers which is more than sufficient, plus code should be factored anyway into smaller bite size pieces with minimal and clearly defined stack usage.

    This is the code to push a value onto the data stack.
    PUSHX                   movd    _stkpsh_,stkptr	        ' update push index from pop index
                            add     stkptr,#1             ' update pop index
    _stkpsh_                mov     datastk,d            ' save last fixed stack reg - stack grows in cog memory
                            mov     d,c             ' ripple push the cog stack registers (4)
                            mov     c,b
                            mov     b,a
                            mov     a,X              	' replace tos
    			mov	acc,#0
    
    Note that the first three instructions implement a software stack but need self-modifying code to achieve indexing which most CPUs achieve with a single instruction, as does the P2. The next four instructions are a brute force register ripple push and finally I maintain an accumulator that is cleared after every instruction that simplifies a number of operations, and this is a good place to clear it.

    Not having to work out where the data is makes most operation very simple and fast. Have a look at fetching from memory:
    ' @  ( addr -- long ) Fetch a long from hub memory
    FETCH                   rdlong  a,a
                            jmp     unext
    

    But in view of the cost of actually pushing and popping I try to avoid that as much as possible which is why there are a lot of instructions that do not push/pop.

    as so many times before - while I compose my answer message researching and relearning about the Tachyon internals you write an essay :-).

    EDIT: I should sleep now instead of writing wrong things ...
    but here HUB is probably what you wanted to say

    As data is pushed onto the stack the 4th cog register is pushed onto a software stack implemented in cog HUB memory, the same cog HUB memory that must hold working registers for the Tachyon kernel.


    wasn't the datastack in hub in one earlier version of Tachyon ???
  • Each cog had its own memory and there is no delay accessing it so therefore the tachyon stack is implemented in cog memory. When you run another tachyon cog there is therefore no need to allocate some chunk of slow hub ram. To index into cog memory requires the use of self modifying code as in the first three instructions of the PUSHX code.
  • mov datastk,d saves to cog memory but the destination which is coded as datastk is modified to point to the current cog address.
  • @mjb - Yes, V3 saved to hub RAM if the depth went beyond the 4 internal registers. This was ok but made it a pain when other Tachyon cogs were started up as separate stack space had to be allocated in hub RAM. Now the data and return stacks are in cog ram although my special loop/branch stack overflows into hub RAM whereas TAQOZ has plenty of room in LUT ram for all these stacks.
  • ErNa wrote:
    Be the forth with you.

    Don't you mean, "forth the you with be" ? :)

    -Phil
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2020-11-27 09:21
    ErNa wrote:
    Be the forth with you.

    Don't you mean, "forth the you with be" ? :)

    -Phil

    Too verbose for Forth, it's almost Cobol. Now this is more Forth-like:
    Forth you !
    
    where the ! is the store word, so store "Forth" in "you" :)
  • Think of tachyon as the construction set with which you make your own application-specific language. That includes any special data or code types you need, including larger stacks if that be essential. See CREATE ... DOES> in the book 'Starting Forth', maybe after some experience has been gained with forth programming.
  • Also - a 20 element stack might seem tiny, but that has to be re-assessed after writing a few applications. Spreading the application across cogs also reduces the reqt. on any one stack.
Sign In or Register to comment.