home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / IVUPDAT2.ZIP / IVP17.ZIP / IVP.LZH / ROUTINES.LZH / GUN.RTN < prev    next >
Text File  |  1992-12-25  |  2KB  |  36 lines

  1. ;  Makes Machine gun sounds over the speaker.
  2. ;  CX=Number of shots.
  3.  
  4. machine_gun:
  5.         push    cx                      ; Save the current count
  6.         mov     dx,0140h                ; DX holds pitch
  7.         mov     bx,0100h                ; BX holds shot duration
  8.         in      al,061h                 ; Read the speaker port
  9.         and     al,11111100b            ; Turn off the speaker bit
  10. fire_shot:
  11.         xor     al,2                    ; Toggle the speaker bit
  12.         out     061h,al                 ; Write AL to speaker port
  13.         add     dx,09248h               ;
  14.         mov     cl,3                    ;
  15.         ror     dx,cl                   ; Figure out the delay time
  16.         mov     cx,dx                   ;
  17.         and     cx,01FFh                ;
  18.         or      cx,10                   ;
  19. shoot_pause:
  20.         loop    shoot_pause             ; Delay a bit
  21.         dec     bx                      ; Are we done with the shot?
  22.         jnz     fire_shot               ; If not, pulse the speaker
  23.         and     al,11111100b            ; Turn off the speaker bit
  24.         out     061h,al                 ; Write AL to speaker port
  25.         mov     bx,0002h                ; BX holds delay time (ticks)
  26.         xor     ah,ah                   ; Get time function
  27.         int     1Ah                     ; BIOS timer interrupt
  28.         add     bx,dx                   ; Add current time to delay
  29. shoot_delay:
  30.         int     1Ah                     ; Get the time again
  31.         cmp     dx,bx                   ; Are we done yet?
  32.         jne     shoot_delay             ; If not, keep checking
  33.         pop     cx                      ; Restore the count
  34.         loop    machine_gun             ; Do another shot
  35.  
  36.