Addition of two 8-bit numbers;sum 8-bit

Discussion in 'Assembly Language Programming (ALP) Forum' started by bijnanabikas acharya, Jan 4, 2012.

  1. bijnanabikas acharya

    bijnanabikas acharya New Member

    Joined:
    Sep 27, 2010
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    student
    Location:
    odisha
    This code is used to add two 8-bit numbers and the sum is also a 8-bit number. here H-L pair is used to store the two numbers. Usually LXI command is used to load immediate 16-bit data in the register pair designated in the operand
    This LXI command is a 3-byte instruction. First byte is used for mnemonics, second byte specifies lower order byte and 3rd byte specifies higher order byte.
    Code:
    Mnemonics       Operands             Comments
    LXI                   H,2501 H             Get address of 1st number in H-L pair.
    MOV                 A,H                     1st number in accumlator.
    INX                   H                        increment content of H-L pair.
    ADD                  M                        Add 1st and 2nd numbers.
    STA                  2503 H                Store sum in 2503 H.
    HLT
    
    INX is used to increment the register pair by 1.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice