2011-01-02 04:46:54 +00:00
|
|
|
struct Cartridge : property<Cartridge> {
|
|
|
|
#include "mbc0/mbc0.hpp"
|
|
|
|
#include "mbc1/mbc1.hpp"
|
|
|
|
|
|
|
|
enum Mapper : unsigned {
|
|
|
|
MBC0,
|
|
|
|
MBC1,
|
|
|
|
Unknown,
|
|
|
|
};
|
2010-12-29 11:03:42 +00:00
|
|
|
|
2010-12-28 01:53:15 +00:00
|
|
|
struct Information {
|
|
|
|
string name;
|
|
|
|
uint8 cgbflag;
|
|
|
|
uint8 sgbflag;
|
2011-01-02 04:46:54 +00:00
|
|
|
|
|
|
|
Mapper mapper;
|
|
|
|
bool ram;
|
|
|
|
bool battery;
|
|
|
|
bool rtc;
|
|
|
|
|
2010-12-28 01:53:15 +00:00
|
|
|
unsigned romsize;
|
|
|
|
unsigned ramsize;
|
|
|
|
} info;
|
|
|
|
|
|
|
|
readonly<bool> loaded;
|
|
|
|
|
2010-12-29 11:03:42 +00:00
|
|
|
uint8_t *romdata;
|
|
|
|
unsigned romsize;
|
|
|
|
|
|
|
|
uint8_t *ramdata;
|
|
|
|
unsigned ramsize;
|
|
|
|
|
2010-12-28 01:53:15 +00:00
|
|
|
void load(uint8_t *data, unsigned size);
|
|
|
|
void unload();
|
2010-12-29 11:03:42 +00:00
|
|
|
|
2011-01-02 04:46:54 +00:00
|
|
|
uint8 rom_read(unsigned addr);
|
|
|
|
void rom_write(unsigned addr, uint8 data);
|
|
|
|
uint8 ram_read(unsigned addr);
|
|
|
|
void ram_write(unsigned addr, uint8 data);
|
|
|
|
|
2010-12-29 11:03:42 +00:00
|
|
|
void power();
|
|
|
|
void reset();
|
|
|
|
|
2010-12-28 01:53:15 +00:00
|
|
|
Cartridge();
|
2010-12-29 11:03:42 +00:00
|
|
|
~Cartridge();
|
2010-12-28 01:53:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
extern Cartridge cartridge;
|