diff --git a/libs/master.lib/bgm_set_tempo.asm b/libs/master.lib/bgm_set_tempo.asm new file mode 100644 index 00000000..84b3a398 --- /dev/null +++ b/libs/master.lib/bgm_set_tempo.asm @@ -0,0 +1,66 @@ +; master library - BGM +; +; Description: +; テンポを変更する +; +; Function/Procedures: +; int bgm_set_tempo(int tempo); +; +; Parameters: +; tempo 設定するテンポ +; +; Returns: +; BGM_COMPLETE 正常終了 +; BGM_EXTENT_ERR テンポの値が異常 +; +; Binding Target: +; Microsoft-C / Turbo-C / Turbo Pascal +; +; Running Target: +; PC-9801V +; +; Requiring Resources: +; CPU: V30 +; +; Notes: +; +; +; Assembly Language Note: +; +; +; Compiler/Assembler: +; TASM 3.0 +; OPTASM 1.6 +; +; Author: +; femy(淀 文武) : オリジナル・C言語版 +; steelman(千野 裕司) : アセンブリ言語版 +; +; Revision History: +; 93/12/19 Initial: b_s_temp.asm / master.lib 0.22 <- bgmlibs.lib 1.12 + +func BGM_SET_TEMPO + mov BX,SP + tempo = (RETSIZE+0)*2 + mov CX,SS:[BX+tempo] + cmp CX,TEMPOMIN + jl short @@ILLEGAL + cmp CX,TEMPOMAX + jg short @@ILLEGAL + + CLI + + mov glb.tp,CX + mov AX,word ptr glb.clockbase + mov DX,word ptr glb.clockbase+2 + div CX + mov glb.tval,AX + + STI + + xor AX,AX ; BGM_COMPLETE + ret 2 +@@ILLEGAL: + mov AX,BGM_EXTENT_ERR + ret 2 +endfunc diff --git a/th04_main.asm b/th04_main.asm index 1c4e5e0d..9e2a69b5 100644 --- a/th04_main.asm +++ b/th04_main.asm @@ -6090,9 +6090,7 @@ loc_3818: loc_3826: call sub_3726 push cx - nop - push cs - call near ptr sub_3D86 + nopcall bgm_set_tempo jmp short loc_3807 ; --------------------------------------------------------------------------- nop @@ -6901,34 +6899,7 @@ loc_3D82: retf sub_3D6C endp - -; =============== S U B R O U T I N E ======================================= - - -sub_3D86 proc far - ; sub_3DB4+12Dp - mov bx, sp - mov cx, ss:[bx+4] - cmp cx, 1Eh - jl short loc_3DAE - cmp cx, 0F0h ; '' - jg short loc_3DAE - cli - mov glb.tp, cx - mov ax, word ptr glb.clockbase - mov dx, word ptr glb.clockbase+2 - div cx - mov glb.tval, ax - sti - xor ax, ax - retf 2 -; --------------------------------------------------------------------------- - -loc_3DAE: - mov ax, 0FFF3h - retf 2 -sub_3D86 endp - +include libs/master.lib/bgm_set_tempo.asm ; =============== S U B R O U T I N E ======================================= @@ -7058,9 +7029,7 @@ loc_3ECE: mov word ptr glb.clockbase+2, dx mov word ptr glb.clockbase, ax push 78h ; 'x' - nop - push cs - call near ptr sub_3D86 + nopcall bgm_set_tempo mov bx, 3664h xor dx, dx xor ax, ax diff --git a/th04_maine.asm b/th04_maine.asm index e5190d1d..2beae8f0 100644 --- a/th04_maine.asm +++ b/th04_maine.asm @@ -3147,9 +3147,7 @@ loc_2E34: loc_2E42: call sub_2D42 push cx - nop - push cs - call near ptr sub_33A2 + nopcall bgm_set_tempo jmp short loc_2E23 ; --------------------------------------------------------------------------- nop @@ -3958,34 +3956,7 @@ loc_339E: retf sub_3388 endp - -; =============== S U B R O U T I N E ======================================= - - -sub_33A2 proc far - ; sub_33D0+12Dp - mov bx, sp - mov cx, ss:[bx+4] - cmp cx, 1Eh - jl short loc_33CA - cmp cx, 0F0h ; '' - jg short loc_33CA - cli - mov glb.tp, cx - mov ax, word ptr glb.clockbase - mov dx, word ptr glb.clockbase+2 - div cx - mov glb.tval, ax - sti - xor ax, ax - retf 2 -; --------------------------------------------------------------------------- - -loc_33CA: - mov ax, 0FFF3h - retf 2 -sub_33A2 endp - +include libs/master.lib/bgm_set_tempo.asm ; =============== S U B R O U T I N E ======================================= @@ -4115,9 +4086,7 @@ loc_34EA: mov word ptr glb.clockbase+2, dx mov word ptr glb.clockbase, ax push 78h ; 'x' - nop - push cs - call near ptr sub_33A2 + nopcall bgm_set_tempo mov bx, 1A74h xor dx, dx xor ax, ax diff --git a/th04_op.asm b/th04_op.asm index 31705c1b..8a96e6a6 100644 --- a/th04_op.asm +++ b/th04_op.asm @@ -3893,9 +3893,7 @@ loc_35D2: loc_35E0: call sub_34E0 push cx - nop - push cs - call near ptr sub_3B40 + nopcall bgm_set_tempo jmp short loc_35C1 ; --------------------------------------------------------------------------- nop @@ -4704,34 +4702,7 @@ loc_3B3C: retf sub_3B26 endp - -; =============== S U B R O U T I N E ======================================= - - -sub_3B40 proc far - ; sub_3B6E+12Dp - mov bx, sp - mov cx, ss:[bx+4] - cmp cx, 1Eh - jl short loc_3B68 - cmp cx, 0F0h ; '' - jg short loc_3B68 - cli - mov glb.tp, cx - mov ax, word ptr glb.clockbase - mov dx, word ptr glb.clockbase+2 - div cx - mov glb.tval, ax - sti - xor ax, ax - retf 2 -; --------------------------------------------------------------------------- - -loc_3B68: - mov ax, 0FFF3h - retf 2 -sub_3B40 endp - +include libs/master.lib/bgm_set_tempo.asm ; =============== S U B R O U T I N E ======================================= @@ -4861,9 +4832,7 @@ loc_3C88: mov word ptr glb.clockbase+2, dx mov word ptr glb.clockbase, ax push 78h ; 'x' - nop - push cs - call near ptr sub_3B40 + nopcall bgm_set_tempo mov bx, 2642h xor dx, dx xor ax, ax diff --git a/th05_main.asm b/th05_main.asm index e6da5891..695fa06f 100644 --- a/th05_main.asm +++ b/th05_main.asm @@ -5999,9 +5999,7 @@ loc_37B2: loc_37C0: call sub_36C0 push cx - nop - push cs - call near ptr sub_3D20 + nopcall bgm_set_tempo jmp short loc_37A1 ; --------------------------------------------------------------------------- nop @@ -6810,34 +6808,7 @@ loc_3D1C: retf sub_3D06 endp - -; =============== S U B R O U T I N E ======================================= - - -sub_3D20 proc far - ; sub_3D4E+12Dp - mov bx, sp - mov cx, ss:[bx+4] - cmp cx, 1Eh - jl short loc_3D48 - cmp cx, 0F0h ; '' - jg short loc_3D48 - cli - mov glb.tp, cx - mov ax, word ptr glb.clockbase - mov dx, word ptr glb.clockbase+2 - div cx - mov glb.tval, ax - sti - xor ax, ax - retf 2 -; --------------------------------------------------------------------------- - -loc_3D48: - mov ax, 0FFF3h - retf 2 -sub_3D20 endp - +include libs/master.lib/bgm_set_tempo.asm ; =============== S U B R O U T I N E ======================================= @@ -6968,9 +6939,7 @@ loc_3E68: mov word ptr glb.clockbase+2, dx mov word ptr glb.clockbase, ax push 78h ; 'x' - nop - push cs - call near ptr sub_3D20 + nopcall bgm_set_tempo mov bx, 2FAAh xor dx, dx xor ax, ax diff --git a/th05_maine.asm b/th05_maine.asm index db24fa7f..18c449ee 100644 --- a/th05_maine.asm +++ b/th05_maine.asm @@ -3593,9 +3593,7 @@ loc_2FBA: loc_2FC8: call sub_2EC8 push cx - nop - push cs - call near ptr sub_3528 + nopcall bgm_set_tempo jmp short loc_2FA9 ; --------------------------------------------------------------------------- nop @@ -4404,34 +4402,7 @@ loc_3524: retf sub_350E endp - -; =============== S U B R O U T I N E ======================================= - - -sub_3528 proc far - ; sub_3556+12Dp - mov bx, sp - mov cx, ss:[bx+4] - cmp cx, 1Eh - jl short loc_3550 - cmp cx, 0F0h ; 'E - jg short loc_3550 - cli - mov glb.tp, cx - mov ax, word ptr glb.clockbase - mov dx, word ptr glb.clockbase+2 - div cx - mov glb.tval, ax - sti - xor ax, ax - retf 2 -; --------------------------------------------------------------------------- - -loc_3550: - mov ax, 0FFF3h - retf 2 -sub_3528 endp - +include libs/master.lib/bgm_set_tempo.asm ; =============== S U B R O U T I N E ======================================= @@ -4561,9 +4532,7 @@ loc_3670: mov word ptr glb.clockbase+2, dx mov word ptr glb.clockbase, ax push 78h ; 'x' - nop - push cs - call near ptr sub_3528 + nopcall bgm_set_tempo mov bx, 26E8h xor dx, dx xor ax, ax diff --git a/th05_op.asm b/th05_op.asm index efae0fd7..cde54b3b 100644 --- a/th05_op.asm +++ b/th05_op.asm @@ -3013,9 +3013,7 @@ loc_2DF2: loc_2E00: call sub_2D00 push cx - nop - push cs - call near ptr sub_3360 + nopcall bgm_set_tempo jmp short loc_2DE1 ; --------------------------------------------------------------------------- nop @@ -3824,34 +3822,7 @@ loc_335C: retf sub_3346 endp - -; =============== S U B R O U T I N E ======================================= - - -sub_3360 proc far - ; sub_338E+12Dp - mov bx, sp - mov cx, ss:[bx+4] - cmp cx, 1Eh - jl short loc_3388 - cmp cx, 0F0h ; '' - jg short loc_3388 - cli - mov glb.tp, cx - mov ax, word ptr glb.clockbase - mov dx, word ptr glb.clockbase+2 - div cx - mov glb.tval, ax - sti - xor ax, ax - retf 2 -; --------------------------------------------------------------------------- - -loc_3388: - mov ax, 0FFF3h - retf 2 -sub_3360 endp - +include libs/master.lib/bgm_set_tempo.asm ; =============== S U B R O U T I N E ======================================= @@ -3981,9 +3952,7 @@ loc_34A8: mov word ptr glb.clockbase+2, dx mov word ptr glb.clockbase, ax push 78h ; 'x' - nop - push cs - call near ptr sub_3360 + nopcall bgm_set_tempo mov bx, 376Ch xor dx, dx xor ax, ax