--- np2/io/iocore.c 2004/03/19 03:36:52 1.14 +++ np2/io/iocore.c 2005/02/12 12:40:39 1.21 @@ -33,6 +33,10 @@ _SYSPORT sysport; _UPD4990 uPD4990; +#if defined(SUPPORT_PC9821) + _PCIDEV pcidev; +#endif + // ---- @@ -63,10 +67,12 @@ static UINT8 ioterminate[0x100]; static void IOOUTCALL defout8(UINT port, REG8 dat) { +#if !defined(DISABLE_SOUND) if ((port & 0xfff0) == cs4231.port) { cs4231io_w8(port, dat); return; } +#endif if ((port & 0xf0ff) == 0x801e) { dipsw_w8(port, dat); return; @@ -76,9 +82,11 @@ static void IOOUTCALL defout8(UINT port, static REG8 IOINPCALL definp8(UINT port) { +#if !defined(DISABLE_SOUND) if ((port & 0xfff0) == cs4231.port) { return(cs4231io_r8(port)); } +#endif if ((port & 0xf0ff) == 0x801e) { return(dipsw_r8(port)); } @@ -235,7 +243,7 @@ void iocore_attachsysinpex(UINT port, UI // ---- -static BOOL makesndiofunc(UINT port) { +static BRESULT makesndiofunc(UINT port) { IOFUNC tbl[2]; UINT num; @@ -265,9 +273,9 @@ static BOOL makesndiofunc(UINT port) { return(SUCCESS); } -BOOL iocore_attachsndout(UINT port, IOOUT func) { +BRESULT iocore_attachsndout(UINT port, IOOUT func) { - BOOL r; + BRESULT r; UINT num; r = makesndiofunc(port); @@ -281,9 +289,9 @@ BOOL iocore_attachsndout(UINT port, IOOU return(r); } -BOOL iocore_attachsndinp(UINT port, IOINP func) { +BRESULT iocore_attachsndinp(UINT port, IOINP func) { - BOOL r; + BRESULT r; UINT num; r = makesndiofunc(port); @@ -316,7 +324,7 @@ static IOFUNC getextiofunc(UINT port) { return(iof); } -BOOL iocore_attachout(UINT port, IOOUT func) { +BRESULT iocore_attachout(UINT port, IOOUT func) { IOFUNC iof; @@ -330,7 +338,7 @@ BOOL iocore_attachout(UINT port, IOOUT f } } -BOOL iocore_attachinp(UINT port, IOINP func) { +BRESULT iocore_attachinp(UINT port, IOINP func) { IOFUNC iof; @@ -355,7 +363,7 @@ const UINT8 *p; ZeroMemory(&iocore, sizeof(iocore)); ZeroMemory(ioterminate, sizeof(ioterminate)); - for (i=0; i<(sizeof(termtbl)/sizeof(TERMTBL)); i++) { + for (i=0; iiotbl = NULL; } -BOOL iocore_build(void) { +BRESULT iocore_build(void) { IOCORE ioc; IOFUNC cmn; @@ -431,10 +439,7 @@ static const IOCBFN resetfn[] = { // extend artic_reset, egc_reset, np2sysp_reset, - necio_reset, epsonio_reset, -#if !defined(CPUCORE_IA32) - emsio_reset, -#endif + necio_reset, epsonio_reset, emsio_reset, #if defined(SUPPORT_PC9821) pcidev_reset, #endif @@ -453,10 +458,7 @@ static const IOCBFN bindfn[] = { // extend artic_bind, egc_bind, np2sysp_bind, - necio_bind, epsonio_bind, -#if !defined(CPUCORE_IA32) - emsio_bind, -#endif + necio_bind, epsonio_bind, emsio_bind, #if defined(SUPPORT_PC9821) pcidev_bind, #endif @@ -473,20 +475,20 @@ void iocore_cb(const IOCBFN *cbfn, UINT void iocore_reset(void) { - iocore_cb(resetfn, sizeof(resetfn)/sizeof(IOCBFN)); + iocore_cb(resetfn, NELEMENTS(resetfn)); } void iocore_bind(void) { iocore.busclock = pccore.multiple; - iocore_cb(bindfn, sizeof(bindfn)/sizeof(IOCBFN)); + iocore_cb(bindfn, NELEMENTS(bindfn)); } void IOOUTCALL iocore_out8(UINT port, REG8 dat) { IOFUNC iof; -// VERBOSE(("iocore_out8(%x, %x)", port, dat)); +// TRACEOUT(("iocore_out8(%.2x, %.2x)", port, dat)); CPU_REMCLOCK -= iocore.busclock; iof = iocore.base[(port >> 8) & 0xff]; iof->ioout[port & 0xff](port, dat); @@ -495,17 +497,20 @@ void IOOUTCALL iocore_out8(UINT port, RE REG8 IOINPCALL iocore_inp8(UINT port) { IOFUNC iof; + REG8 ret; -// VERBOSE(("iocore_inp8(%x)", port)); CPU_REMCLOCK -= iocore.busclock; iof = iocore.base[(port >> 8) & 0xff]; - return(iof->ioinp[port & 0xff](port)); + ret = iof->ioinp[port & 0xff](port); +// TRACEOUT(("iocore_inp8(%.2x) -> %.2x", port, ret)); + return(ret); } void IOOUTCALL iocore_out16(UINT port, REG16 dat) { IOFUNC iof; +// TRACEOUT(("iocore_out16(%.4x, %.4x)", port, dat)); CPU_REMCLOCK -= iocore.busclock; #if defined(SUPPORT_IDEIO) if (port == 0x0640) { @@ -582,6 +587,7 @@ REG16 IOINPCALL iocore_inp16(UINT port) void IOOUTCALL iocore_out32(UINT port, UINT32 dat) { + CPU_REMCLOCK -= iocore.busclock; #if defined(SUPPORT_PC9821) if ((port & 0xfffb) == 0x0cf8) { pcidev_w32(port, dat); @@ -596,6 +602,7 @@ UINT32 IOINPCALL iocore_inp32(UINT port) UINT32 ret; + CPU_REMCLOCK -= iocore.busclock; #if defined(SUPPORT_PC9821) if ((port & 0xfffb) == 0x0cf8) { return(pcidev_r32(port));