Shop OBEX P1 Docs P2 Docs Learn Events
Propeller on-chip develpment — Parallax Forums

Propeller on-chip develpment

hippyhippy Posts: 1,981
edited 2008-04-25 08:54 in Propeller 1
I've finally got a Basic-come-Spin language running which interprets tokens in memory just as the retro home computers did. It supports most Spin statements and syntax except for the control structures, and although there's a way to go yet it's looking good so far ...

Dim myByteVar%(100)
Dim myLongVar(100)
n := 0
p := @myLongVar
While n => 0 and n =< 100
  myByteVar%(n) += ( long[noparse][[/noparse] $7000 + n<<2 ] ++ ) <- ( 1*2)
  If ( n & 1 ) Then
    long[noparse][[/noparse] p + n*4 ] := n
  End If
  Print n,Hex(n,8)
  n++
Wend





The question is ... How to get the code in and edit it ?

Currently I'm thinking of the retro method of each line needing a line number but would be interested in hearing what others think. I suppose it would be possible to create a WYSIWYG full screen editor, but that's a lot of work I don't really want to take on.

What would be a good way to deliver when it's finished ? As a back-end interpreter with a spec as to how the token image should be and what the tokens are and leave it to others to add more than a simple line-numbered editor ?

Comments

  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2008-04-17 01:03
    hippy,

    awesome! Would this code be helpful?

    http://forums.parallax.com/showthread.php?p=714097

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Getting started with the Protoboard? - Propeller Cookbook 1.4
    Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us
    Got an SD card? - PropDOS
    A Living Propeller FAQ - The Propeller Wiki
    (Got the Knowledge? Got a Moment? Add something today!)

  • jazzedjazzed Posts: 11,803
    edited 2008-04-17 01:27
    Nice work Hippy.
    Looks very VB ... line editor on board and a VB like GUI on the desktop and you begin opening a big market.
    All you need after that is Form1 and Windows like GUI widgets [noparse]:)[/noparse] Have you considered plug-ins ?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    jazzed·... about·living in·http://en.wikipedia.org/wiki/Silicon_Valley

    Traffic is slow at times, but Parallax orders·always get here fast 8)
  • RaymanRayman Posts: 14,162
    edited 2008-04-17 01:44
    This is great.· But, I've heard that Parallax is going to implement this in the upcoming Prop2...· I would be afraid that by the time you got this do a finished state, the Prop 2 would be released.· Are you worried about that?
  • JT CookJT Cook Posts: 487
    edited 2008-04-17 02:03
    I don't think I would be too worried about the Propeller 2 since there is no release date, on chip compiling would be spin code and not basic, and I am pretty sure Parallax said the first version would have any software to enable it or use it when they first release it.
  • hippyhippy Posts: 1,981
    edited 2008-04-17 02:25
    @ OBC : That could be just the ticket. Must get a keyboard and SD card hooked up and try PropDOS etc.

    @ Jazzed : No plans for plug-ins, but then I had no plans to do this at all ! It all evolved from modelling how best to implement "++var[noparse][[/noparse]expr]--" etc for a non-Prop compiler upgrade I'm looking at, and ...

    @ Rayman : This is really for fun so in no way meant to challenge the Prop II on-chip IDE, nor FemtoBasic either. I was just planning on getting the core language working from pre-built token images first and adding a simple line-based editor and throwing it into the wild for anyone who finds it useful or is in anyway interested in the way I write my interpreters.

    And if nothing else I can now appreciate the enthusiasm people have for retro systems and implementing the same on the Prop. Not sure what use it will have, but build it and they'll come, or not - I don't really care, the Propeller's so much fun to just play with and try out ideas on. That 'F10 Load to RAM and run' and Video Out are the two best features of the Propeller IMHO.
  • jazzedjazzed Posts: 11,803
    edited 2008-04-17 14:58
    Do you plan to share your source ?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    jazzed·... about·living in·http://en.wikipedia.org/wiki/Silicon_Valley

    Traffic is slow at times, but Parallax orders·always get here fast 8)
  • mparkmpark Posts: 1,305
    edited 2008-04-17 19:52
    Hippy -- Very cool! Are you compiling to Spin bytecodes?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Michael Park

    PS, BTW, and FYI:
    To search the forum, use search.parallax.com (do not use the Search button).
    Check out the Propeller Wiki: propeller.wikispaces.com/
  • hippyhippy Posts: 1,981
    edited 2008-04-18 00:14
    @ jazzed : Yes, MIT license source code will be forthcoming. A sneak preview attached, few comments, code is completely disorganised and incomplete, and I had to strip out variable allocation as it was buggy and easier to start again from the blank canvas.

    Set the CLKFREQ/XINFREQ and TV_PIN connect a TV and watch the little man in the Propller play retro-computing smile.gif

    I want to get the core done, then write the editor part and then I can do more easy debugging by typing in programs rather than editing the tokens at the top of the program. I'm going to add a via PropPlug interface so it can be used with a terminal emulator.

    It's got a bit bloated. I'll split the code into core, file/stream handling, advanced, esoteric sections etc so it's easy to cull bits out to reduce size. It doesn't matter too much as a reference design as code is easier to take out than add, and a small user code area doesn't matter ( there's still ~20KB free at present ).

    @ mpark : No, it's a pure interpreter of the type where each typed word ( eg PRINT, GOTO ) is held as an individual token. More like Basic Stamp PBASIC than Spin.
  • jazzedjazzed Posts: 11,803
    edited 2008-04-18 02:38
    Nice demo [noparse]:)[/noparse] Code is clear as a bell if you ask me sans comments anyway but it might be easier to remember what was done in the more obscure parts next year with a little text [noparse]:)[/noparse] Looks like a break command could be easily added to the core; any plans to support a debugger? I love being able to fix VB bugs on the fly. Having the "core" parser & engine as a separate module so any editor can be used would be excellent. Having editor separate from the engine also frees space for other things. Using a singly linked list would make line editing easier and if you venture far into the woods a data structure representation would make other things like breakpoint tracking and current line execution/setting activity easier. Dynamic line numbering at minimum can be possible if you use a linked list of data structs. I have a C# application that could easily be leveraged for a front-end and core communications/maintenance. PM me if you want a snap-shot or two.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    jazzed·... about·living in·http://en.wikipedia.org/wiki/Silicon_Valley

    Traffic is slow at times, but Parallax orders·always get here fast 8)
  • hippyhippy Posts: 1,981
    edited 2008-04-22 19:07
    Just an update with some clearer source code and a bit more implemented. Still some way to go but it's getting there. There's a lot which could be stripped out for a minimal system.

    No command line yet ( it's a dummy echo loop ) nor code editing. Input can come from keyboard or PropPlug, output to TV plus PropPlug - 19200,N,8,1.
  • hippyhippy Posts: 1,981
    edited 2008-04-25 00:56
    Finally, something worth playing with. Command line, parser and code editor include ( with some buffer overflows if you push it too hard ! ).

    Variable storage is faked so don't expect more than one variable to work. Most Spin expression constructs accepted, byte[noparse]/noparse, word[noparse]/noparse, long[noparse]/noparse, prefix and postfix operators ( except '?' random - use the 'RND' variable for random numbers ), .byte, etc type modifiers plus a few of my own added, variables are long by default, var& is 16-bit, var% is 8-bit.

    Supports 'var+=expr' and so on. Allows Basic or Spin, so "=" is ":=" or "==" as applicable and vice versa, "=<" and "<=" are the same ( No 'var=<=expr' etc supported ). Mutliple 'a:=b:=c' or assignments within expressions not supported ( and likely won't be ).

    Probably still plenty of bugs to hunt down but it's on its way, and user program storage is diminishing by the bucket load ...

     
    AiChip Basic 005 - 6K 118MHz NTSC
    
    >10 myVar = Goto 30 : Goto * myVar
    >20 End
    >30 myVar = $12345678
    >40 Print Hex( myVar )
    >50 Print Hex( myVar.Msw ), Hex( myVar.Lsw )
    >60 Print Hex( myVar.Msw.Msb ), Hex( myVar.Lsw.Msb )
    
    >List
    10 myVar = Goto 30 : Goto * myVar
    20 End
    30 myVar = $12345678
    40 Print Hex ( myVar )
    50 Print Hex ( myVar . Msw ) , Hex ( myVar . Lsw )
    60 Print Hex ( myVar . Msw . Msb ) , Hex ( myVar . Lsw . Msb )
    
    >Run
    12345678
    1234    5678
    12      56
    Finished in Line 60
    
    >myVar.Msw := $ABCD
    
    >Goto 40
    ABCD5678
    ABCD    5678
    AB      56
    Finished in Line 60
    
    >myVar++
    
    >Goto 40
    ABCD5679
    ABCD    5679
    AB      56
    Finished in Line 60
    
    >List Mem
    Base  0000 .. 67FF  26K ( 6398 )
    Hole  6800 .. 67FF  None
    Heap  6800 .. 67FF  None
    Code  6800 .. 6885  134
    Vars  6886 .. 6885  None
    User  6886 .. 6885  None
    Free  6886 .. 7FFF  6010 ( < 6K )
    Stak  8000 .. 7FFF  None
     
    
    



    Edited : version 006 hasn't got the editing bugs ... BUT ... issue a RUN before trying to do any editing or it will crash ...

    Post Edited (hippy) : 4/25/2008 8:50:06 AM GMT
  • hippyhippy Posts: 1,981
    edited 2008-04-25 08:54
    Apologies to those who downloaded the file and found it wasn't as stable as it was claimed to be.

    I thought I'd opened a live file from the PropTool recent files list but it turned out to be a file from my backup directory, so all the edits were lost when I copied what I thought was the latest working version over the actually working backup. Ho hum.

    Anyway, back on track now, with all the edits re-applied. Not finished, but working and definitely more stable ...
Sign In or Register to comment.