Shop OBEX P1 Docs P2 Docs Learn Events
Basic Stamp user input requested - I am writing a Basic compiler for the Propel — Parallax Forums

Basic Stamp user input requested - I am writing a Basic compiler for the Propel

Bill HenningBill Henning Posts: 6,445
edited 2009-09-04 04:17 in BASIC Stamp
Hello Basic Stamp forum!

I've dusted off my incomplete Basic compiler for the Propeller, and I have resumed working on it. You may think "Great, but why is he posting here?"

It's because I am aiming for a "reasonable" level of compatibility with PBasic in order to give Stamp users a much easier path for migrating to the Propeller.

I don't intend on making it a 100% PBasic clone, and don't want to impose PIC based limitations such as 26 byte variables, GET, PUT, etc. While I have a chunk of the compiler running, I will not be posting any previews until it is in much better shape - and PropellerBasic will be a commercial project, but there will be a trial/limited version available.

I would like to know:

- What you would like to see implemented implemented first
- What is most important to you
- Is full compatibility with W0-W12 / B0-B25 important to you?
- Since the 26 variable limit will be gone, do you need aliasing (multiple names for the same piece of memory)?
- Do you really need the NIBBLE data type?
- Do you really need support for line numbers?
- What would be really useful to you, even if it is not part of PBasic?

and of course

- What do you NOT need?

Basically I want your wish list, ideally prioritized.

At a minimum, I intend to support HIGH/LOW/INPUT,SERIN/SEROUT/PULSEIN/PULSEOUT,DEBUG and DELAY, with more support added based on your feedback.

I expect to have a preview release by the end of the year, and a finished product in the first quarter of 2010.

