NASM Forum > Programming with NASM

why is my code not working?

(1/1)

xellos:
it compiles without errors


--- Code: ---import SetCursorPos user32.dll
extern SetCursorPos

import ExitProcess kernel32.dll
extern ExitProcess

segment .data use32
x dd 10
y dd 10

segment .bbs use32

segment .code use32

..start:
push 0
push x
push y
call [SetCursorPos]

push dword 0x00
call [ExitProcess]
ret

--- End code ---

Keith Kanios:
Off-hand you are not using SetCursorPos correctly. It expects only two arguments, both integer values.

Frank Kotler:
In case you don't get what Keith is telling you about "values"...


--- Code: ---push x
push y

--- End code ---

pushes the addresses (offsets) of the two variables. To get the "values", you'd:


--- Code: ---push dword [x]
push dword [y]

--- End code ---

(I'll take a guess that you're supposed to push "[y]" first, too - you can figure it out when you make 'em different)

Best,
Frank

xellos:
thank you it works

Navigation

[0] Message Index

Go to full version