home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 15 / CDACTUAL15.iso / cdactual / program / asm / MISC_ASM.ZIP / BEEP02.ASM < prev    next >
Encoding:
Assembly Source File  |  1987-02-26  |  2.1 KB  |  79 lines

  1.     page    ,132
  2.     title    Batch file Beep
  3.  
  4. ;------------------------------------------------------------------------
  5. ;
  6. ;  Beep      -    Bill Gibson - 1987
  7. ;        Lathrup Village, Mi 48076
  8. ;
  9. ;   Ver. 1.01 -  sound using ASCII character 7            -    02/26/87
  10. ; *     1.02 -  using the 8253 timer chip directly        -    02/26/87
  11. ;
  12. ;  For Public Domain Use.  Not for Sale or Hire.
  13. ;------------------------------------------------------------------------
  14. COMMENT *
  15.        As requested by Viggo Jensen.
  16.  
  17.    Beep utility - sounds alarm until any key is pressed.
  18.  
  19.           Obviously, best use of this small utility is at
  20.           the end of a batch file.  Could be used to replace
  21.           the DOS "pause" command.
  22. *
  23. ;------------------------------------------------------------------------
  24. code        SEGMENT BYTE PUBLIC 'code'
  25. ASSUME        CS:code,DS:code,SS:code
  26.  
  27.         ORG    100h
  28.  
  29. Beep        PROC    FAR
  30.  
  31.         CALL    Sound        ;sound the horn
  32. exit:
  33.         MOV    AH,4Ch
  34.         INT    21h
  35.  
  36. ;------------------------------------------------------------------------
  37. ; Work Area - constants,equates,messages
  38. ;------------------------------------------------------------------------
  39. cr        EQU    0Dh        ;carriage return
  40. lf        EQU    0Ah        ;line feed
  41. esc        EQU    01Bh        ;escape char
  42.  
  43. msg1        DB    cr,lf,'Beeping - press any key to quit...','$'
  44.  
  45. ;--------------------------------------------------------------------------
  46. ; Sub-Routines: Declare each Proc PUBLIC for use with MapSym & SymDeb v4.0
  47. ;--------------------------------------------------------------------------
  48.         PUBLIC    Sound
  49. Sound        PROC    NEAR
  50.         MOV    DX,OFFSET msg1    ;intro greating
  51.         MOV    AH,9
  52.         INT    21h
  53. s1:
  54.         MOV    AL,182        ;notify 8253 that frequency data is
  55.         OUT    67,AL        ;coming
  56.         MOV    AL,0        ;send frequency data (776.8 Hz)
  57.         OUT    66,AL
  58.         MOV    AL,6
  59.         OUT    66,AL
  60.         IN    AL,97        ;activate speaker
  61.         OR    AL,3
  62.         OUT    97,AL
  63.         MOV    CX,6000h    ;time delay for duration
  64. sbeep:        LOOP    sbeep
  65.         IN    AL,97        ;deactivate speaker
  66.         AND    AL,252
  67.         OUT    97,AL
  68.  
  69.         MOV    AH,0Bh        ;check standard input device
  70.         INT    21h
  71.         OR    AL,AL        ;any character waiting ?
  72.         JZ    s1        ;start all over again
  73.         RET
  74. Sound        ENDP
  75.  
  76. Beep        ENDP
  77. code        ENDS
  78.         END    Beep
  79.