हिंदी

Two 16 bit numbers are stored in consecutive memory locations begining with lower order byte A200H and B200H respectively. Add these two numbers and store three byte result starting

Advertisements
Advertisements

प्रश्न

Two 16 bit numbers are stored in consecutive memory locations begining with lower order byte A200H and B200H respectively. Add these two numbers and store three byte result starting from memory location C200H.

कोड लेखन
Advertisements

उत्तर

LHLD A200H    ; Load first 16-bit number into HL pair
XCHG          ; Move it to DE pair
LHLD B200H    ; Load second 16-bit number into HL pair
DAD D         ; Add DE to HL (16-bit addition). Result in HL.
SHLD C200H    ; Store the lower 16 bits of result at C200H & C201H

MVI A, 00H    ; Clear Accumulator to collect carry
ADC A         ; Add carry from DAD operation to Accumulator
STA C202H     ; Store the 3rd byte (Carry) at C202H
HLT           ; Terminate
shaalaa.com
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
2025-2026 (March) Official Board Paper
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×