if(flags) { if(flags & 0x01) {  memset(workRAM, 0, 0x40000); } if(flags & 0x02) {  memset(internalRAM, 0, 0x7e00); } if(flags & 0x04) {  memset(paletteRAM, 0, 0x400); } if(flags & 0x08) {  memset(vram, 0, 0x18000); } if(flags & 0x10) {  memset(oam, 0, 0x400); }
void BIOS_RegisterRamReset(u32 flags){  // no need to trace here. this is only called directly from GBA.cpp  // to emulate bios initialization    if(flags) {    if(flags & 0x01) {      // clear work RAM      memset(workRAM, 0, 0x40000);    }    if(flags & 0x02) {      // clear internal RAM      memset(internalRAM, 0, 0x7e00); // don't clear 0x7e00-0x7fff    }    if(flags & 0x04) {      // clear palette RAM      memset(paletteRAM, 0, 0x400);    }    if(flags & 0x08) {      // clear VRAM      memset(vram, 0, 0x18000);    }    if(flags & 0x10) {      // clean OAM      memset(oam, 0, 0x400);    }    if(flags & 0x80) {      int i;      for(i = 0; i < 8; i++)        CPUUpdateRegister(0x200+i*2, 0);      CPUUpdateRegister(0x202, 0xFFFF);      for(i = 0; i < 8; i++)        CPUUpdateRegister(0x4+i*2, 0);      for(i = 0; i < 16; i++)        CPUUpdateRegister(0x20+i*2, 0);      for(i = 0; i < 24; i++)        CPUUpdateRegister(0xb0+i*2, 0);      CPUUpdateRegister(0x130, 0);      CPUUpdateRegister(0x20, 0x100);      CPUUpdateRegister(0x30, 0x100);      CPUUpdateRegister(0x26, 0x100);      CPUUpdateRegister(0x36, 0x100);    }        if(flags & 0x20) {      int i;      for(i = 0; i < 8; i++)        CPUUpdateRegister(0x110+i*2, 0);      CPUUpdateRegister(0x134, 0x8000);      for(i = 0; i < 7; i++)        CPUUpdateRegister(0x140+i*2, 0);    }    if(flags & 0x40) {      int i;      CPUWriteByte(0x4000084, 0);      CPUWriteByte(0x4000084, 0x80);      CPUWriteMemory(0x4000080, 0x880e0000);      CPUUpdateRegister(0x88, CPUReadHalfWord(0x4000088)&0x3ff);      CPUWriteByte(0x4000070, 0x70);      for(i = 0; i < 8; i++)        CPUUpdateRegister(0x90+i*2, 0);      CPUWriteByte(0x4000070, 0);      for(i = 0; i < 8; i++)        CPUUpdateRegister(0x90+i*2, 0);      CPUWriteByte(0x4000084, 0);    }  }}