-
Notifications
You must be signed in to change notification settings - Fork 3
/
LOCAL.asm
63 lines (48 loc) · 792 Bytes
/
LOCAL.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
55
56
57
58
59
60
61
62
63
section .text
global _start
printstr:
pop edi
pop edx
pop ecx
mov ebx, 1
mov eax, 4
int 0x80
mov edx, 1
mov ecx, NEWLINE
mov ebx, 1
mov eax, 4
int 0x80
push edi
ret
_start:
mov eax, [x]
sub eax, '0'
mov ebx, [y]
sub ebx, '0'
add eax, ebx
add eax, '0'
mov [sum], eax
mov DWORD [esp], msg
%define SUPER_VAR esp
mov eax, [SUPER_VAR]
push eax
; mov eax, msg
; push eax
mov eax, len
push eax
call printstr
mov ecx, sum
mov edx, 1
mov ebx, 1
mov eax, 4
int 0x80
mov eax, 1
int 0x80
section .data
x db '5'
y db '3'
msg db "sum of x and y is "
len equ $ - msg
NEWLINE db 10
segment .bss
sum resb 1