Re: 86 Basic to ASM


[Prev][Next][Index][Thread]

Re: 86 Basic to ASM



Jeff Tyrrill (Jeff_Tyrrill@MSN.COM) wrote:
: It seems that if you just made a p-code generator, it wouldn't help the
speed,
: and the size difference would be offset by the p-code interpreter on the
: calculator. Also, whatever compiling/interpreting method you use, you would
: have to be able to make calls to the built-in interpreter to execute TI-BASIC
: code generated during runtime (such as a mathematical expression entered at
an
: INPUT command).

A p-code interpreter actually would speed things up since it's pre-interpreted.
But it's not as fast as a compiler.

A more practical approach might be to write a different language for
the calc.  I've been looking into how the Forth interpreters work with
the idea in the back of my mind of writing a Forth intepreter for the
83.  It wouldn't be hard to port this to the 85/86/82, etc since Forth
really does most of it's own stuff.  I don't know that I'll actually do
this.

I don't know if I'll actually do this.  I'm just looking into it right
now and it might turn out to be a bigger job than I really want to do on
the calculator.  However, if someone want's a high level language on the
TI calculators, Forth would sure be a good one to look at.

For those who don't know about Forth, it's a threaded interpreted language,
which is MUCH faster than a normal interpreted language like Basic.  In
fact, if it's very well done, it can be faster than a compile language.
It also produces very small executables.  It's only real problem is that
it's weird.  It's a stack oriented language, much like that on the HP48.
In fact the HP48 RPL was modelled after Forth, although they slowed it down
terribly by making it crash-proof.  Forth is hardly crashproof.

The other disadvantage that people often attribute to Forth is that it's
hard to read the code.  It's sometimes jokingly called a write only language.
Forth experts (I'm not one) say this is not true.  I don't know.

I have played with the language a little and it's pretty impressive,
but not easy to learn.  The compiler I'm using is loaded with features,
and is only 11k in size.  I have another one which has many more features
including a built-in editor and assembler to do inline assembly and is only
18k.  I suspsect that a minimum system for a calculator could be written
in 3-5k.

There are also a lot of Z80 Forth systems available with source code that
could be ported to the TI calc.

Barry


References: