gSPLoadUcode [Macro]



Loads the specified microcode


#include <ultra64.h>        /* gbi.h */
gSPLoadUcode(Gfx *gdl, u64 *uc_start, u64 *uc_dstart)
gsSPLoadUcode(         u64 *uc_start, u64 *uc_dstart)


the display list pointer.
the starting physical address of microcode text section.
the starting physical address of microcode data section.


Loads the specified microcode. However, this macro can only load microcode in the F3DEX microcode group (F3DEX, F3DLX, F3DLX_Rej, F3DLP_Rej, and L3DEX). It cannot load Fast3D or Turbo3D microcode. Also, since loading microcode has its associated overhead, you should only load microcode when it is required for performance reasons. The gSPLoadUcodeL macro, which is simpler to use than gSPLoadUcode, also is available. For details, please see Section 25.3.1, "F3DEX Microcode Series Functions" in the N64 Programming Manual.


When microcode is loaded by this macro, the graphics and RSP internal states are initialized. Therefore, RSP-related settings must be set again after the microcode is loaded. Note that the display list link information is also initialized. This means that when this macro is used within a display list that was called by gSPDisplayList, processing will not be able to return to the calling display list. (This specification is regrettably unavoidable for implementation reasons.)

To use this macro's g*SPLoadUcode function, the OS_TASK_LOADABLE flag must be set for the "flag" element in the OSTask structure, as shown below:

        OSTask *tp;
        tp->t.flag = OS_TASK_LOADABLE | OS_TASK_DP_WAIT;

To enable this flag process you must install a patch in the operating system. For information about how to install the patch, refer to F3DEX. The patched operating system is upward compatible with the pre-patched operating system.

Microcode that allows clipping such as F3DLX is loaded when drawing terrain, and high-speed microcode such as F3DLX_Rej is loaded for drawing people. This macro also enables the switch from F3DEX to L3DEX (conventionally done when drawing lines) to be made without CPU intermediation.

Accompanying the change from F3DEX to F3DEX2, when F3DEX2 microcode is self-loaded the following parameters are maintained:

The other GeometryMode, Light, and vertex buffer parameters are not preserved. Although the Model and Projection matrices are maintained, the MP matrix is not, so either the M or the P matrix must be loaded again and the MP matrix must be reconfigured. Accompanying these changes, self-loading with the old F3DEX and S2DEX microcode is no longer possible. Self-loading can only be done between microcode of the F3DEX2 series, and between the F3DEX2 and S2DEX2 microcodes. Self-loading is also possible between FIFO microcode and XBUS microcode.

See Also


Revision History

02/01/99 Entirely revised.