2024-04-18 10:09:07 +00:00
|
|
|
#ifndef EMU_CPU_CONST_H
|
|
|
|
#define EMU_CPU_CONST_H
|
|
|
|
|
2024-04-19 09:05:10 +00:00
|
|
|
#include <stdint.h>
|
|
|
|
|
2024-04-18 10:09:07 +00:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
HLT = 0x00,
|
|
|
|
ADD = 0x01,
|
|
|
|
SUB = 0x02,
|
|
|
|
MUL = 0x03,
|
|
|
|
DIV = 0x04,
|
|
|
|
LBS = 0x05,
|
|
|
|
RBS = 0x06,
|
|
|
|
BAN = 0x07,
|
|
|
|
BOR = 0x08,
|
|
|
|
BXO = 0x09,
|
|
|
|
BNO = 0x0A,
|
|
|
|
PUS = 0x0B,
|
|
|
|
POP = 0x0C,
|
|
|
|
JMP = 0x0D,
|
|
|
|
JEQ = 0x0E,
|
|
|
|
JNZ = 0x0F,
|
|
|
|
CAL = 0x10,
|
|
|
|
RET = 0x11,
|
|
|
|
REG = 0x12,
|
|
|
|
INT = 0x13,
|
|
|
|
INP = 0x14,
|
|
|
|
OUT = 0x15,
|
|
|
|
DIN = 0x16,
|
|
|
|
DOT = 0x17,
|
|
|
|
MOV = 0x18
|
|
|
|
} CpuInstructions;
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
R0 = 0x0,
|
|
|
|
R1 = 0x1,
|
|
|
|
R2 = 0x2,
|
|
|
|
R3 = 0x3,
|
|
|
|
ACU = 0x4,
|
|
|
|
PC = 0x5,
|
|
|
|
SP = 0x6
|
|
|
|
} CpuRegisters;
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
value = 0x0,
|
2024-04-19 09:05:10 +00:00
|
|
|
valueInRegister = 0x1,
|
|
|
|
valueInRam = 0x2,
|
2024-04-18 10:09:07 +00:00
|
|
|
pointerInRegister = 0x3
|
|
|
|
} ArgumentInfo;
|
|
|
|
|
2024-04-22 13:05:10 +00:00
|
|
|
typedef union
|
|
|
|
{
|
|
|
|
int16_t s;
|
|
|
|
uint16_t u;
|
|
|
|
} r16_int;
|
|
|
|
|
2024-04-19 12:39:59 +00:00
|
|
|
#define INSTRUCTION_BIT_MASK 0b0000000011111111
|
|
|
|
#define INSTRUCTION_ARG_1_INFO_MASK 0b0011000000000000
|
|
|
|
#define INSTRUCTION_ARG_2_INFO_MASK 0b1100000000000000
|
2024-04-18 10:09:07 +00:00
|
|
|
|
2024-04-22 11:08:57 +00:00
|
|
|
#define R16 "Reduced 16 bit CPU"
|
|
|
|
#define R16_AUTHOR "Rose Apollo"
|
|
|
|
#define R16_STANDARD "r16_0 version 1"
|
|
|
|
|
2024-04-18 10:09:07 +00:00
|
|
|
#endif
|