| Chase H.Q. | Routines |
| Prev: A8CD | Up: Map | Next: A97E |
|
One particle is set up per frame on dirt track sections, and nothing happens unless both on_dirt_track and allow_spawning are non-zero. The sign of a random byte picks the type, 1 for a stone and 2 for dirt, and a second random byte gives the horizontal position. Both go into the particle table at $ED28 and the three self modified flags that drive the laying out and drawing of the particles are set to 1.
Used by the routines at main_loop and drive_attract_demo.
|
||||
| choose_dirt_and_stones | A955 | LD A,($A248) | Return if on_dirt_track is zero | |
| A958 | AND A | |||
| A959 | RET Z | |||
| A95A | LD A,($A254) | Return if allow_spawning is zero | ||
| A95D | AND A | |||
| A95E | RET Z | |||
| A95F | LD DE,$ED28 | Point DE at (something above the stack) | ||
| A962 | CALL rng | Generate a random byte | ||
| A965 | AND A | Store 1 (stone) if it's +ve or zero, or 2 (dirt) if it's -ve | ||
| A966 | LD A,$01 | |||
| A968 | JP P,cdas_store | |||
| A96B | INC A | |||
| cdas_store | A96C | LD (DE),A | ||
| A96D | CALL rng | Generate a random byte -- the entry's position byte; see layout_dirt_and_stones | ||
| A970 | INC DE | Store that random byte | ||
| A971 | LD (DE),A | |||
| A972 | LD A,$01 | Self modify 'LD A' @ layout_dirt_and_stones to load 1 | ||
| A974 | LD ($A97F),A | |||
| A977 | LD ($C0BC),A | Self modify 'LD A' @ rm_hazard_continue to load 1 | ||
| A97A | LD ($A9DF),A | Self modify 'LD A' @ draw_dirt_and_stones to load 1 | ||
| A97D | RET | Return | ||
| Prev: A8CD | Up: Map | Next: A97E |