-
Notifications
You must be signed in to change notification settings - Fork 3
/
stdio.asm
74 lines (61 loc) · 780 Bytes
/
stdio.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
64
65
66
67
68
69
70
71
72
73
74
section .bss
v: resb 4
a: resb 4
b: resb 4
section .text
println:
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
print:
pop edi
pop edx
pop ecx
mov ebx, 1
mov eax, 4
int 0x80
mov eax, 0
push edi
ret
main2:
mov eax,4
mov eax, RPP_CONSTANT_0
push eax
mov eax, 12
push eax
call println
mov eax, 0
mov [v], eax
mov eax, RPP_CONSTANT_1
mov [v], eax
mov eax, [v]
push eax
mov eax, 2
push eax
call println
lea eax, v
mov [a], eax
mov eax, [a]
mov edx, [eax]
mov [b], edx
mov eax, [b]
push eax
mov eax, 2
push eax
call println
mov eax, 0
ret
section .data
NEWLINE db 10
RPP_CONSTANT_0 db "Hello World!", 0
RPP_CONSTANT_1 db "hi", 0