News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

what are the uses of rol and ror instructions?

Started by jack, September 05, 2022, 01:00:11 PM

Previous topic - Next topic

BugCatcher

In the dos days I used them to scroll sprites across the screen.

InfiniteLoop

Reversing the bits in a qword or dword.

I found the example on the old masm32 archives.
Start by using byteswap...

hutch--

Simple example. (its in PowerBASIC)

    ! mov ax, 6         ' right side
    ! rol eax, 16
    ! mov ax, 10        ' left side
    ! mov var, eax

    SendMessage hEdit,%EM_SETMARGINS,%EC_LEFTMARGIN or %EC_RIGHTMARGIN,var

LiaoMi

Quote from: jack on September 05, 2022, 01:00:11 PM
I know what the instructions do, just can't see a practical use, any examples where these instruction are useful?
note, just rol and ror and not the carry variants

Hi Jack,

Solomon W. Golomb - Shift Register Sequences. Secure and Limited-Access Code Generators, Efficiency Code Generators, Prescribed Property Generators, Mathematical Models 3rd ed.-World Scientific (2017)

Computing the Parity of a Word
Counting Leading 0's
Generalized Bit Reversal
Counting 1-Bits
Reversing bits