Prev: 9F9A Up: Map Next: A33D
9FCD: Routine at 9FCD
Used by the routine at _a345.
9FCD LD ($9FBF),SP
9FD1 LD E,(IX+$00)
9FD4 LD D,(IX+$01)
9FD7 LD A,(Stage_Compass)
9FDA BIT 0,A
9FDC JR Z,$9FE3
9FDE LD HL,(Position_NS)
9FE1 JR $9FE6
9FE3 LD HL,(Position_EW)
9FE6 BIT 1,A
9FE8 JR Z,$9FEB
9FEA EX DE,HL
9FEB LD A,(Hero_LastDir)
9FEE CP $02
9FF0 JR Z,$9FF3
9FF2 EX DE,HL
9FF3 AND A
9FF4 SBC HL,DE
9FF6 LD E,(IX+$02)
9FF9 LD D,$00
9FFB CP $02
9FFD JR Z,$A00B
9FFF AND A
A000 SBC HL,DE
A002 EX DE,HL
A003 LD HL,$0020
A006 AND A
A007 SBC HL,DE
A009 JR $A012
A00B ADD HL,DE
A00C LD DE,$0022
A00F AND A
A010 SBC HL,DE
A012 SRL H
A014 RR L
A016 LD ($9FC1),HL
A019 XOR A
A01A LD ($9FC3),A
A01D LD A,(IX+$03)
A020 LD DE,$0002
A023 ADD IX,DE
A025 LD ($9FC8),IX
A029 SUB $DD
A02B LD L,A
A02C LD H,$00
A02E ADD HL,HL
A02F LD DE,$BE6D
A032 ADD HL,DE
A033 LD E,(HL)
A034 INC HL
A035 LD D,(HL)
A036 PUSH DE
A037 POP IX
A039 LD C,(IX+$00)
A03C INC IX
A03E LD B,$01
A040 JR $A04A
A042 LD IX,($9FC4)
A046 LD A,($9FC6)
A049 LD C,A
A04A PUSH BC
A04B LD A,(IX+$00)
A04E BIT 7,A
A050 JP Z,$A13E
A053 CP $FF
A055 JP Z,$A122
A058 CP $80
A05A JP Z,$A16B
A05D CP $92
A05F JR C,$A066
A061 CP $96
A063 JP C,$A16B
A066 LD L,(IX+$00)
A069 LD H,$00
A06B ADD HL,HL
A06C ADD HL,HL
A06D LD DE,$C58F
A070 ADD HL,DE
A071 LD A,(HL)
A072 LD E,A
A073 RES 7,E
A075 LD D,$00
A077 LD HL,($9FC1)
A07A AND A
A07B SBC HL,DE
A07D JR C,$A091
A07F LD ($9FC1),HL
A082 POP BC
A083 DJNZ $A042
A085 LD B,$01
A087 XOR A
A088 LD ($9FC3),A
A08B DEC C
A08C RET Z
A08D INC IX
A08F JR $A04A
A091 LD D,A
A092 LD A,($9FC3)
A095 XOR D
A096 BIT 7,A
A098 JR Z,$A0A0
A09A LD L,(IX+$00)
A09D CALL _a345_28
A0A0 LD A,(IX+$00)
A0A3 CP $80
A0A5 JP Z,$A257
A0A8 CP $83
A0AA JP Z,$A2FF
A0AD CP $8F
A0AF JP Z,$A1AC
A0B2 CP $90
A0B4 JP Z,$A1B1
A0B7 CP $92
A0B9 JR C,$A0CA
A0BB CP $96
A0BD JP C,$A178
A0C0 CP $A2
A0C2 JP Z,$A1D9
A0C5 CP $BB
A0C7 JP Z,$A1CE
A0CA LD A,(IX+$00)
A0CD LD DE,$0AA0
A0D0 CP $9B
A0D2 JR Z,$A0F3
A0D4 LD DE,$0660
A0D7 CP $8F
A0D9 JR C,$A0F3
A0DB LD DE,$0110
A0DE CP $92
A0E0 JR C,$A0F3
A0E2 LD DE,$0880
A0E5 CP $B5
A0E7 JR C,$A0F3
A0E9 LD DE,$0440
A0EC CP $C9
A0EE JR C,$A0F3
A0F0 LD DE,$0880
A0F3 LD L,A
A0F4 LD H,$00
A0F6 ADD HL,HL
A0F7 ADD HL,HL
A0F8 LD BC,$C58E
A0FB ADD HL,BC
A0FC LD B,(HL)
A0FD RES 7,B
A0FF EX DE,HL
A100 LD DE,$0110
A103 AND A
A104 SBC HL,DE
A106 DJNZ $A103
A108 LD DE,($A339)
A10C ADD HL,DE
A10D LD ($A33B),HL
A110 LD L,(IX+$00)
A113 CALL Bitmap_GetData
A116 LD DE,($9FC1)
A11A CALL Bg_DrawItemColumn
A11D LD SP,($9FBF)
A121 RET
A122 LD HL,($9FC1)
A125 LD DE,$001C
A128 AND A
A129 SBC HL,DE
A12B JP NC,$A07F
A12E LD HL,($A339)
A131 LD DE,$0022
A134 LD A,$FF
A136 LD B,$50
A138 LD (HL),A
A139 ADD HL,DE
A13A DJNZ $A138
A13C JR $A11D
A13E LD A,(IX+$00)
A141 AND $F0
A143 CP $00
A145 JR NZ,$A157
A147 XOR (IX+$00)
A14A LD E,A
A14B LD D,$00
A14D LD HL,($9FC1)
A150 SBC HL,DE
A152 JR C,$A11D
A154 JP $A07F
A157 CP $10
A159 JR NZ,$A168
A15B LD A,$80
A15D LD ($9FC3),A
A160 INC IX
A162 POP BC
A163 DEC C
A164 JP NZ,$A04A
A167 RET
A168 JP $A11D
A16B EX DE,HL
A16C LD HL,($9FC8)
A16F INC HL
A170 INC HL
A171 LD ($9FC8),HL
A174 EX DE,HL
A175 JP $A066
A178 LD A,($9FC1)
A17B CP $03
A17D JP NZ,$A19D
A180 LD HL,($A335)
A183 LD A,(Stage_Compass)
A186 BIT 1,A
A188 JR NZ,$A18C
A18A INC HL
A18B INC HL
A18C LD (Door_CurrentPos),HL
A18F LD A,(IX+$00)
A192 LD HL,$BD7C
A195 LD (HL),A
A196 INC HL
A197 LD DE,($9FC8)
A19B LD A,(DE)
A19C LD (HL),A
A19D LD HL,($9FC8)
A1A0 INC HL
A1A1 LD B,$01
A1A3 LD A,(IX+$00)
A1A6 CALL String_DrawToSign
A1A9 JP $A1AC
A1AC LD BC,$0778
A1AF JR $A1B4
A1B1 LD BC,$0368
A1B4 LD A,($9FC1)
A1B7 CP B
A1B8 JP Z,$A0CA
A1BB LD A,(Area_Colour)
A1BE AND $07
A1C0 OR C
A1C1 LD HL,($A339)
A1C4 LD DE,$0044
A1C7 AND A
A1C8 SBC HL,DE
A1CA LD (HL),A
A1CB JP $A0CA
A1CE LD BC,$0001
A1D1 LD DE,$0001
A1D4 LD HL,$28A3
A1D7 JR $A1E2
A1D9 LD BC,$0000
A1DC LD DE,$0000
A1DF LD HL,$00A0
A1E2 LD A,(Hero_LastDir)
A1E5 CP $02
A1E7 LD A,($9FC1)
A1EA JR NZ,$A1ED
A1EC LD B,C
A1ED CP B
A1EE JP NZ,$A0CA
A1F1 PUSH IX
A1F3 PUSH DE
A1F4 PUSH HL
A1F5 CALL LinkList_MoveLinkFrom
A1F8 POP HL
A1F9 POP DE
A1FA JR Z,$A252
A1FC LD (IX+$09),H
A1FF LD (IX+$02),L
A202 LD (IX+$0B),L
A205 LD L,(IX+$00)
A208 LD H,(IX+$01)
A20B LD (_bd35_LinkList),HL
A20E LD HL,(_bd37_LinkList)
A211 LD (IX+$00),L
A214 LD (IX+$01),H
A217 LD (_bd37_LinkList),IX
A21B LD A,(Stage_Compass)
A21E LD (IX+$0A),A
A221 LD HL,($A335)
A224 INC HL
A225 BIT 1,A
A227 JR Z,$A230
A229 LD A,E
A22A CPL
A22B LD E,A
A22C LD A,D
A22D CPL
A22E LD D,A
A22F INC DE
A230 LD A,(Hero_LastDir)
A233 CP $01
A235 JR Z,$A23C
A237 AND A
A238 SBC HL,DE
A23A JR $A23D
A23C ADD HL,DE
A23D LD (IX+$05),L
A240 LD (IX+$06),H
A243 LD (IX+$07),L
A246 LD (IX+$08),H
A249 LD HL,$9533
A24C LD (IX+$03),L
A24F LD (IX+$04),H
A252 POP IX
A254 JP $A0CA
A257 LD A,($9FC1)
A25A AND A
A25B JR Z,$A269
A25D CP $05
A25F JR Z,$A269
A261 LD HL,($9FC8)
A264 INC HL
A265 LD A,(HL)
A266 CALL $A786
A269 LD HL,($9FC8)
A26C INC HL
A26D LD A,(HL)
A26E AND $7F
A270 CP $04
A272 JR Z,$A28F
A274 CP $07
A276 JR Z,$A28F
A278 CP $08
A27A JR Z,$A28F
A27C LD A,($9FC1)
A27F BIT 0,A
A281 JR NZ,$A284
A283 DEC HL
A284 LD A,(HL)
A285 LD HL,($A339)
A288 LD DE,$0022
A28B AND A
A28C SBC HL,DE
A28E LD (HL),A
A28F LD A,(Hero_LastDir)
A292 CP $02
A294 LD A,($9FC1)
A297 JR Z,$A2A0
A299 CP $01
A29B JP NZ,$A0CA
A29E JR $A2A5
A2A0 CP $04
A2A2 JP NZ,$A0CA
A2A5 PUSH IX
A2A7 CALL LinkList_MoveLinkFrom
A2AA JR Z,$A2F2
A2AC LD HL,($9FC8)
A2AF LD A,(HL)
A2B0 LD (IX+$02),A
A2B3 INC HL
A2B4 LD A,(HL)
A2B5 LD (IX+$0E),A
A2B8 LD HL,($A335)
A2BB INC HL
A2BC LD A,(Stage_Compass)
A2BF LD (IX+$0A),A
A2C2 LD DE,$FFFD
A2C5 BIT 1,A
A2C7 JR NZ,$A2CC
A2C9 LD DE,$0003
A2CC LD A,(Hero_LastDir)
A2CF CP $01
A2D1 JR Z,$A2D8
A2D3 AND A
A2D4 SBC HL,DE
A2D6 JR $A2D9
A2D8 ADD HL,DE
A2D9 LD (IX+$05),L
A2DC LD (IX+$06),H
A2DF LD (IX+$07),L
A2E2 LD (IX+$08),H
A2E5 LD HL,$9396
A2E8 LD (IX+$03),L
A2EB LD (IX+$04),H
A2EE LD (IX+$09),$10
A2F2 POP IX
A2F4 JP $A0CA
A2F7 INC BC
A2F8 NOP
A2F9 LD BC,$FF00
A2FC RST $38
A2FD DEFB $FD
A2FE RST $38
A2FF LD A,($C3DE)
A302 AND A
A303 JP NZ,$A0CA
A306 LD A,$01
A308 LD ($C3DE),A
A30B LD HL,($9FC1)
A30E LD H,$00
A310 ADD HL,HL
A311 LD DE,$A2F7
A314 ADD HL,DE
A315 LD E,(HL)
A316 INC HL
A317 LD D,(HL)
A318 LD A,(Stage_Compass)
A31B LD ($C3E8),A
A31E LD HL,($A335)
A321 INC HL
A322 BIT 1,A
A324 JR Z,$A32B
A326 AND A
A327 SBC HL,DE
A329 JR $A32C
A32B ADD HL,DE
A32C LD ($C3E3),HL
A32F LD ($C3E5),HL
A332 JP $A0CA
A335 RET PE
A336 INC B
A337 JP PE,$8904
A33A LD E,(HL)
A33B RET PE
A33C LD H,H
Prev: 9F9A Up: Map Next: A33D