Hi,

I need to switch the blue and red values with eachother in a RGB-value in the eax...

I thought-up this code...

rcl ax,8
rcl eax,16
rcl ax,8
ror eax,8

but it devides the green and blue values in two :(

What am I doing wrong???


T.I.A.,

Locu
Posted on 2001-12-27 10:51:20 by Locu
Did you specify if your 16 is decimal or hexadecimal? Maybe that could be the problem.
Posted on 2001-12-27 11:12:14 by CodeLover
All of the numbers are decimal...


Grtz...

Locu
Posted on 2001-12-27 11:31:56 by Locu
In what format are the RGB values exactly? How do you initialize eax? Remember that when you read from a memory location, it's bytes are swapped because of the little endian format.

Thomas
Posted on 2001-12-27 11:36:25 by Thomas
This is not optimal - meerly an example of a possible method:
   mov eax,01[COLOR=blue]23[/COLOR][COLOR=limegreen]45[/COLOR][COLOR=red]67[/COLOR]h

bswap eax ; eax = [COLOR=red]67[/COLOR][COLOR=limegreen]45[/COLOR][COLOR=blue]23[/COLOR]01h
ror eax,8 ; eax = 01[COLOR=red]67[/COLOR][COLOR=limegreen]45[/COLOR][COLOR=blue]23[/COLOR]h
Posted on 2001-12-27 12:24:09 by bitRAKE
I figured out what I did wrong... I used "rcl" instead of "rol"...


bitRAKE: Thank you for the code... it's allot shorter :)



Grtz...


Locu
Posted on 2001-12-27 13:04:51 by Locu