Comments: Authenticated sender is From: "George Foot" To: Endlisnis Date: Sat, 22 Aug 1998 22:16:25 +0000 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Re: VESA: hints, clue but no examples Reply-to: george DOT foot AT merton DOT oxford DOT ac DOT uk CC: djgpp AT delorie DOT com Message-Id: Precedence: bulk On 22 Aug 98 at 15:35, Endlisnis wrote: > > anyway...i've got a question about selectors...well, perhaps a couple... i'd have to use _farpokeb do > > access the .....selected memory right?...or movedata(..) to copy a buffer? > > Yes. I've made my own 'setdata' function to use a bunch of _farnspokel calls to quickly write a single > value to a bunch of contiguous locations. For a reasonable number of locations, this would probably be faster if you used an inline assembler routine; push ES, load it with the selector, load EDI with the offset, EAX with the value and ECX with the number of longs, then "rep ; stosl" and finally pop ES back again. Perhaps this: inline void flmemset (int selector, int offset, int value, int num_longs) { asm ( " pushl %%es ; movw %%dx, %%es ; cld ; rep ; stosl ; popl %%es " : : "c" (num_longs), "a" (value), "d" (selector), "D" (offset) : "%ecx", "%edi" ); } In case you don't know, `stosl' stores the 4-byte value in EAX to ES:EDI, increasing EDI by 4 (if the direction flag is clear; `cld' arranges this). `rep ; stosl' does this ECX times. We need to save then restore ES because we're not allowed to clobber it. -- george DOT foot AT merton DOT oxford DOT ac DOT uk