# LC-3 VM Mojo Implementation

**URL:** <https://forum.modular.com/t/lc-3-vm-mojo-implementation/3327>\
**Category:** Community Showcase\
**Created:** [July 15, 2026, 12:58pm UTC](https://forum.modular.com/t/lc-3-vm-mojo-implementation/3327 "2026-07-15T12:58:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![TylerHillery](https://sea1.discourse-cdn.com/flex001/user_avatar/forum.modular.com/tylerhillery/32/135_2.png) [@TylerHillery](https://forum.modular.com/u/TylerHillery)\
**Post date:** [July 15, 2026, 12:58pm UTC](https://forum.modular.com/t/lc-3-vm-mojo-implementation/3327/1 "2026-07-15T12:58:55Z")

</div>

I really liked this guide on how to [Write your Own Virtual Machine](https://www.jmeiners.com/lc3-vm/) for the LC-3 architecture.

I made a Mojo port of it: [TylerHillery/write-your-own-vm/src/vm.mojo](https://github.com/TylerHillery/write-your-own-vm/blob/main/src/vm.mojo)

The only part I wasn’t sure how to implement natively in Mojo was input buffering, since the C version relies on POSIX APIs like `termios`, `select`, `fd_set`, and signal handling. For now I used Mojo’s Python interop to handle that.

Here is a video of the VM running an assembled version of the 2048 game.

![mojo-lc3-vm-2048](https://us1.discourse-cdn.com/flex001/uploads/modular/original/2X/4/47c95df9a1f1ce1156ed9184b9f32dd816136f1f.webp)

---

<div class="post-metadata">

**Author:** ![miktavarez](https://sea1.discourse-cdn.com/flex001/user_avatar/forum.modular.com/miktavarez/32/446_2.png) [@miktavarez](https://forum.modular.com/u/miktavarez)\
**Post date:** [July 15, 2026, 10:28pm UTC](https://forum.modular.com/t/lc-3-vm-mojo-implementation/3327/2 "2026-07-15T22:28:26Z")

</div>

Great stuff! I’ve got some C FFI bindings for Termios in my `mist` package. You could add it to your project as a dependency or just copy over the code you need so you don’t have to use Python interop.

> **[mist/mist/termios at main · thatstoasty/mist](https://github.com/thatstoasty/mist/tree/main/mist/termios)**
>
> main/mist/termios

---

<div class="post-metadata">

**Author:** ![TylerHillery](https://sea1.discourse-cdn.com/flex001/user_avatar/forum.modular.com/tylerhillery/32/135_2.png) [@TylerHillery](https://forum.modular.com/u/TylerHillery)\
**Post date:** [July 15, 2026, 11:13pm UTC](https://forum.modular.com/t/lc-3-vm-mojo-implementation/3327/3 "2026-07-15T23:13:21Z")

</div>

Nice! I copied over just the `termios` module since I didn’t need all of Mist for this project, and added attribution/license info. Now I have a 100% native Mojo implementation 🔥

---

<div class="post-metadata">

**Author:** ![miktavarez](https://sea1.discourse-cdn.com/flex001/user_avatar/forum.modular.com/miktavarez/32/446_2.png) [@miktavarez](https://forum.modular.com/u/miktavarez)\
**Post date:** [July 18, 2026, 4:13pm UTC](https://forum.modular.com/t/lc-3-vm-mojo-implementation/3327/4 "2026-07-18T16:13:38Z")

</div>

Glad to hear it! I had the termios in that package for convenience, but I’ve pulled it out into it’s own package now as well in case anyone does want to just that part of it.

> **[GitHub - thatstoasty/mojo-termios: Termios FFI bindings for Mojo.](https://github.com/thatstoasty/mojo-termios)**
>
> Termios FFI bindings for Mojo.
