some more addresses added (about 3D engine)

This commit is contained in:
damdoum 2007-02-22 18:41:29 +00:00
parent e6df29675b
commit e428ef71fc
4 changed files with 155 additions and 166 deletions

View File

@ -1853,189 +1853,86 @@ void FASTCALL MMU_write32(u32 proc, u32 adr, u32 val)
{
switch(adr)
{
#ifdef RENDER3D
case 0x04000350 :
if(proc == ARMCPU_ARM9)
{
OGLRender::glClearColor(val);
}
case cmd_3D_MTX_MODE /* 0x04000440 */ :
if (proc == ARMCPU_ARM9) gl_MTX_MODE(val);
return;
case 0x04000400 :
if(proc==ARMCPU_ARM9)
{
OGLRender::glCallList(val);
}
case cmd_3D_MTX_PUSH /* 0x04000444 */ :
case cmd_3D_MTX_POP /* 0x04000448 */ :
case cmd_3D_MTX_STORE /* 0x0400044C */ :
case cmd_3D_MTX_RESTORE /* 0x04000450 */ :
if (proc == ARMCPU_ARM9) gl_print_cmd(adr);
return;
case 0x04000440 :
if(proc == ARMCPU_ARM9)
{
OGLRender::glMatrixMode(val);
}
case cmd_3D_MTX_IDENTITY /* 0x04000454 */ :
if (proc == ARMCPU_ARM9) gl_MTX_IDENTITY();
return;
case 0x04000444 :
if(proc == ARMCPU_ARM9)
{
OGLRender::glPushMatrix();
}
case cmd_3D_MTX_LOAD_4x4 /* 0x04000458 */ :
if (proc == ARMCPU_ARM9) gl_MTX_LOAD_4x4(val);
return;
case 0x04000448 :
if(proc == ARMCPU_ARM9)
{
OGLRender::glPopMatrix(val);
}
case cmd_3D_MTX_LOAD_4x3 /* 0x0400045C */ :
if (proc == ARMCPU_ARM9) gl_MTX_LOAD_4x3(val);
return;
case 0x0400044C :
if(proc == ARMCPU_ARM9)
{
OGLRender::glStoreMatrix(val);
}
case cmd_3D_MTX_MULT_4x4 /* 0x04000460 */ :
if (proc == ARMCPU_ARM9) gl_MTX_MULT_4x4(val);
return;
case 0x04000450 :
if(proc == ARMCPU_ARM9)
{
OGLRender::glRestore();
}
case cmd_3D_MTX_MULT_4x3 /* 0x04000464 */ :
if (proc == ARMCPU_ARM9) gl_MTX_MULT_4x3(val);
return;
case 0x04000454 :
if(proc == ARMCPU_ARM9)
{
OGLRender::glLoadIdentity();
}
case cmd_3D_MTX_MULT_3x3 /* 0x04000468 */ :
if (proc == ARMCPU_ARM9) gl_MTX_MULT_3x3(val);
return;
case 0x04000458 :
if(proc == ARMCPU_ARM9)
{
OGLRender::ML4x4ajouter(val);
}
case cmd_3D_MTX_SCALE /* 0x0400046C */ :
case cmd_3D_MTX_TRANS /* 0x04000470 */ :
case cmd_3D_COLOR /* 0x04000480 */ :
case cmd_3D_NORMA /* 0x04000484 */ :
if (proc == ARMCPU_ARM9) gl_print_cmd(adr);
return;
case 0x0400045C :
if(proc == ARMCPU_ARM9)
{
OGLRender::ML4x3ajouter(val);
}
case cmd_3D_TEXCOORD /* 0x04000488 */ :
if (proc == ARMCPU_ARM9) gl_TEXCOORD(val);
return;
case 0x04000460 :
if(proc == ARMCPU_ARM9)
{
OGLRender::glMultMatrix4x4(val);
}
case cmd_3D_VTX_16 /* 0x0400048C */ :
if (proc == ARMCPU_ARM9) gl_VTX_16(val);
return;
case 0x04000464 :
if(proc == ARMCPU_ARM9)
{
OGLRender::glMultMatrix4x3(val);
}
case cmd_3D_VTX_10 /* 0x04000490 */ :
if (proc == ARMCPU_ARM9) gl_VTX_10(val);
return;
case 0x04000468 :
if(proc == ARMCPU_ARM9)
{
OGLRender::glMultMatrix3x3(val);
}
case cmd_3D_VTX_XY /* 0x04000494 */ :
if (proc == ARMCPU_ARM9) gl_VTX_XY(val);
return;
case 0x0400046C :
if(proc==ARMCPU_ARM9)
{
OGLRender::glScale(val);
}
case cmd_3D_VTX_XZ /* 0x04000498 */ :
if (proc == ARMCPU_ARM9) gl_VTX_XZ(val);
return;
case 0x04000470 :
if(proc == ARMCPU_ARM9)
{
OGLRender::addTrans(val);
}
case cmd_3D_VTX_YZ /* 0x0400049C */ :
if (proc == ARMCPU_ARM9) gl_VTX_YZ(val);
return;
case 0x04000480 :
if(proc == ARMCPU_ARM9)
{
OGLRender::glColor3b(val);
}
case cmd_3D_VTX_DIFF /* 0x040004A0 */ :
if (proc == ARMCPU_ARM9) gl_VTX_DIFF(val);
return;
case 0x04000488 :
if(proc==ARMCPU_ARM9)
{
OGLRender::glTexCoord(val);
//execute = FALSE;
}
case cmd_3D_POLYGON_ATTR /* 0x040004A4 */ :
case cmd_3D_TEXIMAGE_PARAM /* 0x040004A8 */ :
case cmd_3D_PLTT_BASE /* 0x040004AC */ :
case cmd_3D_DIF_AMB /* 0x040004C0 */ :
case cmd_3D_SPE_EMI /* 0x040004C4 */ :
case cmd_3D_LIGHT_VECTOR /* 0x040004C8 */ :
case cmd_3D_LIGHT_COLOR /* 0x040004CC */ :
case cmd_3D_SHININESS /* 0x040004D0 */ :
if (proc == ARMCPU_ARM9) gl_print_cmd(adr);
return;
#endif
case 0x0400048C :
if(proc == ARMCPU_ARM9) {
//OGLRender::glVertex3(val);
}
case cmd_3D_BEGIN_VTXS /* 0x04000500 */ :
if (proc == ARMCPU_ARM9) gl_VTX_begin(val);
return;
case 0x04000490 :
if(proc==ARMCPU_ARM9) {
//GPULOG("VERTEX 10 %d\r\n",val);
gl_VTX_10(val);
}
case cmd_3D_END_VTXS /* 0x04000504 */ :
if (proc == ARMCPU_ARM9) gl_VTX_end();
return;
case 0x04000494 :
if(proc==ARMCPU_ARM9) {
//GPULOG(printf(txt, "VERTEXY %d\r\n",val);
gl_VTX_XY(val);
}
case cmd_3D_SWAP_BUFFERS /* 0x04000540 */ :
case cmd_3D_VIEWPORT /* 0x04000580 */ :
case cmd_3D_BOX_TEST /* 0x040005C0 */ :
case cmd_3D_POS_TEST /* 0x040005C4 */ :
case cmd_3D_VEC_TEST /* 0x040005C8 */ :
if (proc == ARMCPU_ARM9) gl_print_cmd(adr);
return;
case 0x04000498 :
if(proc==ARMCPU_ARM9) {
//GPULOG("VERTEXZ %d\r\n",val);
gl_VTX_XZ(val);
}
return;
case 0x0400049C :
if(proc==ARMCPU_ARM9) {
//GPULOG("VERTEYZ %d\r\n",val);
gl_VTX_YZ(val);
}
return;
case 0x040004A0 :
if(proc==ARMCPU_ARM9) {
gl_VTX_DIFF(val);
}
return;
#ifdef RENDER3D
case 0x040004A8 :
if(proc==ARMCPU_ARM9)
{
OGLRender::glTexImage2D(val, FALSE);
//execute = FALSE;
testval = val;
}
return;
case 0x040004AC :
T1WriteLong(MMU.MMU_MEM[proc][0x40], 0x4AC, val);
if(proc==ARMCPU_ARM9)
OGLRender::glTexImage2D(testval, TRUE);
//execute = FALSE;
return;
#endif
case 0x04000500 :
if(proc == ARMCPU_ARM9)
{
// OGLRender::glBegin(val);
gl_VTX_begin(val);
}
return;
case 0x04000504 :
if(proc == ARMCPU_ARM9)
{
// OGLRender::glEnd();
gl_VTX_end();
}
return;
#ifdef RENDER3D
case 0x04000540 :
if(proc == ARMCPU_ARM9)
{
OGLRender::glFlush();
}
return;
case 0x04000580 :
if(proc == ARMCPU_ARM9)
{
OGLRender::glViewPort(val);
}
return;
#endif
case REG_DISPA_BG2PA :
if (proc == ARMCPU_ARM9) GPU_setPAPB(MainScreen.gpu, 2, val);
return;

View File

@ -62,9 +62,9 @@ Table shows Port Address, Command ID, Number of Parameters, and Clock Cycles.
*/
#define print(a) printf a
//#define print(a)
//#define print(a) printf a
#define print(a)
int mtx_mode=0;

View File

@ -23,6 +23,7 @@
#include <stdio.h>
#include "types.h"
#include "registers.h"
#define MTX_MODE_PROJECTION 0
#define MTX_MODE_POSITION 1
@ -56,11 +57,14 @@ typedef union {
} bits;
} _VTX_10 ;
void gl_MTX_MODE (u32 val);
void gl_MTX_IDENTITY ();
void gl_MTX_LOAD_4x4 (u32 val);
void gl_MTX_LOAD_4x3 (u32 val);
void gl_MTX_LOAD_3x3 (u32 val);
void gl_MTX_MULT_4x4 (u32 val);
void gl_MTX_MULT_4x3 (u32 val);
void gl_MTX_MULT_3x3 (u32 val);
void gl_TEXCOORD(u32 val);
@ -83,3 +87,70 @@ void gl_VTX_YZ (u32 yz);
void gl_VTX_DIFF (u32 diff);
//see 40004A0h - Cmd 28h - VTX_DIFF - Set Relative Vertex Coordinates (W)
#define GL_CMD_NAME(n) \
case n : printf("cmd " #n "\n"); break;
INLINE static void gl_print_cmd(u32 adr) {
switch (adr) {
GL_CMD_NAME(eng_3D_RDLINES_COUNT )
GL_CMD_NAME(eng_3D_EDGE_COLOR )
GL_CMD_NAME(eng_3D_ALPHA_TEST_REF )
GL_CMD_NAME(eng_3D_CLEAR_COLOR )
GL_CMD_NAME(eng_3D_CLEAR_DEPTH )
GL_CMD_NAME(eng_3D_CLRIMAGE_OFFSET )
GL_CMD_NAME(eng_3D_FOG_COLOR )
GL_CMD_NAME(eng_3D_FOG_OFFSET )
GL_CMD_NAME(eng_3D_FOG_TABLE )
GL_CMD_NAME(eng_3D_TOON_TABLE )
GL_CMD_NAME(eng_3D_GXFIFO )
GL_CMD_NAME(cmd_3D_MTX_MODE )
GL_CMD_NAME(cmd_3D_MTX_PUSH )
GL_CMD_NAME(cmd_3D_MTX_POP )
GL_CMD_NAME(cmd_3D_MTX_STORE )
GL_CMD_NAME(cmd_3D_MTX_RESTORE )
GL_CMD_NAME(cmd_3D_MTX_IDENTITY )
GL_CMD_NAME(cmd_3D_MTX_LOAD_4x4 )
GL_CMD_NAME(cmd_3D_MTX_LOAD_4x3 )
GL_CMD_NAME(cmd_3D_MTX_MULT_4x4 )
GL_CMD_NAME(cmd_3D_MTX_MULT_4x3 )
GL_CMD_NAME(cmd_3D_MTX_MULT_3x3 )
GL_CMD_NAME(cmd_3D_MTX_SCALE )
GL_CMD_NAME(cmd_3D_MTX_TRANS )
GL_CMD_NAME(cmd_3D_COLOR )
GL_CMD_NAME(cmd_3D_NORMA )
GL_CMD_NAME(cmd_3D_TEXCOORD )
GL_CMD_NAME(cmd_3D_VTX_16 )
GL_CMD_NAME(cmd_3D_VTX_10 )
GL_CMD_NAME(cmd_3D_VTX_XY )
GL_CMD_NAME(cmd_3D_VTX_XZ )
GL_CMD_NAME(cmd_3D_VTX_YZ )
GL_CMD_NAME(cmd_3D_VTX_DIFF )
GL_CMD_NAME(cmd_3D_POLYGON_ATTR )
GL_CMD_NAME(cmd_3D_TEXIMAGE_PARAM )
GL_CMD_NAME(cmd_3D_PLTT_BASE )
GL_CMD_NAME(cmd_3D_DIF_AMB )
GL_CMD_NAME(cmd_3D_SPE_EMI )
GL_CMD_NAME(cmd_3D_LIGHT_VECTOR )
GL_CMD_NAME(cmd_3D_LIGHT_COLOR )
GL_CMD_NAME(cmd_3D_SHININESS )
GL_CMD_NAME(cmd_3D_BEGIN_VTXS )
GL_CMD_NAME(cmd_3D_END_VTXS )
GL_CMD_NAME(cmd_3D_SWAP_BUFFERS )
GL_CMD_NAME(cmd_3D_VIEWPORT )
GL_CMD_NAME(cmd_3D_BOX_TEST )
GL_CMD_NAME(cmd_3D_POS_TEST )
GL_CMD_NAME(cmd_3D_VEC_TEST )
GL_CMD_NAME(eng_3D_GXSTAT )
GL_CMD_NAME(eng_3D_RAM_COUNT )
GL_CMD_NAME(eng_3D_DISP_1DOT_DEPTH )
GL_CMD_NAME(eng_3D_POS_RESULT )
GL_CMD_NAME(eng_3D_VEC_RESULT )
GL_CMD_NAME(eng_3D_CLIPMTX_RESULT )
GL_CMD_NAME(eng_3D_VECMTX_RESULT )
default: break;
}
}

View File

@ -249,6 +249,18 @@
#define REG_DISPA_DISPMMEMFIFO 0x04000068
#define eng_3D_RDLINES_COUNT 0x04000320
#define eng_3D_EDGE_COLOR 0x04000330
#define eng_3D_ALPHA_TEST_REF 0x04000340
#define eng_3D_CLEAR_COLOR 0x04000350
#define eng_3D_CLEAR_DEPTH 0x04000354
#define eng_3D_CLRIMAGE_OFFSET 0x04000356
#define eng_3D_FOG_COLOR 0x04000358
#define eng_3D_FOG_OFFSET 0x0400035C
#define eng_3D_FOG_TABLE 0x04000360
#define eng_3D_TOON_TABLE 0x04000380
#define eng_3D_GXFIFO 0x04000400
// 3d commands
#define cmd_3D_MTX_MODE 0x04000440
#define cmd_3D_MTX_PUSH 0x04000444
@ -288,4 +300,13 @@
#define cmd_3D_POS_TEST 0x040005C4
#define cmd_3D_VEC_TEST 0x040005C8
#define eng_3D_GXSTAT 0x04000600
#define eng_3D_RAM_COUNT 0x04000604
#define eng_3D_DISP_1DOT_DEPTH 0x04000610
#define eng_3D_POS_RESULT 0x04000620
#define eng_3D_VEC_RESULT 0x04000630
#define eng_3D_CLIPMTX_RESULT 0x04000640
#define eng_3D_VECMTX_RESULT 0x04000680
#endif