- Details
- Category: Setup
The IDE card was designed by Thierry Nouspikel in 2001, later revised in 2004. The card does not have any ROM on board, so there are no ROM zip files to get the card going. However, there is a process of installation where the DSR is written on the IDE drive and a mini loader program (bootstrapper) is included to load the DSR from the drive at system startup.
Overview
The original concept from Th. Nouspikel included to load this bootstrapper into the battery-buffered real-time clock on the card (when using the RTC-65271). Other card revisions allowed for the use of BQ chips (like BQ4847, BQ4842, and BQ4852), some of them shipped with internal non-volatile SRAM or provisions to connect external SRAM.
Th. Nouspikel designed the DSR to provide a collection of floppy disk emulations. That is, by means of certain peripheral commands, the floppy image can be swapped for another one.
Fred Kaal redesigned the DSR completely to offer real hard drive access as devices "IDE1" to "IDE8", one for each partition. This allows the user to make use of up to 8 · 248 MiB of capacity. The hard drive partitions comply with the usual TI DSR conventions, in particular the HFDC and SCSI, so that nested subdirectories are possible. The maximum capacity for a partition cannot exceed 248 MiB because of the 31 sector long allocation table that can manage at most 63488 allocation units (clusters) with a maximum of 16 sectors of 256 bytes (see the description of the file system on Ninerpedia).
I recommend to use Fred's DSR, and this will also be the base for all following explanations.
The IDE support consists of two parts:
- the emulated IDE card with its DSR in the nvram subdirectory
- one or two emulated IDE hard disk drives and their respective image files
In order to set up the IDE support, we will at first prepare the IDE card, in particular including the upload of the DSR into the NVRAM. Then we will have to prepare a hard disk image to be mounted in the IDE drive.
Setting up the card and its DSR
At first we should take care that the loaded NVRAM will not get lost when you change the configuration. Therefore, I suggest to use a special nvram directory and also a special configuration directory for IDE use. We can set these directories in the command line, overriding the defaults in the mame.ini file. If you use a script (batch) file for launching your MAME emulation, this is the ideal way to set these paths:
mame ti99_4a -cfg_directory cfgide -nvram_directory nvramide -ioport peb -ioport:peb:slot2 32kmem -ioport:peb:slot7 ide -ioport:peb:slot7:ide:ata:0 hdd
The IDE card has some DIP switch settings. You find these settings in the OSD menü ("DIP switches"). Enter this submenu and verify that these settings are active:
CRU base: 1900
Map at boot time: SRAM
Card mode: TI
Also, we have to check whether the correct RTC chip is selected on the emulated card. In the OSD menu, select "Machine configuration":
Genmod decoding: off
RTC chip: BQ4847 (ext SRAM)
The BQ4847 is a good choice. Do not use the RTC-65271; it will not work with Fred's DSR, it is only useful for Thierry Nouspikel's original DSR. The Genmod decoding should remain off, unless you are configuring for the Genmod.
Now let us test whether the DSR must be installed at all. Maybe this was already done earlier, and we just forgot about it. Enter TI BASIC and try this:
TI BASIC READY
> CALL IDEST
* BAD NAME
If you get this error message (bad name), the DSR is not installed.
Installing the DSR
Fred Kaal offers the DSR on his website. Click on "Projects", and then on "Ide Dsr" on the right side (deep link). Download the file by clicking on the archive symbol at the top of the page ("Download the IDE DSR program as a ZIP file"). You should find a file "idedsr_vXX.zip" (with XX=16 or later) in your Downloads folder. Inside the ZIP archive there is a file "IDEDSRXX.dsk". Store this file in your floppy disks folder or anywhere where you can reach it easily.
Now run your emulation with the disk in the floppy drive and with the Editor/Assembler cartridge:
mame ti99_4a <options from above> -cart editass -flop1 IDEDSR16.dsk
You should store the command line in a script file for later use. Enter Editor/Assembler, select option 5:
* RUN PROGRAM FILE *
FILE NAME?
DSK1.IDELOAD
The program should now load. When it starts, it should show:
**** IDE-DSR VXX loader (xx/xx/20xx) ****
No configured IDE device found
Select:
1 for DSK1.
...
Press 1 for DSK1. In the following screen, set the CRU address to 1900 (just type 9), unless you set another address above. The program tries to detect the clock chip automatically. Sometimes this may fail, and then it assumes the BQ4847 (hence, a good choice). It then loads all DSR files and uploads them to the NVRAM. When done, you are returned to the initial menu, and you should now see
IDE device found @ CRU >1900
with RTC type BQ4847 (not set)
You can set the IDE clock with option 7, but this is not necessary, as the clock chip is automatically synchronized with the PC clock where you run MAME. When all is done, press FCTN-9 to leave the program, and enter TI BASIC to verify that the DSR was properly loaded. For that purpose, enter the CALL IDEST command as shown above. You should now see the version of the IDEDSR, and a list of IDE1...IDE8 status lines. If you do not already have a formatted hard disk image, you will see all zeros here.
Create a hard disk image
We will do this "the hard way" first. Actually, most of the following can be done more easily with TIImageTool's help.
First we have to create a hard disk image file. Use the chdman command from MAME. We will go for one 100 MiB drive that we want to have three partitions.
chdman createhd -o mynewide.hd -s 104857600 -ss 512
This should create a new file "mynewide.hd", size is 100 MiB, and the sector size is 512 bytes. Note that IDE drives always use sector sizes of 512 bytes, not 256. The DSR, however, translates this to 256-byte TI sectors.
Check that this file has been created. Now you need Fred's DU2K program to partition and format the hard drive (deep link). Download the ZIP archive and put the files DU2K, DU2L, and DU2M on a floppy disk image (e.g. with TIImageTool).
More to follow
- Details
- Category: Setup
Preparing the build environment
This should be required only once. We will use a GNU environment in Windows for building. You can also try Visual Studio, but since I do not have it, I cannot give further help here. See https://docs.mamedev.org/initialsetup/compilingmame.html for further information.
Most of the following information can be found on the MAME Documentation Wiki: Compiling MAME in Windows
1. Download MSYS2 and install it
For Windows x64, please download the installer from the MSYS2 website. This is free software.
Start the executable package by double-click. The installer allows you to choose an installation directory; if you do not pick the default (C:\msys64), make a note of it and replace the default path whenever it appears in the following setup. You can run MSYS2 Setup directly from the installer.
Should Windows Defender warn you about a possible security hazard, please ignore that and insist on installing (More info, Install anyway).
2. Set up MSYS2
When you run the setup, you should see something similar to the Windows command prompt, but with colored text, and a cursor blinking after a $ sign. This is the Unix-like build environment that we will use. In the following text, the commands you have to type in are shown in blue after the $ sign (which you do not type). Please make sure you type these command exactly as shown, including uppercase or lowercase. You can also copy the text and paste it behind the $ sign.
Whenever you are asked whether to proceed with the installation, enter Y or hit Return.
$ pacman -Syu
This updates the current installation.
$ pacman -S git make unzip
Installs the git, make, and unzip commands. Git is used to manage the source code, for example, allowing you to download the latest changes.
$ pacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-libc++ mingw-w64-x86_64-python
Installs the compiler, libraries, and the Python interpreter.
$ cd ~
$ curl -O "https://repo.mamedev.org/x86_64/mame-essentials-1.0.6-1-x86_64.pkg.tar.xz"
$ pacman -U mame-essentials-1.0.6-1-x86_64.pkg.tar.xz
$ echo -e '\n[mame]\nInclude = /etc/pacman.d/mirrorlist.mame\nSigLevel = Never' >> /etc/pacman.conf
$ pacman -Syu
$ echo "export MINGW64=/mingw64 MINGW32=" >> .bashrc
$ exit
These are some final settings before building MAME.
Get the sources
Open the command window again (search for MINGW64 in the Start menu), type the following:
$ git clone https://github.com/mamedev/mame.git
This will download all MAME sources from Github. This may take some minutes; the source tree contains nearly 30000 files. You should see a new "mame" directory in the folder.
3. Compile MAME
If you are not already in the mame directory, enter it with the cd command.
$ cd mame
$ make -j4 SOURCES=ti/ti99_4x.cpp,ti/ti99_4p.cpp,ti/ti99_8.cpp,ti/geneve.cpp,ti/ti99_2.cpp REGENIE=1
If your PC has sufficient CPUs/cores, you can choose a higher job count (for example, -j12). You should copy this line in a file and store it in the mame folder (like "maketi"). You can then start compilation with
$ ./maketi
After compiling has finished, you should have a freshly built mame executable file. Copy this file into your MAME working directory.
4. Update MAME
$ git pull
$ make clean
With pull, your local installation is updated with all changes on Github. You should do a make clean, as shown, to avoid trouble during compiling. Then continue as described below "Compile MAME". For more information about git, please check the online documentation.
5. Forget about steps 2-4 and use my tools
I prepared some small scripts to make the preparation, building, and installation easier. You can, of course, adapt these files to your personal needs.
- prepare: Set up MSYS2 as described above.
- clean: Clean the build directory from a previous build
- maketi: Build MAME.
- mameinst: Install the newly built MAME in the target directory
- mameprep_msys2: Fetch all ROMs and create suitable starter batch files.
This will lead you quickly through the installation and configuration process:
Download MSYS2 and install it
As described above, download the executable package and start it. Run MSYS2 from the installer as proposed at the end.
Download the prepare script
Put the prepare script in your home directory. This is the directory where you find yourself when opening MSYS2. Typically, it should be C:\msys64\home\yourname. The other three scripts are automatically retrieved.
Configure MSYS2
Run the prepare script in your home directory. Watch the output. Ideally, it should do everything mentioned above in tasks 1 and 2.
Build MAME
Run the maketi script in the mamegit subdirectory that has been created by the prepare script.
Install MAME
Run the mameinst script in the mamegit subdirectory that has been created by the prepare script. MAME will be installed in the directory C:\prg\mame.
Get all ROMs
On the first installation, the mameinst script will remind you to fetch the necessary ROMs. Go into the target installation directory (by default /c/prg/mame) and run the mameprep_msys2 script. When it is done, you will find a new folder on your desktop, containing batch files to run various TI and Geneve systems. This is done only once.
6. Troubleshooting
Sometimes, things don't work as expected, even though you swear that you did everything as you were told.
Python not found
When you start building MAME, you get the message after some time that Python was not found.
Check: Did you install Python as described above? In the command shell, enter this:
$ /mingw64/bin/python
Does this work? That is, do you get a "No such file or directory" error, or is there a Python command prompt (">>>") ? If so, exit Python with quit(). Obviously, Python is not in your path.
Check exactly what prompt you see: Is there a MINGW64 or MSYS? If you see MSYS, you opened the wrong command window. Close it and search for "MINGW64" in the Windows start menu. You might want to create a shortcut on your desktop.
Scripts are not found
Although you verified that you are in the correct directory, you see this:
$ maketi
-bash: maketi: command not found
Note that in Unix systems, the current directory is not contained in the command search path. To execute a file outside of the search path, you must provide the directory in which it is located. This is done easily by using the period as the current directory:
$ ./maketi
And now you notice that I actually wrote that in the explanation above.
- Details
- Category: Setup
The TI-99/4A emulation offers two kinds of cartridge formats:
- the common ZIP format for ROM packages in MAME
- the RPK format
The first format is used throughout MAME for bundling ROM dumps that belong to some collection, for example, all ROMs for a computer system. In the same way, all ROMs of a cartridge are stored in a single ZIP file, which must be added to the software list, a XML file in the hash subdirectory. For the TI, this would be the file ti99_cart.xml.
The second format was the result of an earlier attempt to find a format for cartridges. Later, the ZIP format became the recommended format for cartridges, but it has a shortcoming: It depends on an update of the mentioned XML file. The RPK format, on the other hand, allows the user to set up a self-contained cartridge package that can be used right away. For this reason, the RPK format was kept in MAME.
I will elaborate on the details of both cartridge formats in a separate document.
Creating a ZIP cartridge
to be added
Creating a RPK cartridge
There are some points to follow, but this is not really difficult.
- You have to collect all dumps that shall be part of the cartridge. These are the dumps of memory in ROM space and in GROM space. Also, you need to check whether the cartridge offers RAM space or NVRAM space (which is saved on shutting down).
- You have to determine the type of the cartridge. The type is relevant for the function of the cartridge board where the ROMs are located.
- Now you have to set up the defining XML file called layout.xml. It must be part of the cartridge package. This is an example for a "gromemu" type:
<?xml version="1.0" encoding="utf-8"?>
<romset version="1.0">
<resources>
<rom id="gromimage" file="TETRISg.bin"/>
</resources>
<configuration>
<pcb type="gromemu">
<socket id="grom_socket" uses="gromimage"/>
</pcb>
</configuration>
</romset>
The most important parts are marked up in magenta. The PCB type is gromemu, and the ROM dump file is called TETRISg.bin. It is referenced by the "gromimage" tag, and the "socket" element declares it to be a GROM image by using the ID "grom_socket". You can use any other tag for "gromimage", and the file may also have any name.
Note that there is no format for the dump file name; the "g.bin" at the end of the file name has no special meaning for MAME. This is different to other emulators where the file name also determines its type; in the RPK format, the meaning of the dump file is determined by the socket element.
- Create a ZIP file from the dump files and the layout.xml. All these files must be part of the package.
- Change the suffix of the ZIP file to "rpk".
- Details
- Category: Setup
This is about setting up the peripheral devices in MAME (for all operating systems).
- Details
- Category: Setup
Actually, all Linuxes are alike. Almost. In the end, you run into problems because one system is by default installed with some library that another does not use. Since these libraries are installed only once, the challenge is to find out which libraries need to be installed and which are already there, and this is again different from system to system.
Thus, not the Linuxes are different, but their installation evolves over time. I will give some hints for installing MAME on different systems on this page.
Running MAME
MAME is dynamically linked against some libraries which may not be installed on your machine.
But fixing this is a simple job which you have to do only once. The following commands have been tested on a fresh installation. After installing, you should be able to run MAME. (Please report if you find a different situation.)
Unfortunately, different Linux flavors come with different package installers. And to make things worse, they use different package names for the same libraries.
If your system does not have the required libraries, you will see an error message like this:
$ ./mame ti99_4a
./mame: error while loading shared libraries: xxxx: cannot open shared object file: No such file or directory
The xxxx is the file name of the missing library file. The package name is usually slightly different.
openSUSE Tumbleweed
(July 2023)
sudo zypper install libSDL2_ttf-2_0-0
Ubuntu 22.04 LTS
sudo apt-get install libsdl2-2.0-0
sudo apt-get install libsdl2-ttf-2.0-0
sudo apt-get install libqt5widgets5
Installing the TTF lib will also install the SDL2 base lib, so you may skip the first command.
Linux Mint 19.3
sudo apt install libsdl2-ttf-2.0-0
sudo apt install libqt5widgets5
Configure it once
Open a bash shell and type
user@host:~$ cd mame
user@host:~/mame$ ./mame -createconfig
This creates a file ~/mame/mame.ini. Open it in some text editor.
In the second section ("CORE SEARCH PATH OPTIONS") you will find a setting rompath. This is relative to your base directory ~/mame; typically, you will find the value roms (i.e. it will be ~/mame/roms). This subdirectory is already created by unpacking the zip file (or after the build process). If you like, you can append ;cartridges or similar in order to separate between modules and system roms. You must make sure that there is a directory ~/mame/cartridges; if needed, create a new folder of that name in your explorer.
Scroll down to "OSD VIDEO OPTION"; change window to 1 to get a windowed output, otherwise it is fullscreen. In the next section "OSD PER-WINDOW VIDEO OPTION" you should set the first resolution property to 1280x960 or bigger, as you find suitable.
Note that this configuration is only done once, when you install MAME, as we show it here.
... or use command line arguments
Instead of editing the mame.ini file, you can also use arguments in the command line that achieve the same.
Set the rompath with the rompath switch: -rompath roms\;carts or -rompath "roms;carts"; note that the semicolon must be escaped or you have to enclose the whole argument in quotes.
Set the output in a window: -window or on full screen: -nowindow
Set the resolution: -resolution 1280x960
Install system ROMs and cartridges
Go to our WHTech repository and download ti99_complete.zip from the directory /System ROMs/MAME. Unzip its contents into the roms subdir. Do not unzip the zip files inside.
Also from WHTech, download all_carts.zip from /Cartridges/MAME. It contains a collection of zip files, each one for a cartridge; do not unpack these cartridge zips.
Store the cartridge zips into the cartridges subdir if you added that location to the rompath, otherwise move all cartridge zip files to the roms subdir.
Create starter script files
The following examples will only work if the specified disk or cassette image files are actually present at the indicated paths (or in the working directory if no path is specified). The backslashes are used to continue the command line on the next line; do not forget them.
Example 1
Plain console, cassette file inserted
#!/bin/bash
cd ~/mame
./mame ti99_4a -cass1 cassette.wav
Example 2
External 32K memory expansion, TI floppy controller, myfloppyimage.dsk inserted in DSK1
#!/bin/bash
cd ~/mame
./mame ti99_4a -ioport peb -ioport:peb:slot2 32kmem -ioport:peb:slot8 tifdc -flop1 myfloppyimage.dsk
Example 3
Cartridge Extended Basic, external 32K memory expansion, RS232 card, HFDC controller, one drive, myfloppyimage.dsk inserted
#!/bin/bash
cd ~/mame
./mame ti99_4a -cart exbasic -ioport peb -ioport:peb:slot2 32kmem \
-ioport:peb:slot7 tirs232 -ioport:peb:slot8 hfdc \
-flop1 myfloppyimage.dsk
Example 4
Cartridge Editor/Assembler, external 32K memory expansion, Speech synthesizer, Horizon RAMDisk, HFDC, hard disk, one floppy image inserted
#!/bin/bash
cd ~/mame
./mame ti99_4a -cart editass -ioport peb -ioport:peb:slot2 32kmem \
-ioport:peb:slot3 speechadapter -ioport:peb:slot4 horizon -ioport:peb:slot8 hfdc \
-ioport:peb:slot8:hfdc:h1 generic -hard1 myharddisk.hd -flop1 myfloppyimage.dsk
Example 5
P-Code system, external 32K memory expansion, TI floppy controller, one drive, Editor/Filer inserted from folder C:\prg\mame\disks\UCSD
#!/bin/bash
cd ~/mame
./mame ti99_4a -ioport peb -ioport:peb:slot2 32kmem \
-ioport:peb:slot3 pcode -ioport:peb:slot8 tifdc \
-flop1 disks\UCSD\ucsd_pascal_editor_filer_1.dsk
Note: You must turn on the P-Code card in the DIP switches menu of the On-screen display (OSD). The card is turned off by default because it immediately takes over control on start.
Example 6
Geneve, Horizon RAMDisk, Speech, RS232, HFDC, one hard disk
#!/bin/bash
cd ~/mame
./mame geneve -peb:slot4 horizon -peb:slot5 speechadapter \
-peb:slot6 tirs232 -peb:slot8 hfdc \
-ioport:peb:slot8:hfdc:h1 generic -hard1 myharddisk.hd
- Details
- Category: Setup
I will give some hints for installing MAME on a Raspberry Pi 4.
Keep in mind that MAME requires a lot of performance from the CPU. As shown in the Requirements section, you will need at least a Raspberry Pi 4.
Running MAME
MAME is dynamically linked against some libraries which may not be installed on your machine.
The following commands have been tested on a fresh installation. After installing, you should be able to run MAME. (Please report if you find a different situation.)
Raspberry Pi OS
Debian version 11 (bullseye)
sudo apt install libsdl2-ttf-2.0-0
more to follow