From dce2c95f05b8f5ed734d1a1b75ccd7bfb2260557 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sat, 26 Sep 2009 23:52:41 +0000 Subject: 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 --- opl/examples/droplay.c | 31 ------------------------------- 1 file changed, 31 deletions(-) (limited to 'opl/examples') 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]); -- cgit v1.2.3