News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Those @@: marks

Started by ShadowRayz, October 02, 2008, 11:24:55 AM

Previous topic - Next topic

ShadowRayz

I couldn't find an example of what those things are  :dazzled: , a small peace of code with explanation would be highly appreciated.

fearless

Microsoft Macro Assembler Reference: Symbols Reference

Quote@@:
Defines a code label recognizable only between label1 and label2, where label1 is either start of code or the previous @@: label, and label2 is either end of code or the next @@: label. See @B and @F.

Quote@F
The location of the next @@: label.

Quote@B
The location of the previous @@: label.

They can be used in code for branching: je @F, jnz @B, jl @F etc etc when testing for certain conditions then moves onto next @@: with the @F symbol or backward with the @B symbol to the last @@:

Here is an example (taken from the faster GetProcAddr function submitted by Lingo)

FindNextCharw:                          ;
       mov    ch,  [eax]                ; eax-> BaseDllName or FullDllName (Unicode)
       add    eax, 2                    ;
       cmp    ch,  5Ah                  ;
       ja     @f                        ;
       cmp    ch,  41h                  ;
       jl     @f                        ;
       or     ch,  20h                  ;
@@:                                     ;
       mov    cl,  [edx]                ; edx->lp dll name string "." or zero ended
       add    edx, 1                    ;
       cmp    cl,  5Ah                  ;
       ja     @f                        ;
       cmp    cl,  41h                  ;
       jl     @f                        ;
       or     cl,  20h                  ;
@@:                                     ;
       cmp    cl,  ch                   ;
       jne    Next_LDRw                 ;
       test   ch,  ch                   ;
       je     @f                        ;
       cmp    ch,  "."                  ;
       jne    FindNextCharw             ;
       cmp    dword ptr [esp+1*4], -1   ; flag for forwarded proc ->  If it is forwarded
       jne    FindNextCharw             ;           copy until "." , else until zero
@@:                                     ;
       mov    ebx, [esi+8]              ; ebx-> Base Dll Name address
       je     GetNextApi                ;

ƒearless

ShadowRayz


P1

One other consideration, but you would have figure it out with the Jump out of Range error.

These are assembled as short relative jumps.

Regards,  P1   :8)

Mark Jones

Are not they called "Anonymous Jump Labels?"
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08