4.3 Memory Management

UP


4.3.1 No Default Dynamic Memory Allocation

N64 software does not impose a memory map on the game. The N64 system leaves the memory allocation problem up to the game application. It assumes that the application knows the memory partitioning scheme most suitable for the particular game. However, the library does have a large amount of functions available which the game application can use.

UP


4.3.2 Region Library

The N64 system provides a region allocation library that can partition a memory region specified by the application into a number of fixed-sized blocks. This gives the application the capability of using a dynamic memory allocation scheme. However, the game application must be able to handle situations where memory in the region has run out.

UP


4.3.3 Memory Buffer Placement

There are some optimizations with the placement of memory buffers. For example, it is best to keep the color buffer and Z buffer on separate 1 MB memory banks. The RDRAM has an active page register for each megabyte. Splitting the color and Z buffers into separate megabytes prevents the memory system from constantly having to change the page register. This technique minimizes page misses.

UP


4.3.4 Memory Alignment

The DMA engines responsible for shuffling data around in the hardware all require the 64-bit aligned source address, the destination address, and lengths. Addresses in ROM do not have this 64-bit alignment restriction. ROM addresses only need to be 16-bit aligned. A compiler and its loader, which input data from the related program (see the man page for ld (1)), verifies that all C language long types are 64-bit aligned.

UP