gtxtr4b.s 3.67 KB
/*---------------------------------------------------------------------
	Copyright (C) 1997, Nintendo.
	
	File		gtxtr4b.s
	Coded    by	Yoshitaka Yasumoto.	Aug 26, 1997.
	Modified by	
	Comments	makes gDPLoadTextureBlock_4b shorten.
	
	$Id: gtxtr4b.s,v 1.1.1.1 2002/05/02 03:29:11 blythe Exp $
  ---------------------------------------------------------------------*/
#if 0
#define gDPLoadTextureBlock_4b(pkt, timg, fmt, width, height,           \
                pal, cms, cmt, masks, maskt, shifts, shiftt)            \
{                                                                       \
        gDPSetTextureImage(pkt, fmt, G_IM_SIZ_16b, 1, timg);            \
        gDPSetTile(pkt, fmt, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, 0,      \
                cmt, maskt, shiftt, cms, masks, shifts);                \
        gDPLoadSync(pkt);                                               \
        gDPLoadBlock(pkt, G_TX_LOADTILE, 0, 0,                          \
                (((width)*(height)+3)>>2)-1,                            \
                CALC_DXT_4b(width));                                    \
        gDPPipeSync(pkt);                                               \
        gDPSetTile(pkt, fmt, G_IM_SIZ_4b, ((((width)>>1)+7)>>3), 0,     \
                G_TX_RENDERTILE, pal, cmt, maskt, shiftt, cms, masks,   \
                shifts);                                                \
        gDPSetTileSize(pkt, G_TX_RENDERTILE, 0, 0,                      \
                ((width)-1) << G_TEXTURE_IMAGE_FRAC,                    \
                ((height)-1) << G_TEXTURE_IMAGE_FRAC)                   \
}

	# S2DEX での設定
	gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, image)
	gsDPSetTile(G_IM_FMT_RGBA, G_IM_SIZ_16b, 0, 0,
			G_LOAD_TILE, 0,0,0,0,0,0,0)	
        gsDPLoadSync()
	gsDPLoadBlock(G_TX_LOADTILE, 0, 0, 
                (((width)*(height)+3)>>2)-1,
                CALC_DXT_4b(width))
        gsDPPipeSync()
        gsDPSetTile(pkt, G_IM_FMT_CI, G_IM_SIZ_4b, ((((width)>>1)+7)>>3), 0,
                G_TX_RENDERTILE, pal, cmt, maskt, shiftt, cms, masks, shifts)
        gDPSetTileSize(pkt, G_TX_RENDERTILE, 0, 0,
                ((width)-1) << G_TEXTURE_IMAGE_FRAC,
                ((height)-1) << G_TEXTURE_IMAGE_FRAC)
#endif
 #------------------------------------------------------------------
 #  gDPLoadTextureBlock_4b を 16bytes で処理する.
 #
 #    +--------------+------------+------------+------------+
 #    |G_TXTRBLK_4b_1|           Load Block parameter       |
 #    +----------+---+------------+------------+------------+
 #    |              Texture Image DRAM address             |
 #    +----------+---+------------+------------+------------+
 #    |G_TXTRBLK_4b_2|            Tile parameter            |
 #    +--------------+------------+-----+------+------------+
 #    |(Width+15)>>4 |   (Width-1)<<2   |  (Height-1)<<2    |
 #    +--------------+------------+-----+------+------------+
 #
 #------------------------------------------------------------------
case_G_TXTRBLK_4b_1:
	jal	AddrFixup
	add	$19, gfx1, zero
	sw	$19, 4(outp)
	lui	$19, 0x3d10
	sw	$19, 0(outp)
	lui	$19, 0x3510
	sw	$19, 8(outp)
	lui	$19, 0x0700
	sw	$19, 12(outp)
	ori	$19, zero, 0x2627
	sh	$19, 16(outp)
	sb	$19, 32(outp)
	sw	gfx0,28(outp)
	sb	$19, 28(outp)
	lui	$19, 0x3300
	sw	$19, 24(outp)
	addiu	outp, outp, 40
case_G_TXTRBLK_4b_Ret:	
	j	OutputClose

case_G_TXTRBLK_4b_2:
	lhu	return, GFXDONE(zero)	# 1,2 の両方で使用する
	lui	$19,   0x3200
	sw	$19,   8(outp)
	sw	gfx1, 12(outp)
	sb	zero, 12(outp)
	sw	gfx0,  4(outp)
	sb	zero,  4(outp)
	lui	$19,   0x3540
	srl	gfx1,  gfx1, 24
	sll	gfx1,  gfx1, 9
	or	$19,   $19, gfx1
	sw	$19,   0(outp)
	j	OutputClose
	addiu	outp,  outp, 16
	
/*======== End of gtxtr4b.s ========*/