delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/12/21/12:39:23

Date: Sun, 21 Dec 1997 09:36:27 -0800 (PST)
Message-Id: <199712211736.JAA29451@adit.ap.net>
Mime-Version: 1.0
To: henri DOT ossi AT mail DOT htk DOT fi, djgpp AT delorie DOT com
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: Re: Pixel plotting to a double buffer using inline asm

At 11:15  12/20/1997 +0200, Henri Ossi wrote:
>Hi.
> I've read all kinds of tutorials about graphics and stuff, but they
>allways explain pixel
>plotting directly to screen ram only, and then they start using double
>buffered systems
>with dosmemput etc. functions.
>
> So, I ask you:
>"How can I plot a pixel to a double buffer and then copy it to screen
>using inline asm?"
>(two separate functions)
>My double buffer is a char pointer, (BTW should I use unsigned char?)
>and the graphics mode is 13h.
I'm confused. You say you know about putpixeling directly to video memory,
and you know about blitting (copying large parts of memory to screen). You
can putpixel to your memory array just like any other array access:

char *buffer = malloc(320*200);
*(buffer+42+(17*320)) = 1; /* set pixel at (17,42) to 1 */
dosmemput(buffer,320*200,0xa0000); /* blit to screen */

You mention inline assembly. It's probably not necessary. `dosmemput' will
do just as good a job in most cases, since it's little more than a `rep;
movsl' loop inside.
(Also, `signed' vs. `unsigned' `char' shouldn't matter here, since you
probably don't look at the sign at all.)


Nate Eldredge
eldredge AT ap DOT net



- Raw text -


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