The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: Magnum on May 29, 2010, 07:28:45 PM

Title: Endm with macro name
Post by: Magnum on May 29, 2010, 07:28:45 PM
This code assembles fine but there is no macro name, just the endm?

I also cannot see what is being repeated 8 times here either.


.startup

    invoke sleep, 50

    REPEAT 8

      ctr_begin 100
      ctr_end
      print dword$(eax)," cycles, empty",13,10

      ctr_begin 100
        invoke CtBits, 123
      ctr_end
      print dword$(eax)," cycles, CtBits",13,10

      ctr_begin 100
        mov dx, 123
        call CBits
      ctr_end
      print dword$(eax)," cycles, CBits",13,10

    ENDM

Title: Re: Endm with macro name
Post by: qWord on May 29, 2010, 07:46:41 PM
the macro loops are also finalized by ENDM:
REPEAT count
    ...
ENDM
WHILE cond
    ...
ENDM
FOR arg,<args>
    ...
ENDM
Title: Re: Endm with macro name
Post by: dedndave on May 29, 2010, 07:47:52 PM
in other words, the ENDM directive is paired with the REPEAT directive in this case
Title: Re: Endm with macro name
Post by: Magnum on May 29, 2010, 09:06:02 PM
Quote from: dedndave on May 29, 2010, 07:47:52 PM
in other words, the ENDM directive is paired with the REPEAT directive in this case

Thanks. I thought endm was only used with macros.

Title: Re: Endm with macro name
Post by: BogdanOntanu on May 29, 2010, 09:42:39 PM
Quote from: Magnum on May 29, 2010, 09:06:02 PM
...
Thanks. I thought endm was only used with macros.

REPEAT, WHILE and FOR directives are in fact MACROS that do not need a name and have predefined arguments...  and because of this they are paired / ended with ENDM like any other macro does.