Debian Codegraph @

gba/system/bios.cpp

raw
1 uint32 BIOS::read(uint32 addr, uint32 size) {
2 //GBA BIOS is read-protected; only the BIOS itself can read its own memory
3 //when accessed elsewhere; this returns the last value read by the BIOS program
4 if(cpu.r(15) >= 0x02000000) return mdr;
5
6 if(size == Word) return mdr = read(addr &~ 2, Half) << 0 | read(addr | 2, Half) << 16;
7 if(size == Half) return mdr = read(addr &~ 1, Byte) << 0 | read(addr | 1, Byte) << 8;
8 return mdr = data[addr & 0x3fff];
9 }
10
11 void BIOS::write(uint32 addr, uint32 size, uint32 word) {
12 }
13
14 BIOS::BIOS() {
15 data = new uint8[size = 16384]();
16 }
17
18 BIOS::~BIOS() {
19 delete[] data;
20 }