1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

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