I'm working on a quick and dirty pi calculating program which takes a command line input of how many passes it should do to generate the aproximation, and I need to convert the dword terminated string into a real8 number for use in my program (I'm suing real8's or most stuff to keep it uniform, I don't care about the extra overhead or anything, this is just a learning experiance)

I'm also getting some "Illegal instruction operands" when trying to use mov  TEMPRUNS,RunsDone and vice versa (Can't push or pop it, and the coprocessor instructions are kinda being used throughout this time)
Both are real8 numbers...
Posted on 2006-06-30 17:36:00 by Bobbias
Are you trying to move data from address to another address (C-like variable assign)? In general, this is not a common mechanism in ASM and you will need to have a register in-between that data transfer.

If I am way off, please excuse my ignorance :) Otherwise...


mov eax,RunsDone
mov TEMPRUNS,eax
Posted on 2006-06-30 19:37:18 by SpooK
Since it is REAL8, you will need to move the high and low DWORDs seperately.



	mov eax, dword ptr 
mov edx, dword ptr
mov dword ptr , eax
mov dword ptr , edx


As for the conversion, why not just use the fild instruction after converting the string to a DWORD? (or have I mis-understood what a "NULL-Terminated DWORD string" is.) If it is a string of DWORDs, then use fild on each.



Ossa
Posted on 2006-06-30 19:41:34 by Ossa
I think he meant null terminated ascii string. I have never heard of dword string before ;).
Posted on 2006-06-30 20:22:57 by roticv

I think he meant null terminated ascii string. I have never heard of dword string before ;).


Perhaps he means a DWORD pointer to Real8 String?
Posted on 2006-06-30 20:28:39 by SpooK
lol, sorry for being way off in my description, it's an ascii string of dwords (ie whenyou make the variable it's in the form of <varName>    DWORD    ?) In any case, getting the command line returns a NULL-terminated string of DWORDS which I then convert into a DWORD (you can't specify a real number as the argument, sinc you can't do partial passes generating PI, lol) but for simplicity's sake later on (partly due to my code, and me being lazy) I'd like to convert the resulting DWORD value into a real8 number representing my DWORD.
Posted on 2006-07-01 00:44:59 by Bobbias
fild
fstp

?
Posted on 2006-07-01 01:27:06 by ti_mo_n
Thank you, that should do exactly what I want... I guess I need a really good list of all the coprocessor instructions...

EDIT; does exactly what I want, but just a quick question: why am I getting unresolved externals in referance to my 2 proc's (Factorial and DoubleFactorial), I have put the prototype at the top of my .asm, fi that makes any difference... I really need more practice coding assembly :/
Posted on 2006-07-01 02:07:56 by Bobbias
Raymond's Page has a lot of information on the coprocessor instructions.
Posted on 2006-07-01 02:25:18 by Synfire