Change initial seed to 1
git-svn-id: svn://svn.cc65.org/cc65/trunk@1488 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
;
|
;
|
||||||
; Randum number generator
|
; Randum number generator
|
||||||
;
|
;
|
||||||
; Written and donated by Sidney Cadot - sidney@ch.twi.tudelft.nl
|
; Written and donated by Sidney Cadot - sidney@ch.twi.tudelft.nl
|
||||||
@@ -21,9 +21,11 @@
|
|||||||
|
|
||||||
.export _rand, _srand
|
.export _rand, _srand
|
||||||
|
|
||||||
.bss
|
.data
|
||||||
|
|
||||||
rand: .res 4 ; Seed
|
; The seed. When srand() is not called, the C standard says that that rand()
|
||||||
|
; should behave as if srand() was called with an argument of 1 before.
|
||||||
|
rand: .dword 1
|
||||||
|
|
||||||
.code
|
.code
|
||||||
|
|
||||||
@@ -51,7 +53,7 @@ _rand: clc
|
|||||||
lda rand+3
|
lda rand+3
|
||||||
adc #$31
|
adc #$31
|
||||||
sta rand+3
|
sta rand+3
|
||||||
pla ; return bit 8-22 in (X,A)
|
pla ; return bit 8-22 in (X,A)
|
||||||
rts
|
rts
|
||||||
|
|
||||||
_srand: sta rand+0 ; Store the seed
|
_srand: sta rand+0 ; Store the seed
|
||||||
@@ -61,3 +63,4 @@ _srand: sta rand+0 ; Store the seed
|
|||||||
sta rand+3
|
sta rand+3
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user