Mail Archives: djgpp/1996/10/20/22:22:11
Mohan Khurana (mohan AT stealth DOT net) wrote:
: Lets say I wanted to fill an area of the screen. Under something like
: Borland C, I would just use
:
: memset(0xA000, 15, 0xffff)
:
: right?
:
: This doesn't seem to work in DJGPP. I was thinking about setting each
: pixel individually in a for loop using _farnspokeb, but this is slow.
: Is there a better way? I want to set chunks of data to a certain
: value. I checked farptr.h, but there wasn't really much documentation
: in the file. I also checked the info documentation and the
: information about far pointers, but the information on the individual
: functions wasn't very helpful.
If you don't mind using near pointers, you could snag the rep_stosl
asm macro from http://brennan.home.ml.org/djgpp/djgpp_asm.html.
It would also be trivial to modify it to set %es, farptr style.
Hell, I'll do that right now:
#define rep_stosl(value, dest, numwords, seg) \
__asm__ __volatile__ ( \
"pushw %%es\n\t" \
"movw %%bx, %%es\n\t" \
"cld\n\t" \
"rep\n\t" \
"stosl\n\t" \
"popw %%es"
: : "a" (value), "D" (dest), "c" (numwords), "b" (seg) \
: "%ecx", "%edi" )
Notice you must fill it a 4-byte longword at a time.
You would call it like this:
rep_stosl(0, 0xa0000, 320*200/4, _dos_ds);
to clear a mode 0x13 VGA screen.
I'm pretty sure that'll work, but caveat emptor.
--Brennan
--
brennan AT rt66 DOT com | Personal Goal #67: Drag Carmack and win.
|
Rasterfarian | <http://brennan.home.ml.org>
- Raw text -