void GBMemory::write(int addr, u8 value)
{
if (addr < 0x8000) mbc->write(addr, value);
- else if (addr < 0xA000) core->video->write_VRAM(addr, value);
+ else if (addr < 0xA000) core->video.write_VRAM(addr, value);
else if (addr < 0xC000) mbc->write(addr, value);
else if (addr < 0xD000) WRAM0[addr - WRAM0_BASE] = value;
else if (addr < 0xE000) WRAM1[addr - WRAM1_BASE] = value;
else if (addr < 0xFDFF) write(addr-0x2000, value);
- else if (addr < 0xFEA0) core->video->write_OAM (addr, value);
+ else if (addr < 0xFEA0) core->video.write_OAM (addr, value);
else if (addr >= 0xFF00 && addr <= 0xFF7F) {
IO.write(addr,value);
}
u8 GBMemory::read(int addr) const
{
if (addr < 0x8000) return mbc->read(addr);
- else if (addr < 0xA000) return core->video->read_VRAM(addr);
+ else if (addr < 0xA000) return core->video.read_VRAM(addr);
else if (addr < 0xC000) return mbc->read(addr);
else if (addr < 0xD000) return WRAM0[addr - WRAM0_BASE];
else if (addr < 0xE000) return WRAM1[addr - WRAM1_BASE];
else if (addr < 0xFDFF) return read(addr-0x2000);
- else if (addr < 0xFEA0) return core->video->read_OAM (addr);
+ else if (addr < 0xFEA0) return core->video.read_OAM (addr);
else if (addr >= 0xFF00 && addr <= 0xFF7F)
return IO.read(addr);
else if (addr >= 0xFF80 && addr <= 0xFFFE) return HRAM[addr - HRAM_BASE];
u8 VRAM[8192];
u8 OAM[];
+ public:
+ u8 read_VRAM (int addr) const;
+ u8 read_OAM (int addr) const;
+ void write_VRAM(int addr, u8 value);
+ void write_OAM (int addr, u8 value);
};