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
; 4000H = 1BH
mov di, 4000h ; di = 4000h
mov al, 1bh ; al = num1 = 1Bh
mov [di], al ; save num1 in [di]
; 4001H = 3AH
mov di, 4001h ; di = 4001h
mov al, 3ah ; al = num2 = 3Ah
mov [di], al ; save num2 in [di]
mov si, 4000h ; si = 4000h
mov al, [si] ; al = num1 = 1Bh
mov si, 4001h ; si = 4001h
mov cl, [si] ; cl = num2 = 5Ah
; 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