05_03_2011_9.55_10.50

Upload: venugopal-rao

Post on 08-Apr-2018

226 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/7/2019 05_03_2011_9.55_10.50

    1/9

    Compiled by

    Venugopala Rao A S

    Sr. Lecturer, Dept of CSE, SSE Mukka.

    Microprocessors

    06CS45

  • 8/7/2019 05_03_2011_9.55_10.50

    2/9

    8086 Family Assembler Language Programmingy LOOP Short_Label

    y It is limited for short jump

    y CX = CX 1

    y If CX != 0, Then JMP to Short_Label ,

    y LOOPE/LOOPZ Short_Label

    y CX = CX 1

    y If (CX != 0 & ZF=1) Then JMP will take place to Short_Label

    y

    LOOPNE/LOOPNZ Short_Labely CX = CX 1

    y If CX != 0 & ZF=0 Then JMP will take place to Short_Label

    2 Venugopal Rao A S, SSE Mukka

  • 8/7/2019 05_03_2011_9.55_10.50

    3/9

    8086 Family Assembler Language Programmingy Logical instructions:

    y AND instruction:

    y AND Destination, Source

    y Performs logic AND operation for each bit of the destination and

    source; stores the result into destination

    y Destination and source can not be both memory locations at the

    same time

    y It modifies flags: CF OF PF SF ZF

    y E.g.

    y MOV AL, 01100001b

    y AND AL, 11011111b ; AL = 01000001b ('A') RET

    3 Venugopal Rao A S, SSE Mukka

  • 8/7/2019 05_03_2011_9.55_10.50

    4/9

    8086 Family Assembler Language Programmingy OR Instruction:

    y Performs logic OR operation for each bit of the destination and

    source; stores the result into destinationy Destination and source can not be both memory locations at the

    same time

    y It modifies flags: CF OF PF SF ZF

    yE.g.y MOV AL, 01000001b

    y OR AL, 00100000b ; AL = 01100001b

    y NOT Instruction:

    y

    NOT destinationy Inverts each bit of the destination operand

    y Destination can be a register or a memory location

    y It does not modify flags

    4 Venugopal Rao A S, SSE Mukka

  • 8/7/2019 05_03_2011_9.55_10.50

    5/9

    8086 Family Assembler Language Programmingy XOR instruction:

    y XOR Destination, Source

    y Performs logic XOR operation for each bit of the destination and

    source; stores the result into destination

    y Destination and source can not be both memory locations at the

    same time

    y It modifies flags: CF OF PF SF ZF

    y E.g.

    y MOV AL, 00000111b

    y XOR AL, 00000010b

    5 Venugopal Rao A S, SSE Mukka

  • 8/7/2019 05_03_2011_9.55_10.50

    6/9

    8086 Family Assembler Language Programmingy Bit manipulation Instructions:

    y SHL(SAL) Destination, Count

    y Left shift destination bits; the number of bits shifted is given by

    operand Count

    y During the shift operation, the MSB of the destination is shifted into

    CF and zero is shifted into the LSB of the destination

    y Operand Count can be either an immediate data or register CL

    y Destination can be a register or a memory location

    y It modifies flags: CF OF PF SF ZF

    y E.g.

    y MOV AL, 11100000b

    y SHL AL, 1 ; AL = 11000000b, CF=1.

    6 Venugopal Rao A S, SSE Mukka

    CF 0Destination

    LSBMSB

  • 8/7/2019 05_03_2011_9.55_10.50

    7/9

    Bit Manipulation Instructions

    SHL(SAL) Destination, Count

    Left shift destination bits; the number of bits shifted is given by operand Count

    During the shift operation, the MSB ofthe destination is shifted into CF and

    zero is shifted into the LSB ofthe destination

    Operand Count can be either an immediate data orregister CL

    Destination can be a register or a memory location

    It modifies flags: CF OF PF SF ZF

    CF 0

    SHR Destination, Count

    Right shift destination bits; the number of bits shifted is given by operand Count

    During the shift operation, the LSB ofthe destination is shifted into CF and

    zero is shifted into the MSB ofthe destination

    Operand Count can be either an immediate data orregister CL

    Destination can be a register or a memory location

    It modifies flags: CF OF PF SF ZF

    CF0 Destination

    Destination

    LSBMSB

    LSB

    MSB

  • 8/7/2019 05_03_2011_9.55_10.50

    8/9

    Bit Manipulation Instructions

    SAR Destination, Count

    Right shift destination bits; the number of bits shifted is given by operand Count

    The LSB ofthe destination is shifted into CF and the MSB ofthe destination remians

    the same

    Operand Count can be either an immediate data orregister CL

    Destination can be a register or a memory location It modifies flags: CF PF SF ZF

    CFDestination

    LSBMSB

  • 8/7/2019 05_03_2011_9.55_10.50

    9/9

    Bit Manipulation Instructions

    ROL Destination, Count

    Left shift destination bits; the number of bits shifted is given by operand Count

    The MSB ofthe destination is shifted into CF, it also goes to the LSB ofthe destination

    Operand Count can be either an immediate data orregister CL

    Destination can be a register or a memory location

    It modifies flags: CF OF

    CF Destination

    ROR Destination, Count

    Right shift destination bits; the number of bits shifted is given by operand Count

    The LSB ofthe destination is shifted into CF, it also goes to the MSB ofthe destination

    Operand Count can be either an immediate data orregister CL Destination can be a register or a memory location

    It modifies flags: CF OF

    CFDestination

    LSBMSB

    LSBMSB