SlideShare a Scribd company logo
   Instruction classification
   Addressing modes
   Assembler directives
   ALP development tools
   ALP
   An instruction is a binary pattern designed
   inside a microprocessor to perform a specific
   function.
   The entire group of instructions that a
   microprocessor supports is called
   Instruction Set.
   8086 has more than 20,000 instructions.
   Data Transfer Instructions
   Arithmetic Instructions
   Bit Manipulation Instructions
   Program Execution Transfer Instructions
   String Instructions
   Processor Control Instructions
   These instructions are used to transfer data
   from source to destination.
   The operand can be a constant, memory
   location, register or I/O port address.
   MOV Des, Src:
    Src operand can be register, memory location or
    immediate
   operand.
    Des can be register or memory operand.
    Both Srcand Des cannot be memory location at the
    same
   time.
    E.g.:
    MOV CX, 037A H
    MOV AL, BL
    MOV BX, [0301 H]
   PUSH Operand:
    It pushes the operand into top of stack.
    E.g.: PUSH BX

    POP Des:
    It pops the operand from top of stack to Des.
    Des can be a general purpose register, segment
    register
   (except CS) or memory location.
    E.g.: POP AX
   XCHG Des, Src:
    This instruction exchanges Src with Des.
    It cannot exchange two memory locations directly.
    E.g.: XCHG DX, AX

   IN Accumulator, Port Address:
    It transfers the operand from specified port to
    accumulator
   register.
    E.g.: IN AX, 0028 H
   OUT Port Address, Accumulator:
    It transfers the operand from accumulator to
    specified port.
    E.g.: OUT 0028 H, AX

   LEA Register, Src:
   It loads a 16-bit register with the offset
   address of the data specified by the Src.
   E.g.: LEA BX, [DI]
    This instruction loads the contents of DI
   (offset) into the BX register.
   LDS Des, Src:
    It loads 32-bit pointer from memory source to
   destination register and DS.
    The offset is placed in the destination register and
    the
   segment is placed in DS.
    To use this instruction the word at the lower
    memory
   address must contain the offset and the word at the
   higher address must contain the segment.
    E.g.: LDS BX, [0301 H]
   LES Des, Src:
    It loads 32-bit pointer from memory source to
   destination register and ES.
    The offset is placed in the destination register and
    the
   segment is placed in ES.
    This instruction is very similar to LDS except that it
   initializes ES instead of DS.
    E.g.: LES BX, [0301 H]
   LAHF:
    It copies the lower byte of flag register to AH.
   SAHF:
    It copies the contents of AH to lower byte of flag
    register.
    PUSHF:
    Pushes flag register to top of stack.
    POPF:
    Pops the stack top to flag register.
  These instruction performs arithmetic operations
   on data.
 The arithmetic operations performed are:

1) Addition
2) Subtraction
3) Multiplication
4) Division
   ADD Des, Src:
   It adds a byte to byte or a word to word.
   It effects AF, CF, OF, PF, SF, ZF flags.
   E.g.:
    ADD AL, 74H
    ADD DX, AX
    ADD AX, [BX]

   ADC Des, Src:
   It adds the two operands with CF.
   It effects AF, CF, OF, PF, SF, ZF flags.
   E.g.:
    ADC AL, 74H
    ADC DX, AX
    ADC AX, [BX]
   SUB Des, Src:
    It subtracts a byte from byte or a word from word.
    It effects AF, CF, OF, PF, SF, ZF flags.
    For subtraction, CF acts as borrow flag.
    E.g. SUB AL, 74H
    SUB DX, AX
    SUB AX, [BX]

   SBB Des, Src:
   It subtracts the two operands and also the
   borrow from the result.
   It effects AF, CF, OF, PF, SF, ZF flags.
   E.g. SBB AL, 74H
    SBB DX, AX
    SBB AX, [BX]
   INC Src:
   It increments the byte or word by one.
   The operand can be a register or memory location.
   It effects AF, OF, PF, SF, ZF flags.
   CF is not effected.
   E.g.: INC AX

   DEC Src:
   It decrements the byte or word by one.
   The operand can be a register or memory location.
   It effects AF, OF, PF, SF, ZF flags.
   CF is not effected.
   E.g.: DEC AX
   AAA (ASCII Adjust after Addition):
    The data entered from the terminal is in ASCII format.
    In ASCII, 0 – 9 are represented by 30H – 39H.
    This instruction allows us to add the ASCII codes.
    This instruction does not have any operand.

   Other ASCII Instructions:
    AAS (ASCII Adjust after Subtraction)
    AAM (ASCII Adjust after Multiplication)
    AAD (ASCII Adjust Before Division)
   DAA (Decimal Adjust after Addition)
    It is used to make sure that the result of adding two
    BCD
       numbers is adjusted to be a correct BCD number.
    It only works on AL register.

   DAS (Decimal Adjust after Subtraction)
    It is used to make sure that the result of subtracting
    two
      BCD numbers is adjusted to be a correct BCD number.
    It only works on AL register.

   NEG Src:
   It creates 2’s complement of a given number.
   That means, it changes the sign of a number.
   CMP Des, Src:
    It compares two specified bytes or words.
    The Src and Des can be a constant, register or memory
   location.
    Both operands cannot be a memory location at the
    same
   time.
    The comparison is done simply by internally subtracting
   the source from destination.
    The value of source and destination does not change,
    but
   the flags are modified to indicate the result.
   MUL Src:
    It is an unsigned multiplication instruction.
    It multiplies two bytes to produce a word or two words
    to
      produce a double word.
    AX = AL * Src
    DX : AX = AX * Src
    This instruction assumes one of the operand in AL or AX.
    Srccan be a register or memory location.

   IMUL Src:
    It is a signed multiplication instruction.
   DIV Src:
    It is an unsigned division instruction.
    It divides word by byte or double word by word.
    The operand is stored in AX, divisor is Src and the
    result is stored as:
    AH = remainder AL = quotient

   IDIV Src:
    It is a signed division instruction.
   CBW (Convert Byte to Word):
    This instruction converts byte in AL to word in AX.
    The conversion is done by extending the sign bit of AL
   throughout AH.

   CWD (Convert Word to Double Word):
    This instruction converts word in AX to double word in
   DX : AX.
    The conversion is done by extending the sign bit of AX
   throughout DX.
    These instructions manipulates individual bits or
     group of bits that represent binary coded
     information.
    These instructions can be used for:
     Testing a zero bit
     Set or reset a bit
     Shift bits across registers
    The 8086 provides three groups of instruction:
