![]()  | 
Routines | 
| Prev: C579 | Up: Map | Next: C592 | 
  | 
||||||||
| GenerateRandomNumber | C582 | PUSH BC | Stash BC on the stack. | |||||
| C583 | LD C,A | Store the maximum number in C. | ||||||
| C584 | CALL FetchFrames | Call FetchFrames. | ||||||
| C587 | LD B,A | Use the frames number as a loop counter in B. | ||||||
| C588 | LD A,C | Restore the maximum number value back to A. | ||||||
| GenerateRandomNumber_Loop | C589 | DEC A | Decrease the maximum number value by one. | |||||
| C58A | JR NZ,GenerateRandomNumber_Next | Jump to GenerateRandomNumber_Next if the maximum number value is not equal to zero. | ||||||
| C58C | LD A,C | Restore the maximum number value back to A. | ||||||
| GenerateRandomNumber_Next | C58D | DJNZ GenerateRandomNumber_Loop | Decrease the loop counter by one and loop back to GenerateRandomNumber_Loop until the loop counter is zero. | |||||
| C58F | DEC A | Decrease the maximum number value by one. | ||||||
| C590 | POP BC | Restore BC from the stack. | ||||||
| C591 | RET | Return. | ||||||
| Prev: C579 | Up: Map | Next: C592 |