Files
assm-test/includes/opcodes.h
T
2023-06-29 20:53:39 -05:00

24 lines
809 B
C

#ifndef OPCODES_H
#define OPCODES_H
#include <string.h>
#include <errno.h>
#include <stdio.h>
typedef enum {
R1 = 0, R2, R3, R4, R5, R6, R7, R8 = 7
} Registers;
typedef enum {
COPYA = 0x08, COPYAB = 0x10, COPYRA = 0x18, COPYRAB = 0x20, COPYRARA = 0x28, COPYRARAB = 0x30, COPY = 0x38, COPYB = 0x40, COPYI = 0xC0,
CMP = 0x48, CMPI = 0x50, ADD = 0x58, SUB = 0x60, AND = 0x68, XOR = 0x70, OR = 0x78, NOT = 0x80, SHR = 0x88, SHL = 0x90,
INC = 0x98, DEC = 0xA0, PUSH = 0xA8, POP = 0xB0,
JMPI = 0xB8, JMP = 0x02, JZ = 0x03, JG = 0x04, JL = 0x05, NOP = 0x01, CALL = 0x06, RET = 0x07
} Mnemonic;
int IsOpcode(const char*, Mnemonic*);
int IsRegister(const char*, Registers*);
void GetMnemonicText(Mnemonic mnemonic, char buffer[12]);
void GetRegisterText(Registers reg, char buffer[3]);
#endif