-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmacros.asm
More file actions
78 lines (60 loc) · 974 Bytes
/
macros.asm
File metadata and controls
78 lines (60 loc) · 974 Bytes
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
75
76
77
78
%macro pushReg 0
push eax
push ebx
push ecx
push edx
%endmacro
%macro popReg 0
pop edx
pop ecx
pop ebx
pop eax
%endmacro
%macro print 2
pushReg
mov eax, 4
mov ebx, 1
mov ecx, %1
mov edx, %2
int 0x80
popReg
%endmacro
%macro exit 1
mov eax, 1
mov ebx, %1
int 0x80
%endmacro
%macro scan 2
pushReg
mov eax, 3
mov ebx, 0
mov ecx, %1
mov edx, %2
int 0x80
popReg
%endmacro
%macro int_to_ascii 3
pushReg
push esi
push edi
mov eax, %1
mov edi, %2 + 15
mov byte [edi], 0
%xdefine iterator_label iterate%3
iterator_label:
xor edx, edx
mov ebx, 10
div ebx
add dl, '0'
dec edi
mov byte [edi], dl
test eax, eax
jnz iterator_label
mov esi, %2 + 15
sub esi, edi
mov edx, esi
print edi, edx
pop edi
pop esi
popReg
%endmacro