Mail Archives: djgpp/2002/04/04/04:23:53
Sahab Yazdani <sahaby AT vif DOT com> wrote:
> well I am finding a 640X480 by 8 bit screen (standard mode 0x101), and
> width*height*bitDepth>>3 is 921600 bytes.
No, it isn't. 640*480*8 >> 3 = 640 * 480 = 307200
The number you give is 640*480*3, which would be about correct for a
640x480x24bit mode, but not for an 8 bit one.
> but I don't think that VESA
> gives the actual size of the memory region, and that this *is* the way
> to calculate it).
Actually, VESA doesn't grant that the frame buffer is contiguous in
the way you assume it. It's possible that each scanline of the buffer
consumes more memory than would be necessary to store all the pixels.
That's why the VESA info block gives you two 'scanline widths'. One
is the physical size of the display (640 in the case at hand), the
other is the amount of memory space allocated for it.
I think using movedata() would be a saner method than the nearptr hack
and memcpy(), here.
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.
- Raw text -