jetpac | Routines |
Prev: 633d | Up: Map | Next: 63a3 |
If one of the players score is a new max score, then update the high score with that of the player with the highest score. Used by the routine at 60b7.
|
||||
6361 | ld hl,($5cf4) | HL=player 1 score | ||
6364 | ld de,($5cf7) | DE=player 2 score | ||
6368 | ld a,l | Swap the P1 LSB/MSB values so we can perform calculations on them. | ||
6369 | ld l,h | |||
636a | ld h,a | |||
636b | ld a,e | Swap the P2 LSB/MSB values so we can perform calculations on them | ||
636c | ld e,d | |||
636d | ld d,a | |||
636e | and a | Reset the Carry flag | ||
636f | sbc hl,de | |||
6371 | jr c,$637f | Jump if score P2 > P1, else | ||
6373 | jr nz,$639e | Jump if score P1 > P2, else P1==P2, so no jump | ||
6375 | ld a,($5cf6) | E=3rd byte of the P1 score | ||
6378 | ld e,a | |||
6379 | ld a,($5cf9) | A=3rd byte of the P2 score | ||
637c | cp e | |||
637d | jr c,$639e | Jump if score of P2 < P1 (set's HL to P1 score) | ||
Inactive player has the highest score.
|
||||
637f | ld hl,$5cf7 | HL=P2 score | ||
Update the high score if the player score has beaten it.
|
||||
6382 | push hl | |||
6383 | ld de,$5cf0 | DE=high score | ||
6386 | ld b,$03 | Loop counter (all 3 score bytes) | ||
6388 | ld a,(de) | A = hi-score byte | ||
6389 | cp (hl) | Compare with player | ||
638a | jr c,$6394 | If hi-score < player, update highscore score | ||
638c | jr nz,$6392 | If hi-score != player (not equal), then RET | ||
638e | inc hl | else hi-score == player: next player byte | ||
638f | inc de | next high score byte | ||
6390 | djnz $6388 | Repeat | ||
6392 | pop hl | Restores HL to the highest player score | ||
6393 | ret | |||
Sets the bytes for the high score with those from the player.
|
||||
6394 | pop hl | |||
6395 | ld de,$5cf0 | High Score | ||
6398 | ld bc,$0003 | |||
639b | ldir | |||
639d | ret | |||
Player 1 has the highest score.
|
||||
639e | ld hl,$5cf4 | HL=P1 score | ||
63a1 | jr $6382 | Update HI score |
Prev: 633d | Up: Map | Next: 63a3 |