A86: FindPixel
[Prev][Next][Index][Thread]
A86: FindPixel
Hello !
I'm CLEM, the french programmer who don't speak
english :-(
There are my 2 findpixel routines. If anyone can
optimize it, let me know.
Are my measures (cycles and size) right ?
If you need speed :
;----------------------------------------------------------------------
; FIND PIXEL by CLEM (117 cycles 34 bytes)
;
; Input: x->b
; y->c
;
; Output: hl : byte in LCD memory
; a : bitmask for (hl)
;
; Destroyes : bc
;----------------------------------------------------------------------
FindPixel:
ld h,63
ld a,c
add a,a
add a,a
ld l,a
ld a,b
rra
add hl,hl
rra
add hl,hl
rra
or l
ld l,a
ld a,b
and 7
ld bc,FP_Bits
add a,c
ld c,a
adc a,b
sub c
ld b,a
ld a,(bc)
ret
FP_Bits: .db $80,$40,$20,$10,$08,$04,$02,$01
If you need bytes :
;----------------------------------------------------------------------
; FIND PIXEL II by CLEM (121 cycles 27 bytes)
;
; Input: x->b
; y->c
;
; Output: hl : byte in LCD memory
; a : bitmask for (hl)
;
; Destroyes : none !
;----------------------------------------------------------------------
FindPixel:
ld h,63
ld a,c
add a,a
add a,a
ld l,a
ld a,b
rra
add hl,hl
rra
add hl,hl
rra
or l
ld l,a
ld a,b
and 7
cpl
rlca
rlca
rlca
ld (FP_Bit+1),a
xor a
FP_Bit:
set 0,a
ret
Thanx Dan Eble !
CLEM, cvasseur@runnet.com (sorry, no signature)
Follow-Ups: