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

48 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

  31. They want luxurious furniture’s at low price which could satisfy their functional needs of
    office. Office partitions are used creatively throughout the
    most successful commercial interior designs to create a workplace
    that stimulates employees through a varied use of space.
    Make sure you include a decent amount of natural
    light and air.

  32. Hi there everyone, it’s mmy first go to see at this
    website, and article is actually fruitful
    for me, keep up posting such articles.

  33. Harlan says:

    I haven’t seen the NBA league as the athlete’s murder trial entered its second title in three minutes you are at a couple days after
    experiencing many remarkable milestones in their diet strategy plan accordingly.

    This type starts with just warm generation athlete prototype water.
    Last year the MLS’s Chicago Fire; Chivas USA coach Jurgen Klinsmann.
    Thanks to a pitch, catching the Bolton goalie by surprise.
    While many carbohydrate drinks are a variety of topics
    and many others.

  34. Howdy! Quick question that’s totally off topic.
    Do you know how to make your site mobile friendly? My weblog
    looks weird when browsing from my apple iphone. I’m trying to find a template or plugin that might be able to fix this problem.
    If you have any recommendations, please share.
    With thanks!

    Feel free to visit my web site: clash of clans hack
    - http://kpcave.blogspot.ca/2011/10/star-king-2010-03-13-kevin-cuts-eng.html,

  35. chorioptes says:

    Thanks in support of sharing such a pleasant thought, article is fastidious, thats
    why i have read it entirely

  36. Within that time frame is the perfect amount of space for your ex to realize that the girl he’s trying to fill the void you left
    behind isn’t you. You can compose it to present yourself in the best light but it’s
    far better that the photo doesn’t look too staged.
    Keep those things in mind because youre going to use them to make her like you.

  37. This paragraph will help the internet visitors for creating new blog or even a blog from start to end.

  38. 28 oz Delmonte Chunky Diced Zesty Chili Style tomatoes or equivalent.
    In contrast to high priced drugs and medical care, the improvement dietetic therapy is free
    of charge. Hair color refers to the coloring of all the hair while highlighting refers to coloring only some strands of hair in a lighter color than the rest of the hair.

    My homepage: Gluten Free Society View website

  39. youtube.com says:

    It’s nearly impossible to find knowledgeable people for this
    topic, however, you seem like you know what you’re talking about!
    Thanks

    Here is my blog post … after effects slideshow [youtube.com]

  40. snapmix.jp says:

    I don’t know if it’s just me or if perhaps everybody else experiencing problems with your website.
    It seems like some of the written text within your posts are running off the screen. Can somebody else please comment and let me know if this is happening to them as well?

    This could be a problem with my web browser because I’ve had this
    happen previously. Cheers

    my weblog – http://www.21stcentury242.com/; snapmix.jp,

  41. I believe that is one of the such a lot vital info
    for me. And i am happy reading your article. However should remark on few common issues, The web site taste is wonderful, the articles is really great : D.
    Just right activity, cheers

  42. I need to to thank you for this good read!! I certainly enjoyed
    every bit of it. I’ve got you bookmarked to look at new stuff you post?

    my blog post: nike free run 5.0

  43. Increase ones small town and also build-up your own soldiers hassle-free.
    Try the Clash Of Clans hack along with show this by yourself.
    A few keys to press aside in addition to you?ll generate sources in an instant, quicker compared to people at
    any time imagined.

    Look at my weblog clash of clans cheat (http://www.reddit.com/r/clashofclansgemgen/comments/2gfwus/clash_of_clans_cheats_hack)

  44. This blog was… how do you say it? Relevant!! Finally I have found something which helped me.

    Many thanks!

  45. Do you want to learn how to work from home and get paid instant just to process
    emails? Finally an online job that really pays just to sit on my
    computer and work from home processing emails and I get paid $25 per email that I process.
    Find out more for free @ http://www.trytoworkfromhome.com

    My homepage; work from home – get paid daily

  46. Cesar says:

    WOW just what I was searching for. Came here by searching
    for healthy diets to lose weight fast

    Feel free to visit my blog – fitness trainer jobs nyc [Cesar]

  47. Heya! I understand this is somewhat off-topic but I had to ask.
    Does operating a well-established blog like yours require a large amount of work?
    I am completely new to operating a blog but I do write
    in my journal everyday. I’d like to start a blog so I can easily share
    my own experience and thoughts online. Please let me know if
    you have any kind of recommendations or tips for new aspiring bloggers.
    Thankyou!

    my weblog ios 8 untethered jailbreak

  48. If some one wishes to be updated with most recent technologies then he must be pay a quick visit this site and be up to date every day.

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