The MASM Forum

General => The Campus => Topic started by: xandaz on November 26, 2021, 04:46:16 AM

Title: Turning a positive register into a negative one.
Post by: xandaz on November 26, 2021, 04:46:16 AM
    Hey. I'm trying to move the File Pointer back to it's beggining but am having a hard time. Shouldn't NEG eax do the trick? Could SetFilePointer,hFile,0,0,FILE_BEGIN do the trick? Thanks for helping me out in advance.
Title: Re: Turning a positive register into a negative one.
Post by: jj2007 on November 26, 2021, 07:58:25 AM
Which value is in eax?
What does the manual say about SetFilePointer?
Title: Re: Turning a positive register into a negative one.
Post by: xandaz on November 26, 2021, 08:15:57 AM
    Hi JJ. EAX has a variable positive number. Also i got over SetFilePointer. Thanks
Title: Re: Turning a positive register into a negative one.
Post by: hutch-- on November 26, 2021, 10:16:10 AM
Using EAX will probably garrantee that it gets overwritten. Get used to using memory variables where you use EAX as transfer, NEG it then load it into a 32 bit variable.
Title: Re: Turning a positive register into a negative one.
Post by: daydreamer on November 26, 2021, 10:35:49 PM
Quote from: hutch-- on November 26, 2021, 10:16:10 AM
Using EAX will probably garrantee that it gets overwritten. Get used to using memory variables where you use EAX as transfer, NEG it then load it into a 32 bit variable.
I prefer the rv macro
Mov variable, rv(apicall,a,b,c)
Some api calls,like SetTextColor and SetBkColor works great with push return value= old RGB color and pop later to restore colors
Title: Re: Turning a positive register into a negative one.
Post by: hutch-- on November 27, 2021, 12:20:35 AM
That is not a distinction magnus, the rv macro simply feeds the return value (eax) into a variable. Its done as a notation convenience.
Title: Re: Turning a positive register into a negative one.
Post by: xandaz on November 27, 2021, 01:00:01 AM
   Thanks guys. You've benn helpful. ty