Okay here we go. First for some due credit: I based this heavily on your work, Grimoire. I tried to fill in some of the missing pieces where (presumably) Geiger's live disassembly naturally jumped over some sections, but I probably missed some. And there were some sections I omitted, but I tried to indicate that below.
The bit in question is used a little over halfway down, after the label for address 03:D0A9.
[03:CC46] Spell Routine (Command 0x02)
Note: Item (0x1D) routine jumps into this too for most of the work.
----------------------------------------------
Sorry, I did not analyze the first chunk of the routine.
I believe part of it is looping targets to check for valid ones so that
it can calculate the divider used to split damage or healing.
The subroutine called at [03:CD33] for player Summon spells basically maps
to the Enemy Summon equivalent.
It replaces the caster's next subaction at $26D2, and sets $3584 to 1 as a flag.
To be honest, I did not know it overwrote $26D2 when I analyzed most of this,
so I may have some logic errors where the code tests for spell number ranges.
When Asura, it picks one of the 3 Asuras at random, and overwrites the
party target at $26D4 with 0xF8 (presumably to target all party?)
[03:CD3E]
Note: This is where the Item routine (0x1D) jumps in.
Starting around [03:D2CE] is where it looks to be checking for life-like spells.
[CE28]
if (num_targets == 0)
FAIL
if (spell targets only ALL of ally or enemy)
num_targets = 1 // Clarification: this is the split damage/healing divider
[CE42]
if (caster is a player)
{
if (caster.mp < spell.mp_cost)
FAIL
caster.mp -= spell.mp_cost
}
[CE7B]
if (using a spell, not an item)
{
if (caster has Mute and spell < 5F) // The "verbal" spells, perhaps.
FAIL
if (caster has Piggy and spell isn't Piggy)
FAIL
if (caster has Toad and spell isn't Toad)
FAIL
}
[CEB7]
hitrate = spell.hitrate
if (spell is a White spell)
hitrate += caster.will / 2
else
hitrate += caster.wisdom / 2
if (hitrate > 255)
hitrate = 255
if (caster has Darkness)
hitrate /= 2
if (caster is in slot 0)
hitrate *= 5 / 4
[CF01]
// I reordered this section a bit to make the logic easier for me to follow
if (is a weapon spell from the Item routine)
{
successful_hit_count = weapon_spell_multiplier // from table at 0F:9070
}
else if (using an item or <byte at $38ED, possibly flag for Grimoire item?>)
{
successful_hit_count = 8
}
else
{
if (spell has solo multiplier bit?) // top bit of effect index byte
attack_multiplier = 1
else if (spell is a White spell)
attack_multiplier = caster.will / 4 + 1
else
attack_multiplier = caster.wisdom / 4 + 1
successful_hit_count = calculate_multiplier(hitrate, attack_multiplier)
}
[CF3E]
Sorry, unknown stuff I did not complete.
Part checks for Wall reflecting.
Part also checks for some target statuses. Very incomplete notes:
If target is Hiding or Swoon, allow spell effects 0A (life) and 30 (I think Revive Monster?), but FAIL any others.
If target is Stone, allow spell effect 0B (heal status), but FAIL any others.
[D049]
// Note the game code uses a 2x biased integer for the elemental and creature "multipliers",
// so (1 means 1/2x, 2 means 1x, etc)
// and sets the top bit for absorb. Here I just use real numbers like 1, -0.5, for simplicity.
// The game initializes these memory locations for various calculations later; they are unused for the rest here though.
is_crit = false
elemental_multiplier = 1x
creature_multiplier = 1x
if (spell is a player Call spell)
power = spell.power * 8
else
power = spell.power * 4
if (caster and target are both PCs)
defense = 0
else
defense = target.magic_defense
[D0A9]
evasion = target.magical_evasion
if (target has Darkness)
evasion = 2 // I think it sets to 2, but that seems weird. Did they intend 0?
if (caster is in slot zero)
evasion *= 5 / 4 // This seems odd. Is it a penalty for spell use in the front?
defense_multiplier = target.magical_defense_multiplier
if (defense_multiplier > 0)
if (spell has top bit of elemental index byte) // <-- Here is the bit in question?
defense_multiplier = 1
if (target has Toad or Charging)
defense_multiplier = 0
if (target is a monster)
{
if (target.magical_defense_multiplier == 255)
{
evasion = 99
defense_multiplier = 99
}
}
successful_evasion_count = calculate_multiplier(evasion, defense_multiplier)
[D113]
if (caster and target are both PCs)
net_multiplier = successful_hit_count
else
net_multiplier = successful_hit_count - successful_evasion_count
<tests $2A35 if non-zero causes a FAIL>
if (net_multiplier <= 0 OR (target.is_boss AND spell has top bit of hit rate byte))
{
if ((spell is A0 [Explode]) or (5F <= spell <= 93) or (spell >= A9))
net_multiplier = 1
else
FAIL
}
[D162]
// if invincibility is on, and target is a monster. let monster target itself though
if (invincibility_counter != 0 AND target is a monster AND caster != target)
{
// more simply this means: everything but the Crystal fails.
if (using a spell)
FAIL
if (item is NOT the Crystal)
FAIL
}
[D17B]
<Sorry I didn't finish this part>
Eventually it jumps to the spell effect routine itself.
So, algorithmically, this bit would clamp the defense multiplier to 1 if it was higher. In theory, this could affect whether the spell hits or misses, as well as any damage or healing that is calculated subsequently if any. I honestly haven't looked at which spells have any of the 3 bits on yet though, so I will have to hold off making a better higher level description of its purpose.