Some fixes and code refactoring

This commit is contained in:
2026-05-22 16:40:33 +01:00
parent cca1abf0be
commit b5695b5c2f
7 changed files with 233 additions and 190 deletions

View File

@@ -42,6 +42,11 @@ namespace Core.Memory
public byte Read(ushort address)
{
if (address < 0xC000 && !_isCartridgeLoaded)
{
return 0xFF;
}
if (address < 0x4000)
{
if (address < 0x0400)
@@ -65,7 +70,7 @@ namespace Core.Memory
return _cartridgeRom[(_romBank2 * 0x4000) + (address - 0x8000)];
}
// THE FIX 1: Bitwise AND perfectly forces 0xE000-0xFFFF to mirror down to 0xC000!
// Bitwise AND perfectly forces 0xE000-0xFFFF to mirror down to 0xC000!
return _workRam[address & 0x1FFF];
}