Copies a 2x4-byte sprite to video memory (or screen buffer), assuming that location to be copied is in Pixel Lines 0-3 of a character line.
void cpct_drawTileAligned2x4_f (void* sprite, void* memory) __z88dk_callee;
(2B HL) sprite | Source Sprite Pointer (8-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_drawTileAligned2x4_f_asm
Copies a 2x4-byte sprite from an array with 8 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 4 lines of the sprite need to be withing the 8 lines of a character line in video memory (or in any screen buffer). For more details about video memory character and pixel lines check table 1 at cpct_drawSprite.
As the 4 lines of the sprite must be inside a character line on video memory (or screen buffer), memory destination pointer must point to any of the first 4 lines (Pixel Lines 0 to 3) of a character line. If hardware scrolling has not been used, all pixel lines 0-3 are contained inside one of these 4 ranges:
[ 0xC000 -- 0xDFFF ] | RAM Bank 3 (Default Video Memory Bank) |
[ 0x8000 -- 0x9FFF ] | RAM Bank 2 |
[ 0x4000 -- 0x5FFF ] | RAM Bank 1 |
[ 0x0000 -- 0x1FFF ] | RAM Bank 0 |
All of them have 1 bit in common: bit 5 is always 0 (xx0xxxxx). Any address not having this bit set to 0 will refer to Pixel Lines 4-7 in any given Character Line, and are 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 | 37 bytes |
ASM-bindings | 33 bytes |
Case | microSecs (us) | CPU Cycles ----------------------------------------- Any | 72 | 288 ----------------------------------------- Asm saving | -13 | -52 -----------------------------------------