A Propeller based "Basic Stamp" emulator. Any interest in this ? [CODE UPDATED
Bean
Posts: 8,129
I've been toying around with making a Propeller based basic stamp emulator.
My initial test show that the speed would be about 1,000 instructions per second, compared to a "real" BS2 which runs at about 4,000 instructions per second. This is because the emulator is written in spin. I don't think there would be enough code space to do it in assembly without use LMM. But that would be a MUCH bigger project.
The saving grace is that you can have multiple BS2 programs running in parallel.
Also, it could have a built-in debug terminal with NTSC output and a PS/2 keyboard input. These would communicate with serial to the running BS2 programs. Also it would use the existing Basic Stamp Editor to get the PBasic code into it.
Anyway, I'm just getting started with this, and was wondering if there is any interest in it. Anyone a BS2 user and a Propeller user ?
I've only just begun, but hopefulling in a week or two I'll post some working code.
[noparse][[/noparse]EDIT] I have posted the code so far. It's not much right now, but you can see the basic framework. Any comments or questions are welcomed.
[noparse][[/noparse]EDIT·Apr 3, 2009] Posted updated code that allows the "Basic stamp IDE" to download the program into the propeller.
Bean.
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
There is a fine line between arrogance and confidence. Make sure you don't cross it...
Post Edited (Bean (Hitt Consulting)) : 4/3/2009 6:15:26 PM GMT
My initial test show that the speed would be about 1,000 instructions per second, compared to a "real" BS2 which runs at about 4,000 instructions per second. This is because the emulator is written in spin. I don't think there would be enough code space to do it in assembly without use LMM. But that would be a MUCH bigger project.
The saving grace is that you can have multiple BS2 programs running in parallel.
Also, it could have a built-in debug terminal with NTSC output and a PS/2 keyboard input. These would communicate with serial to the running BS2 programs. Also it would use the existing Basic Stamp Editor to get the PBasic code into it.
Anyway, I'm just getting started with this, and was wondering if there is any interest in it. Anyone a BS2 user and a Propeller user ?
I've only just begun, but hopefulling in a week or two I'll post some working code.
[noparse][[/noparse]EDIT] I have posted the code so far. It's not much right now, but you can see the basic framework. Any comments or questions are welcomed.
[noparse][[/noparse]EDIT·Apr 3, 2009] Posted updated code that allows the "Basic stamp IDE" to download the program into the propeller.
Bean.
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
There is a fine line between arrogance and confidence. Make sure you don't cross it...
Post Edited (Bean (Hitt Consulting)) : 4/3/2009 6:15:26 PM GMT
spin
21K
Comments
Did you see the webinar (Chips section) - its 128MB and over an hour. Anyway, one of the guys asking questions said his students were playing with the propeller because it was easier. Another asked if Parallax were going to produce a xxxx version like one of the BS boards. To me, it seemed like a lot of young students are starting to progress to the propeller. Therefore, I think it would be a good transition for the students who already know the BS.
Just my thoughts.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps: TriBladeProp, SixBladeProp, website (Multiple propeller pcbs)
· Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
· Prop Tools under Development or Completed (Index)
· Emulators: Micros eg Altair, and Terminals eg VT100 (Index)
· Search the Propeller forums (via Google)
My cruising website is: ·www.bluemagic.biz·· MultiBladeProp is: www.bluemagic.biz/cluso.htm
(I just couldn't swallow the price when I started with the Propeller.)
but it does look like a perfect way to build a bridge for BS users into the Propeller.
I'm a little worried that we drag too many BS users over and Parallax may have to
find another way to stay in business. (Like release of PropellerII)
Based on price, there's a lot more profit in the STAMP than in the Propeller. I'm sure of it. [noparse]:)[/noparse]
But that's another topic. [noparse]:)[/noparse]
OBC
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
New to the Propeller?
Visit the: The Propeller Pages @ Warranty Void.
This is just a personal opinion, but I believe the best use of one's time developing for the Propeller (with the maximum commercial advantage both to oneself and to Parallax) are forward-looking projects that take advantage of its unique capabilities, rather than backwards-compatible emulators.
-Phil
Post Edited (Phil Pilgrim (PhiPi)) : 3/23/2009 3:43:04 PM GMT
If you include a debugger that allows you to display the variable space and I/O registers, it might be an excellent tool for people to debug programs and to learn about the Stamps despite the speed hit. As is often the case with large complex programs, you may find that a small part of it can be translated into assembly with a major impact on speed. For emulators, usually this is the fetch / decode loop and some of the simpler operations (like basic arithmetic).
I have used a BS2 and frankly Ill never return - sure it was great, but once I sat down, took the time, asked several question - basically a true effort to learn Spin. I was blow away at its simplicity.
I think that it would be a waste of time Bean. Just my opinion though. Teach SPIN~~
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Visit my site -> [url=Http://www.rawcircuits.com]www.rawcircuits.com[/url]
I guess I agree about the performance issue. The BS2 tokenize program is really complex. It is geared towards saving every bit of program space. And running programs SLOWER than a BS2 could leave a bad taste in the mouth.
I think to get to at least the performace of the BS2 I'd have to do as Mike has suggested. Use assembly for the fetch/decode loop. Maybe even convert the tokens to a simpler representation (taking more memory, but simpler to decode).
The main reason for this is that there is SO much documentation for the basic stamps. If users could use these programs on the propeller it would open up a new world to them. Without having to convert everything to spin (which is sometimes not a big deal...and sometimes it is difficult).
I am just in the beginnings of working on this project. So I'm open to just about any suggestions. Keep them coming...
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
There is a fine line between arrogance and confidence. Make sure you don't cross it...
·
It sounds like a fantastic project for all those who develop projects
on the Basic Stamp platform, myself included. I don't really care
about what's under the hood in this project or how you accomplish
it, as I would be happy to use the final product. In every respect,
the final product would be a leap of technology.
Some advanced guru's may disagree, as they have rightfully put in
their time and evolved far beyond the level of my humble laboratory
loft. But I truly believe those people at hobbyist and introductory
education levels can vastly benefit from your efforts.
The aspect of outputting to NTSC, having the option for multiple BS2
programs running in parallel, and the ability to do a 1,000 IPS,
is absolutely incredible. It would be a literal boon, Bean, to develop
apps on your simulator! I encourage you to continue and look forward
to the release of your impending project!
humanoido
a) Perhaps a pair of #spin ... #endspin commands could be helpful, like #asm ... #endasm in C. This could let the user start converting to SPIN for speed, or to BSx for learning.
b) If there isn't one already, perhaps a BSx -> SPIN tutorial could be written. I'm still at the programming-with-manual-in-hand stage for both languages, or I might volunteer.
c) Could "What is a Microcontroller?" be re-written for the Propeller?
--Rich
humanoido
So I can see why so many initially use the Stamp processor . I keep flip flopping between the two gradually getting more confident with the Propeller·, I would like to see some kind of bridge ,·perhaps not for myself but for others . But hey to use the emulator you have to buy a Prop right!!
The speed is not the issue introducing more to the Propeller is the key , I liked the idea of the #spin directive and the emulator is not an unreasonable idea.
Jeff T.
ps. I am imagining the product could be called BS2-prop-emu, thus your product logo could be an Emu with a prop beanie.....
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Andrew Williams
WBA Consulting
IT / Web / PCB / Audio
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps: TriBladeProp, SixBladeProp, website (Multiple propeller pcbs)
· Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
· Prop Tools under Development or Completed (Index)
· Emulators: Micros eg Altair, and Terminals eg VT100 (Index)
· Search the Propeller forums (via Google)
My cruising website is: ·www.bluemagic.biz·· MultiBladeProp is: www.bluemagic.biz/cluso.htm
This should get me up to at least the speed of a "real" BS2.
Only downside, is that now I need 2 cogs to run the program. One running the spin and one running the assembly. So maybe only be able to have 2 or 3 parallel programs running. I figure I'll need one cog to handle the downloading of programs and such. Plus one for the debugger.
I'll be ready to post some code after I get the assembly working. It's hard for me to swtich between the SX and Propeller because the assembly is SO different. So I'm just getting my head around Propeller assembly again.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
There is a fine line between arrogance and confidence. Make sure you don't cross it...
·
I got the assembly working. With this simple BS2 program.
' {$STAMP BS2}
' {$PBASIC 2.5}
Start:
HIGH 15
LOW 15
GOTO Start
I got a frequency of 1825 Hz. There are three instruction in the loop so that works out to 5475 instructions per second. I will have to find my BS2 as see what frequency it gives.
If anyone has a BS2 and a frequency counter handy, could you see what the real BS2 gives ?
I'm making progress... Stay tuned...
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
There is a fine line between arrogance and confidence. Make sure you don't cross it...
·
what about focusing on the PC:
- you can have a PC side program that has a virtual serial port. With the basic stamp editor you can connect to this serial port. The PC program will translate the BS2 code to spin/pasm/lmm an upload the propeller (eg. with propellent, brad's compliler or homespun compiler).
- once the BS2 code has been converted and transferred to propeller, you can have a cog connected to that program acting as debugger and all other cogs free (to run converted BS2 code - 6/7 stamps running parallel at prop native speed). In this situation the PC app will collect the data from prop and emulate BS2 debugger passing to StampEditor-DebugTerminal the data through the virtual serial port
- all this can happen transparently for the BS2 user, just a small app/task more on the PC running in background
Data per request..
BS2: 1778 Hz
BS2pe: 1841 Hz
BS2p: 4608 Hz
BS2px: 6655 Hz
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Start:
Toggle PIN
Goto Start
Or whatever that is in real BS2 parlance ( I've never used one ).
You might also think about the Spin Stamp with its compatible size and pinout to the Stamps. It's not a "drop in" replacement because of the different logic levels (3.3V vs. 5V), but that would be one way to provide your emulator.
I thought Parallax already started something like this for the Spin Stamp? If so maybe they could share their work on what they have completed.
·
It's not really useful until I get it to the point where you can upload programs from the Basic Stamp editor. And I have quite a ways before I get to that point. Also I have to make sure Parallax doesn't have a problem with me posting code that basically "exposes" the BS2 IP.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
There is a fine line between arrogance and confidence. Make sure you don't cross it...
·
I will continue to update and put the "latest and greatest" version in the first post.
Comment and questions are welcomed.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
There is a fine line between arrogance and confidence. Make sure you don't cross it...
·
I am very much interested in your BS2 emulator. In your first post
Will the spin program you posted do that now?
Thanks,
MikeS
Post Edited (MikeS) : 3/28/2009 10:47:24 PM GMT
No, not yet.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
There is a fine line between arrogance and confidence. Make sure you don't cross it...
·
I moved to propeller because of the power and the possibilities offered, but when starting for scratch, or when testing a feature or a peripheral I still find Basic Stamp easier.
The idea of having multiple stamps in a single propeller is even more intriguing..
Massimo
The propeller emulates a stock BS2. When the propeller is started it waits to recieve a program from the "Basic Stamp IDE", then it runs that program.
To download a new PBASIC program, you need to reset the propeller.
NOTE: Only a limited number of the PBASIC commands are implemented so far. This is a work in progress...
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
There is a fine line between arrogance and confidence. Make sure you don't cross it...
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Gadget Gangster - Share your Electronic Projects - Sign up as a Designer and get a free 4-pack of Project Boards!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Stop it - you're making my head SPIN!
Whaddya say we take this lil' chip for a SPIN?