commit 2ce447b3fc20c541aff0e02cac186460a57b45f7 parent c18c0ebee369e7eaa529ff7bb44e61a5099e9020 Author: bsandro <email@bsandro.tech> Date: Wed, 6 Jul 2022 02:29:19 +0300 Register number validation; added TODO Diffstat:
A | TODO | | | 4 | ++++ |
M | asm/register.go | | | 3 | +++ |
2 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/TODO b/TODO @@ -0,0 +1,4 @@ +- support for hexadecimal literals and characters (like 'a') for ORTH opcode +- more extensive sanity checks for different opcodes +- #include support +- disassembler diff --git a/asm/register.go b/asm/register.go @@ -16,5 +16,8 @@ func NewRegister(input string) Register { if err != nil { log.Fatal(err) } + if val >= 8 { // only 8 registers allowed + log.Fatalf("invalid register #%d", val) + } return Register(uint8(val)) }