Skip to content

Commit

Permalink
reverts controling OPNA address register to ver0.80
Browse files Browse the repository at this point in the history
  • Loading branch information
yui authored and nmlgc committed Nov 6, 2015
1 parent 534e846 commit 8584cce
Show file tree
Hide file tree
Showing 9 changed files with 182 additions and 249 deletions.
12 changes: 6 additions & 6 deletions cbus/amd98.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,21 +249,21 @@ 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;
}

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);
}
Expand All @@ -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);
}
Expand Down Expand Up @@ -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));
}
Expand All @@ -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));
}
Expand Down
50 changes: 27 additions & 23 deletions cbus/board118.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,22 @@

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;
}

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) {
Expand Down Expand Up @@ -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;
}
Expand All @@ -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) {
Expand All @@ -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) {
Expand Down
12 changes: 6 additions & 6 deletions cbus/board26k.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@

static void IOOUTCALL opn_o188(UINT port, REG8 dat) {

opn.addr = dat;
opn.data = dat;
opn.addr1l = dat;
opn.data1 = dat;
(void)port;
}

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) {
Expand Down Expand Up @@ -59,15 +59,15 @@ static REG8 IOINPCALL opn_i18a(UINT port) {

UINT addr;

addr = opn.addr;
addr = opn.addr1l;
if (addr == 0x0e) {
return(fmboard_getjoy(&psg1));
}
else if (addr < 0x10) {
return(psggen_getreg(&psg1, addr));
}
(void)port;
return(opn.data);
return(opn.data1);
}


Expand Down
41 changes: 16 additions & 25 deletions cbus/board86.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,17 @@

static void IOOUTCALL opna_o188(UINT port, REG8 dat) {

opn.addr = dat;
opn.data = dat;
opn.addr1l = dat;
opn.data1 = dat;
(void)port;
}

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) {
Expand Down Expand Up @@ -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;
}
Expand All @@ -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) {
Expand All @@ -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));
}
Expand All @@ -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) {
Expand All @@ -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);
Expand Down Expand Up @@ -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) {
Expand All @@ -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);
Expand Down
Loading

0 comments on commit 8584cce

Please sign in to comment.