;compiled with FASM
 org 100h
 mov al, 0x13
 int 0x10

la:
 push word 0x07ff6
 pop word es
 mov di,160
 mov ax,0x3636     
 mov cx,32000       
 rep stosw

 add [counter],10
 fld [d]
 fimul [counter]
 fst [c]

 mov word[b],-100
lb:
 mov word[a],720

lc:
 fninit
 fld dword[d]
 fimul word[a]
 fsincos
 fimul word[mul1]
 fld dword[c]
 fadd dword[d]
 fst dword[c]
 fsin 
 fimul word[mul2] ;st0-10*sin(c),st1 cos(licznik), st2=sin(licznik)
 fxch st2 
 fimul word[mul1] 
 fadd st0,st2 ;x
 fst dword[xx] ;x ;st0: 100*sin(licznik)+10*sin(c)=x, st1: cos(licznik)*100=z
 fld dword[pi3]
 fsincos
 fild word[b] ;b*cos(pi3)
 fmul st0,st1
 fild word[b] ;b*sin(pi3)
 fmul st0,st3
 fld st5
 fmul st0,st4  ; z*sin(pi3)
 fld st6
 fmul st0,st4  ;z*cos(pi3)
 fxch st3
 fsub st0,st1  ;y=b*cos(pi3)-z*sin(pi3)
 fld st2
 fadd st0,st4 ;z=b*sin(pi3)+z*cos(pi3)
 fist word[z]
 fiadd word[stala]
 fidiv word[stala]
 fld dword[xx]
 fmul st0,st1
 fist word[x]
 fld st2
 fmul st0,st2
 fist word[y]

 mov ax,word[y]
 add ax,86
 imul ax,320
 add ax,word[x] 
 mov di,ax
 mov ax,word[z]
 add ax,130
 shr al,4
 add al,0x10
 stosb

 dec word[a]
 jnz lc
 inc word[b]
 cmp word[b],100
 jne lb 

 push ds
 push word 0x8000  
 pop word ds       
 xor si,si        
 push word 0xa000   
 pop word es       
 xor di,di        
 mov cx,32000    
 rep movsw      
 pop ds

 xor ax, ax ; exit when ESC pressed
 in al, 0x60
 dec ax 
 jnz la
 ret

counter dw 0
start dd 0.0
d dd 0.0087266
pi3 dd 1.04719
mul1 dw 50
mul2 dw 11
stala dw 320
c dd ?
b dw ?
x dw ?
y dw ?
z dw ?
a dw ?
xx dd ?

