with this:
ORG $300
LDY #$00
XOR LSR RAND
LDA RAND
BCC SKIP
EOR #$B8
SKIP STA RAND
STA $2000,Y
INY
BEQ DONE
JMP XOR
DONE RTS
RAND DB $01
I then put the values in text file:
10 D$ = CHR$ (4)
20 PRINT D$;"OPEN RAND"
30 PRINT D$;"WRITE RAND"
40 FOR I = 0 TO 255
50 PRINT PEEK (8196 + I)
60 NEXT
70 PRINT D$;"CLOSE"
Pasted them into a spreadsheet and sorted. It doesn't work. There are >missing numbers, duplicate numbers. What am I doing wrong? Is there a >better method?
You should use PEEK(8192+I). That may be the only problem.
You should use PEEK(8192+I). That may be the only problem.
Ok, it was a brain fart of 4096 vs 8192, and that was corrected, but I
still get bad numbers.
I was running Applewin, and it gives me one set of numbers, with missing
ones and duplicates. I ran it under GSplus, and it gave me different >numbers, but no missing and one duplicate(but I think I know
why(executing loop an extra round)), I then ran it on real //gs hardware
and it matches the GSplus output.
Shouldn't it always generate the same sequence with the same seed? Does
the EOR function not work right on a 6502 vs 65816, or is Applewin not
right?
Your original code didn't initialize RAND to anything. So it may vary between systems. My modified code initialized it to 1.
Kent
On 9/11/2024 11:58 PM, Kent Dickey wrote:
Your original code didn't initialize RAND to anything. So it may vary
between systems. My modified code initialized it to 1.
Kent
In my original code, I DB'd RAND as $01. I'm not great at assembly, but
is that not initializing it?
| Sysop: | Keyop |
|---|---|
| Location: | Huddersfield, West Yorkshire, UK |
| Users: | 715 |
| Nodes: | 16 (2 / 14) |
| Uptime: | 33:38:24 |
| Calls: | 12,109 |
| Files: | 15,006 |
| Messages: | 6,518,321 |