tms9900gcc Ubuntu Installation Guide - jedimatt42/fcmd GitHub Wiki

GCC Cross Compiler for TI-99/4A

Installation instructions for Insomnia's gcc 4.4.0 patch to target tms9900 CPU.

Full details and community assistance can be found on Atariage: GCC for the TI

Ubuntu 20.10

Install prerequisite packages to allow compilation. You need a modern gcc to compile this TI targetting gcc.

sudo apt install build-essential libgmp-dev libmpfr-dev

Make a scratch directory to extract all the files in. (the name work doesn't matter)

mkdir work
cd work

Lets save this work directory in a variable to make things easier later:

WORK=`pwd`

download gcc-installer.tar.gz

wget https://atariage.com/forums/applications/core/interface/file/attachment.php?id=623420 -O gcc-installer.tar.gz

extract

tar -xvzf gcc-installer.tar.gz

This will provide 3 more files, 2 .patch and the primary installation script

  • gcc-4.4.0-tms9900-1.19.patch
  • binutils-2.19.1-tms9900-1.7.patch
  • install.sh

Fetch an install script update and additional patch:

wget https://atariage.com/forums/applications/core/interface/file/attachment.php?id=799721 -O gcc10-patch.zip

extract this new zip, overwriting the install.sh from the previous archive...

unzip -xo gcc10-patch.zip

you should get 2 new files:

  • install.sh
  • multidef-binutils-2.19.1-tms9900-1.7.patch

You will have to add script execute permissions to install.sh

chmod +x install.sh

Make a directory to install the binaries to:

mkdir ~/tms9900gcc

Run the installer:

./install.sh ~/tms9900gcc

There will be hundreds of warnings. This is ok.

The compilers and binutils will now be in ~/tms9900gcc/bin

There are a couple additional utils that are handy:

Elf2Ea5

This utility extracts the binary from an .elf file and produces a single PROGRAM image file for the TI suitable for EA5 loading.

From inside your previous work directory download it:

cd $WORK
wget https://atariage.com/forums/applications/core/interface/file/attachment.php?id=354228 -O elf2ea5.tar.gz

then build it:

mkdir elf2ea5
cd elf2ea5
tar -xvzf ../elf2ea5.tar.gz
make

It will produce an executable elf2ea5

Copy that to your tms9900 gcc bin directory for convenience:

cp elf2ea5 ~/tms9900gcc/bin/

EA5SPLIT

This utility will convert the potentially large EA5 file produced by elf2ea5 into a sequence of 8K PROGRAM image files as is usually required by EA5 loaders. It also converts the files to FIAD in TIFILES format making them immediately usable on a TIPI or HDX, or in classic99 emulation.

Download it:

cd $WORK
wget https://atariage.com/forums/applications/core/interface/file/attachment.php?id=261992 -O ea5split3.zip

Build it:

unzip ea5split3.zip
cd ea5split
make

It produced executable ea5split. Copy that to the same bin directory as the others:

cp ea5split ~/tms9900gcc/bin/

Elf2Cart

This utility extracts raw binary data to a file suitable for use as a cartridge.

Download it:

cd $WORK
wget https://atariage.com/forums/applications/core/interface/file/attachment.php?id=212080 -O elf2cart.tar.gz

Build it:

mkdir elf2cart
cd elf2cart
tar -xvzf ../elf2cart.tar.gz
make

It produced executable elf2cart. Copy that to your gcc bin directory:

cp elf2cart ~/tms9900gcc/bin/

libti99

There is a commonly used library for the gcc and the 4A that provides routines ranging from direct hardware access to bitmap graphics mode.

This is available on github.com at: https://github.com/tursilion/libti99

Now that you have gcc installed, you should be able to download and use libti99

sudo apt install git
cd ~
git clone https://github.com/tursilion/libti99.git
cd libti99

It comes with libti99.a in the github repository. So there is no need to build it.

Testing your new setup

I have a small 8K cartridge example program that is a 4A expansion memory tester. You should have all the tools needed to build this now. Get the code from github:

cd ~
git clone https://github.com/jedimatt42/ti994a-32kmemtest.git

Setup your environment to find the tools and locations of libti99 as needed by my Makefile:

export PATH=~/tms9900gcc/bin:$PATH
export LIBTI99=~/libti99

Now you should be able to build the mem test cartridge:

cd ti994a-32kmemtest
make

There will be a few warnings. These are not an issue. When it is done, you should have a raw cartridge image file named exptest_c.bin.

You should be able to drop this exptest_c.bin file on classic99 and see it run.