From 8584ccee4a3da023e074ae84c6024891a067ea27 Mon Sep 17 00:00:00 2001 From: yui Date: Sat, 19 Apr 2014 15:29:47 +0000 Subject: [PATCH] reverts controling OPNA address register to ver0.80 refs #4 svn merge -r 1431:1434 https://amethyst.yui.ne.jp/svn/pc98/np2/branches/yui/WORK_01 svn merge -r 1439:1440 https://amethyst.yui.ne.jp/svn/pc98/np2/branches/yui/WORK_01 --- cbus/amd98.c | 12 ++-- cbus/board118.c | 50 ++++++++-------- cbus/board26k.c | 12 ++-- cbus/board86.c | 41 +++++-------- cbus/boardpx.c | 142 ++++++++++++++++----------------------------- cbus/boardspb.c | 61 +++++++------------ cbus/boardx2.c | 34 +++++------ sound/fmboard.h | 10 ++-- win9x/board118.cpp | 69 ++++++++++++---------- 9 files changed, 182 insertions(+), 249 deletions(-) diff --git a/cbus/amd98.c b/cbus/amd98.c index b36570b3..9bdcae46 100644 --- a/cbus/amd98.c +++ b/cbus/amd98.c @@ -249,13 +249,13 @@ void amd98int(NEVENTITEM item) { static void IOOUTCALL amd_od8(UINT port, REG8 dat) { - opn.addr = dat; + opn.addr1l = dat; (void)port; } static void IOOUTCALL amd_od9(UINT port, REG8 dat) { - opn.addr2 = dat; + opn.addr1h = dat; (void)port; } @@ -263,7 +263,7 @@ static void IOOUTCALL amd_oda(UINT port, REG8 dat) { UINT addr; - addr = opn.addr; + addr = opn.addr1l; if (addr < 0x0e) { psggen_setreg(&psg1, addr, dat); } @@ -280,7 +280,7 @@ static void IOOUTCALL amd_odb(UINT port, REG8 dat) { UINT addr; - addr = opn.addr2; + addr = opn.addr1h; if (addr < 0x0e) { psggen_setreg(&psg2, addr, dat); } @@ -328,7 +328,7 @@ static REG8 IOINPCALL amd_ida(UINT port) { UINT addr; - addr = opn.addr; + addr = opn.addr1l; if (addr < 0x0e) { return(psggen_getreg(&psg1, addr)); } @@ -346,7 +346,7 @@ static REG8 IOINPCALL amd_idb(UINT port) { UINT addr; - addr = opn.addr2; + addr = opn.addr1h; if (addr < 0x0e) { return(psggen_getreg(&psg2, addr)); } diff --git a/cbus/board118.c b/cbus/board118.c index ec691882..9b912e0d 100644 --- a/cbus/board118.c +++ b/cbus/board118.c @@ -11,8 +11,9 @@ static void IOOUTCALL ymf_o188(UINT port, REG8 dat) { - opn.addr = dat; - opn.data = dat; + opn.addr1l = dat; + opn.addr1h = 0; + opn.data1 = dat; (void)port; } @@ -20,11 +21,12 @@ static void IOOUTCALL ymf_o18a(UINT port, REG8 dat) { UINT addr; - opn.data = dat; - addr = opn.addr; - if (addr >= 0x100) { + opn.data1 = dat; + if (opn.addr1h != 0) { return; } + + addr = opn.addr1l; S98_put(NORMAL2608, addr, dat); if (addr < 0x10) { if (addr != 0x0e) { @@ -60,8 +62,9 @@ static void IOOUTCALL ymf_o18a(UINT port, REG8 dat) { static void IOOUTCALL ymf_o18c(UINT port, REG8 dat) { if (opn.extend) { - opn.addr = dat + 0x100; - opn.data = dat; + opn.addr1l = dat; + opn.addr1h = 1; + opn.data1 = dat; } (void)port; } @@ -73,11 +76,12 @@ static void IOOUTCALL ymf_o18e(UINT port, REG8 dat) { if (!opn.extend) { return; } - opn.data = dat; - addr = opn.addr - 0x100; - if (addr >= 0x100) { + opn.data1 = dat; + + if (opn.addr1h != 1) { return; } + addr = opn.addr1l; S98_put(EXTEND2608, addr, dat); opn.reg[addr + 0x100] = dat; if (addr >= 0x30) { @@ -103,20 +107,20 @@ static REG8 IOINPCALL ymf_i18a(UINT port) { UINT addr; - addr = opn.addr; - if (addr == 0x0e) { - return(fmboard_getjoy(&psg1)); - } - else if (addr < 0x10) { - return(psggen_getreg(&psg1, addr)); - } - else if (addr == 0xff) { - return(1); - } - else { - (void)port; - return(opn.data); + if (opn.addr1h == 0) { + addr = opn.addr1l; + if (addr == 0x0e) { + return(fmboard_getjoy(&psg1)); + } + else if (addr < 0x10) { + return(psggen_getreg(&psg1, addr)); + } + else if (addr == 0xff) { + return(1); + } } + (void)port; + return(opn.data1); } static REG8 IOINPCALL ymf_i18c(UINT port) { diff --git a/cbus/board26k.c b/cbus/board26k.c index 47445c39..b184ae51 100644 --- a/cbus/board26k.c +++ b/cbus/board26k.c @@ -10,8 +10,8 @@ static void IOOUTCALL opn_o188(UINT port, REG8 dat) { - opn.addr = dat; - opn.data = dat; + opn.addr1l = dat; + opn.data1 = dat; (void)port; } @@ -19,8 +19,8 @@ static void IOOUTCALL opn_o18a(UINT port, REG8 dat) { UINT addr; - opn.data = dat; - addr = opn.addr; + opn.data1 = dat; + addr = opn.addr1l; S98_put(NORMAL2608, addr, dat); if (addr < 0x10) { if (addr != 0x0e) { @@ -59,7 +59,7 @@ static REG8 IOINPCALL opn_i18a(UINT port) { UINT addr; - addr = opn.addr; + addr = opn.addr1l; if (addr == 0x0e) { return(fmboard_getjoy(&psg1)); } @@ -67,7 +67,7 @@ static REG8 IOINPCALL opn_i18a(UINT port) { return(psggen_getreg(&psg1, addr)); } (void)port; - return(opn.data); + return(opn.data1); } diff --git a/cbus/board86.c b/cbus/board86.c index 7cac05ef..c0a9548f 100644 --- a/cbus/board86.c +++ b/cbus/board86.c @@ -11,8 +11,8 @@ static void IOOUTCALL opna_o188(UINT port, REG8 dat) { - opn.addr = dat; - opn.data = dat; + opn.addr1l = dat; + opn.data1 = dat; (void)port; } @@ -20,11 +20,8 @@ static void IOOUTCALL opna_o18a(UINT port, REG8 dat) { UINT addr; - opn.data = dat; - addr = opn.addr; - if (addr >= 0x100) { - return; - } + opn.data1 = dat; + addr = opn.addr1l; S98_put(NORMAL2608, addr, dat); if (addr < 0x10) { if (addr != 0x0e) { @@ -65,8 +62,8 @@ static void IOOUTCALL opna_o18a(UINT port, REG8 dat) { static void IOOUTCALL opna_o18c(UINT port, REG8 dat) { if (opn.extend) { - opn.addr = dat + 0x100; - opn.data = dat; + opn.addr1h = dat; + opn.data1 = dat; } (void)port; } @@ -78,11 +75,8 @@ static void IOOUTCALL opna_o18e(UINT port, REG8 dat) { if (!opn.extend) { return; } - opn.data = dat; - addr = opn.addr - 0x100; - if (addr >= 0x100) { - return; - } + opn.data1 = dat; + addr = opn.addr1h; S98_put(EXTEND2608, addr, dat); opn.reg[addr + 0x100] = dat; if (addr >= 0x30) { @@ -108,7 +102,7 @@ static REG8 IOINPCALL opna_i18a(UINT port) { UINT addr; - addr = opn.addr; + addr = opn.addr1l; if (addr == 0x0e) { return(fmboard_getjoy(&psg1)); } @@ -119,7 +113,7 @@ static REG8 IOINPCALL opna_i18a(UINT port) { return(1); } (void)port; - return(opn.data); + return(opn.data1); } static REG8 IOINPCALL opna_i18c(UINT port) { @@ -134,11 +128,11 @@ static REG8 IOINPCALL opna_i18c(UINT port) { static REG8 IOINPCALL opna_i18e(UINT port) { if (opn.extend) { - UINT addr = opn.addr - 0x100; + UINT addr = opn.addr1h; if ((addr == 0x08) || (addr == 0x0f)) { return(opn.reg[addr + 0x100]); } - return(opn.data); + return(opn.data1); } (void)port; return(0xff); @@ -204,11 +198,8 @@ static void IOOUTCALL opnac_o18e(UINT port, REG8 dat) { if (!opn.extend) { return; } - opn.data = dat; - addr = opn.addr - 0x100; - if (addr >= 0x100) { - return; - } + opn.data1 = dat; + addr = opn.addr1h; S98_put(EXTEND2608, addr, dat); opn.reg[addr + 0x100] = dat; if (addr >= 0x30) { @@ -235,14 +226,14 @@ static REG8 IOINPCALL opnac_i18c(UINT port) { static REG8 IOINPCALL opnac_i18e(UINT port) { if (opn.extend) { - UINT addr = opn.addr - 0x100; + UINT addr = opn.addr1h; if (addr == 0x08) { return(adpcm_readsample(&adpcm)); } else if (addr == 0x0f) { return(opn.reg[addr + 0x100]); } - return(opn.data); + return(opn.data1); } (void)port; return(0xff); diff --git a/cbus/boardpx.c b/cbus/boardpx.c index ace85b66..a4519ba5 100644 --- a/cbus/boardpx.c +++ b/cbus/boardpx.c @@ -12,8 +12,8 @@ static void IOOUTCALL spb_o188(UINT port, REG8 dat) { - opn.addr = dat; - opn.data = dat; + opn.addr1l = dat; +// opn.data1 = dat; (void)port; } @@ -21,11 +21,8 @@ static void IOOUTCALL spb_o18a(UINT port, REG8 dat) { UINT addr; - opn.data = dat; - addr = opn.addr; - if (addr >= 0x100) { - return; - } +// opn.data1 = dat; + addr = opn.addr1l; // S98_put(NORMAL2608, addr, dat); if (addr < 0x10) { if (addr != 0x0e) { @@ -63,8 +60,8 @@ static void IOOUTCALL spb_o18a(UINT port, REG8 dat) { static void IOOUTCALL spb_o18c(UINT port, REG8 dat) { - opn.addr = dat + 0x100; - opn.data = dat; + opn.addr1h = dat; +// opn.data1 = dat; (void)port; } @@ -72,11 +69,8 @@ static void IOOUTCALL spb_o18e(UINT port, REG8 dat) { UINT addr; - opn.data = dat; - addr = opn.addr - 0x100; - if (addr >= 0x100) { - return; - } +// opn.data1 = dat; + addr = opn.addr1h; // S98_put(EXTEND2608, addr, dat); opn.reg[addr + 0x100] = dat; if (addr >= 0x30) { @@ -98,7 +92,7 @@ static REG8 IOINPCALL spb_i18a(UINT port) { UINT addr; - addr = opn.addr; + addr = opn.addr1l; if (addr == 0x0e) { return(fmboard_getjoy(&psg1)); } @@ -110,7 +104,7 @@ static REG8 IOINPCALL spb_i18a(UINT port) { } else { (void)port; - return(opn.data); + return(opn.reg[addr]); } } @@ -118,7 +112,7 @@ static REG8 IOINPCALL spb_i18e(UINT port) { UINT addr; - addr = opn.addr - 0x100; + addr = opn.addr1h; if (addr == 0x08) { return(adpcm_readsample(&adpcm)); } @@ -127,15 +121,15 @@ static REG8 IOINPCALL spb_i18e(UINT port) { } else { (void)port; - return(opn.data); + return(opn.reg[opn.addr1l]); } } static void IOOUTCALL spb_o088(UINT port, REG8 dat) { - opn2.addr = dat; - opn2.data = dat; + opn2.addr1l = dat; +// opn2.data1 = dat; (void)port; } @@ -143,11 +137,8 @@ static void IOOUTCALL spb_o08a(UINT port, REG8 dat) { UINT addr; - opn2.data = dat; - addr = opn2.addr; - if (addr >= 0x100) { - return; - } +// opn2.data1 = dat; + addr = opn2.addr1l; // S98_put(NORMAL2608, addr, dat); if (addr < 0x10) { if (addr != 0x0e) { @@ -185,8 +176,8 @@ static void IOOUTCALL spb_o08a(UINT port, REG8 dat) { static void IOOUTCALL spb_o08c(UINT port, REG8 dat) { - opn2.addr = dat + 0x100; - opn2.data = dat; + opn2.addr1h = dat; +// opn2.data1 = dat; (void)port; } @@ -194,11 +185,8 @@ static void IOOUTCALL spb_o08e(UINT port, REG8 dat) { UINT addr; - opn.data = dat; - addr = opn2.addr - 0x100; - if (addr >= 0x100) { - return; - } +// opn2.data1 = dat; + addr = opn2.addr1h; // S98_put(EXTEND2608, addr, dat); opn2.reg[addr + 0x100] = dat; if (addr >= 0x30) { @@ -220,7 +208,7 @@ static REG8 IOINPCALL spb_i08a(UINT port) { UINT addr; - addr = opn2.addr; + addr = opn2.addr1l; if (addr == 0x0e) { return(fmboard_getjoy(&psg2)); } @@ -232,7 +220,7 @@ static REG8 IOINPCALL spb_i08a(UINT port) { } else { (void)port; - return(opn2.data); + return(opn2.reg[addr]); } } @@ -240,7 +228,7 @@ static REG8 IOINPCALL spb_i08e(UINT port) { UINT addr; - addr = opn2.addr - 0x100; + addr = opn2.addr1h; if (addr == 0x08) { return(adpcm_readsample(&adpcm2)); } @@ -250,7 +238,7 @@ static REG8 IOINPCALL spb_i08e(UINT port) { else { (void)port; - return(opn2.data); + return(opn2.reg[opn2.addr1l]); } } @@ -258,8 +246,8 @@ static REG8 IOINPCALL spb_i08e(UINT port) { static void IOOUTCALL p86_o288(UINT port, REG8 dat) { - opn3.addr = dat; - opn3.data = dat; + opn3.addr1l = dat; +// opn3.data1 = dat; (void)port; } @@ -267,11 +255,8 @@ static void IOOUTCALL p86_o28a(UINT port, REG8 dat) { UINT addr; - opn.data = dat; - addr = opn.addr; - if (addr >= 0x100) { - return; - } +// opn3.data1 = dat; + addr = opn.addr1l; // S98_put(NORMAL2608, addr, dat); if (addr < 0x10) { if (addr != 0x0e) { @@ -309,8 +294,8 @@ static void IOOUTCALL p86_o28a(UINT port, REG8 dat) { static void IOOUTCALL p86_o28c(UINT port, REG8 dat) { - opn3.addr = dat + 0x100; - opn3.data = dat; + opn3.addr1h = dat; +// opn3.data1 = dat; (void)port; } @@ -318,8 +303,8 @@ static void IOOUTCALL p86_o28e(UINT port, REG8 dat) { UINT addr; - opn3.data = dat; - addr = opn3.addr - 0x100; +// opn3.data1 = dat; + addr = opn3.addr1h; if (addr >= 0x100) { return; } @@ -344,7 +329,7 @@ static REG8 IOINPCALL p86_i28a(UINT port) { UINT addr; - addr = opn.addr; + addr = opn3.addr1l; if (addr == 0x0e) { return(fmboard_getjoy(&psg3)); } @@ -356,7 +341,7 @@ static REG8 IOINPCALL p86_i28a(UINT port) { } else { (void)port; - return(opn3.data); + return(opn3.reg[addr]); } } @@ -364,7 +349,7 @@ static REG8 IOINPCALL p86_i28e(UINT port) { UINT addr; - addr = opn3.addr - 0x100; + addr = opn3.addr1h; if (addr == 0x08) { return(adpcm_readsample(&adpcm3)); } @@ -373,7 +358,7 @@ static REG8 IOINPCALL p86_i28e(UINT port) { } else { (void)port; - return(opn3.data); + return(opn3.reg[opn3.addr1l]); } } @@ -382,7 +367,7 @@ static REG8 IOINPCALL p86_i28e(UINT port) { static void IOOUTCALL spr_o588(UINT port, REG8 dat) { - opn.addr2 = dat; + opn.addr2l = dat; // opn.data2 = dat; (void)port; } @@ -392,10 +377,7 @@ static void IOOUTCALL spr_o58a(UINT port, REG8 dat) { UINT addr; // opn.data2 = dat; - addr = opn.addr2; - if (addr >= 0x100) { - return; - } + addr = opn.addr2l; if (addr < 0x30) { if (addr == 0x28) { if ((dat & 0x0f) < 3) { @@ -421,7 +403,7 @@ static void IOOUTCALL spr_o58a(UINT port, REG8 dat) { static void IOOUTCALL spr_o58c(UINT port, REG8 dat) { - opn.addr2 = dat + 0x100; + opn.addr2h = dat; // opn.data2 = dat; (void)port; } @@ -431,10 +413,7 @@ static void IOOUTCALL spr_o58e(UINT port, REG8 dat) { UINT addr; // opn.data2 = dat; - addr = opn.addr2 - 0x100; - if (addr >= 0x100) { - return; - } + addr = opn.addr2h; opn.reg[addr + 0x300] = dat; if (addr >= 0x30) { opngen_setreg(9, addr, dat); @@ -452,7 +431,7 @@ static REG8 IOINPCALL spr_i58a(UINT port) { UINT addr; - addr = opn.addr2; + addr = opn.addr2l; if ((addr >= 0x20) && (addr < 0xff)) { return(opn.reg[addr + 0x200]); } @@ -474,23 +453,14 @@ static REG8 IOINPCALL spr_i58c(UINT port) { static REG8 IOINPCALL spr_i58e(UINT port) { - UINT addr; - - addr = opn.addr2; - if (addr < 0x100) { - return(opn.reg[addr + 0x200]); - } - else { - (void)port; -// return(opn.data2); - return(0xff); - } + (void)port; + return(opn.reg[opn.addr2l + 0x200]); } static void IOOUTCALL spr_o488(UINT port, REG8 dat) { - opn2.addr2 = dat; + opn2.addr2l = dat; // opn2.data2 = dat; (void)port; } @@ -500,7 +470,7 @@ static void IOOUTCALL spr_o48a(UINT port, REG8 dat) { UINT addr; // opn2.data2 = dat; - addr = opn2.addr2; + addr = opn2.addr2l; if (addr >= 0x100) { return; } @@ -529,7 +499,7 @@ static void IOOUTCALL spr_o48a(UINT port, REG8 dat) { static void IOOUTCALL spr_o48c(UINT port, REG8 dat) { - opn2.addr2 = dat + 0x100; + opn2.addr2h = dat; // opn2.data2 = dat; (void)port; } @@ -539,10 +509,7 @@ static void IOOUTCALL spr_o48e(UINT port, REG8 dat) { UINT addr; // opn.data2 = dat; - addr = opn2.addr2 - 0x100; - if (addr >= 0x100) { - return; - } + addr = opn2.addr2h; opn2.reg[addr + 0x300] = dat; if (addr >= 0x30) { opngen_setreg(21, addr, dat); @@ -560,7 +527,7 @@ static REG8 IOINPCALL spr_i48a(UINT port) { UINT addr; - addr = opn2.addr2; + addr = opn2.addr2l; if ((addr >= 0x20) && (addr < 0xff)) { return(opn2.reg[addr + 0x200]); } @@ -582,17 +549,8 @@ static REG8 IOINPCALL spr_i48c(UINT port) { static REG8 IOINPCALL spr_i48e(UINT port) { - UINT addr; - - addr = opn2.addr2; - if (addr < 0x100) { - return(opn2.reg[addr + 0x200]); - } - else { - (void)port; -// return(opn2.data2); - return(0xff); - } + (void)port; + return(opn2.reg[opn2.addr2l + 0x200]); } diff --git a/cbus/boardspb.c b/cbus/boardspb.c index 01b4644e..f60264de 100644 --- a/cbus/boardspb.c +++ b/cbus/boardspb.c @@ -10,8 +10,8 @@ static void IOOUTCALL spb_o188(UINT port, REG8 dat) { - opn.addr = dat; - opn.data = dat; + opn.addr1l = dat; +// opn.data1 = dat; (void)port; } @@ -19,11 +19,8 @@ static void IOOUTCALL spb_o18a(UINT port, REG8 dat) { UINT addr; - opn.data = dat; - addr = opn.addr; - if (addr >= 0x100) { - return; - } +// opn.data1 = dat; + addr = opn.addr1l; S98_put(NORMAL2608, addr, dat); if (addr < 0x10) { if (addr != 0x0e) { @@ -61,8 +58,8 @@ static void IOOUTCALL spb_o18a(UINT port, REG8 dat) { static void IOOUTCALL spb_o18c(UINT port, REG8 dat) { - opn.addr = dat + 0x100; - opn.data = dat; + opn.addr1h = dat; +// opn.data1 = dat; (void)port; } @@ -70,11 +67,8 @@ static void IOOUTCALL spb_o18e(UINT port, REG8 dat) { UINT addr; - opn.data = dat; - addr = opn.addr - 0x100; - if (addr >= 0x100) { - return; - } +// opn.data1 = dat; + addr = opn.addr1h; S98_put(EXTEND2608, addr, dat); opn.reg[addr + 0x100] = dat; if (addr >= 0x30) { @@ -96,7 +90,7 @@ static REG8 IOINPCALL spb_i18a(UINT port) { UINT addr; - addr = opn.addr; + addr = opn.addr1l; if (addr == 0x0e) { return(fmboard_getjoy(&psg1)); } @@ -108,7 +102,7 @@ static REG8 IOINPCALL spb_i18a(UINT port) { } else { (void)port; - return(opn.data); + return(opn.reg[addr]); } } @@ -116,7 +110,7 @@ static REG8 IOINPCALL spb_i18e(UINT port) { UINT addr; - addr = opn.addr - 0x100; + addr = opn.addr1h; if (addr == 0x08) { return(adpcm_readsample(&adpcm)); } @@ -125,7 +119,7 @@ static REG8 IOINPCALL spb_i18e(UINT port) { } else { (void)port; - return(opn.data); + return(opn.reg[opn.addr1l]); } } @@ -134,7 +128,7 @@ static REG8 IOINPCALL spb_i18e(UINT port) { static void IOOUTCALL spr_o588(UINT port, REG8 dat) { - opn.addr2 = dat; + opn.addr2l = dat; // opn.data2 = dat; (void)port; } @@ -143,11 +137,8 @@ static void IOOUTCALL spr_o58a(UINT port, REG8 dat) { UINT addr; -// opn.data2 = dat; - addr = opn.addr2; - if (addr >= 0x100) { - return; - } +// opn.data2l = dat; + addr = opn.addr2l; if (addr < 0x30) { if (addr == 0x28) { if ((dat & 0x0f) < 3) { @@ -173,7 +164,7 @@ static void IOOUTCALL spr_o58a(UINT port, REG8 dat) { static void IOOUTCALL spr_o58c(UINT port, REG8 dat) { - opn.addr2 = dat + 0x100; + opn.addr2h = dat; // opn.data2 = dat; (void)port; } @@ -183,10 +174,7 @@ static void IOOUTCALL spr_o58e(UINT port, REG8 dat) { UINT addr; // opn.data2 = dat; - addr = opn.addr2 - 0x100; - if (addr >= 0x100) { - return; - } + addr = opn.addr2h; opn.reg[addr + 0x300] = dat; if (addr >= 0x30) { opngen_setreg(9, addr, dat); @@ -204,7 +192,7 @@ static REG8 IOINPCALL spr_i58a(UINT port) { UINT addr; - addr = opn.addr2; + addr = opn.addr2l; if ((addr >= 0x20) && (addr < 0xff)) { return(opn.reg[addr + 0x200]); } @@ -226,17 +214,8 @@ static REG8 IOINPCALL spr_i58c(UINT port) { static REG8 IOINPCALL spr_i58e(UINT port) { - UINT addr; - - addr = opn.addr2; - if (addr < 0x100) { - return(opn.reg[addr + 0x200]); - } - else { - (void)port; -// return(opn.data2); - return(0xff); - } + (void)port; + return(opn.reg[opn.addr2l + 0x200]); } diff --git a/cbus/boardx2.c b/cbus/boardx2.c index dedd9f7d..582ac7e9 100644 --- a/cbus/boardx2.c +++ b/cbus/boardx2.c @@ -11,7 +11,7 @@ static void IOOUTCALL opn_o088(UINT port, REG8 dat) { - opn.addr2 = dat; + opn.addr2l = dat; opn.data2 = dat; (void)port; } @@ -21,7 +21,7 @@ static void IOOUTCALL opn_o08a(UINT port, REG8 dat) { UINT addr; opn.data2 = dat; - addr = opn.addr2; + addr = opn.addr2l; if (addr < 0x10) { if (addr != 0x0e) { psggen_setreg(&psg1, addr, dat); @@ -59,7 +59,7 @@ static REG8 IOINPCALL opn_i08a(UINT port) { UINT addr; - addr = opn.addr2; + addr = opn.addr2l; if (addr == 0x0e) { return(0xff); } @@ -77,8 +77,8 @@ static REG8 IOINPCALL opn_i08a(UINT port) { static void IOOUTCALL opna_o188(UINT port, REG8 dat) { - opn.addr = dat; - opn.data = dat; + opn.addr1l = dat; + opn.data1 = dat; (void)port; } @@ -86,11 +86,8 @@ static void IOOUTCALL opna_o18a(UINT port, REG8 dat) { UINT addr; - opn.data = dat; - addr = opn.addr; - if (addr >= 0x100) { - return; - } + opn.data1 = dat; + addr = opn.addr1l; S98_put(NORMAL2608, addr, dat); if (addr < 0x10) { if (addr != 0x0e) { @@ -131,8 +128,8 @@ static void IOOUTCALL opna_o18a(UINT port, REG8 dat) { static void IOOUTCALL opna_o18c(UINT port, REG8 dat) { if (opn.extend) { - opn.addr = dat + 0x100; - opn.data = dat; + opn.addr1h = dat; + opn.data1 = dat; } (void)port; } @@ -144,10 +141,7 @@ static void IOOUTCALL opna_o18e(UINT port, REG8 dat) { if (!opn.extend) { return; } - addr = opn.addr - 0x100; - if (addr >= 0x100) { - return; - } + addr = opn.addr1h; S98_put(EXTEND2608, addr, dat); opn.reg[addr + 0x100] = dat; if (addr >= 0x30) { @@ -173,7 +167,7 @@ static REG8 IOINPCALL opna_i18a(UINT port) { UINT addr; - addr = opn.addr; + addr = opn.addr1l; if (addr == 0x0e) { return(fmboard_getjoy(&psg2)); } @@ -185,7 +179,7 @@ static REG8 IOINPCALL opna_i18a(UINT port) { } else { (void)port; - return(opn.data); + return(opn.data1); } } @@ -201,11 +195,11 @@ static REG8 IOINPCALL opna_i18c(UINT port) { static REG8 IOINPCALL opna_i18e(UINT port) { if (opn.extend) { - UINT addr = opn.addr - 0x100; + UINT addr = opn.addr1h; if ((addr == 0x08) || (addr == 0x0f)) { return(opn.reg[addr + 0x100]); } - return(opn.data); + return(opn.data1); } (void)port; return(0xff); diff --git a/sound/fmboard.h b/sound/fmboard.h index e3cdb8ce..d6991653 100644 --- a/sound/fmboard.h +++ b/sound/fmboard.h @@ -13,15 +13,17 @@ typedef struct { - UINT addr; - UINT addr2; - UINT8 data; + UINT8 addr1l; + UINT8 addr1h; + UINT8 addr2l; + UINT8 addr2h; + UINT8 data1; UINT8 data2; UINT16 base; UINT8 adpcmmask; UINT8 channels; UINT8 extend; - UINT8 _padding; + UINT8 _padding2; UINT8 reg[0x400]; } OPN_T; diff --git a/win9x/board118.cpp b/win9x/board118.cpp index 630044d5..bc914ded 100644 --- a/win9x/board118.cpp +++ b/win9x/board118.cpp @@ -18,8 +18,9 @@ static void IOOUTCALL ymf_o188(UINT port, REG8 dat) { - opn.addr = dat; - opn.data = dat; + opn.addr1l = dat; + opn.addr1h = 0; + opn.data1 = dat; (void)port; } @@ -27,11 +28,12 @@ static void IOOUTCALL ymf_o18a(UINT port, REG8 dat) { UINT addr; - opn.data = dat; - addr = opn.addr; - if (addr >= 0x100) { + opn.data1 = dat; + if (opn.addr1h != 0) { return; } + + addr = opn.addr1l; S98_put(NORMAL2608, addr, dat); if (addr < 0x10) { if (addr != 0x0e) { @@ -67,8 +69,9 @@ static void IOOUTCALL ymf_o18a(UINT port, REG8 dat) { static void IOOUTCALL ymf_o18c(UINT port, REG8 dat) { if (opn.extend) { - opn.addr = dat + 0x100; - opn.data = dat; + opn.addr1l = dat; + opn.addr1h = 1; + opn.data1 = dat; } (void)port; } @@ -80,11 +83,12 @@ static void IOOUTCALL ymf_o18e(UINT port, REG8 dat) { if (!opn.extend) { return; } - opn.data = dat; - addr = opn.addr - 0x100; - if (addr >= 0x100) { + opn.data1 = dat; + + if (opn.addr1h != 1) { return; } + addr = opn.addr1l; S98_put(EXTEND2608, addr, dat); opn.reg[addr + 0x100] = dat; if (addr >= 0x30) { @@ -110,18 +114,20 @@ static REG8 IOINPCALL ymf_i18a(UINT port) { UINT addr; - addr = opn.addr; - if (addr == 0x0e) { - return(fmboard_getjoy(&psg1)); - } - else if (addr < 0x10) { - return(psggen_getreg(&psg1, addr)); - } - else if (addr == 0xff) { - return(1); + if (opn.addr1h == 0) { + addr = opn.addr1l; + if (addr == 0x0e) { + return(fmboard_getjoy(&psg1)); + } + else if (addr < 0x10) { + return(psggen_getreg(&psg1, addr)); + } + else if (addr == 0xff) { + return(1); + } } (void)port; - return(opn.data); + return(opn.data1); } static REG8 IOINPCALL ymf_i18c(UINT port) { @@ -173,13 +179,13 @@ static void RestoreRomeo() static void IOOUTCALL ymfr_o18a(UINT port, REG8 dat) { - opn.data = dat; - - const UINT nAddr = opn.addr; - if (nAddr & 0x100) + opn.data1 = dat; + if (opn.addr1h != 0) { return; } + + const UINT nAddr = opn.addr1l; S98_put(NORMAL2608, nAddr, dat); if (nAddr < 0x10) @@ -236,20 +242,19 @@ static void IOOUTCALL ymfr_o18e(UINT port, REG8 dat) { return; } - opn.data = dat; - - const UINT nAddr = opn.addr; - if ((nAddr & 0x100) == 0) - { + opn.data1 = dat; + if (opn.addr1h != 1) { return; } + + const UINT nAddr = opn.addr1l; S98_put(EXTEND2608, nAddr, dat); opn.reg[nAddr] = dat; - if (nAddr >= 0x130) + if (nAddr >= 0x30) { - CJuliet::GetInstance()->WriteRegister(nAddr, dat); + CJuliet::GetInstance()->WriteRegister(0x100 + nAddr, dat); } - else if (nAddr == 0x110) + else if (nAddr == 0x10) { if (!(dat & 0x80)) {