35 lines
538 B
C
35 lines
538 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
#include <string.h>
|
|
|
|
/* Virtual machine state */
|
|
struct lilith
|
|
{
|
|
uint8_t *memory;
|
|
uint32_t reg[16];
|
|
uint32_t ip;
|
|
bool halted;
|
|
bool exception;
|
|
};
|
|
|
|
/* Unpacked instruction */
|
|
struct Instruction
|
|
{
|
|
uint32_t ip;
|
|
uint8_t raw0, raw1, raw2, raw3;
|
|
char opcode[3];
|
|
uint32_t raw_XOP;
|
|
char XOP[6];
|
|
char operation[9];
|
|
int16_t raw_Immediate;
|
|
char Immediate[7];
|
|
uint32_t HAL_CODE;
|
|
uint8_t reg0;
|
|
uint8_t reg1;
|
|
uint8_t reg2;
|
|
uint8_t reg3;
|
|
bool invalid;
|
|
};
|