aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/Documentation.md24
1 files changed, 13 insertions, 11 deletions
diff --git a/doc/Documentation.md b/doc/Documentation.md
index 5564b05..3e60994 100644
--- a/doc/Documentation.md
+++ b/doc/Documentation.md
@@ -2,19 +2,21 @@
Variable length opcodes. Sizes range from 1 to 4 bytes.
## Instruction formats
Instructions can be in 6 different formats:
-1. 1 byte: Opcode
-2. 2 bytes: Opcode + register
-3. 3 bytes: Opcode + register + register
+1. 1 byte: Opcode(u8)
+2. 2 bytes: Opcode(u8) + register(u8)
+3. 3 bytes: Opcode(u8) + register(u8) + register(u8)
4. 3 bytes:\
-4.1 Opcode + intermediate\
-4.2 Opcode + data\
-4.3 Opcode + index\
-4.4 Opcode + offset
-5. 4 bytes: Opcode + register + register + register
+4.1 Opcode(u8) + intermediate(u16)\
+4.2 Opcode(u8) + data(u16)\
+4.3 Opcode(u8) + offset(i16)\
+4.4 Opcode(u8) + num_reg(u16)\
+4.5 Opcode(u8) + register(u8) + num_args(u8)
+5. 4 bytes: Opcode(u8) + register(u8) + register(u8) + register(u8)
6. 4 bytes:\
-6.1 Opcode + register + offset\
-6.2 Opcode + register + intermediate\
-6.3 Opcode + register + data
+6.1 Opcode(u8) + register(u8) + offset(i16)\
+6.2 Opcode(u8) + register(u8) + intermediate(u16)\
+6.3 Opcode(u8) + register(u8) + data(u16)
+7. 4 bytes: Opcode(u8) + index(u16) + num_args(u8)
# Compiler flow
(Tokenize&parse -> Resolve AST -> Generate SSA -> Generate bytecode) -> Generate program\