diff --git a/bin/nsc.exe b/bin/nsc.exe
index 5d62928..9ad6ee1 100644
Binary files a/bin/nsc.exe and b/bin/nsc.exe differ
diff --git a/bin/nsd.bin b/bin/nsd.bin
index c2a4783..880bdea 100644
Binary files a/bin/nsd.bin and b/bin/nsd.bin differ
diff --git a/bin/nsd_all.bin b/bin/nsd_all.bin
index 829e0e0..6c077a6 100644
Binary files a/bin/nsd_all.bin and b/bin/nsd_all.bin differ
diff --git a/bin/nsd_all2.bin b/bin/nsd_all2.bin
index 5c485de..f04544a 100644
Binary files a/bin/nsd_all2.bin and b/bin/nsd_all2.bin differ
diff --git a/bin/nsd_fds.bin b/bin/nsd_fds.bin
index 66b3033..1ba36bd 100644
Binary files a/bin/nsd_fds.bin and b/bin/nsd_fds.bin differ
diff --git a/bin/nsd_hfe4.bin b/bin/nsd_hfe4.bin
index 0fc859b..7504288 100644
Binary files a/bin/nsd_hfe4.bin and b/bin/nsd_hfe4.bin differ
diff --git a/bin/nsd_hfx4.bin b/bin/nsd_hfx4.bin
index 53e9828..18176e8 100644
Binary files a/bin/nsd_hfx4.bin and b/bin/nsd_hfx4.bin differ
diff --git a/bin/nsd_mmc5.bin b/bin/nsd_mmc5.bin
index 2b60a32..ae3ee6d 100644
Binary files a/bin/nsd_mmc5.bin and b/bin/nsd_mmc5.bin differ
diff --git a/bin/nsd_n163.bin b/bin/nsd_n163.bin
index 5f57dbe..69ece09 100644
Binary files a/bin/nsd_n163.bin and b/bin/nsd_n163.bin differ
diff --git a/bin/nsd_oall.bin b/bin/nsd_oall.bin
index bea3974..b7a951a 100644
Binary files a/bin/nsd_oall.bin and b/bin/nsd_oall.bin differ
diff --git a/bin/nsd_opll.bin b/bin/nsd_opll.bin
index b98e769..64663d2 100644
Binary files a/bin/nsd_opll.bin and b/bin/nsd_opll.bin differ
diff --git a/bin/nsd_s5b.bin b/bin/nsd_s5b.bin
index a6ff8a6..77a3574 100644
Binary files a/bin/nsd_s5b.bin and b/bin/nsd_s5b.bin differ
diff --git a/bin/nsd_vrc6.bin b/bin/nsd_vrc6.bin
index ec3dc67..d1f0ffb 100644
Binary files a/bin/nsd_vrc6.bin and b/bin/nsd_vrc6.bin differ
diff --git a/bin/nsd_vrc7.bin b/bin/nsd_vrc7.bin
index 10c056f..b04bd94 100644
Binary files a/bin/nsd_vrc7.bin and b/bin/nsd_vrc7.bin differ
diff --git a/doc/nsdl.chm b/doc/nsdl.chm
index 55cd27b..66774d0 100644
Binary files a/doc/nsdl.chm and b/doc/nsdl.chm differ
diff --git a/doc/readme.txt b/doc/readme.txt
index 6a80480..d80491f 100644
--- a/doc/readme.txt
+++ b/doc/readme.txt
@@ -1,6 +1,6 @@
+-----------------------------------------------------------------------------
| タイトル | NES Sound Driver Library
-|ファイル名| NSDL112.ZIP
+|ファイル名| NSDL113.ZIP
| カテゴリ | Sound Driver for NES
| 動作機種 | NES (Nintendo Entertainment System)
|前提ソフト| cc65 (Complete cross development package for 65(C)02 systems.)
@@ -28,4 +28,4 @@ This is developed as object library, and user application can control it.
・mixi http://mixi.jp/show_profile.pl?id=16558
========================================================================
-製作のファイルは【NSDL112.ZIP】です。
+製作のファイルは【NSDL113.ZIP】です。
diff --git a/include/nsd.inc b/include/nsd.inc
index ef0db3b..6c7540d 100644
--- a/include/nsd.inc
+++ b/include/nsd.inc
@@ -127,7 +127,6 @@
;****************************************************************
;* Define for nsd.lib *
;****************************************************************
-
;=======================================================================
; General Define
;-----------------------------------------------------------------------
@@ -323,7 +322,7 @@
.Endstruct
.Struct NSD_voice
- voice .byte ;`@R' command value (upper 4bit)
+ voice .byte ;`@R' command value (upper 4bit) ;※廃止
voice_set .byte ;deveice setting value
.Endstruct
@@ -421,6 +420,7 @@
.endscope
.scope nsd_mode
+ voiceR = $F0
voice = $08
gatemode = $03
.endscope
@@ -455,7 +455,7 @@
.define __repeat_ctr nsd_work + NSD_work::Repeat + NSD_Repeat::count1
.define __repeat_ctr2 nsd_work + NSD_work::Repeat + NSD_Repeat::count2
.define __volume nsd_work + NSD_work::Volume + NSD_volume::volume
-.define __voice nsd_work + NSD_work::Voice + NSD_voice::voice
+;.define __voice nsd_work + NSD_work::Voice + NSD_voice::voice
.define __voice_set nsd_work + NSD_work::Voice + NSD_voice::voice_set
.define __frequency nsd_work + NSD_work::Frequency
.define __subroutine nsd_work + NSD_work::SubRoutine
diff --git a/lib/NSD.lib b/lib/NSD.lib
index ea529c7..a6a01a9 100644
Binary files a/lib/NSD.lib and b/lib/NSD.lib differ
diff --git a/lib/NSD_ALL.lib b/lib/NSD_ALL.lib
index 4944173..668fa14 100644
Binary files a/lib/NSD_ALL.lib and b/lib/NSD_ALL.lib differ
diff --git a/lib/NSD_ALL2.lib b/lib/NSD_ALL2.lib
index 1cc0eae..ce826ff 100644
Binary files a/lib/NSD_ALL2.lib and b/lib/NSD_ALL2.lib differ
diff --git a/lib/NSD_FDS.lib b/lib/NSD_FDS.lib
index e326393..fc45640 100644
Binary files a/lib/NSD_FDS.lib and b/lib/NSD_FDS.lib differ
diff --git a/lib/NSD_HFE4.lib b/lib/NSD_HFE4.lib
index 2079228..83ef2fd 100644
Binary files a/lib/NSD_HFE4.lib and b/lib/NSD_HFE4.lib differ
diff --git a/lib/NSD_HFX4.lib b/lib/NSD_HFX4.lib
index e92aff4..5d6efef 100644
Binary files a/lib/NSD_HFX4.lib and b/lib/NSD_HFX4.lib differ
diff --git a/lib/NSD_MMC5.lib b/lib/NSD_MMC5.lib
index e8bac6d..017b910 100644
Binary files a/lib/NSD_MMC5.lib and b/lib/NSD_MMC5.lib differ
diff --git a/lib/NSD_N163.lib b/lib/NSD_N163.lib
index dc248f2..94ca05c 100644
Binary files a/lib/NSD_N163.lib and b/lib/NSD_N163.lib differ
diff --git a/lib/NSD_OALL.lib b/lib/NSD_OALL.lib
index 5957d16..7f9a81f 100644
Binary files a/lib/NSD_OALL.lib and b/lib/NSD_OALL.lib differ
diff --git a/lib/NSD_OPLL.lib b/lib/NSD_OPLL.lib
index eb5899e..7816447 100644
Binary files a/lib/NSD_OPLL.lib and b/lib/NSD_OPLL.lib differ
diff --git a/lib/NSD_VRC6.lib b/lib/NSD_VRC6.lib
index 4ebcc52..af07e18 100644
Binary files a/lib/NSD_VRC6.lib and b/lib/NSD_VRC6.lib differ
diff --git a/lib/NSD_VRC7.lib b/lib/NSD_VRC7.lib
index af4611c..f6a93e9 100644
Binary files a/lib/NSD_VRC7.lib and b/lib/NSD_VRC7.lib differ
diff --git a/lib/NSD_s5b.lib b/lib/NSD_s5b.lib
index c8afc31..3385384 100644
Binary files a/lib/NSD_s5b.lib and b/lib/NSD_s5b.lib differ
diff --git a/sample/sw/Bach_BWV578.nsf b/sample/sw/Bach_BWV578.nsf
index 98fb1be..138c0d0 100644
Binary files a/sample/sw/Bach_BWV578.nsf and b/sample/sw/Bach_BWV578.nsf differ
diff --git a/sample/sw/Mozart_Kv618.nsf b/sample/sw/Mozart_Kv618.nsf
index 988d623..95b2e2a 100644
Binary files a/sample/sw/Mozart_Kv618.nsf and b/sample/sw/Mozart_Kv618.nsf differ
diff --git a/src/help/format_music.html b/src/help/format_music.html
index 59d5444..86b7008 100644
--- a/src/help/format_music.html
+++ b/src/help/format_music.html
@@ -149,9 +149,9 @@
0x80-0xFF | (n1) (n2) | Note and Rest
op-code bit 7 = `H'
- op-code bit 6 = flag of Gate Time (n2 [tick])
+ op-code bit 6 = flag of Thai & Slur
op-code bit 5 = flag of Length (n1 [tick])
- op-code bit 4 = flag of Thai & Slur
+ op-code bit 4 = flag of Gate Time (n2 [tick])
op-code bit 3-0 = note
0x00 : C
0x01 : Cis / Des
diff --git a/src/help/mml_echo.html b/src/help/mml_echo.html
index 96756f0..722b15f 100644
--- a/src/help/mml_echo.html
+++ b/src/help/mml_echo.html
@@ -27,8 +27,9 @@ MML reference: Echo
定義(Define)
- ECdelay,volume
+ ECdelay,volume(,length)
EC*
+ EC-
@@ -38,6 +39,7 @@ MML reference: Echo
引数の替わりに`*'を指定することで、疑似エコーを無効化できます。(Default: Disable)
+また、`-'を指定することで、疑似エコーのバッファをリセットできます。
delay
@@ -53,6 +55,13 @@ volume
0 〜 15 … 指定の音量で発音(Key on)し直します。
+length
+
+疑似エコーで鳴らす音符の音長、もしくはモードを指定します。
+-1 … 休符が疑似エコーに置き換わります(パラメータ省略時のデフォルトです)。
+1 〜 … 前の音符の音長を指定分だけ減らし、指定の音長の疑似エコーに置き換えます。r ,w コマンドは休符になります。
+
+
@@ -74,7 +83,7 @@ volume
注意(Notes)
-リピートと相対音量、相対移調、相対オクターブを組み合わせた場合、正常に疑似エコーのシーケンスを作成できません。
+リピートと相対音量、相対移調を組み合わせた場合、正常に疑似エコーのシーケンスを作成できません。
疑似エコーが有効になっている時は、それらのコマンドを組み合わせて使わないで下さい。
diff --git a/src/help/mml_length.html b/src/help/mml_length.html
index 6dc300a..7cb346e 100644
--- a/src/help/mml_length.html
+++ b/src/help/mml_length.html
@@ -69,9 +69,17 @@ Length
無限ループやリピートで戻った際も適用されますので、注意してください。
-但し、音長を省略して付点のみを記述した音符・休符に関しては、無限ループやリピート前のlコマンドの値に付点がつきます。
-lコマンドは音源ドライバー側の機能、付点はMMLコンパイラ側の機能です。
+
+lコマンドは音源ドライバー側の機能、付点はMMLコンパイラ側の機能である事にご注意ください。
+
+
+- リピートや、ダルセーニョ後は、l コマンドの指定をお勧めします。
+ 音長を省略して付点のみを記述した音符・休符に関しては、ダルセーニョやリピート前のlコマンドの値に付点がつきます。
+- サブルーチン先でl コマンドを指定する場合、戻った後にもl コマンドの指定をお勧めします。
+ サブルーチン先は呼び出し元のデフォルト音長検知できず、また、戻った後もサブルーチン先でデフォルト音長を変えた場合、
+ コンパイラでそれを検知することはできず、呼び出し前ののlコマンドの値に付点がつきます。
+
diff --git a/src/help/mml_octave.html b/src/help/mml_octave.html
index 6063de9..6b03278 100644
--- a/src/help/mml_octave.html
+++ b/src/help/mml_octave.html
@@ -37,7 +37,7 @@ MML reference: Octave
octave
-オクターブです。2〜9の範囲(o4=中央)で指定してください。(Default: octave = 4)
+オクターブです。1〜8の範囲(o4=中央)で指定してください。(Default: octave = 4)
diff --git a/src/help/nsdl.chm b/src/help/nsdl.chm
index 55cd27b..66774d0 100644
Binary files a/src/help/nsdl.chm and b/src/help/nsdl.chm differ
diff --git a/src/help/revision.html b/src/help/revision.html
index cb934e2..2e2c4bf 100644
--- a/src/help/revision.html
+++ b/src/help/revision.html
@@ -25,6 +25,21 @@
ヴァージョン | 内容 | 改定日 |
+1.13 |
+ ●音源ドライバー本体
+ ・nsd_all.bin, nsd_all2.bin, nsd_oall.bin, nsd_hfe4.bin, nsd_hfx4.binにて、
+ Version 1.12におけるシーケンス64kByte化の副作用として、音量エンベロープが効かなくなることがあるバグ及び、
+ ΔPCMのIRQが使えなくなっていたバグをFix。
+ ・ノートコマンドのオペコードのビット位置を最適化のためを変更しました。
+ ・オクターブコマンドで指定できるオクターブを2〜9から1〜8へ変更しました。
+ ●MMLコンパイラ
+ ・疑似エコーのバッファをリセットするコマンドを実装した。
+ ・EC(疑似エコー)コマンドにオプションで第三パラメータを追加し、
+ 休符を書かないでも疑似エコーをできるようにした。
+ ・音符及び休符にて、lコマンドと音長が同じ場合は、1Byte短いオペコードを出力するようにした。
+ ・音量、ゲートタイムの指定値が前回と同じ場合は、コンパイルしないようにした(リピート、ダルセーニョ後は除外)。
+ |
+ 2014年 1月19日 |
1.12 |
●音源ドライバー本体
・Sunsoft 5Bにて、sコマンド使用時にプチノイズが入る場合があるバグを修正。
diff --git a/src/help/variable.html b/src/help/variable.html
index 2f0e18c..dfbe536 100644
--- a/src/help/variable.html
+++ b/src/help/variable.html
@@ -204,7 +204,9 @@ nsd_work
| チャンネル毎のフラグ |
Flag[n].gatemode |
__gatemode |
- ゲートモード(Rmコマンドの設定値) |
+ .... ..rr : ゲートモード(Rmコマンドの設定値)
+ .... e... : 音色エンベロープのスイッチ
+ vvvv .... : リリース時の音色(R@コマンドの数値) |
Length[n].length |
__length |
音長省略時の音長(lコマンドの設定値) |
@@ -270,10 +272,10 @@ nsd_work
TR5(儕CM)はAPU ch2のsweepレジスタの現在値として使用。
Voice[n].voice |
__voice |
- 音色(R@コマンドの数値) |
+ 音色(R@コマンドの数値) ※移動のため廃止 |
Voice[n].voice_set |
__voice_set |
- 現在発音している音色(音色エンベロープ適用後) |
+ 現在発音している音色(音色エンベロープ適用後)※移動し廃止予定 |
Env_F_Now[n].Frequency |
__env_freq_now |
音程エンベロープの現在値 |
diff --git a/src/nsc/MMLfile.cpp b/src/nsc/MMLfile.cpp
index 5cd85c5..250cd58 100644
--- a/src/nsc/MMLfile.cpp
+++ b/src/nsc/MMLfile.cpp
@@ -743,6 +743,9 @@ int MMLfile::readLength(unsigned int DefaultLength){
iDot = iLength;
//付点
while((cData = cRead()) == '.'){
+ if(iLength == -1){
+ Err(L"音長の記述なしに付点を使う場合は、前もってl コマンドを記述して下さい。");
+ }
iMod = (iDot & 0x01);
iDot >>= 1;
if(iMod != 0){
diff --git a/src/nsc/MusicEvent.h b/src/nsc/MusicEvent.h
index fd98276..e8298a0 100644
--- a/src/nsc/MusicEvent.h
+++ b/src/nsc/MusicEvent.h
@@ -75,9 +75,9 @@
#define nsd_Release_Volume 0x70
#define nsd_Note 0x80
-#define nsd_Note_Slur 0x10
+#define nsd_Note_Slur 0x40
#define nsd_Note_Length 0x20
-#define nsd_Note_Gate 0x40
+#define nsd_Note_Gate 0x10
/****************************************************************/
/* */
diff --git a/src/nsc/MusicTrack.cpp b/src/nsc/MusicTrack.cpp
index c76962e..96f1a0e 100644
--- a/src/nsc/MusicTrack.cpp
+++ b/src/nsc/MusicTrack.cpp
@@ -17,12 +17,15 @@ MusicTrack::MusicTrack(const wchar_t _strName[]):
offset_repeat_a_b(0), //リピートA
offset_repeat_b_s(0), //リピートB
offset_repeat_b_b(0), //リピートB
- DefaultLength(24),
- octave(4),
+ DefaultLength(-1),
+ volume(15),
+ octave(5),
octave1(0),
- compile_flag(false),
+ echo_length(-1),
echo_flag(false),
- loop_flag(false)
+ loop_flag(false),
+ compile_flag(false),
+ pt_oldNote(0)
{
unsigned int i = 0;
@@ -31,6 +34,8 @@ MusicTrack::MusicTrack(const wchar_t _strName[]):
i++;
}
+ Reset_opt();
+
//調号(Default = C-Dur)
nowKey =0;
nowScale =0;
@@ -246,6 +251,8 @@ void MusicTrack::SetLoop()
{
offset_loop = offset_now;
loop_flag = true;
+
+ Reset_opt();
}
//==============================================================
@@ -276,6 +283,8 @@ void MusicTrack::SetRepeat_A_Start(MMLfile* MML)
SetEvent(_old_repeat);
offset_repeat_a_s = offset_now; // ] コマンドでは、次のコマンドに戻る。
offset_repeat_a_b = 0;
+
+ Reset_opt();
}
//==============================================================
@@ -348,6 +357,7 @@ void MusicTrack::SetRepeat_A_End(MMLfile* MML)
} else {
MML->Err(L"リピート(A)の開始 [ コマンドがありません。");
}
+ Reset_opt();
}
@@ -364,6 +374,8 @@ void MusicTrack::SetRepeat_B_Start()
SetEvent(new mml_general(nsd_Repeat_B_Start, L"Repeat(B) Start"));
offset_repeat_b_s = offset_now; // :| コマンドでは、次のコマンドに戻る。
offset_repeat_b_b = 0;
+
+ Reset_opt();
}
//==============================================================
@@ -414,6 +426,8 @@ void MusicTrack::SetRepeat_B_End(MMLfile* MML)
} else {
MML->Err(L"リピート(B)の開始 |: コマンドがありません。");
}
+
+ Reset_opt();
}
//==============================================================
@@ -450,6 +464,8 @@ void MusicTrack::SetSubroutine(MMLfile* MML)
_event->set_id(_no);
SetEvent(_event);
ptcSub.push_back(_event);
+
+ Reset_opt();
}
//==============================================================
@@ -597,6 +613,14 @@ void MusicTrack::SetEcho(MMLfile* MML)
echo_slur = false;
echo_volume = (unsigned char)_volume;
}
+
+ cData = MML->GetChar();
+ if(cData != ','){
+ MML->Back();
+ echo_length = -1;
+ } else {
+ echo_length = MML->GetLength(DefaultLength);
+ }
}
//==============================================================
@@ -1139,6 +1163,26 @@ void MusicTrack::SetKeySignature(MMLfile* MML)
*/
}
+//==============================================================
+// 疑似エコーのリセット
+//--------------------------------------------------------------
+// ●引数
+// 無し
+// ●返値
+// 無し
+//==============================================================
+void MusicTrack::ResetEcho()
+{
+ unsigned int i = 0;
+
+ while(i < 256){
+ oldNote[i] = -1;
+ i++;
+ }
+// echo_flag = false;
+ pt_oldNote = 0;
+}
+
//==============================================================
// 音符のイベント作成
//--------------------------------------------------------------
@@ -1156,6 +1200,7 @@ void MusicTrack::SetNote(MMLfile* MML,int note)
int Length = -1;
int GateTime = -1;
bool Slur = false;
+ int Length_0 = -1; //実音長
//臨時記号
cData = MML->GetChar();
@@ -1188,6 +1233,12 @@ void MusicTrack::SetNote(MMLfile* MML,int note)
MML->Back();
}
+ //実音長の取得
+ Length_0 = Length;
+ if(Length_0 == -1){
+ Length_0 = DefaultLength;
+ }
+
cData = MML->GetChar();
if(cData == ','){
cData = MML->GetChar();
@@ -1214,15 +1265,36 @@ void MusicTrack::SetNote(MMLfile* MML,int note)
SetEvent(new mml_general(nsd_Octave_Up_1, L"One time octave up"));
}
-
- //イベントオブジェクトの作成
- _old_note = new mml_note(_key, Length, GateTime, Slur, L"Note");
- SetEvent(_old_note);
-
+ //疑似エコーのバッファ書き込み
pt_oldNote++;
oldNote[pt_oldNote] = ((char)_key + (octave + octave1)*12) & 0xFF;
octave1_old = octave1;
octave1 = 0;
+
+ if((echo_flag == true) && (oldNote[(pt_oldNote - echo_value) & 0xFF] != -1) && (echo_length != -1) && (Length_0 > echo_length)){
+ //疑似エコー あり
+ Length_0 -= echo_length;
+ if(Length_0 == opt_DefaultLength){
+ Length_0 = -1;
+ }
+ _old_note = new mml_note(_key, Length_0, GateTime, Slur, L"Note");
+
+ //イベントオブジェクトの作成
+ SetEvent(_old_note);
+
+ GenerateEcho(echo_length,GateTime,Slur);
+ } else {
+ if(Length == opt_DefaultLength){
+ Length = -1;
+ }
+ //疑似エコー なし
+ _old_note = new mml_note(_key, Length, GateTime, Slur, L"Note");
+
+ //イベントオブジェクトの作成
+ SetEvent(_old_note);
+
+ }
+
}
//==============================================================
@@ -1236,14 +1308,14 @@ void MusicTrack::SetNote(MMLfile* MML,int note)
//==============================================================
void MusicTrack::SetRest(MMLfile* MML, int mode)
{
+ char old_note = oldNote[(pt_oldNote - echo_value) & 0xFF];
+
unsigned char cData;
unsigned char _code = 0x0F;
int Length = -1;
int GateTime = -1;
bool Slur = false;
- char now_note = oldNote[pt_oldNote];
- char old_note = oldNote[(pt_oldNote - echo_value) & 0xFF];
//休符のモード
cData = MML->GetChar();
@@ -1304,41 +1376,68 @@ void MusicTrack::SetRest(MMLfile* MML, int mode)
MML->Back();
}
- if((echo_flag == false) || (_code != 0x0F) || (old_note == -1)){
+ if((echo_flag == false) || (_code != 0x0F) || (old_note == -1) || (echo_length != -1)){
+ if(Length == opt_DefaultLength){
+ Length = -1;
+ }
_old_note = new mml_note(_code, Length, GateTime, Slur, L"Rest");
SetEvent(_old_note);
} else {
- char now_octave = (now_note / 12) - octave1_old;
- char old_octave = (old_note / 12);
-// int i = 0;
+ GenerateEcho(Length,GateTime,Slur);
+ }
+}
- if(echo_slur == false){
- //Echo volume
- SetEvent(new mml_general(nsd_Volume + echo_volume, L"Echo Volume"));
- } else {
- _old_note->SetTai();
- }
+//==============================================================
+//
+//--------------------------------------------------------------
+// ●引数
+// int Length
+// int GateTime
+// bool Slur
+// ●返値
+//
+//==============================================================
+void MusicTrack::GenerateEcho(int Length, int GateTime, bool Slur)
+{
+ char old_note = oldNote[(pt_oldNote - echo_value) & 0xFF];
+ char now_note = oldNote[pt_oldNote];
- //Echo note
- if(old_octave < now_octave){
- while(old_octave < now_octave){
- old_octave++;
- SetEvent(new mml_general(nsd_Octave_Down_1, L"One time octave down"));
- }
- } else if(old_octave > now_octave){
- while(old_octave > now_octave){
- old_octave--;
- SetEvent(new mml_general(nsd_Octave_Up_1, L"One time octave up"));
- }
- }
- _old_note = new mml_note(old_note % 12, Length, GateTime, Slur, L"Echo Note");
- SetEvent(_old_note);
+ char now_octave = (now_note / 12) - octave1_old;
+ char old_octave = (old_note / 12);
+
+// int i = 0;
+
+ if(echo_slur == false){
+ //Echo volume
+ SetEvent(new mml_general(nsd_Volume + echo_volume, L"Echo Volume"));
+ } else {
+ _old_note->SetTai();
+ }
- if(echo_slur == false){
- //volume return
- SetEvent(new mml_general(nsd_Volume + volume, L"Volume"));
+ //Echo note
+ if(old_octave < now_octave){
+ while(old_octave < now_octave){
+ old_octave++;
+ SetEvent(new mml_general(nsd_Octave_Down_1, L"One time octave down"));
+ }
+ } else if(old_octave > now_octave){
+ while(old_octave > now_octave){
+ old_octave--;
+ SetEvent(new mml_general(nsd_Octave_Up_1, L"One time octave up"));
}
}
+
+ if(Length == opt_DefaultLength){
+ Length = -1;
+ }
+ _old_note = new mml_note(old_note % 12, Length, GateTime, Slur, L"Echo Note");
+ SetEvent(_old_note);
+
+ if(echo_slur == false){
+ //volume return
+ SetEvent(new mml_general(nsd_Volume + volume, L"Volume"));
+ }
+
}
//==============================================================
@@ -1365,7 +1464,8 @@ void MusicTrack::SetTai(MMLfile* MML)
//==============================================================
void MusicTrack::SetLength(MMLfile* MML)
{
- DefaultLength = MML->GetLength(DefaultLength);
+ DefaultLength = MML->GetLength(DefaultLength);
+ opt_DefaultLength = DefaultLength;
mml_general* _event;
switch(DefaultLength){
diff --git a/src/nsc/MusicTrack.h b/src/nsc/MusicTrack.h
index bf451bd..5854d1f 100644
--- a/src/nsc/MusicTrack.h
+++ b/src/nsc/MusicTrack.h
@@ -23,6 +23,11 @@ class MusicTrack :
int count_repeat_a;
unsigned int DefaultLength;
+ int opt_DefaultLength;
+ int opt_gatetime_q; //
+ int opt_gatetime_u; //
+ int opt_volume;
+
//調号制御用
char KeySignature[8]; //調号(c,d,e,f,g,a,b,r)
char nowKey; //現在の調
@@ -36,6 +41,7 @@ class MusicTrack :
bool echo_flag; //疑似エコー フラグ
bool echo_slur; //疑似エコー スラーでつなげる?
+ int echo_length; //疑似エコー 長さ
unsigned char echo_volume; //疑似エコー 音量
unsigned char echo_value; //疑似エコー 何前?
char oldNote[256]; //疑似エコー用バッファ
@@ -94,6 +100,8 @@ class MusicTrack :
void SetScale(MMLfile* MML);
void SetKeySignature(MMLfile* MML); //調号の設定
+ void ResetEcho();
+ void GenerateEcho(int Length, int GateTime, bool Slur);
void SetNote(MMLfile* MML, int note);
void SetRest(MMLfile* MML, int mode);
void SetTai(MMLfile* MML);
@@ -105,9 +113,20 @@ class MusicTrack :
void IncOctave1(void){octave1++;};
void DecOctave1(void){octave1--;};
- void SetVolume(char _v){volume = _v;};
- void IncVolume(void){ volume++; if(volume>15){volume = 15;} };
- void DecVolume(void){ volume--; if(volume<0){volume = 0;} };
+ void SetVolume(char _v){volume = _v; opt_volume = volume;};
+ void IncVolume(void){ volume++; if(volume>15){volume = 15;} opt_volume = volume; };
+ void DecVolume(void){ volume--; if(volume<0){volume = 0;} opt_volume = volume; };
unsigned int GetDefaultLength(void){return(DefaultLength);};
+ void Reset_opt(void){
+ opt_volume = -1;
+ opt_gatetime_q = -1;
+ opt_gatetime_u = -1;
+ opt_DefaultLength = -1;
+ }
+ int Get_opt_volume(void){ return(opt_volume); };
+ int Get_opt_gatetime_q(void){ return(opt_gatetime_q); };
+ void Set_opt_gatetime_q(int i){ opt_gatetime_q = i; };
+ int Get_opt_gatetime_u(void){ return(opt_gatetime_u); };
+ void Set_opt_gatetime_u(int i){ opt_gatetime_u = i; };
};
diff --git a/src/nsc/Release/nsc.exe b/src/nsc/Release/nsc.exe
index 5d62928..9ad6ee1 100644
Binary files a/src/nsc/Release/nsc.exe and b/src/nsc/Release/nsc.exe differ
diff --git a/src/nsc/TrackSet.cpp b/src/nsc/TrackSet.cpp
index 7a8bd18..55a1569 100644
--- a/src/nsc/TrackSet.cpp
+++ b/src/nsc/TrackSet.cpp
@@ -62,6 +62,7 @@ enum Command_ID_mml {
mml_Echo,
mml_Echo_Off,
+ mml_Echo_Reset,
mml_Envelop_Voice,
mml_Envelop_Volume,
@@ -205,6 +206,7 @@ const static Command_Info Command[] = {
{ "ゲート", mml_Gate_q },
{ "u", mml_Gate_u },
+ { "EC-", mml_Echo_Reset },
{ "EC*", mml_Echo_Off },
{ "EC", mml_Echo },
{ "エコーオフ", mml_Echo_Off },
@@ -480,6 +482,10 @@ const static Command_Info Command[] = {
SetGatetime_u(MML);
break;
+ case(mml_Echo_Reset):
+ nowTrack->ResetEcho();
+ break;
+
case(mml_Echo_Off):
nowTrack->SetEcho();
break;
@@ -949,13 +955,13 @@ void TrackSet::SetTempo(MMLfile* MML)
//==============================================================
void TrackSet::SetOctave(MMLfile* MML)
{
- unsigned int iOctave = MML->GetInt() - 2;
+ unsigned int iOctave = MML->GetInt() - 1;
if( (iOctave <= 7) && (iOctave >=0) ){
SetEvent(new mml_general(nsd_Octave + (unsigned char)iOctave, L"Octave"));
nowTrack->SetOctave((unsigned char)iOctave);
} else {
- MML->Err(L"オクターブは2〜9の範囲で指定してください。o1の領域は相対オクターブをご利用ください。");
+ MML->Err(L"オクターブは1〜8の範囲で指定してください。");
}
}
@@ -996,8 +1002,10 @@ void TrackSet::SetVolume(MMLfile* MML)
unsigned int i = MML->GetInt();
if( (i <= 15) && (i >= 0) ){
- SetEvent(new mml_general(nsd_Volume + (unsigned char)i, L"Volume"));
- nowTrack->SetVolume((unsigned char)i);
+ if(nowTrack->Get_opt_volume() != i){
+ SetEvent(new mml_general(nsd_Volume + (unsigned char)i, L"Volume"));
+ nowTrack->SetVolume((unsigned char)i);
+ }
} else {
MML->Err(L"音量は0〜15の範囲で指定してください。");
}
@@ -1095,13 +1103,17 @@ void TrackSet::SetGatetime(MMLfile* MML)
{
unsigned int i = MML->GetInt();
- if( (i <= 15) && (i >= 0) ){
- SetEvent(new mml_general(nsd_GateTime_Byte + (unsigned char)i, L"Gatetime(q) Byte"));
- } else if( i <= 255) {
- SetEvent(new mml_general(nsd_GateTime_q, (unsigned char)i, L"Gatetime(q)"));
- } else {
- MML->Err(L"ゲートタイムqは0〜255の範囲で指定して下さい。");
+ if(nowTrack->Get_opt_gatetime_q() != i){
+ nowTrack->Set_opt_gatetime_q(i);
+ if( (i <= 15) && (i >= 0) ){
+ SetEvent(new mml_general(nsd_GateTime_Byte + (unsigned char)i, L"Gatetime(q) Byte"));
+ } else if( i <= 255) {
+ SetEvent(new mml_general(nsd_GateTime_q, (unsigned char)i, L"Gatetime(q)"));
+ } else {
+ MML->Err(L"ゲートタイムqは0〜255の範囲で指定して下さい。");
+ }
}
+
}
//==============================================================
@@ -1114,10 +1126,9 @@ void TrackSet::SetGatetime(MMLfile* MML)
//==============================================================
void TrackSet::SetGatetime_u(MMLfile* MML)
{
- unsigned int i;
+ unsigned int i;
unsigned char cData;
- //休符のモード
cData = MML->GetChar();
if(cData == '0'){
i = 0;
@@ -1125,8 +1136,11 @@ void TrackSet::SetGatetime_u(MMLfile* MML)
MML->Back();
i = MML->GetLength(nowTrack->GetDefaultLength());
}
- SetEvent(new mml_general(nsd_GateTime_u, (unsigned char)i, L"GateTime(u)"));
-
+
+ if(nowTrack->Get_opt_gatetime_u() != i){
+ nowTrack->Set_opt_gatetime_u(i);
+ SetEvent(new mml_general(nsd_GateTime_u, (unsigned char)i, L"GateTime(u)"));
+ }
}
//==============================================================
diff --git a/src/nsc/nsc.ncb b/src/nsc/nsc.ncb
index 0c500bc..ab5529f 100644
Binary files a/src/nsc/nsc.ncb and b/src/nsc/nsc.ncb differ
diff --git a/src/nsc/nsc.suo b/src/nsc/nsc.suo
index e3ec3ee..5758354 100644
Binary files a/src/nsc/nsc.suo and b/src/nsc/nsc.suo differ
diff --git a/src/nsd/NSD.lib b/src/nsd/NSD.lib
index ea529c7..a6a01a9 100644
Binary files a/src/nsd/NSD.lib and b/src/nsd/NSD.lib differ
diff --git a/src/nsd/NSD_ALL.lib b/src/nsd/NSD_ALL.lib
index 4944173..668fa14 100644
Binary files a/src/nsd/NSD_ALL.lib and b/src/nsd/NSD_ALL.lib differ
diff --git a/src/nsd/NSD_ALL2.lib b/src/nsd/NSD_ALL2.lib
index 1cc0eae..ce826ff 100644
Binary files a/src/nsd/NSD_ALL2.lib and b/src/nsd/NSD_ALL2.lib differ
diff --git a/src/nsd/NSD_FDS.lib b/src/nsd/NSD_FDS.lib
index e326393..fc45640 100644
Binary files a/src/nsd/NSD_FDS.lib and b/src/nsd/NSD_FDS.lib differ
diff --git a/src/nsd/NSD_HFE4.lib b/src/nsd/NSD_HFE4.lib
index 2079228..83ef2fd 100644
Binary files a/src/nsd/NSD_HFE4.lib and b/src/nsd/NSD_HFE4.lib differ
diff --git a/src/nsd/NSD_HFX4.lib b/src/nsd/NSD_HFX4.lib
index e92aff4..5d6efef 100644
Binary files a/src/nsd/NSD_HFX4.lib and b/src/nsd/NSD_HFX4.lib differ
diff --git a/src/nsd/NSD_MMC5.lib b/src/nsd/NSD_MMC5.lib
index e8bac6d..017b910 100644
Binary files a/src/nsd/NSD_MMC5.lib and b/src/nsd/NSD_MMC5.lib differ
diff --git a/src/nsd/NSD_N163.lib b/src/nsd/NSD_N163.lib
index dc248f2..94ca05c 100644
Binary files a/src/nsd/NSD_N163.lib and b/src/nsd/NSD_N163.lib differ
diff --git a/src/nsd/NSD_OALL.lib b/src/nsd/NSD_OALL.lib
index 5957d16..7f9a81f 100644
Binary files a/src/nsd/NSD_OALL.lib and b/src/nsd/NSD_OALL.lib differ
diff --git a/src/nsd/NSD_OPLL.lib b/src/nsd/NSD_OPLL.lib
index eb5899e..7816447 100644
Binary files a/src/nsd/NSD_OPLL.lib and b/src/nsd/NSD_OPLL.lib differ
diff --git a/src/nsd/NSD_VRC6.lib b/src/nsd/NSD_VRC6.lib
index 4ebcc52..af07e18 100644
Binary files a/src/nsd/NSD_VRC6.lib and b/src/nsd/NSD_VRC6.lib differ
diff --git a/src/nsd/NSD_VRC7.lib b/src/nsd/NSD_VRC7.lib
index af4611c..f6a93e9 100644
Binary files a/src/nsd/NSD_VRC7.lib and b/src/nsd/NSD_VRC7.lib differ
diff --git a/src/nsd/NSD_s5b.lib b/src/nsd/NSD_s5b.lib
index c8afc31..3385384 100644
Binary files a/src/nsd/NSD_s5b.lib and b/src/nsd/NSD_s5b.lib differ
diff --git a/src/nsd/nsd.inc b/src/nsd/nsd.inc
index f610d63..683382b 100644
--- a/src/nsd/nsd.inc
+++ b/src/nsd/nsd.inc
@@ -416,7 +416,7 @@ PSG_Envelope_Form = $0D
.Endstruct
.Struct NSD_voice
- voice .byte ;`@R' command value (upper 4bit)
+ voice .byte ;`@R' command value (upper 4bit) ;※廃止
voice_set .byte ;deveice setting value
.Endstruct
@@ -514,6 +514,7 @@ PSG_Envelope_Form = $0D
.endscope
.scope nsd_mode
+ voiceR = $F0
voice = $08
gatemode = $03
.endscope
@@ -548,7 +549,7 @@ PSG_Envelope_Form = $0D
.define __repeat_ctr nsd_work + NSD_work::Repeat + NSD_Repeat::count1
.define __repeat_ctr2 nsd_work + NSD_work::Repeat + NSD_Repeat::count2
.define __volume nsd_work + NSD_work::Volume + NSD_volume::volume
-.define __voice nsd_work + NSD_work::Voice + NSD_voice::voice
+;.define __voice nsd_work + NSD_work::Voice + NSD_voice::voice
.define __voice_set nsd_work + NSD_work::Voice + NSD_voice::voice_set
.define __frequency nsd_work + NSD_work::Frequency
.define __subroutine nsd_work + NSD_work::SubRoutine
diff --git a/src/nsd/nsd_envelope.s b/src/nsd/nsd_envelope.s
index 32b7f06..9f0914f 100644
--- a/src/nsd/nsd_envelope.s
+++ b/src/nsd/nsd_envelope.s
@@ -389,8 +389,17 @@ Volume:
jmp Set_Volume
@L3: lda __env_volume + 1,x
+.ifdef DPCMBank
+ ora __env_volume,x
+ beq @NOENV2
+ lda __env_volume + 1,x
+ jmp @Envelop
+.else
+ bne @Envelop
+.endif
bne @Envelop
+@NOENV2:
;Envelope 無効時の処理
lda __volume,x
diff --git a/src/nsd/nsd_irq.s b/src/nsd/nsd_irq.s
index fc41b09..f5c85bb 100644
--- a/src/nsd/nsd_irq.s
+++ b/src/nsd/nsd_irq.s
@@ -12,6 +12,10 @@
.import _nsd_snd_keyon
.import _nsd_dpcm_calc
+.ifdef DPCMBank
+ .import _nsd_ptr_bank
+.endif
+
.importzp nsd_work_zp
.import nsd_work
@@ -56,6 +60,9 @@ DPCM_IRQ:
;next DPCM
ldx #nsd::TR_BGM5
jsr _nsd_dpcm_calc ;現在の構造体から取得
+.ifdef DPCMBank
+ jsr _nsd_ptr_bank
+.endif
;次に発音するノート番号
ldy #5
@@ -63,6 +70,9 @@ DPCM_IRQ:
sta __note,x
jsr _nsd_dpcm_calc ;これから発音する構造体から取得
+.ifdef DPCMBank
+ jsr _nsd_ptr_bank
+.endif
;bank number
ldy #4
diff --git a/src/nsd/nsd_play_bgm.s b/src/nsd/nsd_play_bgm.s
index ad1b3e5..7b27d80 100644
--- a/src/nsd/nsd_play_bgm.s
+++ b/src/nsd/nsd_play_bgm.s
@@ -185,8 +185,8 @@ Loop_End:
sta __env_voi_ptr,x
lda #$02
sta __env_voice,x
- lda #$00
- sta __voice,x
+; lda #$00
+; sta __voice,x ;廃止
lda #$2F
sta __volume,x
Step:
diff --git a/src/nsd/nsd_sequence.s b/src/nsd/nsd_sequence.s
index 0c03af1..64fc3f5 100644
--- a/src/nsd/nsd_sequence.s
+++ b/src/nsd/nsd_sequence.s
@@ -93,7 +93,7 @@
and #nsd_mode::voice ;音量エンベロープが無効だったら
bne @L2 ;ここでKeyOn時の音色にする。
lda __env_voice,x ;
- jsr _nsd_snd_voice ;
+ jmp _nsd_snd_voice ;
@L2:
exit: rts
@@ -235,9 +235,9 @@ Volume_End:
lda __chflag,x
and #$01 ;●●● 最適化 ●●●
beq @VoiceE ;gatemode = 1 だったら、
- lda __voice,x ;ここでKeyOff時の音色にする。
+ lda __gatemode,x ;ここでKeyOff時の音色にする。
shr a, 4 ; a = release voice
- jsr _nsd_snd_voice ;
+ jmp _nsd_snd_voice ;
@VoiceE:
exit: rts
@@ -256,14 +256,14 @@ exit: rts
;=======================================================================
.proc nsd_load_sequence
.ifdef DPCMBank
-
tya
pha
- lda __Sequence_ptr,x
- sta __ptr
- lda __Sequence_ptr + 1,x
- sta __ptr + 1
+ ldy __Sequence_ptr,x
+ sty __ptr
+ ldy __Sequence_ptr + 1,x
+ sty __ptr + 1
+
jsr _nsd_ptr_bank
ldy #0
lda (__ptr),y
@@ -274,14 +274,13 @@ exit: rts
lda __ptr
.else
- lda (__Sequence_ptr,x) ;[6]
+ lda (__Sequence_ptr,x) ;[6] 6*4+2 = 26clock (52clock)
.endif
inc __Sequence_ptr,x ;[6]
bne exit ;[2]
inc __Sequence_ptr + 1,x
exit: rts ;[6]
.endproc
-
;=======================================================================
; nsd_load_ptr;
;-----------------------------------------------------------------------
@@ -297,13 +296,32 @@ exit: rts ;[6]
;=======================================================================
.proc nsd_load_ptr
-.ifdef DPCMBank
lda __Sequence_ptr,x ;
+.ifdef DPCMBank
+ pha
+.endif
sta __ptr ;
+ add #2 ;[3]
+ sta __Sequence_ptr,x ;[4]
+
+.ifdef DPCMBank
lda __Sequence_ptr + 1,x ;
- sta __ptr + 1 ;__ptr = __Sequence_ptr
+ sta __ptr + 1 ; __ptr = __Sequence_ptr
+ pha
+ bcc @l ;[2]9
+ tay
+.else
+ ldy __Sequence_ptr + 1,x ;
+ sty __ptr + 1 ; __ptr = __Sequence_ptr
+ bcc @l ;[2]9
+.endif
+ iny ;
+ sty __Sequence_ptr + 1,x ;
+@l:
+.ifdef DPCMBank
jsr _nsd_ptr_bank
+.endif
ldy #0
lda (__ptr),y
sta __tmp
@@ -311,33 +329,15 @@ exit: rts ;[6]
lda (__ptr),y
sta __tmp + 1
- lda __Sequence_ptr,x
- sta __ptr
- add #2
- sta __Sequence_ptr,x
- lda __Sequence_ptr + 1,x
+.ifdef DPCMBank
+ pla
sta __ptr + 1
- adc #0
- sta __Sequence_ptr + 1,x
-.else
- ldy __Sequence_ptr,x ;
- sty __ptr ;
- ldy __Sequence_ptr + 1,x ;
- sty __ptr + 1 ;__ptr = __Sequence_ptr
-
- lda (__Sequence_ptr,x) ;[6]
- inc __Sequence_ptr,x ;[6]
- bne @L1 ;[2]
- inc __Sequence_ptr + 1,x
-@L1: sta __tmp
-
- lda (__Sequence_ptr,x) ;[6]
- inc __Sequence_ptr,x ;[6]
- bne @L2 ;[2]
- inc __Sequence_ptr + 1,x
-@L2: sta __tmp + 1 ;__tmp = value
+ pla
+ sta __ptr
.endif
+@exit:
+
rts
.endproc
@@ -506,40 +506,37 @@ Exit:
Sequence:
jsr nsd_load_sequence ;[6]
- cmp #$80 ;[2]
+ tay
+ asl a
bcc Control ;[2] a >= 80 ?
;-----------------------
;op-code = 0x80 - 0xFF
Note:
- tay ;save a to y
;-------
- ;bit 4 check (Slur)
+ ;bit 6 check (Slur)
Chk_Slur:
- clc
- and #$10
- beq @L
- sec
-@L: rol __tai,x
+ asl a
+ rol __tai,x
;-------
;bit 5 check (Length )
Chk_Length:
- tya
- and #$20
- bne @L
+ asl a
+ sta __tmp
+ bcs @L
lda __length,x
bne @E ;基本0じゃない。
@L: jsr nsd_load_sequence
@E: sta __Length_ctr,x
;-------
- ;bit 6 check (Gate Time)
+ ;bit 4 check (Gate Time)
Chk_GateTime:
- tya
- and #$40
- beq @L
+ asl __tmp
+ bcc @L
+
jsr nsd_load_sequence
sta __tmp
lda __Length_ctr,x
@@ -578,15 +575,29 @@ Calc_Note_Number:
@Exit:
rts
+NoteSet:
+ add __octave,x
+ add __trans,x
+ add __trans_one,x
+ sta __note,x
+ lda #0
+ sta __trans_one,x ;0 reset
+ jmp nsd_keyon
+
+;=======================================================================
+; Control
+;=======================================================================
;-----------------------
;op-code = 0x00 - 0x7F
Control:
- cmp #$40 ;[2]
- bcs Short_Control ;[2]
+; cmp #$80 ;[2]
+; bcs Short_Control ;[2]
+ bmi Short_Control
+
;---------------
;op-code = 0x00 - 0x3F
- asl ;[2]
+; asl ;[2]
tay ;[2] x <- a * 2
lda opaddr,y ;[4]
sta __ptr ;[3]
@@ -597,33 +608,37 @@ Control:
;---------------
;op-code = 0x40 - 0x7F
Short_Control:
-
+ asl a
;---------------
;op-code = 0x40 - 0x7F
;---------------
;0x40 - 0x4F
-op40: cmp #$50
- bcs op50
- and #$0F
+op40:
+ asl a
+ bcs op60
+ bmi op50
;Set default length
+ tya
+ and #$0F
tay
lda length,y
sta __length,x ;__length = length[a & 0x0F];
jmp Sequence
;---------------
;0x50 - 0x5F
-op50: cmp #$60
- bcs op60
- and #$0F
+op50:
;Set gate time (1)
+ tya
+ and #$0F
sta __gate_q,x ;__gate_q = a & 0x0F;
jmp Sequence
;---------------
;0x60 - 0x6F
-op60: cmp #$70
- bcs op70
- and #$0F
+op60:
+ bmi op70
;Set volume
+ tya
+ and #$0F
sta __tmp
lda __volume,x
and #$F0
@@ -633,7 +648,7 @@ op60: cmp #$70
;---------------
;0x70 - 0x7F
op70: ;Ser release volume
- shl a, 4
+ asl a
sta __tmp
lda __volume,x
and #$0F
@@ -641,18 +656,6 @@ op70: ;Ser release volume
sta __volume,x ;__volume = (__volume & 0x0F) | (a << 4);
jmp Sequence
-
- ;---------------
-NoteSet:
- add __octave,x
- add __trans,x
- add __trans_one,x
- sta __note,x
- lda #0
- sta __trans_one,x ;0 reset
- jmp nsd_keyon
-
-
;=======================================================================
; opcode 0x00: End of Track / End of Subroutine
;-----------------------------------------------------------------------
@@ -713,13 +716,31 @@ nsd_op02:
;-----------------------------------------------------------------------
nsd_op01:
Jump:
- jsr nsd_load_ptr
+ lda __Sequence_ptr,x ;
+ sta __ptr ;
+ ldy __Sequence_ptr + 1,x ;
+ sty __ptr + 1 ; __ptr = __Sequence_ptr
- lda __ptr
- add __tmp
+.ifdef DPCMBank
+ sta __tmp
+ sty __tmp + 1
+ jsr _nsd_ptr_bank
+.endif
+
+ ldy #0 ;[2]11
+.ifdef DPCMBank
+ lda __tmp
+.endif
+ add (__ptr),y
sta __Sequence_ptr,x
+
+ iny
+.ifdef DPCMBank
+ lda __tmp + 1
+.else
lda __ptr + 1
- adc __tmp + 1
+.endif
+ adc (__ptr),y
sta __Sequence_ptr + 1,x ;__Sequence_ptr = __ptr + __tmp
jmp Sequence
@@ -739,8 +760,7 @@ nsd_op04:
lda __repeat_ctr,x
cmp #1
beq Jump
- jsr nsd_load_sequence
- jsr nsd_load_sequence
+ jsr nsd_load_ptr
jmp Sequence
;=======================================================================
@@ -749,8 +769,7 @@ nsd_op04:
nsd_op05:
dec __repeat_ctr,x
bne Jump
- jsr nsd_load_sequence
- jsr nsd_load_sequence
+ jsr nsd_load_ptr
jmp Sequence
;=======================================================================
@@ -1042,27 +1061,47 @@ nsd_op16:
; opcode 0x17: Portamento (Frequency += n2, every n3 [VBlank])
;-----------------------------------------------------------------------
nsd_op17:
+
+ lda __Sequence_ptr,x ;
+ sta __ptr ;
+ add #4 ;[3]
+ sta __Sequence_ptr,x ;[4]
+
+ ldy __Sequence_ptr + 1,x ;
+ sty __ptr + 1 ; __ptr = __Sequence_ptr
+ bcc @l ;[2]9
+ iny ;
+ sty __Sequence_ptr + 1,x ;
+@l:
+
cpx #nsd::TR_BGM5
- beq @L
+ beq @exit
- jsr nsd_load_sequence ;decay
+.ifdef DPCMBank
+ jsr _nsd_ptr_bank
+.endif
+
+ ldy #0
+ lda (__ptr),y
sta __por_ctr,x
- jsr nsd_load_sequence ;rate
+
+ iny
+ lda (__ptr),y
sta __por_rate,x
- jsr nsd_load_sequence ;depth
+
+ iny
+ lda (__ptr),y
sta __por_depth,x
- jsr nsd_load_sequence ;target
+
+ iny
+ lda (__ptr),y
sta __por_target,x
lda #0
sta __por_now + 0,x
sta __por_now + 1,x ;現在の変位
- jmp Sequence
-
-@L:
- jsr nsd_load_ptr
- jsr nsd_load_ptr
+@exit:
jmp Sequence
;=======================================================================
@@ -1453,10 +1492,10 @@ nsd_op30:
lda #$00
nsd_Set_Voice:
sta __tmp
- lda __voice,x
+ lda __gatemode,x
and #$0F
ora __tmp
- sta __voice,x
+ sta __gatemode,x
jmp Sequence
nsd_op31:
@@ -1512,35 +1551,35 @@ nsd_op28_Exit:
; opcode 0x38 - 0x3F: Octave
;-----------------------------------------------------------------------
nsd_op38:
- lda #12
- bne nsd_Set_Octave
+ lda #0
+ beq nsd_Set_Octave
nsd_op39:
- lda #24
+ lda #12
bne nsd_Set_Octave
nsd_op3A:
- lda #36
+ lda #24
bne nsd_Set_Octave
nsd_op3B:
- lda #48
+ lda #36
bne nsd_Set_Octave
nsd_op3C:
- lda #60
+ lda #48
bne nsd_Set_Octave
nsd_op3D:
- lda #72
+ lda #60
bne nsd_Set_Octave
nsd_op3E:
- lda #84
+ lda #72
bne nsd_Set_Octave
nsd_op3F:
- lda #96
+ lda #84
bne nsd_Set_Octave
.endproc
diff --git a/src/rom/crt0.s b/src/rom/crt0.s
index 96cb5e2..6ce5e25 100644
--- a/src/rom/crt0.s
+++ b/src/rom/crt0.s
@@ -107,8 +107,13 @@ _play: .byte 0
; ------------------------------------------------------------------------
.segment "DRVINFO"
DRV_Name: .byte $4E, $53, $44, $4C, $20, $20
-DRV_Version: .byte $01
- .byte $0c
+DRV_Version: .byte 1
+ .byte 13
+
+.segment "STARTUP"
+DRV_Name2: .byte $4E, $53, $44, $4C, $20, $20
+DRV_Version2: .byte 1
+ .byte 13
; ------------------------------------------------------------------------
; 実機ROM用 IRQ (DPCM)
diff --git a/src/rom/nsd.bin b/src/rom/nsd.bin
index c2a4783..880bdea 100644
Binary files a/src/rom/nsd.bin and b/src/rom/nsd.bin differ
diff --git a/src/rom/nsd_all.bin b/src/rom/nsd_all.bin
index 829e0e0..6c077a6 100644
Binary files a/src/rom/nsd_all.bin and b/src/rom/nsd_all.bin differ
diff --git a/src/rom/nsd_all2.bin b/src/rom/nsd_all2.bin
index 5c485de..f04544a 100644
Binary files a/src/rom/nsd_all2.bin and b/src/rom/nsd_all2.bin differ
diff --git a/src/rom/nsd_fds.bin b/src/rom/nsd_fds.bin
index 66b3033..1ba36bd 100644
Binary files a/src/rom/nsd_fds.bin and b/src/rom/nsd_fds.bin differ
diff --git a/src/rom/nsd_hfe4.bin b/src/rom/nsd_hfe4.bin
index 0fc859b..7504288 100644
Binary files a/src/rom/nsd_hfe4.bin and b/src/rom/nsd_hfe4.bin differ
diff --git a/src/rom/nsd_hfx4.bin b/src/rom/nsd_hfx4.bin
index 53e9828..18176e8 100644
Binary files a/src/rom/nsd_hfx4.bin and b/src/rom/nsd_hfx4.bin differ
diff --git a/src/rom/nsd_mmc5.bin b/src/rom/nsd_mmc5.bin
index 2b60a32..ae3ee6d 100644
Binary files a/src/rom/nsd_mmc5.bin and b/src/rom/nsd_mmc5.bin differ
diff --git a/src/rom/nsd_n163.bin b/src/rom/nsd_n163.bin
index 5f57dbe..69ece09 100644
Binary files a/src/rom/nsd_n163.bin and b/src/rom/nsd_n163.bin differ
diff --git a/src/rom/nsd_oall.bin b/src/rom/nsd_oall.bin
index bea3974..b7a951a 100644
Binary files a/src/rom/nsd_oall.bin and b/src/rom/nsd_oall.bin differ
diff --git a/src/rom/nsd_opll.bin b/src/rom/nsd_opll.bin
index b98e769..64663d2 100644
Binary files a/src/rom/nsd_opll.bin and b/src/rom/nsd_opll.bin differ
diff --git a/src/rom/nsd_s5b.bin b/src/rom/nsd_s5b.bin
index a6ff8a6..77a3574 100644
Binary files a/src/rom/nsd_s5b.bin and b/src/rom/nsd_s5b.bin differ
diff --git a/src/rom/nsd_vrc6.bin b/src/rom/nsd_vrc6.bin
index ec3dc67..d1f0ffb 100644
Binary files a/src/rom/nsd_vrc6.bin and b/src/rom/nsd_vrc6.bin differ
diff --git a/src/rom/nsd_vrc7.bin b/src/rom/nsd_vrc7.bin
index 10c056f..b04bd94 100644
Binary files a/src/rom/nsd_vrc7.bin and b/src/rom/nsd_vrc7.bin differ
|