# TI-990

The TI-990 was a series of 16-bit minicomputers sold by Texas Instruments (TI) in the 1970s and 1980s. The TI-990 was a replacement for TI's earlier minicomputer systems, the TI-960 and the TI-980. It had several unique features, and was easier to program than its predecessors.
Among its core concepts was the ability to support multiprogramming using a software-switchable set of processor registers that allowed it to perform rapid context switches between programs. This was enabled through the use of register values stored in main memory that could be swapped by changing a single pointer.
TI later implemented the TI-990 in a single chip, the TMS9900, one of the first 16-bit microprocessors. Intended for use in low-end models of the TI-990, it retained the 990's memory-to-memory architecture. This chip was widely used in the TI-99/4A home computer, where details of its minicomputer-style memory model presented significant disadvantages.

## Features
### Workspaces

On the TI-990, registers are stored in memory and are referred to through a hardware register called the Workspace Pointer. The concept behind the workspace is that main memory was based on the new semiconductor RAM chips that TI had developed and ran at the same speed as the CPU. This meant that it didn't matter if the "registers" were real registers in the CPU or stored in memory. When the Workspace Pointer is loaded with a memory address, that address is the origin of the registers.
There are only three hardware registers in the 990: the Workspace Pointer (WP), the Program Counter (PC) and the Status register (ST). A context switch entailed the saving and restoring of only the hardware registers.

### Extended operation

The TI-990 had a facility to allow extended operations through the use of plug in hardware. If the hardware is not present the CPU traps to allow software to perform the function. The operation code (XOP) allowed for 15 attached devices on a system. Although, device 15 was reserved in TI's operating systems for the Supervisor Call (SVC), through which user programs requested I/O and other operating systems services.
On the 990/12, the XOP instruction could run microcode from the machine's Writable Control Store.

### Orthogonal instruction set

The TI-990 used a fairly orthogonal instruction set. The instruction formats allowed for one, two and three word instructions. The model 990/12 CPU allowed for a four word instruction with the extended mode operations.

## Architectural details
### General register addressing modes

(R is a general register, 0 to 15.)
    0. Register - the value is to or from a register: OPR R ; R contains operand
    1. Indirect register - the register contains the address of the operand: OPR *R ; R points to operand
    2. Indexed: OPR @MEM(R); R contains index value (offset in bytes) to add to address MEM. R0 is not used in indexing and allows direct memory addressing
    3. Indirect Autoincrement: OPR *R+ ; R contains address of operand. Later, increment R by the length of the operand type
Several registers had defined purposes in many instructions. These are:
* R0 - shift counter, extended mode counter, Floating point Accumulator (FAC) most significant word
* R1 - FAC+2 (single precision)
* R2 - FAC+4 (double precision)
* R3 - FAC+6 (double precision)
* R11 - return linkage, or pointer to operand of XOP (privileged mode)
* R12 - CRU base address (privileged mode)
* R13 - Saved Workspace Pointer
* R14 - Saved Program Counter
* R15 - Saved Status Register

### TI-990 instructions

