-
Notifications
You must be signed in to change notification settings - Fork 2
/
MMU.h
77 lines (54 loc) · 1.59 KB
/
MMU.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#ifndef MMU_H
#define MMU_H
#include <iostream>
#include <cstring>
#include "PCE.h"
#include "HuC6270.h"
#include "HuC6280.h"
#include "render.h"
class HuC6270;
class HuC6280;
/* Interrupt Vectors */
#define INTERRUPT_TIME 0xFFFA
#define INTERRUPT_IRQ1 0xFFF8
class MMU {
public:
MMU();
~MMU();
unsigned char readMemory(unsigned short addr);
unsigned char readMPRi(unsigned char n);
unsigned char readIO(unsigned short addr);
unsigned char getTimerStart();
unsigned char readStack(unsigned short addr);
unsigned short readVRAM(unsigned short addr);
void writeStack(unsigned short addr, unsigned char data);
void writeMemory(unsigned short addr, unsigned char data);
void writeIO(unsigned short addr, unsigned char data);
void writeVRAM(unsigned short addr, unsigned short data);
void setMPRi(unsigned char n, unsigned char data);
void clearMPR();
void writeLog(std::string text);
void setupVDC(HuC6270 *vdc);
void setupCPU(HuC6280 *cpu);
void setupRender(render *r);
bool startMemory();
bool isTimerEnable();
unsigned char* getVRAM();
private:
PCE pceLoader;
bool timerEnable;
unsigned char timerStart;
unsigned char mpr [0x8];
unsigned char wram [0x8000];
unsigned char HuCardROM [0x100000];
unsigned char vram [0x10000];
unsigned char interruptMask;
// CPU can access some registers of HuC6270(VDC) and HuC6260(VCE)
// So we will use *ptr to solve it =)
HuC6270* VDC;
HuC6280* CPU;
render* mRender;
// Only for debug purpose, log system
FILE *log;
};
#endif