Prev: 42878 Up: Map Next: 42977
42892: Controller: Name Selection
Used by the routine at Player_Name.
Input
HL Either Name_1UP or Name_2UP.
Controller_NameSelect 42892 LD A,(43914) A=*Game_Flags.
42895 AND %11110000 Keep only bits 4-7.
42897 OR %00001000 Set bit 3.
42899 LD (43914),A Write A back to Game_Flags.
Handler_NameSelect_Loop 42902 LD A,0 Write 0 to 52285.
42904 LD (52285),A
This entry point is used by the routine at Handler_NameSelect_Up.
Controller_NameSelect_0 42907 PUSH HL Stash HL on the stack.
42908 LD B,10 B=10.
Controller_NameSelect_1 42910 CALL 52124 Call 52124.
42913 LD HL,52285 HL=52285.
42916 LD (HL),0 Write 0 to *HL.
42918 DJNZ Controller_NameSelect_1 Decrease counter by one and loop back to Controller_NameSelect_1 until counter is zero.
42920 LD (HL),1 Write 1 to *HL.
42922 LD HL,128 Write 0128 HL to *52283.
42925 LD (52283),HL
42928 CALL Handler_DebounceSpace Call Handler_DebounceSpace.
42931 POP HL Restore HL from the stack.
42932 CALL Handler_Controls Call Handler_Controls.
42935 LD A,E A=E.
Was "up" pressed?
42936 CP 24 Jump to Handler_NameSelect_Up if A is 24
42938 JR Z,Handler_NameSelect_Up
Was "down" pressed?
42940 CP 8 Jump to Handler_NameSelect_Down if A is 8.
42942 JR Z,Handler_NameSelect_Down
Was "fire" not pressed?
42944 CP 128 Jump to Handler_NameSelect_Loop if A is not 128.
42946 JR NZ,Handler_NameSelect_Loop
42948 PUSH HL Stash HL on the stack.
42949 LD HL,64 Write 0064 to *52283.
42952 LD (52283),HL
42955 LD HL,43914 Decrease *Game_Flags by one.
42958 DEC (HL)
42959 LD A,7 A=7.
42961 AND (HL) Merge the bits from *HL.
42962 JR Z,Controller_NameSelect_2 Jump to Controller_NameSelect_2 if the result is zero.
42964 CALL 43066 Call 43066.
42967 CALL Handler_Debounce_Controls Call Handler_Debounce_Controls.
42970 POP HL Restore HL from the stack.
42971 INC HL Increment HL by one.
42972 HALT Halt operation (suspend CPU until the next interrupt).
42973 JR Controller_NameSelect_0 Jump to Controller_NameSelect_0.
Controller_NameSelect_2 42975 POP HL Restore HL from the stack.
42976 RET Return.
Prev: 42878 Up: Map Next: 42977