Skip to content

Commit ece5d25

Browse files
Fix peeks/pokes with the new memory domains in Virtu
fixes a311b3b
1 parent 2fc4683 commit ece5d25

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

ExternalCoreProjects/Virtu/Memory.cs

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -338,73 +338,73 @@ public byte PeekMainRam(int address)
338338
{
339339
return address switch
340340
{
341-
> 0 and < 0x0200 => _ramMainRegion0001[address - 0],
342-
> 0x0200 and < 0xC000 => _ramMainRegion02BF[address - 0x0200],
343-
> 0xC000 and < 0xD000 => _ramMainBank1RegionD0DF[address - 0xC000],
344-
> 0xD000 and < 0xE000 => _ramMainBank2RegionD0DF[address - 0xD000],
345-
> 0xE000 and < 0x10000 => _ramMainRegionE0FF[address - 0xE000],
346-
_ => throw new InvalidOperationException()
341+
>= 0 and < 0x0200 => _ramMainRegion0001[address - 0],
342+
>= 0x0200 and < 0xC000 => _ramMainRegion02BF[address - 0x0200],
343+
>= 0xC000 and < 0xD000 => _ramMainBank1RegionD0DF[address - 0xC000],
344+
>= 0xD000 and < 0xE000 => _ramMainBank2RegionD0DF[address - 0xD000],
345+
>= 0xE000 and < 0x10000 => _ramMainRegionE0FF[address - 0xE000],
346+
_ => throw new InvalidOperationException($"{nameof(address)} out of range ({address})")
347347
};
348348
}
349349

350350
public void PokeMainRam(int address, byte value)
351351
{
352352
switch (address)
353353
{
354-
case > 0 and < 0x0200:
354+
case >= 0 and < 0x0200:
355355
_ramMainRegion0001[address - 0] = value;
356356
break;
357-
case > 0x0200 and < 0xC000:
357+
case >= 0x0200 and < 0xC000:
358358
_ramMainRegion02BF[address - 0x0200] = value;
359359
break;
360-
case > 0xC000 and < 0xD000:
360+
case >= 0xC000 and < 0xD000:
361361
_ramMainBank1RegionD0DF[address - 0xC000] = value;
362362
break;
363-
case > 0xD000 and < 0xE000:
363+
case >= 0xD000 and < 0xE000:
364364
_ramMainBank2RegionD0DF[address - 0xD000] = value;
365365
break;
366-
case > 0xE000 and < 0x10000:
366+
case >= 0xE000 and < 0x10000:
367367
_ramMainRegionE0FF[address - 0xE000] = value;
368368
break;
369369
default:
370-
throw new InvalidOperationException();
370+
throw new InvalidOperationException($"{nameof(address)} out of range ({address})");
371371
}
372372
}
373373

374374
public byte PeekAuxRam(int address)
375375
{
376376
return address switch
377377
{
378-
> 0 and < 0x0200 => _ramAuxRegion0001[address - 0],
379-
> 0x0200 and < 0xC000 => _ramAuxRegion02BF[address - 0x0200],
380-
> 0xC000 and < 0xD000 => _ramAuxBank1RegionD0DF[address - 0xC000],
381-
> 0xD000 and < 0xE000 => _ramAuxBank2RegionD0DF[address - 0xD000],
382-
> 0xE000 and < 0x10000 => _ramAuxRegionE0FF[address - 0xE000],
383-
_ => throw new InvalidOperationException()
378+
>= 0 and < 0x0200 => _ramAuxRegion0001[address - 0],
379+
>= 0x0200 and < 0xC000 => _ramAuxRegion02BF[address - 0x0200],
380+
>= 0xC000 and < 0xD000 => _ramAuxBank1RegionD0DF[address - 0xC000],
381+
>= 0xD000 and < 0xE000 => _ramAuxBank2RegionD0DF[address - 0xD000],
382+
>= 0xE000 and < 0x10000 => _ramAuxRegionE0FF[address - 0xE000],
383+
_ => throw new InvalidOperationException($"{nameof(address)} out of range ({address})")
384384
};
385385
}
386386

387387
public void PokeAuxRam(int address, byte value)
388388
{
389389
switch (address)
390390
{
391-
case > 0 and < 0x0200:
391+
case >= 0 and < 0x0200:
392392
_ramAuxRegion0001[address - 0] = value;
393393
break;
394-
case > 0x0200 and < 0xC000:
394+
case >= 0x0200 and < 0xC000:
395395
_ramAuxRegion02BF[address - 0x0200] = value;
396396
break;
397-
case > 0xC000 and < 0xD000:
397+
case >= 0xC000 and < 0xD000:
398398
_ramAuxBank1RegionD0DF[address - 0xC000] = value;
399399
break;
400-
case > 0xD000 and < 0xE000:
400+
case >= 0xD000 and < 0xE000:
401401
_ramAuxBank2RegionD0DF[address - 0xD000] = value;
402402
break;
403-
case > 0xE000 and < 0x10000:
403+
case >= 0xE000 and < 0x10000:
404404
_ramAuxRegionE0FF[address - 0xE000] = value;
405405
break;
406406
default:
407-
throw new InvalidOperationException();
407+
throw new InvalidOperationException($"{nameof(address)} out of range ({address})");
408408
}
409409
}
410410

References/Virtu.dll

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)