With this code :Quote:
.export start
ICPTL = $0346
ICPTH = $0347
.zeropage
zp_start:
;state: .res 8
cnt: .res 6
zp_end:
.code
.proc rand
; fast PRNG (pseudo random number generator) written in 6502 assembly language
; (C) Arlet Ottens 2023 <arlet@c-scape.nl>
;
https://github.com/Arlet/pseudo-random- ... m-6502.asm CLC
LDA #$45
ADC s+0
STA s+0
ADC s+1
STA s+1
ADC s+2
STA s+2
ADC s+3
STA s+3
ADC s+4
STA s+4
ADC s+5
STA s+5
LDA s+2
ASL
ADC s+5
STA o+0
ADC s+3
STA o+1
ADC s+4
STA o+3
LDA o+2
ASL
ADC o+3
STA o+2
ADC o+0
STA o+0
ADC o+1
ASL
ADC o+0
STA o+1
ADC o+3
STA o+3
ADC o+2
ASL
ADC o+3
STA o+2
ADC o+1
STA o+1
ADC o+0
STA o+0
RTS
.endproc
s: .byte $00,$00,$00,$00,$01,$00
o: .byte $00,$00,$00,$00
.proc print_hex_byte
pha
lsr
lsr
lsr
lsr
jsr print_hex
pla
print_hex:
and #$0F
tax
lda hextab,x
; Fall through
::putc:
ldx #0
jump: jmp $FFFF
hextab: .byte "0123456789ABCDEF"
.endproc
start:
; Init fast putchar
lda ICPTL
clc
adc #1
sta print_hex_byte::jump+1
lda ICPTH
adc #0
sta print_hex_byte::jump+2
; Clear state
ldx #zp_end-zp_start-1
lda #0
zpclr:
sta zp_start, x
dex
bpl zpclr
; Generate and print numbers
loop:
jsr rand
; jsr print_hex_byte
; lda #$9B
jsr putc
inc cnt
bne loop
inc cnt+1
bne loop
inc cnt+2
bne loop
inc cnt+3
bne loop
inc cnt+4
bne loop
inc cnt+5
bne loop
rts
I used the Accumulator as random byte (s0)compilation:Quote:
cl65 -tatari -Catari-asm.cfg arlet-big-binary.asm
test:Quote:
./atarisim -b arlet-big-binary | rng_test stdin8 -te 1 -tlmin 10 -tlmax 50 -tlmaxonly -multithreaded
with s: .byte $00,$00,$00,$00,$01,$00Quote:
length= 1 kilobyte (2^10 bytes), time= 10.3 seconds
Test Name Raw Processed Evaluation
FPF-14+6/64:all R= +39.0 p~= 2e-16 FAIL !
...and 15 test result(s) without anomalies
length= 256 kilobytes (2^18 bytes), time= 25.6 seconds
Test Name Raw Processed Evaluation
[Low1/8]mod3n(0):(6,9-6) R= +11.5 p = 6.4e-5 unusual
...and 114 test result(s) without anomalies
with s: .byte $00,$01,$00,$00,$00,$00Quote:
length= 8 kilobytes (2^13 bytes), time= 6.6 seconds
Test Name Raw Processed Evaluation
[Low1/8]FPF-14+6/64:all R= +15.5 p~= 3e-4 unusual
...and 51 test result(s) without anomalies
length= 512 kilobytes (2^19 bytes), time= 29.5 seconds
Test Name Raw Processed Evaluation
[Low1/8]DC6-6x2Bytes-1 R= +6.1 p = 1.8e-3 unusual
...and 128 test result(s) without anomalies
length= 2 megabytes (2^21 bytes), time= 43.0 seconds
Test Name Raw Processed Evaluation
[Low1/8]BCFN(0+2,13-8,T) R= +12.6 p = 4.2e-4 unusual
[Low1/8]DC6-9x1Bytes-1 R= +7.3 p = 5.3e-4 unusual
...and 154 test result(s) without anomalies
with s: .byte $00,$00,$00,$00,$00,$00Quote:
length= 16 kilobytes (2^14 bytes), time= 9.7 seconds
Test Name Raw Processed Evaluation
[Low1/8]FPF-14+6/16:cross R= +5.5 p~= 5.9e-4 unusual
...and 61 test result(s) without anomalies
with s: .byte $00,$00,$00,$00,$00,$01Quote:
length= 1 kilobyte (2^10 bytes), time= 1.3 seconds
Test Name Raw Processed Evaluation
FPF-14+6/64:all R= +26.5 p~= 5e-9 VERY SUSPICIOUS
...and 15 test result(s) without anomalies
rng=RNG_stdin8, seed=unknown
length= 2 kilobytes (2^11 bytes), time= 2.8 seconds
Test Name Raw Processed Evaluation
FPF-14+6/64:all R= +14.2 p~= 8e-4 unusual
...and 20 test result(s) without anomalies
length= 8 kilobytes (2^13 bytes), time= 6.3 seconds
Test Name Raw Processed Evaluation
FPF-14+6/16:all R= +10.3 p = 3.2e-5 mildly suspicious
[Low1/8]FPF-14+6/64:all R= +16.3 p~= 1e-4 unusual
...and 50 test result(s) without anomalies
with s: .byte $01,$00,$00,$00,$00,$01Quote:
length= 1 kilobyte (2^10 bytes), time= 1.2 seconds
Test Name Raw Processed Evaluation
FPF-14+6/64:all R= +17.1 p~= 9e-5 mildly suspicious
...and 15 test result(s) without anomalies
with s: .byte $01,$00,$00,$00,$00,$00Quote:
length= 1 kilobyte (2^10 bytes), time= 1.3 seconds
Test Name Raw Processed Evaluation
DC6-9x1Bytes-1 R= +7.2 p = 7.0e-3 unusual
DC6-6x2Bytes-1 R= +6.4 p = 4.2e-3 unusual
...and 14 test result(s) without anomalies
length= 8 kilobytes (2^13 bytes), time= 6.6 seconds
Test Name Raw Processed Evaluation
[Low1/8]FPF-14+6/64:all R= +17.1 p~= 9e-5 unusual
...and 51 test result(s) without anomalies
length= 8 kilobytes (2^13 bytes), time= 6.6 seconds
Test Name Raw Processed Evaluation
[Low1/8]FPF-14+6/64:all R= +17.1 p~= 9e-5 unusual
...and 51 test result(s) without anomalies
with s: .byte $FF,$FF,$FF,$FF,$FF,$FFQuote:
length= 8 kilobytes (2^13 bytes), time= 7.0 seconds
Test Name Raw Processed Evaluation
[Low1/8]FPF-14+6/64:all R= -21.7 p~= 1-1e-6 suspicious
...and 51 test result(s) without anomalies
length= 4 megabytes (2^22 bytes), time= 57.1 seconds
Test Name Raw Processed Evaluation
DC6-9x1Bytes-1 R= -5.6 p =1-7.0e-4 unusual
...and 168 test result(s) without anomalies
Could someone confirm this ?