Table of Contents:
TI-99/Sim
a Texas Instruments Home Computer Emulator
NOTE: This page is designed to use CSS styles - you may want to upgrade your browser.
This is the latest incarnation of an emulator for the TI-99/4A that I've been working on, on and off, since 1993. At first it was a simple text-based simulation of the TI (ti99sim-console) running under MS-DOS™. Then it was ported to OS/2 and graphics support for the OS/2 Presentation Manager was added. Later, it was ported to Windows and had sound support added. Now it's been ported to Linux and Mac OS X and more features are still being added.
DISCLAIMER: I'm not one for writing a lot of documentation, so you're encouraged to look at the code to see how some things work if they're not described here. If you're interested in writing documentation, let me know.
NOTE: In order to run the emulator, you need to create a cartridge that contains the console ROM & GROMs from the TI-99/4A. Texas Instruments will not allow these to be distributed, so they are not included with ti99sim. In order to get a working installation, you should run the included setup script which will create the required files.
Before building or running TI-99/Sim you must install the SDL library. The latest version is available at http://www.libsdl.org/download-1.2.php. If you are planning on building TI-99/Sim, you will need to install the Development Libraries
version otherwise, the Runtime Libraries
package is sufficient.
If you downloaded the binary-only version, you can skip straight to Installation. Before building you should make sure that the SDL development code has been installed on your system and ensure that the sdl2-config utility is in your search path.
If everything is installed properly, running 'make' will build all the executables found in the binary-only package. Any OS specific operations are detailed in the following sections.
NOTE: When building from the source, all the executables are left in their corresponding directories.
Since this is the primary development environment, you should have few problems building under Linux.
First, make sure you have the following installed:
Then, from the ti99sim folder simply type:
~/ti99sim> make
NOTE: If you are seeing messages like 'plugin needed to handle to object', you will need to type 'make AR=gcc-ar RANLIB=gcc-ranlib' in order to build successfully.
In order to build ti99sim under Macintosh OS X, you'll need to install the developer tools from Apple. You will also need to copy the SDL main files (SDLMain.m and SDLMain.h) from the development libraries to the src/sdl folder. Then, from a bash shell, just type:
~/ti99sim> make
NOTE: I'm not a Mac OS X guru, so there is no neat little package for TI-99/Sim. This probably means that to run it you'll need to do so from a command window. (If anybody is interested in working on a proper
Mac OS X install is more than welcome to do so.)
Solution and project files for Microsoft's Visual Studio 2015 can be found in the v14 folder.
These files assume that you have installed the SDL development files in a folder called SDL-1.2.15 in a directory at the same level as the TI-99/Sim directory.
Installing the emulator is easy. Make sure you have sufficient privileges to create/write to the installation directories and type:
make install
This will create the default directories and install the binaries. The default directory is /opt/ti99sim and the binaries will be installed in /opt/ti99sim/bin. In addition to installing the binaries, symbolic links to them will be created in /usr/local/bin (which should already be in your path). When loading files (ROMs, cartridges, disk images, …), ti99sim will look in the current directory, ~/.ti99sim, and finally, /opt/ti99sim. Under Windows, the search is limited to the current directory followed by the directory specified in the environment variable HOME (if it is defined at all). When searching directories other than the current directory, the following sub-directories are considered:
─┬─ cartridges ├─ console └─ disks
When looking for a file, the appropriate sub-directory for that file type will be searched. If there is no logical directory for a given file, only the base directory will be searched.
NOTE: Since v0.14.0, the setup script found in the scripts folder is provided to help create a set of both console & cartridge files to get you started. This section describes how to create and install your console ROM files by hand if you prefer to do it yourself.
Once you have run make install
, you will need to create the console ROM cartridge TI-994A.ctg
(see convert-ctg below for instructions) in order to run the emulator. This ROM cartridge contains the operating system, the BASIC interpreter, and a description of the RAM configuration for the computer. Without it, the emulator will not do anything useful. Once you have created the console ROM cartridge, copy it to either ~/.ti99sim/console or /opt/ti99sim/console.
You should also place a copy of spchrom.bin into this directory to enable speech synthesis. If you don't have this file, you can use mkspch to create one that will keep the emulator happy.
If you want to use the disk emulation features, you will need to create another cartridge named ti-disk.ctg
that contains a copy of the TI Disk Controller ROM (the section on convert-ctg contains information about creating cartridges for peripheral DSR ROMs).
In order to use the CF7+ disk emulation features, you will need to create a cartridge named cf7+.ctg
using the supplied cf7+.dat file.
A sample installation is shown below. In order to get up and running, however, the only file needed is the TI-994A.ctg file.
─┬─ cartridges │ ├─ Alpiner.ctg │ ├─ Editor-Assembler.ctg │ ├─ Parsec.ctg │ └─ TI Extended BASIC.ctg ├─ disks │ ├─ ASSM1 - E/A Disk 1 │ ├─ ASSM2 - E/A Disk 2 │ ├─ DISKASSM - Miller Graphics' Disk-Assembler │ ├─ dsk1.dsk - Default disk image │ ├─ image.cf7 - Fle accessed by CF7+ module │ └─ MG_DIAG - Miller Graphics' Advanced Diagnostics └─ console ├─ cf7+.ctg - CF7+ ROM DSR module ├─ Gram Kracker.ctg - Miller Graphic's Gram Kracker ROMs ├─ spchrom.bin - TI Speech Synthesizer ROM ├─ ti-disk.ctg - TI ROM DSR module for disk access └─ TI-994A.ctg - TI-99/4A ROM
Now you're all set to run the emulator, just type:
ti99sim-sdl
If everything is installed correctly, you should see a window on your screen with the TI-99/4A startup screen followed by a beep. Enjoy!
Using the sample configuration in the previous section, the following are valid commands:
ti99sim-sdl --dsk2=ASSM1 --dsk3=ASSM2 Editor-Assembler.ctg (DSK1 will default to using the dsk1.dsk image) ti99sim-sdl --dsk1=MG_DIAG "TI Extended BASIC.ctg" (Note the use of quotes when using modules with spaces in their name) ti99sim-sdl -f Parsec.ctg (OK, bring 'em on ...)
What good is a computer is you can't save information or programs? On the TI-99/4A, there are two standard storage media: floppy disks and cassette tapes. This section deals with floppy disks. Depending on your disk controller, the TI could access either 3 or 4 floppy drives. These drive could be either single-density (using FM encoding) or high-density (using MFM encoding). Finally, disks can be either single-sided or double-sided. The various disk sizes are listed in the following table.
Notation | Sides | Recording Mode | Sectors/Track | Tracks | Capacity |
---|---|---|---|---|---|
SSSD | 1 | FM | 9 | 40 | 90K |
SSDD | 1 | MFM | 18 | 40 | 180K |
DSSD | 2 | FM | 9 | 80 | 180K |
DSDD | 2 | MFM | 18 | 80 | 360K |
CF7+ | 2 | CF* | 20 | 80 | 400K |
* CF7+ is not an actual floppy disk. This format was introduced by the CF7+/nanoPEB peripherals for the TI-99/4A. These devices use CompactFlash to store multiple disk images (referred to as volumes) on a single device. The number of images stored depends on the size of the CompactFlash memory. These disk images are larger than typical disk images and require a custom DSR to read them properly. The disk utility is able to read and write to these devices.
The problem with emulating the TI (besides finding a 5ΒΌΚΊ disk drive) on an IBM PC is that most PC's don't easily allow single-density (FM) disks to be read. In addition, modern operating system don't make it easy to access the disk at the level required to read TI disks. To get around this, disks are read (using special programs, usually written for MS-DOS, to get easy access to the disk) and converted to a single file on the local hard drive. However, there is no one standard file format for disks. The formats that I'm aware of, all of which are supported by TI-99/Sim, are shown in table below.
In addition to supporting disk images, TI-99/Sim also supports archive files. Archive files were developed by Barry Boone and use a Limpel-Zev compression scheme similar to .zip files on the PC. Each file stored in the archive contains all the information to completely recover the original file including the file descriptor record. One way of looking at an archive file is as a cross between a file and a disk (in fact, the disk and other utilities treat these files as disks).
Name | Format | Pros | Cons |
---|---|---|---|
AnaDisk | Header & Data | Retains sector ordering and special formatting information | None |
v9t9 | Raw sectors | Compact image size | Unable to distinguish between SSDD & DSSD disks |
PC99 | Raw tracks | Stores a complete copy of a track | Hard to parse. Lots of extra data (roughly 40% more than v9t9's format) |
HxC Floppy Emulator (hfe) | Raw Data Pulses | Stores a complete copy of a track including clock information | Hardest to parse. Lots of extra data (roughly double PC99's format) |
Archive | Compressed files | Uses the least amount of space | Not a real disk image |
TI-99/Sim only deals with files contained within disk images. However, there are reasons to deal with individual files rather than entire disks. As with disks, there are a few different formats that individual files may use. The most common format for v9t9 systems is the FIAD format. This format allows the emulator to identify all of the attributes of the original file. A similar, but slightly different format is known as TIFILES. This is the format used to transfer files to/from the TI using the X-Modem protocol. Finally, files can be stored as 'native' files. When this format is used, the TI file is converted, as best as possible, to a native file on the host operating system.
Format | Description |
---|---|
FIAD | v9t9's native file format. The actual file descriptor record from the file is included in the header of the file, followed by the raw sectors that make up the file. |
TIFILES | Very similar to FIAD in structure. The difference is limited to the 128 byte header. There are at least 3 different flavors of this format. Each flavor includes most or all of the information normally found in the file descriptor record (the original name is not always present). |
'Native' | This format has no header or formatting information. |
Two of the utility applications, dumpcpu and list, access files. These files can be either standalone files or files contained within a disk. To access either a FIAD or TIFILES files, simply use the name of the file on the host filesystem. Files contained within a disk are identified by the name of the containing disk and the intended filename, separated by a colon. For example, to list a BASIC program called GAME on a disk named sample.dsk the syntax would be: list sample.dsk:GAME
This is a simple utility that will list all of the cartridges/disks/files in the path(s) specified. Each entry is displayed as a SHA1 hash of the entry followed by the filename. Disks and cartridges will additionally display either the disk name or cartridge title. All output is sorted by SHA1 and any duplicate entries are marked to make it easier to clean up multiple copies.
NOTES:
The SHA1 values displayed are hashes of the relevant object being checked. That means the SHA1 of a disk will not match the sha1sum of the disks image file from the command line.
For disks, the SHA1 is a hash of all the files found on the disk. It is not affected by the disk format or file layout. So, a highly fragmented disk copied to a clean disk file by file will both have the same SHA1 hash.
For cartridges, the SHA1 is a hash of all the ROM/GROM sections. It is not affected by the Title or any other 'features'.
For files, the SHA1 is a hash of all relevant data. It does not take into account the unused empty space at the end of sectors.
Command-line syntax:
The ti99sim emulator uses special .ctg files to store the ROM and/or GROM images contained within the computer console and plug-in cartridges. The convert-ctg program allows you to create these cartridges. It will convert your existing v9t9 ROMs or create cartridges using output from a hex dump of a ROM image. A set of sample files, TI-994A.dat, Mini-Memory.dat, and Gram Kracker.dat, located in the roms directory, are supplied as examples of the format of the hex dump file. NOTE: These files do not contain complete hex dumps of their corresponding ROMs but can be used as templates if you have the required information.
To convert existing v9t9 cartridges, type convert-ctg foo.bin
where foo is the base name of a set of ROM files. The base name is usually the portion of the filenames that are common between all files associated with a particular cartridge. convert-ctg understands the naming conventions used by present and past versions of v9t9, and will attempt to determine which version of files that you have installed. For example, the following command will convert the files PARSECC.BIN and PARSECG.BIN to PARSEC.ctg:
convert-ctg /your-path-here/v9t9/v6.0/modules/PARSEC.BIN
Files to be converted can be in any directory. The new cartridge will be created in the current working directory. To create the console ROM cartridge you need to specify either 994a.bin or ti.hex (depending on your version of v9t9 or TI Emulator) as the filename. For example:
convert-ctg /your-path-here/v9t9/v6.0/roms/994a.bin
This will create the special TI-994A.ctg file that contains the console ROM, the system GROMs, scratch-pad RAM, and 32K memory expansion RAM. Without this file, ti99sim will not run!
There are three types of cartridges. The first is the special TI-994A.ctg file, the second are DSR ROMs, and the third are normal cartridges
. The first two types are expected to be found in the 'console' directories, while the last is expected in the 'cartridges' directories.
DSR ROMs are special ROM cartridges that are associated with a particular peripheral device. These cartridges must be associated with a particular CRU address. The ROM in these cartridges is located at a different address than the ROMs normally found in a cartridge and without a CRU address, the CPU won't be able to see the ROM within the cartridge. To create a DSR ROM cartridge, simply use the --cru=xxxx
option to convert-ctg. This will instruct convert-ctg to store the ROM at the special DSR memory range, and mark the cartridge with the correct CRU information. In order to use the disk emulation features, you need to create a cartridge from a TI disk ROM with the name ti-disk.ctg
with the CRU address 1100.
When creating cartridges, convert-ctg will attempt to add a cartridge title by searching for valid GROM headers in the files being converted. If it does not find any valid names, or if you want to change the one it uses, you can specify a title on the command line after the base filename. ti99sim uses the cartridge title when saving/loading memory images to ensure that the correct cartridges are present when loading. If you intend to use this feature, please make sure that all of your cartridges have unique names.
convert-ctg will also allow you to dump the contents of a cartridge to a specially formatted hex dump file. This feature is useful if you want to see the contents of a cartridge's ROM/GROM code, or to patch the code and rebuild the cartridge with your changes.
Command-line syntax:
If you have old TI audio tapes hanging around, decode will convert them into binary files that can be used (in some future version) by ti99sim. It attempts to intelligently find sections of stored data while ignoring any other sounds it finds. This makes it easier to get all the data from a tape - just create a .wav file that covers the entire tape. There is no need to create a separate .wav file for each data file. Once it's done, you will have a separate file for each track of audio found on the tape. If you have a TI-BASIC or TI Extended BASIC program stored on tape, you can use the list utility to display a listing of the program from the file(s) created by decode.
Only .wav files are currently supported. Any .wav file stored using a standard format (i.e. non-compressed, PCM audio using integer samples) should work. decode can handle files at any sampling rate and bit depth. This means you can keep your recordings as small as possible by using 8-bit mono 8000Hz .wav files. If your file is not recorded in mono (i.e. stereo or multi-track), decode will only attempt to use data from the first channel (i.e. left (2,3), front left (4), left center (6), ...). Of course, a higher sampling rate or resolution may help the decoding process in cases where the audio is garbled. If you find that a file is not decoding properly, you may want to re-record the tape using higher settings. If you have the proper hardware, for example, you could record a 32-bit mono 44100Hz file (this will create a file over 20 times larger than the one mentioned earlier, so it should only be used as a last resort).
Command-line syntax:
The emulator allows you to use disks created by a TI-99/4A computer within the emulator. The emulator can read disks created using the dump feature of AnaDisk - with or without the optional 8-byte header for each sector. The latter is the format used by v9t9 disks. The emulator can also read disks that contain raw track data (the format used by PC99). disk can understand both single and double density disk formats.
The disk utility allows you to look at the contents of a disk image and optionally create native files from those in the disk image. This allows you to create files that can be used by convert-ctg to create cartridge files that you can use with the emulator. There are two output formats for files extracted from a disk. The first (default) format is the v9t9 FIAD format. This format contains a 128-byte header that preserves all of the original file information. The second format is a naked
file. These files use only a filename extension to convey the original file format. The actual contents of the file are converted to a conventional file as best as possible. Files using this format may be readable on the host computer (normally, DISPLAY type files are readable).
the --sha1 option will display a SHA1 hash of the contents of each file. The SHA1 calculation only includes data belonging to the file (it ignores unused bytes at the end of sectors). This means that if a file has been copied to another disk, it should generate the same checksum regardless of how it was copied. The SHA1 value is useful for locating duplicate files across disks (or volumes on a CF7+ image) or determining if two copies of similarly named file are really the same.
CF7+ devices can be read/written using the disk utility. The syntax for accessing a volume on the device is: <device-file>#<volume>. Where <device-file> can be either the device node where the CompactFlash card is located (e.g. /dev/sdb on a Linux machine) or a file image taken from an actual device. The <volume> is a number (starting at 1) indicating which volume on the device to access.
The disk utility can also be used to convert disk images between formats. By specifying --output={anadisk|v9t9|pc99|cf7+}
, a disk image can be converted to any format.
NOTES:
Command-line syntax:
This program will allow you to disassemble any CPU ROM section in a cartridge file, a DISPLAY/FIXED FIAD file, or RAM from a save image file. Through the use of an external configuration file, you can assign labels and EQUs to make the disassembly more readable.
NOTE: This program is a work in progress and does not always create good listings.
Command-line syntax:
Ever wondered what the code behind that game looks like? This program is similar to dumpcpu but disassembles the GPL code in the GROM cartridge. It uses the standard GROM headers to find starting addresses and strings.
NOTE: This program is a work in progress and does not always create good listings.
Command-line syntax:
Here is a utility that can help you analyze the contents of your speech synthesizer's ROM (spchrom.bin). This program will create a text file, spchrom.dat, which contains the contents of the ROM that can later be used by mkspch to create a new speech ROM. It can create files in two different formats. The first (default) is a simple hexadecimal listing of the speech data for each phrase contained in the ROM file. The second breaks down the raw data into a 'parsed' format that exposes the individual LPC-10 speech frames. Each speech frame represents 25ms worth of sound. If you're feeling adventurous, you can edit the speech frames in the generated .dat file, create a new spchrom.bin file, and see how things sound!
For those that are interested, the parsed speech frames are of the form:
STOP CODE S - Signals the end of the speech data ZERO CODE Z - Indicates 1 frames worth of silence REPEAT Frame Pxx Exx R - Repeats the previous frame using the indicated pitch and energy Unvoiced Frame Pxx Exx <Kxx>4 - An unvoiced (fricative) frame with 4 reflection coefficients Voiced Frame Pxx Exx <Kxx>10 - A voiced frame with 10 reflection coefficients
NOTE: If you create a file using the 'spch' format, the resulting file will only contain the valid speech data. The actual TI speech ROM data contains a few extra bytes following several phrases. The parsed output file will not include this extraneous data. A spchrom.bin file created from the generated spchrom.dat file will not match the original ROM byte-for-byte, but will be a completely functional copy.
Command-line syntax:
This utility can be used to list TI-BASIC (and TI Extended BASIC) programs. Files can be either a native file that has been extracted from a disk image (using 'disk -d xyz.dsk'), or a file inside a disk image (using xyz.dsk:filename, or cf7#5:filename). Find the file you want listed (i.e. HELLO) and type 'list HELLO'. If you have selected a valid BASIC file, a listing similar to the one printed by the BASIC interpreter should print.
Command-line syntax:
If you have a directory full of ROM files for a large collection of cartridges (or even a single file), mkcart can help create a set of cartridge files from them in one quick pass. It was designed to be a simple tool for mass cartridge conversion and does not have all the features of convert-ctg but does a much better job when faced with a large set of files. It also understands the TOSEC naming convention, so the cartridges created will usually have a more descriptive title.
NOTE: mkcart can only create 'normal' cartridges, it cannot be used to create device DSR cartridges or the system ROM cartridge.
Command-line syntax:
If you can't find a copy of spchrom.bin, you can use this utility to create one that can be used by the ti99sim. The spchrom.dat file located in the console directory contains the information required to create a stripped down speech ROM. This file does not contain any actual speech data, but instead contains the bare minimum number of phrases required for the proper operation of TI Extended BASIC's CALL SAY logic. If you have your own LPC-10 coded speech samples (I have no idea how you would create them - yet, so please don't ask), you can use this utility to create a speech ROM using your own voice samples!
Command-line syntax:
Do you miss being able to type CALL SAY("HELLO") and hear the TI's speech synthesizer? Well, say is your answer. This program attempts to mimic the behavior of the TI Extended BASIC routine SAY. It will look through the spchrom.bin file for the indicated pattern and do it's best to produce synthesized speech. Some phrases in the speech library contain spaces. If you want to say one of these ("Texas Instruments" for example), you will need to put quotes around it on the command line, otherwise say will look for two or more separate words that are probably not present.
Command-line syntax:
A simple text-based version of the emulator. It includes an interface, similar to Miller Graphics' Explorer, which allows you to step through code at the assembly or GPL instruction level. It has two modes: command and run. While it is in command mode, the CPU is paused. You can edit any of the register values, clear the PC breakpoint, load/save memory images, exit... In run mode, the CPU is running and all keystrokes go to the TI. Pressing <Esc> will stop the CPU and return to command mode. Since its text-mode only, it does not support graphics or sprites. If you just want to see what the computer is doing, this is the program to do it with.
Command-line syntax:
NOTE: If you try to load a memory image, you must make sure that any cartridge(s) that were running when the image was made are also specified.
Command Mode:
Run Mode:
The SDL-based emulator
Command-line syntax:
NOTE: If you try to load a memory image, you must make sure that any cartridge(s) that were running when the image was made are also specified.
There is no GUI yet. The following keys are defined:
For those of you that don't have easy access to the TI-99/4A keyboard or overlay, here is a summary of the special function keys:
Using the ti-disk.ctg cartridge, the emulator is capable of reading and writing single-density disk images. The TI disk controller is not capable of accessing double-density disks. Internally, the emulator is ready to support double-density disks, but I don't have access to a controller ROM that supports them, so I haven't been able to test them yet.
The emulator supports all operations on a disk image. When the emulator shuts down, any changes made to the disk image are saved. A disk can be made write-protected
by making the file read-only.
NOTE: The disk routines can read and write files in the PC99 format, but disks formatted in the emulator by routines other than those in the DSR ROM (like those formatted using a program like Miller Graphics' Advanced Diagnostics
) may not be readable by PC99 or other PC99-compatible software.
The supplied cf7+.ctg cartridge allows the emulator to access CF7+/nanoPEB files. By default, the emulator will look for a file named 'image.cf7' in the disks subdirectory. In a POSIX environment (Mac OSX, Linux, BSD, ...), this may be a symbolic link to the device containing your CF7+ CompactFlash. If you don't have an actual CF7+ CompactFlash, you can create a file to be used as a virtual CompactFlash file (the CF7+ module will determine the number of volumes based on the size of your file). The disk utility can be used to create an arbitrarily sized file by specifying an appropriate volume number number:
disk --output=cf7+ --filename=image.cf7#30 blank.dsk (Copies an existing disk image 'blank.dsk' to volume # 30 of a CF7+ image file name 'image.cf7')
Unlike normal disk emulation, all operations on the image are immediate (i.e. they are not deferred until the emulator shuts down).
NOTE: In order for this feature to function properly, you must ensure that you have read/write access to the CompactFlash file.
NOTE: CF7+ support is limited to disk access. The parallel/serial port features of the CF7+/nanoPEB are currently not supported.
Sorry, this feature is not implemented - yet.
If you have created the Gram Kracker cartridge properly and placed the cartridge in the console directory (the one where you placed the TI-994A.ctg file), the following extra keys are active:
Consult your Gram Kracker manual for a description of each of these switches.
To create a Gram Kracker cartridge, the loader ROM must be added to the Gram Kracker.dat
file supplied in the roms directory. Getting the loader ROM is left as an exercise for the reader. (Hints: Save it to disk, transfer it to the PC using AnaDisk, extract it using the disk utility, and a) make a hex dump after stripping off the header or b) create a normal cartridge file using the convert-ctg utility then create a .dat file using the -d option. OR Use the dump feature built into the Edit Memory option of the Gram Kracker loader to send a hex dump to the serial port and capture it on the PC to a disk file).