This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
fast3d_display_list_commands [2016/01/25 05:31] queueram Add parameters to B6 and B7 and link to SM64 RSP |
— (current) | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Fast3D Display List Commands ====== | ||
| - | The Fast3D display list commands are microcode that are passed to the RSP for rendering. The are all 8 bytes long. | ||
| - | ===== Fast3D Commands ===== | ||
| - | |||
| - | ==== 03: F3D_MOVEMEM ==== | ||
| - | Used in Super Mario 64 to load vector normals (shading) RGB values. | ||
| - | |||
| - | ''03 [<color darkgrey>TT</color>] 00 00 [<color purple>AA AA AA AA</color>]'' | ||
| - | |||
| - | | <color darkgrey>T</color> | If 86, loads light values. If 88, loads dark values | | ||
| - | | <color purple>A</color> | Segmented address of vectors | | ||
| - | |||
| - | Example: Loads light RGB from 0x0 in RAM bank 0x0E; loads dark RGB from 0x08 in RAM Bank 0x0E | ||
| - | 03 86 00 00 0E 00 00 00 | ||
| - | 03 88 00 00 0E 00 00 08 | ||
| - | |||
| - | ---- | ||
| - | |||
| - | ==== 04: F3D_VTX ==== | ||
| - | Fills the vertex buffer with vertex information (ex. coordinates, color values). Max amount of bytes to load in F3D is 0x100 (16 vertices). | ||
| - | |||
| - | ''04 [<color darkred>XX</color>] [<color darkgreen>YY YY</color>] [<color purple>AA AA AA AA</color>]'' | ||
| - | |||
| - | | <color darkred>X</color> | Where to start writing vertices inside the vertex buffer | | ||
| - | | <color darkgreen>Y</color> | Amount of vertices to write (* 0x10) | | ||
| - | | <color purple>A</color> | Segmented address where vertices are stored | | ||
| - | |||
| - | Example: Load 15 (0xF0 / 0x10) vertices from 0x0E000780 (current map data) - and put them into the vertex buffer, starting at position 0x10 (15 vertices - 14). | ||
| - | 04 E0 00 F0 0E 00 07 80 | ||
| - | |||
| - | ---- | ||
| - | |||
| - | ==== 06: F3D_DL ==== | ||
| - | Signifies the start of a Display List. May be used to link data and branch the current DL. | ||
| - | |||
| - | ''06 00 00 00 [<color purple>AA AA AA AA</color>]'' | ||
| - | |||
| - | | <color purple>A</color> | Segmented Address to branch to | | ||
| - | |||
| - | Example: Loads a display list from 0xA50 in bank 0x07. | ||
| - | 06 00 00 00 07 00 0A 50 | ||
| - | |||
| - | ---- | ||
| - | |||
| - | ==== B5: F3D_QUAD ==== | ||
| - | Renders one quad according to the vertices inside the vertex buffer | ||
| - | |||
| - | ''B5 [<color darkred>AA</color>] [<color darkgreen>BB</color>] [<color darkblue>CC</color>] 00 [<color red>DD</color>] [<color green>EE</color>] [<color blue>FF</color>]'' | ||
| - | |||
| - | | <color darkred>A</color> | First vertex to use for the quad (* 0x0A) | | ||
| - | | <color darkgreen>B</color> | Second vertex to use for the quad (* 0x0A) | | ||
| - | | <color darkblue>C</color> | Third vertex to use for the quad (* 0x0A) | | ||
| - | | <color red>D</color> | Fourth vertex to use for the quad (* 0x0A) | | ||
| - | | <color green>E</color> | Fifth vertex to use for the quad (* 0x0A) | | ||
| - | | <color blue>F</color> | Sixth vertex to use for the quad (* 0x0A) | | ||
| - | |||
| - | Example: Render a quad using the vertex data specified at the vertex buffer positions 0, 1 (0x0A / 0x0A), 2 (0x14 / 0x0A), 0, 2 (0x14 / 0x0A) and 3 (0x1E / 0x0A). | ||
| - | B5 00 0A 14 00 00 14 1E | ||
| - | |||
| - | ---- | ||
| - | |||
| - | ==== B6: F3D_CLEARGEOMETRYMODE ==== | ||
| - | Enables or disables certain geometry parameters (ex. lighting, front-/backface culling, Z-buffer). Used at start of Display List. | ||
| - | |||
| - | ''B6 00 00 00 [<color purple>AA AA AA AA</color>]'' | ||
| - | |||
| - | | <color purple>A</color> | Various parameters | | ||
| - | |||
| - | Parameters (can be OR'd together): | ||
| - | | 0x00000001 | Use Z-buffering | | ||
| - | | 0x00000004 | Use shading | | ||
| - | | 0x00000200 | Enable smooth shading (otherwise flat shading) | | ||
| - | | 0x00001000 | cull front facing triangles | | ||
| - | | 0x00002000 | cull back facing triangles | | ||
| - | | 0x00004000 | Crystal effect? | | ||
| - | | 0x00010000 | Fog | | ||
| - | | 0x00020000 | Enable lighting? Vertex colors? | | ||
| - | | 0x00040000 | generate texture coords using the normal | | ||
| - | | 0x00080000 | generate texture coords (not sure how this works)| | ||
| - | |||
| - | Examples: | ||
| - | B6 00 00 00 00 02 20 00 : Vertex RGB, no culling | ||
| - | B6 00 00 00 00 02 00 00 : Vertex RGB, culling | ||
| - | B6 00 00 00 00 00 00 00 : No vertex RGB, culling | ||
| - | B6 00 00 00 00 00 22 00 : No vertex RGB, no culling | ||
| - | |||
| - | ---- | ||
| - | |||
| - | ==== B7: F3D_SETGEOMETRYMODE ==== | ||
| - | Enables or disables certain geometry parameters (ex. lighting, front-/backface culling, Z-buffer). Used at end of Display List. | ||
| - | |||
| - | ''B7 00 00 00 [<color purple>AA AA AA AA</color>]'' | ||
| - | |||
| - | | <color purple>A</color> | Various parameters | | ||
| - | |||
| - | See [[#B6: F3D_CLEARGEOMETRYMODE]] for list of parameters. | ||
| - | |||
| - | Examples: | ||
| - | B7 00 00 00 00 02 20 00 : Vertex RGB, no culling | ||
| - | B7 00 00 00 00 02 00 00 : Vertex RGB, culling | ||
| - | B7 00 00 00 00 00 00 00 : No vertex RGB, culling | ||
| - | B7 00 00 00 00 00 22 00 : No vertex RGB, no culling | ||
| - | |||
| - | ---- | ||
| - | |||
| - | ==== B8: F3D_ENDDL ==== | ||
| - | Terminates the current Display List | ||
| - | |||
| - | ''B8 00 000 000 00 00 00'' | ||
| - | |||
| - | ---- | ||
| - | |||
| - | ==== BB: F3D_TEXTURE ==== | ||
| - | Sets the texture scaling factor. | ||
| - | |||
| - | ''BB 00 00 ?? ?? ?? ?? ??'' | ||
| - | |||
| - | Examples: | ||
| - | BB 00 00 01 FF FF FF FF : Standard - at start for 1 scaling. | ||
| - | BB 00 00 01 0F 80 07 C0 : Special case - at start for environment mapping. | ||
| - | BB 00 00 00 FF FF FF FF : Always reset to at end of the DL to reset scale to 0. | ||
| - | |||
| - | ---- | ||
| - | |||
| - | ==== BF: F3D_TRI1 ==== | ||
| - | Renders one triangle according to the vertices inside the vertex buffer | ||
| - | |||
| - | ''BF 00 00 00 [<color darkred>AA</color>] [<color darkgreen>BB</color>] [<color darkblue>CC</color>]'' | ||
| - | |||
| - | | <color darkred>A</color> | First vertex to use for the triangle (* 0x0A) | | ||
| - | | <color darkgreen>B</color> | Second vertex to use for the triangle (* 0x0A) | | ||
| - | | <color darkblue>C</color> | Third vertex to use for the triangle (* 0x0A) | | ||
| - | |||
| - | Example: Render a triangle using the vertex data specified at the vertex buffer positions 0, 1 (0x0A / 0x0A) and 2 (0x14 / 0x0A). | ||
| - | |||
| - | BF 00 00 00 00 0A 14 | ||
| - | |||
| - | ---- | ||
| - | |||
| - | ==== F2: G_SETTILESIZE ==== | ||
| - | Sets the texture coordinates and size | ||
| - | |||
| - | ''F2 00 00 00 00 [<color darkred>WW W</color>][<color darkgreen>H HH</color>]'' | ||
| - | |||
| - | | <color darkred>W</color> | (width - 1) << 2 | | ||
| - | | <color darkgreen>H</color> | (hieght - 1) << 2 | | ||
| - | |||
| - | Examples: | ||
| - | F2 00 00 00 00 07 C0 7C : 32x32 textures | ||
| - | F2 00 00 00 00 0F C0 7C : 64x32 | ||
| - | F2 00 00 00 00 07 C0 FC : 32x64 | ||
| - | |||
| - | ---- | ||
| - | |||
| - | ==== F3: G_LOADBLOCK ==== | ||
| - | Determines how much data to load after SETTIMG | ||
| - | |||
| - | ''F3 00 00 00 ?? ?? ?? ??'' | ||
| - | |||
| - | Examples: | ||
| - | F3 00 00 00 07 7F F1 00 : 32x64 or 64x32 RGBA Textures | ||
| - | F3 00 00 00 07 3F F1 00 : 32x32 RGBA Textures | ||
| - | |||
| - | ---- | ||
| - | |||
| - | ==== F5: G_SETTILE ==== | ||
| - | Sets the texture properties (ex. mirroring) | ||
| - | |||
| - | ''F5 ?? ?? ?? ?? ?? ?? ??'' | ||
| - | |||
| - | Examples: | ||
| - | F5 10 00 00 07 00 00 00 : Always loaded first for normal RGBA, followed by another F5 command | ||
| - | F5 70 00 00 07 00 00 00 : Always loaded first for Grayscale, followed by another F5 command | ||
| - | F5 10 10 00 07 01 40 50 : Normal for 32x32 textures after G_SETTILESIZE | ||
| - | F5 10 20 00 07 01 40 60 : Normal for 64x32 textures after G_SETTILESIZE | ||
| - | F5 70 10 00 07 01 40 50 : Grayscale for 32x32 textures after G_SETTILESIZE | ||
| - | |||
| - | ---- | ||
| - | |||
| - | ==== F8: G_SETFOGCOLOR ==== | ||
| - | Sets the fog color | ||
| - | |||
| - | ''F8 00 00 00 [<color red>RR</color>] [<color green>GG</color>] [<color blue>BB</color>] [<color darkgray>AA</color>]'' | ||
| - | |||
| - | | R | red value | | ||
| - | | G | green value | | ||
| - | | B | blue value | | ||
| - | | A | typically set to FF | | ||
| - | |||
| - | Example: set the fog for the following polygons to pure green | ||
| - | |||
| - | F8 00 00 00 00 FF 00 FF | ||
| - | |||
| - | ---- | ||
| - | |||
| - | ==== FB: G_SETENVCOLOR ==== | ||
| - | Sets the environment color for combiner | ||
| - | |||
| - | ''FB 00 00 00 [<color red>RR</color>] [<color green>GG</color>] [<color blue>BB</color>] [<color darkgray>AA</color>]'' | ||
| - | |||
| - | |||
| - | | R | red value | | ||
| - | | G | green value | | ||
| - | | B | blue value | | ||
| - | | A | alpha value | | ||
| - | |||
| - | Example: make everything loaded underneath the command red, and semi-transparent | ||
| - | FB 00 00 00 FF 00 00 8C | ||
| - | |||
| - | ---- | ||
| - | |||
| - | ==== FC: G_SETCOMBINE ==== | ||
| - | Performs combining operations (ex. multi-texturing) | ||
| - | |||
| - | ''FC ?? ?? ?? ?? ?? ?? ??'' | ||
| - | |||
| - | Examples: | ||
| - | FC 12 7F FF FF FF F8 38 : Standard usage for solid RGBA textures | ||
| - | FC 12 18 24 FF 33 FF FF : Standard usage for alpha RGBA textures | ||
| - | |||
| - | |||
| - | ---- | ||
| - | |||
| - | ==== FD: G_SETTIMG ==== | ||
| - | Sets the texture image offset | ||
| - | |||
| - | ''FD 10 00 00 [<color purple>AA AA AA AA</color>]'' | ||
| - | |||
| - | | <color purple>A</color> | Segmented address of texture | | ||
| - | |||
| - | Example: Load texture position from 0x90 in RAM bank 0x04 | ||
| - | FD 10 00 00 04 00 00 90 | ||
| - | |||
| - | ===== References ===== | ||
| - | * http://www.smwcentral.net/?p=viewthread&t=74389 | ||
| - | * http://origami64.net/showthread.php?tid=114 | ||
| - | * http://n64.icequake.net/doc/n64intro/kantan/step2/4-3.html | ||
| - | * http://jul.rustedlogic.net/thread.php?id=1234 | ||
| - | * http://level42.ca/projects/ultra64/Documentation/man/pro-man/pro25/25-01.html | ||
| - | * http://wiki.spinout182.com/w/F3DEX2 | ||