Skip to content
This repository has been archived by the owner on Sep 11, 2023. It is now read-only.

fix warnings #114

Merged
merged 3 commits into from
Jul 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Core/BmcDs07.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ class BmcDs07 : public BaseMapper
protected:
uint16_t GetPRGPageSize() override { return 0x4000; }
uint16_t GetCHRPageSize() override { return 0x2000; }
uint16_t RegisterStartAddress() { return 0x6000; }
uint16_t RegisterEndAddress() { return 0xFFFF; }
uint16_t RegisterStartAddress() override { return 0x6000; }
uint16_t RegisterEndAddress() override { return 0xFFFF; }

void InitMapper() override
{
Expand Down
4 changes: 4 additions & 0 deletions Core/Core.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -807,6 +807,9 @@
<ClInclude Include="Mapper400.h" />
<ClInclude Include="Mapper449.h" />
<ClInclude Include="Mapper452.h" />
<ClInclude Include="Mapper500.h" />
<ClInclude Include="Mapper501.h" />
<ClInclude Include="Mapper502.h" />
<ClInclude Include="Mapper523.h" />
<ClInclude Include="Mapper533.h" />
<ClInclude Include="Mapper535.h" />
Expand All @@ -815,6 +818,7 @@
<ClInclude Include="Mapper540.h" />
<ClInclude Include="Mapper549.h" />
<ClInclude Include="Mapper556.h" />
<ClInclude Include="Mapper559.h" />
<ClInclude Include="MMC1_155.h" />
<ClInclude Include="MMC1_297.h" />
<ClInclude Include="MMC3_114.h" />
Expand Down
12 changes: 12 additions & 0 deletions Core/Core.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -1576,6 +1576,15 @@
<ClInclude Include="Mapper452.h">
<Filter>Nes\Mappers\Unnamed</Filter>
</ClInclude>
<ClInclude Include="Mapper500.h">
<Filter>Nes\Mappers\Unnamed</Filter>
</ClInclude>
<ClInclude Include="Mapper501.h">
<Filter>Nes\Mappers\Unnamed</Filter>
</ClInclude>
<ClInclude Include="Mapper502.h">
<Filter>Nes\Mappers\Unnamed</Filter>
</ClInclude>
<ClInclude Include="Mapper523.h">
<Filter>Nes\Mappers\Unnamed</Filter>
</ClInclude>
Expand All @@ -1600,6 +1609,9 @@
<ClInclude Include="Mapper556.h">
<Filter>Nes\Mappers\Unnamed</Filter>
</ClInclude>
<ClInclude Include="Mapper559.h">
<Filter>Nes\Mappers\Unnamed</Filter>
</ClInclude>
<ClInclude Include="MMC3_208.h">
<Filter>Nes\Mappers\MMC</Filter>
</ClInclude>
Expand Down
2 changes: 1 addition & 1 deletion Core/MMC3_420.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class MMC3_420 : public MMC3
uint16_t mask;
uint16_t base;
if(_exRegs[0] & 0x80) {
base = ((_exRegs[0] >> 1) & 0x07 | ((_exRegs[3] >> 2) & 0x08)) << 2;
base = (((_exRegs[0] >> 1) & 0x07) | ((_exRegs[3] >> 2) & 0x08)) << 2;
page = slot;
mask = 0x03;
} else {
Expand Down
4 changes: 2 additions & 2 deletions Core/Mapper428.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ class Mapper428 : public BaseMapper
uint16_t GetPRGPageSize() override { return 0x4000; }
uint16_t GetCHRPageSize() override { return 0x2000; }

uint16_t RegisterStartAddress() { return 0x6000; }
uint16_t RegisterEndAddress() { return 0xFFFF; }
uint16_t RegisterStartAddress() override { return 0x6000; }
uint16_t RegisterEndAddress() override { return 0xFFFF; }
bool AllowRegisterRead() override { return true; }

void InitMapper() override
Expand Down
69 changes: 69 additions & 0 deletions Core/Mapper500.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#pragma once
#include "stdafx.h"
#include "BaseMapper.h"

class Mapper500 : public BaseMapper
{
private:
uint8_t _regs[2];
uint8_t _latch;

protected:
virtual uint16_t GetPRGPageSize() override { return 0x4000; }
virtual uint16_t GetCHRPageSize() override { return 0x2000; }

uint32_t GetWorkRamSize() override { return 0x2000; }
uint32_t GetWorkRamPageSize() override { return 0x1000; }

void InitMapper() override
{
_regs[0] = 0;
_regs[1] = 0;
_latch = 0;
AddRegisterRange(0x6000, 0x6FFF, MemoryOperation::Write);

UpdateState();
}

void Reset(bool softReset) override
{
if(!softReset) {
_latch = 0;
}

_regs[0] = 0;
_regs[1] = 0;

UpdateState();
}

void StreamState(bool saving) override
{
BaseMapper::StreamState(saving);
Stream(_regs[0], _regs[1], _latch);
}

void UpdateState()
{
uint16_t outerBank = (_regs[0] & 0x0F) << 3;

SetCpuMemoryMapping(0x7000, 0x7FFF, 0, PrgMemoryType::WorkRam);
SelectPRGPage(0, outerBank | (_latch & 0x07));
SelectPRGPage(1, outerBank | 0x07);
SelectCHRPage(0, 0);
SetMirroringType((_regs[1] & 0x01) ? MirroringType::Vertical : MirroringType::Horizontal);
}

void WriteRegister(uint16_t addr, uint8_t value) override
{
if(addr < 0x8000) {
if((_regs[1] & 0x80) == 0) {
_regs[addr & 0x01] = value;
}
} else {
_latch = value;
}

UpdateState();
}
};
68 changes: 68 additions & 0 deletions Core/Mapper501.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#pragma once
#include "stdafx.h"
#include "BaseMapper.h"

class Mapper501 : public BaseMapper
{
private:
uint8_t _regs[2];
uint8_t _latch;

protected:
virtual uint16_t GetPRGPageSize() override { return 0x8000; }
virtual uint16_t GetCHRPageSize() override { return 0x2000; }

uint32_t GetWorkRamSize() override { return 0x2000; }
uint32_t GetWorkRamPageSize() override { return 0x1000; }

void InitMapper() override
{
_regs[0] = 0;
_regs[1] = 0;
_latch = 0;
AddRegisterRange(0x6000, 0x6FFF, MemoryOperation::Write);

UpdateState();
}

void Reset(bool softReset) override
{
if(!softReset) {
_latch = 0;
}

_regs[0] = 0;
_regs[1] = 0;

UpdateState();
}

void StreamState(bool saving) override
{
BaseMapper::StreamState(saving);
Stream(_regs[0], _regs[1], _latch);
}

void UpdateState()
{
uint16_t outerBank = (_regs[0] & 0x0F) << 2;

SetCpuMemoryMapping(0x7000, 0x7FFF, 0, PrgMemoryType::WorkRam);
SelectPRGPage(0, outerBank + (_latch & 0x07));
SelectCHRPage(0, 0);
SetMirroringType((_latch & 0x10) ? MirroringType::ScreenBOnly : MirroringType::ScreenAOnly);
}

void WriteRegister(uint16_t addr, uint8_t value) override
{
if(addr < 0x8000) {
if((_regs[1] & 0x80) == 0) {
_regs[addr & 0x01] = value;
}
} else {
_latch = value;
}

UpdateState();
}
};
80 changes: 80 additions & 0 deletions Core/Mapper502.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#pragma once
#include "stdafx.h"
#include "BaseMapper.h"

class Mapper502 : public BaseMapper
{
private:
uint8_t _regs[2];
uint8_t _latch;

protected:
virtual uint16_t GetPRGPageSize() override { return 0x4000; }
virtual uint16_t GetCHRPageSize() override { return 0x2000; }

uint32_t GetWorkRamSize() override { return 0x2000; }
uint32_t GetWorkRamPageSize() override { return 0x1000; }

void InitMapper() override
{
_regs[0] = 0;
_regs[1] = 0;
_latch = 0;
AddRegisterRange(0x6000, 0x6FFF, MemoryOperation::Write);

UpdateState();
}

void Reset(bool softReset) override
{
if(!softReset) {
_latch = 0;
}

_regs[0] = 0;
_regs[1] = 0;

UpdateState();
}

void StreamState(bool saving) override
{
BaseMapper::StreamState(saving);
Stream(_regs[0], _regs[1], _latch);
}

void UpdateState()
{
uint16_t outerBank;
uint16_t mask = (8 << ((_regs[1] >> 4) & 0x03)) - 1;

SetCpuMemoryMapping(0x7000, 0x7FFF, 0, PrgMemoryType::WorkRam);
if(_regs[1] & 0x06) {
outerBank = (_regs[0] & 0x0F) << 2;
SelectPrgPage2x(0, (outerBank + (_latch & (mask >> 1))) << 1);
} else {
outerBank = (_regs[0] & 0x0F) << 3;
SelectPRGPage(0, outerBank + (_latch & mask));
SelectPRGPage(1, outerBank + mask);
}
SelectCHRPage(0, 0);
if(_regs[1] & 0x02) {
SetMirroringType((_latch & 0x10) ? MirroringType::ScreenBOnly : MirroringType::ScreenAOnly);
} else {
SetMirroringType((_regs[1] & 0x01) ? MirroringType::Vertical : MirroringType::Horizontal);
}
}

void WriteRegister(uint16_t addr, uint8_t value) override
{
if(addr < 0x8000) {
if((_regs[1] & 0x80) == 0) {
_regs[addr & 0x01] = value;
}
} else {
_latch = value;
}

UpdateState();
}
};
Loading