Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; code c
- ;void calc_coord(int *x_axis, int *y_axis, double theta, int radius)
- ;{
- ; *x_axis = (int)(250-radius*sin(theta));
- ; *y_axis = (int)(250-radius*cos(theta));
- ;};
- ; section .bss
- ; xax: resq 1 ;reserve 1 quad word for for result
- ; yax: resq 1
- section .text
- global _asdf
- _asdf:
- ;prologue
- push ebp
- mov ebp, esp
- ;stack frame:
- ;[ebp] [ebp+4][ebp+8][ebp+12][ebp+16][ebp+24]
- ;[oldEBP][ret] [*x_ax][*y_ax] [theta] [radius]
- fld qword [ebp+16] ;load theta into st0
- fsin ;st0 = sin(theta)
- fld qword [ebp+24]
- fmulp st1, st0 ;st0 = radius*sin(theta) ;fmulp??
- mov eax, 250
- sub esp, 4
- mov [esp], eax
- fild dword [esp]
- fsubp st1, st0 ;st0 = 250 - radius*sin(theta)
- fist dword [ebp+8]
- fld qword [ebp+16] ;load theta into st0
- fcos ;st0 = cos(theta)
- fld qword [ebp+24] ;st0 = radius*cos(theta)
- fmulp st1,st0
- mov eax, 250
- mov [esp], eax
- fild dword [esp]
- add esp, 4
- fsubp st1, st0 ;st0 = 250 - radius*cos(theta)
- fist dword [ebp+12] ;store st0 in c
- ;epilogue
- mov esp, ebp
- pop ebp
- ret
Add Comment
Please, Sign In to add comment