10 #define wait_vblank() \
12 while(REG_DISPSTAT & DISPSTAT_VBLANK); \
13 while(!(REG_DISPSTAT & DISPSTAT_VBLANK)); \
18 REG_DISPCNT = DISPCNT_BG2 | DISPCNT_OBJ | 4 | ((x) << 4); \
21 #else /* non-GBA build */
24 void present(int buf); /* defined in src/pc/main.c */
27 #define set_bg_color(idx, r, g, b) \
28 gba_bgpal[idx] = (uint16_t)(r) | ((uint16_t)(g) << 5) | ((uint16_t)(b) << 10)
30 extern int16_t sinlut[];
32 #define SIN(x) sinlut[(x) & 0xff]
33 #define COS(x) sinlut[((x) + 64) & 0xff]
35 int iwram_brk(void *addr);
36 void *iwram_sbrk(intptr_t delta);
38 void fillblock_16byte(void *dest, uint32_t val, int count);
43 int ispow2(unsigned int x);
45 /* Non-failing versions of malloc/calloc/realloc. They never return 0, they call
46 * demo_abort on failure. Use the macros, don't call the *_impl functions.
48 #define malloc_nf(sz) malloc_nf_impl(sz, __FILE__, __LINE__)
49 void *malloc_nf_impl(size_t sz, const char *file, int line);
50 #define calloc_nf(n, sz) calloc_nf_impl(n, sz, __FILE__, __LINE__)
51 void *calloc_nf_impl(size_t num, size_t sz, const char *file, int line);
52 #define realloc_nf(p, sz) realloc_nf_impl(p, sz, __FILE__, __LINE__)
53 void *realloc_nf_impl(void *p, size_t sz, const char *file, int line);
54 #define strdup_nf(s) strdup_nf_impl(s, __FILE__, __LINE__)
55 char *strdup_nf_impl(const char *s, const char *file, int line);