# GX_SetBankForBG

## C Specification

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

## Description

This function allocates the specified VRAM bank to the main 2D Engine's BG. If the specified VRAM bank is either disabled or allocated to LCDC, that VRAM bank is allocated to the Main 2D Engine's BG.

`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;

## Arguments

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

## Return Values

None

## See Also

`GX_GetBankForBG, GX_ResetBankForBG, GX_DisableBankForBG, GX_GetSizeOfBG, GX_SetBankForBGEx`

## Revision History

01/19/2004 Initial Version