From 0e47e5658a584828fd6d297f46744c41ed2bb9ca Mon Sep 17 00:00:00 2001 From: Ava Affine Date: Thu, 7 Aug 2025 21:26:23 +0000 Subject: [PATCH] add documentation for current addressing modes to instructions.toml Signed-off-by: Ava Affine --- hyphae/instructions.toml | 35 +++++++++++++++++++++++++++++++++++ hyphae/src/vm.rs | 2 ++ 2 files changed, 37 insertions(+) diff --git a/hyphae/instructions.toml b/hyphae/instructions.toml index 3f02d65..0a8775e 100644 --- a/hyphae/instructions.toml +++ b/hyphae/instructions.toml @@ -1,6 +1,41 @@ # NOTE: keep libc out of this, thats what trap vector is for # NOTE: to programmers: only registers allow mutable acess +[[addressing_modes]] +name = "expr" +mutable = true +symbol = "$expr" +example = "inc $expr" +description = "The expression register is used as a default output, or input by many instructions." + +[[addressing_modes]] +name = "operand" +mutable = true +symbol = "$oper" +example = "add $oper1, $oper2" +description = "There are four operand registers N=(0, 1, 2, 3, and 4). They are for storing mutable data." + +[[addressing_modes]] +name = "stack" +mutable = false +symbol = "%N" +example = "dupl %0, $expr" +description = "Stack addressing mode takes an index in to the stack to read from." + +[[addressing_modes]] +name = "instruction" +mutable = false +symbol = "@N" +example = "jmp @100" +description = "Instruction addressing mode indexes by instruction into the program." + +[[addressing_modes]] +name = "numeric" +mutable = false +symbol = "N" +example = "const $expr, 100" +description = "Numeric addressing mode provides read only integer constants to instructions" + [[instructions]] name = "trap" args = ["index"] diff --git a/hyphae/src/vm.rs b/hyphae/src/vm.rs index 2ca76e5..7ed5c1d 100644 --- a/hyphae/src/vm.rs +++ b/hyphae/src/vm.rs @@ -1117,6 +1117,7 @@ mod tests { assert!(case.test_passes(&vm)); } + /* #[test] fn isa_index() { // TODO INDEX on V, BV, S, L @@ -1146,4 +1147,5 @@ mod tests { fn isa_string_ops() { // TODO CONCAT and S_APPEND } + */ }