--- np2/io/cpuio.c 2003/12/01 10:45:46 1.3 +++ np2/io/cpuio.c 2003/12/08 00:55:32 1.4 @@ -1,31 +1,42 @@ #include "compiler.h" -#include "i286.h" +#include "cpucore.h" #include "pccore.h" #include "iocore.h" #include "sound.h" #include "fmboard.h" +// 後で調整 +#if defined(CPU386) +DWORD cpumem_addrmask = 0xfffff; +#endif + // ---- I/O -static void IOOUTCALL cpuio_of0(UINT port, BYTE dat) { +static void IOOUTCALL cpuio_of0(UINT port, REG8 dat) { - i286core.s.adrsmask = 0x0fffff; - i286core.s.resetreq = 1; - i286_interrupt(0x02); + CPU_ADRSMASK = 0x0fffff; +#if defined(CPU386) + cpumem_addrmask = 0xfffff; +#endif + CPU_RESETREQ = 1; + CPU_INTERRUPT(0x02); nevent_forceexit(); (void)port; (void)dat; } -static void IOOUTCALL cpuio_of2(UINT port, BYTE dat) { +static void IOOUTCALL cpuio_of2(UINT port, REG8 dat) { - i286core.s.adrsmask = 0x1fffff; + CPU_ADRSMASK = 0x1fffff; +#if defined(CPU386) + cpumem_addrmask = 0xffffffff; +#endif (void)port; (void)dat; } -static BYTE IOINPCALL cpuio_if0(UINT port) { +static REG8 IOINPCALL cpuio_if0(UINT port) { BYTE ret; @@ -39,43 +50,54 @@ static BYTE IOINPCALL cpuio_if0(UINT por return(ret); } -static BYTE IOINPCALL cpuio_if2(UINT port) { +static REG8 IOINPCALL cpuio_if2(UINT port) { - BYTE ret; + REG8 ret; +#if 1 + ret = 0xff; + ret -= (REG8)((CPU_ADRSMASK >> 20) & 1); +#else ret = 0xfe; - if (i286core.s.adrsmask != 0x1fffff) { + if (CPU_ADRSMASK != 0x1fffff) { ret++; } +#endif (void)port; return(ret); } #ifdef CPU386 // defineを変えてね -static void IOOUTCALL cpuio_of6(UINT port, BYTE dat) { +static void IOOUTCALL cpuio_of6(UINT port, REG8 dat) { switch(dat) { case 0x02: - i286core.s.adrsmask = 0x1fffff; + CPU_ADRSMASK = 0x1fffff; +#if defined(CPU_386) + cpumem_addrmask = 0xffffffff; +#endif break; case 0x03: - i286core.s.adrsmask = 0x0fffff; + CPU_ADRSMASK = 0x0fffff; +#if defined(CPU_386) + cpumem_addrmask = 0xfffff; +#endif break; } (void)port; } -static BYTE IOINPCALL cpuio_if6(UINT port) { +static REG8 IOINPCALL cpuio_if6(UINT port) { - BYTE ret; + REG8 ret; ret = 0x00; - if (i286core.s.adrsmask != 0x1fffff) { + if (CPU_ADRSMASK != 0x1fffff) { ret |= 0x01; } - if (nmi.enable) { + if (nmiio.enable) { ret |= 0x02; } (void)port;