Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .model tiny
- .code
- .386
- org 100h
- start:
- finit
- fild num
- fsin ; cos
- fstsw ax
- sahf
- jnc ssss
- fabs
- mov ah, 02h
- mov dl, '-'
- int 21h
- ssss:
- fld1 ; 1, cos
- fld st(1) ; cos, 1, cos
- fprem ; {cos}, 1, cos
- fsub st(2), st(0) ; {cos}, 1, [cos]
- fxch st(2) ; [cos], 1, {cos}
- xor cx, cx
- mov bp, sp
- push 10
- push 0
- ftst
- fchs
- loop_n:
- fidiv word ptr [bp - 2]
- fxch st(1)
- fld st(1)
- fprem
- fsub st(2), st
- fimul word ptr [bp - 2]
- fistp word ptr [bp - 4]
- inc cx
- push word ptr [bp - 4]
- fxch st(1)
- ftst
- fstsw ax
- sahf
- jnz loop_n
- mov ah, 02h
- loop_r:
- pop dx
- add dl, '0'
- int 21h
- loop loop_r
- fstp st(0)
- fxch st(1)
- ftst
- fstsw ax
- sahf
- jz endd
- mov ah, 02h
- mov dl, '.'
- int 21h
- mov cx, 7
- loop_h:
- fimul word ptr [bp - 2]
- fxch st(1)
- fld st(1)
- fprem
- fsub st(2), st
- fxch st(2)
- fistp word ptr [bp - 4]
- mov ah, 02h
- mov dl, [bp - 4]
- add dl, '0'
- int 21h
- fxch st(1)
- ftst
- fstsw ax
- sahf
- loop loop_h
- endd:
- fstp st(0)
- fstp st(0)
- int 20h
- num dq 4
- end start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement