GBDK 2020 Docs 4.4.0 API Documentation for GBDK 2020

rand.h
Go to the documentation of this file.
1
6 #ifndef RAND_INCLUDE
7 #define RAND_INCLUDE
8
9 #include <types.h>
10 #include <stdint.h>
11
27 #if defined(__PORT_sm83) || defined(__PORT_mos6502)
28 void initrand(uint16_t seed) OLDCALL;
29 #elif defined(__PORT_z80)
30 void initrand(uint16_t seed) Z88DK_FASTCALL;
31 #endif
32
33 #define RAND_MAX 255
34 #define RANDW_MAX 65535
35
47 extern uint16_t __rand_seed;
48
53 #if defined(__PORT_sm83)
54 uint8_t rand(void) OLDCALL PRESERVES_REGS(b, c);
55 #elif defined(__PORT_z80)
56 uint8_t rand(void) OLDCALL PRESERVES_REGS(b, c, iyh, iyl);
57 #elif defined(__PORT_mos6502)
58 uint8_t rand(void);
59 #endif
60
65 #if defined(__PORT_sm83)
66 uint16_t randw(void) OLDCALL PRESERVES_REGS(b, c);
67 #elif defined(__PORT_z80)
68 uint16_t randw(void) OLDCALL PRESERVES_REGS(b, c, iyh, iyl);
69 #elif defined(__PORT_mos6502)
70 uint16_t randw(void);
71 #endif
72
82 #if defined(__PORT_sm83) || defined(__PORT_mos6502)
83 void initarand(uint16_t seed) OLDCALL;
84 #elif defined(__PORT_z80)
85 void initarand(uint16_t seed) Z88DK_FASTCALL;
86 #endif
87
92 #if defined(__PORT_sm83)
93 uint8_t arand(void) OLDCALL PRESERVES_REGS(b, c);
94 #elif defined(__PORT_z80)
95 uint8_t arand(void) OLDCALL PRESERVES_REGS(b, c, iyh, iyl);
96 #elif defined(__PORT_mos6502)
97 uint8_t arand(void);
98 #endif
99
100 #endif
OLDCALL
#define OLDCALL
Definition: types.h:21
PRESERVES_REGS
#define PRESERVES_REGS(...)
Definition: types.h:32
Z88DK_FASTCALL
#define Z88DK_FASTCALL
Definition: types.h:47
b
void b
Definition: gb.h:748
iyl
static uint8_t iyl
Definition: metasprites.h:49
iyh
void iyh
Definition: msx.h:102
randw
uint16_t randw(void) OLDCALL PRESERVES_REGS(b
c
uint8_t c
Definition: rand.h:54
initarand
void initarand(uint16_t seed) OLDCALL
arand
uint8_t arand(void) OLDCALL PRESERVES_REGS(b
__rand_seed
uint16_t __rand_seed
initrand
void initrand(uint16_t seed) OLDCALL
rand
uint8_t rand(void) OLDCALL PRESERVES_REGS(b
stdint.h
uint8_t
unsigned char uint8_t
Definition: stdint.h:51
uint16_t
unsigned short int uint16_t
Definition: stdint.h:52
types.h