Mail Archives: djgpp/1997/12/28/13:30:34
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 -