graphic.c
1.96 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
/*============================================================================
NuSYSTEM サンプルプログラム「SNAKE TAIL HACK」
graphic.c
Copyright (C) 1997, NINTENDO Co,Ltd.
============================================================================*/
#include <nusys.h>
#include "graphic.h"
#include "para.h"
Gfx gfx_glist[GFX_GTASK_NUM][GFX_GLIST_LEN];
Dynamic gfx_dynamic[GFX_GTASK_NUM];
Gfx* glistp;
u32 gfx_gtask_no = 0;
/*----------------------------------------------------------------------------
gfxRCPIinit
RCPの初期化
----------------------------------------------------------------------------*/
void
gfxRCPInit(void)
{
/* RSPセグメントレジスタの設定 */
gSPSegment(glistp++, 0, 0x0); /* CPU仮想アドレス用 */
/* RSPの設定 */
gSPDisplayList(glistp++, OS_K0_TO_PHYSICAL(setup_rspstate));
/* RDPの設定 */
gSPDisplayList(glistp++, OS_K0_TO_PHYSICAL(setup_rdpstate));
}
/*----------------------------------------------------------------------------
gfxClearCfb
フレームバッファ/Zバッファのクリア
----------------------------------------------------------------------------*/
void
gfxClearCfb(void)
{
/* Zバッファのクリア */
gDPSetDepthImage(glistp++, OS_K0_TO_PHYSICAL(nuGfxZBuffer));
gDPPipeSync(glistp++);
gDPSetCycleType(glistp++, G_CYC_FILL);
gDPSetColorImage(glistp++, G_IM_FMT_RGBA, G_IM_SIZ_16b,SCREEN_WD,
OS_K0_TO_PHYSICAL(nuGfxZBuffer));
gDPSetFillColor(glistp++,(GPACK_ZDZ(G_MAXFBZ,0) << 16 |
GPACK_ZDZ(G_MAXFBZ,0)));
gDPFillRectangle(glistp++, 0, 0, SCREEN_WD-1, SCREEN_HT-1);
gDPPipeSync(glistp++);
/* フレームバッファのクリア */
gDPSetColorImage(glistp++, G_IM_FMT_RGBA, G_IM_SIZ_16b, SCREEN_WD,
osVirtualToPhysical(nuGfxCfb_ptr));
gDPSetFillColor(glistp++, (GPACK_RGBA5551(0, 0, 0, 1) << 16 |
GPACK_RGBA5551(0, 0, 0, 1)));
gDPFillRectangle(glistp++, 0, 0, SCREEN_WD-1, SCREEN_HT-1);
gDPPipeSync(glistp++);
}