 Hello and welcome to another Commodore 64 tutorial. This time we're going to have some fun with random numbers and random numbers into specific memory locations to generate some audio and visual feedback. So the first thing I'm going to do, line 10 here, is print the character 147 which has the effect of clearing all text from the screen. And you see here I've used the question mark instead of the word print. Once we enter that if we list the program you'll see that that question mark has been replaced literally with the word print. There was no space after the question mark before so there's no space after the word print and that's just fine. For the Commodore 64, the spaces that we put in between commands and operators really are just for human readability sake. Line 20, we're going to jump to subroutine starting at line 100. That'll become clear later. Line 30 we are going to poke into a memory location starting at 54272 all the way up to 54296 So a random address within that range we're going to poke in a random number between 0 and 255. Now with the R&D command the asterisk and the number following it denotes the upper bound but that is not included. So you can see here the 25 will never be generated. It'll be 0 to 24 and with this last the second one here it'll be 0 to 255. So 0 and 255 will be in the lower and upper most values you could fit in an 8-bit byte. So R&D, the one in brackets afterwards just denotes it should be a positive value and I'll put a link to in the description which should just explain a bit more about the R&D function. I do want to go on for too long in this example about it. On line 40 we're going to poke into the memory location responsible for setting the border color which is 53280. We're going to poke in the value stored in R which we haven't set yet. Line 50 we're again going to jump to the subroutine starting at line 100. Line 60 we're going to poke into the memory address responsible for the background color again the value R. Line 70 is a simple go to 20. Why not go to 10? Well this program doesn't output any text so we don't need to clear it again once that's already been done. And then line 100 where our go sub is going to be jumping to and we're going to set the R variable to a random number, a random positive number between 0 and 15 so 16 possible values including 0 and then one term which is going to return to wherever the go sub was called from. So just to walk through really how a go sub command works. So once this one line 20 is executed that will send execution down to line 100 which sets up our R variable with a random number then line 110 is a return command which takes us back to where it's called from or the next command after where it's called from. So in this case the return takes to line 30 which would execute line 40 that would execute then line 50 again sends us down to 100 that executes then one 10 sends us back up to line 60 and then 70 sends us up to 20. Now before we run the program I just wanted to demonstrate a couple of little common or 64 shortcuts or abbreviations you can see if you type list obviously it lists the program. If you type L followed by shift and I it produces that funny little character if you press enter after that it has the same effect as listing and there's a similar shortcut for run instead of RUN you can type R shift and U which gives you this funny little symbol and then hit and enter and have the same effect as if you type RUN. And here we have our finished program so you can see the border and background colors just changing to random colors as fast as the the processor can make it happen. What you can't hear because I've dubbed over it in doing this voiceover is the little pops and squeaks and whistles that are coming from the SID chip but run it yourself on your own common or 64 or emulator to get the full experience.