libc8
CHIP-8 utility library
|
#include "symbol.h"
#include "../encode.h"
#include "../defs.h"
#include "exception.h"
#include "util.h"
#include <ctype.h>
#include <string.h>
Functions | |
int | build_instruction (instruction_t *ins, symbol_list_t *symbols, int idx) |
Build an instruction from symbols beginning at idx. More... | |
int | is_comment (const char *s) |
Check if the given string is a comment. More... | |
int | is_db (const char *s) |
Check if given string is a DB identifier. More... | |
int | is_dw (const char *s) |
Check if given string is a DW identifier. More... | |
int | is_instruction (const char *s) |
Check if the given string is an instruction. More... | |
int | is_label_definition (const char *s) |
Check if the given string is a label definition. More... | |
int | is_label (const char *s, label_list_t *labels) |
Check if given string is a label reference. More... | |
int | is_register (const char *s) |
Check if the given string represents a V register. More... | |
int | is_reserved_identifier (const char *s) |
Check if given string is a reserved identifier. More... | |
symbol_t * | next_symbol (symbol_list_t *symbols) |
Get the next symbol. More... | |
int | populate_labels (char **lines, int lineCount, label_list_t *labels) |
Populate label list from lines. More... | |
int | resolve_labels (symbol_list_t *symbols, label_list_t *labels) |
Get byte indexes of label definitions from completed symbol table. More... | |
int | substitute_labels (symbol_list_t *symbols, label_list_t *labels) |
Substitute label symbols with their corresponding int value. More... | |
Variables | |
const char * | c8_identifierStrings [] |
const char * | c8_instructionStrings [] |
instruction_format_t | formats [] |
Stuff for parsing symbols and instructions for encoding CHIP-8 "assembly".
int build_instruction | ( | instruction_t * | ins, |
symbol_list_t * | symbols, | ||
int | idx | ||
) |
Build an instruction from symbols beginning at idx.
This function builds an instruction from a completely parsed set of symbols (with labels expanded).
ins | instruction_t to store instruction contents |
symbols | symbol list |
idx | symbols index of start of instruction |
int is_comment | ( | const char * | s | ) |
Check if the given string is a comment.
s | the string to check |
int is_db | ( | const char * | s | ) |
Check if given string is a DB identifier.
int is_dw | ( | const char * | s | ) |
Check if given string is a DW identifier.
int is_instruction | ( | const char * | s | ) |
Check if the given string is an instruction.
s | the string to check |
int is_label | ( | const char * | s, |
label_list_t * | labels | ||
) |
Check if given string is a label reference.
s | string to check |
labels | label list to check from |
int is_label_definition | ( | const char * | s | ) |
Check if the given string is a label definition.
s | the string to check |
int is_register | ( | const char * | s | ) |
Check if the given string represents a V register.
s | string to check |
int is_reserved_identifier | ( | const char * | s | ) |
Check if given string is a reserved identifier.
s | string to check |
symbol_t * next_symbol | ( | symbol_list_t * | symbols | ) |
Get the next symbol.
int populate_labels | ( | char ** | lines, |
int | lineCount, | ||
label_list_t * | labels | ||
) |
Populate label list from lines.
lines | lines to search |
lineCount | number of lines to search |
labels | label list to populate |
int resolve_labels | ( | symbol_list_t * | symbols, |
label_list_t * | labels | ||
) |
Get byte indexes of label definitions from completed symbol table.
symbols | list of symbols |
labels | list of labels |
int substitute_labels | ( | symbol_list_t * | symbols, |
label_list_t * | labels | ||
) |
Substitute label symbols with their corresponding int value.
symbols | symbols to search |
labels | labels to search |
const char* c8_identifierStrings[] |
const char* c8_instructionStrings[] |
instruction_format_t formats[] |
All valid instruction formats