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

Nintendo® Confidential





gSPLoadUcode

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

Arguments

  • gdl is the display list pointer.

  • uc_start is the starting physical address of microcode text section.

  • uc_dstart is the starting physical address of microcode data section.

Explanation
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 Online Programming Manual.

Note
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.

Comment
Microcode is loaded to switch to the microcode corresponding to the type of drawing to be done at the time. For example, 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:

  • DisplayList stack
  • Matrix stack
  • ModelView matrix
  • Projection matrix
  • Segment table
  • Scissor Box range
  • SetOtherMode parameter
  • PerspNormalize value
  • ViewPort parameter

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
gSPLoadUcodeL

Revision History
2/1/1999 Completely rewritten.


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 1999