Prev: 33313 Up: Map Next: 33904
33700: Test In View
Returns zero if *Depth is between *View_Low and *View_High, and the absolute *Rotated_X and *Rotated_Y are inside that range.
Output
A Zero if the point is in view
Test_In_View 33700 LD HL,(60946) Fetch *Depth.
33703 LD DE,(60950) Fetch *View_Low.
33707 AND A Jump to Test_In_View_2 if *Depth is less than *View_Low.
33708 SBC HL,DE
33710 JR C,Test_In_View_2
33712 ADD HL,DE Restore *Depth.
33713 LD DE,(60948) Fetch *View_High.
33717 AND A Jump to Test_In_View_2 if *Depth is not less than *View_High.
33718 SBC HL,DE
33720 JR NC,Test_In_View_2
33722 ADD HL,DE Restore *Depth.
33723 SRA H Halve the coordinate.
33725 RR L
33727 LD BC,(60952) Fetch *View_Range.
33731 ADD HL,BC Add *View_Range.
33732 EX DE,HL Store the limit in DE.
33733 LD HL,(60942) Fetch *Rotated_X.
33736 BIT 7,H Jump to Test_In_View_0 if *Rotated_X is positive.
33738 JR Z,Test_In_View_0
33740 LD A,H Take the absolute value.
33741 CPL
33742 LD H,A
33743 LD A,L
33744 CPL
33745 LD L,A
33746 INC HL
Test_In_View_0 33747 AND A Jump to Test_In_View_2 if *Rotated_X is outside the limit.
33748 SBC HL,DE
33750 JR NC,Test_In_View_2
33752 EX DE,HL Swap the limit with the coordinate.
33753 ADD HL,BC Add *View_Range.
33754 SRA H Halve the range.
33756 RR L
33758 EX DE,HL Store the limit in DE.
33759 LD HL,(60944) Fetch *Rotated_Y.
33762 BIT 7,H Jump to Test_In_View_1 if *Rotated_Y is positive.
33764 JR Z,Test_In_View_1
33766 LD A,H Take the absolute value.
33767 CPL
33768 LD H,A
33769 LD A,L
33770 CPL
33771 LD L,A
33772 INC HL
Test_In_View_1 33773 AND A Jump to Test_In_View_2 if *Rotated_Y is outside the limit.
33774 SBC HL,DE
33776 JR NC,Test_In_View_2
33778 XOR A Set the result to 0.
33779 RET Return.
Test_In_View_2 33780 OR %00000001 Set bit 0.
33782 RET Return.
33783 NOP
33784 NOP
33785 NOP
33786 NOP
33787 NOP
33788 NOP
33789 NOP
This entry point is used by the routine at Service_Interrupt.
Test_In_View_3 33790 LD DE,50380
33793 LD HL,54550
33796 LD A,(61310)
33799 DEC A
33800 RET Z
33801 LD BC,63486
33804 IN A,(C)
33806 OR 224
33808 CP 254
33810 RET NZ
Test_In_View_4 33811 LD BC,63486
33814 IN A,(C)
33816 RRA
33817 RRA
33818 RET NC
33819 RRA
33820 PUSH DE
33821 PUSH HL
33822 CALL NC,Set_Phase_Table_7
33825 POP HL
33826 POP DE
33827 RRA
33828 JR NC,Test_In_View_6
33830 PUSH DE
33831 PUSH HL
33832 LD HL,54550
33835 LD (57723),HL
33838 POP HL
33839 CALL Divide_25
33842 EX (SP),HL
33843 LD DE,50380
33846 LD (57723),DE
33850 CALL Divide_25
33853 EX DE,HL
33854 POP HL
33855 LD A,(HL)
33856 AND A
33857 JR NZ,Test_In_View_5
33859 XOR A
33860 LD (61389),A
33863 LD (61388),A
33866 LD (57845),A
33869 RET
Test_In_View_5 33870 LD A,(DE)
33871 AND A
33872 JR NZ,Test_In_View_4
33874 LD A,4
33876 LD (61388),A
33879 LD (61389),A
33882 LD A,25
33884 LD (57845),A
33887 RET
Test_In_View_6 33888 LD A,1
33890 LD (61310),A
33893 RET
33894 NOP
33895 NOP
33896 NOP
33897 NOP
33898 NOP
33899 NOP
This entry point is used by the routines at Run_Other_Phase and Draw_Phase_Slots.
Test_In_View_7 33900 LD IX,59008
Prev: 33313 Up: Map Next: 33904