flat assembler
Message board for the users of flat assembler.

 Index > Main > Can someone please explain RCR reg,reg to me please ?
Author
shism2

Joined: 14 Sep 2005
Posts: 248
shism2 08 Aug 2007, 16:45
08 Aug 2007, 16:45
LocoDelAssembly

Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 08 Aug 2007, 17:19
What it does or how to use?

If you what to use a register as src it only can be CL.
08 Aug 2007, 17:19
DJ Mauretto

Joined: 14 Mar 2007
Posts: 464
Location: Rome,Italy
DJ Mauretto 08 Aug 2007, 19:13
08 Aug 2007, 19:13
shism2

Joined: 14 Sep 2005
Posts: 248
shism2 09 Aug 2007, 01:42
I don't understand that picture lol...... I want to know what the opcode does. Please explain in words lol
09 Aug 2007, 01:42
ChrisLeslie

Joined: 04 Jun 2006
Posts: 50
Location: Australia
ChrisLeslie 09 Aug 2007, 03:42
Rotate Right through Carry.
For example, when the instruction RCR al,1 is executed the low order bit (bit0) of al is copied to the carry flag. The carry flag is copied to the high order bit (bit7) of al. Bit 7 copies to bit 6 etc. So all the 8 register bits plus the carry bit play musical chairs and shift one bit (or chair) in a circle.

If the instruction is RCR al,cl, for example, the number of times the shift takes place for the one instruction is the value that is in the cl register. For example, if you preceed the rcr al,cl instruction with mov cl,2, then two shifts will take place.

Chris
09 Aug 2007, 03:42
shism2

Joined: 14 Sep 2005
Posts: 248
shism2 09 Aug 2007, 13:54
Do you mean the high order bit ( bit 7 ) by eax ?
eax can hold 8 bits .... in the way you explain it from 0-7

I still dont understand what happens here :

mov al, 36h
rcr al,2h

al is equal to "Dh" after the execution . How is the low order bit --- 6h in this case copied into the carry flag ? The carry flag can't become 6 ....
09 Aug 2007, 13:54
shism2

Joined: 14 Sep 2005
Posts: 248
shism2 09 Aug 2007, 19:26
However, al can only hold a byte
So for example

mov al,36h

which al in bits is 110110

There are only 6 binary numbers there.... and the carry flag would count as the 7th. Why do you say 8 then ? Is there something I'm missing ?
09 Aug 2007, 19:26
DOS386

Joined: 08 Dec 2006
Posts: 1898
DOS386 09 Aug 2007, 19:54
> Is there something I'm missing ?

YES. After 2 years and 233 posts

> So for example
> mov al,36h
> which al in bits is 110110

00110110

> There are only 6 binary numbers there

NO. always 8

> the carry flag would count as the 7th.

NO.

> Why do you say 8 then ?

Always 8.

Code:
```; Before  : 00110110 C ; \$36
; After 1 : C0011011 0 ; \$1B
; After 2 : 0C001101 1 ; \$0D
```

BTW, C must have been zero before your RCR

_________________
Bug Nr.: 12345

Title: Hello World program compiles to 100 KB !!!

Status: Closed: NOT a Bug
09 Aug 2007, 19:54
shism2

Joined: 14 Sep 2005
Posts: 248
shism2 09 Aug 2007, 20:12
Lol I know I don't have all the basics down..
09 Aug 2007, 20:12
ChrisLeslie

Joined: 04 Jun 2006
Posts: 50
Location: Australia
ChrisLeslie 09 Aug 2007, 22:51
> Do you mean the high order bit ( bit 7 ) by eax ?
> eax can hold 8 bits .... in the way you explain it from 0-7

The example was using an 8 bit register. If using 16 bit register then high order bit will be 15, and 31 if using a 32 bit register.

> al is equal to "Dh" after the execution . How is the low order bit --- 6h in > this case copied into the carry flag ? The carry flag can't become 6 ....

The low order bit is 1h. You are confusing a hex nibble with a bit. Only one bit is copied to the carry flag, not the four bits of a hex symbol.

Quote:
mov al,36h

which al in bits is 110110

There are only 6 binary numbers there.... and the carry flag would count as the 7th. Why do you say 8 then ? Is there something I'm missing ?

mov al,36h gives 00110110 in binary. You left off the top two bits. So there are 8 bits and the carry flag could count as the ninth bit during the rotate.
09 Aug 2007, 22:51
shism2

Joined: 14 Sep 2005
Posts: 248
shism2 11 Aug 2007, 00:06
Well thank you everyone. I understand now
11 Aug 2007, 00:06
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

 Jump to: Select a forum Official----------------AssemblyPeripheria General----------------MainTutorials and ExamplesDOSWindowsLinuxUnixMenuetOS Specific----------------MacroinstructionsOS ConstructionIDE DevelopmentProjects and IdeasNon-x86 architecturesHigh Level LanguagesProgramming Language DesignCompiler Internals Other----------------FeedbackHeapTest Area

Forum Rules:
 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot vote in polls in this forumYou cannot attach files in this forumYou can download files in this forum