Assembly -Summe von 2 Zahlen, die aus Stdin gelesen wurdenLinux

Linux verstehen
Anonymous
 Assembly -Summe von 2 Zahlen, die aus Stdin gelesen wurden

Post by Anonymous »

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
Wie kann ich die 2 Zahlen hinzufügen, jede Methode, die ich mit Movzx usw. ausprobiert habe, hat nicht funktioniert, ich habe nichts für Sum>

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post