Add Bool and Char addressing modes
All checks were successful
per-push tests / build (push) Successful in 1m45s
per-push tests / test-frontend (push) Successful in 2m5s
per-push tests / test-utility (push) Successful in 2m12s
per-push tests / timed-decomposer-parse (push) Successful in 1m8s
per-push tests / test-backend (push) Successful in 1m17s

This commit adds addressing modes for boolean and character data.
The Address enum is extended, along with its TryFrom<u8> implementation
and its operand_size function. The access macro is extended to handle
the new modes. The CONST instruction can now create Char and Bool data.
The instructions.toml has information on the new addressing modes. Unit
tests have been added to test new CONST logic.

fixes: #41

Signed-off-by: Ava Affine <ava@sunnypup.io>
This commit is contained in:
Ava Apples Affine 2025-08-09 04:45:56 +00:00
parent 4fb7e78c2a
commit e310b901c3
3 changed files with 76 additions and 25 deletions

View file

@ -1,6 +1,3 @@
# 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
@ -36,6 +33,20 @@ symbol = "N"
example = "const $expr, 100"
description = "Numeric addressing mode provides read only integer constants to instructions"
[[addressing_modes]]
name = "char"
mutable = false
symbol = "'N'"
example = "const $expr, 'c'"
description = "Char addressing mode provides read only character constants to instructions"
[[addressing_modes]]
name = "boolean"
mutable = false
symbol = "{true|false}"
example = "const $expr, true"
description = "Boolean addressing mode provides read only booleans to instructions"
[[instructions]]
name = "trap"
args = ["index"]