Initialize String Assembly

自古美人都是妖i 提交于 2019-12-25 05:34:32

问题


In i386 I'm trying to initialize a string in data. This is stupid, but I can't get it to work.

sentence:
.char 'h',0

says .char is an illegal pseudo op. Clearly I'm not doing it right, though

sentence: db 'h',0

gives nothing either.


回答1:


As lurker said, each assembler has its own syntax. db is used by nasm, for example. gas provides .byte, .string, .asciz and a bunch of other directives. See the manual. Your code could look like:

sentence: .string "h"


来源:https://stackoverflow.com/questions/29724523/initialize-string-assembly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!