Core/burn/drv/capcom/cps_rw.cpp
// Read input port 0x000-0x1ff
Read input port 0x000-0x1ff
Read input port 0x000 - 0x1ff
static UINT8 CpsReadPort(const UINT32 ia)
{
	UINT8 d = 0xFF;
	if (ia == 0x000) {
		d = (UINT8)~Inp000;
		if (Pzloop2) {
			if (ReadPaddle) {
				d -= CpsPaddle2Value;
			} else {
				d = CpsPaddle2;
			}
		}
		return d;
	}
	if (ia == 0x001) {
		d = (UINT8)~Inp001;
		if (Pzloop2) {
			if (ReadPaddle) {
				d -= CpsPaddle1Value;
			} else {
				d = CpsPaddle1;
			}
		}
		return d;
	}
	if (ia == 0x010) {
		d = (UINT8)~Inp010;
		return d;
	}
	if (ia == 0x011) {
		d = (UINT8)~Inp011;
		return d;
	}
	if (ia == 0x012) {
		d = (UINT8)~Inp012;
		return d;
	}
	if (ia == 0x018) {
		d = (UINT8)~Inp018;
		return d;
	}
	if (ia == 0x019) {
		d = (UINT8)~Inp019;
		return d;
	}
	if (ia == 0x01B) {
		d = (UINT8)~Inp01B;
		return d;
	}
	if (ia == 0x01A) {
		d = (UINT8)~Cpi01A;
		return d;
	}
	if (ia == 0x01C) {
		d = (UINT8)~Cpi01C;
		return d;
	}
	if (ia == 0x01E) {
		d = (UINT8)~Cpi01E;
		return d;
	}
	if (Cps == 2) {
		if (ia == 0x020) {
			d = (UINT8)~Inp020;
			return d;
		}
		if (ia == 0x021) {
			d = (UINT8)~Inp021;
			d &= 0xFE;
			d |= EEPROMRead();
			return d;
		}
		if (ia == 0x030) {
			if (Ssf2tb) {
				d = 0x20;
			} else {
				d = Cps2VolumeStates[Cps2Volume] >> 8;
				if (Cps2DisableDigitalVolume) d = 0xd0;
			}
			return d;
		}
		if (ia == 0x031) {
			d = Cps2VolumeStates[Cps2Volume] & 0xff;
			return d;
		}
		if (ia >= 0x0100 && ia < 0x0200) {
			static INT32 nRasterLine;
			if ((ia & 0x0FE) == 0x50) {
				if ((ia & 1) == 0) {
					nRasterLine = nIrqLine50 - SekCurrentScanline();
					return nRasterLine >> 8;
				} else {
					return nRasterLine & 0xFF;
				}
			}
			if ((ia & 0x0FE) == 0x52) {
				if ((ia & 1) == 0) {
					nRasterLine = nIrqLine52 - SekCurrentScanline();
					return nRasterLine >> 8;
				} else {
					return nRasterLine & 0xFF;
				}
			}
		}
	} else {
		if (ia == 0x100 + CpsBID[0]) {
			d = (UINT8)CpsBID[1];
			return d;
		}
		if (ia == 0x100 + (CpsBID[0] + 1)) {
			d = (UINT8)CpsBID[2];
			return d;
		}
		if (Sf2thndr) {
			if (ia == 0x1c8) {
				d = (UINT8)CpsBID[1];
				return d;
			}
			if (ia == 0x1c9) {
				d = (UINT8)CpsBID[2];
				return d;
			}
		}
		if (ia == 0xC007) {
			if (Cps1Qs || CpsBootlegEEPROM) {
				return EEPROMRead();
			} else {
				return 0;
			}
		}
		if (PangEEP == 1) {
			if (ia == 0x17B) {
				return EEPROMRead();
			}
		}
		if (ia == 0x006) {
			d = (UINT8)~Inp006;
			return d;
		}
		if (ia == 0x007) {
			d = (UINT8)~Inp007;
			return d;
		}
		if (ia == 0x008) {
			d = (UINT8)~Inp008;
			return d;
		}
		if (ia == 0x029) {
			d = (UINT8)~Inp029;
			return d;
		}		
		if (ia == 0x176) {
			d = (UINT8)~Inp176;
			return d;
		}
		if (ia == 0x177) {
			d = (UINT8)~Inp177;
			return d;
		}		
		if (ia == 0x179) {
			d = (UINT8)~Inp179;
			return d;
		}
		if (ia == 0x186) {
			d = (UINT8)~Inp186;
			return d;
		}		
		if (ia == 0x1fd) {
			d = (UINT8)~Inp1fd;
			return d;
		}		
		if (ia == 0xC000) {
			d = (UINT8)~Inpc000;
			return d;
		}
		if (ia == 0xC001) {
			d = (UINT8)~Inpc001;
			return d;
		}
		if (ia == 0xC002) {
			d = (UINT8)~Inpc002;
			return d;
		}
		if (ia == 0xC003) {
			d = (UINT8)~Inpc003;
			return d;
		}
		if (Forgottn) {
			if (ia == 0x053) {
				return (nDial055 >>  8) & 0xFF;
			}
			if (ia == 0x055) {
				return (nDial055 >> 16) & 0xFF;
			}
			if (ia == 0x05B) {
				return (nDial05d >>  8) & 0xFF;
			}
			if (ia == 0x05D) {
				return (nDial05d >> 16) & 0xFF;
			}
		}	
	}
	return d;
}
static UINT8 CpsReadPort ( const UINT32 ia ) { UINT8 d = 0xFF ; if ( ia == 0x000 ) { d = ( UINT8 ) ~ Inp000 ; if ( Pzloop2 ) { if ( ReadPaddle ) { d -= CpsPaddle2Value ; } else { d = CpsPaddle2 ; } } return d ; } if ( ia == 0x001 ) { d = ( UINT8 ) ~ Inp001 ; if ( Pzloop2 ) { if ( ReadPaddle ) { d -= CpsPaddle1Value ; } else { d = CpsPaddle1 ; } } return d ; } if ( ia == 0x010 ) { d = ( UINT8 ) ~ Inp010 ; return d ; } if ( ia == 0x011 ) { d = ( UINT8 ) ~ Inp011 ; return d ; } if ( ia == 0x012 ) { d = ( UINT8 ) ~ Inp012 ; return d ; } if ( ia == 0x018 ) { d = ( UINT8 ) ~ Inp018 ; return d ; } if ( ia == 0x019 ) { d = ( UINT8 ) ~ Inp019 ; return d ; } if ( ia == 0x01B ) { d = ( UINT8 ) ~ Inp01B ; return d ; } if ( ia == 0x01A ) { d = ( UINT8 ) ~ Cpi01A ; return d ; } if ( ia == 0x01C ) { d = ( UINT8 ) ~ Cpi01C ; return d ; } if ( ia == 0x01E ) { d = ( UINT8 ) ~ Cpi01E ; return d ; } if ( Cps == 2 ) { if ( ia == 0x020 ) { d = ( UINT8 ) ~ Inp020 ; return d ; } if ( ia == 0x021 ) { d = ( UINT8 ) ~ Inp021 ; d &= 0xFE ; d |= EEPROMRead ( ) ; return d ; } if ( ia == 0x030 ) { if ( Ssf2tb ) { d = 0x20 ; } else { d = Cps2VolumeStates [ Cps2Volume ] >> 8 ; if ( Cps2DisableDigitalVolume ) d = 0xd0 ; } return d ; } if ( ia == 0x031 ) { d = Cps2VolumeStates [ Cps2Volume ] & 0xff ; return d ; } if ( ia >= 0x0100 && ia < 0x0200 ) { static INT32 nRasterLine ; if ( ( ia & 0x0FE ) == 0x50 ) { if ( ( ia & 1 ) == 0 ) { nRasterLine = nIrqLine50 - SekCurrentScanline ( ) ; return nRasterLine >> 8 ; } else { return nRasterLine & 0xFF ; } } if ( ( ia & 0x0FE ) == 0x52 ) { if ( ( ia & 1 ) == 0 ) { nRasterLine = nIrqLine52 - SekCurrentScanline ( ) ; return nRasterLine >> 8 ; } else { return nRasterLine & 0xFF ; } } } } else { if ( ia == 0x100 + CpsBID [ 0 ] ) { d = ( UINT8 ) CpsBID [ 1 ] ; return d ; } if ( ia == 0x100 + ( CpsBID [ 0 ] + 1 ) ) { d = ( UINT8 ) CpsBID [ 2 ] ; return d ; } if ( Sf2thndr ) { if ( ia == 0x1c8 ) { d = ( UINT8 ) CpsBID [ 1 ] ; return d ; } if ( ia == 0x1c9 ) { d = ( UINT8 ) CpsBID [ 2 ] ; return d ; } } if ( ia == 0xC007 ) { if ( Cps1Qs || CpsBootlegEEPROM ) { return EEPROMRead ( ) ; } else { return 0 ; } } if ( PangEEP == 1 ) { if ( ia == 0x17B ) { return EEPROMRead ( ) ; } } if ( ia == 0x006 ) { d = ( UINT8 ) ~ Inp006 ; return d ; } if ( ia == 0x007 ) { d = ( UINT8 ) ~ Inp007 ; return d ; } if ( ia == 0x008 ) { d = ( UINT8 ) ~ Inp008 ; return d ; } if ( ia == 0x029 ) { d = ( UINT8 ) ~ Inp029 ; return d ; } if ( ia == 0x176 ) { d = ( UINT8 ) ~ Inp176 ; return d ; } if ( ia == 0x177 ) { d = ( UINT8 ) ~ Inp177 ; return d ; } if ( ia == 0x179 ) { d = ( UINT8 ) ~ Inp179 ; return d ; } if ( ia == 0x186 ) { d = ( UINT8 ) ~ Inp186 ; return d ; } if ( ia == 0x1fd ) { d = ( UINT8 ) ~ Inp1fd ; return d ; } if ( ia == 0xC000 ) { d = ( UINT8 ) ~ Inpc000 ; return d ; } if ( ia == 0xC001 ) { d = ( UINT8 ) ~ Inpc001 ; return d ; } if ( ia == 0xC002 ) { d = ( UINT8 ) ~ Inpc002 ; return d ; } if ( ia == 0xC003 ) { d = ( UINT8 ) ~ Inpc003 ; return d ; } if ( Forgottn ) { if ( ia == 0x053 ) { return ( nDial055 >> 8 ) & 0xFF ; } if ( ia == 0x055 ) { return ( nDial055 >> 16 ) & 0xFF ; } if ( ia == 0x05B ) { return ( nDial05d >> 8 ) & 0xFF ; } if ( ia == 0x05D ) { return ( nDial05d >> 16 ) & 0xFF ; } } } return d ; }
Read input port 0x000-0x1ff
Read input port 0x000 - 0x1ff
// Used on CPS2 only I think // CPS2 Volume control //			bprintf(PRINT_NORMAL, _T("  - port 0x%02X (%3i)\n"), ia & 255, SekCurrentScanline()); // The linecounters seem to return the line at which the last IRQ triggered by this counter is scheduled minus the current line // Board ID // this reads the B-ID from here on startup as well as the normal location in-game // CPS1 EEPROM read // Pang3 EEPROM // Extra Input ports (move from game-to-game) // Forgotten Worlds Dial //	bprintf(PRINT_NORMAL, _T("Read Port %x\n"), ia);