forked from mamedev/mame
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- 5.9.0.0 Supported NanoDrive 6 UART for OPN2, DCSG.
- Loading branch information
1 parent
d42f2ac
commit 5f679fe
Showing
18 changed files
with
573 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
using FTD2XX_NET; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics; | ||
using System.IO.Ports; | ||
using System.Linq; | ||
using System.Runtime.InteropServices; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace zanac.VGMPlayer | ||
{ | ||
public class PortWriterNanoDrive : PortWriter | ||
{ | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
/// <param name="serialPort"></param> | ||
public PortWriterNanoDrive(SerialPort serialPort) : base(serialPort) | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// | ||
/// </summary> | ||
/// <param name="ftdiPort"></param> | ||
public PortWriterNanoDrive(FTDI ftdiPort, PortId portNo) : base(ftdiPort, portNo) | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// | ||
/// </summary> | ||
/// <param name="type"></param> | ||
/// <param name="address"></param> | ||
/// <param name="data"></param> | ||
/// <param name="wait"></param> | ||
public override void Write(PortWriteData[] data) | ||
{ | ||
try | ||
{ | ||
List<byte> ds = new List<byte>(); | ||
foreach (var dt in data) | ||
{ | ||
switch (dt.Type) | ||
{ | ||
//PSG (SN76489/SN76496) write value dd | ||
case 0x50: | ||
ds.Add(dt.Type); | ||
ds.Add(dt.Data); | ||
break; | ||
//YM2612 port 0, write value dd to register aa | ||
case 0x52: | ||
//YM2612 port 1, write value dd to register aa | ||
case 0x53: | ||
ds.Add(dt.Type); | ||
ds.Add(dt.Address); | ||
ds.Add(dt.Data); | ||
break; | ||
} | ||
} | ||
|
||
byte[] dsa = ds.ToArray(); | ||
lock (LockObject) | ||
SerialPort?.Write(dsa, 0, dsa.Length); | ||
} | ||
catch (Exception ex) | ||
{ | ||
if (ex.GetType() == typeof(Exception)) | ||
throw; | ||
else if (ex.GetType() == typeof(SystemException)) | ||
throw; | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// | ||
/// </summary> | ||
/// <param name="data"></param> | ||
/// <param name="wait"></param> | ||
public override void RawWrite(byte[] data, int[] wait) | ||
{ | ||
try | ||
{ | ||
lock (LockObject) | ||
SerialPort?.Write(data, 0, data.Length); | ||
} | ||
catch (Exception ex) | ||
{ | ||
if (ex.GetType() == typeof(Exception)) | ||
throw; | ||
else if (ex.GetType() == typeof(SystemException)) | ||
throw; | ||
} | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.