VGA from a Cortex-M4, written in pure Rust

Similar projects worth following
I wanted to make a 1980s style home computer using an inexpensive Cortex-M4 devkit. Can you generate VGA from this board? In colour? How about handle a PS/2 keyboard? Load applications? Let the user write BASIC programs? Generate audio?

More importantly, can you do all this in pure Embedded Rust, with no C or C++ in sight?

Can you display VGA and play audio on a Cortex-M4 in pure Rust? The short answer is yes, yes you can! Minus the hand-unrolled assembler loop for fixing the phase error in the RGB output. But we don't talk about that in polite company.

The rev 0.7 Monotron PCB is now here! I got five from to test out the idea. So far, I've shown that:

  • The Atari Joystick interface works, but two Joysticks would be more fun
  • The PS/2 Keyboard via the Atmega works, but the pinout was mirrored so you have to put the connector under the PCB :/
  • The RTC works
  • VGA Output works
  • The MIDI Out seems to work when looped to MIDI In, as does the MIDI Though.
  • The MIDI In seems to receive data when connected to my electronic drum kit
  • The Audio output seems to work quite nicely
  • The SD card works, but the power supply can't handle hot-insertion of the SD card and it makes the TM4C reboot. More capacitors / some current limiting probably required.

I can load games and programs from the SD card into the 24 KiB of free Application RAM. You can interact with these games via the PS/2 Keyboard and Joystick. I can play simple games (like Snake) and play three channels of 8-bit wavetable audio simultaneously. I've even got a 6502 Emulator running a copy of 6502 Enhanced BASIC, if you want to go old school!

The TODO list includes:

  • Revising the PCB layout
    • Lose the 5V barrel jack - there's potential for problems if the USB is connected at the same time
    • Get the parallel port working
    • Add some mounting holes!
    • Add a second Joystick port
    • Add support for Sega Megadrive pads (which multiplex more than 8 signals on the 9 pin connector)
    • Find a way of leaving the Atmega reset as a reset pin, while still driving all 18 pins on the parallel port
    • Add an ICSP header for the Atmega
  • Write a programming language!
    • It's call Monotronian (for now)
    • It allows line editing like BASIC
    • It parses / tokenises each line as entered and only stores tokens to save RAM
    • It can render tokens back to text when you LIST
    • It has fewer magic keywords (like BASIC's INPUT) and instead has more functions (like C or Python)
    • Functions take named parameters
    • Scalar values are Integer, Float, String, and Char
    • Collections include Array and HashMap
    • APIs for Sound, Joystick, I/O, Text and Graphics
    • Can LOAD and SAVE like BASIC, but to SD card
    • PC version for testing / debugging
    • All written in pure Rust
  • More games and demos!
    • Can we squeeze a MOD tracker into 24 KiB?
    • Use custom font as background tiles
    • Can we do a sprite as well as the text?
    • Write a MIDI synthesiser and/or sequencer you can plug a MIDI keyboard into
    • Write a MIDI player so you can play tunes on a Roland MT32 or similar
    • Write a text editor that can edit files much larger than RAM, using a swap-file on the SD card


Rev 0.7 CC-BY-SA 4.0

Adobe Portable Document Format - 1.12 MB - 04/08/2019 at 19:32



Rev 0.7 CC-BY-SA 4.0

Adobe Portable Document Format - 217.71 kB - 04/08/2019 at 19:32


  • 1 × Tiva-C EK-TM4C123GXL Launchpad
  • 1 × AtMega 328
  • 2 × 33n Capacitor
  • 7 × 100n Capacitor
  • 3 × 5-pin 180 degree DIN

View all 31 components

View project log

Enjoy this project?



Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates