October 21st, 2021—
The MOS Technology 6502 was one of the most popular processors of the 8-bit era. It found a home in legendary computers like the Commodore 64, Acorn Electron, BBC Micro, and Apple II. Even the NES had a custom implementation of the 6502. Because the 6502 is so well documented, it is possible for today’s enthusiasts to use it in their own homebrew computers. To enhance their DIY 6502 computer, rehsd used an Arduino to add USB mouse support.
This homebrew computer is a Ben Eater design, which rehsd modified and created a PCB to streamline. It operates like most computers from the late ’70s and early ’80s. Computers back then didn’t support USB mice — the USB standard wouldn’t even exist until 1996. Joysticks were common, but graphical user interfaces and the mice to support them were not. So rehsd had to find a way to get a USB mouse talking to his 6502 processor. They settled on an Arduino Mega as an adapter.
The mouse connects to the Arduino through a USB host shield, which lets the board read data coming from standard USB devices. The Arduino runs a sketch that polls the mouse data and then sends that data to the 6502 through the VIA (Versatile Interface Adapter). It first triggers interrupts on the VIA and then writes the mouse data to the VIA ports. Code written in assembly runs on the 6502 and reads the mouse data after the interrupts. To demonstrate the mouse, rehsd wrote a simple drawing program that would have been a hit in 1978.