Files
MyLittleCPU/src/emu.h

28 lines
505 B
C
Raw Normal View History

2026-07-15 15:02:54 +10:00
#pragma once
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
2026-07-15 15:02:54 +10:00
#include "memory.h"
#define FLAG_ZERO (1 << 0)
#define FLAG_NEGATIVE (1 << 1)
#define FLAG_OVERFLOW (1 << 2)
2026-07-15 15:02:54 +10:00
// -- TYPES -- //
typedef struct {
uint16_t regs[REG_MAX];
Memory* mem;
2026-07-15 15:54:51 +10:00
uint32_t pc;
uint32_t ihp;
uint32_t sp;
bool halted;
2026-07-15 15:02:54 +10:00
} Emulator;
// -- FUNCTIONS -- //
2026-07-15 15:54:51 +10:00
Emulator* initEmulator(uint32_t memorySize);
void freeEmulator(Emulator* emu);
void startEmulator(Emulator* emu);