s502 assembler
A very simple assembler for the 6502 line of processors written in C
state.h
Go to the documentation of this file.
1 #ifndef GUARD_STATE
2 #define GUARD_STATE
3 
4 #include "map.h"
5 #include "tokenslist.h"
6 #include "instructions.h"
7 
13 enum {
16 };
17 
18 
32 typedef struct {
42  int PC;
44  char infile[STATE_MAX_STRING_LEN];
46  char outfile[STATE_MAX_STRING_LEN];
47 } State;
48 
54 State* state_new();
55 
63 int state_load_instr(State* s, char* fname);
64 
72 void state_free(State* s);
73 
91 int state_parse_commandline(State* s, int argc, char** argv);
92 
93 #endif
State::labels
Map * labels
label locations
Definition: state.h:36
State::instr
Instruction * instr
instruction data
Definition: state.h:40
State::tokens
TokensList * tokens
tokens
Definition: state.h:38
State
Compiler pseudo-global state.
Definition: state.h:32
State::state_load_instr
int state_load_instr(State *s, char *fname)
load instructions from a file
Definition: state.c:41
State::defines
Map * defines
defined constants
Definition: state.h:34
State::state_new
State * state_new()
Create a new State object.
Definition: state.c:16
State::state_free
void state_free(State *s)
free a State object and all associated memory
Definition: state.c:48
Map
Simple key->value map (str->int)
Definition: map.h:34
tokenslist.h
Implement TokensList.
map.h
Map class.
Instruction
linked list member holding instruction data
Definition: instructions.h:25
TokensList
A doubly-linked list for storing Tokens.
Definition: tokenslist.h:29
instructions.h
Instruction data and related operations.
State::state_parse_commandline
int state_parse_commandline(State *s, int argc, char **argv)
parse command line arguments and update state
Definition: state.c:81
STATE_MAX_STRING_LEN
@ STATE_MAX_STRING_LEN
max string length for input/output files
Definition: state.h:15
State::PC
int PC
PC (starts at 0)
Definition: state.h:42