-
Notifications
You must be signed in to change notification settings - Fork 0
/
add.asm
54 lines (42 loc) · 833 Bytes
/
add.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
EXIT equ 1
STDIN equ 0
STDOUT equ 1
READ equ 3
WRITE equ 4
section .data
enterNumberText db 'coloque um número: '
enterNumberTextSize equ $ - enterNumberText
totalText db 'Numero + 2: '
totalTextSize equ $ - totalText
section .bss
num resb 2
result resb 2
section .text
global _start
_start:
mov eax, WRITE
mov ebx, STDOUT
mov ecx, enterNumberText
mov edx, enterNumberTextSize
int 0x80
mov eax, READ
mov ebx, STDIN
mov ecx, num
mov edx, 2
int 0x80
mov ebx, [num]
add ebx, 2
add byte [result], '0'
mov [result], ebx
mov eax, WRITE
mov ebx, STDOUT
mov ecx, totalText
mov edx, totalTextSize
int 0x80
mov eax, WRITE
mov ebx, STDOUT
mov ecx, result
mov edx, 2
int 0x80
mov eax, EXIT
int 0x80