1
0
mirror of https://github.com/KarolS/millfork.git synced 2024-12-22 16:31:02 +00:00

Use POKEY for random seed on Atari

This commit is contained in:
Karol Stasiak 2020-09-30 01:51:26 +02:00
parent a00e10382d
commit e94ccd164f
3 changed files with 19 additions and 0 deletions

View File

@ -10,6 +10,8 @@
* Implemented `readline` and `readword` for VIC-20.
* `init_rand_seed` uses the POKEY on Atari.
* Fix: more instances of memset loops should be detected and optimized (#59).
* Fix: things mentioned in the segment layout should not be deleted even if unused.

View File

@ -32,6 +32,8 @@ Current implementation:
* On C64, spends two frames reading noise data from the SID chip.
* On Atari computers, reads the POKEY random register.
* On Z80, reads the refresh register.
* On all other targets, sets the seed to 1.

View File

@ -33,6 +33,21 @@ void init_rand_seed() {
rand_seed.lo = peek($D41B)
}
#elseif ATARI_8
noinline asm void init_rand_seed() {
lda $D20A
sta rand_seed.lo
lda #1
.loop:
asl
bne .loop
lda $D20A
sta rand_seed.hi
rts
}
#else
inline void init_rand_seed() {