PocketMatrix forums

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

Is it safe to write outside of the screen area?

What I'd like to do is have an off-screen buffer to reduce flicker. For iPAQ and Jornada this should be fine, just make a 240x320x2 buffer and memcpy it in - being careful to start from the lowest corner address.
(4-5ms?)

However for "CASSIOPEIA E700" I've noticed the line pitch is 512 not 480. Is it be safe to create a 512x320 buffer and memcpy it in? Would the extra 32 byte overwrite something important/crash the machine?
As far as I know, this works on my Casio E-125... I haven't had the time yet to compare the performances between using a full 512x320 memcpy() vs multiple 480 bytes memcpy()s. But there is no need: the Casio E-125 already provides a backbuffer so there is no need to create one of your own.
Hi,

I actually tested the performance on my E115 (512x320 compared to 480x320) and 480x320 was faster. The overhead of each memcpy is less than the time it takes to read/write those few extra bits.

I would also discourage writing to bits in memory you should not write to, since it may not work on the XScale once they fix the display driver (the ATI chip is capable of real page flipping double buffer which means extreme performance once they get it fixed). On Stationary PCs the extra data is often used as cache by the display driver, and I would assume that the ATI chip in the XScale could work in a similar way.

/Johan
Has anyone disassembled memcpy to see how it runs so fast and whether it can be inproved upon?
I get about 4 milliseconds to copy the whole screen, very nice.
I'm thinking it probably checks for dword alignment and if it finds it does ldr and str to copy 4-bytes at a time, possibly with an unwrapped loop.

How would I go about disassembling memcpy by the way? Is there a way to use the Visual C++ style debugger?
You can actually find the source to memcpy if you dig a bit. There's also some source on the web you can dig up (I forgot all the URLs). And yep, that's the way it works..

I used the same principle in my fill blit routines in GapiDraw, allowing me to achieve the same performance when filling a memory area with a 16-bit color as I would have got if I just cleared it.

/Johan
dumpbin /DISASM
In modern compilers, memcpy() is usually an intrinsic function. This means that it is automatically inlined to the most efficient sequence of instructions. This usually only happen when the number of bytes is fixed. If you are copying an arbitrary number of bytes, the runtime library will be used.

Ex:

memcpy( dest, src, 480 ) --> intrinsic version used

memcpy( dest, src, pitch*2 ) --> function call to the library
>In modern compilers, memcpy() is usually an intrinsic function. This means that it is automatically inlined to the most efficient sequence of instructions.

I know and I had become so used to Vis C inlining with rep movsd instructions that I was shocked to look at the assembler output and find... yep you guessed it, and mere bl memcpy!!

Sad but true. Is there a _memcpy or something which eVC can inline?