Prev: 873A Up: Map Next: 89E9
87C9: ; TODO
Used by the routine at Main_routine.
_87c9 87C9 XOR A
87CA LD ($BD1D),A
87CD LD ($954D),A
87D0 LD HL,$6908
87D3 LD DE,$6909
87D6 LD BC,$001F
87D9 LD A,(Area_Colour)
87DC LD (HL),A
87DD LDIR
87DF LD A,(_bd9c)
87E2 AND A
87E3 JR Z,_87c9_0
87E5 DEC A
87E6 LD (_bd9c),A
87E9 JR NZ,_87c9_0
87EB CALL Data_ClearToZero
87EE LD H,E
87EF LD E,C
87F0 LD A,(DE)
_87c9_0 87F1 LD A,$3C See if player is carrying the plans
87F3 CALL Obj_CarriedSearch
87F6 CALL Z,Game_CheckCountDown
87F9 LD A,(Stat_ResetGame) See if the reset flag has been set and handle it.
87FC AND A
87FD JP NZ,Death_HandleFlag
Not in reset mode.
8800 LD A,(Hero_ThroughDoor)
8803 BIT 0,A
8805 JP NZ,$8BB6
8808 CALL Keys_UpdateAction
880B LD HL,KeyState_Actions
880E LD BC,($BD2C)
8812 LD A,(HL)
8813 AND C
8814 LD (HL),A
8815 INC HL
8816 LD A,(HL)
8817 AND C
8818 LD (HL),A
8819 CALL _89e9_Shoot
881C LD A,($BD2B)
881F INC A
8820 CALL Z,_8ac9_Enter
8823 LD A,(Hero_ThroughN)
8826 CP $10
8828 JR NZ,_87c9_1
882A LD A,(Flag_Demo)
882D AND A
882E JR Z,_87c9_1
8830 OR $08
8832 LD (KeyState_Actions),A
_87c9_1 8835 LD A,(KeyState_Actions)
8838 AND $0C
883A JR Z,_87c9_4
883C LD A,($C540)
883F AND $0C
8841 JP NZ,$AFFA
8844 LD A,(KeyState_Actions)
8847 LD ($C540),A
884A AND $0C
884C CP $0C
884E JP Z,$AFFA
8851 BIT 2,A
8853 JR Z,_87c9_2
8855 LD A,(Stage_Compass)
8858 INC A
8859 JR _87c9_3
_87c9_2 885B LD A,(Stage_Compass)
885E DEC A
_87c9_3 885F AND $03
8861 LD (Stage_Compass),A
8864 JP _873a
_87c9_4 8867 LD A,(KeyState_Actions)
886A AND $F0
886C JR Z,_87c9_7
886E LD A,($C540)
8871 AND $70
8873 JR NZ,_87c9_7
8875 LD A,(KeyState_Actions)
8878 BIT 7,A
887A JR Z,_87c9_5
887C LD A,($C540)
887F BIT 7,A
8881 JR NZ,_87c9_5
8883 CALL Inv_Select
8886 JR _87c9_7
_87c9_5 8888 LD A,(KeyState_Actions)
888B AND $60
888D CP $60
888F JR Z,_87c9_7
8891 BIT 5,A
8893 JR Z,_87c9_6
8895 CALL Obj_Take
8898 JR _87c9_7
_87c9_6 889A BIT 6,A
889C CALL NZ,Obj_Drop
_87c9_7 889F LD A,(KeyState_Actions)
88A2 LD ($C540),A
88A5 LD A,(Hero_ThroughN)
88A8 LD HL,$87C1
88AB LD BC,$0008
88AE CPIR
88B0 JP NZ,_87c9_23
88B3 LD HL,(Position_EW)
88B6 LD DE,$0007
88B9 LD A,(Stage_Compass)
88BC BIT 0,A
88BE JR Z,_87c9_8
88C0 LD HL,(Position_NS)
_87c9_8 88C3 BIT 1,A
88C5 JR Z,_87c9_9
88C7 LD DE,$FFF9
_87c9_9 88CA LD A,(KeyState_Actions)
88CD AND $03
88CF CP $03
88D1 JR NZ,_87c9_10
88D3 XOR A
_87c9_10 88D4 LD ($C588),A
88D7 LD A,(Hero_ThroughN)
88DA CP $04
88DC JP Z,_87c9_18
88DF CP $0B
88E1 JP Z,_87c9_18
88E4 CP $07
88E6 JP Z,_87c9_23
88E9 CP $0E
88EB JP Z,_87c9_23
88EE LD A,($C588)
88F1 AND A
88F2 JP Z,_87c9_27
88F5 LD BC,(Hero_LastDir)
88F9 CP C
88FA JR Z,_87c9_11
88FC LD A,(Hero_ThroughN)
88FF CP $10
8901 JR NZ,_87c9_11
8903 LD A,$13
8905 LD (Hero_ThroughN),A
8908 LD A,(Stage_Compass)
890B XOR $02
890D LD (Hero_ThroughCompass),A
8910 JP _87c9_27
_87c9_11 8913 LD A,($C588)
8916 CP $02
8918 JR Z,_87c9_12
891A AND A
891B ADC HL,DE
891D JR _87c9_13
_87c9_12 891F SBC HL,DE
_87c9_13 8921 JP M,_87c9_16
8924 JR Z,_87c9_16
8926 LD E,L
8927 LD D,H
8928 LD IX,(PathPtr)
892C LD L,(IX+$02)
892F LD H,(IX+$03)
8932 SCF
8933 SBC HL,DE
8935 JP NC,_87c9_14
8938 LD L,(IX+$04)
893B LD H,(IX+$05)
893E EX DE,HL
893F SCF
8940 SBC HL,DE
8942 JP C,_87c9_16
_87c9_14 8945 LD A,($C588)
8948 LD (Hero_LastDir),A
894B LD C,$01
894D CP $01
894F JR Z,_87c9_15
8951 LD C,$FF
_87c9_15 8953 LD A,(Stage_Compass)
8956 ADD A,C
8957 AND $03
8959 LD (Hero_ThroughCompass),A
895C LD A,$10
895E LD (Hero_ThroughN),A
8961 JP _87c9_27
_87c9_16 8964 LD A,($C588)
8967 LD (Hero_LastDir),A
896A LD C,$01
896C CP $01
896E JR Z,_87c9_17
8970 LD C,$FF
_87c9_17 8972 LD A,(Stage_Compass)
8975 ADD A,C
8976 AND $03
8978 LD (Hero_ThroughCompass),A
897B LD A,($C541)
897E ADD A,$02
8980 LD (Hero_ThroughN),A
8983 JR _87c9_26
_87c9_18 8985 LD A,(Hero_ThroughN)
8988 LD ($C541),A
898B LD A,(Hero_LastDir)
898E CP $02
8990 JR Z,_87c9_19
8992 AND A
8993 ADC HL,DE
8995 JR _87c9_20
_87c9_19 8997 SBC HL,DE
_87c9_20 8999 JP M,_87c9_21
899C JR Z,_87c9_21
899E LD E,L
899F LD D,H
89A0 LD IX,(PathPtr)
89A4 LD L,(IX+$02)
89A7 LD H,(IX+$03)
89AA AND A
89AB SBC HL,DE
89AD JR NC,_87c9_22
89AF LD L,(IX+$04)
89B2 LD H,(IX+$05)
89B5 EX DE,HL
89B6 AND A
89B7 SBC HL,DE
89B9 JR NC,_87c9_22
_87c9_21 89BB LD A,($C588)
89BE LD HL,Hero_LastDir
89C1 CP (HL)
89C2 JR Z,_87c9_23
_87c9_22 89C4 LD A,$10
89C6 JR _87c9_25
_87c9_23 89C8 LD A,(Hero_ThroughN)
_87c9_24 89CB INC A
89CC CP $0F
89CE JR NZ,_87c9_25
89D0 LD A,$02
_87c9_25 89D2 CP $01
89D4 JR Z,_87c9_24
89D6 CP $08
89D8 JR Z,_87c9_24
89DA LD (Hero_ThroughN),A
_87c9_26 89DD CALL $8138
This entry point is used by the routine at 8BB6.
_87c9_27 89E0 LD A,(Hero_ThroughN)
89E2 CP L Reset any shoot action if not.
89E3 JP $AFFD
89E6 INC BC
89E7 DEC B
89E8 INC BC
Prev: 873A Up: Map Next: 89E9