aboutsummaryrefslogtreecommitdiff
path: root/doc/Documentation.md
diff options
context:
space:
mode:
Diffstat (limited to 'doc/Documentation.md')
-rw-r--r--doc/Documentation.md35
1 files changed, 18 insertions, 17 deletions
diff --git a/doc/Documentation.md b/doc/Documentation.md
index 96cd3ef..493fcfa 100644
--- a/doc/Documentation.md
+++ b/doc/Documentation.md
@@ -16,8 +16,9 @@ Instructions can be in 7 different formats:
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.
@@ -88,15 +89,15 @@ The versions in the header only changes for every release, not every change.
|Function[]|Functions |Multiple non-extern functions, where the number of functions is defined by @num_funcs.|
## Function
-|Type|Field |Description |
-|----|-------------------------|------------------------------------------------------------------------------------------------------------------------|
-|u32 |func_offset |The offset in the program code (machine code) where the function starts. Is always 0 until the program has been started.|
-|u8 |num_params |The number of parameters. |
-|u32 |params_num_pointers |The number of pointers in the parameters. |
-|u32 |params_fixed_size |The size of all non-pointer type parameters, in bytes. |
-|u8 |num_return_types |The number of return values. |
-|u32 |return_types_num_pointers|The number of pointers in the return types. |
-|u32 |return_types_fixed_size |The size of all non-pointer type return types, in bytes. |
+|Type|Field |Description |
+|----|-------------------------|-------------------------------------------------------------------------------------------------------------------------|
+|u32 |func_offset |The offset in the program code (machine code) where the function starts. Is always ~0 until the program has been started.|
+|u8 |num_params |The number of parameters. |
+|u32 |params_num_pointers |The number of pointers in the parameters. |
+|u32 |params_fixed_size |The size of all non-pointer type parameters, in bytes. |
+|u8 |num_return_types |The number of return values. |
+|u32 |return_types_num_pointers|The number of pointers in the return types. |
+|u32 |return_types_fixed_size |The size of all non-pointer type return types, in bytes. |
# Bytecode external functions
## External functions layout
@@ -128,12 +129,12 @@ The versions in the header only changes for every release, not every change.
|Exported function[]|Exported functions|Multiple exported functions, where the number of functions is defined by @num_export_func|
## Exported function
-|Type|Field |Description |
-|----|------------------|--------------------------------------------------------------------------------------------------------------------------|
-|u32 |instruction_offset|The offset in the instruction data where the exported function is defined. Is always 0 until the program has been started.|
-|u8 |num_args |The number of arguments the functions has. |
-|u8 |name_len |The length of the exported function name, in bytes. Excluding the null-terminate character. |
-|u8[]|name |The name of the exported function, where the size is defined by @name_len. Names are null-terminated. |
+|Type|Field |Description |
+|----|------------------|---------------------------------------------------------------------------------------------------------------------------|
+|u32 |instruction_offset|The offset in the instruction data where the exported function is defined. Is always ~0 until the program has been started.|
+|u8 |num_args |The number of arguments the functions has. |
+|u8 |name_len |The length of the exported function name, in bytes. Excluding the null-terminate character. |
+|u8[]|name |The name of the exported function, where the size is defined by @name_len. Names are null-terminated. |
# Bytecode imports
## Imports layout