Prev: B724 Up: Map Next: BB36
BADD: Routine at BADD
Used by the routine at StartGame.
BADD LD IX,$C36E IX=C36E.
BAE1 LD B,(IX+$0A) B=*IX+0A.
BAE4 LD C,(IX+$0B) C=*IX+0B.
BAE7 LD DE,$0020 DE=0020.
BAEA LD L,(IX+$0C) L=*IX+0C.
BAED LD H,(IX+$0D) H=*IX+0D.
BAF0 SET 5,H Set bit 5 of H.
BAF2 LD A,L A=L.
BAF3 AND %00011111 Keep only bits 0-4.
BAF5 CP $00 Compare A with 00.
BAF7 JR C,$BB06 Jump to BB06 if {} is lower.
BAF9 CP $00 Compare A with 00.
BAFB JR NC,$BB06 Jump to BB06 if {} is higher.
BAFD PUSH HL Stash HL and BC on the stack.
BAFE PUSH BC
BAFF SET 6,(HL) Set bit 6 of *HL.
BB01 ADD HL,DE HL+=DE.
BB02 DJNZ $BAFF Decrease counter by one and loop back to BAFF until counter is zero.
BB04 POP BC Restore BC and HL from the stack.
BB05 POP HL
BB06 INC HL Increment HL by one.
BB07 DEC C Decrease C by one.
BB08 JR NZ,$BAF2 Jump to BAF2 if {} is not zero.
BB0A LD C,(IX+$0B) C=*IX+0B.
BB0D LD L,(IX+$0C) L=*IX+0C.
BB10 LD A,(IX+$0D) A=*IX+0D.
BB13 LD DE,$0040 DE=0040.
BB16 AND %00000011 Keep only bits 0-1.
BB18 OR %00111000 Set bits 3-5.
BB1A LD H,A H=A.
BB1B ADD HL,HL HL+=HL.
BB1C INC HL Increment HL by one.
BB1D LD A,L A=L.
BB1E AND %00111111 Keep only bits 0-5.
BB20 CP $00 Compare A with 00.
BB22 JR C,$BB31 Jump to BB31 if {} is lower.
BB24 CP $00 Compare A with 00.
BB26 JR NC,$BB31 Jump to BB31 if {} is higher.
BB28 PUSH HL Stash HL and BC on the stack.
BB29 PUSH BC
BB2A RES 7,(HL) Reset bit 7 of *HL.
BB2C ADD HL,DE HL+=DE.
BB2D DJNZ $BB2A Decrease counter by one and loop back to BB2A until counter is zero.
BB2F POP BC Restore BC and HL from the stack.
BB30 POP HL
BB31 INC HL Increment HL by one.
BB32 DEC C Decrease C by one.
BB33 JR NZ,$BB1C Jump to BB1C if {} is not zero.
BB35 RET Return.
Prev: B724 Up: Map Next: BB36