From 64aaada31a0efadd7c919f4ad08e9d762be73cd1 Mon Sep 17 00:00:00 2001 From: Sjoerd van der Berg Date: Sat, 16 May 2009 08:29:05 +0000 Subject: [PATCH] Don't install handlers for 0x220-0x223 when using opl2 so we can have both opl2 and cms. Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3392 --- src/hardware/adlib.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/hardware/adlib.cpp b/src/hardware/adlib.cpp index 41e826c0..0500b95a 100644 --- a/src/hardware/adlib.cpp +++ b/src/hardware/adlib.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: adlib.cpp,v 1.40 2009-05-15 21:07:13 c2woody Exp $ */ +/* $Id: adlib.cpp,v 1.41 2009-05-16 08:29:05 harekiet Exp $ */ #include #include @@ -754,10 +754,10 @@ Module::Module( Section* configuration ) : Module_base(configuration) { handler = new DBOPL::Handler(); } handler->Init( rate ); - Bit8u portRange = 4; //opl2 will set this to 2 + bool single = false; switch ( oplmode ) { case OPL_opl2: - portRange = 2; + single = true; Init( Adlib::MODE_OPL2 ); break; case OPL_dualopl2: @@ -768,14 +768,16 @@ Module::Module( Section* configuration ) : Module_base(configuration) { break; } //0x388 range - WriteHandler[0].Install(0x388,OPL_Write,IO_MB, portRange ); - ReadHandler[0].Install(0x388,OPL_Read,IO_MB, portRange - 1 ); + WriteHandler[0].Install(0x388,OPL_Write,IO_MB, 4 ); + ReadHandler[0].Install(0x388,OPL_Read,IO_MB, 4 ); //0x220 range - WriteHandler[1].Install(base,OPL_Write,IO_MB, portRange ); - ReadHandler[1].Install(base,OPL_Read,IO_MB, portRange - 1 ); + if ( !single ) { + WriteHandler[1].Install(base,OPL_Write,IO_MB, 4 ); + ReadHandler[1].Install(base,OPL_Read,IO_MB, 4 ); + } //0x228 range - WriteHandler[2].Install(base+8,OPL_Write,IO_MB,2); - ReadHandler[2].Install(base+8,OPL_Read,IO_MB,1); + WriteHandler[2].Install(base+8,OPL_Write,IO_MB, 2); + ReadHandler[2].Install(base+8,OPL_Read,IO_MB, 1); MAPPER_AddHandler(OPL_SaveRawEvent,MK_f7,MMOD1|MMOD2,"caprawopl","Cap OPL"); }