aboutsummaryrefslogtreecommitdiff
path: root/include/bytecode
diff options
context:
space:
mode:
Diffstat (limited to 'include/bytecode')
-rw-r--r--include/bytecode/bytecode.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/include/bytecode/bytecode.h b/include/bytecode/bytecode.h
index a70bb6f..0547a35 100644
--- a/include/bytecode/bytecode.h
+++ b/include/bytecode/bytecode.h
@@ -26,8 +26,9 @@
6.1 Opcode(u8) + register(AmalReg) + label(i16)\
6.2 Opcode(u8) + register(AmalReg) + intermediate(u16)\
6.3 Opcode(u8) + register(AmalReg) + data(u16)\
- 6.4 Opcode(u8) + flags(u8) + num_local_var_reg(u16)\
- 6.5 Opcode(u8) + index(u8) + index(u16)
+ 6.4 Opcode(u8) + register(AmalReg) + index(u16)\
+ 6.5 Opcode(u8) + flags(u8) + num_local_var_reg(u16)\
+ 6.6 Opcode(u8) + index(u8) + index(u16)
# Registers
Registers have a range of 128. Parameters have the most significant bit set while local variables dont.
@@ -45,6 +46,7 @@ typedef enum {
AMAL_OP_MOV, /* mov dst, src - Move src register to dst register */
AMAL_OP_MOVI, /* movi dst, src - Move src intermediate to dst register */
AMAL_OP_MOVD, /* movd dst, src - Move src data to dst register */
+ AMAL_OP_LOADF, /* loadf dst, fi - Move function by index @fi to register @dst. @f1 is u16 */
AMAL_OP_ADD, /* add dst, reg1, reg2 - Add reg1 and reg2 and put the result in dst */
AMAL_OP_SUB, /* sub dst, reg1, reg2 - Substract reg2 from reg1 and put the result in dst */
AMAL_OP_IMUL, /* imul dst, reg1, reg2 - Signed multiplication */
@@ -57,8 +59,8 @@ typedef enum {
AMAL_OP_PUSH_RET, /* push_ret reg - Push register as a return value of the next function call */
AMAL_OP_CALL_START, /* call_start num_args - Start of a CALL with @num_args number of arguments. Arguments for the next CALL is pushed immediately after this, followed by a CALL. @num_args is u8 */
AMAL_OP_CALL, /* call ii, fi - Call a function in imported file (ii, import index) using function index (fi). The number of arguments is the number of values pushed to stack. ii is u8, fi is u16 */
- AMAL_OP_CALLR, /* callr reg - Call a function using a register. Used for function pointers. The number of arguments is the number of values pushed to stack */
AMAL_OP_CALLE, /* calle ii, efi - Call an extern function in imported file (ii, import index) using extern function index (efi). The number of arguments is the number of values pushed to stack. ii is u8, efi is u16 */
+ AMAL_OP_CALLR, /* callr reg - Call a function using a register. Used for function pointers. The number of arguments is the number of values pushed to stack */
AMAL_OP_EQ, /* eq dst, reg1, reg2 - Set dst to 1 if reg1 equals reg2, otherwise set it to 0 */
AMAL_OP_NEQ, /* neq dst, reg1, reg2 - Set dst to 1 if reg1 is not equal to reg2, otherwise set it to 0 */
AMAL_OP_ILT, /* ilt dst, reg1, reg2 - Set dst to 1 if reg1 is less than reg2 (signed comparison), otherwise set it to 0 */