![]() |
Routines |
| Prev: F981 | Up: Map | Next: FAA8 |
|
Used by the routine at SelectionScreen.
|
|||||
| ChangeControls | F9BF | CALL GetKeypress | Call GetKeypress. | ||
| F9C2 | JR NZ,ChangeControls | Loop back to ChangeControls until a key is pressed. | |||
|
Reset the control type for all monsters.
|
|||||
| F9C4 | LD A,$FF | Write FF to: | |||
| F9C6 | LD ($CFE0),A | ||||
| F9C9 | LD ($D00F),A | ||||
| F9CC | LD ($D03E),A | ||||
|
Set up a count for how many players will be using the keyboard (see ChangeControls_Keyboard).
|
|||||
| F9CF | LD A,$03 | Write 03 to *Keyboard_Control_Count. | |||
| F9D1 | LD ($FB5A),A | ||||
|
Create a "change controls" page for George:
|
|||||
| F9D4 | CALL CreateAdminPageTemplate | Call CreateAdminPageTemplate. | |||
| F9D7 | LD HL,$D05F | HL=Messaging_George. | |||
| F9DA | LD IX,$CFD2 | IX=George_State. | |||
| F9DE | CALL ChangeControls_Action | Call ChangeControls_Action. | |||
|
Create a "change controls" page for Lizzy.
|
|||||
| F9E1 | CALL CreateAdminPageTemplate | Call CreateAdminPageTemplate. | |||
| F9E4 | LD IX,$D001 | IX=Lizzy_State. | |||
| F9E8 | LD HL,$D06D | HL=Messaging_Lizzy. | |||
| F9EB | CALL ChangeControls_Action | Call ChangeControls_Action. | |||
|
Create a "change controls" page for Ralph.
|
|||||
| F9EE | CALL CreateAdminPageTemplate | Call CreateAdminPageTemplate. | |||
| F9F1 | LD IX,$D030 | IX=Ralph_State. | |||
| F9F5 | LD HL,$D07B | HL=Messaging_Ralph. | |||
| F9F8 | CALL ChangeControls_Action | Call ChangeControls_Action. | |||
| F9FB | RET | Return. | |||
|
Print the monster name.
|
|||||
| ChangeControls_Action | F9FC | LD BC,$0804 | BC=0804 (screen co-ordinates). | ||
| F9FF | CALL PrintString | Call PrintString. | |||
|
Prints "SELECT THE CONTROLS FOR".
|
|||||
| FA02 | LD HL,$D0D5 | HL=Messaging_ChangeControls. | |||
| FA05 | LD BC,$0303 | BC=0303 (screen co-ordinates). | |||
| FA08 | CALL PrintString | Call PrintString. | |||
| FA0B | INC HL | Move onto the start of the next message. | |||
| FA0C | LD BC,$0502 | BC=0502 (screen co-ordinates). | |||
| FA0F | CALL PrintString | Call PrintString. | |||
|
Programmatically display all the Messaging_ChooseControls options.
|
|||||
| FA12 | LD HL,$D133 | HL=Messaging_ChooseControls. | |||
| FA15 | XOR A | A=00 (option counter). | |||
| ChangeControls_PrintLoop | FA16 | PUSH AF | Stash the option counter on the stack. | ||
|
The options are two lines apart and start from row 0B.
|
|||||
| FA17 | ADD A,A | B=0B+A*02. | |||
| FA18 | ADD A,$0B | ||||
| FA1A | LD B,A | ||||
| FA1B | LD C,$01 | C=01 (screen co-ordinates). | |||
| FA1D | CALL PrintString | Call PrintString. | |||
| FA20 | INC HL | Move onto the start of the next message. | |||
| FA21 | POP AF | Restore the option counter from the stack. | |||
| FA22 | INC A | Increment the option counter by one. | |||
|
Note we only show five options "N - NO MONSTER" is never used.
|
|||||
| FA23 | CP $05 | Jump to ChangeControls_PrintLoop until the option counter is equal to 05. | |||
| FA25 | JR NZ,ChangeControls_PrintLoop | ||||
|
Prints the last line manually " CONTROLLED" (as it's the second line of the option before it).
|
|||||
| FA27 | LD BC,$1401 | BC=1401 (screen co-ordinates). | |||
| FA2A | CALL PrintString | Call PrintString. | |||
|
Output to the screen buffer.
|
|||||
| FA2D | CALL ScreenBuffer_Update | Call ScreenBuffer_Update. | |||
| FA30 | CALL AttributeBuffer_Update | Call AttributeBuffer_Update. | |||
| ChangeControls_Input | FA33 | CALL ChooseControlType | Call ChooseControlType. | ||
| FA36 | JR NZ,ChangeControls_Input | Loop back to ChangeControls_Input until an option has been selected. | |||
|
Process the selected option.
|
|||||
| FA38 | LD A,D | A=control option. | |||
| FA39 | CP $FF | Jump to ChangeControls_Input if the control option is invalid. | |||
| FA3B | JR Z,ChangeControls_Input | ||||
| FA3D | CP $11 | Jump to ChangeControls_Keyboard if "K" was pressed. | |||
| FA3F | JR Z,ChangeControls_Keyboard | ||||
| FA41 | CP $24 | Jump to ChangeControls_Sinclair1 if "1" was pressed. | |||
| FA43 | JR Z,ChangeControls_Sinclair1 | ||||
| FA45 | CP $1C | Jump to ChangeControls_Sinclair2 if "2" was pressed. | |||
| FA47 | JR Z,ChangeControls_Sinclair2 | ||||
| FA49 | CP $14 | Jump to ChangeControls_Kempston if "3" was pressed. | |||
| FA4B | JR Z,ChangeControls_Kempston | ||||
| FA4D | CP $0F | Jump to ChangeControls_Computer if "C" was pressed. | |||
| FA4F | JR Z,ChangeControls_Computer | ||||
| FA51 | JR ChangeControls_Input | Jump to ChangeControls_Input. | |||
|
Set "Keyboard" as the control method.
|
|||||
| ChangeControls_Keyboard | FA53 | CALL UserDefinedKeys | Call UserDefinedKeys. | ||
|
Each set of user defined keys will have a different control method ID starting from 04.
|
|||||
| FA56 | LD A,($FB5A) | A=*Keyboard_Control_Count. | |||
| FA59 | INC A | Increment A by one. | |||
| FA5A | LD ($FB5A),A | Write A to *Keyboard_Control_Count. | |||
| FA5D | LD (IX+$0E),A | Write A to *IX+0E (monster control type). | |||
|
Calculate where the user defined keys will be stored.
|
|||||
| FA60 | SUB $04 | A-=04. | |||
| FA62 | ADD A,A | A*=02. | |||
| FA63 | LD D,A | D=A. | |||
| FA64 | ADD A,A | A*=04. | |||
| FA65 | ADD A,A | ||||
| FA66 | ADD A,D | A+=D. | |||
| FA67 | LD H,$00 | Create an offset using HL. | |||
| FA69 | LD L,A | ||||
| FA6A | LD DE,$C850 | HL+=UserDefinedKeys_Set1. | |||
| FA6D | ADD HL,DE | ||||
| FA6E | EX DE,HL | Exchange the DE and HL registers. | |||
| FA6F | LD HL,$FB4E | HL=UserDefinedKeys_Buffer. | |||
| FA72 | LD BC,$000A | BC=000A. | |||
| FA75 | LDIR | Copy selected keys to monster config. | |||
| FA77 | RET | Return. | |||
|
Set "Sinclair Interface 2" (port 1) as the control method.
|
|||||
| ChangeControls_Sinclair1 | FA78 | LD D,$02 | D=02. | ||
| FA7A | JR SetControlType | Jump to SetControlType. | |||
|
Set "Sinclair Interface 2" (port 2) as the control method.
|
|||||
| ChangeControls_Sinclair2 | FA7C | LD D,$01 | D=01. | ||
| FA7E | JR SetControlType | Jump to SetControlType. | |||
|
Set "Kempston Joystick" as the control method.
|
|||||
| ChangeControls_Kempston | FA80 | LD D,$03 | D=03. | ||
| SetControlType | FA82 | CALL CheckExistingControls | Call CheckExistingControls. | ||
| FA85 | JR Z,ChangeControls_Input | Jump to ChangeControls_Input if the control type is already selected by another monster. | |||
| FA87 | LD (IX+$0E),D | Write the control type to *IX+0E (monster control type). | |||
| FA8A | RET | Return. | |||
|
Set "Computer Controlled" as the control method.
|
|||||
| ChangeControls_Computer | FA8B | LD (IX+$0E),$00 | Write 00 to *IX+0E (monster control type). | ||
| ChangeControls_Computer_KeyPress | FA8F | CALL GetKeypress | Call GetKeypress. | ||
| FA92 | JR NZ,ChangeControls_Computer_KeyPress | Loop back to ChangeControls_Computer_KeyPress until a key has been pressed. | |||
| FA94 | RET | Return. | |||
|
Monsters can't use the same controllers, this is verified here.
|
|||||
| CheckExistingControls | FA95 | LD A,($CFE0) | Return if *George_Control_Type is equal to the currently selected control method. | ||
| FA98 | CP D | ||||
| FA99 | RET Z | ||||
| FA9A | LD A,($D00F) | Return if *Lizzy_Control_Type is equal to the currently selected control method. | |||
| FA9D | CP D | ||||
| FA9E | RET Z | ||||
| FA9F | LD A,($D03E) | Return if *Ralph_Control_Type is equal to the currently selected control method. | |||
| FAA2 | CP D | ||||
| FAA3 | RET Z | ||||
|
Ensure ZERO flag is not set for the return.
|
|||||
| FAA4 | LD A,$01 | A=01. | |||
| FAA6 | OR A | Set the bits from A. | |||
| FAA7 | RET | Return. | |||
| Prev: F981 | Up: Map | Next: FAA8 |