GBDK 2020 Docs  4.3.0
API Documentation for GBDK 2020
incbin.h
Go to the documentation of this file.
1 
10 #ifndef _INCBIN_H
11 #define _INCBIN_H
12 
13 #include <stdint.h>
14 
15 
25 #define INCBIN_EXTERN(VARNAME) extern const uint8_t VARNAME[]; \
26 extern const void __size_ ## VARNAME; \
27 extern const void __bank_ ## VARNAME;
28 
37 #define INCBIN_SIZE(VARNAME) ( (uint16_t) & __size_ ## VARNAME )
38 
47 #ifndef BANK
48 #define BANK(VARNAME) ( (uint8_t) & __bank_ ## VARNAME )
49 #endif
50 
74 #define INCBIN(VARNAME, FILEPATH) void __func_ ## VARNAME(void) __banked __naked { \
75 __asm \
76 _ ## VARNAME:: \
77 1$: \
78  .incbin FILEPATH \
79 2$: \
80  ___size_ ## VARNAME = (2$-1$) \
81  .globl ___size_ ## VARNAME \
82  .local b___func_ ## VARNAME \
83  ___bank_ ## VARNAME = b___func_ ## VARNAME \
84  .globl ___bank_ ## VARNAME \
85 __endasm; \
86 }
87 
88 #endif // _INCBIN_H