# GX_TrySetBankForBG

## C Specification

  `#include <nitro/gx/gx_vramcnt.h>`
  `BOOL GX_TrySetBankForBG(GXVRamBG bg);`

## Arguments

`bg` | Specifies a VRAM bank to allocate to the main 2D Engine's BG

## Return Values

Returns TRUE if the VRAM bank is allocated as normal. Returns FALSE if the VRAM bank to be allocated is locked by another library.

## Description

Attempts to allocate a designated VRAM bank to the main 2D engine BG. Allocates that VRAM bank to the main 2D engine BG if the designated VRAM bank is disabled or if it is allocated to LCDC. The allocation will fail if the designated VRAM bank is exclusively locked by another library. Note: Because VRAM combinations not defined below cannot be allocated to successive addresses, they cannot be configured with this function. Depending on the VRAM combination, you may be able to configure with `GX_TrySetBankForBGEx`. Refer to the description of this function for more information.

`GX_VRAM_BG_NONE` | The VRAM bank is not allocated to BG.
`GX_VRAM_BG_16_F` | 16 kilobytes are reserved in BG. VRAM-F is allocated.
`GX_VRAM_BG_16_G` | 16 kilobytes are reserved in BG. VRAM-G is allocated.
`GX_VRAM_BG_32_FG` | 32 kilobytes are reserved in BG. VRAM-F and -G are allocated.
`GX_VRAM_BG_64_E` | 64 kilobytes are reserved in BG. VRAM-E is allocated.
`GX_VRAM_BG_80_EF` | 80 kilobytes are reserved in BG. VRAM-E and -F are allocated.
`GX_VRAM_BG_96_EFG` | 96 kilobytes are reserved in BG. VRAM-E, -F, and -G are allocated.
`GX_VRAM_BG_128_A` | 128 kilobytes are reserved in BG. VRAM-A is allocated.
`GX_VRAM_BG_128_B` | 128 kilobytes are reserved in BG. VRAM-B is allocated.
`GX_VRAM_BG_128_C` | 128 kilobytes are reserved in BG. VRAM-C is allocated.
`GX_VRAM_BG_128_D` | 128 kilobytes are reserved in BG. VRAM-D is allocated.
`GX_VRAM_BG_256_AB` | 256 kilobytes are reserved in BG. VRAM-A and -B are allocated.
`GX_VRAM_BG_256_BC` | 256 kilobytes are reserved in BG. VRAM-B and -C are allocated.
`GX_VRAM_BG_256_CD` | 256 kilobytes are reserved in BG. VRAM-C and -D are allocated.
`GX_VRAM_BG_384_ABC` | 384 kilobytes are reserved in BG. VRAM-A, -B, and -C are allocated.
`GX_VRAM_BG_384_BCD` | 384 kilobytes are reserved in BG. VRAM-B, -C, and -D are allocated.
`GX_VRAM_BG_512_ABCD` | 512 kilobytes are reserved in BG. VRAM-A, -B, -C, and -D are allocated.
`GX_VRAM_BG_80_EG` | 80 kilobytes are reserved in BG. VRAM-E and -G are allocated.
`GX_VRAM_BG_256_AC` | 256 kilobytes are reserved in BG. VRAM-A and -C are allocated.
`GX_VRAM_BG_256_AD` | 256 kilobytes are reserved in BG. VRAM-A and -D are allocated.
`GX_VRAM_BG_256_BD` | 256 kilobytes are reserved in BG. VRAM-B and -D are allocated.
`GX_VRAM_BG_384_ABD` | 384 kilobytes are reserved in BG. VRAM-A, -B, and -D are allocated.
`GX_VRAM_BG_384_ACD` | 384 kilobytes are reserved in BG. VRAM-A, -C, and -D are allocated.

