;Z80 Assembly Programmers Organization (ZAPO) ;Even faster findpixel routine ;~Code7~ ; ;95 t-states ;28 bytes ;not counting optional return or initialization ; ;Input: ;b=y ;c=x ; ;Output: ;hl = byte in LCD memory ;a = bitmask for (hl) ;de destroyed ; ;if you use b=y and a=x for input and use the ;shorter version (FindPixelShort), then this routine ;takes only 91 t-states but will destroy your x value ; ;Feb 17,1999 ;this offset table program must be placed at $8700 in order ;to work. Since this code is for the TI-86 only, you can set ;the ram page in port (6) to 1 and $8700 should be free. ;I've included an initialization routine example to move it to $8700. Offset: .db $80,$40,$20,$10,$8,$4,$2,$1 ;end offset table ;the find pixel routine itself can be placed anywhere FindPixel: ld a,b FindPixelShort: ld h,$3f add a,a add a,a ld l,a ld a,c rra add hl,hl rra add hl,hl rra add a,l ld l,a ld d,$87 ld a,c and d ld e,a ld a,(de) ret ;when initializing you should set the RAM page to 1. ;(already done if executing regular assembly) InitializeFP: ;11 bytes, 59 t-states, not including optional ret ld de,$8700 ld hl,Offset ld bc,8 ldir ret .end