Fast3D is the name of the microcode (a microcode is basically a graphics driver for the N64 in very rough and simplified terms) that Super Mario 64 uses. This page hopefully will be of use to you as it demonstrates all of the available macros for use in a display list.
A command is literal data being sent to the RCP telling it to perform an action. Most people who have done binary ROM hacking have likely experienced using F3D commands and editing them through a hex editor. Assembler macros greatly simplify the process of tweaking a displaylist by often combining several commands into one with an easier syntax. In order to use the macros, you must add .include "ultra64/gbi.inc" and .include macros.inc near the top of your assembler file
Loads vertices.
Dynamic display list: gSPVertex(Gfx *gdl, Vtx *v, u32 n, u32 v0)
Static display list: gsSPVertex(Vtx *v, u32 n, u32 v0)
Argument | Description |
---|---|
gdl | Pointer to display list. |
v | Vertex list. |
n | Amount of vertices to be loaded. For F3D this ranges from 1-15, on F3DEX it is 1-32, and on F3DEX Rej/F3DLP Rej it is 1-64. |
v0 | Starting index in vertex buffer where vertices are to be loaded (offset). For F3D this is 0-14, for F3DEX it is 0-31, and for F3DEX Rej/F3DLP Rej it is 0-63 and 0-79 respectively. |
Loads into the RSP vertex buffer the vertices that will be used by the gSP1Triangle and gSP2Triangles macros that generate polygons.
Draws one triangle.
Dynamic display list: gSP1Triangle(Gfx *gdl, s32 v0, s32 v1, s32 v2, s32 flag)
Static display list: gsSP1Triangle(s32 v0, s32 v1, s32 v2, s32 flag)
Argument | Description |
---|---|
gdl | Pointer to display list. |
v0, v1, v2 | Vertex buffer index. 0-15 on F3D (default), 0-31 on F3DEX, and 0-63 on F3DEX Rejection (0-79 on F3DLP). |
flag | Not implemented. |
Generates a single triangle face (using the vertices v0, v1, and v2) in the internal vertex buffer loaded by the gSPVertex macro.
Draws two triangles.
Dynamic display list: gSP2Triangles(gfx *gdl, s32 v0, s32 v1, s32 v2, s32 flag0, s32 v3, s32 v4, s32 v5, s32 flag1)
Static display list: gsSP2Triangles(s32 v0, s32 v1, s32 v2, s32 flag0, s32 v3, s32 v4, s32 v5, s32 flag1)
Argument | Description |
---|---|
gdl | Pointer to display list. |
v0, v1, v2 | Vertex buffer index. 0-31 on F3DEX, and 0-63 on F3DEX Rejection (0-79 on F3DLP). |
flag0 | Not implemented. |
v3, v4, v5 | Vertex buffer index. Same purpose as the first three. |
flag1 | Not implemented. |
Note: This macro is implemented on F3DEX only! It generates the first triangle using the vertices v0, v1, and v2, loaded into the vertex buffer by the gSPVertex macro, and generates the second triangle using the vertices v3, v4, and v5. Using this wherever possible reduces memory usage and increases performance.
Calls a child display list from the current display list.
Dynamic display list: gSPDisplayList(Gfx *gdl, Gfx *dl)
Static display list: gsSPDisplayList(Gfx *dl)
Argument | Description |
---|---|
gdl | Pointer to display list. |
dl | Pointer to display list. |
gSPDisplayList calls a child display list from the current display list. This kind of display list hierarchy can be used to make re-use of display lists or to structure the display list data in a way that reflects the actual rendering model. The display list hierarchy can have up to 10 steps (18 steps for F3DEX). This macro works like a subroutine call: when the processing of the child display list is complete, the processing of the parent display list which made the call resumes.
Sets the geometry pipeline modes enabled
Dynamic display list: gSPSetGeometryMode(Gfx *gdl, u32 mode)
Static display list: gsSPSetGeometryMode(u32 mode)
Argument | Description |
---|---|
gdl | Pointer to display list. |
mode | Geometry pipeline mode. Discussed more in detail below. |
Sets the geometry pipeline modes for culling, lighting, specular highlights, reflection mapping, fog, etc. Use gSPClearGeometryMode to disable the modes. Numerous specifications can be set for mode with a bit sum (as in, can be OR'd together) of the following flags:
Mode | Numerical Equivalent | Description |
---|---|---|
G_SHADE | 0x00000004 | Enables calculation of vertex color for a triangle. |
G_LIGHTING | 0x00020000 | Enables lighting calculations. |
G_SHADING_SMOOTH | 0x00000200 | Enables Gouraud shading. When this is not enabled, flat shading is used for the triangle, based on the color of one vertex (see gSP1Triangle). G_SHADE must be enabled to calculate vertex color. |
G_ZBUFFER | 0x00000001 | Enables Z buffer calculations. Other Z buffer-related parameters for the frame buffer must also be set. |
G_TEXTURE_GEN | 0x00040000 | Enables automatic generation of the texture's s,t coordinates. Spherical mapping based on the normal vector is used. |
G_TEXTURE_GEN_LINEAR | 0x00080000 | Enables automatic generation of the texture's s,t coordinates. |
G_CULL_FRONT | 0x00001000 | Pointer to display list. |
G_CULL_BACK | 0x00002000 | Enables front-face culling. Note: This is not supported on F3DEX Rej/F3DLP Rej. |
G_CULL_BOTH | 0x00003000 | Enables back-face culling. Note: This is not supported on F3DEX Rej/F3DLP Rej. |
G_FOG | 0x00010000 | Enables generation of vertex alpha coordinate fog parameters. Note: Enabling this means you cannot use vertex alpha. |
G_CLIPPING | 0x00800000 | Enables clipping. This mode is enabled in the initial state. When disabled, clipping is not performed. Note: This is only supported on F3DLX and F3DLX NoN. |
Disables the geometry pipeline modes
Dynamic display list: gSPClearGeometryMode(Gfx *gdl, u32 mode)
Static display list: gsSPClearGeometryMode(u32 mode)
Argument | Description |
---|---|
gdl | Pointer to display list. |
mode | Geometry pipeline mode. |
gSPClearGeometryMode disables the geometry pipeline modes for culling, lighting, specular highlights, reflection mapping, fog, etc. To enable these various modes, use gSPSetGeometryMode. For details about the different modes, see gSPSetGeometryMode.
Ends a display list.
Dynamic display list: gSPEndDisplayList(Gfx *gdl)
Static display list: gSPEndDisplayList(void)
Argument | Description |
---|---|
gdl | Pointer to display list. |
Ends a display list. When this macro is executed, the RSP pops the display list stack and, if the display list stack is empty, ends the graphics process. Note: All display lists must end with this macro.