1)   Logical instruction
2)   Shift instruction
3)   Rotate instruction
   NOT Src:
    It complements each bit of Src to produce 1’s
   complement of the specified operand.
    The operand can be a register or memory location.

   AND Des, Src:
    It performs AND operation of Des and Src.
    Src can be immediate number, register or memory
    location.
    Des can be register or memory location.
    Both operands cannot be memory locations at the same
    time.
    CF and OF become zero after the operation.
    PF, SF and ZF are updated.
   OR Des, Src:
    It performs OR operation of Des and Src.
    Srccan be immediate number, register or memory location.
    Des can be register or memory location.
    Both operands cannot be memory locations at the same time.
    CF and OF become zero after the operation.
    PF, SF and ZF are updated.

   XOR Des, Src:
    It performs XOR operation of Des and Src.
    Srccan be immediate number, register or memory location.
    Des can be register or memory location.
    Both operands cannot be memory locations at the same time.
    CF and OF become zero after the operation.
    PF, SF and ZF are updated.
SHL Des, Count:
 It shift bits of byte or word left, by count.
 It puts zero(s) in LSBs.
 MSB is shifted into carry flag.
 If the number of bits desired to be shifted is 1, then
the immediate number 1 can be written in Count.
 However, if the number of bits to be shifted is more
than 1, then the count is put in CL register.
SHR Des, Count:
 It shift bits of byte or word right, by count.
 It puts zero(s) in MSBs.
 LSB is shifted into carry flag.
 If the number of bits desired to be shifted is 1, then
the immediate number 1 can be written in Count.
 However, if the number of bits to be shifted is more
than 1, then the count is put in CL register.
   ROL Des, Count:
    It rotates bits of byte or word left, by count.
    MSB is transferred to LSB and also to CF.
    If the number of bits desired to be shifted is 1, then the
   immediate number 1 can be written in Count.
   However, if the number of bits to be shifted is more than
    1, then the count is put in CL register.
   ROR Des, Count:
    It rotates bits of byte or word right, by count.
    LSB is transferred to MSB and also to CF.
    If the number of bits desired to be shifted is 1, then the
   immediate number 1 can be written in Count.
    However, if the number of bits to be shifted is more
    than
   1, then the count is put in CL register.
   RCL Des,count:
   RCL (rotate carry left) shifts each bit to the left
   Copies the Carry flag to the least significant bit
   Copies the most significant bit to the Carry flag



        CF
   RCR Des,count:
   RCR (rotate carry right) shifts each bit to the right
   Copies the Carry flag to the most significant bit
   Copies the least significant bit to the Carry flag
   String in assembly language is just a sequentially
   stored bytes or words.
   There are very strong set of string instructions in
    8086.
   Instructions are available to move, compare scan for
    given value & move string elements to & from the
    accumulator.
   By using these string instructions, the size of the
    program is considerably reduced.
   CMPS Des, Src:
    It compares the string bytes or words.

   SCAS String:
    It scans a string.
    It compares the String with byte in AL or with word in
    AX.

   MOVS / MOVSB / MOVSW:
    It causes moving of byte or word from one string to
    another.
    In this instruction, the source string is in Data Segment
   and destination string is in Extra Segment.
    SI and DI store the offset values for source and
    destination index.
   REP (Repeat):
    This is an instruction prefix.
    It causes the repetition of the instruction until CX
    becomes zero.
    E.g.: REP MOVSB STR1, STR2
    It copies byte by byte contents.
    REP repeats the operation MOVSB until CX becomes
    zero.
    These instructions cause change in the sequence of
     the execution of instruction.
    This change can be through a condition or
     sometimes unconditional.
    The conditions are represented by flags.
    Four groups of program transfer instructions are:

1)   Unconditional transfer
2)   Conditional transfer
3)   Iteration control
4)   Interrupt
   CALL Des:
    This instruction is used to call a subroutine or
    function or procedure.
    The address of next instruction after CALL is saved
    onto stack.

   RET:
    It returns the control from procedure to calling
    program.
    Every CALL instruction should have a RET.

   JMP Des:
    This instruction is used for unconditional jump from
   one place to another
   These instructions depend on the state of CPU flags
   If the condition is true then the control is transferred
    to target specified by signed 8-bit displacement.
   If condition is false then control passes to the next
    instruction after jump.
Mnemon    Operation                                   Flag
ic                                                    tested
JC        Jump if carry                               CF=1
JNC       Jump if no carry                            CF=0
JZ/JE     Jump if zero                                ZF=1
JNZ/JNE   Jump if not zero                            ZF=0
JS        Jump if sign or negative                    SF=1
JNS       Jump if positive                            SF=0
JP/JPE    Jump if parity is even                      PF=1
JNP/JPO   Jump if parity is odd                       PF=0
JO        Jump if overflow                            OF=1
JNO       Jump if no overflow                         OF=0
JA/JNBE   Jump if above/if neither bellow nor equal   CF=0
JAE/JNB   Jump if above or equal/if not bellow        CF=0
JB/JNAE   Jump if bellow/if neither equal nor above   CF=1
JBE/JNA   Jump if bellow or equal/if not        CF=1 OR ZF=1
          above

JG/JNLE   Jump if greater/if neither less nor   [CF=OF] OR ZF=0
          equal

JGE/JNL   Jump if greater or equal/if not less SF=OF=1

JL/JNGE   Jump if less/if neither greater nor   SF NOT EQUAL TO
          equal                                 OF

