Write an assembly program for multiplication of two eight bit no. at 4000H=1BH and
4001H=3AH and save result at 4002H and 4003H.
; 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
Comments
Leave a comment