]> git.sur5r.net Git - cc65/commitdiff
Fix broken rand() implementation. The high 8 bits were unused, reducing it to a 24... 323/head
authorBrad Smith <rainwarrior@gmail.com>
Tue, 12 Jul 2016 00:48:47 +0000 (20:48 -0400)
committerBrad Smith <rainwarrior@gmail.com>
Tue, 12 Jul 2016 00:48:47 +0000 (20:48 -0400)
libsrc/common/rand.s

index 48a88b7c413254b4ebe3b2d675c9470ab91d4b35..8ad7bcdb48bd575539948fdc6852b3dfdd992f46 100644 (file)
@@ -44,7 +44,6 @@ _rand:  clc
         lda     rand+1
         adc     #$59
         sta     rand+1
-        pha
         lda     rand+2
         adc     #$41
         sta     rand+2
@@ -53,8 +52,7 @@ _rand:  clc
         lda     rand+3
         adc     #$31
         sta     rand+3
-        pla                     ; return bit 8-22 in (X,A)
-        rts
+        rts                     ; return bit (16-22,24-31) in (X,A)
 
 _srand: sta     rand+0          ; Store the seed
         stx     rand+1