6502 Watch

Introduction

The 6502 has been around for just about 40 years, yet still powers the hearts of many electrical systems in place today, such as many micro-controllers and embedded systems. In fact, WDC still manufactures the 6502 and 65xx series chips under the 65c02 and 65cxx. I’ve noticed that WDC also introduced more package variants of the 6502 and 6522, such as PLCC and QFP. Another thing I noticed was the fact that these form factors of the 65c02 are almost never used. Given that the only people buying these are hobbyists, that isn’t too surprising, as they don’t offer much over the standard 40 pin DIP. What they do offer, however, is small package size. I went off to try and design the smallest 6502 SBC i could, and was pleasantly surprised with the results. What I ended up with was what i think is the smallest hobbyist 6502 SBC produced. Small enough, in fact, that you could easily wear it on your wrist! I then added the neat little Nokia 5110 LCD and a cool interface, and now have what I believe to be the only 6502-driven watch in existence.

Hardware

The watch is pretty standard as far as 6502 hardware goes:

  • 65c02 running @ 8MHz
  • 65c22 VIA (controls LCD, keyboard, and buttons)
  • Nokia 5110 LCD (84×48, bitmap only)
  • 32k SRAM
  • 16k ROM
  • C64 Keyboard Connector
The front face of the PCB. The connector along the top fits a CBM-style keyboard from a VIC-20 or C64.

Probably the strangest bit there is the full size C64 keyboard connector along the top of the watch. I wanted to have some sort of physical interface for grabbing character data, since the point of the watch would be mostly ruined by it needing to be tethered to a serial port at all times. The simplest way to do this is to use some preexisting matrix keyboard and wire it to a parallel port, which is what I ended up doing.

The back face of the PCB. In the top left is the circuitry for charging the optional Li-Po battery (which on this board is absent). Bottom right is the RTC and watch crystal that provide the clock functionality to the watch.

The part that ties everything together is really the tiny Nokia LCD. It’s interfaced through SPI, which i had to bit-bang through the 6522 VIA. The VIA also interfaces with the keyboard, and the face buttons. An interesting thing to note here is that the VIA only has 16 i/o pins, which in this case are all needed to interface just with the keyboard alone. I was able to use some of those pins for both the keyboard and the LCD without causing any sort of corruption with a bit of luck, and a lot more trial and error.

The fully assembled watch running Tetris.

Software

The watch has a few different things on its ROM. The primary thing is G’Mon, a machine monitor i wrote for the 6502. It  supports viewing memory in single and batch, depositing memory in single or batch, jumping to programs, filling blocks of memory with a pattern byte, and moving blocks of memory. I had to strip a few of the less useful commands out in order to fit it on the ROM with everything else. The secondary thing on there is Lee Davidson’s Enhanced Basic. I was just barely able to fit into the ROM with everything else, like there are only around 100 bytes free. EhBasic has been modified to hook into the watch’s main code, but other than that it’s a completely normal version of EhBasic!

The thing that greets you when you start up the watch is the watch interface. Clever name, i know. It just provides a graphical menu you can move through to select what you want to run. This is the only place where the face buttons are actually used, at least on purpose. The topmost button is what brings up the menu. Interesting bit about that: its connected directly to the NMI pin on the 6502, so it can be used to get back to the watch menu from almost anywhere on the thing (unless you crash the 6502).

In my sources, there is a big blob of code that handles interfacing with the watch hardware; It’s called the kernel there, but its less of a kernel and more of a library everything else references. Some of the more interesting things in there are the SPI bit-banging stuff for the LCD, and the matrix scanning and decoding routine for the keyboard.

Speaking of sources, they are all uploaded on here, of course. All the assembler code is written to be assembled using KickAssembler, and makes quite heavy use of its macro capabilities, so i doubt it would be fun to try and assemble with anything else. Here i have also included the EhBasic sources that i have modified; They have been modified to be assembled with KickAssembler. Everything builds at the same time, just run the ./Compile.sh script and it will spit out a ROM image. If for some reason you feel the need to fiddle with it, then make sure to go to Configuration.asm: That’s the header that holds a bunch of the miscellaneous variables, like the location of the ROM in memory.

If you every wanted to run the software yourself, then you can do that as well. If you set the Emulated variable in the config file to true, then it will build a ROM for use with Symon.

Other Software Toys

I have written a few extra programs to show what the hardware itself can do. The first thing is a little sprite demo that has 8 animated software sprites bouncing around the screen, plus a text scroller along the top. The visibility is quite poor with it, as the LCD sure does take its time with updating the pixels, which causes everything moving to be a little blurry. To combat this I had to wait a bit after each frame for the LCD to update, which means that the demo itself runs a little slower than it actually could on the hardware. A video of this demo in action is in the Demos section.

Did i mention it runs Tetris? Because yea, it sure does. I wrote a version of Tetris for the watch not long after realizing it was probably the only practical thing that it could feasibly do. Its a pretty standard Tetris clone, following pretty much all of the mechanics of the original versions. This means having the scoring system, having the progressive levels, all the tetrominoes, etc. Its controlled using the face buttons, using the navigation buttons as left & right, the center button as rotate, and the NMI button as the drop button. At the moment I don’t have actual recordings of Tetris running on the watch, mostly because i am too lazy to do that much work for a project that was finished nearly 2 and a half years as of this write-up, but i do have the graphics assets i made for it, and have put them together into what it looks like while. If you don’t believe that I wrote Tetris for it, then don’t worry, just take a look at the sources that i have included with the project’s main downloads.

Some Demos

This is a little demo i made to test the graphical capabilities of the watch. It implements 8 fully animated moveable sprites bouncing around a play-field with a scrollertext running across the top.
This clip shows the main watch OS. The watch menu is accessible at any time (via NMI) by hitting the menu button on the left hand side of the watch. From there you can drop into your choice of either Enhanced BASIC or G’Mon.

Schematics

Schematics and boards were laid out using KiCad. The watch board is 3×1.5 inches in size and double sided. The board uses all SMD parts except for the PLCC socket, keyboard connector, and LCD connector.

The Rest

This project is quite old now; I finished it late 2017 and am only now getting to documenting it. So it would be no surprise to hear that i have stopped working on it. I don’t plan on supporting any of the hardware here, so if you decide for whatever reason that you want a 6502 watch as well, then you are on your own. If you find any of the software interesting though, then I’m all ears for questions; I haven’t written 6502 assembly in a few years now but still know these sources in and out.

Leave a Reply

Your email address will not be published. Required fields are marked *