aboutsummaryrefslogtreecommitdiff
path: root/src/adlmidi_opl3.cpp
diff options
context:
space:
mode:
authorWohlstand <admin@wohlnet.ru>2017-11-12 07:32:11 +0300
committerWohlstand <admin@wohlnet.ru>2017-11-12 07:32:11 +0300
commitb043032a89f38e2b3191a65dab9ae4e8202d48f3 (patch)
treefa43cf8e88087b84aff825e8eaac40ff4587f2c3 /src/adlmidi_opl3.cpp
parentcc2d7237cce71482c04895e5550609534e41413b (diff)
downloadlibADLMIDI-b043032a89f38e2b3191a65dab9ae4e8202d48f3.tar.gz
libADLMIDI-b043032a89f38e2b3191a65dab9ae4e8202d48f3.tar.bz2
libADLMIDI-b043032a89f38e2b3191a65dab9ae4e8202d48f3.zip
libADLMIDI now is buildable under OpenWatcom except of some workarounds
- Need a different way to create a static library, otherwise it don't wanna be built. - Needed a different custom STL containers (std::vector and std::set) implementation that will work and will don't glitch with a crashes
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();