From: john Conner Newsgroups: comp.os.msdos.djgpp Subject: Re: Djgpp and Asm Date: Mon, 07 Jul 1997 12:49:33 -0600 Organization: AT&T WorldNet Services Lines: 38 Message-ID: <33C13A3D.5B9A@nowhere.com> References: <33BFE434 DOT 392 AT nowhere DOT com> <5ppsjt$gfs AT ds2 DOT acs DOT ucalgary DOT ca> NNTP-Posting-Host: 207.147.99.150 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Matthew Mastracci wrote: > > On Sun, 6 Jul 1997, john Conner wrote: > > > asm("leal _RAM,%ebp"); /* RAM is a c pointer */ > > > > It crashes every time. I get a gpf or stack fault. > > It works fine if I use esi,edi,ect. Any help? > > Forgive me if I'm wrong, but isn't the proper line: > > asm("leal %ebp,_RAM"); > > Your line is moving the contents of _RAM (undefined at the time, I'm > assuming) to ebp. AT&T syntax is "backwards" (in relation to Intel). > The opcodes act like: > > grammer: [verb] FROM [src] TO [dest] > opcode: [verb] [src], [dest] > ie: movb 5, %eax > > instead of: > > grammer: [verb] TO [dest] FROM [src] > opcode: [verb] [dest], [src] > ie: mov ax, 3 > > AT&T syntax makes a little more sense gramatically (in terms of English), > but for people raised on Intel, it's dang confusing sometimes. ;) > > /\/\att /\/\astracci mmastrac AT acs DOT ucalgary DOT ca > > GCS/GE d- s+:+ a--- C++++ UA P+ L E-- W+ N++ o K+ w+ O M- V > PS++ PE++ Y+ PGP t+++ 5+++ X++ R++ tv+ b+++ DI++++ I > G++ e h r* z? nope, I'm trying to move RAM(yes its defined) to %ebp. Basicly what im trying to do is pass a pointer into an obj asm module that uses %ebp for one of its functions.