Skip to content

Commit

Permalink
fix: Mercury-Unit V3.5 identify
Browse files Browse the repository at this point in the history
  • Loading branch information
kg68k committed Feb 26, 2024
1 parent 7ee3cb7 commit 431b620
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 38 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# 変更履歴

## 4.10 (2024-02-27)

* Mercury-Unit V3.5を正しく判別できない不具合を修正。
* Mercury-Unit V3.5でハーフレート設定時は`-m(--m35)`なしでもV3.5と表示するようにした。


## 4.09 (2024-02-09)

* PhantomX装着時はWINPORTが有効でもエミュレータと見なさないようにした。
13 changes: 9 additions & 4 deletions si.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,16 @@

-m / --m35

 Mercury-Unit の V3.1 以下と V3.5 の判別を行います。ただし、ボードの
設定が変更されたり、動作中に実行すると音が乱れる可能性があります。
 Mercury-Unit の V3.1 以下と V3.5 は再生周波数をハーフレートに設定で
きるかどうかで判別できますが、フルレートで再生中にハーフレートに変更す
ると音が乱れるので、通常はこの方法による判別は行いません。

 このオプションを指定しない場合、V3.5 以下と V4 / V4 OPNA 付きの判別
のみ行い、V3.1 以下と V3.5 は同一視されます。
 このオプションを指定するとハーフレートへの変更を試みて判別を行います。
ただし、再生中に実行すると音が乱れることがあります。

 このオプションを指定しない場合は V3.5 以下と V4 / V4 OPNA 付きの判別
のみ行います。V3.5 でハーフレートに設定されている場合はこのオプション
なしでも判別されます。

 -f-merc と併用する場合は必ず -m / --m35 オプションの方を先に記述して
下さい。
Expand Down
74 changes: 42 additions & 32 deletions src/si.s
Original file line number Diff line number Diff line change
Expand Up @@ -3246,9 +3246,13 @@ print_iob_no_fs_b:


* Mercury-Unit
bsr is_exist_mercury_unit2
bsr is_exist_mercury_unit
tst d0
beq print_iob_no_mu

move.b (opt_m35_flag,a6),d1
bsr identify_mercury_unit35

lea (a3),a2
lea (b_mu,pc),a1
btst d0,#1<<MERC_V4+1<<MERC_V4OPNA
Expand Down Expand Up @@ -4521,51 +4525,57 @@ is_exist_midi:
*└────────────────────────────────────────┘

sw_f_mercury:
bsr is_exist_mercury_unit2
bsr is_exist_mercury_unit
move.b (opt_m35_flag,a6),d1 ;互換性のため、-m(--m35)無指定時は
beq @f ;ハーフレートでもV3.5と判別しない
bsr identify_mercury_unit35
@@:
bra exit_d0


* ~V3.1/V3.5 判別付き Mercury-Unit 存在検査.
* out d0.l 0:存在しない
* 1:Mercury-Unit ~V3.1
* 2:Mercury-Unit V4(MK-MU1)
* 3:Mercury-Unit V4 with OPN3-L(MK-MU1O)
* 4:Mercury-Unit V3.5
* ccr <tst.l d0> の結果
* 仕様:
* 設定が破壊されたり、動作中に実行すると音が乱れる可能性がある.

MERC_NON: .equ 0
MERC_V3: .equ 1
MERC_V4: .equ 2
MERC_V4OPNA: .equ 3
MERC_V35: .equ 4

is_exist_mercury_unit2:
PUSH d1/a0
move sr,-(sp)
bsr is_exist_mercury_unit
tst.b (opt_m35_flag,a6)
beq is_exist_mu2_end
* Mercury-Unit の V3.1 以下と V3.5 を判別する。
* in d0.l is_exist_mercury_unit の返り値(0:なし 1:~V4.1 2:MK-MU1 3:MK-MU1O)
* d1.b 動作モードを変更しての判別を行うか(0:しない それ以外:する)
* out d0.l 0:存在しない
* 1:V3.1 以下、またはV3.1/V3.5を判別しない
* 2:V4(MK-MU1)
* 3:V4 with OPN3-L(MK-MU1O)
* 4:V3.5
* 仕様:
* 入出力中に実行すると音が乱れることがある。

identify_mercury_unit35:
cmpi #MERC_V3,d0
bne is_exist_mu2_end
bne 9f

PUSH d2-d3/a0
lea (MU_COMMAND),a0
tst.b (MU_STATUS-MU_COMMAND)
bpl is_exist_mu2_v35 ;既にハーフレートに設定されている
tst.b (MU_STATUS-MU_COMMAND,a0)
bpl identify_mu35_v35 ;すでにハーフレートに設定されていれば V3.5
tst.b d1
beq 8f ;動作モードを変更しての判別は行わない

DI
and.b #$7f,(a0) ;ハーフレートにしてみる
tst.b (MU_STATUS-MU_COMMAND)
bmi is_exist_mu2_end ;変化しなかったら ~V3.1

tas (a0) ;元に戻す
is_exist_mu2_v35:
moveq #MERC_V35,d0 ;ハーフレートに出来れば V3.5
is_exist_mu2_end:
moveq #$7f,d2
PUSH_SR_DI
move.b (a0),d3
and.b d3,d2 ;bit7=0
move.b d2,(a0) ;ハーフレートにしてみる
move.b (MU_STATUS-MU_COMMAND,a0),d2
move.b d3,(a0) ;元の設定に戻す
POP_SR
POP d1/a0
tst.l d0
tst.b d2
bmi 8f ;ハーフレートにならなかったら V3.1 以下
identify_mu35_v35:
moveq #MERC_V35,d0 ;ハーフレートになれば V3.5
8:
POP d2-d3/a0
9:
rts


Expand Down
4 changes: 2 additions & 2 deletions src/si_ver.mac
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
SIEE_VERSION: .reg '4.09'
SIEE_DATE: .reg '2024-02-09'
SIEE_VERSION: .reg '4.10'
SIEE_DATE: .reg '2024-02-27'

0 comments on commit 431b620

Please sign in to comment.