|  | Routines | 
| Prev: DD53 | Up: Map | Next: DF05 | 
| 
This routine handles the Define keys option menu
 | ||||
| DD54 | CALL $DB96 | Hidden the enemy windows of the title screen (if any) | ||
| DD57 | LD HL,$0000 | Reset the keys for Rex movement defined at DD4E | ||
| DD5A | LD ($DD4E),HL | |||
| DD5D | LD ($DD50),HL | |||
| DD60 | LD ($DD52),HL | |||
| DD63 | LD IY,$DD4E | Set IY to the base address of the keys defined for Rex movement | ||
| DD67 | LD IX,$DF9F | Set IX to address of the text definition data for DEFINE KEYS | ||
| DD6B | LD B,$06 | Set B to the number of rows of the windows | ||
| DD6D | PUSH IY | Save IY | ||
| DD6F | CALL $A13E | Draws the windows DEFINE KEYS | ||
| DD72 | POP IY | Restore IY | ||
| DD74 | LD BC,$F7FE | Read keys 1-2-3-4-5 into A | ||
| DD77 | IN A,(C) | |||
| DD79 | BIT 0,A | Is key 1 pressed? | ||
| DD7B | JP Z,$DD74 | Jump back until key 1 is not pressed | ||
| DD7E | LD IX,$DFDA | Set IX to the address of the windows defintion for the highlighted options of the menu | ||
| DD82 | LD B,$01 | Set B to the number of files | ||
| DD84 | PUSH IY | Save IY | ||
| DD86 | CALL $A2DF | Draw the line of highlighted text UP | ||
| DD89 | POP IY | Restore IY | ||
| 
Handles the DEFINE UP key
 | ||||
| DD8B | CALL $DBAE | Check for UP key pressed in the DEFINE keys windows | ||
| DD8E | LD (IY+$00),A | Save the keycode of the key pressed at the UP address of the Rex movement table at DD4E | ||
| DD91 | CALL $DEF0 | Point DE to the address graphics data of the key pressed | ||
| DD94 | LD HL,$488F | Point HL to the address of the diplay file to print the character | ||
| DD97 | CALL $DEFC | Draw the grahics data of character into display file | ||
| DD9A | CALL $A4B5 | Configure check UP key pressed routine | ||
| DD9D | LD IX,$DFE2 | Set IX to the address of the text definition data for higlighted UP text | ||
| DDA1 | LD B,$01 | Set B to the number of lines | ||
| DDA3 | PUSH IY | Save IY | ||
| DDA5 | CALL $A2DF | Draws the line of higlighted text UP | ||
| DDA8 | POP IY | Restore IY | ||
| 
Handles the DEFINE DOWN key
 | ||||
| DDAA | CALL $DBAE | Check for DOWN key pressed in the DEFINE keys windows | ||
| DDAD | LD (IY+$01),A | Save the keycode of the key pressed at the DOWN address of the Rex movement table at DD4E | ||
| DDB0 | CALL $DEF0 | Point DE to the address graphics data of the key pressed | ||
| DDB3 | LD HL,$48AF | Point HL to the address of the diplay file to print the character | ||
| DDB6 | CALL $DEFC | Draw the grahics data of character into display file | ||
| DDB9 | CALL $A4CE | Configure check DOWN key pressed routine | ||
| DDBC | LD IX,$DFEC | Set IX to the address of the text definition data for higlighted LEFT text | ||
| DDC0 | LD B,$01 | Set B to the number of lines | ||
| DDC2 | PUSH IY | Save IY | ||
| DDC4 | CALL $A2DF | Draws the line of higlighted text LEFT | ||
| DDC7 | POP IY | Restore IY | ||
| 
Handles the DEFINE LEFT key
 | ||||
| DDC9 | CALL $DBAE | Check for LEFT key pressed in the DEFINE keys windows | ||
| DDCC | LD (IY+$02),A | Save the keycode of the key pressed at the LEFT address of the Rex movement table at DD4E | ||
| DDCF | CALL $DEF0 | Point DE to the address graphics data of the key pressed | ||
| DDD2 | LD HL,$48CF | Point HL to the address of the diplay file to print the character | ||
| DDD5 | CALL $DEFC | Draw the grahics data of character into display file | ||
| DDD8 | CALL $A483 | Configure check LEFT key pressed routine | ||
| DDDB | LD IX,$DFF6 | Set IX to the address of the text definition data for higlighted RIGHT text | ||
| DDDF | LD B,$01 | Set B to the number of lines | ||
| DDE1 | PUSH IY | Save IY | ||
| DDE3 | CALL $A2DF | Draws the line of higlighted text RIGHT | ||
| DDE6 | POP IY | Restore IY | ||
| 
Handles the DEFINE RIGHT key
 | ||||
