Back when I was 7 years old, I wanted to buy a TRS-80 Color Computer, but my dad wanted to make sure that I was committed to programming before spending the $100 -- so he bought me a Science Fair "Microcomputer Trainer" and wanted me to learn to program that first. After I attempts to read the book with my second grade (or was it first?) reading level, I finally managed to do a little programming, but I ended up destroying the system by shorting the clock out with my fingers. My dad was satisfied and bought me the CoCo for Christmas later that year, and I've been programming ever since...
The
microcomputer trainer used a simple 4-bit processor with 16 hexadecimal buttons, 4 control buttons, 7 LEDS, a 7 segment HEX LED, and a speaker. The CPU was a Texas Instruments TMS1100, which was based on the Speak and Spell's TMS1000.
I downloaded a copy of the
manual here. The primary goal was to teach machine language programming to a young audience.
My question is whether it's possible to teach kids machine language in today's world by using a similar device. If so, what changes would be necessary to keep enough interest to teach a little bit about machine language and pointers? I think a small instruction set would be appropriate, but how small could you make it and still be Turing complete, and still make it fun to use?
To get the ideas started, here is the instruction set for the Microcomputer Trainer:
Main commands:
- 0: KA = "Key into Ar" - If a key is pressed, then set Ar to key value and set flag to 0; else set flag to 1.
- 1: AO = "A Output" - Displays contents of Ar on HEX LED and sets flag to 1.
- 2: CH = "exChange" - Exchanges the contents of Ar with Br, exchanges Zr with Yr, and sets flag to 1.
- 3: CY = "exChange Ar with Yr" - Exchanges the contents of Yr and Ar
- 4: AM = "Ar to Memory" - Moves contents of Ar to the memory location indicated by following nibble and sets flag to 1.
- 5: MA = "Memory to Ar" - Moves contents of memory indicated by following nibble into Ar and sets flag to 1.
- 6: M+ = "Memory +" - Adds contents of memory pointed to by Yr to Ar, stores the result in Ar, and sets flag to 1 if there is a carry.
- 7: M- = "Memory -" - Subtracts the contents of Ar from the memory location pointed to by Yr and stores the result in Ar. If an underflow occurs, flag is set to 1.
- 8: TIA = "Transfer Immediate into Ar" - Moves following nibble into Ar and sets flag to 1.
- 9: AIA = "Add Immediate into Ar"- Adds following nibble into Ar and sets flag to 1 if there is a carry.
- A: TIY = "Transfer Immediate into Yr" - Moves following nibble into Yr and sets flag to 1.
- B: AIY = "Add Immediate into Yr" - Adds following nibble into Yr and sets flag to 1 if there is a carry.
- C: CIA = "Compare Immediate to Ar" - Sets flag to zero if Ar equals following nibble; else sets flag to 1.
- D: CIY = "Compare Immediate to Yr" - Sets flag to zero if Yr equals following nibble; else sets flag to 1.
- E: CAL = "Call" - Execute extended command (see below) if flag is set to 1 in previous command; else do nothing.
- F: JUMP = "Jump" - If flag is 1, jump to byte address in following 2 nibbles; else do nothing
CALL commands (preceded by 'E'):
- E0: RSTO = "Reset port O" - Turns off the HEX LED.
- E1: SETR = "Set LED" - Sets LED according to number indicated by Yr (0-6)
- E2: RSTR = "Clear LED" -Clears the LED according to number indicated by Yr (0-6).
- E3: Not Used
- E4: CMPL = "Complement" - Replaces Ar with its ones-complement (i.e. result of F - Ar)
- E5: CHNG = "Change registers" - Exchanges Ar, Br, Yr & Zr with Ar', Br', Yr' & Zr'.
- E6: SIFT = "Shift" - Shifts the contents of Ar one bit to the right and sets the flag to the opposite of the least significant bit of Ar before shifting.
- E7: ENDS = "End Sound" - Emits an 'end' sound
- E8: ERRS = "Error" - Emits an 'error' sound
- E9: SHTS = "Short Sound" - Emits a 'blip' through the speakers
- EA: LONS = "Long Sound' - Emits a long sound through the speakers
- EB: SUND = "Sound" - Emits a note according to value in Ar (0 = no sound, 1 = la, 2 = ti, 3 = do, ... E = sol, F = no sound)
- EC: TIMR = "Timer" - Pauses for the following number of seconds: seconds = (Ar + 1) / 10
- ED: DSPR = "Display on port R" - Displays contents of memory locations E and F in binary on the 7 LEDs. Memory F contains the right-most 4 LEDs and memory E contains the leftmost 3 LEDs.
- EE: DEM- = "Decimal conversion of M- result" - similar to DEM+, but subtracts instead of adds.
- EF: DEM+ = "Decimal conversion of M+ result" - Adds together the decimal contents of Ar and the pointed address to give a decimal answer and stores that answer at the pointed address. If there is a carry, 1 is added to the pointed address less 1. After the command has been executed, the pointer is left pointer one address below the pointed address (If the number to be added is in 54, the answer is put in 54 and the pointer is reduced by 3. If there is a carry, one is added to 53)