JLE/JNG   Jump if less or equal/if notgreater   ZF=1
   Loop Des:
    This is a looping instruction.
    The number of times looping is required is placed in
    the
   CX register.
    With each iteration, the contents of CX are
   decremented.
    ZF is checked whether to loop again or not.
   INT type
   This instruction calls a far procedure. i.e. request a
    service from OS or from hardware initiated
    interrupts.
   The type in the instruction refers to ano. Between 0
    & 255, which identifies the interrupt.
   Eg: INT 35

   INTO
   This generates a interrupt if OF=1; otherwise control
    proceeds to next instruction in any interrupt
    procedure.
   IRET
   This instruction returns the control to the main
    program.
   These instructions control the processor itself.
   8086 allows to control certain control flags that:
     causes the processing in a certain direction
     processor synchronization if more than one
    microprocessor attached.
    STC:
    It sets the carry flag to 1.

    CLC:
    It clears the carry flag to 0.

    CMC:
    It complements the carry flag.

   STD:
    It sets the direction flag to 1.
    If it is set, string bytes are accessed from higher
    memory
   address to lower memory address.
    CLD:
    It clears the direction flag to 0.
    If it is reset, the string bytes are accessed from
    lower
   memory address to higher memory address.

   CLI:
   It resets the interrupt flag to zero.

   STI:
   It set the IF to one.

   HLT:
   It will cause the processor to stop fetching &
    executing instructions & enter a half state.
   WAIT:
   It causes 8086 to enter into an idle condition where
    no processing is done.
   This instruction is used to synchronize the 8086 with
    external hardware such as 8087 math co-processor.

   LOCK:
   It allows microprocessor to make sure that another
    processor does not take the control of system bus
    while it is in the middle of critical instruction which
    uses system bus.

   ESC:
   It is used to pass control to the co-processor.

   NOP: (Perform no operation)
   It is used to increase the delay of a delay loop
   Addressing modes specify where an operand is
    located.
   They can specify a constant, a register, or a
    memory location.
   The actual location of an operand is its effective
    address.
   Certain addressing modes allow us to determine
    the address of an operand dynamically.
    The 8086 addressing modes can be classified into five
     groups:

1)   Modes for accessing Immediate & Register data
2)   Modes for accessing data in memory.
3)   Modes for accessing I/O ports.
4)   Relative addressing mode
5)   Implied addressing mode
   Modes for accessing Immediate & Register data:

   Immediate addressing:
    In this mode the data is part of the instruction.
   The operand is 8 or 16 bit data.
   Eg:
   MOV AL,15H

   Register addressing:
   In this mode data is located in a internal register
    of 8086.
   Eg:
   MOV AX, BX
   Modes for accessing data in memory:

   Direct addressing :
   In this mode the address of data is given in the
    instruction.
   Eg:
   MOV CX,[1234H]

   Register indirect :
   It uses a register to store the address of the address of
    the data.
   EA resides either in the base register BX or base
    pointer register BP, & index register can be source
    index register SI or destination index register DI
   Eg: MOV AX,[SI]
Based addressing :
In this mode tha EA address of the operand is obtained
   by adding a direct or indirect displacement to the
   contents of either base register BX or base pointer
   register BP
 Eg:
 MOV [BX] + 1234h,AL
 EA= BX+ 1234H       PA=Segment base : EA

   Indexed addressing mode:
   In this the EA at the operand is obtained by adding
    direct or indirect displacement to the the content of
    SI or DI
   Eg:
   MOV AL,[SI] + 2000H
   EA= SI + 2000H       PA= segment base : EA
   Based Indexed addressing mode:
   It is combination of based & indexed addressing
    mode.
   In this mode the EA is computed by adding a base
    register (BX or BP) , an index register(SI or DI) &
    displacement.
   Eg:
   MOV AH,[BX][SI] + 1234H
   EA=BX + SI + 1234h
   PA=DS:EA
 Modes for accessing I/O ports:
 Standard I/O uses port addressing modes.
 There are two types of this modes:

1) Direct            2) Indirect

   Direct port mode:
   In this direct port number is used in the instruction.
   Port no. are 0 t0 255
   Eg:OUT 05H,AL

 Indirect Port mode:
 Port no. is taken from DX allowing 64K, 8-bit ports or
  32K,16 bits ports.
Eg:IN AL, DXRelative addressing mode
   Relative addresing mode:
   In this mode the operand is signed 8-bit displacement
    relative to the PC.
   Eg:
   JNZ BACK

   Implied addresing mode:
   Instruction using this mode has no approach.
   Eg:
   STC
   The source program is composed of three types of
    lines: opcode, assemble directive(pseudo opcodes) &
    the comments.
   The opcode create the instruction for the CPU.
   Assembler directives give instruction to the
    assembler.
   Comments tells us what the program wants to tell us.
   Assembler directives are specific for a particular
    assembler.
   They are used only during the assembly of program &
    generate machine executable code
   ASSUME: This directive tell the assembler the name
    of the logical segment it should use for a specified
    segment.
   DB: This directive is used to declare a byte-type
    variable or to set aside one or more storage locations
    of type byte in memory (Define Byte).
    DD: This directive is used to declare a variable of
    type doubleword or to reserve memory locations
    which can be accessed as type doubleword (Define
    Doubleword).
    DW: This directive is used to tell the assembler to
    declare a variable of type word or to reserve storage
    locations of type word in memory.
   ENDS: This directive is used with the name of a
    segment to indicate the end of that logical segment
   EQU: It is used to give a name to some value or
    symbol
   END: This is put after the last statement of program.
    It tells the assembler this is the end of the program.
   ENDP This directive is used with name procedure to
    indicate the end of a procedure to tha assembler.
   EXTERN:Tells the assembler that the name or lables
    following the directive are in some other assembly
    module.
   ORG: Originate. The assembler uses a location
    counter to account for its relative position in data
    code segment.
   MACRO & ENDM-This directive defines the macros in
    the program.
   ENDM is used along with MACRO . It defines the end
    of the macro
 ALP DEVELOPMENT TOOLS
 Tools required