The following is the type definition for `GXVRamBG` types.

    typedef enum
    {
    GX_VRAM_BG_NONE     = 0x0000,
    GX_VRAM_BG_16_F     = GX_VRAM_F,                                     // ARM9: HW_BG_VRAM   -->   HW_BG_VRAM + HW_VRAM_F_SIZE
    GX_VRAM_BG_16_G     = GX_VRAM_G,                                     // ARM9: HW_BG_VRAM   -->   HW_BG_VRAM + HW_VRAM_G_SIZE
    GX_VRAM_BG_32_FG    = GX_VRAM_F | GX_VRAM_G,                         // ARM9: HW_BG_VRAM   -->   HW_BG_VRAM + HW_VRAM_F_SIZE + HW_VRAM_G_SIZE
    GX_VRAM_BG_64_E     = GX_VRAM_E,                                     // ARM9: HW_BG_VRAM   -->   HW_BG_VRAM + HW_VRAM_E_SIZE
    GX_VRAM_BG_80_EF    = GX_VRAM_E | GX_VRAM_F,                         // ARM9: HW_BG_VRAM   -->   HW_BG_VRAM + HW_VRAM_E_SIZE + HW_VRAM_F_SIZE
    GX_VRAM_BG_96_EFG   = GX_VRAM_E | GX_VRAM_F | GX_VRAM_G,             // ARM9: HW_BG_VRAM   -->   HW_BG_VRAM + HW_VRAM_E_SIZE + HW_VRAM_F_SIZE + HW_VRAM_G_SIZE
    GX_VRAM_BG_128_A    = GX_VRAM_A,                                     // ARM9: HW_BG_VRAM   -->   HW_BG_VRAM + HW_VRAM_A_SIZE
    GX_VRAM_BG_128_B    = GX_VRAM_B,                                     // ARM9: HW_BG_VRAM   -->   HW_BG_VRAM + HW_VRAM_B_SIZE
    GX_VRAM_BG_128_C    = GX_VRAM_C,                                     // ARM9: HW_BG_VRAM   -->   HW_BG_VRAM + HW_VRAM_C_SIZE
    GX_VRAM_BG_128_D    = GX_VRAM_D,                                     // ARM9: HW_BG_VRAM   -->   HW_BG_VRAM + HW_VRAM_D_SIZE
    GX_VRAM_BG_256_AB   = GX_VRAM_A | GX_VRAM_B,                         // ARM9: HW_BG_VRAM   -->   HW_BG_VRAM + HW_VRAM_A_SIZE + HW_VRAM_B_SIZE
    GX_VRAM_BG_256_BC   = GX_VRAM_B | GX_VRAM_C,                         // ARM9: HW_BG_VRAM   -->   HW_BG_VRAM + HW_VRAM_B_SIZE + HW_VRAM_C_SIZE
    GX_VRAM_BG_256_CD   = GX_VRAM_C | GX_VRAM_D,                         // ARM9: HW_BG_VRAM   -->   HW_BG_VRAM + HW_VRAM_C_SIZE + HW_VRAM_D_SIZE
    GX_VRAM_BG_384_ABC  = GX_VRAM_A | GX_VRAM_B | GX_VRAM_C,             // ARM9: HW_BG_VRAM   -->   HW_BG_VRAM + HW_VRAM_A_SIZE + HW_VRAM_B_SIZE + HW_VRAM_C_SIZE
    GX_VRAM_BG_384_BCD  = GX_VRAM_B | GX_VRAM_C | GX_VRAM_D,             // ARM9: HW_BG_VRAM   -->   HW_BG_VRAM + HW_VRAM_B_SIZE + HW_VRAM_C_SIZE + HW_VRAM_D_SIZE
    GX_VRAM_BG_512_ABCD = GX_VRAM_A | GX_VRAM_B | GX_VRAM_C | GX_VRAM_D, // ARM9: HW_BG_VRAM   -->   HW_BG_VRAM + HW_VRAM_A_SIZE + HW_VRAM_B_SIZE + HW_VRAM_C_SIZE + HW_VRAM_D_SIZE

    // discontinuous on LCDC memory
    GX_VRAM_BG_80_EG    = GX_VRAM_E | GX_VRAM_G,                         // ARM9: HW_BG_VRAM   -->   HW_BG_VRAM + HW_VRAM_E_SIZE + HW_VRAM_G_SIZE
    GX_VRAM_BG_256_AC   = GX_VRAM_A | GX_VRAM_C,                         // ARM9: HW_BG_VRAM   -->   HW_BG_VRAM + HW_VRAM_A_SIZE + HW_VRAM_C_SIZE
    GX_VRAM_BG_256_AD   = GX_VRAM_A | GX_VRAM_D,                         // ARM9: HW_BG_VRAM   -->   HW_BG_VRAM + HW_VRAM_A_SIZE + HW_VRAM_D_SIZE
    GX_VRAM_BG_256_BD   = GX_VRAM_B | GX_VRAM_D,                         // ARM9: HW_BG_VRAM   -->   HW_BG_VRAM + HW_VRAM_B_SIZE + HW_VRAM_D_SIZE
    GX_VRAM_BG_384_ABD  = GX_VRAM_A | GX_VRAM_B | GX_VRAM_D,             // ARM9: HW_BG_VRAM   -->   HW_BG_VRAM + HW_VRAM_A_SIZE + HW_VRAM_B_SIZE + HW_VRAM_D_SIZE
    GX_VRAM_BG_384_ACD  = GX_VRAM_A | GX_VRAM_C | GX_VRAM_D              // ARM9: HW_BG_VRAM   -->   HW_BG_VRAM + HW_VRAM_A_SIZE + HW_VRAM_C_SIZE + HW_VRAM_D_SIZE
    }
    GXVRamBG;

## See Also

GX_SetBankForBG, GX_GetBankForBG, GX_ResetBankForBG, GX_DisableBankForBG, GX_GetSizeOfBG, GX_SetBankForBGEx, GX_TrySetBankForBGEx

## Revision History

02/15/2005 Initial version.