diff --git a/README.md b/README.md index 8c164dbab0bc5..e8fa6e8e4ba96 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -MAmidiMEmo 5.7.1.1 Itoken (c)2019, 2024 / GPL-2.0 +MAmidiMEmo 5.7.1.2 Itoken (c)2019, 2024 / GPL-2.0 *** What is the MAmidiMEmo? *** @@ -274,6 +274,7 @@ e.g.) YM2151 has 8ch FM sounds, so you can play 8 chords on MIDI 1ch or sharing [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=SNQ9JE3JAQMNQ) *** Changes +5.7.1.2 Updated VGMPlayer(only) to support MSXturboR DAC to play SEGA PCM, K053260, OKIM6285. 5.7.1.1 Re-improved Hi-DPI screen handling. 5.7.1.0 Improved Hi-DPI screen handling. 5.7.0.0 Supported \*.mop\* file importing on TimbreManager. diff --git a/src/VSIF/VGMPlay_MSX/VGM_msx.rom b/src/VSIF/VGMPlay_MSX/VGM_msx.rom index c425946f7a89e..03d43142c3e9d 100644 Binary files a/src/VSIF/VGMPlay_MSX/VGM_msx.rom and b/src/VSIF/VGMPlay_MSX/VGM_msx.rom differ diff --git a/src/VSIF/VGMPlay_MSX/VGM_msx_Vkey.rom b/src/VSIF/VGMPlay_MSX/VGM_msx_Vkey.rom index 12e676e8d19ed..77521a307d1f2 100644 Binary files a/src/VSIF/VGMPlay_MSX/VGM_msx_Vkey.rom and b/src/VSIF/VGMPlay_MSX/VGM_msx_Vkey.rom differ diff --git a/src/VSIF/VGMPlay_MSX/const.inc b/src/VSIF/VGMPlay_MSX/const.inc index 52dfc30099a29..ec248c57b32c2 100644 --- a/src/VSIF/VGMPlay_MSX/const.inc +++ b/src/VSIF/VGMPlay_MSX/const.inc @@ -20,6 +20,8 @@ OPN2WR2 = #0x17 ;:OPN2 ch4-6 data(W) OPNAD = #0x12 ;:OPN ch1-3 address(W) / status(R) OPNWR = #0x13 ;:OPN ch1-3 data(W) +TRDAC = #0xA4 + WRSLT = #0x14 RDSLT = #0x0c ENASLT = #0x24 diff --git a/src/VSIF/VGMPlay_MSX/copy.bat b/src/VSIF/VGMPlay_MSX/copy.bat index 348474326da57..90b6671af72e3 100644 --- a/src/VSIF/VGMPlay_MSX/copy.bat +++ b/src/VSIF/VGMPlay_MSX/copy.bat @@ -1,3 +1,3 @@ -if exist G:\ copy VGM_msx.rom G:\DATA\ROMS\ -if exist F:\ copy VGM_msx.rom F:\DATA\ROMS\ +if exist I:\ copy VGM_msx.rom I:\ROMS\ +rem if exist F:\ copy VGM_msx.rom F:\DATA\ROMS\ rem copy VGMPlay_msx.rom \\192.168.1.66\DavWWWRoot diff --git a/src/VSIF/VGMPlay_MSX/macro.inc b/src/VSIF/VGMPlay_MSX/macro.inc index a0bbb2726f5b9..f856627cb6465 100644 --- a/src/VSIF/VGMPlay_MSX/macro.inc +++ b/src/VSIF/VGMPlay_MSX/macro.inc @@ -172,6 +172,7 @@ __WRITE_PSG_IO: LD L,#0 ; ;Zero clear JP (HL) ; 94 .endm + ;======================================================= .macro __WRITE_OPLL_IO @@ -764,6 +765,43 @@ __WRITE_OPN2_DAC: .endm ;======================================================= + .macro __WRITE_TR_DAC +__WRITE_TR_DAC: + LD C,#14 ; 7 14 + LD B,#0 ; 7 14 +0$: +;======================= + READ_DATA ; 55 + + LD A,B ; 5 60 + OUT (PSGAD),A ; 12 72 + + LD A,D ; 5 77 + OUT (TRDAC),A ; 12 89 + + ; JOY2 Pin Read Mode + LD A,C ; 5 94 + OUT (PSGAD),A ; 12 106 + + ; Continuous Write + LD E,#0x1F ; 30 85 +;======================= +1$: + IN A,(PSGRD) ; + AND #0x20 ; + JP Z, 1$ ; + IN A,(PSGRD) ; + AND E ; + CP E ; + JP Z,0$ ; ; Continuous Write + + OR #JPOFST ; + LD H,A ; + LD L,#0 ; + JP (HL) ; 90 ; Jump to other ID + .endm +;======================================================= + ;==================================================================== ;(参考)P0/P2のBIOSコールを使わないスロット切り替えルーチン ;==================================================================== diff --git a/src/VSIF/VGMPlay_MSX/uart-4800.asm b/src/VSIF/VGMPlay_MSX/uart-4800.asm index a22e1a684528b..1b74b625e015f 100644 --- a/src/VSIF/VGMPlay_MSX/uart-4800.asm +++ b/src/VSIF/VGMPlay_MSX/uart-4800.asm @@ -70,6 +70,10 @@ tR_mode: LD IY,(EXPTBL) CALL CALSLT ;CALSLT + ;PCM MUTE=OFF,ADDABUFF=SINGLE + LD A,#3 + OUT (#0xA5),A + LD HL,#STR_TR CALL STRPUT JP endCheckCPU @@ -349,7 +353,7 @@ __ENA_SCC: ;======================================================= .ORG 0x7500 - JP __VGM_LOOP ; + __WRITE_TR_DAC ;======================================================= .ORG 0x7600 diff --git a/src/VSIF/VGMPlay_MSX/uart-4800_p2.asm b/src/VSIF/VGMPlay_MSX/uart-4800_p2.asm index 821936faa307e..ff74fd45c4c32 100644 --- a/src/VSIF/VGMPlay_MSX/uart-4800_p2.asm +++ b/src/VSIF/VGMPlay_MSX/uart-4800_p2.asm @@ -216,7 +216,7 @@ __SELECT_SCC_SLOT: ;======================================================= .ORG 0xB500 - JP __VGM_LOOP ; + __WRITE_TR_DAC ;======================================================= .ORG 0xB600 diff --git a/src/VSIF/VGMPlay_MSX/uart-4800_p2.rel b/src/VSIF/VGMPlay_MSX/uart-4800_p2.rel index 7ffbd5b4656b2..4e1de33b61504 100644 --- a/src/VSIF/VGMPlay_MSX/uart-4800_p2.rel +++ b/src/VSIF/VGMPlay_MSX/uart-4800_p2.rel @@ -90,7 +90,7 @@ A _HEADER214 size 3D flags 8 addr B300 S A$uart-4800_p2$211 Def00B300 A _HEADER215 size 3D flags 8 addr B400 S A$uart-4800_p2$215 Def00B400 -A _HEADER216 size 3 flags 8 addr B500 +A _HEADER216 size 43 flags 8 addr B500 S A$uart-4800_p2$219 Def00B500 A _HEADER217 size 3 flags 8 addr B600 S A$uart-4800_p2$223 Def00B600 @@ -788,8 +788,32 @@ T 35 B4 00 04 B4 F6 A0 67 2E 00 E9 R 00 00 17 00 00 03 17 00 T 00 B5 00 R 00 00 18 00 -T 00 B5 00 C3 0E 90 -R 00 00 18 00 00 04 02 00 +T 00 B5 00 +R 00 00 18 00 +T 00 B5 00 0E 0E 06 00 +R 00 00 18 00 +T 04 B5 00 +R 00 00 18 00 +T 04 B5 00 26 10 +R 00 00 18 00 +T 06 B5 00 +R 00 00 18 00 +T 06 B5 00 DB A2 A4 C2 06 B5 DB A2 57 CB 22 CB 22 +R 00 00 18 00 00 07 18 00 +T 13 B5 00 CB 22 CB 22 1E 0F +R 00 00 18 00 +T 19 B5 00 +R 00 00 18 00 +T 19 B5 00 DB A2 A4 CA 19 B5 DB A2 A3 B2 57 78 D3 +R 00 00 18 00 00 07 18 00 +T 26 B5 00 A0 7A D3 A4 79 D3 A0 1E 1F +R 00 00 18 00 +T 2F B5 00 +R 00 00 18 00 +T 2F B5 00 DB A2 E6 20 CA 2F B5 DB A2 A3 BB CA +R 00 00 18 00 00 08 18 00 +T 3B B5 00 04 B5 F6 A0 67 2E 00 E9 +R 00 00 18 00 00 03 18 00 T 00 B6 00 R 00 00 19 00 T 00 B6 00 C3 0E 90 diff --git a/src/VSIF/VGMPlayer/DacStream.cs b/src/VSIF/VGMPlayer/DacStream.cs index 7fb77966ca0ef..4db10483961f9 100644 --- a/src/VSIF/VGMPlayer/DacStream.cs +++ b/src/VSIF/VGMPlayer/DacStream.cs @@ -162,6 +162,18 @@ public void StreamSong() byte bdata = (byte)((ddata >> 8)); parentSong.DeferredWriteOPNA_DAC(comPortOPNA, bdata); } + else + { + foreach (var c in VsifManager.GetVsifClients()) + { + if (c.SoundModuleType == VsifSoundModuleType.TurboR_FTDI && c.Tag.ContainsKey("ProxyOKIM6258")) + { + byte bdata = (byte)((ddata >> 8) + 128); + parentSong.DeferredWriteTurboR_DAC(c, bdata); + break; + } + } + } pd.StreamIdx -= pd.StreamIdxDir; pd.Oki6285Adpcm2ndNibble = true; } @@ -182,6 +194,18 @@ public void StreamSong() byte bdata = (byte)((ddata >> 8)); parentSong.DeferredWriteOPNA_DAC(comPortOPNA, bdata); } + else + { + foreach (var c in VsifManager.GetVsifClients()) + { + if (c.SoundModuleType == VsifSoundModuleType.TurboR_FTDI) + { + byte bdata = (byte)((ddata >> 8) + 128); + parentSong.DeferredWriteTurboR_DAC(c, bdata); + break; + } + } + } pd.Oki6285Adpcm2ndNibble = false; } } diff --git a/src/VSIF/VGMPlayer/FormMain.Designer.cs b/src/VSIF/VGMPlayer/FormMain.Designer.cs index c9450c485359a..82361afebe6d9 100644 --- a/src/VSIF/VGMPlayer/FormMain.Designer.cs +++ b/src/VSIF/VGMPlayer/FormMain.Designer.cs @@ -1170,7 +1170,8 @@ private void InitializeComponent() this.comboBoxSCC.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboBoxSCC.FormattingEnabled = true; this.comboBoxSCC.Items.AddRange(new object[] { - "VSIF - MSX(FTDI2XX Clk: 232R=25~,H=32~)"}); + "VSIF - MSX(FTDI2XX Clk: 232R=25~,H=32~)", + "VSIF - turboR(FTDI2XX Clk: 232R=8~,H=9~)"}); this.comboBoxSCC.Location = new System.Drawing.Point(3, 3); this.comboBoxSCC.Name = "comboBoxSCC"; this.comboBoxSCC.Size = new System.Drawing.Size(204, 20); @@ -1581,7 +1582,8 @@ private void InitializeComponent() "VSIF - SMS(UART 115Kbps)", "VSIF - MD/Genesis(UART 115Kbps)", "VSIF - MSX(FTDI2XX Clk: 232R=25~,H=32~)", - "VSIF - SMS(FTDI2XX Clk: 232R=20~,H=25~)"}); + "VSIF - SMS(FTDI2XX Clk: 232R=20~,H=25~)", + "VSIF - turboR(FTDI2XX Clk: 232R=8~,H=9~)"}); this.comboBoxDCSG.Location = new System.Drawing.Point(163, 50); this.comboBoxDCSG.Name = "comboBoxDCSG"; this.comboBoxDCSG.Size = new System.Drawing.Size(336, 20); @@ -2161,7 +2163,8 @@ private void InitializeComponent() this.comboBoxY8910.FormattingEnabled = true; this.comboBoxY8910.Items.AddRange(new object[] { "VSIF - MSX/PC-6001(FTDI2XX Clk: 232R=25~,H=32~)", - "VSIF - Generic(UART 115Kbps)"}); + "VSIF - Generic(UART 115Kbps)", + "VSIF - turboR(FTDI2XX Clk: 232R=8~,H=9~)"}); this.comboBoxY8910.Location = new System.Drawing.Point(163, 128); this.comboBoxY8910.Name = "comboBoxY8910"; this.comboBoxY8910.Size = new System.Drawing.Size(336, 20); @@ -2539,7 +2542,8 @@ private void InitializeComponent() "VSIF - MD/Genesis(UART 163Kbps)", "VSIF - MD/Genesis(FTDI2XX Clk: 232R=8~,H=9~)", "VSIF - MD/Genesis(UART 115Kbps)", - "VSIF - MSX/PC-6001(FTDI2XX Clk: 232R=25~,H=32~)"}); + "VSIF - MSX/PC-6001(FTDI2XX Clk: 232R=25~,H=32~)", + "VSIF - turboR(FTDI2XX Clk: 232R=8~,H=9~)"}); this.comboBoxOPN2.Location = new System.Drawing.Point(163, 24); this.comboBoxOPN2.Name = "comboBoxOPN2"; this.comboBoxOPN2.Size = new System.Drawing.Size(336, 20); @@ -3182,7 +3186,8 @@ private void InitializeComponent() "VSIF - MSX(FTDI2XX Clk: 232R=25~,H=32~)", "SPFM Light - 4759 Player", "SPFM - 4759 Player", - "G.I.M.I.C"}); + "G.I.M.I.C", + "VSIF - turboR(FTDI2XX Clk: 232R=8~,H=9~)"}); this.comboBoxOPM.Location = new System.Drawing.Point(3, 3); this.comboBoxOPM.Name = "comboBoxOPM"; this.comboBoxOPM.Size = new System.Drawing.Size(205, 20); @@ -3228,7 +3233,8 @@ private void InitializeComponent() this.comboBoxOPLL.Items.AddRange(new object[] { "VSIF - SMS(UART 115Kbps)", "VSIF - MSX(FTDI2XX Clk: 232R=25~,H=32~)", - "VSIF - SMS(FTDI2XX Clk: 232R=20~,H=25~)"}); + "VSIF - SMS(FTDI2XX Clk: 232R=20~,H=25~)", + "VSIF - turboR(FTDI2XX Clk: 232R=8~,H=9~)"}); this.comboBoxOPLL.Location = new System.Drawing.Point(3, 3); this.comboBoxOPLL.Name = "comboBoxOPLL"; this.comboBoxOPLL.Size = new System.Drawing.Size(204, 20); @@ -3269,7 +3275,8 @@ private void InitializeComponent() this.comboBoxOPL3.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboBoxOPL3.FormattingEnabled = true; this.comboBoxOPL3.Items.AddRange(new object[] { - "VSIF - MSX(FTDI2XX Clk: 232R=25~,H=32~)"}); + "VSIF - MSX(FTDI2XX Clk: 232R=25~,H=32~)", + "VSIF - turboR(FTDI2XX Clk: 232R=8~,H=9~)"}); this.comboBoxOPL3.Location = new System.Drawing.Point(163, 180); this.comboBoxOPL3.Name = "comboBoxOPL3"; this.comboBoxOPL3.Size = new System.Drawing.Size(336, 20); @@ -3582,7 +3589,8 @@ private void InitializeComponent() "SPFM Light - 4759 Player", "SPFM - 4759 Player", "G.I.M.I.C", - "VSIF - PC-8801 V2(FTDI2XX Clk: 232R=10~,H=20~)"}); + "VSIF - PC-8801 V2(FTDI2XX Clk: 232R=10~,H=20~)", + "VSIF - turboR(FTDI2XX Clk: 232R=8~,H=9~)"}); this.comboBoxOPNA.Location = new System.Drawing.Point(163, 206); this.comboBoxOPNA.Name = "comboBoxOPNA"; this.comboBoxOPNA.Size = new System.Drawing.Size(336, 20); @@ -4192,7 +4200,8 @@ private void InitializeComponent() this.comboBoxY8950.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboBoxY8950.FormattingEnabled = true; this.comboBoxY8950.Items.AddRange(new object[] { - "VSIF - MSX(FTDI2XX Clk: 232R=25~,H=32~)"}); + "VSIF - MSX(FTDI2XX Clk: 232R=25~,H=32~)", + "VSIF - turboR(FTDI2XX Clk: 232R=8~,H=9~)"}); this.comboBoxY8950.Location = new System.Drawing.Point(3, 3); this.comboBoxY8950.Name = "comboBoxY8950"; this.comboBoxY8950.Size = new System.Drawing.Size(205, 20); @@ -4247,7 +4256,8 @@ private void InitializeComponent() this.comboBoxOPN.FormattingEnabled = true; this.comboBoxOPN.Items.AddRange(new object[] { "VSIF - MSX/PC-6001(FTDI2XX Clk: 232R=25~,H=32~)", - "VSIF - PC-8801 V2(FTDI2XX Clk: 232R=10~,H=20~)"}); + "VSIF - PC-8801 V2(FTDI2XX Clk: 232R=10~,H=20~)", + "VSIF - turboR(FTDI2XX Clk: 232R=8~,H=9~)"}); this.comboBoxOPN.Location = new System.Drawing.Point(163, 258); this.comboBoxOPN.Name = "comboBoxOPN"; this.comboBoxOPN.Size = new System.Drawing.Size(336, 20); @@ -5480,7 +5490,8 @@ private void InitializeComponent() this.comboBoxSAA.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboBoxSAA.FormattingEnabled = true; this.comboBoxSAA.Items.AddRange(new object[] { - "VSIF - MSX(FTDI2XX Clk: 232R=25~,H=32~)"}); + "VSIF - MSX(FTDI2XX Clk: 232R=25~,H=32~)", + "VSIF - turboR(FTDI2XX Clk: 232R=8~,H=9~)"}); this.comboBoxSAA.Location = new System.Drawing.Point(163, 336); this.comboBoxSAA.Name = "comboBoxSAA"; this.comboBoxSAA.Size = new System.Drawing.Size(336, 20); @@ -5840,7 +5851,7 @@ private void InitializeComponent() this.KeyPreview = true; this.MainMenuStrip = this.menuStrip1; this.Name = "FormMain"; - this.Text = "Real chip VGM/XGM/MGS player V1.71 by Itoken"; + this.Text = "Real chip VGM/XGM/MGS player V1.72 by Itoken"; this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.FormMain_KeyDown); this.menuStrip1.ResumeLayout(false); this.menuStrip1.PerformLayout(); diff --git a/src/VSIF/VGMPlayer/FormMain.cs b/src/VSIF/VGMPlayer/FormMain.cs index 35d1ddeaa5bbc..9388c5c22d75d 100644 --- a/src/VSIF/VGMPlayer/FormMain.cs +++ b/src/VSIF/VGMPlayer/FormMain.cs @@ -765,6 +765,10 @@ private void checkBoxCnnSAA_CheckedChanged(object sender, EventArgs e) comPortSAA = VsifManager.TryToConnectVSIF(VsifSoundModuleType.MSX_FTDI, (PortId)Settings.Default.SAA_Port, (int)Settings.Default.SAA_Div, false); break; + case 1: + comPortSAA = VsifManager.TryToConnectVSIF(VsifSoundModuleType.TurboR_FTDI, + (PortId)Settings.Default.SAA_Port, (int)Settings.Default.SAA_Div, false); + break; } checkBoxConnSAA.Checked = comPortSAA != null; @@ -843,6 +847,10 @@ private void checkBoxConnDCSG_CheckedChanged(object sender, EventArgs e) comPortDCSG = VsifManager.TryToConnectVSIF(VsifSoundModuleType.SMS_FTDI, (PortId)Settings.Default.DCSG_Port, (int)Settings.Default.DCSGDiv, false); break; + case 6: + comPortDCSG = VsifManager.TryToConnectVSIF(VsifSoundModuleType.TurboR_FTDI, + (PortId)Settings.Default.DCSG_Port, (int)Settings.Default.DCSGDiv, false); + break; } checkBoxConnDCSG.Checked = comPortDCSG != null; @@ -882,6 +890,12 @@ private void checkBoxConnOPLL_CheckedChanged(object sender, EventArgs e) comPortOPLL = VsifManager.TryToConnectVSIF(VsifSoundModuleType.SMS_FTDI, (PortId)Settings.Default.OPLL_Port, (int)Settings.Default.OPLLDiv, false); break; + case 3: + comPortOPLL = VsifManager.TryToConnectVSIF(VsifSoundModuleType.TurboR_FTDI, + (PortId)Settings.Default.OPLL_Port, (int)Settings.Default.OPLLDiv, false); + if (comPortOPLL != null) + comPortOPLL.Tag["OPLL.Slot"] = comboBoxOpllSlot.SelectedIndex; + break; } checkBoxConnOPLL.Checked = comPortOPLL != null; @@ -925,6 +939,10 @@ private void checkBoxConnOPN2_CheckedChanged(object sender, EventArgs e) comPortOPN2 = VsifManager.TryToConnectVSIF(VsifSoundModuleType.MSX_FTDI, (PortId)Settings.Default.OPN2_Port, (int)Settings.Default.OPN2Div, false); break; + case 4: + comPortOPN2 = VsifManager.TryToConnectVSIF(VsifSoundModuleType.TurboR_FTDI, + (PortId)Settings.Default.OPN2_Port, (int)Settings.Default.OPN2Div, false); + break; } checkBoxConnOPN2.Checked = comPortOPN2 != null; comboBoxOPN2.Enabled = comPortOPN2 == null; @@ -958,6 +976,10 @@ private void checkBoxConnOPN_CheckedChanged(object sender, EventArgs e) comPortOPN = VsifManager.TryToConnectVSIF(VsifSoundModuleType.PC88_FTDI, (PortId)Settings.Default.OPN_Port, (int)Settings.Default.OPNDiv, false); break; + case 2: + comPortOPN = VsifManager.TryToConnectVSIF(VsifSoundModuleType.TurboR_FTDI, + (PortId)Settings.Default.OPN_Port, (int)Settings.Default.OPNDiv, false); + break; } checkBoxConnOPN.Checked = comPortOPN != null; comboBoxOPN.Enabled = comPortOPN == null; @@ -994,6 +1016,18 @@ private void checkBoxConnSCC_CheckedChanged(object sender, EventArgs e) comPortSCC.Tag["SCC.Slot"] = SCCSlotNo[comboBoxSccSlot.SelectedIndex - 2]; } break; + case 1: + comPortSCC = VsifManager.TryToConnectVSIF(VsifSoundModuleType.TurboR_FTDI, + (PortId)Settings.Default.SCC_Port, (int)Settings.Default.SCCDiv, false); + if (comPortSCC != null) + { + comPortSCC.Tag["SCC.Type"] = (SCCType)(comboBoxSccType.SelectedIndex + 1); + if (comboBoxSccSlot.SelectedIndex < 2) + comPortSCC.Tag["SCC.Slot"] = comboBoxSccSlot.SelectedIndex - 2; + else + comPortSCC.Tag["SCC.Slot"] = SCCSlotNo[comboBoxSccSlot.SelectedIndex - 2]; + } + break; } checkBoxConnSCC.Checked = comPortSCC != null; comboBoxSCC.Enabled = comPortSCC == null; @@ -1067,6 +1101,10 @@ private void checkBoxConnY8910_CheckedChanged(object sender, EventArgs e) comPortY8910 = VsifManager.TryToConnectVSIF(VsifSoundModuleType.Generic_UART, (PortId)Settings.Default.Y8910_Port, (int)Settings.Default.PSGDiv, false); break; + case 2: + comPortY8910 = VsifManager.TryToConnectVSIF(VsifSoundModuleType.TurboR_FTDI, + (PortId)Settings.Default.Y8910_Port, (int)Settings.Default.PSGDiv, false); + break; } checkBoxConnY8910.Checked = comPortY8910 != null; comboBoxY8910.Enabled = comPortY8910 == null; @@ -1122,6 +1160,15 @@ private void checkBoxConnOPM_CheckedChanged(object sender, EventArgs e) comPortOPM = VsifManager.TryToConnectVSIF(VsifSoundModuleType.Gimic, (PortId)Settings.Default.OPM_Port, (int)Settings.Default.OPMDiv, false); break; + case 4: + comPortOPM = VsifManager.TryToConnectVSIF(VsifSoundModuleType.TurboR_FTDI, + (PortId)Settings.Default.OPM_Port, (int)Settings.Default.OPMDiv, false); + if (comPortOPM != null) + { + comPortOPM.Tag["OPM.Slot"] = comboBoxOpmSlot.SelectedIndex; + comPortOPM.DeferredWriteData(0xd, 0, (byte)comboBoxOpmSlot.SelectedIndex, (int)Settings.Default.BitBangWaitOPM); + } + break; } checkBoxConnOPM.Checked = comPortOPM != null; comboBoxOPM.Enabled = comPortOPM == null; @@ -1152,6 +1199,10 @@ private void checkBoxConnOPL3_CheckedChanged(object sender, EventArgs e) comPortOPL3 = VsifManager.TryToConnectVSIF(VsifSoundModuleType.MSX_FTDI, (PortId)Settings.Default.OPL3_Port, (int)Settings.Default.OPL3Div, false); break; + case 1: + comPortOPL3 = VsifManager.TryToConnectVSIF(VsifSoundModuleType.TurboR_FTDI, + (PortId)Settings.Default.OPL3_Port, (int)Settings.Default.OPL3Div, false); + break; } checkBoxConnOPL3.Checked = comPortOPL3 != null; comboBoxOPL3.Enabled = comPortOPL3 == null; @@ -1196,6 +1247,10 @@ private void checkBoxOPNA_CheckedChanged(object sender, EventArgs e) comPortOPNA = VsifManager.TryToConnectVSIF(VsifSoundModuleType.PC88_FTDI, (PortId)Settings.Default.OPNA_Port, (int)Settings.Default.OPNADiv, false); break; + case 5: + comPortOPNA = VsifManager.TryToConnectVSIF(VsifSoundModuleType.TurboR_FTDI, + (PortId)Settings.Default.OPNA_Port, (int)Settings.Default.OPNADiv, false); + break; } checkBoxConnOPNA.Checked = comPortOPNA != null; comboBoxOPNA.Enabled = comPortOPNA == null; @@ -1227,6 +1282,12 @@ private void checkBoxConnY8950_CheckedChanged(object sender, EventArgs e) if (comPortY8950 != null) comPortY8950.Tag["Y8950.Slot"] = comboBoxY8950Slot.SelectedIndex; break; + case 1: + comPortY8950 = VsifManager.TryToConnectVSIF(VsifSoundModuleType.TurboR_FTDI, + (PortId)Settings.Default.Y8950_Port, (int)Settings.Default.Y8950Div, false); + if (comPortY8950 != null) + comPortY8950.Tag["Y8950.Slot"] = comboBoxY8950Slot.SelectedIndex; + break; } checkBoxConnY8950.Checked = comPortY8950 != null; comboBoxY8950.Enabled = comPortY8950 == null; diff --git a/src/VSIF/VGMPlayer/FormMain.resx b/src/VSIF/VGMPlayer/FormMain.resx index 1b5e17f61d4cb..958f3b4197a01 100644 --- a/src/VSIF/VGMPlayer/FormMain.resx +++ b/src/VSIF/VGMPlayer/FormMain.resx @@ -128,7 +128,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAD+ - ZQAAAk1TRnQBSQFMAgEBCgEAAUgBGQFIARkBIAEAASABAAT/ASEBAAj/AUIBTQE2BwABNgMAASgDAAGA + ZQAAAk1TRnQBSQFMAgEBCgEAAZABGQGQARkBIAEAASABAAT/ASEBAAj/AUIBTQE2BwABNgMAASgDAAGA AwABYAMAAQEBAAEgBgABwMIAA3kB/wNbAf8BTQFMAU0B/wNLAf8BTQFMAU0B/wNZAf8DdwH/A6IB//8A 1QADcwH/A0wB/wNLAf8DSwH/A0sB/wNLAf8DSwH/A0sB/wNLAf8DSwH/A0sB/wNLAf8DbQH//wDFAAN+ Af8DSwH/A0sB/wNLAf8DTwH/A3QB/wOaAf8MAAKaAZsB/wN4Af8DUAH/A0sB/wNLAf8DSwH/A3kB//8A @@ -577,7 +577,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAB6 - aQAAAk1TRnQBSQFMAgEBAgEAAUgBGQFIARkBQAEAAUABAAT/ASEBAAj/AUIBTQE2BwABNgMAASgEAAEB + aQAAAk1TRnQBSQFMAgEBAgEAAZABGQGQARkBQAEAAUABAAT/ASEBAAj/AUIBTQE2BwABNgMAASgEAAEB AgABQAMAAQEBAAEgBwABAWUAAwYBBwMSARcDHAEnAyUBNgM+AWoDRwGBA04BmANVAa8DWwHFA14B3QNg AfMDYAHzA14B3QNbAcUDVQGvA04BmANHAYEDPgFqAyUBNgMcAScDEgEXAwYBB6gAAwYBBwMSARcDHAEn AyUBNgM+AWoDRwGBA04BmANVAa8DWwHFA14B3QNgAfMDYAHzA14B3QNbAcUDVQGvA04BmANHAYEDPgFq diff --git a/src/VSIF/VGMPlayer/K053260.cs b/src/VSIF/VGMPlayer/K053260.cs index c6fe8eb0d35a0..805c42f586102 100644 --- a/src/VSIF/VGMPlayer/K053260.cs +++ b/src/VSIF/VGMPlayer/K053260.cs @@ -121,13 +121,23 @@ public void StreamSong() parentSong.DeferredWriteOPNA_DAC(vsifClient, dt); } + else if (vsifClient.SoundModuleType == VsifSoundModuleType.TurboR_FTDI && vsifClient.Tag.ContainsKey("ProxyK053260")) + { + int dt = ((dtL + dtR) / 2) >> 8; + + if (dt > sbyte.MaxValue) + dt = sbyte.MaxValue; + else if (dt < sbyte.MinValue) + dt = sbyte.MinValue; + parentSong.DeferredWriteTurboR_DAC(vsifClient, (byte)(dt + 128)); + } } QueryPerformanceCounter(out after); double nextTime = dbefore + ((double)freq / (sampleRate / (double)multiply)); while (after < nextTime) QueryPerformanceCounter(out after); - dbefore = nextTime ; + dbefore = nextTime; } } diff --git a/src/VSIF/VGMPlayer/OKIM6295.cs b/src/VSIF/VGMPlayer/OKIM6295.cs index d39170eff97c4..abb2a1bf2ad79 100644 --- a/src/VSIF/VGMPlayer/OKIM6295.cs +++ b/src/VSIF/VGMPlayer/OKIM6295.cs @@ -154,6 +154,16 @@ public void StreamSong() parentSong.DeferredWriteOPNA_DAC(vsifClient, dt); } + else if (vsifClient.SoundModuleType == VsifSoundModuleType.TurboR_FTDI && vsifClient.Tag.ContainsKey("ProxyOKIM6295")) + { + int dt = ((dtL + dtR) / 2) >> 8; + + if (dt > sbyte.MaxValue) + dt = sbyte.MaxValue; + else if (dt < sbyte.MinValue) + dt = sbyte.MinValue; + parentSong.DeferredWriteTurboR_DAC(vsifClient, (byte)(dt + 128)); + } } QueryPerformanceCounter(out after); diff --git a/src/VSIF/VGMPlayer/PortWriterMsx.cs b/src/VSIF/VGMPlayer/PortWriterMsx.cs index 18ea6708cfdb1..000721533221d 100644 --- a/src/VSIF/VGMPlayer/PortWriterMsx.cs +++ b/src/VSIF/VGMPlayer/PortWriterMsx.cs @@ -177,6 +177,27 @@ public override void Write(PortWriteData[] data) lastDataType = dt.Type; lastWriteAddress = dt.Address; break; + case 0x15: + if (lastWriteAddress == 0x0 && //tR DAC write + lastDataType == dt.Type && (ushort)dt.Address == ((ushort)lastWriteAddress)) + { + byte[] sd = new byte[3] { + (byte)(0x1f | 0x20), + (byte)((dt.Data >> 4) | 0x00), (byte)((dt.Data & 0x0f) | 0x10), + }; + ds.AddRange(sd); + } + else + { + byte[] sd = new byte[3] { + (byte)(dt.Type | 0x20), + (byte)((dt.Data >> 4) | 0x00), (byte)((dt.Data & 0x0f) | 0x10), + }; + ds.AddRange(sd); + } + lastDataType = dt.Type; + lastWriteAddress = dt.Address; + break; default: { if ((dt.Type == 0xa || dt.Type == 0xb) && lastWriteAddress == 0xf && //YM8950 ADPCM write diff --git a/src/VSIF/VGMPlayer/SegaPcm.cs b/src/VSIF/VGMPlayer/SegaPcm.cs index 57a6cab282d1e..e7c08d77d25dd 100644 --- a/src/VSIF/VGMPlayer/SegaPcm.cs +++ b/src/VSIF/VGMPlayer/SegaPcm.cs @@ -128,6 +128,17 @@ public void StreamSong() parentSong.DeferredWriteOPNA_DAC(vsifClient, dt); } + else if (vsifClient.SoundModuleType == VsifSoundModuleType.TurboR_FTDI && vsifClient.Tag.ContainsKey("ProxySegaPcm")) + { + int dt = ((dtL + dtR) / 2) >> 7; + + if (dt > sbyte.MaxValue) + dt = sbyte.MaxValue; + else if (dt < sbyte.MinValue) + dt = sbyte.MinValue; + + parentSong.DeferredWriteTurboR_DAC(vsifClient, (byte)(dt + 128)); + } } QueryPerformanceCounter(out after); diff --git a/src/VSIF/VGMPlayer/SongBase.cs b/src/VSIF/VGMPlayer/SongBase.cs index 240496599e16a..9ef1c317c394e 100644 --- a/src/VSIF/VGMPlayer/SongBase.cs +++ b/src/VSIF/VGMPlayer/SongBase.cs @@ -1003,6 +1003,7 @@ protected void deferredWriteOPNA_P0(VsifClient comPortOPNA, int adrs, int dt) switch (comPortOPNA.SoundModuleType) { case VsifSoundModuleType.MSX_FTDI: + case VsifSoundModuleType.TurboR_FTDI: comPortOPNA.DeferredWriteData(0x10, (byte)adrs, (byte)dt, (int)Settings.Default.BitBangWaitOPNA); break; case VsifSoundModuleType.SpfmLight: @@ -1090,6 +1091,7 @@ protected void deferredWriteOPNA_P1(VsifClient comPortOPNA, int adrs, int dt) switch (comPortOPNA.SoundModuleType) { case VsifSoundModuleType.MSX_FTDI: + case VsifSoundModuleType.TurboR_FTDI: comPortOPNA.DeferredWriteData(0x11, (byte)adrs, (byte)dt, (int)Settings.Default.BitBangWaitOPNA); break; case VsifSoundModuleType.SpfmLight: @@ -1147,7 +1149,8 @@ public void DeferredWriteOPN2_DAC(VsifClient comPortOPN2, int dacValue) if (lastOpn2DacValue == dacValue) return; - if (comPortOPN2.SoundModuleType == VsifSoundModuleType.MSX_FTDI) + if (comPortOPN2.SoundModuleType == VsifSoundModuleType.MSX_FTDI || + comPortOPN2.SoundModuleType == VsifSoundModuleType.TurboR_FTDI) { comPortOPN2.DeferredWriteData(0x14, (byte)0x2a, (byte)dacValue, (int)Settings.Default.BitBangWaitOPN2); } @@ -1175,6 +1178,7 @@ public void DeferredWriteOPNA_PseudoDAC(VsifClient comPortOPNA, int inputValue) switch (comPortOPNA.SoundModuleType) { case VsifSoundModuleType.MSX_FTDI: + case VsifSoundModuleType.TurboR_FTDI: //Set volume for pseudo DAC comPortOPNA.DeferredWriteData(0x13, (byte)0xb, (byte)inputValue, (int)Settings.Default.BitBangWaitOPNA); //outputAdpcm(comPort, lastWriteDacValue); @@ -1214,6 +1218,7 @@ public void DeferredWriteOPNA_DAC(VsifClient comPortOPNA, int dacValue) switch (comPortOPNA.SoundModuleType) { case VsifSoundModuleType.MSX_FTDI: + case VsifSoundModuleType.TurboR_FTDI: deferredWriteOPNA_P1(comPortOPNA, 0x0e, (byte)dacValue); //TODO: comPortOPNA.DeferredWriteData(0x13, (byte)0xb, (byte)lastWriteDacValue, (int)Settings.Default.BitBangWaitOPNA); break; @@ -1295,7 +1300,8 @@ protected void deferredWriteOPN2_P0(VsifClient comPortOPN2, int adrs, int dt, ui /// protected void deferredWriteOPN2_P0(VsifClient comPortOPN2, int adrs, int dt) { - if (comPortOPN2.SoundModuleType == VsifSoundModuleType.MSX_FTDI) + if (comPortOPN2.SoundModuleType == VsifSoundModuleType.MSX_FTDI || + comPortOPN2.SoundModuleType == VsifSoundModuleType.TurboR_FTDI) { comPortOPN2.DeferredWriteData(0x10, (byte)adrs, (byte)dt, (int)Settings.Default.BitBangWaitOPN2); } @@ -1370,7 +1376,8 @@ protected void deferredWriteOPN2_P1(VsifClient comPortOPN2, int adrs, int dt, ui /// protected void deferredWriteOPN2_P1(VsifClient comPortOPN2, int adrs, int dt) { - if (comPortOPN2.SoundModuleType == VsifSoundModuleType.MSX_FTDI) + if (comPortOPN2.SoundModuleType == VsifSoundModuleType.MSX_FTDI || + comPortOPN2.SoundModuleType == VsifSoundModuleType.TurboR_FTDI) { comPortOPN2.DeferredWriteData(0x11, (byte)adrs, (byte)dt, (int)Settings.Default.BitBangWaitOPN2); } @@ -1487,6 +1494,27 @@ private void outputAdpcm(VsifClient comPortOPNA, int inputValue) else if (predictValue > 24576) predictValue = 24576; } + + + int lastTurboRDacValue; + + /// + /// + /// + /// + /// + public void DeferredWriteTurboR_DAC(VsifClient comPortTurboR, int dacValue) + { + if (Settings.Default.DisableDAC) + return; + + if (lastTurboRDacValue == dacValue) + return; + + comPortTurboR.DeferredWriteData(0x15, (byte)0x0, (byte)dacValue, (int)(decimal)comPortTurboR.Tag["ClockWidth"]); + + lastOpnaDacValue = dacValue; + } } /// diff --git a/src/VSIF/VGMPlayer/VGMSong.cs b/src/VSIF/VGMPlayer/VGMSong.cs index 2ab168a1e235d..842f2ceb5a3b2 100644 --- a/src/VSIF/VGMPlayer/VGMSong.cs +++ b/src/VSIF/VGMPlayer/VGMSong.cs @@ -107,6 +107,7 @@ protected override void StopAllSounds(bool volumeOff) comPortDCSG.DeferredWriteData(0, 0x00, (byte)(0x80 | 3 << 5 | 0x1f), (int)Settings.Default.BitBangWaitDCSG); break; case VsifSoundModuleType.MSX_FTDI: + case VsifSoundModuleType.TurboR_FTDI: for (int i = 0; i < 3; i++) comPortDCSG.DeferredWriteData(0xF, 0, (byte)(0x80 | i << 5 | 0x1f), (int)Settings.Default.BitBangWaitDCSG); comPortDCSG.DeferredWriteData(0xF, 0, (byte)(0x80 | 3 << 5 | 0x1f), (int)Settings.Default.BitBangWaitDCSG); @@ -134,7 +135,8 @@ protected override void StopAllSounds(bool volumeOff) if (comPortOPN2 != null) { - if (comPortOPN2.SoundModuleType == VsifSoundModuleType.MSX_FTDI) + if (comPortOPN2.SoundModuleType == VsifSoundModuleType.MSX_FTDI || + comPortOPN2.SoundModuleType == VsifSoundModuleType.TurboR_FTDI) { // ALL KEY OFF for (int i = 0; i < 3; i++) @@ -162,6 +164,7 @@ protected override void StopAllSounds(bool volumeOff) if (comPortOPNA != null) { if (comPortOPNA.SoundModuleType == VsifSoundModuleType.MSX_FTDI || + comPortOPNA.SoundModuleType == VsifSoundModuleType.TurboR_FTDI || comPortOPNA.SoundModuleType == VsifSoundModuleType.PC88_FTDI) { // ALL KEY OFF @@ -208,6 +211,7 @@ protected override void StopAllSounds(bool volumeOff) if (comPortOPN != null) { if (comPortOPN.SoundModuleType == VsifSoundModuleType.MSX_FTDI || + comPortOPN.SoundModuleType == VsifSoundModuleType.TurboR_FTDI || comPortOPN.SoundModuleType == VsifSoundModuleType.PC88_FTDI) { // ALL KEY OFF @@ -293,7 +297,8 @@ protected override void StopAllSounds(bool volumeOff) //SCC if (comPortSCC != null) { - if (comPortSCC.SoundModuleType == VsifSoundModuleType.MSX_FTDI) + if (comPortSCC.SoundModuleType == VsifSoundModuleType.MSX_FTDI || + comPortSCC.SoundModuleType == VsifSoundModuleType.TurboR_FTDI) { comPortSCC.DeferredWriteData(4, (byte)0xaf, (byte)00, (int)Settings.Default.BitBangWaitSCC); comPortSCC.DeferredWriteData(5, (byte)0x8f, (byte)00, (int)Settings.Default.BitBangWaitSCC); @@ -312,7 +317,8 @@ protected override void StopAllSounds(bool volumeOff) //Y8910 if (comPortY8910 != null) { - if (comPortY8910.SoundModuleType == VsifSoundModuleType.MSX_FTDI) + if (comPortY8910.SoundModuleType == VsifSoundModuleType.MSX_FTDI || + comPortY8910.SoundModuleType == VsifSoundModuleType.TurboR_FTDI) { //comPortY8910?.DeferredWriteData(0, (byte)0x07, (byte)0xff, (int)Settings.Default.BitBangWaitAY8910); comPortY8910.DeferredWriteData(0, (byte)0x08, (byte)0x00, (int)Settings.Default.BitBangWaitAY8910); @@ -745,6 +751,17 @@ private VGM_HEADER readVGMHeader(BinaryReader hFile) //Enable Dac EnableDacYM2608(comPortOPNA, true); } + else + { + foreach (var c in VsifManager.GetVsifClients()) + { + if (c.SoundModuleType == VsifSoundModuleType.TurboR_FTDI) + { + c.Tag["ProxyOKIM6258"] = true; + break; + } + } + } } if (curHead.lngHzOKIM6295 != 0 && curHead.lngVersion >= 0x00000161) { @@ -769,6 +786,19 @@ private VGM_HEADER readVGMHeader(BinaryReader hFile) okim6295 = new OKIM6295(this); okim6295.device_start_okim6295(0, (int)curHead.lngHzOKIM6295, comPortOPNA); } + else + { + foreach (var c in VsifManager.GetVsifClients()) + { + if (c.SoundModuleType == VsifSoundModuleType.TurboR_FTDI) + { + c.Tag["ProxyOKIM6295"] = true; + okim6295 = new OKIM6295(this); + okim6295.device_start_okim6295(0, (int)curHead.lngHzOKIM6295, c); + break; + } + } + } } if (curHead.lngHzSPCM != 0 && curHead.lngVersion >= 0x00000151) { @@ -793,6 +823,19 @@ private VGM_HEADER readVGMHeader(BinaryReader hFile) segaPcm = new SegaPcm(this); segaPcm.device_start_segapcm(0, (int)curHead.lngHzSPCM, (int)curHead.lngSPCMIntf, comPortOPNA); } + else + { + foreach (var c in VsifManager.GetVsifClients()) + { + if (c.SoundModuleType == VsifSoundModuleType.TurboR_FTDI) + { + c.Tag["ProxySegaPcm"] = true; + segaPcm = new SegaPcm(this); + segaPcm.device_start_segapcm(0, (int)curHead.lngHzSPCM, (int)curHead.lngSPCMIntf, c); + break; + } + } + } } if (curHead.lngHzK053260 != 0 && curHead.lngVersion >= 0x00000161) { @@ -817,6 +860,19 @@ private VGM_HEADER readVGMHeader(BinaryReader hFile) k053260 = new K053260(this); k053260.device_start_k053260(0, (int)curHead.lngHzK053260, comPortOPNA); } + else + { + foreach (var c in VsifManager.GetVsifClients()) + { + if (c.SoundModuleType == VsifSoundModuleType.TurboR_FTDI) + { + c.Tag["ProxyK053260"] = true; + k053260 = new K053260(this); + k053260.device_start_k053260(0, (int)curHead.lngHzK053260, c); + break; + } + } + } } if (curHead.lngHzNESAPU != 0 && curHead.lngVersion >= 0x00000161) { @@ -886,6 +942,21 @@ private bool connectToSAA() } } break; + case 1: + if (comPortSAA == null) + { + comPortSAA = VsifManager.TryToConnectVSIF(VsifSoundModuleType.TurboR_FTDI, + (PortId)Settings.Default.SAA_Port); + + if (comPortSAA != null) + { + comPortSAA.Tag["ClockWidth"] = Settings.Default.BitBangWaitSAA; + comPortSAA.ChipClockHz["SAA1099"] = 8000000; + comPortSAA.ChipClockHz["SAA1099_org"] = 8000000; + UseChipInformation += "SAA1099@8MHz "; + } + } + break; } if (comPortSAA != null) { @@ -993,6 +1064,21 @@ private bool connectToPSG() } } break; + case 2: + if (comPortY8910 == null) + { + comPortY8910 = VsifManager.TryToConnectVSIF(VsifSoundModuleType.TurboR_FTDI, + (PortId)Settings.Default.Y8910_Port); + + if (comPortY8910 != null) + { + comPortY8910.Tag["ClockWidth"] = Settings.Default.BitBangWaitY8950; + comPortY8910.ChipClockHz["Y8910"] = 1789773; + comPortY8910.ChipClockHz["Y8910_org"] = 1789773; + UseChipInformation += "PSG@1.789773MHz "; + } + } + break; } if (comPortY8910 != null) { @@ -1050,6 +1136,20 @@ private bool connectToOPLL() } } break; + case 3: + if (comPortOPLL == null) + { + comPortOPLL = VsifManager.TryToConnectVSIF(VsifSoundModuleType.TurboR_FTDI, + (PortId)Settings.Default.OPLL_Port); + if (comPortOPLL != null) + { + comPortOPLL.Tag["ClockWidth"] = Settings.Default.BitBangWaitOPLL; + comPortOPLL.ChipClockHz["OPLL"] = 3579545; + comPortOPLL.ChipClockHz["OPLL_org"] = 3579545; + UseChipInformation += "OPLL@3.579545MHz "; + } + } + break; } if (comPortOPLL != null) { @@ -1150,6 +1250,20 @@ private bool coonectToDCSG() } } break; + case 6: + if (comPortDCSG == null) + { + comPortDCSG = VsifManager.TryToConnectVSIF(VsifSoundModuleType.TurboR_FTDI, + (PortId)Settings.Default.DCSG_Port); + if (comPortDCSG != null) + { + comPortDCSG.Tag["ClockWidth"] = Settings.Default.BitBangWaitDCSG; + comPortDCSG.ChipClockHz["DCSG"] = 3579545; + comPortDCSG.ChipClockHz["DCSG_org"] = 3579545; + UseChipInformation += "DCSG@3.579545MHz "; + } + } + break; } if (comPortDCSG != null) { @@ -1168,14 +1282,23 @@ private bool connectToSCC() switch (Settings.Default.SCC_IF) { case 0: + case 1: if (comPortSCC == null) { - comPortSCC = VsifManager.TryToConnectVSIF(VsifSoundModuleType.MSX_FTDI, - (PortId)Settings.Default.SCC_Port); + switch (Settings.Default.SCC_IF) + { + case 0: + comPortSCC = VsifManager.TryToConnectVSIF(VsifSoundModuleType.MSX_FTDI, (PortId)Settings.Default.SCC_Port); + break; + case 1: + comPortSCC = VsifManager.TryToConnectVSIF(VsifSoundModuleType.TurboR_FTDI, (PortId)Settings.Default.SCC_Port); + break; + } if (comPortSCC != null) { Accepted = true; + comPortSCC.Tag["ClockWidth"] = Settings.Default.BitBangWaitSCC; comPortSCC.ChipClockHz["SCC"] = 3.579545 * 1000 * 1000; comPortSCC.ChipClockHz["SCC_org"] = 3.579545 * 1000 * 1000; UseChipInformation += "SCC@3.579545MHz "; @@ -1183,6 +1306,7 @@ private bool connectToSCC() switch (comPortSCC.SoundModuleType) { case VsifSoundModuleType.MSX_FTDI: + case VsifSoundModuleType.TurboR_FTDI: SCCType type = (SCCType)comPortSCC.Tag["SCC.Type"]; var slot = (int)comPortSCC.Tag["SCC.Slot"]; if ((int)slot < 0) @@ -1248,6 +1372,20 @@ private bool connectToMsxAudio() } } break; + case 1: + if (comPortY8950 == null) + { + comPortY8950 = VsifManager.TryToConnectVSIF(VsifSoundModuleType.TurboR_FTDI, + (PortId)Settings.Default.Y8950_Port); + if (comPortY8950 != null) + { + comPortY8950.Tag["ClockWidth"] = Settings.Default.BitBangWaitY8950; + comPortY8950.ChipClockHz["Y8950"] = 3579545; + comPortY8950.ChipClockHz["Y8950_org"] = 3579545; + UseChipInformation += "Y8950@3.579545MHz "; + } + } + break; } if (comPortY8950 != null) { @@ -1283,6 +1421,18 @@ private bool connectToOPL3() UseChipInformation += "OPL3@14.318180MHz "; } break; + case 1: + if (comPortOPL3 == null) + comPortOPL3 = VsifManager.TryToConnectVSIF(VsifSoundModuleType.TurboR_FTDI, + (PortId)Settings.Default.OPL3_Port); + if (comPortOPL3 != null) + { + comPortOPL3.Tag["ClockWidth"] = Settings.Default.BitBangWaitOPL3; + comPortOPL3.ChipClockHz["OPL3"] = 14318180; + comPortOPL3.ChipClockHz["OPL3_org"] = 14318180; + UseChipInformation += "OPL3@14.318180MHz "; + } + break; } if (comPortOPL3 != null) { @@ -1383,6 +1533,20 @@ private bool connectToOPM(uint clock) } } break; + case 4: + if (comPortOPM == null) + { + comPortOPM = VsifManager.TryToConnectVSIF(VsifSoundModuleType.TurboR_FTDI, + (PortId)Settings.Default.OPM_Port); + if (comPortOPM != null) + { + comPortOPM.Tag["ClockWidth"] = Settings.Default.BitBangWaitOPM; + comPortOPM.ChipClockHz["OPM"] = 3579545; + comPortOPM.ChipClockHz["OPM_org"] = 3579545; + UseChipInformation += "OPM@3.579545MHz "; + } + } + break; } if (comPortOPM != null) { @@ -1505,6 +1669,21 @@ private bool connectToOPNA(uint clock) } } break; + case 5: + if (comPortOPNA == null) + { + comPortOPNA = VsifManager.TryToConnectVSIF(VsifSoundModuleType.TurboR_FTDI, + (PortId)Settings.Default.OPNA_Port); + if (comPortOPNA != null) + { + comPortOPNA.Tag["ClockWidth"] = Settings.Default.BitBangWaitOPNA; + comPortOPNA.ChipClockHz["OPNA"] = 8000000; + comPortOPNA.ChipClockHz["OPNA_SSG"] = 8000000; + comPortOPNA.ChipClockHz["OPNA_org"] = 8000000; + UseChipInformation += "OPNA@8.000000MHz "; + } + } + break; } if (comPortOPNA != null) { @@ -1575,6 +1754,21 @@ private bool connectToOPN() } } break; + case 2: + if (comPortOPN == null) + { + comPortOPN = VsifManager.TryToConnectVSIF(VsifSoundModuleType.TurboR_FTDI, + (PortId)Settings.Default.OPN_Port); + if (comPortOPN != null) + { + comPortOPN.Tag["ClockWidth"] = Settings.Default.BitBangWaitOPN; + comPortOPN.ChipClockHz["OPN"] = 4000000; + comPortOPN.ChipClockHz["OPN_SSG"] = 4000000; + comPortOPN.ChipClockHz["OPN_org"] = 4000000; + UseChipInformation += "OPN@4.000000MHz "; + } + } + break; } if (comPortOPN != null) { @@ -1656,6 +1850,20 @@ private bool connectToOPN2() } } break; + case 4: + if (comPortOPN2 == null) + { + comPortOPN2 = VsifManager.TryToConnectVSIF(VsifSoundModuleType.TurboR_FTDI, + (PortId)Settings.Default.OPN2_Port); + if (comPortOPN2 != null) + { + comPortOPN2.Tag["ClockWidth"] = Settings.Default.BitBangWaitOPN2; + comPortOPN2.ChipClockHz["OPN2"] = 7670453; + comPortOPN2.ChipClockHz["OPN2_org"] = 7670453; + UseChipInformation += "OPN2@7.670453MHz "; + } + } + break; } if (comPortOPN2 != null) { @@ -2590,7 +2798,8 @@ protected override void StreamSong() if ((dt & 1) == 1) { //HACK: ROM -> RAM - if (comPortY8950?.SoundModuleType == VsifSoundModuleType.MSX_FTDI) + if (comPortY8950?.SoundModuleType == VsifSoundModuleType.MSX_FTDI || + comPortY8950?.SoundModuleType == VsifSoundModuleType.TurboR_FTDI) { dt -= 1; #if DEBUG @@ -2635,7 +2844,8 @@ protected override void StreamSong() { if (comPortY8950 != null) { - if (comPortY8950.SoundModuleType == VsifSoundModuleType.MSX_FTDI) + if (comPortY8950.SoundModuleType == VsifSoundModuleType.MSX_FTDI || + comPortY8950.SoundModuleType == VsifSoundModuleType.TurboR_FTDI) { var dt2 = ((y8950_pcm_start << 3) & 0xff00) >> 8; writeY8950PcmAddressData(0xa, dt2); @@ -2650,6 +2860,7 @@ protected override void StreamSong() switch (comPortOPNA.SoundModuleType) { case VsifSoundModuleType.MSX_FTDI: + case VsifSoundModuleType.TurboR_FTDI: case VsifSoundModuleType.PC88_FTDI: var dt2 = ((y8950_pcm_start << 3) & 0xff00) >> 8; deferredWriteOPNA_P1(comPortOPNA, 0x03, dt2, dclk); @@ -2668,7 +2879,8 @@ protected override void StreamSong() { if (comPortY8950 != null) { - if (comPortY8950.SoundModuleType == VsifSoundModuleType.MSX_FTDI) + if (comPortY8950.SoundModuleType == VsifSoundModuleType.MSX_FTDI || + comPortY8950.SoundModuleType == VsifSoundModuleType.TurboR_FTDI) { dt = ((y8950_pcm_start << 3) & 0xff00) >> 8; } @@ -2680,6 +2892,7 @@ protected override void StreamSong() switch (comPortOPNA.SoundModuleType) { case VsifSoundModuleType.MSX_FTDI: + case VsifSoundModuleType.TurboR_FTDI: case VsifSoundModuleType.PC88_FTDI: dt = ((y8950_pcm_start << 3) & 0xff00) >> 8; break; @@ -2696,7 +2909,8 @@ protected override void StreamSong() { if (comPortY8950 != null) { - if (comPortY8950.SoundModuleType == VsifSoundModuleType.MSX_FTDI) + if (comPortY8950.SoundModuleType == VsifSoundModuleType.MSX_FTDI || + comPortY8950.SoundModuleType == VsifSoundModuleType.TurboR_FTDI) { var dt2 = (((y8950_pcm_stop << 3) | 0b111) & 0xff00) >> 8; writeY8950PcmAddressData(0xc, dt2); @@ -2711,6 +2925,7 @@ protected override void StreamSong() switch (comPortOPNA.SoundModuleType) { case VsifSoundModuleType.MSX_FTDI: + case VsifSoundModuleType.TurboR_FTDI: case VsifSoundModuleType.PC88_FTDI: { var dt2 = (((y8950_pcm_stop << 3) | 0b111) & 0xff00) >> 8; @@ -2734,7 +2949,8 @@ protected override void StreamSong() { if (comPortY8950 != null) { - if (comPortY8950.SoundModuleType == VsifSoundModuleType.MSX_FTDI) + if (comPortY8950.SoundModuleType == VsifSoundModuleType.MSX_FTDI || + comPortY8950.SoundModuleType == VsifSoundModuleType.TurboR_FTDI) { dt = (((y8950_pcm_stop << 3) | 0b111) & 0xff00) >> 8; } @@ -2744,6 +2960,7 @@ protected override void StreamSong() switch (comPortOPNA.SoundModuleType) { case VsifSoundModuleType.MSX_FTDI: + case VsifSoundModuleType.TurboR_FTDI: case VsifSoundModuleType.PC88_FTDI: { dt = (((y8950_pcm_stop << 3) | 0b111) & 0xff00) >> 8; @@ -3636,6 +3853,18 @@ protected override void StreamSong() DeferredWriteOPNA_DAC(comPortOPNA, bdata); streamWaitDelta += 44.1 * 1000 / oki6258_sample_rate; } + else + { + foreach (var c in VsifManager.GetVsifClients()) + { + if (c.SoundModuleType == VsifSoundModuleType.TurboR_FTDI && c.Tag.ContainsKey("ProxyOKIM6258")) + { + byte bdata = (byte)((ddata >> 8) + 128); + DeferredWriteTurboR_DAC(c, bdata); + break; + } + } + } oki6285Adpcm2ndNibble = true; vgmDataCurrentOffset--; } @@ -3657,6 +3886,18 @@ protected override void StreamSong() DeferredWriteOPNA_DAC(comPortOPNA, bdata); streamWaitDelta += 44.1 * 1000 / oki6258_sample_rate; } + else + { + foreach (var c in VsifManager.GetVsifClients()) + { + if (c.SoundModuleType == VsifSoundModuleType.TurboR_FTDI && c.Tag.ContainsKey("ProxyOKIM6258")) + { + byte bdata = (byte)((ddata >> 8) + 128); + DeferredWriteTurboR_DAC(c, bdata); + break; + } + } + } oki6285Adpcm2ndNibble = false; } } @@ -4149,6 +4390,7 @@ private void deferredWriteSCC(int pp, int aa, int dd) switch (comPortSCC.SoundModuleType) { case VsifSoundModuleType.MSX_FTDI: + case VsifSoundModuleType.TurboR_FTDI: SCCType type = (SCCType)comPortSCC.Tag["SCC.Type"]; var slot = (int)comPortSCC.Tag["SCC.Slot"]; if ((int)slot < 0) @@ -4267,6 +4509,7 @@ public void deferredWriteSAAReg(int adrs, byte dt, uint dclk) switch (comPortSAA.SoundModuleType) { case VsifSoundModuleType.MSX_FTDI: + case VsifSoundModuleType.TurboR_FTDI: comPortSAA.DeferredWriteData(0x1e, 0x5, (byte)adrs, (int)Settings.Default.BitBangWaitSAA); comPortSAA.DeferredWriteData(0x1e, 0x4, (byte)ret.Lo, (int)Settings.Default.BitBangWaitSAA); @@ -4313,6 +4556,7 @@ public void deferredWriteSAAReg(int adrs, byte dt, uint dclk) switch (comPortSAA.SoundModuleType) { case VsifSoundModuleType.MSX_FTDI: + case VsifSoundModuleType.TurboR_FTDI: comPortSAA.DeferredWriteData(0x1e, 0x5, (byte)ladr0, (int)Settings.Default.BitBangWaitSAA); comPortSAA.DeferredWriteData(0x1e, 0x4, (byte)ret0.Lo, (int)Settings.Default.BitBangWaitSAA); Debug.WriteLine($"Data: \t{ladr0} {ret0.Lo}"); @@ -4344,6 +4588,7 @@ public void deferredWriteSAAReg(int adrs, byte dt, uint dclk) switch (comPortSAA.SoundModuleType) { case VsifSoundModuleType.MSX_FTDI: + case VsifSoundModuleType.TurboR_FTDI: comPortSAA.DeferredWriteData(0x1e, 0x5, (byte)adrs, (int)Settings.Default.BitBangWaitSAA); comPortSAA.DeferredWriteData(0x1e, 0x4, dt, (int)Settings.Default.BitBangWaitSAA); break; @@ -4638,6 +4883,7 @@ protected void deferredWriteDCSG(int data) comPortDCSG.DeferredWriteData(0, 0x00, (byte)data, (int)Settings.Default.BitBangWaitDCSG); break; case VsifSoundModuleType.MSX_FTDI: + case VsifSoundModuleType.TurboR_FTDI: comPortDCSG.DeferredWriteData(0xF, 0, (byte)data, (int)Settings.Default.BitBangWaitDCSG); break; } @@ -4648,6 +4894,7 @@ protected void deferredWriteY8910(int adrs, int dt) switch (comPortY8910.SoundModuleType) { case VsifSoundModuleType.MSX_FTDI: + case VsifSoundModuleType.TurboR_FTDI: comPortY8910.DeferredWriteData(0, (byte)adrs, (byte)dt, (int)Settings.Default.BitBangWaitAY8910); break; case VsifSoundModuleType.Generic_UART: @@ -4691,6 +4938,7 @@ protected void deferredWriteOPM(int adrs, int dt) switch (comPortOPM.SoundModuleType) { case VsifSoundModuleType.MSX_FTDI: + case VsifSoundModuleType.TurboR_FTDI: comPortOPM.DeferredWriteData(0xe, (byte)adrs, (byte)dt, (int)Settings.Default.BitBangWaitOPM); break; case VsifSoundModuleType.SpfmLight: @@ -4708,6 +4956,7 @@ protected void deferredWriteOPLL(int adrs, int dt) switch (comPortOPLL.SoundModuleType) { case VsifSoundModuleType.MSX_FTDI: + case VsifSoundModuleType.TurboR_FTDI: var slot = (int)comPortOPLL.Tag["OPLL.Slot"]; if (slot == 1 || slot == 2) comPortOPLL.DeferredWriteData(2, (byte)0, (byte)(slot - 1), (int)Settings.Default.BitBangWaitOPLL); @@ -4915,7 +5164,8 @@ private void sendAdpcmDataY8950(byte[] transferData, int saddr, FormProgress fp) /// private void deferredWriteY8950(int adrs, int dt) { - if (comPortY8950.SoundModuleType == VsifSoundModuleType.MSX_FTDI) + if (comPortY8950.SoundModuleType == VsifSoundModuleType.MSX_FTDI || + comPortY8950.SoundModuleType == VsifSoundModuleType.TurboR_FTDI) { int ytype = (int)comPortY8950.Tag["Y8950.Slot"]; switch (ytype) @@ -4975,7 +5225,8 @@ private void deferredWriteOPL3_P0(int adrs, int dt, uint dclk) /// private void deferredWriteOPL3_P0(int adrs, int dt) { - if (comPortOPL3.SoundModuleType == VsifSoundModuleType.MSX_FTDI) + if (comPortOPL3.SoundModuleType == VsifSoundModuleType.MSX_FTDI || + comPortOPL3.SoundModuleType == VsifSoundModuleType.TurboR_FTDI) { if (adrs != 0x10) //ignore for Y8950 simulation comPortOPL3.DeferredWriteData(10, (byte)adrs, (byte)dt, (int)Settings.Default.BitBangWaitOPL3); @@ -5027,7 +5278,8 @@ private void deferredWriteOPL3_P1(int adrs, int dt, uint dclk) /// private void deferredWriteOPL3_P1(int adrs, int dt) { - if (comPortOPL3.SoundModuleType == VsifSoundModuleType.MSX_FTDI) + if (comPortOPL3.SoundModuleType == VsifSoundModuleType.MSX_FTDI || + comPortOPL3.SoundModuleType == VsifSoundModuleType.TurboR_FTDI) { comPortOPL3.DeferredWriteData(11, (byte)adrs, (byte)dt, (int)Settings.Default.BitBangWaitOPL3); } @@ -5167,6 +5419,7 @@ private void deferredWriteOPN_P0(int adrs, int dt) switch (comPortOPN.SoundModuleType) { case VsifSoundModuleType.MSX_FTDI: + case VsifSoundModuleType.TurboR_FTDI: comPortOPN.DeferredWriteData(0x12, (byte)adrs, (byte)dt, (int)Settings.Default.BitBangWaitOPN); break; case VsifSoundModuleType.PC88_FTDI: @@ -5188,7 +5441,8 @@ private void writeY8950PcmAddressData(int adrs2, int dt2) { if (comPortY8950 != null) { - if (comPortY8950.SoundModuleType == VsifSoundModuleType.MSX_FTDI) + if (comPortY8950.SoundModuleType == VsifSoundModuleType.MSX_FTDI || + comPortY8950.SoundModuleType == VsifSoundModuleType.TurboR_FTDI) { int ytype = (int)comPortY8950.Tag["Y8950.Slot"]; switch (ytype) diff --git a/src/VSIF/VGMPlayer/VsifManager.cs b/src/VSIF/VGMPlayer/VsifManager.cs index 9a38a20e36ad8..720f8e21a7c3c 100644 --- a/src/VSIF/VGMPlayer/VsifManager.cs +++ b/src/VSIF/VGMPlayer/VsifManager.cs @@ -235,6 +235,7 @@ public static VsifClient TryToConnectVSIF(VsifSoundModuleType soundModule, PortI } break; case VsifSoundModuleType.MSX_FTDI: + case VsifSoundModuleType.TurboR_FTDI: { var ftdi = new FTD2XX_NET.FTDI(); var stat = ftdi.OpenByIndex((uint)comPort); @@ -419,6 +420,7 @@ public enum VsifSoundModuleType Gimic, PC88_FTDI, SMS_FTDI, + TurboR_FTDI, } diff --git a/src/VSIF/VGMPlayer/XGMSong.cs b/src/VSIF/VGMPlayer/XGMSong.cs index 548091ce65066..4ea7d85a83874 100644 --- a/src/VSIF/VGMPlayer/XGMSong.cs +++ b/src/VSIF/VGMPlayer/XGMSong.cs @@ -120,6 +120,7 @@ protected override void StopAllSounds(bool volumeOff) comPortDCSG.DeferredWriteData(0, 0x00, (byte)(0x80 | 3 << 5 | 0x1f), (int)Settings.Default.BitBangWaitDCSG); break; case VsifSoundModuleType.MSX_FTDI: + case VsifSoundModuleType.TurboR_FTDI: for (int i = 0; i < 3; i++) comPortDCSG.DeferredWriteData(0xF, 0, (byte)(0x80 | i << 5 | 0x1f), (int)Settings.Default.BitBangWaitDCSG); comPortDCSG.DeferredWriteData(0xF, 0, (byte)(0x80 | 3 << 5 | 0x1f), (int)Settings.Default.BitBangWaitDCSG); @@ -128,7 +129,8 @@ protected override void StopAllSounds(bool volumeOff) } if (comPortOPN2 != null) { - if (comPortOPN2.SoundModuleType == VsifSoundModuleType.MSX_FTDI) + if (comPortOPN2.SoundModuleType == VsifSoundModuleType.MSX_FTDI || + comPortOPN2.SoundModuleType == VsifSoundModuleType.TurboR_FTDI) { // ALL KEY OFF for (int i = 0; i < 3; i++) @@ -155,7 +157,8 @@ protected override void StopAllSounds(bool volumeOff) if (comPortOPNA != null) { - if (comPortOPNA.SoundModuleType == VsifSoundModuleType.MSX_FTDI) + if (comPortOPNA.SoundModuleType == VsifSoundModuleType.MSX_FTDI || + comPortOPNA.SoundModuleType == VsifSoundModuleType.TurboR_FTDI) { // ALL KEY OFF for (int i = 0; i < 3; i++) @@ -210,7 +213,8 @@ protected override void StopAllSounds(bool volumeOff) /// private void deferredWriteOPN2_P0(int adrs, int dt) { - if (comPortOPN2.SoundModuleType == VsifSoundModuleType.MSX_FTDI) + if (comPortOPN2.SoundModuleType == VsifSoundModuleType.MSX_FTDI || + comPortOPN2.SoundModuleType == VsifSoundModuleType.TurboR_FTDI) { comPortOPN2.DeferredWriteData(0x10, (byte)adrs, (byte)dt, (int)Settings.Default.BitBangWaitOPN2); } @@ -231,7 +235,8 @@ private void deferredWriteOPN2_P0(int adrs, int dt) /// private void deferredWriteOPN2_P1(int adrs, int dt) { - if (comPortOPN2.SoundModuleType == VsifSoundModuleType.MSX_FTDI) + if (comPortOPN2.SoundModuleType == VsifSoundModuleType.MSX_FTDI || + comPortOPN2.SoundModuleType == VsifSoundModuleType.TurboR_FTDI) { comPortOPN2.DeferredWriteData(0x11, (byte)adrs, (byte)dt, (int)Settings.Default.BitBangWaitOPN2); } @@ -477,6 +482,19 @@ private bool connectToOPNA(uint clock) } } break; + case 4: + if (comPortOPNA == null) + { + comPortOPNA = VsifManager.TryToConnectVSIF(VsifSoundModuleType.TurboR_FTDI, + (PortId)Settings.Default.OPNA_Port); + if (comPortOPNA != null) + { + comPortOPNA.Tag["ClockWidth"] = Settings.Default.BitBangWaitOPNA; + comPortOPNA.ChipClockHz["OPNA"] = 8 * 1000 * 1000; + UseChipInformation += "OPNA@8.000000MHz "; + } + } + break; } if (comPortOPNA != null) { @@ -567,6 +585,19 @@ private bool connectToOPN2() } } break; + case 4: + if (comPortOPN2 == null) + { + comPortOPN2 = VsifManager.TryToConnectVSIF(VsifSoundModuleType.TurboR_FTDI, + (PortId)Settings.Default.OPN2_Port); + if (comPortOPN2 != null) + { + comPortOPN2.Tag["ClockWidth"] = Settings.Default.BitBangWaitOPN2; + comPortOPN2.ChipClockHz["OPN2"] = 7670453; + UseChipInformation += "OPN2@7.670453MHz "; + } + } + break; } if (comPortOPN2 != null) { @@ -669,6 +700,19 @@ private bool coonectToDCSG() } } break; + case 5: + if (comPortDCSG == null) + { + comPortDCSG = VsifManager.TryToConnectVSIF(VsifSoundModuleType.TurboR_FTDI, + (PortId)Settings.Default.DCSG_Port); + if (comPortDCSG != null) + { + comPortDCSG.Tag["ClockWidth"] = Settings.Default.BitBangWaitDCSG; + comPortDCSG.ChipClockHz["DCSG"] = 3579545; + UseChipInformation += "DCSG@3.579545MHz "; + } + } + break; } if (comPortDCSG != null) { @@ -1159,6 +1203,7 @@ protected void deferredWriteDCSG(int data) comPortDCSG.DeferredWriteData(0, 0xFF, (byte)data, (int)Settings.Default.BitBangWaitDCSG); break; case VsifSoundModuleType.MSX_FTDI: + case VsifSoundModuleType.TurboR_FTDI: comPortDCSG.DeferredWriteData(0xF, 0, (byte)data, (int)Settings.Default.BitBangWaitDCSG); break; } diff --git a/src/mamidimemo/Program.cs b/src/mamidimemo/Program.cs index fd68ef8fdaec6..2197b314d7572 100644 --- a/src/mamidimemo/Program.cs +++ b/src/mamidimemo/Program.cs @@ -41,7 +41,7 @@ public static class Program /// /// /// - public const string FILE_VERSION = "5.7.1.1"; + public const string FILE_VERSION = "5.7.1.2"; public const string FILE_COPYRIGHT = @"Virtual chiptune sound MIDI module ""MAmidiMEmo"" Version {0} Copyright(C) 2019, 2024 Itoken.All rights reserved.";