Implementing a Virtual Machine in C

Hello everyone! In this post, we will be doing the Synacor Challenge. In this challenge, which you can find here, we are only given a tar file. Inside this archive is two files:

  • arch-spec, which is the spesification of this imaginary machine
  • challenge.bin, which is an executable designed to be run on the VM

The arch-spec file describes everything in detail, but let me summarize the machine in a few points. The virtual machine;

  • Is little endian
  • Has a memory made up of 16-bit unsigned integers
  • Has a stack of 16-bit unsigned integers
  • Has 8 registers which are also 16-bit unsigned integers

Comments BETA