--- np2/cbus/amd98.c 2004/03/19 00:30:00 1.12 +++ np2/cbus/amd98.c 2005/05/13 05:47:24 1.16 @@ -213,22 +213,25 @@ void amd98int(NEVENTITEM item) { static void IOOUTCALL amd_od8(UINT port, REG8 dat) { - opn.opnreg = dat; + opn.addr = dat; (void)port; } static void IOOUTCALL amd_od9(UINT port, REG8 dat) { - opn.extreg = dat; + opn.addr2 = dat; (void)port; } static void IOOUTCALL amd_oda(UINT port, REG8 dat) { - if (opn.opnreg < 0x0e) { - psggen_setreg(&psg1, opn.opnreg, dat); + UINT addr; + + addr = opn.addr; + if (addr < 0x0e) { + psggen_setreg(&psg1, addr, dat); } - else if (opn.opnreg == 0x0f) { + else if (addr == 0x0f) { psg1.reg.io2 = dat; } (void)port; @@ -236,10 +239,13 @@ static void IOOUTCALL amd_oda(UINT port, static void IOOUTCALL amd_odb(UINT port, REG8 dat) { - if (opn.extreg < 0x0e) { - psggen_setreg(&psg2, opn.extreg, dat); + UINT addr; + + addr = opn.addr2; + if (addr < 0x0e) { + psggen_setreg(&psg2, addr, dat); } - else if (opn.extreg == 0x0f) { + else if (addr == 0x0f) { REG8 b; b = psg2.reg.io2; if ((b & 1) > (dat & 1)) { @@ -279,6 +285,43 @@ static void IOOUTCALL amd_ode(UINT port, (void)port; } +static REG8 IOINPCALL amd_ida(UINT port) { + + UINT addr; + + addr = opn.addr; + if (addr < 0x0e) { + return(psggen_getreg(&psg1, addr)); + } + else if (addr == 0x0f) { + return(psg1.reg.io2); + } + (void)port; + return(0xff); +} + +static REG8 IOINPCALL amd_idb(UINT port) { + + UINT addr; + + addr = opn.addr2; + if (addr < 0x0e) { + return(psggen_getreg(&psg2, addr)); + } + else if (addr == 0x0f) { + return(psg2.reg.io2); + } + (void)port; + return(0xff); +} + +#if defined(TRACE) +static REG8 IOINPCALL amd_inp(UINT port) { + + TRACEOUT(("amd inp - %.4x", port)); + return(0xff); +} +#endif // ---- @@ -309,5 +352,14 @@ void amd98_bind(void) { iocore_attachout(0xdb, amd_odb); iocore_attachout(0xdc, amd_odc); iocore_attachout(0xde, amd_ode); + + iocore_attachinp(0xda, amd_ida); + iocore_attachinp(0xdb, amd_idb); +#if defined(TRACE) + iocore_attachinp(0xd8, amd_inp); + iocore_attachinp(0xd9, amd_inp); + iocore_attachinp(0xdc, amd_inp); + iocore_attachinp(0xde, amd_inp); +#endif }