Mike's Workbench

The space between electronics and software.

Author: Mike Bakula

Bootstrap strategies

Bootstrapping, or “booting” a computer refers to the process of getting an initial program into a computer, so it can do something.  Most often, it is a small program that does one thing, which is to load a larger, more capable program into memory and run it.  Boot programs are always hardware-specific, because they have to know what the computer will do first when it starts, and have to permit the computer to access wherever the larger program is so it can be loaded.  In some cases, the boot program just does whatever task you want the computer to be doing — this is common in microcontroller applications.

If we want to bootstrap our computer, we need to find a way to work with memory that doesn’t require the computer to be running.  There are a number of ways to do this.  Early Control Data Computers literally had some memory mapped to an array of switches;

6600DeadStartPanel-

 

but that gets expensive fast, and takes up a good deal of space for not much memory.

It’s much more common to use a pre-programmed Erasable Programmable Read Only Memory (EPROM) to hold an initial program, and pre define the system setup and I/O.  This is basically the same as the switch solution above, only using much smaller transistor switches, affording a lot more memory.  The Basic Input/Output System (BIOS) in your PC is a ROM with a boot program for your processor.

27C256-25-nec-uv-erasable-eprom-28-pin-ceramic-dip-pkg-image-No

To change the program, you pull the Integrated Circuit (IC) out of the computer, erase it (usually with UV light), and write a new program using special hardware.   While an efficient solution, it doesn’t really let us play with the boot process, or see what’s going on.

Early microcomputers used a “front panel” to provide access to the memory and microprocessor.  It consisted of arrays of status LEDs and switches that afforded access to the machine’s status signals and Random Access Memory (RAM).  My favorite example of this strategy is the Altair 8800;

8800fobfront

a classic front panel.  To use it, you set the memory address and data value with the switches, then press a button to load the data into that address.  Lather, rinse repeat.  I like this approach.  It gets us direct access to memory, yet doesn’t require the microprocessor to be running.  However, it has some problems with readability, and programming individual bytes with toggle switches is really tedious.

What I want is more like what I remember from my dad’s SYM-1;

synertek_sym_1

seven-segment displays for address and data, and a hex keypad for entering values.  This is a lot easier to read, and quicker too.  But, when I dug into the manuals for the SYM-1, I discovered this functionality was due to the ROM monitor that handled the boot process, and drove  an I/O chip for keyboard and display.  It’s not really a front panel.

But it could be; all I’d have to do is work out a circuit to decode the buses and display them on the 7 segment displays, and a circuit to encode a hex keypad to set the buses, and I’d have a front panel without the pain of flipping toggles.  There will be some issues with counting and latching so each keypress goes to the right place, but I don’t see any showstoppers with the idea.  It will be more complicated than a basic front-panel, but simplicity isn’t a requirement.  That’s what we’ll do.

Begin with the end in mind

So this is another electronics blog — I’m writing this to record my progress as I develop a series of experiments to build a 6502 computer.  My goal is not to build the most efficient design, or the smallest, or to reproduce a vintage design.  Instead, I’m want to build a computer that’s easy to understand, and that allows one to learn some digital logic and computer concepts along the way.

Why the 6502?  Well because it’s one of the microprocessors I learned on, back in the day.  I actually started with the RCA 1802, but they’re now relatively difficult to find, and anyway, I’d be hard-pressed to improve on Lee Hart’s 1802 Membership Card.  Still, I learned the 6502 inside and out, first on my father’s SYM-1, then on the Apple ][.  Like the 1802, it has a reasonably small instruction set, an easy to understand programming model, and undemanding electrical needs.  Unlike the 1802, it’s still in production as a PDIP and also as a FPGA core, so it’s easy to get.

Getting a little deeper into the why, I’ve found when teaching Arduino seminars that even relatively experienced makers tend to treat the microcontroller as a black box, or in some cases a magic box.  They often don’t have a good understanding of what the microcontroller is doing, or how they can get the board to do their bidding.  In some cases, folks will buy incredibly overkill solutions, because it’s a solution they understand, when with just a little knowledge, they could build something much cheaper that would work much better.  So the idea here is to disaggregate the microcontroller, and look a little deeper into what it is made of, and how it works.  Armed with this knowledge, it should be easier to make magic, instead of appeasing it.

With the foregoing in mind, I have some requirements for my 6502 computer:

  • It must use a current production microprocessor (Western Design Center W65C02S–14).
  • It should use easy to get parts. (DigiKey, Mouser, Jameco — otherwise it’s hard to replicate.)
  • It must be bootstrappable.  (It shouldn’t require an EPROM programmer.)
  • The RAM should be preserved with a supercap.  (Cribbing from Lee Hart on this one!)
  • It should use 7-segment displays and a hex keypad for initial I/O, (LEDs and switches are too painful.)
  • It must be built up as a series of small projects. (for positive reinforcement and to explore concepts.)

Since the goal is to explore concepts, high performance and small size are not requirements.  My computer will probably use more chips than an optimized design might, but it should be easy to understand, and the subassemblies will often be able to do things before they are integrated into the computer.  This is going to be a development blog, so things may end up out of order, or a problem may get solved more than once as my ideas (and knowledge) develop.

I’m sure more requirements and design assumptions will emerge as I go through this, but that’s enough to get started.  It seems to me that the most unique part of this design is how to bootstrap a 6502, so we’ll start with the display and hex keypad…

Hello world!

The first program you write in any new system is usually something that prints “Hello World!”  In microprocessor systems, your “hello world” is often blinking an LED.  Here, it’s apparently a blog post!

© 2017 Mike's Workbench

Theme by Anders NorenUp ↑