A 6502 breadboard computer boots into its own language—and makes room for assembly

6502, homebrew, dflat

This is the read-only HTML version. For the full Visual Space experience, open the app.

6502 breadboard computer — Ima

6502 breadboard computer — Ima

Source: 6502 Homebrew Computer on breadboard on Hackaday.io · 6502Nerd

Retrocomputing, interpreters

6502Nerd’s homebrew pairs a 5.36 MHz processor with video, sound and SD storage, but its defining feature is dflat: a custom structured BASIC. An inline assembler shares the interpreter’s variables while sidestepping its 128-token limit.

👍 1

A homebrew computer becomes a different kind of project when you can switch it on and start writing programs without another machine. That’s the goal behind 6502Nerd’s 6502 breadboard computer on Hackaday.io: a self-contained machine with a keyboard, display, sound, storage and a programming language called dflat. The hardware supplies the capabilities; the custom interpreter makes them accessible from the command line.

This is a long-running hobby build, not a new launch. The project page was created on May 13, 2015, and its May 2022 overview update reports a real-time clock and FAT16 file timestamps. Across the dated notes, the interesting progression is from getting a processor to execute code to making a computer that can host useful programming work of its own.

The language makes the hardware usable

The listed configuration centers on a WDC 65C02 running at 5.36 MHz, with 128 KB of SRAM, 64 KB of EEPROM and banked memory to work around the processor’s 64 KB address space. A TMS9918-family video processor has its own 16 KB of memory. Two 65C22 interface chips connect peripherals including an AY-3-8910 sound chip, SD storage and a BBC Micro keyboard interface. The machine lives in a modified BBC Micro case.

But a parts list doesn’t explain what it feels like to program. For that, the dflat language notes, posted in December 2015 and updated in September 2016, give a clearer picture. Dflat uses integer arithmetic, procedures with parameters, arrays and structured conditionals and loops. Line numbers organize the editor’s stored lines rather than serving as destinations for program flow. Execution can begin by calling a procedure from the command line.

The interpreter also exposes video and sound. That matters because the alternative is repeatedly writing low-level peripheral routines before getting to the program you actually wanted to make.

There was a practical test of the language early on. In a May 30, 2016 programming log, 6502Nerd described a rudimentary Space Invaders-style game occupying roughly 6,500 bytes of source, reduced to about 4,500 bytes when tokenized. Writing it exposed serious bugs in how dflat saved state during procedure calls, which the creator reported fixing. A game was doing double duty: demonstrating the machine and exercising the interpreter beyond small examples.

A dot opens the door to assembly

The inline assembler is a particularly revealing design choice. Dflat stores keywords as tokens, identified by their top bit being set. That leaves space for 128 tokens—comfortable for the BASIC-like language, but awkward if dozens of 6502 instruction mnemonics must also fit.

Rather than squeeze both languages into the same table, 6502Nerd gave the assembler its own decoding path. When the first non-whitespace character is a dot, the main interpreter hands control to an assembler sub-interpreter. Assembly gets a separate parser, but shares dflat’s variable namespace. A value established in the higher-level program can therefore be used by assembly code.

Address resolution needed another accommodation. A forward reference might eventually point into zero page or require an absolute address, and those choices produce instructions of different lengths. The creator describes a three-pass approach: initially assume unknown addresses are zero-page references, resolve them on the next pass, then use a final pass to account for address shifts caused by instructions growing.

This isn’t just another way to write the same programs. The project notes describe assembly as the route to interrupt handling and precisely timed changes to video settings—work that the BASIC interpreter alone couldn’t perform with the required timing.

Each peripheral brings a software bill

The sound interface shows why this project demanded more than wiring chips together. In the June 2015 sound log, 6502Nerd explains how the AY-3-8910 is driven through a 6522 rather than connected directly to the CPU bus. Eight data lines and two control lines are consumed, and changing one sound register takes a sequence of writes to select the register, latch it and transfer its value.

There’s a useful tradeoff: the sound chip’s own I/O lines provide a place to connect an Atari-compatible joystick. The interface is slow, but joystick input is less demanding than video or serial data transfers. The log reports one joystick connected; additional controllers were only a possibility.

Storage brought another layer of work. By the May 2022 update, a DS12887 real-time clock supplied timestamps for FAT16 files. The creator describes needing bus-interface work, operating-system routines to get and set time, a boot-time clock check and filesystem timestamp handling. Even a seemingly modest feature crossed the hardware, OS and filesystem boundaries.

For anyone adapting the design, documentation is the next constraint to check. In a February 2022 reply about schematics, 6502Nerd said there wasn’t a full schematic, though block and address-decoding views existed and were intended for the gallery. This is better approached as a set of design lessons than an assumed step-by-step kit.

The strongest lesson is where to put the boundary between convenience and control. Dflat makes the machine approachable, while shared variables and an inline assembler let programs reach below that convenience when timing demands it. For a homebrew computer, that boundary can matter as much as the processor you choose.

Source: 6502 Homebrew Computer on breadboard

Hardware

3 Followers

A workshop for electronics and physical computing. Share circuits, boards, tools and prototypes; work through measurement and debugging, compare components, and document the choices that turn an idea into working hardware.

Visual Space is built for projects like this—where creators collaborate, organize goals, and grow communities around real work.