Answer to Question #162626 in Assembler for passout

Question #162626

Write an assembly program for multiplication of two eight bit no. at 4000H=1BH and  4001H=3AH and save result at 4002H and 4003H.


1
Expert's answer
2021-02-15T14:51:54-0500

; DosBox

DATA SEGMENT

DATA ENDS

 

CODE SEGMENT

ASSUME DS:DATA,CS:CODE

START:

    MOV AX, DATA

    MOV DS, AX

 

; save 1BH at 4000H

    mov di, 4000h          ; di = 4000h

    mov al, 1bh               ; num1 = 1Bh

    mov [di], al                ; save num1 in [di]

 

; save 3AH at 4001H

    mov di, 4001h         ; di = 4001h

    mov al, 3ah              ; num2 = 3Ah

    mov [di], al               ; save num2 in [di]

 

    mov si, 4000h         ; si = 4000h

    mov al, [si]               ; num1 = 1Bh

    mov si, 4001h          ; si = 4001h

    mov cl, [si]               ; num2 = 5Ah

 

; result = num1*num2

    mul  cl                       ; ax = al*cl = num1*num2

    mov di, 4002h         ; di = 4002h

    mov [di], ax             ; save result at 4002h and 4003h

 

EXIT_PROG:                ; Program is terminated

    MOV AH, 4CH

    INT 21H

 

CODE ENDS

END START


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS