PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

PocketHAL backbuffer mem layout

Hello,

When I (for example) write 0x1111FFFF to the backbuffer at position (0,0), it turns out that 0x1111 is the color of the second pixel (position: 1,0) and 0xFFFF is at 0,0.

Is this behaviour universal across all devices, or does it depend on the video memory layout and how the backbuffer is blitted to it?

Maybe Thierry can help as I would imagine he knows the internals of PH ;)
Actually this only seems to be the case if I write a 32-bit value i.e:
Code:
*(uint32_t *)back_buffer->GetPixels() = 0x1111FFFF;


If I write:
Code:

*back_buffer->GetPixels() = 0x1111;
*(back_buffer->GetPixels()+1) = 0xFFFF;


then the first pixel is 0x1111 and the second is 0xFFFF as one would expect.

This doesn't seem to make sense. Anybody got a clue?
It's just the way 32bit numbers are written...

in 0x1111FFFF
The 'FFFF' is the low byte, which will come first in the addressing of the screen, then the high byte of '1111'



[/i]
This is perfectly normal as the PocketPCs address memory in "little endian". So if you write 0x11223344, you end up with 44-33-22-11 in memory. You will get the same thing on all x86 processors.
Ahh ok. Thx!