home *** CD-ROM | disk | FTP | other *** search
- * ============================================================================ *
- * PtInRect: Determines if a point is inside a rectangle
- *
- * void PtInRect(struct IBox *b,SHORT x, SHORT y);
- *
- * ============================================================================ *
-
- include 'intuition/intuition.i'
-
- SECTION ptinrect.asm,CODE
-
- xdef _PtInRect
-
- _PtInRect
- ; changed to use register calling parameters
- ; move.l 4(sp),a1 ; IBox
- ; movem.w 8(sp),d0-d1 ; x and y
-
- sub.w ibox_Left(a1),d0 ; x - left
- bmi.s 9$
- cmp.w ibox_Width(a1),d0 ; (x - left) > width
- bpl.s 9$
-
- sub.w ibox_Top(a1),d1 ; y - top
- bmi.s 9$
- cmp.w ibox_Height(a1),d1 ; (y - top) > height
- bpl.s 9$
-
- moveq #-1,d0
- rts
-
- 9$ moveq #0,d0
- rts
-
- end
-