		opt		l.,c+,m-,at-

		include	..\spec_psx\gtereg.h

GPBASE		equs	"gp_start_address"
		include	..\spec_psx\macros.inc

		xref	gp_start_address

DEBUG			equ 	0
W2V_SHIFT		equ		12
OTSIZE			equ		2564
OTRIGHT 		equ 	1
;SUBDIVIDE_Z 	equ 	4096
;SUBDIVIDE_Z2	equ 	(2*SUBDIVIDE_Z)/3
SUBDIVIDE_Z		equ		5000
SUBDIVIDE_Z2	equ		2500
;SUBDIVIDE_Z		equ		3072
;SUBDIVIDE_Z2	equ 	1024
;SUBDIVIDE_Z3	equ		256
NEAR_CLIP		equ 	512
SHADE_SHIFT 	equ 	5
DPQ_LENGTH		equ 	256<<SHADE_SHIFT
DPQ_END 		equ 	20*1024
DPQ_START		equ 	DPQ_END-DPQ_LENGTH
WALL_L			equ 	1024
SUB_FLAG_BITS	equ 	$7fc5e000
;SUB_FLAG_BITS	equ 	$7fc7e000
WIBBLE_SIZE 	equ 	64
WIBBLE_MASK		equ		$3f
MIPMAP_START	equ		8*1024
POLYPTR_CLAMP	equ		2200*13
PSX_OBJ_BIAS	equ 	0				; actually I bias rooms + in z, rather than objects - in z...
ROOM_OT_BIAS	equ		(OTSIZE-2562)	; 2562 is orig. OT size (2560+1+1)...  extra is for room/object sorting bias

				rsreset
tag 			rw		1
rgb0c			rw		1
xy0 			rw		1
uv0clut			rw		1
rgb1			rw		1
xy1 			rw		1
uv1tpg			rw		1
rgb2			rw		1
xy2 			rw		1
uv2 			rw		1
gt3_sz			rb		0
rgb3			rw		1		;
xy3 			rw		1		; GT4 only
uv3 			rw		1		;
gt4_sz			rb		0

				rsreset
M_00			rw 1	;0
M_01			rw 1	;4
M_02			rw 1	;8
M_03			rw 1	;12
M_10			rw 1	;16
M_11			rw 1	;20
M_12			rw 1	;24
M_13			rw 1	;28
M_20			rw 1	;32
M_21			rw 1	;36
M_22			rw 1	;40
M_23			rw 1	;44
M_SIZE			rb 0	;48

				rsreset
db_current_buffer rw	1
db_ot			rw	1
db_polyptr		rw	1
db_curpolybuf	rw	1
db_polybuf_limit rw	1
db_nOTSize		rw	1
db_nPBSize		rw	1
db_order_table	rw	2
db_poly_buffer	rw	2
db_draw			rb	2*92
db_disp			rb	2*20
db_size			rb	0

sc		macros
		\0		\1,\2(scratch)

gte_rtps		macros
		cop2	$180001

gte_rtpt		macros
		cop2	$280030

gte_nclip		macros
		cop2	$1400006

gte_avsz3		macros
		cop2	$158002d

gte_avsz4		macros
		cop2	$168002e

gte_dpcs		macros
		cop2	$780010

gte_dpct		macros
		cop2	$f8002a

		section .text
