如何仅从nasm的数据部分写入一个字符串?

问题描述

尝试在stdout上依次编写msg1和msg2以获得类似内容:

Hello
World

但是打印此内容:

Hello
World
World

section .data     
                              
msg1    db 'Hello',10,0
msg2    db 'World',0

len1    equ     $- msg1                
len2    equ     $- msg2

section .text
global CMAIN
CMAIN:
   mov ebp,esp; for correct debugging

   mov edx,len1        
   mov ecx,msg1         
   call printString     
   

   mov edx,len2
   mov ecx,msg2
   call printString 
   
   mov eax,1            
   int 0x80        
 
printString:
   mov ebx,1          
   mov eax,4           
   int 0x80       
   xor eax,eax
   ret
 

请有人能解释一下为什么会这样吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)