Prev: D4E8 Up: Map Next: D55B
D50C: Routine at D50C
Used by the routine at FindScene.
D50C OR A Set zero flag based on A.
D50D SLA A Shift A left (with carry).
D50F LD L,A Store the result in L.
D510 RLA Rotate A left (bit 7 is moved to bit 0).
D511 AND %00000001 Keep only bit 0.
D513 LD H,A H=A.
D514 LD DE,$C700 DE=C700.
D517 ADD HL,DE HL+=DE.
D518 EX DE,HL Exchange the DE and HL registers.
D519 LD BC,$0020 BC=0020.
D51C LD HL,$6140 HL=6140.
D51F PUSH HL Stash HL and DE on the stack.
D520 PUSH DE
D521 LD A,(DE) A=*DE.
D522 DEC A Decrease A by one.
D523 INC DE Increment DE by one.
D524 OR A Set the bits from A.
D525 LD (HL),$01 Write 01 to *HL.
D527 SBC HL,BC HL-=BC.
D529 DEC A Decrease A by one.
D52A JR NZ,$D525 Jump to D525 until A is zero.
D52C LD A,(DE) Jump to D550 if *DE is zero.
D52D AND A
D52E JR Z,$D550
D530 PUSH HL Stash HL on the stack.
D531 LD HL,$C800 HL=C800.
D534 LD E,A E=A.
D535 LD A,(HL) A=*HL.
D536 INC HL Increment HL by one.
D537 CP $80 Jump to D535 if A is lower than 80.
D539 JP C,$D535
D53C DEC E Decrease E by one.
D53D JP NZ,$D535 Jump to D535 until E is zero.
D540 EX DE,HL Exchange the DE and HL registers.
D541 POP HL Restore HL from the stack.
D542 LD A,(DE) A=*DE.
D543 AND %01111111 Keep only bits 0-6.
D545 LD (HL),A Write A to *HL.
D546 LD A,(DE) A=*DE.
D547 BIT 7,A Jump to D550 if bit 7 of A is set.
D549 JR NZ,$D550
D54B SBC HL,BC HL-=BC.
D54D INC DE Increment DE by one.
D54E JR $D542 Jump to D542.
D550 POP DE Restore DE and HL from the stack.
D551 POP HL
D552 INC HL Increment HL by one.
D553 INC DE Increment DE by two.
D554 INC DE
D555 LD A,L Jump to D51F if L is not equal to 60.
D556 CP $60
D558 JR NZ,$D51F
D55A RET Return.
Prev: D4E8 Up: Map Next: D55B