BG scroll. also fix silly bug.
This commit is contained in:
parent
7dba0121cb
commit
711375c0be
20
GPU2D.cpp
20
GPU2D.cpp
|
@ -35,6 +35,8 @@ void GPU2D::Reset()
|
|||
{
|
||||
DispCnt = 0;
|
||||
memset(BGCnt, 0, 4*2);
|
||||
memset(BGXPos, 0, 4*2);
|
||||
memset(BGYPos, 0, 4*2);
|
||||
}
|
||||
|
||||
void GPU2D::SetFramebuffer(u16* buf)
|
||||
|
@ -100,6 +102,15 @@ void GPU2D::Write16(u32 addr, u16 val)
|
|||
case 0x00A: BGCnt[1] = val; return;
|
||||
case 0x00C: BGCnt[2] = val; return;
|
||||
case 0x00E: BGCnt[3] = val; return;
|
||||
|
||||
case 0x010: BGXPos[0] = val; return;
|
||||
case 0x012: BGYPos[0] = val; return;
|
||||
case 0x014: BGXPos[1] = val; return;
|
||||
case 0x016: BGYPos[1] = val; return;
|
||||
case 0x018: BGXPos[2] = val; return;
|
||||
case 0x01A: BGYPos[2] = val; return;
|
||||
case 0x01C: BGXPos[3] = val; return;
|
||||
case 0x01E: BGYPos[3] = val; return;
|
||||
}
|
||||
|
||||
printf("unknown GPU write16 %08X %04X\n", addr, val);
|
||||
|
@ -213,9 +224,8 @@ void GPU2D::DrawBG_Text_4bpp(u32 line, u16* dst, u32 bgnum)
|
|||
u16* tilemap;
|
||||
u16* pal;
|
||||
|
||||
// TODO scroll
|
||||
u16 xoff = 0;
|
||||
u16 yoff = line;
|
||||
u16 xoff = BGXPos[bgnum];
|
||||
u16 yoff = BGYPos[bgnum] + line;
|
||||
|
||||
u32 widexmask = (bgcnt & 0x4000) ? 0x100 : 0;
|
||||
//u32 ymask = (bgcnt & 0x8000) ? 0x1FF : 0xFF;
|
||||
|
@ -257,7 +267,7 @@ void GPU2D::DrawBG_Text_4bpp(u32 line, u16* dst, u32 bgnum)
|
|||
// load a new tile
|
||||
curtile = tilemap[((xoff & 0xFF) >> 3) + ((xoff & widexmask) << 2)];
|
||||
curpal = pal + ((curtile & 0xF000) >> 8);
|
||||
pixels = tileset + ((curtile & 0x01FF) << 5) + ((yoff & 0x7) << 2);
|
||||
pixels = tileset + ((curtile & 0x03FF) << 5) + ((yoff & 0x7) << 2);
|
||||
pixels += ((xoff & 0x7) >> 1);
|
||||
}
|
||||
|
||||
|
@ -268,7 +278,7 @@ void GPU2D::DrawBG_Text_4bpp(u32 line, u16* dst, u32 bgnum)
|
|||
// load a new tile
|
||||
curtile = tilemap[((xoff & 0xFF) >> 3) + ((xoff & widexmask) << 2)];
|
||||
curpal = pal + ((curtile & 0xF000) >> 8);
|
||||
pixels = tileset + ((curtile & 0x01FF) << 5) + ((yoff & 0x7) << 2);
|
||||
pixels = tileset + ((curtile & 0x03FF) << 5) + ((yoff & 0x7) << 2);
|
||||
}
|
||||
|
||||
// draw pixel
|
||||
|
|
3
GPU2D.h
3
GPU2D.h
|
@ -45,6 +45,9 @@ private:
|
|||
u32 DispCnt;
|
||||
u16 BGCnt[4];
|
||||
|
||||
u16 BGXPos[4];
|
||||
u16 BGYPos[4];
|
||||
|
||||
void DrawScanline_Mode1(u32 line, u16* dst);
|
||||
void DrawBG_Text_4bpp(u32 line, u16* dst, u32 num);
|
||||
};
|
||||
|
|
11
NDS.cpp
11
NDS.cpp
|
@ -970,13 +970,7 @@ void ARM9Write8(u32 addr, u8 val)
|
|||
void ARM9Write16(u32 addr, u16 val)
|
||||
{
|
||||
if (addr == ARM9->R[15]) printf("!!!!!!!!!!!!9999 %08X %04X\n", addr, val);
|
||||
if (addr == 0x02331B44) printf("!! PAL !! %04X %08X\n", val, ARM9->R[15]);
|
||||
/*if (addr >= 0x06218000 && addr < 0x06218000+0x6000 && val)
|
||||
{
|
||||
printf("WRITE TO LAME VRAM %08X %04X %08X, %08X %08X, %08X\n", addr, val, ARM9->R[15], ARM9->R[4], ARM9->R[3],
|
||||
ARM9Read32(ARM9->R[13]+12));
|
||||
//Halt();
|
||||
}*/
|
||||
|
||||
if (addr < ARM9ITCMSize)
|
||||
{
|
||||
*(u16*)&ARM9ITCM[addr & 0x7FFF] = val;
|
||||
|
@ -1034,8 +1028,7 @@ void ARM9Write16(u32 addr, u16 val)
|
|||
void ARM9Write32(u32 addr, u32 val)
|
||||
{
|
||||
if (addr == ARM9->R[15]) printf("!!!!!!!!!!!!9999 %08X %08X\n", addr, val);
|
||||
if (addr == 0x023549F0) printf("%08X STATE=%08X\n", ARM9->R[15], val);
|
||||
if (addr == 0x02331B44) printf("!! PAL !! %04X %08X %08X\n", val, ARM9->R[15], ARM9Read32(0x23312E8));
|
||||
|
||||
if (addr < ARM9ITCMSize)
|
||||
{
|
||||
*(u32*)&ARM9ITCM[addr & 0x7FFF] = val;
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
1481161027 c:\documents\sources\melonds\types.h
|
||||
|
||||
1484919120 source:c:\documents\sources\melonds\nds.cpp
|
||||
1484922190 source:c:\documents\sources\melonds\nds.cpp
|
||||
<stdio.h>
|
||||
<string.h>
|
||||
"NDS.h"
|
||||
|
@ -83,13 +83,13 @@
|
|||
"NDS.h"
|
||||
"SPI.h"
|
||||
|
||||
1484920777 source:c:\documents\sources\melonds\gpu2d.cpp
|
||||
1484922144 source:c:\documents\sources\melonds\gpu2d.cpp
|
||||
<stdio.h>
|
||||
<string.h>
|
||||
"NDS.h"
|
||||
"GPU.h"
|
||||
|
||||
1484711212 c:\documents\sources\melonds\gpu2d.h
|
||||
1484922330 c:\documents\sources\melonds\gpu2d.h
|
||||
|
||||
1481040524 c:\documents\sources\melonds\wifi.h
|
||||
|
||||
|
|
Loading…
Reference in New Issue