2010-12-28 01:53:15 +00:00
|
|
|
struct Memory {
|
|
|
|
uint8_t *data;
|
|
|
|
unsigned size;
|
|
|
|
|
|
|
|
uint8_t& operator[](unsigned addr);
|
|
|
|
void allocate(unsigned size);
|
|
|
|
void copy(const uint8_t *data, unsigned size);
|
|
|
|
void free();
|
|
|
|
Memory();
|
|
|
|
~Memory();
|
|
|
|
};
|
|
|
|
|
2010-12-29 11:03:42 +00:00
|
|
|
struct MMIO {
|
|
|
|
virtual uint8 mmio_read(uint16 addr) = 0;
|
|
|
|
virtual void mmio_write(uint16 addr, uint8 data) = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Unmapped : MMIO {
|
|
|
|
uint8 mmio_read(uint16) { return 0x00; }
|
|
|
|
void mmio_write(uint16, uint8) {}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Bus {
|
|
|
|
MMIO *mmio[65536];
|
2010-12-28 01:53:15 +00:00
|
|
|
uint8 read(uint16 addr);
|
|
|
|
void write(uint16 addr, uint8 data);
|
|
|
|
|
2010-12-29 11:03:42 +00:00
|
|
|
void power();
|
2010-12-28 01:53:15 +00:00
|
|
|
};
|
|
|
|
|
2010-12-29 11:03:42 +00:00
|
|
|
extern Unmapped unmapped;
|
2010-12-28 01:53:15 +00:00
|
|
|
extern Bus bus;
|