The Radio Shack Science Fair Microcomputer Trainer (and Gakken GMC-4 clone/remake) is a 4-bit Texas Instruments TMS1100 CPU with builtin RAM and a custom mask ROM running at 400kHz. This same CPU was also used in the Microvision battery-powered portable game system as well as a number of other handheld devices from the 1980s, such as the Merlin.
The TMS1100 has the following memory map. Each memory location stores a single 4-bit value.
Note that the Science Fair Microcomputer Trainer has little or no keyboard debounce. It is common to accidentally issue multiple keypresses. This is mostly a problem with the INCR button. If this happens, RESET and INCR through memory, checking data entry.
4-bit (nybble) Opcode | Mnemonic | RTL Pseudocode | Addressing Mode | Sets FLAG to | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | KA - Keyboard to A | keyboard -> Ar | Inherent | 0 or 1 | KA is a non-blocking check of whether any of the keys 0-9 or A-F are pressed. If a key is being pressed at the time this instruction is executed, the FLAG is cleared to 0 and the value of the key is stored in register A. If no key is being pressed at the time this instruction is executed, then the FLAG is set to 1. | |||||||||||||||||||||||||||||||||||||||||||||||||||
1 | AO - A to Output port 0 (7-segment LED) | Ar -> output port 0 | Inherent | 1 | AO outputs the value in the A register to the output port connected to the 7-segment hexadecimal display. | |||||||||||||||||||||||||||||||||||||||||||||||||||
2 | CH - exCHange A with B and X with Y | Ar <-> Br, Yr <-> Zr | Inherent | 1 | CH exchanges the contents of the A register with the B register at the same time as the X register is exchanged with the Y register. In other words, the values in A and B are swapped and the values in X and Y are swapped. | |||||||||||||||||||||||||||||||||||||||||||||||||||
3 | CY - exChange Y with A | Ar <-> Yr | Inherent | 1 | CY exchanges the contents of the A register with the Y register. In other words, the values in A and Y are swapped. | |||||||||||||||||||||||||||||||||||||||||||||||||||
4 | AM - A to Memory | Ar -> M[$50 + Yr] | Indexed | 1 | AM copies the value in the A register into memory address pointed to by $50 plus the offset specified in the Y register. | |||||||||||||||||||||||||||||||||||||||||||||||||||
5 | MA - Memory to A | M[$50 + Yr] -> A | Indexed | 1 | MA copies the value contained in the memory address $50 plus the offset specified in the Y register to the A register. | |||||||||||||||||||||||||||||||||||||||||||||||||||
6 | M+ - Memory Add | M[$50 + Yr] + Ar -> Ar | Indexed | 0 or 1 | M+ adds the value contained in the memory address $50 plus the offset specified in the Y register to the A
register and stores that result in the A register. If the nybble addition operation results in a carry, then
the FLAG is set to 1. Otherwise the FLAG is set to 0.
When a JUMP or CAL operation immediately follows the M+ command, the JUMP or CAL will be executed if and only if the FLAG is 1. |
|||||||||||||||||||||||||||||||||||||||||||||||||||
7 | M- - Memory Subtract | M[$50 + Yr] - Ar -> Ar | Indexed | 0 or 1 | M- subtracts the value in the A register from the value in memory indexed by the Y register and stores that
result in the A register. If the nybble subtraction results in an underflow (that is,
the value from memory is smaller than the value in the A register), then the FLAG is set to 1. Otherwise the
FLAG is set to 0. (Note that this operation is considered to be unsigned.)
When a JUMP or CAL operation immediately follows the M- command, the JUMP or CAL will be executed if and only if the FLAG is 1. |
|||||||||||||||||||||||||||||||||||||||||||||||||||
8 | TIA - Transfer (Immediate) Into A | operand -> Ar | Immediate | 1 | TIA copies the nybble stored in the address following this opcode into the A register. | |||||||||||||||||||||||||||||||||||||||||||||||||||
9 | AIA - Add (Immediate) Into A | Ar + operand -> Ar | Immediate | 0 or 1 | AIA adds the nybble value stored in the address immediately following this opcode to the value already in the A register and stores that result in the A register. If the nybble addition operation results in bit 4 (the 5th bit) being set (a CARRY result), then the FLAG will be set to 1. Otherwise, the FLAG will be set to 0. | |||||||||||||||||||||||||||||||||||||||||||||||||||
A | TIY - Transfer (Immediate) Into Y | operand -> Yr | Immediate | 1 | TIY copies the nybble stored in the address following this opcode into the Y register. | |||||||||||||||||||||||||||||||||||||||||||||||||||
B | AIY - Add (Immediate) Into Y | Yr + operand -> Yr | Immediate | 0 or 1 | AIY adds the nybble value stored in the address immediately following this opcode to the value already in the Y register and stores that result in the Y register. | |||||||||||||||||||||||||||||||||||||||||||||||||||
C | CIA - Compare Immediate to A | Ar == operand? | Immediate | 0 or 1 | CIA compares the value in the A register against that of the operand immediately following this opcode. If they are equal to each other, then the FLAG is cleared to 0. Otherwise the FLAG is set to 1. | |||||||||||||||||||||||||||||||||||||||||||||||||||
D | CIY - Compare Immedate to Y | Yr == operand? | Immediate | 0 or 1 | CIY compares the value in the Y register against that of the operand immediately following this opcode. If they are equal to each other, then the FLAG is cleared to 0. Otherwise the FLAG is set to 1. | |||||||||||||||||||||||||||||||||||||||||||||||||||
E | CAL - CALl subroutine | Immediate | 1 (except for SIFT) | CAL calls the subroutine specified in the nybble stored in the address immediately following this opcode.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
F | JUMP - JUMP to address | operands -> program counter | Immediate | 1 | JUMP causes program execution to move to the 2-nybble address following this opcode. The first of these two address nybbles is the most significant, and the second one is the least significant. |