mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2024-11-30 21:52:07 +00:00
37 lines
383 B
Plaintext
37 lines
383 B
Plaintext
|
|
.include "vcs-ca65.inc"
|
|
|
|
.global _randseed8
|
|
.global _initrand8
|
|
.global _nextrand8
|
|
.global _prevrand8
|
|
|
|
_randseed8: .res 1
|
|
|
|
.proc _initrand8
|
|
lda INTIM
|
|
ora #1
|
|
sta _randseed8
|
|
rts
|
|
.endproc
|
|
|
|
.proc _nextrand8
|
|
lda _randseed8
|
|
lsr
|
|
bcc :+
|
|
eor #$d4
|
|
:
|
|
sta _randseed8
|
|
rts
|
|
.endproc
|
|
|
|
.proc _prevrand8
|
|
lda _randseed8
|
|
asl
|
|
bcc :+
|
|
eor #$a9
|
|
:
|
|
sta _randseed8
|
|
rts
|
|
.endproc
|