Prev: 46191 Up: Map Next: 46408
46359: Initialise Opponent
Used by the routine at 43530.
Input
A Opponent number
InitialiseOpponent 46359 LD E,6 E=6.
46361 CALL 43125 Call 43125.
46364 LD HL,46212 HL=Table_Opponent_BeerBellyBill.
46367 LD DE,21 Set the length of the opponent data in DE (0021 bytes).
46370 LD C,A C=the opponent ID.
46371 AND A Set a counter in B of the opponent ID.
46372 LD B,A
46373 JR Z,FoundOpponentData Jump to FoundOpponentData if the opponent counter is zero.
FindOpponentData_Loop 46375 ADD HL,DE Move HL to the next opponent data block.
46376 DJNZ FindOpponentData_Loop Decrease the opponent counter by one and loop back to FindOpponentData_Loop until the counter is zero.
HL now points to the opponent data block.
FoundOpponentData 46378 LD (39713),HL Write the opponent data pointer to *QuarterFinals_OpponentData.
InitialiseOpponent_0 46381 PUSH BC Stash BC on the stack.
46382 LD E,6 E=6.
46384 CALL 43125 Call 43125.
46387 POP BC Restore BC from the stack.
46388 CP C Jump to InitialiseOpponent_0 if A is equal to C.
46389 JR Z,InitialiseOpponent_0
46391 LD HL,46212 HL=Table_Opponent_BeerBellyBill.
46394 LD DE,21 Set the length of the opponent data in DE (0021 bytes).
46397 AND A Set a counter in B of the opponent ID.
46398 LD B,A
46399 JR Z,InitialiseOpponent_2 Jump to InitialiseOpponent_2 if the opponent counter is zero.
InitialiseOpponent_1 46401 ADD HL,DE Move HL to the next opponent data block.
46402 DJNZ InitialiseOpponent_1 Decrease the opponent counter by one and loop back to InitialiseOpponent_1 until the counter is zero.
InitialiseOpponent_2 46404 LD (39715),HL Write HL to *SemiFinals_OpponentData.
46407 RET Return.
Prev: 46191 Up: Map Next: 46408