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.
This commit is contained in:
2023-11-03 19:01:31 +00:00
parent 32d50a9342
commit b5a1582976
4 changed files with 104 additions and 38 deletions

View File

@@ -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;