home *** CD-ROM | disk | FTP | other *** search
/ Audio 4.94 - Over 11,000 Files / audio-11000.iso / msdos / sndbords / proaudio / pcmtlsrc / pcm.arj / PCM.ASM < prev    next >
Assembly Source File  |  1992-09-01  |  4KB  |  193 lines

  1. ;$Author:   BCRANE  $
  2. ;$Date:   01 Sep 1992 13:34:10  $
  3. ;$Header:   X:/sccs/sdkapp/pcm.asv   1.2   01 Sep 1992 13:34:10   BCRANE  $
  4. ;$Log:   X:/sccs/sdkapp/pcm.asv  $
  5. ;  
  6. ;     Rev 1.2   01 Sep 1992 13:34:10   BCRANE
  7. ;  changed VERBOSE to TELLABIT (?) to indicate progress (or not)
  8. ;  
  9. ;     Rev 1.1   31 Aug 1992 09:34:00   BCRANE
  10. ;  added support for 16-bit 
  11. ;  
  12. ;     Rev 1.0   29 Jul 1992 16:57:52   BCRANE
  13. ;  Initial revision.
  14. ;$Logfile:   X:/sccs/sdkapp/pcm.asv  $
  15. ;$Modtimes$
  16. ;$Revision:   1.2  $
  17. ;$Workfile:   pcm.asm  $ 
  18.  
  19.     page 120,132
  20.     title PCM - substitute interrupt vectors
  21.     subttl Bart Crane - copyright 1-90 - all rights reserved
  22.  
  23. TALKABIT equ 1
  24. BUILDALL equ 1
  25. MODELSIZE equ 0
  26. BUILD_PAS3 equ 1
  27.  
  28.     include model.inc
  29. ;    .model compact, c
  30.  
  31.     .xlist
  32. include macro.inc
  33.     .list
  34.  
  35. program_size    equ pcmw - start + 100h
  36. program_para    equ program_size shr 4
  37.  
  38. _text    segment 
  39.     assume cs:_text, ds:_text
  40.     org 100h
  41.  
  42. start:    jmp pcmw
  43.  
  44. f_sig    db 'PCM-SHARK (v1.1)'            ; Check for residency
  45. f_copy    db 'Copyright (c) 1992.  Media Vision, Inc.  All Rights Reserved.'
  46.  
  47.  
  48. ;;;;; pcm.inc - data structures, vector tables, resident stuff
  49. include mvsound.asm            ; Media Vision Library Code
  50. include pcm.inc            ; Interrupt handlers and tables
  51.  
  52.     align 32
  53. i_didone    db    0
  54.  
  55.     align 32
  56. pcmw    proc
  57.     assume cs:_text, ds:_text
  58.  
  59.     mov ax, cs            ; Set up data segment
  60.     mov ds, ax
  61.     mov savedcs, ax            ; save for later use
  62.  
  63.     mov ah, 34h            ; get "indos" flag address
  64.     int 21h
  65.     mov word ptr indos[0], bx    ; save
  66.     mov word ptr indos[2], es
  67.  
  68.     mov cx, MAXINTR            ; Count of interrupts to replace
  69.     mov si, offset iddata         ; Get first intrdata structure
  70.  
  71. i_do:
  72.     mov ax, cs
  73.     mov ds, ax            ; ds points to data in code segment
  74.  
  75.     if TALKABIT
  76.     mov dx, si            ; i_name coming up
  77.     add dx, nam            ; dx gets address of nam in st_intr 
  78.     dstring                ; Display name from list in dx
  79.     endif
  80.  
  81.     mov al, byte ptr [si].vnum    ; Vector number
  82.     mov ah, GETDOSVECTOR
  83.     int 21h
  84.  
  85.     nop
  86.     nop
  87.     nop
  88.     nop
  89.     call chkforsig            ; check signature in isr's segment
  90.     jne i_ok
  91.  
  92.     if TALKABIT
  93.     dstring s_nuuh            ; Display message of already done
  94.     endif
  95.  
  96.     jmp short i_done        ; Skip to next vector in list
  97.  
  98. i_ok:
  99.     mov ax, cs
  100.     mov ds, ax            ; just to be sure
  101.  
  102.     mov al, byte ptr [si].vnum    ; vector number to replace
  103.     mov ah, GETDOSVECTOR
  104.     int 21h
  105.  
  106.     mov word ptr [si].vold[0], bx    ; save isr address from dos
  107.     mov word ptr [si].vold[2], es
  108.  
  109.     nop
  110.     nop
  111.     nop
  112.     nop
  113.     nop
  114.     nop
  115.  
  116.     mov dx, [si].vnew        ; i_intr taken care of
  117.     mov al, byte ptr [si].vnum
  118.     mov ah, SETDOSVECTOR
  119.     int 21h
  120.  
  121.     nop
  122.     nop
  123.     nop
  124.     nop
  125.     nop
  126.  
  127.     mov ax, [si].vini        ; initialization routine
  128.     or ax, ax            ; is there one?
  129.     jz @F                ; no, skip
  130.  
  131.     call ax                ; yes, call it
  132.  
  133. @@:    inc i_didone            ; Installed a new vector
  134.  
  135.     if TALKABIT
  136.     dstring s_done
  137.     endif
  138.  
  139. i_done:
  140.     add si, type st_intr
  141.     loop i_do
  142.  
  143.     test i_didone, 0FFFFh        ; Did we do one?
  144.     jz i_quit            ; No, don't go resident
  145.  
  146.     if TALKABIT
  147.     dstring s_okay            ; Display message that its okay
  148.     endif
  149.  
  150.     resident (program_para+1)*1    ; ((pcmw-start)>>4)+1
  151.  
  152. i_quit:
  153.     terminate 1            ; Error 1 - already resident
  154.  
  155. pcmw    endp
  156.  
  157. chkforsig proc near
  158.  
  159.     cmp es:f_sig[0], 'P'        ; Check for string in segment 
  160.     jne @F                ; Not, okay to install
  161.     cmp es:f_sig[1], 'C'
  162.     jne @F
  163.     cmp es:f_sig[2], 'M'
  164.     jne @F
  165.     cmp es:f_sig[3], '-'
  166.     jne @F
  167.     cmp es:f_sig[4], 'S'
  168.     jne @F
  169.     cmp es:f_sig[5], 'H'
  170.     jne @F
  171.     cmp es:f_sig[6], 'A'
  172.     jne @F
  173.     cmp es:f_sig[7], 'R'
  174.     jne @F
  175.     cmp es:f_sig[8], 'K'
  176.     jne @F
  177.  
  178.     ret                ; zr flag set
  179.  
  180. @@:
  181.     ret                ; zr flag cleared
  182.  
  183. chkforsig endp
  184.  
  185. include gethw.asm
  186. include mvstate.asm
  187.  
  188. _text    ends
  189.     end    start
  190.  
  191.  
  192.  
  193.