Jump to content
IGNORED

Why twice interpreted TI BASIC?


Airshack

Recommended Posts

3 hours ago, TheBF said:

I guess that could happen with someone who is not familiar with how VMs work.

Is it correct to say that the TI BASIC interpreter is written in GPL?

Yes TI Basic and XB along with most TI Carts are written in GPL.

Disk Manager, TE2, Diagnostics, Editor Assembler, Mini Memory, P-Code Card, TI LOGO just to name a few.

Link to comment
Share on other sites

3 hours ago, Count9929A said:

Let me give my impression, not knowing anything about GPL or BASIC internals, but knowing something about computer science in general. For me, "interpreter" is a program (written in language A) that reads tokens of a language B and executes them, i.e. modifies the state of the memory according to the intended semantics of language B. From what I read in this thread (and others) I think that this is what happens with TI BASIC, which is executed by an interpreter, written in GPL. 

To me, "BASIC is interpreted by GPL" would not mean that BASIC tokens are translated to GPL tokens. I would have called this hypothetical process "BASIC is compiled into GPL".

 

Therefore if (as I think to have understood here in the forum) GPL instructions are themselves executed by a TMS9900 interpreter, (in the same sense as BASIC is interpreted in GPL) for me to say that BASIC is "doubly interpreted" makes sense: it is obviously a quick (and possibly inaccurate) way of describing the above process

Sorry NO TI Basic itself is written in GPL, but the code TI Basic runs is written in TI Basic Tokenized code thus:

Step 1 the Basic Tokenized code is loaded

Step 2 the Basic Tokenized code is run from GPL

Step 3 GPL that is built into the Console runs the Assembly routines to process the commands in GPL for Basic.

 

I do not know how to explain it more plain then that.

Forth does exactly the same thing in interpreter mode, Forth is called that runs Assembly to function. GPL = Forth in how they work.

Link to comment
Share on other sites

^^ This is what I was essentially typing when Rich's post showed up.

 

TI BASIC commands are tokenized and interpreted by the TI BASIC interpreter program, which is written in GPL.

The TI BASIC interpreter program has GPL instructions (compiled) to do the statements of a TI BASIC program, which the GPL interpreter executes as needed by the TI BASIC program.  

 

Is this accurate?  (feels like it, but want to make sure).  

  • Thanks 1
Link to comment
Share on other sites

"My first three consoles had this GARBAGE COLLECTION bug..."

 

This is not a bug. It is necessary for string handling in BASIC/XB. XB has its own garbage collection written in assembly, and my XB compiler also has a garbage collection routine.

The garbage collection routine is in the console ROM at G51A9. According to Heiner Martin there are no known variants of that GROM.

If you were using XB that could explain why your more recent efforts worked better. Or maybe it was changed for the emulators?

  • Like 2
Link to comment
Share on other sites

15 minutes ago, RXB said:

Sorry NO TI Basic itself is written in GPL, but the code TI Basic runs is written in TI Basic Tokenized code thus:

Step 1 the Basic Tokenized code is loaded

Step 2 the Basic Tokenized code is run from GPL

Step 3 GPL that is built into the Console runs the Assembly routines to process the commands in GPL for Basic.

 

I do not know how to explain it more plain then that.

Forth does exactly the same thing in interpreter mode, Forth is called that runs Assembly to function. GPL = Forth in how they work.

With one very important difference. Forth is written in assembly. This cuts out the GPL middle man that plagues XB, which leads to much higher speeds.

  • Like 1
Link to comment
Share on other sites

Casey:

TI BASIC commands are tokenized and interpreted by the TI BASIC interpreter program, which is written in GPL.

The TI BASIC interpreter program has GPL instructions (compiled) to do the statements of a TI BASIC program, which the GPL interpreter executes as needed by the TI BASIC program.  

Is this accurate?  (feels like it, but want to make sure).  

 

RXB:

Yes Casey you got it!

-------------------------------------------------------------------------------------------------------

Rich, I'm glad to see that you finally have come to admit that XB is double interpreted!

Edited by senior_falcon
  • Like 1
Link to comment
Share on other sites

1 hour ago, senior_falcon said:

With one very important difference. Forth is written in assembly. This cuts out the GPL middle man that plagues XB, which leads to much higher speeds.

Hmm dude GPL is written in Assembly too! Look at TI Intern please.

 

You could write TI Basic in Forth so do you think it would run faster?

Not likely as GPL has many commands that unlike Forth require the order to be such as GPL and Basic and XB commands are similar.

Example: CALL CLEAR is the ALL command in GPL and calls a Assembly OS in console to do it.

A problem would be commands with multiple variables as Forth uses Reverse Polish Notation unlike GPL or Basic or XB.

Link to comment
Share on other sites

1 hour ago, senior_falcon said:

Casey:

