Prev: 85E4 Up: Map Next: 865A
860F: Animate the signal meters
Used by the routine at run_pregame_screen.
Update the first meter.
animate_meters 860F CALL rng Call rng
8612 AND A Set flags
8613 LD A,$00 Self modified counter
Use sign of the random value to enlarge or reduce the apparent meter level.
8615 JP P,animate_meters_0 Jump to enlarge case if random value is positive
8618 SUB $01 Decrement counter [Why use SUB here?]
861A JR NC,animate_meters_1 Jump if >= 0
animate_meters_0 861C ADD A,$01 Increment counter [Why use ADD here?]
861E CP $08 Jump if < 8
8620 JR C,animate_meters_1
8622 DEC A Decrement counter (max out at 7)
animate_meters_1 8623 LD ($8614),A Self modify counter in 8613
8626 LD HL,$5A17 Screen attribute (23,16)
8629 CALL am_set_attrs Call am_set_attrs
Update the second meter. Repeats the above.
862C CALL rng Call rng
862F AND A Set flags
8630 LD A,$00 Self modified counter
Use sign of the random value to enlarge or reduce the apparent meter level.
8632 JP P,animate_meters_2 Jump to enlarge case if random value is positive
8635 SUB $01 Decrement counter [Why use SUB here?]
8637 JR NC,animate_meters_3 Jump if >= 0
animate_meters_2 8639 ADD A,$01 Increment counter [Why use ADD here?]
863B CP $08 Jump if < 8
863D JR C,animate_meters_3
863F DEC A Decrement counter (max out at 7)
animate_meters_3 8640 LD ($8631),A Self modify counter in 8630
8643 LD HL,$5A57 Screen attribute (23,18)
The signal meter bar is seven segments wide. Fill the left hand portion with our chosen amount of green segments and the right hand side with the complement of red segments.
am_set_attrs 8646 AND A Set flags from counter in A
8647 JR Z,am_set_right_attrs Jump if zero
8649 LD B,A Copy counter to loop counter
animate_meters_4 864A LD (HL),$60 Set attribute byte to black ink over green
864C INC L
864D DJNZ animate_meters_4 Loop while B > 0
am_set_right_attrs 864F CPL A = 7 - A
8650 ADD A,$08
8652 RET Z Return if zero
8653 LD B,A Copy counter to loop counter
animate_meters_5 8654 LD (HL),$50 Set attribute byte to black ink over red
8656 INC L
8657 DJNZ animate_meters_5 Loop while B > 0
8659 RET Return
Prev: 85E4 Up: Map Next: 865A