home *** CD-ROM | disk | FTP | other *** search
/ World of Shareware - Software Farm 2 / wosw_2.zip / wosw_2 / CPROG / SCRD_ASM.ZIP / ADLIB.INC next >
Text File  |  1992-06-20  |  2KB  |  61 lines

  1. comment *
  2.  
  3.         Purpose:
  4.         Macros for use in AdLib/SoundBlaster programming
  5.  
  6.         Author: Yousuf J. Khan
  7.  
  8.         *
  9.  
  10. addrdelay       macro           ;delay after writing to address port
  11.         mov     cx, 6           ;six loops, 3.3 microsecs
  12.         call    delay
  13.         endm
  14.  
  15. datadelay       macro           ;delay after writing to data port
  16.         mov     cx, 35          ;thirty-five loops, 23 microsecs
  17.         call    delay
  18.         endm
  19.  
  20. setreg  macro   address, data
  21. ;comment *
  22. ;
  23. ;        Purpose:
  24. ;        This macro first places the sound card's register address in its
  25. ;        address port. Then after a specified delay it then places the
  26. ;        desired value into that register from the Data port.
  27. ;
  28. ;        Entry:
  29. ;        DX: Address port of sound card
  30. ;
  31. ;        *
  32.         ; Note: set DX to port address beforehand
  33.         push    cx
  34.         mov     al, address
  35.         out     dx, al
  36.         mov     cx, 6
  37.         call    sbdelay
  38.         inc     dx
  39.         mov     al, data
  40.         out     dx, al
  41.         dec     dx
  42.         mov     cx, 35
  43.         call    sbdelay
  44.         pop     cx
  45.         endm
  46.  
  47. setadlib        macro   address, data
  48. comment *
  49.  
  50.         Purpose:
  51.         This is a special version of the SETREG macro, specifically
  52.         suited to sending commands to the AdLib's Address port, 388h,
  53.         and its Data port, 389h.
  54.  
  55.         *
  56.         push    dx              ;save DX
  57.         mov     dx, 388h
  58.         setreg  address, data
  59.         pop     dx              ;restore DX
  60.         endm
  61.