MASM32 中的宏在做什么?
szText MACRO Name, Text:VARARG
LOCAL lbl
jmp lbl
Name db Text,0
lbl:
ENDM
有谁知道这个宏是做什么的吗?
szText MACRO Name, Text:VARARG
LOCAL lbl
jmp lbl
Name db Text,0
lbl:
ENDM
Anyone knows what this macro's doing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来它创建了一个以零结尾的字符串(因此,sz)。字符串的符号是作为 Name 参数传递给宏的任何内容,并且它包含作为 Text 参数传递的任何内容,加上终止 0。
它输出一条跳转指令以跳过字符串,后跟字符串的字节字符串本身。跳转的标签被声明为宏的本地标签,因此它不会污染全局命名空间。
自从我完成 x86 汇编语言以来已经有一段时间了,但我想这会将字符串数据放在代码段中,而不是放在数据段中,这看起来有点奇怪。
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.