[Scummvm-git-logs] scummvm master -> 71098c697adb9508f36ea2139b35c1c18cb85061
dreammaster
noreply at scummvm.org
Mon Aug 10 05:52:58 UTC 2026
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
b67afcf8a7 MADS: FOREST: Update TODO as an explicit workaround
71098c697a MADS: Remove memory location references from sound code comments
Commit: b67afcf8a77cfbe0075d1cc8602bd24e8af94465
https://github.com/scummvm/scummvm/commit/b67afcf8a77cfbe0075d1cc8602bd24e8af94465
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-08-10T12:43:26+10:00
Commit Message:
MADS: FOREST: Update TODO as an explicit workaround
Changed paths:
engines/mads/forest/rooms/room104.cpp
diff --git a/engines/mads/forest/rooms/room104.cpp b/engines/mads/forest/rooms/room104.cpp
index cdca02ec3c5..5efb2ea1378 100644
--- a/engines/mads/forest/rooms/room104.cpp
+++ b/engines/mads/forest/rooms/room104.cpp
@@ -848,7 +848,10 @@ static void room_104_daemon() {
case 100:
kernel_abort_animation(aa[0]);
- // TODO: word_79954 = 0;
+
+ // WORKAROUND: Nonsensical assignment from the original disabled
+ //room_510_array1[52].quote_id = 0;
+
global[g131] = -1;
global[g141] = -1;
kernel_reset_animation(scratch._9a, 1);
Commit: 71098c697adb9508f36ea2139b35c1c18cb85061
https://github.com/scummvm/scummvm/commit/71098c697adb9508f36ea2139b35c1c18cb85061
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-08-10T15:50:32+10:00
Commit Message:
MADS: Remove memory location references from sound code comments
Changed paths:
engines/mads/core/conv.cpp
engines/mads/dragonsphere/sound/asound.cpp
engines/mads/dragonsphere/sound/asound.h
engines/mads/dragonsphere/sound/asound_dragonsphere.cpp
engines/mads/dragonsphere/sound/asound_dragonsphere.h
engines/mads/dragonsphere/sound/rsound.cpp
engines/mads/dragonsphere/sound/rsound.h
engines/mads/dragonsphere/sound/rsound_dragonsphere.cpp
engines/mads/dragonsphere/sound/rsound_dragonsphere.h
engines/mads/nebular/sound/asound.h
engines/mads/nebular/sound/asound_nebular.h
engines/mads/nebular/sound/rsound.cpp
engines/mads/nebular/sound/rsound.h
engines/mads/nebular/sound/rsound_nebular.h
engines/mads/phantom/sound/asound_phantom.cpp
engines/mads/phantom/sound/asound_phantom.h
engines/mads/phantom/sound/rsound.cpp
engines/mads/phantom/sound/rsound.h
engines/mads/phantom/sound/rsound_phantom.cpp
engines/mads/phantom/sound/rsound_phantom.h
diff --git a/engines/mads/core/conv.cpp b/engines/mads/core/conv.cpp
index 4de33456802..408294b905f 100644
--- a/engines/mads/core/conv.cpp
+++ b/engines/mads/core/conv.cpp
@@ -1413,7 +1413,7 @@ done:
// engine has a pending player command ready (mirrors player.command_ready in
// the callers for modes 1 and 2).
//
-// Status dispatch table (off_2D438):
+// Status dispatch table:
// 0 (NEXT_NODE) â advance to next node or build player menu
// 1 (WAIT_AUTO) â wait for auto-trigger then advance to EXECUTE
// 2 (WAIT_ENTRY) â player chose an option; execute it + show NPC portrait
diff --git a/engines/mads/dragonsphere/sound/asound.cpp b/engines/mads/dragonsphere/sound/asound.cpp
index bc23b2b76ab..38dddee0ed8 100644
--- a/engines/mads/dragonsphere/sound/asound.cpp
+++ b/engines/mads/dragonsphere/sound/asound.cpp
@@ -32,11 +32,11 @@ namespace Sound {
bool AdlibChannel::_isDisabled;
/*
- * PATCH_ATTEN_TO_TL (seg001:0x0092 / offset from _asound_samples base)
+ * PATCH_ATTEN_TO_TL (offset from _asound_samples base)
* patchAttenuation (0-127) -> 6-bit OPL total-level.
* The Dragonsphere asm uses PATCH_ATTEN_TO_TL[bx] for the modulator lookup
- * and unk_12431 - bx (i.e. PATCH_ATTEN_TO_TL[127 - patchAtt]) for the
- * carrier lookup.
+ * and a mirrored table indexed by (127 - bx) - i.e.
+ * PATCH_ATTEN_TO_TL[127 - patchAtt] - for the carrier lookup.
*/
static const uint8 PATCH_ATTEN_TO_TL[128] = {
63, 54, 49, 45, 42, 40, 38, 36, 34, 33, 32, 31, 30, 29, 28, 27,
@@ -75,14 +75,14 @@ static const uint16 SEMITONE_FREQ_TABLE[12] = {
};
/*
- * VOICE_SLOTS (byte_1239B in the binary, also used as the operator-reg
+ * VOICE_SLOTS (also used as the operator-reg
* index table for command6/7)
*
* Layout for each voice: { slot0 (modulator), slot1 (carrier) }
* The writeVolume loop uses:
* pass 0 -> VOICE_SLOTS[ch][0] (modulator)
* pass 1 -> VOICE_SLOTS[ch][1] (carrier)
- * The alg!=0 single-op path (loc_11692) goes directly to VOICE_SLOTS[ch][1].
+ * The alg!=0 single-op path goes directly to VOICE_SLOTS[ch][1].
*/
static const uint8 VOICE_SLOTS[ADLIB_CHANNEL_COUNT][2] = {
{ 0, 3 }, { 1, 4 }, { 2, 5 },
@@ -101,7 +101,7 @@ static const uint8 SLOT_TO_REG_OFFSET[18] = {
};
/*
- * byte_1239B - all 22 operator TL register indices muted/restored by
+ * ALL_OP_TL_REGS - all 22 operator TL register indices muted/restored by
* command6 and command7. They cover every OPL operator slot (0x40-0x55).
*/
static const uint8 ALL_OP_TL_REGS[22] = {
@@ -447,7 +447,7 @@ int ASound::command7() {
int ASound::command8() {
/* Returns non-zero if any channel is currently active.
- * Clears byte_12393 (music-only flag) first so all 9 channels are checked. */
+ * Clears the music-only flag first so all 9 channels are checked. */
_musicOnlyFlag = 0;
uint8 result = 0;
for (int i = 0; i < ADLIB_CHANNEL_COUNT; ++i)
@@ -456,9 +456,9 @@ int ASound::command8() {
}
int ASound::command18() {
- /* Re-entrant background-music launcher (asound_command18 in the binary).
+ /* Re-entrant background-music launcher.
* Fades everything, then dispatches back through the command table using
- * _musicIndex (word_12370) as the command ID. */
+ * _musicIndex as the command ID. */
command1();
return command(_musicIndex, 0);
}
@@ -486,7 +486,7 @@ uint16 ASound::getRandomNumber() {
}
void ASound::adlib_channelOff(uint8 portIndex) {
- /* sub_1018F: OR the register with 0x3F (force max attenuation),
+ /* OR the register with 0x3F (force max attenuation),
* then write back both to _adlibPorts and to the OPL chip.
* Note: unlike the Phantom driver, the original value is NOT preserved
* in _adlibPorts - the ORed value is stored back. */
@@ -553,7 +553,7 @@ void ASound::writeVolume() {
* effectively 1: VOICE_SLOTS[ch][1]). */
for (int var6 = (passes == 1 ? 1 : 0); var6 < 2; ++var6) {
- /* Reload var_2 = var_4 at the start of each pass (loc_11642). */
+ /* Reload var_2 = var_4 at the start of each pass. */
int16 var2 = var4;
/* Select the operator slot. */
@@ -567,7 +567,7 @@ void ASound::writeVolume() {
int16 si, di;
if (OPL_VERSION_FLAG < 0x18) {
- /* ---- OPL2 simple path (loc_1167C / loc_1167C equivalent) ---- */
+ /* ---- OPL2 simple path ---- */
int16 tl = (int16)0x3F - var2;
tl |= kslBits;
si = tl;
@@ -575,7 +575,7 @@ void ASound::writeVolume() {
/* adlib_write2(8, tlReg, tl) */
write((uint8)tlReg, (uint8)tl);
} else {
- /* ---- OPL3 patch-attenuation path (loc_115BE / loc_116D4) ---- */
+ /* ---- OPL3 patch-attenuation path ---- */
uint8 pa = ch->_patchAttenuation;
/* Modulator TL (first register, offset 0): */
@@ -590,7 +590,8 @@ void ASound::writeVolume() {
write((uint8)tlReg, (uint8)reg0val);
/* Carrier TL (second register, offset 2):
- * unk_12431 - bx (where bx = pa) == PATCH_ATTEN_TO_TL[127 - pa]. */
+ * uses the mirrored table indexed by (127 - bx) where bx = pa,
+ * i.e. PATCH_ATTEN_TO_TL[127 - pa]. */
int16 tlCar = (int16)(uint16)PATCH_ATTEN_TO_TL[127 - pa];
/* di = var_2 - tlCar (var_4 for alg!=0, var_2=var_4 reload for alg==0) */
di = var2 - tlCar;
@@ -996,7 +997,7 @@ void ASound::pollActiveChannel() {
return;
}
- /* byte_16A0A: volume-dirty flag. Cleared here, set by various opcodes
+ /* volDirty: volume-dirty flag. Cleared here, set by various opcodes
* and by the fade/vibrato sections; causes writeVolume at the end. */
bool volDirty = false;
@@ -1090,7 +1091,7 @@ op2_set_vol:
case 0x3: /* set patchAttenuation */
ch->_patchAttenuation = *pSrc;
- volDirty = true; /* opcodes1 case 3 jumps to loc_10B56 -> byte_16A0A=1 */
+ volDirty = true; /* opcodes1 case 3 sets the volume-dirty flag */
ch->_pSrc = pSrc + 1;
goto dispatch;
@@ -1195,7 +1196,7 @@ op2_set_vol:
goto dispatch;
}
ch->_innerLoopCount = (uint16)cnt;
- /* Jump to innerLoopPtr (loc_10D5A). */
+ /* Jump to innerLoopPtr. */
ch->_pSrc = ch->_innerLoopPtr;
goto dispatch;
}
@@ -1393,13 +1394,13 @@ op2_set_vol:
case 0x5: /* advance _pSrc by 4 (from command byte) */
{
- /* loc_10F55 is shared with case 1's epilogue: _pSrc += 4. */
+ /* Shared with case 1's epilogue: _pSrc += 4. */
ch = _activeChannelPtr;
ch->_pSrc += 4;
goto dispatch;
}
- case 0x6: /* set word_124F2 (_tempoFineStep) */
+ case 0x6: /* set _tempoFineStep */
{
pSrc++;
uint8 val = *pSrc;
@@ -1409,7 +1410,7 @@ op2_set_vol:
goto dispatch;
}
- case 0x7: /* set word_124F0 (_tempoCoarseStep) */
+ case 0x7: /* set _tempoCoarseStep */
{
pSrc++;
uint8 val = *pSrc;
@@ -1419,7 +1420,7 @@ op2_set_vol:
goto dispatch;
}
- case 0x8: /* set word_124EE (_tempoPeriod), enable tick callback */
+ case 0x8: /* set _tempoPeriod, enable tick callback */
{
uint16 period = readWord_impl();
_tempoPeriod = period;
@@ -1430,7 +1431,7 @@ op2_set_vol:
goto dispatch;
}
- case 0x9: /* set word_124F4 (_tempoShift) */
+ case 0x9: /* set _tempoShift */
{
pSrc++;
uint8 val = *pSrc;
@@ -1638,27 +1639,27 @@ op2_set_vol:
bool taken = false;
switch (di & 0x07) {
case 0x0: taken = ((uint16)va != (uint16)vb); break; /* jnz after cmp ax,di (case 0: jz -> NOT taken if ==; var_2 stays 0; but then def path: var_2==0 -> skip. Wait - let me re-read.) */
- /* Re-reading loc_112F0: cmp ax,di; jz loc_11352 (-> var_2=1=taken).
+ /* Re-reading: cmp ax,di; jz -> (var_2=1=taken).
* So case 0: taken = (va == vb). */
default: break;
}
/* Actually re-reading carefully:
- * case 0 (loc_112F0): cmp ax,di; jz -> loc_11352 (var_2=1, taken)
- * else -> loc_112FA (ax=0, var_2=0, not taken)
- * case 1 (loc_11302): cmp ax,di; jz -> loc_1130A -> (jz loc_112FA, not taken)
- * else -> loc_11284 (var_2=1, taken)
+ * case 0: cmp ax,di; jz -> taken (var_2=1)
+ * else -> not taken (ax=0, var_2=0)
+ * case 1: cmp ax,di; jz -> not taken
+ * else -> taken (var_2=1)
* -> case 1: taken = (va != vb)
- * case 2 (loc_1130E): jge -> loc_112FA (not taken); else loc_11284 (taken)
+ * case 2: jge -> not taken; else taken
* -> taken = (va < vb) (signed)
- * case 3 (loc_1131A): jle -> not taken; else taken
+ * case 3: jle -> not taken; else taken
* -> taken = (va > vb) (signed)
- * case 4 (loc_11326): cmp [di],al; jnz -> loc_112FA (not taken); else loc_11284 (taken)
+ * case 4: cmp [di],al; jnz -> not taken; else taken
* -> taken = (_scriptVars[idxB] == va) (already same as case 0 with vars swapped)
- * case 5 (loc_11332): cmp [di],al; jz->loc_1130A (not taken if ==, taken if !=)
+ * case 5: cmp [di],al; jz -> not taken if ==, taken if !=
* -> taken = (_scriptVars[idxB] != va)
- * case 6 (loc_1133C): jbe -> not taken; else taken -> taken = (_scriptVars[idxB] > va)
- * case 7 (loc_11348): jnb -> not taken; else taken -> taken = (_scriptVars[idxB] < va)
+ * case 6: jbe -> not taken; else taken -> taken = (_scriptVars[idxB] > va)
+ * case 7: jnb -> not taken; else taken -> taken = (_scriptVars[idxB] < va)
*/
switch (di) {
case 0x0: taken = (va == vb); break;
@@ -1725,7 +1726,7 @@ post_keyon:
if (ch->_arpPeriodCounter == 0) {
/* Reload from field_12 (_arpPeriodReload). */
ch->_arpPeriodCounter = ch->_arpPeriodReload;
- /* Call sub_117E8 (writeArpeggio - writes the arpeggio frequency). */
+ /* Call writeArpeggio (writes the arpeggio frequency). */
writeArpeggio();
}
ch = _activeChannelPtr;
@@ -1737,7 +1738,7 @@ post_keyon:
/* ---- Write-volume pending (field_11 / _writeVolumePending) ---- */
ch = _activeChannelPtr;
if (ch->_writeVolumePending != 0) {
- /* sub_11856 was already called by writeArpeggio above (or this is
+ /* The arpeggio frequency writer was already called by writeArpeggio above (or this is
* a standalone field_11 set via opcode 8). Clear the flag. */
writeArpeggio();
ch = _activeChannelPtr;
@@ -1774,7 +1775,7 @@ post_keyon:
ch->_velocity = 0;
}
}
- volDirty = true; /* byte_16A0A = 1 */
+ volDirty = true;
}
}
}
diff --git a/engines/mads/dragonsphere/sound/asound.h b/engines/mads/dragonsphere/sound/asound.h
index 3f679c3a1d9..f52340d0e19 100644
--- a/engines/mads/dragonsphere/sound/asound.h
+++ b/engines/mads/dragonsphere/sound/asound.h
@@ -56,7 +56,7 @@ struct AdlibChannel {
uint8 _vibPeriodReload = 0; // 0x0E reload value for _vibPeriodCounter
uint8 _patchAttenuation = 0; // 0x0F per-note attenuation offset added on top of the patch TL
uint8 _velocity = 0; // 0x10 note velocity (0-127); used together with _volume for TL
- uint8 _writeVolumePending = 0; // 0x11 non-zero -> call sub_11856 (secondary freq write) this tick
+ uint8 _writeVolumePending = 0; // 0x11 non-zero -> call the arpeggio frequency writer (secondary freq write) this tick
uint8 _arpPeriodReload = 0; // 0x12 arpeggio period reload value (set by opcode 9)
uint8 _arpCounterReload = 0; // 0x13 arpeggio counter reload (decremented; 0xFF = infinite)
@@ -164,29 +164,28 @@ struct AdlibSample {
// ---------------------------------------------------------------------------
// ASound - Dragonsphere Adlib sound driver base class
//
-// Command dispatch table layout (from off_11A14 / off_11A26 / off_11A2E /
-// funcs_12251 / off_11A64 in the disassembly):
+// Command dispatch table layout:
//
-// Table 1 off_11A14 commands 0- 8 (max=8, base=0, 9 entries)
-// Table 2 off_11A26 commands 16-19 (max=0x13, base=0x10, 4 entries)
+// Table 1 commands 0- 8 (max=8, base=0, 9 entries)
+// Table 2 commands 16-19 (max=0x13, base=0x10, 4 entries)
// command16 = background-music dispatcher (calls command18)
// command17 = play specific piece (loads 7 channels direct)
-// command18 = re-entrant music launcher (reads word_12370 to pick a sub-command)
+// command18 = re-entrant music launcher (reads _musicIndex to pick a sub-command)
// command19 = no-op (asound_command98)
-// Table 3 off_11A2E commands 24-32 (max=0x20, base=0x18, 9 entries)
-// Table 4 funcs_12251 commands 32-49 (max=0x31, base=0x20, 18 entries)
+// Table 3 commands 24-32 (max=0x20, base=0x18, 9 entries)
+// Table 4 commands 32-49 (max=0x31, base=0x20, 18 entries)
// Includes asound_command32-48 (music pieces / SFX loaders)
// and asound_command98 (no-op) in the last slot.
-// Table 5 off_11A64 commands 64-101 (max=0x65, base=0x40, 38 entries)
+// Table 5 commands 64-101 (max=0x65, base=0x40, 38 entries)
// Includes asound_command64-101 (single-shot SFX loaders via
// findFreeChannel / findFreeChannelFull) and two no-ops.
//
// The driver also exposes:
// asound_command90 / 91 - two-voice SFX (findFreeChannelFull x2)
// asound_command95 - four-voice music piece (findFreeChannel x4)
-// sub_11F98 - two-voice SFX (findFreeChannelFull x2)
+// asound_command97 - two-voice SFX (findFreeChannelFull x2)
//
-// word_12370 tracks the "current music index" used by command18 to select
+// _musicIndex tracks the "current music index" used by command18 to select
// which music-piece loader to call.
// ---------------------------------------------------------------------------
class ASound : public SoundDriver {
@@ -231,20 +230,20 @@ private:
int _frameNumber2 = 0; // secondary frame counter incremented every update
// ---- script / sequencer registers -----------------------------------
- uint8 _scriptVars[32] = {}; // byte_16A10: 32 general-purpose script registers
+ uint8 _scriptVars[32] = {}; // 32 general-purpose script registers
- // ---- music-index tracker (word_12370) --------------------------------
+ // ---- music-index tracker ------------------------------------------
// Tracks which music piece was last launched by command18.
uint16 _musicIndex = 0;
// ---- tempo / sequencer state (from opcodes3 group 2 handlers) --------
- uint8 _musicOnlyFlag = 0; // byte_12393: 1=music-only check, 0=all channels
- uint16 _tempoFineStep = 0; // word_124F2: fine tempo step (opcode A6)
- uint16 _tempoCoarseStep = 0; // word_124F0: coarse tempo step (opcode A7)
- uint16 _tempoPeriod = 0; // word_124EE: tempo period in ticks (opcode A8)
+ uint8 _musicOnlyFlag = 0; // 1=music-only check, 0=all channels
+ uint16 _tempoFineStep = 0; // fine tempo step (opcode A6)
+ uint16 _tempoCoarseStep = 0; // coarse tempo step (opcode A7)
+ uint16 _tempoPeriod = 0; // tempo period in ticks (opcode A8)
uint8 _tempoEnabled = 0; // non-zero when tempo tick is active (opcode A8)
uint16 _tempoTickCounter = 0; // countdown for tempo callback
- uint16 _tempoShift = 0; // word_124F4: tempo shift (opcode A9)
+ uint16 _tempoShift = 0; // tempo shift (opcode A9)
// =========================================================================
// Private helpers
@@ -301,7 +300,7 @@ private:
void writePitchBend();
/**
- * Arpeggio frequency write (sub_11856).
+ * Arpeggio frequency write.
* Called from pollActiveChannel when _writeVolumePending (field_11) is set.
* Computes a modified frequency from _note + _octaveTranspose + field_11 - 1
* and writes it to the OPL registers, preserving the key-on bit.
@@ -403,13 +402,12 @@ protected:
/**
* Checks whether any of channels 0-6 (or 0-8 when _musicOnlyFlag is clear)
* have a non-zero _activeCount. Returns non-zero if sound is playing.
- * This is 'sub_1061A' in the disassembly.
*/
int isMusicChannelsActive();
/**
* Like isMusicChannelsActive but scans all 9 channels unconditionally
- * (clears the ch0-6-only flag first). This is 'sub_1064E'.
+ * (clears the ch0-6-only flag first).
*/
int isAnyChannelActive();
@@ -441,12 +439,12 @@ protected:
_callbackPeriod = period;
}
- /** Set the music-piece index (word_12370) read by command18. */
+ /** Set the music-piece index read by command18. */
void setMusicIndex(uint16 idx) { _musicIndex = idx; }
/** Read the current music-piece index. */
uint16 getMusicIndex() const { return _musicIndex; }
- /** Write one script-variable register (byte_16A10[idx]). */
+ /** Write one script-variable register. */
void setScriptVar(int idx, uint8 val) { _scriptVars[idx] = val; }
/**
* Writes (reg, value) to the OPL chip and updates the _adlibPorts shadow
@@ -567,7 +565,7 @@ protected:
* command6: Pause playback.
* Saves each channel's _freqSweepCounter into _savedSweepCounter, zeroes
* _freqSweepCounter on all channels, then mutes all 22 operator TL
- * registers (the byte_1239B table covers all operator slots 0x40-0x55).
+ * registers (covering all operator slots 0x40-0x55).
* Sets _isDisabled to prevent further updates.
*/
int command6();
@@ -583,7 +581,7 @@ protected:
/**
* command8: Returns non-zero if any of the 9 channels has a non-zero
* _activeCount (i.e. sound is currently playing).
- * Also clears the music-only flag (byte_12393 = 0) so the check covers
+ * Also clears the music-only flag (_musicOnlyFlag = 0) so the check covers
* all 9 channels.
*/
int command8();
@@ -600,10 +598,10 @@ protected:
/**
* command18: Re-entrant music launcher.
- * First calls command1 to fade current output, then branches on _musicIndex
- * (word_12370):
- * <= 0x12 -> calls off_11A26 table (commands 16-19)
- * > 0x12 -> calls funcs_12251 table (commands 32-49), index = _musicIndex - 0x20
+ * First calls command1 to fade current output, then branches on
+ * _musicIndex:
+ * <= 0x12 -> calls table 2 (commands 16-19)
+ * > 0x12 -> calls table 4 (commands 32-49), index = _musicIndex - 0x20
*/
int command18();
diff --git a/engines/mads/dragonsphere/sound/asound_dragonsphere.cpp b/engines/mads/dragonsphere/sound/asound_dragonsphere.cpp
index 1d97b7105f6..d265e680818 100644
--- a/engines/mads/dragonsphere/sound/asound_dragonsphere.cpp
+++ b/engines/mads/dragonsphere/sound/asound_dragonsphere.cpp
@@ -35,17 +35,17 @@ namespace Sound {
reinterpret_cast<ASound::CallbackFunction>(&cls::fn)
const ASound1::CommandPtr ASound1::_commandList[102] = {
- // commands 0-8 (off_11A14)
+ // commands 0-8 (table 1)
&ASound1::command0, &ASound1::command1, &ASound1::command2, &ASound1::command3,
&ASound1::command4, &ASound1::command5, &ASound1::command6, &ASound1::command7,
&ASound1::command8,
// 9-15 absent
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
- // commands 16-18, 19=no-op (off_11A26)
+ // commands 16-18, 19=no-op (table 2)
&ASound1::command16, &ASound1::command17, &ASound1::command18, nullptr,
// 20-23 absent
nullptr, nullptr, nullptr, nullptr,
- // commands 24-31, then no-op for slot 32 (off_11A2E)
+ // commands 24-31, then no-op for slot 32 (table 3)
&ASound1::command24, &ASound1::command25, &ASound1::command26, &ASound1::command27,
&ASound1::command28, &ASound1::command29, &ASound1::command30, &ASound1::command31,
// commands 32-48, 49=no-op (funcs_12251)
@@ -57,7 +57,7 @@ const ASound1::CommandPtr ASound1::_commandList[102] = {
// 50-63 absent
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
- // commands 64-101 (off_11A64); slot 92 and slot 98 are no-ops
+ // commands 64-101 (table 5); slot 92 and slot 98 are no-ops
&ASound1::command64, &ASound1::command65, &ASound1::command66, &ASound1::command67,
&ASound1::command68, &ASound1::command69, &ASound1::command70, &ASound1::command71,
&ASound1::command72, &ASound1::command73, &ASound1::command74, &ASound1::command75,
@@ -661,7 +661,7 @@ int ASound1::command95() {
int ASound1::command96() { findFreeChannelFull(loadData(0x305C)); return 0; }
-// command97 = sub_11F98 in original
+// command97's shape matches the original disassembly exactly
int ASound1::command97() {
findFreeChannelFull(loadData(0x307E));
findFreeChannelFull(loadData(0x3094));
@@ -688,11 +688,11 @@ const ASound2::CommandPtr ASound2::_commandList[76] = {
// 9-15: nullptr
nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr, nullptr,
- // 16-19: off_11A26
+ // 16-19: table 2
&ASound2::command16, &ASound2::command17, &ASound2::command18, nullptr,
// 20-23: nullptr
nullptr, nullptr, nullptr, nullptr,
- // 24-31: off_11A2E
+ // 24-31: table 3
&ASound2::command24, &ASound2::command25, &ASound2::command26, &ASound2::command27,
&ASound2::command28, &ASound2::command29, &ASound2::command30, &ASound2::command31,
// 32-36: funcs_11C87 (slot 36 = no-op)
@@ -706,7 +706,7 @@ const ASound2::CommandPtr ASound2::_commandList[76] = {
nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr,
- // 64-75: off_11A4A (slots 73-75 = no-ops)
+ // 64-75: table 5 (slots 73-75 = no-ops)
&ASound2::command64, &ASound2::command65, &ASound2::command66, &ASound2::command67,
&ASound2::command68, &ASound2::command69_70, &ASound2::command69_70, &ASound2::command71,
&ASound2::command72, nullptr, nullptr, nullptr
@@ -969,18 +969,18 @@ int ASound2::command72() {
*-----------------------------------------------------------------------*/
const ASound3::CommandPtr ASound3::_commandList[77] = {
- // commands 0-8 (off_11A14)
+ // commands 0-8 (table 1)
&ASound3::command0, &ASound3::command1, &ASound3::command2, &ASound3::command3,
&ASound3::command4, &ASound3::command5, &ASound3::command6, &ASound3::command7,
&ASound3::command8,
// 9-15 absent
nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr, nullptr,
- // commands 16-19 (off_11A26; slot 19 = no-op)
+ // commands 16-19 (table 2; slot 19 = no-op)
&ASound3::command16, &ASound3::command17, &ASound3::command18, nullptr,
// 20-23 absent
nullptr, nullptr, nullptr, nullptr,
- // commands 24-31 (off_11A2E; slot at 32 = no-op/unreachable)
+ // commands 24-31 (table 3; slot at 32 = no-op/unreachable)
&ASound3::command24, &ASound3::command25, &ASound3::command26, &ASound3::command27,
&ASound3::command28, &ASound3::command29, &ASound3::command30, &ASound3::command31,
// commands 32-33 (funcs_11C61; slot 34 = no-op)
@@ -994,7 +994,7 @@ const ASound3::CommandPtr ASound3::_commandList[77] = {
nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr,
- // commands 64-73 (off_11A46); slots 74-76 = no-ops
+ // commands 64-73 (table 5); slots 74-76 = no-ops
&ASound3::command64, &ASound3::command65, &ASound3::command66, &ASound3::command67,
&ASound3::command68, &ASound3::command69, &ASound3::command70, &ASound3::command71,
&ASound3::command72, &ASound3::command73,
@@ -1081,7 +1081,7 @@ int ASound3::command18() {
}
// ---------------------------------------------------------------------------
-// commands 24-31 (off_11A2E)
+// commands 24-31 (table 3)
// ---------------------------------------------------------------------------
int ASound3::command24() {
@@ -1178,7 +1178,7 @@ int ASound3::command33() {
}
// ---------------------------------------------------------------------------
-// commands 64-73 (off_11A46)
+// commands 64-73 (table 5)
// ---------------------------------------------------------------------------
// command64: patch pitch byte (0x78) then play â same block as command31 (0x78 vs 0x67)
@@ -1243,18 +1243,18 @@ int ASound3::command73() {
*-----------------------------------------------------------------------*/
const ASound4::CommandPtr ASound4::_commandList[82] = {
- // commands 0-8 (off_11A14; slot 5 = no-op)
+ // commands 0-8 (table 1; slot 5 = no-op)
&ASound4::command0, &ASound4::command1, &ASound4::command2, &ASound4::command3,
&ASound4::command4, nullptr, &ASound4::command6, &ASound4::command7,
&ASound4::command8,
// 9-15 absent
nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr,
- // commands 16-19 (off_11A26; slot 19 = no-op)
+ // commands 16-19 (table 2; slot 19 = no-op)
&ASound4::command16, &ASound4::command17, &ASound4::command18, nullptr,
// 20-23 absent
nullptr, nullptr, nullptr, nullptr,
- // commands 24-31 (off_11A2E; slot 32 unreachable via off_11A2E)
+ // commands 24-31 (table 3; slot 32 unreachable via table 3)
&ASound4::command24, &ASound4::command25, &ASound4::command26, &ASound4::command27,
&ASound4::command28, &ASound4::command29, &ASound4::command30, &ASound4::command31,
// commands 32-41 (funcs_11E51; slots 34 and 41 = no-ops)
@@ -1268,7 +1268,7 @@ const ASound4::CommandPtr ASound4::_commandList[82] = {
nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr,
- // commands 64-81 (off_11A54; slot 79 = no-op; slots 80-81 = stubs)
+ // commands 64-81 (table 5; slot 79 = no-op; slots 80-81 = stubs)
&ASound4::command64, &ASound4::command65, &ASound4::command66, &ASound4::command67,
&ASound4::command68, &ASound4::command69, &ASound4::command70, &ASound4::command71,
&ASound4::command72, &ASound4::command73, &ASound4::command74, &ASound4::command75,
@@ -1358,7 +1358,7 @@ int ASound4::command18() {
}
// ---------------------------------------------------------------------------
-// commands 24-31 (off_11A2E) - SFX
+// commands 24-31 (table 3) - SFX
// ---------------------------------------------------------------------------
int ASound4::command24() { playSound(0x2CD3); playSound(0x2D08); return 0; }
int ASound4::command25() { playSound(0x2D38); playSound(0x2D66); return 0; }
@@ -1578,7 +1578,7 @@ int ASound4::command40() {
}
// ---------------------------------------------------------------------------
-// commands 64-81 (off_11A54) - SFX (command73 = empty, 80-81 = stubs)
+// commands 64-81 (table 5) - SFX (command73 = empty, 80-81 = stubs)
// ---------------------------------------------------------------------------
int ASound4::command64() { playSound(0x25B4); return 0; }
int ASound4::command65() { playSound(0x25F7); return 0; }
@@ -1605,21 +1605,21 @@ int ASound4::command81() { return 0; }
*-----------------------------------------------------------------------*/
const ASound5::CommandPtr ASound5::_commandList[82] = {
- // commands 0-8 (off_11A14)
+ // commands 0-8 (table 1)
&ASound5::command0, &ASound5::command1, &ASound5::command2, &ASound5::command3,
&ASound5::command4, &ASound5::command5, &ASound5::command6, &ASound5::command7,
&ASound5::command8,
// 9-15 absent
nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr, nullptr,
- // commands 16-19 (off_11A26; slot 19 = no-op)
+ // commands 16-19 (table 2; slot 19 = no-op)
&ASound5::command16, &ASound5::command17, &ASound5::command18, nullptr,
// 20-23 absent
nullptr, nullptr, nullptr, nullptr,
- // commands 24-31 (off_11A2E; slot 32 handled by funcs_11E05)
+ // commands 24-31 (table 3; slot 32 handled by table 4)
&ASound5::command24, &ASound5::command25, &ASound5::command26, &ASound5::command27,
&ASound5::command28, &ASound5::command29, &ASound5::command30, &ASound5::command31,
- // commands 32-39 (funcs_11E05; slot 39 = no-op)
+ // commands 32-39 (table 4; slot 39 = no-op)
&ASound5::command32, &ASound5::command33, &ASound5::command34, &ASound5::command35,
&ASound5::command36, &ASound5::command37, &ASound5::command38, nullptr,
// 40-63 absent
@@ -1629,7 +1629,7 @@ const ASound5::CommandPtr ASound5::_commandList[82] = {
nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr, nullptr,
- // commands 64-81 (off_11A50; slot 79 = no-op; 80-81 = stubs)
+ // commands 64-81 (table 5; slot 79 = no-op; 80-81 = stubs)
&ASound5::command64, &ASound5::command65, &ASound5::command66, &ASound5::command67,
&ASound5::command68, &ASound5::command69, &ASound5::command70, &ASound5::command71,
&ASound5::command72, &ASound5::command73, &ASound5::command74, &ASound5::command75,
@@ -1727,7 +1727,7 @@ int ASound5::command18() {
}
// ---------------------------------------------------------------------------
-// commands 24-31 (off_11A2E) - SFX
+// commands 24-31 (table 3) - SFX
// ---------------------------------------------------------------------------
int ASound5::command24() { playSound(0x29DF); playSound(0x2A14); return 0; }
int ASound5::command25() { playSound(0x2A44); playSound(0x2A72); return 0; }
@@ -1891,7 +1891,7 @@ int ASound5::command38() {
}
// ---------------------------------------------------------------------------
-// commands 64-78 (off_11A50) - SFX
+// commands 64-78 (table 5) - SFX
// ---------------------------------------------------------------------------
int ASound5::command64() { playSound(0x252C); return 0; }
int ASound5::command65() { playSound(0x253B); playSound(0x254C); return 0; }
@@ -1937,17 +1937,17 @@ int ASound5::command81() { return 0; }
*-----------------------------------------------------------------------*/
const ASound6::CommandPtr ASound6::_commandList[102] = {
- // commands 0-8 (off_11A14)
+ // commands 0-8 (table 1)
&ASound6::command0, &ASound6::command1, &ASound6::command2, &ASound6::command3,
&ASound6::command4, &ASound6::command5, &ASound6::command6, &ASound6::command7,
&ASound6::command8,
// 9-15 absent
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
- // commands 16-19 (off_11A26; slot 19 = no-op)
+ // commands 16-19 (table 2; slot 19 = no-op)
&ASound6::command16, &ASound6::command17, &ASound6::command18, nullptr,
// 20-23 absent
nullptr, nullptr, nullptr, nullptr,
- // commands 24-31 (off_11A2E)
+ // commands 24-31 (table 3)
&ASound6::command24, &ASound6::command25, &ASound6::command26, &ASound6::command27,
&ASound6::command28, &ASound6::command29, &ASound6::command30, &ASound6::command31,
// commands 32-47 (funcs_1204D; slots 41-43 and 46-47 = no-op)
@@ -1958,7 +1958,7 @@ const ASound6::CommandPtr ASound6::_commandList[102] = {
// 48-63 absent
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
- // commands 64-101 (off_11A60; slot 99 = no-op)
+ // commands 64-101 (table 5; slot 99 = no-op)
&ASound6::command64, &ASound6::command65, &ASound6::command66, &ASound6::command67,
&ASound6::command68, &ASound6::command69, &ASound6::command70, &ASound6::command71,
&ASound6::command72, &ASound6::command73, &ASound6::command74, &ASound6::command75,
@@ -2053,7 +2053,7 @@ int ASound6::command18() {
return 0;
}
-// commands 24-31 â SFX via playSound (loc_103DC = findFreeChannelFull)
+// commands 24-31 â SFX via playSound (a thin wrapper over findFreeChannelFull)
int ASound6::command24() { playSound(0x3279); playSound(0x32AE); return 0; }
int ASound6::command25() { playSound(0x32DE); playSound(0x330C); return 0; }
int ASound6::command26() { playSound(0x333C); return 0; }
@@ -2064,7 +2064,7 @@ int ASound6::command30() { playSound(0x33B4); return 0; }
int ASound6::command31() { *loadData(0x3418) = 0x67; playSound(0x3415); return 0; }
// command32 â complex: optionally modifies active channel; Pattern B for ch0-ch5
-// Shared deferred loader with command33 (loc_11B29)
+// Shared deferred loader with command33
void ASound6::loadCommand32() {
resetCallbackTimer(0x3C);
ASound::command1();
@@ -2105,7 +2105,7 @@ int ASound6::command33() {
if (!isMusicChannelsActive()) {
loadCommand32();
} else if (isSoundActive(loadData(0x1192))) {
- // loc_11B69: sound 0x1192 already running â only load ch6
+ // Sound 0x1192 already running â only load ch6
_cmd33Flag = 0;
_channels[6]->load(loadData(0x12F4));
} else {
@@ -2130,7 +2130,7 @@ void ASound6::loadCommand34() {
int ASound6::command34() {
if (!isSoundActive(loadData(0x13C5))) {
if (_channels[0]->_loopStartPtr == loadData(0x1362) && _channels[0]->_activeCount != 0) {
- // Shortcut: ch0 already running 0x1362 â only load extra channels (loc_11C15)
+ // Shortcut: ch0 already running 0x1362 â only load extra channels
_channels[1]->load(loadData(0x13C5));
_channels[5]->load(loadData(0x1510));
_channels[3]->load(loadData(0x14A7));
@@ -2297,7 +2297,7 @@ int ASound6::command44() {
return 0;
}
-// command45 â Pattern B; timer=0x1E; 3ÃfindFreeChannel (lower pool, sub_10388)
+// command45 â Pattern B; timer=0x1E; 3ÃfindFreeChannel (lower pool)
void ASound6::loadCommand45() {
resetCallbackTimer(0x1E);
ASound::command1();
@@ -2412,14 +2412,14 @@ const ASound9::CommandPtr ASound9::_commandList[65] = {
// 9-15: nullptr (not in any dispatch range)
nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr,
- // 16-19: nullptr (off_11A26, all null)
+ // 16-19: nullptr (table 2, all null)
nullptr, nullptr, nullptr, nullptr,
// 20-23: nullptr
nullptr, nullptr, nullptr, nullptr,
- // 24-31: nullptr (off_11A2E, all null)
+ // 24-31: nullptr (table 3, all null)
nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr, nullptr,
- // 32-63: music/SFX (off_11A3E)
+ // 32-63: music/SFX (table 4)
&ASound9::command32, &ASound9::command33_47, &ASound9::command34, &ASound9::command35,
&ASound9::command36, &ASound9::command37, &ASound9::command38, &ASound9::command39,
&ASound9::command40, &ASound9::command41, &ASound9::command42, &ASound9::command43,
@@ -2428,7 +2428,7 @@ const ASound9::CommandPtr ASound9::_commandList[65] = {
&ASound9::command52, &ASound9::command53, &ASound9::command54, &ASound9::command55,
nullptr, &ASound9::command57, &ASound9::command58, &ASound9::command59,
nullptr, &ASound9::command61, &ASound9::command62, &ASound9::command63,
- // 64: nullptr (off_11A80, single null entry)
+ // 64: nullptr (table 5, single null entry)
nullptr,
};
diff --git a/engines/mads/dragonsphere/sound/asound_dragonsphere.h b/engines/mads/dragonsphere/sound/asound_dragonsphere.h
index 8797779ef40..1b6cbd7971a 100644
--- a/engines/mads/dragonsphere/sound/asound_dragonsphere.h
+++ b/engines/mads/dragonsphere/sound/asound_dragonsphere.h
@@ -32,17 +32,17 @@ namespace Sound {
* ASound1 (asound.dr1, _dataOffset = 0x2520, _dataSize = 0x49e0)
*
* Dispatch table layout (five tables collapsed to flat [102]):
- * off_11A14: commands 0â 8 (base=0, max=8)
- * off_11A26: commands 16â19 (base=0x10, max=0x13; slot 19 = no-op)
- * off_11A2E: commands 24â32 (base=0x18, max=0x20; slot 32 = no-op)
- * funcs_12251: commands 32â49 (base=0x20, max=0x31; slot 49 = no-op)
- * off_11A64: commands 64â101 (base=0x40, max=0x65)
+ * Table 1: commands 0â 8 (base=0, max=8)
+ * Table 2: commands 16â19 (base=0x10, max=0x13; slot 19 = no-op)
+ * Table 3: commands 24â32 (base=0x18, max=0x20; slot 32 = no-op)
+ * Table 4: commands 32â49 (base=0x20, max=0x31; slot 49 = no-op)
+ * Table 5: commands 64â101 (base=0x40, max=0x65)
* Slot 92 and slot 98 are no-ops (command98); slots 102â103 are
- * nullsub_1/nullsub_4, both beyond the [102] array.
+ * no-op stubs, both beyond the [102] array.
*
- * word_12370 (_musicIndex in base): tracks the last music-piece launched
- * via command18 for re-entry. Values <=0x12 use off_11A26; >0x12 use
- * funcs_12251 with index = musicIndex - 0x20.
+ * _musicIndex: tracks the last music-piece launched
+ * via command18 for re-entry. Values <=0x12 use table 2; >0x12 use
+ * table 4 with index = musicIndex - 0x20.
*
* Mutable sound-data bytes (modified before channel loads):
* _soundData[0x28C9] â pitch-bend variant byte (command43 / command48)
@@ -164,11 +164,11 @@ public:
* ASound2 (asound.dr2, _dataOffset = 0x1FA0, _dataSize = 0x2950)
*
* Dispatch table layout (five tables collapsed to flat [76]):
- * off_11A14: commands 0â8 (base=0, max=8)
- * off_11A26: commands 16â19 (base=0x10, max=0x13; slot 19 = no-op)
- * off_11A2E: commands 24â31 (base=0x18, max=0x1F; slot at cmd32 unreachable)
- * funcs_11C87: commands 32â36 (base=0x20, max=0x24; slot 36 = no-op)
- * off_11A4A: commands 64â75 (base=0x40, max=0x4B; slots 73â75 = no-ops)
+ * Table 1: commands 0â8 (base=0, max=8)
+ * Table 2: commands 16â19 (base=0x10, max=0x13; slot 19 = no-op)
+ * Table 3: commands 24â31 (base=0x18, max=0x1F; slot at cmd32 unreachable)
+ * Table 4: commands 32â36 (base=0x20, max=0x24; slot 36 = no-op)
+ * Table 5: commands 64â75 (base=0x40, max=0x4B; slots 73â75 = no-ops)
*
* command16 sets _musicIndex = 0x10 for command18 re-entry.
* commands 32â35: _musicIndex saved by dispatcher for command18 re-entry.
@@ -211,11 +211,11 @@ public:
* ASound3 (asound.dr3, _dataOffset = 0x1F30, _dataSize = 0x2750)
*
* Dispatch table layout (five tables collapsed to flat [77]):
- * off_11A14: commands 0â8 (base=0, max=8)
- * off_11A26: commands 16â19 (base=0x10, max=0x13; slot 19 = no-op)
- * off_11A2E: commands 24â32 (base=0x18, max=0x20; slot 32 = no-op/unreachable)
- * funcs_11C61: commands 32â34 (base=0x20, max=0x22; slot 34 = no-op)
- * off_11A46: commands 64â76 (base=0x40, max=0x4C; slots 74â76 = no-ops)
+ * Table 1: commands 0â8 (base=0, max=8)
+ * Table 2: commands 16â19 (base=0x10, max=0x13; slot 19 = no-op)
+ * Table 3: commands 24â32 (base=0x18, max=0x20; slot 32 = no-op/unreachable)
+ * Table 4: commands 32â34 (base=0x20, max=0x22; slot 34 = no-op)
+ * Table 5: commands 64â76 (base=0x40, max=0x4C; slots 74â76 = no-ops)
*
* command16 sets _musicIndex = 0x10 for command18 re-entry.
* commands 32â33: _musicIndex saved by dispatcher for command18 re-entry.
@@ -280,11 +280,11 @@ public:
* ASound4 (asound.dr4, _dataOffset = 0x2120, _dataSize = 0x31D0)
*
* Dispatch table layout (five tables collapsed to flat [82]):
- * off_11A14: commands 0â8 (base=0, max=8; slot 5 = no-op)
- * off_11A26: commands 16â19 (base=0x10, max=0x13; slot 19 = no-op)
- * off_11A2E: commands 24â32 (base=0x18, max=0x20; slot 32 = no-op/unreachable)
- * funcs_11E51: commands 32â41 (base=0x20, max=0x29; slots 34,41 = no-ops)
- * off_11A54: commands 64â81 (base=0x40, max=0x51; slot 79 = no-op; slots 80,81 = stubs)
+ * Table 1: commands 0â8 (base=0, max=8; slot 5 = no-op)
+ * Table 2: commands 16â19 (base=0x10, max=0x13; slot 19 = no-op)
+ * Table 3: commands 24â32 (base=0x18, max=0x20; slot 32 = no-op/unreachable)
+ * Table 4: commands 32â41 (base=0x20, max=0x29; slots 34,41 = no-ops)
+ * Table 5: commands 64â81 (base=0x40, max=0x51; slot 79 = no-op; slots 80,81 = stubs)
*
* command16 sets _musicIndex = 0x10 for command18 re-entry.
* commands 32â33 and 35â40: _musicIndex saved by dispatcher for command18 re-entry.
@@ -336,11 +336,11 @@ public:
* ASound5 (asound.dr5, _dataOffset = 0x20D0, _dataSize = 0x2EE0)
*
* Dispatch table layout (five tables collapsed to flat [82]):
- * off_11A14: commands 0â8 (base=0, max=8)
- * off_11A26: commands 16â19 (base=0x10, max=0x13; slot 19 = no-op)
- * off_11A2E: commands 24â32 (base=0x18, max=0x20; slot 32 = no-op/unreachable)
- * funcs_11E05: commands 32â39 (base=0x20, max=0x27; slot 39 = no-op)
- * off_11A50: commands 64â81 (base=0x40, max=0x51; slot 79 = no-op; slots 80â81 = stubs)
+ * Table 1: commands 0â8 (base=0, max=8)
+ * Table 2: commands 16â19 (base=0x10, max=0x13; slot 19 = no-op)
+ * Table 3: commands 24â32 (base=0x18, max=0x20; slot 32 = no-op/unreachable)
+ * Table 4: commands 32â39 (base=0x20, max=0x27; slot 39 = no-op)
+ * Table 5: commands 64â81 (base=0x40, max=0x51; slot 79 = no-op; slots 80â81 = stubs)
*
* command16 and command32/33 set _musicIndex = 0x10 for command18 re-entry.
* command38 sets _musicIndex = 0x26; command36 sets it to 0x29 (beyond table).
@@ -395,11 +395,11 @@ public:
/**
* ASound6 (asound.dr6, _dataOffset = 0x2370, _dataSize = 0x3870)
* Dispatch table layout (five tables collapsed to flat [102]):
- * off_11A14: commands 0â 8 (base=0, max=8)
- * off_11A26: commands 16â19 (base=0x10, max=0x13; slot 19 = no-op)
- * off_11A2E: commands 24â31 (base=0x18, max=0x1F)
- * funcs_1204D: commands 32â47 (base=0x20, max=0x2F; slots 41â43, 46â47 = no-op)
- * off_11A60: commands 64â101 (base=0x40, max=0x65; slot 99 = no-op)
+ * Table 1: commands 0â 8 (base=0, max=8)
+ * Table 2: commands 16â19 (base=0x10, max=0x13; slot 19 = no-op)
+ * Table 3: commands 24â31 (base=0x18, max=0x1F)
+ * Table 4: commands 32â47 (base=0x20, max=0x2F; slots 41â43, 46â47 = no-op)
+ * Table 5: commands 64â101 (base=0x40, max=0x65; slot 99 = no-op)
*/
class ASound6 : public ASound {
private:
@@ -419,7 +419,7 @@ private:
void loadCommand45();
void loadCommand96();
- uint8 _cmd33Flag; // byte_134D1: set by command33 to extend loadCommand32
+ uint8 _cmd33Flag; // set by command33 to extend loadCommand32
int _lastParam; // param stored by command() for use by command64
int command0(); int command1(); int command2(); int command3();
diff --git a/engines/mads/dragonsphere/sound/rsound.cpp b/engines/mads/dragonsphere/sound/rsound.cpp
index a9190e019f2..ede257e8ffd 100644
--- a/engines/mads/dragonsphere/sound/rsound.cpp
+++ b/engines/mads/dragonsphere/sound/rsound.cpp
@@ -241,7 +241,7 @@ bool RSound::isSoundActive(byte *pData) {
}
int RSound::isMusicChannelsActive() {
- // Matches sub_10477: channels 1-5 AND 9 (this driver's "lower"/music
+ // Channels 1-5 AND 9 (this driver's "lower"/music
// group) - NOT Phantom/ASound's fixed channel range.
return _channels[0]._activeCount || _channels[1]._activeCount ||
_channels[2]._activeCount || _channels[3]._activeCount ||
@@ -266,7 +266,7 @@ void RSound::sendStatus(int midiChannel, byte statusNibble) {
}
void RSound::sendNoteOn(int midiChannel, int note, int velocity) {
- // Matches sub_10AC2. The disassembly derives midiChannel/velocity from
+ // The disassembly derives midiChannel/velocity from
// the currently-active channel context rather than taking them as
// explicit call-site parameters, but the transmitted bytes are
// identical either way - kept parameterized here for API consistency
@@ -283,7 +283,7 @@ void RSound::sendProgramChange(int midiChannel, int program) {
void RSound::sendVolume(Channel *ch) {
// CORRECTED naming and NEW gate - see rsound.h class comment. The
- // disassembly's real volume-sender (sub_10B54, unnamed) only
+ // disassembly's real (unnamed) volume-sender only
// transmits when the channel is not pending-stop; Channel_checkFade's
// own fade-out mechanism takes over otherwise.
if (ch->_pendingStop)
@@ -628,7 +628,6 @@ uint16 RSound::readScriptWord(byte *&pSrc) {
}
void RSound::tickCallback() {
- // Matches sub_122DA.
if (!_callbackPeriod)
return;
if (--_callbackCounter != 0)
@@ -754,7 +753,7 @@ dispatch:
goto dispatch;
}
case 0xC3: {
- readScriptByte(pSrc); // matches sub_108D1: reads one operand, does nothing with it
+ readScriptByte(pSrc); // reads one operand, does nothing with it
ch->_pSrc += 2;
goto dispatch;
}
diff --git a/engines/mads/dragonsphere/sound/rsound.h b/engines/mads/dragonsphere/sound/rsound.h
index 7ffa2098d43..79fd8d80abf 100644
--- a/engines/mads/dragonsphere/sound/rsound.h
+++ b/engines/mads/dragonsphere/sound/rsound.h
@@ -136,7 +136,7 @@ public:
* Phantom's RSound family entirely. Used by RSound1's music-loading
* commands (16, 32-48) for the same "immediate load, or defer until
* the music channels free up" idiom documented for ASound1's Pattern B.
- * - isMusicChannelsActive() (matches sub_10477) checks this driver's own
+ * - isMusicChannelsActive() checks this driver's own
* 6-channel "lower" group (1-5, 9), not Phantom's fixed 6-channel(0-6)
* equivalent from ASound.
* - No checkRandomAmbianceTrigger()/_randomAmbianceTriggerFlag hook -
@@ -146,7 +146,7 @@ public:
* - sendVolume()/sendPan() naming CORRECTED from a mixed-up disassembly
* symbol: the function IDA auto-named "sendVolume" actually sends CC#10
* (Pan) using the channel's _pan field; the real volume-sender (CC#7,
- * _volume field) was an unnamed sub_10B54. Also, CONFIRMED NEW: the
+ * _volume field) was an unnamed helper. Also, CONFIRMED NEW: the
* real sendVolume() only actually transmits when the channel's
* _pendingStop is zero - Channel_checkFade's own separate fade-out
* mechanism otherwise takes precedence. No equivalent gate exists on
@@ -154,8 +154,8 @@ public:
* - sendReverbSysEx()'s exact byte layout (fixed 10 00 01h Roland System
* Area Reverb address) is INFERRED by strong structural analogy to
* Phantom's confirmed implementation (same 2/3/3-bit parameter
- * masking, same "mutate 3 bytes then sendSysEx" shape found at
- * sub_108A1) - NOT independently confirmed by inspecting the literal
+ * masking, same "mutate 3 bytes then sendSysEx" shape found in
+ * Phantom's driver) - NOT independently confirmed by inspecting the literal
* bytes at rsound.dr1's offset 0x67 sysex template.
* - null_sound_data (see _silenceStream) is a fixed 2-byte (0, 0)
* silence marker referenced by BOTH Channel::enable() and
@@ -187,14 +187,14 @@ private:
uint16 _randomSeed;
byte _lastMidiStatus; // running-status cache, avoids resending an unchanged status byte
byte _sysexChecksum;
- int _stateChangedFlag; // word_12A56 in the disassembly; latches _pollResult=0xFFFF once per state change
+ int _stateChangedFlag; // latches _pollResult=0xFFFF once per state change
/**
* Per-MIDI-channel held-note slots (index 0 unused; channels are
* 1-9; 4 = max chord polyphony). CONFIRMED byte-addressed, 4 bytes
* per channel (channel*4 byte offset, single-byte reads/writes in
* Channel_flushHeldNotes and the chord opcode). The real table
- * (word_161FC, "dw 20h dup(?)") is 64 bytes/16 rows - 6 rows larger
+ * (declared as "dw 20h dup(?)" in the disassembly) is 64 bytes/16 rows - 6 rows larger
* than this [10][4] array - but rows 10-15 are never addressed since
* channel numbers only run 1-9; that's unused padding in the
* original; this smaller array is behaviorally equivalent.
@@ -234,7 +234,7 @@ private:
byte _scriptVariables[32];
/**
- * Half-rate fade-check timer (byte_10796 in the disassembly) -
+ * Half-rate fade-check timer -
* drives checkFadingChannels() directly.
*/
int _fadeCheckCounter;
@@ -256,14 +256,14 @@ private:
int _clockEnabled1;
int _clockEnabled2;
- // ---- Deferred-callback subsystem (word_131AA/AC/AE) - NEW vs. the
+ // ---- Deferred-callback subsystem - NEW vs. the
// Phantom RSound family, mirrors the sibling ASound driver's
// identically-shaped mechanism. ----
uint16 _callbackCounter = 0;
uint16 _callbackPeriod = 0;
CallbackFunction _callbackFnPtr = nullptr;
- /** Tracks which bucket-4 (32-48) music piece was last launched, for command18's re-entry. Matches word_12A8B. */
+ /** Tracks which bucket-4 (32-48) music piece was last launched, for command18's re-entry. */
uint16 _musicIndex = 0;
void update();
@@ -307,7 +307,7 @@ protected:
/**
* A driver-specific variant of Channel::enable() confirmed across
- * multiple drivers so far (RSound4's sub_1092A, RSound5's sub_10854)
+ * multiple drivers so far (RSound4's and RSound5's command5)
* - redirects _soundData (and, if the channel is about to expire this
* tick, _pSrc too) to _silenceStream instead of nullptr.
*/
@@ -373,7 +373,7 @@ protected:
_callbackPeriod = period;
}
- /** Set the music-piece index (word_12A8B) read by command18. */
+ /** Set the music-piece index read by command18. */
void setMusicIndex(uint16 idx) {
_musicIndex = idx;
}
@@ -385,13 +385,13 @@ protected:
* Deferred-callback tick: decrements _callbackCounter; when it
* reaches zero, reloads it from _callbackPeriod and calls
* _callbackFnPtr (if non-null), then clears _callbackFnPtr so it
- * fires exactly once. Matches sub_122DA.
+ * fires exactly once.
*/
void tickCallback();
/**
* Checks whether channels 1-5 or 9 (this driver's "lower"/music
- * group) have any non-zero _activeCount. Matches sub_10477 - the
+ * group) have any non-zero _activeCount - the
* Dragonsphere-specific equivalent of the sibling ASound driver's
* isMusicChannelsActive(), but scanning THIS driver's own channel
* grouping rather than ASound's fixed channels 0-6.
@@ -448,7 +448,7 @@ protected:
/**
* CORRECTED naming (see class comment): sends CC#7 (Volume) - but
* ONLY if the channel is not currently pending-stop (matches
- * sub_10B54's "cmp [bx+_pendingStop],0" gate, confirmed new vs.
+ * the disassembly's "cmp [bx+_pendingStop],0" gate, confirmed new vs.
* Phantom's unconditional sendVolume()).
*/
void sendVolume(Channel *ch);
@@ -511,7 +511,7 @@ protected:
* 0-7, level 0-7) and sends them via the Roland MT-32 System Area
* Reverb SysEx address (10 00 01h) - see class comment re: this
* being inferred by analogy rather than independently confirmed for
- * Dragonsphere. Matches sub_108A1.
+ * Dragonsphere.
*/
void sendReverbSysEx(int mode, int time, int level);
@@ -532,7 +532,7 @@ protected:
public:
Channel _channels[RSOUND_CHANNEL_COUNT];
int _frameCounter;
- int _tickCounter; // word_12A83 - incremented alongside _frameCounter every update() tick
+ int _tickCounter; // incremented alongside _frameCounter every update() tick
bool _isDisabled;
int _pollResult;
diff --git a/engines/mads/dragonsphere/sound/rsound_dragonsphere.cpp b/engines/mads/dragonsphere/sound/rsound_dragonsphere.cpp
index 281512285bb..cd17dffd403 100644
--- a/engines/mads/dragonsphere/sound/rsound_dragonsphere.cpp
+++ b/engines/mads/dragonsphere/sound/rsound_dragonsphere.cpp
@@ -1709,8 +1709,8 @@ int RSound5::command1() {
}
int RSound5::command5() {
- // Matches sub_10854: same disableChannelTo mechanic as RSound4's
- // sub_1092A, for channels 6,7,8.
+ // Same disableChannelTo mechanic as RSound4's
+ // command5, for channels 6,7,8.
_fadeCheckPeriod = 1; // armFadeCheck
disableChannelTo(5, 0xFF);
disableChannelTo(6, 0xFF);
@@ -1750,7 +1750,7 @@ int RSound5::command(int commandId, int param) {
}
int RSound5::command16() {
- // Matches byte_134D8's first-time-vs-every-other-time selection -
+ // The first-time-vs-every-other-time selection -
// see class comment. Both variants check the SAME two offsets
// (0x7DC, 0x7E9) as an OR-gate before proceeding, just in reversed
// order.
@@ -2185,7 +2185,7 @@ Channel *RSound6::playSoundChannels1To6(int offset) {
}
int RSound6::isMusicChannelsActive() {
- // Matches sub_10539: channels 1-6 AND 9 (seven channels), matching
+ // Channels 1-6 AND 9 (seven channels), matching
// command3()'s own wider group.
return _channels[0]._activeCount || _channels[1]._activeCount ||
_channels[2]._activeCount || _channels[3]._activeCount ||
@@ -2317,13 +2317,12 @@ int RSound6::command31() {
// command32/command33 share an intricate tail - see the class comment.
void RSound6::command32_33LoadCh4() {
- // Matches loc_124B2.
_command33Flag = 0;
_channels[3].load(loadData(0x9FB));
}
void RSound6::command32_33Load() {
- // Matches loc_12490 (falls through to the byte_13378 check at its end).
+ // Falls through to the shared flag check at its end.
command3();
_channels[0].load(loadData(0x8CE));
_channels[1].load(loadData(0x914));
@@ -2352,8 +2351,8 @@ int RSound6::command32() {
int RSound6::command33() {
// Matches rsound_command33's own entry point: gates, sets the shared
- // flag, then either falls into loc_1247E (command32's immediate
- // setup) or loc_124B2 (command32's "load channel 4" tail) directly,
+ // flag, then either falls into command32's immediate
+ // setup or command32's "load channel 4" tail directly,
// or - if neither condition holds - falls all the way through into
// command32's own body from the top (equivalent to calling it).
if (isSoundActive(loadData(0x9FB)))
@@ -2374,7 +2373,7 @@ int RSound6::command33() {
/*-----------------------------------------------------------------------*/
void RSound6::command34LoadCh1AndRest() {
- // Matches loc_12524 falling through to loc_1252D.
+ // Falls through to command34LoadRestOnly().
command3();
_channels[0].load(loadData(0xA1A));
_channels[1].load(loadData(0xA5C));
@@ -2383,7 +2382,7 @@ void RSound6::command34LoadCh1AndRest() {
}
void RSound6::command34LoadRestOnly() {
- // Matches loc_1252D reached directly (already-looping skip path).
+ // Reached directly (already-looping skip path).
_channels[1].load(loadData(0xA5C));
_channels[2].load(loadData(0xA95));
_channels[3].load(loadData(0xB22));
diff --git a/engines/mads/dragonsphere/sound/rsound_dragonsphere.h b/engines/mads/dragonsphere/sound/rsound_dragonsphere.h
index 3b60a09e13b..00ff857ce3c 100644
--- a/engines/mads/dragonsphere/sound/rsound_dragonsphere.h
+++ b/engines/mads/dragonsphere/sound/rsound_dragonsphere.h
@@ -168,7 +168,7 @@ public:
* channel 9 is untouched), and command5 enables channels 7,8 (confirmed
* via raw offsets 0x19CA/0x19F2, spaced by the channel stride).
*
- * command2 calls resetChannels1to6() (matches sub_1079A) + sendGmReset(4)
+ * command2 calls resetChannels1to6() + sendGmReset(4)
* - a genuinely different 6-channel range from the base class's
* resetChannels1to5(), matching command3's own shifted grouping.
*
@@ -235,7 +235,7 @@ public:
*
* command0/command2/command4/command6/command7/command8 all confirmed to
* match the shared RSound base exactly (no overrides needed) -
- * including command4 (whose reset helper sub_107E7 matches the base
+ * including command4 (whose reset helper matches the base
* class's own resetChannels6to8() exactly) and command2 (whose
* resetChannels1to5 matches the base class's own method exactly,
* including the channel-9 fix).
@@ -290,7 +290,7 @@ private:
int command31();
/**
- * Shared tail of command31()/command64() (matches loc_124D8): writes
+ * Shared tail of command31()/command64(): writes
* a variant byte (0x5A for command31, 0x78 for command64) into the
* sound data at offset 0x1402 before playing 0x13FF.
*/
@@ -328,7 +328,7 @@ public:
*
* command1/command2/command3/command4 are all genuinely different from
* the base class, in two ways:
- * - They use the base class's disableChannelTo() (matching sub_1092A)
+ * - They use the base class's disableChannelTo()
* instead of Channel::enable().
* - Channel 6 (the boundary between the "lower" 1-5,9 group and
* "upper" 6,7,8 group) is conditionally included/excluded based on
@@ -438,8 +438,8 @@ public:
* one) and command3 (matches the base's default 1-5,9 lower-group
* enable exactly).
*
- * command5 uses the base class's disableChannelTo() (matching
- * sub_10854) instead of Channel::enable(), for channels 6,7,8 (three
+ * command5 uses the base class's disableChannelTo()
+ * instead of Channel::enable(), for channels 6,7,8 (three
* channels, matching the base's default upper group range, just via a
* different mechanic).
*
@@ -456,7 +456,7 @@ private:
int command5();
/**
- * Matches byte_134D8: false the first time command16 is ever called,
+ * False the first time command16 is ever called,
* true forever after (there is no code path that resets it back to
* false) - selects between two near-identical variants (A the first
* time, B every time after).
@@ -479,7 +479,7 @@ private:
int command30();
/**
- * Shared tail of command31()/command78() (matches loc_126FF): writes
+ * Shared tail of command31()/command78(): writes
* a variant byte (0x5A for command31, 0x78 for command78) into the
* sound data at offset 0x2301 (3 bytes into the block about to be
* played) before playing 0x22FE.
@@ -575,7 +575,7 @@ private:
void resetChannels6to8();
/**
- * Hides the base class's method: matches sub_10539 - channels 1-6
+ * Hides the base class's method: channels 1-6
* AND 9 (seven channels), matching command3()'s own wider group,
* not the base class's default (1-5,9).
*/
@@ -624,7 +624,7 @@ private:
int command33();
void command32_33Load();
void command32_33LoadCh4();
- byte _command33Flag = 0; // matches byte_13378
+ byte _command33Flag = 0;
int command34();
void command34LoadCh1AndRest();
@@ -732,14 +732,14 @@ private:
int command32();
- /** Matches sub_123E0: writes a "variant A" set of bytes into the shared command33Or47()/command60() sound block, at the same 8 offsets touched by variantSetupB(). Called only by command60(). */
+ /** Writes a "variant A" set of bytes into the shared command33Or47()/command60() sound block, at the same 8 offsets touched by variantSetupB(). Called only by command60(). */
void variantSetupA();
- /** Matches sub_123FF: same 8 offsets as variantSetupA(), with different "variant B" byte values. Called only by command33Or47(). */
+ /** Same 8 offsets as variantSetupA(), with different "variant B" byte values. Called only by command33Or47(). */
void variantSetupB();
/**
- * Shared tail of command60()/command33Or47() (matches loc_12450) -
+ * Shared tail of command60()/command33Or47() -
* the two commands are otherwise identical (same gate, same
* counter=98/period=84 timer) and differ only in which variant setup
* helper runs first.
diff --git a/engines/mads/nebular/sound/asound.h b/engines/mads/nebular/sound/asound.h
index 146676fea9b..665ed0cdada 100644
--- a/engines/mads/nebular/sound/asound.h
+++ b/engines/mads/nebular/sound/asound.h
@@ -192,8 +192,7 @@ protected:
/**
* Hook called once per update() frame, immediately after the disabled
* check and before the frame counter/channel polling. Only ASound9's
- * driver data makes use of a recurring deferred-callback timer (the
- * word_1949E/word_194A0/_soundPtr trio in the original disassembly);
+ * driver data makes use of a recurring deferred-callback timer;
* every other driver leaves this as a no-op.
*/
virtual void tickCallback() {
@@ -303,18 +302,18 @@ public:
AdlibSample *_samplePtr;
int _frameCounter;
bool _isDisabled;
- int _noiseTicks1; // remaining duration for noise voice 1 (byte_11F86)
- int _noiseTicks2; // remaining duration for noise voice 2 (byte_11F87)
+ int _noiseTicks1; // remaining duration for noise voice 1
+ int _noiseTicks2; // remaining duration for noise voice 2
int _activeChannelNumber;
int _freqMask1;
int _freqMask2;
int _freqBase1;
int _freqBase2;
int _noiseChannel1, _noiseChannel2;
- int _noiseFreqStep1; // per-tick frequency-sweep step for noise voice 1 (word_11F8A)
- int _noiseFreqStep2; // per-tick frequency-sweep step for noise voice 2 (word_11F8C)
- int _savedNoiseTicks1; // _noiseTicks1 saved across command6/7 (byte_194B0)
- int _savedNoiseTicks2; // _noiseTicks2 saved across command6/7 (byte_194B1)
+ int _noiseFreqStep1; // per-tick frequency-sweep step for noise voice 1
+ int _noiseFreqStep2; // per-tick frequency-sweep step for noise voice 2
+ int _savedNoiseTicks1; // _noiseTicks1 saved across command6/7
+ int _savedNoiseTicks2; // _noiseTicks2 saved across command6/7
int _pollResult;
int _resultFlag;
byte _nullData[2];
diff --git a/engines/mads/nebular/sound/asound_nebular.h b/engines/mads/nebular/sound/asound_nebular.h
index f6d94217c2f..5f057dc4598 100644
--- a/engines/mads/nebular/sound/asound_nebular.h
+++ b/engines/mads/nebular/sound/asound_nebular.h
@@ -454,8 +454,7 @@ public:
class ASound9 : public ASound {
private:
/**
- * Deferred sound-loader callback state (word_1949E/word_194A0/_soundPtr
- * in the original disassembly). Unlike every other Rex Nebular driver,
+ * Deferred sound-loader callback state. Unlike every other Rex Nebular driver,
* ASound9 arms a recurring timer that re-invokes a scheduled loader
* function every _callbackPeriod ticks, without ever clearing the
* pointer itself (the loader body clears it if it wants the recurrence
diff --git a/engines/mads/nebular/sound/rsound.cpp b/engines/mads/nebular/sound/rsound.cpp
index 473cb5037ba..a319971a7c4 100644
--- a/engines/mads/nebular/sound/rsound.cpp
+++ b/engines/mads/nebular/sound/rsound.cpp
@@ -641,7 +641,7 @@ void RSound::update() {
/**
* Zeroes _activeCount and the three fade-step fields for channels in
- * [first, last) - matches the shared shape of sub_10132/sub_101A0/sub_101EA.
+ * [first, last).
* Deliberately does NOT touch the loop pointers, volume, program, pan etc,
* matching the original.
*/
@@ -666,7 +666,7 @@ void RSound::resetHeldNotes() {
}
/**
- * Matches sub_10132: resets all 9 channels and the held-notes table.
+ * Resets all 9 channels and the held-notes table.
* Called both from the constructor (mirroring rsound_init) and from
* command0.
*/
@@ -696,7 +696,7 @@ int RSound::command0() {
resetAllChannels();
sendMidiChannelReset(1, RSOUND_CHANNEL_COUNT);
- // Matches the trailing "lea ax, unk_1138F; jmp sub_1041E" in rsound_command0.
+ // Matches the tail of the original rsound_command0.
// _sysExOffset is this driver's own command0_array offset, supplied
// via the constructor (0x67 for rsound.001, 0x87 for rsound.002, 0x6F
// for rsound.009) - each driver's own resource file carries its own
@@ -714,7 +714,7 @@ int RSound::command1() {
}
int RSound::command2() {
- // Channels 1-5, matching sub_101A0 (also reinitializes the held-notes
+ // Channels 1-5 (also reinitializes the held-notes
// table) plus the MIDI channel reset for those same channels.
resetChannelRange(0, 5);
resetHeldNotes();
@@ -729,7 +729,7 @@ int RSound::command3() {
}
int RSound::command4() {
- // Channels 6-9, matching sub_101EA (does NOT touch the held-notes
+ // Channels 6-9 (does NOT touch the held-notes
// table) plus the MIDI channel reset for those same channels.
resetChannelRange(5, RSOUND_CHANNEL_COUNT);
sendMidiChannelReset(6, RSOUND_CHANNEL_COUNT);
diff --git a/engines/mads/nebular/sound/rsound.h b/engines/mads/nebular/sound/rsound.h
index e47b817f3d9..afbf196f933 100644
--- a/engines/mads/nebular/sound/rsound.h
+++ b/engines/mads/nebular/sound/rsound.h
@@ -164,7 +164,7 @@ private:
/**
* Zeroes _activeCount and the three fade-step fields for channels in
- * [first, last) - matches the shared shape of sub_10132/sub_101A0/sub_101EA.
+ * [first, last).
*/
void resetChannelRange(int first, int last);
@@ -174,7 +174,7 @@ private:
void resetHeldNotes();
/**
- * Matches sub_10132: resets all 9 channels and the held-notes table.
+ * Resets all 9 channels and the held-notes table.
*/
void resetAllChannels();
diff --git a/engines/mads/nebular/sound/rsound_nebular.h b/engines/mads/nebular/sound/rsound_nebular.h
index 745dcc536de..9a677e1a063 100644
--- a/engines/mads/nebular/sound/rsound_nebular.h
+++ b/engines/mads/nebular/sound/rsound_nebular.h
@@ -103,7 +103,7 @@ private:
static const uint16 _table1[16];
/**
- * Persistent counter (byte_108F1 in the disassembly; initial value
+ * Persistent counter (initial value
* 0x2F/47). Incremented by 16 (wrapping as a byte) each time
* command12 runs; the low 7 bits are written into the sound data's
* pitch/note byte before playback. command5 resets it back to 47.
@@ -159,7 +159,7 @@ private:
static const CommandPtr _commandList[61];
/**
- * Toggle used by command16 (byte_10A93 in the disassembly, initially
+ * Toggle used by command16 (initially
* 0). Flips every call; alternates between two completely different
* 4-channel music loads (one with a command1() fade first, one
* without) - preserved exactly despite the asymmetry looking odd.
@@ -167,8 +167,7 @@ private:
bool _command16AltFlag = false;
/**
- * Toggle used by command39/40 (byte_10B77 in the disassembly,
- * initially 0). Shared between both commands: flips bit 2 (^= 4) on
+ * Toggle used by command39/40 (initially 0). Shared between both commands: flips bit 2 (^= 4) on
* every call to either one, and the post-toggle value + 0x28 is
* written into the same sound data's byte 6, regardless of which of
* the two commands triggered the toggle.
@@ -176,7 +175,7 @@ private:
byte _command3940Toggle = 0;
/**
- * byte_10742 in the disassembly. Written unconditionally to 1 by
+ * Written unconditionally to 1 by
* sub1074E() (called from the shared command1/command5 tail and from
* command3), and separately written to the raw command parameter by
* command9. No consumer of this byte showed up in the batches given
@@ -186,10 +185,9 @@ private:
byte _byte10742 = 0;
/**
- * Shared helper: pData[5] = value, then plays pData. Matches
- * loc_10C44 in the disassembly (called once from command25, offset
- * 0x11A6, with a truncated second call at offset 0x11C4 not yet
- * confirmed).
+ * Shared helper: pData[5] = value, then plays pData. Called once
+ * from command25, with a truncated second call not yet
+ * confirmed.
*/
Channel *method1(int offset, byte value);
@@ -216,7 +214,7 @@ private:
void sendDualVolume(byte volume);
/**
- * sub_1074E in the disassembly - just sets _byte10742 = 1. Reached
+ * Just sets _byte10742 = 1. Reached
* both as a genuine call (from command3, not yet given) and via the
* shared command1/command5 tail below.
*/
@@ -224,17 +222,17 @@ private:
/**
* Placeholder for command slots confirmed by the dispatch table
- * (funcs_108A2) to be real, driver-specific functions, but whose
+ * to be real, driver-specific functions, but whose
* disassembly wasn't included in this batch. Warns at runtime if
* actually invoked, so a real call shows up during testing instead
* of silently vanishing. Distinct from nullCommand(), which is for
- * slots the table confirms are genuinely nullsub_1 in the original
+ * slots the table confirms are genuinely no-op stubs in the original
* (12, 52-56, 58).
*/
int notImplemented();
/**
- * Shared tail (loc_1083B in the disassembly) used by both command1
+ * Shared tail used by both command1
* (falls through into it after calling command3()) and command5
* (jumps straight into it after its isSoundActive gate). Enables
* channels 5-8 (1-based; indices 4-7) - notably never reaches
@@ -298,8 +296,8 @@ private:
/**
* Deferred callback state (checkCallback() in the disassembly,
* called from this driver's own rsound_update() override) - confirmed
- * identical in shape to RSound9's mechanism: word_122C4 is the
- * reload period, word_122C2 the countdown, and _soundPtr the pointer
+ * identical in shape to RSound9's mechanism: the reload period,
+ * the countdown, and _soundPtr the pointer
* invoked (without self-clearing - each loadCommandNN() body clears
* it itself, same as RSound9's loaders) once the countdown reaches 0.
*/
@@ -309,7 +307,7 @@ private:
int _callbackPeriod = 0;
/**
- * byte_10745 in the disassembly - set from the raw command parameter
+ * Set from the raw command parameter
* by command9. No consumer showed up in this batch, so its real
* purpose is unconfirmed (mirrors RSound3's equally-unconfirmed
* _byte10742, set the same way by RSound3::command9).
@@ -320,19 +318,19 @@ private:
static const CommandPtr _commandList[60];
/**
- * method1 in the disassembly - called only from command12's shared
+ * Called only from command12's shared
* tail; computes (param >> 1) + 36.
*/
byte paramToVariant();
/**
- * loc_109D3 in the disassembly - writes the same variant byte into
+ * Writes the same variant byte into
* offset 1 of the five sound blocks command12 (re)loads.
*/
void setCommand12Variant();
/**
- * loc_10967 in the disassembly - shared tail of both command10 and
+ * Shared tail of both command10 and
* command58, loading channels 1-3 (1-based; indices 0-2).
*/
void loadIntroChannels();
@@ -377,7 +375,7 @@ private:
static const CommandPtr _commandList[42];
/**
- * loc_1093A in the disassembly - shared tail of command29 and
+ * Shared tail of command29 and
* command38, loading channels 4 and 9 (1-based; indices 3 and 8).
*/
void loadTailChannels();
@@ -427,8 +425,8 @@ private:
/**
* Confirmed via rsound_update's own body (its checkCallback-equivalent
* is inlined directly rather than factored into a separate function
- * like RSound4's checkCallback()): word_121B6 is the reload period,
- * word_121B4 the countdown, and word_121B8 a genuine CODE pointer
+ * like RSound4's checkCallback()): the reload period,
+ * the countdown, and a genuine CODE pointer
* ("call bx" - not sound data) invoked once the countdown reaches 0.
* Matches RSound4's mechanism exactly in shape.
*/
@@ -440,7 +438,7 @@ private:
void tickCallback() override;
/**
- * loc_109BA / loc_10968 in the disassembly - command24/command28's
+ * command24/command28's
* own full-reload bodies. When channel 1 is currently playing the
* OTHER command's theme, that command doesn't interrupt it
* immediately - it just points _callbackFnPtr at this same reload
@@ -509,7 +507,7 @@ private:
static const CommandPtr _commandList[38];
/**
- * Shared tail (loc_109E2 in the disassembly) of command14/command15 -
+ * Shared tail of command14/command15 -
* mutates three bytes of the shared sound data then plays it 4 times.
*/
void setCommand1415Variant(byte v1, byte v2);
diff --git a/engines/mads/phantom/sound/asound_phantom.cpp b/engines/mads/phantom/sound/asound_phantom.cpp
index c421d7d112f..59b16595c20 100644
--- a/engines/mads/phantom/sound/asound_phantom.cpp
+++ b/engines/mads/phantom/sound/asound_phantom.cpp
@@ -582,7 +582,7 @@ int ASound3::command7() { return ASound::command7(); }
int ASound3::command8() { return ASound::command8(); }
// ---------------------------------------------------------------------------
-// sub_11CC6 - shared helper used by command34.
+// Shared helper used by command34.
// isSoundActive guard on 0xC36; if not active: command1, load ch0-7.
// (The tiny ch6 and ch7 blocks - 4 bytes each - are very short sub-blocks
// within the same composite sound.)
diff --git a/engines/mads/phantom/sound/asound_phantom.h b/engines/mads/phantom/sound/asound_phantom.h
index 5647dc39a32..06ded4aa955 100644
--- a/engines/mads/phantom/sound/asound_phantom.h
+++ b/engines/mads/phantom/sound/asound_phantom.h
@@ -32,33 +32,33 @@ namespace Sound {
* ASound1 (asound.ph1, _dataOffset = 0x21e0)
*
* Dispatch table layout:
- * off_11C32: commands 0â8 (max=8, base=0)
- * off_11C44: command 16 (max=0x10, base=0x10, 1 entry)
- * off_11C46: commands 24â27 (max=0x1B, base=0x18, 4 entries)
- * off_11C4E: commands 32â39 (max=0x27, base=0x20, 8 entries)
+ * Table 1: commands 0â8 (max=8, base=0)
+ * Table 2: command 16 (max=0x10, base=0x10, 1 entry)
+ * Table 3: commands 24â27 (max=0x1B, base=0x18, 4 entries)
+ * Table 4: commands 32â39 (max=0x27, base=0x20, 8 entries)
*
- * A fifth table (unk_13C3E, commands 64â76) exists but is encoded as raw
+ * A fifth table (commands 64â76) exists but is encoded as raw
* sound data bytes used as near-pointers â not reconstructible without the
* binary. Those commands are silently ignored.
*
- * command16 (sub_11F70): random background-music selector. Checks whether
+ * command16: random background-music selector. Checks whether
* channel 0 is already playing one of the five known music pieces; if not,
* randomly picks from four music loaders and plays it, storing the choice
- * in _musicIndex (mirrors word_11F5E in the original).
+ * in _musicIndex.
*/
class ASound1 : public ASound {
private:
typedef int (ASound1::*CommandPtr)();
static const CommandPtr _commandList[40];
- // Mirrors word_11F5E: tracks which music piece was last selected.
+ // Tracks which music piece was last selected.
int _musicIndex = 0;
- // Background-music loaders (targets of the CS:0x1F60 indirect table).
- int commandMusic0(); // sub_11D84 â starts at 0x1ECA
- int commandMusic1(); // sub_11EE6 â starts at 0x3418
- int commandMusic2(); // sub_11F0E â starts at 0x3688
- int commandMusic3(); // sub_11F36 â starts at 0x3D52
+ // Background-music loaders (targets of an indirect jump table).
+ int commandMusic0();
+ int commandMusic1();
+ int commandMusic2();
+ int commandMusic3();
int command0();
int command1();
@@ -218,7 +218,7 @@ public:
* asound_commands4: commands 64â70 (max=0x46, base=0x40, 7 entries)
* (Commands 32â63 are unreachable: the 0x20-range max constant = 0)
*
- * commands 24 and 25 share the same handler (sub_11D0A).
+ * commands 24 and 25 share the same handler.
*/
class ASound4 : public ASound {
private:
diff --git a/engines/mads/phantom/sound/rsound.cpp b/engines/mads/phantom/sound/rsound.cpp
index 73ce32466b9..35cf66cd6f6 100644
--- a/engines/mads/phantom/sound/rsound.cpp
+++ b/engines/mads/phantom/sound/rsound.cpp
@@ -175,7 +175,7 @@ void RSound::setVolume(int volume) {
}
void RSound::resultCheck() {
- // Matches the "cmp word_12BB8, 0xFFFF" latch right after rsound_update.
+ // Matches the state-changed-flag latch right after rsound_update.
if (_stateChangedFlag != 0xFFFF) {
_stateChangedFlag = 0xFFFF;
_pollResult = 0xFFFF;
@@ -281,7 +281,7 @@ void RSound::sendVolume(int midiChannel, int volume) {
}
void RSound::sendVolumeCC(int midiChannel, int volume) {
- // Matches sub_10423: unlike sendVolume()/sendStatus(), this sends the
+ // Unlike sendVolume()/sendStatus(), this sends the
// status byte UNCONDITIONALLY (no _lastMidiStatus dedup check) -
// used by command7 when restoring all 9 channels' volumes in a row.
byte status = 0xB0 | midiChannel;
@@ -317,10 +317,10 @@ void RSound::muteChannel(int midiChannel) {
}
void RSound::sendGmReset(int count) {
- // Matches sub_1068A: counts DOWN from count to 1, using the counter
+ // Counts DOWN from count to 1, using the counter
// itself as the MIDI channel number each iteration.
for (int midiChannel = count; midiChannel >= 1; --midiChannel) {
- _fadeCheckPeriod = 0; // matches "mov cs:byte_107BE, 0" at the top of every iteration
+ _fadeCheckPeriod = 0; // reset at the top of every iteration
byte status = 0xB0 | midiChannel;
_lastMidiStatus = status;
@@ -369,11 +369,10 @@ void RSound::sendSysExSequence() {
}
void RSound::sendPatchInitSequence() {
- // TENTATIVE - see header comment for sendPatchInitSequence(). Matches
- // sub_102BE exactly: 4 outer iterations, each sending one SysEx
- // message built from the fixed header at loadData(0xA3) plus a
- // computed payload; byte_12BD2 (here: base) persists and accumulates
- // across outer iterations.
+ // TENTATIVE - see header comment for sendPatchInitSequence(). 4 outer
+ // iterations, each sending one SysEx message built from the fixed
+ // header at loadData(0xA3) plus a computed payload; base persists
+ // and accumulates across outer iterations.
byte base = 0;
for (int outer = 0; outer < 4; ++outer) {
byte *header = loadData(0xA3);
@@ -408,14 +407,13 @@ void RSound::sendPatchInitSequence() {
}
void RSound::sendReverbSysEx(int mode, int time, int level) {
- // CONFIRMED: unk_12BC9 (RSound1's dseg offset 0xA9) holds the fixed
- // 3-byte Roland address 10 00 01h - the real MT-32 System Area Reverb
- // parameter address, a hardware protocol constant rather than
- // driver-specific sound data - immediately followed by the 3 mutable
- // payload bytes (byte_12BCC/CD/CE) that this function fills in
- // before sending. Hardcoded (not read via loadData()) since there's
- // no reason to expect this address to live at the same offset in
- // every driver's own resource file.
+ // CONFIRMED: the fixed 3-byte Roland address 10 00 01h is the real
+ // MT-32 System Area Reverb parameter address, a hardware protocol
+ // constant rather than driver-specific sound data - immediately
+ // followed by the 3 mutable payload bytes that this function fills
+ // in before sending. Hardcoded (not read via loadData()) since
+ // there's no reason to expect this address to live at the same
+ // offset in every driver's own resource file.
byte buffer[7] = { 0x10, 0x00, 0x01, (byte)(mode & 3), (byte)(time & 7), (byte)(level & 7), 0xFF };
sendSysExData(buffer);
}
@@ -441,12 +439,11 @@ void RSound::Channel_checkFade(Channel *channel, int midiChannel) {
return;
if (channel->_volume == 0) {
- // unk_172E5 (RSound1's dseg offset 0x47C5) is 3 zero bytes - a
- // generic silence/no-op stream, not driver-specific sound data.
- // Hardcoded (not read via loadData()) for the same reason as
- // sendReverbSysEx()'s fixed address - no reason to expect the
- // same offset holds the same bytes in every driver's own
- // resource file.
+ // This is 3 zero bytes - a generic silence/no-op stream, not
+ // driver-specific sound data. Hardcoded (not read via loadData())
+ // for the same reason as sendReverbSysEx()'s fixed address - no
+ // reason to expect the same offset holds the same bytes in every
+ // driver's own resource file.
static byte silenceStream[3] = { 0, 0, 0 };
channel->_pSrc = silenceStream;
channel->_pendingStop = 0;
@@ -525,7 +522,7 @@ int RSound::command0() {
}
int RSound::command1() {
- // IMPORTANT: falls through to the SAME tail as command5() (loc_108A9)
+ // IMPORTANT: falls through to the SAME tail as command5()
// directly and ungated - it must NOT call the virtual command5()
// here, since that would wrongly apply whatever driver-specific
// isSoundActive() gate command5() has. command1() itself is never
@@ -555,8 +552,8 @@ int RSound::command3() {
}
void RSound::resetAndGmResetUpperChannels() {
- // Matches loc_106DB (command4()'s shared tail in every driver
- // confirmed so far): reset channels 4-9, then a full sendGmReset(9)
+ // command4()'s shared tail in every driver
+ // confirmed so far: reset channels 4-9, then a full sendGmReset(9)
// (all 9 channels) - both really execute, matching the original
// exactly despite the apparent redundancy.
resetChannels4to9();
@@ -564,8 +561,8 @@ void RSound::resetAndGmResetUpperChannels() {
}
void RSound::enableUpperChannels() {
- // Matches loc_108A9 (command1()'s and command5()'s shared tail in
- // every driver confirmed so far): enables channels 5,6,7,8.
+ // command1()'s and command5()'s shared tail in
+ // every driver confirmed so far: enables channels 5,6,7,8.
_fadeCheckPeriod = 1;
_channels[4].enable(0xFF);
_channels[5].enable(0xFF);
@@ -613,7 +610,7 @@ void RSound::update() {
return;
++_frameCounter;
- ++_tickCounter; // matches "inc word_12BE5" alongside _frameCounter
+ ++_tickCounter; // incremented alongside _frameCounter
checkRandomAmbianceTrigger();
pollAllChannels();
checkFadingChannels();
@@ -657,8 +654,8 @@ dispatch:
byte b = *pSrc;
if (!(b & 0x80)) {
- // ---- Simple note event: [note][duration] (matches loc_11FCA;
- // distinct from - and simpler than - the explicit chord opcode
+ // ---- Simple note event: [note][duration] (distinct from -
+ // and simpler than - the explicit chord opcode
// 0xED below, which is count-prefixed and can hold up to 4
// simultaneous notes) ----
int note = (int8)pSrc[0] + ch->_transpose;
@@ -945,8 +942,8 @@ dispatch:
// a "tableByte" positioned right after the two range operands,
// and writes the random value at offset (pSrc+2+tableByte)
// relative to pSrc's position after reading both operands
- // (an extra "inc word_174A0" in the disassembly, beyond the
- // two operand reads, is what puts tableByte one byte further
+ // (an extra increment in the disassembly, beyond the two
+ // operand reads, is what puts tableByte one byte further
// out than the 0xEC case below).
int rangeLow = readScriptByte(pSrc);
int rangeHigh = readScriptByte(pSrc);
@@ -983,7 +980,7 @@ dispatch:
ch->_innerLoopPtr = ch->_soundData;
ch->_outerLoopPtr = ch->_soundData;
}
- goto post_keyon; // matches "jmp loc_11FAB" tail used by this cluster
+ goto post_keyon; // tail used by this cluster
}
case 0xFC: {
byte *ptr = loadData(readScriptWord(pSrc));
@@ -1083,7 +1080,7 @@ dispatch:
}
case 0xED: {
// ---- Chord event: [count][note1..noteN][duration] ----
- // Matches loc_11102 - distinct from (and richer than) the
+ // Distinct from (and richer than) the
// simple single-note "high bit clear" format at the top of
// dispatch: this one is count-prefixed and can hold up to
// 4 simultaneous notes (matching _heldNotes' 4 slots).
diff --git a/engines/mads/phantom/sound/rsound.h b/engines/mads/phantom/sound/rsound.h
index 971262d6492..173926cb216 100644
--- a/engines/mads/phantom/sound/rsound.h
+++ b/engines/mads/phantom/sound/rsound.h
@@ -135,20 +135,20 @@ private:
uint16 _randomSeed;
byte _lastMidiStatus; // running-status cache, avoids resending an unchanged status byte
byte _sysexChecksum;
- int _stateChangedFlag; // word_12BB8 in the disassembly; latches _pollResult=0xFFFF once per state change
+ int _stateChangedFlag; // latches _pollResult=0xFFFF once per state change
/**
* Per-MIDI-channel held-note slots (index 0 unused; channels are
* 1-9; 4 = max chord polyphony). TODO/unconfirmed: the disassembly
* shows TWO seemingly-parallel tables using the identical
- * "channel*4+slot" indexing and 0xFF-empty-slot convention -
- * byte_1760C (read/written directly by the chord-note-storing logic
- * in Channel_pollActive) and an unnamed array at dseg offset 0x4AEC
- * (used by resetAllChannels's initialization and by the
- * flush-held-notes helper). IDA never resolves 0x4AEC to a named
- * symbol anywhere, so it's not confirmed whether these are the same
- * underlying memory (most likely, and what's implemented here) or
- * two genuinely separate tables - worth double-checking.
+ * "channel*4+slot" indexing and 0xFF-empty-slot convention - one
+ * table (read/written directly by the chord-note-storing logic
+ * in Channel_pollActive) and a second, unnamed array (used by
+ * resetAllChannels's initialization and by the flush-held-notes
+ * helper). The disassembly never resolves the second array to a named
+ * symbol, so it's not confirmed whether these are the same underlying
+ * memory (most likely, and what's implemented here) or two genuinely
+ * separate tables - worth double-checking.
*/
byte _heldNotes[RSOUND_CHANNEL_COUNT + 1][4];
@@ -163,18 +163,17 @@ private:
int _sysExOffset;
/**
- * General-purpose script variable table (byte_17480 in the
- * disassembly). Confirmed 32 bytes via the gap to the next declared
- * global (_scriptReadPtr) - also matches the sibling ASound driver's
- * analogous _scriptVars[32].
+ * General-purpose script variable table. Confirmed 32 bytes via the
+ * gap to the next declared global (_scriptReadPtr) - also matches the
+ * sibling ASound driver's analogous _scriptVars[32].
*/
byte _scriptVariables[32];
/**
- * Half-rate fade-check timer (byte_107BD/byte_107BE in the
- * disassembly) - same counter/period/reload shape as the Rex Nebular
- * RSound4/RSound6 callback mechanism, but drives checkFadingChannels()
- * directly rather than an arbitrary function pointer.
+ * Half-rate fade-check timer - same counter/period/reload shape as the
+ * Rex Nebular RSound4/RSound6 callback mechanism, but drives
+ * checkFadingChannels() directly rather than an arbitrary function
+ * pointer.
*/
int _fadeCheckCounter;
@@ -190,15 +189,15 @@ private:
* update() tick ever runs, since _tickCounter increments
* unconditionally every tick thereafter and the gate checks "== 0".
*/
- int _tickCounter; // word_12BE5
- int _clockMedTarget; // word_12BE7 - pending value for _clockMed, set by opcode 0xC0
- int _clockCoarseTarget; // word_12BE9 - pending value for _clockCoarse, set by opcode 0xBF
- int _clockUnknown; // word_12BEB - default 0; doesn't fit the 4x pattern, standalone (opcode 0xBE)
- int _clockCoarse; // word_12BEE - default 112 (=28*4)
- int _clockMed; // word_12BF0 - default 28 (=7*4)
- int _clockFine; // word_12BF2 - default 7
- int _clockEnabled1; // word_12BD3 - set to 1 by opcode 0xBF
- int _clockEnabled2; // word_12BE3 - set to 1 by opcode 0xBF
+ int _tickCounter;
+ int _clockMedTarget; // pending value for _clockMed, set by opcode 0xC0
+ int _clockCoarseTarget; // pending value for _clockCoarse, set by opcode 0xBF
+ int _clockUnknown; // default 0; doesn't fit the 4x pattern, standalone (opcode 0xBE)
+ int _clockCoarse; // default 112 (=28*4)
+ int _clockMed; // default 28 (=7*4)
+ int _clockFine; // default 7
+ int _clockEnabled1; // set to 1 by opcode 0xBF
+ int _clockEnabled2; // set to 1 by opcode 0xBF
void update();
void pollAllChannels();
@@ -250,13 +249,12 @@ protected:
}
/**
- * byte_1303E in the disassembly. Cleared to 0 by RSound1's command37
- * (a "cancel any pending random-ambiance trigger" side effect of
- * playing that specific sound). CONFIRMED: the only code that ever
- * sets it to 0xFF (arming checkRandomAmbianceTrigger()) is itself
- * unreachable/dead code - so in the real game this mechanism never
- * actually fires. Implemented faithfully anyway (matching sub_1222E's
- * shape exactly) in case that changes for a different driver.
+ * Cleared to 0 by RSound1's command37 (a "cancel any pending
+ * random-ambiance trigger" side effect of playing that specific
+ * sound). CONFIRMED: the only code that ever sets it to 0xFF (arming
+ * checkRandomAmbianceTrigger()) is itself unreachable/dead code - so
+ * in the real game this mechanism never actually fires. Implemented
+ * faithfully anyway in case that changes for a different driver.
* Protected (not private) so driver subclasses with their own
* commands touching it (like RSound1's command37) can reach it
* directly.
@@ -289,7 +287,7 @@ protected:
* Hook called once per update() frame after the disabled check.
* Only drivers with a random-ambiance/music picker (e.g. RSound1's
* command16) override this; every other driver leaves it a no-op.
- * Matches sub_1222E's confirmed shape: if _randomAmbianceTriggerFlag
+ * Confirmed shape: if _randomAmbianceTriggerFlag
* == 0xFF, clear it and fire the driver-specific picker.
*/
virtual void checkRandomAmbianceTrigger() {
@@ -316,9 +314,8 @@ protected:
/**
* Plays the specified sound, using any free channel from 1 to 8
- * (everything except channel 9). Matches sub_104FF in the
- * disassembly - a third, distinct scan range from playSound() and
- * playSoundAny() above.
+ * (everything except channel 9) - a third, distinct scan range from
+ * playSound() and playSoundAny() above.
*/
Channel *playSoundAny(int offset);
@@ -369,7 +366,7 @@ protected:
/**
* Sends the GM-reset Control Change sequence (all notes off, reset all
* controllers, volume=100, pan=center) to `count` MIDI channels,
- * counting down from `count` to 1. Matches sub_1068A.
+ * counting down from `count` to 1.
*/
void sendGmReset(int count);
@@ -402,7 +399,7 @@ protected:
void sendSysExSequence();
/**
- * TENTATIVE: matches sub_102BE - a nested loop (4 outer x 32 inner
+ * TENTATIVE: a nested loop (4 outer x 32 inner
* iterations) building and sending a SysEx message each inner pass.
* The overall shape (loop counters, accumulating base value, fixed
* bytes 0x18/0x32/0x0C) is clear from the disassembly, but the exact
@@ -412,17 +409,16 @@ protected:
void sendPatchInitSequence();
/**
- * CONFIRMED: matches sub_108C7 - masks the 3 caller-supplied values
+ * CONFIRMED: masks the 3 caller-supplied values
* to 2/3/3 bits (mode 0-3, time 0-7, level 0-7) and sends them via
- * the real Roland MT-32 System Area Reverb SysEx address (10 00 01h -
- * originally found at RSound1's dseg offset 0xA9, but hardcoded here
- * rather than read via loadData(), since it's a fixed hardware
- * protocol address, not driver-specific sound data).
+ * the real Roland MT-32 System Area Reverb SysEx address (10 00 01h),
+ * hardcoded here rather than read via loadData(), since it's a fixed
+ * hardware protocol address, not driver-specific sound data.
*/
void sendReverbSysEx(int mode, int time, int level);
/**
- * Matches sub_108F9 - a confirmed no-op (reads one operand, does
+ * A confirmed no-op (reads one operand, does
* nothing with it).
*/
void noOpHandler(int param) {
@@ -436,13 +432,13 @@ protected:
/**
* Shared tail of command1() (falls through into it after command3())
* and command5() (jumps straight into it, ungated, in every driver
- * confirmed so far): enables channels 5,6,7,8. Matches loc_108A9.
+ * confirmed so far): enables channels 5,6,7,8.
*/
void enableUpperChannels();
/**
* Shared tail of command4() in every driver confirmed so far:
- * resetChannels4to9() + sendGmReset(9). Matches loc_106DB.
+ * resetChannels4to9() + sendGmReset(9).
*/
void resetAndGmResetUpperChannels();
diff --git a/engines/mads/phantom/sound/rsound_phantom.cpp b/engines/mads/phantom/sound/rsound_phantom.cpp
index 693420d80fb..32470579bc4 100644
--- a/engines/mads/phantom/sound/rsound_phantom.cpp
+++ b/engines/mads/phantom/sound/rsound_phantom.cpp
@@ -76,7 +76,7 @@ int RSound1::command(int commandId, int param) {
}
void RSound1::checkRandomAmbianceTrigger() {
- // Matches sub_1222E exactly. CONFIRMED: the only code that ever arms
+ // CONFIRMED: the only code that ever arms
// this (setting _randomAmbianceTriggerFlag to 0xFF) is itself
// unreachable/dead code, so in practice this check always fails and
// command16() never fires via this path - only command37's clear
@@ -652,7 +652,7 @@ int RSound3::command(int commandId, int param) {
int RSound3::command4() {
// Confirmed: TWO chained isSoundActive() gates (unlike RSound1/
- // RSound2's single 0x3D98 gate), then a tail (sub_10832) that
+ // RSound2's single 0x3D98 gate), then a tail that
// resets only channels 5-9 (indices 4-8) - narrower than the
// shared resetChannels4to9()'s 4-9 (indices 3-8) - so it can't
// reuse resetAndGmResetUpperChannels() and calls resetChannelRange()
@@ -671,7 +671,7 @@ int RSound3::command4() {
int RSound3::command5() {
// Same two-gate shape as command4() above, but the plain
- // enableUpperChannels() tail (loc_10955, shared with command1()).
+ // enableUpperChannels() tail (shared with command1()).
if (isSoundActive(loadData(0x2AA6)))
return 0;
if (isSoundActive(loadData(0x1E30)))
@@ -886,8 +886,8 @@ int RSound4::command(int commandId, int param) {
int RSound4::command4() {
// Confirmed: NO isSoundActive() gate in this driver, unlike every
- // other driver seen so far - matches sub_107FC + sendGmReset(9)
- // unconditionally.
+ // other driver seen so far - unconditionally resets channels 5-8,
+ // then calls sendGmReset(9).
_isDisabled = true;
resetChannelRange(5, 8);
_isDisabled = false;
@@ -896,14 +896,14 @@ int RSound4::command4() {
}
int RSound4::command5() {
- // Confirmed: sub_10838 (_fadeCheckPeriod = 1) + channels 5-8 -
+ // Confirmed: _fadeCheckPeriod = 1 + channels 5-8 -
// identical to the shared enableUpperChannels(), no gate at all.
enableUpperChannels();
return 0;
}
int RSound4::command16() {
- // sub_101E7 ("isSoundPlaying") confirmed functionally identical to
+ // The disassembly's "isSoundPlaying" helper is confirmed functionally identical to
// RSound::isSoundActive() - same channel 1-8 scan, same
// _activeCount && _soundData==pData test, same pop-return-address
// early-exit trick.
@@ -1298,7 +1298,7 @@ int RSound9::command(int commandId, int param) {
}
int RSound9::command4() {
- // sub_1082B: resets channels 7,8,9 (0-based indices 6-8) - a fourth
+ // Resets channels 7,8,9 (0-based indices 6-8) - a fourth
// distinct range for this reset tail (RSound1/2: 4-9, RSound3: 5-9,
// RSound4/5: 6-9). No isSoundActive() gate, matching RSound4/5.
_isDisabled = true;
@@ -1452,8 +1452,8 @@ int RSound9::command69() {
}
int RSound9::command70() {
- // Shares a fallthrough tail with command71 (loc_12439 in the
- // disassembly): writes a variant byte into the sound data at 0x299B
+ // Shares a fallthrough tail with command71: writes a variant byte
+ // into the sound data at 0x299B
// before playing 0x2998 - twice, matching the disassembly's call +
// tail-jmp pair exactly.
*loadData(0x299B) = 80;
diff --git a/engines/mads/phantom/sound/rsound_phantom.h b/engines/mads/phantom/sound/rsound_phantom.h
index 321c71deaeb..097722654f1 100644
--- a/engines/mads/phantom/sound/rsound_phantom.h
+++ b/engines/mads/phantom/sound/rsound_phantom.h
@@ -31,11 +31,11 @@ namespace Sound {
/**
* RSound1 (rsound.ph1)
*
- * Dispatch table layout (funcs_10960/10976/1098C/109A2/109B8 in the
- * disassembly - a 5-bucket sparse dispatch, mirroring the sibling ASound1's
- * identical structure). There is no command 17 - bucket 2's dispatch
- * bounds check only ever admits index 16 (confirmed: word_13047 = 16, an
- * inclusive upper bound equal to the bucket's own lower bound).
+ * Dispatch table layout: a 5-bucket sparse dispatch, mirroring the
+ * sibling ASound1's identical structure. There is no command 17 -
+ * bucket 2's dispatch bounds check only ever admits index 16
+ * (confirmed: the upper bound is 16, equal to the bucket's own lower
+ * bound).
* commands 0-8 (base class, except command4/5 - see RSound::command4/5)
* command 16 (random-ambiance picker, this class)
* commands 24-27 (this class)
@@ -55,7 +55,7 @@ class RSound1 : public RSound {
private:
typedef int (RSound1:: *CommandPtr)();
- // Mirrors word_1225D: avoids picking the same alternative twice in a row.
+ // Avoids picking the same alternative twice in a row.
int _lastRandomAmbianceIndex = -1;
void checkRandomAmbianceTrigger() override;
@@ -192,7 +192,7 @@ public:
* RSound1/RSound2: both gate on TWO chained isSoundActive() checks
* (0x2AA6 then 0x1E30, each an independent early-out per the
* pop-return-address mechanic) rather than one, and command4()'s tail
- * (sub_10832) resets only channels 5-9 (indices 4-8) - NOT channels
+ * resets only channels 5-9 (indices 4-8) - NOT channels
* 4-9 (indices 3-8) like the shared resetAndGmResetUpperChannels() -
* so it can't reuse that helper and calls resetChannelRange()
* directly instead.
@@ -260,13 +260,13 @@ public:
* command4() is a genuinely new shape: unlike every driver confirmed so
* far, it has NO isSoundActive() gate at all - it unconditionally resets
* channels 6-9 (0-based indices 5-8, confirmed via explicit
- * Channel._activeCount/_volumeFadeStep-labeled writes in sub_107FC) via
+ * Channel._activeCount/_volumeFadeStep-labeled writes) via
* resetChannelRange(), then sends a full sendGmReset(9). A third distinct
* channel range for this reset (RSound1/RSound2 used 4-9, RSound3 used
* 5-9), reinforcing that this range is always driver-specific.
*
* command1/command3 confirmed to match the shared RSound base exactly
- * (no overrides needed) - sub_10838 (called at the top of both) is
+ * (no overrides needed) - the helper called at the top of both is
* confirmed to be exactly "_fadeCheckPeriod = 1", and command5's four
* channel-enable targets are confirmed to be channels 5-8, matching
* enableUpperChannels() exactly.
More information about the Scummvm-git-logs
mailing list