From: Matthew Mastracci Newsgroups: comp.os.msdos.djgpp Subject: Re: Djgpp and Asm Date: Sun, 6 Jul 1997 22:50:11 -0600 Organization: The University of Calgary Lines: 35 Message-ID: <5ppsjt$gfs@ds2.acs.ucalgary.ca> References: <33BFE434 DOT 392 AT nowhere DOT com> Reply-To: Matthew Mastracci NNTP-Posting-Host: mmastrac AT acs2 DOT acs DOT ucalgary DOT ca Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII In-Reply-To: <33BFE434.392@nowhere.com> To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk 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?