add some more GPU IO

This commit is contained in:
StapleButter 2017-07-23 15:31:09 +02:00
parent f869975a51
commit e6f5507c9e
3 changed files with 38 additions and 3 deletions

View File

@ -105,6 +105,11 @@ void GPU2D::Reset()
memset(Win1Coords, 0, 4); memset(Win1Coords, 0, 4);
memset(WinCnt, 0, 4); memset(WinCnt, 0, 4);
BGMosaicSize[0] = 0;
BGMosaicSize[1] = 0;
OBJMosaicSize[0] = 0;
OBJMosaicSize[1] = 0;
BlendCnt = 0; BlendCnt = 0;
EVA = 16; EVA = 16;
EVB = 0; EVB = 0;
@ -238,6 +243,15 @@ void GPU2D::Write8(u32 addr, u8 val)
case 0x04A: WinCnt[2] = val; return; case 0x04A: WinCnt[2] = val; return;
case 0x04B: WinCnt[3] = val; return; case 0x04B: WinCnt[3] = val; return;
case 0x04C:
BGMosaicSize[0] = val & 0xF;
BGMosaicSize[1] = val >> 4;
return;
case 0x04D:
OBJMosaicSize[0] = val & 0xF;
OBJMosaicSize[1] = val >> 4;
return;
case 0x050: BlendCnt = (BlendCnt & 0x3F00) | val; return; case 0x050: BlendCnt = (BlendCnt & 0x3F00) | val; return;
case 0x051: BlendCnt = (BlendCnt & 0x00FF) | (val << 8); return; case 0x051: BlendCnt = (BlendCnt & 0x00FF) | (val << 8); return;
case 0x052: case 0x052:
@ -245,7 +259,7 @@ void GPU2D::Write8(u32 addr, u8 val)
EVA = val & 0x1F; EVA = val & 0x1F;
if (EVA > 16) EVA = 16; if (EVA > 16) EVA = 16;
return; return;
case 0x53: case 0x053:
BlendAlpha = (BlendAlpha & 0x001F) | ((val & 0x1F) << 8); BlendAlpha = (BlendAlpha & 0x001F) | ((val & 0x1F) << 8);
EVB = val & 0x1F; EVB = val & 0x1F;
if (EVB > 16) EVB = 16; if (EVB > 16) EVB = 16;
@ -353,6 +367,13 @@ void GPU2D::Write16(u32 addr, u16 val)
WinCnt[3] = val >> 8; WinCnt[3] = val >> 8;
return; return;
case 0x04C:
BGMosaicSize[0] = val & 0xF;
BGMosaicSize[1] = (val >> 4) & 0xF;
OBJMosaicSize[0] = (val >> 8) & 0xF;
OBJMosaicSize[1] = val >> 12;
return;
case 0x050: BlendCnt = val & 0x3FFF; return; case 0x050: BlendCnt = val & 0x3FFF; return;
case 0x052: case 0x052:
BlendAlpha = val & 0x1F1F; BlendAlpha = val & 0x1F1F;

View File

@ -91,6 +91,9 @@ private:
bool Win0Active; bool Win0Active;
bool Win1Active; bool Win1Active;
u8 BGMosaicSize[2];
u8 OBJMosaicSize[2];
u16 BlendCnt; u16 BlendCnt;
u16 BlendAlpha; u16 BlendAlpha;
u8 EVA, EVB; u8 EVA, EVB;

View File

@ -1638,6 +1638,11 @@ void ARM9IOWrite8(u32 addr, u8 val)
{ {
switch (addr) switch (addr)
{ {
case 0x0400006C:
case 0x0400006D: GPU::GPU2D_A->Write8(addr, val); return;
case 0x0400106C:
case 0x0400106D: GPU::GPU2D_B->Write8(addr, val); return;
case 0x04000132: case 0x04000132:
KeyCnt = (KeyCnt & 0xFF00) | val; KeyCnt = (KeyCnt & 0xFF00) | val;
return; return;
@ -1720,6 +1725,9 @@ void ARM9IOWrite16(u32 addr, u16 val)
case 0x04000068: case 0x04000068:
case 0x0400006A: GPU::GPU2D_A->Write16(addr, val); return; case 0x0400006A: GPU::GPU2D_A->Write16(addr, val); return;
case 0x0400006C: GPU::GPU2D_A->Write16(addr, val); return;
case 0x0400106C: GPU::GPU2D_B->Write16(addr, val); return;
case 0x040000B8: DMAs[0]->WriteCnt((DMAs[0]->Cnt & 0xFFFF0000) | val); return; case 0x040000B8: DMAs[0]->WriteCnt((DMAs[0]->Cnt & 0xFFFF0000) | val); return;
case 0x040000BA: DMAs[0]->WriteCnt((DMAs[0]->Cnt & 0x0000FFFF) | (val << 16)); return; case 0x040000BA: DMAs[0]->WriteCnt((DMAs[0]->Cnt & 0x0000FFFF) | (val << 16)); return;
case 0x040000C4: DMAs[1]->WriteCnt((DMAs[1]->Cnt & 0xFFFF0000) | val); return; case 0x040000C4: DMAs[1]->WriteCnt((DMAs[1]->Cnt & 0xFFFF0000) | val); return;
@ -1847,12 +1855,12 @@ void ARM9IOWrite16(u32 addr, u16 val)
return; return;
} }
if ((addr >= 0x04000000 && addr < 0x04000060) || (addr == 0x0400006C)) if (addr >= 0x04000000 && addr < 0x04000060)
{ {
GPU::GPU2D_A->Write16(addr, val); GPU::GPU2D_A->Write16(addr, val);
return; return;
} }
if ((addr >= 0x04001000 && addr < 0x04001060) || (addr == 0x0400106C)) if (addr >= 0x04001000 && addr < 0x04001060)
{ {
GPU::GPU2D_B->Write16(addr, val); GPU::GPU2D_B->Write16(addr, val);
return; return;
@ -1874,6 +1882,9 @@ void ARM9IOWrite32(u32 addr, u32 val)
case 0x04000064: case 0x04000064:
case 0x04000068: GPU::GPU2D_A->Write32(addr, val); return; case 0x04000068: GPU::GPU2D_A->Write32(addr, val); return;
case 0x0400006C: GPU::GPU2D_A->Write16(addr, val&0xFFFF); return;
case 0x0400106C: GPU::GPU2D_B->Write16(addr, val&0xFFFF); return;
case 0x040000B0: DMAs[0]->SrcAddr = val; return; case 0x040000B0: DMAs[0]->SrcAddr = val; return;
case 0x040000B4: DMAs[0]->DstAddr = val; return; case 0x040000B4: DMAs[0]->DstAddr = val; return;
case 0x040000B8: DMAs[0]->WriteCnt(val); return; case 0x040000B8: DMAs[0]->WriteCnt(val); return;