开发者

What's the macro doing in MASM32?

  szText MACRO Name, Text:VARARG
    LOCAL lbl
      jmp lbl
        Name db Text,0
      lbl:
    ENDM
开发者_运维百科

Anyone knows what this macro's doing?


It looks like it creates a zero-terminated string (hence, sz). The symbol for the string is whatever you pass as the Name parameter to the macro, and it contains whatever you pass as the Text parameter, plus a terminating 0.

It outputs a jump instruction to jump past the string, followed by the bytes of the string itself. The label for the jump is declared to be local to the macro, so it doesn't pollute the global namespace.

It's been a while since I've done x86 assembly language, but I guess this would put the string data right in the code segment, rather than putting it in a data segment, which seems a bit odd.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