Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Assembly Language Step by Step Programming with DOS and Linux 2nd Ed 2000.pdf
Скачиваний:
156
Добавлен:
17.08.2013
Размер:
4.44 Mб
Скачать

ROR Rotate Right

Flags affected:

O D

I

T

S

Z

A

P

C

OF: Overflow flag TF: Trap flag AF: Aux carry

F

F

F

F

F

F

F

F

F

DF: Direction

flag SF: Sign

flag

PF: Parity flag

*

 

 

 

 

 

 

 

* IF: Interrupt

flag ZF: Zero

flag

CF: Carry flag

Legal forms:

ROR r8,1

 

ROR m8,1

 

ROR r16,1

 

ROR m16,1

386+

ROR r32,1

ROR m32,1

386+

ROR r8,CL

 

ROR m8,CL

 

ROR r16,CL

 

ROR m16,CL

386+

ROR r32,CL

ROR m32,CL

386+

ROR r8,i8

286+

ROR m8,i8

286+

ROR r16,i8

286+

ROR m16,i8

286+

ROR r32,i8

386+

ROR m32,i8

386+

Examples:

ROR AL,1

ROR WORD [BX+SI],CL

ROR BP,1

ROR DWORD [EBX+ESI],9

ROR BP,CL

Notes:

ROR rotates the bits within the destination operand to the right, where right is toward the least significant bit (LSB). A rotate is a shift (see SHL and SHR) that wraps around; the rightmost bit of the operand is shifted into the leftmost bit, and all intermediate bits are shifted one bit to the right. Except for the direction the shift operation takes, ROR is identical to ROL.

The number of bit positions shifted may be specified either as an 8-bit immediate value, or by the value in CL- not CX or ECX. (The 8086 and 8088 are limited to the immediate value 1.) Note that while CL may accept a value up to 255, it is meaningless to shift by any value larger than 16-or 32 in 32-bit mode-even though the shifts are actually performed on the 8086 and 8088. (The 286 and later limit the number of shift operations performed to the native word size except when running in Virtual 86 mode.)

The rightmost bit is copied into the Carry flag on each shift operation. OF is modified only by the shift-by-one forms of ROR; after shift-by-CL forms, OF becomes undefined.

r8

= AL

AH

BL BH

CL

CH DL DH

r16

= AX BX CX DX

BP SP SI DI

sr = CS

DS SS ES

FS GS

r32

= EAX EBX ECX

EDX EBP ESP ESI E

m8

= 8-bit

memory data

m16

= 16-bit memory data

m32 = 32-bit memory

data

i8 = 8-bit immediate data

i16

= 16-bit

immediate data

i32

=

32-bit

immediate data

d8 = 8-bit signed displacement

d16

=

16-bit

signed displacement

d32

= 32-bit

unsigned displacement

 

 

 

 

SBB Arithmetic Subtraction with Borrow

Flags affected:

O

D

I

T

S

Z

A

P

C

OF:

Overflow flag TF:

Trap

flag

AF:

Aux carry

F

F

F

F

F

F

F

F

F

DF:

Direction flag SF:

Sign

flag

PF:

Parity flag

** * * * * IF: Interrupt flag ZF: Zero flag CF: Carry flag

Legal forms:

SBB r8,r8

 

SBB m8,r8

 

SBB r8,m8

 

SBB r16,r16

 

SBB m16,r16

 

SBB r16,m16

386+

SBB r32,r32

SBB m32,r32

386+

SBB r32,m32

386+

SBB r8,i8

 

SBB m8,i8

 

SBB r16,i16

 

SBB m16,i16

386+

SBB r32,i32

SBB m32,i32

386+

SBB r16,i8

 

SBB m16,i8

386+

SBB r32,i8

SBB m32,i8

386+

SBB AL,i8

 

SBB AX,i16

386+

SBB EAX,i32

Examples:

SBB BX,DI

;Uses

single-byte

opcode

SBB AX,0FFFFH

SBB

AL,42H

;Uses

single-byte

opcode

SBB

BP,17H

 

 

 

SBB WORD [BX+SI+Inset],5

SBB WORD [ES:BX],0B800H

Notes:

SBB performs a subtraction with borrow, where the source is subtracted from the destination, and then the Carry flag is subtracted from the result. The result then replaces the destination. If the result is negative, the Carry flag is set. To subtract without taking the Carry flag into account (i.e., without borrowing), use the SUB instruction.

r8 = AL AH BL BH CL CH DL DH sr = CS DS SS ES FS GS

m8 = 8-bit memory data

m32 = 32-bit memory data

i16 = 16-bit immediate data

d8 = 8-bit signed displacement

d32 = 32-bit unsigned displacement

r16 = AX BX CX DX BP SP SI DI

r32 = EAX EBX ECX EDX EBP ESP ESI E m16 = 16-bit memory data

i8 = 8-bit immediate data

i32 = 32-bit immediate data

d16 = 16-bit signed displacement