<<< Calling Beep from Assembly     Index     Notes regarding the Beep sample program >>>

; @goto masm

; CIS-77 Lab exercise M09
; M09.BAT
; Program that beeps
;

.386                ; Tells MASM to use Intel 80386 instruction set.
.MODEL FLAT         ; Flat memory model
option casemap:none ; Treat labels as case-sensitive

EXTERN _Beep@8:NEAR

.CONST          ; Constant data segment

.DATA           ; Begin initialised data segment

.CODE           ; Begin code segment
_main PROC      ; Main entry point into program

    ; __stdcall calling convention: args pushed R to L
    
    mov         eax, 200  ; duration, milliseconds
    push        eax
    
    mov         eax, 1000 ; frequency, Hertz
    push        eax
    
    call        _Beep@8   ; Beep( frequency, duration );
    
    ret
_main ENDP
END _main       ; Marks the end of the module and sets the program entry point label

:masm
; @call "C:\Program Files\Microsoft Visual Studio 8\Common7\Tools\vsvars32.bat"
; @echo ___________________________________________________
; ml /c /coff M09.BAT
; @echo ___________________________________________________
; link /subsystem:console /entry:main /out:M09.exe M09.OBJ kernel32.lib
; @echo ___________________________________________________
; @pause

<<< Calling Beep from Assembly     Index     Notes regarding the Beep sample program >>>