• ### What is your GameDev Story?

#### Archived

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

# helpme for a little little question(asm)

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

## 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 on other sites
my god,who else can help me?
thanks!!!

The will,the way.

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

##### Share on other sites
Do a rotate and shift operation?

"There is no dark side of the moon." - Pink Floyd

##### 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 on other sites
how dissapointed

The will,the way.

##### Share on other sites
mov	ecx,eax		;store current value of eaxand	eax,0FFh	;and eax by 0x000000FFimul	eax,eax,802h	;multiply eax by 0x00000802and	eax,2110h	;and eax by 0x00002110and	ecx,0FFh	;and ecx by 0x000000FFimul	ecx,ecx,8020h	;multiply ecx by 0x00008020and	ecx,88440h	;and ecx by 0x00088440or	eax,ecx		;or eax by ecximul	eax,eax,10101h	;multiply eax by 0x00010101shr	eax,10h		;shift eax right 16 bits

the result will be stored in al.

Bungo!

##### Share on other sites
thank you,what a good idea!!!

The will,the way.

##### 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.

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

(You must login to your GameDev.net account.)

• 17
• 14
• 10
• 9
• 11
• ### Forum Statistics

• Total Topics
634094
• Total Posts
3015498
×