![]()  | 
Routines | 
| Prev: 45185 | Up: Map | Next: 45210 | 
| 
 
Used by the routines at Event_Roman and Event_Fomorian.
 
  | 
||||||||
| GenerateRandomNumber | 45194 | PUSH BC | Stash BC on the stack. | |||||
| 45195 | LD C,A | Store the maximum number in C. | ||||||
| 45196 | CALL FetchFrames | Call FetchFrames. | ||||||
| 45199 | LD B,A | Use the frames number as a loop counter in B. | ||||||
| 45200 | LD A,C | Restore the maximum number value back to A. | ||||||
| GenerateRandomNumber_Loop | 45201 | DEC A | Decrease the maximum number value by one. | |||||
| 45202 | JR NZ,GenerateRandomNumber_Next | Jump to GenerateRandomNumber_Next if the maximum number value is not equal to zero. | ||||||
| 45204 | LD A,C | Restore the maximum number value back to A. | ||||||
| GenerateRandomNumber_Next | 45205 | DJNZ GenerateRandomNumber_Loop | Decrease the loop counter by one and loop back to GenerateRandomNumber_Loop until the loop counter is zero. | |||||
| 45207 | DEC A | Decrease the maximum number value by one. | ||||||
| 45208 | POP BC | Restore BC from the stack. | ||||||
| 45209 | RET | Return. | ||||||
| 
 
View the equivalent code in The Jewels Of Babylon.
 
 | 
||||||||
| Prev: 45185 | Up: Map | Next: 45210 |