compilator-2000/asm_instructions.h
2021-04-06 16:19:44 +02:00

46 lines
948 B
C

#ifndef COMPILATOR_2000_ASM_INSTRUCTIONS_H
#define COMPILATOR_2000_ASM_INSTRUCTIONS_H
#include <stdio.h>
#define INSTRUCTION_TABLE_SIZE 100
typedef enum Instruction {
ADD,
MUL,
SOU,
DIV,
COP,
AFC,
JMP,
JMF,
INF,
SUP,
EQU,
PRI
} Instruction;
char* instructions_labels[12];
typedef struct InstructionItem {
Instruction instruction;
int arg1;
int arg2;
int arg3;
} InstructionItem;
typedef struct InstructionTable {
InstructionItem table[INSTRUCTION_TABLE_SIZE];
int index;
} InstructionTable;
void init_instruction_table(InstructionTable *table);
int add_instruction(InstructionTable *table, Instruction instruction, int arg1, int arg2, int arg3);
void write_instruction_table(InstructionTable *table, FILE *file);
void write_instruction(InstructionItem *item, FILE *file);
#endif //COMPILATOR_2000_ASM_INSTRUCTIONS_H