# NNS_GfdAllocFrmPlttVram

## Syntax

      #include <nnsys/gfd.h>

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

## Arguments

`szByte` | Size of the 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

Allocates palette-use memory of the size specified by `szByte` from Palette RAM and returns a 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`, palette memory is allocated from the lower part of Palette RAM. Conversely, if `NNS_GFD_ALLOC_FROM_HIGH` is specified in `allocFrom`, 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`, memory is allocated for a 4-color palette. In this situation, the function determines if palette-use memory was successfully allocated in a location where it is possible to place a 4-color palette. (The 4-color palette cannot be placed beyond `0x10000`.)

## See Also

`NNS_GfdInitFrmPlttVramManager`
`NNS_GfdFreeFrmPlttVram`

## Revision History

2005/01/31 Added a warning about the size range.
2004/07/16 Initial version.

CONFIDENTIAL