Routines |
Prev: 25639 | Up: Map | Next: 25686 |
Pick a random value for the bonus out of the table, add that to the player score, then print the bonus value on screen where the spaceship is.
Used by the routine at hit_spaceship.
|
||||
award_spaceship_bonus | 25643 | LD A,(_CYCLER_4) | Pick up "just about random value" and make it 0 to 3 inclusive | |
25646 | RRA | |||
25647 | AND 3 | |||
25649 | LD HL,_BONUS_TABLE | Find entry in bonus table. Add offset into it. A now contains spaceship bonus | ||
25652 | CALL add_a_to_hl_1 | |||
25655 | LD A,(HL) | |||
25656 | LD B,A | Stash bonus in B | ||
25657 | LD HL,(_CURRENT_SCORE) | Increase score and write back. | ||
25660 | CALL add_a_to_hl_1 | |||
25663 | LD (_CURRENT_SCORE),HL | |||
Now we need to print the bonus where the spaceship is
|
||||
25666 | LD A,(_SPACESHIP_XPOS) | Pick up xpos in pixels | ||
25669 | SRL A | div 2 | ||
25671 | SRL A | div 4 | ||
25673 | SRL A | div 8 | ||
25675 | LD C,A | C=cx | ||
25676 | LD L,B | Retrieve bonus from B and add to HL. HL is points bonus as 16 bits | ||
25677 | LD H,0 | |||
25679 | LD B,1 | B=cy=1 | ||
25681 | LD A,2 | 2 chars, the print routine adds the extra '0' | ||
25683 | JP print_score | Print that number where the ship is |
Prev: 25639 | Up: Map | Next: 25686 |