Fix peeks/pokes with the new memory domains in Virtu

fixes a311b3b6f3
This commit is contained in:
CasualPokePlayer 2023-04-02 23:37:48 -07:00
parent 2fc4683e6b
commit ece5d2548a
2 changed files with 24 additions and 24 deletions

View File

@ -338,12 +338,12 @@ namespace Jellyfish.Virtu
{
return address switch
{
> 0 and < 0x0200 => _ramMainRegion0001[address - 0],
> 0x0200 and < 0xC000 => _ramMainRegion02BF[address - 0x0200],
> 0xC000 and < 0xD000 => _ramMainBank1RegionD0DF[address - 0xC000],
> 0xD000 and < 0xE000 => _ramMainBank2RegionD0DF[address - 0xD000],
> 0xE000 and < 0x10000 => _ramMainRegionE0FF[address - 0xE000],
_ => throw new InvalidOperationException()
>= 0 and < 0x0200 => _ramMainRegion0001[address - 0],
>= 0x0200 and < 0xC000 => _ramMainRegion02BF[address - 0x0200],
>= 0xC000 and < 0xD000 => _ramMainBank1RegionD0DF[address - 0xC000],
>= 0xD000 and < 0xE000 => _ramMainBank2RegionD0DF[address - 0xD000],
>= 0xE000 and < 0x10000 => _ramMainRegionE0FF[address - 0xE000],
_ => throw new InvalidOperationException($"{nameof(address)} out of range ({address})")
};
}
@ -351,23 +351,23 @@ namespace Jellyfish.Virtu
{
switch (address)
{
case > 0 and < 0x0200:
case >= 0 and < 0x0200:
_ramMainRegion0001[address - 0] = value;
break;
case > 0x0200 and < 0xC000:
case >= 0x0200 and < 0xC000:
_ramMainRegion02BF[address - 0x0200] = value;
break;
case > 0xC000 and < 0xD000:
case >= 0xC000 and < 0xD000:
_ramMainBank1RegionD0DF[address - 0xC000] = value;
break;
case > 0xD000 and < 0xE000:
case >= 0xD000 and < 0xE000:
_ramMainBank2RegionD0DF[address - 0xD000] = value;
break;
case > 0xE000 and < 0x10000:
case >= 0xE000 and < 0x10000:
_ramMainRegionE0FF[address - 0xE000] = value;
break;
default:
throw new InvalidOperationException();
throw new InvalidOperationException($"{nameof(address)} out of range ({address})");
}
}
@ -375,12 +375,12 @@ namespace Jellyfish.Virtu
{
return address switch
{
> 0 and < 0x0200 => _ramAuxRegion0001[address - 0],
> 0x0200 and < 0xC000 => _ramAuxRegion02BF[address - 0x0200],
> 0xC000 and < 0xD000 => _ramAuxBank1RegionD0DF[address - 0xC000],
> 0xD000 and < 0xE000 => _ramAuxBank2RegionD0DF[address - 0xD000],
> 0xE000 and < 0x10000 => _ramAuxRegionE0FF[address - 0xE000],
_ => throw new InvalidOperationException()
>= 0 and < 0x0200 => _ramAuxRegion0001[address - 0],
>= 0x0200 and < 0xC000 => _ramAuxRegion02BF[address - 0x0200],
>= 0xC000 and < 0xD000 => _ramAuxBank1RegionD0DF[address - 0xC000],
>= 0xD000 and < 0xE000 => _ramAuxBank2RegionD0DF[address - 0xD000],
>= 0xE000 and < 0x10000 => _ramAuxRegionE0FF[address - 0xE000],
_ => throw new InvalidOperationException($"{nameof(address)} out of range ({address})")
};
}
@ -388,23 +388,23 @@ namespace Jellyfish.Virtu
{
switch (address)
{
case > 0 and < 0x0200:
case >= 0 and < 0x0200:
_ramAuxRegion0001[address - 0] = value;
break;
case > 0x0200 and < 0xC000:
case >= 0x0200 and < 0xC000:
_ramAuxRegion02BF[address - 0x0200] = value;
break;
case > 0xC000 and < 0xD000:
case >= 0xC000 and < 0xD000:
_ramAuxBank1RegionD0DF[address - 0xC000] = value;
break;
case > 0xD000 and < 0xE000:
case >= 0xD000 and < 0xE000:
_ramAuxBank2RegionD0DF[address - 0xD000] = value;
break;
case > 0xE000 and < 0x10000:
case >= 0xE000 and < 0x10000:
_ramAuxRegionE0FF[address - 0xE000] = value;
break;
default:
throw new InvalidOperationException();
throw new InvalidOperationException($"{nameof(address)} out of range ({address})");
}
}

Binary file not shown.