• Earn real money by being active: Hello Guest, earn real money by simply being active on the forum — post quality content, get reactions, and help the community. Once you reach the minimum credit amount, you’ll be able to withdraw your balance directly. Learn how it works.

ASM Memset example(MASM32)

Status
Not open for further replies.

top10

Moderator
User
Joined
Mar 18, 2015
Messages
487
Reputation
0
Reaction score
5,047
Points
243
Credits
0
‎10 Years of Service‎
70%
[HIDE-THANKS]

Code:
>.386
.model flat, stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\user32.inc
includelib \masm32\lib\user32.lib
.data
M db "this will be filled with xs",0
.code

memset proc source:dword, dest:dword, ln:dword
pushad
mov edi,dest
mov ecx,ln
mov	eax, source
cld
rep stosb
popad
ret
memset endp

start:
invoke MessageBox, NULL,addr M, addr M, MB_OK
invoke memset,"x", offset M, sizeof M - 1     ;fill procedure
invoke MessageBox, NULL,addr M, addr M, MB_OK
ret
END start
[/HIDE-THANKS]

 
Status
Not open for further replies.
Back
Top