Skip to content

Commit

Permalink
TAG053 2020/11/13
Browse files Browse the repository at this point in the history
  Compiler/Driver:トレースモード、K/Rパート対応
  • Loading branch information
kumatan committed Nov 13, 2020
1 parent 9f650be commit a28ef0c
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 33 deletions.
3 changes: 3 additions & 0 deletions CHANGE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
�X�V����
TAG053 2020/11/13
Compiler/Driver:�g���[�X���[�h�AK/R�p�[�g�Ή�

TAG052 2020/11/09 2nd
Compiler:IDE�X�C�b�`�������ƈ��k���������Ȃ��悤�ɂ��Ă݂�...

Expand Down
7 changes: 4 additions & 3 deletions PMDDotNETCompiler/mc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5891,8 +5891,8 @@ private enmPass2JumpTable otoset()

cx = (byte)cx * 0x100 + ((cx & 0xff00) >> 8);

m_seg.m_buf.Set(work.di + 0, new MmlDatum((byte)cx));
m_seg.m_buf.Set(work.di + 1, new MmlDatum((byte)(cx >> 8)));
m_seg.m_buf.Set(work.di + 0, new MmlDatum((byte)cx)); //KUMA: @n
m_seg.m_buf.Set(work.di + 1, new MmlDatum((byte)(cx >> 8))); //KUMA: c
work.di += 2;

mml_seg.length_check1 = 1;//音長データがあったよ
Expand Down Expand Up @@ -7463,7 +7463,8 @@ private enmPass2JumpTable vseta()

private enmPass2JumpTable vset()
{
work.dx = (work.dx & 0xff00) + (byte)work.bx;
//work.dx = (work.dx & 0xff00) + (byte)work.bx;
work.dx = (byte)work.bx;
return vset2();
}

Expand Down
2 changes: 1 addition & 1 deletion PMDDotNETConsole/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"profiles": {
"PMDDotNETConsole": {
"commandName": "Project",
"commandLineArgs": "-LOGLEVEL=DEBUG /V /c D:\\bootcamp\\FM音源\\player\\pmd\\fromTAN-Y\\ORANGE04.MML"
"commandLineArgs": "-LOGLEVEL=DEBUG /V /c D:\\bootcamp\\FM音源\\player\\pmd\\fromTAN-Y\\testSSS_EXER.MML"
}
}
}
28 changes: 27 additions & 1 deletion PMDDotNETDriver/EFCDRV.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,19 @@ private void eff_main()
r.bl ^= 0b0000_1111;//volume
r.ah = 1;//command
r.al &= 0x7f;//num?
ChipDatum cd = new ChipDatum(0x01, (r.al << 8) | r.bh, r.bl);

ChipDatum cd = new ChipDatum(-1, -1, -1);
cd.addtionalData = pw.cmd;
pmd.WriteOPNARegister(cd);
if (pw.cmd != null && pw.cmd.args != null && pw.cmd.args.Count > 2 && pw.cmd.args[2] is MmlDatum[])
{
foreach (MmlDatum md in (MmlDatum[])pw.cmd.args[2])
{
pmd.ExecIDESpecialCommand(md);
}
}

cd = new ChipDatum(0x01, (r.al << 8) | r.bh, r.bl);
ppsdrv(cd);//.Play(r.al, r.bh, r.bl);//; ppsdrv keyon
ppsdrm_ret:;
return;
Expand All @@ -125,6 +137,20 @@ private void eff_main()
cd = new ChipDatum(0x02, 0, 0);
ppsdrv(cd);//.Stop();//; ppsdrv 強制keyoff
eok_nonppsdrv:;


cd = new ChipDatum(-1, -1, -1);
cd.addtionalData = pw.cmd;
pmd.WriteOPNARegister(cd);
if (pw.cmd != null && pw.cmd.args != null && pw.cmd.args.Count > 2 && pw.cmd.args[2] is MmlDatum[])
{
foreach (MmlDatum md in (MmlDatum[])pw.cmd.args[2])
{
pmd.ExecIDESpecialCommand(md);
}
}


r.si = 0;// pw.efftbl[r.bx].Item2;
r.si += 0;//offset efftbl
pw.crtEfcDat = pw.efftbl[r.bx].Item2;
Expand Down
83 changes: 56 additions & 27 deletions PMDDotNETDriver/PMD.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2013,6 +2013,9 @@ private void rhyms00()
rlnset();
}

/// <summary>
/// 音長を読み取り、セット
/// </summary>
private void rlnset()
{
r.al = (byte)pw.rd[r.bx].dat;// mov al,[bx]
Expand Down Expand Up @@ -2041,19 +2044,20 @@ private void rlnset()

private void reom()
{
//KUMA: K part の解析
reom:;
do
{
pw.cmd = pw.md[r.si];
r.al = (byte)pw.md[r.si].dat;

if (r.si == pw.jumpIndex)
pw.jumpIndex = -1;//KUMA:Added
pw.jumpIndex = -1;//KUMA:Added スキップ再生向け

r.si++;

if (r.al == 0x80) goto rfin;
if (r.al < 0x80) break;
if (r.al < 0x80) break; // K part に Rn コマンドが指定されていた場合

object o = commandsr();
while (o != null)
Expand All @@ -2062,48 +2066,67 @@ private void reom()
}
} while (true);

//KUMA: R part に処理を切り替える準備

//Console.WriteLine("{0}", pw.cmd);

FlashMacroList();

MmlDatum md = new MmlDatum(enmMMLType.TraceLocate, null, LinePos.Copy(pw.cmd.linePos), 0xff);
md = new MmlDatum(enmMMLType.TraceLocate, new List<object>(new object[] { 0, 1, md }), LinePos.Copy(pw.cmd.linePos), 0xff);
ChipDatum cd = new ChipDatum(-1, -1, -1);
cd.addtionalData = md;
WriteDummy(cd);

//re00:
pw.partWk[r.di].address = r.si;
r.ah = 0;
r.ax += r.ax;
r.ax += (ushort)pw.radtbl;
r.ax += (ushort)pw.radtbl;//KUMA: R part のアドレステーブル0x00~最大0x7f分存在しうる
r.bx = r.ax;
r.ax = (ushort)(pw.md[r.bx].dat + pw.md[r.bx + 1].dat * 0x100);// mov ax,[bx]

r.ax += (ushort)pw.mmlbuf;
pw.rhyadr = r.ax;

//KUMA: R part に処理を切り替え

r.bx = r.ax;
pw.rd = pw.md;

rhyms00:;
{
pw.cmd = pw.rd[r.bx];// mov al,[bx]
r.al = (byte)pw.rd[r.bx].dat;// mov al,[bx]
r.bx++;

if (r.al == 0xff)
{
goto reom;
}
if ((r.al & 0x80) != 0)
{
int r = rhythmon();
if (r == 1) goto rhyms00;
return;
}
rhyms00:;
pw.cmd = pw.rd[r.bx];// mov al,[bx]
r.al = (byte)pw.rd[r.bx].dat;// mov al,[bx]
r.bx++;

FlashMacroList();
if (r.al == 0xff) //KUMA: R part 終端の場合は K part 解析に戻る
{
goto reom;
}

pw.kshot_dat = 0;//; rest
rlnset();
//0x00 - 0x7f : 休符
//0x80 - 0xbf : 音符(発音)
//0xc0 - 0xff : コマンド
if ((r.al & 0x80) != 0) //KUMA: 最上位bitが1かどうかチェック(mmlコマンド/発音かどうかチェック)
{
int r = rhythmon();
if (r == 1) goto rhyms00;//KUMA: 1の(連続でコマンドを実行したい)場合はループ
return;
}

//KUMA: alが0~0x7fの場合は休符処理

FlashMacroList();

pw.kshot_dat = 0;//; rest
rlnset();
return;


rfin:;

//KUMA: K part終端処理

FlashMacroList();

r.si--;
Expand Down Expand Up @@ -2135,19 +2158,24 @@ private void reom()
//;==============================================================================
private int rhythmon()
{
if ((r.al & 0b0100_0000) == 0)
if ((r.al & 0b0100_0000) == 0)//KUMA: bit6が0の場合はリズム音の発音処理へ
goto rhy_shot;

//KUMA: 各コマンド処理はr.siをインデックスとして使うのでbxとsiを入れ替える

ushort a = r.si;
r.si = r.bx;
r.bx = a;
r.stack.Push(r.bx);

object o = commandsr();
object o = commandsr(); //KUMA: alが示す、コマンド処理をもらってくる
while (o != null)
{
o = ((Func<object>)o)();
o = ((Func<object>)o)();//KUMA: コマンド実施
}

//KUMA: 元に戻す

r.bx = r.stack.Pop();
a = r.si;
r.si = r.bx;
Expand All @@ -2164,7 +2192,8 @@ private int rhythmon()
return 0;
r_nonmask:;
r.ah = r.al;
r.al = (byte)pw.rd[r.bx].dat;
pw.cmd = pw.rd[r.bx];
r.al = (byte)pw.rd[r.bx].dat;//本来の音符コマンド
r.bx++;
r.ax &= 0x3fff;
pw.kshot_dat = r.ax;
Expand Down Expand Up @@ -10614,7 +10643,7 @@ public void WriteDummy(ChipDatum cd)
}
}

private void ExecIDESpecialCommand(MmlDatum md)
public void ExecIDESpecialCommand(MmlDatum md)
{
//Console.WriteLine("{0}", md);

Expand Down
2 changes: 1 addition & 1 deletion PMDDotNETPlayer/PMDDotNETPlayer.csproj.user
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<StartArguments>-D=EMU -L=2 "D:\bootcamp\FM音源\player\pmd\AIR_T06.MZ"</StartArguments>
<StartArguments>-D=EMU -L=2 "D:\bootcamp\FM音源\player\pmd\fromTAN-Y\testSSS_EXER.M"</StartArguments>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<StartArguments>-D=GIMIC C:\Users\kuma\Desktop\desire\des_26.m</StartArguments>
Expand Down

0 comments on commit a28ef0c

Please sign in to comment.