Prev: 60160 Up: Map Next: 60387
60227: Display Change Controls
Used by the routine at InitialiseGame.
change-controls
DisplayChangeControls 60227 LD HL,59648 HL=Messaging_ControlSelection.
60230 LD C,4 C=4 (four "blocks" of text).
60232 EXX Switch to the shadow registers.
60233 LD DE,16480 DE'=16480 (screen buffer location).
60236 EXX Switch to the shadow registers.
Re-use the same printing routine as the start screen.
60237 CALL StartScreen_TextLoop Call StartScreen_TextLoop.
60240 LD HL,257 Write 1 to *REPDEL and 1 to *REPPER.
60243 LD (23561),HL
Add a little pause to debounce the keypress from the previous page.
60246 LD HL,0 HL=0000.
ChangeControls_DebounceLoop 60249 DEC HL Decrease HL by one.
60250 LD A,H Jump to ChangeControls_DebounceLoop until HL is zero.
60251 OR L
60252 JR NZ,ChangeControls_DebounceLoop
Get input from the keyboard.
ChangeControls_InputLoop 60254 CALL KeyboardInput Call KeyboardInput.
60257 AND A Jump to ChangeControls_InputLoop until any key is pressed.
60258 JR Z,ChangeControls_InputLoop
Test if "keyboard/ standard" control has been selected.
60260 LD HL,26664 HL=KeyboardInput.
60263 BIT 4,A Jump to ChangeControls_TestIfKempston if a key from the top row has not been pressed.
60265 JR Z,ChangeControls_TestIfKempston
Write the selected control method to *ControlMethod.
SetControlMethod 60267 LD (30800),HL Write HL to *ControlMethod.
60270 RET Return.
Test if "kempston joystick" control has been selected.
ChangeControls_TestIfKempston 60271 LD HL,59638 HL=KempstonJoystickInput.
60274 BIT 3,A Jump to SetControlMethod if a key from the second row has been pressed.
60276 JR NZ,SetControlMethod
Handle both AGF interface and "other" (user defined keys) selections.
60278 LD HL,60160 HL=UserDefinedKeysInput.
60281 LD (30800),HL Write HL to *ControlMethod.
60284 BIT 2,A Jump to SetAGFController if a key from the third row has been pressed.
60286 JP NZ,SetAGFController
60289 NOP No operation.
60290 NOP No operation.
Ask the user to set user-defined keys.
user-defined-left
60291 CALL ClearScreen_Pause Call ClearScreen_Pause.
Set the attributes.
60294 LD HL,22784 HL=22784 (attribute buffer location).
60297 LD B,64 B=64 (counter; two rows of text).
UserDefinedControls_ColourLoop 60299 LD (HL),133 Write 133 (INK: CYAN, PAPER: BLACK FLASH: ON) to *HL.
60301 INC L Increment L by one.
60302 DJNZ UserDefinedControls_ColourLoop Decrease counter by one and loop back to UserDefinedControls_ColourLoop until counter is zero.
Set the screen buffer position.
60304 EXX Switch to the shadow registers.
60305 LD D,72 D'=72.
60307 EXX Switch back to the normal registers.
Loop through each control and allow the user to set it.
60308 LD B,5 B=5 (counter; five controls to select).
60310 LD HL,60000 HL=Messaging_Left.
60313 LD DE,30803 DE=UserDefinedKeyMap.
UserDefinedControls_Loop 60316 PUSH BC Stash the control counter on the stack.
Reset the screen buffer position.
60317 EXX Switch to the shadow registers.
60318 LD E,32 E'=32.
60320 EXX Switch back to the normal registers.
Print the control select message to the screen.
60321 LD B,32 B=32 (counter; number of characters to print for this control).
60323 CALL Print_Loop Call Print_Loop.
60326 PUSH HL Stash control messaging pointer on the stack.
Reset the screen buffer position.
60327 EXX Switch to the shadow registers.
60328 LD E,0 E'=0.
60330 EXX Switch to the normal registers.
60331 LD HL,59904 HL=Messaging_ChangeControls.
60334 LD B,32 B=32 (counter; length of "change controls" string).
60336 CALL Print_Loop Call Print_Loop.
60339 LD (IY+7),0 Write 7 to *IY+7.
60343 SET 3,(IY+48) Set bit 3 of *IX+48.
60347 LD HL,23611 HL=FLAGS.
60350 RES 5,(HL) Reset bit 5 of *HL.
UserDefinedControls_InputLoop 60352 RST 56 Call MASK_INT
60353 BIT 5,(HL) Jump to UserDefinedControls_InputLoop until any key is pressed.
60355 JR Z,UserDefinedControls_InputLoop
Fetch the user keypress.
60357 LD A,(23560) A=*LAST_K.
60360 LD (DE),A Write the keypress to the current position in *UserDefinedKeyMap.
60361 INC E Move onto the next control key.
Warn the user that we debounce using pauses rather than wait for the key to be released.
user-defined-warning
60362 LD HL,59936 HL=Messaging_Warning.
60365 LD B,64 B=64 (counter; number of characters in the warning messaging).
Set the screen buffer position.
60367 EXX Switch to the shadow registers.
60368 LD E,0 E'=0.
60370 EXX Switch back to the normal registers.
60371 CALL Print_Loop Call Print_Loop.
60374 NOP No operation.
60375 NOP No operation.
60376 NOP No operation.
60377 CALL PauseLong Debounce using PauseLong.
60380 NOP No operation.
60381 NOP No operation.
60382 POP HL Restore control messaging pointer and control counter from the stack.
60383 POP BC
60384 DJNZ UserDefinedControls_Loop Decrease control counter by one and loop back to UserDefinedControls_Loop until counter is zero.
60386 RET Return.
Prev: 60160 Up: Map Next: 60387