struct CPU : Processor, MMIO {
#include "core/core.hpp"
#include "mmio/mmio.hpp"
#include "timing/timing.hpp"
bool trace;
enum class Interrupt : unsigned {
Vblank,
Stat,
Timer,
Serial,
Joypad,
};
struct Status {
unsigned clock;
bool halt;
bool stop;
bool ei;
bool ime;
bool p15;
bool p14;
uint8 joyp;
uint8 mlt_req;
uint8 serial_data;
unsigned serial_bits;
bool serial_transfer;
bool serial_clock;
uint8 div;
uint8 tima;
uint8 tma;
bool timer_enable;
unsigned timer_clock;
bool interrupt_request_joypad;
bool interrupt_request_serial;
bool interrupt_request_timer;
bool interrupt_request_stat;
bool interrupt_request_vblank;
bool speed_double;
bool speed_switch;
uint16 dma_source;
uint16 dma_target;
bool dma_mode;
uint16 dma_length;
uint8 ff6c;
uint3 wram_bank;
uint8 ff72;
uint8 ff73;
uint8 ff74;
uint8 ff75;
bool interrupt_enable_joypad;
bool interrupt_enable_serial;
bool interrupt_enable_timer;
bool interrupt_enable_stat;
bool interrupt_enable_vblank;
} status;
uint8* wram;
uint8* hram;
static void Main();
void main();
void interrupt_raise(Interrupt id);
void interrupt_test();
void interrupt_exec(uint16 pc);
void power();
void serialize(serializer&);
void initialize();
CPU();
~CPU();
};
extern CPU cpu;