unsigned char cdrRead1(void) { if (cdr.ResultReady) { // && cdr.Ctrl & 0x1) { psxHu8(0x1801) = cdr.Result[cdr.ResultP++]; if (cdr.ResultP == cdr.ResultC) cdr.ResultReady = 0; } else psxHu8(0x1801) = 0; #ifdef CDR_LOG CDR_LOG("cdrRead1() Log: CD1 Read: %x\n", psxHu8(0x1801)); #endif return psxHu8(0x1801); }
unsigned char cdrRead3(void) { if (cdr.Stat) { if (cdr.Ctrl & 0x1) psxHu8(0x1803) = cdr.Stat | 0xE0; else psxHu8(0x1803) = 0xff; } else psxHu8(0x1803) = 0; #ifdef CDR_LOG CDR_LOG("cdrRead3() Log: CD3 Read: %x\n", psxHu8(0x1803)); #endif return psxHu8(0x1803); }
u8 cdrRead3(void) { if (cdr.Stat) { if (cdr.Ctrl & 0x1) psxHu8(0x1803) = cdr.Stat | 0xE0; else psxHu8(0x1803) = 0xff; } else psxHu8(0x1803) = 0; CDVD_LOG("CD3 Read: %x", psxHu8(0x1803)); return psxHu8(0x1803); }
u8 cdrRead1(void) { if (cdr.ResultReady && cdr.Ctrl & 0x1) { psxHu8(0x1801) = cdr.Result[cdr.ResultP++]; if (cdr.ResultP == cdr.ResultC) cdr.ResultReady = 0; } else psxHu8(0x1801) = 0; CDVD_LOG("CD1 Read: %x", psxHu8(0x1801)); return psxHu8(0x1801); }
u8 psxHwRead8(u32 add) { unsigned char hard; switch (add) { case 0x1f801040: hard = sioRead8();break; #ifdef ENABLE_SIO1API case 0x1f801050: hard = SIO1_readData8(); break; #endif case 0x1f801800: hard = cdrRead0(); break; case 0x1f801801: hard = cdrRead1(); break; case 0x1f801802: hard = cdrRead2(); break; case 0x1f801803: hard = cdrRead3(); break; default: hard = psxHu8(add); #ifdef PSXHW_LOG PSXHW_LOG("*Unkwnown 8bit read at address %x\n", add); #endif return hard; } #ifdef PSXHW_LOG PSXHW_LOG("*Known 8bit read at address %x value %x\n", add, hard); #endif return hard; }
void psxMemWrite8(u32 mem, u8 value) { char *p; u32 t; psxRegs.cycle += 1; t = mem >> 16; if (t == 0x1f80 || t == 0x9f80 || t == 0xbf80) { if ((mem & 0xffff) < 0x400) psxHu8(mem) = value; else psxHwWrite8(mem, value); } else { p = (char *)(psxMemWLUT[t]); if (p != NULL) { if (Config.Debug) DebugCheckBP((mem & 0xffffff) | 0x80000000, BW1); *(u8 *)(p + (mem & 0xffff)) = value; #ifdef PSXREC psxCpu->Clear((mem & (~3)), 1); #endif } else { #ifdef PSXMEM_LOG PSXMEM_LOG("err sb %8.8lx\n", mem); #endif } } }
u8 psxMemRead8(u32 mem) { char *p; u32 t; psxRegs.cycle += 0; t = mem >> 16; if (t == 0x1f80 || t == 0x9f80 || t == 0xbf80) { if ((mem & 0xffff) < 0x400) return psxHu8(mem); else return psxHwRead8(mem); } else { p = (char *)(psxMemRLUT[t]); if (p != NULL) { if (Config.Debug) DebugCheckBP((mem & 0xffffff) | 0x80000000, BR1); return *(u8 *)(p + (mem & 0xffff)); } else { #ifdef PSXMEM_LOG PSXMEM_LOG("err lb %8.8lx\n", mem); #endif return 0; } } }
void psxHwWrite8(u32 add, u8 value) { switch (add) { case 0x1f801040: sioWrite8(value); break; #ifdef ENABLE_SIO1API case 0x1f801050: SIO1_writeData8(value); break; #endif case 0x1f801800: cdrWrite0(value); break; case 0x1f801801: cdrWrite1(value); break; case 0x1f801802: cdrWrite2(value); break; case 0x1f801803: cdrWrite3(value); break; default: psxHu8(add) = value; #ifdef PSXHW_LOG PSXHW_LOG("*Unknown 8bit write at address %x value %x\n", add, value); #endif return; } psxHu8(add) = value; #ifdef PSXHW_LOG PSXHW_LOG("*Known 8bit write at address %x value %x\n", add, value); #endif }
mem8_t __fastcall iopHwRead8_Page8( u32 addr ) { HwAddrPrep( 8 ); mem8_t ret; if( addr == HW_SIO2_FIFO ) ret = sio2_fifoOut();//sio2 serial data feed/fifo_out else ret = psxHu8( addr ); PSXHW_LOG( "HwRead8 from %s, addr 0x%08x = 0x%02x", _log_GetIopHwName<mem8_t>( addr ), addr, psxHu8(addr) ); return ret; }
mem8_t __fastcall iopHwRead8_Page3( u32 addr ) { // all addresses are assumed to be prefixed with 0x1f803xxx: HwAddrPrep( 3 ); mem8_t ret; if( addr == 0x1f803100 ) // PS/EE/IOP conf related ret = 0x10; // Dram 2M else ret = psxHu8( addr ); PSXHW_LOG( "HwRead8 from %s, addr 0x%08x = 0x%02x", _log_GetIopHwName<mem8_t>( addr ), addr, psxHu8(addr) ); return ret; }
unsigned char cdrRead0(void) { if (cdr.ResultReady) cdr.Ctrl|= 0x20; else cdr.Ctrl&=~0x20; if (cdr.OCUP) cdr.Ctrl|= 0x40; // else cdr.Ctrl&=~0x40; // what means the 0x10 and the 0x08 bits? i only saw it used by the bios cdr.Ctrl|=0x18; #ifdef CDR_LOG CDR_LOG("cdrRead0() Log: CD0 Read: %x\n", cdr.Ctrl); #endif return psxHu8(0x1800) = cdr.Ctrl; }
u8 cdrRead0(void) { if (cdr.ResultReady) cdr.Ctrl |= 0x20; else cdr.Ctrl &= ~0x20; if (cdr.OCUP) cdr.Ctrl |= 0x40; else cdr.Ctrl &= ~0x40; // what means the 0x10 and the 0x08 bits? i only saw it used by the bios cdr.Ctrl|=0x18; CDVD_LOG("CD0 Read: %x", cdr.Ctrl); return psxHu8(0x1800) = cdr.Ctrl; }
u8 psxMemRead8(u32 mem) { u32 t; t = mem >> 16; if (t == 0x1f80) { if (mem < 0x1f801000) return psxHu8(mem); else return psxHwRead8(mem); } else { char *p = (char *)(psxMemRLUT[t]); if (p != NULL) { return *(u8 *)(p + (mem & 0xffff)); } else { #ifdef PSXMEM_LOG PSXMEM_LOG("err lb %8.8lx\n", mem); #endif return 0; } } }
void psxMemWrite8(u32 mem, u8 value) { u32 t; t = mem >> 16; if (t == 0x1f80) { if (mem < 0x1f801000) psxHu8(mem) = value; else psxHwWrite8(mem, value); } else { char *p = (char *)(psxMemWLUT[t]); if (p != NULL) { *(u8 *)(p + (mem & 0xffff)) = value; #ifdef PSXREC psxCpu->Clear((mem&(~3)), 1); #endif } else { #ifdef PSXMEM_LOG PSXMEM_LOG("err sb %8.8lx\n", mem); #endif } } }
u8 psxHwRead8(u32 add) { return psxHu8(add); }
void psxHwWrite8(u32 add, u8 value) { psxHu8(add) = value; }