1.Editor
2.Assembler
3.Linker
4.Locator
5.Debugger
6.Emulator
   EDITOR
   Allows to create a file containing
    assemblyprogram
   Ex: PC Write, WordStar
   It will save program in RAM as it is typed
   It backups the file before correcting errors
   The file can be save on any
    drive(floppy/CD/hard drive)
   Program should be well formatted
   Assembly program should be saved as.ASM file
   ASSEMBLER
   Translates the assembly language mnemonics to
    binary codes
   Displacements of named data items offset oflabels
    are determined in 1st run
   On 2nd run it produce the binary code
   Produce object file (.OBJ ) & assembler listfile(.LST )
   Errors are put in list file
   It generates only offset address and not physical
    address
   Linker or Locator will determine physical address
   LINKER
   Used to combine several .obj files into one large
    object file
   Programs are split into modules
   Link file contains the binary code of all combined
    modules
   Also produce the link map file which containsthe
    address information
   Assign only relative address(address startingwith
    zero)
   TASM & MASM produce the linker file with.exe
    extension

   LOCATOR
   Is used to assign absolute address
   DEBUGGER
   Can be used to run the program if external hardware
    are not used
   Will load the object file to memory for debugging
   It allow you to see the content of registers and
    memory location
   Allows to change the content of register and
    memory location
   Will allow to set a breakpoint

   EMULATOR
   Used t o run program
   Mixture of hardware and software
   Program Development Algorithm
   An 8086 assembly language program has five columns
    namely
     Address
     Data or code
     Labels
     Mnemonics
     Operands
     Comments
   The address column is used for the address or the
    offset of a code byte or a data byte

   The actual code bytes or data bytes are put in the
    data or code column

   A label is a name which represents an address
    referred to in a jump or call instruction

   Labels are put in the labels column

   The operands column contains the registers, memory
    locations or data acted upon by the instructions

   A comments column gives space to describe the
    function of the instruction for future reference
   An ALP for addition of X + Y=Z
   An ALP for subtraction of Z=X-Y
   An ALP for Division of Z=X/Y
Instruction set

More Related Content

What's hot

Computer instructions
Computer instructionsComputer instructions
Computer instructionsAnuj Modi
 
chapter 7 Logic, shift and rotate instructions
chapter 7 Logic, shift and rotate instructionschapter 7 Logic, shift and rotate instructions
chapter 7 Logic, shift and rotate instructions
warda aziz
 
8086 assembly language
8086 assembly language8086 assembly language
8086 assembly languageMir Majid
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 80869840596838
 
Instruction sets of 8086
Instruction sets of 8086Instruction sets of 8086
Instruction sets of 8086
Mahalakshmiv11
 
Register transfer language
Register transfer languageRegister transfer language
Register transfer language
Sanjeev Patel
 
Instruction Set Architecture: MIPS
Instruction Set Architecture: MIPSInstruction Set Architecture: MIPS
Instruction Set Architecture: MIPS
Prasenjit Dey
 
Instruction cycle presentation
Instruction   cycle presentationInstruction   cycle presentation
Instruction cycle presentation
Moniba Irfan
 
Register transfer language & its micro operations
Register transfer language & its micro operationsRegister transfer language & its micro operations
Register transfer language & its micro operations
Lakshya Sharma
 
8086 String Instructions.pdf
8086 String Instructions.pdf8086 String Instructions.pdf
8086 String Instructions.pdf
A. S. M. Badrudduza
 
8259 Programmable Interrupt Controller
8259 Programmable Interrupt Controller8259 Programmable Interrupt Controller
8259 Programmable Interrupt Controller
abhikalmegh
 
8086
80868086
Addressing modes of 8086 - Binu Joy
Addressing modes of 8086 - Binu JoyAddressing modes of 8086 - Binu Joy
Addressing modes of 8086 - Binu Joy
Binu Joy
 
Memory Segmentation of 8086
Memory Segmentation of 8086Memory Segmentation of 8086
Memory Segmentation of 8086
Nikhil Kumar
 
Floating point representation
Floating point representationFloating point representation
Floating point representation
missstevenson01
 
8086 Instruction set
8086 Instruction set8086 Instruction set
8086 Instruction set
karthiga selvaraju
 
8086 alp
8086 alp8086 alp
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086
Tirumalesh Nizampatnam
 
Addressing modes of 8086
Addressing modes of 8086Addressing modes of 8086
Addressing modes of 8086
saurav kumar
 

What's hot (20)

Computer instructions
Computer instructionsComputer instructions
Computer instructions
 
chapter 7 Logic, shift and rotate instructions
chapter 7 Logic, shift and rotate instructionschapter 7 Logic, shift and rotate instructions
chapter 7 Logic, shift and rotate instructions
 
8086 assembly language
8086 assembly language8086 assembly language
8086 assembly language
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086
 
Instruction sets of 8086
Instruction sets of 8086Instruction sets of 8086
Instruction sets of 8086
 
Register transfer language
Register transfer languageRegister transfer language
Register transfer language
 
Instruction Set Architecture: MIPS
Instruction Set Architecture: MIPSInstruction Set Architecture: MIPS
Instruction Set Architecture: MIPS
 
Instruction cycle presentation
Instruction   cycle presentationInstruction   cycle presentation
Instruction cycle presentation
 
Register transfer language & its micro operations
Register transfer language & its micro operationsRegister transfer language & its micro operations
Register transfer language & its micro operations
 
8086 String Instructions.pdf
8086 String Instructions.pdf8086 String Instructions.pdf
8086 String Instructions.pdf
 
8259 Programmable Interrupt Controller
8259 Programmable Interrupt Controller8259 Programmable Interrupt Controller
8259 Programmable Interrupt Controller
 
8086
80868086
8086
 
Addressing modes of 8086 - Binu Joy
Addressing modes of 8086 - Binu JoyAddressing modes of 8086 - Binu Joy
Addressing modes of 8086 - Binu Joy
 
Memory Segmentation of 8086
Memory Segmentation of 8086Memory Segmentation of 8086
Memory Segmentation of 8086
 
Floating point representation
Floating point representationFloating point representation
Floating point representation
 
8086 Instruction set
8086 Instruction set8086 Instruction set
8086 Instruction set
 
8086 alp
8086 alp8086 alp
8086 alp
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086
 
Assignment on alp
Assignment on alpAssignment on alp
Assignment on alp
 
Addressing modes of 8086
Addressing modes of 8086Addressing modes of 8086
Addressing modes of 8086
 