TI BASIC commands are tokenized and interpreted by the TI BASIC interpreter program, which is written in GPL.

The TI BASIC interpreter program has GPL instructions (compiled) to do the statements of a TI BASIC program, which the GPL interpreter executes as needed by the TI BASIC program.  

Is this accurate?  (feels like it, but want to make sure).  

 

RXB:

Yes Casey you got it!

-------------------------------------------------------------------------------------------------------

Rich, I'm glad to see that you finally have come to admit that XB is double interpreted!

Pilot, LOGO and many others are also. But no one complains about them as hardly anyone uses them.

I think GPL was a good selling point as look at how much work it takes in Commodore to just load a file.

Thanks to GPL devices work much better and are much more easy to use, straight Assembly can not even agree on much of anything.

Link to comment
Share on other sites

30 minutes ago, RXB said:

Hmm dude GPL is written in Assembly too! Look at TI Intern please.

 

You could write TI Basic in Forth so do you think it would run faster?

Not likely as GPL has many commands that unlike Forth require the order to be such as GPL and Basic and XB commands are similar.

Example: CALL CLEAR is the ALL command in GPL and calls a Assembly OS in console to do it.

A problem would be commands with multiple variables as Forth uses Reverse Polish Notation unlike GPL or Basic or XB.

Why on earth would you write TI BASIC in Forth? That would be silly. I would write it in assembly, If it were written in assembly by a competent coder, it would blow the doors off any GPL based BASIC. That is not an opinion. It is a fact!!

 

Edited by senior_falcon
  • Like 1
  • Haha 1
Link to comment
Share on other sites

16 minutes ago, senior_falcon said:

Why on earth would you write TI BASIC in Forth? That would be silly. I would write it in assembly, and it would blow the doors off any GPL based BASIC. That is not an opinion. It is a fact!!

That's been done once too, although it sees very little use as the code is somewhat quirky/buggy. Myarc Extended BASIC II was written entirely in Assembly, and it is a LOT faster than the TI variants coded mostly in GPL. The problem with it is the need for a Myarc (or modified Foundation) memory card and the bugs/aspirational features that Myarc never fixed. The Geneve's Advanced BASIC is a somewhat distant descendant, fully functional and with all of the missing features implemented. 

  • Like 2
Link to comment
Share on other sites

About the BUG...

 

I'm not certain of when the issue was corrected. My feeling is that TI continued distributing the buggy consoles even after the fix was in. I seem to recall/believe my first V2.2 console, still had the issue.

 

I first noticed it while running MARKET SIMULATION, before I really knew much about programming(I was about 12). The printing to display would freeze for a second or two at random points in the text. This program uses V or HCHAR, to slowly print to specific positions on the display, in a manner similar to DISPLAY AT. At the time I assumed TI chose this way of doing things merely to speed up execution for periods of time by clearing memory at non-symmetrical intervals.

 

This is the only issue that caused untimely BASIC statement execution. Which could seemingly occur randomly at any LINE, defying any programming based solution. I remember thinking ...if only they(TI) had provided a way to force the collection at will, I could have perhaps found a way to exclude the key scans from this horrible penalty.

 

1392617051_garbagecollect1.thumb.JPG.2f3b37c4cc6fd327c554fe3b5e946b5d.JPG1738785834_garbagecollect2.thumb.JPG.b2f0d7556f4265b568dc162232763eea.JPG

 

This is the only explanation I have found to date that well fits the observed behavior.

 

  P.S. My program, referred to previously, was as large as CS1 would accommodate.

  • Like 2
Link to comment
Share on other sites

Based on the date of that code change, the correction would have been present in all 99/4A machines made--although the error might have been found in every 99/4 made. The address places the code in GROM2--and that GROM is different between the /4 (CD2005) and the /4A (CD2157). I seem to have found a useful quick reference in the GROM listing I made a while back. Finding this was a snap. . .

  • Like 2
Link to comment
Share on other sites

1 hour ago, senior_falcon said:

Why on earth would you write TI BASIC in Forth? That would be silly. I would write it in assembly, If it were written in assembly by a competent coder, it would blow the doors off any GPL based BASIC. That is not an opinion. It is a fact!!

 

Did not say to do it just that it would be just like GPL as a result as double interpeted.

I get sick of attacks on GPL constantly like some how they can magically fix the TI99/4A by avoiding it, yet it is BUILT INTO THE CONSOLE to even boot!

And I dare anyone to pull this off, if not then it is just you thinking not fact. I am living in REALITY not some forgone fantasy land.

Link to comment
Share on other sites

1 hour ago, Ksarul said:

That's been done once too, although it sees very little use as the code is somewhat quirky/buggy. Myarc Extended BASIC II was written entirely in Assembly, and it is a LOT faster than the TI variants coded mostly in GPL. The problem with it is the need for a Myarc (or modified Foundation) memory card and the bugs/aspirational features that Myarc never fixed. The Geneve's Advanced BASIC is a somewhat distant descendant, fully functional and with all of the missing features implemented. 

