gximm_ex.s 3.09 KB
/*---------------------------------------------------------------------*
	Copyright (C) 1998, Nintendo.
	
	File		gximm_ex.s
	Coded    by	Yoshitaka Yasumoto.	Feb 16, 1998.
	
	$Id: gximm_ex.s,v 1.1.1.1 2002/05/02 03:29:11 blythe Exp $
 *---------------------------------------------------------------------*/

	#---------------------------------------------------------------------
	#  caseEX_G_CULLDL
	#	指定した頂点が画面内部にあるなら ENDDL 動作をする
	#
	#   31        24        16         8         0
	#    +---------+---------+---------+---------+
	#    | CULLDL  |         | (top of vtx) * 2  |
	#    +---------+---------+---------+---------+
	#    |                   | (btm of vtx) * 2  |
	#    +---------+---------+---------+---------+
	#---------------------------------------------------------------------
caseEX_G_CULLDL:
  Assign(cc, 1)
		lhu	gfx0, RSP_SUBMOD_POINTS(gfx0)
		lhu	gfx1, RSP_SUBMOD_POINTS(gfx1)
#ifdef NEARCLIP_OFF
                _liu	(cc, 0x70b0)	/* -ZYX +WYX */
#else  /* NEARCLIP_OFF */
                _liu	(cc, 0x7070)	/* -ZYX +ZYX */
#endif /* NEARCLIP_OFF */
		lw	sys0, oRSP_POINT_CC+0(gfx0)
EXCullDL_Loop:	and	cc,   cc,   sys0
		beq	cc,   zero, GfxDone
		lw	sys0, oRSP_POINT_CC+40(gfx0)
		bne	gfx0, gfx1, EXCullDL_Loop
		addiu	gfx0, gfx0, 40
		j	case_G_ENDDL
  EndAssign(cc, 1)
		
	#---------------------------------------------------------------------
	#  caseEX_G_BRANCH_Z
	#	Z の値に応じて BRANCH を行なう
	#
	#   31        24        16         8         0
	#    +---------+---------+---------+---------+
	#    |RDPHALF  |                             |
	#    +---------+---------+---------+---------+
	#    |             branch addrs              |
	#    +---------+---------+---------+---------+
	#    |BRANCH_Z |    vtx*5     |0000|  vtx*2  |
	#    +---------+---------+---------+---------+
	#    |                Z Value                |
	#    +---------+---------+---------+---------+
	#---------------------------------------------------------------------
caseEX_G_BRANCH_Z:	
  FixedAssign(param,    2)
		lhu	gfx0,  RSP_SUBMOD_POINTS(gfx0)
#ifndef	BRANCH_WINT
		lw	gfx0,  oRSP_POINT_ZS(gfx0)	# Zscreen 値の取得
#else
		lh	gfx0,  oRSP_POINT_WI(gfx0)	# Wint 値の取得
#endif
		sub	param, gfx0, gfx1		# Z 値の比較
		bgez	param, GfxDone			# 大きければ終了
		lw	gfx1, RSP_GSTAT_RDPHALF_1L(zero)# Jump 位置の取得
		j	case_G_DL_0			# Jump 処理
							# このとき param<0
  EndAssign(param,    2)
		
	#---------------------------------------------------------------------
	#  caseEX_G_MODIFYVTX
	#	頂点キャッシュの内部データを直接書換える
	#
	#   31        24        16         8         0
	#    +---------+---------+---------+---------+
	#    |MODIFYVTX|  offset |  (vtx id) * 2     |
	#    +---------+---------+---------+---------+
	#    |             d  a  t  a                |
	#    +---------+---------+---------+---------+
	#---------------------------------------------------------------------
caseEX_G_MODIFYVTX:
  FixedAssign(adrs, 1)
		lbu	adrs, (RSP_DLINPUT_BOTTOM-7)(dinp) # Delay $2 使用不可
		j	case_G_MOVEWORD_0
		lhu	gfx0, RSP_SUBMOD_POINTS(gfx0)
  EndAssign(adrs,  1)

/*======== End of gximm_ex.s ========*/