हिंदी

Write an assembly language program that multiply two 8 bit hex numbers stored in memory locations 9404H and 9405H. Store the two byte result in consecutive memory locations 9606H begining with lower

Advertisements
Advertisements

प्रश्न

Write an assembly language program that multiply two 8 bit hex numbers stored in memory locations 9404H and 9405H. Store the two byte result in consecutive memory locations 9606H begining with lower order byte.

कोड लेखन
Advertisements

उत्तर

      LXI H, 0000H  ; Initialize HL pair to 0000H (to store result)
      LDA 9404H     ; Load first number into Accumulator
      MOV B, A      ; Move first number to Register B (Multiplicand)
      LDA 9405H     ; Load second number into Accumulator
      MOV C, A      ; Move second number to Register C (Multiplier/Counter)
      LXI D, 0000H  ; Clear DE pair
      MOV E, B      ; Move Multiplicand to Register E for 16-bit addition

LOOP: DAD D         ; Add DE to HL (HL = HL + DE)
      DCR C         ; Decrement the multiplier counter
      JNZ LOOP      ; If C is not zero, repeat addition

      SHLD 9606H    ; Store 16-bit result (L-byte at 9606H, H-byte at 9607H)
      HLT           ; Stop execution
shaalaa.com
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
2025-2026 (March) Official Board Paper
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×