Brendan's Classic Microcomputer Trainer Quick Reference

Go back to Brendan's Microcomputer Trainer page.

Since writing the document below, note that another author has also written Programming the Gakken GMC-4 Microcomputer, which may also be useful.

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.

The TMS1100 also has the following nybble-sized registers: It also has a single bit multi-purpose condition code FLAG that can be used to detect results of arithmetic and comparison operations and then conditionally perform subsequent operations such as JUMP.

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.


Entering Data

  1. Press RESET.
  2. Observe binary LED readout for current address, 7-segment for current data nybble stored at that address.
  3. Press hexadecimal (0-F) key if an update to the value stored at that address is required.
  4. Press INCR to store the data and update the address pointer to the next nybble.
  5. Return to step 2.

Program Execution

Single-Step Execution Modes

Run Execution Modes


Machine Code Instructions

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.

Operand Subroutine Mnemonic Description
0 RSTO - ReSeT port 0 Turns off the 7-segment hexadecimal display.
1 SETR - SET port R Illuminates single binary LED selected by the Y register.
2 RSTR - ReSeT port R Turns off single binary LED selected by the Y register.
3 Unused Unused
4 CMPL - CoMPLement Complement all bits in the value stored in the A register. In other words, bitwise invert the A register or subtract the A register from hexadecimal F.
5 CHNG - exCHaNGe registers Swaps the contents of the A, B, Y, and Z registers with the A', B', Y', and Z' registers, respectively.
6 SIFT - ShIFT Shifts the nybble stored in the A register to the right one bit position and places a 0 in the most significant bit of the A register. The least significant bit of the original value of the A register is inverted and becomes the FLAG. That is, if the least significant bit of the A register was 0 then the FLAG will be set to 1. If the least significant bit of the A register was 1 then the FLAG will be cleared to 0.
7 ENDS - END Sound Plays an "end" sound.
8 ERRS - ERRor Sound Plays an "error" sound.
9 SHTS - SHorT Sound Emit short sound (relative to the length of the sound play by LONS).
A LONS - LONg Sound Emit long sound (relative to the length of the sound played by SHTS).
B SUND - SoUND Plays the note associated with the value stored in the A register. See "Accessing the Built-In Programs - Electronic Organ" for the note associated with these values.
C TIMR Pauses execution for 100 * (A register + 1) milliseconds.
D DSPR - DiSPlay on port R. Displays values stored in memory locations $5E and $5F to the binary LEDs. Note that the most significant bit of $5E will not be displayed because only 7 LEDs are present.
E DEM- - DEcimal conversion of M- Subtracts the decimal value of the A register from the decimal value contained in the memory address $50 plus the offset specified in the Y register and stores that result in the memory address $50 plus the offset specified by the Y register. After the operation, the Y register is decremented by 1.
F DEM+ - DEcimal convesion of M+ Adds the decimal value contained in the memory address $50 plus the offset specified in the Y register to the decimal value contained in the A register and stores that result in the memory address $50 plus the offset specified in the Y register. If the nybble addition operation results in a carry, then 1 is added to the value in the memory address $50 plus the offset specified in the Y register minus 1. After the operation, the Y register is decremented by 1.
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.

Accessing the Built-In Programs

RESET 9 RUN: Electronic Organ - live play

RESET A RUN: Electronic Organ Playback from Memory

RESET B RUN: Musical Guessing Game

RESET C RUN: "Rat Bashing" Game

RESET D RUN: Tennis Game

RESET [minutes] INCR [tens-of-seconds] INCR [ones-of-seconds] INCR E RUN: Countdown Timer

RESET F INCR [morse code data INCR]... RESET F RUN: Morse Code Pattern Playback


Go back to the Microcomputer Trainer page.
Go to my home page.
Go to the polylith.com home page.
brendan@polylith.com