;       SCCSID = @(#)beep.asm   6.2 90/12/10
        PAGE    ,132
        NAME    DOSBEEP
        TITLE   DOSBeep Worker Service

;***    DosBeep Worker Service (DOSBEEP)
;
;       SCCSID = @(#)beep.asm   6.2 90/12/10
;
; ****************************************************************************
; *                                                                          *
; *                       IBM/Microsoft Confidential                         *
; *                                                                          *
; *                 Copyright (c) IBM Corporation  1987, 1990                *
; *                 Copyright (c) Microsoft Corp.  1987, 1990                *
; *                           All Rights Reserved                            *
; *                                                                          *
; ****************************************************************************
;
;       DESCRIPTION
;       This module contains the DOSBEEP worker service.
;
;       MODIFICATION HISTORY
;       04/23/90 MTS    Created.
;       12/10/90 GEB    fix for ptr b789448

        .xlist
        include dosseg.inc
        include basemaca.inc
        include osmaca.inc
        .list

;***    Imported References

        EXTRN32 _w_Beep


        FARCODE LOW

CODE    SEGMENT

        .386p

;***EP  w_Beep(usFreq, usDuration) - DOSBEEP Service
;
;       This is the worker routine for DOSBEEP.  It generates
;       a tone from the system speaker with the given frequency
;       and duration.
;
;       ENTRY
;           (bx) - usFreq     = beep frequency in Hz
;           (cx) - usDuration = beep duration in ms
;
;       EXIT
;           SUCCESS
;               (ax) = 0
;           FAILURE
;               (ax) = error code - ERROR_INVALID_FREQUENCY
;
;       USES
;           None
;
;       CONTEXT
;           Task
;
;       PSEUDOCODE
;           call 32-bit _w_Beep worker;

        ASSUME  CS:CODE,DS:NOTHING,ES:NOTHING,SS:NOTHING
Procedure w_Beep,HYBRID

if RAS
;***DT  DosBeep - Pre-Invocation Dynamic Trace
;
;       TRACE   MINOR=0x0007,
;               TP=.DosBeep_PreTrace,
;               TYPE=(PRE,API),
;               GROUP=IO,
;               DESC="(OS) DosBeep Pre-Invocation"

        public  DosBeep_PreTrace
DosBeep_PreTrace:
endif ;RAS


        FlatContext <ds,es>,ax

        movzx   ebx,bx          ;(ebx)=ulFreq
        movzx   ecx,cx          ;(ecx)=ulDuration

        CCALL32 _w_Beep,<ebx,ecx>
        cmp ax,1                                                  ; B789448
        cmc                         ; set carry if (EX) non-zero  ; B789448

if RAS
;***DT  DosBeep - Post-Invocation Dynamic Trace
;
;       TRACE   MINOR=0x8007,
;               TP=.DosBeep_PostTrace,
;               TYPE=(POST,API),
;               GROUP=IO,
;               DESC="(OS) DosBeep Post-Invocation",
;               FMT="Return Code=%w",
;               REGS=(AX)

        public  DosBeep_PostTrace
DosBeep_PostTrace:
endif ;RAS

        ret

EndProc w_Beep


CODE    ENDS

        END
