s502 assembler
A very simple assembler for the 6502 line of processors written in C
instructions.h
Go to the documentation of this file.
1 #ifndef GUARD_INSTRUCTIONS
2 #define GUARD_INSTRUCTIONS
3 
4 #include "addressmode.h"
5 
13 enum {
15  OPC_INVALID = 0xff
16 };
17 
25 typedef struct Instruction {
27  char mnem[4];
29  unsigned char opcs[ADRM_COUNT];
31  struct Instruction* next;
32 } Instruction;
33 
34 
46 Instruction* instruction_load(char* fname);
47 
59 
68 void instruction_free(Instruction* list);
69 
78 void instruction_print(Instruction* instr);
79 
89 
90 #endif
ADRM_COUNT
@ ADRM_COUNT
Total number of addressing modes.
Definition: addressmode.h:51
Instruction::instruction_free
void instruction_free(Instruction *list)
free all memory associated with an Instruction* list
Definition: instructions.c:121
Instruction::instruction_print_all
void instruction_print_all(Instruction *list)
debug-print all instructions in a list
Definition: instructions.c:141
Instruction::mnem
char mnem[4]
3-letter mnemonic of an instruction + trailing 0
Definition: instructions.h:27
Instruction::next
struct Instruction * next
Next instruction pointer on NULL.
Definition: instructions.h:31
Instruction::instruction_print
void instruction_print(Instruction *instr)
fancy-print one instruction data
Definition: instructions.c:132
Instruction::instruction_load
Instruction * instruction_load(char *fname)
Load instruction data from CSV file.
Definition: instructions.c:18
addressmode.h
AddressMode enum and related data.
Instruction
linked list member holding instruction data
Definition: instructions.h:25
Instruction::opcs
unsigned char opcs[ADRM_COUNT]
Different combinarions of this instruction. Invalid ones are set to OPC_INVALID.
Definition: instructions.h:29
Instruction::instruction_find
Instruction * instruction_find(Instruction *list, char *mnem)
find the Instruction entry for a given mnemonic
Definition: instructions.c:111
OPC_INVALID
@ OPC_INVALID
An invalid opcode to signal invalid / non-existent variations.
Definition: instructions.h:15