Prev: A33D Up: Map Next: A5F1
A345: Routine at A345
Used by the routines at 8138 and 86B9.
_a345 A345 LD ($A339),HL
A348 LD DE,$0022
A34B AND A
A34C SBC HL,DE
A34E LD B,$51
A350 XOR A
_a345_0 A351 LD (HL),A
A352 ADD HL,DE
A353 DJNZ _a345_0
A355 LD HL,($A339)
A358 LD DE,$0044
A35B AND A
A35C SBC HL,DE
A35E LD A,(Area_Colour)
A361 LD (HL),A
A362 LD A,(Stage_Compass)
A365 AND A
A366 RLA
A367 RLA
A368 LD C,A
A369 LD B,$00
A36B ADD IX,BC
A36D LD DE,(Position_EW)
A371 LD HL,(Position_NS)
A374 LD A,(Stage_Compass)
A377 BIT 0,A
A379 JR NZ,_a345_1
A37B EX DE,HL
_a345_1 A37C PUSH HL
A37D LD E,(IX+$00)
A380 LD D,(IX+$01)
A383 ADD HL,DE
A384 LD ($A335),HL
A387 POP HL
A388 LD E,(IX+$02)
A38B LD D,(IX+$03)
A38E ADD HL,DE
A38F LD ($A337),HL
A392 JR _a345_2
A394 CALL M,$04FF
A397 NOP
A398 NOP
A399 NOP
_a345_2 A39A XOR A
A39B LD ($A33E),A
A39E LD A,$C2
A3A0 LD (Bg_JunctionInfoBmp),A
A3A3 LD HL,$0004
A3A6 LD DE,$0002
A3A9 LD BC,$0010
A3AC LD A,$02
_a345_3 A3AE PUSH AF
A3AF LD ($A394),HL
A3B2 LD ($A396),DE
A3B6 LD ($A398),BC
A3BA LD A,($A33E)
A3BD LD ($A33D),A
A3C0 XOR A
A3C1 LD ($A33E),A
A3C4 LD A,(Stage_Compass)
A3C7 BIT 0,A
A3C9 JR Z,_a345_4
A3CB LD IX,(CurrentArea_PathsEWptr)
A3CF LD BC,($A335)
A3D3 LD DE,(Position_EW)
A3D7 JR _a345_5
_a345_4 A3D9 LD IX,(CurrentArea_PathsNSptr)
A3DD LD BC,($A335)
A3E1 LD DE,(Position_NS)
_a345_5 A3E5 INC BC
A3E6 INC BC
A3E7 LD HL,($A394)
A3EA CP $01
A3EC JR Z,_a345_6
A3EE CP $02
A3F0 JR Z,_a345_6
A3F2 EX DE,HL
A3F3 AND A
A3F4 SBC HL,DE
A3F6 JR _a345_7
_a345_6 A3F8 ADD HL,DE
_a345_7 A3F9 EX DE,HL
_a345_8 A3FA PUSH BC
A3FB PUSH DE
A3FC LD L,(IX+$00)
A3FF LD H,(IX+$01)
A402 AND A
A403 SBC HL,BC
A405 LD BC,($A396)
A409 JR NC,_a345_9
A40B AND A
A40C ADC HL,BC
A40E JP M,_a345_11
A411 JR _a345_10
_a345_9 A413 AND A
A414 SBC HL,BC
A416 JR NC,_a345_12
_a345_10 A418 BIT 2,(IX+$06)
A41C JR Z,_a345_11
A41E LD L,(IX+$02)
A421 LD H,(IX+$03)
A424 AND A
A425 SBC HL,DE
A427 JR NC,_a345_11
A429 LD L,(IX+$04)
A42C LD H,(IX+$05)
A42F SCF
A430 SBC HL,DE
A432 JR C,_a345_11
A434 LD L,(IX+$00)
A437 LD H,(IX+$01)
A43A LD (Bg_JunctionInfo),HL
A43D LD A,$01
A43F LD ($A33E),A
A442 LD IX,Bg_JunctionInfo
A446 LD HL,($A398)
A449 CALL Bg_DrawJunction
A44C JR _a345_12
_a345_11 A44E LD BC,$000A
A451 ADD IX,BC
A453 POP DE
A454 POP BC
A455 JR _a345_8
_a345_12 A457 POP DE
A458 POP BC
A459 LD A,$C4
A45B LD (Bg_JunctionInfoBmp),A
A45E LD HL,$FFFC
A461 LD DE,$0004
A464 LD BC,$0000
A467 POP AF
A468 DEC A
A469 JP NZ,_a345_3
A46C LD A,(Stage_Compass)
A46F BIT 0,A
A471 JR NZ,_a345_13
A473 LD DE,(Position_NS)
A477 LD IX,(PathPtr)
A47B JR _a345_14
_a345_13 A47D LD DE,(Position_EW)
A481 LD IX,(PathPtr)
_a345_14 A485 LD L,(IX+$00)
A488 LD H,(IX+$01)
A48B AND A
A48C SBC HL,DE
A48E JR Z,_a345_16
A490 JP NC,_a345_20
_a345_15 A493 LD BC,$000A
A496 ADD IX,BC
A498 JR _a345_14
_a345_16 A49A BIT 2,(IX+$06)
A49E JR Z,_a345_15
A4A0 LD BC,($A335)
A4A4 INC BC
A4A5 LD L,(IX+$02)
A4A8 LD H,(IX+$03)
A4AB AND A
A4AC SBC HL,BC
A4AE JR NC,_a345_15
A4B0 LD A,L
A4B1 CPL
A4B2 LD L,A
A4B3 LD A,H
A4B4 CPL
A4B5 LD H,A
A4B6 INC HL
A4B7 LD ($C588),HL
A4BA LD L,(IX+$04)
A4BD LD H,(IX+$05)
A4C0 AND A
A4C1 SBC HL,BC
A4C3 JR C,_a345_15
A4C5 LD ($C58A),HL
A4C8 LD A,C
A4C9 RRA
A4CA AND $01
A4CC LD C,A
A4CD LD B,$00
A4CF LD A,($A33E)
A4D2 AND A
A4D3 JR NZ,_a345_18
A4D5 PUSH BC
A4D6 LD HL,($C8A4)
A4D9 ADD HL,BC
A4DA EX DE,HL
A4DB LD HL,($A339)
A4DE LD BC,$0990
A4E1 ADD HL,BC
A4E2 LD BC,$0022
A4E5 LD A,$08
_a345_17 A4E7 EX AF,AF'
A4E8 LD A,(DE)
A4E9 XOR (HL)
A4EA LD (HL),A
A4EB ADD HL,BC
A4EC INC DE
A4ED INC DE
A4EE EX AF,AF'
A4EF DEC A
A4F0 JR NZ,_a345_17
A4F2 POP BC
_a345_18 A4F3 LD A,($A33D)
A4F6 AND A
A4F7 JR NZ,_a345_21
A4F9 LD HL,($C58A)
A4FC LD DE,$0002
A4FF SBC HL,DE
A501 JR C,_a345_21
A503 LD HL,($C588)
A506 SBC HL,DE
A508 JR C,_a345_21
A50A LD HL,($C8A0)
A50D ADD HL,BC
A50E EX DE,HL
A50F LD HL,($A339)
A512 LD BC,$0770
A515 ADD HL,BC
A516 LD BC,$0022
A519 LD A,$08
_a345_19 A51B EX AF,AF'
A51C LD A,(DE)
A51D XOR (HL)
A51E LD (HL),A
A51F ADD HL,BC
A520 INC DE
A521 INC DE
A522 EX AF,AF'
A523 DEC A
A524 JR NZ,_a345_19
A526 JR _a345_21
_a345_20 A528 LD A,($A33E)
A52B AND A
A52C JR NZ,_a345_24
A52E LD A,($A33D)
A531 AND A
A532 JR NZ,_a345_24
A534 JR _a345_25
_a345_21 A536 LD HL,($C58A)
A539 LD DE,$0004
A53C AND A
A53D SBC HL,DE
A53F JR C,_a345_22
A541 LD DE,($C588)
A545 LD HL,$0004
A548 SBC HL,DE
A54A JR C,_a345_25
_a345_22 A54C LD DE,($A335)
A550 LD BC,(Position_NS)
A554 LD A,(Stage_Compass)
A557 BIT 0,A
A559 JR Z,_a345_23
A55B LD DE,($A335)
A55F LD BC,(Position_EW)
_a345_23 A563 INC DE
A564 ADD HL,DE
A565 LD (Bg_JunctionInfo),HL
_a345_24 A568 LD IX,Bg_JunctionInfo
A56C LD (IX+$02),$C3
A570 LD HL,$0008
A573 CALL Bg_DrawJunction
_a345_25 A576 LD IX,PathPosHalfway
A57A CALL $9F9A
A57D JR NC,_a345_26
A57F LD IX,$BE14
A583 CALL $9F9A
A586 JR NC,_a345_26
A588 LD IX,$BE18
A58C CALL $9F9A
A58F JR NC,_a345_26
A591 JR _a345_27
_a345_26 A593 CALL $9FCD
_a345_27 A596 RET
This entry point is used by the routines at _939a, 9FCD, AB5F, AFFA, _b0ea and Game_WinScreen.
_a345_28 A597 LD H,$00
A599 ADD HL,HL
A59A ADD HL,HL
A59B LD DE,Bitmap_Table
A59E ADD HL,DE
A59F LD E,(HL)
A5A0 INC HL
A5A1 LD D,(HL)
A5A2 INC HL
A5A3 LD A,(HL)
A5A4 AND $7F
A5A6 LD C,A
A5A7 INC HL
A5A8 LD A,(HL)
A5A9 XOR $80
A5AB LD (HL),A
A5AC AND $7F
A5AE LD L,A
A5AF LD H,$00
A5B1 LD ($5BE0),HL
A5B4 SRL A
A5B6 ADC A,$00
A5B8 LD ($5BE2),A
_a345_29 A5BB LD B,$08
_a345_30 A5BD PUSH BC
A5BE LD HL,($5BE0)
A5C1 ADD HL,DE
A5C2 PUSH HL
A5C3 LD A,($5BE2)
A5C6 LD B,A
A5C7 AND A
_a345_31 A5C8 DEC HL
A5C9 LD A,(DE)
A5CA LD C,(HL)
A5CB RLA
A5CC RR C
A5CE RLA
A5CF RR C
A5D1 RLA
A5D2 RR C
A5D4 RLA
A5D5 RR C
A5D7 RLA
A5D8 RR C
A5DA RLA
A5DB RR C
A5DD RLA
A5DE RR C
A5E0 RLA
A5E1 RR C
A5E3 RLA
A5E4 LD (DE),A
A5E5 LD (HL),C
A5E6 INC DE
A5E7 DJNZ _a345_31
A5E9 POP DE
A5EA POP BC
A5EB DJNZ _a345_30
A5ED DEC C
A5EE JR NZ,_a345_29
A5F0 RET
Prev: A33D Up: Map Next: A5F1