TI-99/4A BASIC as a Scripting Language

It is a good time for statically recompiled versions of BASIC from old computers.  First there was Apple I BASIC.  Then came Commodore BASIC.  Now, due to overwhelming demand, we’re proud to release TI-99/4A BASIC. For those unfamiliar the TI-99/4A was a home computer by Texas Instruments released in 1981. Unusually for the time it had a 16-bit CPU: the TMS9900.

Download the program from the project page on SourceForge. Binaries for Windows and Mac OS X are available and the source should compile on most POSIX-like systems. If you port it to a new platform please drop us a line; we’d love hear about it.

It supports the same interfaces as the previous projects.  You can use it interactively in direct mode:

$ tibasic
TI BASIC READY
>print 4*atn(1)
 3.141592654

>bye

Or you can write a line-numbered program:

$ tibasic
>10 FOR I=1 TO 10
>20 PRINT TAB(I);"Hello, world!"
>30 NEXT I
>RUN
Hello, world!
 Hello, world!
  Hello, world!
   Hello, world!
    Hello, world!
     Hello, world!
      Hello, world!
       Hello, world!
        Hello, world!
         Hello, world!

** DONE **

>BYE

You can also run programs from a file:

$ cat name.bas
10 INPUT "What is your name? ":N$
20 PRINT "Hello, ";N$;"!"

$ tibasic.exe name.bas
What is your name? James
Hello, James!

There are a few sample programs available on the homepage that you can run in this manner.

How it works

This program works much like the already mentioned Commodore BASIC project. The original program is statically recompiled to produce a new native binary. The recompiler is the work of Michael Steil and the  support for the TI-99/4A is by James Abbatiello.

The output of the recompiler is tibasic.c which is platform independent. The support functions are in runtime_functions.c and it is this file that you would edit to port to a new system or to add new features.

There are a couple quirks of the TI-99/4A which made this a bit trickier to support than the C64 version:

  • The BASIC interpreter was not written in assembly language as you might expect. Instead it was programmed in something called Graphics Programming Language (GPL). GPL was much like an assembly language with some high-level primitives for commonly needed functions. A program written in GPL would be assembled to bytecode and then run on an interpreter that was written in TMS9900 assembly language. This made BASIC programs on the machine rather slow. The CPU would execute the GPL interpreter. The GPL interpreter would run the BASIC interpreter. Finally, the BASIC interpreter would run your program. Only the TMS9900 code is statically recompiled in this program. The GPL still runs interpreted just as it did on the original machine. While it would theoretically be possible to statically recompile the GPL code as well this would be significantly more difficult since GPL was never officially documented by TI. The only definitive reference is the original interpreter.
  • C64 BASIC outputs characters to the screen via one function (CHROUT) which was easy to trap. TI-99/4A BASIC outputs to the screen with direct writes to video memory from multiple different places in the code. This requires some ugly hacks to get anything approximating reasonable on stdout.

Limitations

The Cassette, Disk, and Sound devices are not currently emulated. Contributions in these areas are most welcome.

Links

pixelstats trackingpixel

