www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/07/31/11:00:46

Xref: news2.mv.net comp.os.msdos.djgpp:6615
From: dbarrett AT srvr1 DOT engin DOT umich DOT edu (David M Barrett)
Newsgroups: comp.os.msdos.djgpp
Subject: Inline ASM : "Error: operands given ..."
Date: 30 Jul 1996 19:33:26 GMT
Organization: University of Michigan Engineering, Ann Arbor
Lines: 62
Message-ID: <4tlo26$8cb@srvr1.engin.umich.edu>
NNTP-Posting-Host: blazers.engin.umich.edu
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I've got some inline assembly that I just can't get to work.  It's a 
simple routine to move an offscreen buffer onto the screen.  But, when I 
try to compile it I get an "Error: operands given don't match any known 
386 instruction" with a line number that doesn't coorespond to any line 
in my C code (I have 120 lines of C code and the error is on line 140 and 
148).  So, I did a "gcc -S vga13h.c" and looked at lines 140 and 148, but 
there was nothing fancy going on there.  I've looked over it with a 
couple of friends and we are all stumped.  Could someone please help 
out?  Here's the code:  I've made arrows pointing to the lines that could 
be associated with the line numbers (when compiled with -S option) that 
have the errors.  Thanks!  (Oh, and I've noticed that my algorithm is 
messed up; I should add 320-Buffer width instead of 320 to the line, but 
that isn't causing me the errors).

-David :)

// -- VGA_Mode_13h_Normal_Blit_Video_Buffer --
// This draws a Video_Buffer to the screen without any filters (ie, no
// transparency, translucency, etc) or clipping
// In: *In_Buf - pointer to the Video_Buffer to draw
//      X,Y - location to put the buffer on the screen
// Out: none
// Returns: none
void VGA_Mode_13h_Normal_Blit_Video_Buffer(Video_Buffer *In_Buf,
					   U16 X, U16 Y){
U8 *Data_Ptr;
U16 A,B;

	ASM("                                   \n
		pushw %%es                      \n 
		movw _our_global_selector, %%es \n 
--------------> movw %%es, %%ds                 \n 
		movl $0xA0000, %%edi            \n 
		imulw $320, %%ax                \n 
		addw %%bx, %%ax                 \n 
--------------> addw %%ax, %%edi                \n 
		next_line:                      \n
			pushw   %%cx            \n 
			movw    %%dx, %%cx      \n 
			rep                     \n 
			movsb                   \n 
			pop %%cx                \n 
			addw $320, %%edi        \n 
			loop next_lineb         \n 
		popw %%es                       \n 
	    "
	    :
	    : "a" (Y),
	      "b" (X),
	      "c" (In_Buf->Dimensions.Y),
	      "d" (In_Buf->Dimensions.X),
	      "S" (In_Buf->Data));
	      

}


--
-----------------------------------------------------------------------------
 David M. Barrett :)         |     University of Michigan / CAEN Hotline
 dbarrett AT engin DOT umich DOT edu    | http://www-personal.engin.umich.edu/~dbarrett
-----------------------------------------------------------------------------

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019