# NNS_GfdAllocPlttVram

## C Specification

      #include <nnsys/gfd.h>

      NNSGfdPlttKey NNS_GfdAllocPlttVram(u32 szByte, BOOL is4pltt, u32 opt);

## Arguments

szByte | The size of palette-use memory you want to allocate (8 to 524280 bytes)
is4pltt | TRUE if 4-color palette-use memory is being allocated
opt | Options for Palette VRAM Memory Manager

## Return Values

The key data indicating the palette-use memory.

## Description

Allocates palette-use memory of the size specified by `szByte` from VRAM. The NITRO-System library uses this function to allocate palette-use memory from Palette RAM.

The `NNS_GfdAllocPlttVram` function is defined as shown below. The only internal process this function conducts is to call the function set in the global function pointer `NNS_GfdDefaultFuncAllocPlttVram`.

    static inline NNSGfdPlttKey

    NNS_GfdAllocPlttVram(u32 szByte, BOOL is4pltt, u32 opt)

    {
    return (*NNS_GfdDefaultFuncAllocPlttVram)( szByte, is4pltt, opt );
    }

`NNS_GfdAllocPlttVram` functions by registering the appropriate function for allocating palette-use memory in this function pointer. With this setup, the user can control the allocation of palette-use memory from the library. In the initial state, the function that is set in `NNS_GfdDefaultFuncAllocPlttVram` does nothing and returns an error. If an error occurs when palette-use memory is being allocated, the key `NNS_GFD_ALLOC_ERROR_PLTTKEY` is returned, indicating the error.

The `opt` parameter enables you to freely select how to use the function set in `NNS_GfdDefaultFuncAllocPlttVram` for allocating palette-use memory.

There is a restriction for the size that can be specified due to the specification of the bit expression inside the palette key.

## See Also

`NNS_GfdFreePlttVram`

## Revision History

01/31/2005 Added a cautionary statement regarding the size range.

07/16/2004 Initial version.