mirror of
https://github.com/snesrev/zelda3.git
synced 2025-12-19 18:05:55 -05:00
46 lines
731 B
C
46 lines
731 B
C
|
|
#ifndef SPC_H
|
|
#define SPC_H
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
|
|
typedef struct Spc Spc;
|
|
|
|
#include "apu.h"
|
|
#include "saveload.h"
|
|
|
|
struct Spc {
|
|
Apu* apu;
|
|
// registers
|
|
uint8_t a;
|
|
uint8_t x;
|
|
uint8_t y;
|
|
uint8_t sp;
|
|
uint16_t pc;
|
|
// flags
|
|
bool c;
|
|
bool z;
|
|
bool v;
|
|
bool n;
|
|
bool i;
|
|
bool h;
|
|
bool p;
|
|
bool b;
|
|
// stopping
|
|
bool stopped;
|
|
// internal use
|
|
uint8_t cyclesUsed; // indicates how many cycles an opcode used
|
|
};
|
|
|
|
Spc* spc_init(Apu* apu);
|
|
void spc_free(Spc* spc);
|
|
void spc_reset(Spc* spc);
|
|
int spc_runOpcode(Spc* spc);
|
|
void spc_saveload(Spc *spc, SaveLoadFunc *func, void *ctx);
|
|
|
|
#endif
|