N64® Functions Menu
|
al - Audio Library Functions
gDP - DP GBI Macros
gdSP - General GBI Macros
gSP - SP GBI Macros
gt - Turbo Microcode RDP
gu - Graphics Utilities
Math - Math Functions
nuSys - NuSystem
os - N64 Operating System
sp - Sprite Library Functions
uh - Host to Target IO
64DD - N64 Disk Drive
|
|
osGetRegionBufCount
osGetRegionBufSize
Syntax
long osGetRegionBufCount(void *region);
long osGetRegionBufSize(void *region);
Explanation
The osCreateRegion, osMalloc, osFree, osGetRegionBufCount, and osGetRegionBufSize functions are arbitrary region memory allocation routines.
These routines provide an easy and fast way to allocate and free
fixed-size buffers from an arbitrary memory area. A region is a user-defined, physically contiguous block of memory, divided into a set of
equal-sized buffers.
You can create any number of memory regions at run-time by calling osCreateRegion. You must supply a block of memory large enough for the specific buffer size, including a certain
overhead for the control structure. This memory allocation scheme takes a small portion at the beginning of the input memory area to use as the region control header. The rest of the region is organized simply as a pool of equal-sized buffers. The buffer size is aligned to the number of bytes defined in the alignSize argument. Upon creation, each region is given a unique region identifier. You can use this id to reference the region. because the id is actually the address of the control header for the region, any reference leads
directly to it, without any searching.
The osGetRegionBufCount function returns the total number of buffers created for the region.
The osGetRegionBufSize function returns the size (in bytes) allocated for each buffer in the region.
Notes
Currently, a region can have up to a maximum of 32,768 buffers. Upon
initialization, the region's starting address is automatically aligned to
the boundary specified by the alignSize argument. Its buffer size (in bytes) is rounded up to be alignSize aligned.
You need to be extremely careful that you do not create multiple regions
pointing to the same memory address. This will cause unexpected behavior
because this scheme does not perform any memory check during region
creation.
See Also
osCreateRegion
osMalloc
osFree
|
Nintendo® Confidential
Warning: all information in this document is confidential and covered by a non-disclosure agreement. You are responsible for keeping this information confidential and protected. Nintendo will vigorously enforce this responsibility.
Copyright © 1998
Nintendo of America Inc. All rights reserved Nintendo and N64 are registered trademarks of Nintendo
Last updated March 1998
|
|