mirror of https://github.com/nmlgc/ReC98.git
[Reverse-engineering] [th03/th04/th05] snd_delay_until_measure
This commit is contained in:
parent
e8c9876bef
commit
811ba84e3f
|
@ -0,0 +1,40 @@
|
|||
public SND_DELAY_UNTIL_MEASURE
|
||||
snd_delay_until_measure proc far
|
||||
|
||||
@@frames_if_no_bgm = word ptr 6
|
||||
@@measure = word ptr 8
|
||||
|
||||
push bp
|
||||
mov bp, sp
|
||||
if GAME eq 4
|
||||
cmp _snd_bgm_mode, SND_BGM_OFF
|
||||
else
|
||||
cmp _snd_active, 0
|
||||
endif
|
||||
jnz short @@retry
|
||||
push [bp+@@frames_if_no_bgm]
|
||||
nopcall frame_delay
|
||||
pop bp
|
||||
retf 4
|
||||
|
||||
@@retry:
|
||||
mov ah, KAJA_GET_SONG_MEASURE
|
||||
if GAME eq 4
|
||||
cmp _snd_bgm_mode, SND_BGM_MIDI
|
||||
else
|
||||
cmp _snd_midi_active, 1
|
||||
endif
|
||||
jz short @@MIDI_is_active
|
||||
int PMD
|
||||
jmp short @@reached?
|
||||
|
||||
@@MIDI_is_active:
|
||||
mov dx, MMD_TICKS_PER_QUARTER_NOTE * 4 ; yes, hardcoded to 4/4
|
||||
int MMD
|
||||
|
||||
@@reached?:
|
||||
cmp ax, [bp+@@measure]
|
||||
jb short @@retry
|
||||
pop bp
|
||||
retf 4
|
||||
snd_delay_until_measure endp
|
|
@ -0,0 +1,4 @@
|
|||
// Adds a customizable delay to the TH02 version.
|
||||
int snd_delay_until_measure(
|
||||
unsigned int measure, unsigned int frames_if_no_bgm
|
||||
);
|
|
@ -342,7 +342,7 @@ sub_978D proc near
|
|||
push 2
|
||||
call palette_black_in
|
||||
push 60010h
|
||||
call sub_D3FC
|
||||
call snd_delay_until_measure
|
||||
mov si, 1
|
||||
jmp short loc_97FC
|
||||
; ---------------------------------------------------------------------------
|
||||
|
@ -359,7 +359,7 @@ loc_97FC:
|
|||
cmp si, 5
|
||||
jl short loc_97E8
|
||||
push 0A0040h
|
||||
call sub_D3FC
|
||||
call snd_delay_until_measure
|
||||
mov PaletteTone, 0C8h
|
||||
call far ptr palette_show
|
||||
push (224 shl 16) or 64
|
||||
|
@ -374,7 +374,7 @@ loc_97FC:
|
|||
call far ptr palette_show
|
||||
call cdg_freeall
|
||||
push 0B0004h
|
||||
call sub_D3FC
|
||||
call snd_delay_until_measure
|
||||
push 1
|
||||
call palette_white_in
|
||||
push 8
|
||||
|
@ -2073,7 +2073,7 @@ loc_A7E7:
|
|||
jz short loc_A814
|
||||
push [bp+var_2]
|
||||
push [bp+var_4]
|
||||
call sub_D3FC
|
||||
call snd_delay_until_measure
|
||||
jmp loc_AB63
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
|
@ -4215,7 +4215,7 @@ sub_B92E proc near
|
|||
push 1
|
||||
call palette_black_in
|
||||
push 30040h
|
||||
call sub_D3FC
|
||||
call snd_delay_until_measure
|
||||
push 1
|
||||
call palette_black_out
|
||||
kajacall KAJA_SONG_STOP
|
||||
|
@ -5955,48 +5955,7 @@ loc_D3EB:
|
|||
retf 0Ah
|
||||
graph_putsa_fx endp
|
||||
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
; Attributes: bp-based frame
|
||||
|
||||
sub_D3FC proc far
|
||||
|
||||
arg_0 = word ptr 6
|
||||
arg_2 = word ptr 8
|
||||
|
||||
push bp
|
||||
mov bp, sp
|
||||
cmp _snd_active, 0
|
||||
jnz short loc_D412
|
||||
push [bp+arg_0]
|
||||
nopcall frame_delay
|
||||
pop bp
|
||||
retf 4
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_D412:
|
||||
mov ah, KAJA_GET_SONG_MEASURE
|
||||
cmp _snd_midi_active, 1
|
||||
jz short loc_D41F
|
||||
int 60h ; - FTP Packet Driver - BASIC FUNC - TERMINATE DRIVER FOR HANDLE
|
||||
; BX = handle
|
||||
; Return: CF set on error, DH = error code
|
||||
; CF clear if successful
|
||||
jmp short loc_D424
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_D41F:
|
||||
mov dx, MMD_TICKS_PER_QUARTER_NOTE * 4 ; yes, hardcoded to 4/4
|
||||
int 61h ; reserved for user interrupt
|
||||
|
||||
loc_D424:
|
||||
cmp ax, [bp+arg_2]
|
||||
jb short loc_D412
|
||||
pop bp
|
||||
retf 4
|
||||
sub_D3FC endp
|
||||
|
||||
include th03/snd/delaymea.asm
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
|
|
|
@ -1233,7 +1233,7 @@ loc_A9AB:
|
|||
jnz loc_ADB5 ; default
|
||||
push [bp+var_2]
|
||||
push [bp+var_4]
|
||||
call sub_D046
|
||||
call snd_delay_until_measure
|
||||
jmp loc_ACFF
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
|
@ -2473,7 +2473,7 @@ sub_B44D proc near
|
|||
call cdg_load_single pascal, 0, ds, offset aSff1_cdg, 0
|
||||
call cdg_load_single_noalpha pascal, 1, ds, offset aSff1b_cdg, 0
|
||||
push 30040h
|
||||
call sub_D046
|
||||
call snd_delay_until_measure
|
||||
mov byte_124C6, 0
|
||||
mov fp_124C8, offset sub_AED0
|
||||
push 16000A0h
|
||||
|
@ -2481,7 +2481,7 @@ sub_B44D proc near
|
|||
call cdg_load_single pascal, 2, ds, offset aSff2_cdg, 0
|
||||
call cdg_load_single_noalpha pascal, 3, ds, offset aSff2b_cdg, 0
|
||||
push 700A0h
|
||||
call sub_D046
|
||||
call snd_delay_until_measure
|
||||
mov fp_124C8, offset sub_B02D
|
||||
push 16000A0h
|
||||
call sub_B31E
|
||||
|
@ -2494,11 +2494,11 @@ sub_B44D proc near
|
|||
call cdg_load_single pascal, 0, ds, offset aSff3_cdg, 0
|
||||
call cdg_load_single_noalpha pascal, 1, ds, offset aSff3b_cdg, 0
|
||||
push 0B00A0h
|
||||
call sub_D046
|
||||
call snd_delay_until_measure
|
||||
push 12000C8h
|
||||
call sub_B291
|
||||
push 1300A0h
|
||||
call sub_D046
|
||||
call snd_delay_until_measure
|
||||
mov fp_124C8, offset sub_B02D
|
||||
push 0C00080h
|
||||
push 12000C8h
|
||||
|
@ -2519,7 +2519,7 @@ sub_B44D proc near
|
|||
call cdg_load_single pascal, 2, ds, offset aSff4_cdg, 0
|
||||
call cdg_load_single_noalpha pascal, 3, ds, offset aSff4b_cdg, 0
|
||||
push 1700A0h
|
||||
call sub_D046
|
||||
call snd_delay_until_measure
|
||||
mov byte_124C6, 2
|
||||
mov fp_124C8, offset sub_B144
|
||||
push 200070h
|
||||
|
@ -2528,7 +2528,7 @@ sub_B44D proc near
|
|||
call cdg_load_single pascal, 4, ds, offset aSff5_cdg, 0
|
||||
call cdg_load_single_noalpha pascal, 5, ds, offset aSff5b_cdg, 0
|
||||
push 1B00A0h
|
||||
call sub_D046
|
||||
call snd_delay_until_measure
|
||||
mov byte_124C6, 4
|
||||
mov fp_124C8, offset sub_B02D
|
||||
push 2000B8h
|
||||
|
@ -2536,7 +2536,7 @@ sub_B44D proc near
|
|||
call cdg_load_single pascal, 0, ds, offset aSff8_cdg, 0
|
||||
call cdg_load_single_noalpha pascal, 1, ds, offset aSff8b_cdg, 0
|
||||
push 1F00A0h
|
||||
call sub_D046
|
||||
call snd_delay_until_measure
|
||||
mov fp_124C8, offset sub_B144
|
||||
push 2000B8h
|
||||
call sub_B31E
|
||||
|
@ -2546,7 +2546,7 @@ sub_B44D proc near
|
|||
call cdg_load_single pascal, 4, ds, offset aSff9_cdg, 0
|
||||
call cdg_load_single_noalpha pascal, 5, ds, offset aSff9b_cdg, 0
|
||||
push 2300A0h
|
||||
call sub_D046
|
||||
call snd_delay_until_measure
|
||||
mov fp_124C8, offset sub_AED0
|
||||
push 4000B8h
|
||||
call sub_B31E
|
||||
|
@ -2556,7 +2556,7 @@ sub_B44D proc near
|
|||
call cdg_load_single pascal, 0, ds, offset aSff6_cdg, 0
|
||||
call cdg_load_single_noalpha pascal, 1, ds, offset aSff6b_cdg, 0
|
||||
push 2700A0h
|
||||
call sub_D046
|
||||
call snd_delay_until_measure
|
||||
mov fp_124C8, offset sub_B02D
|
||||
push 4000B8h
|
||||
call sub_B31E
|
||||
|
@ -2564,7 +2564,7 @@ sub_B44D proc near
|
|||
push 2000B8h
|
||||
call sub_B291
|
||||
push 2B00A0h
|
||||
call sub_D046
|
||||
call snd_delay_until_measure
|
||||
mov fp_124C8, offset sub_B144
|
||||
push 200070h
|
||||
push 2000B8h
|
||||
|
@ -2575,7 +2575,7 @@ sub_B44D proc near
|
|||
push 200150h
|
||||
call sub_B291
|
||||
push 3000A0h
|
||||
call sub_D046
|
||||
call snd_delay_until_measure
|
||||
call sub_D6C4
|
||||
call cdg_freeall
|
||||
push 4
|
||||
|
@ -5104,49 +5104,7 @@ include th04/snd/pmd_res.asm
|
|||
include th02/snd/mmd_res.asm
|
||||
include th04/snd/kajaint.asm
|
||||
include th04/snd/detmodes.asm
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
; Attributes: bp-based frame
|
||||
|
||||
sub_D046 proc far
|
||||
|
||||
arg_0 = word ptr 6
|
||||
arg_2 = word ptr 8
|
||||
|
||||
push bp
|
||||
mov bp, sp
|
||||
cmp _snd_bgm_mode, SND_BGM_OFF
|
||||
jnz short loc_D05C
|
||||
push [bp+arg_0]
|
||||
nopcall frame_delay
|
||||
pop bp
|
||||
retf 4
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_D05C:
|
||||
mov ah, KAJA_GET_SONG_MEASURE
|
||||
cmp _snd_bgm_mode, SND_BGM_MIDI
|
||||
jz short loc_D069
|
||||
int 60h ; - FTP Packet Driver - BASIC FUNC - TERMINATE DRIVER FOR HANDLE
|
||||
; BX = handle
|
||||
; Return: CF set on error, DH = error code
|
||||
; CF clear if successful
|
||||
jmp short loc_D06E
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_D069:
|
||||
mov dx, MMD_TICKS_PER_QUARTER_NOTE * 4 ; yes, hardcoded to 4/4
|
||||
int 61h ; reserved for user interrupt
|
||||
|
||||
loc_D06E:
|
||||
cmp ax, [bp+arg_2]
|
||||
jb short loc_D05C
|
||||
pop bp
|
||||
retf 4
|
||||
sub_D046 endp
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
include th03/snd/delaymea.asm
|
||||
db 0
|
||||
include th04/formats/cdg_put_plane.asm
|
||||
include th04/snd/load.asm
|
||||
|
|
45
th04_op.asm
45
th04_op.asm
|
@ -2400,7 +2400,7 @@ loc_BD2A:
|
|||
cmp si, 100h
|
||||
jl short loc_BD1E
|
||||
push 20000h
|
||||
call sub_DD80
|
||||
call snd_delay_until_measure
|
||||
mov PaletteTone, 64h ; 'd'
|
||||
call far ptr palette_show
|
||||
push ds
|
||||
|
@ -5377,48 +5377,7 @@ include th02/snd/mmd_res.asm
|
|||
include th04/snd/kajaint.asm
|
||||
include th04/formats/cdg_put_nocolors.asm
|
||||
include th04/snd/detmodes.asm
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
; Attributes: bp-based frame
|
||||
|
||||
sub_DD80 proc far
|
||||
|
||||
arg_0 = word ptr 6
|
||||
arg_2 = word ptr 8
|
||||
|
||||
push bp
|
||||
mov bp, sp
|
||||
cmp _snd_bgm_mode, SND_BGM_OFF
|
||||
jnz short loc_DD96
|
||||
push [bp+arg_0]
|
||||
nopcall frame_delay
|
||||
pop bp
|
||||
retf 4
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_DD96:
|
||||
mov ah, KAJA_GET_SONG_MEASURE
|
||||
cmp _snd_bgm_mode, SND_BGM_MIDI
|
||||
jz short loc_DDA3
|
||||
int 60h ; - FTP Packet Driver - BASIC FUNC - TERMINATE DRIVER FOR HANDLE
|
||||
; BX = handle
|
||||
; Return: CF set on error, DH = error code
|
||||
; CF clear if successful
|
||||
jmp short loc_DDA8
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_DDA3:
|
||||
mov dx, MMD_TICKS_PER_QUARTER_NOTE * 4 ; yes, hardcoded to 4/4
|
||||
int 61h ; reserved for user interrupt
|
||||
|
||||
loc_DDA8:
|
||||
cmp ax, [bp+arg_2]
|
||||
jb short loc_DD96
|
||||
pop bp
|
||||
retf 4
|
||||
sub_DD80 endp
|
||||
|
||||
include th03/snd/delaymea.asm
|
||||
include th02/exit_dos.asm
|
||||
include th04/snd/load.asm
|
||||
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
public SND_DELAY_UNTIL_MEASURE
|
||||
snd_delay_until_measure proc far
|
||||
|
||||
@@frames_if_no_bgm = word ptr 6
|
||||
@@measure = word ptr 8
|
||||
|
||||
push bp
|
||||
mov bp, sp
|
||||
push si
|
||||
|
||||
@@retry:
|
||||
call _snd_bgm_measure
|
||||
mov si, ax
|
||||
or si, si
|
||||
jge short @@reached?
|
||||
push [bp+@@frames_if_no_bgm]
|
||||
nopcall frame_delay
|
||||
jmp short @@ret
|
||||
|
||||
@@reached?:
|
||||
cmp si, [bp+@@measure]
|
||||
jl short @@retry
|
||||
|
||||
@@ret:
|
||||
pop si
|
||||
pop bp
|
||||
retf 4
|
||||
snd_delay_until_measure endp
|
||||
db 0
|
|
@ -992,7 +992,7 @@ loc_AB4A:
|
|||
jnz loc_AF8F ; default
|
||||
push [bp+var_2]
|
||||
push [bp+var_4]
|
||||
call sub_F25F
|
||||
call snd_delay_until_measure
|
||||
jmp loc_AF8F ; default
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
|
@ -8681,43 +8681,7 @@ include th04/hardware/input_sense.asm
|
|||
include th05/hardware/input_held.asm
|
||||
include th05/hardware/input_wait.asm
|
||||
include th05/snd/measure.asm
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
; Attributes: bp-based frame
|
||||
|
||||
sub_F25F proc far
|
||||
|
||||
arg_0 = word ptr 6
|
||||
arg_2 = word ptr 8
|
||||
|
||||
push bp
|
||||
mov bp, sp
|
||||
push si
|
||||
|
||||
loc_F263:
|
||||
call _snd_bgm_measure
|
||||
mov si, ax
|
||||
or si, si
|
||||
jge short loc_F277
|
||||
push [bp+arg_0]
|
||||
nopcall frame_delay
|
||||
jmp short loc_F27C
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_F277:
|
||||
cmp si, [bp+arg_2]
|
||||
jl short loc_F263
|
||||
|
||||
loc_F27C:
|
||||
pop si
|
||||
pop bp
|
||||
retf 4
|
||||
sub_F25F endp
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
db 0
|
||||
|
||||
include th05/snd/delaymea.asm
|
||||
include th05/hardware/frame_delay.asm
|
||||
db 0
|
||||
include th04/formats/cdg_load.asm
|
||||
|
|
40
th05_op.asm
40
th05_op.asm
|
@ -2342,7 +2342,7 @@ loc_B8F4:
|
|||
jl short loc_B8E8
|
||||
;}
|
||||
push 20000h
|
||||
call sub_E0F1
|
||||
call snd_delay_until_measure
|
||||
mov PaletteTone, 64h ; 'd'
|
||||
call far ptr palette_show
|
||||
push ds
|
||||
|
@ -5945,43 +5945,7 @@ include th04/hardware/input_sense.asm
|
|||
include th05/hardware/input_held.asm
|
||||
include th05/hardware/input_wait.asm
|
||||
include th05/snd/measure.asm
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
; Attributes: bp-based frame
|
||||
|
||||
sub_E0F1 proc far
|
||||
|
||||
arg_0 = word ptr 6
|
||||
arg_2 = word ptr 8
|
||||
|
||||
push bp
|
||||
mov bp, sp
|
||||
push si
|
||||
|
||||
loc_E0F5:
|
||||
call _snd_bgm_measure
|
||||
mov si, ax
|
||||
or si, si
|
||||
jge short loc_E109
|
||||
push [bp+arg_0]
|
||||
nopcall frame_delay
|
||||
jmp short loc_E10E
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_E109:
|
||||
cmp si, [bp+arg_2]
|
||||
jl short loc_E0F5
|
||||
|
||||
loc_E10E:
|
||||
pop si
|
||||
pop bp
|
||||
retf 4
|
||||
sub_E0F1 endp
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
db 0
|
||||
|
||||
include th05/snd/delaymea.asm
|
||||
include th04/formats/cdg_put_nocolors.asm
|
||||
include th05/hardware/frame_delay.asm
|
||||
db 0
|
||||
|
|
Loading…
Reference in New Issue