InlineASM Red() replacement needed ;)

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by MrVainSCL.

Hi @ all
Can someone post a working inline asm code (procedure i.e) that return the value of a 24 bit RGB colour (between 0 and 255)..? The orginal command is called Red() for example and stored in MiscLib but i dont have the space to use this lib at the moment... And its not important if the result is R,G,B ... in all three vals is everytime the same val :wink:)

Many thanks to all who try to help me in my actual game project that will be released in this days (if all works fine)...

PIII450, 256MB Ram, 6GB HD, RivaTNT, DirectX8.1, SB AWE64, Win98SE + Updates...

greetz
MrVainSCL! aka Thorsten
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by fred.

No need for inline asm here:

Red = Colour & $FF

And you got it :)

For Green:

Green = (Colour >> 8) & $FF

For Blue:

Green = Blue >> 16

Fred - AlphaSND
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Franco.
No need for inline asm here:

Red = Colour & $FF

And you got it :)

For Green:

Green = (Colour >> 8) & $FF

For Blue:

Green = Blue >> 16

Fred - AlphaSND

Suppose the last line must be:

Blue = Green >> 16

BTW: Can't find a the 'Colour' command in the docs, is it new?


Have a nice day...
Franco

Sometimes you have to go a lonely way to accomplish genius things.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Danilo.

Colour is your Color

(registered PureBasic user)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by El_Choni.

Shouldn't it be:

Code: Select all

Blue = Colour >> 16
?

Bye,

El_Choni
Post Reply