# 2.4.3 Using Microcode

## Types of Microcode

Currently, N64 has two types of microcode, graphics microcode and audio microcode.

## Graphics Microcode

The commands used in the graphics microcode are called GBI (graphics binary interface) commands. Each GBI command uses 64 bits. Following are some general notes about improvements that Nintendo has made to the graphics microcode:

### gspF3DEX Series of Microcode

- gspF3DEX.fifo.o (with near clip) and gspF3DEX.NoN.fifo.o (without near clip) both have an increased vertex cache of 32 based on the Fast 3D microcode and have packaged the 2Triangles command. Also, the number of links in the display list has increased from 10 to 18.
- gspF3DLX.fifo.o (with near clip) and gspF3DLX.NoN.fifo.o (without near clip) both have improved performance. This was accomplished by simplifying the sub-pixel calculation on F3DEX, so sometimes the texture has little creases. The GBI in F3DLX is compatible with F3DEX. Also, F3DLX has an additional feature in that it can turn clipping on or off. When clipping is off, performance improves a little.
- gspF3DLX.Rej.fifo.o (with texture correction) and gspF3DLP.Rej.fifo.o (without texture correction) both omit the usual microcode clipping process and use the "reject" process instead. The reject process simply means that the microcode draws only triangles whose three vertices are within a fixed area inside the screen. If one of the vertices lies outside the screen, the entire triangle is rejected (not drawn). In the F3DLX.Rej and F3DLP.Rej microcode, the processing rate for the 2Triangles command has been significantly improved by adopting this reject process. Therefore, you should use the gSP2Triangles function as often as possible when creating the display list.
  Note that the F3DLP.Rej microcode is slightly faster than the F3DLX.Rej microcode. However, this faster speed applies only to the RSP process. There is no effect on the RDP process. Therefore, the RDP process may not follow the RSP process in which case, you may need to change the render mode to the RA mode (G_RM_RA_ZB_OPA_SURF).
  Also note that this microcode does not support G_CULL_BOTH or G_CULL_FRONT.
- gspL3DEX.fifo.o is a modified version of the Line3D microcode adapted to a vertex cache size of 32. It is the same as gspLine3D and displays polygons (such as 1Triangle and 2Triangles) rendered by F3DEX series of microcode to be displayed using wireframe.
- GBI Compatibility
  On the binary level, there is no compatibility between the GBI of the gspF3DEX series of microcode and the GBI of the usual Fast3D microcode. However, the gspF3DEX series has been designed so that the differences are absorbed by gbi.h. Even if both types of microcode are in the same display list, a compile option can distribute each command to its proper GBI. Specifically, you can ensure that the GBI corresponding to the gspF3DEX microcode is output by defining the F3DEX_GBI keyword before including the gbi.h file.
  After Release 0.96, all microcode of F3DEX, F3DLX, F3DLX.Rej, and F3DLP.Rej became compatible at the GBI binary level, so each display list was able to use it. However, because of the reject process, operations are slightly different even under the same command; as a result, you need to be careful that the same screen is not always drawn even when in the same display list.
- Microcode of the Fast3D series
  Although microcode of the Fast3D series are used in many samples, they are really obsolete now that the new and improved F3DEX series is out. You should use the improved F3DEX series for your actual game making.

### Sprite Microcode

- S2DEX is the microcode that makes it possible to use sprites in N64 development. This microcode makes it possible for you to manage drawn objects using the separate concepts of the sprite and the BG. This makes it easy for you to get used to the usual sprite game development methods.
- Microcode of the Sprite2D Series
  Although microcode of the Sprite2D series is used in many samples, you should use the S2DEX microcode in actual game development. The S2DEX microcode is an improved version of the Sprite2D microcode.

### JPEG Microcode

The N64_JPEG library has two types of microcode, one for encoding and one for decoding.

- njpgespMain.o provides YUV conversion, culling, DCT, quantization, and a zigzag scan for RGBA image data. The output is entropy encodable data.
- njpgdspMain.o provides a reverse zigzag scan, reverse quantization, and reverse DCT for entropy decoded data. The output is YUV format data.

## Audio Microcode

The audio microcode is made up of ABI (audio binary interface) commands. These ABI commands are strung together to form the audio command list. Each ABI command uses 64 bits.

- aspMain is the audio microcode, which is used only for waveform synthesis. This microcode makes the RSP operate as a waveform synthesis processor. The audio microcode processes each game application task and synthesizes the 16-bit sample data of an L/R stereo.
- n_aspMain is the audio microcode for n_audio, which is an enhanced version of the original N64 audio library. This microcode helps speed up the audio process.

Nintendo® Confidential
Copyright © 1999
Nintendo of America Inc. All Rights Reserved
Nintendo and N64 are registered trademarks of Nintendo
Last Updated March, 1999