/VirtualMachine

A simple virtual machine to test my programming skills and understanding of computers from the inside out

Primary LanguageJava

Virtual Machine

A simple virtual machine to test my programming skills and understanding of computers from the inside out. It is made entirely in Java using only the standard library. There are currently two sections:

  • The Virtual Machine
  • The Assembler

####The Virtual Machine

The Virtual Machine accepts a file as input, as generated by the assembler below. It reads the raw bytes from the file and loads them into the machine, it is based from the Hack platform and has the following properties:

  • Big-endian architecture
  • 16-bit CPU
  • It has 32kb of addressable memory split as follows:
    • 10,000 bytes of intial code memory that is loaded from the file, although you can jump to higher memory addresses
    • 2,500 bytes of video memory, 1 byte per pixel for a 50x50 grid, see more below
    • 300 bytes of key memory with a 0xFF indicating that a key is pressed and 0x00 otherwise
    • 19,968 bytes of general purpose memory for the program to use
  • Three 16-bit registers:
    • The program counter register
    • The address register
    • The data register

####The Assembler

TODO