#2
batsom2021-09-20 19:00
|
section .data
massage: dw "1+2+...+100="
Len: equ $ - massage
valueToPrint: db 0
;section .bss
;valueToPrint: resb 4
section .text
global main
main:
mov ebp, esp; for correct debugging
mov eax,0
mov ebx,0
mov ecx,100
s:
add ebx,1
add eax,ebx
loop s
;push eax
;sub eax,5H
;add eax,48H
mov [valueToPrint],eax
mov eax,4 ; 4号调用 sys_write的系统调用
mov ebx,1 ; ebx送1表示输出,参数1,文件描述符,stdout是1
mov ecx,massage ; 字符串的首地址送入ecx
mov edx,Len ; 字符串的长度送入edx
int 80h ; 输出字串
mov eax,4
mov ebx,1
mov ecx,valueToPrint
mov edx,4
int 0x80
mov ebx,0
mov eax,1
int 0x80