Similar to Instruction set

Chap 3_2.ppt
Chap 3_2.pptChap 3_2.ppt
Chap 3_2.ppt
inian2
 
Instruction set-of-8086
Instruction set-of-8086Instruction set-of-8086
Instruction set-of-8086
mudulin
 
Instruction Set of 8086 Microprocessor
Instruction Set of 8086 MicroprocessorInstruction Set of 8086 Microprocessor
Instruction Set of 8086 Microprocessor
Ashita Agrawal
 
8086 instructions
8086 instructions8086 instructions
8086 instructions
Ravi Anand
 
Assembly Language Lecture 4
Assembly Language Lecture 4Assembly Language Lecture 4
Assembly Language Lecture 4
Motaz Saad
 
Microprocessor.pptx
Microprocessor.pptxMicroprocessor.pptx
Microprocessor.pptx
NishatNishu5
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086
Vijay Kumar
 
Instructionsetof8086 180224060745(3)
Instructionsetof8086 180224060745(3)Instructionsetof8086 180224060745(3)
Instructionsetof8086 180224060745(3)
AmitPaliwal20
 
Instruction set of 8086 Microprocessor
Instruction set of 8086 Microprocessor Instruction set of 8086 Microprocessor
Instruction set of 8086 Microprocessor
Velalar College of Engineering and Technology
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086
Akhila Rahul
 
Arm Cortex material Arm Cortex material3222886.ppt
Arm Cortex material Arm Cortex material3222886.pptArm Cortex material Arm Cortex material3222886.ppt
Arm Cortex material Arm Cortex material3222886.ppt
Manju Badiger
 
Arithmetic instrctions
Arithmetic instrctionsArithmetic instrctions
Arithmetic instrctions
HarshitParkar6677
 
Topic 6 - Programming in Assembly Language_230517_115118.pdf
Topic 6 - Programming in Assembly Language_230517_115118.pdfTopic 6 - Programming in Assembly Language_230517_115118.pdf
Topic 6 - Programming in Assembly Language_230517_115118.pdf
ezaldeen2013
 
Chapter 3 programming concepts-ii
Chapter 3  programming concepts-iiChapter 3  programming concepts-ii
Chapter 3 programming concepts-ii
SHREEHARI WADAWADAGI
 
Mastering Assembly Language: Programming with 8086
Mastering Assembly Language: Programming with 8086Mastering Assembly Language: Programming with 8086
Mastering Assembly Language: Programming with 8086
sravanithonta79
 
Intrl 8086 instruction set
Intrl 8086 instruction setIntrl 8086 instruction set
Intrl 8086 instruction set
edwardkiwalabye1
 
8086 instruction set
8086 instruction set8086 instruction set
8086 instruction set
meenakshi_l
 
8086 instruction set
8086 instruction set8086 instruction set
8086 instruction set
Alamin Hossain Miraje
 

Similar to Instruction set (20)

Chap 3_2.ppt
Chap 3_2.pptChap 3_2.ppt
Chap 3_2.ppt
 
Instruction set-of-8086
Instruction set-of-8086Instruction set-of-8086
Instruction set-of-8086
 
Instruction Set of 8086 Microprocessor
Instruction Set of 8086 MicroprocessorInstruction Set of 8086 Microprocessor
Instruction Set of 8086 Microprocessor
 
8086 instructions
8086 instructions8086 instructions
8086 instructions
 
Assembly Language Lecture 4
Assembly Language Lecture 4Assembly Language Lecture 4
Assembly Language Lecture 4
 
Microprocessor.pptx
Microprocessor.pptxMicroprocessor.pptx
Microprocessor.pptx
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086
 
Instructionsetof8086 180224060745(3)
Instructionsetof8086 180224060745(3)Instructionsetof8086 180224060745(3)
Instructionsetof8086 180224060745(3)
 
Instruction set of 8086 Microprocessor
Instruction set of 8086 Microprocessor Instruction set of 8086 Microprocessor
Instruction set of 8086 Microprocessor
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086
 
Arm Cortex material Arm Cortex material3222886.ppt
Arm Cortex material Arm Cortex material3222886.pptArm Cortex material Arm Cortex material3222886.ppt
Arm Cortex material Arm Cortex material3222886.ppt
 
Arithmetic instrctions
Arithmetic instrctionsArithmetic instrctions
Arithmetic instrctions
 
Topic 6 - Programming in Assembly Language_230517_115118.pdf
Topic 6 - Programming in Assembly Language_230517_115118.pdfTopic 6 - Programming in Assembly Language_230517_115118.pdf
Topic 6 - Programming in Assembly Language_230517_115118.pdf
 
Lecture5
Lecture5Lecture5
Lecture5
 
Lecture5(1)
Lecture5(1)Lecture5(1)
Lecture5(1)
 
Chapter 3 programming concepts-ii
Chapter 3  programming concepts-iiChapter 3  programming concepts-ii
Chapter 3 programming concepts-ii
 
Mastering Assembly Language: Programming with 8086
Mastering Assembly Language: Programming with 8086Mastering Assembly Language: Programming with 8086
Mastering Assembly Language: Programming with 8086
 
Intrl 8086 instruction set
Intrl 8086 instruction setIntrl 8086 instruction set
Intrl 8086 instruction set
 
8086 instruction set
8086 instruction set8086 instruction set
8086 instruction set
 
8086 instruction set
8086 instruction set8086 instruction set
8086 instruction set
 

Recently uploaded

1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Po-Chuan Chen
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
CarlosHernanMontoyab2
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 

Recently uploaded (20)

1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 

