CARDIAC
Code
  CARDboard Illustrative Aid to Computation…
- …folded cardboard “computer”
- …teaches how computers work
- …originated from Bell Laboratories in 1969
- Instruction manual (Internet Archive, CC-0)
- Cf. article, Brian L. Stuart
Print out (Johan Von Konow, CC-BY-NC-SA)…

Components…
- CPU section
- …sliders for….
- …input
- …accumulator sign
- …instruction digits
 
 
- …sliders for….
- Memory section
- …slider for output
- …100 memory locations
- …cardboard ladybug (aka program counter)
 
Architecture
Control unit …three part cycle
- …fetch instruction to the instruction register (IR)
- …increment program counter (PC)
- …execute instruction register
Accumulator…
- …4-digit number (overflow for numbers > 999)
- ALU (arithmetic logic unit) supports…
- …addition
- …subtraction
- …decimal shifting (left/right)
 
- …test for sign-negative or -positive
Memory…
- …location stores a signed three-digit decimal number
- …locations identified by numbers 00through99- …00always contains the value001
- …99always contains a value between 800 and 899
 
- …
I/0…
- …card reader (input) and a card writer (output)
- …hold exactly one signed three-digit number
- …read by way of the INPinstruction

Instructions
Identified by an opcode (operation code)
| Opcode | Mnemonic | Description | 
|---|---|---|
| 0 | INP | read input …store to memory location | 
| 1 | CLA | load content from memory location to accumulator | 
| 2 | ADD | add accumulator to memory location …store to accumulator | 
| 3 | TAC | acc. negative …operand address to PC …otherwise next instruction | 
| 4 | SFT | shift accumulator | 
| 5 | OUT | write content of memory location to output | 
| 6 | STO | copy accumulator content to memory location | 
| 7 | SUB | subtract content of memory location from accumulator | 
| 8 | JMP | copy PC to address 99…copy operand address to PC | 
| 9 | HRS | halt (stop machine) …reset PC | 
- …mnemonic abbreviations
- Oxx…three-digit decimal numerals (non-negative)- …opcode Oleft most digit
- …xx..lower order digits …address/memory location
 
- …opcode 
Anatomy of opcode decoding…
  ┌──── opcode (here for instruction INP)
  │
  034   ➡  read from input and store content to memory location 34
   ││
   └┴── address (here memory location 34)  ┌──── opcode (here for instruction ADD)
  │
  235   ➡  add content from memory location 35 to accumulator
   ││
   └┴── address (here memory location 35)Program
Simple addition of two numbers…
Line   Opcode    Description
──────────────────────────────
01     034       read input A
02     035       read input B
03     134       load input A to accumulator
04     235       add B to accumulator ...sum S in accumulator
05     636       store S
06     536       print S
07     900       halt