N64® Function Reference

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
Demos and Sample Code
Miscellaneous Tools
Emulator 2.0 INDY Device
Microcode

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.

## N64 Hardware Terminology

64DD

> The previous working name for the N64 Disk Drive. N64 Disk Drive disks can hold larger games than N64 Game Paks can hold. In fact, the N64 Disk Drive disks store approximately 64 megabytes. N64 Game Pak games use 4, 8, or 12 megabytes of ROM.

Add-on memory

> There are four ways to add on back-up memory:
> - The Memory Pak device adds 4 megabytes of RAM to the N64 system. It is required by the N64 Disk Drive and can also be used by an N64 Game Pak. It attaches directly to the top of the N64 Control Deck in the little compartment in front of the Game Pak slot.
> - The Controller Pak device adds additional back-up memory for the Controller. It attaches directly to the Controller.
> - An EEPROM (electrically erasable programmable ROM) chip can be built right into the N64 Game Pak to add back-up memory for use by the game. The EEPROM memory size can be either 4K bits or 16K bits.
> - SRAM can be built right into the N64 Game Pak to add back-up memory for use by the game. The SRAM memory size is 256K bits.

AI

> The audio interface. The AI is a write-only interface that connects the RCP to the audio DAC (digital analog converter). It uses DMA (direct memory access) to write audio data out of main memory into a specific video address buffer. It generates the stereo audio signal and allows you to change video modes and configurations. See Chapter 27, "The Audio Library" and Chapter 9, "Input/Output Functionality" in the N64 Programming Manual for more information.

Controller Pak

> A removable memory device (back-up RAM) used with the N64 Controller that can store 32K bytes of data. The operating system implements a simple file system on the Controller Pak so developers can find, create, delete, read, and write files. The Controller Pak is inserted into the Controller and can be used for purposes such as storing game progress and high scores and other game configuration data. It is usually shared by multiple applications.

EEPROM

> A nonremovable memory chip, EEPROM (electrically erasable programmable ROM) is built right into the N64 Game Pak. It holds either 4K bits of data or 16K bits. Game developers use it to save data during a game. For example, a developer might use it to keep track of where the game user was in the game when the game ended or to keep track of high scores. A circuit is added to the EEPROM so that it can communicate with the serial interface of the RCP through the PIF.

EPI

> The enhanced, expanded, or extended PI (peripheral interface). Without EPI (that is, with just the PI), game programmers can use the address space of Game Pak ROM but cannot use an extension device located in another address space like SRAM or the ROM in the N64 Disk Drive. With EPI functions, the programmer can indicate which device to access by using a handler (OSPiHandle structure). The handler is set up according to the characteristics of the hardware device (EEPROM, SRAM, Controller Pak ROM, or N64 Disk Drive ROM) to be used.

Memory Pak

> An additional 4 megabytes of add-on RAM that you can use to expand capacity. It is required by the N64 Disk Drive and can also be used by an N64 Game Pak. It attaches directly to the top of the N64 Control Deck in the little compartment at the front of the top. It is different from the other types of add-on memory:
> - The Controller Pak adds additional memory for the Controller and attaches directly to the Controller.
> - The EEPROM chip is built right into the N64 Game Pak to add back-up memory for use by the game.
> - SRAM is built right into the N64 Game Pak to add back-up memory for use by the game.

PI

> The parallel interface also known as the peripheral interface. The PI is the read/write DMA (direct memory access) engine that connects the RCP to the N64 Game Pak and other mass storage devices that use the parallel port. The PiManager thread is used to set up the actual DMA commands for all other threads.

R4280 CPU

> The R4280 CPU is part of the MIPS R4000 family of processors. The R4280 consists of an execution unit with a 64-bit register file for integer and floating-point operations, a 16K byte instruction cache, an 8K byte writeback data cache, and a 32-entry TLB (translation lookaside buffer) for virtual-to-physical address calculation. The N64 game runs in kernel mode with 32-bit addressing. The 64-bit integer operations are available in this mode; the 32-bit C calling convention is used to maximize performace.
> For more information on the R4280 CPU and the operating system control of the CPU see the MIPS Microprocessor R4000 User's Manual and Chapter 7, "Operating System Overview," of the N64 Programming Manual.

RCP

> The Reality Co-Processor chip. N64 games consist of a number of hardware components that work together to produce the graphics and audio for the game. The heart of the system is the RCP. Attached to the RCP are memory chips, the MIPS R4280 CPU, and some miscellaneous I/O chips.
> The RCP is the center of the game; all data must pass through it. It acts as the memory controller for the CPU. The RCP runs the graphics and audio microcode. The display portion of the RCP renders into the graphics framebuffer located in main memory.
> The CPU and RCP are both processors that can execute at the same time. Threads execute on the CPU and tasks execute on the RCP. The RCP is a microcode engine that processes a task list. Task lists are generated by a thread running on the MIPS R4280 CPU and are stored in main memory. The game program creates the task list, calls an OS routine to load the appropriate microcode, and then starts the RCP running to process the task list. The microcode on the RCP reads the task list from main memory. The RCP task can also write into main memory.
> The RCP has two modes of I/O (input/output) operations:
> - DMA (direct memory access) to provide a minimum of 64-bit transfer between the RDRAM and any of the devices
> - IO to provide a 32-bit transfer between the CPU and any of the devices
> The RCP consists of the following major devices and memory interfaces:
> - Reality Signal Processor (RSP). This internal processor is the audio and graphics microcode engine that supports both DMA and I/O operations between RDRAM and IMEM or DMEM addresses.
> - Reality Display Processor (RDP). This internal processor supports only DMA from either RDRAM or DMEM addresses to its internal buffer. It is the graphics display pipeline that renders into the framebuffer.
> - The following memory interfaces that provide access to main memory for the CPU, RSP, RDP, video interface, audio interface, peripherial devices, and serial game controllers:
>   - Video Interface (VI). This write-only interface connects to the video DAC (digital analog converter). It supports only DMA from RDRAM to a specific video buffer address and allows you to change video modes and configurations.
>   - Audio Interface (AI). This write-only interface connects to the audio DAC. It supports only DMA from RDRAM to a specific audio buffer address and allows you to set the audio frequency.
>   - Peripheral Interface (PI). This read-write interface connects to the ROM cartridge and other mass storage devices. It supports DMA as well as I/O Read/Write to ROM addresses.
>   - Serial Interface (SI). This read-write module interfaces to the PIF, which connects to the game controller and modem devices. It supports DMA as well as I/O Read/Write to PIF RAM addresses.
>   It is very important to remember that these interfaces may be active at the same time and that the RSP and RDP are also running in parallel.

