flat assembler
Message board for the users of flat assembler.

Index > Windows > would someone be so kind?

Author
Thread Post new topic Reply to topic
RedGhost



Joined: 18 May 2005
Posts: 443
Location: BC, Canada
RedGhost
as to convert this for me? Smile

Code:
//WINGDI.H

#define GetRValue(rgb)      ((BYTE)(rgb))
#define GetGValue(rgb)      ((BYTE)(((WORD)(rgb)) >> 8))
#define GetBValue(rgb)      ((BYTE)((rgb)>>16))
    


thanks in advance !
Post 21 May 2005, 16:08
View user's profile Send private message AIM Address MSN Messenger Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
there isn't anything line inline macro in FASM.
But generally:
eax = GetRValue(eax); -> and eax,0FFh
eax = GetGValue(eax); -> shr eax,8; and eax,0FFh
eax = GetBValue(eax); -> shr eax,16; and eax,0FFh
eax = GetRValue([variable]); -> movzx eax,byte [variable]
eax = GetGValue([variable]); -> movzx eax,byte [variable+1]
eax = GetBValue([variable]); -> movzx eax,byte [variable+2]
Post 21 May 2005, 17:30
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
bogdanontanu



Joined: 07 Jan 2004
Posts: 403
Location: Sol. Earth. Europe. Romania. Bucuresti
bogdanontanu
However in TASM it would look like this:

GetRValue MACRO aRGB
mov eax,aRGB
and eax,0ffh
ENDM

GetGValue MACRO aRGB
mov eax,aRGB
shr eax,8
and eax,0ffh
ENDM

GetBValue MACRO aRGB
mov eax,aRGB
shr eax,16
and eax,0ffh
ENDM


And if you do not need the return in EAX you could do the operations directly on aRGB argument.
Post 21 May 2005, 18:00
View user's profile Send private message Visit poster's website Reply with quote
Nikolay Petrov



Joined: 22 Apr 2004
Posts: 101
Location: Bulgaria
Nikolay Petrov
"<<" -> shl
">>" -> shr
char -> byte
short -> word
....

basic C programing

Prevision post take it details
Post 22 May 2005, 17:24
View user's profile Send private message Reply with quote
RedGhost



Joined: 18 May 2005
Posts: 443
Location: BC, Canada
RedGhost
Nickolay wrote:
"<<" -> shl
">>" -> shr
char -> byte
short -> word
....

basic C programing

Prevision post take it details

just had never used >> or << in c, thanks guys!
Post 23 May 2005, 16:52
View user's profile Send private message AIM Address MSN Messenger Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.