![]() |
Routines |
| Prev: 26066 | Up: Map | Next: 26086 |
|
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 | 26070 | PUSH BC | Take the frame counter as a countdown, limited by the value passed in. | |||||
| 26071 | LD C,A | |||||||
| 26072 | LD A,(23672) | |||||||
| 26075 | LD B,A | |||||||
| 26076 | LD A,C | |||||||
| GenerateRandomNumber_Loop1 | 26077 | DEC A | Wrap back to that limit when the countdown passes zero. | |||||
| 26078 | JR NZ,GenerateRandomNumber_Step1 | |||||||
| 26080 | LD A,C | |||||||
| GenerateRandomNumber_Step1 | 26081 | DJNZ GenerateRandomNumber_Loop1 | Repeat for every frame that has passed. | |||||
| 26083 | DEC A | Step the result back one more. | ||||||
| 26084 | POP BC | Restore the registers the caller needs from the stack. | ||||||
| 26085 | RET | Return. | ||||||
| Prev: 26066 | Up: Map | Next: 26086 |