27 lines
526 B
C
27 lines
526 B
C
|
|
#pragma once
|
||
|
|
|
||
|
|
#include <stdint.h>
|
||
|
|
#include <stdlib.h>
|
||
|
|
#include <string.h>
|
||
|
|
#include "memory.h"
|
||
|
|
|
||
|
|
// -- TYPES -- //
|
||
|
|
typedef enum {
|
||
|
|
REG_A, REG_B, REG_C,
|
||
|
|
|
||
|
|
REG_X, REG_Y, REG_Z,
|
||
|
|
REG_R,
|
||
|
|
|
||
|
|
REG_PC, REG_IHP, REG_SP, REG_F,
|
||
|
|
|
||
|
|
REG_MAX // all registers should come before this one, this is so we can
|
||
|
|
// automatically know the length of the registers array
|
||
|
|
} Register;
|
||
|
|
|
||
|
|
typedef struct {
|
||
|
|
uint16_t regs[REG_MAX];
|
||
|
|
Memory* mem;
|
||
|
|
} Emulator;
|
||
|
|
|
||
|
|
// -- FUNCTIONS -- //
|
||
|
|
Emulator* initEmulator(uint32_t memorySize);
|