Instruction set

  • 1.
  • 2. Instruction classification  Addressing modes  Assembler directives  ALP development tools  ALP
  • 3. An instruction is a binary pattern designed  inside a microprocessor to perform a specific  function.  The entire group of instructions that a  microprocessor supports is called  Instruction Set.  8086 has more than 20,000 instructions.
  • 4. Data Transfer Instructions  Arithmetic Instructions  Bit Manipulation Instructions  Program Execution Transfer Instructions  String Instructions  Processor Control Instructions
  • 5. These instructions are used to transfer data  from source to destination.  The operand can be a constant, memory  location, register or I/O port address.
  • 6. MOV Des, Src:   Src operand can be register, memory location or immediate  operand.   Des can be register or memory operand.   Both Srcand Des cannot be memory location at the same  time.   E.g.:   MOV CX, 037A H   MOV AL, BL   MOV BX, [0301 H]
  • 7. PUSH Operand:   It pushes the operand into top of stack.   E.g.: PUSH BX   POP Des:   It pops the operand from top of stack to Des.   Des can be a general purpose register, segment register  (except CS) or memory location.   E.g.: POP AX
  • 8. XCHG Des, Src:   This instruction exchanges Src with Des.   It cannot exchange two memory locations directly.   E.g.: XCHG DX, AX  IN Accumulator, Port Address:   It transfers the operand from specified port to accumulator  register.   E.g.: IN AX, 0028 H
  • 9. OUT Port Address, Accumulator:   It transfers the operand from accumulator to specified port.  E.g.: OUT 0028 H, AX  LEA Register, Src:  It loads a 16-bit register with the offset  address of the data specified by the Src.  E.g.: LEA BX, [DI]   This instruction loads the contents of DI  (offset) into the BX register.
  • 10. LDS Des, Src:   It loads 32-bit pointer from memory source to  destination register and DS.   The offset is placed in the destination register and the  segment is placed in DS.   To use this instruction the word at the lower memory  address must contain the offset and the word at the  higher address must contain the segment.   E.g.: LDS BX, [0301 H]
  • 11. LES Des, Src:   It loads 32-bit pointer from memory source to  destination register and ES.   The offset is placed in the destination register and the  segment is placed in ES.   This instruction is very similar to LDS except that it  initializes ES instead of DS.   E.g.: LES BX, [0301 H]
  • 12. LAHF:   It copies the lower byte of flag register to AH.  SAHF:   It copies the contents of AH to lower byte of flag register.  PUSHF:   Pushes flag register to top of stack.  POPF:   Pops the stack top to flag register.
  • 13.  These instruction performs arithmetic operations on data.  The arithmetic operations performed are: 1) Addition 2) Subtraction 3) Multiplication 4) Division
  • 14. ADD Des, Src:  It adds a byte to byte or a word to word.  It effects AF, CF, OF, PF, SF, ZF flags.  E.g.:   ADD AL, 74H   ADD DX, AX   ADD AX, [BX]  ADC Des, Src:  It adds the two operands with CF.  It effects AF, CF, OF, PF, SF, ZF flags.  E.g.:   ADC AL, 74H   ADC DX, AX   ADC AX, [BX]
  • 15. SUB Des, Src:   It subtracts a byte from byte or a word from word.   It effects AF, CF, OF, PF, SF, ZF flags.   For subtraction, CF acts as borrow flag.   E.g. SUB AL, 74H   SUB DX, AX   SUB AX, [BX]  SBB Des, Src:  It subtracts the two operands and also the  borrow from the result.  It effects AF, CF, OF, PF, SF, ZF flags.  E.g. SBB AL, 74H   SBB DX, AX   SBB AX, [BX]
  • 16. INC Src:  It increments the byte or word by one.  The operand can be a register or memory location.  It effects AF, OF, PF, SF, ZF flags.  CF is not effected.  E.g.: INC AX  DEC Src:  It decrements the byte or word by one.  The operand can be a register or memory location.  It effects AF, OF, PF, SF, ZF flags.  CF is not effected.  E.g.: DEC AX
  • 17. AAA (ASCII Adjust after Addition):   The data entered from the terminal is in ASCII format.   In ASCII, 0 – 9 are represented by 30H – 39H.   This instruction allows us to add the ASCII codes.   This instruction does not have any operand.  Other ASCII Instructions:   AAS (ASCII Adjust after Subtraction)   AAM (ASCII Adjust after Multiplication)   AAD (ASCII Adjust Before Division)
  • 18. DAA (Decimal Adjust after Addition)   It is used to make sure that the result of adding two BCD numbers is adjusted to be a correct BCD number.   It only works on AL register.  DAS (Decimal Adjust after Subtraction)   It is used to make sure that the result of subtracting two BCD numbers is adjusted to be a correct BCD number.   It only works on AL register.  NEG Src:  It creates 2’s complement of a given number.  That means, it changes the sign of a number.
  • 19. CMP Des, Src:   It compares two specified bytes or words.   The Src and Des can be a constant, register or memory  location.   Both operands cannot be a memory location at the same  time.   The comparison is done simply by internally subtracting  the source from destination.   The value of source and destination does not change, but  the flags are modified to indicate the result.
  • 20. MUL Src:   It is an unsigned multiplication instruction.   It multiplies two bytes to produce a word or two words to produce a double word.   AX = AL * Src   DX : AX = AX * Src   This instruction assumes one of the operand in AL or AX.   Srccan be a register or memory location.  IMUL Src:   It is a signed multiplication instruction.
  • 21. DIV Src:   It is an unsigned division instruction.   It divides word by byte or double word by word.   The operand is stored in AX, divisor is Src and the result is stored as:   AH = remainder AL = quotient  IDIV Src:   It is a signed division instruction.
  • 22. CBW (Convert Byte to Word):   This instruction converts byte in AL to word in AX.   The conversion is done by extending the sign bit of AL  throughout AH.  CWD (Convert Word to Double Word):   This instruction converts word in AX to double word in  DX : AX.   The conversion is done by extending the sign bit of AX  throughout DX.
  • 23. These instructions manipulates individual bits or group of bits that represent binary coded information.  These instructions can be used for:   Testing a zero bit   Set or reset a bit   Shift bits across registers  The 8086 provides three groups of instruction: 1) Logical instruction 2) Shift instruction 3) Rotate instruction
  • 24. NOT Src:   It complements each bit of Src to produce 1’s  complement of the specified operand.   The operand can be a register or memory location.  AND Des, Src:   It performs AND operation of Des and Src.   Src can be immediate number, register or memory location.   Des can be register or memory location.   Both operands cannot be memory locations at the same time.   CF and OF become zero after the operation.   PF, SF and ZF are updated.
  • 25. OR Des, Src:   It performs OR operation of Des and Src.   Srccan be immediate number, register or memory location.   Des can be register or memory location.   Both operands cannot be memory locations at the same time.   CF and OF become zero after the operation.   PF, SF and ZF are updated.  XOR Des, Src:   It performs XOR operation of Des and Src.   Srccan be immediate number, register or memory location.   Des can be register or memory location.   Both operands cannot be memory locations at the same time.   CF and OF become zero after the operation.   PF, SF and ZF are updated.
  • 26. SHL Des, Count:  It shift bits of byte or word left, by count.  It puts zero(s) in LSBs.  MSB is shifted into carry flag.  If the number of bits desired to be shifted is 1, then the immediate number 1 can be written in Count. However, if the number of bits to be shifted is more than 1, then the count is put in CL register.
  • 27. SHR Des, Count:  It shift bits of byte or word right, by count.  It puts zero(s) in MSBs.  LSB is shifted into carry flag.  If the number of bits desired to be shifted is 1, then the immediate number 1 can be written in Count.  However, if the number of bits to be shifted is more than 1, then the count is put in CL register.
  • 28. ROL Des, Count:   It rotates bits of byte or word left, by count.   MSB is transferred to LSB and also to CF.   If the number of bits desired to be shifted is 1, then the  immediate number 1 can be written in Count.  However, if the number of bits to be shifted is more than 1, then the count is put in CL register.
  • 29. ROR Des, Count:   It rotates bits of byte or word right, by count.   LSB is transferred to MSB and also to CF.   If the number of bits desired to be shifted is 1, then the  immediate number 1 can be written in Count.   However, if the number of bits to be shifted is more than  1, then the count is put in CL register.
  • 30. RCL Des,count:  RCL (rotate carry left) shifts each bit to the left  Copies the Carry flag to the least significant bit  Copies the most significant bit to the Carry flag CF
  • 31. RCR Des,count:  RCR (rotate carry right) shifts each bit to the right  Copies the Carry flag to the most significant bit  Copies the least significant bit to the Carry flag
  • 32. String in assembly language is just a sequentially  stored bytes or words.  There are very strong set of string instructions in 8086.  Instructions are available to move, compare scan for given value & move string elements to & from the accumulator.  By using these string instructions, the size of the program is considerably reduced.
  • 33. CMPS Des, Src:   It compares the string bytes or words.  SCAS String:   It scans a string.   It compares the String with byte in AL or with word in AX.  MOVS / MOVSB / MOVSW:   It causes moving of byte or word from one string to another.   In this instruction, the source string is in Data Segment  and destination string is in Extra Segment.   SI and DI store the offset values for source and destination index.
  • 34. REP (Repeat):   This is an instruction prefix.   It causes the repetition of the instruction until CX becomes zero.   E.g.: REP MOVSB STR1, STR2   It copies byte by byte contents.   REP repeats the operation MOVSB until CX becomes zero.
  • 35. These instructions cause change in the sequence of the execution of instruction.  This change can be through a condition or sometimes unconditional.  The conditions are represented by flags.  Four groups of program transfer instructions are: 1) Unconditional transfer 2) Conditional transfer 3) Iteration control 4) Interrupt
  • 36. CALL Des:   This instruction is used to call a subroutine or function or procedure.   The address of next instruction after CALL is saved onto stack.  RET:   It returns the control from procedure to calling program.   Every CALL instruction should have a RET.  JMP Des:   This instruction is used for unconditional jump from  one place to another
  • 37. These instructions depend on the state of CPU flags  If the condition is true then the control is transferred to target specified by signed 8-bit displacement.  If condition is false then control passes to the next instruction after jump.
  • 38. Mnemon Operation Flag ic tested JC Jump if carry CF=1 JNC Jump if no carry CF=0 JZ/JE Jump if zero ZF=1 JNZ/JNE Jump if not zero ZF=0 JS Jump if sign or negative SF=1 JNS Jump if positive SF=0 JP/JPE Jump if parity is even PF=1 JNP/JPO Jump if parity is odd PF=0 JO Jump if overflow OF=1 JNO Jump if no overflow OF=0 JA/JNBE Jump if above/if neither bellow nor equal CF=0 JAE/JNB Jump if above or equal/if not bellow CF=0 JB/JNAE Jump if bellow/if neither equal nor above CF=1
  • 39. JBE/JNA Jump if bellow or equal/if not CF=1 OR ZF=1 above JG/JNLE Jump if greater/if neither less nor [CF=OF] OR ZF=0 equal JGE/JNL Jump if greater or equal/if not less SF=OF=1 JL/JNGE Jump if less/if neither greater nor SF NOT EQUAL TO equal OF JLE/JNG Jump if less or equal/if notgreater ZF=1
  • 40. Loop Des:   This is a looping instruction.   The number of times looping is required is placed in the  CX register.   With each iteration, the contents of CX are  decremented.   ZF is checked whether to loop again or not.
  • 41. INT type  This instruction calls a far procedure. i.e. request a service from OS or from hardware initiated interrupts.  The type in the instruction refers to ano. Between 0 & 255, which identifies the interrupt.  Eg: INT 35  INTO  This generates a interrupt if OF=1; otherwise control proceeds to next instruction in any interrupt procedure.  IRET  This instruction returns the control to the main program.
  • 42. These instructions control the processor itself.  8086 allows to control certain control flags that:  causes the processing in a certain direction  processor synchronization if more than one microprocessor attached.
  • 43.  STC:   It sets the carry flag to 1.   CLC:   It clears the carry flag to 0.   CMC:   It complements the carry flag.  STD:   It sets the direction flag to 1.   If it is set, string bytes are accessed from higher memory  address to lower memory address.
  • 44.  CLD:   It clears the direction flag to 0.   If it is reset, the string bytes are accessed from lower  memory address to higher memory address.  CLI:  It resets the interrupt flag to zero.  STI:  It set the IF to one.  HLT:  It will cause the processor to stop fetching & executing instructions & enter a half state.
  • 45. WAIT:  It causes 8086 to enter into an idle condition where no processing is done.  This instruction is used to synchronize the 8086 with external hardware such as 8087 math co-processor.  LOCK:  It allows microprocessor to make sure that another processor does not take the control of system bus while it is in the middle of critical instruction which uses system bus.  ESC:  It is used to pass control to the co-processor.  NOP: (Perform no operation)  It is used to increase the delay of a delay loop
  • 46. Addressing modes specify where an operand is located.  They can specify a constant, a register, or a memory location.  The actual location of an operand is its effective address.  Certain addressing modes allow us to determine the address of an operand dynamically.
  • 47. The 8086 addressing modes can be classified into five groups: 1) Modes for accessing Immediate & Register data 2) Modes for accessing data in memory. 3) Modes for accessing I/O ports. 4) Relative addressing mode 5) Implied addressing mode
  • 48. Modes for accessing Immediate & Register data:  Immediate addressing:  In this mode the data is part of the instruction.  The operand is 8 or 16 bit data.  Eg:  MOV AL,15H  Register addressing:  In this mode data is located in a internal register of 8086.  Eg:  MOV AX, BX
  • 49. Modes for accessing data in memory:  Direct addressing :  In this mode the address of data is given in the instruction.  Eg:  MOV CX,[1234H]  Register indirect :  It uses a register to store the address of the address of the data.  EA resides either in the base register BX or base pointer register BP, & index register can be source index register SI or destination index register DI  Eg: MOV AX,[SI]
  • 50. Based addressing : In this mode tha EA address of the operand is obtained by adding a direct or indirect displacement to the contents of either base register BX or base pointer register BP  Eg:  MOV [BX] + 1234h,AL  EA= BX+ 1234H PA=Segment base : EA  Indexed addressing mode:  In this the EA at the operand is obtained by adding direct or indirect displacement to the the content of SI or DI  Eg:  MOV AL,[SI] + 2000H  EA= SI + 2000H PA= segment base : EA
  • 51. Based Indexed addressing mode:  It is combination of based & indexed addressing mode.  In this mode the EA is computed by adding a base register (BX or BP) , an index register(SI or DI) & displacement.  Eg:  MOV AH,[BX][SI] + 1234H  EA=BX + SI + 1234h  PA=DS:EA
  • 52.  Modes for accessing I/O ports:  Standard I/O uses port addressing modes.  There are two types of this modes: 1) Direct 2) Indirect  Direct port mode:  In this direct port number is used in the instruction.  Port no. are 0 t0 255  Eg:OUT 05H,AL  Indirect Port mode:  Port no. is taken from DX allowing 64K, 8-bit ports or 32K,16 bits ports. Eg:IN AL, DXRelative addressing mode
  • 53. Relative addresing mode:  In this mode the operand is signed 8-bit displacement relative to the PC.  Eg:  JNZ BACK  Implied addresing mode:  Instruction using this mode has no approach.  Eg:  STC
  • 54. The source program is composed of three types of lines: opcode, assemble directive(pseudo opcodes) & the comments.  The opcode create the instruction for the CPU.  Assembler directives give instruction to the assembler.  Comments tells us what the program wants to tell us.  Assembler directives are specific for a particular assembler.  They are used only during the assembly of program & generate machine executable code
  • 55. ASSUME: This directive tell the assembler the name of the logical segment it should use for a specified segment.  DB: This directive is used to declare a byte-type variable or to set aside one or more storage locations of type byte in memory (Define Byte).  DD: This directive is used to declare a variable of type doubleword or to reserve memory locations which can be accessed as type doubleword (Define Doubleword).  DW: This directive is used to tell the assembler to declare a variable of type word or to reserve storage locations of type word in memory.  ENDS: This directive is used with the name of a segment to indicate the end of that logical segment  EQU: It is used to give a name to some value or symbol
  • 56. END: This is put after the last statement of program. It tells the assembler this is the end of the program.  ENDP This directive is used with name procedure to indicate the end of a procedure to tha assembler.  EXTERN:Tells the assembler that the name or lables following the directive are in some other assembly module.  ORG: Originate. The assembler uses a location counter to account for its relative position in data code segment.  MACRO & ENDM-This directive defines the macros in the program.  ENDM is used along with MACRO . It defines the end of the macro
  • 57.  ALP DEVELOPMENT TOOLS  Tools required 1.Editor 2.Assembler 3.Linker 4.Locator 5.Debugger 6.Emulator
  • 58. EDITOR  Allows to create a file containing assemblyprogram  Ex: PC Write, WordStar  It will save program in RAM as it is typed  It backups the file before correcting errors  The file can be save on any drive(floppy/CD/hard drive)  Program should be well formatted  Assembly program should be saved as.ASM file
  • 59. ASSEMBLER  Translates the assembly language mnemonics to binary codes  Displacements of named data items offset oflabels are determined in 1st run  On 2nd run it produce the binary code  Produce object file (.OBJ ) & assembler listfile(.LST )  Errors are put in list file  It generates only offset address and not physical address  Linker or Locator will determine physical address
  • 60. LINKER  Used to combine several .obj files into one large object file  Programs are split into modules  Link file contains the binary code of all combined modules  Also produce the link map file which containsthe address information  Assign only relative address(address startingwith zero)  TASM & MASM produce the linker file with.exe extension  LOCATOR  Is used to assign absolute address
  • 61. DEBUGGER  Can be used to run the program if external hardware are not used  Will load the object file to memory for debugging  It allow you to see the content of registers and memory location  Allows to change the content of register and memory location  Will allow to set a breakpoint  EMULATOR  Used t o run program  Mixture of hardware and software
  • 62. Program Development Algorithm
  • 63. An 8086 assembly language program has five columns namely  Address  Data or code  Labels  Mnemonics  Operands  Comments
  • 64. The address column is used for the address or the offset of a code byte or a data byte  The actual code bytes or data bytes are put in the data or code column  A label is a name which represents an address referred to in a jump or call instruction  Labels are put in the labels column  The operands column contains the registers, memory locations or data acted upon by the instructions  A comments column gives space to describe the function of the instruction for future reference
  • 65. An ALP for addition of X + Y=Z  An ALP for subtraction of Z=X-Y  An ALP for Division of Z=X/Y