finding circle area help - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

finding circle area help

hi, i have to write code which lets you to input radius and then finds area of the circle. the rasult musn't be only integer so i use quadruple real number variables. then i dont know how to move such variable to microprocessor because all registers are no more than 16bit. Thats my code, please help me to finish it (var3 is 3,14)
ASSUME CS:code, DS:data, SS:sstack


sstack SEGMENT PARA STACK 'STACK'
DB 256 dup (?)
sstekas ENDS


data SEGMENT

msg db 10, 13, "Input radius"
enterp db 10, 13, "$"
maxlength db 255
length db ?
var1 dq 8 dup ('0')
var2 dq ?
var3 dq 19023D70A3D70A3Dh
res_str db 19 dup ('$')
res dd 00000000h

data ENDS

code SEGMENT
start:

mov ax, data
mov ds, ax

mov ax, 02h
int 10h

mov dx, offset msg
mov ah, 9
int 21h

mov dx, offset maxlength
mov ah, 10
int 21h

mov dx, offset enterp
mov ah, 9
int 21h


finit
fld var3
fld var2
fld var1
fst st(1)
fmul st(0), st(1)
fmul st(0), st(2)
fst res
fwait

call res_to_str
call print_res


mov ah, 07h
int 21h

mov ah, 4Ch
int 21h

res_to_str:

push ax
push di
push cx
push dx

xor di, di
xor cx, cx
mov dx, 10
mov ax, res

find_length:
div dl
xor ah, ah
inc cx
cmp al, 0
je res_buf
jmp find_length

res_buf:
mov ax, res
mov di, cx
dec di

mov_to_buf:
div dl
mov res_str[di], ah
dec di
loop mov_to_buf

exit:
pop dx
pop cx
pop di
pop ax

ret

print_res:
push ax
push dx

mov dx, offset res_str
mov ah, 9
int 21h

pop dx
pop ax

ret

code ends
end start
Sign In or Register to comment.