TMS9900 Assembly Programming for the TI-99/4A


The TI-99 was pretty much the only computer to use the TMS9900, just like the Cpu itself, the TI-99 wasn't designed like most computers - with almost all it's ram as VRAM - it actually uses VRAM to store basic programs (which is not as fast as 'proper' memory!!)

Specs:

TI-99 4A
Cpu 3mhz TMS9900
Ram 256 bytes! (32k ram upgrade option)
Vram 16k
GPU TMS9918A
Resolution 160x144
Max Tiles 256 (8x8 px) - 360 onscreen
Max Sprites 40 (8x8 px 10 per line)
Colors 4
Sound chip TMS9919

TI-4A

ChibiAkumas Tutorials

Lesson H1 - Hello World on the TI-99

Lesson P1 - Bitmap graphics on the TI-99
Lesson P2 - Joystick and Key Reading on the TI-99 with the CRU
Lesson P3- Sound with the TMS9919 on the TI-99

Useful Documents

1602000-9701_TM990_100M_Users_Guide_Dec78 - See Page 4-01 onward

TI Memory Map

Address  Details
>0000 Console / ROM / OS / GPL Interpreter / BASIC Interpreter
>2000 �Low� Ram Expansion (8k of 32k)
>4000 Device Service Routines
>7000 Cartridge ROM / Page Flip
>8000 RAM Memory Mapped Devices - VDP,GROM, SOUND, SPEECH.
>8000 CPU Memory 256 byte block
>8400 Sound Chip
>8800 VDP Data Read
>8802 VDP Status Read
>8C00 VDP DATA Write
>8C02 VDP Address Write
>9000 Speech Read
>9400 Speech Write
>9800 GROM Data Read
>9802 GROM Address Read
>9C00 GROM Data Write
>9C02 GROM Address Write
>A000 High Ram Expansion (24k of 32k)

TI VDP Memory Map

Address 
Details
>0000 Screen Image
>0300 Sprite Attrib
>0380 Color Table
>0400 Sprite Descriptor
>0780 Sprite Motion
>0800 Pattern Generator
>1000 Free Space
>3500 Disk DSRs

TI Default Charset

The Character set has no lowercase characters.

TI Key Map

To select a column of the Keymap we use CRU Address 0024h, we can then read in from the address 0006h
We can read a whole column into R4 with ST R4,8
We can test a single bit with TB n - where n is the bit (offset from 0006h) to test 


CRU Address Col 0 Col 1 Col 2 Col 3 Col 4 Col 5 Col 6 Col 7
0006h = . , M N / J1-Fire J2-Fire
0008h space L K J H ; J1-Right J2-Right
000Ah enter O I U Y P J1-Left J2-Left
000Ch
9 8 7 6 0 J1-Down J2-Down
000Eh fctn 2 3 4 5 1 J1-Up J2-Up
0010h shift S D F G A

0012h ctrl W E R T Q

0014h
X C V B Z



Sound on the TI99

The TMS9919 uses memory mapped port 8400h for its sound control... This port takes a single byte of data - except for tones which take 2 bytes
The data we send is in the format below:


Bits
Command Bit Details  7  6  5  4  3  2  1  0
Format Template L=Latch C=Channel T=Type XXXX=Data L C C T D D D D










Tone - Command 1/2 C=Channel L=tone Low data 1 C C 0 L L L L
Tone - Command 2/2 H= High tone data (Higher numbers = lower tone) 0 - H H H H H H
Volume C=Channel (0-2)  V=Volume (15=silent 0=max) 1 C C 1 V V V V
Noise Channel (Channel 3)  M=Noise mode (1=white) R=Rate (3=use tone 2) 1 1 1 0 - M R R