foxygit / doom Log in
commit a10180a460f6425cd308719584aa58ab4fcb63fb
Author:     Simon Howard <fraggle@gmail.com>
AuthorDate: Sat Aug 29 21:26:43 2009 +0000
Commit:     Simon Howard <fraggle@gmail.com>
CommitDate: Sat Aug 29 21:26:43 2009 +0000

    Use OPL_Delay to wait 1ms for timer to expire when doing OPL detect.

    Subversion-branch: /branches/opl-branch
    Subversion-revision: 1638
---
 opl/examples/droplay.c | 7 ++++++-
 src/i_oplmusic.c       | 2 ++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/opl/examples/droplay.c b/opl/examples/droplay.c
index 4c2fc2f8..d53a427b 100644
--- a/opl/examples/droplay.c
+++ b/opl/examples/droplay.c
@@ -81,11 +81,16 @@ int DetectOPL(void)

     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(50);
+
+    OPL_Delay(1);
+
     val2 = OPL_ReadPort(OPL_REGISTER_PORT) & 0xe0;
+
     WriteReg(OPL_REG_TIMER_CTRL, 0x60);
     WriteReg(OPL_REG_TIMER_CTRL, 0x80);

diff --git a/src/i_oplmusic.c b/src/i_oplmusic.c
index c444dfd8..0e1b69a3 100644
--- a/src/i_oplmusic.c
+++ b/src/i_oplmusic.c
@@ -202,6 +202,8 @@ static boolean DetectOPL(void)
         GetStatus();
     }

+    OPL_Delay(1);
+
     // Read status
     result2 = GetStatus();