![]() |
Routines |
Prev: 26566 | Up: Map | Next: 26675 |
Used by the routines at game_over and handle_inputs
|
||||
read_keyboard | 26587 | LD BC,65278 | 0xFEFE - matrix SHIFT, Z, X, C, V | |
26590 | IN E,(C) | Read port into E | ||
26592 | LD BC,63486 | 0xF7FE - matrix 1, 2, 3, 4, 5 | ||
26595 | IN D,(C) | Read port into D | ||
26597 | LD A,(_PLAYER_XPOS) | A holds player ship X-pos | ||
26600 | LD C,0 | C will be the pixels to move | ||
Left pressed check - look for Z or 1 being down
|
||||
26602 | BIT 1,E | Z (left) pressed? | ||
26604 | JR Z,read_keyboard_0 | Skip looking for other key (1) if yes | ||
26606 | BIT 0,D | 1 (left) pressed? | ||
26608 | JR NZ,read_keyboard_1 | Neither left key is pressed so skip to look for right pressed | ||
Move left is pressed
|
||||
read_keyboard_0 | 26610 | OR A | Is player already at leftmost position? | |
26611 | JR Z,read_keyboard_1 | Yes, can't move left then | ||
26613 | DEC C | Move one pixel left | ||
Right pressed check - look for X or 2 being down
|
||||
read_keyboard_1 | 26614 | BIT 2,E | X (right) pressed? | |
26616 | JR Z,read_keyboard_2 | Skip looking for other key (2) if yes | ||
26618 | BIT 1,D | 2 (left) pressed? | ||
26620 | JR NZ,read_keyboard_3 | Neither right key is pressed so skip to look for fire pressed | ||
Move right is pressed
|
||||
read_keyboard_2 | 26622 | CP 235 | Is player already at rightmost position? | |
26624 | JR Z,read_keyboard_3 | Yes, can't move right then | ||
26626 | INC C | Move one pixel right | ||
C contains position adjustment, -1 or +1
|
||||
read_keyboard_3 | 26627 | LD A,C | Load player ship position adjustment, -1, 0 or 1 | |
26628 | LD (_YPOS_ADJUST),A | |||
Now check for fire being pressed
|
||||
26631 | LD BC,32766 | 0x7FFE - matrix SPACE, SYM SHFT, M, N, B | ||
26634 | IN E,(C) | Read port into E | ||
26636 | BIT 0,E | Space pressed? | ||
26638 | JR Z,read_keyboard_5 | Jump to fire-pressed routine if yes | ||
26640 | BIT 4,D | D still holds number keys state, 5 pressed? | ||
26642 | JR Z,read_keyboard_5 | Jump to fire-pressed routine if yes | ||
If we drop to here fire is not pressed, B isn't pressed, so we set flags and return
|
||||
26644 | LD A,1 | Set fire released flag to 1 | ||
26646 | LD (_FIRE_RELEASED),A | |||
read_keyboard_4 | 26649 | XOR A | Set fire pressed flag to 0 | |
26650 | LD (_FIRE_PRESSED),A | |||
26653 | RET | |||
Fire is pressed, check B which is a secret button to freeze your bullet
|
||||
read_keyboard_5 | 26654 | BIT 4,E | E still contains Z-B keys state, B pressed? | |
26656 | JR NZ,read_keyboard_6 | Jump if B is not pressed | ||
Exit, B is pressed
|
||||
26658 | POP BC | Restore and return | ||
26659 | RET | |||
Fire is pressed, B is not pressed
|
||||
read_keyboard_6 | 26660 | LD A,(_FIRE_RELEASED) | Is fire released flag set to 0? Jump back and clear fire pressed flag if so | |
26663 | OR A | |||
26664 | JP Z,read_keyboard_4 | |||
26667 | LD (_FIRE_PRESSED),A | Set fire pressed flag to 1 | ||
26670 | XOR A | Set released flag to 0 | ||
26671 | LD (_FIRE_RELEASED),A | |||
26674 | RET |
Prev: 26566 | Up: Map | Next: 26675 |