![]() |
Routines |
| Prev: 882B | Up: Map | Next: 8934 |
|
Gives an object a random speed. The object is removed if it ends up with no speed at all.
|
||||||||
| SetRandomSpeed | 890D | LD A,($9BCC) | Fetch the second byte of the random seed. | |||||
| 8910 | LD B,A | Copy it into B. | ||||||
| 8911 | AND %00000110 | Keep two bits. | ||||||
| 8913 | NEG | Negate them. | ||||||
| 8915 | LD C,A | Copy the result into C. | ||||||
| 8916 | LD (IY+$09),A | Set the vertical speed of the object. | ||||||
| 8919 | LD A,B | Fetch the random value again. | ||||||
| 891A | RLCA | Rotate bits 5 to 3 into the bottom three bits. | ||||||
| 891B | RLCA | |||||||
| 891C | RLCA | |||||||
| 891D | AND %00000111 | Keep them. | ||||||
| 891F | CP $07 | Jump to SetRandomSpeed_Remove if the value is 07. | ||||||
| 8921 | JP Z,SetRandomSpeed_Remove | |||||||
| 8924 | SUB $03 | Subtract three... | ||||||
| 8926 | ADD A,A | ...and double it to get a horizontal speed. | ||||||
| 8927 | LD B,A | |||||||
| 8928 | LD (IY+$07),A | Set the horizontal speed of the object. | ||||||
| 892B | OR C | Combine the speeds. | ||||||
| 892C | JR NZ,FireShot_Sound | Jump to FireShot_Sound if the object has any speed. | ||||||
|
This entry point is used by the routine at SetFallingSpeed.
|
||||||||
| SetRandomSpeed_Remove | 892E | LD (IY+$00),$FF | Free the slot of the object. | |||||
| 8932 | JR FireShot_Sound | Jump to FireShot_Sound. | ||||||
| Prev: 882B | Up: Map | Next: 8934 |