Skool Daze Routines
62674: Get attribute file address of pellet's potential target or the safe
Used by the routines at 28143 and 63270. If the pellet's potential target is on-screen, this routine returns with the carry flag reset and HL holding the attribute file address of the potential target.
D y-coordinate of location to check
E 128 + x-coordinate of location to check
62674 LD HL,32512 32512 holds column at far left of screen (0-64)
62677 LD A,E A=128 + x-coordinate of potential target
62678 AND 127 A=x-coordinate of potential target
62680 SUB (HL)
62681 RET C Return with carry flag set if the pellet is off-screen to the left
62682 CP 32 The screen is 32 columns wide
62684 CCF Return with carry flag set if the pellet is off-screen to the right
62685 RET C
62686 LD L,A L=column of screen (0-31) where potential target lies
62687 LD A,D A=y-coordinate of potential target (154, 160, or 166)
62688 SUB 152 A=row of screen where potential target lies
62690 RRCA A=128 (top floor), 1 (middle floor), or 193 (bottom floor
62691 RRCA
62692 RRCA
62693 LD H,A
62694 AND 224 A=128 (top floor), 0 (middle) or 192 (bottom)
62696 ADD A,L Now L=LSB of attribute file address of potential target
62697 LD L,A
62698 LD A,H A=88 (top floor) or 89 (middle floor or bottom floor)
62699 AND 3
62701 ADD A,88
62703 LD H,A HL=attribute file address of potential target
62704 RET Return with the carry flag reset