I would like to repeat these 2 sounds 25 times and then wait the 2 secs.
I tried plugging 25 into the ecx register and decrementing it, but got an endless loop.
invoke Beep, 1000, 55 ; Sound duration and the frequency in hertz
invoke Beep, 800, 55
invoke Sleep, 2000
Since ECX is one of the three registers not preserved across function calls, to use it as a loop counter you would need to preserve it around the function calls:
mov ecx, 25
@@:
push ecx
invoke Beep, 1000, 55 ; Sound duration and the frequency in hertz
invoke Beep, 800, 55
pop ecx
dec ecx
jnz @B
invoke Sleep, 2000
Or if you don't mind simply repeating the statements 25 times each , you can save some typing effort with:
REPEAT 25
invoke Beep, 1000, 55 ; Sound duration and the frequency in hertz
invoke Beep, 800, 55
ENDM
invoke Sleep, 2000
Thanks MichaelW.