Code: Select all
lda a ; Operation 7 (with carry clear).
asl
eor b
sta b
rol ; Operation 9.
eor c
sta c
eor a ; Operation 5.
sta a
lda b ; Operation 15.
ror
eor c
sta c
eor b ; Operation 6.
sta b
Code: Select all
lda a ; Operation 7 (with carry clear).
asl
eor b
sta b
rol ; Operation 9.
eor c
sta c
eor a ; Operation 5.
sta a
lda b ; Operation 15.
ror
eor c
sta c
eor b ; Operation 6.
sta b
Code: Select all
rep #%11111111 ;reset all SR bits
sep #%00110000 ;8-bit registers
lda #%00110000 ;operate timer B...
sta $c104 ;as a counter
rep #%00100000 ;16-bit .A
stz $c106 ;preset timer to zero
bra restart ;start timer & halt
;
;
; here we read the timer on the fly...
;
read ldx $c10f ;stop timer &...
lda $c104 ;read it
sta $c104 ;write it back as new preset
;
restart ldx $c10e ;restart timer
sta $a0 ;save timer value
brk
nop
bra read ;play it again, SamCode: Select all
.opt proc65816,caseinsensitive,swapbin
;===============================================================================
;
;PRNG SEED NOISE GENERATOR
;
; —————————————————————————————————————————————————————————————————————
; This bit of code sets up timer B as a free-running counter driven by
; the X1 clock without scaling. The timer will run down from $FFFF to
; $0000, reload & repeat. THe “noise” is gotten by briefly stopping
; the timer, doing a 16-bit read of its registers & then restarting it.
; The result will be a value somewhere in the 16-bit range.
; —————————————————————————————————————————————————————————————————————
;
acrb =$00c104 ;DUART ‘B’ aux control
ctb =$00c106 ;DUART ‘B’ timer
ctstrtb =$00c10e ;DUART ‘B’ timer start
ctstopb =$00c10f ;DUART ‘B’ timer stop
;
setasctr =%00100000 ;counter mode using 1× X1 clock
;
noise =$a0 ;noise storage
;
*=$000100
;
main rep #%11111111 ;reset all SR bits
lda !#0
tax
tay
phk
plb
sep #%00010000 ;8-bit index
ldx #setasctr ;operate timer B...
stx acrb ;as a counter
stz ctb ;initial preset
stz noise ;reset...
stz noise+2 ;noise
bra restart ;start timer & pause
;
read ldx ctstopb ;stop timer
lda ctb ;read timer
sta ctb ;write back as preset
xba ;reverse endianess &...
sta noise ;save noise LSW
eor !#-1 ;mix up things
sta noise+2 ;save noise MSW
;
restart ldx ctstrtb ;start timer
brk
nop
bra read ;get some noise
;
.endCode: Select all
lda a ; Operation 7 (with carry clear).
asl
eor b
sta b
rol ; Operation 9.
eor c
sta c
eor a ; Operation 5.
sta a
lda b ; Operation 15.
ror
eor c
sta c
eor b ; Operation 6.
sta b
Code: Select all
$ minisim -b couwenberg.xex | ../../pr-095/RNG_test stdin8 -te 1 -tlmin 10 -tlmax 50 -tlmaxonly -multithreaded
RNG_test using PractRand version 0.95
RNG = RNG_stdin8, seed = unknown
test set = expanded, folding = standard (8 bit)
rng=RNG_stdin8, seed=unknown
length= 1 kilobyte (2^10 bytes), time= 0.1 seconds
no anomalies in 16 test result(s)
rng=RNG_stdin8, seed=unknown
length= 2 kilobytes (2^11 bytes), time= 0.4 seconds
no anomalies in 30 test result(s)
rng=RNG_stdin8, seed=unknown
length= 4 kilobytes (2^12 bytes), time= 1.0 seconds
no anomalies in 38 test result(s)
rng=RNG_stdin8, seed=unknown
length= 8 kilobytes (2^13 bytes), time= 1.8 seconds
Test Name Raw Processed Evaluation
BRank(18):128(1) R= +2133 p~= 3.3e-643 FAIL !!!!!!!
...and 60 test result(s) without anomalies
rng=RNG_stdin8, seed=unknown
length= 16 kilobytes (2^14 bytes), time= 2.8 seconds
Test Name Raw Processed Evaluation
BRank(18):128(2) R= +3017 p~= 3.3e-909 FAIL !!!!!!!
...and 79 test result(s) without anomalies
rng=RNG_stdin8, seed=unknown
length= 32 kilobytes (2^15 bytes), time= 4.2 seconds
Test Name Raw Processed Evaluation
BRank(18):128(2) R= +3017 p~= 3.3e-909 FAIL !!!!!!!
...and 95 test result(s) without anomalies
rng=RNG_stdin8, seed=unknown
length= 64 kilobytes (2^16 bytes), time= 5.8 seconds
Test Name Raw Processed Evaluation
BRank(18):128(2) R= +3017 p~= 3.3e-909 FAIL !!!!!!!
BRank(18):256(1) R= +4889 p~= 1e-1472 FAIL !!!!!!!!
[Low1/8]BRank(18):128(1) R= +2133 p~= 3.3e-643 FAIL !!!!!!!
...and 110 test result(s) without anomalies
Code: Select all
lda seed
beq doEor ;if the input was $00, force EOR
asl
beq noEor ;if the input was $80, skip the EOR
bcc noEor
doEor: eor #$1d
noEor: sta seed
; $00 : (shift and) perform EOR
; $80 : just shift
; %1xxxxxxx : shift and perform EOR
; %0xxxxxxx : just shift