From: brennan AT news DOT rt66 DOT com (Brennan "The Rev. Bas" Underwood) Newsgroups: comp.os.msdos.djgpp Subject: Re: info, FAQ not enough -> GCC and ASM Date: 12 Mar 1997 15:55:23 -0700 Organization: Acid Brain Lines: 45 Distribution: world Message-ID: <5g7c8r$eop$1@mack.rt66.com> References: <5g1hv1$qtb$1 AT thor DOT atcon DOT com> NNTP-Posting-Host: mack.rt66.com To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp In article <5g1hv1$qtb$1 AT thor DOT atcon DOT com>, SteelGolem wrote: >ok, i've read the info files on doing asm in djgpp, and the faq just >tells me to read the info files. i am still confused on it! > >i understand what the following does: > >asm( "mov %1, %0": "=i(var2)": "i(var1)" ); > >it puts the integer var1 into the integer var2. (right???) >what i don't understand is how you put them in the registers >ax/bx/eax/etc.. is it possible to access the registers? (i know, i know, >its protected mode..) I coulda sworn there's a reference to http://brennan.home.ml.org/djgpp/djgpp_asm.html in the (go hanmhaith) FAQ. >or at least, convert the following borland c function: > >long fixmul( long a, long b ) >{ > long result; > asm mov ax, [a] > asm mov bx, [b] > asm imul ebx > asm shrd eax, edx, 16 > asm mov [result], eax > return result; >} > >this is a fixed point multiplication function.. it returns a long >integer with the lower 8 bits being the fractional part, (x/65536) and >the upper 8 bits being the actual integer. thanks for any help.. I think you mean 16 bits instead of 8 bits there. If so, http://brennan.home.ml.org/programming/fixed.h oughter steer you in the right direction. Brennan -- brennan AT rt66 DOT com | vi rules. Riomhchlaraitheoir| Rasterfarian | -O