]> git.sur5r.net Git - cc65/blobdiff - libsrc/common/rand.s
The spans do now contain the size of a span, no longer the end offset.
[cc65] / libsrc / common / rand.s
index 51959619b3d6fa5420de94ab158c7a09c610810b..0ed52aa8b6fd246d580d9c4b3976cfa1848890a7 100644 (file)
@@ -1,4 +1,4 @@
-;      
+;
 ; Randum number generator
 ;
 ; Written and donated by Sidney Cadot - sidney@ch.twi.tudelft.nl
 
        .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
 
@@ -51,7 +53,7 @@ _rand:        clc
        lda     rand+3
        adc     #$31
        sta     rand+3
-       pla                     ; return bit 8-22 in (X,A)
+       pla                     ; return bit 8-22 in (X,A)
        rts
 
 _srand:        sta     rand+0          ; Store the seed
@@ -61,3 +63,4 @@ _srand:       sta     rand+0          ; Store the seed
        sta     rand+3
        rts
 
+