The MASM Forum

General => The Campus => Topic started by: Magnum on June 22, 2015, 05:57:22 AM

Title: Macro ?
Post by: Magnum on June 22, 2015, 05:57:22 AM
I forgot what to do so I do not have to type the whole section.

Macro comes to mind, but I am probably wrong.

mov ecx, 15
@@:
push ecx
invoke Beep, 1000, 55 ; Frequency in hertz and sound duration
invoke Beep, 800, 55   
pop ecx
dec ecx
jnz @B
invoke Sleep, 1500   

Title: Re: Macro ?
Post by: Magnum on June 22, 2015, 01:02:00 PM
I found some examples in MASM32/macros/ but I am lost.

Title: Re: Macro ?
Post by: rrr314159 on June 22, 2015, 02:43:27 PM
Magnum: ... I do not have to type the whole section.

- I don't understand what u want to do. What section?
Title: Re: Macro ?
Post by: Magnum on June 22, 2015, 03:07:42 PM
I want to repeat the code I posted without typing the whole thing.

I know a lot of folks are mad at me, so the responses will be minimal.   :biggrin:

I will try real hard to not post anything to the Colesseum or other controversial areas. :-)


Title: Re: Macro ?
Post by: rrr314159 on June 22, 2015, 04:30:54 PM
playbeeps MACRO
LOCAL beeploop
mov ecx, 15
beeploop:
push ecx
invoke Beep, 1000, 55 ; Frequency in hertz and sound duration
invoke Beep, 800, 55   
pop ecx
dec ecx
jnz beeploop
invoke Sleep, 1500   
ENDM