Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/famicom-dumper-client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2021-04-29 12:26:12 +0300
committerAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2021-04-29 12:26:12 +0300
commit3b3cdfe40dee32d0d81be48dd9a9c716aade89a0 (patch)
tree75678c28d8a52321c4baffd496ed37ef165cd945
parent5daa29fa10ba994d053b811cdcba78c2f6b277b1 (diff)
Refactoringv2.2
-rw-r--r--FamicomDumper/CoolboyWriter.cs30
-rw-r--r--FamicomDumper/FDS.cs20
-rw-r--r--FamicomDumper/FlashHelper.cs12
-rw-r--r--FamicomDumper/mappers/BMC-10-24-C-A1.cs12
-rw-r--r--FamicomDumper/mappers/Coolboy.cs24
-rw-r--r--FamicomDumper/mappers/MMC3.cs4
-rw-r--r--FamicomDumper/mappers/Sunsoft5A-5B-FME7.cs2
-rw-r--r--FamicomDumper/scripts/DemoScript.cs4
-rw-r--r--FamicomDumper/scripts/FdsSpeedMeasure.cs8
9 files changed, 58 insertions, 58 deletions
diff --git a/FamicomDumper/CoolboyWriter.cs b/FamicomDumper/CoolboyWriter.cs
index dbe2a79..50b2ba0 100644
--- a/FamicomDumper/CoolboyWriter.cs
+++ b/FamicomDumper/CoolboyWriter.cs
@@ -16,23 +16,23 @@ namespace com.clusterrr.Famicom
byte version;
Console.Write("Detecting COOLBOY version... ");
// 0th CHR bank using both methods
- dumper.WriteCpu(0x5000, new byte[] { 0, 0, 0, 0x10 });
- dumper.WriteCpu(0x6000, new byte[] { 0, 0, 0, 0x10 });
+ dumper.WriteCpu(0x5000, 0, 0, 0, 0x10);
+ dumper.WriteCpu(0x6000, 0, 0, 0, 0x10);
// Writing 0
- dumper.WritePpu(0x0000, new byte[] { 0 });
+ dumper.WritePpu(0x0000, 0);
// First CHR bank using both methods
- dumper.WriteCpu(0x5000, new byte[] { 0, 0, 1, 0x10 });
- dumper.WriteCpu(0x6000, new byte[] { 0, 0, 1, 0x10 });
+ dumper.WriteCpu(0x5000, 0, 0, 1, 0x10);
+ dumper.WriteCpu(0x6000, 0, 0, 1, 0x10);
// Writing 1
- dumper.WritePpu(0x0000, new byte[] { 1 });
+ dumper.WritePpu(0x0000, 1);
// 0th bank using first method
- dumper.WriteCpu(0x6000, new byte[] { 0, 0, 0, 0x10 });
- byte v6000 = dumper.ReadPpu(0x0000, 1)[0];
+ dumper.WriteCpu(0x6000, 0, 0, 0, 0x10);
+ byte v6000 = dumper.ReadPpu(0x0000);
// return
- dumper.WriteCpu(0x6000, new byte[] { 0, 0, 1, 0x10 });
+ dumper.WriteCpu(0x6000, 0, 0, 1, 0x10);
// 0th bank using second method
- dumper.WriteCpu(0x5000, new byte[] { 0, 0, 0, 0x10 });
- byte v5000 = dumper.ReadPpu(0x0000, 1)[0];
+ dumper.WriteCpu(0x5000, 0, 0, 0, 0x10);
+ byte v5000 = dumper.ReadPpu(0x0000);
if (v6000 == 0 && v5000 == 1)
version = 1;
@@ -58,7 +58,7 @@ namespace com.clusterrr.Famicom
byte r2 = 0;
byte r3 = (byte)((1 << 4) // NROM mode
| ((bank & 7) << 1)); // 2, 1, 0 bits
- dumper.WriteCpu(CoolboyReg, new byte[] { r0, r1, r2, r3 });
+ dumper.WriteCpu(CoolboyReg, r0, r1, r2, r3);
var cfi = FlashHelper.GetCFIInfo(dumper);
FlashHelper.PrintCFIInfo(cfi);
FlashHelper.LockBitsCheckPrint(dumper);
@@ -130,7 +130,7 @@ namespace com.clusterrr.Famicom
byte r2 = 0;
byte r3 = (byte)((1 << 4) // NROM mode
| ((bank & 7) << 1)); // 2, 1, 0 bits
- dumper.WriteCpu(coolboyReg, new byte[] { r0, r1, r2, r3 });
+ dumper.WriteCpu(coolboyReg, r0, r1, r2, r3);
var data = new byte[BANK_SIZE];
int pos = bank * BANK_SIZE;
@@ -209,7 +209,7 @@ namespace com.clusterrr.Famicom
byte r2 = 0;
byte r3 = (byte)((1 << 4) // NROM mode
| ((bank & 7) << 1)); // 2, 1, 0 bits
- dumper.WriteCpu(coolboyReg, new byte[] { r0, r1, r2, r3 });
+ dumper.WriteCpu(coolboyReg, r0, r1, r2, r3);
var data = new byte[BANK_SIZE];
int pos = bank * BANK_SIZE;
@@ -269,7 +269,7 @@ namespace com.clusterrr.Famicom
byte r2 = 0;
byte r3 = (byte)((1 << 4) // NROM mode
| ((bank & 7) << 1)); // 2, 1, 0 bits
- dumper.WriteCpu(coolboyReg, new byte[] { r0, r1, r2, r3 });
+ dumper.WriteCpu(coolboyReg, r0, r1, r2, r3);
FlashHelper.PPBClear(dumper);
}
diff --git a/FamicomDumper/FDS.cs b/FamicomDumper/FDS.cs
index 5798f49..be43cd5 100644
--- a/FamicomDumper/FDS.cs
+++ b/FamicomDumper/FDS.cs
@@ -24,14 +24,14 @@ namespace com.clusterrr.Famicom
for (int sideNumber = 0; sideNumber < rom.Sides.Count; sideNumber++)
{
- var driveStatus = dumper.ReadCpu(0x4032, 1)[0];
+ var driveStatus = dumper.ReadCpu(0x4032);
if ((driveStatus & 1) != 0)
{
Console.Write($"Please set disk card, side #{sideNumber + 1}... ");
while ((driveStatus & 1) != 0)
{
Thread.Sleep(100);
- driveStatus = dumper.ReadCpu(0x4032, 1)[0];
+ driveStatus = dumper.ReadCpu(0x4032);
}
Console.WriteLine("OK");
}
@@ -89,14 +89,14 @@ namespace com.clusterrr.Famicom
if (sideNumber + 1 < rom.Sides.Count)
{
- driveStatus = dumper.ReadCpu(0x4032, 1)[0];
+ driveStatus = dumper.ReadCpu(0x4032);
if ((driveStatus & 1) == 0)
{
Console.Write($"Please remove disk card... ");
while ((driveStatus & 1) == 0)
{
Thread.Sleep(100);
- driveStatus = dumper.ReadCpu(0x4032, 1)[0];
+ driveStatus = dumper.ReadCpu(0x4032);
}
Console.WriteLine("OK");
}
@@ -118,14 +118,14 @@ namespace com.clusterrr.Famicom
var sideImages = new List<FdsDiskSide>();
for (int side = 1; side <= sides; side++)
{
- var driveStatus = dumper.ReadCpu(0x4032, 1)[0];
+ var driveStatus = dumper.ReadCpu(0x4032);
if ((driveStatus & 1) != 0)
{
Console.Write($"Please set disk card, side #{side}... ");
while ((driveStatus & 1) != 0)
{
Thread.Sleep(100);
- driveStatus = dumper.ReadCpu(0x4032, 1)[0];
+ driveStatus = dumper.ReadCpu(0x4032);
}
Console.WriteLine("OK");
}
@@ -134,14 +134,14 @@ namespace com.clusterrr.Famicom
if (side < sides)
{
- driveStatus = dumper.ReadCpu(0x4032, 1)[0];
+ driveStatus = dumper.ReadCpu(0x4032);
if ((driveStatus & 1) == 0)
{
Console.Write($"Please remove disk card... ");
while ((driveStatus & 1) == 0)
{
Thread.Sleep(100);
- driveStatus = dumper.ReadCpu(0x4032, 1)[0];
+ driveStatus = dumper.ReadCpu(0x4032);
}
Console.WriteLine("OK");
}
@@ -189,11 +189,11 @@ namespace com.clusterrr.Famicom
dumper.WriteCpu(0x4026, 0x00);
dumper.WriteCpu(0x4025, 0b00100110); // reset
dumper.WriteCpu(0x0000, 0xFF); // to prevent open bus read
- var ext = dumper.ReadCpu(0x4033, 1)[0];
+ var ext = dumper.ReadCpu(0x4033);
if (ext != 0x00) ramAdapterPresent = false;
dumper.WriteCpu(0x4026, 0xFF);
dumper.WriteCpu(0x0000, 0x00); // to prevent open bus read
- ext = dumper.ReadCpu(0x4033, 1)[0];
+ ext = dumper.ReadCpu(0x4033);
if ((ext & 0x7F) != 0x7F) ramAdapterPresent = false;
if (!ramAdapterPresent) throw new IOException("RAM adapter IO error, is it connected?");
}
diff --git a/FamicomDumper/FlashHelper.cs b/FamicomDumper/FlashHelper.cs
index cd1d1c8..0d8e7c6 100644
--- a/FamicomDumper/FlashHelper.cs
+++ b/FamicomDumper/FlashHelper.cs
@@ -107,7 +107,7 @@ namespace com.clusterrr.Famicom
// Bits Program
dumper.WriteCpu(0x8000, 0xA0);
dumper.WriteCpu(0x8000, (byte)(1 << 2) ^ 0xFF); // password protection
- var r = dumper.ReadCpu(0x8000, 1)[0];
+ var r = dumper.ReadCpu(0x8000);
if ((r & 7) != 3)
throw new InvalidDataException("Lock bit verification failed");
}
@@ -151,7 +151,7 @@ namespace com.clusterrr.Famicom
dumper.WriteCpu(0x8AAA, 0xAA);
dumper.WriteCpu(0x8555, 0x55);
dumper.WriteCpu(0x8AAA, 0x40);
- var lockRegister = dumper.ReadCpu(0x8000, 1)[0];
+ var lockRegister = dumper.ReadCpu(0x8000);
if ((lockRegister & 1) == 0)
Console.WriteLine("WARNING: Secured Silicon Sector Protection Bit is set!");
if ((lockRegister & 2) == 0)
@@ -173,7 +173,7 @@ namespace com.clusterrr.Famicom
dumper.WriteCpu(0x8AAA, 0xAA);
dumper.WriteCpu(0x8555, 0x55);
dumper.WriteCpu(0x8AAA, 0x50);
- var ppbLockStatus = dumper.ReadCpu(0x8000, 1)[0];
+ var ppbLockStatus = dumper.ReadCpu(0x8000);
if (ppbLockStatus == 0)
Console.WriteLine("WARNING: PPB Lock Bit is set!");
}
@@ -192,7 +192,7 @@ namespace com.clusterrr.Famicom
dumper.WriteCpu(0x8555, 0x55);
dumper.WriteCpu(0x8AAA, 0xC0);
// PPB Status Read
- return dumper.ReadCpu(0x8000, 1)[0];
+ return dumper.ReadCpu(0x8000);
}
finally
{
@@ -216,7 +216,7 @@ namespace com.clusterrr.Famicom
DateTime startTime = DateTime.Now;
while (true)
{
- byte b = dumper.ReadCpu(0x8000, 1)[0];
+ byte b = dumper.ReadCpu(0x8000);
if (b == 0x00)
break;
if ((DateTime.Now - startTime).TotalMilliseconds >= 1500)
@@ -248,7 +248,7 @@ namespace com.clusterrr.Famicom
DateTime startTime = DateTime.Now;
while (true)
{
- byte b = dumper.ReadCpu(0x8000, 1)[0];
+ byte b = dumper.ReadCpu(0x8000);
if (b == 0x01)
break;
if ((DateTime.Now - startTime).TotalMilliseconds >= 1500)
diff --git a/FamicomDumper/mappers/BMC-10-24-C-A1.cs b/FamicomDumper/mappers/BMC-10-24-C-A1.cs
index 62eb3c5..b8af7d1 100644
--- a/FamicomDumper/mappers/BMC-10-24-C-A1.cs
+++ b/FamicomDumper/mappers/BMC-10-24-C-A1.cs
@@ -44,8 +44,8 @@
for (var bank = 0; bank < banks; bank += 2)
{
Console.Write($"Reading PRG banks #{outbank}|{bank} and #{outbank}|{bank + 1}... ");
- dumper.WriteCpu(0x8000, new byte[] { 6, (byte)bank });
- dumper.WriteCpu(0x8000, new byte[] { 7, (byte)(bank | 1) });
+ dumper.WriteCpu(0x8000, 6, (byte)bank);
+ dumper.WriteCpu(0x8000, 7, (byte)(bank | 1));
data.AddRange(dumper.ReadCpu(0x8000, 0x4000));
Console.WriteLine("OK");
}
@@ -67,10 +67,10 @@
for (var bank = 0; bank < banks; bank += 4)
{
Console.Write($"Reading CHR banks #{outbank}|{bank}, #{outbank}|{bank + 1}, #{outbank}|{bank + 2}, #{outbank}|{bank + 3}... ");
- dumper.WriteCpu(0x8000, new byte[] { 2, (byte)bank });
- dumper.WriteCpu(0x8000, new byte[] { 3, (byte)(bank | 1) });
- dumper.WriteCpu(0x8000, new byte[] { 4, (byte)(bank | 2) });
- dumper.WriteCpu(0x8000, new byte[] { 5, (byte)(bank | 3) });
+ dumper.WriteCpu(0x8000, 2, (byte)bank);
+ dumper.WriteCpu(0x8000, 3, (byte)(bank | 1));
+ dumper.WriteCpu(0x8000, 4, (byte)(bank | 2));
+ dumper.WriteCpu(0x8000, 5, (byte)(bank | 3));
data.AddRange(dumper.ReadPpu(0x1000, 0x1000));
Console.WriteLine("OK");
}
diff --git a/FamicomDumper/mappers/Coolboy.cs b/FamicomDumper/mappers/Coolboy.cs
index 357071a..bcc03d4 100644
--- a/FamicomDumper/mappers/Coolboy.cs
+++ b/FamicomDumper/mappers/Coolboy.cs
@@ -46,23 +46,23 @@
byte version;
Console.Write("Detecting COOLBOY version... ");
// 0th CHR bank using both methods
- dumper.WriteCpu(0x5000, new byte[] { 0, 0, 0, 0x10 });
- dumper.WriteCpu(0x6000, new byte[] { 0, 0, 0, 0x10 });
+ dumper.WriteCpu(0x5000, 0, 0, 0, 0x10);
+ dumper.WriteCpu(0x6000, 0, 0, 0, 0x10);
// Writing 0
- dumper.WritePpu(0x0000, new byte[] { 0 });
+ dumper.WritePpu(0x0000, 0);
// First CHR bank using both methods
- dumper.WriteCpu(0x5000, new byte[] { 0, 0, 1, 0x10 });
- dumper.WriteCpu(0x6000, new byte[] { 0, 0, 1, 0x10 });
+ dumper.WriteCpu(0x5000, 0, 0, 1, 0x10);
+ dumper.WriteCpu(0x6000, 0, 0, 1, 0x10);
// Writing 1
- dumper.WritePpu(0x0000, new byte[] { 1 });
+ dumper.WritePpu(0x0000, 1);
// 0th bank using first method
- dumper.WriteCpu(0x6000, new byte[] { 0, 0, 0, 0x10 });
- byte v6000 = dumper.ReadPpu(0x0000, 1)[0];
+ dumper.WriteCpu(0x6000, 0, 0, 0, 0x10);
+ byte v6000 = dumper.ReadPpu(0x0000);
// return
- dumper.WriteCpu(0x6000, new byte[] { 0, 0, 1, 0x10 });
+ dumper.WriteCpu(0x6000, 0, 0, 1, 0x10);
// 0th bank using second method
- dumper.WriteCpu(0x5000, new byte[] { 0, 0, 0, 0x10 });
- byte v5000 = dumper.ReadPpu(0x0000, 1)[0];
+ dumper.WriteCpu(0x5000, 0, 0, 0, 0x10);
+ byte v5000 = dumper.ReadPpu(0x0000);
if (v6000 == 0 && v5000 == 1)
version = 1;
@@ -92,7 +92,7 @@
var r2 = (byte)0;
var r3 = (byte)((1 << 4) // NROM mode
| ((bank & 7) << 1)); // 2, 1, 0 bits
- dumper.WriteCpu(coolboyReg, new byte[] { r0, r1, r2, r3 });
+ dumper.WriteCpu(coolboyReg, r0, r1, r2, r3 );
Console.Write($"Reading PRG bank #{bank}/{banks}... ");
data.AddRange(dumper.ReadCpu(0x8000, 0x4000));
diff --git a/FamicomDumper/mappers/MMC3.cs b/FamicomDumper/mappers/MMC3.cs
index c0aac1f..59028c1 100644
--- a/FamicomDumper/mappers/MMC3.cs
+++ b/FamicomDumper/mappers/MMC3.cs
@@ -37,7 +37,7 @@
for (var bank = 0; bank < banks; bank++)
{
Console.Write($"Reading PRG banks #{bank}/{banks}... ");
- dumper.WriteCpu(0x8000, new byte[] { 6, (byte)bank });
+ dumper.WriteCpu(0x8000, 6, (byte)bank);
data.AddRange(dumper.ReadCpu(0x8000, 0x2000));
Console.WriteLine("OK");
}
@@ -51,7 +51,7 @@
for (var bank = 0; bank < banks; bank++)
{
Console.Write($"Reading CHR banks #{bank}/{banks}... ");
- dumper.WriteCpu(0x8000, new byte[] { 2, (byte)bank });
+ dumper.WriteCpu(0x8000, 2, (byte)bank);
data.AddRange(dumper.ReadPpu(0x1000, 0x0400));
Console.WriteLine("OK");
}
diff --git a/FamicomDumper/mappers/Sunsoft5A-5B-FME7.cs b/FamicomDumper/mappers/Sunsoft5A-5B-FME7.cs
index 9db9a3e..6fc9c42 100644
--- a/FamicomDumper/mappers/Sunsoft5A-5B-FME7.cs
+++ b/FamicomDumper/mappers/Sunsoft5A-5B-FME7.cs
@@ -66,4 +66,4 @@
{
return NesFile.MirroringType.MapperControlled;
}
-}
+}
diff --git a/FamicomDumper/scripts/DemoScript.cs b/FamicomDumper/scripts/DemoScript.cs
index 7a63d22..664be3d 100644
--- a/FamicomDumper/scripts/DemoScript.cs
+++ b/FamicomDumper/scripts/DemoScript.cs
@@ -17,7 +17,7 @@
{
if (bank > 256) throw new InvalidDataException("Bank number out of range, did you actually insert the MMC3 cartridge?");
Console.Write($"Reading PRG bank #{bank}... ");
- dumper.WriteCpu(0x8000, new byte[] { 6, (byte)bank });
+ dumper.WriteCpu(0x8000, 6, (byte)bank);
var data = dumper.ReadCpu(0x8000, 0x2000);
Console.WriteLine("OK");
if (bank == 0)
@@ -34,7 +34,7 @@
{
if (bank > 256) throw new InvalidDataException("Bank number out of range, did you actually insert the MMC3 cartridge?");
Console.Write($"Reading CHR bank #{bank}... ");
- dumper.WriteCpu(0x8000, new byte[] { 2, (byte)bank });
+ dumper.WriteCpu(0x8000, 2, (byte)bank);
var data = dumper.ReadPpu(0x1000, 0x0400);
Console.WriteLine("OK");
if (bank == 0)
diff --git a/FamicomDumper/scripts/FdsSpeedMeasure.cs b/FamicomDumper/scripts/FdsSpeedMeasure.cs
index 5c4d701..93af05c 100644
--- a/FamicomDumper/scripts/FdsSpeedMeasure.cs
+++ b/FamicomDumper/scripts/FdsSpeedMeasure.cs
@@ -36,11 +36,11 @@ class FdsSpeedMeasure
dumper.WriteCpu(0x4026, 0x00);
dumper.WriteCpu(0x4025, /*0b00100110*/ 0x26); // reset
dumper.WriteCpu(0x0000, 0xFF); // to prevent open bus read
- var ext = dumper.ReadCpu(0x4033, 1)[0];
+ var ext = dumper.ReadCpu(0x4033);
if (ext != 0x00) ramAdapterPresent = false;
dumper.WriteCpu(0x4026, 0xFF);
dumper.WriteCpu(0x0000, 0x00); // to prevent open bus read
- ext = dumper.ReadCpu(0x4033, 1)[0];
+ ext = dumper.ReadCpu(0x4033);
if ((ext & 0x7F) != 0x7F) ramAdapterPresent = false;
if (!ramAdapterPresent) throw new IOException("Famicom Disk System RAM adapter IO error, is it connected?");
@@ -48,7 +48,7 @@ class FdsSpeedMeasure
dumper.WriteCpu(0x4025, 0b00100101); // enable motor without data transfer
Thread.Sleep(100);
// Check battery health
- ext = dumper.ReadCpu(0x4033, 1)[0];
+ ext = dumper.ReadCpu(0x4033);
if ((ext & 0x80) == 0) throw new IOException("Battery voltage is low or power supply is not connected");
Console.WriteLine("Measuring FDS drive speed, make sure that disk card is inserted and wait. Press ENTER to stop.");
@@ -75,7 +75,7 @@ class FdsSpeedMeasure
dumper.WriteCpu(0x4025, 0b00100101); // enable motor without data transfer
// Wait for ready state
- while ((dumper.ReadCpu(0x4032, 1)[0] & 2) != 0)
+ while ((dumper.ReadCpu(0x4032) & 2) != 0)
{
if (cancellationToken.IsCancellationRequested) return;
await Task.Delay(1);