this is from one of hutches string algorithms:
 ; ########################################################################

trim proc src:DWORD

    mov ecx, src
    mov edx, src

  ; ---------------------------
  ; read leading tabs & spaces
  ; ---------------------------
  @@:
    mov al, 
    inc ecx
    cmp al, 32  ; space
    je @B
    cmp al, 9   ; tab
    je @B

    dec ecx     ; correct for following copy

  ; --------------------------------------
  ; copy the rest including trailing zero
  ; --------------------------------------
  @@:
    mov al, 
    inc ecx
    mov , al
    inc edx
    cmp al, 0
    jne @B

  ; --------------------------------------
  ; back 2 to compare trailing characters
  ; --------------------------------------
    sub edx, 2

  ; ----------------------------------------------
  ; scan backwards to find first non tab or space
  ; ----------------------------------------------
  @@:
    mov al, 
    dec edx
    cmp al, 32
    je @B
    cmp al, 9
    je @B

  ; --------------------------------------------------
  ; place terminator at position of last tab or space
  ; --------------------------------------------------
    mov , byte ptr 0

    ret

trim endp

; #########################################################################
i need to know about @@: and especially @B i dont understand where the code is jumping to when refering to @B. also @@: doesnt appear to be jumped to so why use it? thanks smurf
Posted on 2001-06-11 20:01:00 by smurf
this is my first time looking at this code and i must say that it's very strange. @@ can be use for label. but error will strike as soon you use the Jxx to @@. and also, there's two of @@ in the trim procedure... i think that's not good because it's considered as symbol redefinition. and therefore, it's invalid.
Posted on 2001-06-11 21:48:00 by NOP
@@ is an anonimous label. You can use label @B to jump to the previous label @@ ("B" means "back") and @F ("F" means "forward") to jump to the next label @@. For instance:

@@:            <-|
    ;some code   |
    jz @B -------|

    jmp @F ------|
@@:            <-|
Posted on 2001-06-11 23:02:00 by vkim
smurf, vkim is right, masm supports anonymous labels so that you don't have to keep inventing new names in places where the labels are very close to the jump being taken. They can look a little strange vut once you are used to them, they save you a lot of messing around naming labels that are obvious and don't need it.

  @@:    ; anonymous label
    ; code
    jmp @B    ; jump back to last @@: label
    ;code
    jmp @F    ; jump forward to next @@: label
    ;code
  @@:
It does make more complicted algorithms simpler to write, all the assembler does is substitute a unique label into the code when it finds a @@: and they are all resolved by the asembler. Regards, hutch@pbq.com.au
Posted on 2001-06-12 03:23:00 by hutch--