delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/07/11/16:01:43

Xref: news2.mv.net comp.os.msdos.djgpp:5879
From: korpela AT islay DOT ssl DOT berkeley DOT edu (Eric J. Korpela)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Setpixel in AT&T inline asm....
Date: 11 Jul 1996 18:54:21 GMT
Organization: Cal Berkeley-- Space Sciences Lab
Lines: 37
Message-ID: <4s3ikt$ano@agate.berkeley.edu>
References: <4rh0g5$m9r AT twain DOT mo DOT net> <4rj0kb$sf3 AT nef DOT ens DOT fr>
NNTP-Posting-Host: islay.ssl.berkeley.edu
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In article <4rj0kb$sf3 AT nef DOT ens DOT fr>,
Pascal Massimino <massimin AT clipper DOT ens DOT fr> wrote:
>In article <4rh0g5$m9r AT twain DOT mo DOT net>, vecna AT Walden DOT mo DOT net ([vecna]) writes:
>|> I'm trying to write a simple putpixel to
>|> a 320x200 virtual screen, which is already allocated and defined as:
>|> 
>|> char *virscr;
>|> 
>|> This is my (yes, unoptimized) setpixel routine:
>|> 
>	movl _y,%eax
>	imull $320,%eax
>	addl _x,%eax
>	movb _c,%cl
>	addl _virscr,%eax
>	movb %cl,(%eax)

how about....

  lookup_table[y][x]=c;

where lookup_table is initialized at startup to...

char **lookup_table
for (i=0;i<200;i++) {
  lookup_table[i]=virscr+i*320;
}

It's bound to be faster than an imull.

Eric

-- 
Eric Korpela                        |  An object at rest can never be
korpela AT ssl DOT berkeley DOT edu            |  stopped.
<a href="http://www.cs.indiana.edu/finger/mofo.ssl.berkeley.edu/korpela/w">
Click here for more info.</a>

- Raw text -


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