This blog is about any and all things related to the MOS 6502 microprocessor. The author Carl Gundel is a software engineer by trade and author of the popular Liberty BASIC and Run BASIC languages.
For the web: Run BASIC
For Windows: Liberty BASIC
Visit the 6502 Shack group on Facebook!
I hope my readers will indulge me while a take a quick detour into one of my favorite things; Programmable calculators.
As a gentle prologue to machine language programming I don't think you can do better than one of the old programmable calculators. In my youth the very first thing I learned to program was my father's HP-67 calculator. I still have one today. Me and my brother Ernie both had TI-57 calculators and we had a good time with these, trying to cram something interesting into 49 steps of program memory. ;-)
My personal HP-67.
If you look at the Commodore MOS KIM-1 it sort of looks like a giant calculator.
The HP-67 is a small computer, and like the KIM-1 it even has its own permanent program storage in a form of a magnetic card reader. It has it's own language that resembles assembly language, but it is like an assembly language with training wheels.
Like the assembly language coder, the HP-67 programmer needs to deal with registers, with conserving space, with storing and retrieving values. Many ideas are represented. There is even a way to jump indirectly using a value in a register.
Here is some 6502 assembly code:
For comparison here is some HP-67 code.
The user is insulated from certain kinds of problems such as programs accidentally overwriting themselves because the programs can only change values in the registers. So there is program memory (224 instructions) and there is data memory (26 registers).
The programmer is also introduced to LIFO stack concepts.
The quality of documentation that came with these calculators put programming within the reach of most people.
Microchess is the first game ever published for a home computer back in the 1970s. It was written for the Commodore MOS KIM-1 single board computer by Peter Jennings (no, not that Peter Jennings!) and when you bought a copy all you got was a manual with the machine code listing in hexadecimal. To play you needed to punch those numbers in by hand. Yes, really! The good news was that the KIM-1 had a cassette interface. ;-)
I found the assembly language source code online! Yay!
Back in the day, when I used to write business software for the Apple II computer (and the IBM PC, let's forget I said that) we used to use the Applesoft BASIC Compiler from Microsoft.
Typically I would print out the program listing, or part of it. Go away and mark it up, planning what I was going to do next. Then I would sit down and make my edits using the Applesoft interpreter and run the compiler.
This was a disk-based compiler, before microcomputers had enough memory to hold the code, the compiler and everything else in memory. That meant that the compile was really, really slow.
So when you start the compiler it reads a line of code and displays it on the screen, and then you hear the floppy drive do its grinding sounds. Rrrrr, rrrr, rrrrrrrr, rr. Swish, swish, swish. Repeat.
Each line of code was 3 or 4 seconds to compile, and when it was finally done with that it had to do a second pass to finish compiling.
It took a half hour to compile the code. I can't say I really minded so much because this was an ideal time for some coffee and cookies (Keebler fudge covered cookies). Or I would watch TV with my boss and we would talk politics.
Then once the program was compiled it would get tested, and the cycle would repeat.
Arguably the MOS 6502 processor was really no better than Motorola 6800 that was its direct predecessor, and why would you buy the most important part of your computer from a calculator chip company like MOS Technologies instead of a more stable company like Motorola?
The answer is clear. $25 The 6502 was merely 1/6th the cost of a Motorola 6800.
Think about it. Without this low price, Steve Wozniak would not have produced the Apple I and Apple II computers as we know them, and Commodore could not have produced the PET, VIC-20, C64, etc. The Atari VCS and Nintendo NES would never have existed.
The home computer market would have evolved more slowly and in a completely different direction.
When I was a kid, single board computers had real appeal as a low cost way into computing, at least until the VIC-20 and the Sinclair ZX80 appeared in the market.
For one thing if you were into electronics, these things had serious nerd appeal. You could buy these things as kits to solder together, and you got to see the parts in all their glory.
The Commodore MOS KIM-1 is claimed to be the very first commercially available single board computer. I think it's amazing that they actually sold a lot of these, but why should I be surprised? Today people are buying these sorts of things all the time, for example the Arduino and the BASIC Stamp can certainly be compared to the KIM-1, and these are well known.
The KIM-1 inspired a whole range of imitators and evolutionary descendants. For example, the RCA COSMAC VIP and ELF boards; the 6502 based Synertek SYM-1, and even trainers such as the Radio Shack Science Fair Microprocessor Trainer and the famous Heathkit ET-3400. Perhaps the Heathkit H-8 also qualifies for this category.
So, let's sing a little praise for the unsung Commodore KIM-1 computer!
This amazing list of machines (scavenged from Wikipedia) are all 6502 based because they are all clones (or ripoffs) of the Apple II computer design.
Correct me if I'm wrong, but I don't remember any clones being made of the Commodore 64 or the Atari 8-bit line of computers.
Abacus Portable AES easy3 Agat Agat-4 Agat-7 Agat-8 Agat-9 Albert AMI II Apco Arrow 1000 Asem AM 64e Aton II Ap II AVT-2 Base 48, Base 64, Base 64A Basis 108, Basis 208 Bee II Bimex BOSS-1 CCE Exato Pró Citron II CSC Euro Super Cubic 88 CB-777 Elppa II Energy Control Formosa Microcomputer Formula II kit ("Fully compatible with Apple II+") Franklin Ace Fugu Elite 5 General 64 Golden II Iris 8 IMKO 2 InterTek System IV ITT 2020 (Europlus) Ivel Z3 Laser 128 Laser 3000 Marta kompjuteri Mackintosh MCP MC 4000 Mango II Medfly Microcraft Craft II Plus Microdigital TK-2000 Color (not 100% binary-compatible) Microdigital TK-2000 II Color (not 100% binary-compatible) Microdigital TK-3000 IIe - Page in Portuguese Microdigital TK-3000 //e Compact Microengenho Multitech Microprofessor II (MPF II) Microprofessor III (MPF III) MicroSCI Havac Microcom IIe Mind II Multi-system computer O. S. Micro Systems Orange Panasia Peach Pearcom Pravetz series 8 Pravetz 8A Pravetz 8M Pravetz 8E Pravetz 8C Precision Echo Phase II Pineapple RX-8800 Sekon (computer) Shuttle (computer) Space 83 Spiral II (available in Canada) Spring Spectrum ED Syscom 2 TK 8000 TMS Vela (TMS means Troyes Micro Service) UNITRON AP II Unitronics Sonic VECTORIO (Japan?) Wombat Zeus 2001