The 990/4, 990/5, 990/9 instruction sets consisted of 69 instructions, the 990/10 had 72 instructions, the 990/10A had 77 instructions and the 990/12 had 144 instructions.
The instructions are grouped according to which addressing modes and how many operands they accept. A group is defined by the layout of bit-fields within the instruction word. The leftmost bits of the instruction word are sufficient to identify its group.
The first field of the word specifies the operation to be performed, the remaining two fields provide information for locating the operands.
* MOV (move word)
* MOVB (move byte)
* A (add word)
* AB (add byte)
* S (subtract word)
* SB (subtract byte)
* C (compare word)
* CB (compare byte)
* SZC (set zeros corresponding word)
* SZCB (set zeros corresponding byte)
* SOC (set ones corresponding word)
* SOCB (set ones corresponding byte)
The first field of the word specifies the operation to be performed, the second field is a relative offset to where to go, for JMP instructions, or the relative offset for CRU bit addressing.
* JMP (jump unconditionally)
* JLT (jump if less than zero)
* JLE (jump if less than or equal to zero)
* JEQ (jump if zero)
* JHE (jump if logically greater than or equal to zero)
* JGT (jump if greater than zero)
* JNE (jump if not equal zero)
* JNC (jump if carry clear)
* JOC (jump if carry set)
* JNO (jump if overflow clear)
* JOP (jump if odd parity - only relevant after byte operations)
* JL (jump if logically less than zero)
* JH (jump if logically greater than zero)
* SBO (set CRU bit to one)
* SBZ (set CRU bit to zero)
* TB (test CRU bit)
The first field of the word specifies the operation, the second field provides the register, the third field provides information for locating the second operand.
* COC (compare ones corresponding)
* CZC (compare zeros corresponding)
* XOR (exclusive or)
* XOP (extended operation)
The first field of the word specifies the operation to be performed, the second field is the bit width of the operation, the third field provides information for locating the second operand.
* LDCR (load CRU)
* STCR (store CRU)
The first field of the word specifies the operation to be performed, the second field is the shift count, the third field specifies the register to shift.
* SRA (shift right arithmetic)
* SRL (shift right logical)
* SLA (shift left arithmetic)
* SRC (shift right circular)
The first field specifies the operation to be performed, the second field provides information for locating the second operand.
* BLWP (branch and load workspace pointer)
* B (branch)
* X (execute)
* CLR (clear word)
* NEG (twos complement negate)
* INV (ones complement)
* INC (increment)
* INCT (increment by two)
* DEC (decrement)
* DECT (decrement by two)
* BL (branch and link)
* ABS (absolute value)
* SWPB (swap bytes)
* SETO (set word to ones)
* LDS (long distance source, 990/10, 990/10A, 990/12)
* LDD (long distance destination, 990/10, 990/10A, 990/12)
* BIND (branch indirect, 990/10A, 990/12)
* MPYS (multiply signed, 990/10A, 990/12)
* DIVS (divide signed, 990/10A, 990/12)
* AR (add real, 990/12)
* CIR (convert integer to real, 990/12)
* SR (subtract real, 990/12)
* MR (multiply real, 990/12)
* DR (divide real, 990/12)
* LR (load real, 990/12)
* STR (store real, 990/12)
* AD (add double, 990/12)
* CID (convert integer to double, 990/12)
* SD (subtract double, 990/12)
* MD (multiply double, 990/12)
* DD (divide double, 990/12)
* LD (load double, 990/12)
* STD (store double, 990/12)
The word specified the operation to be performed.
* IDLE (cpu idle)
* RSET (cpu reset)
* RTWP (return workspace pointer)
* CKON (clock on)
* CKOF (clock off)
* LREX (load ROM and execute)
* EMD (execute micro diagnostic, 990/12)
* EINT (enable interrupt, 990/12)
* DINT (disable interrupt, 990/12)
* CRI (convert real to integer, 990/12)
* CDI (convert double to integer, 990/12)
* NEGR (negate real, 990/12)
* NEGD (negate double, 990/12)
* CRE (convert real to extended integer, 990/12)
* CDE (convert double to extended integer, 990/12)
* CER (convert extended integer to real, 990/12)
* CED (convert extended integer to double, 990/12)
* XIT (exit floating point, 990/12)
The first field specifies the operation, the second field specifies the register if applicable. The third field, if applicable, specifies an immediate operand in a second word.
* LIMI (load interrupt mask immediate)
* LI (load immediate)
* AI (add immediate)
* ANDI (and immediate)
* ORI (or immediate)
* CI (compare immediate)
* STWP (store workspace pointer)
* STST (store status)
* LWPI (load workspace pointer immediate)
* BLSK (branch immediate push link onto stack, 990/12)
The first field of the word specifies the operation, the second field provides the register, the third field provides information for locating the second operand.
* MPY (unsigned multiply)
* DIV (unsigned divide)
The first field specifies the operation, the second field specifies the map file (0=kernel, 1=user) and the third field specifies a register with an address.
The given map file is loaded with 6 words from the address in the register.
This instruction was supported on the 990/10A and 990/12, or the 990/10 with memory-map option installed.
* LMF (load map file)
The first word is the opcode; in the second word, the first field is the byte count field, the second field is the destination operand and the third field is the source operand. These instructions are supported on the 990/12.
* NRM (normalize)
* RTO (right test for ones)
* LTO (left test for ones)
* CNTO (count ones)
* BDC (binary to decimal conversion)
* DBC (decimal to binary conversion)
* SWPM (swap multiple)
* XORM (xor multiple)
* ORM (or multiple)
* ANDM (and multiple)
* SM (subtract multiple)
* AM (add multiple)
The multiple precision instructions allowed for logic and integer arithmetic on operands from 1-15 bytes long. *SM and *AM were supported on the 990/10A.
The first field of the first word is the opcode, the second field of the first word indicates a checkpoint register; the first field of the second word is the byte count field, the second field is the destination operand and the third field is the source operand. These instructions were supported on the 990/12.
* SNEB (search string for not equal byte)
* CRC (cyclic redundancy code calculation)
* TS (translate string)
* CS (compare string)
* SEQB (search string for equal byte)
* MOVS (move string)
* MVSR (move string reversed)
* MVSK (move string from stack)
* POPS (pop string from stack)
* PSHS (push string to stack)
The first word is the opcode; in the second word, the first field is the byte count field, the second field is the shift count and the third field is the source operand. These instructions are supported on the 990/12 and 990/10A.
* SRAM (shift right arithmetic multiple)
* SLAM (shift left arithmetic multiple)
The first word is the opcode; the first field of the second word is the position field and the second field is the source operand. These instructions were supported on the 990/12.
* TMB (test memory bit)
* TCMB (test and clear memory bit)
* TSMB (test and set memory bit)
The first field of the first word is the opcode, the second field of the first word indicates a width; the first field of the second word is the position, the second field is the source operand. This instruction supported on the 990/12.
* IOF (invert order of field)
The first field of the first word is the opcode, the second field of the first word indicates a width; the first field of the second word is the position, the second field is the destination operand and the third field is the source operand. These instructions supported on the 990/12.
* INSF (insert field)
* XV (extract value)
* XF (extract field)
The first word is the opcode; the first field of the second word is the value field and the second field is the register and the third field is the relative offset. These instructions supported on the 990/12.
* SRJ (subtract value from register and jump)
* ARJ (add value to register and jump)
The first field of the word is the opcode and the second field is the register specification. These instructions supported on the 990/12.
* STPC (store PC in register)
* LIM (load interrupt mask from register)
* LST (load status register)
* LWP (load workspace pointer)
* LCS (load control store)
The first word is the opcode; the first field of the second word is the destination operand and the second field is the source operand. This instruction supported on the 990/12.
* MOVA (move address)
The first word is the opcode; the first field of the second word is the condition code field, the second field is the destination operand and the third field is the source operand. These instructions supported on the 990/12.
* SLSL (search list logical address)
* SLSP (search list physical address)
The first field of the first word is the opcode, the second field of the first word specifies the destination length; the first field of the second word specifies the source length, the second field is the destination operand and the third field is the source operand. This instruction is only supported on the 990/12.
* EP (extend precision)

## Assembly Language Programming Example

A complete "Hello, world!" program in TI-990 assembler, to run under DX10:
This program can be run on a TI-990 simulator, such as Dave Pitts's "sim990", which emulates the TI-990 and includes software kits for native operating systems (including DX10).
The following program is a standalone version that prints on the serial terminal connected to CRU address 0. It illustrates the CRU I/O and workspace linkage for the PRINT subroutine.

## TI-990 models

The TI-990 processors fell into several natural groups depending on the original design upon which they are based and which I/O bus they used.
All models supported the Communications Register Unit (CRU) which is a serial bit addressable I/O bus. Also, supported on higher end models was the TILINE I/O bus which is similar to DEC's popular UNIBUS. The TILINE also supported a master/slave relationship that allowed multiple CPU boards in a common chassis with arbitration control.

### TILINE/CRU models

The following models used the TILINE as their principal mass storage bus:
* TI-990/5 — TMS9900 microprocessor with 64 KB of memory
* TI-990/10 — TTL processor with memory mapping support to 2 MB of ECC memory
* TI-990/10A — TMS-99000 microprocessor with memory mapping support to 1 MB of memory
* TI-990/12 — Schottky TTL processor with memory mapping to 2 MB of ECC Memory, workspace caching, hardware floating point, extended mode instructions and writeable control store

### CRU only models

The following models used the CRU as their principal bus:
* TI-990/4 — TMS9900 microprocessor with 56 KB of memory
* TI-990/9 — The original TTL implementation

## Operating systems

Several operating systems were available for the TI-990
From TI:
* TX990/TXDS
* DX10
* DNOS Distributed Network Operating System
From third parties:
* UCSD Pascal

## Sources

* 990 Computer Family Systems Handbook
* 990 Assembler Reference Manual