--- np2/io/iocore.c 2004/02/11 17:39:59 1.10 +++ np2/io/iocore.c 2004/07/01 11:42:54 1.19 @@ -5,6 +5,7 @@ #include "cbuscore.h" #include "sound.h" #include "fmboard.h" +#include "ideio.h" #include "cs4231io.h" #include "iocore16.tbl" @@ -23,6 +24,7 @@ _GRCG grcg; _KEYBRD keybrd; _MOUSEIF mouseif; + _NECIO necio; _NMIIO nmiio; _NP2SYSP np2sysp; _PIC pic; @@ -31,6 +33,10 @@ _SYSPORT sysport; _UPD4990 uPD4990; +#if defined(SUPPORT_PC9821) + _PCIDEV pcidev; +#endif + // ---- @@ -61,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; @@ -74,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)); } @@ -429,9 +439,9 @@ static const IOCBFN resetfn[] = { // extend artic_reset, egc_reset, np2sysp_reset, - necio_reset, epsonio_reset, -#if !defined(CPUCORE_IA32) - emsio_reset, + necio_reset, epsonio_reset, emsio_reset, +#if defined(SUPPORT_PC9821) + pcidev_reset, #endif }; @@ -448,9 +458,9 @@ static const IOCBFN bindfn[] = { // extend artic_bind, egc_bind, np2sysp_bind, - necio_bind, epsonio_bind, -#if !defined(CPUCORE_IA32) - emsio_bind, + necio_bind, epsonio_bind, emsio_bind, +#if defined(SUPPORT_PC9821) + pcidev_bind, #endif }; @@ -478,6 +488,7 @@ void IOOUTCALL iocore_out8(UINT port, RE IOFUNC iof; +// TRACEOUT(("iocore_out8(%.2x, %.2x)", port, dat)); CPU_REMCLOCK -= iocore.busclock; iof = iocore.base[(port >> 8) & 0xff]; iof->ioout[port & 0xff](port, dat); @@ -486,17 +497,27 @@ void IOOUTCALL iocore_out8(UINT port, RE REG8 IOINPCALL iocore_inp8(UINT port) { IOFUNC iof; + REG8 ret; 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) { + ideio_w16(port, dat); + return; + } +#endif if ((port & 0xfff1) == 0x04a0) { egc_w16(port, dat); return; @@ -528,6 +549,11 @@ REG16 IOINPCALL iocore_inp16(UINT port) REG8 ret; CPU_REMCLOCK -= iocore.busclock; +#if defined(SUPPORT_IDEIO) + if (port == 0x0640) { + return(ideio_r16(port)); + } +#endif if ((port & 0xfffc) == 0x005c) { return(artic_r16(port)); } @@ -561,14 +587,27 @@ 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); + return; + } +#endif iocore_out16(port, (UINT16)dat); iocore_out16(port+2, (UINT16)(dat >> 16)); } UINT32 IOINPCALL iocore_inp32(UINT port) { - REG16 ret; + UINT32 ret; + CPU_REMCLOCK -= iocore.busclock; +#if defined(SUPPORT_PC9821) + if ((port & 0xfffb) == 0x0cf8) { + return(pcidev_r32(port)); + } +#endif ret = iocore_inp16(port); return(ret + (iocore_inp16(port+2) << 16)); }