![]()  | 
Routines | 
| Prev: B081 | Up: Map | Next: B09A | 
| 
 
Used by the routines at Event_Roman and Event_Fomorian.
 
  | 
||||||||
| GenerateRandomNumber | B08A | PUSH BC | Stash BC on the stack. | |||||
| B08B | LD C,A | Store the maximum number in C. | ||||||
| B08C | CALL FetchFrames | Call FetchFrames. | ||||||
| B08F | LD B,A | Use the frames number as a loop counter in B. | ||||||
| B090 | LD A,C | Restore the maximum number value back to A. | ||||||
| GenerateRandomNumber_Loop | B091 | DEC A | Decrease the maximum number value by one. | |||||
| B092 | JR NZ,GenerateRandomNumber_Next | Jump to GenerateRandomNumber_Next if the maximum number value is not equal to zero. | ||||||
| B094 | LD A,C | Restore the maximum number value back to A. | ||||||
| GenerateRandomNumber_Next | B095 | DJNZ GenerateRandomNumber_Loop | Decrease the loop counter by one and loop back to GenerateRandomNumber_Loop until the loop counter is zero. | |||||
| B097 | DEC A | Decrease the maximum number value by one. | ||||||
| B098 | POP BC | Restore BC from the stack. | ||||||
| B099 | RET | Return. | ||||||
| 
 
View the equivalent code in The Jewels Of Babylon.
 
 | 
||||||||
| Prev: B081 | Up: Map | Next: B09A |