buntine / bolverk

A simple 8-bit microprocessor emulation engine, built for educational purposes.

This URL has Read+Write access

buntine (author)
Sat Mar 14 23:53:40 -0700 2009
commit  fa5b44dca8d483e7957d3faa1055115da8f300c9
tree    5ea47a63a2f82b819d9a51cb4dc07c1ac240c4b5
parent  b6ea3cb89c360bc9976f03ddcd31240b9c7d173d
name age message
file .gitignore Loading commit data...
file LANGUAGE_SPEC
file README
file Rakefile
file bolverk.gemspec
directory lib/
directory spec/
file test.rb
README
=========================================
===           Bolverk v0.0.3          ===
===         By Andrew Buntine         ===
=========================================

1) Definition

  Bolverk is an emulator for a typical machine language. I have developed it in an attempt to
  better understand the way machines work at a low-level and potentially as an educational tool
  for students who prefer to see a machine language in action in a virtual environment.

  With Bolverk, you can write a machine language program, and then step through the operation one
  "machine cycle" at time. At each point, you can dissect main memory and all registers. This is a
  great way to see how the program effects memory in realtime.

  Programs are written in base-16 (hexadecimal). The language design is based on the one described
  in J. Glenn Brookshears textbook -- Computer Science: An Overview (3rd edition, 1991).

2) Architecture

  - The machine has 16 registers identified in hexadecimal as 0 through to F.
  - Each register can hold one byte (8 bits).
  - Main memory consists of 256 cells.
  - Each memory cell can hold one byte.
  - Memory cells can be referenced in hexadecimal as 00 (00000000) to FF (11111111).

3) Machine Language

  - Machine instructions are 16 bits (two bytes) in length, therefore each instruction requires two memory cells.
  - The first 4 bits make up the op-code. The following 12 bits make up the operand field.
  - See the LANGUAGE_SPEC document for a listing of the available instructions.

2) Storing Integers and Fractions

  To represent signed integers, binary numbers are encoded in Two's Complement Notation.
  Therefore, the range of numbers than can be stored is -128 to 127. This should be sufficient
  for educational purposes.

  Fractions are stored in Floating Point Notation using the following layout: 0 000 0000

    1)    Sign bit.
    2..4) Exponent field, encoded in Excess Four Notation
    5..8) Mantissa field

  It's worth noting that my Floating Point implemenation is very limited as only one byte is
  reserved per number (most systems would use atleast 32 bits). Therefore, round-off errors
  and overflows are going to be rather common unless you are dealing with a very small range
  of numbers (roughly 1/256 to 7 1/2).