Prev: BACE Up: Map Next: BB3E
BAD8: Game Initialisation
Used by the routines at Demo_Start and GameLoop.
Game_Initialisation BAD8 LD IY,$BC67 IY=FrameId_Wally.
BADC LD ($B09D),IY Write IY to CurrentCharacter.
BAE0 LD HL,$BB3E HL=BB3E.
BAE3 LD DE,$BCE9 DE=Items_TownSquare.
BAE6 LD B,$1F B=1F (counter).
Game_Initialisation_0 BAE8 PUSH BC Stash BC on the stack.
Game_Initialisation_1 BAE9 LD A,(DE) A=*DE.
BAEA CP $FF If A is not the terminator (FF) jump to Game_Initialisation_2.
BAEC JR NZ,Game_Initialisation_2
BAEE INC DE Increment DE by one.
BAEF JR Game_Initialisation_1 Jump to Game_Initialisation_1.
Game_Initialisation_2 BAF1 LDI
BAF3 INC DE Increment DE by two.
BAF4 INC DE
BAF5 LDI
BAF7 POP BC Restore BC from the stack.
BAF8 DJNZ Game_Initialisation_0 Decrease counter by one and loop back to Game_Initialisation_0 until counter is zero.
BAFA LD BC,$00AF BC=00AF.
BAFD LD HL,$BB7C HL=BB7C.
BB00 LD DE,$BC30 DE=BC30.
BB03 LDIR
BB05 XOR A Write 00 to:
BB06 LD ($ECF5),A
BB09 LD ($ECFE),A
BB0C LD ($ECFF),A
BB0F INC A Write 01 to EDC5.
BB10 LD ($EDC5),A
BB13 LD A,$14 Write 14 to F9F4.
BB15 LD ($F9F4),A
BB18 LD A,$28 Write 28 to F5BE.
BB1A LD ($F5BE),A
BB1D LD A,$3C Write 3C to F5C2.
BB1F LD ($F5C2),A
BB22 LD A,$20 Write 20 to F5C6.
BB24 LD ($F5C6),A
BB27 LD HL,$EC5C HL=EC5C.
BB2A LD B,$20 B=20 (counter).
Game_Initialisation_3 BB2C LD (HL),$00 Write 00 to *HL.
BB2E INC HL Increment HL by three.
BB2F INC HL
BB30 INC HL
BB31 DJNZ Game_Initialisation_3 Decrease counter by one and loop back to Game_Initialisation_3 until counter is zero.
BB33 LD HL,$EC0F HL=Flag_Bottle_Full.
BB36 LD B,$0E B=0E.
Game_Initialisation_4 BB38 LD (HL),$00 Write 00 to *HL.
BB3A INC HL Increment HL by one.
BB3B DJNZ Game_Initialisation_4 Decrease counter by one and loop back to Game_Initialisation_4 until counter is zero.
BB3D RET Return.
Prev: BACE Up: Map Next: BB3E