#+TITLE Project Specification * Binary interface The VM does not use floating point numbers, it instead uses fixed point numbers. This is for portability reasons as some devices might not have a FPU in them especially microcontrollers and some retro game systems like the PS1. ** Numbers | type | size (bytes) | description | |------+--------------+---------------------------------------| | u8 | 1 | unsigned 8bit, alias =char= and =byte= | | bool | 1 | unsigned 8bit, =false= or =true= | | i8 | 1 | signed 8bit for interop | | u16 | 2 | unsigned 16bit for interop | | i16 | 2 | signed 16bit for interop | | u32 | 4 | unsigned 32bit, alias =nat= | | i32 | 4 | signed 32bit, alias =int= | | f32 | 4 | signed 32bit fixed number, alias =real= | * Memory Uses a harvard style archecture, meaning the code and ram memory are split up into two seperate blocks. In the C version you can see these are two seperate arrays 'code' and 'mem'. During compilation constants and local variables are put onto 'mem' * Opcodes Most opcodes are 4 bytes [opcode][dest][src1][src2] A small number are multibyte like load-long-immidiate [multibyte-opcode][0u8][0u8][opcode] . [u32] These are decoded during runtime and selected. In theory, bitshift decoding is faster than accessing an unknown n bytes of memory in the 'code' array.