[Separate translation units] [th02] snd_determine_mode()

Perfectly decompilable with pseudo-registers. Why did I decide against
them in 2015?

Part of P0133, funded by [Anonymous].
This commit is contained in:
nmlgc 2021-01-28 20:34:05 +01:00
parent 5bbc08c3ef
commit cdbd621f91
7 changed files with 33 additions and 23 deletions

View File

@ -78,17 +78,17 @@ bin\th02\zun_res.com: th02\zun_res1.c th02\zun_res2.c th02\zun_res3.c
$**
| masters.lib
bin\th02\op.exe: th02\op_01.cpp bin\exit_dos.obj bin\th02\zunerror.obj bin\th02\grppsafx.obj bin\th02\op.obj th02\op_02_1.cpp bin\th02\pi_load.obj bin\th02\grp_rect.obj bin\frmdely2.obj th02\op_02_2.cpp bin\th02\snd_pmdr.obj bin\th02\snd_load.obj bin\th02\pi_put.obj bin\th02\snd_kaja.obj th02\op_02_3.cpp bin\th02\snd_se.obj bin\frmdely1.obj th02\op_03.cpp th02\op_04.cpp th02\op_05.cpp th02\op_06.cpp
bin\th02\op.exe: th02\op_01.cpp bin\exit_dos.obj bin\th02\zunerror.obj bin\th02\grppsafx.obj bin\th02\op.obj th02\op_02_1.cpp bin\th02\pi_load.obj bin\th02\grp_rect.obj bin\frmdely2.obj th02\op_02_2.cpp bin\th02\snd_mode.obj bin\th02\snd_pmdr.obj bin\th02\snd_load.obj bin\th02\pi_put.obj bin\th02\snd_kaja.obj th02\op_02_3.cpp bin\th02\snd_se.obj bin\frmdely1.obj th02\op_03.cpp th02\op_04.cpp th02\op_05.cpp th02\op_06.cpp
$(CC) $(CFLAGS) -ml -Z -DGAME=2 -nbin\th02\ -eOP.EXE @&&|
$**
|
bin\th02\main.exe: bin\th02\main.obj bin\th02\zunerror.obj th02\main02_1.cpp bin\th02\pi_load.obj bin\th02\vector.obj bin\frmdely1.obj th02\main02_2.cpp bin\th02\snd_pmdr.obj bin\th02\snd_dlyv.obj bin\th02\snd_load.obj th02\mptn_i.cpp bin\th02\initmain.obj bin\th02\pi_put.obj bin\th02\snd_kaja.obj bin\th02\snd_dlym.obj bin\th02\snd_se.obj th02\main_03.cpp
bin\th02\main.exe: bin\th02\main.obj bin\th02\zunerror.obj th02\main02_1.cpp bin\th02\pi_load.obj bin\th02\vector.obj bin\frmdely1.obj th02\main02_2.cpp bin\th02\snd_mode.obj bin\th02\snd_pmdr.obj bin\th02\snd_dlyv.obj bin\th02\snd_load.obj th02\mptn_i.cpp bin\th02\initmain.obj bin\th02\pi_put.obj bin\th02\snd_kaja.obj bin\th02\snd_dlym.obj bin\th02\snd_se.obj th02\main_03.cpp
$(CC) $(CFLAGS) -ml -Z -DGAME=2 -nbin\th02\ -eMAIN.EXE @&&|
$**
|
bin\th02\maine.exe: bin\th02\maine.obj bin\th02\grppsafx.obj th02\maine021.cpp bin\th02\pi_load.obj bin\frmdely1.obj th02\maine022.cpp bin\th02\snd_pmdr.obj bin\th02\snd_load.obj bin\th02\initmain.obj bin\th02\pi_put.obj bin\th02\snd_kaja.obj bin\th02\snd_dlym.obj th02\maine_03.c th02\maine_04.cpp th02\maine_05.cpp
bin\th02\maine.exe: bin\th02\maine.obj bin\th02\grppsafx.obj th02\maine021.cpp bin\th02\pi_load.obj bin\frmdely1.obj th02\maine022.cpp bin\th02\snd_mode.obj bin\th02\snd_pmdr.obj bin\th02\snd_load.obj bin\th02\initmain.obj bin\th02\pi_put.obj bin\th02\snd_kaja.obj bin\th02\snd_dlym.obj th02\maine_03.c th02\maine_04.cpp th02\maine_05.cpp
$(CC) $(CFLAGS) -ml -3 -Z -DGAME=2 -nbin\th02\ -eMAINE.EXE @&&|
$**
|

View File

@ -18,5 +18,4 @@ extern "C" {
#include "th02/hardware/input.c"
#include "th02/exit.c"
#include "th02/snd/mmd_res.c"
#include "th02/snd/detmode.c"
}

View File

@ -21,5 +21,4 @@ extern const char pf_fn[] = PF_FN;
#include "th02/hardware/input.c"
#include "th02/exit.c"
#include "th02/snd/mmd_res.c"
#include "th02/snd/detmode.c"
}

View File

@ -29,5 +29,4 @@ const char pf_fn[] = PF_FN;
#pragma codestring "\x00"
#include "th02/snd/mmd_res.c"
#include "th02/snd/detmode.c"
}

View File

@ -1,16 +1,24 @@
int snd_determine_mode(void)
{
__asm mov ah, PMD_GET_DRIVER_VERSION;
__asm int PMD;
_BX = 0;
if(_AL != 0xFF) {
__asm inc bx;
snd_fm_possible = 1;
} else {
__asm mov bl, snd_midi_active;
}
__asm mov snd_active, bl;
return _BX;
}
#pragma codestring "\x90"
#pragma codeseg SHARED
#pragma option -k-
#include <dos.h>
#include "platform.h"
#include "libs/kaja/kaja.h"
#include "th02/snd/snd.h"
bool16 snd_determine_mode(void)
{
_AH = PMD_GET_DRIVER_VERSION;
geninterrupt(PMD);
_BX = false;
if(_AL != 0xFF) {
_BX++;
snd_fm_possible = true;
} else {
_BL = snd_midi_active;
}
snd_active = _BL;
return _BX;
}
#pragma codestring "\x90"

View File

@ -31,7 +31,11 @@ bool16 snd_pmd_resident(void);
int snd_mmd_resident(void);
#endif
int snd_determine_mode(void);
// Checks whether an FM sound source is active, and sets [snd_fm_possible]
// and [snd_active]. In the absence of an FM source, [snd_active] is set to
// [snd_midi_active]. Returns the new value of [snd_active].
bool16 snd_determine_mode(void);
int16_t DEFCONV snd_kaja_interrupt(int16_t ax);
#define snd_kaja_func(func, param) snd_kaja_interrupt((func) << 8 | (param))

1
th02/snd_mode.c Normal file
View File

@ -0,0 +1 @@
#include "th02/snd/detmode.c"