Advertisement
Guest User

Untitled

a guest
Dec 14th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     .model tiny
  2.     .code
  3.     .386
  4.     org 100h
  5. start:
  6.     finit
  7.     fild num
  8.     fsin    ; cos
  9.     fstsw ax
  10.     sahf
  11.     jnc ssss
  12.     fabs
  13.     mov ah, 02h
  14.     mov dl, '-'
  15.     int 21h
  16. ssss:
  17.     fld1    ; 1, cos
  18.     fld st(1)   ; cos, 1, cos
  19.     fprem   ; {cos}, 1, cos
  20.     fsub st(2), st(0) ; {cos}, 1, [cos]
  21.     fxch st(2)  ; [cos], 1, {cos}
  22.     xor cx, cx
  23.     mov bp, sp
  24.     push 10
  25.     push 0
  26.     ftst
  27.     fchs
  28. loop_n:
  29.     fidiv word ptr [bp - 2]
  30.     fxch st(1)
  31.     fld st(1)
  32.     fprem
  33.     fsub st(2), st
  34.     fimul word ptr [bp - 2]
  35.     fistp word ptr [bp - 4]
  36.     inc cx
  37.     push word ptr [bp - 4]
  38.     fxch st(1)
  39.     ftst
  40.     fstsw ax
  41.     sahf
  42.     jnz loop_n
  43.     mov ah, 02h
  44. loop_r:  
  45.     pop dx
  46.     add dl, '0'
  47.     int 21h
  48.     loop loop_r
  49. fstp st(0)
  50. fxch st(1)
  51. ftst
  52. fstsw ax
  53. sahf
  54. jz endd
  55. mov ah, 02h
  56. mov dl, '.'
  57. int 21h
  58. mov cx, 7
  59. loop_h:  
  60.     fimul word ptr [bp - 2]
  61.     fxch st(1)
  62.     fld st(1)
  63.     fprem
  64.     fsub st(2), st
  65.     fxch st(2)
  66.     fistp word ptr [bp - 4]
  67.     mov ah, 02h
  68.     mov dl, [bp - 4]
  69.     add dl, '0'
  70.     int 21h
  71.     fxch st(1)
  72.     ftst
  73.     fstsw ax
  74.     sahf
  75.     loop loop_h
  76. endd:
  77.     fstp st(0)
  78.     fstp st(0)
  79. int 20h
  80. num dq 4
  81. end start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement