@@ -338,73 +338,73 @@ public byte PeekMainRam(int address)
338
338
{
339
339
return address switch
340
340
{
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 } )" )
347
347
} ;
348
348
}
349
349
350
350
public void PokeMainRam ( int address , byte value )
351
351
{
352
352
switch ( address )
353
353
{
354
- case > 0 and < 0x0200 :
354
+ case >= 0 and < 0x0200 :
355
355
_ramMainRegion0001 [ address - 0 ] = value ;
356
356
break ;
357
- case > 0x0200 and < 0xC000 :
357
+ case >= 0x0200 and < 0xC000 :
358
358
_ramMainRegion02BF [ address - 0x0200 ] = value ;
359
359
break ;
360
- case > 0xC000 and < 0xD000 :
360
+ case >= 0xC000 and < 0xD000 :
361
361
_ramMainBank1RegionD0DF [ address - 0xC000 ] = value ;
362
362
break ;
363
- case > 0xD000 and < 0xE000 :
363
+ case >= 0xD000 and < 0xE000 :
364
364
_ramMainBank2RegionD0DF [ address - 0xD000 ] = value ;
365
365
break ;
366
- case > 0xE000 and < 0x10000 :
366
+ case >= 0xE000 and < 0x10000 :
367
367
_ramMainRegionE0FF [ address - 0xE000 ] = value ;
368
368
break ;
369
369
default :
370
- throw new InvalidOperationException ( ) ;
370
+ throw new InvalidOperationException ( $ " { nameof ( address ) } out of range ( { address } )" ) ;
371
371
}
372
372
}
373
373
374
374
public byte PeekAuxRam ( int address )
375
375
{
376
376
return address switch
377
377
{
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 } )" )
384
384
} ;
385
385
}
386
386
387
387
public void PokeAuxRam ( int address , byte value )
388
388
{
389
389
switch ( address )
390
390
{
391
- case > 0 and < 0x0200 :
391
+ case >= 0 and < 0x0200 :
392
392
_ramAuxRegion0001 [ address - 0 ] = value ;
393
393
break ;
394
- case > 0x0200 and < 0xC000 :
394
+ case >= 0x0200 and < 0xC000 :
395
395
_ramAuxRegion02BF [ address - 0x0200 ] = value ;
396
396
break ;
397
- case > 0xC000 and < 0xD000 :
397
+ case >= 0xC000 and < 0xD000 :
398
398
_ramAuxBank1RegionD0DF [ address - 0xC000 ] = value ;
399
399
break ;
400
- case > 0xD000 and < 0xE000 :
400
+ case >= 0xD000 and < 0xE000 :
401
401
_ramAuxBank2RegionD0DF [ address - 0xD000 ] = value ;
402
402
break ;
403
- case > 0xE000 and < 0x10000 :
403
+ case >= 0xE000 and < 0x10000 :
404
404
_ramAuxRegionE0FF [ address - 0xE000 ] = value ;
405
405
break ;
406
406
default :
407
- throw new InvalidOperationException ( ) ;
407
+ throw new InvalidOperationException ( $ " { nameof ( address ) } out of range ( { address } )" ) ;
408
408
}
409
409
}
410
410
0 commit comments