A DIY Retrocomputer Programmed In Pure Rust

Can you generate VGA and handle a PS/2 keyboard with a Cortex-M4 in Rust? That’s precisely what [theJPster] wanted to find out with Monotron, a 1980s style home computer programmed in pure Rust.

In order to run embedded Rust without a working operating system, some tools are necessary: an LLVM back-end for generating machine code, a target file for specifying memory sizes and other configs, and a pre-compiled libcore as a substitute for a compiler when running an operating system. Rust takes the place of C running on top of the board support package (BSP) and hardware abstraction layer (HAL), and peripheral access crates (PACs) that specify the hardware and allow the code to be portable across different chips.

The implementation generates a 800 x 600 VGA video signal at 60 Hz, displays text on a 48 character by 36 line display, displays color graphics using color lookup (stored in flash memory), and runs applications that take less than 24 KiB for all data. Monotron also generates 8-bit audio with PWM and sports a synthesizer that uses a three-channel wavetable allowing it to make sounds with square waves, sine waves, sawtooth waves, and create white noise.

So far, the Monotron has been able to work with an Atari joystick, a PS/2 keyboard, and has outputs to VGA, MIDI, SD card, and audio. Next up for the Monotron: writing a programming language (tentatively named Monotronian), adding support for Sega Megadrive pads, displaying sprites, and many more exciting developments.

17 thoughts on “A DIY Retrocomputer Programmed In Pure Rust

  1. Like most humans I am also equipped with error-correcting technology, I was able to derive the original content and I must say that this is super cool. I think the only thing I would do differently is to use an ARM Cortex M7 with double precision float support, and put native support for it in the language. Double-precision float gives you 53 bit integer arithmetic so you can use it as the only numeric type in your language. What an incredibly cool hack this is, can’t say it enough.

  2. Is that really relevant? REALLY? You don’t know what kind of things anyone else here has going on in their lives, what stresses they’re under, or any of that. Leave people alone about this kind of thing; it doesn’t contribute positively in ANY way.

    1. Yes, this is relevant. Really. In particular it is relevant when your job is writing and/or editing. If stress and other life factors that prevent you from doing your job effectively, you should take leave.

      Criticism can indeed contribute positively. If it results in better-reviewed articles, I would say that improves the site for the audience.

  3. English is not my primary language, so I commit mistakes all the time, so I don’t really care when I see mistakes here. This site is not a writing site, is a hacking site. While technical documentation should be correct, I don’t care if the article is riddled with grammatical errors, unless I read it and have no idea what it’s talking about.

    So guys, relax. If grammatically incorrect text prevents you from being able to read it, right click, inspect element, fix the mistakes, and enjoy. Or save the hassle, ignore the errors, and enjoy.

    1. Some people like to nitpick about spelling or grammar.

      In 1972 someone offered a lot of amateur radio magazines for free, and I got them. Throughout tgere were “corrections” in pen. Not always were they about spelling or obvious grammar, it seemed like he just thought things shouid be different. Clearly it bothered him to see what he thought needed fixing. I found the “corrections” distracting at the very least. I could have lived without them, probably didn’t notice the “errors”.

      That’s not to say we should be careless, but most probably can live with it, and sometimes there are external reasons for errors.

      Michael

    2. I am baffled that people here expect that 100% English is important – or should it be rather tested according to American grammar? Realistically looking at it, I assume about 80 % of the people reading this in the whole world which contains wonderful other languages might run it through google translate anyway to read it in their own language. Great project. Is there a sign somewhere stating BRITISH ENGLISH ONLY – or similar?

      1. If improving your English is your goal, you must go something else for that. A site written mostly by non-native English speakers will not help you.

        Go read something like BBC, the New York Times, or even The Onion. Don’t expect correct grammar here, it’s not the point.

  4. I never could understand why people get so bent about grammar errors. Grammar is not like math where you need to do it corectly to get a corect answer. Grammar has many ways to get a point across and does not lead to problems. Learn to relax all those who nit pick things like this. After all, grammar is nothing more than some ya-ho who decided that we should say things “this way”.

    1. The point is – when you are paid to write – there is a different expectation. This would be analogous to not getting upset when your mechanic forgets to put the oil plug back in after an oil change – its just a small thing… anyone can forget it. The difference is, its his JOB not to forget.

      ..and before everyone crucifies me for my analogy for being orders of magnitude more severe – I would argue that to a non-technical person and/or a non-native speaker – grammar is VERY important. In those cases, you can completely miss the details and misunderstand the article. Bottom line – You can’t assume the reader is going to be on exactly the same technical lever as you are.

      I’ve learned a lot from HAD articles over the years in subjects that aren’t my area of expertise – because they were well written and easy to follow. Not easy when you are tripping over poor grammar, etc.

      Shall we just start writing all articles in L33T since grammar doesn’t matter? What about in txt, OFC IKR? Brospeak rox bruh, maybe tha’d be the shizz, you get me? ;)

  5. Concerning the sentence: “The Monotron also generates…” You have kept the ‘s’ at the end of ‘generate’ but removed it in the sentence “The implemntation maps generates…”
    Why is it “generate” in the first case and “generates” in the second case?

  6. Dear “The Mog”, how nice of you to inform us about these horrible mistakes. If it weren’t for you I would not have noticed, so thanks for pointing that out.

    But seriously… this is hackaday, not spelladay. You’ve could at least made a funny remark about “rust”, that you expected this project to be using data from a tape recording or such.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.