| Chase H.Q. | Routines |
| Prev: 85E4 | Up: Map | Next: 865A |
|
Calls rng once per meter and uses the sign of the random byte to nudge that meter's level up or down, clamped to 0-7. am_set_attrs then paints the level as a row of seven attribute cells, green for signal and red for noise. Each level lives in a LD A,n operand ($8614 and $8631).
Used by the routine at run_pregame_screen.
|
||||
|
Update the first meter.
|
||||
| animate_meters | 860F | CALL rng | Generate a random byte | |
| 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 -- SUB, not DEC A, because JR NC below tests the carry flag DEC A wouldn't set | ||
| 861A | JR NC,animate_meters_1 | Jump if >= 0 | ||
| animate_meters_0 | 861C | ADD A,$01 | Increment counter -- ADD mirrors the SUB above for symmetry; INC A would work equally well since carry isn't tested 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. Essentially duplicates the above code.
|
||||
| 862C | CALL rng | Generate a random byte | ||
| 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 -- SUB, not DEC A, because JR NC below tests the carry flag DEC A wouldn't set | ||
| 8637 | JR NC,animate_meters_3 | Jump if >= 0 | ||
| animate_meters_2 | 8639 | ADD A,$01 | Increment counter -- ADD mirrors the SUB above for symmetry; INC A would work equally well since carry isn't tested 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 bright, 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 bright, 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 |