This Side of Sanity
alternate history: four bit computer

alternate history: four bit computer

The real world timeline is shown side by side with this alternate history (and marked with a gray background).

1971 The first four bit processor was the Intel 4004 (BCD), developed for a calculator. It was followed by the Intel 4040.

1974 The Texas Instruments TMS 1000 had a 4-bit CPU.

1970s and 1980s Four bit processors were common in calculators and handheld electronic games.

1984-2003 The HP Saturn was used in most Hewlett-Packard calculators between 1984 and 2003 inclusive.

2009 The Gakken GMC-4 Microcomputer was distributed in a magazine that included a speaker, battery pack, 20 key key pad, seven LEDs, seven-segment LED, and a hard reset switch. Its purpose was to teach the principles of assembly language programming. The computer had a tennis game, melody software, and two other 4bit videogames preinstalled.

continuing Four bit micro-controllers are still made for device control.

Intel 4004

“Ted Hoff and Stanley Mazor conceived Intel’s first integrated CPU, the 4004 40bit device, as a member of the MCS-4 Micro Computer Chip Set. In 1971, Federico Faggin, assisted by Masatoshi Shima, applied his expertise in silicon-gate MPS technology to squeeze the 2300 transistors of the 4004 into a low-cost 16-pin package.“ —1971: Microprocessor Integrates CPU Function onto a Single Chip

GMC-4

2009 The Gakken GMC-4 Microcomputer was distributed in a magazine that included a speaker, battery pack, 20 key key pad, seven LEDs, seven-segment LED, and a hard reset switch. Its purpose was to teach the principles of assembly language programming. The computer had a tennis game, melody software, and two other 4bit videogames preinstalled.

MatrixSynth article

James Campbell's article (includes asembly language code table

English instructions for programming the Gakken GMC-4 Microcomputer

Brendan’s Classic Microcomputer Trainer Kit Manual

Example programs (in Japanese)

gmc4cc (C Compiler for GMC-4) (in Japanese)

G4CBASIC (in Japanese)

memory map and registers

The memory and registers are organized:

00 - 4F Program Memory
50 - 5F Data Memory
6F A Register 69 A' Register
6C B Register 67 B' Register
6E Y Register 68 Y' Register
6D Z Register 66 Z' Register

All registers and memory cells are 4 bits wide.

A register is used for most calculations.

The table was created by Curtis Hoffman in a Knol on the GMC-4.

Y register is used as an offset to point into data memory. The calculated address value is Y register + 0x50.

There are 7 pre-loaded programs, which are activated by pressing RESET, the program number, RUN. Some of the programs need data to be loaded starting from address 50 first before running.

Program
Number
Program
9 Organ
B Sound Hit Game
C Whack-a-mole
D Tennis
E Timer
A Music Player
F Morse Code Generator

The table was created by Curtis Hoffman in a Knol on the GMC-4.

The GMC-4 keys are as follows:

Key Description
A SET When you enter a 2-byte address value and then press A SET, the address pointer will change to the value entered. The 2-pin LEDs will light to represent the binary value of the current address, and the 7-segment readout will then show the value of the data at that address.
INCR Increments the address pointer. If you entered a hex number for code or data, that value will be stored to memory before incrementing the address pointer.
RUN Execute. If you want to run a pre-loaded program, enter the program number and then press RUN (as given in the table above). Otherwise, select the execute mode (see table below) and then press RUN. The program will start at the current address. Normally, the sequence is:
RESET 1 RUN
RESET Resets the address pointer to 0 0. Does not affect the contents of the code or data memory
Hard Reset This is the unmarked button located beside the CPU. A hard reset sets the address pointer to 0 0 and sets memory from 00 to 6F to hex F.

The table was created by Curtis Hoffman in a Knol on the GMC-4.

