<bieling@terra.es> wrote:
biel...@terra.es wrote:
<http://6502asm.com/>
I've written this to try it out:
start: lda $ff ; read keypress
ldx $fe ; get a random number
sta $200,x
sta $300,x
sta $400,x
sta $500,x
jmp start
When it's run, there are 4 dots whose color never change (you've got
to press a key to change the color).
Is it that the random number at $fe never gets the value $ff ?
What do you think ?
In a loop like this (on a real Apple II), $FE and $FF will always
contain the same values. They are only a random number if you wait for a
keypress using the KEYIN routine, which does a cyclic 16-bit increment
of these two locations.
It gets its randomness from the human reaction time of pressing keys.
The low order byte ($FE) will increment 256 times faster than the high
order byte, so if the person presses keys quickly, the pattern of the
$FF byte won't be very random but the $FE byte should be.
You would have to wait for a keypress on each loop if you wanted to get
a random pattern on the screen.