



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




includelib kernel32.lib extern GetStdHandle : proc extern WriteConsoleA : proc extern ExitProcess : proc
.data character db 'A ' handle dq? written dq?
.code main proc sub rsp , 28 h mov rcx , - call GetStdHandle mov handle , rax mov rcx , handle lea rdx , character mov r8 , 1 lea r9 , written mov qword ptr [ rsp +32] , 0 call WriteConsoleA xor rcx , rcx call ExitProcess main endp end
includelib kernel32.lib extern GetStdHandle : proc extern WriteConsoleA : proc extern ExitProcess : proc
.data msg db ' Hello , World ' , 0
handle dq? written dq?
.code main proc sub rsp , 28 h mov rcx , - call GetStdHandle mov handle , rax mov rcx , handle lea rdx , msg mov r8 , lengthof msg lea r9 , written mov qword ptr [ rsp +32] , 0 call WriteConsoleA xor rcx , rcx call ExitProcess main endp end
includelib kernel32.lib extern GetStdHandle : proc extern WriteConsoleA : proc extern ExitProcess : proc
.data msg1 db ' Muhammad Nadeem ' , 13 , 10 msg1Len equ $ - msg msg2 db ' Government Associate College Sinawan ' , 13 , msg2Len equ $ - msg handle dq? written dq?
.code main proc sub rsp , 28 h mov rcx , -
sub rsp , 28 h call GetStdHandle mov handle , rax
mov al , digit add al , ' 0 ' ; convert to ASCII ( ' 5 ') mov digit , al
mov rcx , handle lea rdx , digit mov r8 , 1 lea r9 , written call WriteConsoleA
xor rcx , rcx ; exit code = 0 call ExitProcess
main endp end
includelib kernel32.lib
extern GetStdHandle : proc extern ReadConsoleA : proc extern WriteConsoleA : proc extern ExitProcess : proc
.data buffer db 100 dup (0) bytesRead dd? bytesWritten dd? hIn dq? ; Input handle hOut dq? ; Output handle
.code main proc sub rsp , 28 h
mov rcx , - call GetStdHandle mov hIn , rax
mov rcx , - call GetStdHandle mov hOut , rax
; Read input from the user mov rcx , hIn lea rdx , buffer mov r8d , 100 lea r9 , bytesRead mov qword ptr [ rsp +20 h ] , 0 call ReadConsoleA
; Print user input mov rcx , hOut lea rdx , buffer mov eax , bytesRead mov r8d , eax lea r9 , bytesWritten mov qword ptr [ rsp +20 h ] , 0 call WriteConsoleA
xor rcx , rcx call ExitProcess main endp end
includelib kernel32.lib
extern GetStdHandle : proc extern ReadConsoleA : proc extern WriteConsoleA : proc extern GetConsoleMode : proc extern SetConsoleMode : proc extern ExitProcess : proc
lea rdx , buffer mov r8d , 100 lea r9 , bytesRead mov qword ptr [ rsp +20 h ] , 0 call ReadConsoleA
; Reset console mode to echo mov rcx , hIn mov edx , oldMode call SetConsoleMode
; Print user input mov rcx , hOut lea rdx , buffer mov eax , bytesRead mov r8d , eax lea r9 , bytesWritten mov qword ptr [ rsp +20 h ] , 0 call WriteConsoleA
xor rcx , rcx call ExitProcess main endp end