1
2; SP1IsPt8InRect
3; 05.2006 aralbrec, Sprite Pack v3.0
4; sinclair spectrum version
5; uses rectangles library
6
7PUBLIC SP1IsPt8InRect
8EXTERN RIsPtInRect8
9
10; Determines if a pixel coordinate lies within an 8-bit
11; rectangle described using character coordinates.  The
12; pixel coordinate is divided by 8 to change to character
13; coordinates in this subroutine.
14;
15; enter : bc = x coordinate of pixel
16;         de = y coordinate of pixel
17;         hl = & struct sp1_Rect
18; exit  : carry flag set = in rectangle
19; uses  : af,af',bc,de,hl
20
21.SP1IsPt8InRect
22
23   ld a,c
24   srl b
25   rra
26   srl b
27   rra
28   srl b
29   rra
30   ex af,af                  ; a' = 8-bit x coord
31   ld a,e
32   srl d
33   rra
34   srl d
35   rra
36   srl d
37   rra                       ; a = 8-bit y coord
38   ld d,(hl)
39   inc hl
40   ld b,(hl)
41   inc hl
42   ld c,(hl)
43   inc hl
44   ld e,(hl)
45   ld l,a
46   ex af,af
47   jp RIsPtInRect8
48