About the mask
ZXNet echo conference «code.zx»
From Slavik Tretiak → To All 22 February 2006
Hello, Soplik
depending on how you define it.
If you unlock the sprite pin in advance, you can speed it up a lot.
and if you display the sprite according to location, taking from the sign “by mask” or “not by
mask" it might become slower.
actually it makes sense if the sprites are large enough and the places are not in the mask
more than "by mask"
From Victor Ivanov → To All 22 February 2006
Hello, All
How much can you speed up?
if you determine in advance which familiar places are displayed by the mask,
and which ones just like that?
Thank you.
From Victor Ivanov → To All 24 February 2006
Hello Sinus
Fighting games, that is.
And racing - if only racing were written for Spec.
Oh, and you can’t display it horizontally pixel by pixel.
From Gavrilov Vitaly → To All 24 February 2006
Hello, Soplik
Regular output:
;hl->de
spr:
ld c,height
push de
ld b,width
row:
call putzn
inc e
jr z,$+6
ld a,d
sub 8
ld d,a
djnz row
pop de
call d_de_zn
dec c
jr nz,spr
optimized:
ld a,(hl)
inc hl
exx
ldc,a
ld b,8
exx
ld c,height
spr:
push de
ld b,width
row:
exx
rr c
djnz$+9
exx
ld a,(hl)
inc hl
exx
ldc,a
ld b,8
exx
call nc,put_zn
call c,put_zn_msk
inc e
jr z,$+6
ld a,d
sub 8
ld d,a
djnz row
pop de
call d_de_zn
dec c
jr nz,spr
put_zn:
dup 8
ld a,(hl)
ld(de),a
inc hl
inc d
edup
ret
put_zn_msk:
dup 8
ld a,(de)
and (hl)
inc hl
or(hl)
ld(de),a
inc hl
inc d
edup
ret
Please don't blame me if I messed up somewhere or didn't optimize it, it was written on the fly.
I think the general principle of working with a bit mask is clear %)