News:

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

split strings

Started by lelejau, December 16, 2010, 03:40:43 PM

Previous topic - Next topic

jj2007

Quote from: lelejau on December 16, 2010, 05:21:26 PM
Just answer me something, what TheBranch=1 is for?

It is called "conditional assembly". Masm generates either the loop code, or the three print statements. Good for testing variants.

lelejau

Learning assembly :)

jj2007

Masm generates different code depending on the value of TheBranch. The first variant uses a loop, the second one
  • , [4] etc to get the address of array elements; this is less flexible, of course.

    You can see the difference if you run the executable(s) with OllyDbg.

      if TheBranch eq 1
    mov esi, offset TheArray ; start of array pointers
    .Repeat
    lodsd ; mov eax, [esi] plus add esi, 4
    .Break .if !eax ; eax = 0 means end of pointers
    print eax, 13, 10 ; print it...
    .Until 0
      else
    print TheArray[0], 13, 10
    print TheArray[4], 13, 10
    print TheArray[8], 13, 10
      endif

lelejau

Learning assembly :)