| DDE8 | CALL $DBAE | Check for RIGHT key pressed in the DEFINE keys windows | ||
| DDEB | LD (IY+$03),A | Save the keycode of the key pressed at the RIGHT address of the Rex movement table at DD4E | ||
| DDEE | CALL $DEF0 | Point DE to the address graphics data of the key pressed | ||
| DDF1 | LD HL,$48EF | Point HL to the address of the diplay file to print the character | ||
| DDF4 | CALL $DEFC | Draw the grahics data of character into display file | ||
| DDF7 | CALL $A49C | Configure check RIGHT key pressed routine | ||
| DDFA | LD IX,$E001 | Set IX to the address of the text definition data for higlighted FIRE text | ||
| DDFE | LD B,$01 | Set B to the number of lines | ||
| DE00 | PUSH IY | Save IY | ||
| DE02 | CALL $A2DF | Draws the line of higlighted text FIRE | ||
| DE05 | POP IY | Restore IY | ||
| 
Handles the FIRE key
 | ||||
| DE07 | CALL $DBAE | Check for FIRE key pressed in the DEFINE keys windows | ||
| DE0A | LD (IY+$04),A | Save the keycode of the key pressed at the FIRE address of the Rex movement table at DD4E | ||
| DE0D | CALL $DEF0 | Point DE to the address graphics data of the key pressed | ||
| DE10 | LD HL,$500F | Point HL to the address of the diplay file to print the character | ||
| DE13 | CALL $DEFC | Draw the grahics data of character into display file | ||
| DE16 | CALL $A46A | Configure check FIRE key pressed routine | ||
| DE19 | LD IX,$DF8B | Points IX to the text definition data for CONFIRM KEYS windows | ||
| DE1D | JP $DE92 | Jump to show confirmation windows and handles Y/N key presses | ||
| 
This routine handles the Kempston option
 | ||||
| DE20 | CALL $DB96 | Hide the current visible enemy animation windows | ||
| DE23 | LD HL,$001F | Set A0AB to the port to read the inputs from Kempston joystick | ||
| DE26 | LD ($A0AB),HL | |||
| DE29 | LD A,$67 | Set A0AD to the BIT opcode corresponent to the FIRE button | ||
| DE2B | LD ($A0AD),A | |||
| DE2E | CALL $A46A | Configure check FIRE button pressed routine | ||
| DE31 | LD A,$5F | Set A0AD to the BIT opcode corresponent to the joystick UP | ||
| DE33 | LD ($A0AD),A | |||
| DE36 | CALL $A4B5 | Configure check joystick UP routine | ||
| DE39 | LD A,$57 | Set A0AD to the BIT opcode corresponent to the joystick DOWN | ||
| DE3B | LD ($A0AD),A | |||
| DE3E | CALL $A4CE | Configure check joystick DOWN routine | ||
| DE41 | LD A,$47 | Set A0AD to the BIT opcode corresponent to the joystick RIGHT | ||
| DE43 | LD ($A0AD),A | |||
| DE46 | CALL $A49C | Configure check joystick RIGHT routine | ||
| DE49 | LD A,$4F | Set A0AD to the BIT opcode corresponent to the joystick LEFT | ||
| DE4B | LD ($A0AD),A | |||
| DE4E | CALL $A483 | Configure check joystick LEFT routine | ||
| DE51 | LD A,$FF | Set Kempston as input device type at A0AE | ||
| DE53 | LD ($A0AE),A | |||
| DE56 | LD IX,$DF73 | Points IX to the text definition data for CONFIRM KEMPSTON windows | ||
| DE5A | JP $DED2 | Jump to show confirmation windows and handles Y/N key presses | ||
| 
This routine handles the Sinclair option
 | ||||
| DE5D | CALL $DB96 | Hide the current visible enemy animation windows | ||
| DE60 | LD HL,$EFFE | Set A0AB to the port to read the inputs from Sinclair joystick | ||
| DE63 | LD ($A0AB),HL | |||
| DE66 | LD A,$47 | Set A0AD to the BIT opcode corresponent to the FIRE button | ||
| DE68 | LD ($A0AD),A | |||
| DE6B | CALL $A46A | Configure check FIRE button pressed routine | ||
| DE6E | LD A,$4F | Set A0AD to the BIT opcode corresponent to the joystick UP | ||
| DE70 | LD ($A0AD),A | |||
| DE73 | CALL $A4B5 | Configure check joystick UP routine | ||
| DE76 | LD A,$57 | Set A0AD to the BIT opcode corresponent to the joystick DOWN | ||
| DE78 | LD ($A0AD),A | |||
| DE7B | CALL $A4CE | Configure check joystick DOWN routine | ||
| DE7E | LD A,$5F | Set A0AD to the BIT opcode corresponent to the joystick RIGHT | ||
| DE80 | LD ($A0AD),A | |||
| DE83 | CALL $A49C | Configure check joystick RIGHT routine | ||
| DE86 | LD A,$67 | Set A0AD to the BIT opcode corresponent to the joystick LEFT | ||
| DE88 | LD ($A0AD),A | |||
| DE8B | CALL $A483 | Configure check joystick LEFT routine | ||
| DE8E | LD IX,$DF45 | Points IX to the text definition data for CONFIRM SINCLAIR windows | ||
| 
Reset input device type
 | ||||
