Mail Archives: djgpp/1998/07/28/01:56:09
Martin Peach wrote:
>
> Hi all,
> I want to dump the screen image to a file for debugging purposes. I
> have set up a linear buffer in the way Shawn Hargreaves describes on
> the delorie website. I have no problem accessing the data via a line
> buffer I allocate, using movedata(linBufSelector, i, _my_ds,
> (int)lineBuf, lineBytes). But I want it to go faster...it seems as
> though I could just do a fwrite((void *)linBufMapping.address + i,
> lineBytes, 1L, fp) to write the data directly to a file rather than
> going through an intermediate line buffer. But the thing crashes when
> I use linBufMapping.address (which is 0xE0000000, a reasonable looking
> address, no?). Is there some other call I need to make to point the
> thing to the right place or does fwrite not work on this kind of
> address?
> Martin.
Think about it. The fact that you need a special selector implies that
the LFB lives in another segment than the rest of your program.
However, the pointers that are thrown about in your program are assumed
to be relative to the DS segment (because they're all near pointers).
Thus, passing the LFB's address relative to its segment won't work.
You may be able to use the nearptr hack (see FAQ section 18.6) in this
case, which allows the DS segment to cover all of memory. This,
however, has its own dangers.
Surely the comparatively enormous overhead of writing to the file will
cause the memory move to be lost in the noise, so this probably isn't
even worth it. If you see more than about a 1% speedup, I'll be rather
surprised.
[sniped]
--
Nate Eldredge
nate AT cartsys DOT com
- Raw text -