From: broeker AT physik DOT rwth-aachen DOT de Newsgroups: comp.os.msdos.djgpp Subject: Re: External assembly functions and arguments Date: 28 Mar 2000 13:02:16 GMT Organization: Aachen University of Technology (RWTH) Lines: 34 Message-ID: <8bqago$gov$1@nets3.rz.RWTH-Aachen.DE> References: <38DFD269 DOT 9E44A7DD AT hotmail DOT com> NNTP-Posting-Host: acp3bf.physik.rwth-aachen.de X-Trace: nets3.rz.RWTH-Aachen.DE 954248536 17183 137.226.32.75 (28 Mar 2000 13:02:16 GMT) X-Complaints-To: abuse AT rwth-aachen DOT de NNTP-Posting-Date: 28 Mar 2000 13:02:16 GMT Originator: broeker@ To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Heavy wrote: > How do I retrieve the arguments of a function written in external > assembly? I was looking at some assembly source files, and from what I > can piece together, %ebp points to the arguments passed to the function > where 8(%ebp) would be the first argument, 12(%ebp) would be the second > one, etc. However, the function I have written does not seem to want to > work. I just wanted to confirm that this is the way DJGPP does argument > passing in assembler. If you inserted the usual C function lead-in, then that's the way to reference the arguments, yes. Be careful with argument sizes other than 32bits. To be really sure, the usually best way is to make a 'dummy' implementation of the function, in C, that does nothing but access all its arguments, and (if applicable) sets the return value to something. Now, compile that to assembly source with 'gcc -g -S -O0' and you'll have a prototype assembly file you can look into to find out whatever you need to know, for the actual assembly function implementation. > I think that this is related to another problem I am having, the > assembler gives me an error about this line: > mull 36(%ebp), %ebx > It says that the operands don't match any known 386 instruction, which > leads me to believe you cannot have this many arguments... this is pure > speculation however. Don't speculate, look it up. In the i386 technical reference, in this case. You need to check which addressing modes do exist for 'mul', and which don't. -- Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de) Even if all the snow were burnt, ashes would remain.