Menu

#149 add support `times N db %'

open
nobody
None
1
2008-07-09
2008-07-09
Anonymous
No

In fasm `times 5 db %' will define five bytes with values 1, 2, 3, 4, 5. `%' is counter of repeats.
Please, add in the nasm the feature.

Discussion

  • Frank Kotler

    Frank Kotler - 2008-07-09

    Logged In: YES
    user_id=68913
    Originator: NO

    Settle for this?

    %macro byte_counter 1
    %assign %%count 0
    %rep %1 + 1
    db %%count
    %assign %%count %%count + 1
    %endrep
    %endmacro

    byte_counter 5

    Best,
    Frank

     
  • nasm64developer

    nasm64developer - 2008-07-09
    • priority: 5 --> 1
     
  • nasm64developer

    nasm64developer - 2008-07-09

    Logged In: YES
    user_id=804543
    Originator: NO

    Instead of only teaching TIMES how to do it, you
    really want to teach %REP...%ENDREP how to do it,
    since they are more general (and thus powerful).
    And you want more than just '%'.

    See SF #872331 for %*, %%*, %%%* (i.e. being able
    to refer to the current iteration in a %REP, and
    the current token/char in a %REPTOK/%REPSTR).

    See SF #1241018 for %+0 and %-0 (i.e. being able
    to refer to the number of completed and remaining
    iterations).

    See SF #1365092 for multiple % (i.e. being able to
    refer to outer reps).

    See SF #1552357 for %REP with base/step arguments.

    The code attached to #1842438 implements all of the
    above.

     

Log in to post a comment.