-
Notifications
You must be signed in to change notification settings - Fork 0
/
Exceptions.cs
38 lines (32 loc) · 1.23 KB
/
Exceptions.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
using System;
namespace NesSharp
{
public class IllegalMemoryAccessException : Exception
{
public IllegalMemoryAccessException(AddressBus bus, ushort address, string message = null)
: base(string.Format("Illegal {0} memory access at address 0x{1:X4}" + (message != null ? ": " + message : ""), bus, address))
{
this.Address = address;
}
public AddressBus Bus { get; private set; }
public ushort Address { get; private set; }
}
public class UnderhandledMemoryException : Exception
{
public UnderhandledMemoryException(AddressBus bus, ushort address, string message = null)
: base(string.Format("Underhandled {0} memory access at address 0x{1:X4}" + (message != null ? ": " + message : ""), bus, address))
{
this.Address = address;
}
public AddressBus Bus { get; private set; }
public ushort Address { get; private set; }
}
public class RomFormatException : Exception
{
public RomFormatException(string message) : base(message) { }
}
public class MapperNotImplemented : Exception
{
public MapperNotImplemented(int id) : base($"Mapper {id} not yet implemented") { }
}
}