问题
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