DRM65, a 6502 computer in a FPGA
SIMRETRO FPGA board (green) connected to a
programming board (red), and to a VGA monitor
DRM65 is the design of a complete 8-bit
computer in a FPGA board. It was more or less inspired by David Murray's
"8-bit Dream Computer", but I'm not a big fan of Commodore, so this is a
quite different (and a lot cheaper) design with these guidelines:
- Simple hardware without legacy, hard to get, parts. It is integrated
inside the FPGA and all signals are 3.3V
- VGA monitor, PS2 keyboard, and PWM audio for human interface. SPI
flash and/or SD card for storage.
- It should run BASIC.
The FPGA board was designed by Angel Díaz
(tutored by Jesús Arias) to emulate these kind of computers and includes:
- An ICE40HX4K FPGA from Lattice with 7680 logic cells (not 3520, as
stated in the family data sheet)
- An SPI flash memory for FPGA configuration and storage (N25Q64 from
Micron mounted)
- A 64K x 16 bit SRAM
- VGA interface, 4-bit (16 levels) for each color component
- PS2 keyboard interface
- Joystick interface
- Single-bit audio, with power amplifier. Capable of PWM modulation.
- SD card connector (uses SPI mode)
- USB micro-b connector for power input (and, maybe, also for USB
device/host interface someday)
- Serial port (through programming connector)
An additional board was designed in order to program the SPI flash
contents, to upload bitstreams to the FPGA directly, and to provide a
serial port to the main FPGA board. This board isn't needed after the SPI
flash is programmed.
The DRM65 in turn includes:
- A 6502 core designed by Arlet Ottens running at 25MHz.
- A video controller with:
- a 512 x 400, 1 bit per pixel graphic mode
- a 256 x 200, 4 bit per pixel graphic mode
- a 16 x 12 palette table.
- An internal 8KB memory for boot code
- A 7-page MMU (page size: 8KB) for the translation of virtual 64KB
spaces into a physical 128KB memory
- A PS2 keyboard interface
- A 115200 bps UART interface
- PWM audio (31250 Samples/s, 8-bit samples)
- Interrupts on UART RX, UART TX, keyboard scan code, video line,
video frame, and single-step execution.
The contents of the internal memory are
loaded along the FPGA configuration bitstream. This startup code has the
following features:
- Interrupt-driven keyboard and serial port drivers.
- Full 6502 disassembler and debugger. Invoked by typing
<crtl>-C in the serial port or <ctrl>-V in the keyboard.
- Two text modes for the 512 x 400 video mode: 64 and 85 columns
- 42 column for the 256 x 200 video mode
- Fixed address jump table for I/O routines and graphics.
- Can load programs via serial port or from the SPI flash.
Some applications were also developed for
this computer, including:
- EH-Basic port from the Lee Davison's source. (No graphics, poke and
peek them if needed ;) interrupt with <ctrl>-X )
- Picture display and sound playing form SPI flash
- A DOS-command-like file explorer for SD cards (limited to non SD-HC
cards with FAT-16)
- A Tetris game compiled form C sources with cc65
And here are some screenshots of these
programs running:
- Selecting files to load from SPI flash:
- Disassembler / Debugger (85 column text):
- EH-Basic program changing the border index:
- ...And the palette entry assigned to the border:
- Monochrome mode showing the two text fonts (64 and 85 columns):
- Mandelbrot set (Basic code) with
grey-scale and default palettes: