mirror of
https://github.com/MoleskiCoder/EightBitNet.git
synced 2025-02-09 12:31:01 +00:00
28 lines
760 B
C#
28 lines
760 B
C#
// <copyright file="MemoryMapping.cs" company="Adrian Conlon">
|
|
// Copyright (c) Adrian Conlon. All rights reserved.
|
|
// </copyright>
|
|
|
|
namespace EightBit
|
|
{
|
|
public class MemoryMapping(Memory memory, ushort begin, ushort mask, AccessLevel access)
|
|
{
|
|
public MemoryMapping(Memory memory, ushort begin, Mask mask, AccessLevel access)
|
|
: this(memory, begin, (ushort)mask, access)
|
|
{
|
|
}
|
|
|
|
public Memory Memory { get; set; } = memory;
|
|
|
|
public ushort Begin { get; set; } = begin;
|
|
|
|
public ushort Mask { get; set; } = mask;
|
|
|
|
public AccessLevel Access { get; set; } = access;
|
|
|
|
public int Offset(ushort absolute)
|
|
{
|
|
return (absolute - this.Begin) & this.Mask;
|
|
}
|
|
}
|
|
}
|