8085 Programming : Adding 2 Hexa-Decimal nos with carry

8085 Programming

             LDA 2200H  

             MOV C,A ; Initialize counter  

             LXI H, 2201H ; Initialize pointer  

             SUB A  ; Sum low = 0  

             MOV B,A ; Sumhigh = 0  

BACK:  ADD M ; Sum = sum + data  

             JNC SKIP  

             INR B   ; Add carry to MSB of SUM  

SKIP:    INX H   ; Increment pointer  

            DCR C ; Decrement counter  

            JNZ BACK  ; Check if counter 0 repeat  

            STA 2300H 

            MOV A,B  ; Store lower byte  

            STA 2301H  ; Store higher byte  

            HLT   ; Terminate program execution


Popular posts from this blog

Write a Program to Add two 3x3 Matrix using C

C program for Unit Conversion

Write a Program to Add two 5x5 Matrix using C