summaryrefslogtreecommitdiff
path: root/opl/examples/droplay.c
diff options
context:
space:
mode:
authorSimon Howard2009-09-26 23:52:41 +0000
committerSimon Howard2009-09-26 23:52:41 +0000
commitdce2c95f05b8f5ed734d1a1b75ccd7bfb2260557 (patch)
treec691b8315051dbd9ee59158d6d7d88886ab46c97 /opl/examples/droplay.c
parent808b78153c3d3bfe1fb692106323731d17e49489 (diff)
downloadchocolate-doom-dce2c95f05b8f5ed734d1a1b75ccd7bfb2260557.tar.gz
chocolate-doom-dce2c95f05b8f5ed734d1a1b75ccd7bfb2260557.tar.bz2
chocolate-doom-dce2c95f05b8f5ed734d1a1b75ccd7bfb2260557.zip
Move register read/write code into OPL library. Detect OPL in the
library code, so that we fall back to software emulation if we have port access but an OPL is not detected. Fix detection of ioperm in configure. Subversion-branch: /branches/opl-branch Subversion-revision: 1692
Diffstat (limited to 'opl/examples/droplay.c')
-rw-r--r--opl/examples/droplay.c31
1 files changed, 0 insertions, 31 deletions
diff --git a/opl/examples/droplay.c b/opl/examples/droplay.c
index d53a427b..36f5c3c0 100644
--- a/opl/examples/droplay.c
+++ b/opl/examples/droplay.c
@@ -73,30 +73,6 @@ void ClearAllRegs(void)
}
}
-// Detect an OPL chip.
-
-int DetectOPL(void)
-{
- int val1, val2;
-
- WriteReg(OPL_REG_TIMER_CTRL, 0x60);
- WriteReg(OPL_REG_TIMER_CTRL, 0x80);
-
- val1 = OPL_ReadPort(OPL_REGISTER_PORT) & 0xe0;
-
- WriteReg(OPL_REG_TIMER1, 0xff);
- WriteReg(OPL_REG_TIMER_CTRL, 0x21);
-
- OPL_Delay(1);
-
- val2 = OPL_ReadPort(OPL_REGISTER_PORT) & 0xe0;
-
- WriteReg(OPL_REG_TIMER_CTRL, 0x60);
- WriteReg(OPL_REG_TIMER_CTRL, 0x80);
-
- return val1 == 0 && val2 == 0xc0;
-}
-
void Init(void)
{
if (SDL_Init(SDL_INIT_TIMER) < 0)
@@ -110,12 +86,6 @@ void Init(void)
fprintf(stderr, "Unable to initialise OPL layer\n");
exit(-1);
}
-
- if (!DetectOPL())
- {
- fprintf(stderr, "Adlib not detected\n");
- exit(-1);
- }
}
void Shutdown(void)
@@ -236,7 +206,6 @@ int main(int argc, char *argv[])
}
Init();
- ClearAllRegs();
PlayFile(argv[1]);