home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / p / pps110.zip / PPSSRC.ZIP / PPSDET.ASM < prev    next >
Assembly Source File  |  1992-07-27  |  4KB  |  124 lines

  1. ;┌───────────────────────────────────────────────────────────────────────────┐
  2. ;│  FILENAME: PPSDET.ASM   Version 1.10                      │
  3. ;│                                         │
  4. ;│  DATE    : July 27, 1992                             │
  5. ;│                                                                           │
  6. ;│  Ideal Mode -- Turbo Assembler v2.01 and above                 │
  7. ;│                                                                           │
  8. ;│  DESCRIPTION: This file includes all routines for detecting what sound    │
  9. ;│         equipment is onboard the computer.                 │
  10. ;└───────────────────────────────────────────────────────────────────────────┘
  11.  
  12.     ideal                ; Use TASM's Ideal mode.
  13.     model    Small,Pascal        ; Define the memory model.
  14.     P286                ; Set up for 286 instructions.
  15.     jumps                ; Have TASM automatically resolve out-
  16.                     ; of-range jumps.
  17.  
  18.     include "pps.inc"
  19.  
  20. codeseg
  21.  
  22. ;╒═══════════════════════════════════════════════════════════════════════════╕
  23. ;│ NAME       : sd_DetectSB                             │
  24. ;│                                                                           │
  25. ;│ ENTRY      : None                                                         │
  26. ;│                                                                           │
  27. ;│ RETURN     : None                                                         │
  28. ;│                                                                           │
  29. ;│ DESCRIPTION: Soundblaster specific code.  Finds Soundblaster port         │
  30. ;│        address is available.  This code is based on a lot of         │
  31. ;│        technical junk that came out of the SBK around section 8-4.  │
  32. ;│                                                                           │
  33. ;│        *** Written by Joshua C. Jensen                  │
  34. ;╘═══════════════════════════════════════════════════════════════════════════╛
  35. proc    sd_DetectSB
  36.     mov    dx,210h
  37. @@TopLoop:
  38.     add    dx,6
  39.     mov    al,1
  40.     out    dx,al            ; Send a 1 to reset the port.
  41.     mov    cx,10
  42. @@WaitLoop:                             ; This should be about 3 ms
  43.     loop    @@WaitLoop
  44.     mov    al,0
  45.     out    dx,al            ; Send a 0 to reset the port.
  46.     add    dx,6
  47.     call    sd_PollSB
  48.     jnb    @@Found
  49.     sub    dx,0Ch
  50.     add    dx,10h
  51.     cmp    dx,270h
  52.     jnz    @@TopLoop
  53.     jmp    @@Exit
  54. @@Found:
  55.     mov    al,0D1h
  56.     out    dx,al
  57.     mov    bx,size SoundSrcStruc
  58.         add     bx,offset SoundSources
  59.     mov    [bx+SoundSrcStruc.AddressLeft],dx
  60.     mov    [Byte SoundSource],1
  61. @@Exit:
  62.     ret
  63. endp    sd_DetectSB
  64.  
  65. proc    sd_PollSB
  66.         mov     bx,10
  67. @@TopLoop:
  68.         mov     cx,255
  69. @@PollIt:
  70.         in      al,dx
  71.         rol     al,1
  72.         jnb     @@GotAResponse
  73.         loop    @@PollIt
  74.         dec     bx
  75.         jnz     @@TopLoop
  76.         stc
  77. @@GotAResponse:
  78.         ret
  79. endp    sd_PollSB
  80.  
  81. ;╒═══════════════════════════════════════════════════════════════════════════╕
  82. ;│ NAME       : sd_DetectDACs                             │
  83. ;│                                                                           │
  84. ;│ ENTRY      : None                                                         │
  85. ;│                                                                           │
  86. ;│ RETURN     : SoundSource set to first DAC found in SoundSources list.     │
  87. ;│                                                                           │
  88. ;│ DESCRIPTION: DAC specific code.  Finds the port addresses of all          │
  89. ;│        installed parallel ports on the system.              │
  90. ;│                                         │
  91. ;│              *** Written by Joshua C. Jensen                              │
  92. ;╘═══════════════════════════════════════════════════════════════════════════╛
  93. proc    sd_DetectDACs
  94.     uses    es
  95.     mov    ax,0040h
  96.     mov    es,ax
  97.     mov    si,8
  98.     mov    bx,size SoundSrcStruc
  99.     shl    bx,1
  100.     add    bx,offset SoundSources
  101.     xor    cx,cx
  102.     xor    dx,dx            ; Used for found DAC.
  103. @@DACLoop:
  104.     mov    ax,[es:si]        ; Get the address.
  105.     add    si,2
  106.     or    ax,ax            ; Is there a parallel port?
  107.     jz    @@ParallelPut
  108.     or    dx,dx            ; Do we already have one here?
  109.     jnz    @@ParallelPut
  110.     mov    dx,cx
  111.     add    dx,2
  112. @@ParallelPut:
  113.     mov    [bx+SoundSrcStruc.AddressLeft],ax
  114.     add    bx,size SoundSrcStruc
  115.     inc    cx
  116.     cmp    cx,4
  117.     jz    @@DACLoop
  118.     mov    [SoundSource],dl
  119.     ret
  120. endp    sd_DetectDACs
  121.  
  122. end
  123.  
  124.