gzloaduc.s
3.61 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
/*---------------------------------------------------------------------
$Id: gzloaduc.s,v 1.1.1.1 2002/05/02 03:29:12 blythe Exp $
File : gzloaduc.s
Coded by Yoshitaka Yasumoto. Jun 18, 1997.
Copyright by Nintendo, Co., Ltd. 1997.
---------------------------------------------------------------------*/
#----------------------------------------------------------------------------
# マイクロコードの SWITCH 処理 12 insts. 計 27insts.
# SMARTINP で +2 insts.
# DMA2BUF/DMANOWAIT で +3 insts.
# DMANOWAIT2 で +6 insts.
# RDPHALF のコピー で +1 inst.
#
# +--------------+------------+------------+------------+
# |G_RDPHALF_1 | |
# +--------------+------------+------------+------------+
# | Pointer for ucode (Data section) |
# +--------------+------------+------------+------------+
# |G_SWITCH_UCODE| | (ucode_data size)-1 |
# +--------------+------------+------------+------------+
# | Pointer for ucode (Text section) |
# +--------------+------------+------------+------------+
#----------------------------------------------------------------------------
#define dlcount $28 /* F3DEX と共通 */
case_G_LOAD_UCODE:
#---------------------------------------------------------------------
# (1) SMARTINP と処理を共通にするために dlcount に 0 を代入する
# (2) F3DEX 系コマンドと位置を合わせるために RSP_STATEP_RDPHALF_1L
# の値を 0x010c 番地にコピーする
# (3) RDPCMD バッファにデータが残っていたらフラッシュする.
#---------------------------------------------------------------------
lw $19, RSP_STATEP_RDPHALF_1L(zero) # Data Section
addi dlcount, zero, 0
jal OutputCloseFlush
sw $19, 0x010c(zero)
lw gfx1, (RSP_DLINPUT_BOTTOM+4)(dinp)
lw gfx0, (RSP_DLINPUT_BOTTOM+0)(dinp)
#---------------------------------------------------------------------
# これ以降 全マイクロコード 共通のコードとなるのでいじらないこと
#---------------------------------------------------------------------
addi $19, gfx1, 0 # Text Section
sw gfx1, (RSP_TASK_OFFSET+OS_TASK_OFF_UCODE)(zero)
# Ucode の保存
# SMARTINP
add inp, inp, dinp
sub inp, inp, dlcount
sw inp, (RSP_TASK_OFFSET+OS_TASK_OFF_DATA)(zero)
addi $20, zero, TASKBASELO # Load into IMEM
jal DMAread
addi $18, zero, (0x1000-0x0080-26*4-1) # gloaduc
# RSP_STATEP_RDPHALF データは 0x010c 番地になければならない
# lw $19, RSP_STATEP_RDPHALF(zero) # Data Section
lw $19, 0x010c(zero) # Data Section
addi $20, zero, 0x0000 # Load into DMEM
jal DMAread
andi $18, gfx0, 0xffff # Get length
addi $1, zero, RSP_TASK_OFFSET # Set taskp
addi return, zero, TASKBASELO # Wiat DMA & Jump to ucode top
#undef dlcount /* F3DEX と共通 */
#----------------------------------------------------------------------------
# DMA 待ち 4 insts.
#----------------------------------------------------------------------------
DMAwait: mfc0 sys0, DMA_BUSY
DMAwait1: bne sys0, zero, DMAwait1
mfc0 sys0, DMA_BUSY
ReturnToR31: jr return
#----------------------------------------------------------------------------
# DMA 処理 11 insts.
#----------------------------------------------------------------------------
AssignForDMAproc
DMAread: add iswrite, zero, zero
DMAproc: mfc0 sys0, DMA_FULL
bne sys0, zero, DMAproc
nop
# set DMA registers:
mtc0 dmem_adrs, DMA_CACHE
# handle writes:
bgtz iswrite, DMAWrite
mtc0 dram_adrs, DMA_DRAM
jr return
mtc0 dma_len, DMA_READ_LENGTH
DMAWrite: jr return
mtc0 dma_len, DMA_WRITE_LENGTH
EndAssignForDMAproc
/*======== End of gzloaduc.s ========*/