Using db to declare a string in assembly NASM

隐身守侯 提交于 2019-12-05 10:30:33

The pseudo instructions db, dw, dd and friends can define multiple items

db 34h             ;Define byte 34h
db 34h, 12h        ;Define bytes 34h and 12h (i.e. word 1234h)

They accept character constants too

db 'H', 'e', 'l', 'l', 'o', 0

but this syntax is awkward for strings, so the next logical step was to give explicit support

db "Hello", 0         ;Equivalent of the above

P.S. In general prefer the user-level directives, though for [BITS] and [ORG] is irrelevant.

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