• Advertisement
Sign in to follow this  

Asm + MMX please help

This topic is 4909 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello Could someone help me with this: I have an array of bytes (AlphaMask 0-255 range) so what I am trying to do is load 4 alpha values (4 bytes) in a MMX register so I can do the blend using existing code (from gamedev alpha blend articles), the trouble is I cant get the alpha values in the format that I need it Example: BYTE *lpbAlphaMask[8] = {0x00, 0xFF, 0x00, 0xFF, 0x00, 0x80, 0x00, 0x80 }; mov edx, lpbAlphaMask ;load alpha mask in edx . . . movq mm1, [edx] ; copy to mm1 the alpha values (mm1=0x80008000ff00ff00) The trouble here is that I need mm1 using only the first 4 alpha values (4 pixels at time in 16-bit mode) in the following format: mm1 = 0x00ff000000ff0000 So to recap, I need to do exactly what _mm_set_pi16 intrinsic do but in full asm code. Thanks in advance Oscar

Share this post


Link to post
Share on other sites
Advertisement
Try this - write out your code in C/C++ using the instrinsics, then just do a StepInto, go to your intrinsic code, and do a Go To Disassembly. You can now view the assembly, cut and paste?.

Your specific example looks more like an _mm_unpackhi_pi16, but not quite.

joe
image space

Share this post


Link to post
Share on other sites
Hi, thx for your relpy I got it working using punpcklbw and psrlw

punpcklbw mm1, [edx]
psrlw mm1, 8

where edx hold the alpha mask values

Regards,
Oscar

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement