øAslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&topic=1883.msg19235e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/indexe715.htmldelayedslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&topic=1883.45e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/indexe715.html.zxÚg^ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÈ`x)ÂgOKtext/htmlISO-8859-1gzip@øÕÂgÿÿÿÿÿÿÿÿÑHTue, 10 Mar 2020 05:03:44 GMT0ó°° ®0®P®€§²ð®Øg^ÿÿÿÿÿÿÿÿ9aÂg Grimoire LD's Notes, Patches, and Hacks (Dark Knight/Paladin Swap In Battle!)

Author Topic: Grimoire LD's Notes, Patches, and Hacks (Dark Knight/Paladin Swap In Battle!)  (Read 78650 times)

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
« Reply #45 on: September 24, 2013, 12:17:45 AM »
Counter Routine

Code: [Select]
$03/DDC6 AD 9D 26 LDA $269D  [$7E:269D] A:0003 X:0056 Y:0000 P:envMxdizc - Load the Caster's Physical Attack Base into A.
$03/DDC9 AA TAX A:0011 X:0056 Y:0000 P:envMxdizc - Transfer A to X.
$03/DDCA 8E 02 39 STX $3902  [$7E:3902] A:0011 X:0011 Y:0000 P:envMxdizc - Store X in 7E3902.
$03/DDCD 0E 02 39 ASL $3902  [$7E:3902] A:0011 X:0011 Y:0000 P:envMxdizc - Multiply the value by 2.
$03/DDD0 2E 03 39 ROL $3903  [$7E:3903] A:0011 X:0011 Y:0000 P:envMxdizc - Roll the value in 7E3903 by 2.
$03/DDD3 4C AF C9 JMP $C9AF  [$03:C9AF] A:0011 X:0011 Y:0000 P:envMxdiZc - Jump to Damage Determination.
(Seems to somehow leave the routine from here)

Well... that seemed straightforward enough.

This is such a waste of space and opportunity. For whatever reason the game has four extra bytes allocated to it (possibly more) that would easily allow someone to add in an Elemental or Status component.

I will have to move away slightly from my ordinary coding (as shown through Geiger's) to get the point across...

This is what is at 03DDD0 Ordinarily

2E 03 39 4C AF C9 EE 81 38 60 - The 60 is the RTS which takes it out of the routine, but it never seems to be properly read. Nor are the three bytes before it as far as I could tell. It has the barebones basic of being an attack formula without anything added to it.

To...

Say we wanted to add Elemental to this...

2E 03 39 20 30 E1 4C AF C9 60 - This adds in 20 30 E1 Or Jump to E130 which is the Elemental Damage Routine.


Say you wanted Cecil to learn a series of Elemental Sword Attacks, this change would allow the Counter Formula to do so and if you didn't want the data to be the same exact as your physical attack you would change the 7E269D to something else desired. Maybe base it on Cecil's Current MP making it scale in power (and if controlled properly) but shouldn't overtake the power of the available swords. You could also, in essence, cannibalize Sing to give Cid a "Random Element Attack" skill. This is quite a unique formula and it may just be better to expand on it rather than worry about Absorb too much.

 :edit: While the above would work. The bytes following it are Invincibility On for monsters. So it would screw up the Mist Dragon and Zeromus2. There are ways around both of these, of course.

« Last Edit: September 27, 2013, 12:41:21 PM by Grimoire LD »

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
« Reply #46 on: September 24, 2013, 09:22:43 AM »
I would wonder, though, if those four bytes are used at an entirely different time.
Once or twice (though I can't remember the specifics), I've seen the game jump to the middle of a subroutine and wondered what instructions were being skipped.
The only way I can think of to test this is to put a breakpoint on 03/DDD6 and play for a while to see if it ever breaks - tedious.

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
« Reply #47 on: September 24, 2013, 09:36:03 AM »
I thought the same thing, but I saw no jump to it in the routine, what it does is Increment the value at 7E3881, which is apparently only used if Monster's are going to become invincible. Well there is the Mist Dragon to test that on...

...And yeah. Bah. It is called for the very specific purpose of turning a Monster invincible and then returning. Why would they put that there rather than place it closer to its own "increment Invincibility Counter" routine? Ah well, I'll have to keep that address jump in mind for when I get to the Increment Invincibility Counter. There has to be a cleaner way to make that work.

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
« Reply #48 on: September 24, 2013, 11:09:46 AM »
Damage, Immobolizing Status (Mage) Routine
Code: [Select]
$03/DA8C 20 FD E0 JSR $E0FD  [$03:E0FD] A:0003 X:0032 Y:FFFF P:envMxdizc - Jump to "Is it Absorb?" Subroutine.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/E0FD AD 26 27 LDA $2726  [$7E:2726] A:0003 X:0032 Y:FFFF P:envMxdizc - Load Target's Elemental Immunity.
$03/E100 2D A2 28 AND $28A2  [$7E:28A2] A:0000 X:0032 Y:FFFF P:envMxdiZc - And the Spell's Elemental.
$03/E103 F0 11 BEQ $11    [$E116] A:0000 X:0032 Y:FFFF P:envMxdiZc - Branch it the two do not match or are both 00 to 03E116.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E105 7B TDC A:0040 X:0032 Y:0000 P:envMxdizc - Transfer Direct Page
$03/E106 8D FE 38 STA $38FE  [$7E:38FE] A:0000 X:0032 Y:0000 P:envMxdiZc - Store A in 7E38FE.
$03/E109 AD 26 27 LDA $2726  [$7E:2726] A:0000 X:0032 Y:0000 P:envMxdiZc - Load Target's Elemental Immunity.
$03/E10C 29 40 AND #$40 A:00C0 X:0032 Y:0000 P:eNvMxdizc - Is Absorb included?
$03/E10E F0 1F BEQ $1F    [$E12F] A:0040 X:0032 Y:0000 P:envMxdizc - If not, branch to 03E12F.
$03/E110 A9 84 LDA #$84 A:0040 X:0032 Y:0000 P:envMxdizc - Load 84 into A. (Double the power)
$03/E112 8D FE 38 STA $38FE  [$7E:38FE] A:0084 X:0032 Y:0000 P:eNvMxdizc - Store A in 7E38FE.
$03/E115 60 RTS A:0084 X:0032 Y:0000 P:eNvMxdizc - Return.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E116 AD 25 27 LDA $2725  [$7E:2725] A:0000 X:0032 Y:FFFF P:envMxdiZc - Load Target's Elemental Resistance
$03/E119 2D A2 28 AND $28A2  [$7E:28A2] A:0000 X:0032 Y:FFFF P:envMxdiZc - And the Spell's Elemental.
$03/E11C F0 11 BEQ $11    [$E12F] A:0000 X:0032 Y:FFFF P:envMxdiZc - Branch if the two do not match or are both 00 to 03E12F.
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E11E A9 01 LDA #$01 A:0008 X:0032 Y:0000 P:envMxdizc - Load 01 into A.
$03/E120 8D FE 38 STA $38FE  [$7E:38FE] A:0001 X:0032 Y:0000 P:envMxdizc - Store A in 7E38FE.
$03/E123 AD 25 27 LDA $2725  [$7E:2725] A:0001 X:0032 Y:0000 P:envMxdizc - Load Target's Elemental Resistance
$03/E126 29 40 AND #$40 A:0008 X:0032 Y:0000 P:envMxdizc - ?Is it 40 (Absorb)
$03/E128 F0 05 BEQ $05    [$E12F] A:0000 X:0032 Y:0000 P:envMxdiZc - If not branch to 03E12F.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E12A A9 82 LDA #$82 A:0040 X:0032 Y:0000 P:envMxdizc - Load an 82 into A.
$03/E12C 8D FE 38 STA $38FE  [$7E:38FE] A:0082 X:0032 Y:0000 P:eNvMxdizc - Store A in 7E38FE.
-------------------------------------------------------------------------------------------------------------------------------------------------
$03/E12F 60 RTS A:0000 X:0032 Y:FFFF P:envMxdiZc - Return
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/DA8F AD FE 38 LDA $38FE  [$7E:38FE] A:0000 X:0032 Y:FFFF P:envMxdiZc - Load A from 7E38FE.
$03/DA92 10 08 BPL $08    [$DA9C] A:0002 X:0032 Y:FFFF P:envMxdizc - Branch if positive to 03DA9C. (Which will not happen if the above Abosrb check was passed)
-----------------------------------------------------------------------------------------------------------------------------------
$03/DA94 29 7F AND #$7F A:0082 X:0032 Y:0000 P:eNvMxdizc - Add 7F to a negative, thereby making it a positive?
$03/DA96 8D FE 38 STA $38FE  [$7E:38FE] A:0002 X:0032 Y:0000 P:envMxdizc - Store A in 7E38FE.
$03/DA99 4C 1C D4 JMP $D41C  [$03:D41C] A:0002 X:0032 Y:0000 P:envMxdizc - Jump to Cure Subroutine
(It returns from here and leaves the Subroutine)
-------------------------------------------------------------------------------------------------------------------------------------
$03/DA9C 20 30 E1 JSR $E130  [$03:E130] A:0002 X:0032 Y:FFFF P:envMxdizc - Jump to Elemental Damage Subroutine.
$03/DA9F 20 AF C9 JSR $C9AF  [$03:C9AF] A:0000 X:0032 Y:FFFF P:envMxdiZC - Jump to Damage Determination.
$03/DAA2 AD 50 35 LDA $3550  [$7E:3550] A:0000 X:02A8 Y:00FF P:envMxdizc - Load A from 7E3550.
$03/DAA5 48 PHA A:0040 X:02A8 Y:00FF P:envMxdizc - Push Accumulator.
$03/DAA6 20 B6 D5 JSR $D5B6  [$03:D5B6] A:0040 X:02A8 Y:00FF P:envMxdizc - Jump to Immobilizing Status Routine.
$03/DAA9 68 PLA A:0040 X:0081 Y:0028 P:envMxdizc - Pull Accumulator
$03/DAAA 8D 50 35 STA $3550  [$7E:3550] A:0040 X:0081 Y:0028 P:envMxdizc - Store A in 7E3550
$03/DAAD 60 RTS A:0040 X:0081 Y:0028 P:envMxdizc - Return

Now here is something rather interesting! If the Mage Summon is set to Absorb Elemental as well as inflict a status and the enemy happens to Resist Absorb Elemental they will take the damage as a Cure and ignore the Status. Unless they are a Zombie then the damage would be taken as damage. There is a part in the code specifically referring to this behavior for the Absorb Elemental only. If it is just an ordinary Elemental Resistance it is carried out in the Elemental Damage Subroutine. I wonder if they planned for more to the Mage Summon than they ended up including since it is a formula that supports Elemental, Status, and Curing all at the same time.






« Last Edit: September 24, 2013, 11:27:37 AM by Grimoire LD »

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
« Reply #49 on: September 24, 2013, 12:06:21 PM »
Damage Based on Caster's HP (Bomb, Mist Dragon) Routine

Code: [Select]
03/D99D 20 FD E0 JSR $E0FD  [$03:E0FD] A:0003 X:0028 Y:0000 P:envMxdizc - Jump to "Is it Absorb?" Routine.
$03/D9A0 AD FE 38 LDA $38FE  [$7E:38FE] A:0000 X:0028 Y:0000 P:envMxdiZc - Load A from 7E38FE.
$03/D9A3 10 08 BPL $08    [$D9AD] A:0002 X:0028 Y:0000 P:envMxdizc - Is it Positive? (Was the Heal Bit added) - It not ranch to 03D9AD.
------------------------------------------------------------------------------------------------------------------------------------
$03/D9AD 20 30 E1 JSR $E130  [$03:E130] A:0002 X:0028 Y:0000 P:envMxdizc - Jump to Elemental Damage Subroutine.
$03/D9B2 8D FC 38 STA $38FC  [$7E:38FC] A:0001 X:0028 Y:0000 P:envMxdizC - Store A in 7E38FC.
$03/D9B5 AE 87 26 LDX $2687  [$7E:2687] A:0001 X:0028 Y:0000 P:envMxdizC - Load Caster's HP into X.
$03/D9B8 8E 45 39 STX $3945  [$7E:3945] A:0001 X:00C1 Y:0000 P:envMxdizC - Store X in 7E3945.
$03/D9BB AD 9D 28 LDA $289D  [$7E:289D] A:0001 X:00C1 Y:0000 P:envMxdizC - Load A from 289D (Presumably Spell Power)
$03/D9BE AA TAX A:0001 X:00C1 Y:0000 P:envMxdizC - Transfer A to X.
$03/D9BF 8E 47 39 STX $3947  [$7E:3947] A:0001 X:0001 Y:0000 P:envMxdizC - Store X in 7E3497.
$03/D9C2 20 07 84 JSR $8407  [$03:8407] A:0001 X:0001 Y:0000 P:envMxdizC - Jump to Subroutine (Appears to deal something with HP...?)
$03/D9C5 AE 49 39 LDX $3949  [$7E:3949] A:0000 X:0000 Y:0000 P:envMxdiZc - Load X from 7E3949.
$03/D9C8 8E 02 39 STX $3902  [$7E:3902] A:0000 X:00C1 Y:0000 P:envMxdizc - Store X in 7E3902.
$03/D9CB 7B TDC A:0000 X:00C1 Y:0000 P:envMxdizc - Transfer Direct Page.
$03/D9CC AA TAX A:0000 X:00C1 Y:0000 P:envMxdiZc - Transfer A to X.
$03/D9CD 8E 04 39 STX $3904  [$7E:3904] A:0000 X:0000 Y:0000 P:envMxdiZc - Store X in 7E3904..
$03/D9D0 20 AF C9 JSR $C9AF  [$03:C9AF] A:0000 X:0000 Y:0000 P:envMxdiZc - Jump to Damage Determination.
$03/D9D3 AD A3 28 LDA $28A3  [$7E:28A3] A:0000 X:00EC Y:0000 P:envMxdizc - Load A from Casted Spell's Status.
$03/D9D6 29 FE AND #$FE A:0000 X:00EC Y:0000 P:envMxdiZc - Is it ?everything? but Poison?
$03/D9D8 D0 07 BNE $07    [$D9E1] A:0000 X:00EC Y:0000 P:envMxdiZc - If it is so branch to 03D9E1.
$03/D9DA AD A4 28 LDA $28A4  [$7E:28A4] A:0000 X:00EC Y:0000 P:envMxdiZc - Load A from Casted Spell's Status 2.
$03/D9DD 29 CC AND #$CC A:0000 X:00EC Y:0000 P:envMxdiZc - Is it Curse, Float, Berserk or Charm?
$03/D9DF F0 03 BEQ $03    [$D9E4] A:0000 X:00EC Y:0000 P:envMxdiZc - If not, branch to 03D9E4.
----------------------------------------------------------------------------------------------------------------------
03/D9E1 4C 15 D5 JMP $D515  [$03:D515] A:0002 X:010E Y:0000 P:envMxdizc - Jump to Status Routine.
------------------------------------------------------------------------------------------------------------------------
$03/D9E4 AD A3 28 LDA $28A3  [$7E:28A3] A:0000 X:00EC Y:0000 P:envMxdiZc - Load A from Casted Spell's Status.
$03/D9E7 29 01 AND #$01 A:0000 X:00EC Y:0000 P:envMxdiZc - Is it Poison?
$03/D9E9 F0 03 BEQ $03    [$D9EE] A:0000 X:00EC Y:0000 P:envMxdiZc - If not branch to 03D9EE.
--------------------------------------------------------------------------------------------------------------------------
$03/D9EB 4C 41 DA JMP $DA41  [$03:DA41] A:0001 X:00C8 Y:0000 P:envMxdizc - Jump to (Presumably)Poison Routine.
---------------------------------------------------------------------------------------------------------------------------
$03/D9EE AD A4 28 LDA $28A4  [$7E:28A4] A:0000 X:00EC Y:0000 P:envMxdiZc - Load A from Casted Spell's Status 2.
$03/D9F1 29 30 AND #$30 A:0000 X:00EC Y:0000 P:envMxdiZc - Is it Sleep or Paralyze?
$03/D9F3 F0 03 BEQ $03    [$D9F8] A:0000 X:00EC Y:0000 P:envMxdiZc - If not branch to 03D9F8
-----------------------------------------------------------------------------------------------------------------------------
$03/D9F5 4C B6 D5 JMP $D5B6  [$03:D5B6] A:0020 X:0102 Y:0000 P:envMxdizc - Jump to Sleep/Paralyze Routine.
-------------------------------------------------------------------------------------------------------------------------------
$03/D9F8 60 RTS A:0000 X:00EC Y:0000 P:envMxdiZc - Return

This Routine seems to have a lot in common with the at the start with Damage, Immobilizing Status Routine with the start of it being a copy/paste job it appears, therefore the subroutines and branches covered there will only be marked here without further exploration.

Other than that it is an Extremely thorough formula. With required room for jumps to all of the Status' that can be inflicted without special code. The game never attaches a status to one of these spells and this is a Lot of room that is used by that. So if one wanted to make this into quite a special formula that chance is always before them since the Status portion (the largest chunk of it) is never used normally.

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
« Reply #50 on: September 24, 2013, 12:30:53 PM »
Damage, Poison (Venom, Poison) Routine.

Code: [Select]
$03/DA2B 20 FD E0 JSR $E0FD  [$03:E0FD] A:0003 X:002E Y:FFFF P:envMxdizc - Jump to "Is It Absorb?" Routine.
$03/DA2E AD FE 38 LDA $38FE  [$7E:38FE] A:0000 X:002E Y:FFFF P:envMxdiZc - Load A from 7E38FE
$03/DA31 10 08 BPL $08    [$DA3B] A:0002 X:002E Y:FFFF P:envMxdizc - Branch if Cure Tag is not Set to 03DA3B.
-----------------------------------------------------------------------------------------------------------------
$03/DA3B 20 30 E1 JSR $E130  [$03:E130] A:0002 X:002E Y:FFFF P:envMxdizc - Jump to Elemental Damage Routine.
$03/DA3E 20 AF C9 JSR $C9AF  [$03:C9AF] A:0000 X:002E Y:FFFF P:envMxdiZC - Jump to Damage Determination.
$03/DA41 AD 03 27 LDA $2703  [$7E:2703] A:0000 X:0000 Y:00FF P:envMxdizc - Load Target's Status Byte 1.
$03/DA44 09 01 ORA #$01 A:0000 X:0000 Y:00FF P:envMxdiZc - Add 01 (Poison) to A.
$03/DA46 8D 03 27 STA $2703  [$7E:2703] A:0001 X:0000 Y:00FF P:envMxdizc - Store A in Target's Status Byte 1.
$03/DA49 A9 06 LDA #$06 A:0001 X:0000 Y:00FF P:envMxdizc - Load 06 into A.
$03/DA4B 85 D6 STA $D6    [$00:00D6] A:0006 X:0000 Y:00FF P:envMxdizc - Store A in D6.
$03/DA4D A5 CF LDA $CF    [$00:00CF] A:0006 X:0000 Y:00FF P:envMxdizc - Load A from CF.
$03/DA4F 20 36 9E JSR $9E36  [$03:9E36] A:0005 X:0000 Y:00FF P:envMxdizc - Jump to Subroutine (??)
$03/DA52 A9 09 LDA #$09 A:0000 X:0021 Y:0021 P:envMxdizc - Load 09 into A.
$03/DA54 20 C8 85 JSR $85C8  [$03:85C8] A:0009 X:0021 Y:0021 P:envMxdizc - Jump to Subroutine (May possibly deal something with a Timer)
$03/DA57 A9 40 LDA #$40 A:0000 X:0072 Y:0021 P:envMxdiZc - Load 40 into A.
$03/DA59 9D 06 2A STA $2A06,x[$7E:2A78] A:0040 X:0072 Y:0021 P:envMxdizc - Store A in 7E2A78.
$03/DA5C A5 CF LDA $CF    [$00:00CF] A:0040 X:0072 Y:0021 P:envMxdizc - Load A from CF.
$03/DA5E 0A ASL A A:0005 X:0072 Y:0021 P:envMxdizc - Multiply A by 2.
$03/DA5F AA TAX A:000A X:0072 Y:0021 P:envMxdizc - Transfer A to X.
$03/DA60 BD EB 29 LDA $29EB,x[$7E:29F5] A:000A X:000A Y:0021 P:envMxdizc - Load A from 7E29F5.
$03/DA63 09 10 ORA #$10 A:0040 X:000A Y:0021 P:envMxdizc - Add 10 to A.
$03/DA65 9D EB 29 STA $29EB,x[$7E:29F5] A:0050 X:000A Y:0021 P:envMxdizc - Store A 7E29F5.
$03/DA68 A5 D4 LDA $D4    [$00:00D4] A:0050 X:000A Y:0021 P:envMxdizc - Load A from D4.
$03/DA6A 9D 2A 2B STA $2B2A,x[$7E:2B34] A:0021 X:000A Y:0021 P:envMxdizc - Store A in 7E2B34.
$03/DA6D A5 D5 LDA $D5    [$00:00D5] A:0021 X:000A Y:0021 P:envMxdizc - Load A from D5.
$03/DA6F 9D 2B 2B STA $2B2B,x[$7E:2B35] A:0000 X:000A Y:0021 P:envMxdiZc - Store A in 7E2B35
$03/DA72 60 RTS A:0000 X:000A Y:0021 P:envMxdiZc - Return



A bit of deja vu... well I guess all of those formula's follow a similar progression so it makes sense that they might somewhat repeat themselves. The definitions of the repeated Jumps are explained in the Mage Subroutine above. No surprises here. While you can change the inflicted status the Timers will likely become askewed because of the absence of Poison.

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
« Reply #51 on: September 24, 2013, 01:59:25 PM »
Here we go...

Sylph Routine

Code: [Select]
$03/DAAE 20 FD E0 JSR $E0FD  [$03:E0FD] A:0003 X:0034 Y:0000 P:envMxdizc - Jump to "Is it Absorb?" Routine.
$03/DAB1 AD FE 38 LDA $38FE  [$7E:38FE] A:0000 X:0034 Y:0000 P:envMxdiZc - Load A from 7E38FE.
$03/DAB4 10 08 BPL $08    [$DABE] A:0002 X:0034 Y:0000 P:envMxdizc - If it does not have the Cure Tag branch to 03DABE.
-----------------------------------------------------------------------------------------------------------------------------------
$03/DABE 20 30 E1 JSR $E130  [$03:E130] A:0002 X:0034 Y:0000 P:envMxdizc - Jump to Elemental Damage Routine.
$03/DAC1 20 AF C9 JSR $C9AF  [$03:C9AF] A:0000 X:0034 Y:0000 P:envMxdiZC - Jump to Damage Determination
$03/DAC4 AD 06 39 LDA $3906  [$7E:3906] A:0000 X:026C Y:0000 P:envMxdizc - Load A from 7E3906
$03/DAC7 CD 4D 35 CMP $354D  [$7E:354D] A:0001 X:026C Y:0000 P:envMxdizc - Compare it to the value in 7E354D.
$03/DACA F0 01 BEQ $01    [$DACD] A:0001 X:026C Y:0000 P:envMxdiZC - If not equal branch to 03DACD.
----------------------------------------------------------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------------------------------------------------------
$03/DACD EE 53 35 INC $3553  [$7E:3553] A:0001 X:026C Y:0000 P:envMxdiZC - Increment 7E3553.
$03/DAD0 A6 A4 LDX $A4    [$00:00A4] A:0001 X:026C Y:0000 P:envMxdizC - Load X from A4.
$03/DAD2 DA PHX A:0001 X:026C Y:0000 P:envMxdizC - Push X.
$03/DAD3 7B TDC A:0001 X:026C Y:0000 P:envMxdizC - Transfer Direct Page.
$03/DAD4 AA TAX A:0000 X:026C Y:0000 P:envMxdiZC - Tranfer A to X.
$03/DAD5 86 A9 STX $A9    [$00:00A9] A:0000 X:0000 Y:0000 P:envMxdiZC - Store X in A9.
$03/DAD7 86 AB STX $AB    [$00:00AB] A:0000 X:0000 Y:0000 P:envMxdiZC - Store X in AB.
$03/DAD9 8E 1C 29 STX $291C  [$7E:291C] A:0000 X:0000 Y:0000 P:envMxdiZC - Store X in 7E291C.
$03/DADC 8E 1E 29 STX $291E  [$7E:291E] A:0000 X:0000 Y:0000 P:envMxdiZC - Store X in 7E291E.
$03/DADF 8E 20 29 STX $2920  [$7E:2920] A:0000 X:0000 Y:0000 P:envMxdiZC - Store X in 7E2920.
$03/DAE2 A6 A9 LDX $A9    [$00:00A9] A:0000 X:0000 Y:0000 P:envMxdiZC - Load X from A9.
$03/DAE4 BD 40 35 LDA $3540,x[$7E:3540] A:0000 X:0000 Y:0000 P:envMxdiZC - Load A from 7E3540.
$03/DAE7 D0 27 BNE $27    [$DB10] A:0000 X:0000 Y:0000 P:envMxdiZC - If the values are not 00 branch to 03DB10.
$03/DAE9 A5 A9 LDA $A9    [$00:00A9] A:0000 X:0000 Y:0000 P:envMxdiZC - Load A from A9.
$03/DAEB 85 DF STA $DF    [$00:00DF] A:0000 X:0000 Y:0000 P:envMxdiZC - Store A in DF.
$03/DAED A9 80 LDA #$80 A:0000 X:0000 Y:0000 P:envMxdiZC - Load 80 into A.
$03/DAEF 85 E1 STA $E1    [$00:00E1] A:0080 X:0000 Y:0000 P:eNvMxdizC - Store A in E1.
$03/DAF1 20 E0 83 JSR $83E0  [$03:83E0] A:0080 X:0000 Y:0000 P:eNvMxdizC - Jump  to Subroutine (??)
$03/DAF4 A6 E3 LDX $E3    [$00:00E3] A:0000 X:0000 Y:0000 P:envMxdiZc - Load X from E3.
$03/DAF6 BD 03 20 LDA $2003,x[$7E:2003] A:0000 X:0000 Y:0000 P:envMxdiZc - Load A from Slot 1's Status Byte 1.
$03/DAF9 29 C0 AND #$C0 A:0000 X:0000 Y:0000 P:envMxdiZc - Are they inflicted with Petrify or KO?
$03/DAFB D0 13 BNE $13    [$DB10] A:0000 X:0000 Y:0000 P:envMxdiZc - If so branch to 7EDB10.
$03/DAFD BD 05 20 LDA $2005,x[$7E:2005] A:0000 X:0000 Y:0000 P:envMxdiZc - Load A from Slot 1's Status Byte 3.
$03/DB00 29 02 AND #$02 A:0000 X:0000 Y:0000 P:envMxdiZc - Are they Jumping?
$03/DB02 D0 0C BNE $0C    [$DB10] A:0000 X:0000 Y:0000 P:envMxdiZc - If so branch to 7EDB10.
$03/DB04 BD 06 20 LDA $2006,x[$7E:2006] A:0000 X:0000 Y:0000 P:envMxdiZc - Load A from Slot 1's Status Byte 4.
$03/DB07 30 07 BMI $07    [$DB10] A:0000 X:0000 Y:0000 P:envMxdiZc - Are they Hiding? If so, branch to 7EDB10.
$03/DB09 E6 AB INC $AB    [$00:00AB] A:0000 X:0000 Y:0000 P:envMxdiZc - +1 to AB.
$03/DB0B A6 A9 LDX $A9    [$00:00A9] A:0000 X:0000 Y:0000 P:envMxdizc - Load X from A9.
$03/DB0D FE 1C 29 INC $291C,x[$7E:291C] A:0000 X:0000 Y:0000 P:envMxdiZc - +1 to 7E291C.
$03/DB10 E6 A9 INC $A9    [$00:00A9] A:0000 X:0000 Y:0000 P:envMxdizc - +1 to A9.
$03/DB12 A5 A9 LDA $A9    [$00:00A9] A:0000 X:0000 Y:0000 P:envMxdizc - Load A from A9.
$03/DB14 C9 05 CMP #$05 A:0001 X:0000 Y:0000 P:envMxdizc - Compare the value to 05.
$03/DB16 D0 CA BNE $CA    [$DAE2] A:0001 X:0000 Y:0000 P:eNvMxdiz - If not 05, loop until so. (For the five party members)
$03/DB18 A6 A4 LDX $A4    [$00:00A4] A:0005 X:0004 Y:0000 P:envMxdiZC - Load X from A4.
$03/DB1A 8E 45 39 STX $3945  [$7E:3945] A:0005 X:026C Y:0000 P:envMxdizC - Store X in 7E3945.
$03/DB1D A6 AB LDX $AB    [$00:00AB] A:0005 X:026C Y:0000 P:envMxdizC - Load X into AB.
$03/DB1F 8E 47 39 STX $3947  [$7E:3947] A:0005 X:0005 Y:0000 P:envMxdizC - Store X in 7E3947.
$03/DB22 20 07 84 JSR $8407  [$03:8407] A:0005 X:0005 Y:0000 P:envMxdizC - Jump to Subroutine (May deal something with HP)
$03/DB25 AE 49 39 LDX $3949  [$7E:3949] A:0000 X:0000 Y:0000 P:envMxdiZc - Load X from 7E3949.
$03/DB28 86 A4 STX $A4    [$00:00A4] A:0000 X:007C Y:0000 P:envMxdizc - Store X in A4.
$03/DB2A 7B TDC A:0000 X:007C Y:0000 P:envMxdizc - Transfer Direct Page.
$03/DB2B AA TAX A:0000 X:007C Y:0000 P:envMxdiZc - Transfer A to X.
$03/DB2C 86 A9 STX $A9    [$00:00A9] A:0000 X:0000 Y:0000 P:envMxdiZc - Store X in A9.
$03/DB2E A6 A9 LDX $A9    [$00:00A9] A:0000 X:0000 Y:0000 P:envMxdiZc - Load X from A9.
$03/DB30 BD 1C 29 LDA $291C,x[$7E:291C] A:0000 X:0000 Y:0000 P:envMxdiZc - Load A from 7E291C.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ (Looping Point)
$03/DB33 F0 1E BEQ $1E    [$DB53] A:0001 X:0000 Y:0000 P:envMxdizc - If the value is 00 branch to 03DB53.
$03/DB35 A5 A9 LDA $A9    [$00:00A9] A:0001 X:0000 Y:0000 P:envMxdizc - Load A from A9
$03/DB37 85 DF STA $DF    [$00:00DF] A:0000 X:0000 Y:0000 P:envMxdiZc - Store A in DF.
$03/DB39 A9 80 LDA #$80 A:0000 X:0000 Y:0000 P:envMxdiZc - Load 80 into A.
$03/DB3B 85 E1 STA $E1    [$00:00E1] A:0080 X:0000 Y:0000 P:eNvMxdizc - Store A in E1.
$03/DB3D 20 E0 83 JSR $83E0  [$03:83E0] A:0080 X:0000 Y:0000 P:eNvMxdizc - Jump to Subroutine (??)
$03/DB40 20 7B E0 JSR $E07B  [$03:E07B] A:0000 X:0000 Y:0000 P:envMxdiZc - Jump to Subroutine
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/E07B BD 00 20 LDA $2000,x[$7E:2000] A:0000 X:0000 Y:0000 P:envMxdiZc  - Load Slot 1's ID.
$03/E07E 29 1F AND #$1F A:0081 X:0000 Y:0000 P:eNvMxdizc - Remove 80 from it?
$03/E080 C9 11 CMP #$11 A:0001 X:0000 Y:0000 P:envMxdizc - Is it (Adult Rydia) 11?
$03/E082 D0 0C BNE $0C    [$E090] A:0001 X:0000 Y:0000 P:eNvMxdizc - If not branch to 03E090.
--------------------------------------------------------------------------------------------------------------------------------------
$03/E084 AD 8B 26 LDA $268B  [$7E:268B] A:0011 X:0000 Y:0000 P:envMxdiZC - Load A from Caster's Current MP.
$03/E087 9D 0B 20 STA $200B,x[$7E:200B] A:00BF X:0000 Y:0000 P:eNvMxdizC - Store A in Slot 1's Current MP.
$03/E08A AD 8C 26 LDA $268C  [$7E:268C] A:00BF X:0000 Y:0000 P:eNvMxdizC - Load A from Caster's Current MP Byte 2.
$03/E08D 9D 0C 20 STA $200C,x[$7E:200C] A:0003 X:0000 Y:0000 P:envMxdizC - Store A in Slot1's Current MP Byte 2.
----------------------------------------------------------------------------------------------------------------------------------------
$03/E090 60 RTS A:0001 X:0000 Y:0000 P:eNvMxdizc Return.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/DB43 A5 A9 LDA $A9    [$00:00A9] A:0001 X:0000 Y:0000 P:eNvMxdizc - Load A fromA9.
$03/DB45 0A ASL A A:0000 X:0000 Y:0000 P:envMxdiZc - Multiply A by 2.
$03/DB46 AA TAX A:0000 X:0000 Y:0000 P:envMxdiZc - Transfer A to X.
$03/DB47 A5 A4 LDA $A4    [$00:00A4] A:0000 X:0000 Y:0000 P:envMxdiZc - Load A from A4.
$03/DB49 9D D4 34 STA $34D4,x[$7E:34D4] A:007C X:0000 Y:0000 P:envMxdizc - Store A in 7E34D4.
$03/DB4C A5 A5 LDA $A5    [$00:00A5] A:007C X:0000 Y:0000 P:envMxdizc - Load A in A5.
$03/DB4E 09 80 ORA #$80 A:0000 X:0000 Y:0000 P:envMxdiZc - Add 80 to A.
$03/DB50 9D D5 34 STA $34D5,x[$7E:34D5] A:0080 X:0000 Y:0000 P:eNvMxdizc - Store A in 7E34D5.
$03/DB53 E6 A9 INC $A9    [$00:00A9] A:0080 X:0000 Y:0000 P:eNvMxdizc - +1 to A9.
$03/DB55 A5 A9 LDA $A9    [$00:00A9] A:0080 X:0000 Y:0000 P:envMxdizc - Load A from A9.
$03/DB57 C9 05 CMP #$05 A:0001 X:0000 Y:0000 P:envMxdizc - Has it looped 5 times?
$03/DB59 D0 D3 BNE $D3    [$DB2E] A:0001 X:0000 Y:0000 P:eNvMxdizc - If not Loop back from 03DB2E.
$03/DB5B FA PLX A:0005 X:0008 Y:0000 P:envMxdiZC - Push X.
$03/DB5C 86 A4 STX $A4    [$00:00A4] A:0005 X:026C Y:0000 P:envMxdizC - Store Xin A4.
$03/DB5E 60 RTS A:0005 X:026C Y:0000 P:envMxdizC - Return

Where do I even begin...? This is an interesting and unique formula, but it is glitched and the glitch is clear to see if you look at the formula...

Do you see that Adult Rydia check up there? The game never, Ever compensates for slots. It will Only look at Slot 1 and Only if that slot is Adult Rydia will it decrease the proper amount of MP. It is a pretty large oversight and explains why the spell costs no MP. That is unless you have Rydia in Slot 1. Then it will take its proper amount of MP away. This might be able to be fixed by adding a continuous 80 to X as the loops continue.. to have it properly check all five slots. This is such a strange formula, 1 it references Rydia directly which I have seen no other spell formula reference any character directly. 2 it fails in its attempt because it is not very likely that Rydia will be in Slot 1.


Also the SNES version has a catch for Hide as seen above (tested it, it works properly) where as the GBA version does not as DeathLike2 has pointed out before.










Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
« Reply #52 on: September 24, 2013, 10:54:55 PM »
Odin Routine

Code: [Select]

$03/DB5F A9 01 LDA #$01 A:0003 X:0036 Y:FFFF P:envMxdizc - Load 01 into A.
$03/DB61 8D 4D 35 STA $354D  [$7E:354D] A:0001 X:0036 Y:FFFF P:envMxdizc - Store A in 7E354D.
$03/DB64 20 8B 85 JSR $858B  [$03:858B] A:0001 X:0036 Y:FFFF P:envMxdizc - Jump to Subroutine (May be used in Random Number Generation.)
$03/DB67 C9 32 CMP #$32 A:0040 X:0000 Y:00FF P:eNvMxdizc - Is it 32 or below? (50)
$03/DB69 90 16 BCC $16    [$DB81] A:0040 X:0000 Y:00FF P:envMxdizC - If so branch to 03DB69.
$03/DB6B 7B TDC A:0040 X:0000 Y:00FF P:envMxdizC - Transfer Direct Page
$03/DB6C 8D 50 35 STA $3550  [$7E:3550] A:0000 X:0000 Y:00FF P:envMxdiZC - Store A in 7E3550.
$03/DB6F AA TAX A:0000 X:0000 Y:00FF P:envMxdiZC - Transfer A to X.
$03/DB70 86 A9 STX $A9    [$00:00A9] A:0000 X:0000 Y:00FF P:envMxdiZC - Store X in A9.
--------------------------------(Looping Point)
$03/DB72 20 7B E0 JSR $E07B  [$03:E07B] A:0000 X:0000 Y:00FF P:envMxdiZC - Jump to Subroutine (Unique Rydia one from above? Why?)
$03/DB75 20 BC 85 JSR $85BC  [$03:85BC] A:0001 X:0000 Y:00FF P:eNvMxdizc - Jump to Subroutine.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/85BC C2 20 REP #$20 A:0001 X:0000 Y:00FF P:eNvMxdizc - Reset Processor Status (20?)
$03/85BE 8A TXA A:0001 X:0000 Y:00FF P:eNvmxdizc - Transfer X to A.
$03/85BF 18 CLC A:0000 X:0000 Y:00FF P:envmxdiZc - Clear Carry Flag.
$03/85C0 69 80 00 ADC #$0080 A:0000 X:0000 Y:00FF P:envmxdiZc - Add 80 to A.
$03/85C3 AA TAX A:0080 X:0000 Y:00FF P:envmxdizc - Transfer A to X.
$03/85C4 7B TDC A:0080 X:0080 Y:00FF P:envmxdizc - Transfer Direct Page.
$03/85C5 E2 20 SEP #$20 A:0000 X:0080 Y:00FF P:envmxdiZc - Set Processor Status (20?)
$03/85C7 60 RTS A:0000 X:0080 Y:00FF P:envMxdiZc - Return
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/DB78 E6 A9 INC $A9    [$00:00A9] A:0000 X:0080 Y:00FF P:envMxdiZc - +1 to A9.
$03/DB7A A5 A9 LDA $A9    [$00:00A9] A:0000 X:0080 Y:00FF P:envMxdizc - Load A9.
$03/DB7C C9 05 CMP #$05 A:0001 X:0080 Y:00FF P:envMxdizc - Has it gone through five times?
$03/DB7E D0 F2 BNE $F2    [$DB72] A:0001 X:0080 Y:00FF P:eNvMxdizc - If not loop back to 03DB72
$03/DB80 60 RTS A:0005 X:0280 Y:00FF P:envMxdiZC - Return (Failed path?)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/DB81 AD 03 27 LDA $2703  [$7E:2703] A:001F X:0000 Y:00FF P:eNvMxdizc - Load Target's Status Byte 1.
$03/DB84 09 80 ORA #$80 A:0000 X:0000 Y:00FF P:envMxdiZc - Add 80 (Death) to A.
$03/DB86 8D 03 27 STA $2703  [$7E:2703] A:0080 X:0000 Y:00FF P:eNvMxdizc - Store A in Target's Status Byte 1.
$03/DB89 64 AB STZ $AB    [$00:00AB] A:0080 X:0000 Y:00FF P:eNvMxdizc - Store Zero in AB
$03/DB8B AD 4F 35 LDA $354F  [$7E:354F] A:0080 X:0000 Y:00FF P:eNvMxdizc - Load 7E354F into A.
$03/DB8E 85 A9 STA $A9    [$00:00A9] A:0070 X:0000 Y:00FF P:envMxdizc - Store A in A9.
$03/DB90 06 A9 ASL $A9    [$00:00A9] A:0070 X:0000 Y:00FF P:envMxdizc - Multiply A9.
$03/DB92 90 18 BCC $18    [$DBAC] A:0070 X:0000 Y:00FF P:eNvMxdizc - Branch if Flag is Carried.
--------------------------------------------------------------------------------------------------------------------------------------------
$03/DB94 18 CLC A:0001 X:0000 Y:00FF P:eNvMxdizC - Clear Carry Flag.
$03/DB95 A5 AB LDA $AB    [$00:00AB] A:0001 X:0000 Y:00FF P:eNvMxdizc - Load AB into A.
$03/DB97 69 05 ADC #$05 A:0001 X:0000 Y:00FF P:envMxdizc - Add 5.
$03/DB99 85 DF STA $DF    [$00:00DF] A:0006 X:0000 Y:00FF P:envMxdizc - Store A in DF.
$03/DB9B A9 80 LDA #$80 A:0006 X:0000 Y:00FF P:envMxdizc - Load 80 into A.
$03/DB9D 85 E1 STA $E1    [$00:00E1] A:0080 X:0000 Y:00FF P:eNvMxdizc - Store A in E1.
$03/DB9F 20 E0 83 JSR $83E0  [$03:83E0] A:0080 X:0000 Y:00FF P:eNvMxdizc - Jump to Subroutine (??)
$03/DBA2 A6 E3 LDX $E3    [$00:00E3] A:0000 X:0000 Y:00FF P:envMxdiZc - Load X from E3.
$03/DBA4 BD 03 20 LDA $2003,x[$7E:2303] A:0000 X:0300 Y:00FF P:envMxdizc - Load Monster Slot X's Status Byte 1.
$03/DBA7 09 80 ORA #$80 A:0000 X:0300 Y:00FF P:envMxdiZc - Add 80 (Death) to A.
$03/DBA9 9D 03 20 STA $2003,x[$7E:2303] A:0080 X:0300 Y:00FF P:eNvMxdizc - Store A in Monster Slot X's Status Byte 1.
--------------------------------------------------------------------------------------------------------------------------------------------
$03/DBAC E6 AB INC $AB    [$00:00AB] A:0070 X:0000 Y:00FF P:eNvMxdizc - +1 to AB.
$03/DBAE A5 AB LDA $AB    [$00:00AB] A:0070 X:0000 Y:00FF P:envMxdizc -  Load AB into A.
$03/DBB0 C9 08 CMP #$08 A:0001 X:0000 Y:00FF P:envMxdizc - Has it cycled through 8 times
$03/DBB2 D0 DC BNE $DC    [$DB90] A:0001 X:0000 Y:00FF P:eNvMxdizc - If not, go back to 03DB90.
$03/DBB4 60 RTS A:0008 X:0400 Y:00FF P:envMxdiZC - Return.

Now it makes sense! The reason why Sylph is broken and Odin is not, is because the loop has the 80 attached and it loops immediately to that subroutine, therefore counting all five slots.. As far as I can tell the Sylph formula may have a lot unnecessary fluff that the Odin formula bypasses through a jump rather than having the formula attempt to add 80 itself and fail in the long run. Even so the game doesn't necessarily take Odin's formula into consideration as using Odin as another character will reduce the MP of that character and not just Rydia if Sylph is used. However there is a strange measure that goes along with this where if another character uses Odin, their MP will become Rydia's current MP. But this is only done if Odin fails. If it succeeds nothing special happens with MP.

The Level Checking portion of the spell seems to be located elsewhere. But if the Level Check does not succeed than the game does not even try to load the rest of the routine. Even if you do succeed you have a 50/50 chance of succeeding in using it. That seems a bit low so for balancing purposes it may be best to increase the player's chances a bit to maybe 60-65% chance of success.




chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
« Reply #53 on: September 24, 2013, 11:18:43 PM »
Yeah, I always thought of Odin as more of a trophy than a usable spell because of the high failure rate, but I don't think I ever realized it was that high.

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
« Reply #54 on: September 24, 2013, 11:27:02 PM »
Count Routine

Code: [Select]
$03/DBB5 AD 05 27 LDA $2705  [$7E:2705] A:0003 X:003A Y:0000 P:envMxdizc - Load Target's Status Byte 3 into A.
$03/DBB8 09 01 ORA #$01 A:0000 X:003A Y:0000 P:envMxdiZc - Add 1 (Count) into A.
$03/DBBA 8D 05 27 STA $2705  [$7E:2705] A:0001 X:003A Y:0000 P:envMxdizc - Store Count in Target's Status Byte 3.
$03/DBBD A5 CF LDA $CF    [$00:00CF] A:0001 X:003A Y:0000 P:envMxdizc - Load A into CF.
$03/DBBF 20 89 84 JSR $8489  [$03:8489] A:0005 X:003A Y:0000 P:envMxdizc -  Jump to Subroutine (Timing Routine?)
$03/DBC2 A9 12 LDA #$12 A:0000 X:05A0 Y:0000 P:envMxdizc - Load 12 into A.
$03/DBC4 20 69 85 JSR $8569  [$03:8569] A:0012 X:05A0 Y:0000 P:envMxdizc - Jump to Subroutine (??)
$03/DBC7 AE 98 35 LDX $3598  [$7E:3598] A:0000 X:05A0 Y:0000 P:envMxdiZc - Load 7E3598 into X.
$03/DBCA AD 9D 28 LDA $289D  [$7E:289D] A:0000 X:007B Y:0000 P:envMxdizc - Load Spell Power into A.
$03/DBCD 9D 04 2A STA $2A04,x[$7E:2A7F] A:0001 X:007B Y:0000 P:envMxdizc - Store A into Slot's Status.
$03/DBD0 9E 05 2A STZ $2A05,x[$7E:2A80] A:0001 X:007B Y:0000 P:envMxdizc - Store Zero into 7E2A80.
$03/DBD3 A9 40 LDA #$40 A:0001 X:007B Y:0000 P:envMxdizc - Load 40 into A.
$03/DBD5 9D 06 2A STA $2A06,x[$7E:2A81] A:0040 X:007B Y:0000 P:envMxdizc - Store A in 7E2A81
$03/DBD8 A5 CF LDA $CF    [$00:00CF] A:0040 X:007B Y:0000 P:envMxdizc - Load CF into A.
$03/DBDA 0A ASL A A:0005 X:007B Y:0000 P:envMxdizc - Multiply A by 2.
$03/DBDB AA TAX A:000A X:007B Y:0000 P:envMxdizc - Transfer A to X.
$03/DBDC BD EB 29 LDA $29EB,x[$7E:29F5] A:000A X:000A Y:0000 P:envMxdizc - Load A from 7E29F5.
$03/DBDF 09 02 ORA #$02 A:0040 X:000A Y:0000 P:envMxdizc - Add 02 into A.
$03/DBE1 9D EB 29 STA $29EB,x[$7E:29F5] A:0042 X:000A Y:0000 P:envMxdizc - Store A in 7E29F5.
$03/DBE4 60 RTS A:0042 X:000A Y:0000 P:envMxdizc - Return.

Not a very long or complicated code, but this doesn't answer the reasons why the game has trouble killing more than two monsters with Count. Not much help there, I'm afraid.

@Chillfeez - That spell is in desperate need of some help. Unfortunately I can't begin to fathom where this level check is. It may deal something special with simply choosing the spell rather than anything leading up to its casting.


 :edit: 12/26/14 - Well, looks like the answer to Count's Timer was in front of me the whole time. It's just the Spell Power of the given Spell, hence Count's Timer is 0A.
« Last Edit: December 26, 2014, 12:20:31 PM by Grimoire LD »

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
« Reply #55 on: September 25, 2013, 12:07:27 AM »
Damage Based on Target's Max HP (Beam, Maser) Routine.

Code: [Select]
$03/DBE5 AD 9D 28 LDA $289D  [$7E:289D] A:0003 X:003C Y:0000 P:envMxdizc - Load A from 7E289D
$03/DBE8 85 A9 STA $A9    [$00:00A9] A:0001 X:003C Y:0000 P:envMxdizc - Store A in A9.
$03/DBEA 20 FD E0 JSR $E0FD  [$03:E0FD] A:0001 X:003C Y:0000 P:envMxdizc - Jump to "Is it Absorb?" Routine.
$03/DBED AD FE 38 LDA $38FE  [$7E:38FE] A:0000 X:003C Y:0000 P:envMxdiZc - Load 7E38FE
$03/DBF0 10 08 BPL $08    [$DBFA] A:0002 X:003C Y:0000 P:envMxdizc - Branch if Positive. (Cure Tag)
------------------------------------------------------------------------------------------------------------- (If Cure Tag is active)
$03/DBFA 20 30 E1 JSR $E130  [$03:E130] A:0002 X:003C Y:0000 P:envMxdizc - Jump to Elemental Damage Routine.
$03/DBFD AD FE 38 LDA $38FE  [$7E:38FE] A:0004 X:003C Y:0000 P:envMxdizC - Load Elemental Damage.
$03/DC00 C9 02 CMP #$02 A:0004 X:003C Y:0000 P:envMxdizC - Is it 02 or more?
$03/DC02 B0 06 BCS $06    [$DC0A] A:0004 X:003C Y:0000 P:envMxdizC - If so branch to 03DC0A.
---------------------------------------------------------------------------------------------------------------------------------------------
$03/DC04 A9 0A LDA #$0A A:0001 X:003C Y:0000 P:eNvMxdizc - Load 0A into A
$03/DC06 85 A9 STA $A9    [$00:00A9] A:000A X:003C Y:0000 P:envMxdizc - Store A in A9. (What this effectively does is, regardless of the actual strength, if the Target resists the element of the attack, it will deal 10% of their HP damage. How interesting)
$03/DC08 80 06 BRA $06    [$DC10] A:000A X:003C Y:0000 P:envMxdizc - Branch always to 03DC10.
---------------------------------------------------------------------------------------------------------------------------------------------
$03/DC0A C9 04 CMP #$04 A:0004 X:003C Y:0000 P:envMxdizC - Is it Weakness?
$03/DC0C 90 02 BCC $02    [$DC10] A:0004 X:003C Y:0000 P:envMxdiZC - If not branch to 03DC10.
-------------------------------------------------------------------------
$03/DC0E 46 A9 LSR $A9    [$00:00A9] A:0004 X:003C Y:0000 P:envMxdiZC - Divide the value in A9 by 2. (Power)
--------------------------------------------------------------------------
$03/DC10 A5 A9 LDA $A9    [$00:00A9] A:0004 X:003C Y:0000 P:envMxdiZC - Load A9 into A.
$03/DC12 AA TAX A:0000 X:003C Y:0000 P:envMxdiZC - Transfer A to X.
$03/DC13 8E 47 39 STX $3947  [$7E:3947] A:0000 X:0000 Y:0000 P:envMxdiZC - Store X in 7E3947.
$03/DC16 AD 09 27 LDA $2709  [$7E:2709] A:0000 X:0000 Y:0000 P:envMxdiZC - Load Target's Max HP Byte 1 into A.
$03/DC19 8D 45 39 STA $3945  [$7E:3945] A:00F4 X:0000 Y:0000 P:eNvMxdizC - Store A in 7E3945.
$03/DC1C AD 0A 27 LDA $270A  [$7E:270A] A:00F4 X:0000 Y:0000 P:eNvMxdizC - Load Target's Max HP Byte 2 into A.
$03/DC1F 8D 46 39 STA $3946  [$7E:3946] A:0001 X:0000 Y:0000 P:envMxdizC - Store A in 7E3946.
$03/DC22 20 07 84 JSR $8407  [$03:8407] A:0001 X:0000 Y:0000 P:envMxdizC - Jump to Subroutine. (Appears to deal something with HP.)
$03/DC25 AE 49 39 LDX $3949  [$7E:3949] A:0000 X:0000 Y:0000 P:envMxdiZC - Load 7E3949 into X.
$03/DC28 86 A4 STX $A4    [$00:00A4] A:0000 X:0000 Y:0000 P:envMxdiZC - Store X in A4.
$03/DC2A 60 RTS A:0000 X:0000 Y:0000 P:envMxdiZC - Return

Now this is quite interesting. The player has no access to these so its a moot point really. but if the Target is Weak to whatever Element this could happen to be what it is dividing is the Power. Because I was testing it at 1 originally it turned to 0 making it deal no damage to those weak to it. Heh, that would be a bit of a trap to set the player up for. However if you set it to say... 10, you would ordinarily deal 10% of their HP to the Target. But if the enemy is weak to that element you would be doing 20% of their HP to the target because it is a straight divide. On the flipside if the Target resists the element it will always deal 10% of their maximum HP, regardless of the Spell Power of the Attack. (I forgot how easy it would be to make a Demi spell...)


Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
« Reply #56 on: September 25, 2013, 12:46:34 AM »
Calcify (Petrify) Routine -

Code: [Select]
$03/DC2B 20 FD E0 JSR $E0FD  [$03:E0FD] A:0003 X:003E Y:0000 P:envMxdizc - Jump to "Is it Absorb?" Routine.
$03/DC2E AD FE 38 LDA $38FE  [$7E:38FE] A:0000 X:003E Y:0000 P:envMxdiZc - Load 7E38FE into A.
$03/DC31 10 08 BPL $08    [$DC3B] A:0001 X:003E Y:0000 P:envMxdizc - Is it Positive (Cure Tag?)
------------------------------------------------------------------------------------
03/DC33 29 7F AND #$7F A:0084 X:003E Y:0000 P:eNvMxdizc
$03/DC35 8D FE 38 STA $38FE  [$7E:38FE] A:0004 X:003E Y:0000 P:envMxdizc
$03/DC38 4C 1C D4 JMP $D41C  [$03:D41C] A:0004 X:003E Y:0000 P:envMxdizc
------------------------------------------------------------------------------------
$03/DC3B AD 2C 27 LDA $272C  [$7E:272C] A:0001 X:003E Y:0000 P:envMxdizc - Load Target's Status Immunity 2 into A.
$03/DC3E 2D A4 28 AND $28A4  [$7E:28A4] A:0010 X:003E Y:0000 P:envMxdizc -  Check Spell's Status Infliction Byte 2.
$03/DC41 F0 03 BEQ $03    [$DC46] A:0000 X:003E Y:0000 P:envMxdiZc - Branch if not equal to 03DC41.
-----------------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------------------
$03/DC46 AD 04 27 LDA $2704  [$7E:2704] A:0000 X:003E Y:0000 P:envMxdiZc - Load Target's Status Byte 2 into A.
$03/DC49 29 FC AND #$FC A:0000 X:003E Y:0000 P:envMxdiZc - ?Add -4? -(Remove Berserk?)
$03/DC4B 85 AA STA $AA    [$00:00AA] A:0000 X:003E Y:0000 P:envMxdiZc - Store A in AA.
$03/DC4D AD 04 27 LDA $2704  [$7E:2704] A:0000 X:003E Y:0000 P:envMxdiZc - Load Target's Status Byte 2 into A.
$03/DC50 29 03 AND #$03 A:0000 X:003E Y:0000 P:envMxdiZc - Is there 03 already there?
$03/DC52 18 CLC A:0000 X:003E Y:0000 P:envMxdiZc - Clear Carry Flag.
$03/DC53 69 01 ADC #$01 A:0000 X:003E Y:0000 P:envMxdiZc - Add 01 to A.
$03/DC55 C9 04 CMP #$04 A:0001 X:003E Y:0000 P:envMxdizc - Is it 04?
$03/DC57 90 08 BCC $08    [$DC61] A:0001 X:003E Y:0000 P:eNvMxdizc - If not, branch to 03DC61,
---------------------------------------------------------------------------------------------------------------------------------------

--------------------------------------------------------------------------------------------------------------------------------------
$03/DC61 05 AA ORA $AA    [$00:00AA] A:0001 X:003E Y:0000 P:eNvMxdizc - Add the value in AA into A?
$03/DC63 8D 04 27 STA $2704  [$7E:2704] A:0001 X:003E Y:0000 P:envMxdizc - Store A in 7E2704.
$03/DC66 A9 07 LDA #$07 A:0001 X:003E Y:0000 P:envMxdizc - Load 07 into A.
$03/DC68 85 D6 STA $D6    [$00:00D6] A:0007 X:003E Y:0000 P:envMxdizc - Store A in D6.
$03/DC6A A5 CF LDA $CF    [$00:00CF] A:0007 X:003E Y:0000 P:envMxdizc - Load A in CF.
$03/DC6C 20 36 9E JSR $9E36  [$03:9E36] A:0005 X:003E Y:0000 P:envMxdizc - Jump to Subroutine.  (??)
$03/DC6F A9 0C LDA #$0C A:0000 X:0024 Y:0024 P:envMxdizc - Load 0C into A.
$03/DC71 20 C8 85 JSR $85C8  [$03:85C8] A:000C X:0024 Y:0024 P:envMxdizc - Jump to Subroutine (May deal something with a Timer)
$03/DC74 A9 40 LDA #$40 A:0000 X:0075 Y:0024 P:envMxdiZc - Load 40 into A.
$03/DC76 9D 06 2A STA $2A06,x[$7E:2A7B] A:0040 X:0075 Y:0024 P:envMxdizc - Store A in 7E2A7B.
$03/DC79 A5 CF LDA $CF    [$00:00CF] A:0040 X:0075 Y:0024 P:envMxdizc - Load CF into A.
$03/DC7B 0A ASL A A:0005 X:0075 Y:0024 P:envMxdizc - Multiply A by 2.
$03/DC7C AA TAX A:000A X:0075 Y:0024 P:envMxdizc - Transfer A to X.
$03/DC7D BD EB 29 LDA $29EB,x[$7E:29F5] A:000A X:000A Y:0024 P:envMxdizc - Load A from 7E29F5.
$03/DC80 09 08 ORA #$08 A:0040 X:000A Y:0024 P:envMxdizc - Add 08 to A.
$03/DC82 9D EB 29 STA $29EB,x[$7E:29F5] A:0048 X:000A Y:0024 P:envMxdizc - Store A 7E29F5.
$03/DC85 A5 D4 LDA $D4    [$00:00D4] A:0048 X:000A Y:0024 P:envMxdizc - Load A from D4.
$03/DC87 9D 44 2B STA $2B44,x[$7E:2B4E] A:0024 X:000A Y:0024 P:envMxdizc - Store A in 7E2B4E.
$03/DC8A A5 D5 LDA $D5    [$00:00D5] A:0024 X:000A Y:0024 P:envMxdizc - Load A from D5.
$03/DC8C 9D 45 2B STA $2B45,x[$7E:2B4F] A:0000 X:000A Y:0024 P:envMxdiZc - Store A in 7E2B4F.
$03/DC8F 60 RTS A:0000 X:000A Y:0024 P:envMxdiZc - Return
-------------------------------------------------------------------------------------------------------------------------------------

Hmm, now there are a few interesting items here. One is the Absorb tag when the routine does no damage (normally. If the Absorb routine and is carried through the Target will instead by healed based on the power of the Spell.) and the second is that very familiar sequence at the end which is becoming a staple for Timed Statuses, that is something to take note of. Furthermore I've cast this spell many, many times on enemies and have not frozen the game once, with enemies dying properly. But I can't say the same for the Calcify Weapon Effect. The game will sporadically freeze, as mentioned elsewhere when timers elapse. My thought is that the timer isn't dealt with correctly when the status is inflicted by a weapon. If it's inflicted by a spell it appears to work perfectly fine.

So have no fear in using Calcify as a spell. Just be wary of using it as a Weapon Effect.

« Last Edit: September 25, 2013, 12:54:39 AM by Grimoire LD »

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
« Reply #57 on: September 25, 2013, 01:25:45 AM »
Gaze Routine

Code: [Select]
$03/DC90 A2 03 00 LDX #$0003 A:0003 X:0040 Y:0000 P:envMxdizc - Load 03 into X
$03/DC93 A9 05 LDA #$05 A:0003 X:0003 Y:0000 P:envMxdizc - Load 05 into A.
$03/DC95 20 79 83 JSR $8379  [$03:8379] A:0005 X:0003 Y:0000 P:envMxdizc - (Random number generator. Will choose a value between 3 or 5.
$03/DC98 A8 TAY A:0004 X:0000 Y:0000 P:envMxdizc - Transfer A to Y.
$03/DC99 8D A9 00 STA $00A9  [$7E:00A9] A:0004 X:0000 Y:0004 P:envMxdizc - Store A in A9.
$03/DC9C 38 SEC A:0004 X:0000 Y:0004 P:envMxdizc - Set Carry Flag
$03/DC9D 6E A4 28 ROR $28A4  [$7E:28A4] A:0004 X:0000 Y:0004 P:envMxdizC - Divide value in 7E28A4 by 2.
$03/DCA0 88 DEY A:0004 X:0000 Y:0004 P:eNvMxdizc - Decrement Y.
$03/DCA1 D0 FA BNE $FA    [$DC9D] A:0004 X:0000 Y:0003 P:envMxdizc - Does Y = 0? If not loop back to 03DC9D.
$03/DCA3 AD A9 00 LDA $00A9  [$7E:00A9] A:0004 X:0000 Y:0000 P:envMxdiZc - Load the value in A9 into A.
$03/DCA6 C9 05 CMP #$05 A:0004 X:0000 Y:0000 P:envMxdizc - Is it 05?
$03/DCA8 F0 03 BEQ $03    [$DCAD] A:0004 X:0000 Y:0000 P:eNvMxdizc - If so, branch to 03DCAD
$03/DCAA 4C B6 D5 JMP $D5B6  [$03:D5B6] A:0004 X:0000 Y:0000 P:eNvMxdizc - Jump to Immobilizing Status Routine. (Seems to exit Routine from here)
------------------------------------------------------------------------------------------------------------------------------------------------
$03/DCAD 4C 24 D5 JMP $D524  [$03:D524] A:0005 X:0000 Y:0000 P:envMxdiZC - Jump to Status Routine (Seems to exit Routine from here)
------------------------------------------------------------------------------------------------------------------------------------------------

Now here's the first of the random status routines and it is very simple to see how it works. It chooses a random number between 3 and 5 and that random number is how many times a loop will occur making the Status "Of the Spell" go from 00 to 80, from 80 to 40, and since 3 is the first valid choice 40 to 20 which is Paralyze. 4 is 20 to 10 which is Sleep and 5 is 10 to 8 which is Charm in the special branching routine. These are fully malleable and a bit of custom fun could be had with them. That Random Number Generator could be put to great use eventually.




Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Grimoire LD's Notes, Methods, and Hacks (All Spells Disassembly)
« Reply #58 on: September 25, 2013, 10:31:37 AM »
Blaster Routine -

Code: [Select]
$03/DCB0 A2 00 00 LDX #$0000 A:0003 X:0042 Y:FFFF P:envMxdizc - Load 00 into X.
$03/DCB3 A9 01 LDA #$01 A:0003 X:0000 Y:FFFF P:envMxdiZc - Load 01 into A
$03/DCB5 20 79 83 JSR $8379  [$03:8379] A:0001 X:0000 Y:FFFF P:envMxdizc - Run it through Random Number Generator.
$03/DCB8 AA TAX A:0000 X:0000 Y:00FF P:envMxdizc - Transfer A to X.
$03/DCB9 D0 08 BNE $08    [$DCC3] A:0000 X:0000 Y:00FF P:envMxdiZc - If not 00 branch to 03DCC3.
$03/DCBB A9 80 LDA #$80 A:0000 X:0000 Y:00FF P:envMxdiZc - Load 80 (Death) into A.
$03/DCBD 8D A3 28 STA $28A3  [$7E:28A3] A:0080 X:0000 Y:00FF P:eNvMxdizc - Store A in "Casted Spell's Status"
$03/DCC0 4C 24 D5 JMP $D524  [$03:D524] A:0080 X:0000 Y:00FF P:eNvMxdizc - Jump to Status Routine (Leaves Routine from here.)
-----------------------------------------------------------------------------------------------------------------------------------------------------------
$03/DCC3 A9 20 LDA #$20 A:0001 X:0001 Y:00FF P:envMxdizc - Load 20 (Paralysis) into A.
$03/DCC5 8D A4 28 STA $28A4  [$7E:28A4] A:0020 X:0001 Y:00FF P:envMxdizc - Store A in "Casted Spell's Status"
$03/DCC8 4C B6 D5 JMP $D5B6  [$03:D5B6] A:0020 X:0001 Y:00FF P:envMxdizc - Jump to Immobilizing Status Routine (Leaves Routine from here.)

A very short and simple code and as before it is quite malleable. Even moreso in a couple of ways here because this does not use divided numbers but full choices of 20 and 80 and their appropriate routine jumps are shown. It is not shown normally in any circumstance, but the code is redrawn for as many targets as there may be, the afflicted effect may differ from the first time as well.

Slap Routine

Code: [Select]
$03/DCCB A2 00 00 LDX #$0000 A:0003 X:0044 Y:FFFF P:envMxdizc - Load 00 into X.
$03/DCCE A9 02 LDA #$02 A:0003 X:0000 Y:FFFF P:envMxdiZc - Load 02 into X.
$03/DCD0 20 79 83 JSR $8379  [$03:8379] A:0002 X:0000 Y:FFFF P:envMxdizc - Run it through Random Number Generator
$03/DCD3 AA TAX A:0002 X:0000 Y:00FF P:eNvMxdizc - Transfer A to X.
$03/DCD4 D0 08 BNE $08    [$DCDE] A:0002 X:0002 Y:00FF P:envMxdizc - If A is not 00 branch to 03DCDE.
-----------------------------------------------------------------------------------------------------------------------
$03/DCD6 A9 20 LDA #$20 A:0000 X:0000 Y:00FF P:envMxdiZc - Load 20 (Paralysis) into A.
$03/DCD8 8D A4 28 STA $28A4  [$7E:28A4] A:0020 X:0000 Y:00FF P:envMxdizc  - Store A in "Casted Spell's Status Byte 2".
$03/DCDB 4C B6 D5 JMP $D5B6  [$03:D5B6] A:0020 X:0000 Y:00FF P:envMxdizc - Jump to Immobilizing Status Routine.
-----------------------------------------------------------------------------------------------------------------------------
$03/DCDE 3A DEC A A:0002 X:0002 Y:00FF P:envMxdizc - -1 to A.
$03/DCDF D0 07 BNE $07    [$DCE8] A:0001 X:0002 Y:00FF P:envMxdizc - If A is not 00 branch to 03DCE8.
------------------------------------------------------------------------------------------------------------------------------
$03/DCE1 A9 04 LDA #$04 A:0000 X:0001 Y:00FF P:envMxdiZc - Load 04 (Silence) into A
$03/DCE3 8D A3 28 STA $28A3  [$7E:28A3] A:0004 X:0001 Y:00FF P:envMxdizc - Store A in "Casted Spell's Status Byte 1"
$03/DCE6 80 05 BRA $05    [$DCED] A:0004 X:0001 Y:00FF P:envMxdizc - Branch always to 03DCED
------------------------------------------------------------------------------------------------------------------------------
$03/DCE8 A9 80 LDA #$80 A:0001 X:0002 Y:00FF P:envMxdizc - Load 80 (Curse) into A.
$03/DCEA 8D A4 28 STA $28A4  [$7E:28A4] A:0080 X:0002 Y:00FF P:eNvMxdizc - Store A in "Casted Spell's Status Byte 2"
$03/DCED 4C 24 D5 JMP $D524  [$03:D524] A:0080 X:0002 Y:00FF P:eNvMxdizc - Jump to Status Routine. (Leaves Routine from here)


Now this seems like a nearly ideal way to approach this matter, third time's the charm I guess for Square. They have three options set up that lead to three unique and different occurrences not dependent on any other part (except for Silence using a branch and saving one byte as a result, but other than that...) Now to expand this sort of theory to other parts of the game...


Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Grimoire LD's Notes, Methods, and Hacks (All Spells Disassembly)
« Reply #59 on: September 25, 2013, 11:31:38 AM »
Blast/Mind Blast Routine

Code: [Select]

$03/DCF0 A9 20 LDA #$20 A:0003 X:0046 Y:0000 P:envMxdizc - Load 20 into A.
$03/DCF2 8D A4 28 STA $28A4  [$7E:28A4] A:0020 X:0046 Y:0000 P:envMxdizc - Store A in "Casted Spell's Status Byte 2."
$03/DCF5 20 B6 D5 JSR $D5B6  [$03:D5B6] A:0020 X:0046 Y:0000 P:envMxdizc - Jump to Immobilizing Status Routine
$03/DCF8 4C F4 D3 JMP $D3F4  [$03:D3F4] A:0040 X:006C Y:0027 P:envMxdizc - Jump Immediately to Sap Portion of Damage, Sap Routine.

Shortest Code ever?

Well its efficient if nothing else. Even in this form it supplies us with some information. It is clearly just jumping straight to Sap and that should easily be changed to any desired circumstance of like cause.

Hug Routine
Code: [Select]
$03/DCFB C2 20 REP #$20 A:0003 X:0048 Y:0000 P:envMxdizc - Reset Processor status
$03/DCFD 38 SEC A:0003 X:0048 Y:0000 P:envmxdizc - Set Carry Flag.
$03/DCFE AD 09 27 LDA $2709  [$7E:2709] A:0003 X:0048 Y:0000 P:envmxdizC - Load Target's Max HP.
$03/DD01 ED 07 27 SBC $2707  [$7E:2707] A:01F4 X:0048 Y:0000 P:envmxdizC - ?-1 their Current HP?
$03/DD04 85 A4 STA $A4    [$00:00A4] A:0000 X:0048 Y:0000 P:envmxdiZC - Store A in A4.
$03/DD06 7B TDC A:0000 X:0048 Y:0000 P:envmxdiZC - Transfer Direct Page.
$03/DD07 E2 20 SEP #$20 A:0000 X:0048 Y:0000 P:envmxdiZC - Set Bit 5.
$03/DD09 A5 A5 LDA $A5    [$00:00A5] A:0000 X:0048 Y:0000 P:envMxdiZC - Load A from A5.
$03/DD0B 09 80 ORA #$80 A:0000 X:0048 Y:0000 P:envMxdiZC - Add 80 (Cure Flag)
$03/DD0D 85 A5 STA $A5    [$00:00A5] A:0080 X:0048 Y:0000 P:eNvMxdizC - Store A in A5.
$03/DD0F 4C 15 D5 JMP $D515  [$03:D515] A:0080 X:0048 Y:0000 P:eNvMxdizC - Jump to Status Routine (Jumps out of Routine from here)
---------------------------------------------------------------------------------------------

I would have thought it would jump to Cure 4's routine to condense this even further and then jump to Status. Guess I was wrong. It seems to go through the motions of its own accord. Interestingly enough Hug actually obeys the given status for it rather than draw it from anywhere in particular. So say you wanted a powerful status to inflict or something, but you didn't want it viable in the late battle, you could give it Hug's formula to recover all of the enemy's HP when it is used.

Explode Routine

Code: [Select]
$03/DD12 A9 05 LDA #$05 A:0003 X:004A Y:0000 P:envMxdizc - Load 05 into A.
$03/DD14 8D E6 38 STA $38E6  [$7E:38E6] A:0005 X:004A Y:0000 P:envMxdizc - Store A in 7E38E6.
$03/DD17 C2 20 REP #$20 A:0005 X:004A Y:0000 P:envMxdizc - Reset Processor Status.
$03/DD19 AD 87 26 LDA $2687  [$7E:2687] A:0005 X:004A Y:0000 P:envmxdizc - Load A from Caster's HP.
$03/DD1C C9 0F 27 CMP #$270F A:00C8 X:004A Y:0000 P:envmxdizc - Is it ?Less than Base Strength of Target?
$03/DD1F 90 03 BCC $03    [$DD24] A:00C8 X:004A Y:0000 P:eNvmxdizc - If not branch to 03DD24.
---------------------------------------------------------------------------------------------------------------------------------------
$03/DD21 A9 0F 27 LDA #$270F A:00C5 X:004A Y:0000 P:eNvmxdizc - ?Load A from Target's Base Strength? (Had to null the BCC above to get here. I couldn't figure out how otherwise. From what I can tell this guarantees that that attack will do 9999 damage. I have no clue how that is though.)
---------------------------------------------------------------------------------------------------------------------------------------
$03/DD24 85 A4 STA $A4    [$00:00A4] A:00C8 X:004A Y:0000 P:eNvmxdizc - Store A in A4.
$03/DD26 7B TDC A:00C8 X:004A Y:0000 P:eNvmxdizc - Transfer Direct Page.
$03/DD27 E2 20 SEP #$20 A:0000 X:004A Y:0000 P:envmxdiZc p Set Processor Status.
$03/DD29 A9 80 LDA #$80 A:0000 X:004A Y:0000 P:envMxdiZc - Load 80 (Death) into A.
$03/DD2B 8D 83 26 STA $2683  [$7E:2683] A:0080 X:004A Y:0000 P:eNvMxdizc - Store A in Caster's Status Byte 1.
$03/DD2E 60 RTS A:0080 X:004A Y:0000 P:eNvMxdizc - Return
-------------------------------------------------------------------------------------------------------------------------------------------

I'm a bit confused on this one and I feel that this comparison may not actually be normally fulfilled. I may be missing something really simple in regards to it though.


Reaction Routine

Code: [Select]
$03/DD2F A9 05 LDA #$05 A:0003 X:004C Y:0000 P:envMxdizc - Load 05 into A.
$03/DD31 8D E6 38 STA $38E6  [$7E:38E6] A:0005 X:004C Y:0000 P:envMxdizc - Store A 7E38E6.
$03/DD34 A9 80 LDA #$80 A:0005 X:004C Y:0000 P:envMxdizc - Load 80 (Death) into A.
$03/DD36 8D 83 26 STA $2683  [$7E:2683] A:0080 X:004C Y:0000 P:eNvMxdizc - Store A in Caster's Status Byte 1.
$03/DD39 8D 03 27 STA $2703  [$7E:2703] A:0080 X:004C Y:0000 P:eNvMxdizc - Store A in Target's Status Byte 1.
$03/DD3C A2 80 02 LDX #$0280 A:0080 X:004C Y:0000 P:eNvMxdizc - Load 0280 into X (So it targets Monsters only)
$03/DD3F A0 08 00 LDY #$0008 A:0080 X:0280 Y:0000 P:envMxdizc - Load 08 into Y (For the eight other creatures)
-------------------------------------------------------------------------(Looping Point)
$03/DD42 A9 80 LDA #$80 A:0080 X:0280 Y:0008 P:envMxdizc - Load 80 (Death) into A.
$03/DD44 9D 03 20 STA $2003,x[$7E:2283] A:0080 X:0280 Y:0008 P:eNvMxdizc - Store A in Monster Slot 1's Status Byte 1.
$03/DD47 20 BC 85 JSR $85BC  [$03:85BC] A:0080 X:0280 Y:0008 P:eNvMxdizc - Jump to Subroutine (Safe Transfer to X routine)
$03/DD4A 88 DEY A:0000 X:0300 Y:0008 P:envMxdiZc - -1 to Y.
$03/DD4B D0 F5 BNE $F5    [$DD42] A:0000 X:0300 Y:0007 P:envMxdizc - Loop until Y reads 00.
$03/DD4D 60 RTS A:0000 X:0680 Y:0000 P:envMxdiZc

Because of how the game utlizes this routine it is entirely pointless to be a custom routine in the first place. They could have just as easily make Reaction a Monster Spell which Targets all Allies and apply Death to them. It would not have been a difficult thing to do. If there is any formula that can be devoured and made anew, this is likely it.