I want to calculate this perimeter expression
(hight * 2) + (width * 2)
example:
Enter hight: 3
Enter width: 2
perimeter is : 10
Enter hight: 1
Enter width: 1
perimeter is : 4
.model small
cr equ 0Dh
lf equ 0Ah
.data
msg1 db cr,lf,'Enter hight: $'
msg2 db cr,lf,'Enter width: $'
msg3 db cr,lf,'perimeter is : $'
.stack 100h
.code
main proc
mov ax,@data
mov ds,ax
lea dx,msg1
mov ah,9h
int 21h
mov ah,1h
int 21h
sub al,30h
mov cl,2
mul cl
mov bx,ax
mov ax,@data
mov ds,ax
lea dx,msg2
mov ah,9h
int 21h
mov ah,1h
int 21h
sub al,30h
mov cl,2
mul cl
mov cx,ax
mov ax,@data
mov ds,ax
lea dx,msg3
mov ah,9h
int 21h
add cx,bx
mov ah,2h
int 21h
mov ah,4ch
int 21h
main endp
end main
My code does not give the correct result. How can I fix my code?