mem16_t __fastcall _ext_memRead16(u32 mem) { switch (p) { case 1: // hwm return hwRead16(mem); case 2: // psh return psxHwRead16(mem); case 4: // b80 MEM_LOG("b800000 Memory read16 address %x\n", mem); return 0; case 5: // ba0 return ba0R16(mem); case 6: // gsm return gsRead16(mem); case 7: // dev9 { mem16_t retval = DEV9read16(mem & ~0xa4000000); SysPrintf("DEV9 read16 %8.8lx: %4.4lx\n", mem & ~0xa4000000, retval); return retval; } case 8: // spu2 return SPU2read(mem); } MEM_LOG("Unknown Memory read16 from address %8.8x\n", mem); cpuTlbMissR(mem, cpuRegs.branch); return 0; }
u16 psxMemRead16(u32 mem) { char *p; u32 t; psxRegs.cycle += 1; t = mem >> 16; if (t == 0x1f80 || t == 0x9f80 || t == 0xbf80) { if ((mem & 0xffff) < 0x400) return psxHu16(mem); else return psxHwRead16(mem); } else { p = (char *)(psxMemRLUT[t]); if (p != NULL) { if (Config.Debug) DebugCheckBP((mem & 0xffffff) | 0x80000000, BR2); return SWAPu16(*(u16 *)(p + (mem & 0xffff))); } else { #ifdef PSXMEM_LOG PSXMEM_LOG("err lh %8.8lx\n", mem); #endif return 0; } } }
u16 psxMemRead16(u32 mem) { u32 t; t = mem >> 16; if (t == 0x1f80) { if (mem < 0x1f801000) return psxHu16(mem); else return psxHwRead16(mem); } else { char *p = (char *)(psxMemRLUT[t]); if (p != NULL) { return SWAPu16(*(u16 *)(p + (mem & 0xffff))); } else { #ifdef PSXMEM_LOG PSXMEM_LOG("err lh %8.8lx\n", mem); #endif return 0; } } }