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

	#---------------------------------------------------------------------
	#  caseLXRej_G_CULLDL
	#	指定した頂点が画面内部にあるなら ENDDL 動作をする
	#
	#   31        24        16         8         0
	#    +---------+---------+---------+---------+
	#    | CULLDL  |         | (top of vtx) * 2  |
	#    +---------+---------+---------+---------+
	#    |                   | (btm of vtx) * 2  |
	#    +---------+---------+---------+---------+
	#---------------------------------------------------------------------
caseLXRej_G_CULLDL:	lhu	gfx0, RSP_SUBMOD_POINTS(gfx0)
			lhu	gfx1, RSP_SUBMOD_POINTS(gfx1)
	                _liu	(sys1, 0x7fff)
LXRejCullDL_Loop:	lhu	sys0, oRSP_POINT_YS(gfx0)
			bne	sys0, sys1, GfxDone	# YS!=0x7fff なら終了
			nop
			bne	gfx0, gfx1, LXRejCullDL_Loop
			addiu	gfx0, gfx0, 20
			j	case_G_ENDDL
		
	#---------------------------------------------------------------------
	#  caseLXRej_G_BRANCH_Z
	#	Z の値に応じて BRANCH を行なう
	#
	#   31        24        16         8         0
	#    +---------+---------+---------+---------+
	#    |RDPHALF  |                             |
	#    +---------+---------+---------+---------+
	#    |             branch addrs              |
	#    +---------+---------+---------+---------+
	#    |BRANCH_Z |    vtx*5     |0000|  vtx*2  |
	#    +---------+---------+---------+---------+
	#    |                Z Value                |
	#    +---------+---------+---------+---------+
	#---------------------------------------------------------------------
caseLXRej_G_BRANCH_Z:	
  FixedAssign(param,    2)
		lhu	gfx0,  RSP_SUBMOD_POINTS(gfx0)
		lw	gfx0,  oRSP_POINT_ZS(gfx0)	# Zscreen 値の取得
		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)
		
	#---------------------------------------------------------------------
	#  caseLXRej_G_MODIFYVTX
	#	頂点キャッシュの内部データを直接書換える
	#
	#	offset:	G_MWO_POINT_RGBA        0x10
	#		G_MWO_POINT_ST          0x14
	#		G_MWO_POINT_XYSCREEN    0x18
	#		G_MWO_POINT_ZSCREEN     0x1c
	#
	#   31        24        16         8         0
	#    +---------+---------+---------+---------+
	#    |MODIFYVTX|  offset |  (vtx id) * 2     |
	#    +---------+---------+---------+---------+
	#    |             d  a  t  a                |
	#    +---------+---------+---------+---------+
	#---------------------------------------------------------------------
caseLXRej_G_MODIFYVTX:
  FixedAssign(adrs, 1)
		lbu	adrs, RSP_DLINPUT_BOTTOM-7(dinp)  # Delay $2 は使用不可
		lhu	gfx0, RSP_SUBMOD_POINTS(gfx0)
		j	case_G_MOVEWORD_0
		addi	adrs, adrs, -0x10
  EndAssign(adrs,  1)

/*======== End of gximm_lxrej.s ========*/