Written By:

The 6502 is a classic piece of computing history. Versions of this CPU were found in everything from the Apple ][, to the Nintendo Entertainment System, and the Commodore 64. The history of the 6502 doesn’t end with video games; for the last forty years, this CPU has found its way into industrial equipment, medical devices, and everything else that doesn’t need to be redesigned every two years. Combine the longevity of the 6502 with the fact an entire generation of developers first cut their teeth on 6502 assembly, and you have the makings of a classic microprocessor that will, I’m sure, still be relevant in another forty years.

The cathedral of The 6502 is Western Design Center. For more than 35 years, WDC has been the home of 6502-related designs. Recently, WDC has been interested in the educational aspects of the 6502, with one of the VPs, [David Cramer], lending his time to an after-school club teaching opcodes.

The folks at WDC recently contacted me to see if I would give their hardware a close look, and after providing a few boards, this hardware proved to be both excellent. They’re great for educators adventurous enough to deviate from the Arduino, Processing, and Fritzing zeitgeist, and for anyone who wants to dip their toes into the world of 65xx development.

The Single Board Computers

WDC sent me the W65C02SXB and the W65c816SXB, two single board computers based on the 65C02 and the 65C816, respectively.

SBCThere are hundreds of very well-documented designs floating around the Internet for 65xx-based computers, but most of these designs have a lot in common. If you’re looking to build your own 6502-based computer, you’ll need a CPU, some RAM, and an EEPROM or Flash chip. For peripherals, you’ll be looking at the 6520 PIA, a chip that provides two eight-bit ports of I/O, the 6522 VIA a more advanced I/O chip with timers and a shift register, and maybe an 6551 ACIA communications/serial chip if you’re a purist. This is the standard compliment of chips for a 6502-based computer, and if you believe [Chuck Peddle], the 6502 wasn’t that useful without these support chips.

Both the ’02 and ‘816-based single board computers from WDC feature an ACIA, a PIA, and two VIAs – the second VIA is connected to a microUSB interface designed for WDC’s Terbium IDE (TIDE). More on TIDE in a bit. Each board also has 32kB of SRAM and a 128kB Flash chip mapped into the top 32k of memory. This is a fairly standard layout for just about every homebrew 6502 computer, but there are a few features that make this board special. Every pin you would ever need – data, address, control, and some chip selects – are available on a header running the entire length of the board. This is great if you’d like to interface an SXB with some old hardware, but the potential for creating new hardware is interesting. When I talked to [David Cramer] and [David Gray] at WDC, we speculated on what interesting hardware could be made that supports this gigantic header. The board might be too big and cumbersome for a quadcopter, but a 3D printer controller board is entirely reasonable, and would probably work very well.

The 65C816

The Western Design Center doesn’t just deal with the 6502 and its support chips. It remains the only place where you can get the 65C816, a greatly expanded CPU built on the 6502 ISA.

816The ‘816 is a very interesting chip, most famous for its use in the Apple IIgs and the Super Nintendo. With a 24-bit address bus, it supports 16 Megabytes of RAM, has 16-bit registers, and a few new instructions over the 6502. Most impressively, when you first turn a 65C816 on, it starts up in a 6502 emulation mode that is 100% compatible with the 6502 until you flip a bit in a ‘hidden’ register.

With new stack instructions and compatibility with the 65C02, you have to wonder what would have happened if the 65C816 were introduced a few years earlier. The chip was finished in 1984 in time for Apple to use it in the IIgs, and for [Bil Herd] to realize, ‘the reason to use it is because the competition is using it wasn’t going to be a successful pitch.’ A few years earlier, and this chip would have at least been considered in the initial designs of the Apple Lisa, Macintosh, the Atari ST line, and possibly even the IBM PC. It’s the greatest ‘what-ifs’ of computing history.

For the last 30 years, WDC have been the keepers of the 65C816 flame, and of course their educational offerings include a single board computer based around this chip. It is more or less identical to the W65C02SXB with PIA breakouts, VIA breakouts, and an ACIA breakout. The larger set of connectors contains all the data, address, and control lines of the XBus02 connector of the W65C02SXB, save for additional pins for the extra address lines.

Best of all, with a 65C816 development board, there’s no need to deal with the multiplexed data and address lines. Writing ‘816 code is as simple as plugging the board into your computer and mashing the keyboard; the Western Design Center has the only modern ‘816 C compiler, after all.

Terbium IDE

WDCGIF
The Sample Project for the SXBs blink a seven-segment display in a pleasing pattern

All of the WDC boards work with the Terbium IDE, the IDE packaged with the WDCTool suite. This is the interface for the compiler, linker, the editor of your choice, and a simulator. Truth be told, it’s not exactly a modern IDE – it’s Windows only, and my battle station (Win 8.1) saw the best results running in WinXP Sp2 compatibility mode.

Although TIDE is a little rough around the edges, it’s not really fair to compare this to Visual Studio or Eclipse; these high-end IDEs will always have more features and more polish than an IDE built for a single platform. Also, it’s an IDE, and being rough around the edges is the default, not an exception.

Aside from compiling and linking, TIDE also has another neat feature that’s directly applicable to the SXB boards: a simulator and debugger.

65sim
The TIDE simulator/debugger running the sample project with a seven-segment display

The addition of a simulator and debugger in TIDE is something you’re not going to get if you build your own 6502 single board computer. With the simulator and debugger, you can step into code, set breakpoints, and generally do everything you would expect to be able to do with an embedded IDE.

The sample project for the W65C02SXB was a ‘light up a seven segment display with a VIA’ tutorial, and this demonstrates the potential of the debugger; it even simulates the seven segment display with the help of a little code.

There are a few extra features in TIDE that tie into FPGA-related stuff for WDC’s soft cores for the ’02 and ‘816, but since that’s far beyond the boards I have, those buttons were left alone.

The Microcontroller Development Boards

265
The W65C265SXB – A microcontroller board based on the 65C816

WDC has not been resting on their laurels for 40 years. Their educational tools also include microcontrollers based on the 65c02 and 65c816. These are the 65C134SXB (based on the ’02, and was originally designed for life support), and the W65C265SXB (based on the 65c816).

Each of these boards feature the W65C134S or W65C256S microcontroller with 32kB of SRAM, a socket for a 32PLLC Flash ROM, one large connector that is more or less the same as their ‘full microprocessor’ counterparts, and three 10-pin connectors that are used for basic I/O, the Serial Interface Bus, and UART signals.

Although these microcontroller development boards appear very minimal – there are only four chips, a hand full of passives, and a bunch of pin headers, after all – appearances are deceiving. The microcontrollers are actually incredible pieces of engineering that really aren’t comparable to anything else on the market.

CoolTerm
The W65C265SXB ROM Monitor running in a terminal emulator

Inside both of these microcontrollers is a ROM monitor that functions just like any monitor program you’d find in an ancient computer. With this monitor, you can read and write to memory addresses, jump to addresses, and run code. All that’s needed is a USB cable, a terminal emulator (CoolTerm, Putty, a neat little Python script, or anything else that can connect to something over a serial port, 9600, 8N1) [Rod Biresch] has a great tutorial for entering opcodes into the ‘265SXB to blink an LED. Yes, it’s the most basic thing you can do with a microcontroller, but it does work, and can serve as the first stepping stone to more complex applications of an embedded 65xx ISA microcontroller.

Like their bigger brothers, they are also supported by the WDC’s own development environment, TIDE. With this, you can throw assembly or C at these little boards and they’ll chug right along.

Conclusion

There is one fairly large drawback to the single board computers from WDC – the price. The W65C02SXB and W65C816SXB go for a little under $200 USD. The microcontroller variants – the W65C134 and W65C265 knock $100 off the price of their bigger brothers. When you can get an Arduino Nano clone for $2 with free shipping, this looks insane at first glance. After thinking about it, I’m not convinced the price actually is insane.

While you can pull a 6502 out of any old computer, you’re not going to find new chips from anyone but WDC. Being in the 6502 game is a comparatively low-volume business, and for every classic microprocessor, there are thousands of ARM chips.

That being said, if you were to build a 6502 or 65816 single board computer, you’ll also need those VIAs and PIAs; again, not chips you can pick up for a dollar a piece. I’ve built a 6502-based computer, and in terms of cost, my build wasn’t very far off. If you consider the effort that goes into building your own SBC… well, what do you value your time at?

The microcontroller variants of WDC’s boards are by far their most interesting offerings. There’s a common trope in modern 6502 builds that offload nearly everything to a microcontroller, but keep the 6502 in it’s classic 40-pin DIP format. You’ve seen it done with the Propeller, with an ATMega, and with the Propeller again. The 65C134 and ~265 do this job exceptionally well, and they have a built-in monitor to get you typing in machine code fast. That’s the goal of every homebrew computer, really.

For an educational offering, WDC’s single board computers do exactly what they’re designed to do: get people learning assembly and opcodes and machine codes. There’s still a value in this, especially if you’re going to continue hacking on Arduinos and ARMs. The microcontroller boards are a great introduction to some seriously interesting hardware, and I can’t wait to see the retro/homebrew scene dig into some serious tinkering with these machines.