Retro Lab · Microcomputer Trainer

The Microcomputer Trainer

Radio Shack's Science Fair Microcomputer Trainer (catalog 28-260, 1985) was a 4-bit computer you programmed one hex digit at a time. It had a 20-key pad, seven binary LEDs, one digit of display and a speaker. This emulator follows the original manual instruction by instruction. Load a sample, or key a program in the way you would on the real board.

Binary LEDs
6
5
4
3
2
1
0
Hex. LED
Entry · address 00
Keyboard: 0–F, Enter increment, S address set, R run, Esc reset

Shows whichever hex key you hold down. The smallest useful KA loop.

Write mnemonics like TIA 5, CAL TIMR or JUMP loop; the hex is worked out for you. Labels end with a colon, and comments start with a semicolon.

Assembles to
next instruction address pointer
  1. Pick a sample and choose Load into memory, or key one in: Reset, then a digit and Increment for each word.
  2. Press Reset, then a mode digit, then Run. Mode 1 runs, 2 runs and shows the address on the LEDs, 5 and 6 step one instruction per Increment.
  3. Reset stops the program. 9 then Run plays the built-in Electronic Organ.
  4. To look at any address, type two digits and press Address set. Registers live at 66–6F.

Instruction set

Sixteen instructions, one hex digit each, some followed by one or two operand digits. Most of them leave FLAG at 1. JUMP and CAL only act when FLAG is 1, which is how the Trainer makes decisions.

CodeMnemonicDoesFLAG after
0KAKey → A0 if a key is down, 1 if not
1AOA → display1
2CHSwap A↔B and Y↔Z1
3CYSwap A↔Y1
4AMA → M[50+Y]1
5MAM[50+Y] → A1
6M+A ← M + A1 on carry
7M−A ← M − A1 if A > M
8 nTIA nA ← n1
9 nAIA nA ← A + n1 on carry
A nTIY nY ← n1
B nAIY nY ← Y + n1 on carry
C nCIA nCompare A with n1 if not equal
D nCIY nCompare Y with n1 if not equal
E nCAL nCall a ROM routine, only if FLAG is 1see below
F h lJUMP hlGo to hl, only if FLAG is 11

CAL routines

CodeNameDoes
E0CAL RSTOBlank the display
E1CAL SETRLight binary LED number Y
E2CAL RSTRTurn off LED number Y
E3CAL INPTRead the external port (not wired here)
E4CAL CMPLA ← F − A
E5CAL CHNGSwap A, B, Y, Z with A′, B′, Y′, Z′
E6CAL SIFTA ← A ÷ 2; FLAG 1 if A was even
E7CAL ENDSEnd sound
E8CAL ERRSError sound
E9CAL SHTSShort beep
EACAL LONSLong beep
EBCAL SUNDPlay note A (1–E)
ECCAL TIMRWait (A + 1) × 0.1 s
EDCAL DSPRLEDs ← 5F (left 3) and 5E (right 4)
EECAL DEM-Decimal M − A, then Y − 1
EFCAL DEM+Decimal M + A, then Y − 1

Memory map

Program memory is 00–4F, though code may run on into data memory, 50–5F. AM, MA, M+ and M− use address 50 + Y. The registers are memory too: A at 6F, B 6C, Y 6E, Z 6D, and the spare set A′ 69, B′ 67, Y′ 68, Z′ 66.

Where this emulator guesses

The manual doesn't cover everything, so these behaviors are best guesses: