git.y1.nz

gbdk-2020

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

commit bd2732f922d7b0d6f4fcc0eb64db79017b03fcca
parent cf03f162d8767b34992b82edaf0b55d4f41eb008
Author: Toxa <untoxa@mail.ru>
Date:   Thu, 24 Jun 2021 18:40:00 +0300

BANKREF() helper macro, allows using BANK() macro to retrieve the bank number of the object

Diffstat:
Mgbdk-lib/include/gb/incbin.h21+++++++++++++++++++++
1 file changed, 21 insertions(+), 0 deletions(-)

diff --git a/gbdk-lib/include/gb/incbin.h b/gbdk-lib/include/gb/incbin.h @@ -77,6 +77,27 @@ _ ## VARNAME:: \ __endasm; \ } +/** Creates the reference for retriving the bank number of the object + + @param VARNAME Variable name to use + + @see BANK() for obtaining the bank number of the included data. + + Use @ref INCBIN_EXTERN() within another source file + to make the variable and it's data accesible there. +*/ +#define BANKREF(VARNAME) void __func_ ## VARNAME() __banked __naked { \ +__asm \ + _ ## VARNAME = 0x4000 \ + .globl _ ## VARNAME \ + ___size_ ## VARNAME = 0 \ + .globl ___size_ ## VARNAME \ + .local b___func_ ## VARNAME \ + ___bank_ ## VARNAME = b___func_ ## VARNAME \ + .globl ___bank_ ## VARNAME \ +__endasm; \ +} + #endif // _INCBIN_H

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