aboutsummaryrefslogtreecommitdiff
path: root/src/adlmidi_opl3.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/adlmidi_opl3.cpp')
-rw-r--r--src/adlmidi_opl3.cpp33
1 files changed, 30 insertions, 3 deletions
diff --git a/src/adlmidi_opl3.cpp b/src/adlmidi_opl3.cpp
index 9db3803..f46d0ca 100644
--- a/src/adlmidi_opl3.cpp
+++ b/src/adlmidi_opl3.cpp
@@ -165,30 +165,56 @@ OPL3::OPL3() :
void OPL3::Poke(size_t card, uint32_t index, uint32_t value)
{
#ifdef ADLMIDI_HW_OPL
+ (void)card;
unsigned o = index >> 8;
unsigned port = OPLBase + o * 2;
+
+ #ifdef __DJGPP__
outportb(port, index);
for(unsigned c = 0; c < 6; ++c) inportb(port);
outportb(port + 1, value);
for(unsigned c = 0; c < 35; ++c) inportb(port);
- #else
+ #endif//__DJGPP__
+
+ #ifdef __WATCOMC__
+ outp(port, index);
+ for(uint16_t c = 0; c < 6; ++c) inp(port);
+ outp(port + 1, value);
+ for(uint16_t c = 0; c < 35; ++c) inp(port);
+ #endif//__WATCOMC__
+
+ #else//ADLMIDI_HW_OPL
+
#ifdef ADLMIDI_USE_DOSBOX_OPL
cards[card].WriteReg(index, static_cast<uint8_t>(value));
#else
OPL3_WriteReg(&cards[card], static_cast<Bit16u>(index), static_cast<Bit8u>(value));
#endif
- #endif
+
+ #endif//ADLMIDI_HW_OPL
}
void OPL3::PokeN(size_t card, uint16_t index, uint8_t value)
{
#ifdef ADLMIDI_HW_OPL
+ (void)card;
unsigned o = index >> 8;
unsigned port = OPLBase + o * 2;
+
+ #ifdef __DJGPP__
outportb(port, index);
for(unsigned c = 0; c < 6; ++c) inportb(port);
outportb(port + 1, value);
for(unsigned c = 0; c < 35; ++c) inportb(port);
+ #endif
+
+ #ifdef __WATCOMC__
+ outp(port, index);
+ for(uint16_t c = 0; c < 6; ++c) inp(port);
+ outp(port + 1, value);
+ for(uint16_t c = 0; c < 35; ++c) inp(port);
+ #endif//__WATCOMC__
+
#else
#ifdef ADLMIDI_USE_DOSBOX_OPL
cards[card].WriteReg(static_cast<Bit32u>(index), value);
@@ -452,15 +478,16 @@ void OPL3::ChangeVolumeRangesModel(ADLMIDI_VolumeModels volumeModel)
void OPL3::Reset(unsigned long PCM_RATE)
{
+ #ifndef ADLMIDI_HW_OPL
#ifdef ADLMIDI_USE_DOSBOX_OPL
DBOPL::Handler emptyChip; //Constructors inside are will initialize necessary fields
#else
_opl3_chip emptyChip;
std::memset(&emptyChip, 0, sizeof(_opl3_chip));
#endif
- #ifndef ADLMIDI_HW_OPL
cards.clear();
#endif
+ (void)PCM_RATE;
ins.clear();
pit.clear();
regBD.clear();