PropellerBasic hints, tips & tricks!
Bill Henning
Posts: 6,445
PropellerBasic is coming along nicely, and I thought it would be time for me to start revealing some of its features!
I will be regularly updating this thread as I add features - or make any changes.
This is the "Official PropellerBasic Thread"
Misc Features
- PropellerBasic is incredibly faster than a BasicStamp, significantly faster than Spin, but slower than regular pasm due to using LMM
- PropellerBasic allows writing very large programs.
- Large Memory Model code, supports .binary/.eeprom files up to 512KB in size
- No line numbers
- reasonably high level of compatibility with PBASIC
Output
Large memory model assembly code, with original basic code embedded as comments.
Once assembled with my LAS assembler it produces a .binary or .eeprom file
Supported Data Types
BYTE, WORD, LONG, FLOAT, STRING
Notes:
Initially only declarations of FLOAT and STRING will be possible, however I intend to have them work by the first public preview.
Multi-dimensional arrays will be supported after the first public preview.
NIB is accepted as an alias for BYTE - so old PBASIC code declaring NIB variables will compile
Standard I/O
PRINT, INPUT, INKEY
Requires support from I/O library: AVAILCH, GETCH, PUTCH - will be provided, initially based on FullDuplexSerial
String Functions:
LEN(), STR$(), LEFT$(), RIGHT$(), MID$(), VAL(), HEX$(), "+" operator supported for adding strings
GOTO/GOSUB
label:
GOTO label
GOSUB label
ON N GOTO label1,label2,label3...,labelN
ON N GOSUB label1,label2,label3...,labelN
SUB name(param1,...,param7)
END SUB
FUNC name(param1,...,param7) ' may not be in first preview
RETURN val
END FUNC
CONDITIONALS
IF expr THEN {one valid basic statement}
IF expr THEN
{ELSE}
ENDIF
SELECT expression
CASE value1
basic statement (one or more lines)
CASE value2
basic statement (one or more lines)
OTHER
basic statement (one or more lines)
ENDS
Looping Constructs:
DO
basic statement (one or more lines), conditional can EXIT
LOOP
WHILE expr
basic statement (one or more lines)
WEND
REPEAT
basic statement (one or more lines)
UNTIL expr
FOR var=expr TO expr {STEP expr}
NEXT var
PBASIC COMPATABILITY
Supports variable declarations of the form
label VAR type
label PIN number
label VAR label ' for aliases
Supported PBASIC keywords
HIGH
LOW
INP
OUT
PAUSE
SERIN
SEROUT
DEBUG (with some limitations - mostly formatting - for now)
Many more later, as time allows me to write them, including I2C and SPI.
Memory Access
PEEK, POKE - read/write hub memory a byte at a time
PEEKW, POKEW - read/write hub memory a word at a time
PEEKL, POKEL - read/write hub memory a long at a time
Propeller Specific
COGNEW
COGID
COGSTOP
FUTURE ADDITIONS
SD support for file handling
FAR FUTURE
Running PropellerBasic and LAS natively on the Propeller
***************************************************
$64,000 Question
***************************************************
When do I anticipate doing a public pre-release*?
<<<DRUM ROLL>>>
December 24, 2009
* pre-release will be code size limited and may contain a "drop dead" date as this will be a commercial compiler
** if it is licensed by Parallax for the Propeller IDE, the limitations and "drop dead" date go *POOF*
Your suggestions, comments and questions are welcome, however I may not be able to answer some questions until I know what additional features will make it into the preview release.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com Please use mikronauts _at_ gmail _dot_ com to contact me off-forum, my PM is almost totally full
Morpheusdual Prop SBC w/ 512KB kit $119.95, Mem+2MB memory IO board kit $89.95, both kits $189.95
Propteus and Proteus for Propeller prototyping 6.250MHz custom Crystals run Propellers at 100MHz
Las - Large model assembler for the Propeller Largos - a feature full nano operating system for the Propeller
Post Edited (Bill Henning) : 11/10/2009 7:47:18 PM GMT
I will be regularly updating this thread as I add features - or make any changes.
This is the "Official PropellerBasic Thread"
Misc Features
- PropellerBasic is incredibly faster than a BasicStamp, significantly faster than Spin, but slower than regular pasm due to using LMM
- PropellerBasic allows writing very large programs.
- Large Memory Model code, supports .binary/.eeprom files up to 512KB in size
- No line numbers
- reasonably high level of compatibility with PBASIC
Output
Large memory model assembly code, with original basic code embedded as comments.
Once assembled with my LAS assembler it produces a .binary or .eeprom file
Supported Data Types
BYTE, WORD, LONG, FLOAT, STRING
Notes:
Initially only declarations of FLOAT and STRING will be possible, however I intend to have them work by the first public preview.
Multi-dimensional arrays will be supported after the first public preview.
NIB is accepted as an alias for BYTE - so old PBASIC code declaring NIB variables will compile
Standard I/O
PRINT, INPUT, INKEY
Requires support from I/O library: AVAILCH, GETCH, PUTCH - will be provided, initially based on FullDuplexSerial
String Functions:
LEN(), STR$(), LEFT$(), RIGHT$(), MID$(), VAL(), HEX$(), "+" operator supported for adding strings
GOTO/GOSUB
label:
GOTO label
GOSUB label
ON N GOTO label1,label2,label3...,labelN
ON N GOSUB label1,label2,label3...,labelN
SUB name(param1,...,param7)
END SUB
FUNC name(param1,...,param7) ' may not be in first preview
RETURN val
END FUNC
CONDITIONALS
IF expr THEN {one valid basic statement}
IF expr THEN
{ELSE}
ENDIF
SELECT expression
CASE value1
basic statement (one or more lines)
CASE value2
basic statement (one or more lines)
OTHER
basic statement (one or more lines)
ENDS
Looping Constructs:
DO
basic statement (one or more lines), conditional can EXIT
LOOP
WHILE expr
basic statement (one or more lines)
WEND
REPEAT
basic statement (one or more lines)
UNTIL expr
FOR var=expr TO expr {STEP expr}
NEXT var
PBASIC COMPATABILITY
Supports variable declarations of the form
label VAR type
label PIN number
label VAR label ' for aliases
Supported PBASIC keywords
HIGH
LOW
INP
OUT
PAUSE
SERIN
SEROUT
DEBUG (with some limitations - mostly formatting - for now)
Many more later, as time allows me to write them, including I2C and SPI.
Memory Access
PEEK, POKE - read/write hub memory a byte at a time
PEEKW, POKEW - read/write hub memory a word at a time
PEEKL, POKEL - read/write hub memory a long at a time
Propeller Specific
COGNEW
COGID
COGSTOP
FUTURE ADDITIONS
SD support for file handling
FAR FUTURE
Running PropellerBasic and LAS natively on the Propeller
***************************************************
$64,000 Question
***************************************************
When do I anticipate doing a public pre-release*?
<<<DRUM ROLL>>>
December 24, 2009
* pre-release will be code size limited and may contain a "drop dead" date as this will be a commercial compiler
** if it is licensed by Parallax for the Propeller IDE, the limitations and "drop dead" date go *POOF*
Your suggestions, comments and questions are welcome, however I may not be able to answer some questions until I know what additional features will make it into the preview release.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com Please use mikronauts _at_ gmail _dot_ com to contact me off-forum, my PM is almost totally full
Morpheusdual Prop SBC w/ 512KB kit $119.95, Mem+2MB memory IO board kit $89.95, both kits $189.95
Propteus and Proteus for Propeller prototyping 6.250MHz custom Crystals run Propellers at 100MHz
Las - Large model assembler for the Propeller Largos - a feature full nano operating system for the Propeller
Post Edited (Bill Henning) : 11/10/2009 7:47:18 PM GMT
Comments
I can see I'm going to have to get a move on and brush up the performance of Catalina. How embarassing it would be to have C outperformed by BASIC!
Ross.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Catalina - a FREE C compiler for the Propeller - see Catalina
I would not be surprised if Catalina was a bit faster for some things, and PropellerBasic a bit faster for others.
At a later date, I intend to support two interesting compiler flags:
-om
and
-os
which stand for "Optimize" for {"Speed"|"Memory"}
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com Please use mikronauts _at_ gmail _dot_ com to contact me off-forum, my PM is almost totally full
Morpheusdual Prop SBC w/ 512KB kit $119.95, Mem+2MB memory IO board kit $89.95, both kits $189.95
Propteus and Proteus for Propeller prototyping 6.250MHz custom Crystals run Propellers at 100MHz
Las - Large model assembler for the Propeller Largos - a feature full nano operating system for the Propeller
Some ideas:
If you have Longs, any chance of adding OUTA, INA and DIRA to the language? Ok, they are not strictly Basic, but they are three simple Spin/PASM commands that would translate directly to PASM in your compiler. They would be very handy for bitbanging in Basic. You could perhaps just tweak the syntax to be more like Basic, eg 'DIRA:=mylong' becomes 'DIRA=mylong'
SD card ought to be straightforward (I think I can say that having just spent a week inside PropDos and fsrw). Hopefully you will emerge from coding with more hair than me! SD means you can store and read back little data files:
I think it translates 1:1 line to existing spin code.
What is "PRINT"? I'm in the middle of designing some boards and it is a little more complex to answer than I first thought. Does it print to a VGA? What if you don't have a VGA? Does it print to a serial port back to the propterminal or another terminal? Does it print somewhere else. I'm thinking it doesn't do any harm to send it everywhere - to the VGA screen, to the serial download cable (and on a board I'm working on, to a LCD20x4 display as well. And there is an object already done for that in the library!) Or - do you explicitly turn on and off each option?
Ditto keyboard input. I've got some Z80 boards and I wrote a driver that scans both the serial port and the local keyboard. It accepts input from either, and it is very handy for debugging to be using a terminal program, but also very handy to use a local keyboard once a program is debugged and running.
In the background that could be testing the physical keyboard with the standard spin code and returning "" or a character, and it could also be scanning the download cable for a character.
Or would you seperate the two (given you already have listed SERIN)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.smarthome.viviti.com/build
It sounds very impressive. I can't wait to see it.
Do you have any of the documentation done ? Ha ha ha. No I'm just kidding, it's just that the documentation is always the LAST thing that gets done.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Does that byte of memory hold "A", 65, $41 or %01000001 ?
Yes it does...
·
Thanks [noparse]:)[/noparse]
I am making all the cog special registers accessible by their name, although due to LMM I don't think writing video drivers in basic is going to be feasible on the Propeller. PropII? Maybe.
I don't use ":=" for assignment, I use "=". You are correct on the file handling syntax, I intend to be close to existing Basics.
PRINT, INPUT and DEBUG go to "STDIO" which initially will point at FullDuplexSerial, but there will be a way of redirecting it to other I/O devices by specifying three routines:
GETCH - waits for a char, returns it
AVAILCH - returns 1 if a character is ready, 0 if it is not.
PUTCH - outputs a character
I just have not decided on the syntax for re-mapping I/O yet. One syntax I am considering is:
REDIRECT GETCH my_get_char
REDIRECT AVAILCH my_char_test
REDIRECT PUTCH my_char_out
where my_get_char/my_char_test/my_char_out would have to be defined in PropellerBasic
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com Please use mikronauts _at_ gmail _dot_ com to contact me off-forum, my PM is almost totally full
Morpheusdual Prop SBC w/ 512KB kit $119.95, Mem+2MB memory IO board kit $89.95, both kits $189.95
Propteus and Proteus for Propeller prototyping 6.250MHz custom Crystals run Propellers at 100MHz
Las - Large model assembler for the Propeller Largos - a feature full nano operating system for the Propeller
Post Edited (Bill Henning) : 11/10/2009 3:18:59 AM GMT
I have an outline of the docs, basically just section headers - it is in flux.
Recently I dropped some features I intended to put in, because I want to do an alpha test release this year, and I was not confident I could get them into that release.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com Please use mikronauts _at_ gmail _dot_ com to contact me off-forum, my PM is almost totally full
Morpheusdual Prop SBC w/ 512KB kit $119.95, Mem+2MB memory IO board kit $89.95, both kits $189.95
Propteus and Proteus for Propeller prototyping 6.250MHz custom Crystals run Propellers at 100MHz
Las - Large model assembler for the Propeller Largos - a feature full nano operating system for the Propeller
The STRING type sounds intriguing. Dynamic strings maybe? With automatic garbage collection?
-Phil
Due to time constraints, the initial version will implement strings as statically allocated arrays
buff var string(100) ' declares buff as a string of 100 bytes, 99 usable as strings are null terminated
later I could add something like
buffptr var varstr
I made the compiler infrastructure very flexible [noparse]:)[/noparse]
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com Please use mikronauts _at_ gmail _dot_ com to contact me off-forum, my PM is almost totally full
Morpheusdual Prop SBC w/ 512KB kit $119.95, Mem+2MB memory IO board kit $89.95, both kits $189.95
Propteus and Proteus for Propeller prototyping 6.250MHz custom Crystals run Propellers at 100MHz
Las - Large model assembler for the Propeller Largos - a feature full nano operating system for the Propeller
Isn't SWITCH a C syntax and CASE a basic syntax ??? Very vague memories here so I could be totally wrong.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps: TriBlade,·RamBlade,·SixBlade, website
· Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
· Prop Tools under Development or Completed (Index)
· Emulators: CPUs Z80 etc; Micros Altair etc;· Terminals·VT100 etc; (Index) ZiCog (Z80) , MoCog (6809)
· Search the Propeller forums·(uses advanced Google search)
My cruising website is: ·www.bluemagic.biz·· MultiBladeProp is: www.bluemagic.biz/cluso.htm
humanoido
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
humanoido
*Stamp SEED Supercomputer *Basic Stamp Supercomputer *TriCore Stamp Supercomputer
*Minuscule Stamp Supercomputer *Three Dimensional Computer *Penguin with 12 Brains
*Penguin Tech *StampOne News! *Penguin Robot Society
*Handbook of BASIC Stamp Supercomputing
SELECT is the basic equivalent, and MS uses CASE.... however I did not like MS's "ELSE CASE", I think "OTHERWISE" is clearer.
I almost used "SWITCH" - but decided its better to stick to what Basic programmers expect.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com Please use mikronauts _at_ gmail _dot_ com to contact me off-forum, my PM is almost totally full
Morpheusdual Prop SBC w/ 512KB kit $119.95, Mem+2MB memory IO board kit $89.95, both kits $189.95
Propteus and Proteus for Propeller prototyping 6.250MHz custom Crystals run Propellers at 100MHz
Las - Large model assembler for the Propeller Largos - a feature full nano operating system for the Propeller
I'll figure out the exact limits later.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com Please use mikronauts _at_ gmail _dot_ com to contact me off-forum, my PM is almost totally full
Morpheusdual Prop SBC w/ 512KB kit $119.95, Mem+2MB memory IO board kit $89.95, both kits $189.95
Propteus and Proteus for Propeller prototyping 6.250MHz custom Crystals run Propellers at 100MHz
Las - Large model assembler for the Propeller Largos - a feature full nano operating system for the Propeller
and to me seems clearer CASE ELSE than OTHERWISE. It is also more similar to IF THEN ·ELSE· END IF ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
· Propeller Object Exchange (last Publications / Updates);·· Vaati's custom search
I may allow it as an alternate syntax.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com Please use mikronauts _at_ gmail _dot_ com to contact me off-forum, my PM is almost totally full
Morpheusdual Prop SBC w/ 512KB kit $119.95, Mem+2MB memory IO board kit $89.95, both kits $189.95
Propteus and Proteus for Propeller prototyping 6.250MHz custom Crystals run Propellers at 100MHz
Las - Large model assembler for the Propeller Largos - a feature full nano operating system for the Propeller
I don't want to use "ELSE" as it may cause confusion for new programmers.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com Please use mikronauts _at_ gmail _dot_ com to contact me off-forum, my PM is almost totally full
Morpheusdual Prop SBC w/ 512KB kit $119.95, Mem+2MB memory IO board kit $89.95, both kits $189.95
Propteus and Proteus for Propeller prototyping 6.250MHz custom Crystals run Propellers at 100MHz
Las - Large model assembler for the Propeller Largos - a feature full nano operating system for the Propeller
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
· Propeller Object Exchange (last Publications / Updates);·· Vaati's custom search
I'll check out VStudio when I have a bit of time.
Due to the way I wrote the parser, it is quite easy for me to support multiple syntaxes, so I may just support both
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com Please use mikronauts _at_ gmail _dot_ com to contact me off-forum, my PM is almost totally full
Morpheusdual Prop SBC w/ 512KB kit $119.95, Mem+2MB memory IO board kit $89.95, both kits $189.95
Propteus and Proteus for Propeller prototyping 6.250MHz custom Crystals run Propellers at 100MHz
Las - Large model assembler for the Propeller Largos - a feature full nano operating system for the Propeller
(when running on a Morpheus)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com Please use mikronauts _at_ gmail _dot_ com to contact me off-forum, my PM is almost totally full
Morpheusdual Prop SBC w/ 512KB kit $119.95, Mem+2MB memory IO board kit $89.95, both kits $189.95
Propteus and Proteus for Propeller prototyping 6.250MHz custom Crystals run Propellers at 100MHz
Las - Large model assembler for the Propeller Largos - a feature full nano operating system for the Propeller
PropellerBasic currently uses 6MB of ram under Windows XP while compiling. All those hash tables, stacks and arrays sure chew up memory!
I can always "trim the fat" if needed after it is complete & debugged. It's going pretty well, I am on-track for a preview release on Dec.24/09.
I am adding constant folding and some code optimization to the expression compilation code.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com Please use mikronauts _at_ gmail _dot_ com to contact me off-forum, my PM is almost totally full
Morpheusdual Prop SBC w/ 512KB kit $119.95, Mem+2MB memory IO board kit $89.95, both kits $189.95
Propteus and Proteus for Propeller prototyping 6.250MHz custom Crystals run Propellers at 100MHz
Las - Large model assembler for the Propeller Largos - a feature full nano operating system for the Propeller
PropellerBasic Status:
Genarates correct LMM assembly code:
- variable declarations (byte, word, long, float, string)
- PIN and CON declarations
- labels
- GOTO
- GOSUB
- RETURN
- HIGH
- LOW
- complex expressions
- All the keywords from my thread now parsing
- compiler is designed so it is easy to add new keywords
- special registers (ina/outa/dira et al) now valid for use in expressions
Currently working on:
- Generating good LMM code from complex expressions, as this is needed for pretty much all the keywords
Next up:
- IF/THEN/ELSE/ELSIF/ENDIF
- SELECT/CASE/OTHERWISE/ENDS
... rest of keywords ...
Still on-track for Dec.24 preview
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com Please use mikronauts _at_ gmail _dot_ com to contact me off-forum, my PM is almost totally full
Morpheusdual Prop SBC w/ 512KB kit $119.95, Mem+2MB memory IO board kit $89.95, both kits $189.95
Propteus and Proteus for Propeller prototyping 6.250MHz custom Crystals run Propellers at 100MHz
Las - Large model assembler for the Propeller Largos - a feature full nano operating system for the Propeller
Post Edited (Bill Henning) : 11/19/2009 6:45:01 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com Please use mikronauts _at_ gmail _dot_ com to contact me off-forum, my PM is almost totally full
Morpheusdual Prop SBC w/ 512KB kit $119.95, Mem+2MB memory IO board kit $89.95, both kits $189.95
Propteus and Proteus for Propeller prototyping 6.250MHz custom Crystals run Propellers at 100MHz
Las - Large model assembler for the Propeller Largos - a feature full nano operating system for the Propeller
My apologies, I cannot release a preview yet, I did not get as far as I thought I would by Dec.24.
Life intruded... between family, shopping for xmas, and working on (near) future hardware products, I did not as much done on PropellerBasic as I'd hoped.
Generating good non-stack oriented LMM code for complex expressions takes a lot of code.
I will release a preview as soon as I have it compiling a reasonable subset of the PropellerBasic features I listed above.
The good news is that my register coloring algorithm works, and it is generating pretty nice code (for the operators that are implemented at this time).
After the preview, I will add a peep-hole optimizer and preliminary FCACHE support, then later, XLMM support for HUGE programs.
Marry Christmas & Happy New Year to everyone...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com Please use mikronauts _at_ gmail _dot_ com to contact me off-forum, my PM is almost totally full
Morpheusdual Prop SBC w/ 512KB kit $119.95, Mem+2MB memory IO board kit $89.95, both kits $189.95
Propteus and Proteus for Propeller prototyping 6.250MHz custom Crystals run Propellers at 100MHz
Las - Large model assembler for the Propeller Largos - a feature full nano operating system for the Propeller
As I understand it there are two basic threads going in parallel.
Some musings re Basic on the Prop that apply I think equally here and on Bean's thread.
I've been coding recently in MBASIC and SBASIC on CP/M running on a Propeller. I think one of the great things about Basic is the ability to take complex tasks and make them easy to use.
Consider (in a hybrid of mbasic and sbasic)
so, i="" simply sets a string as being null
Next, i=inkey
That reads a character from the keyboard. If there is no character present then it keeps looping until there is. One line of code.
Behind the scenes, on the Z80 emulation, that is sending an OUT instruction, which is being trapped by spin and which is running the standard Prop keyboard object which is running in its own cog.
But - the user doesn't have to worry about initialising the pins, or starting the cog, or loading the driver, or worrying about which port it uses. All of that is done in the background, and it ends up just being one line of code.
I wonder if similar simplification is possible using Basic on the prop? Eg, when you run some code that is asking for keyboard input (input, inkey etc) then the apprpropriate drivers are loaded and cogs started etc.
Ditto
PRINT "Hello"
It seems such a simple line of code, but it implies there is actually somewhere to send "Hello". Do you send it to a serial port (implying there is a terminal program running somewhere) or a vga display or a TV display or a local LCD display, or all of these?
In the CP/M emulation, CP/M handles where the output goes, and then Spin and PASM do the work behind the scenes. Again, as soon as you run PRINT, it implies you are setting up the pins for (say) a vga display, starting a cog, running it etc.
And we can look at files in a similar way. I've now got fsrw down as simple as it can be - open a file, read or write n bytes, close the file. Those spin commands get a real workout. This could easily be ported to Basic commands that pass straight through to fsrw.
eg, as soon as Basic finds an Open command, it sets up the port pins, starts a cog, loads in fsrw etc.
The great thing is that all the code already exists for:
Keyboard
Displays
Serial ports
SD card access
Large ram access
And from the point of view of writing a compiler, it is a matter of looking for keywords that just paste in blocks of code that already are around.
Just some random thoughts from someone who has been close to this "behind the scenes" code for the last month. I hope I'm making some sort of sense!
And looking forward to the code.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.smarthome.viviti.com/propeller
Post Edited (Dr_Acula) : 12/24/2009 12:40:28 AM GMT
Take two Aspirin's and call me in the morning.
AMA take note - I was just KIDDING!
I agree with you about simplicity - and there WILL be a way with PropellerBasic to bind the standard input and standard output to different devices, such that sometimes INKEY and PRINT will refer to a serial port, and sometimes to TV/KB or VGA/KB. I have not decided on the exact syntax yet, however I am leaning towards one of the following:
OPTION INPUT SERIAL|KB
OPTION OUTPUT SERIAL|TV|VGA
-or-
OPEN #0 AS <devicename> FOR INPUT
OPEN #0 AS <devicename> FOR OUTPUT
-or-
OPTION CONSOLE SERIAL | TV | VGA
ofcourse under Largos (at a later date) Largos will provide the console redirection.
Best Regards,
Bill
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com Please use mikronauts _at_ gmail _dot_ com to contact me off-forum, my PM is almost totally full
Morpheusdual Prop SBC w/ 512KB kit $119.95, Mem+2MB memory IO board kit $89.95, both kits $189.95
Propteus and Proteus for Propeller prototyping 6.250MHz custom Crystals run Propellers at 100MHz
Las - Large model assembler for the Propeller Largos - a feature full nano operating system for the Propeller
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com Please use mikronauts _at_ gmail _dot_ com to contact me off-forum, my PM is almost totally full
Morpheusdual Prop SBC w/ 512KB kit $119.95, Mem+2MB memory IO board kit $89.95, both kits $189.95
Propteus and Proteus for Propeller prototyping 6.250MHz custom Crystals run Propellers at 100MHz
Las - Large model assembler for the Propeller Largos - a feature full nano operating system for the Propeller