26 lines
693 B
C#
26 lines
693 B
C#
using System;
|
|
using System.IO;
|
|
|
|
namespace Desktop
|
|
{
|
|
public static class RomLoader
|
|
{
|
|
public static byte[] Load(string filePath)
|
|
{
|
|
if (!File.Exists(filePath))
|
|
{
|
|
throw new FileNotFoundException($"Could not find the ROM file at: {filePath}");
|
|
}
|
|
|
|
byte[] romData = File.ReadAllBytes(filePath);
|
|
|
|
// The standard ZX Spectrum 48k ROM is exactly 16384 bytes (16KB)
|
|
if (romData.Length != 16384)
|
|
{
|
|
throw new InvalidDataException($"Invalid ROM size. Expected 16384 bytes, got {romData.Length} bytes.");
|
|
}
|
|
|
|
return romData;
|
|
}
|
|
}
|
|
} |