Instruction
4-bit Code
Mnemonic Action Result
Flag
Detail
0 KA K->Ar 0, 1 The pressed key from the hex keypad is saved to the A register. If a key is not pressed, the Flag is set to 1, otherwise it is 0.
1 AO Ar->Op 1 The 7-segment readout displays the value currently contained in the A register.
2 CH Ar<=>Br
Yr<=>Zr
1 Exchange the contents of the A and B registers, and the Y and Z registers.
3 CY Ar<=>Yr 1 Exchange the contents of the A and Y registers.
4 AM Ar->M 1 Write the contents of the A register to data memory (memory address is 50 + Y register).
5 MA M->Ar 1 Write the contents of data memory (50 + Y register) to the A register.
6 M+ M+Ar->Ar 0, 1 Add the contents of data memory (50 + Y register) to the A register. If there is overflow, the Flag is set to 1, otherwise 0.
7 M- M-Ar->Ar 0, 1 Subtract the contents of data memory (50 + Y register) from the A register. If the result is negative, the Flag is set to 1, otherwise 0.
8 TIA [ ] [ ] -> Ar 1 Transfer immediate to the A register.
9 AIA [ ] Ar + [ ] -> Ar 0, 1 Add immediate to the A register. If there is overflow, the Flag is set to 1, otherwise 0.
A TIY [ ] [ ] -> Yr 1 Transfer immediate to the Y register.
B AIY [ ] Yr + [ ] -> Yr 0, 1 Add immediate to the Y register. If there is overflow, the Flag is set to 1, otherwise 0.
C CIA [ ] Ar != [ ] ? 0, 1 Compare immediate to the A register. If equal, Flag reset to 0, otherwise set to 1.
D CIY [ ] Yr != [ ] ? 0, 1 Compare immediate to the Y register. If equal, Flag reset to 0, otherwise set to 1.
E --- --- --- Extended code. See table below.
F JUMP [ ] [ ] 1 Jump to the immediate address if the Flag is 1, otherwise just increment the program counter. The Flag is then set to 1. Note that this is an absolute address. That is, JUMP [0] [2] will change the address pointer to hex address 0x02. You can jump both forward and backward in program space.

Extended code table.:

E0 CAL RSTO 1 Clear the 7-segment readout.
E1 CAL SETR 1 Turn on the 2-pin LED using the Y register (Y register takes the value of 0-6).
E2 CAL RSTR 1 Turn off the 2-pin LED using the Y register (Y register takes the value of 0-6).
E3 --- --- Not used.
E4 CAL CMPL 1 Complement the A register (1 <=> 0).
E5 CAL CHNG 1 Swap the A/B/Y/Z registers with A'/B'/Y'/Z'
E6 CAL SIFT 0, 1 Shift the A register right 1 bit. If the starting value is even (bit 0 = 0), set the Flag to 1, otherwise 0.
E7 CAL ENDS 1 Play the End sound.
E8 CAL ERRS 1 Play the Error sound.
E9 CAL SHTS 1 Play a short "pi" sound.
EA CAL LONS 1 Play a longer "pi-" sound.
EB CAL SUND 1 Play a note based on the value of the A register (allowed values are 1 - E).
EC CAL TIMR 1 Pause for the time calculated by (value of A register +1) * 0.1 seconds.
ED CAL DSPR 1 Set the 2-pin LEDs with the value from data memory. The data to display is as follows: the upper three bits come from memory address 5F (bits 0-2), and the lower four from memory address 5E (bits 0-3).
EE CAL DEM- 1 Subtract the value of the A register from the value in data memory. The new value is stored in data memory as a decimal. Afterwards, the Y register is decremented by 1.
EF CAL DEM+ 1 Add the value of the A register to the value in data memory. The new value is stored in memory as a decimal. If the result is overflow, data memory will be automatically adjusted. Afterwards, the Y register is decremented.

The table was created by Curtis Hoffman in a Knol on the GMC-4.

Comment from Paul Robson:

It is unclear from the original documentation from Tandy what CAL DEM- actually does. In the English translation for the GMC-4 it reads like they don't know. Having looked at Ex72 (the only one that uses CAL DEM-) in the original manual, the only way it can work is if the borrow is stored in data memory after Y is decremented e.g. it does

Memory(Y) = Memory(Y) - A, decimal adjusted
    Decrement Y
    Memory(Y) = 1 if Borrow (-ve), 0 otherwise.

The documentation for CAL DEM+ is accurate and matches Ex71 in the English manual, viz.

Memory(Y) = Memory(Y) + A, decimal adjusted
    Decrement Y
    If Carry (result >= 10) then Increment Memory(Y) NOT decimal adjusted (e.g. as a hex nibble)

Comment from Zack:

It seems that the info on E commands needing the flag set, is missing. This really confused me for a while. From the microcomputer trainer manual: "The CAL command is executed when the FLAG is 1, but not when it is 0 - just like JUMP."

Comment from Andrew Benoit:

I am just wondering if there is typo on your description of the flag operation for the KA instruction?

"If a key is pressed, the Flag is set to 1, otherwise it is 0." Isn't it the other way around, i.e. the flag is set to 0 if a key is pressed?

Comment from solder guy:

This GMC-4 is almost the same as the old Tandy / Radio Shack Science Fair Microcomputer Trainer initially released in 1976. Model 28-260

Microcomputer Trainer references:

http://heisencoder.net/2008/02/microcomputer-trainer.html

http://www.polylith.com/~brendan/ClassicComputers/Tandy/uCptrTrain.html

Music is featured to play: Yankee Doodle, Silent Night and Swanee River.

Pages 32-33 show how to play Morse Code messages.

The following chart was created by Matthew V Ball at The Microcomputer Trainer:

Main commands:

CALL commands (preceded by 'E'):

16 mnemonics, 2kilonybble ROM and 128 nybbles of RAM. Who'll ever need more than that?