| DE92 | XOR A | Reset input device type at A0AE | ||
| DE93 | LD ($A0AE),A | |||
| DE96 | JP $DED2 | Jump to show confirmation windows and handles Y/N key presses | ||
| 
This routine handles the Cursor option
 | ||||
| DE99 | CALL $DB96 | Hide the current visible enemy animation windows | ||
| DE9C | LD HL,$EFFE | Set A0AB to the port to read the inputs FIRE, UP, DOWN and RIGHT from Sinclair joystick | ||
| DE9F | LD ($A0AB),HL | |||
| DEA2 | LD A,$47 | Set A0AD to the BIT opcode corresponent to the FIRE button | ||
| DEA4 | LD ($A0AD),A | |||
| DEA7 | CALL $A46A | Configure check FIRE button pressed routine | ||
| DEAA | LD A,$57 | Set A0AD to the BIT opcode corresponent to the joystick RIGHT | ||
| DEAC | LD ($A0AD),A | |||
| DEAF | CALL $A49C | Configure check joystick RIGHT routine | ||
| DEB2 | LD A,$5F | Set A0AD to the BIT opcode corresponent to the joystick UP | ||
| DEB4 | LD ($A0AD),A | |||
| DEB7 | CALL $A4B5 | Configure check joystick UP routine | ||
| DEBA | LD A,$67 | Set A0AD to the BIT opcode corresponent to the joystick DOWN | ||
| DEBC | LD ($A0AD),A | |||
| DEBF | CALL $A4CE | Configure check joystick DOWN routine | ||
| DEC2 | LD HL,$F7FE | Set A0AB to the port to read the input LEFT from Sinclair joystick | ||
| DEC5 | LD ($A0AB),HL | |||
| DEC8 | CALL $A483 | Configure check joystick LEFT routine | ||
| DECB | LD IX,$DF5D | Points IX to the text definition data for CONFIRM CURSOR windows | ||
| DECF | JP $DE92 | Jump to show confirmation windows and handles Y/N key presses | ||
| 
Show confirmation windows for input device and handles Y/N key press
 | ||||
| DED2 | LD B,$01 | Set B to the number of lines | ||
| DED4 | CALL $A13E | Draw input device confirmation windows | ||
| DED7 | LD BC,$DFFE | Set BC to port $DFFE for read keys P-O-I-U-Y | ||
| DEDA | IN A,(C) | Check if key Y is pressed | ||
| DEDC | BIT 4,A | |||
| DEDE | RET Z | Return if pressed. Jump to the start routine to init the game | ||
| DEDF | LD BC,$7FFE | Set BC to port $7FFE for read keys SPACE-SYM-M-N-B | ||
| DEE2 | IN A,(C) | Check if key N is pressed | ||
| DEE4 | BIT 3,A | |||
| DEE6 | JP Z,$DEEC | Jump forward if pressed | ||
| DEE9 | JP $DED7 | Jump backs and continue to read for keys if not | ||
| DEEC | JP $DAEE | Jump back to the main loop routine for the title screen | ||
| DEEF | RET | |||
| 
Point DE to the address graphics data of the key pressed
 | ||||
| DEF0 | LD L,A | Point HL to the address graphic data of the key pressed from the charset table at 60E0 | ||
| DEF1 | LD H,$00 | |||
| DEF3 | ADD HL,HL | |||
| DEF4 | ADD HL,HL | |||
| DEF5 | ADD HL,HL | |||
| DEF6 | LD DE,$5FE0 | |||
| DEF9 | ADD HL,DE | |||
| DEFA | EX DE,HL | Exchange DE and HL | ||
| DEFB | RET | |||
| 
Draw the grahics data of character into display file
 | ||||
| DEFC | LD B,$08 | Set B to the number of bytes to copy | ||
| DEFE | LD A,(DE) | Copy a byte from the graphics data to the display file | ||
| DEFF | LD (HL),A | |||
| DF00 | INC DE | Point DE to the next byte of the graphics data | ||
| DF01 | INC H | Point HL to the addres of the next row of pixels | ||
| DF02 | DJNZ $DEFE | Jump back until all the bytes are copied | ||
| DF04 | RET | |||
| Prev: DD53 | Up: Map | Next: DF05 |