Advertisements
Advertisements
प्रश्न
Write an Assembly Language Program to add two 16-bit numbers. The first 16-bit number is stored from memory location CO40H and CO41H. The second 16-bit number is stored from memory location CO42H and CO43H. Store the three byte result starting from memory location CO50H.
कोड लेखन
Advertisements
उत्तर
Label Mnemonics Comments
MVI A, 00H ; Clear Accumulator to store Carry
LHLD C040H ; Load first 16-bit number into HL
XCHG ; Move first number to DE pair
LHLD C042H ; Load second 16-bit number into HL
DAD D ; Add DE to HL (Result in HL, Carry in CY flag)
JNC next ; If no carry, skip increment
INR A ; If carry generated, set A = 01H
next: SHLD C050H ; Store 16-bit sum at C050H and C051H
STA C052H ; Store carry (from A) at C052H
HLT ; Stop programshaalaa.com
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
