byte rotating in Visual in-line assembler 
Author Message
 byte rotating in Visual in-line assembler

This is my frist time with i386 assembly (I've done a fair bit of
MC68k) and I need to write a rotate assembly routine for a cycle-hungry
Visual C++ routine. To further complicate my problem, I need to rotate
a byte, and it seems that I've had more success when rotating a long
word. I remember instructions in MC68k being triplicated such that
almost every instruction had a byte, word and long word version, but
I've seen no indication of that in i386.
     It would greatly streamline the progress of my program if I could
pull this off, since the rotate routine I use takes several
instructions: calculating the shift (using the modulo of 8),
duplicating the byte, shifting the high part to the low, and the low
part to the high, filtering out the extra 1s in the part that shifted
less than 4-bits, then splicing them together with |.
    Thanks for your help.

Sent via Deja.com http://www.*-*-*.com/
Share what you know. Learn what you don't.



Tue, 19 Feb 2002 03:00:00 GMT  
 byte rotating in Visual in-line assembler
I've never used inline assembler, but the ROL and ROR (rotate left and
right respectively) instructions both work with byte-sized operands.

Hope this helps,
Martin.

Quote:

> This is my frist time with i386 assembly (I've done a fair bit of
> MC68k) and I need to write a rotate assembly routine for a cycle-hungry
> Visual C++ routine. To further complicate my problem, I need to rotate
> a byte, and it seems that I've had more success when rotating a long
> word. I remember instructions in MC68k being triplicated such that
> almost every instruction had a byte, word and long word version, but
> I've seen no indication of that in i386.



Fri, 22 Feb 2002 03:00:00 GMT  
 byte rotating in Visual in-line assembler
There're rol and ror instructions.

    mov cl,rotateBits
    rol al,cl ;byte
    rol ax,cl ;word
    rol eax,cl ;dword

    rol al,3
    rol si,5
    rol ecx,16

You get the idea.

Quote:

> This is my frist time with i386 assembly (I've done a fair bit of
> MC68k) and I need to write a rotate assembly routine for a cycle-hungry
> Visual C++ routine. To further complicate my problem, I need to rotate
> a byte, and it seems that I've had more success when rotating a long
> word. I remember instructions in MC68k being triplicated such that
> almost every instruction had a byte, word and long word version, but
> I've seen no indication of that in i386.
>      It would greatly streamline the progress of my program if I could
> pull this off, since the rotate routine I use takes several
> instructions: calculating the shift (using the modulo of 8),
> duplicating the byte, shifting the high part to the low, and the low
> part to the high, filtering out the extra 1s in the part that shifted
> less than 4-bits, then splicing them together with |.
>     Thanks for your help.



Sat, 23 Feb 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. file IO in visual c++ 6 inline assembler

2. Visual C++ Inline Assembler

3. Borland inline assembler deletes lines of code?

4. rotate-byte

5. Public domain assemblers/in-line assemblers

6. Rotating an image and summing up along line of sight

7. Inline assembler in Topspeed C++

8. Inline Assembler on DOS

9. Modula2 and inline Assembler

10. Using inline assembler in Turbo C

11. Using Turbo C and Inline assembler

12. How does one in C++ and inline assembler ...

 

 
Powered by phpBB® Forum Software