Thursday, April 5, 2012

Nostalgic Musing on CPUs

The first processor I learned was the 6502 on an Ohio Scientific Superboard computer. My main resource for learning was the book Programming a Microcomputer: 6502 by Caxton Foster, which was written for the KIM-1 computer but was pretty generic. I wrote a disassembler, a simple assembler, and some games. Later I got an Apple //e and did some more 6502 programming with it, along with BASIC, and Pascal.

Ohio Scientific Superboard

I used a 6800 in university and at a summer job at the university working on an embedded data acquisition system. The graduate student writing the code had no source code, he just typed in the bytes and burned them into an EEPROM! I adapted my disassembler in BASIC from the 6502 to the 6800 to disassemble the EEPROMs and make a hardcopy of the code.

At school I also used a 6800 cross-assembler on a minicomputer for labs on a small KIM-1 like single board computer. I remember it had a minor bug - it assembled the NOP instruction wrong! In a CS course I did a little assembler programming on a mainframe that had 60 bit words - I believe it was a CDC Cyber.

When I started working in the mid 80's I worked on developing equipment for manufacturing testing. It was all custom and used Motorola processors. It started with the 6800 but mostly used 6809 for new development by that time. The 6809 was a big improvement over the 6800 having more registers and addressing modes. You had 16-bit registers and could write position independent code. It could even do an 8-bit multiply! I spent many hours programming EEPROMs or waiting for them to be erased under an ultra violet light so I could test my latest version of code.

Then the 68000 came out and it was an embarrassment of riches to have 16 32-bit registers and a MOVE instruction that could move from anywhere to anywhere. It ran at a blazing 8MHz! I didn't actually do much assembler programming on the 68000 because by then we were mostly using higher level languages like C and Pascal (and a language called Concurrent Euclid that you probably haven't heard of). 

I still have a soft spot in my heart for the 6502 as all the programming I did on it was done for fun. It was the first processor I learned, and it has an elegant simplicity to it.

Actually, I wasn't entirely correct when I said I first learned the 6502. Some time when I was under 10 years old my father introduced me to the CARDIAC computer: CARDboard Illustrative Aid to Computation.  The short book and cardboard model was a hypothetical processor that taught how processors work at the fundamental level. It was a simple CPU with 10 instructions and the student used the cardboard model to execute instructions in a program himself. Copies of the booklet and computer are available on the Internet. Even the original cardboard CARDIAC is still available.

Cardiac Computer
Accompanying Booklet

I remember at the time I found it hard to resolve the wide gap between this explanation of a computer with what I saw in the media, such as the robot in Lost In Space or computer on Star Trek. I was also given a book called The How And Why Wonder Book Of Robots And Electronic Brains that probably set some unrealistic expectations about computers too.


On my to do list is to write a simulator for the CARDIAC, probably graphical in C++ using the Qt toolkit.

No comments: