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?
Hi Giles, I have greatly enjoyed having a look at your 6502 blog. Ben Eater is inspirational and I have been busy building his 6502 breadboard kit and developing my own add-ons this year.
I particularly like your work with a keypad, it provides a simple interface with lots of ability to communicate – so I may add one to my system.
When I finished Ben’s set of hardware videos (I will do the BCD and interrupts videos later) I thought about improvements I wanted to make.
My assembly programming is very dubious requiring many iterations before programs work so my first task was to avoid the need to remove/replace the EEPROM each time I wanted to write a program.
The 6502 breadboard project has nearly everything you need to program the EEPROM in situ and as you know it is very similar to the RAM. With the address and data signals already there you just need a little bit of logic for the write operations. Ben has a video “Build an Arduino EEPROM programmer” which gives you an idea of what is required – although I didn’t use shift registers.
Simple programs can be coded by hand in an Arduino sketch then downloaded to the EEPROM, starting at 0×8000. As my programs became larger I found it easier to write a little C program to convert the output from vasm assembler to a data file which the Arduino sketch can send to the EEPROM. Life suddenly became a whole lot easier.
I also really needed to get some sort of terminal i/o. I saw on 6502.org that W65C51 ACIA chips provide a simple serial interface. Googling existing projects to do this, I (like you) came across Dirk Grappendorf’s website and was able to use his code to control the ACIA. This provided me with full terminal I/O using putty on my PC. Life got a whole lot better for me at that point.
Since then I have been spending some time practicing some simple assembler and I need to get a monitor working so that I can load a variety of programs and check what is happening on the machine – if it goes well I may even call it a memory resident operating system! Like you I am keen to try using some of Steve Wozniaks code.
Thanks for you interesting blog, I hope I have provided some ideas for “what you should do next”
Hi John,
Your project sounds fantastic! I’m going to enjoy exploring it this weekend and start a shopping list as mouser.com… lots of ideas there. Serial interface is intriguing. I’m not keen on anything that requires a ‘real’ computer to connect but if I got my hands on a modern dumb terminal like a VT-69 that could change things, although I *really* like the idea of building a machine with its own keyboard and multi-line LCD display.
best wishes
Giles
Hi Giles.
I had a look at the Vt-69, I’m not sure whether it exists or not. I haven’t made any progress on a memory-mapped display yet but I have a small screen attached now. I am using an old Raspberry PI and a 3.5″ LCD screen which runs terminal emulation. It gives me VT100 style escape codes so I have colour and character based screen formatting.