1 #ifndef __ASSEMBLER_H__
2 #define __ASSEMBLER_H__
62 #define LC3AS_VAR extern
66 #define ERR_OPEN_READ "could not open '%s' for reading."
67 #define ERR_OPEN_WRITE "could not open '%s' for writing."
68 #define ERR_LINE_TOO_LONG "source line too long (max is %d)"
69 #define ERR_NO_ORIG "no .ORIG directive found"
70 #define ERR_NO_END "no .END directive found"
71 #define ERR_ORIG_NOT_1ST "instruction(s) appear before .ORIG"
72 #define ERR_END_NOT_LAST "instruction(s) appear after .END"
73 #define ERR_MISSING_ORIG ".ORIG not found"
74 #define ERR_MISSING_END ".END not found"
75 #define ERR_EXPECTED_COMMA "expected comma, got '%s'"
76 #define ERR_EXPECTED_REG "expected register (R0-R7), got '%s'"
77 #define ERR_EXPECT_REG_IMM "expected register or immediate, got '%s'"
78 #define ERR_BAD_LABEL "label '%s' contains illegal characters"
79 #define ERR_MISSING_OP "expected LC3 op, got '%s'"
80 #define ERR_MISSING_OPERAND "too few operand(s)"
81 #define ERR_EXTRA_OPERAND "extra operand(s) '%s'"
82 #define ERR_DUPLICATE_LABEL "label '%s' previosly defined"
83 #define ERR_MISSING_LABEL "label '%s' never defined"
84 #define ERR_BAD_PCOFFSET "PCoffset to '%s' out of range"
85 #define ERR_BAD_IMM "immediate '%s' (bad format)"
86 #define ERR_IMM_TOO_BIG "immediate '%s' out of range"
87 #define ERR_EXPECTED_STR "expected quoted string, got '%s'"
88 #define ERR_BAD_STR "unterminated string '%s'"
171 void asm_pass_one (
char* asm_file_name,
char* sym_file_name);
void asm_init(void)
Definition: assembler.c:59
void scan_operands(operands_t operands)
Definition: assembler.c:141
Defines the interface to symbol.c functions (do not modify)
void encode_operand(operand_t operand)
Definition: assembler.c:88
void asm_print_line_info(line_info_t *info)
Definition: assembler.c:39
int lineNum
Definition: assembler.h:108
void get_comma_or_error(void)
Definition: assembler.c:96
int address
Definition: assembler.h:109
void get_PCoffset_or_error(char *token)
Definition: assembler.c:103
opcode_t opcode
Definition: assembler.h:111
void asm_pass_one(char *asm_file_name, char *sym_file_name)
Definition: assembler.c:66
operand
Definition: lc3.h:115
FILE * open_read_or_error(char *file_name)
Definition: assembler.c:112
void asm_error(char *msg,...)
Definition: assembler.c:49
int form
Definition: assembler.h:112
char * reference
Definition: assembler.h:117
void asm_term(void)
Definition: assembler.c:74
LC3AS_VAR int numErrors
Definition: assembler.h:97
void check_line_syntax(char *token)
Definition: assembler.c:83
void update_address(void)
Definition: assembler.c:156
LC3AS_VAR int currAddr
Definition: assembler.h:94
line_info_t * next
Definition: assembler.h:107
LC3AS_VAR int srcLineNum
Definition: assembler.h:91
int reg2
Definition: assembler.h:114
void asm_init_line_info(line_info_t *info)
Definition: assembler.c:23
int reg3
Definition: assembler.h:115
Definition: assembler.h:106
int get_reg_or_error(char *token)
Definition: assembler.c:107
int reg1
Definition: assembler.h:113
int machineCode
Definition: assembler.h:110
char * check_for_label(char *token)
Definition: assembler.c:78
void encode_PCoffset_or_error(int width)
FILE * open_write_or_error(char *file_name)
Definition: assembler.c:117
int immediate
Definition: assembler.h:116
void asm_pass_two(char *obj_file_name)
Definition: assembler.c:70
operands
Definition: lc3.h:142
definitions of the LC3 instruction set architecture (ISA) (do not modify)
void get_immediate_or_error(char *token, int width, int isSigned)
Definition: assembler.c:100
void get_operand(operand_t operand, char *token)
Definition: assembler.c:122