Prev: AD0D Up: Map Next: ADA0
AD51: Routine at AD51
Used by the routines at sub_ad0d and draw_hazards.
Input
IX Address of a hazard structure
Output
D Return value
sub_ad51 AD51 LD A,(IX+$07) Return if IX[7] is non-zero
AD54 AND A
AD55 RET NZ
AD56 LD L,(IX+$02) HL = wordat(IX + 2)
AD59 LD H,(IX+$03)
AD5C LD A,H Return if top byte of HL was set
AD5D AND A
AD5E RET NZ
AD5F LD A,(IX+$0F) A = IX[15] + 1 and set flags
AD62 INC A
AD63 LD A,(IX+$01) A = IX[1]
AD66 LD C,$03 C = 3
AD68 JR NZ,sub_ad51_0 Jump if A /was/ non-zero
AD6A LD C,$02 C = 2
sub_ad51_0 AD6C CP C Return if A >= C
AD6D RET NC
AD6E LD E,$04 E = 4
AD70 DEC A A--
AD71 LD A,($A23F) A = fast_counter
AD74 JR NZ,sub_ad51_1 Jump if A /was/ non0zero
AD76 AND A Set flags
AD77 JP P,sub_ad51_2 Jump if positive
AD7A LD E,$01 E = 1
AD7C JR sub_ad51_2 Jump
sub_ad51_1 AD7E AND A Set flags
AD7F RET P Return if positive
sub_ad51_2 AD80 LD A,L A = L
AD81 AND $F8 A &= $F8
AD83 CP $90 Return if A >= $90
AD85 RET NC
AD86 ADD A,(IX+$08) A += IX[8]
AD89 CP $70 Return if A <= $70
AD8B RET C
AD8C SUB (IX+$08) A -= IX[8]
AD8F CP $68 Jump if A < $68
AD91 JR C,sub_ad51_3
AD93 DEC E E--
AD94 CP $78 Jump if A < $78
AD96 JR C,sub_ad51_3
AD98 INC E E += 2
AD99 INC E
sub_ad51_3 AD9A LD (IX+$07),E IX[7] = E
AD9D LD D,$01 D = 1
AD9F RET Return
Prev: AD0D Up: Map Next: ADA0