trdp.s
3.29 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/**************************************************************************
* *
* Copyright (C) 1994, Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
*************************************************************************/
/*
* File: grdp.s
* Creator: hsa@sgi.com
* Create Date: Fri Jun 24 13:54:26 PDT 1994
*
* This file holds the top-level of the RDP command processing, and
* related routines.
*
*/
############################################################################
#
# The following code processes the RDP type display list commands.
# Registers on input:
# gfx0 - first word of display list command
# gfx1 - second word of display list command
#
# RDP command processing is a little different, we only check the
# command to identify it as having an address to patch up. We don't
# need a switch table with an entry for each command...
#
#
# NOTE: We need to detect the FULLSYNC (and other sync?) command
# and then spin until some bit in cp0 (?) tells us the RDP pipeline
# has drained (about 40 clocks?). Otherwise a race condition is
# possible when we write the next output...
#
.name mask, $2
.name addr, $19
.name temp, $8
.ent doRDP
doRDP:
#ifdef LINE3D
# check to see if we have a scissor command
# shift down the command word
srl mask, gfx0, 24
# now compare against scissor command
ori temp, zero, G_SETSCISSOR
bne temp, mask, notScissor
# we have a scissor command
#store YH
andi temp, gfx0, 0xfff
sh temp, RSP_STATE_SCISSOR_YH(rsp_state)
# store XH
srl temp, gfx0, 12
andi temp, temp, 0xfff
sh temp, RSP_STATE_SCISSOR_XH(rsp_state)
#store YL
andi temp, gfx1, 0xfff
sh temp, RSP_STATE_SCISSOR_YL(rsp_state)
# store XL
srl temp, gfx1, 12
andi temp, temp, 0xfff
sh temp, RSP_STATE_SCISSOR_XL(rsp_state)
notScissor:
#endif
# identify RDP command as having an address or not...
sra mask, gfx0, 24
addi mask, mask, G_RDP_ADDR_FIXUP
bltz mask, doRDPSend
addi mask, mask, (G_RDP_TEXRECT_CHECK-G_RDP_ADDR_FIXUP)
### BRANCH OCCURS to doRDPSend: if no address in command
#
# RDP command has an address to patch...
#
jal AddrFixup
add addr, gfx1, zero # delay slot
add gfx1, addr, zero
#
# if RDP command doesn't have an addr, copy it verbatim.
#
.name outsz, $18 # used in OutputOpen
doRDPSend:
jal OutputOpen #
addi outsz, zero, 8 # delay slot
#
sw gfx0, 0(outp) #
sw gfx1, 4(outp) #
#
jal OutputClose #
addi outp, outp, 8 # delay slot
#
bgtz mask, GfxDone # most commands return normally
nop #
j noYield # Textured Rectangle commands
# do not allow a yield to occur
# before the second half of the
# command is sent
#NOTE! delay slot is in gdma.s
.end doRDP
.unname outsz
.unname mask
.unname addr
.unname temp
#
#
#
############################################################################