Skip to navigation

Aviator on the BBC Micro

Utility routines: SetRandomNumber

Name: SetRandomNumber [Show more] Type: Subroutine Category: Utility routines Summary: Set the next item in the randomNumbers list to a new random number and update the pointer to point to it Deep dive: Random numbers
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * MainLoop (Part 13 of 15) calls SetRandomNumber
.SetRandomNumber LDX randomNumbers \ Fetch the pointer for the randomNumbers list LDA VIA+&64 \ Read the 6522 User VIA T1C-L timer 1 low-order \ counter (SHEILA &64), which decrements one million \ times a second and will therefore be pretty random STA randomNumbers+1,X \ Set the next item in the list to the random number we \ just fetched \ Fall through into NextRandomNumber to move the list \ pointer to point to the new number we just added