Make non-seeded rng a rom flag instead of compile flag

This commit is contained in:
2022-01-24 13:53:03 -08:00
parent 2a15f39e65
commit ede8760b5c
2 changed files with 13 additions and 12 deletions

View File

@@ -110,18 +110,17 @@ RTL
; Out: A = RNG Result
;--------------------------------------------------------------------------------
!RNG_POINTERS = "$7F5200"
!static_rng ?= 1
GetStaticRNG:
if !static_rng
PHX : PHP
REP #$30 ; set 16-bit accumulator and index registers
AND.w #$000F
ASL : TAX : LDA !RNG_POINTERS, X : INC : AND.w #$03FF : STA !RNG_POINTERS, X : TAX ; increment pointer and move value to X
LDA Static_RNG, X ; load RNG value
PLP : PLX
else
JML GetRandomInt
endif
LDA.l SeededRNG : BNE .seeded
JML GetRandomInt
RTL
.seeded
PHX : PHP
REP #$30 ; set 16-bit accumulator and index registers
AND.w #$000F
ASL : TAX : LDA !RNG_POINTERS, X : INC : AND.w #$03FF : STA !RNG_POINTERS, X : TAX ; increment pointer and move value to X
LDA Static_RNG, X ; load RNG value
PLP : PLX
RTL
;--------------------------------------------------------------------------------
InitRNGPointerTable: