News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Using MASM to create a .dll

Started by JoueurDébutant, February 15, 2012, 03:25:17 PM

Previous topic - Next topic

JoueurDébutant

Hi everyone !

First of all, please excuse my English, I'm foreigner...

I'm just beginning with MASM. I aim to write a .dll file which contains only one procedure. This procedure should interchange the contents of two Bytes, which will be arguments of the procedure. I wrote this code :
.386
.model flat, stdcall
option casemap: none

.code

start:

echange PROC p1: PTR, p2: PTR

mov eax, p1
mov ebx, p2
mov p1, ebx
mov p2, eax

ret

echange endp

end start


Could you please tell me whether this code is good ?

Thank you very much ! :U

qWord

Your procedure only change the arguments p1 and p2, which will be discarded when the procedure returns.
echange PROC uses ebx p1: PTR BYTE, p2: PTR BYTE

mov eax, p1
mov ebx, p2
mov dl,BYTE ptr [eax]
mov dh,BYTE ptr [ebx]
mov BYTE ptr [ebx],dl
mov BYTE ptr [eax],dh

ret

echange endp
FPU in a trice: SmplMath
It's that simple!

dedndave

welcome to the forum   :U
i think we just had this discussion   :P

the forum search tool can answer some questions for you
http://www.masm32.com/board/index.php?topic=18309.0

JoueurDébutant

@qWord: Thank you for your answer !

@dadndave : ok, next time I first search in the forum.

Bye !