Can PropBasic call .spin files as Tasks
I download PropBasic and its ultra cool.
I noticed when I wrote a task a .spin file actually got generated which got me thinking.
Is there a way to include Spin files not generated from the PropBasic Tasks? Aka, can I move·AnyonesCool.Spin file into the PropBasic folder and then use it within my PropBasic program?
I noticed when I wrote a task a .spin file actually got generated which got me thinking.
Is there a way to include Spin files not generated from the PropBasic Tasks? Aka, can I move·AnyonesCool.Spin file into the PropBasic folder and then use it within my PropBasic program?
Comments
That said; Bean has given an example of calling other code - look for his "dispatcher". <edit> See http://forums.parallax.com/showthread.php?p=867134 - third post from bottom.</edit>
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheers,
Simon
www.norfolkhelicopterclub.com
Announcement: To cut costs in the current economic climate, we have switched-off the light at the end of the tunnel.
Post Edited (simonl) : 3/12/2010 11:11:37 PM GMT
Here is a demo program showing how to interface spin objects into PropBASIC using a spin dispatcher. If you try this demo, make sure it's NOT in the same directory as the keyboard demo PropBASIC code. The PropBASIC keyboard demo creates a "keyboard.spin" file that is NOT the one we want to this demo. You can see that I used an ASM...ENDASM block to insert the object and dispatcher code. Even though it's not PASM code, the ASM...ENDASM commands don't care they just put whatever is between them into the output file. ' Put in code to run spin dispatcher ASM OBJ Key: "Keyboard" PUB SpinStart CogInit(1, @__Init, @__DATASTART) ' Start PropBASIC program Repeat case spinCmd spinKeyStart: Key.Start(spinP1, spinP2) spinCmd := 0 spinKeyGetKey: spinP1 := Key.GetKey spinCmd := 0 ENDASM If you have any questions about how this works, please let me know. Bean. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - PropBASIC home page www.propbasic.com Post Edited (Bean (Hitt Consulting)) : 12/30/2009 6:41:25 PM GMT File Attachment : dispatcher.pbas 1KB (application/octet-stream) This file has been downloaded 39 time(s).
It may not be the ONLY way, but it is probably the easiest way.
Basically, you keep the spin program alive and wait for requests from PropBASIC. All data exchange is handled with HUB variables in PropBASIC.
PASM code in .spin files can be pretty easily inserted into PropBASIC, but "spin" code cannot and must be called using the dispatch method.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Use BASIC on the Propeller with the speed of assembly language.
PropBASIC thread http://forums.parallax.com/showthread.php?p=867134
March 2010 Nuts and Volts article·http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp5.pdf
·
So, what you are saying I can't call a method I did in spin like this "method.spin".
So, what you are saying I can't call a method I did in spin like this "method.spin" as a TASK.