I heard rumors that TI (or someone) was developing this. Anyone know of it or of one? thanks.
BASIC Compiler for MSP430
Started by ●February 12, 2004
Reply by ●February 12, 20042004-02-12
Here's a clue: OPTION EXPLICIT SUB FOO DIM X AS INTEGER, Y AS INTE Z = CLNG(X) * 2 X = X - 2*Y X = PEEK(1024) POKE 10, 20 IF X = 3 THEN X = X + 1 ELSE X = X - 1 END IF X = MAX(X, Y, Z, 4) END SUB This generates: CODE SECTION CODE 3: SUB FOO .ALIGN BYTE[2] L$1 LOCAL Y @ R10 LOCAL X @ R11 LOCAL Z @ R8 PUSH.W R11 PUSH.W R10 PUSH.W R9 PUSH.W R8 @0 5: Z = CLNG(X) * 2 MOV.W R11, R15 MOV.W R15, R14 XOR.W #-1, R15 ADD.W R15, R15 SUBC.W R15, R15 ADD.W R14, R14 ADDC.W R15, R15 MOV.W R14, R8 MOV.W R15, R9 6: X = X - 2*Y SUB.W R10, R11 SUB.W R10, R11 7: X = PEEK(1024) MOV.B &1024, R15 MOV.W R15, R11 8: POKE 10, 20 MOV.B #20, &10 9: IF X = 3 THEN CMP.W #3, R11 JNZ @1 @2 10: X = X + 1 ADD.W #1, R11 @3 JMP @4 @1 @5 12: X = X - 1 SUB.W #1, R11 @6 @4 14: X = MAX(X, Y, Z, 4) MOV.W R11, R15 MOV.W R10, R14 CALL #_max MOV.W R15, R14 XOR.W #-1, R15 ADD.W R15, R15 SUBC.W R15, R15 MOV.W R9, R13 MOV.W R8, R12 CALL #_lmax MOV.W #4, R12 MOV.W #0, R13 CALL #_lmax MOV.W R14, R11 @7 POP.W R8 POP.W R9 POP.W R10 POP.W R11 RET @8 -- Paul. -----Original Message----- From: solutions4circuits [mailto:solutions4circuits@solu...] Sent: 12 February 2004 04:33 To: msp430@msp4... Subject: [msp430] BASIC Compiler for MSP430 I heard rumors that TI (or someone) was developing this. Anyone know of it or of one? thanks. . Yahoo! Groups Links
Reply by ●February 12, 20042004-02-12
On Thu, 12 Feb 2004 17:50:07 -0000, Paul wrote:
>Here's a clue:
>
>OPTION EXPLICIT
Pretty nifty clue.
Looks like it accepts the VB DOS 1.0 lingo, including the
"OPTION EXPLICIT," which is a "nice to have." Of course,
this
leads to a bevy of other questions, such as BYVAL and UEVENTs,
for example.
Jon
Reply by ●February 12, 20042004-02-12
Hi Jon,
BYVAL and BYREF are supported, but BYVAL is the default not BYREF.
There are no dynamic strings, strings have fixed length and are null
terminated, and the code generator can therefore get by without needing
a heap. I enjoyed writing the routines that encode string operations.
The code generator is the one that's used in our C compiler, hence code
generation is good and you can reuse C libraries in Basic. However, it
has all the looping and structuring concepts derived from those popular
MS products.
I have also written a 32-bit integer Basic in MSP430 assembly code which
I'll be releasing under the GPL when I get the time. The code has
already been distributed to a number of people within TI for them to
have a play with, and a couple of people in this group.
-- Paul.
-----Original Message-----
From: Jonathan Kirwan [mailto:jkirwan@jkir...]
Sent: 12 February 2004 19:18
To: msp430@msp4...
Subject: Re: [msp430] BASIC Compiler for MSP430
On Thu, 12 Feb 2004 17:50:07 -0000, Paul wrote:
>Here's a clue:
>
>OPTION EXPLICIT
Pretty nifty clue.
Looks like it accepts the VB DOS 1.0 lingo, including the
"OPTION EXPLICIT," which is a "nice to have." Of course,
this
leads to a bevy of other questions, such as BYVAL and UEVENTs,
for example.
Jon
.
Yahoo! Groups Links
Reply by ●February 13, 20042004-02-13
On Fri, 13 Feb 2004 01:29:54 -0000, Paul wrote: >BYVAL and BYREF are supported, but BYVAL is the default not BYREF. >There are no dynamic strings, strings have fixed length and are null >terminated, and the code generator can therefore get by without needing >a heap. I enjoyed writing the routines that encode string operations. >The code generator is the one that's used in our C compiler, hence code >generation is good and you can reuse C libraries in Basic. However, it >has all the looping and structuring concepts derived from those popular >MS products. Is "ON LOCAL ERROR" and "ON ERROR" supported? (I gather UEVENTs aren't, as you didn't respond to that one.) For FUNCTIONs, do you support the: DECLARE FUNCTION XYZ (A AS INTEGER) AS INTEGER syntax? Or does it have to be: DECLARE FUNCTION XYZ% (A AS INTEGER) ? >I have also written a 32-bit integer Basic in MSP430 assembly code which >I'll be releasing under the GPL when I get the time. The code has >already been distributed to a number of people within TI for them to >have a play with, and a couple of people in this group. Sounds great! Jon
Reply by ●February 13, 20042004-02-13
Jon, > Is "ON LOCAL ERROR" and "ON ERROR" supported? No. I don't intend to either, I think. > (I gather UEVENTs > aren't, as you didn't respond to that one.) Correct. > For FUNCTIONs, do you support the: > > DECLARE FUNCTION XYZ (A AS INTEGER) AS INTEGER > > syntax? Or does it have to be: > > DECLARE FUNCTION XYZ% (A AS INTEGER) > Both are supported. -- Paul.
Reply by ●February 13, 20042004-02-13
On Fri, 13 Feb 2004 08:42:18 -0000, Paul wrote: >Jon, > >> Is "ON LOCAL ERROR" and "ON ERROR" supported? > >No. I don't intend to either, I think. I was wondering if there were any thoughts about biting off that one. It makes sense to avoid it. (By the way, I've developed two somewhat widely sold commercial systems using VB DOS 1.0 -- one of them with over 15,000 users -- but some time ago, admittedly. Still use the product on occasion for PC-104 style prototyping demonstrations.) >> (I gather UEVENTs >> aren't, as you didn't respond to that one.) > >Correct. > >> For FUNCTIONs, do you support the: >> >> DECLARE FUNCTION XYZ (A AS INTEGER) AS INTEGER >> >> syntax? Or does it have to be: >> >> DECLARE FUNCTION XYZ% (A AS INTEGER) >> > >Both are supported. Glad to hear it. Just as in VB DOS 1.0. Does the compiler report errors when seeing this? DIM A AS INTEGER LET A! = 1 (Assuming FP works.) But not report errors when seeing this? DIM A AS INTEGER LET A% = 1 or, LET A% = 5 LET A! = 1! ?? In other words, does the application of a DIM AS cause the name to be reserved for a single type and bar it's use in multiple types, while the absense of a DIM AS for that name then permit the same name in multiple variable types? Seems to me the simplest thing to do, if you don't "mangle" names using types, is to emit a symbol in the object for the name and prevent the use of that name for other types, no matter what. Which would be somewhat different from VB DOS 1.0's method. So, if I had to guess, you'd use the first encountered appearance in the compilation unit as defining the type, absent a DIM AS declaration before it, and then bar any other type modifier being added. And that you might support an untyped reference to a variable, such as "LET A = 1", only if there was a DIM AS before it (or by assuming a default type in this case.) Also, are you handling COMMON across multiple compilation units? And what about DIM SHARED within one? Or, how can variables or arrays be shared across compilation units, generally? (I'm assuming the declarations for FUNCTIONs and SUBs are compatible with those in C.) Jon
Reply by ●February 18, 20042004-02-18
Paul,
I for one, as a in-training C programmer, would welcome and glady pay
for a Basic Langauage Complier for the MSP430 family.
Thanks
Jay
--- In msp430@msp4..., "Paul Curtis" <plc@r...> wrote:
> Jon,
>
> > Is "ON LOCAL ERROR" and "ON ERROR" supported?
>
> No. I don't intend to either, I think.
>
> > (I gather UEVENTs
> > aren't, as you didn't respond to that one.)
>
> Correct.
>
> > For FUNCTIONs, do you support the:
> >
> > DECLARE FUNCTION XYZ (A AS INTEGER) AS INTEGER
> >
> > syntax? Or does it have to be:
> >
> > DECLARE FUNCTION XYZ% (A AS INTEGER)
> >
>
> Both are supported.
>
> -- Paul.
Reply by ●February 18, 20042004-02-18
Jay, > Paul, > I for one, as a in-training C programmer, would welcome and glady pay > for a Basic Langauage Complier for the MSP430 family. > > Thanks > Jay You might be the only one... ;-) Seriously, the compiler is now pretty stable. The front end needs more work, and if turned into a product, obviously needs documentation. But it will work with all the back ends in development. -- Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk CrossWorks for MSP430, ARM, and (soon) Atmel AVR processors