16#define C8_INSTRUCTION_COUNT 64
21#define C8_LABEL_CEILING 64
26#define C8_LABEL_IDENTIFIER_SIZE 20
31#define C8_SYMBOL_CEILING 64
37#define C8_S_CALL "CALL"
46#define C8_S_SUBN "SUBN"
51#define C8_S_SKNP "SKNP"
56#define C8_S_EXIT "EXIT"
58#define C8_S_HIGH "HIGH"
59#define C8_S_JP_V0 "JP V0,"
Represents an instruction.
Definition: symbol.h:169
int line
Line number.
Definition: symbol.h:170
int pcount
Parameter count.
Definition: symbol.h:172
C8_InstructionFormat * format
Corresponding instruction format.
Definition: symbol.h:175
C8_InstructionIdentifier cmd
Instruction command.
Definition: symbol.h:171
Represents a list of labels.
Definition: symbol.h:193
C8_Label * l
Pointer to first label.
Definition: symbol.h:194
int ceil
Maximum length of the list.
Definition: symbol.h:196
int len
Length of the list.
Definition: symbol.h:195
Represents a label.
Definition: symbol.h:184
int byte
Byte location.
Definition: symbol.h:186
Represents a symbol with a type, value, and line number.
Definition: symbol.h:213
C8_Symbol * s
Pointer to first symbol.
Definition: symbol.h:214
int ceil
Amount of symbols that can fit in allocated memory.
Definition: symbol.h:216
int len
Number of symbols in list.
Definition: symbol.h:215
Represents a symbol with a type, value, and line number.
Definition: symbol.h:203
C8_SymbolIdentifier type
Symbol type.
Definition: symbol.h:204
uint16_t value
Symbol value.
Definition: symbol.h:205
int ln
Line number.
Definition: symbol.h:206
int c8_substitute_labels(C8_SymbolList *, C8_LabelList *)
Substitute label symbols with their corresponding int value.
Definition: symbol.c:400
C8_InstructionIdentifier
Represents instruction types.
Definition: symbol.h:83
@ C8_I_SCD
Definition: symbol.h:104
@ C8_I_SHL
Definition: symbol.h:98
@ C8_I_SKP
Definition: symbol.h:101
@ C8_I_OR
Definition: symbol.h:93
@ C8_I_SE
Definition: symbol.h:89
@ C8_I_HIGH
Definition: symbol.h:109
@ C8_I_DRW
Definition: symbol.h:100
@ C8_I_SUB
Definition: symbol.h:95
@ C8_I_RET
Definition: symbol.h:86
@ C8_I_JP_V0
Definition: symbol.h:110
@ C8_I_XOR
Definition: symbol.h:103
@ C8_I_EXIT
Definition: symbol.h:107
@ C8_I_RND
Definition: symbol.h:99
@ C8_I_LD
Definition: symbol.h:91
@ C8_I_JP
Definition: symbol.h:87
@ C8_I_SCR
Definition: symbol.h:105
@ C8_I_CLS
Definition: symbol.h:85
@ C8_I_SHR
Definition: symbol.h:96
@ C8_I_NULL
Definition: symbol.h:84
@ C8_I_SCL
Definition: symbol.h:106
@ C8_I_AND
Definition: symbol.h:94
@ C8_I_SNE
Definition: symbol.h:90
@ C8_I_SUBN
Definition: symbol.h:97
@ C8_I_LOW
Definition: symbol.h:108
@ C8_I_SKNP
Definition: symbol.h:102
@ C8_I_CALL
Definition: symbol.h:88
@ C8_I_ADD
Definition: symbol.h:92
int c8_is_dw(const char *)
Check if given string is a DW identifier.
Definition: symbol.c:149
int c8_is_label(const char *, const C8_LabelList *)
Check if given string is a label reference.
Definition: symbol.c:197
int c8_populate_labels(C8_LabelList *)
Populate label list from lines.
Definition: symbol.c:290
C8_SymbolIdentifier
Represents symbol types.
Definition: symbol.h:122
@ C8_SYM_I
Definition: symbol.h:126
@ C8_SYM_LABEL
Definition: symbol.h:136
@ C8_SYM_DW
Definition: symbol.h:132
@ C8_SYM_R
Definition: symbol.h:135
@ C8_SYM_DT
Definition: symbol.h:124
@ C8_SYM_INT8
Definition: symbol.h:139
@ C8_SYM_V
Definition: symbol.h:142
@ C8_SYM_ST
Definition: symbol.h:125
@ C8_SYM_F
Definition: symbol.h:129
@ C8_SYM_LABEL_DEFINITION
Definition: symbol.h:144
@ C8_SYM_K
Definition: symbol.h:128
@ C8_SYM_INSTRUCTION
Definition: symbol.h:143
@ C8_SYM_INT4
Definition: symbol.h:138
@ C8_SYM_DS
Definition: symbol.h:133
@ C8_SYM_B
Definition: symbol.h:130
@ C8_SYM_INT12
Definition: symbol.h:140
@ C8_SYM_NULL
Definition: symbol.h:123
@ C8_SYM_INT
Definition: symbol.h:137
@ C8_SYM_IP
Definition: symbol.h:127
@ C8_SYM_HF
Definition: symbol.h:134
@ C8_SYM_DB
Definition: symbol.h:131
@ C8_SYM_STRING
Definition: symbol.h:141
#define C8_LABEL_IDENTIFIER_SIZE
Maximum size of label identifier.
Definition: symbol.h:26
int c8_is_register(const char *)
Check if the given string represents a V register.
Definition: symbol.c:222
int c8_resolve_labels(C8_SymbolList *, C8_LabelList *)
Get byte indexes of label definitions from completed symbol table.
Definition: symbol.c:361
C8_InstructionFormat c8_formats[]
Definition: symbol.c:38
int c8_is_instruction(const char *)
Check if the given string is an instruction.
Definition: symbol.c:157
int c8_is_label_definition(const char *)
Check if the given string is a label definition.
Definition: symbol.c:173
int c8_is_comment(const char *)
Check if the given string is a comment.
Definition: symbol.c:128
const char * c8_identifierStrings[]
Definition: symbol.c:21
int c8_is_ds(const char *)
Check if given string is a DS identifier.
Definition: symbol.c:142
int c8_shift(uint16_t)
Find the bits needed to shift to OR a parameter into an instruction.
Definition: symbol.c:588
int c8_is_db(const char *)
Check if given string is a DB identifier.
Definition: symbol.c:135
const char * c8_instructionStrings[]
Definition: symbol.c:29
int c8_is_reserved_identifier(const char *)
Check if given string is a reserved identifier.
Definition: symbol.c:234
C8_Symbol * c8_next_symbol(C8_SymbolList *)
Get the next symbol.
Definition: symbol.c:258
int c8_build_instruction(C8_Instruction *, C8_SymbolList *, int)
Build an instruction from symbols beginning at idx.
Definition: symbol.c:112