PropBASIC 00.00.04 Sept 1, 2009 Download it and try it.
Bean
Posts: 8,129
Okay, it is still VERY basic. Only a few commands have been implemented. But members have been bugging me for something ANYTHING to try out.
So here it is. Be sure to read the PropBASIC.txt file. It is just a command line utility for now. You MUST HIT ENTER after it is done compiling for it to end.
If you have any questions please ask.
0.0.04 Sept 1, 2009
· Fixed problem with·9-bit constants used as parameters to subroutines.
· Fixed problem with using PAUSE more than once, cause DUPLICATE VARIABLE error
Bean.
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Does that byte of memory hold "A", 65, $41 or %01000001 ?
Yes it does...
Post Edited (Bean (Hitt Consulting)) : 9/1/2009 3:21:06 PM GMT
So here it is. Be sure to read the PropBASIC.txt file. It is just a command line utility for now. You MUST HIT ENTER after it is done compiling for it to end.
If you have any questions please ask.
0.0.04 Sept 1, 2009
· Fixed problem with·9-bit constants used as parameters to subroutines.
· Fixed problem with using PAUSE more than once, cause DUPLICATE VARIABLE error
Bean.
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Does that byte of memory hold "A", 65, $41 or %01000001 ?
Yes it does...
Post Edited (Bean (Hitt Consulting)) : 9/1/2009 3:21:06 PM GMT
Comments
Post Edited (JonnyMac) : 8/31/2009 5:46:14 PM GMT
The compiler seems to be looking for INVALID.TXT
Oops, Sorry about that Jon. I updated the program. Try it now.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Does that byte of memory hold "A", 65, $41 or %01000001 ?
Yes it does...
Post Edited (Bean (Hitt Consulting)) : 8/31/2009 6:20:57 PM GMT
Yeah it looks like spin will not allow the word "Main" to be used as a label.
I changed it to "Main1" and it worked.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Does that byte of memory hold "A", 65, $41 or %01000001 ?
Yes it does...
·
At the end of the FOR-NEXT loop there is a peculiar line:
Is the "+" supposed to be there? It doesn't seem to hurt, but I've never seen such syntax.
No that "+" is not supposed to be there. I'll remove that. But I'm surprised that it works....
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Does that byte of memory hold "A", 65, $41 or %01000001 ?
Yes it does...
·
I missed NOT from the list of operators.
So I inserted temp = NOT temp
It compiles without error and the line temp = NOT temp
seems to be ignored.
regards peter
Also, the Main issue was caused by the compiler's use of Main; suggest you change that to RunPB or something else that a programmer typically wouldn't use.
Post Edited (JonnyMac) : 8/31/2009 7:48:06 PM GMT
And, you might consider optimizing for short delays that are powers of two. A pause of 8 milliseconds might expand to this:
Post Edited (JonnyMac) : 8/31/2009 9:46:06 PM GMT
With so little room in one cog have you considered callable code blocks instead of straight inline compilation?
Post Edited (JonnyMac) : 8/31/2009 10:17:13 PM GMT
Ken Gracey
Parallax Inc.
For the life of me I could not find a reference to PAUSEUS. I broke out my BS2 books and SX books and did a Parallex site search for the command. I finaley found it in the SX/B help. Boy, you couln't have hidden a command any better.·
I guess it's old hat to you SX guys. This·is to help the BS2 guys that come over to the dark side.
So - you have loops, delays, flashing lights and goto already.
Can't wait for the next installment!
Get it from the top post.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Does that byte of memory hold "A", 65, $41 or %01000001 ?
Yes it does...
·
-Andy
Small error with setting up for PAUSE 500. The compiler outputs:
... it's missing the # for the immediate value.
Post Edited (JonnyMac) : 9/1/2009 2:49:52 AM GMT
The compiler output uses Main but doesn't have to. Here's the original output:
I manually edited to this:
... which works fine, frees 'Main' for programmer use, and saves the beginning (unnecessary?) jmp. I don't think Spin cares about having a Main; it simply runs the first method. Right?
Enter causes it to end however no compiled spin file appears on the
E drive or anywhere. Where is it?
Post Edited (humanoido) : 9/1/2009 7:11:31 AM GMT
You could just as well use __PARAM2 and __PARAM3.
regards peter
instead of PUB Main call it something else.
I'd prefer PUB start and also a PUB stop.
These seem to be the standard names for starting and stopping a cog.
Also, why putting in
· _ClkMode = XTAL1 + PLL16X································
· _XInFreq =·· 5000000······································ 'FREQ 80_000_000
I only have a spinstamp and therefor always need to edit the generated file.
I would like to import the generated file as
OBJ
· pbcog: "test.spin"
in my own program (in which I use main as
the program starting point) and call pbcog.start() from there.
regards peter
This is a cool and ambitious project
I'd love to be able to write a tiny compiler for a controller.
I need a good book about compiler creation.
I would need a "Compiler Construction for Dummies" type of book, not a tome
usable only by CompSci Phd's
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Some mornings I wake up cranky.....but usually I just let him sleep -
plus an edited test.spin to make test.spin a loadable module.
The programs import test.spin
They also declare a long array to be passed to the PropBasic cog.
I think that is the most useful setup. I can write my cogcode in PropBasic
and my mainprogram in spin. Having not to use PASM directly makes
a difference, even if the compiled PASM is not optimized.
The modified test.spin
The protoboard program
regards peter
· I've decided that the __PARAMx variables will be used exclusively for subroutine parameters. So you DON'T need to store them into other variables in the subroutine, because they will never be used by PropBASIC commands.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Does that byte of memory hold "A", 65, $41 or %01000001 ?
Yes it does...
·
· For the spin stamp change "DEVICE P8X32A, XTAL1, PLL16X" to "DEVICE P8X32A, XTAL1, PLL8X". The compiler will then generate the correct _XInFreq for "FREQ 80_000_000".
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Does that byte of memory hold "A", 65, $41 or %01000001 ?
Yes it does...
·
I understand the necessity for FREQ 80_000_000.
That value is used for PAUSE and PAUSEUS.
But why including PLL multiplier and oscillator frequency?
I don't think a cog needs that info.
And I want to set clkmode and inxfreq in my program file,
not in a object that I import in my program file.
BTW, I tried commenting out DEVICE but then
the compiler crashes.
regards peter
Is there still a need for __PARAMCNT since all arguments to·a sub are 32bit values anyway?
regards peter
assumption that all you need is PropBASIC test1.bas /p, but that did not work.
<edit
The program, I think, is supposed to flash the LED, but with a setting of 'delay 500', I did not see anything happen.
When I increased the value to 'delay 1500', then I saw it flash. So, I am not sure as to how the delay values
are supposed to work.
edit>
Ray
Post Edited (Rsadeika) : 9/1/2009 1:34:35 PM GMT