# NNS_GfdAllocFrmPlttVram

## C Specification

      #include <nnsys/gfd.h>

      NNSGfdTexKey NNS_GfdAllocFrmPlttVram(u32 szByte, BOOL b4Pltt, u32 allocFrom);

## Arguments

szByte | The size of palette-use memory you want to allocate (8 to 524280 bytes)
b4Pltt | TRUE if memory for 4-color palette is being allocated
allocFrom | Where palette-use memory is being allocated from.

## Return Values

The key data indicating the palette-use memory.

## Description

This function allocates palette-use memory of the size specified by `szByte` from Palette RAM, and returns the key indicating that palette-use memory. If an error occurs when the palette-use memory is being allocated, the function returns `NNS_GFD_ALLOC_ERROR_PLTTKEY`, which is a key indicating that an error has occurred.

The Frame Palette VRAM Manager can allocate palette memory from both the upper part and the lower part of Palette RAM. If `NNS_GFD_ALLOC_FROM_LOW` is specified in `allocFrom`, then palette memory is allocated from the lower part of Palette RAM. Conversely, if `NNS_GFD_ALLOC_FROM_HIGH` is specified in `allocFrom`, then palette memory is allocated from the upper part of Palette RAM.

If an allocation request is made for a size below the minimum that can be expressed for the key, the request size is rounded up to the minimum. If an allocation request is made for a size above the maximum that can be expressed for the key, the allocation process will not be performed and an error key will be returned.

If `TRUE` is specified in `b4Pltt`, then memory is allocated for a 4-color palette. The location where the 4-color palette can be placed serves as the basis for determining whether or not the palette-use memory has been allocated. (The 4-color palette cannot be placed beyond 0x10000.)

## See Also

`NNS_GfdInitFrmPlttVramManager, NNS_GfdFreeFrmPlttVram`

## Revision History

01/31/2005 Added a cautionary statement regarding the size range.
07/16/2004 Initial version.