-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathitoa.asm
More file actions
115 lines (90 loc) · 1.6 KB
/
itoa.asm
File metadata and controls
115 lines (90 loc) · 1.6 KB
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
.386
.model flat, stdcall
option casemap:none
include E:\masm32\include\windows.inc
include E:\masm32\include\user32.inc
include E:\masm32\include\kernel32.inc
include E:\masm32\include\masm32.inc
; *************************************************************************
; MASM32 object libraries
; *************************************************************************
includelib E:\masm32\lib\user32.lib
includelib E:\masm32\lib\kernel32.lib
includelib E:\masm32\lib\msvcrt.lib
includelib E:\masm32\lib\masm32.lib
.data
newline db 0ah, 0
num1 dword 48DAF76Eh
num2 dword 79DA325Ch
num3 dword 570DC63Ah
num4 dword 19BCF455h
string db 50 dup (?)
.code
start proc
mov eax, dword ptr [num1]
push eax
call itoa
add esp, 04h
push eax
call StdOut
push offset newline
call StdOut
mov eax, dword ptr [num2]
push eax
call itoa
add esp, 04h
push eax
call StdOut
push offset newline
call StdOut
mov eax, dword ptr [num3]
push eax
call itoa
add esp, 04h
push eax
call StdOut
push offset newline
call StdOut
mov eax, dword ptr [num4]
push eax
call itoa
add esp, 04h
push eax
call StdOut
push offset newline
call StdOut
;;Exit
Exit:
push 0
call ExitProcess
itoa proc
push ebp
mov ebp, esp
xor eax, eax
mov eax, [ebp + 08h]
mov ecx, offset string
push 69h
mov ebx, 10
loop_itoa:
xor edx, edx
div ebx
add dl, 30h
xor dh, dh
push edx
cmp eax, 0
jnz loop_itoa
done_itoa:
xor ebx, ebx
pop ebx
cmp ebx, 69h
jz OutHere
mov byte ptr [ecx], bl
inc ecx
jmp done_itoa
OutHere:
mov eax, offset string
pop ebp
ret
itoa endp
start endp
End start