Quote (chubbycakez @ Nov 3 2015 11:21pm)
mov eax, 3
add eax, 2
depending where you want me to store it:
if eax, just leave it
if ebx, then simply (mov ebx,eax)
i understand some parts of it, but not all of it. right now we are doing floating point. i cant understand it. although i understand the fact that the stacks are kind of set up like a revolver when loading and storing values
the stack is a stack
what really helped me with the floating point stuff was always putting a comment next to each instruction showing what the stack would contain at that point
I still have some on my HDD lol
Code
push ebx
call exp ;ToS = x^n
fst Q[t_i] ; t_i = x^n
fld1
fld1
fadd ; ToS = 2, x^n
push ebx
call exp ; ToS = 2^n, x^n
push ebx
call fact ; eax = n!
mov [tmp_sto], eax
fild Q[tmp_sto] ; ToS = n!, 2^n, x^n
fmul ; ToS = n! * 2^n, x^n
fdiv ; ToS = t0 case (x^n / (n! * 2^n))
fst Q[result]
fstp Q[t_i] ; ToS = empty, result = t_i = t0
.loop
finit
fld Q[x_val]
fld Q[x_val]
fmul ; ToS = x^2
mov eax, 4
mov [tmp_sto], eax
fild Q[tmp_sto] ; ToS = 4, x^2
mov [tmp_sto], ecx
fild Q[tmp_sto] ; ToS = i, 4, x^2
fmul ; ToS = 4*i, x^2
mov [tmp_sto], ebx
fild Q[tmp_sto] ; ToS = n, 4*i, x^2
mov [tmp_sto], ecx
fild Q[tmp_sto] ; ToS = i, n, 4*i, x^2
fadd ; ToS = (n+i), 4*i, x^2
fmul ; ToS = (4*i)*(n+i), x^2
fdiv ; ToS = x^2 / (4*i*(n+i))
fld Q[t_i] ; ToS = t_(i-1), x^2 / (4*i*(n+i)))
fmul ; ToS = t_i
fchs ; ToS = -(t_i)
fst Q[t_i]
fld Q[result]
fadd ; ToS = current result
fstp Q[result] ; ToS = empty
inc ecx