Copies a 4x8-byte sprite to video memory (or screen buffer), assuming that location to be copied is Pixel Line 0 of a character line.
void cpct_drawTileAligned4x8 (void* sprite, void* memory) __z88dk_callee;
(2B HL) sprite | Source Sprite Pointer (32-byte array with 8-bit pixel data) |
(2B DE) memory | Pointer (aligned) to the first byte in video memory where the sprite will be copied. |
call cpct_drawTileAligned4x8_asm
Copies a 4x8-byte sprite from an array with 32 screen pixel format bytes to video memory or a screen buffer. This function is tagged aligned, meaning that the destination byte must be character aligned. Being character aligned means that the 8 lines of the sprite will coincide with the 8 lines of a character line in video memory (or in the screen buffer). For more details about video memory character and pixel lines check table 1 at cpct_drawSprite.
As the 8 lines of the sprite must go to a character line on video memory (or screen buffer), memory destination pointer must point to a the first line (Pixel Line 0) of a character line. If hardware scrolling has not been used, all pixel lines 0 are contained inside one of these 4 ranges:
[ 0xC000 -- 0xC7FF ] | RAM Bank 3 (Default Video Memory Bank) |
[ 0x8000 -- 0x87FF ] | RAM Bank 2 |
[ 0x4000 -- 0x47FF ] | RAM Bank 1 |
[ 0x0000 -- 0x07FF ] | RAM Bank 0 |
All of them have 3 bits in common: bits 5, 4 and 3 are always 0 (xx000xxx). Any address not having all these 3 bits set to 0 does not refer to a Pixel Line 0 and is not considered to be aligned.
This function will just copy bytes, not taking care of colours or transparencies. If you wanted to copy a sprite without erasing the background just check for masked sprites and <cpct_drawMaskedSprite>.
AF, BC, DE, HL
C-bindings | 26 bytes |
ASM-bindings | 22 bytes |
Case | microSecs (us) | CPU Cycles ----------------------------------------- Any | 271 | 1084 ----------------------------------------- Asm saving | -13 | -52 -----------------------------------------