		NINTENDO64 TECHNICAL SUPPORT CENTER
		
		    NINTENDO64 SAMPLE PROGRAM 2

		Copyright (C) 1997, NINTENDO Co,Ltd.


Table of Contents

	Introduction
	make
	Operation
	Program description
	Rights and Program Re-use
	History

Introduction
	
	
This program is a sample of the F3DEX Ver. 1.21 microcode.   The basic program is the same as nnsample1.  It uses BranchDisplayList, a feature added beginning with F3DEX Ver. 1.21, and a sample of direct-loading microcode.  In F3DEX Vers. 1.21, ucode runs BranchDisplayList, simplifying LOD (Level of Detail) processing.  Direct loading of microcode simplifies scheduling of graphics tasks, and microcode can be easily switched depending upon the processing.  


make

Use make with either the Indy Emulator Board or Partner-N64NW.  It is used without changes to either device.   

Note: (1) The F3DEX microcode must be used with this sample program.
          (2) The comments in the source file use Shift-JIS encoding.  

Operation 
	Control Pad	Movement of object in depth direction or left and right
	
	START Button	Screen initialization


Program Description

LOD Processing

With LOD, models of the the following characters are rendered depending on the location of the model relative to the viewpoint.

	Viewpoint to 500  	"NEAR"
	501 to 1000		"MIDDLE"
	1001 to 1600		"FAR"
	1601 or greater		no rendering		

When displayed using DisplayList, this appears as follows.

	  gsSPBranchLessZ(near__dl,   0,  500, 10, 2000, G_BZ_PERSP),
	  gsSPBranchLessZ(middle__dl, 0, 1000, 10, 2000, G_BZ_PERSP),
	  gsSPBranchLessZ(far__dl,    0, 1600, 10, 2000, G_BZ_PERSP),
	  gsSPEndDisplayList(),

ucode thus calculates the distance from the viewpoint to the model and thereby performs LOD processing. 


Direct Loading of Microcode

Dynamic changes in microcode are now possible by means of statements such as line 84 of graphic.c , in the section where the display list is created: 	

	gSPLoadUcodeL(glist_ptr++, gspL3DEX_fifo);

In this way, microcode can easily be switched depending on the object rendered, and scheduling also is simplified.  However, because microcode loading increases overhead, it is better not to switch microcode frequently.     


Points to note when using the fifo microcode. 

RDP OUTPUT SIZE

When using the fifo graphics microcode, the maximum pointer +1 for the fifo buffer must be assigned to the OSTask structure "*t.output_buff_size."  In this sample, for example, the pointer is substituted and used as shown below:   

---def.h---
	#define GFX_RDP_OUTPUT_SIZE 1024    /* RDP FIFO size */
	
	---rdp_output.c---
	u64 rdp_output[GFX_RDP_OUTPUT_SIZE];

	---graphic.c---
	gtask->list.t.output_buff = (u64 *)&rdp_output[0];
	gtask->list.t.output_buff_size = (u64 *)&rdp_output[GFX_RDP_OUTPUT_SIZE];

Please note that the role of this pointer variable is different in DRAM microcode and xbus. 
	
	
Rights and Program Re-use

The copyright for this sample program is held by Nintendo Co., Ltd.  
Although the source code can be freely re-used and modified, this program has not been adequately debugged.  We, therefore, urge you to perform adequate debugging when using the program. 


History

	1.0	Jan 30,1997 	nnsample2 released
	1.1	Feb  3,1997 	ntscsched.c problem fixed
	1.2	Dec  9,1997	waring suppressed in compile
				RDP FIFO buffer size corrected
