git.y1.nz

gbdk-2020

GameBoy Development Kit
download: https://git.y1.nz/archives/gbdk.tar.gz
README | Files | Log | Refs | LICENSE

commit c2a3488821a7c26affbf286695bb357e50a5f393
parent c97d278cd4178dbe0bd3d66589821d7f6f31e711
Author: Toxa <untoxa@mail.ru>
Date:   Wed, 13 Nov 2024 17:33:43 +0300

SM83/Z80: register usage hints for the RNG functions

Diffstat:
Mgbdk-lib/include/rand.h24+++++++++++++++++++++---
1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/gbdk-lib/include/rand.h b/gbdk-lib/include/rand.h @@ -50,13 +50,25 @@ extern uint16_t __rand_seed; @ref initrand() should be used to initialize the random number generator before using rand() */ -uint8_t rand(void) OLDCALL; +#if defined(__PORT_sm83) +uint8_t rand(void) OLDCALL PRESERVES_REGS(b, c); +#elif defined(__PORT_z80) +uint8_t rand(void) OLDCALL PRESERVES_REGS(b, c, iyh, iyl); +#elif defined(__PORT_mos6502) +uint8_t rand(void); +#endif /** Returns a random word (16 bit) value. @ref initrand() should be used to initialize the random number generator before using rand() */ -uint16_t randw(void) OLDCALL; +#if defined(__PORT_sm83) +uint16_t randw(void) OLDCALL PRESERVES_REGS(b, c); +#elif defined(__PORT_z80) +uint16_t randw(void) OLDCALL PRESERVES_REGS(b, c, iyh, iyl); +#elif defined(__PORT_mos6502) +uint16_t randw(void); +#endif /** Random generator using the linear lagged additive method @@ -77,6 +89,12 @@ void initarand(uint16_t seed) Z88DK_FASTCALL; @ref initarand() should be used to initialize the random number generator before using arand() */ -uint8_t arand(void) OLDCALL; +#if defined(__PORT_sm83) +uint8_t arand(void) OLDCALL PRESERVES_REGS(b, c); +#elif defined(__PORT_z80) +uint8_t arand(void) OLDCALL PRESERVES_REGS(b, c, iyh, iyl); +#elif defined(__PORT_mos6502) +uint8_t arand(void); +#endif #endif

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.