forked from Konamiman/NestorMSX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PlainRamPlugin.cs
39 lines (35 loc) · 1.13 KB
/
PlainRamPlugin.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using System.Collections.Generic;
using Konamiman.NestorMSX.Memories;
using Konamiman.NestorMSX.Misc;
using Konamiman.Z80dotNet;
namespace Konamiman.NestorMSX.Plugins
{
[NestorMSXPlugin("RAM")]
public class PlainRamPlugin
{
private readonly int baseAddress;
private readonly int size;
public PlainRamPlugin(PluginContext context, IDictionary<string, object> pluginConfig)
{
baseAddress = pluginConfig.GetValueOrDefault<int>("baseAddress", -1);
size = pluginConfig.GetValueOrDefault<int>("size", -1);
if(baseAddress == -1 && size != -1)
{
baseAddress = ushort.MaxValue - size;
}
else if(baseAddress != -1 && size == -1)
{
size = ushort.MaxValue - baseAddress;
}
else if(baseAddress == -1 && size == -1)
{
baseAddress = 0;
size = ushort.MaxValue;
}
}
public IMemory GetMemory()
{
return new PlainRam(baseAddress, size);
}
}
}