From: "Bart Alewijnse" Newsgroups: comp.os.msdos.djgpp Subject: Re: AT&T style asm problem Date: 18 Jun 1999 20:01:47 GMT Organization: WorldOnline News server Lines: 54 Message-ID: <01beb9c5$e8885fe0$eab2f1c3@scarfboy.tip.nl> References: <01beb90f$e47e8f20$d1b2f1c3 AT scarfboy DOT tip DOT nl> <37698C10 DOT 1EA863E2 AT cartsys DOT com> <01beb9a0$5cbdc880$LocalHost AT scarfboy DOT tip DOT nl> <376AA084 DOT C3776B20 AT cartsys DOT com> NNTP-Posting-Host: vp178-234.worldonline.nl X-Trace: news.worldonline.nl 929736107 21887 195.241.178.234 (18 Jun 1999 20:01:47 GMT) X-Complaints-To: abuse AT worldonline DOT nl NNTP-Posting-Date: 18 Jun 1999 20:01:47 GMT X-Newsreader: Microsoft Internet News 4.70.1155 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com > > > > Okay.. I'm modifying a sprite compiler for use in djgpp, and I dunno > > how to do the following. > > > > > > > > I currently have > > > > fprintf(outfile," \"movb 0x%02X, 0x%X(%%%%edi,,)\\n\\t\" \n", byte1, > > > > offset); > > > > > > > > that's in my C code. (extended asm, and the four %'s become two in the > > > > file that's written to.)That resoves to > > > > "movb 0x12, 0x11D3(%%edi,,) \n\t" > > > > > > > > The idea and the problem is the > > > > immed32(basepointer,indexpointer,indexscale) > > > > format. [more stuff] > > > The effective address for `disp(base,index,scale)' is > > > > > > disp + base + (index * scale) > > > > > > Where disp is a constant, base and index are registers, and scale is the > > > number 1, 2, 4 or (I think) 8. (You don't need the $ delimiter in a > > > memory operand.) > > > > > > Any of these can be omitted, and you need not include the delimiters for > > > omitted ones if they are at the end. So: > > > > > > disp > > > (base) > > > disp(base) > > > disp(base,index) # scale assumed to be 1 > > > > > > > > AAAAAAAAAAAAARGH!!!! I just realized a big mistake. The $. > > The bloody $. Okay. "movb $0x1e, $0x604c(%%edi) \n\t" > > Still no go. Same problem. As with your second solution, > > and your third. You want the source code with this? > > No $ in the second one. > > movb $0x1e, 0x604c(%%edi) > > The $ is only used for an immediate operand which stands alone. Yup. Thanx. I was getting really frustrated... It makes sense, but it's one of those things a newbie doesn't dream up, and the people that write the faqs don't always think of... -Bart