(In case you have been following my Morpheus product - don't worry, this won't slow down Morpheus drivers significantly, because it just so happens that PropellerBasic will have built-in support for Morpheus's many features... including high resolution graphics!)

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Please use mikronauts _at_ gmail _dot_ com to contact me off-forum, my PM is almost totally full
Morpheus & Mem+dual Prop SBC w/ 512KB kit $119.95, 2MB memory IO board kit $89.95, both kits $189.95
www.mikronauts.com - my site 6.250MHz custom Crystals for running Propellers at 100MHz
Las - Large model assembler for the Propeller Largos - a feature full nano operating system for the Propeller

Comments

  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2009-08-31 05:09
    Hi Bill, the things I immediately thought of already come readily available with the Prop so I'm guessing they should be relatively easy to implement.

    One wish from a lot of Stamp users is the capability to multi task or interupt , having eight cogs perhaps there could be a Basic·instruction(s) permitting this

    Second wish would be faster serial (·I would think thats a given )

    Third wish I really like the DIRA , INA and OUTA which again the Prop supports.

    Jeff T.
  • Bill HenningBill Henning Posts: 6,445
    edited 2009-08-31 14:02
    Hi Unsoundcode,

    I will support some form of multi-tasking pretty much from the beginning.

    The idea of some form of interrupts is interesting, and I will take it under consideration - it is not as simple as it sounds to support it properly.

    Faster serial is a given smile.gif

    While I will be supporting "HIGH/LOW/INPUT" there will be some mechanism to access DIRA, INA and OUTA directly.

    Thanks for the input! I want a LOT of input so I can build a great compiler that is very welcoming to Basic Stamp users.
    Unsoundcode said...
    Hi Bill, the things I immediately thought of already come readily available with the Prop so I'm guessing they should be relatively easy to implement.

    One wish from a lot of Stamp users is the capability to multi task or interupt , having eight cogs perhaps there could be a Basic instruction(s) permitting this

    Second wish would be faster serial ( I would think thats a given )

    Third wish I really like the DIRA , INA and OUTA which again the Prop supports.

    Jeff T.
    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Please use mikronauts _at_ gmail _dot_ com to contact me off-forum, my PM is almost totally full
    Morpheus & Mem+dual Prop SBC w/ 512KB kit $119.95, 2MB memory IO board kit $89.95, both kits $189.95
    www.mikronauts.com - my site 6.250MHz custom Crystals for running Propellers at 100MHz
    Las - Large model assembler for the Propeller Largos - a feature full nano operating system for the Propeller
  • dev/nulldev/null Posts: 381
    edited 2009-08-31 15:53
    Cool project! Here are my 10 cents:
    * SPI is a must-have (SHIFTIN/OUT).
    * I2C would be nice, but few people need it.
    * BUTTON is good for eliminating debounce circuits.
    * FREQOUT to drive piezo or other pseudo-sinewave compatible devices directly (eliminating unstable RC circuits).
    * SELECT CASE is a must.
    * GOSUB is a must (or other method of calling a function/procedure)
    * Aliasing is not necessary
    * Forget line numbers
    * I WANT NIBBLES! smile.gif oh I thought you said NIPPLES. Yes nibbles are important.
    * I agree that you need some sort of mechanism to access pins via arrays like DIRS, INS, OUTS
    * BIT data type is good. Also to access the bits of a word or byte or long is necessary.
    * Would be nice to be able to convert between data types.
    * DO...LOOP or something similar

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Don't worry. Be happy
  • SRLMSRLM Posts: 5,045
    edited 2009-08-31 16:26
    An internal clock would be useful. Often BS2 users are disappointed that they need a RTC chip to keep time. I know that you could count the system clock, but what about a clock already in HH:MM:SS.SSS? Perhaps it could default to since startup, and be changeable to real time.
    Personally, I like aliasing even when variable space isn't limited. It helps to alias temp variables for the different methods that use them.
    Also, some tone generating commands would be good (like freqout) but with multiple harmonics and such.
    I'm not sure if this conforms to spec, but local variables are always appreciated.
    The DEBUG command is very useful. I think it should be kept (even if it's just another name for SEROUT/SERIN).
    Quite a few trivial BS2 programs use the psuedo random RANDOM. That would be good to keep too, especially if you could choose between true and psuedo.
    Trig functions are good too (sin, cos, tan, arcsin, arc cos, arctan). Log functions are helpful to, but not as important.
    Multidimensional arrays are a must.
    Floating point support would be a nice upgrade from the BS2.
  • phil kennyphil kenny Posts: 233
    edited 2009-08-31 21:18
    I2C, One-wire and RCTIME support.

    phil
  • xanatosxanatos Posts: 1,120
    edited 2009-08-31 22:06
    Goto, gosub...
  • dev/nulldev/null Posts: 381
    edited 2009-08-31 22:42
    If you make function calls with parameters and return values, I'll buy your software and take a double backward summersault.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Don't worry. Be happy
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2009-09-01 00:07
    Here is a case in point

    I post a question on the Propeller Forum about how to count



    count = count + 1



    ·Used in Pbasic I try to find an example of how you do this in Spin and could not find one

    What I am getting at is to have more example of the common used routine that you would·use in Pbasic This would help a lot

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ··Thanks for any·idea.gif·that you may have and all of your time finding them smile.gif

    ·
    ·
    ·
    ·
    Sam
  • $WMc%$WMc% Posts: 1,884
    edited 2009-09-01 01:53
    Bill Henning

    Besides the usual, "IF THEN ELSE ELSEIF ENDIF,FOR NEXT,DO LOOP UNTIL,WHILE WEND INSTAT,GOTO, GOSUB RETURN", ETC..
    And since the Propeller can support a keyboard and VGA monitor, I see the need for more code on the keyboard/screen side of things. Here's a couple of examples.

    INKEY$ CHR$ SCREEN LEN DIM DEFINT PSET PRESET PRINT PAINT POKE CLS. This is mostly keyboard/VGA related.

    Interrupts would be nice. But I think I have posted enough to make you bail out of this project already. LOL


    Maybe between you and Bean, I can get that Prop/Basic compiler I wanted!!!.....Theres nothing like competition to get things moving.


    ___________$WMc%_________

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Truth is out there············································ BoogerWoods, FL. USA
  • denodeno Posts: 242
    edited 2009-09-01 12:05
    I would personally start using the Propeller if:· Coding was in some form of PBASIC.· I like the idea of ending IF statements with ENDIF and SELECT statements with END SELECT.·The idea of indenting or skipping a line to take the place of the above is·really confusing to me and I do alot of indenting to make my code readable.·I really like the BS2sx and the different programming slots, as my devices usually require alot of programming room, when using an LCD.· So, if the Propeller could be programmed in PBASIC and having the ability of the 8 COGS to multitask would be great.

    I prefer the PBASIC editor window, and programming the different COGS·much in the same manner as·when you program an SX with the different programming slots.

    Just my two cents worth...DeNO

    PS...there is a thread over in the Propeller forum about the same thing...Bean over at Hint consulting is writing or trying to write a Basic compiler for the Propeller.
  • Bill HenningBill Henning Posts: 6,445
    edited 2009-09-01 22:33
    Hi guys,

    Thank you for the great feedback! Please keep it coming...

    In order to save time, I am consolidating my responses to y'all into this post.

    dev/null:

    I expect to support the following fairly early:

    - HIGH/LOW/TOGGLE/INPUT
    - SHIFTIN/SHIFTOUT
    - SERIN/SEROUT
    - FREQOUT
    - SWITCH/CASE/ENDCASE
    - label:
    - GOTO/GOSUB/RETURN
    - FOR/NEXT, DO/LOOP
    - one dimensional arrays of byte/word/long

    There will be some way of converting between data types. Initially I think I will only support 32 bit variables.

    I do not expect to support:

    NIBBLE data type
    BIT data type

    Eventually I will add support for I2C and BUTTON, SUB name/END SUB

    There will be some mechanism to access bits within a variable, maybe nibbles as well.

    SLRM:

    Interesting idea re/ keeping a soft real time clock. Personally I prefer using a PCF8563 or PCF8583, but I will put a soft RTC on the wishlist.

    I may do aliases 'a la' standard assembler - by allowing 'EQU' directives, or alternately I could support C-style "#define" - however in both cases it would be simple text substitution only.

    I plan to support FREQOUT, but harmonics will have to wait for another day. Some version of DEBUG will survive - even if (as you suggest) it is just an alias for SERIN/SEROUT. A pseudo random number generator is a good idea too.

    I will probably implement multi-dimensional arrays next year, but I'd like to keep the code generator fairly simple for now, so they are not likely to make it for launch - same for sin/cos/tan/arcsin/arccos/arctan/log and floating point.

    I am taking all the requests seriously, and I am saving them in a "TODO" list for future features.

    phil kenny:

    RCTIME is likely to make the first release, but I2C and one-wire will probably come later.

    xanatos:

    GOTO/GOSUB/RETURN will be there from the very first release!

    dev/null:

    function calls with parameters are on the wishlist, I don't know if they will get into the first release - however they will be supported in the future.

    sam_sam_sam:

    count := count + 1 ' this is one valid form
    count++ ' another valid way
    ++count ' another valid way
    count += 1 ' yet another way

    The difference: numbers are 32 bits in size, so you won't go to -32768 when you add one to 32767

    I will try to provide a lot of examples [noparse]:)[/noparse]

    $WMc%

    I am not familiar with INSTAT... can you enlighten me?

    The following will be in the first release:

    - IF/THEN/ELSE/ENDIF
    - FOR/NEXT
    - DO/LOOP
    - GOTO/GOSUB/RETURN
    - DIM
    - PRINT (probably an alias for SEROUT initially)
    - INKEY$ (probably an alias for SERIN initially)
    - CHR$()
    - LEN()

    The following may show up in the second release:

    - ELSEIF
    - WHILE/WEND
    - PEEK/POKE

    Graphics commands - but they will be for my Morpheus board:

    - CLS/PLOT/LINE/RECTANGLE/FILLEDRECTANGLE/CIRCLE/FILLEDCIRCLE/PEN/TEXT

    No, you are not making me bail out [noparse]:)[/noparse] I have ambitious plans...

    deno:

    We will be happy to see you in the Propeller forum!

    SWITCH (aka SELECT) will end with a unique terminator, it depends on weather I adopt C-style or M$ style conventions.

    There will be a way to start code running in a different cog, however it will not be like the Stamp's program slots (which I find limited). Most likely, it will take the form of COGNEW(label, stacksize) and COGSTOP(id) - it will require careful programming as hub variables would be shared - I will likely implement LOCKSET and LOCKCLR.

    I know, Bean and I are friendly competitors smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Please use mikronauts _at_ gmail _dot_ com to contact me off-forum, my PM is almost totally full
    Morpheus & Mem+dual Prop SBC w/ 512KB kit $119.95, 2MB memory IO board kit $89.95, both kits $189.95
    www.mikronauts.com - my site 6.250MHz custom Crystals for running Propellers at 100MHz
    Las - Large model assembler for the Propeller Largos - a feature full nano operating system for the Propeller
  • $WMc%$WMc% Posts: 1,884
    edited 2009-09-02 03:39
    Bill Henning

    INSTAT is a keyboard/serial port, input monitor. It is used when an input is needed from the keyboard/serial port from a user to make a decision on program flow.

    y = INSTAT

    EXAMPLE
    ? "waiting for a key..."
    WHILE NOT INSTAT 'see if a key was pressed
    WEND
    ? "You presses "; INKEY$ 'display the key


    The INSTAT statement works well when sending ASCII on a serial port.

    INSTAT is used inside of WHILE and WEND.


    ___________________$WMC%___________

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Truth is out there············································ BoogerWoods, FL. USA
  • skylightskylight Posts: 1,915
    edited 2009-09-02 18:22
    A way of setting up matrix variables, useful for programming games like minesweeper
    Peek and Poke for hitting the metal
    and of course END roll.gif

    Post Edited (skylight) : 9/2/2009 6:52:24 PM GMT
  • Bill HenningBill Henning Posts: 6,445
    edited 2009-09-04 04:17
    $WMc%

    Thank you, that explains INSTAT

    skylight:

    one dimensional arrays will be supported in v1, however multi-dimensional arrays probably will have to wait for v2

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Please use mikronauts _at_ gmail _dot_ com to contact me off-forum, my PM is almost totally full
    Morpheus & Mem+dual Prop SBC w/ 512KB kit $119.95, 2MB memory IO board kit $89.95, both kits $189.95
    www.mikronauts.com - my site 6.250MHz custom Crystals for running Propellers at 100MHz
    Las - Large model assembler for the Propeller Largos - a feature full nano operating system for the Propeller
Sign In or Register to comment.