21.08.2013 Views

AVR Instruction Set Nomenclature: Status Register (SREG ...

AVR Instruction Set Nomenclature: Status Register (SREG ...

AVR Instruction Set Nomenclature: Status Register (SREG ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

ROR - Rotate Right through Carry<br />

<strong>Instruction</strong> <strong>Set</strong><br />

Description:<br />

Shifts all bits in Rd one place to the right. The C flag is shifted into bit 7 of Rd. Bit 0 is shifted into the C flag. This operation,<br />

combined with ASR, effectively divides multi-byte signed values by two. Combined with LSR it effectively divides multi-byte<br />

unsigned values by two. The carry flag can be used to round the result.<br />

Operation:<br />

C → b7 - - - - - - - - - - - - - - - - - - b0 → C<br />

Syntax: Operands: Program Counter:<br />

(i) ROR Rd 0 ≤ d ≤ 31 PC ← PC + 1<br />

16-bit Opcode:<br />

<strong>Status</strong> <strong>Register</strong> (<strong>SREG</strong>) and Boolean Formula:<br />

S: N ⊕ V, For signed tests.<br />

V: N ⊕ C (For N and C after the shift)<br />

N: R7<br />

<strong>Set</strong> if MSB of the result is set; cleared otherwise.<br />

Z: R7• R6 •R5• R4• R3 •R2• R1• R0<br />

<strong>Set</strong> if the result is $00; cleared otherwise.<br />

C: Rd0<br />

<strong>Set</strong> if, before the shift, the LSB of Rd was set; cleared otherwise.<br />

R (Result) equals Rd after the operation.<br />

→<br />

1001 010d dddd 0111<br />

I T H S V N Z C<br />

- - - ⇔ ⇔ ⇔ ⇔ ⇔<br />

99

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!