Assembly -Summe von 2 Zahlen, die aus Stdin gelesen wurden
Posted: 28 Mar 2025, 11:31
Code: Select all
section .data
msg db 'Introduceti primul numar: '
lenMsg equ $ -msg
newline db 10
MSG db 'Introduceti al doilea numar: '
LENMSG equ $ -MSG
result db 'Suma este: '
lenResult equ $ -result
section .bss
num1 resb 1
num2 resb 1
sum resb 1
section .text
global _start
_start:
; Afisare mesaj 1
mov eax, 4
mov ebx, 1
mov ecx, msg
mov edx, lenMsg
int 0x80
; Citire numar 1
mov eax, 3
mov ebx, 0
mov ecx, num1
mov edx, 1
int 0x80
; Afisare mesaj 2
mov eax, 4
mov ebx, 1
mov ecx, MSG
mov edx, LENMSG
int 0x80
; Citire numar 2
mov eax, 3
mov ebx, 0
mov ecx, num2
mov edx, 1
int 0x80
; Afisare ultim mesaj
mov eax, 4
mov ebx, 1
mov ecx, result
mov edx, lenResult
int 0x80
;afisare suma
mov eax, 4
mov ebx, 1
mov ecx, sum
mov edx, 1
int 0x80
; Afisare newline
mov eax, 4
mov ebx, 1
mov ecx, newline
mov edx, 1
int 0x80
; Iesire din program
mov eax, 1
xor ebx, ebx
int 0x80