30 Responses to “TI-99/4A BASIC as a Scripting Language”

  1. kerobaros says:

    Oh, my childhood is calling. Thanks, guys.

  2. kassaroo says:

    Now we need Atari Basic as a scripting language.

  3. sgt_burns says:

    you want a TI-99 hack?

    Came up with this when I was young! lol

    You know (with out extended basic) its possible to get sprites to appear?

    That its also possible to crash the computer….

    With a remark statement!

    10 REM

    edit the line when your done (if I remember rite ctrl-u= with programing word ramdomize keep going past the last ramdomize statement (will take a while) and youi’ll reach what you think is the end…. the (trying to remember) hold down either space or enter or the down or right arrows…. and the system will start freaking out! :)

  4. I was able to get this to work well on both my Mac OS X 10.4 PowerMacs, but on neither of my Mac OS X 10.5 Intel-based Macs. Is there something I am doing incorrectly?

  5. The problem with the binary you have is the 64-bit side fails. If you strip the 64-bit target (x86_64) with lipo, leaving only a 32-bit universal binary (PPC & Intel), it works fine.

    I recommend recompiling the binary without the 64-bit portion until you have resolved your bug. Otherwise, most Intel Mac users (who typically have 64-bit ready machines) will not be able to run your app.

  6. ti99_forever says:

    Cool! Windows 7 was made for me! Oh wait, I mean “TI Basic as a scripting language was made for me!”.
    When I first saw the CBM and Apple Basics, I asked for this, and now I have it!
    Wonderful!

  7. Michael Steil says:

    Yes, the 64 bit piece is broken on Mac OS X. If it does not work for you, prepend “arch -arch i386″ to your command line for now.

  8. niku says:

    hello, wonderful site!

    a quote about basic:
    “It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.” ~Edsger Dijkstra
    (source: http://www.cs.virginia.edu/~evans/cs655/readings/ewd498.html )
    (some similar ideas here: http://www.cs.utexas.edu/~EWD/transcriptions/EWD08xx/EWD898.html )

  9. Sadly, there has been no change in this program in the year since its first release. The Mac version continues to crash on Intel 64-bit machines. What started out so promising has atrophied into irrelevance. Very bummed.

  10. FTG says:

    If I’m not mistaken didn’t the BASIC on TI-99/4A have PEEK and POKE omitted so a hobbyist could never run machine code on it? What a howler! Crippling a potentially very impressive home computer (for the time).

    I’ve always thought it must have been a deliberate strategy to make people buy the expensive game cartridge ROMs (that were coded in machine language and often very good, e. g. Parsec). I think the system might have flourished otherwise. Anyone who was at TI in that era shed any light?

  11. MiaM says:

    If I remember correct PEEK were added if you had “extended basic” but still no POKE. Bummer, a perfect way to make sure almost noone writes any good software (especially games) for your machine…

  12. Canada Goose says:

    With the Extended Basic and a 32 KB memory extension one could PEEK and POKE from Basic (with the LOAD subprogram), so programming the TI 99 in machine code was possible. Yet, the assembler sold by TI also required a disk drive. As an alternative, you could assemble by hand or write your own assembler in Basic.

  13. I’d be interested to see if the Extended Basic source could be obtained to port, as the original TI-99 Basic here was. It probably wouldn’t require a lot of work to reverse engineer.

  14. [download movies][download games][download music][forum warez][game full download][download scripts][watch online movies][movis][games][software][scripts]…

    [...]TI-99/4A BASIC as a Scripting Language « pagetable.com[...]…

  15. Portal Jezykow Obcych…

    [...]TI-99/4A BASIC as a Scripting Language « pagetable.com[...]…

  16. OLD CS1 says:

    What about file processing? Is there special syntax for opening, say, text files?

  17. Gordon says:

    Why have an emulator when I have my original computer. Nice to see the work some people are prepared to do to keep things alive.
    I’m transferring some programs from tape to minidisc, saves having to ff and rw a tape.

    Kudos and well done.

    Now, where’s my Parsec cartridge…

  18. [...] a Texas Instruments TI-99/4A. Longtime readers may remember a previous article where we implemented TI-99/4A BASIC as a Scripting Language for modern computers. Recently I got nostalgic for the actual hardware so I got my 99 out of the [...]

  19. party suppli says:

    Piece of writing writing is also a fun, if you know afterward
    you can write otherwise it is difficult to write.

    Here is my web site; party suppli

  20. ??????? ??? says:

    ??????? ???
    Remarkable! Its genuinely amazing piece of writing, I have got much clear idea concerning from
    this post.

  21. It will tell you how much you happen to be willing to get
    rid of with a trade; it will let you know when to enter a trade, when to exit a trade, and explain
    to you how you can protect your profits. Ms tarde despues de meses veremos que esa
    sabiduria es incluso insuficiente. Charts offer a lot of information
    and will help you increase the risk for right trading strategies.

  22. basket montant nike…

    Designer bags can be found in an range of sizes, styles and forms. They are rather attractive, regardless of the dimension and cost. Even though some could be pricey, they’re extremely tough enduring for any number of many years….

  23. sacs louis vuitton pas cher…

    en vente pour pas cher inexpensive {popularit?|Reconnaissance??r?putation de r?plique les, ils sont prennent le sac ? main place de march? par la temp?te. Il ya effectivement 1000 de ces produits articles sont se vendu Web bas? et en dehors, ind?pendam…

  24. chaussure de sport nike…

    a number of difficulties with the present POP packaging, I for a single am incredibly pleased that SC Johnson of Racine, Wisconsin, has selected to bring back again this most wonderful item. I really hope this publishing is found by your several shoppe…

  25. nike turbo shox…

    The Web continues to become the fastest-growing retail channel. In accordance with Boston Consulting Group, web based retail revenues grew sixty five % in 2000, striking $44.five billion. The analysis provider expects revenues to achieve 66 billion thi…

  26. air jordan nike…

    I met Farrah, my most desirable friend cousin, at a birthday celebration. I got her quantity and sent her a text three times later. We kept texting one another, cracking jokes and flirting…..

  27. warez Mp3 says:

    In a release posted Monday, October 1, Anonymous hacktivists
    issued a summary of Swedish government websites being targeted in retaliation to the raid by
    Swedish police. When you make a juice from dark, leafy
    greens, try adding in a little cucumber. When you have a file you want to share,
    you’ll be able to upload it for your storage account.

  28. Software says:

    Definitely believe that which you stated. Your favorite justification seemed to be on the web
    the easiest thing to be aware of. I say to you, I certainly get irked while
    people think about worries that they just do
    not know about. You managed to hit the nail upon the top and also defined out the whole
    thing without having side effect , people could take a signal.
    Will likely be back to get more. Thanks

  29. Tech Atul: Hacks,Tips,Linux Tutorials…

    [...]TI-99/4A BASIC as a Scripting Language « pagetable.com[...]…

  30. Thank you for submitting your amazing understanding on such
    a taboo subject.

    My web page – Cheap E-Liquid

Leave a Reply

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word