English

Write an Assembly Language Program to multiply two one byte data stored at memory location CO60H and CO61H. Store the two byte result starting with memory location CO62H. - Computer Science 2

Advertisements
Advertisements

Question

Write an Assembly Language Program to multiply two one byte data stored at memory location CO60H and CO61H. Store the two byte result starting with memory location CO62H.

Code Writing
Advertisements

Solution

LABEL       MNEMONICS            COMMENTS

START:  LXI H, 0000H   ; Set initial product = 0 in HL pair
        LDA C060H      ; Load first number (N1) into Accumulator
        MOV E, A       ; Move N1 to register E
        MVI D, 00H     ; Clear register D (DE now contains 00N1)
        LDA C061H      ; Load second number (N2) into Accumulator

LOOP:   DAD D          ; Add DE to HL (Product = Product + N1)
        DCR A          ; Decrement N2 (Counter)
        JNZ LOOP       ; If N2 is not zero, repeat addition

END:    SHLD C062H     ; Store 16-bit result at C062H and C063H
        HLT            ; Stop the program
shaalaa.com
  Is there an error in this question or solution?
2023-2024 (July) Official Board Paper
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×