32/64-Bit 80x86 Assembly Language Architecture

Graphics 101 Frame Buffer

When dealing with graphic images there are various parameters defining its geometry.

So now let's use this information in some real code.

#ifdef __cplusplus extern "C" void gfxClrAsm(byte *pDst, uint nStride, uint nWidth, uint nHeight); #endif // Comment this line out for C code #define USE_ASM_GFXCLR // Graphics Clear // // This is a pre-clipped function used to clear a bitmap // pointed to by the destination pointer. // Note: This can be used to clear 8/16/24/32-bit pixels. #ifdef USE_ASM_GFXCLR #define gfxClr gfxClrAsm #else void gfxClr(byte *pDst, uint nStride, uint nWidth, uint nHeight) { do { memset(pDst, 0, nWidth); pDst += nStride; } while (--nHeight); } #endif

Project:

Using what you've learned, try to write the C function above in assembly optimized for your processor.

void gfxClrAsm(byte *pDst, uint nStride, uint nWidth, uint nHeight);

Категории