v6502
The MOS 6502 Virtual Machine and Toolchain Infrastructure
|
Symbol table management. More...
Go to the source code of this file.
Data Structures | |
struct | as6502_symbol |
An individual symbol in a symbol table. More... | |
struct | as6502_symbol_table |
The assembler's per-object symbol table structure, which holds all symbols. More... | |
Macros | |
#define | as6502_symbolTypeIsLinked(_type) (_type == as6502_symbol_type_label || _type == as6502_symbol_type_variable) |
Return YES if a given as6502_symbol_type has a low link bit. | |
#define | as6502_symbolTypeIsLabel(_type) (_type == as6502_symbol_type_label || _type == as6502_symbol_type_label_unlinked) |
Return YES if a given as6502_symbol_type is a label type, regardless of linkage. | |
#define | as6502_symbolTypeIsVariable(_type) (_type == as6502_symbol_type_variable || _type == as6502_symbol_type_variable_unlinked) |
Return YES if a given as6502_symbol_type is a variable type, regardless of linkage. | |
Enumerations | |
enum | as6502_symbol_type { as6502_symbol_type_unknown = 0, as6502_symbol_type_label = 2, as6502_symbol_type_variable = 3, as6502_symbol_type_label_unlinked = 4, as6502_symbol_type_variable_unlinked = 5 } |
as6502_symbol Type More... | |
Functions | |
as6502_symbol_table * | as6502_createSymbolTable (void) |
Creates a new symbol table object. | |
void | as6502_destroySymbolTable (as6502_symbol_table *table) |
Destroys a symbol table object. | |
void | as6502_printSymbolTable (as6502_symbol_table *table) |
Prints a human readable representation of a as6502_symbol_table for debugging. | |
void | as6502_printSymbolScript (as6502_symbol_table *table, FILE *out) |
Generates a debugger script containing all of the commands necessary for loading the symbol table generated during assembly into the debugger. | |
as6502_symbol * | as6502_symbolForString (as6502_symbol_table *table, const char *name) |
Finds a as6502_symbol in a given as6502_symbol_table by name. | |
as6502_symbol * | as6502_symbolForAddress (as6502_symbol_table *table, uint16_t address) |
Finds a as6502_symbol in a given as6502_symbol_table by address. | |
uint16_t | as6502_addressForSymbolByName (as6502_symbol_table *table, const char *name) |
Looks up a symbol by name to retrieve its address. | |
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. | |
void | as6502_removeSymbolFromTable (as6502_symbol_table *table, as6502_symbol *symbol) |
Removes a as6502_symbol from a as6502_symbol_table. | |
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. | |
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 actual addresses. More... | |
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. More... | |
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 for performance. | |
int | as6502_symbolShouldBeReplacedDoubleWidth (as6502_token *instruction) |
This indicates if a symbol following an instruction should be replaced with a relative or absolute address. | |
Symbol table management.
enum as6502_symbol_type |
as6502_symbol Type
If you need to test type or linkage, use the provided Symbol Type Test Macros. If for some reason you need to do more advanced manipulation of the type field: Label types are odd, variable types are even, so symbol type (regardless of linkage) can be tested with a simple or mask against the unlinked type that you want. For example:
Linkage can be tested by masking against the linkage you want, always using label, as it carries a type bit of zero.