-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathiolib.asm
63 lines (56 loc) · 995 Bytes
/
iolib.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
.686
option casemap :none
include \masm32\include\masm32rt.inc
ltoa PROTO :DWORD, :DWORD
StrLen PROTO :DWORD
atol PROTO :DWORD
strcpy PROTO c :dword, :dword
.data
iolib_buffer db 1024 dup (?)
.code
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
_outstr proc
invoke CharToOem, edx, addr iolib_buffer
print addr iolib_buffer
ret
_outstr endp
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
_outint proc
push ecx
invoke ltoa, eax, ADDR iolib_buffer
invoke StrLen, addr iolib_buffer
pop ecx
.if ecx > eax
sub ecx, eax
.while ecx > 0
push ecx
print " "
pop ecx
dec ecx
.endw
.endif
print addr iolib_buffer
ret
_outint endp
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
_inint proc
push ecx
push edx
invoke atol, input()
pop edx
pop ecx
ret
_inint endp
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
_inch proc
push ecx
push edx
push eax
invoke strcpy, addr iolib_buffer, input()
pop eax
mov al, iolib_buffer[0]
pop edx
pop ecx
ret
_inch endp
end