A86: The Result of the FindPixel War
[Prev][Next][Index][Thread]
A86: The Result of the FindPixel War
James and I have been revising our FindPixel routine. Here it is.
;-----------------------------------------------------------------
; The Eble-Yopp-Yopp-Eble-Eble-Eble-Yopp Fast FindPixel Routine :)
; 36b/121t not counting ret or possible push/pop of BC
; .. and now only C is modified, so this procedure can
; be used inside a djnz loop without push/pop!
;-----------------------------------------------------------------
; Input: D=y, E=x Output: A=bitmask, HL->vid mem byte, C mod.
;-----------------------------------------------------------------
FindPixel:
ld hl,FP_Bits
ld a,e
and $07 ; a = bit offset
add a,l
ld l,a
adc a,h
sub l
ld h,a
ld c,(hl) ; c = bitmask for (hl)
;48 t-states up to this point
ld hl,FP_RLD
ld (hl),d
ld a,e ; a = x/8 (byte offset within row)
rrca
rrca
rrca
rld
or $FC
ld l,(hl)
ld h,a ; hl -> byte in vid mem
ld a,c ; now a = bitmask for (hl)
;121 t-states up to this point
ret
FP_RLD: .db $00
FP_Bits: .db $80,$40,$20,$10,$08,$04,$02,$01
.end
--------
Dan Eble (mailto:eble@cis.ohio-state.edu)
(http://www.cis.ohio-state.edu/~eble)