-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPrint.asm
More file actions
59 lines (45 loc) · 1.39 KB
/
Print.asm
File metadata and controls
59 lines (45 loc) · 1.39 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
.386
.model flat, stdcall
.stack 4096
ExitProcess proto :dword
WriteConsoleA proto :dword, :dword, :dword, :dword, :dword
; console output handle --> GetStdHandle --> Parameter(-11)
; -11 handle chap kardan hast
; -11 for output console OR -10 for input console
GetStdHandle proto :dword
; address
; length
; count character: baraye inke tamam character ha chap she
; Adad 0 ro midim
; In ham akharin parameter default male WriteConsoleA hast ke (0) hast
.data
message db "Hello World!" ; 12 length dare
; db chiye? mokhafaf Define Byte
; Miyad baraye message ke 12length hast
; har 1length --> 1byte chon char --> 8bit OR 1Byte hast
; In 12 character hast pas in
; Define Byte (db) miyad 12 Byte baraye in Hello World!
; Dar nazar migire
msgLen = ($ - offset message) ; baraye be dast ovardan length message hast
; (offset) kalameye offset baraye be dast ovardan address hast
; mesal dar C ,C++ ba &Variable be dast miovardim
; ($) akharin khone address kam mikonim az
; Akharin khone address (offset message)
.code
main PROC
;mov eax, 5 ; In testi bod
;push 0
;call ExitProcess
invoke GetStdHandle, -11
; Method 1:
;push 0
;push 0
;push msgLen
;push offset message
;push eax
;call WriteConsoleA
; Method 2: in ravesh awlie
invoke WriteConsoleA, eax, offset message, msgLen, 0, 0
invoke ExitProcess, 0
main ENDP
END main