Skip to content

Commit

Permalink
implement 16 bit r/w IF and DISPCAPCNT (#2061)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaklyy authored Aug 1, 2024
1 parent 327ce45 commit 29c67f2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/GPU2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,14 @@ void Unit::Write16(u32 addr, u16 val)
if (!Num) GPU.GPU3D.SetRenderXPos(val);
break;

case 0x064:
CaptureCnt = (CaptureCnt & 0xFFFF0000) | (val & 0xEF3F1F1F);
return;

case 0x066:
CaptureCnt = (CaptureCnt & 0xFFFF) | ((val << 16) & 0xEF3F1F1F);
return;

case 0x068:
DispFIFO[DispFIFOWritePtr] = val;
return;
Expand Down
7 changes: 7 additions & 0 deletions src/NDS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2946,6 +2946,8 @@ u16 NDS::ARM9IORead16(u32 addr)
case 0x04000208: return IME[0];
case 0x04000210: return IE[0] & 0xFFFF;
case 0x04000212: return IE[0] >> 16;
case 0x04000214: return IF[0] & 0xFFFF;
case 0x04000216: return IF[0] >> 16;

case 0x04000240: return GPU.VRAMCNT[0] | (GPU.VRAMCNT[1] << 8);
case 0x04000242: return GPU.VRAMCNT[2] | (GPU.VRAMCNT[3] << 8);
Expand Down Expand Up @@ -3257,6 +3259,9 @@ void NDS::ARM9IOWrite16(u32 addr, u16 val)

case 0x04000060: GPU.GPU3D.Write16(addr, val); return;

case 0x04000064:
case 0x04000066: GPU.GPU2D_A.Write16(addr, val); return;

case 0x04000068:
case 0x0400006A: GPU.GPU2D_A.Write16(addr, val); return;

Expand Down Expand Up @@ -3385,6 +3390,8 @@ void NDS::ARM9IOWrite16(u32 addr, u16 val)
case 0x04000210: IE[0] = (IE[0] & 0xFFFF0000) | val; UpdateIRQ(0); return;
case 0x04000212: IE[0] = (IE[0] & 0x0000FFFF) | (val << 16); UpdateIRQ(0); return;
// TODO: what happens when writing to IF this way??
case 0x04000214: IF[0] &= ~val; GPU.GPU3D.CheckFIFOIRQ(); UpdateIRQ(0); return;
case 0x04000216: IF[0] &= ~(val<<16); GPU.GPU3D.CheckFIFOIRQ(); UpdateIRQ(0); return;

case 0x04000240:
GPU.MapVRAM_AB(0, val & 0xFF);
Expand Down

0 comments on commit 29c67f2

Please sign in to comment.