Small usage simplification with bus mapper

This commit is contained in:
Adrian Conlon committed 2026-06-01 11:10:31 +01:00
1 parent 2ecc139d63
commit 7d99e8162f
2 files changed
+4 -4

No files matched your search

+1 -1
View File
@@ -66,7 +66,7 @@ namespace EightBit
protected ref byte Reference(ushort absolute)
{
var mapped = this.Mapping(absolute);
var offset = (ushort)mapped.Offset(absolute);
var offset = mapped.Offset(absolute);
if (mapped.Access != AccessLevel.ReadOnly)
{
return ref mapped.Memory.Reference(offset);
+3 -3
View File
@@ -25,7 +25,7 @@ namespace EightBit
{
}
private readonly int[] _offsets = new int[ushort.MaxValue + 1];
private readonly ushort[] _offsets = new ushort[ushort.MaxValue + 1];
private readonly Memory _memory;
private readonly ushort _begin;
private readonly ushort _mask;
@@ -39,8 +39,8 @@ namespace EightBit
public AccessLevel Access => this._access;
private int CalculateOffset(ushort absolute) => (absolute - this.Begin) & this.Mask;
private ushort CalculateOffset(ushort absolute) => (ushort)((absolute - this.Begin) & this.Mask);
public int Offset(ushort absolute) => this._offsets[absolute];
public ushort Offset(ushort absolute) => this._offsets[absolute];
}
}