Skip to content

Commit

Permalink
[Reduction] #181: bgm_sound
Browse files Browse the repository at this point in the history
  • Loading branch information
nmlgc committed Aug 25, 2014
1 parent fab08f2 commit 17fa898
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 240 deletions.
76 changes: 76 additions & 0 deletions libs/master.lib/bgm_sound.asm
@@ -0,0 +1,76 @@
; master library - BGM
;
; Description:
; 効果音を出力する
;
; Function/Procedures:
; int bgm_sound(int num);
;
; Parameters:
; num 効果音番号
;
; Returns:
; BGM_COMPLETE 正常終了
; BGM_NO_MUSIC 無効な効果音番号
;
; 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_sound.asm / master.lib 0.22 <- bgmlibs.lib 1.12

func BGM_SOUND
mov BX,SP
push SI
num = (RETSIZE+0)*2
mov SI,SS:[BX+num]
;効果音番号チェック
cmp SI,1
jl short @@ILLEGAL
cmp SI,glb.snum
jle short @@OK
@@ILLEGAL:
mov AX,BGM_NO_MUSIC
pop SI
ret 2
@@OK:
cmp glb.sound,ON
jne short @@NOSOUND
nopcall _BGM_BELL_ORG
mov glb.scnt,SI
;esound[glb.scnt - 1].sptr = esound[glb.scnt - 1].sbuf;
mov BX,SI
shl BX,3
mov AX,offset esound-8
add BX,AX
mov AX,word ptr [BX].sbuf+2
mov word ptr [BX].sptr+2,AX
; mov AX,word ptr [BX].sbuf
; mov word ptr [BX].sptr,AX
mov word ptr [BX].sptr,0 ;sbufのoffsetは0のはず
mov glb.effect,ON
@@NOSOUND:
xor AX,AX ;AX = BGM_COMPLETE
pop SI
ret 2
endfunc
42 changes: 2 additions & 40 deletions th04_main.asm
Expand Up @@ -6262,45 +6262,7 @@ loc_3B00:
; ---------------------------------------------------------------------------
nop
include libs/master.lib/bgm_play.asm

; =============== S U B R O U T I N E =======================================


sub_3CAA proc far
mov bx, sp
push si
mov si, ss:[bx+4]
cmp si, 1
jl short loc_3CBC
cmp si, glb.snum
jle short loc_3CC3

loc_3CBC:
mov ax, 0FFF3h
pop si
retf 2
; ---------------------------------------------------------------------------

loc_3CC3:
cmp glb.sound, 1
jnz short loc_3CED
nopcall _bgm_bell_org
mov glb.scnt, si
mov bx, si
shl bx, 3
mov ax, 369Ah
add bx, ax
mov ax, [bx+6]
mov [bx+2], ax
mov word ptr [bx], 0
mov glb.effect, 1

loc_3CED:
xor ax, ax
pop si
retf 2
sub_3CAA endp

include libs/master.lib/bgm_sound.asm
include libs/master.lib/bgm_effect_sound.asm
include libs/master.lib/bgm_stop_play.asm
include libs/master.lib/bgm_set_tempo.asm
Expand Down Expand Up @@ -37289,7 +37251,7 @@ sub_138EC proc far
loc_13911:
xor ah, ah
push ax
call sub_3CAA
call bgm_sound

loc_13919:
; sub_138EC+23j
Expand Down
42 changes: 2 additions & 40 deletions th04_maine.asm
Expand Up @@ -3319,45 +3319,7 @@ loc_311C:
; ---------------------------------------------------------------------------
nop
include libs/master.lib/bgm_play.asm

; =============== S U B R O U T I N E =======================================


sub_32C6 proc far
mov bx, sp
push si
mov si, ss:[bx+4]
cmp si, 1
jl short loc_32D8
cmp si, glb.snum
jle short loc_32DF

loc_32D8:
mov ax, 0FFF3h
pop si
retf 2
; ---------------------------------------------------------------------------

loc_32DF:
cmp glb.sound, 1
jnz short loc_3309
nopcall _bgm_bell_org
mov glb.scnt, si
mov bx, si
shl bx, 3
mov ax, 1AAAh
add bx, ax
mov ax, [bx+6]
mov [bx+2], ax
mov word ptr [bx], 0
mov glb.effect, 1

loc_3309:
xor ax, ax
pop si
retf 2
sub_32C6 endp

include libs/master.lib/bgm_sound.asm
include libs/master.lib/bgm_effect_sound.asm
include libs/master.lib/bgm_stop_play.asm
include libs/master.lib/bgm_set_tempo.asm
Expand Down Expand Up @@ -21926,7 +21888,7 @@ sub_D5DA proc far
loc_D5FF:
xor ah, ah
push ax
call sub_32C6
call bgm_sound

