26 #ifndef as6502_symbols_h 27 #define as6502_symbols_h 36 #define as6502_symbolTypeIsLinked(_type) (_type == as6502_symbol_type_label || _type == as6502_symbol_type_variable) 38 #define as6502_symbolTypeIsLabel(_type) (_type == as6502_symbol_type_label || _type == as6502_symbol_type_label_unlinked) 40 #define as6502_symbolTypeIsVariable(_type) (_type == as6502_symbol_type_variable || _type == as6502_symbol_type_variable_unlinked) 47 as6502_symbol_type_unknown = 0,
48 as6502_symbol_type_label = 2,
49 as6502_symbol_type_variable = 3,
50 as6502_symbol_type_label_unlinked = 4,
51 as6502_symbol_type_variable_unlinked = 5
56 typedef struct _as6502_symbol {
58 struct _as6502_symbol *
next;
void as6502_printSymbolScript(as6502_symbol_table *table, FILE *out)
Generates a debugger script containing all of the commands necessary for loading the symbol table gen...
Definition: symbols.c:63
void as6502_replaceSymbolInLineAtLocationWithText(char *line, size_t len, char *loc, const char *restrict symbol, const char *restrict text)
Convenience function to replace a given string in another string, with its location already specified...
Definition: symbols.c:242
An individual token which will often be a part of a linked list of tokens.
Definition: token.h:41
void as6502_printSymbolTable(as6502_symbol_table *table)
Prints a human readable representation of a as6502_symbol_table for debugging.
Definition: symbols.c:82
as6502_token * as6502_desymbolicateExpression(as6502_symbol_table *table, as6502_token *head, uint16_t offset, int caseSensitive)
Automatically detects symbols in a given line, then dereferences them and replaces them with their ac...
Definition: symbols.c:281
void as6502_destroySymbolTable(as6502_symbol_table *table)
Destroys a symbol table object.
Definition: symbols.c:48
void as6502_symbolicateLine(as6502_symbol_table *table, char *line, size_t len, uint16_t offset)
Searches for addresses in a given line and replaces them with their symbols in a given symbol table...
Definition: symbols.c:371
An individual symbol in a symbol table.
Definition: symbols.h:56
as6502_symbol_table * as6502_createSymbolTable(void)
Creates a new symbol table object.
Definition: symbols.c:44
void as6502_truncateTableToAddressSpace(as6502_symbol_table *table, uint16_t start, uint16_t len)
Remove all as6502_symbol's that lie outside the address region specified.
Definition: symbols.c:219
as6502_symbol * as6502_symbolForString(as6502_symbol_table *table, const char *name)
Finds a as6502_symbol in a given as6502_symbol_table by name.
Definition: symbols.c:118
as6502_symbol_type type
The symbol type.
Definition: symbols.h:66
void as6502_addSymbolToTable(as6502_symbol_table *table, unsigned long line, const char *name, uint16_t address, as6502_symbol_type type)
Creates and adds a as6502_symbol to a as6502_symbol_table.
Definition: symbols.c:154
as6502_symbol * as6502_symbolForAddress(as6502_symbol_table *table, uint16_t address)
Finds a as6502_symbol in a given as6502_symbol_table by address.
Definition: symbols.c:130
uint16_t address
The symbol's address.
Definition: symbols.h:64
char * name
The symbol name.
Definition: symbols.h:62
int as6502_symbolShouldBeReplacedDoubleWidth(as6502_token *instruction)
This indicates if a symbol following an instruction should be replaced with a relative or absolute ad...
Definition: symbols.c:270
The assembler's per-object symbol table structure, which holds all symbols.
Definition: symbols.h:71
struct _as6502_symbol * next
The next variable in the linked list.
Definition: symbols.h:58
void as6502_removeSymbolFromTable(as6502_symbol_table *table, as6502_symbol *symbol)
Removes a as6502_symbol from a as6502_symbol_table.
Definition: symbols.c:205
uint16_t as6502_addressForSymbolByName(as6502_symbol_table *table, const char *name)
Looks up a symbol by name to retrieve its address.
Definition: symbols.c:142
as6502_symbol * first_symbol
The head of the linked list of labels.
Definition: symbols.h:73
Tokenization functionality.
unsigned long line
The line number of the symbol in the source file.
Definition: symbols.h:60
as6502_symbol_type
as6502_symbol Type
Definition: symbols.h:46