Initial commit
This commit is contained in:
50
src/snes/apu.h
Normal file
50
src/snes/apu.h
Normal file
@@ -0,0 +1,50 @@
|
||||
|
||||
#ifndef APU_H
|
||||
#define APU_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
typedef struct Apu Apu;
|
||||
|
||||
#include "snes.h"
|
||||
#include "spc.h"
|
||||
#include "dsp.h"
|
||||
|
||||
typedef struct Timer {
|
||||
uint8_t cycles;
|
||||
uint8_t divider;
|
||||
uint8_t target;
|
||||
uint8_t counter;
|
||||
bool enabled;
|
||||
} Timer;
|
||||
|
||||
struct Apu {
|
||||
Spc* spc;
|
||||
Dsp* dsp;
|
||||
uint8_t ram[0x10000];
|
||||
bool romReadable;
|
||||
uint8_t dspAdr;
|
||||
uint32_t cycles;
|
||||
uint8_t inPorts[6]; // includes 2 bytes of ram
|
||||
uint8_t outPorts[4];
|
||||
Timer timer[3];
|
||||
uint8_t cpuCyclesLeft;
|
||||
|
||||
union {
|
||||
struct DspRegWriteHistory hist;
|
||||
void *padpad;
|
||||
};
|
||||
};
|
||||
|
||||
Apu* apu_init();
|
||||
void apu_free(Apu* apu);
|
||||
void apu_reset(Apu* apu);
|
||||
void apu_cycle(Apu* apu);
|
||||
uint8_t apu_cpuRead(Apu* apu, uint16_t adr);
|
||||
void apu_cpuWrite(Apu* apu, uint16_t adr, uint8_t val);
|
||||
void apu_saveload(Apu *apu, SaveLoadFunc *func, void *ctx);
|
||||
#endif
|
||||
Reference in New Issue
Block a user