From: Ben Peddell User-Agent: Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.1) Gecko/20020826 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp Subject: Re: Inline assembly error References: <84e4e2a9 DOT 0308072140 DOT 47872db2 AT posting DOT google DOT com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Lines: 74 Message-ID: <11lZa.26436$bo1.17360@news-server.bigpond.net.au> Date: Sun, 10 Aug 2003 05:48:45 GMT NNTP-Posting-Host: 144.139.175.169 X-Complaints-To: abuse AT bigpond DOT net DOT au X-Trace: news-server.bigpond.net.au 1060494525 144.139.175.169 (Sun, 10 Aug 2003 15:48:45 EST) NNTP-Posting-Date: Sun, 10 Aug 2003 15:48:45 EST Organization: BigPond Internet Services To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Joel wrote: > One of the SVGA graphics routines I'm making has given me an inline > error message. > What I'm doing is making a routine to call the protected mode verson > of > Function 9 -Set/Get Palette Data > BL = 0 - Set Palette Data / 80H Set Palette Data During Vertical > Retrace > CX = Number of Palette Registers to Update > DX = First of the Palette Registers to Update > ES:EDI = Table of Palette Values > So, here's my routine > unsigned short PM_Palette_Data(unsigned char Flag, unsigned short > PCount, unsigned short FirstPal, unsigned short TableSeg, unsigned > long TableOff) > { > asm("movw %%ax, %%es\n\t" > "call *%0" > : > : "r" (PMPaletteData), OK. This code is to call PMPaletteData. > "b" (Flag), OK. ebx is to be Flag. > "C" (PCount), There is no "C" constraint on the i386. Try the "c" constraint. > "a" (TableSeg), OK. eax is to be TableSeg. You need to save and restore es. > "D" (TableOff) OK. edi is to be TableOff. Where's FirstPal? > ); > } > > And here's the error I get > Error: inconsistent operand constraints in an `asm' > Referring of course, to the "movw %%ax, %%es\n\t" > I'm not sure why this is happening. movw is move word ax and es are > words, although maybe it's confusing es as esi, but then what would I > use to represent ES? > Anyway, I'm still getting use to AT&T style DJGPP extended inline > assembly, so any help is appreciated. Thanks. Perhaps: unsigned short PM_Palette_Data (unsigned char Flag, unsigned short PCount, unsigned short FirstPal, unsigned short TableSeg, unsigned long TableOff){ int retval; asm ( "pushl %%es\n\t" "movw %w0, %%es\n\t" "call *%1\n\t" "popl %%es" : "a" (RetVal) : "r" (TableSeg), "r" (PMPaletteData), "b" (Flag), "c" (PCount), "d" (FirstPal), "D" (TableOff) ); return retval; }