1
0
Fork 0

forward data to adlib command register of the gus

Don't use the cms ports when in opl2 mode


Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@1813
This commit is contained in:
Sjoerd van der Berg 2004-06-07 14:42:36 +00:00
parent f6938602bd
commit 70914f545e
2 changed files with 13 additions and 5 deletions

View file

@ -28,7 +28,6 @@
/*
Thanks to vdmsound for nice simple way to implement this
*/
# define logerror
#ifdef _MSC_VER
@ -133,6 +132,7 @@ void OPL_Write(Bitu port,Bitu val,Bitu iolen) {
MIXER_Enable(opl.chan,true);
}
Bitu addr=port & 3;
if (!addr) adlib_commandreg=val;
switch (opl.mode) {
case OPL_opl2:
OPL2::YM3812Write(0,addr,val);
@ -159,13 +159,14 @@ void OPL_Init(Section* sec,Bitu base,OPL_Mode oplmode,Bitu rate) {
THEOPL3::YMF262SetTimerHandler(0,THEOPL3::TimerHandler,0);
IO_RegisterWriteHandler(0x388,OPL_Write,IO_MB,4);
IO_RegisterReadHandler(0x388,OPL_Read,IO_MB,4);
IO_RegisterWriteHandler(base,OPL_Write,IO_MB,4);
IO_RegisterReadHandler(base,OPL_Read,IO_MB,4);
if (oplmode>=OPL_dualopl2) {
IO_RegisterWriteHandler(base,OPL_Write,IO_MB,4);
IO_RegisterReadHandler(base,OPL_Read,IO_MB,4);
}
IO_RegisterWriteHandler(base+8,OPL_Write,IO_MB,2);
IO_RegisterReadHandler(base+8,OPL_Read,IO_MB,2);
opl.active=false;
opl.last_used=0;
opl.mode=oplmode;

View file

@ -983,6 +983,10 @@ static void write_sb(Bitu port,Bitu val,Bitu iolen) {
}
}
static void adlib_gusforward(Bitu port,Bitu val,Bitu iolen) {
adlib_commandreg=val;
}
static void SBLASTER_CallBack(Bit8u * stream,Bit32u len) {
if (!len) return;
GenerateSound(len);
@ -1029,7 +1033,7 @@ void SBLASTER_Init(Section* sec) {
else {
switch (sb.type) {
case SBT_NONE:opl_mode=OPL_none;break;
case SBT_1:opl_mode=OPL_cms;break;
case SBT_1:opl_mode=OPL_opl2;break;
case SBT_2:opl_mode=OPL_opl2;break;
case SBT_PRO1:opl_mode=OPL_dualopl2;break;
case SBT_PRO2:
@ -1039,11 +1043,14 @@ void SBLASTER_Init(Section* sec) {
}
switch (opl_mode) {
case OPL_none:
IO_RegisterWriteHandler(0x388,adlib_gusforward,IO_MB);
break;
case OPL_cms:
IO_RegisterWriteHandler(0x388,adlib_gusforward,IO_MB);
CMS_Init(section,sb.hw.base,oplrate);
break;
case OPL_opl2:
CMS_Init(section,sb.hw.base,oplrate);
case OPL_dualopl2:
case OPL_opl3:
OPL_Init(section,sb.hw.base,opl_mode,oplrate);