CPUUpdateRegister((address & 0x3FC), value & 0xFFFF); CPUUpdateRegister((address & 0x3FC) + 2, (value >> 16));
if(address < 0x4000400) { CPUUpdateRegister((address & 0x3FC), value & 0xFFFF); CPUUpdateRegister((address & 0x3FC) + 2, (value >> 16)); } else goto unwritable;
inline void CPUWriteMemory(u32 address, u32 value){#ifdef DEV_VERSION  if(address & 3) {    if(systemVerbose & VERBOSE_UNALIGNED_MEMORY) {      log("Unaliagned word write: %08x to %08x from %08x\n",          value,          address,          armMode ? armNextPC - 4 : armNextPC - 2);    }  }#endif    switch(address >> 24) {  case 0x02:#ifdef SDL    if(*((u32 *)&freezeWorkRAM[address & 0x3FFFC]))      cheatsWriteMemory((u32 *)&workRAM[address & 0x3FFFC],                        value,                        *((u32 *)&freezeWorkRAM[address & 0x3FFFC]));    else#endif      WRITE32LE(((u32 *)&workRAM[address & 0x3FFFC]), value);    break;  case 0x03:#ifdef SDL    if(*((u32 *)&freezeInternalRAM[address & 0x7ffc]))      cheatsWriteMemory((u32 *)&internalRAM[address & 0x7FFC],                        value,                        *((u32 *)&freezeInternalRAM[address & 0x7ffc]));    else#endif      WRITE32LE(((u32 *)&internalRAM[address & 0x7ffC]), value);    break;  case 0x04:    CPUUpdateRegister((address & 0x3FC), value & 0xFFFF);    CPUUpdateRegister((address & 0x3FC) + 2, (value >> 16));    break;  case 0x05:    WRITE32LE(((u32 *)&paletteRAM[address & 0x3FC]), value);    break;  case 0x06:    if(address & 0x10000)      WRITE32LE(((u32 *)&vram[address & 0x17ffc]), value);    else      WRITE32LE(((u32 *)&vram[address & 0x1fffc]), value);    break;  case 0x07:    WRITE32LE(((u32 *)&oam[address & 0x3fc]), value);    break;  case 0x0D:    if(cpuEEPROMEnabled) {      eepromWrite(address, value);      break;    }    goto unwritable;  case 0x0E:    if(!eepromInUse | cpuSramEnabled | cpuFlashEnabled) {      (*cpuSaveGameFunc)(address, (u8)value);      break;    }    // default  default:  unwritable:#ifdef DEV_VERSION    if(systemVerbose & VERBOSE_ILLEGAL_WRITE) {      log("Illegal word write: %08x to %08x from %08x\n",          value,          address,          armMode ? armNextPC - 4 : armNextPC - 2);    }#endif    break;  }}