Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

qass

helpme for a little little question(asm)

This topic is 5155 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

who can help me to do this thing: a byte in register AX,how can you do change bits each other as below: bit0---bit7 bit1---bit6 bit2---bit5 bit3---bit4 can you write an assembler to get the result? TIA! The will,the way.

Share this post


Link to post
Share on other sites
Advertisement
This sounds very much like a homework question. What have tried so far to complete the problem?

Share this post


Link to post
Share on other sites
thank both,in fact,i wanna find an optimize method,i try to use
ROR & ROL,but it used too bad and so boring.
thank you anyway.

The will,the way.

Share this post


Link to post
Share on other sites

mov ecx,eax ;store current value of eax
and eax,0FFh ;and eax by 0x000000FF
imul eax,eax,802h ;multiply eax by 0x00000802
and eax,2110h ;and eax by 0x00002110
and ecx,0FFh ;and ecx by 0x000000FF
imul ecx,ecx,8020h ;multiply ecx by 0x00008020
and ecx,88440h ;and ecx by 0x00088440
or eax,ecx ;or eax by ecx
imul eax,eax,10101h ;multiply eax by 0x00010101
shr eax,10h ;shift eax right 16 bits


the result will be stored in al.

Bungo!

Share this post


Link to post
Share on other sites
imul ecx,ecx,8020h------i seldom see some like this sentence.
how to compile it?
and in some tutorial,the IMUL is used as:
IMUL ops

waitting for some answers,thanks

The will,the way.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!