aboutsummaryrefslogtreecommitdiff
path: root/rand.s
diff options
context:
space:
mode:
Diffstat (limited to 'rand.s')
-rw-r--r--rand.s10
1 files changed, 7 insertions, 3 deletions
diff --git a/rand.s b/rand.s
index c48478e..3d64c74 100644
--- a/rand.s
+++ b/rand.s
@@ -5,10 +5,14 @@
RANDOM = 53770 ; POKEY LFSR read address, defined in the Atari OS
; void __fastcall__ randi(void);
+; NB cc65's rand() returns a positive signed int, meaning
+; 0 to 0x7fff.
_randi:
- lda #0
- sta sreg
- beq randl1
+ lda RANDOM
+ and #$7f
+ tax
+ lda RANDOM
+ rts
; void __fastcall__ randl(void);
_randl: