汇编语言中字符串存储时DB DW怎么确定是选用DB存储还是DW存储?

比如 DB “I am a Mananger”应该也可以用 DW “I am a Mananger”吧,
2024-11-05 03:45:38
推荐回答(1个)
回答1:

字符串存储必须用db(单字节顺序存放),

不能用dw(双字节顺序存放,且要分开编辑。按低到低字节、高到高位字节对应)

code  segment
      assume cs:code
      org 100h
start:
      jmp bbb
      nop
msg1  dw 'he','ll','o ','wo','rl','d ',' $'

bbb:
      push cs
      pop ds
      
      lea dx,msg1
      mov ah,9
      int 21h
      
      mov ah,4ch
      int 21h
code  ends
      end start

上例输出的是“ehll oowlr d”,而不是“hello world”