Twenty years ago, if you wanted an LCD for a project, you’d probably end up with something salvaged from a mobile phone or an HD44780 character display. These days, little OLEDs can be had for a few bucks and they’ve taken the maker world by storm. [Anders Nielsen] has recently been experimenting with driving these displays from the vintage 6502 CPU, and he’s even got scrolling operation down pat.
The best part is that [Nielsen] is doing all this on a single-board computer running his own assembly code. That’s right – there’s no compilers here. It’s bare metal coding at it’s best. The build uses a 6507 chip running at 1 MHz, paired with a 6532 RIOT and just 128 bytes of RAM—a similar setup to the Atari 2600.
The video explains how the code stacks up and drives the display, achieving the scrolling effect. It makes a huge difference to usability, especially compared to chunking pages at a time to the postage stamp-sized screen. He demonstrates a legitimate usage case too, using the setup as a serial terminal for a Raspberry Pi.
The 6502 architecture still looms large in the collective consciousness; we’ve been talking about programming it in assembly for years. Video after the break.
Video on other websites disabled
Bummer!
I’ll just fix that!
Thanks for the write up @HaD!
Back around 1995 I built a little box with a 6502, 6522, 6116 2K RAM, 2716 2K EPROM, 74LS74, 74LS04 and 74LS42. I used a couple of transistors for a RS-232 level converter, 4 MHz Crystal oscillator, a Hitachi 2×16 LCD display and a solid state relay.
The purpose of my box was to monitor our USENET feed which was via a Telebit 23K bit/S modem into an AT&T 3B1. From there, the feed was distributed to Vaxes and HP 9000s. The problem was that the 3B1 would occasionally lock up when humans weren’t around to reboot it. The purpose of my box was to power cycle the 3B1 if no serial port activity was seen for 10 minutes. I only used about half the ROM, so I added temperature monitoring capability with an op-amp and thermistor. I did the project on breadboard first add then wire wrap for the final device.
I developed my code on a PC-AT clone machine running MS-DOS with a nice cross-assembler I found on the Simtel-20 CD called TASM for table-driven assembler. TASM could generate Intel hex file output for several different CPUs and microcontrollers. I burned the EPROMs on a JDR Microdevices programmer on the same AT clone. I also had a Heathkit EPROM eraser.
I probably could have used a Z80 and Zilog PIA with one less TTL glue part. I just happened to have a 6502 but not a Z80 in my stock. I had written assembly for both Cromemco and Apple systems, so I would have been happy with either CPU.
I’m a bit puzzled that 6502 seems to be a more popular retro CPU now because the Z80 is easier to use, with just a single phase clock. To be honest, I got satisfied back when those CPUs weren’t retro. I would much rather use an Arduino or an ESP-32 Dev Board now. I just did a little project for fun on a Lilygo ESP-32 board with a little on-board color LCD to make a triggered sweep oscilloscope in about 300 lines of code using the Arduino IDE. A hotshot coder could probably written more compact code – I’m more hardware oriented.
The project shown in the article above is cool because it bright back some vintage recollections. Thanks.
I think the fascination with the 6502 CPU, at least for me, is the CHANCE of me actually understanding whats happening. I will definitely be building Ben Eater’s 8 Bit TTL computer and 6502 Breadboard Computer. I have a KIM-1 clone on the way as well. I’m pretty dumb when it comes to programming (besides Basic and Ladder Logic).
Great to see a homebrew computer that’s not just composite output or serial.
My 6502 sbc can do composite and svideo, has 128k of ram, a co processor using an atmega8515 or 644, ay8910 or 8930 with another 16bit of gpio and sound upgrade over co10444d and better digital audio playback
Atmega should run stable at 21.47727mhz it’s on its max boundaries
Makes it 18x time faster than 6502, 6 times faster than co10444d, so every cpu tick, 18 instructions can be done on atmega and every color clock, 6 instructions can be done, can use eeprom as lut and create an antic style display list, and incorporate sound and memory management, also flash and ram available in those chips.
Only downside is my design requires bus tri stating so using a 6502 requires some extra logic to tri state data and addresses, so using a Sally 6502 from atari 8bit would make life easier, but you can really get those new.
Also my sbc would be completely compatible with 2k and 4k atari cartridges, 8k and over would have to be remapped, since 6502 actually has interrupts and a13 thru a15, and has actual ram blocks
A12 thru a15 are decoded using a 74hc139 and some gates to provide the needed control logic and chip selection lines
With ay chip, 16bit of gpio cam be used for ram, serial or parallel port, or any expansion really
Cool! What does it look like? :)
I wonder why he chose 1MHz instead of a faster modern version.
You can’t get a modern version in DIP-28. Could get a PLCC but that would look weird :)
You can’t get a 6532 either and that doesn’t have a faster version.
An STM32 is also wildly superior to a WDC65C02.. but neither has the same instruction set as an NMOS 6502. I like the 70s design better than the 80s remake.
Buying new is wasteful when there are so many recycled to be had – and the recycled ones are cheaper too.
Those are the main reasons :)
Thanks! Great work by the way. I cut my teeth 40 years ago coding my Apple //e in assembly. I was fascinated with making music on the Apple, which consisted of poking the audio port very rapidly to make notes with PWM. I had to be sure the inner loop was very fast and that every path took the same number of cycles. A faster clock than 1 MHz would have been very nice to have. I wonder if a modern chip like the W65C02 would have the same cycle counts for each instruction, though.
Good luck on all your projects!
Actually going back over my designs
I think 8502 is a much much better choice, downside is they don’t make em, so more expensive than a 6502 or 65c02, if i actually wanted to resell it….
8502 would remove tri-state logic needed for both data and addresses lines, gives a 7 bit gpio builtin so reduces bankswitch glue logic
If only there was a cpld or fpga gate level version….
65c02 would work though I’d have to use rdy and some gates to give a halt input, but 65c02 can be halted on rising or falling edge, and r/w is irrelevant, but illegal opcodes are different, but I don’t think most 4k atari vcs roms use em…. and goes up to 14mhz too. And I think they internally have tri-state
So I can even gate the clock and have a software turbo mode, compatibility mode boots as a vcs, then trigger and write a few addresses no 4k atari rom will ever do, boom 128k ram, ay8910, an atmega display controller for dma, cpu now clocks at 3.579545mhz instead of only 1.19mhz
Normally I’d get about 76 cpu cycles per scanline, per 228 cycles of the C010444d
Now I get 228 cycles of cpu, with 228 of color clock, so 3 times more per frame, the atmega gets 1,368 cycles per scanline at 6x times the graphics clock.
Fast enough to draw display, play a few notes on ay and tia, and then shuffle ram blocks and gpio around.