🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: maus.lang.c
Article #2

Re: PutPixel

#2
From: Herman Dullink
Date: Mon, 11 Sep 1995 09:49
36 lines
1677 bytes
>Hi...
Ah, an English word, too bad the rest aren't...

>Ich suche die schnellste Moeglichkeit in Turbo C++ 3.0 mit einer  
>aufzurufenden Funktion einen Punkt auf den Bildschirm zu bringen.
Most overhead is the call to the plot routines. To really speed things
up, you should use a macro (#define) instead of a function.

>(VGA-Modus 13h, also 320x200x256)
>Diese darf auch gerne Inline-ASM benutzen. Sie sollte nur schneller sein  
>als alle anderen.
A putpixel routine is sooo simple, inline assembly won't do much good.
All you can do is a faster 'multiply'.

>char *ScreenAddr = (char*)0xA0000000;
>
>void drawxy(int x,int y,char color)
>{
>  *(ScreenAddr+320*y+x) = color;
>}
320*y = (y << 8) + (y << 6) =>

{
  *(ScreenAddr+(y << 8) + (y << 6) + x) = color;
}

or better

#define drawxy(x,y,c) {*(ScreenAddr + (y << 8) + (y << 6) + x) = color;}

Of course, with multiple pixel primitives (lines, circles, polygons) inline
assembly _can_ make a difference.

Another tip; NEVER user the drawxy primitive to draw lines, circles, etc..

Herman
Technical Details
Message-ID: <DEqJAF.IL@rug.nl>
Path: arc1-ca.pugleaf.net!rug.nl!root
References: <5tQJ7Qt71rB@mpware.m-night.domino.de>

Show Full Headers
Complete Article Headers
Newsgroups: maus.lang.c,de.comp.lang.c++,de.comp.lang.c,comp.lang.asm.x86
Path: arc1-ca.pugleaf.net!rug.nl!root
From: Herman Dullink <csg669>
Subject: Re: PutPixel
Content-Type: text/plain; charset=us-ascii
Message-ID: <DEqJAF.IL@rug.nl>
To: MAGICIAN@m-night.domino.de
Sender: root@rug.nl (Operator)
Nntp-Posting-Host: rug103.cs.rug.nl
Content-Transfer-Encoding: 7bit
Organization: RuG
References: <5tQJ7Qt71rB@mpware.m-night.domino.de>
Mime-Version: 1.0
Date: Mon, 11 Sep 1995 09:49:26 GMT
X-Mailer: Mozilla 1.1N (X11; I; HP-UX A.09.01 9000/735)
X-Url: news:5tQJ7Qt71rB@mpware.m-night.domino.de