Prev: BD48 Up: Map Next: BE59
BD89: Routine at BD89
Used by the routine at StartGame.
BD89 LD IX,$C356 IX=C356.
BD8D LD HL,($C277) HL=*C277.
BD90 BIT 4,(IX+$10) Test bit 4 of *IX+10.
BD94 LD DE,$0021 DE=0021.
BD97 JR Z,$BD9C Jump to BD9C if bit 4 of *IX+10 is not set.
BD99 LD DE,$002D DE=002D.
BD9C ADD HL,DE HL+=DE.
BD9D BIT 5,(HL) Return if bit 5 of *HL is not set.
BD9F RET Z
BDA0 LD A,(HL) A=*HL.
BDA1 LD HL,$C35D HL=C35D.
BDA4 LD DE,$C356 DE=C356.
BDA7 LD BC,$0007 BC=0007.
BDAA LDIR LDIR.
BDAC LD HL,$C387 HL=C387.
BDAF DEC (HL) Decrease *HL by one.
BDB0 RET NZ Return if *HL is not zero.
BDB1 LD (HL),$06 Write 06 to *HL.
BDB3 BIT 0,A Jump to BDBC if bit 0 of A is set.
BDB5 JR NZ,$BDBC
BDB7 BIT 3,(IX+$17) Return if bit 3 of *IX+17 is not set.
BDBB RET Z
BDBC SET 3,(IX+$17) Set bit 3 of *IX+17.
BDC0 BIT 5,(IX+$13) Jump to BDCD if bit 5 of *IX+13 is not set.
BDC4 JR Z,$BDCD
BDC6 RES 5,(IX+$13) Reset bit 5 of *IX+13.
BDCA JP $B8A6 Jump to B8A6.
BDCD LD A,(IX+$28) A=*IX+28.
BDD0 AND %00011111 Keep only bits 0-4.
BDD2 BIT 4,(IX+$28) Jump to BDDE if bit 4 of *IX+28 is not set.
BDD6 JR Z,$BDDE
BDD8 CP $16 Jump to BE4E if A is lower than 16.
BDDA JR C,$BE4E
BDDC JR $BDE2 Jump to BDE2.
BDDE CP $0A Jump to BE4E if A is higher than 0A.
BDE0 JR NC,$BE4E
BDE2 BIT 5,(IX+$2F) Jump to BE4E if bit 5 of *IX+2F is set.
BDE6 JR NZ,$BE4E
BDE8 LD A,(IX+$28) A=*IX+28.
BDEB LD L,A L=A.
BDEC AND %00011111 Keep only bits 0-4.
BDEE LD C,A C=A.
BDEF LD H,(IX+$29) H=*IX+29.
BDF2 ADD HL,HL HL+=HL.
BDF3 ADD HL,HL HL+=HL.
BDF4 ADD HL,HL HL+=HL.
BDF5 LD A,H A=H.
BDF6 AND %00011111 Keep only bits 0-4.
BDF8 NEG NEG.
BDFA ADD A,$15 A+=15.
BDFC LD B,A B=A.
BDFD LD A,(IX+$10) A=*IX+10.
BE00 AND %00011111 Keep only bits 0-4.
BE02 CP C Compare A with C.
BE03 LD C,$00 C=00.
BE05 JR C,$BE09 Jump to BE09 if A is lower than C.
BE07 LD C,$10 C=10.
BE09 LD A,(IX+$07) A=*IX+07.
BE0C CP B Compare A with B.
BE0D LD B,$08 B=08.
BE0F JR NC,$BE13 Jump to BE13 if A is higher than B.
BE11 LD B,$18 B=18.
BE13 BIT 5,(IX+$17) Jump to BE1C if bit 5 of *IX+17 is not set.
BE17 JR Z,$BE1C
BE19 LD A,C A=C.
BE1A LD C,B C=B.
BE1B LD B,A B=A.
BE1C BIT 4,(IX+$17) Jump to BE35 if bit 4 of *IX+17 is set.
BE20 JR NZ,$BE35
BE22 LD A,(IX+$13) A=*IX+13.
BE25 CP C Jump to BE35 if A is equal to C.
BE26 JR Z,$BE35
BE28 LD (IX+$13),B Write B to *IX+13.
BE2B CALL $BE75 Call BE75.
BE2E SET 4,(IX+$17) Set bit 4 of *IX+17.
BE32 LD (IX+$13),C Write C to *IX+13.
BE35 CALL $BE75 Call BE75.
BE38 RES 4,(IX+$17) Reset bit 4 of *IX+17.
BE3C LD (IX+$13),B Write B to *IX+13.
BE3F CALL $BE75 Call BE75.
BE42 LD A,C A=C.
BE43 XOR %00010000 Reset bit 4.
BE45 LD (IX+$13),A Write A to *IX+13.
BE48 CALL $BE75 Call BE75.
BE4B JP $B8A6 Jump to B8A6.
BE4E BIT 1,(IX+$17) Return if bit 1 of *IX+17 is set.
BE52 RET NZ
BE53 LD BC,($B917) BC=*B917.
BE57 JR $BDFD Jump to BDFD.
Prev: BD48 Up: Map Next: BE59