gdone.s
2.11 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
##########################################################################
#
# This code includes yield and taskdone code
#
##########################################################################
#ifdef FASTLIGHT3D
#include <rsp.h>
#include "mbi.h"
.text startClip
#include "gdmem.h"
#include "gfx_regs.h"
#endif /* FASTLIGHT3D */
######################################################################
######################################################################
#
# JUMP TO YIELD (MUST BE EXACTLY 2 INSTRUCTIONS)
#
#ifdef FASTLIGHT3D
j RSPYieldOver
nop
#endif /* FASTLIGHT3D */
######################################################################
######################################################################
#
# TASKDONE
#
.name dramp, $19
.name dmemp, $20
.name dmasz, $18
.name iswrite, $17
#ifndef FASTLIGHT3D
TaskDone: # all done, return to executive:
#endif /* FASTLIGHT3D */
#
# If we sent output to the DRAM, update the counter
# in DRAM
#
#ifdef OUTPUT_DRAM
# lw dramp, RSP_STATE_DRAM_OUTP(rsp_state)
# beq dramp, zero, TaskHalt
addi dmemp, rsp_state, RSP_STATE_DRAM_OUT_LEN
lw dramp, RSP_STATE_DRAM_OUT_LENP(rsp_state)
addi iswrite, zero, 1
jal DMAproc
addi dmasz, zero, 7 # delay slot
#else
#ifdef DMANOWAIT2
addi $6, outp, -(RSP_OUTPUT_OFFSET+1)
bgezal $6, OutputCloseFlush
nop
jal DMAwait
lw $21, RSP_STATE_FIFO_OUTP(rsp_state)
mtc0 $21, CMD_END
#else
nop
#endif
#endif
.unname dramp
.unname dmemp
.unname dmasz
.unname iswrite
.name yield, $2
TaskHalt:
jal DMAwait
ori yield, zero, SP_SET_TASKDONE # delay slot
mtc0 yield, SP_STATUS # DONE, not a BP
break # tell cpu we are done
nop # and HALT
.unname yield
######################################################################
######################################################################
#
# YIELD
#
#ifdef FASTLIGHT3D
#define YIELD_STOP
#include "gyield.s"
#undef YIELD_STOP
nop
nop
#endif /* FASTLIGHT3D */
#ifndef _HW_VERSION_1
# just to show that we're using HW2 code...
# THIS WILL BE DELETED!
addiu $0, $0, 0xbeef
#endif