Prev: EB00 Up: Map Next: EBE3
EB43: Display Change Controls
Used by the routine at InitialiseGame.
change-controls
DisplayChangeControls EB43 LD HL,$E900 HL=Messaging_ControlSelection.
EB46 LD C,$04 C=04 (four "blocks" of text).
EB48 EXX Switch to the shadow registers.
EB49 LD DE,$4060 DE'=4060 (screen buffer location).
EB4C EXX Switch to the shadow registers.
Re-use the same printing routine as the start screen.
EB4D CALL StartScreen_TextLoop Call StartScreen_TextLoop.
EB50 LD HL,$0101 Write 01 to *REPDEL and 01 to *REPPER.
EB53 LD ($5C09),HL
Add a little pause to debounce the keypress from the previous page.
EB56 LD HL,$0000 HL=0000.
ChangeControls_DebounceLoop EB59 DEC HL Decrease HL by one.
EB5A LD A,H Jump to ChangeControls_DebounceLoop until HL is zero.
EB5B OR L
EB5C JR NZ,ChangeControls_DebounceLoop
Get input from the keyboard.
ChangeControls_InputLoop EB5E CALL KeyboardInput Call KeyboardInput.
EB61 AND A Jump to ChangeControls_InputLoop until any key is pressed.
EB62 JR Z,ChangeControls_InputLoop
Test if "keyboard/ standard" control has been selected.
EB64 LD HL,$6828 HL=KeyboardInput.
EB67 BIT 4,A Jump to ChangeControls_TestIfKempston if a key from the top row has not been pressed.
EB69 JR Z,ChangeControls_TestIfKempston
Write the selected control method to *ControlMethod.
SetControlMethod EB6B LD ($7850),HL Write HL to *ControlMethod.
EB6E RET Return.
Test if "kempston joystick" control has been selected.
ChangeControls_TestIfKempston EB6F LD HL,$E8F6 HL=KempstonJoystickInput.
EB72 BIT 3,A Jump to SetControlMethod if a key from the second row has been pressed.
EB74 JR NZ,SetControlMethod
Handle both AGF interface and "other" (user defined keys) selections.
EB76 LD HL,$EB00 HL=UserDefinedKeysInput.
EB79 LD ($7850),HL Write HL to *ControlMethod.
EB7C BIT 2,A Jump to SetAGFController if a key from the third row has been pressed.
EB7E JP NZ,SetAGFController
EB81 NOP No operation.
EB82 NOP No operation.
Ask the user to set user-defined keys.
user-defined-left
EB83 CALL ClearScreen_Pause Call ClearScreen_Pause.
Set the attributes.
EB86 LD HL,$5900 HL=5900 (attribute buffer location).
EB89 LD B,$40 B=40 (counter; two rows of text).
UserDefinedControls_ColourLoop EB8B LD (HL),$85 Write 85 (INK: CYAN, PAPER: BLACK FLASH: ON) to *HL.
EB8D INC L Increment L by one.
EB8E DJNZ UserDefinedControls_ColourLoop Decrease counter by one and loop back to UserDefinedControls_ColourLoop until counter is zero.
Set the screen buffer position.
EB90 EXX Switch to the shadow registers.
EB91 LD D,$48 D'=48.
EB93 EXX Switch back to the normal registers.
Loop through each control and allow the user to set it.
EB94 LD B,$05 B=05 (counter; five controls to select).
EB96 LD HL,$EA60 HL=Messaging_Left.
EB99 LD DE,$7853 DE=UserDefinedKeyMap.
UserDefinedControls_Loop EB9C PUSH BC Stash the control counter on the stack.
Reset the screen buffer position.
EB9D EXX Switch to the shadow registers.
EB9E LD E,$20 E'=20.
EBA0 EXX Switch back to the normal registers.
Print the control select message to the screen.
EBA1 LD B,$20 B=20 (counter; number of characters to print for this control).
EBA3 CALL Print_Loop Call Print_Loop.
EBA6 PUSH HL Stash control messaging pointer on the stack.
Reset the screen buffer position.
EBA7 EXX Switch to the shadow registers.
EBA8 LD E,$00 E'=00.
EBAA EXX Switch to the normal registers.
EBAB LD HL,$EA00 HL=Messaging_ChangeControls.
EBAE LD B,$20 B=20 (counter; length of "change controls" string).
EBB0 CALL Print_Loop Call Print_Loop.
EBB3 LD (IY+$07),$00 Write 07 to *IY+07.
EBB7 SET 3,(IY+$30) Set bit 3 of *IX+30.
EBBB LD HL,$5C3B HL=FLAGS.
EBBE RES 5,(HL) Reset bit 5 of *HL.
UserDefinedControls_InputLoop EBC0 RST $38 Call MASK_INT
EBC1 BIT 5,(HL) Jump to UserDefinedControls_InputLoop until any key is pressed.
EBC3 JR Z,UserDefinedControls_InputLoop
Fetch the user keypress.
EBC5 LD A,($5C08) A=*LAST_K.
EBC8 LD (DE),A Write the keypress to the current position in *UserDefinedKeyMap.
EBC9 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
EBCA LD HL,$EA20 HL=Messaging_Warning.
EBCD LD B,$40 B=40 (counter; number of characters in the warning messaging).
Set the screen buffer position.
EBCF EXX Switch to the shadow registers.
EBD0 LD E,$00 E'=00.
EBD2 EXX Switch back to the normal registers.
EBD3 CALL Print_Loop Call Print_Loop.
EBD6 NOP No operation.
EBD7 NOP No operation.
EBD8 NOP No operation.
EBD9 CALL PauseLong Debounce using PauseLong.
EBDC NOP No operation.
EBDD NOP No operation.
EBDE POP HL Restore control messaging pointer and control counter from the stack.
EBDF POP BC
EBE0 DJNZ UserDefinedControls_Loop Decrease control counter by one and loop back to UserDefinedControls_Loop until counter is zero.
EBE2 RET Return.
Prev: EB00 Up: Map Next: EBE3