gtxtr4b.s
3.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/*---------------------------------------------------------------------
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 ========*/