diff --git a/src/hardware/adlib.cpp b/src/hardware/adlib.cpp index 9e6b3c24..5c276768 100644 --- a/src/hardware/adlib.cpp +++ b/src/hardware/adlib.cpp @@ -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; diff --git a/src/hardware/sblaster.cpp b/src/hardware/sblaster.cpp index d0c0db88..5ffae9a8 100644 --- a/src/hardware/sblaster.cpp +++ b/src/hardware/sblaster.cpp @@ -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);