diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2023-11-01 22:09:39 +0000 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2023-11-01 22:09:39 +0000 |
commit | 90e04542a284f642b0a3a56ed568b5d5828bc376 (patch) | |
tree | 49560373f8b33f772e48940cdabbc86cc01ae7b2 /asm/lexer.c | |
parent | 26dea6ce72ce6fe4011e5a7dbfad9de9330c75f7 (diff) | |
download | ovm-90e04542a284f642b0a3a56ed568b5d5828bc376.tar.gz ovm-90e04542a284f642b0a3a56ed568b5d5828bc376.tar.bz2 ovm-90e04542a284f642b0a3a56ed568b5d5828bc376.zip |
Implemented stack versions of MGET and MSET in assembler
Diffstat (limited to 'asm/lexer.c')
-rw-r--r-- | asm/lexer.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/asm/lexer.c b/asm/lexer.c index 4e92502..dfc4976 100644 --- a/asm/lexer.c +++ b/asm/lexer.c @@ -46,8 +46,12 @@ const char *token_type_as_cstr(token_type_t type) return "MALLOC"; case TOKEN_MSET: return "MSET"; + case TOKEN_MSET_STACK: + return "MSET_STACK"; case TOKEN_MGET: return "MGET"; + case TOKEN_MGET_STACK: + return "MGET_STACK"; case TOKEN_MDELETE: return "MDELETE"; case TOKEN_MSIZE: @@ -127,7 +131,7 @@ bool is_valid_hex_char(char c) token_t tokenise_symbol(buffer_t *buffer, size_t *column) { - static_assert(NUMBER_OF_OPCODES == 84, "tokenise_buffer: Out of date!"); + static_assert(NUMBER_OF_OPCODES == 90, "tokenise_buffer: Out of date!"); size_t sym_size = 0; for (; sym_size < space_left(buffer) && @@ -183,11 +187,21 @@ token_t tokenise_symbol(buffer_t *buffer, size_t *column) offset = 6; type = TOKEN_MALLOC; } + else if (sym_size >= 10 && strncmp(opcode, "MSET.STACK", 10) == 0) + { + offset = 10; + type = TOKEN_MSET_STACK; + } else if (sym_size >= 4 && strncmp(opcode, "MSET", 4) == 0) { offset = 4; type = TOKEN_MSET; } + else if (sym_size >= 10 && strncmp(opcode, "MGET.STACK", 10) == 0) + { + offset = 10; + type = TOKEN_MGET_STACK; + } else if (sym_size >= 4 && strncmp(opcode, "MGET", 4) == 0) { offset = 4; |