From here it looks like the official way is to use RND(N) to seed, where is N is a negative number.
But according to this you can also just copy a byte from a timer to the RND seed with:
If your program shows a title screen with a loop checking for a user keypress, you could:
Do X=RND(0) in the loop. This will put you at a random place ...
The BASIC in question (and many Microsoft BASIC versions) use a single stack to track both FOR/NEXT loops and GOSUBs. Here's a first approximation of the rules:
FOR x puts a loop record on the stack
GOSUB puts a return location on the stack
RETURN pops down the stack and goes back to the return location
NEXT x pops down the stack to find the loop record ...
The CoCo has an interrupt called fast interrupt (FIRQ) which is connected to the video output horizontal sync pulse. The IRQ happens every 1/16 of a millisecond (62.5 microseconds). The extended basic command timer uses this interrupt to increment its counter. Remember that the IRQ happens independently of what you see on screen so this is why the number ...
You can manage CoCo disk images quite easily with MAME's imgtool. I've assumed you want to use RS-DOS on a CoCo 2, launching xroar via:
xroar -default-machine coco2bus
To make a blank, single-sided disk image, enter
imgtool create coco_jvc_rsdos new.dsk
The file will be 161280 bytes long: 35 tracks × 9 sectors × 512 bytes per sector.
I'm assuming your ...
Address 65280 (Hex &FF00) is the I/O port on the CoCo for the joystick and the keyboard row input. It is the case that the lower 2 bits are assigned to the left and right joystick buttons. Bit 7 is associated with the joystick direction, which is why it can be either 0 OR 1 while a button is pressed. So, your proposed approach is correct.
I can't speak on the inner workings of this BASIC. But perhaps you can force the for/next to end "naturally" by manipulating i directly. I don't have a CoCo to test this on, but something like:
100 FOR I=1 TO 20
110 REM IF I>10 THEN RETURN
120 PRINT I,
125 IF I>9 THEN I=20
130 NEXT I
BASICally you set up the comparison at line 100 to ...
Use a value derived from a CMOS clock for your seed, since those are never the same twice.
On an older computer with no CMOS clock, there will still be a clock that starts from zero every time the computer is started. You can use this clock as well, as long as the program start time relies on human action which will introduce a random delay. Manually ...