Changes
now it's one micro second faster ;-)
AND &X00000011 ;A = X MOD 4
JR Z, NSHIFT ;-> = 0, no shift
SHIFT SRL C ;move bitmask to pixel
DEC A ;loop counter DJNZ JR NZ,SHIFT ;-position
NSHIFT LD A, (CMASK) ;get color mask