Dmem Organization And Usage; Jump Tables; Constants - Nintendo Ultra64 Programmer's Manual

Rsp
Table of Contents

Advertisement

Advanced Information

DMEM Organization and Usage

126
Planning the layout of DMEM is an essential step of writing an RSP
program. A convenient DMEM layout can save precious instructions and
lead to a more optimized and bug-free program.
There are typically parts of DMEM which can be or need to be allocated and
initialized at compile-time; the assembler's data directives can accomplish
this. Although the data section is built up sequentially regardless of source
code files, it helps to keep all DMEM allocations centralized in one file,
rather than spreading it out over several source code files.
During compilation, the assembler will produce a .dat file which
represents the data section of the microcode object. This section should be
loaded into DMEM as part of the task loading effort. If you make this data
section as small as it can be, and keep it near the top of DMEM (0x04000000)
this task loading can be as fast as possible.
Be sure to compare the size of the data that must be initialized with the size
of the data loaded into DMEM via the task structure. Most programs use the
value SP_UCODE_DATA_SIZE, which is defined in ucode.h with a value of
2048 (bytes). This value might not be appropriate for every RSP program.

Jump Tables

Program "jump tables" can be constructed by initializing DMEM with
program labels. During the second pass of the assembler, these labels will be
resolved and the contents of DMEM will be initialized correctly.
Since IMEM is only 4K bytes, a half word is sufficient to hold any IMEM
address.

Constants

Program constants can be generated at compile-time and initialized in
DMEM. When needed, they can be loaded directly and used.

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents