Go4Expert (http://www.go4expert.com/)
-   Assembly Language Programming (ALP) Forum (http://www.go4expert.com/forums/assembly-language-programming-forum/)
-   -   Addition of two 8-bit numbers;sum 8-bit (http://www.go4expert.com/forums/addition-8-bit-numberssum-8-bit-t27535/)

bijnanabikas acharya 4Jan2012 23:47

Addition of two 8-bit numbers;sum 8-bit
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.

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.

INX is used to increment the register pair by 1.

All times are GMT +5.5. The time now is 21:05.