| Gyruss | Routines |
| Prev: A6D2 | Up: Map | Next: A73C |
|
Used by the routines at perfect_bonus and add_points_from_enemy.
|
||||||||
| add_score | A6EC | PUSH DE | ||||||
| A6ED | PUSH BC | |||||||
| A6EE | LD (points_to_add),HL | Save points to add (this buffer has one more byte) | ||||||
| A6F1 | LD A,(current_player) | Current player | ||||||
| A6F4 | LD DE,score_player_1 | Score player 1 | ||||||
| A6F7 | OR A | Is it player 1? | ||||||
| A6F8 | JR Z,add_score_0 | The skip ahead | ||||||
| A6FA | LD DE,score_player_2 | Score player 2 | ||||||
| add_score_0 | A6FD | PUSH DE | Save pointer to score | |||||
| A6FE | LD HL,points_to_add | Pointer to points to add | ||||||
| A701 | LD B,$03 | 3 bytes in score | ||||||
| add_score_1 | A703 | LD A,(DE) | Get score byte | |||||
| A704 | ADC A,(HL) | Add points | ||||||
| A705 | DAA | Adjust for BCD | ||||||
| A706 | LD (DE),A | Store score byte | ||||||
| A707 | INC DE | Next score byte | ||||||
| A708 | INC HL | Next points byte | ||||||
| A709 | DJNZ add_score_1 | Loop 3 times | ||||||
| A70B | POP DE | Restore pointer to score | ||||||
| A70C | INC DE | Advance to last byte of extra life score $71F5 or $71FB | ||||||
| A70D | INC DE | ... | ||||||
| A70E | LD HL,$0003 | Point HL to byte at score_extra_life_1_MSB or score_extra_life_2_MSB (initially set to 6) | ||||||
| A711 | ADD HL,DE | ... | ||||||
| A712 | PUSH HL | Save pointer | ||||||
| A713 | LD B,$03 | 3 bytes to check | ||||||
| add_score_2 | A715 | LD A,(DE) | Get score byte | |||||
| A716 | CP (HL) | Compare with extra life byte | ||||||
| A717 | JR NZ,add_score_3 | Exit loop if not equal | ||||||
| A719 | DEC DE | Previous score byte | ||||||
| A71A | DEC HL | Previous extra life byte | ||||||
| A71B | DJNZ add_score_2 | Loop 3 times | ||||||
| A71D | XOR A | All equal, set A = 0 | ||||||
| add_score_3 | A71E | POP HL | Restore pointer to score_extra_life_1_MSB or score_extra_life_2_MSB | |||||
| A71F | JR C,add_score_4 | Return if extra life byte was bigger | ||||||
| A721 | LD A,(HL) | Next extra life at 80000 more points | ||||||
| A722 | ADD A,$08 | ... | ||||||
| A724 | DAA | ... | ||||||
| A725 | LD (HL),A | ... | ||||||
| A726 | LD A,(lives) | Get lives | ||||||
| A729 | CP $09 | Return if already 9 | ||||||
| A72B | JR NC,add_score_4 | ... | ||||||
| A72D | INC A | Extra life | ||||||
| A72E | LD (lives),A | Save it | ||||||
| A731 | CALL display_lives | Display lives | ||||||
| A734 | LD A,$06 | Play a sound | ||||||
| A736 | CALL call_play_sound | ... | ||||||
| add_score_4 | A739 | POP BC | ||||||
| A73A | POP DE | |||||||
| A73B | RET | |||||||
| Prev: A6D2 | Up: Map | Next: A73C |