RDP

> The Reality Display Processor. It is an internal processor in the RCP. The RDP is the graphics display pipeline that executes an RDP display list that was generated by the RSP and CPU. The RDP consists of a Rasterizer (RS), a Texture Unit (TX), 4K bytes of texture memory (TMEM), a Texture Filter Unit (TF), a Color Combiner (CC), a Blender (BL), and a Memory Interface (MI).
> The RS rasterizes triangles and rectangles. The TX samples textures loaded in TMEM. The TF filters the texture samples. The CC combines and interpolates between two colors. The BL blends the resulting pixels with pixels in the framebuffer and performs Z-Buffer and anitaliasing operations. The MI performs the read, modify, and write operations for the individual pixels at either one pixel per clock or one pixel for every two clocks. The MI also has special modes for loading the TMEM, filling rectangles (fast clears), and copying multiple pixels from the TMEM into the framebuffer (sprites).
> The RDP gains access to main memory by using physical addresses to load the internal TMEM, to read the framebuffer for blending, to read the Z-Buffer for depth comparison, and to write the Z-Buffer and framebuffer. The microcode on the RSP translates the segmented addresses in the task list into physical addresses.
> The global state registers are used by all stages of the pipeline. There are a number of sync commands to provide synchronization. For example, a pipe sync is used before changing one of the rendering modes. This ensures that all previous rendering affected by the mode change occurs before the mode change.
> The command list for the RDP usually comes directly from the RSP. However, it is possible to feed the RDP pipeline from a command list that has been stored in main memory.
> See Chapter 14, "RDP Programming," in the N64 Programming Manual for more information on the RDP.

RSP

> The Reality Signal Processor. It is an internal processor embedded in the RCP. It performs all 3D manipulations and audio functions. The RSP is used by and can be configured by the graphics and audio microcode. It consists of a Scalar Unit (SU), a Vector Unit (VU), instruction memory (IMEM), and data memory (DMEM). The microcode is fetched from IMEM and has direct access to DMEM. The RSP also has access to main memory by using DMA (direct memory access). All memory references in the RSP are physical. However, the microcode uses a segment address table to translate segmented addresses provided in the task lists into physical addresses. The IMEM and DMEM are both 4K bytes in size. The SU implements a subset of the R4000 instruction set. The VU has eight 16-bit elements.
> For information on how the RSP is used to implement part of the graphics pipeline, see Chapter 13, "RSP Graphics Programming" in the N64 Programming Manual. Chapter 27, "The Audio Library," describes how the RSP is used in audio processing.

SI

> The serial interface. It is a read/write interface that connects serial devices like the Controller, Controller Pak, N64 Game Pak EEPROM, and Rumble Pak to the RCP (Reality CoProcessor) in the N64 Control Deck. The serial interface connects the RCP with the game controllers through the PIF chip. To get the current state of the controllers, the application must send a command to query all the game controllers.

SRAM

> A memory area that N64 programs can reserve for saving data. Unlike the EEPROM and Controller Pak, SRAM can be handled by EPI in the same way as ordinary MASKROM, although the addressing is different. Currently, the available SRAM has a capacity of 256K bits. The starting address is a physical address from 0x8000000.
> If SRAM is connected to the AD16 bus, it can be used when developing game software. For example, while using Partner-N64, you can use SRAM by inserting the SRAM board into the slot located in the upper part of Emulator ROM. While using an N64 Control Deck, you can use either flash ROM, which has built-in SRAM, or a DCC-Board.

VI

> The video interface. The VI is a write-only interface that connects the RCP to the video DAC (digital analog converter). It uses DMA (direct memory access) to move data out of the framebuffer in main memory to a specific video buffer address. You can use it to change video modes and configurations. It generates the composite, S-video, and RGB signals. It also performs the second pass of the antialias algorithm. The VI works in either NTSC or PAL mode, and can display 15- or 24-bit color pixels, with or without filtering, at both high and low resolutions. The VI can also scale up a smaller image to fill the screen.
> For more information on how to set one of the 28 video modes and control the special features of the VI, see the osViSetMode function in the online Function Reference Manual and Chapter 9, "Input/Output Functionality" in the N64 Programming Manual.

Nintendo® Confidential Copyright © 1998 Nintendo of America Inc. All rights reserved Nintendo and N64 are registered trademarks of Nintendo Last Updated March 1998