I am new to Assmbly language and I'm practicing for future use. I've tried a lot of ways, read a lot of articles and a lot of examples but I just can't compute the surface area properly also the output is not the output I wanted. Here's my code. The formula for surface area of Polygon is S = (2 × Base Area) + (Base perimeter × height)
data segment
string0 db 10,13,'SURFACE AREA OF POLYGON CALCULATOR$'
string1 db 10,13,'ENTER BASE AREA OF POLYGON: $'
string2 db 10,13,'ENTER HEIGHT OF POLYGON: $'
string02 db 10,13,'ENTER BASE PERIMETER OF POLYGON: $'
string3 db 10,13,'RESULT: $'
val1 db ?
base db ?
height db ?
perimeter db ?
BaseArea db ?
ends
code segment
assume ds:data, cs:code
start:
mov ax,data ; mov data to register
mov ds,ax
lea dx,string0 ;display data on data segment
mov ah,9
int 21h
lea dx, string1 ;display data on data segment
mov ah, 9
int 21h
mov ah,01h ;user input
int 21h
sub al,'0'
mov val1,al
mov base,al ;move al->base
aam
add ah,30h
add al,30h
mov bx,ax
lea dx, string2
mov ah, 9
int 21h
mov ah,01h
int 21h
sub al,'0'
mov height,al ;move al->hgt(height) for multiplication
mul base ;multiply hgt x base
mov res,al ; move al,res
aam
add ah,30h
add al,30h
mov bx,ax
mov al,sqr ;move stored data in sqr->al for addition
add res,al ;add al + res
aaa
add ah,30h
add al,30h
mov bx,ax
lea dx, string3 ;display string
mov ah,9
int 21h
add dl,'0'
mov ah,2
mov dl,bh
int 21h
add dl,'0'
mov ah,2
mov dl,bl
int 21h
add dx,'0'
mov ah,2
mov dx,bx
int 21h
mov ah, 4ch
int 21h
ends
end start
sample input: 6,3
output: >C