delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/10/22/15:44:21

From: oak9755 AT silver DOT sdsmt DOT edu (Olav Kindt)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Help with graphics and inline asm please.
Date: 22 Oct 1996 16:32:50 GMT
Organization: South Dakota School of Mines and Technology
Lines: 44
Distribution: world
Message-ID: <54isvi$4p8@news.sdsmt.edu>
References: <01bbc016$d29f7660$88015838 AT peterstb DOT usps DOT gov>
NNTP-Posting-Host: silver.sdsmt.edu
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

B. Peterson (bpeterson AT ntip DOT usps DOT gov) wrote:
: putpixel(int x, int y, int color)
: {
:    short our_global_selector;
:    our_global_selector = _dos_ds;
: 
:    __asm__ __volatile__("
:        movw _our_global_selector, %es\n
:        movl $0xA0000, %edi\n
:        movw _y, %ax\n
:        imulw $320, %ax\n
:        addw _x, %ax\n
:        addw %ax, %di\n
:        movb _color, %al\n
:        stosb"
:        );
: }
: 

Try this:
	movw %0, %%es
	movl $0xa0000, %%edi
	movw %1, %%ax
	imulw $320, %%ax
	addw %2, %%ax
	addw %%ax, %%di	<= shouldn't this be edi
	movb %3, %%al"
	stosb"
	: "g" (our_global_selector) "g" (y) "g" (x) "g" (color)
// These are 0, 1, 2, 3 respectively
	);

I didn't compile this, but i shouldn't be to far away from the truth.

Check out the asm tutorial from the same source you referenced 
in your original posting.

Hope it helps

	
-- 
Olav Kindt		     | email:	oak9755 AT silver DOT sdsmt DOT edu
737 E. Anamosa Street #103   |		xedb_oak AT debet DOT nhh DOT no
Rapid City SD-57701	     | 		MAIL me man.......

- Raw text -


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