Re: Free Alternative to PicBasic?

D Yuniskis wrote:

Find a copy of the "BASIC 52" interpreter Intel used
decades ago in their masked 8052AH-BASIC part. This
is written in 8052 assembler. You can study how the
interpreter works and then *translate* it to the
processor of your choice.

This gives you exposure to a different class of processor
(8048/52), assembly language (on *two* processors) *and*
a "BASIC" that you can use on your ultimate target AS WELL
AS the knowledge of what's under the hood (so you could
modify it to add features that you might want).

I guess you've won the prize for the most difficult solution for his
problem :-)

I doubt Mike can do it, if he has already problems using C, e.g. installing
MPLAB and using an example from the free HI-TECH C compiler as the base for
his programs and reading the datasheet for calculating the values for the
baud rate registers instead of using some program magic for it. The only
limitation of the HI-TECH C compiler is that the code is not as optimized
as in the commercial version. It's really not that difficult, see e.g. this
simple project:

Or this preview of my latest project, a speed and time measurement device
with 200 us resolution (with a PIC18F252)

The full source code and schematic is attached to the German article, which
are linked in the description of the video. It is one C file with 415
lines, including 50 lines for the 16x16 bitmap font. No libraries are used,
except the standard C libraries for sprintf and floating point handling
(yes, it is slow on the PIC and uses lots of flash, but it is no problem,
as the PIC18F252 has lots of flash and the calculations are outside the

You can't do projects with 200 us resolution with a BASIC interpreter. But
you could do it with a BASIC compiler. But this is more difficult than
writing an interpreter. You could start with writing a parser:

You can write the parser in BASIC, too. It is no problem to write a BASIC
parser in BASIC. But try it with something on and for the PC, e.g. Visual
Basic from .NET inside the free Visual Studio, because it is easier to test
and debug. Then you can try to enhance it to a parser and finally to a

And buy the dragon book, if you want to learn how to write compilers,
because it is the standard book for this kind of stuff and helps you not
reinventing the wheel:

Much better for learning compiler design than reading an assembler
implementation of a BASIC interpreter :-)

Frank Buss,
piano and more: