![]() |
Routines |
| Prev: 65D2 | Up: Map | Next: 65E6 |
|
Used by the routines at GameLoop and ActionKill.
Return a number derived from the frame counter, used when an event may or may not happen.
|
||||||||
| GenerateRandomNumber | 65D6 | PUSH BC | Take the frame counter as a countdown, limited by the value passed in. | |||||
| 65D7 | LD C,A | |||||||
| 65D8 | LD A,($5C78) | |||||||
| 65DB | LD B,A | |||||||
| 65DC | LD A,C | |||||||
| GenerateRandomNumber_Loop1 | 65DD | DEC A | Wrap back to that limit when the countdown passes zero. | |||||
| 65DE | JR NZ,GenerateRandomNumber_Step1 | |||||||
| 65E0 | LD A,C | |||||||
| GenerateRandomNumber_Step1 | 65E1 | DJNZ GenerateRandomNumber_Loop1 | Repeat for every frame that has passed. | |||||
| 65E3 | DEC A | Step the result back one more. | ||||||
| 65E4 | POP BC | Restore the registers the caller needs from the stack. | ||||||
| 65E5 | RET | Return. | ||||||
| Prev: 65D2 | Up: Map | Next: 65E6 |