Prev: 50553 Up: Map Next: 50578
50562: Generate Random Number
Input
A Maximum value of generated number
GenerateRandomNumber 50562 PUSH BC Stash BC on the stack.
50563 LD C,A Store the maximum number in C.
50564 CALL FetchFrames Call FetchFrames.
50567 LD B,A Use the frames number as a loop counter in B.
50568 LD A,C Restore the maximum number value back to A.
GenerateRandomNumber_Loop 50569 DEC A Decrease the maximum number value by one.
50570 JR NZ,GenerateRandomNumber_Next Jump to GenerateRandomNumber_Next if the maximum number value is not equal to zero.
50572 LD A,C Restore the maximum number value back to A.
GenerateRandomNumber_Next 50573 DJNZ GenerateRandomNumber_Loop Decrease the loop counter by one and loop back to GenerateRandomNumber_Loop until the loop counter is zero.
50575 DEC A Decrease the maximum number value by one.
50576 POP BC Restore BC from the stack.
50577 RET Return.
Prev: 50553 Up: Map Next: 50578