Myarc XB 2 was not very backward compatible with normal Basic or XB either, yes it was way faster, but way buggy and way to many strange quirks.

 

If people help me convert XB to Assembly that I am presently working on I can make sure bugs are at a minimum as I have been using XB / GPL for over 30 years.

It is going to take a long time for me to do it ALONE!

  • Like 1
Link to comment
Share on other sites

On 6/22/2021 at 1:33 PM, OLD CS1 said:

I keep forgetting about that because it does not make any damn sense.  Look at the Amiga, as an example, and you will find 8-bit peripherals on the 16-bit buss with no such encumbrance.  Admittedly, I am not an engineer and I have never designed a full computer system, but I did stay at a Holiday Inn Express last night.

It gets better than that, the VDP /is/ on the 16-bit bus. ;)

  • Like 1
Link to comment
Share on other sites

8 hours ago, mizapf said:

I find this list misleading to some extent. It suggests (to the inexperienced reader) that the BASIC programs (tokens) are translated to GPL, which is not the case. Hence, I usually disagree with a description like "double interpretation".

"Double interpretation" is accurate. Interpretation is not translation, it has specific meaning in computing (or at least it used to. Kids have been changing all the words around lately ;) ). GPL is an interpreted byte code. BASIC is also an interpreted byte code. The BASIC interpreter is written in GPL.

 

Since it's a literal industry term, the understanding of an inexperienced reader isn't really necessary to bring into play. There are lots of computing terms which may be misleading to an inexperienced reader.

 

Not sure why this is a hot point. ;)

 

  • Like 3
Link to comment
Share on other sites

Wrt the Forth comments - it's true there are some similarities. Forth words are converted to values. It's often called compilation but it's actually the same mechanical steps as tokenizing. However, there are two differences to the TI BASIC debate.

 

First, there's only one layer. The Forth tokens are executed directly.

 

Secondly, it's not interpreted. As I understand it, the tokens are literally already the jump addresses of the machine instructions. It's not assembly and it's not interpreted byte code, it really is its own thing.

  • Like 2
Link to comment
Share on other sites

1 hour ago, Tursi said:

Secondly, it's not interpreted. As I understand it, the tokens are literally already the jump addresses of the machine instructions. It's not assembly and it's not interpreted byte code, it really is its own thing.

One could say that "threaded' Forth is still interpreted but since the tokens are addresses the interpreter is very small.

  • If you use literal machine code addresses or direct threading, the interpreter is just two 9900 instructions. This is the same mechanism used by the BASIC compiler and Camel99 DTC.
  • If you use the native sub-routine mechanism of the machine (sub-routine threaded) there is no interpreter but the code is two times bigger since every token is a BL @xxxx
  • For small memory machines indirect threading is best where the tokens are a pointer to machine code. This interpreter is three 9900 instructions. (TI-Forth, FbForth, Turbo Forth Camel99)
  • You can also make byte code Forth where the tokens are the indices of an array that contains either direct addresses or indirect addresses or even addresses that are called with BL. (OpenBoot, Openfirmware)

(I have it on the stack to make a Forth with byte codes because the 9900 has excellent instructions for doing this.)

 

Everything you needed to know but were afraid to ask. :)

  • Like 3
  • Haha 1
Link to comment
Share on other sites

3 hours ago, RXB said:

Did not say to do it just that it would be just like GPL as a result as double interpeted.

I get sick of attacks on GPL constantly like some how they can magically fix the TI99/4A by avoiding it, yet it is BUILT INTO THE CONSOLE to even boot!

And I dare anyone to pull this off, if not then it is just you thinking not fact. I am living in REALITY not some forgone fantasy land.

Yes, I guess it was just a silly fantasy of mine to think that something like The Missing Link could possibly be developed that allows real time full bit mapped graphics in Extended BASIC.

Another foolish dream was thinking that something like XB256 could be programmed so XB could use all 256 characters with another 112 characters for sprites, plus the ability to toggle between two distinct screens.

And I must have really had my head in the clouds to think there was any way to incorporate 40 column text mode and 80 column text mode into XB

Clearly, only someone living in LaLa land could dream up something like XB2.8 G.E.M. which rolls all the above into a super powerful version of XB with many additional enhancements that go far beyond XB 2.7

People complained for years about how slow XB was and dreamed of a compiler that could handle XB. And silly me, I was too dumb to know it couldn't be done, so I just went ahead and did it. And now you can compile an XB program so it runs 25x faster.

 

So yes, I guess it would be accurate to say that I live in some forgone fantasy land.

Drop The Mic GIFs - Find & Share on GIPHY

 

  • Like 3
  • Haha 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...