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')
var3 dq 3.14
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 var1
fsqrt
fmul st(0), st(1)
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
Edited by thatsme, 09 January 2010 - 06:36 AM.
code modified


Sign In
Create Account


Back to top