loc_D607:
inc byte_EB31
Expand Down
42 changes: 2 additions & 40 deletions th04_op.asm
Expand Up @@ -4065,45 +4065,7 @@ loc_38BA:
; ---------------------------------------------------------------------------
nop
include libs/master.lib/bgm_play.asm

; =============== S U B R O U T I N E =======================================


sub_3A64 proc far
mov bx, sp
push si
mov si, ss:[bx+4]
cmp si, 1
jl short loc_3A76
cmp si, glb.snum
jle short loc_3A7D

loc_3A76:
mov ax, 0FFF3h
pop si
retf 2
; ---------------------------------------------------------------------------

loc_3A7D:
cmp glb.sound, 1
jnz short loc_3AA7
nopcall _bgm_bell_org
mov glb.scnt, si
mov bx, si
shl bx, 3
mov ax, 2678h
add bx, ax
mov ax, [bx+6]
mov [bx+2], ax
mov word ptr [bx], 0
mov glb.effect, 1

loc_3AA7:
xor ax, ax
pop si
retf 2
sub_3A64 endp

include libs/master.lib/bgm_sound.asm
include libs/master.lib/bgm_effect_sound.asm
include libs/master.lib/bgm_stop_play.asm
include libs/master.lib/bgm_set_tempo.asm
Expand Down Expand Up @@ -23506,7 +23468,7 @@ sub_E32C proc far
loc_E351:
xor ah, ah
push ax
call sub_3A64
call bgm_sound

loc_E359:
inc byte_FD81
Expand Down
42 changes: 2 additions & 40 deletions th05_main.asm
Expand Up @@ -6171,45 +6171,7 @@ loc_3A9A:
; ---------------------------------------------------------------------------
nop
include libs/master.lib/bgm_play.asm

; =============== S U B R O U T I N E =======================================


sub_3C44 proc far
mov bx, sp
push si
mov si, ss:[bx+4]
cmp si, 1
jl short loc_3C56
cmp si, glb.snum
jle short loc_3C5D

loc_3C56:
mov ax, 0FFF3h
pop si
retf 2
; ---------------------------------------------------------------------------

loc_3C5D:
cmp glb.sound, 1
jnz short loc_3C87
nopcall _bgm_bell_org
mov glb.scnt, si
mov bx, si
shl bx, 3
mov ax, 2FE0h
add bx, ax
mov ax, [bx+6]
mov [bx+2], ax
mov word ptr [bx], 0
mov glb.effect, 1

loc_3C87:
xor ax, ax
pop si
retf 2
sub_3C44 endp

include libs/master.lib/bgm_sound.asm
include libs/master.lib/bgm_effect_sound.asm
include libs/master.lib/bgm_stop_play.asm
include libs/master.lib/bgm_set_tempo.asm
Expand Down Expand Up @@ -37594,7 +37556,7 @@ sub_14D28 proc far
loc_14D4D:
xor ah, ah
push ax
call sub_3C44
call bgm_sound

loc_14D55:
; sub_14D28+23j
Expand Down
42 changes: 2 additions & 40 deletions th05_maine.asm
Expand Up @@ -3765,45 +3765,7 @@ loc_32A2:
; ---------------------------------------------------------------------------
nop
include libs/master.lib/bgm_play.asm

; =============== S U B R O U T I N E =======================================


sub_344C proc far
mov bx, sp
push si
mov si, ss:[bx+4]
cmp si, 1
jl short loc_345E
cmp si, glb.snum
jle short loc_3465

loc_345E:
mov ax, 0FFF3h
pop si
retf 2
; ---------------------------------------------------------------------------

loc_3465:
cmp glb.sound, 1
jnz short loc_348F
nopcall _bgm_bell_org
mov glb.scnt, si
mov bx, si
shl bx, 3
mov ax, 271Eh
add bx, ax
mov ax, [bx+6]
mov [bx+2], ax
mov word ptr [bx], 0
mov glb.effect, 1

loc_348F:
xor ax, ax
pop si
retf 2
sub_344C endp

include libs/master.lib/bgm_sound.asm
include libs/master.lib/bgm_effect_sound.asm
include libs/master.lib/bgm_stop_play.asm
include libs/master.lib/bgm_set_tempo.asm
Expand Down Expand Up @@ -24786,7 +24748,7 @@ sub_EB1A proc far
loc_EB3F:
xor ah, ah
push ax
call sub_344C
call bgm_sound

loc_EB47:
inc byte_107C1
Expand Down

0 comments on commit 17fa898

Please sign in to comment.