improve WRAMCNT memory mapping

This commit is contained in:
zeromus 2012-10-21 21:17:07 +00:00
parent e2fcf5eadb
commit e6216b978a
3 changed files with 9 additions and 14 deletions

View File

@ -787,9 +787,6 @@ static inline void MMU_VRAMmapControl(u8 block, u8 VRAMBankCnt)
if(block == 7)
{
MMU.WRAMCNT = VRAMBankCnt & 3;
//copy new value into WRAMSTAT
//TODO - block user writes to WRAMSTAT
T1WriteByte(MMU.MMU_MEM[ARMCPU_ARM7][0x40], 0x241, MMU.WRAMCNT);
return;
}
@ -1003,6 +1000,8 @@ void MMU_Reset()
MMU.SPI_CNT = 0;
MMU.AUX_SPI_CNT = 0;
MMU.WRAMCNT = 0;
// Enable the sound speakers
T1WriteWord(MMU.ARM7_REG, 0x304, 0x0001);

View File

@ -357,9 +357,9 @@ struct MMU_struct
//ARM7 mem
u8 ARM7_BIOS[0x4000];
u8 ARM7_ERAM[0x10000];
u8 ARM7_ERAM[0x10000]; //64KB of exclusive WRAM
u8 ARM7_REG[0x10000];
u8 ARM7_WIRAM[0x10000];
u8 ARM7_WIRAM[0x10000]; //WIFI ram
// VRAM mapping
u8 VRAM_MAP[4][32];
@ -759,10 +759,6 @@ FORCEINLINE u32 _MMU_read32(const int PROCNUM, const MMU_ACCESS_TYPE AT, const u
{
if ( (addr & 0x0F000000) == 0x02000000)
return T1ReadLong_guaranteedAligned( MMU.MAIN_MEM, addr & _MMU_MAIN_MEM_MASK32);
else if((addr & 0xFF800000) == 0x03800000)
return T1ReadLong_guaranteedAligned(MMU.ARM7_ERAM, addr&0xFFFC);
else if((addr & 0xFF800000) == 0x03000000)
return T1ReadLong_guaranteedAligned(MMU.SWIRAM, addr&0x7FFC);
}

View File

@ -2469,6 +2469,11 @@ void NDS_Reset()
{
//fake firmware boot-up process
//according to smea, this is initialized to 3. who does this? we're doing it here because we're not sure if the firmware depends on it
//but it mustve been done by the time the game boots, unless it was libnds doing it.
//it's important that this be done before the copy happens so that arm7 programs can load into SIWRAM if thats where theyre specified to go
_MMU_write08<ARMCPU_ARM9>(REG_WRAMCNT,3);
//copy the arm9 program to the address specified by rom header
u32 src = header->ARM9src;
u32 dst = header->ARM9cpy;
@ -2493,11 +2498,6 @@ void NDS_Reset()
armcpu_init(&NDS_ARM7, header->ARM7exe);
armcpu_init(&NDS_ARM9, header->ARM9exe);
//TODO reading REG_WRAMSTAT (
//according to smea, this is initialized to 3. who does this? we're doing it here because we're not sure if the firmware depends on it
//but it mustve been done by the time the game boots, unless it was libnds doing it.
_MMU_write08<ARMCPU_ARM9>(REG_WRAMCNT,3);
//set REG_POSTFLG to the value indicating post-firmware status
MMU.ARM9_REG[0x300] = 1;
MMU.ARM7_REG[0x300] = 1;