www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/12/28/13:30:34

From: Henri Ossi <henri DOT ossi AT mail DOT htk DOT fi>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Pixel plotting to a double buffer using inline asm
Date: Mon, 22 Dec 1997 12:21:56 +0200
Organization: Telecom Finland News Service
Lines: 89
Message-ID: <349E3F44.2ED8615A@mail.htk.fi>
References: <199712211736 DOT JAA29451 AT adit DOT ap DOT net>
Reply-To: henri DOT ossi AT mail DOT htk DOT fi
NNTP-Posting-Host: pc2038.public.htk.fi
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Nate Eldredge wrote:

> 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

This isn't the answer I wanted. I need the inline asm examples, so I can
plot pixels to the bufferin my asm code. (And IF possible, blit the
dblbuf to the screen)

 I just want to know, how I point to a part of the memory, which I get,
when I add the x,y offset
to the offset, that dblbuf points?

movl $1, dblbuf[(y*xsize)+x]  ; how is the destination part done in asm?

Or is it even possible to just movl to the dblbuf?
Should I use stosb? I'm quite confused :)

It doesn't matter, if I have to use registers to store the counted
offset...please, send me some examples.

And another thing:
Could you tell me, how I get this code work?

#define rep_movsl(src, dest, numwords) \
__asm__ __volatile__ ( \
  "cld\n\t" \
  "rep\n\t" \
  "movsl" \
  : : "S" (src), "D" (dest), "c" (numwords) \
  : "%ecx", "%esi", "%edi" )

If I try to call:
rep_movsl(dblbuf,0xa0000, sizeof(dblbuf));

Djgpp exits and gives an error.
The thing I don't understand here is, why we don't give the selector
_dos_ds anywhere?
I know, that if I want to access the screen mem, I have to use _dos_ds,
because
with 0xa0000, I only have the right pointer, and not the right selector,
am I right?
But how does the movsl -opcode work? I guess the dblbuf also has its own
selector?
Is it _dos_ds or the selector, where my actual code is?
(sorry for my bad english...I hope you understood my problem)


Thanks for reading.

-Henri Ossi


- Raw text -


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