Prev: A77E Up: Map Next: A7E1
A78C: Controller: Name Selection
Used by the routine at Player_Name.
Input
HL Either Name_1UP or Name_2UP.
Controller_NameSelect A78C LD A,($AB8A) A=*Game_Flags.
A78F AND %11110000 Keep only bits 4-7.
A791 OR %00001000 Set bit 3.
A793 LD ($AB8A),A Write A back to Game_Flags.
Handler_NameSelect_Loop A796 LD A,$00 Write 00 to CC3D.
A798 LD ($CC3D),A
This entry point is used by the routine at Handler_NameSelect_Up.
Controller_NameSelect_0 A79B PUSH HL Stash HL on the stack.
A79C LD B,$0A B=0A.
Controller_NameSelect_1 A79E CALL $CB9C Call CB9C.
A7A1 LD HL,$CC3D HL=CC3D.
A7A4 LD (HL),$00 Write 00 to *HL.
A7A6 DJNZ Controller_NameSelect_1 Decrease counter by one and loop back to Controller_NameSelect_1 until counter is zero.
A7A8 LD (HL),$01 Write 01 to *HL.
A7AA LD HL,$0080 Write 0080 HL to *CC3B.
A7AD LD ($CC3B),HL
A7B0 CALL Handler_DebounceSpace Call Handler_DebounceSpace.
A7B3 POP HL Restore HL from the stack.
A7B4 CALL Handler_Controls Call Handler_Controls.
A7B7 LD A,E A=E.
Was "up" pressed?
A7B8 CP $18 Jump to Handler_NameSelect_Up if A is 18
A7BA JR Z,Handler_NameSelect_Up
Was "down" pressed?
A7BC CP $08 Jump to Handler_NameSelect_Down if A is 08.
A7BE JR Z,Handler_NameSelect_Down
Was "fire" not pressed?
A7C0 CP $80 Jump to Handler_NameSelect_Loop if A is not 80.
A7C2 JR NZ,Handler_NameSelect_Loop
A7C4 PUSH HL Stash HL on the stack.
A7C5 LD HL,$0040 Write 0040 to *CC3B.
A7C8 LD ($CC3B),HL
A7CB LD HL,$AB8A Decrease *Game_Flags by one.
A7CE DEC (HL)
A7CF LD A,$07 A=07.
A7D1 AND (HL) Merge the bits from *HL.
A7D2 JR Z,Controller_NameSelect_2 Jump to Controller_NameSelect_2 if the result is zero.
A7D4 CALL $A83A Call A83A.
A7D7 CALL Handler_Debounce_Controls Call Handler_Debounce_Controls.
A7DA POP HL Restore HL from the stack.
A7DB INC HL Increment HL by one.
A7DC HALT Halt operation (suspend CPU until the next interrupt).
A7DD JR Controller_NameSelect_0 Jump to Controller_NameSelect_0.
Controller_NameSelect_2 A7DF POP HL Restore HL from the stack.
A7E0 RET Return.
Prev: A77E Up: Map Next: A7E1