Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alexbevi
GitHub Repository: alexbevi/BizHawk
Path: blob/master/libsnes/bsnes/gameboy/cpu/cpu.hpp
2 views
1
struct CPU : Processor, MMIO {
2
#include "core/core.hpp"
3
#include "mmio/mmio.hpp"
4
#include "timing/timing.hpp"
5
6
bool trace;
7
8
enum class Interrupt : unsigned {
9
Vblank,
10
Stat,
11
Timer,
12
Serial,
13
Joypad,
14
};
15
16
struct Status {
17
unsigned clock;
18
bool halt;
19
bool stop;
20
bool ei;
21
bool ime;
22
23
//$ff00 JOYP
24
bool p15;
25
bool p14;
26
uint8 joyp;
27
uint8 mlt_req;
28
29
//$ff01 SB
30
uint8 serial_data;
31
unsigned serial_bits;
32
33
//$ff02 SC
34
bool serial_transfer;
35
bool serial_clock;
36
37
//$ff04 DIV
38
uint8 div;
39
40
//$ff05 TIMA
41
uint8 tima;
42
43
//$ff06 TMA
44
uint8 tma;
45
46
//$ff07 TAC
47
bool timer_enable;
48
unsigned timer_clock;
49
50
//$ff0f IF
51
bool interrupt_request_joypad;
52
bool interrupt_request_serial;
53
bool interrupt_request_timer;
54
bool interrupt_request_stat;
55
bool interrupt_request_vblank;
56
57
//$ff4d KEY1
58
bool speed_double;
59
bool speed_switch;
60
61
//$ff51,$ff52 HDMA1,HDMA2
62
uint16 dma_source;
63
64
//$ff53,$ff54 HDMA3,HDMA4
65
uint16 dma_target;
66
67
//$ff55 HDMA5
68
bool dma_mode;
69
uint16 dma_length;
70
71
//$ff6c ???
72
uint8 ff6c;
73
74
//$ff70 SVBK
75
uint3 wram_bank;
76
77
//$ff72-$ff75 ???
78
uint8 ff72;
79
uint8 ff73;
80
uint8 ff74;
81
uint8 ff75;
82
83
//$ffff IE
84
bool interrupt_enable_joypad;
85
bool interrupt_enable_serial;
86
bool interrupt_enable_timer;
87
bool interrupt_enable_stat;
88
bool interrupt_enable_vblank;
89
} status;
90
91
uint8* wram; //[32768]; //GB=8192, GBC=32768
92
uint8* hram; //[128];
93
94
static void Main();
95
void main();
96
void interrupt_raise(Interrupt id);
97
void interrupt_test();
98
void interrupt_exec(uint16 pc);
99
void power();
100
101
void serialize(serializer&);
102
void initialize();
103
CPU();
104
~CPU();
105
};
106
107
extern CPU cpu;
108
109