UEMU: Micro Emulator Architecture


Used only for storing program instructions.  UEMU is a bit odd in that memory consists of 16-bit instructions, not 8-bit bytes.  Normally a single instruction (or integer) stored in memory spans several bytes, but not in UEMU!


There are 16 registers numbered 0 through F (in hex).  Register F is the program counter--it stores the memory address of the next instruction to execute.  All other registers are free for programmer use.


The instruction encoding is chosen such that everything's a multiple of 4 bits long, which makes it easy to write machine language programs in hex.  There are a ridiculously small number of instructions:

Input File

The input file consists of machine language instructions, written with one instruction at the start of each line.  Instructions should be encoded in hexadecimal using the usual 0xABCD notation, but can also be written in octal (07423) or even decimal.  Anything after the instruction is ignored, and so should be used for comments.  Lines that don't start with integers are ignored, so "# Not 0x23, it ain't" is a comment, as is "// Crap.", "/* Nooooo! */", as well as "Why... WHY?". 

The first instruction is loaded into memory address 0x80, which is the initial value of register F (the program counter).  Each instruction read from the file is loaded into memory in the subsequent address--so the 5th instruction goes into 0x85, the 9th into 0x89, the 15th into 0x8F, the 16th into 0x90, and so on.   It's usually a good idea to start with a 0xED00 instruction (dump program memory and registers) to make sure your program loaded into the addresses you think it did.

You can pass the input filename in as a command-line parameter, drag-and-drop the input file onto uemu, or copy the input file to "input.txt" and run uemu without parameters.

See the examples/ directory for some simple example programs.

Be aware that the Windows version will expect Windows newline characters in your input files.  If your newlines get screwed up (for example, the file looks weird in notepad and some of your instructions don't dump out right) you can fix them by viewing the file in a web browser and Save As text.

O. Lawlor, ffosl@uaf.edu
Up to: Class Site, CS, UAF