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 JLCPCB.com 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)
- It has IF / ENDIF, WHILE / ENDWHILE, FN / ENDFN
- 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