I recently achieved my goal of making a 1970s-style 6502 breadboard computer that I can use to practice machine code programming. It has a hexadecimal keypad for entering instructions, a 16×2 alphanumeric LCD display and a very basic monitor program that allows me to enter programs up to 256 bytes in length and run them.
So it’s time to take stock and consider what next…
Practice my coding
There’s a lot I can do with this computer to learn more about 6502 machine code. There are stacks of books and websites to mine, from classics like Programming the 6502 by Rodnay Zaks, to helpful blogs like this one and this interactive one.
Improve the monitor
- The Apple 1 computer had an amazingly compact monitor program written by Steve Wozniak, usually called ‘wozmon’ – the source code is available and it’ll be instructional to dig into it and see how it works. Straight away, for example, I saw he’d used logical shifts instead of rotates – if I’d done that I’d never have had the carry bug that was corrupting my display of hexadecimal numbers.
- I could also make improvements to the ROM to make displaying text easier. At the moment you have to load the ASCII value of the character you want to show into the accumulator and call a subroutine. There’s almost certainly a better way of doing this. I could make it easier to write text across two lines, for example.
- I don’t want a full assembler or typewrite keyboard, but I do have a lot of spare shift-keys, so it might be fun to put frequently used opcodes as shortcuts on some spare keys, Sinclair ZX81/Spectrum-style.
- It might be useful to use the second line of the monitor display to show the contents of key registers and status flags.
- Add some way of making it easier to include keypad input in user-entered programs. This needs some thought and maybe a fundamental redesign of my monitor. At the moment the monitor sits in the ROM and pressing a key triggers an IRQ which updates the monitor display. Pressing GO (shift-A) jumps to memory location $0300 and starts executing any user-entered program. You can drop out of the user-entered program and back to the monitor with an RTI instruction. I guess looking at wozmon or even the Kim-1 monitor program might be instructive.
- Allow longer programs perhaps, but will I ever really want to type more than 256 opcodes by hand? (See note below on adding, or not adding, storage).
You know nothing of future time, and yet in my teeming circuitry I can navigate the infinite delta streams of future possibility and see that there must one day come a computer whose merest operational parameters I am not worthy to calculate, but which it will be my destiny eventually to design.
The Deep Thought computer in The Hitch-Hiker’s Guide to the Galaxy by Douglas Adams, Series 1, Fit the Fourth.
Improve the hardware
I could rewire the LCD and redesign the monitor code to drive it in 4-bit mode to free up 4 more I/O pins on the VIA, but I’m not sure what I’d actually use them for. I think I’m going to keep this machine pretty much as it is, so no video output, no storage device, no serial access, no BASIC interpreter… but perhaps design and build a second machine. This will have a full keyboard, BASIC and rather than a video output, a wide LCD display and maybe even a thermal printer in an Aim-65 style. I’d decided this and then discovered this amazing project, which is very close to what I want to build.
I’m keen to keep it broadly sympathetic to 70s/80s tech, so I’d like to avoid any microcontrollers that are more powerful than the 6502 itself… but what do you think I should do next?