DCPU-16 Specification

Summary

  • 16 bit words
  • 0x10000 words of ram
  • 8 registers (A, B, C, X, Y, Z, I, J)
  • program counter (PC)
  • stack pointer (SP)
  • extra/excess (EX)
  • interrupt address (IA)

In this document, anything within [brackets] is shorthand for "the value of the RAM at the location of the value inside the brackets". For example, SP means stack pointer, but [SP] means the value of the RAM at the location the stack pointer is pointing at.

Whenever the CPU needs to read a word, it reads [PC], then increases PC by one. Shorthand for this is [PC++]. In some cases, the CPU will modify a value before reading it, in this case the shorthand is [++PC].

For stability and to reduce bugs, it's strongly suggested all multi-word operations use little endian in all DCPU-16 programs, wherever possible.