Skip to content
Stephen001 edited this page Feb 11, 2011 · 2 revisions

Grouping and Codes

ByteCode numbering comes in two parts, with a total width of 4 bytes.

The 'upper' half (MSB downwards) is the group code. Group codes are defined to logically group functions together, allowing Awesome to optionally load supporting DLLs for these functions at run-time, swap in implementations, perform targetted bug-fix releases etc. This permits 65535 groups.

The 'lower' half (LSB upwards) is the opcode itself. No information about the number of arguments required, types required etc are encoded in the bytecode. It is all handled by a contract between the assembler and VM, to allow the VM to just plow on with execution. This permits 65535 operations to a group.

An example:

  • 0100 0100 - MathOp AddOp
  • 0200 0100 - MathOp AddInPlaceOp

Group Index

  • 0x0000 CoreOps - Core VM operations, such as dynamic memory allocation, compiler assisted locking logic and so on.
  • 0x0001 MathOps - Mathematical operation, such as add, add in place, square root and so on.

CoreOps

MathOps

  • 0x0000 AssignOp [Register] [Any] - Assigns a value to a given register.
  • 0x0001 AddOp [Register] [Any] [Any] - Adds two arguments together, and allocates the result to the register.
  • 0x0002 AddInPlaceOp [Register] [Any] - Adds the contents of argument 1 to 2, and stores back in 1.
  • 0x0003 SubstractOp [Register] [Any] [Any] - Subtract two arguments from each other, and allocate the result to the register.
  • 0x0004 SubtractInPlaceOp [Register] [Any] - Subtracts argument 2 from 1, and stores back in 1.
Clone this wiki locally