From b5a1582976c721dbb9ece622226be0e5ea575fd8 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Fri, 3 Nov 2023 19:01:31 +0000 Subject: Added a start address (equivalent to `main`) to assembler Creates a jump address to the label delegated by "global" so program starts at that point. --- asm/lexer.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'asm/lexer.c') diff --git a/asm/lexer.c b/asm/lexer.c index 525deb2..7f37ce7 100644 --- a/asm/lexer.c +++ b/asm/lexer.c @@ -24,6 +24,8 @@ const char *token_type_as_cstr(token_type_t type) { switch (type) { + case TOKEN_GLOBAL: + return "GLOBAL"; case TOKEN_STAR: return "STAR"; case TOKEN_LITERAL_NUMBER: @@ -331,6 +333,11 @@ token_t tokenise_symbol(buffer_t *buffer, size_t *column) offset = 3; type = TOKEN_RET; } + else if (sym_size == 6 && strncmp(opcode, "GLOBAL", 6) == 0) + { + offset = 6; + type = TOKEN_GLOBAL; + } else is_opcode = false; -- cgit v1.2.3-13-gbd6f