øAslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&topic=1883.msg19256e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index9557.htmlslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&topic=1883.0e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index9557.html.zxÒg^ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÈ'ÿOKtext/htmlISO-8859-1gzip0|ÖÿÿÿÿÿÿÿÿÿTue, 10 Mar 2020 04:59:19 GMT0ó°° ®0®P®€§²ð®Ïg^ÿÿÿÿÿÿÿÿV²ÿ 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 78640 times)

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Grimoire LD's Notes, Methods, and Hacks (All Spells Disassembly)
« Reply #60 on: September 25, 2013, 12:06:37 PM »
Recover 1/10 - Recover 1/3 Target's HP (Remedy/Absorb) Routines

Code: [Select]
$03/DD4E AD 09 27 LDA $2709  [$7E:2709] A:0003 X:004E Y:0000 P:envMxdizc - Load A from Target's Max HP.
$03/DD51 8D 45 39 STA $3945  [$7E:3945] A:00C8 X:004E Y:0000 P:eNvMxdizc - Store A in 7E3945.
$03/DD54 AD 0A 27 LDA $270A  [$7E:270A] A:00C8 X:004E Y:0000 P:eNvMxdizc - Load A from Target's Max HP Byte 2.
$03/DD57 8D 46 39 STA $3946  [$7E:3946] A:0000 X:004E Y:0000 P:envMxdiZc - Store A in 7E3946.
$03/DD5A A2 0A 00 LDX #$000A A:0000 X:004E Y:0000 P:envMxdiZc - Load 0A into X. (/10. How much % of HP to heal.
$03/DD5D 8E 47 39 STX $3947  [$7E:3947] A:0000 X:000A Y:0000 P:envMxdizc - Store X in 7E3947.
$03/DD60 80 12 BRA $12    [$DD74] A:0000 X:000A Y:0000 P:envMxdizc - Branch Always to 03DD74.
---------------------------------------------------------------------------------------------------------------------------------------------------
(Absorb's Routine.)
$03/DD62 AD 07 27 LDA $2707  [$7E:2707] A:0000 X:0001 Y:0000 P:envMxdizc - Load A from Target's Current HP.
$03/DD65 8D 45 39 STA $3945  [$7E:3945] A:00C3 X:0001 Y:0000 P:eNvMxdizc - Store A in 7E3945.
$03/DD68 AD 08 27 LDA $2708  [$7E:2708] A:00C3 X:0001 Y:0000 P:eNvMxdizc - Load A from Target's Current HP Byte 2.
$03/DD6B 8D 46 39 STA $3946  [$7E:3946] A:0000 X:0001 Y:0000 P:envMxdiZc - Store A in 7E3946.
$03/DD6E A2 03 00 LDX #$0003 A:0000 X:0001 Y:0000 P:envMxdiZc - Load 03 into X (/3. How much % of HP to heal.)
$03/DD71 8E 47 39 STX $3947  [$7E:3947] A:0000 X:0003 Y:0000 P:envMxdizc - Store X in 7E3947.
--------------------------------------------------------------------------------------------------------------------------------------------------
$03/DD74 20 07 84 JSR $8407  [$03:8407] A:0000 X:000A Y:0000 P:envMxdizc - Jump to Subroutine (Appears to deal something with HP.)
$03/DD77 AE 49 39 LDX $3949  [$7E:3949] A:0000 X:0000 Y:0000 P:envMxdiZc - Load X from 7E3949.
$03/DD7A E0 0F 27 CPX #$270F A:0000 X:0014 Y:0000 P:envMxdizc - Is it Target's ?base strength?
$03/DD7D 90 06 BCC $06    [$DD85] A:0000 X:0014 Y:0000 P:eNvMxdizc - If ?not? branch to 03DD7D.
---------------------------------------------------------------------------------------------------------------------------------------------------
$03/DD7F A2 0F 27 LDX #$270F A:0000 X:00C8 Y:0000 P:eNvMxdizc - Load X from Target's ?base strength?
$03/DD82 8E 49 39 STX $3949  [$7E:3949] A:0000 X:270F Y:0000 P:envMxdizc - Store X in 7E3949.
-----------------------------------------------------------------------------------------------------------------------------------------------------
$03/DD85 AD 49 39 LDA $3949  [$7E:3949] A:0000 X:0014 Y:0000 P:eNvMxdizc - Load A from 7E3949 (compounded health recovery)
$03/DD88 85 A4 STA $A4    [$00:00A4] A:0014 X:0014 Y:0000 P:envMxdizc - Store A in A4.
$03/DD8A AD 4A 39 LDA $394A  [$7E:394A] A:0014 X:0014 Y:0000 P:envMxdizc - Load A from 7E394A
$03/DD8D 09 80 ORA #$80 A:0000 X:0014 Y:0000 P:envMxdiZc - Add 80 (Cure Tag)
$03/DD8F 85 A5 STA $A5    [$00:00A5] A:0080 X:0014 Y:0000 P:eNvMxdizc - Store A in A5.
$03/DD91 60 RTS A:0080 X:0014 Y:0000 P:eNvMxdizc - Return.

Another bizarre reference to Target Strength, again it seems to automatically make the damage recovered 9999. This may have been in earlier plans or something. Since it can't be seen in the normal game and there is no logical way of activating it just like with Explode. It is interesting to see a Routine inside of a Routine in the form of Absorb though.





Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Grimoire LD's Notes, Methods, and Hacks (All Spells Disassembly)
« Reply #61 on: September 25, 2013, 03:21:21 PM »
Damage, Status (Unused?) Routine

Code: [Select]
$03/DD92 20 88 D3 JSR $D388  [$03:D388] A:0003 X:0050 Y:0000 P:envMxdizc - Jump to Spell Damage Routine.
$03/DD95 4C 24 D5 JMP $D524  [$03:D524] A:0081 X:0155 Y:0000 P:eNvMxdizc - Jump to Status Routine. (Leaves Routine)

Well.. it does what it says on the tin. But it doesn't do anything that Roc (Also Damage, Status) doesn't do. And it does it in quite a few less bytes. Hmm, maybe damage on the Roc spell isn't using the normal method of damage (Spell Power) but something else maybe? What it does seem to do is suppress the Graphic data oddly enough. There will be no graphic for the spell when this formula is used.

Alert, Call Routine

Code: [Select]
$03/DD98 EE E6 38 INC $38E6  [$7E:38E6] A:0003 X:0052 Y:0000 P:envMxdizc - +1 to 7E38E6.
$03/DD9B 7B TDC A:0003 X:0052 Y:0000 P:envMxdizc - Transfer Direct Page.
$03/DD9C AA TAX A:0000 X:0052 Y:0000 P:envMxdiZc - Transfer A to X.
-----------------------------(Loop Point)
$03/DD9D BD B5 29 LDA $29B5,x[$7E:29B5] A:0000 X:0000 Y:0000 P:envMxdiZc - Load 7E29B5.
$03/DDA0 C9 FF CMP #$FF A:0000 X:0000 Y:0000 P:envMxdiZc - Is it FF?
$03/DDA2 F0 03 BEQ $03    [$DDA7] A:0000 X:0000 Y:0000 P:envMxdizc - If so, continue on.
$03/DDA4 E8 INX A:0000 X:0000 Y:0000 P:envMxdizc - Increase X by 1.
$03/DDA5 80 F6 BRA $F6    [$DD9D] A:0000 X:0001 Y:0000 P:envMxdizc - Loop back to 03DD9D. (Looking for an empty spot to put the new monster data.)
---------------------------------------------------------------------------------------------------------------------
$03/DDA7 86 8A STX $8A    [$00:008A] A:00FF X:0004 Y:0000 P:envMxdiZC - Store X in 8A.
$03/DDA9 A9 01 LDA #$01 A:00FF X:0004 Y:0000 P:envMxdiZC - Load 01 (Monster Group 2) into A.
$03/DDAB 4C 5C DF JMP $DF5C  [$03:DF5C] A:0001 X:0004 Y:0000 P:envMxdizC - Jump to ?Audio-Visual Effect? Routine.
(While in this subroutine the monster is placed onto the battlefield with a clean slate as if it was the start of battle, it leaves the Routine from here)
--------------------------------------------------------------------------------------------------------------------------

It seems that its possibly to switch which Monster Group is summoned by Call. I'm not sure how useful that information is, but there it is anyhow.

Black Hole Routine -
Code: [Select]
$03/DDAE AD 04 27 LDA $2704  [$7E:2704] A:0003 X:0054 Y:0000 P:envMxdizc - Load Target's Status Byte 2.
$03/DDB1 85 A9 STA $A9    [$00:00A9] A:0000 X:0054 Y:0000 P:envMxdiZc - Store it in A9.
$03/DDB3 29 BB AND #$BB A:0000 X:0054 Y:0000 P:envMxdiZc  - Add -44 to it (Nulling Berserk and Float)
$03/DDB5 8D 04 27 STA $2704  [$7E:2704] A:0000 X:0054 Y:0000 P:envMxdiZc - Store the value in Target's Status Byte 2.
$03/DDB8 AD 06 27 LDA $2706  [$7E:2706] A:0000 X:0054 Y:0000 P:envMxdiZc - Load  Target's Status Byte 4.
$03/DDBB 29 C3 AND #$C3 A:0000 X:0054 Y:0000 P:envMxdiZc - Add -3C (Nulling Image 1, Image 2, Barrier, and Wall)
$03/DDBD 8D 06 27 STA $2706  [$7E:2706] A:0000 X:0054 Y:0000 P:envMxdiZc - Store the value in Target's Status Byte 4.
$03/DDC0 A9 10 LDA #$10 A:0000 X:0054 Y:0000 P:envMxdiZc - Load 10 into A.
$03/DDC2 8D 3B 27 STA $273B  [$7E:273B] A:0010 X:0054 Y:0000 P:envMxdizc - Store A in Target's Speed. (Resetting it)
$03/DDC5 60 RTS A:0010 X:0054 Y:0000 P:envMxdizc - Return

Very straightforward code, while all of this was known it is interesting to see that This is what Dispel should have been in the first place. I would suggest cannibalizing Dispel for a custom routine and just use Black Hole as a replacement.






Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Grimoire LD's Notes, Methods, and Hacks (All Spells Disassembly)
« Reply #62 on: September 25, 2013, 03:39:53 PM »
Trigger a Reaction Routine -

Code: [Select]
$03/DDD9 60 RTS A:0003 X:005A Y:0000 P:envMxdizc - Sure. Alright.

We have a winner! The smallest amount of Code goes to Trigger a Reaction! (No clue on why this would be so short.)

Invincibility Counter Increment Routine
Code: [Select]
$03/DDD6 EE 81 38 INC $3881  [$7E:3881] A:0003 X:005C Y:FFFF P:envMxdizc - Increase the Monster Invincibility Counter by 1.
$03/DDD9 60 RTS A:0003 X:005C Y:FFFF P:envMxdizc - Return

Yeah.

Decrement Invincibility Encounter

Code: [Select]
$03/DDDA CE 81 38 DEC $3881  [$7E:3881] A:0003 X:005E Y:0000 P:envMxdizc - Decrease the Monster Invincibility Counter by 1.
$03/DDDD 60 RTS A:0003 X:005E Y:0000 P:eNvMxdizc - Return.

Nothing to see here.

Revive Monster

Code: [Select]
$03/DDDE A9 02 LDA #$02 A:0003 X:0060 Y:0000 P:envMxdizc - Load 02 into A.
$03/DDE0 8D E6 38 STA $38E6  [$7E:38E6] A:0002 X:0060 Y:0000 P:envMxdizc - Store A in 7E38E6.
$03/DDE3 AD 03 27 LDA $2703  [$7E:2703] A:0002 X:0060 Y:0000 P:envMxdizc - Load A from Target's Status Byte 1.
$03/DDE6 10 3C BPL $3C    [$DE24] A:0000 X:0060 Y:0000 P:envMxdiZc - Branch if not 80+ (Not dead).
---------------------------------------------------------------------------------------------------------------------
$03/DDE8 9C 03 27 STZ $2703  [$7E:2703] A:0080 X:0060 Y:FFFF P:eNvMxdizc - Store Zero in Target's Status Byte 1.
$03/DDEB 9C 04 27 STZ $2704  [$7E:2704] A:0080 X:0060 Y:FFFF P:eNvMxdizc - Store Zero in Target's Status Byte 2.
$03/DDEE 9C 05 27 STZ $2705  [$7E:2705] A:0080 X:0060 Y:FFFF P:eNvMxdizc - Store Zero in Target's Status Byte 3.
$03/DDF1 9C 06 27 STZ $2706  [$7E:2706] A:0080 X:0060 Y:FFFF P:eNvMxdizc - Store Zero in Target's Status Byte 4.
$03/DDF4 64 D6 STZ $D6    [$00:00D6] A:0080 X:0060 Y:FFFF P:eNvMxdizc - Store Zero in D6.
$03/DDF6 A5 CF LDA $CF    [$00:00CF] A:0080 X:0060 Y:FFFF P:eNvMxdizc - Load A from CF.
$03/DDF8 20 36 9E JSR $9E36  [$03:9E36] A:0001 X:0060 Y:FFFF P:envMxdizc- Jump to Subroutine (??)
$03/DDFB A9 03 LDA #$03 A:0000 X:0004 Y:0004 P:envMxdizc - Load 03 into A.
$03/DDFD 20 C8 85 JSR $85C8  [$03:85C8] A:0003 X:0004 Y:0004 P:envMxdizc - Jump to Subroutine (May deal something with Healing - Seems to leave routine from here)
---------------------------------------------------------------------------------------------------------------------------


--------------------------------------------------------------------------------------------------------------------
$03/DE24 AD 09 27 LDA $2709  [$7E:2709] A:0000 X:0060 Y:0000 P:envMxdiZc - Load A from Target's Max HP.
$03/DE27 8D 07 27 STA $2707  [$7E:2707] A:00F4 X:0060 Y:0000 P:eNvMxdizc - Store A in Target's Current HP.
$03/DE2A AD 0A 27 LDA $270A  [$7E:270A] A:00F4 X:0060 Y:0000 P:eNvMxdizc - Load A from Target's Max HP Byte 2.
$03/DE2D 8D 08 27 STA $2708  [$7E:2708] A:0001 X:0060 Y:0000 P:envMxdizc - Store A in Target's Current HP Byte 2.
$03/DE30 60 RTS A:0001 X:0060 Y:0000 P:envMxdizc - Return

Bah, cut it to the wire. So I don't have time to finish this now. Will hopefully be able to do so tonight.

 :edit: Hmm, there is a noticeable difference missing here. Maybe it's data used in another formula?
« Last Edit: September 25, 2013, 11:28:27 PM by Grimoire LD »

Pinkpuff

  • Flan Princess
  • *
  • Posts: 924
  • Find a Megalixir in Unprecedented Crisis!
    • View Profile
Re: Grimoire LD's Notes, Methods, and Hacks (All Spells Disassembly)
« Reply #63 on: September 25, 2013, 03:56:11 PM »
Recover 1/10 - Recover 1/3 Target's HP (Remedy/Absorb) Routines

Code: [Select]
$03/DD4E AD 09 27 LDA $2709  [$7E:2709] A:0003 X:004E Y:0000 P:envMxdizc - Load A from Target's Max HP.
$03/DD51 8D 45 39 STA $3945  [$7E:3945] A:00C8 X:004E Y:0000 P:eNvMxdizc - Store A in 7E3945.
$03/DD54 AD 0A 27 LDA $270A  [$7E:270A] A:00C8 X:004E Y:0000 P:eNvMxdizc - Load A from Target's Max HP Byte 2.
$03/DD57 8D 46 39 STA $3946  [$7E:3946] A:0000 X:004E Y:0000 P:envMxdiZc - Store A in 7E3946.
$03/DD5A A2 0A 00 LDX #$000A A:0000 X:004E Y:0000 P:envMxdiZc - Load 0A into X. (/10. How much % of HP to heal.
$03/DD5D 8E 47 39 STX $3947  [$7E:3947] A:0000 X:000A Y:0000 P:envMxdizc - Store X in 7E3947.
$03/DD60 80 12 BRA $12    [$DD74] A:0000 X:000A Y:0000 P:envMxdizc - Branch Always to 03DD74.
---------------------------------------------------------------------------------------------------------------------------------------------------
(Absorb's Routine.)
$03/DD62 AD 07 27 LDA $2707  [$7E:2707] A:0000 X:0001 Y:0000 P:envMxdizc - Load A from Target's Current HP.
$03/DD65 8D 45 39 STA $3945  [$7E:3945] A:00C3 X:0001 Y:0000 P:eNvMxdizc - Store A in 7E3945.
$03/DD68 AD 08 27 LDA $2708  [$7E:2708] A:00C3 X:0001 Y:0000 P:eNvMxdizc - Load A from Target's Current HP Byte 2.
$03/DD6B 8D 46 39 STA $3946  [$7E:3946] A:0000 X:0001 Y:0000 P:envMxdiZc - Store A in 7E3946.
$03/DD6E A2 03 00 LDX #$0003 A:0000 X:0001 Y:0000 P:envMxdiZc - Load 03 into X (/3. How much % of HP to heal.)
$03/DD71 8E 47 39 STX $3947  [$7E:3947] A:0000 X:0003 Y:0000 P:envMxdizc - Store X in 7E3947.
--------------------------------------------------------------------------------------------------------------------------------------------------
$03/DD74 20 07 84 JSR $8407  [$03:8407] A:0000 X:000A Y:0000 P:envMxdizc - Jump to Subroutine (Appears to deal something with HP.)
$03/DD77 AE 49 39 LDX $3949  [$7E:3949] A:0000 X:0000 Y:0000 P:envMxdiZc - Load X from 7E3949.
$03/DD7A E0 0F 27 CPX #$270F A:0000 X:0014 Y:0000 P:envMxdizc - Is it Target's ?base strength?
$03/DD7D 90 06 BCC $06    [$DD85] A:0000 X:0014 Y:0000 P:eNvMxdizc - If ?not? branch to 03DD7D.
---------------------------------------------------------------------------------------------------------------------------------------------------
$03/DD7F A2 0F 27 LDX #$270F A:0000 X:00C8 Y:0000 P:eNvMxdizc - Load X from Target's ?base strength?
$03/DD82 8E 49 39 STX $3949  [$7E:3949] A:0000 X:270F Y:0000 P:envMxdizc - Store X in 7E3949.
-----------------------------------------------------------------------------------------------------------------------------------------------------
$03/DD85 AD 49 39 LDA $3949  [$7E:3949] A:0000 X:0014 Y:0000 P:eNvMxdizc - Load A from 7E3949 (compounded health recovery)
$03/DD88 85 A4 STA $A4    [$00:00A4] A:0014 X:0014 Y:0000 P:envMxdizc - Store A in A4.
$03/DD8A AD 4A 39 LDA $394A  [$7E:394A] A:0014 X:0014 Y:0000 P:envMxdizc - Load A from 7E394A
$03/DD8D 09 80 ORA #$80 A:0000 X:0014 Y:0000 P:envMxdiZc - Add 80 (Cure Tag)
$03/DD8F 85 A5 STA $A5    [$00:00A5] A:0080 X:0014 Y:0000 P:eNvMxdizc - Store A in A5.
$03/DD91 60 RTS A:0080 X:0014 Y:0000 P:eNvMxdizc - Return.

Another bizarre reference to Target Strength, again it seems to automatically make the damage recovered 9999. This may have been in earlier plans or something. Since it can't be seen in the normal game and there is no logical way of activating it just like with Explode. It is interesting to see a Routine inside of a Routine in the form of Absorb though.

I remember trying to modify this routine to get it to heal (1 / Spell Power) instead of a static 1/10 but I couldn't seem to get it to work. I'm sure that discussion is here somewhere, maybe archived or something.
Let's dance!

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Grimoire LD's Notes, Methods, and Hacks (All Spells Disassembly)
« Reply #64 on: September 25, 2013, 11:17:44 PM »
Ah, I can see why this might be an issue. Spell Power in this case would refer to...


AD 9D 28   LDA $289D  [$7E:289D]   A:0001   X:00C1   Y:0000   P:envMxdizC - Load A from 289D (Presumably Spell Power)

At least in that case (and Life's case) but not for the Ordinary routine...

You are right. It's not absolute and I am a bit flabbergasted...

Even another value where Spell Power is written (7E28A1 - Possibly the difference between healing and harming?) it shows nothing special when Remedy is used...

Alright, after a bit of digging I found your original topic and you thought the same exact thing I had. Unfortunately this doesn't seem to work with Absorb/Remedy for some reason. While it did load 2 HP for me on a constant basis (with a 200 HP character, effectively healing 1/100 of my HP) it did not line up with my spell power, which I have no idea where it goes for this spell. It may just be that some spells have their spell power completely ignored. But that would be strange as you'd expect that to be the case with Life as well. hmm...


Or maybe I missed the obvious...

$03/DD5A   A2 0A 00   LDX #$000A   A:0000   X:004E   Y:0000   P:envMxdiZc - Load 0A into X. (/10. How much % of HP to heal)

An X you idiot, oy... sometimes I wonder if I'm qualified for this sort of thing, heh.

Alright. While it may not be ideal, there is a workaround you can do. While the game does not appear to load its Spell Power (it still might, I could be wrong on its location) you can tie it to Element. Element is never used in the formula so you won't need to worry about Elemental Resistances or Weaknesses.

Fire - 1 (1/1)
Ice - 2 (1/2)
Lightning - 4 (1/4)
Dark - 8 (1/8)

And that's probably as far as you would want to go with that. (The rest of the elements would recover such ridiculously low amounts)...

Or maybe I could use my brain for once tonight and look at things in a reasonable manner. Yes the Spell Power is saved to 7E289D. Even Remedy's Spell Power.

Why wasn't this working when you tried it? You likely made the same mistake as me...

Here is your code...

1DF5A: AE 9D 28   (Load X with $7E:289D)



Here is mine...

$03/DD5A   AE 9D 28   LDX $289D  [$7E:289D]   A:0000   X:004E   Y:0000   P:envMxdiZc
$03/DD5D   8E 47 39   STX $3947  [$7E:3947]   A:0000   X:FF05   Y:0000   P:eNvMxdizc

One thing we did not account for was it reading Two Bytes instead of just the single one. Despite looking for an answer to this (which there Must be!) I have had no luck locating it. It deals something with 8-bit and 16-bits and using an instruction to change between the two. But there is little space to do so here, I have no idea on how to begin looking for it.

-----------------------------

Alright! Finally after about another half hour of tinkering there is a work around we can do to make this work optimally and read Spell Power.

We were on the right track, but we didn't take X's lack of ?versatility? into consideration. If we instead use...

$03/DD5A   AD 9D 28   LDA $289D  [$7E:289D]   A:0000   X:004E   Y:0000   P:envMxdiZc
$03/DD5D   8D 47 39   STA $3947  [$7E:3947]   A:0005   X:004E   Y:0000   P:envMxdizc

Instead of...

$03/DD5A   A2 0A 00   LDX #$000A   A:0000   X:004E   Y:0000   P:envMxdiZc - Load 0A into X. (/10. How much % of HP to heal.
$03/DD5D   8E 47 39   STX $3947  [$7E:3947]   A:0000   X:000A   Y:0000   P:envMxdizc - Store X in 7E3947.

Then everything works out fine.

I was leery at first in changing the register it was putting the data into but it caused no code mishaps and healed the target Dependent on the Spell Power rather than anything else. Phew, that was brain-draining for such a simple little problem.

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Grimoire LD's Notes, Methods, and Hacks (All Spells Disassembly)
« Reply #65 on: September 26, 2013, 12:48:31 AM »
Tradeoff (Suicide, Bring in Next Monster) Routine

Code: [Select]
$03/DE31 A9 03 LDA #$03 A:0003 X:0062 Y:0000 P:envMxdizc - Load 03 into A.
$03/DE33 8D E6 38 STA $38E6  [$7E:38E6] A:0003 X:0062 Y:0000 P:envMxdizc - Store A in 7E38E6
$03/DE36 EE 82 38 INC $3882  [$7E:3882] A:0003 X:0062 Y:0000 P:envMxdizc - +1 to 7E3882.
$03/DE39 AD 83 26 LDA $2683  [$7E:2683] A:0003 X:0062 Y:0000 P:envMxdizc - Load Caster's Status Byte 1 into A.
$03/DE3C 09 80 ORA #$80 A:0000 X:0062 Y:0000 P:envMxdiZc - Add 80 (Death) to A.
$03/DE3E 8D 83 26 STA $2683  [$7E:2683] A:0080 X:0062 Y:0000 P:eNvMxdizc - Store A in Caster's Status Byte 1.
$03/DE41 AD 03 27 LDA $2703  [$7E:2703] A:0080 X:0062 Y:0000 P:eNvMxdizc - Load Target's Status Byte 1 into A.
$03/DE44 09 80 ORA #$80 A:0000 X:0062 Y:0000 P:envMxdiZc - Add 80 (Death) to A.
$03/DE46 8D 03 27 STA $2703  [$7E:2703] A:0080 X:0062 Y:0000 P:eNvMxdizc - Store A in Target's Status Byte 1.
$03/DE49 AD A0 29 LDA $29A0  [$7E:29A0] A:0080 X:0062 Y:0000 P:eNvMxdizc - Load A from 7E29A0.
$03/DE4C 85 A9 STA $A9    [$00:00A9] A:00A0 X:0062 Y:0000 P:eNvMxdizc - Store A in A9.
$03/DE4E 29 03 AND #$03 A:00A0 X:0062 Y:0000 P:eNvMxdizc - ??
$03/DE50 C9 03 CMP #$03 A:0000 X:0062 Y:0000 P:envMxdiZc - Is it 03?
$03/DE52 D0 03 BNE $03    [$DE57] A:0000 X:0062 Y:0000 P:eNvMxdizc - If not branch to 03DE57.
-----------------------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------------------
$03/DE57 7B TDC A:0000 X:0062 Y:0000 P:eNvMxdizc - Transfer Direct Page.
$03/DE58 AA TAX A:0000 X:0062 Y:0000 P:envMxdiZc - Transfer A to X.
$03/DE59 86 AB STX $AB    [$00:00AB] A:0000 X:0000 Y:0000 P:envMxdiZc - Store X into AB.
$03/DE5B 18 CLC A:0000 X:0000 Y:0000 P:envMxdiZc - Clear Carry Flag.
-------------------------------------(Looping Point)-------------------------------------------------------------------------
$03/DE5C BD B5 29 LDA $29B5,x[$7E:29B5] A:0000 X:0000 Y:0000 P:envMxdiZc - Load A from Monster Type.
$03/DE5F 30 04 BMI $04    [$DE65] A:0000 X:0000 Y:0000 P:envMxdiZc - Branch if Minus to 03DE65.
--------------------------------------------------------------------------------------------------------------------------------------------
$03/DE61 65 AB ADC $AB    [$00:00AB] A:0000 X:0000 Y:0000 P:envMxdiZc - Add ?+1? to AB.
$03/DE63 85 AB STA $AB    [$00:00AB] A:0000 X:0000 Y:0000 P:envMxdiZc - Store A in AB.
-----------------------------------------------------------------------------------------------------------------------------------------------
$03/DE65 E8 INX A:0000 X:0000 Y:0000 P:envMxdiZc - +1 to X.
$03/DE66 E0 08 00 CPX #$0008 A:0000 X:0001 Y:0000 P:envMxdizc - Has it cycled through the eight monster slots?
$03/DE69 D0 F1 BNE $F1    [$DE5C] A:0000 X:0001 Y:0000 P:eNvMxdizc - If not loop back to 03DE5C.
$03/DE6B A5 AB LDA $AB    [$00:00AB] A:00FF X:0008 Y:0000 P:envMxdiZC - Load A from AB.
$03/DE6D D0 43 BNE $43    [$DEB2] A:0002 X:0008 Y:0000 P:envMxdizC  - If not 00 go to 03DEB2.
---------------------------------------------------------------------------------------------------------------------------------------------------------

--------------------------------------------------------------------------------------------------------------------------------------------------------
$03/DEB2 A9 01 LDA #$01 A:0002 X:0008 Y:0000 P:envMxdizC - Load 01 into A.
$03/DEB4 85 B1 STA $B1    [$00:00B1] A:0001 X:0008 Y:0000 P:envMxdizC - Store A in B1.
$03/DEB6 1A INC A A:0001 X:0008 Y:0000 P:envMxdizC - +1 to A
$03/DEB7 85 B2 STA $B2    [$00:00B2] A:0002 X:0008 Y:0000 P:envMxdizC - Store A in B2.
$03/DEB9 20 AD DF JSR $DFAD  [$03:DFAD] A:0002 X:0008 Y:0000 P:envMxdizC - Jump to Subroutine (A routine which seems to systematically kill all monsters?)
$03/DEBC 7B TDC A:0000 X:0680 Y:0008 P:envMxdiZC - Transfer Direct Page
$03/DEBD AA TAX A:0000 X:0680 Y:0008 P:envMxdiZC - Transfer A to X.
$03/DEBE 86 8A STX $8A    [$00:008A] A:0000 X:0000 Y:0008 P:envMxdiZC - Store X in 8A.
$03/DEC0 A5 A9 LDA $A9    [$00:00A9] A:0000 X:0000 Y:0008 P:envMxdiZC - Load A from A9.
$03/DEC2 29 C0 AND #$C0 A:00A0 X:0000 Y:0008 P:eNvMxdizC -  -40?
$03/DEC4 20 82 84 JSR $8482  [$03:8482] A:0080 X:0000 Y:0008 P:eNvMxdizC - Jump to Dividing Subroutine.
$03/DEC8 86 8C STX $8C    [$00:008C] A:0002 X:0002 Y:0008 P:envMxdizc - Store X in 8C.
------------------------------------------------------------------------------------------(Looping Point)
$03/DECA A9 00 LDA #$00 A:0002 X:0002 Y:0008 P:envMxdizc - Load 00 into A.
$03/DECC 20 5C DF JSR $DF5C  [$03:DF5C] A:0000 - Jump to Routine (Seems to make a new monster fit for battle)
$03/DECF C6 8C DEC $8C    [$00:008C] A:0040 X:000A Y:0019 P:envMxdizc - Decrease the value in 8C by 1.
$03/DED1 A5 8C LDA $8C    [$00:008C] A:0040 X:000A Y:0019 P:envMxdizc - Load A from 8C.
$03/DED3 D0 F5 BNE $F5    [$DECA] A:0001 X:000A Y:0019 P:envMxdizc  - Branch if 00? If not loop back to DECA.
$03/DED5 4C 5B DF JMP $DF5B  [$03:DF5B] A:0000 X:000C Y:000C P:envMxdiZc - Jump to Routine (A one byte routine which is just an RTS, the routine ends here.)
-------------------------------------------------------------------------------------------------------------------------------------------------------


What a mouthful this routine is... I thought it would be as easy as "Kill Self, summon monster" but there's a lot more moving parts to it than that, likely because of the intricacies in bringing back six monsters in Calbrena to Cal and Brena.

End Battle Routine

Code: [Select]
$03/DFCF A9 04 LDA #$04 A:0003 X:0064 Y:0000 P:envMxdizc - Load 04 (End Battle) into A.
$03/DFD1 8D A8 00 STA $00A8  [$7E:00A8] A:0004 X:0064 Y:0000 P:envMxdizc - Store A in Battle Determination.
$03/DFD4 60 RTS A:0004 X:0064 Y:0000 P:envMxdizc - Return

Search Routine

Code: [Select]
$03/DFD5 A5 CE LDA $CE    [$00:00CE] A:0003 X:0066 Y:0000 P:envMxdizc - Load A from Target's Slot.
$03/DFD7 A8 TAY A:0080 X:0066 Y:0000 P:eNvMxdizc - Transfer A to Y.
$03/DFD8 A5 CD LDA $CD    [$00:00CD] A:0080 X:0066 Y:0080 P:envMxdizc - Load A from User's Slot.
$03/DFDA 29 7F AND #$7F A:0000 X:0066 Y:0080 P:envMxdiZc - Reduce it to 00?
$03/DFDC AA TAX A:0000 X:0066 Y:0080 P:envMxdiZc - Transfer A to X.
$03/DFDD A9 00 LDA #$00 A:0000 X:0000 Y:0080 P:envMxdiZc - Load A from 00.
$03/DFDF 38 SEC A:0000 X:0000 Y:0080 P:envMxdiZc - Set Carry Flag.
--------------------------------------------------------(Looping Point)
$03/DFE0 6A ROR A A:0000 X:0000 Y:0080 P:envMxdiZC - Divide A by 2.
$03/DFE1 88 DEY A:0080 X:0000 Y:0080 P:eNvMxdizc - -1 to Y.
$03/DFE2 10 FC BPL $FC    [$DFE0] A:0080 X:0000 Y:007F P:envMxdizc - Branch if Positive to 03DFE0.
$03/DFE4 9D 83 38 STA $3883,x[$7E:3883] A:0020 X:0000 Y:FFFF P:eNvMxdizc - Store A in 7E3883.
$03/DFE7 60 RTS A:0020 X:0000 Y:FFFF P:eNvMxdizc - Return

This Routine takes a random enemy, puts that into targeting (CD) and then demands its own targeting to follow that enemy on their next turn. Worthless for PC's because they can switch it manually.

Hatch Routine
Code: [Select]
$03/DFE8 AD 05 27 LDA $2705  [$7E:2705] A:0003 X:0068 Y:0000 P:envMxdizc - Load Target's Status Byte 3 into A.
$03/DFEB 29 DF AND #$DF A:0000 X:0068 Y:0000 P:envMxdiZc - -20 (Egg)
$03/DFED 8D 05 27 STA $2705  [$7E:2705] A:0000 X:0068 Y:0000 P:envMxdiZc - Store A in Target's Status Byte 3.
$03/DFF0 A5 CD LDA $CD    [$00:00CD] A:0000 X:0068 Y:0000 P:envMxdiZc - Load A from CD.
$03/DFF2 29 7F AND #$7F A:0000 X:0068 Y:0000 P:envMxdiZc - Add 7F?
$03/DFF4 AA TAX A:0000 X:0068 Y:0000 P:envMxdiZc - Transfer A to X.
$03/DFF5 BD B5 29 LDA $29B5,x[$7E:29B5] A:0000 X:0000 Y:0000 P:envMxdiZc - Load A from 1st Monster on List.
$03/DFF8 AA TAX A:0000 X:0000 Y:0000 P:envMxdiZc - Transfer A to X.
$03/DFF9 9E D0 38 STZ $38D0,x[$7E:38D0] A:0000 X:0000 Y:0000 P:envMxdiZc - Store Zero in 7E38D0.
$03/DFFC 60 RTS A:0000 X:0000 Y:0000 P:envMxdiZc - Return.

Curiously enough it will not work if a player tries to use it. I'm not sure why that is.

Something Happens to Adult Rydia  Routine

Code: [Select]
$03/DFFD 7B TDC A:0003 X:006A Y:0000 P:envMxdizc - Transfer Direct Page.
$03/DFFE AA TAX A:0000 X:006A Y:0000 P:envMxdiZc - Transfer A to X.
$03/DFFF 86 A9 STX $A9    [$00:00A9] A:0000 X:0000 Y:0000 P:envMxdiZc - Store X in A9.
------------------------------------------(Looping Point)----------------------------------------------------------------------------
$03/E001 BD 00 20 LDA $2000,x[$7E:2000] A:0000 X:0000 Y:0000 P:envMxdiZc - Load Character ID.
$03/E004 29 1F AND #$1F A:0081 X:0000 Y:0000 P:eNvMxdizc - (removes the 80)
$03/E006 C9 11 CMP #$11 A:0001 X:0000 Y:0000 P:envMxdizc - Is it Adult Rydia?
$03/E008 F0 07 BEQ $07    [$E011] A:0001 X:0000 Y:0000 P:eNvMxdizc - If so branch to 03E011.
$03/E00A 20 BC 85 JSR $85BC  [$03:85BC] A:0001 X:0000 Y:0000 P:eNvMxdizc - Jump to Subroutine (Safe exchange of X index +80)
$03/E00D E6 A9 INC $A9    [$00:00A9] A:0000 X:0080 Y:0000 P:envMxdiZc - Add 1 to A9.
$03/E00F 80 F0 BRA $F0    [$E001] A:0000 X:0080 Y:0000 P:envMxdizc - Loop back to E001. - Continue looking for Rydia.
$03/E011 A5 A9 LDA $A9    [$00:00A9] A:0011 X:A500 Y:0000 P:envMxdiZC - Load A from A9.
$03/E013 20 89 84 JSR $8489  [$03:8489] A:004A X:A500 Y:0000 P:envMxdizC - Jump to Subroutine (Timing Routine?)
$03/E016 A9 03 LDA #$03 A:0000 X:5340 Y:0000 P:envMxdizc - Load 03 into A
$03/E018 20 69 85 JSR $8569  [$03:8569] A:0003 X:5340 Y:0000 P:envMxdizc - Jump to Subroutine (Possibly something to do with a Status Timer?)
$03/E01E A9 0A LDA #$0A A:0006 X:0615 Y:0000 P:envMxdizc - Load 0A into A.
$03/E020 9D 04 2A STA $2A04,x[$7E:3019] A:000A X:0615 Y:0000 P:envMxdizc - Store A in 7E3019.
$03/E023 9E 05 2A STZ $2A05,x[$7E:301A] A:000A X:0615 Y:0000 P:envMxdizc - Store Zero in 7E301A.
$03/E026 9E 06 2A STZ $2A06,x[$7E:301B] A:000A X:0615 Y:0000 P:envMxdizc - Store Zero in 7E301B.
$03/E029 EE E4 38 INC $38E4  [$7E:38E4] A:000A X:0615 Y:0000 P:envMxdizc - +1 to 7E38E4.
$03/E02C 60 RTS A:000A X:0615 Y:0000 P:envMxdizc - Return
-----------------------------------------------------------------------------------

Now this is a really strange one. Apparently it is another formula that looks for a specific character (and again that character is Rydia). That battle formation has to hide Rydia somehow in a manner that I don't fully understand. It looks to put some sort of status on her and keep her hidden from sight and then removes all timers attached to her. What this routine seems to say is that Rydia is always actually in the battle, just not present. Hmm...

But for now that is all but one of the Routines (Yousei handled those I didn't go over long ago) aside from Heal (because it's apparently nearly 200 Bytes long!) I'll get to that eventually. For now I should see if I can use any of this newfound knowledge on Commands.


 :edit: 1/10/14 Added a bit of information about how Search works.



« Last Edit: January 10, 2014, 02:05:31 PM by Grimoire LD »

Deathlike2

  • Moderator
  • *
  • Posts: 3,538
  • I'm looking at you, bitch!
    • View Profile
Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
« Reply #66 on: September 26, 2013, 02:19:15 AM »
Counter Routine

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.

Well, it's a straight damage attack powered by your actual weapon power... it's the basic idea that I made for a hack that replaced the godawful Goblin's Punch to the same concept that was used in FF5 (the FF4 version is technically better... plus it's great for a hack).


Damage, Poison (Venom, Poison) Routine.

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.

If you could find the damage algo, that would be greatly appreciated.

Odin Routine


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.

I haven't really figured out the level check, but it is more prevalent in the GBA port than it is the SNES ports.

Count Routine

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.

Count is Reflectable... and has serious bugs in its design. Try it and you'll see really weird stuff with the ATB.

Recover 1/10 - Recover 1/3 Target's HP (Remedy/Absorb) Routines

Another bizarre reference to Target Strength, again it seems to automatically make the damage recovered 9999. This may have been in earlier plans or something. Since it can't be seen in the normal game and there is no logical way of activating it just like with Explode. It is interesting to see a Routine inside of a Routine in the form of Absorb though.

I'm trying to recall if there were monsters that used Remedy (1/10 of maxHP) that weren't boss monsters.. I know there are a number of monsters that use Absorb (1/3 of maxHP) that aren't bosses...

I don't think there's any monster that manipulates its Attack Power though (it's hard to recall at this hour)... but something like the "monster that has no image" might be the one. It has the max attack power set to it (like the Dark Elf YOU FOOLS version). I've kinda envisioned that monster to be the one where you convert the 2-handed Crystal Sword to a one-handed version. That would make for an interesting battle.

Search Routine

I don't know what to make of this routine, honestly. Using it as if it were a spell didn't appear to do much of anything to monster targeting.

It's supposed to set the monster's next target to the one previously chosen by Search. That's why the TrapDoors have the giveaway secret to Reflect.

It is also used by the Last Arm for Reflect... but also changes the "Target All" of its Fission attack (self-explode, damage everyone) to whoever that target was. It's only good for the enemy that uses it, but I suspect you can manipulate it for the same thing Golbez uses.

Quote
Hatch Routine

Curiously enough it will not work if a player tries to use it. I'm not sure why that is.

Hatch applies to the monster that uses it and has the status. It is the only reaction to damage in virtually any battle script.

Quote
Something Happens to Adult Rydia  Routine

Now this is a really strange one. Apparently it is another formula that looks for a specific character (and again that character is Rydia). That battle formation has to hide Rydia somehow in a manner that I don't fully understand. It looks to put some sort of status on her and keep her hidden from sight and then removes all timers attached to her. What this routine seems to say is that Rydia is always actually in the battle, just not present. Hmm...

But for now that is all but one of the Routines (Yousei handled those I didn't go over long ago) aside from Heal (because it's apparently nearly 200 Bytes long!) I'll get to that eventually. For now I should see if I can use any of this newfound knowledge on Commands.

The status is most likely Hide (the same one Edward uses), because the animation isn't really all that special (the unhiding part, which is to show up in the battle).
Working on the next Yet To Be Named FF4 "Hardtype" Hack Download Latest: v1.48

Video Demos: #1 #2 #3

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
« Reply #67 on: September 26, 2013, 07:49:54 AM »
Well, it's a straight damage attack powered by your actual weapon power... it's the basic idea that I made for a hack that replaced the godawful Goblin's Punch to the same concept that was used in FF5 (the FF4 version is technically better... plus it's great for a hack).

I never thought about fixing Goblin Punch to make it unique with this formula but it makes a good deal sense now that I think about it. Using level comparisons to boost damage x8 or so. Good thinking there.



If you could find the damage algo, that would be greatly appreciated.

Where to start... I know there are several formulas which are basically "damage determination", but even with physical attacks I saw no reference to a character's Physical Attack Base. Only to their chance to hit for several matters. That is worth further exploration.


I haven't really figured out the level check, but it is more prevalent in the GBA port than it is the SNES ports.

Really? I thought it was pretty unyielding here. It took roughly 10 casts from a Level 1 Rydia to kill a group of Level 5 Larva with it. It's even worse in the GBA Port then?



Count is Reflectable... and has serious bugs in its design. Try it and you'll see really weird stuff with the ATB.

I don't doubt it. It may be fundamentally flawed with monsters and thereby virtually unusable in many respects.

I'm trying to recall if there were monsters that used Remedy (1/10 of maxHP) that weren't boss monsters.. I know there are a number of monsters that use Absorb (1/3 of maxHP) that aren't bosses...

I don't think there's any monster that manipulates its Attack Power though (it's hard to recall at this hour)... but something like the "monster that has no image" might be the one. It has the max attack power set to it (like the Dark Elf YOU FOOLS version). I've kinda envisioned that monster to be the one where you convert the 2-handed Crystal Sword to a one-handed version. That would make for an interesting battle.

I'm not sure what enemies use Remedy either. 10% HP doesn't seem very... good. However that is a misconception with Absorb (I even noticed this using my Twin Healing Hack) what it heals is 1/3 of the Target's Current HP. Not Max HP. So if you're down to 60 you would heal 20 regardless of your Max HP and the code backs that up as well. I do know that no monsters seem to have a programmed "Strength" stat. So if these were ever in their plans to use effectively it likely dealt with the player or maybe monster layout was difference once upon a time?

That is a Really neat idea for that unused monster slot to have been involved with making the Crystal Sword 1-Handed. Setting that scenario up with an event doesn't seem to be that difficult either. And I think I know where such an event may have possibly been planned to take place... There's a blank wall in the Lunar Subterrane 4th Floor that has a Trigger set that leads to a Glitch World (As the second to last map) The wall is quite inconspicuous in the first place. So there may be something to that theory.


It's supposed to set the monster's next target to the one previously chosen by Search. That's why the TrapDoors have the giveaway secret to Reflect.

It is also used by the Last Arm for Reflect... but also changes the "Target All" of its Fission attack (self-explode, damage everyone) to whoever that target was. It's only good for the enemy that uses it, but I suspect you can manipulate it for the same thing Golbez uses.

Indeed, that's what I had expected to see. I tried it on my characters but still monsters attacked them at random rather than set to attack the one that had Search used. Golbez uses targets from within his script to directly target the party members for Black Fang. Maybe it's only special attacks. I was fighting against a group of enemies which never did anything special so that could have been the problem.


Hatch applies to the monster that uses it and has the status. It is the only reaction to damage in virtually any battle script.

You're likely right but there's still one unknown to that still. The monster is listed as "Egg" while inside of an Egg, which is probably what some of that code has a hand in changing to its proper name, now that I think on it.

The status is most likely Hide (the same one Edward uses), because the animation isn't really all that special (the unhiding part, which is to show up in the battle).

That makes a great deal of sense! But that must mean that there is special code which not only Hides Rydia for that battle but also makes her name and HP invisible as well. These are all worthy of another glance.

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Grimoire LD's Notes, Methods, and Hacks (All Spells Disassembly)
« Reply #68 on: September 26, 2013, 09:40:10 AM »
Damage Determination Routine

Code: [Select]

$03/C9AF AE 02 39 LDX $3902  [$7E:3902] A:0018 X:0000 Y:0000 P:envMxdizC - Load Caster's Current Attack Power into X.
$03/C9B2 8E 56 39 STX $3956  [$7E:3956] A:0018 X:000D Y:0000 P:envMxdizC - Store X in 7E3956.
$03/C9B5 8E 58 39 STX $3958  [$7E:3958] A:0018 X:000D Y:0000 P:envMxdizC - Store X in 7E3958.
$03/C9B8 4E 57 39 LSR $3957  [$7E:3957] A:0018 X:000D Y:0000 P:envMxdizC - Divide the value in 7E3957 by 2.
$03/C9BB 6E 56 39 ROR $3956  [$7E:3956] A:0018 X:000D Y:0000 P:envMxdiZc - Divide the Value in 7E3956 by 2.
$03/C9BE AD 57 39 LDA $3957  [$7E:3957] A:0018 X:000D Y:0000 P:envMxdizC - Load A from 7E3957.
$03/C9C1 F0 06 BEQ $06    [$C9C9] A:0000 X:000D Y:0000 P:envMxdiZC - If 00 branch to 03C9C9.
-----------------------------------------------------------------------------------------------------------------------------------------------

-------------------------------------------------------------------------------------------------------------------------------------------------
$03/C9C9 7B TDC A:0000 X:000D Y:0000 P:envMxdiZC - Transfer Direct Page
$03/C9CA AA TAX A:0000 X:000D Y:0000 P:envMxdiZC - Transfer A to X.
$03/C9CB AD 56 39 LDA $3956  [$7E:3956] A:0000 X:0000 Y:0000 P:envMxdiZC - Load A from 7E3956. (Where stored Attack Power /2 is.)
$03/C9CE 20 79 83 JSR $8379  [$03:8379] A:0006 X:0000 Y:0000 P:envMxdizC - Jump to Subroutine. (Generate Random Number. Not sure between what, 0 and 6 possibly?
$03/C9D1 AA TAX A:0005 X:0000 Y:0000 P:envMxdizc - Transfer A to X.
$03/C9D2 8E 56 39 STX $3956  [$7E:3956] A:0005 X:0005 Y:0000 P:envMxdizc - Store X in 7E3956 (New Stored Attack Power Variable?)
$03/C9D5 20 E3 84 JSR $84E3  [$03:84E3] A:0005 X:0005 Y:0000 P:envMxdizc - Jump to Subroutine (Adds random number with Physical Attack Power)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/84E3 C2 20 REP #$20 A:0002 X:0002 Y:0000 P:envMxdizc - Reset Processor Status (making X 1 byte, if I'm not mistaken)
$03/84E5 18 CLC A:0002 X:0002 Y:0000 P:envmxdizc - Clear Carry Flag.
$03/84E6 AD 56 39 LDA $3956  [$7E:3956] A:0002 X:0002 Y:0000 P:envmxdizc - Load Previously generated number into A.
$03/84E9 6D 58 39 ADC $3958  [$7E:3958] A:0002 X:0002 Y:0000 P:envmxdizc - Add the value in 7E3958 (Critical Hit Bonus) into A.
$03/84EC 8D 5A 39 STA $395A  [$7E:395A] A:000F X:0002 Y:0000 P:envmxdizc - Store A in 7E395A.
$03/84EF A9 00 00 LDA #$0000 A:000F X:0002 Y:0000 P:envmxdizc - Load 0000 into A?
$03/84F2 69 00 00 ADC #$0000 A:0000 X:0002 Y:0000 P:envmxdiZc - Add 0000 into A?
$03/84F5 8D 5C 39 STA $395C  [$7E:395C] A:0000 X:0002 Y:0000 P:envmxdiZc - Store A in 7E395C.
$03/84F8 7B TDC A:0000 X:0002 Y:0000 P:envmxdiZc - Transfer Direct Page.
$03/84F9 E2 20 SEP #$20 A:0000 X:0002 Y:0000 P:envmxdiZc Set Processor Status. (Makes X indexes back to 2 bytes, I think)
$03/84FB 60 RTS A:0000 X:0002 Y:0000 P:envMxdiZc - Return
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/C9D8 AE 5A 39 LDX $395A  [$7E:395A] A:0000 X:0002 Y:0000 P:envMxdiZc - Load the value in 7E395A into X ( (0-(Attack Power /2)) + Physical Attack Power)
$03/C9DB 86 A4 STX $A4    [$00:00A4] A:0000 X:000F Y:0000 P:envMxdizc - Store X in A4.
$03/C9DD AD FE 38 LDA $38FE  [$7E:38FE] A:0000 X:000F Y:0000 P:envMxdizc - Load 7E38FE into A.
$03/C9E0 20 51 CA JSR $CA51  [$03:CA51] A:0002 X:000F Y:0000 P:envMxdizc - Jump to Subroutine.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/CA51 D0 05 BNE $05    [$CA58] A:0002 X:000F Y:0000 P:envMxdizc - Branch if not 00 to 03CA58.
------------------------------------------------------------------------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------------------------------------------------------------------------
$03/CA58 4A LSR A A:0002 X:000F Y:0000 P:envMxdizc - Divide the value in A by 2.
$03/CA59 D0 05 BNE $05    [$CA60] A:0001 X:000F Y:0000 P:envMxdizc -  Branch if not 00 to 03CA60.
----------------------------------------------------------------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------------------------------------------------------------
$03/CA60 AA TAX A:0001 X:000F Y:0000 P:envMxdizc - Transfer A to X.
$03/CA61 8E 3D 39 STX $393D  [$7E:393D] A:0001 X:0001 Y:0000 P:envMxdizc - Store X in 7E393D.
$03/CA64 A6 A4 LDX $A4    [$00:00A4] A:0001 X:0001 Y:0000 P:envMxdizc - Load X from A4
$03/CA66 8E 3F 39 STX $393F  [$7E:393F] A:0001 X:000F Y:0000 P:envMxdizc - Store X in 7E393F.
$03/CA69 20 B9 83 JSR $83B9  [$03:83B9] A:0001 X:000F Y:0000 P:envMxdizc - Jump to Subroutine.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/83B9 C2 20 REP #$20 A:0001 X:000F Y:0000 P:envMxdizc - Reset Processor Status
$03/83BB A2 10 00 LDX #$0010 A:0001 X:000F Y:0000 P:envmxdizc - Load 0010 into X.
$03/83BE 9C 41 39 STZ $3941  [$7E:3941] A:0001 X:0010 Y:0000 P:envmxdizc - Store Zero in 7E3941.
$03/83C1 9C 43 39 STZ $3943  [$7E:3943] A:0001 X:0010 Y:0000 P:envmxdizc - Store Zero in 7E3943.
-------------------------------------------------------------------------------(Looping Point)--------------------------------------------------------
$03/83C4 6E 3F 39 ROR $393F  [$7E:393F] A:0001 X:0010 Y:0000 P:envmxdizc - Divide value in 7E393F by 2.
$03/83C7 90 0A BCC $0A    [$83D3] A:0001 X:0010 Y:0000 P:envmxdizC - Branch and carry flag if 00 to 0383D3.
$03/83C9 18 CLC A:0001 X:0010 Y:0000 P:envmxdizC - Claer Carry Flag.
$03/83CA AD 3D 39 LDA $393D  [$7E:393D] A:0001 X:0010 Y:0000 P:envmxdizc - Load 7E393D into A.
$03/83CD 6D 43 39 ADC $3943  [$7E:3943] A:0001 X:0010 Y:0000 P:envmxdizc - Add 1 to 7E3943.
$03/83D0 8D 43 39 STA $3943  [$7E:3943] A:0001 X:0010 Y:0000 P:envmxdizc - Store A in 7E3943.
$03/83D3 6E 43 39 ROR $3943  [$7E:3943] A:0001 X:0010 Y:0000 P:envmxdizc - Divide value in 7E3943 by 2.
$03/83D6 6E 41 39 ROR $3941  [$7E:3941] A:0001 X:0010 Y:0000 P:envmxdiZC - Divide value in 7E3941 by 2.
$03/83D9 CA DEX A:0001 X:0010 Y:0000 P:eNvmxdizc - -1 to X.
$03/83DA D0 E8 BNE $E8    [$83C4] A:0001 X:000F Y:0000 P:envmxdizc - If X = 00 pass, otherwise loop back to 7E83C4.
$03/83DC 7B TDC A:0001 X:0000 Y:0000 P:envmxdiZc - Transfer Direct Page.
$03/83DD E2 20 SEP #$20 A:0000 X:0000 Y:0000 P:envmxdiZc - Set Processor Status.
$03/83DF 60 RTS A:0000 X:0000 Y:0000 P:envMxdiZc - Return
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/CA6C AE 41 39 LDX $3941  [$7E:3941] A:0000 X:0000 Y:0000 P:envMxdiZc - Load X from 7E3941 (which appears to still be the ( (0-(Attack Power /2)) + Physical Attack Power))
$03/CA6F 86 A4 STX $A4    [$00:00A4] A:0000 X:000F Y:0000 P:envMxdizc - Store it in A4 (which I believe is damage and healing matters)
$03/CA71 60 RTS A:0000 X:000F Y:0000 P:envMxdizc - Return
----------------------------------------------------------------------------------------------------------------------------------------------------------

That only appears to be part of it because this number here doesn't actually correspond 100% with the damage done. It may be the base damage before taking Multipliers and Defense into Effect. In some instances I see it dealing a little more or a little less damage than displayed (except where Multipliers are involved than it's x2 the shown amount roughly. Now this seems to be how the game reaches any damage quota... (before multipliers and the like) - Base Attack Power + 0-1/2 of Base Attack Power = Raw Attack Damage.

This does seem to be the end of this routine anyhow. I know Magic also is taken through this same pattern as well (there must be some marked differences though, I haven't really explored it too well) and after this there is another routine that seems to do something similar... ish.

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 (All Spells Disassembly)
« Reply #69 on: September 26, 2013, 11:46:24 AM »
Grimoire - AND is a bitwise comparison command.
When the game ANDs, it compares the bits of the value specified with those of the register in question.
So, if A is 1C (00011100) and you AND it with 38 (00111000), the result will be whichever "ones" are held in common - in this case, 00011000, or 18.
If you AND with 7F (01111111), as mentioned a few times above, the result will be zero if and only if the register starts as 80 (10000000).
 :edit: oops - or if the register is 00. Sorry.
AND is used quite a bit in displaying monster images, so I had to figure this out for what I was working on. Hope this helps.
« Last Edit: September 26, 2013, 03:10:44 PM by chillyfeez »

Deathlike2

  • Moderator
  • *
  • Posts: 3,538
  • I'm looking at you, bitch!
    • View Profile
Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
« Reply #70 on: September 26, 2013, 01:16:11 PM »
Well, it's a straight damage attack powered by your actual weapon power... it's the basic idea that I made for a hack that replaced the godawful Goblin's Punch to the same concept that was used in FF5 (the FF4 version is technically better... plus it's great for a hack).

I never thought about fixing Goblin Punch to make it unique with this formula but it makes a good deal sense now that I think about it. Using level comparisons to boost damage x8 or so. Good thinking there.

It wasn't about the damage bonus... it was to use Rydia's "poor" attack power and converting that into damage through a summon. It would actually help through using a Bow+Arrow over a Whip.

Quote
Where to start... I know there are several formulas which are basically "damage determination", but even with physical attacks I saw no reference to a character's Physical Attack Base. Only to their chance to hit for several matters. That is worth further exploration.

I kinda meant the damage dealt algo through Poison....


Quote
Really? I thought it was pretty unyielding here. It took roughly 10 casts from a Level 1 Rydia to kill a group of Level 5 Larva with it. It's even worse in the GBA Port then?

Well, the Black Flan (Pudding) in this game are at level 50... whereas the GBA port's version is @ level 98. Although, levels are likely altered to counter Steal, not nerf Odin.


Quote
I'm not sure what enemies use Remedy either. 10% HP doesn't seem very... good. However that is a misconception with Absorb (I even noticed this using my Twin Healing Hack) what it heals is 1/3 of the Target's Current HP. Not Max HP. So if you're down to 60 you would heal 20 regardless of your Max HP and the code backs that up as well. I do know that no monsters seem to have a programmed "Strength" stat. So if these were ever in their plans to use effectively it likely dealt with the player or maybe monster layout was difference once upon a time?

I meant to use 1/3 of currentHP. In my hack I have Asura set up to regular healing, Remedy healing (1/10 maxHP) (purple face), and Absorb healing (1/3 currentHP) (yellow/orange mad face).

Quote
Indeed, that's what I had expected to see. I tried it on my characters but still monsters attacked them at random rather than set to attack the one that had Search used. Golbez uses targets from within his script to directly target the party members for Black Fang. Maybe it's only special attacks. I was fighting against a group of enemies which never did anything special so that could have been the problem.

You would have to manipulate ALL of the monsters on the field's targeting... since the code probably alters "self" (meaning the lone monster) on the field.


Quote
You're likely right but there's still one unknown to that still. The monster is listed as "Egg" while inside of an Egg, which is probably what some of that code has a hand in changing to its proper name, now that I think on it.

It is tied to a few things, so you'd have to track down the details. You could probably manipulate it for actual Pigs, Toads, and Mini if you were clever.

Working on the next Yet To Be Named FF4 "Hardtype" Hack Download Latest: v1.48

Video Demos: #1 #2 #3

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
« Reply #71 on: September 27, 2013, 12:13:23 AM »
@Chillyfeez - Thanks Chillyfeez! I had not taken bit operands into account whatsoever for AND's. That is really great knowledge and will help me understand the concepts a bit better now.

It wasn't about the damage bonus... it was to use Rydia's "poor" attack power and converting that into damage through a summon. It would actually help through using a Bow+Arrow over a Whip.

Oh yeah! I recall now getting that in your hack and finding it quite useful to take out foes with decent magic defense with her. I do think the Whips are in desperate need of help though. But its not like we can't modify most aspects of a weapon nowadays anyhow.


I kinda meant the damage dealt algo through Poison....

Oh... well I did find the normal damage formula and recorded it down to the best of my ability. Poison routine is a bit of a mystery. I'm not sure where to start digging to find it. Unless you meant the 1/8 damage it deals to the character and how to change that (if possible, I already have a sneaking suspicion its run through the same bit of code that Dark Wave is ran through...

And I am correct.  The game gets to that 1/8 damage through that LSR A we've seen before at 038485.



Well, the Black Flan (Pudding) in this game are at level 50... whereas the GBA port's version is @ level 98. Although, levels are likely altered to counter Steal, not nerf Odin.

Ether farming, if memory serves right is probably the reason for that, yeah. "Let's make a marginally useful skill completely worthless!" I rather like my idea of changing the byte to always steal the 1/64 drop, thereby having (for all intents and purposes) steal-only items.


I meant to use 1/3 of currentHP. In my hack I have Asura set up to regular healing, Remedy healing (1/10 maxHP) (purple face), and Absorb healing (1/3 currentHP) (yellow/orange mad face).

That's a good use of the formulas actually.

You would have to manipulate ALL of the monsters on the field's targeting... since the code probably alters "self" (meaning the lone monster) on the field.

Hmm, there might be something there. It seemingly makes no direct reference to Target or Caster though and just reduces a value until it reaches FF. But the Search skill does actually work by targeting another character, it must be a mess of things then.


It is tied to a few things, so you'd have to track down the details. You could probably manipulate it for actual Pigs, Toads, and Mini if you were clever.

Haha, quite a bit of work I would imagine.

Hmm, I need to think about what to look up next. I should probably take another look at commands but this Regen thing is really bothering me... it may not be possible for it to recover MP by the way the game is set up unfortunately.

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Grimoire LD's Notes, Methods, and Hacks (All Spells Disassembly)
« Reply #72 on: September 27, 2013, 10:49:58 AM »
(Mostly) Full Fight Routine -

Code: [Select]
$03/C499 9C C7 34 STZ $34C7  [$7E:34C7] A:0003 X:0000 Y:0000 P:envMxdizc - Store Zero in 7E34C7
$03/C49C 9C E1 38 STZ $38E1  [$7E:38E1] A:0003 X:0000 Y:0000 P:envMxdizc - Store Zero in 7E38E1.
$03/C49F 7B TDC A:0003 X:0000 Y:0000 P:envMxdizc - Transfer Direct Page.
$03/C4A0 AA TAX A:0000 X:0000 Y:0000 P:envMxdiZc - Transfer A to X.
$03/C4A1 8E 96 28 STX $2896  [$7E:2896] A:0000 X:0000 Y:0000 P:envMxdiZc - Store X in 7E2896
$03/C4A4 A5 CD LDA $CD    [$00:00CD] A:0000 X:0000 Y:0000 P:envMxdiZc - Load A from CD (Unit ID when a monster it appears)
$03/C4A6 30 0F BMI $0F    [$C4B7] A:0080 X:0000 Y:0000 P:eNvMxdizc - Branch if Minus to 03C4B7 (Which it seems it will be if a Monster attacks)
------------------------------------------------------------------------------------------------------------------------------------------------
$03/C4A8 A9 F8 LDA #$F8 A:0000 X:0000 Y:0000 P:envMxdiZc - Load F8 into A.
$03/C4AA 8D C6 33 STA $33C6  [$7E:33C6] A:00F8 X:0000 Y:0000 P:eNvMxdizc - Store A in 7E33C6.
$03/C4AD A9 04 LDA #$04 A:00F8 X:0000 Y:0000 P:eNvMxdizc - Load 04 into A.
$03/C4AF 8D C7 33 STA $33C7  [$7E:33C7] A:0004 X:0000 Y:0000 P:envMxdizc - Store A in 7E33C7.
$03/C4B2 20 24 C9 JSR $C924  [$03:C924] A:0004 X:0000 Y:0000 P:envMxdizc - Jump to Subroutine
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/C924 AD 83 26 LDA $2683  [$7E:2683] A:0004 X:0000 Y:0000 P:envMxdizc - Load Caster's Status Byte 1.
$03/C927 29 30 AND #$30 A:0000 X:0000 Y:0000 P:envMxdiZc - Are they inflicted with Small or Toad?
$03/C929 D0 6B BNE $6B    [$C996] A:0000 X:0000 Y:0000 P:envMxdiZc - If so branch to 03C996.
$03/C92B A5 CD LDA $CD    [$00:00CD] A:0000 X:0000 Y:0000 P:envMxdiZc - Load A from CD.
$03/C92D 20 89 84 JSR $8489  [$03:8489] A:0000 X:0000 Y:0000 P:envMxdiZc - Jump to Subroutine (Preparation? Subroutine)
$03/C930 18 CLC A:0000 X:0000 Y:0000 P:envMxdiZc - Clear Carry Flag
$03/C931 AD 32 35 LDA $3532  [$7E:3532] A:0000 X:0000 Y:0000 P:envMxdiZc - Load A from 7E3532
$03/C934 69 21 ADC #$21 A:0000 X:0000 Y:0000 P:envMxdiZc - Add 21 to A.
$03/C936 85 A9 STA $A9    [$00:00A9] A:0021 X:0000 Y:0000 P:envMxdizc - Store A in A9.
$03/C938 AD 33 35 LDA $3533  [$7E:3533] A:0021 X:0000 Y:0000 P:envMxdizc - Load A from 7E3553.
$03/C93B 69 00 ADC #$00 A:0000 X:0000 Y:0000 P:envMxdiZc - Add 00 into A.
$03/C93D 85 AA STA $AA    [$00:00AA] A:0000 X:0000 Y:0000 P:envMxdiZc - Store A in AA.
$03/C93F 7B TDC A:0000 X:0000 Y:0000 P:envMxdiZc - Transfer Direct Page.
$03/C940 A8 TAY A:0000 X:0000 Y:0000 P:envMxdiZc - Transfer A to Y.
$03/C941 84 AB STY $AB    [$00:00AB] A:0000 X:0000 Y:0000 P:envMxdiZc - Store Y in a AB.
$03/C943 8D E3 38 STA $38E3  [$7E:38E3] A:0000 X:0000 Y:0000 P:envMxdiZc - Store A in 7E38E3.
$03/C946 A6 A9 LDX $A9    [$00:00A9] A:0000 X:0000 Y:0000 P:envMxdiZc - Load X from A9.
$03/C948 BD 86 27 LDA $2786,x[$7E:27A7] A:0000 X:0021 Y:0000 P:envMxdizc - Load A from 7E27A7. (Equip Index?)
$03/C94B 29 40 AND #$40 A:0015 X:0021 Y:0000 P:envMxdizc - If not 40 or none of the bits align change to lowered number
$03/C94D F0 03 BEQ $03    [$C952] A:0000 X:0021 Y:0000 P:envMxdiZc - If 00 branch to 03C952.
--------------------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------------------
$03/C952 BD 91 27 LDA $2791,x[$7E:27B2] A:0000 X:0021 Y:0000 P:envMxdiZc - Load A from 7E27B2. (Equip Index?)
$03/C955 29 40 AND #$40 A:0015 X:0021 Y:0000 P:envMxdizc - If not 40 (as above)
$03/C957 F0 09 BEQ $09    [$C962] A:0000 X:0021 Y:0000 P:envMxdiZc - Branch if 00 to 03C962.
---------------------------------------------------------------------------------------------------------------------------

-------------------------------------------------------------------------------------------------------------------------------
$03/C962 A5 CD LDA $CD    [$00:00CD] A:0000 X:0021 Y:0000 P:envMxdiZc - Load A from CD.
$03/C964 20 7E 84 JSR $847E  [$03:847E] A:0000 X:0021 Y:0000 P:envMxdiZc - Jump to Subroutine (Multiplying x6 Subroutine)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/847E 0A ASL A A:0000 X:0021 Y:0000 P:envMxdiZc - x2 to A.
$03/847F 0A ASL A A:0000 X:0021 Y:0000 P:envMxdiZc - x2 to A
$03/8480 0A ASL A A:0000 X:0021 Y:0000 P:envMxdiZc - x2 to A
$03/8481 60 RTS A:0000 X:0021 Y:0000 P:envMxdiZc - Return
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/C967 AA TAX A:0000 X:0021 Y:0000 P:envMxdiZc - Transfer A to X.
$03/C968 98 TYA A:0000 X:0000 Y:0000 P:envMxdiZc - Transfer Y to A.
$03/C969 F0 2B BEQ $2B    [$C996] A:0000 X:0000 Y:0000 P:envMxdiZc - If 00 branch to 03C996.
------------------------------------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------------------------------------
$03/C996 60 RTS A:0000 X:0000 Y:0000 P:envMxdiZc - Return
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/C4B5 80 54 BRA $54    [$C50B] A:0000 X:0000 Y:0000 P:envMxdiZc - Branch to 03C50B.
---------------------------------------------------------------------------------------------------------------------------------------------------
$03/C4B7 AD 01 36 LDA $3601  [$7E:3601] A:0080 X:0000 Y:0000 P:eNvMxdizc - Load A from 7E3601
$03/C4BA C9 FF CMP #$FF A:00FF X:0000 Y:0000 P:eNvMxdizc - Is it FF?
$03/C4BC F0 10 BEQ $10    [$C4CE] A:00FF X:0000 Y:0000 P:envMxdiZC - If so branch to 03C4BC,
----------------------------------------------------------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------------------------------------------------------------
$03/C4CE 7B TDC A:00FF X:0000 Y:0000 P:envMxdiZC - Transfer Direct Page
$03/C4CF AA TAX A:0000 X:0000 Y:0000 P:envMxdiZC - Transfer A to X.
$03/C4D0 A8 TAY A:0000 X:0000 Y:0000 P:envMxdiZC - Transfer A to Y.
-------------------------------------------------------------(Looping Point) ---------------------------------------------
$03/C4D1 BD C2 33 LDA $33C2,x[$7E:33C2] A:0000 X:0000 Y:0000 P:envMxdiZC -  Load A from 7E33C2.
$03/C4D4 99 9C 28 STA $289C,y[$7E:289C] A:00C0 X:0000 Y:0000 P:eNvMxdizC - Store A in 7E289C.
$03/C4D7 C9 FF CMP #$FF A:00C0 X:0000 Y:0000 P:eNvMxdizC - Is it FF?
$03/C4D9 F0 04 BEQ $04    [$C4DF] A:00C0 X:0000 Y:0000 P:eNvMxdizc - If not branch to 03C4DF
-------------------------------------------------------------------------------------------------------------------------------
$03/C4DB E8 INX A:00C0 X:0000 Y:0000 P:eNvMxdizc - +1 to X.
$03/C4DC C8 INY A:00C0 X:0001 Y:0000 P:envMxdizc - +1 to Y.
$03/C4DD 80 F2 BRA $F2    [$C4D1] A:00C0 X:0001 Y:0001 P:envMxdizc - Loop back to 03C4D1.
$03/C4DF 7B TDC A:00FF X:0001 Y:0001 P:envMxdiZC - Transfer Direct Page
$03/C4E0 AA TAX A:0000 X:0001 Y:0001 P:envMxdiZC - Transfer A to X.
$03/C4E1 A8 TAY A:0000 X:0000 Y:0001 P:envMxdiZC - Transfer A to Y.
$03/C4E2 BD 9C 28 LDA $289C,x[$7E:289C] A:0000 X:0000 Y:0000 P:envMxdiZC - Load A from 7E289C.
$03/C4E5 99 C2 33 STA $33C2,y[$7E:33C2] A:00C0 X:0000 Y:0000 P:eNvMxdizC - Store A in 7E33C2.
$03/C4E8 C9 FF CMP #$FF A:00C0 X:0000 Y:0000 P:eNvMxdizC - Is it FF?
$03/C4EA F0 1F BEQ $1F    [$C50B] A:00C0 X:0000 Y:0000 P:eNvMxdizc - If so, branch to 03C50B.
$03/C4EC C9 C0 CMP #$C0 A:00C0 X:0000 Y:0000 P:eNvMxdizc - Is it C0?
$03/C4EE F0 08 BEQ $08    [$C4F8] A:00C0 X:0000 Y:0000 P:envMxdiZC - If so branch to C4F8.
-------------------------------------------------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------------------------------------------------
$03/C4F8 C8 INY A:00C0 X:0000 Y:0000 P:envMxdiZC - +1 to Y
$03/C4F9 8C 96 28 STY $2896  [$7E:2896] A:00C0 X:0000 Y:0001 P:envMxdizC - Store Y in 7E2896.
$03/C4FC A9 F8 LDA #$F8 A:00C0 X:0000 Y:0001 P:envMxdizC - Load A from F8

$03/C50B 64 C7 STZ $C7    [$00:00C7] A:00FF X:0001 Y:0003 P:envMxdiZC
$03/C4FE 99 C2 33 STA $33C2,y[$7E:33C3] A:00F8 X:0000 Y:0001 P:eNvMxdizC - Store A in 7E33C3 (Audiovisual Code?)
$03/C501 C8 INY A:00F8 X:0000 Y:0001 P:eNvMxdizC - Increase Y by 1.
$03/C502 A9 04 LDA #$04 A:00F8 X:0000 Y:0002 P:envMxdizC - Load 04 into A.
$03/C504 99 C2 33 STA $33C2,y[$7E:33C4] A:0004 X:0000 Y:0002 P:envMxdizC - Store A in 7E33C4
$03/C507 E8 INX A:0004 X:0000 Y:0002 P:envMxdizC - Increment X
$03/C508 C8 INY A:0004 X:0001 Y:0002 P:envMxdizC  - Increment Y
$03/C509 80 D7 BRA $D7    [$C4E2] A:0004 X:0001 Y:0003 P:envMxdizC - Branch Always to 03C4E2
-------------------------------------------------------------------------------------------------------------------------------------------------------
$03/C50B 64 C7 STZ $C7    [$00:00C7] A:00FF X:0001 Y:0003 P:envMxdiZC - Store Zero in C7.
$03/C50D 9C FC 38 STZ $38FC  [$7E:38FC] A:00FF X:0001 Y:0003 P:envMxdiZC - Store Zero in 7E38FC.
$03/C510 AD 9C 26 LDA $269C  [$7E:269C] A:00FF X:0001 Y:0003 P:envMxdiZC - Load A from Caster's Physical Attack Percentage (Chance to Hit)
$03/C513 8D F8 38 STA $38F8  [$7E:38F8] A:004B X:0001 Y:0003 P:envMxdizC - Store A in 7E38F8 (Apparently used to store accuracy.)
$03/C516 AD 83 26 LDA $2683  [$7E:2683] A:004B X:0001 Y:0003 P:envMxdizC - Load A from Caster's Status Byte 1.
$03/C519 29 02 AND #$02 A:0000 X:0001 Y:0003 P:envMxdiZC - Is it Darkness?
$03/C51B F0 03 BEQ $03    [$C520] A:0000 X:0001 Y:0003 P:envMxdiZC - If not branch to 03C520.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/C51D 4E F8 38 LSR $38F8  [$7E:38F8] A:0002 X:0000 Y:0000 P:envMxdizc - Divide Accuracy by 2.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/C520 AD 81 26 LDA $2681  [$7E:2681] A:0002 X:0000 Y:0000 P:envMxdizc - Load Caster's Class and Row (specifically Row)
$03/C523 10 11 BPL $11    [$C536] A:0000 X:0000 Y:0000 P:envMxdiZc - If the number is positive branch to 03C536 (This will only happen if they are in the front row.)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/C525 AD 81 26 LDA $2681  [$7E:2681] A:0080 X:0000 Y:0000 P:eNvMxdizc - Load Caster's Class and Row
$03/C528 29 20 AND #$20 A:0080 X:0000 Y:0000 P:eNvMxdizc - Is it Long Ranged?
$03/C52A D0 0A BNE $0A    [$C536] A:0000 X:0000 Y:0000 P:envMxdiZc - Long Range Check - If successful branch to 03C536
$03/C52C AD 85 26 LDA $2685  [$7E:2685] A:0000 X:0000 Y:0000 P:envMxdiZc - Load Status Byte 3.
$03/C52F 29 02 AND #$02 A:0000 X:0000 Y:0000 P:envMxdiZc - Is it Jump?
$03/C531 D0 03 BNE $03    [$C536] A:0000 X:0000 Y:0000 P:envMxdiZc - If so branch to 03C536
$03/C533 4E F8 38 LSR $38F8  [$7E:38F8] A:0000 X:0000 Y:0000 P:envMxdiZc - Divide Accuracy by 2.
--------------------------------------------------------------------------------------------------------------------------------------------------
$03/C536 A5 CD LDA $CD    [$00:00CD] A:0000 X:0000 Y:0000 P:envMxdiZc - Load CD into A.
$03/C538 29 7F AND #$7F A:0000 X:0000 Y:0000 P:envMxdiZc - ??
$03/C53A D0 19 BNE $19    [$C555] A:0000 X:0000 Y:0000 P:envMxdiZc - If so branch 03C555
$03/C53C AD F8 38 LDA $38F8  [$7E:38F8] A:0000 X:0000 Y:0000 P:envMxdiZc - Load Accuracy.
$03/C53F 85 DF STA $DF    [$00:00DF] A:004D X:0000 Y:0000 P:envMxdizc - Store Accuracy in DF.
$03/C541 A9 05 LDA #$05 A:004D X:0000 Y:0000 P:envMxdizc - Load 05 into A.
$03/C543 85 E1 STA $E1    [$00:00E1] A:0005 X:0000 Y:0000 P:envMxdizc - Store A in E1.
$03/C545 20 E0 83 JSR $83E0  [$03:83E0] A:0005 X:0000 Y:0000 P:envMxdizc - Cleaning Routine.
$03/C548 46 E4 LSR $E4    [$00:00E4] A:0000 X:0000 Y:0000 P:envMxdiZc - Reduce Accuracy Copy by 1/2
$03/C54A 66 E3 ROR $E3    [$00:00E3] A:0000 X:0000 Y:0000 P:envMxdiZC - ??
$03/C54C 46 E4 LSR $E4    [$00:00E4] A:0000 X:0000 Y:0000 P:eNvMxdizC - Reduce Accuracy Copy by 1/2
$03/C54E 66 E3 ROR $E3    [$00:00E3] A:0000 X:0000 Y:0000 P:envMxdiZc - ??
$03/C550 A5 E3 LDA $E3    [$00:00E3] A:0000 X:0000 Y:0000 P:envMxdizc -?Load New Accuracy, now with +1/4 of its base accuracy?
$03/C552 8D F8 38 STA $38F8  [$7E:38F8] A:0060 X:0000 Y:0000 P:envMxdizc - Store the new Accuracy in the Accuracy slot of data altering fields.
$03/C555 AD 01 27 LDA $2701  [$7E:2701] A:0060 X:0000 Y:0000 P:envMxdizc - Load Target's Class and Row
$03/C558 10 11 BPL $11    [$C56B] A:0000 X:0000 Y:0000 P:envMxdiZc - If it is less than 80 (If you are in the Front Row)  branch to 03C56B.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/C55A AD 81 26 LDA $2681  [$7E:2681] A:0080 X:0000 Y:0003 P:eNvMxdizc - Load Caster's class/row/Long Range
$03/C55D 29 20 AND #$20 A:0080 X:0000 Y:0003 P:eNvMxdizc  - Is it Long Range?
$03/C55F D0 0A BNE $0A    [$C56B] A:0000 X:0000 Y:0003 P:envMxdiZc - If so branch to 03C56B.
$03/C561 AD 85 26 LDA $2685  [$7E:2685] A:0000 X:0000 Y:0003 P:envMxdiZc - Load Caster's Status Byte 3.
$03/C564 29 02 AND #$02 A:0000 X:0000 Y:0003 P:envMxdiZc - Is it Jump?
$03/C566 D0 03 BNE $03    [$C56B] A:0000 X:0000 Y:0003 P:envMxdiZc - If so branch to 03C56B.
$03/C568 4E F8 38 LSR $38F8  [$7E:38F8] A:0000 X:0000 Y:0003 P:envMxdiZc - Divide Accuracy by 2.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/C56B AD F8 38 LDA $38F8  [$7E:38F8] A:0000 X:0000 Y:0003 P:envMxdizc - Load Accuracy from Accuracy slot of data altering fields.
$03/C56E 8D FA 38 STA $38FA  [$7E:38FA] A:0019 X:0000 Y:0003 P:envMxdizc - Store Accuracy in another slot.
$03/C571 AD 9B 26 LDA $269B  [$7E:269B] A:0019 X:0000 Y:0003 P:envMxdizc - Load Caster's Physical Attack Multiplier
$03/C574 8D FB 38 STA $38FB  [$7E:38FB] A:0001 X:0000 Y:0003 P:envMxdizc - Store A in 7E38FB (Data altering field)
$03/C577 20 97 C9 JSR $C997  [$03:C997] A:0001 X:0000 Y:0003 P:envMxdizc - Jump out of Routine. (Not sure what this one is doing.)
$03/C57A AD FD 38 LDA $38FD  [$7E:38FD] A:0039 X:0000 Y:0000 P:envMxdiZC - Load A from 7E38FD
$03/C57D 8D F8 38 STA $38F8  [$7E:38F8] A:0000 X:0000 Y:0000 P:envMxdiZC - Store A in Accuracy Altering Field?
$03/C580 A5 CE LDA $CE    [$00:00CE] A:0000 X:0000 Y:0000 P:envMxdiZC -  Load A from CE (Appears to be Target's Class... or something)
$03/C582 10 05 BPL $05    [$C589] A:0000 X:0000 Y:0000 P:envMxdiZC  - Branch if Plus to 03C589
--------------------------------------------
$03/C584 29 7F AND #$7F A:0081 X:0000 Y:0000 P:eNvMxdizC - ??
$03/C586 18 CLC A:0001 X:0000 Y:0000 P:envMxdizC - Clear the Carry Flag
$03/C587 69 05 ADC #$05 A:0001 X:0000 Y:0000 P:envMxdizc - Add 5 to A.
----------------------------------------------
$03/C589 20 89 84 JSR $8489  [$03:8489] A:0000 X:0000 Y:0000 P:envMxdiZC - Jump to a Cleaning or Time Routine.
$03/C58C AD 06 27 LDA $2706  [$7E:2706] A:0000 X:0900 Y:0000 P:envMxdizc  - Load Target's Status Anomalies (Byte 4) into A from Data Copy.
$03/C58F 29 10 AND #$10 A:0000 X:0900 Y:0000 P:envMxdiZc - Is it Barrier or Covered?
$03/C591 D0 18 BNE $18    [$C5AB] A:0000 X:0900 Y:0000 P:envMxdiZc - If so Branch to 03C5AB.
$03/C593 AD 06 27 LDA $2706  [$7E:2706] A:0000 X:0900 Y:0000 P:envMxdiZc - Load Target's Status Anomalies (Byte 4) into A from Data Copy.
$03/C596 29 0C AND #$0C A:0000 X:0900 Y:0000 P:envMxdiZc - Does it have Image 1 or 2?
$03/C598 F0 15 BEQ $15    [$C5AF] A:0000 X:0900 Y:0000 P:envMxdiZc - If not Branch to 03C5AF.
---------------------------------------------------------------------------------------------------------------------------------------
$03/C59A 4A LSR A A:000C X:0000 Y:0000 P:envMxdizc - Divide the value in A by 2.
$03/C59B 29 04 AND #$04 A:0006 X:0000 Y:0000 P:envMxdizc - Load 04 into A?
$03/C59D 85 A9 STA $A9    [$00:00A9] A:0004 X:0000 Y:0000 P:envMxdizc - Store A in A9
$03/C59F A6 A6 LDX $A6    [$00:00A6] A:0004 X:0000 Y:0000 P:envMxdizc - Load X from A6.
$03/C5A1 BD 06 20 LDA $2006,x[$7E:2006] A:0004 X:0000 Y:0000 P:envMxdiZc - Load A into Character/Monster Status Byte 3 (thereby decrementing Image)
$03/C5A4 29 F3 AND #$F3 A:000C X:0000 Y:0000 P:envMxdizc - ??
$03/C5A6 05 A9 ORA $A9    [$00:00A9] A:0000 X:0000 Y:0000 P:envMxdiZc - Load the value in A9 into A?
$03/C5A8 9D 06 20 STA $2006,x[$7E:2006] A:0004 X:0000 Y:0000 P:envMxdizc - Store A in Character/Monster Status Byte 3 (Isn't that done above? Why repeat it here?)
$03/C5AB A9 FF LDA #$FF A:0004 X:0000 Y:0000 P:envMxdizc - Load FF into A.
$03/C5AD 80 4B BRA $4B    [$C5FA] A:00FF X:0000 Y:0000 P:eNvMxdizc - Branch Always to 03C5FA.
-----------------------------------------------------------------------------------------------------------------------------------------------
$03/C5AF AD 29 27 LDA $2729  [$7E:2729] A:0000 X:0900 Y:0000 P:envMxdiZc - Load Target's Evasion "Defense Percentage" from Copy Data.
$03/C5B2 8D F9 38 STA $38F9  [$7E:38F9] A:0016 X:0000 Y:0000 P:envMxdizc - Store it in 7E38F9 (Altering field)
$03/C5B5 AD 03 27 LDA $2703  [$7E:2703] A:0016 X:0000 Y:0000 P:envMxdizc - Load Target's Status Byte 1 from Copy Data
$03/C5B8 29 02 AND #$02 A:0000 X:0000 Y:0000 P:envMxdiZc - Is it Darkness?
$03/C5BA F0 03 BEQ $03    [$C5BF] A:0000 X:0000 Y:0000 P:envMxdiZc -If not branch to 03C5BF
----------------------------------------------------------------------------------------------------------------------------------------------
$03/C5BC 4E F9 38 LSR $38F9  [$7E:38F9] A:0002 X:0000 Y:0000 P:envMxdizc - Reduce Evasion by half.
$03/C5BF A5 CE LDA $CE    [$00:00CE] A:0002 X:0000 Y:0000 P:envMxdizc - Load A from CE.
--------------------------------------------------------------------------------------------------------------------------------------------------
$03/C5C1 29 7F AND #$7F A:0000 X:0000 Y:0000 P:envMxdiZc - Add A from 7F?
$03/C5C3 D0 19 BNE $19    [$C5DE] A:0000 X:0000 Y:0000 P:envMxdiZc - ?If so? branch to 03C5DE.
$03/C5C5 AD F9 38 LDA $38F9  [$7E:38F9] A:0000 X:0000 Y:0000 P:envMxdiZc - Load Evasion from Altered Field
$03/C5C8 85 DF STA $DF    [$00:00DF] A:000B X:0000 Y:0000 P:envMxdizc - Store A in DF.
$03/C5CA A9 05 LDA #$05 A:000B X:0000 Y:0000 P:envMxdizc - Load 05 into A.
$03/C5CC 85 E1 STA $E1    [$00:00E1] A:0005 X:0000 Y:0000 P:envMxdizc - Store A in E1
$03/C5CE 20 E0 83 JSR $83E0  [$03:83E0] A:0005 X:0000 Y:0000 P:envMxdizc - Jump out of routine.
$03/C5D1 46 E4 LSR $E4    [$00:00E4] A:0000 X:0000 Y:0000 P:envMxdiZc - ?? (They're all clearly reducing amounts at E4 and E3 by a substantial amount, but not sure of the purpose in doing so. As above it may be a routine to add +1/4 to evasion which begs the question what is the point of the +1/4 if both sides get it anyhow?)
$03/C5D3 66 E3 ROR $E3    [$00:00E3] A:0000 X:0000 Y:0000 P:envMxdiZc - ??
$03/C5D5 46 E4 LSR $E4    [$00:00E4] A:0000 X:0000 Y:0000 P:envMxdizC - ??
$03/C5D7 66 E3 ROR $E3    [$00:00E3] A:0000 X:0000 Y:0000 P:envMxdiZc - ??
$03/C5D9 A5 E3 LDA $E3    [$00:00E3] A:0000 X:0000 Y:0000 P:envMxdizC - ??
$03/C5DB 8D F9 38 STA $38F9  [$7E:38F9] A:000D X:0000 Y:0000 P:envMxdizC - Store Evasion.
$03/C5DE AD F9 38 LDA $38F9  [$7E:38F9] A:000D X:0000 Y:0000 P:envMxdizC - Load Evasion into A
$03/C5E1 8D FA 38 STA $38FA  [$7E:38FA] A:000D X:0000 Y:0000 P:envMxdizC - Store Evasion into 38FA?
$03/C5E4 AD 28 27 LDA $2728  [$7E:2728] A:000D X:0000 Y:0000 P:envMxdizC - Load Physical Defense Multiplier
$03/C5E7 8D FB 38 STA $38FB  [$7E:38FB] A:0003 X:0000 Y:0000 P:envMxdizC - Store it into 38FB.
$03/C5EA AD 03 27 LDA $2703  [$7E:2703] A:0003 X:0000 Y:0000 P:envMxdizC - Load Status Byte 1 from Character/Monster.
$03/C5ED 29 30 AND #$30 A:0002 X:0000 Y:0000 P:envMxdizC - Is it Toad or Mini?
$03/C5EF F0 03 BEQ $03    [$C5F4] A:0000 X:0000 Y:0000 P:envMxdiZC - If not branch to 03C5F4.
---------------------------------------------------------------------------------------------------------------------------------------------
$03/C5F1 9C FB 38 STZ $38FB  [$7E:38FB] A:0030 X:0000 Y:0000 P:envMxdizC - Store zero into Defense Multiplier.
---------------------------------------------------------------------------------------------------------------------------------------------------
$03/C5F4 20 97 C9 JSR $C997  [$03:C997] A:0030 X:0000 Y:0000 P:envMxdizC - Jump out of routine.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/C997 9C FD 38 STZ $38FD  [$7E:38FD] A:0030 X:0000 Y:0000 P:envMxdizC - Store Zero into 7E38FD.
$03/C99A AD FB 38 LDA $38FB  [$7E:38FB] A:0030 X:0000 Y:0000 P:envMxdizC - Load 7E38FB into A.
$03/C99D F0 0F BEQ $0F    [$C9AE] A:0000 X:0000 Y:0000 P:envMxdiZC - (Not sure how it is passed. Sometimes it is, sometimes it isn't.)
---------------------------------------------------------------------------------------------------------------------------------------------------
$03/C99F A8 TAY A:0001 X:0000 Y:0000 P:envMxdizc - Transfer A to Y.
$03/C9A0 20 8B 85 JSR $858B  [$03:858B] A:0001 X:0000 Y:0001 P:envMxdizc - Jump to another subroutine. (I can't glean much useful information from within so it will be omitted)
$03/C9A3 CD FA 38 CMP $38FA  [$7E:38FA] A:0041 X:0000 Y:0001 P:envMxdizc - Compared 7E38FA with the value in A.
$03/C9A6 B0 03 BCS $03    [$C9AB] A:0041 X:0000 Y:0001 P:envMxdizC - If not equal branch to 03C9AB (Can't figure out how to access the rest from there.)
--------------------------------------------------------------------------------------
$03/C9AB 88 DEY A:0041 X:0000 Y:0001 P:envMxdizC - Decrement Y
$03/C9AC D0 F2 BNE $F2    [$C9A0] A:0041 X:0000 Y:0000 P:envMxdiZC -If the bit is set branch to 03C9A0.
$03/C9AE 60 RTS A:0000 X:0000 Y:0000 P:envMxdiZC - Return
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/C5F7 AD FD 38 LDA $38FD  [$7E:38FD] A:0000 X:0000 Y:0000 P:envMxdiZC - Load A from 7E38FD
$03/C5FA 8D F9 38 STA $38F9  [$7E:38F9] A:0000 X:0000 Y:0000 P:envMxdiZC - Store A into 7E38F9 (Which should be Evasion unless that check is already finished?)
$03/C5FD 38 SEC A:0000 X:0000 Y:0000 P:envMxdiZC - Set Carry Flag
$03/C5FE AD F8 38 LDA $38F8  [$7E:38F8] A:0000 X:0000 Y:0000 P:envMxdiZC - Load A from 7E38F8
$03/C601 ED F9 38 SBC $38F9  [$7E:38F9] A:0002 X:0000 Y:0000 P:envMxdizC - Subtract 1 from 7E38F9 (Evasion)
$03/C604 8D C8 34 STA $34C8  [$7E:34C8] A:0002 X:0000 Y:0000 P:envMxdizC - Store A in 7E34C8
$03/C607 8D FC 38 STA $38FC  [$7E:38FC] A:0002 X:0000 Y:0000 P:envMxdizC - Store A in 7E38FC
$03/C60A F0 02 BEQ $02    [$C60E] A:0003 X:0000 Y:0000 P:envMxdizC - If Carry Flag is not set branch to 03C60E
------------------------------------------------------------------------------------------------------------------------------------
$03/C60C B0 25 BCS $25    [$C633] A:0003 X:0000 Y:0000 P:envMxdizC - Branch if Carry is set to 03C633
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
$03/C633 A5 CE LDA $CE    [$00:00CE] A:0003 X:0000 Y:0000 P:envMxdizC - Load A from CE
$03/C635 10 05 BPL $05    [$C63C] A:0080 X:0000 Y:0000 P:eNvMxdizC - If the value is positive than jump to 03C63C.
------------------------------------------------------------------------------------------------------------------------------------------
$03/C637 AD 81 38 LDA $3881  [$7E:3881] A:0080 X:0000 Y:0000 P:eNvMxdizC - Load A from 7E3881
$03/C63A D0 D2 BNE $D2    [$C60E] A:0000 X:0000 Y:0000 P:envMxdiZC - If the value has a flag set go back to 03C60E
$03/C63C AD C7 34 LDA $34C7  [$7E:34C7] A:0000 X:0000 Y:0000 P:envMxdiZC - Load A from 7E34C7
$03/C63F 09 80 ORA #$80 A:0000 X:0000 Y:0000 P:envMxdiZC - Load 80 into A.
$03/C641 8D C7 34 STA $34C7  [$7E:34C7] A:0080 X:0000 Y:0000 P:eNvMxdizC - Store A in 7E34C7
$03/C644 A6 A6 LDX $A6    [$00:00A6] A:0080 X:0000 Y:0000 P:eNvMxdizC - Load the value in A6 into X
$03/C646 BD 04 20 LDA $2004,x[$7E:2304] A:0080 X:0300 Y:0000 P:envMxdizC - Load the value in Status Anomalies (Byte 2) into A.
$03/C649 85 A9 STA $A9    [$00:00A9] A:0000 X:0300 Y:0000 P:envMxdiZC - Store A in 00A9.
$03/C64B 29 F7 AND #$F7 A:0000 X:0300 Y:0000 P:envMxdiZC - ??
$03/C64D 9D 04 20 STA $2004,x[$7E:2304] A:0000 X:0300 Y:0000 P:envMxdiZC - Store A into 2004 (Eh? How could it have changed from here to there)
$03/C650 A9 02 LDA #$02 A:0000 X:0300 Y:0000 P:envMxdiZC - Load a 02 into A.
$03/C652 8D FE 38 STA $38FE  [$7E:38FE] A:0002 X:0300 Y:0000 P:envMxdizC - Store A at 7E38FE (presumably a data altering field x2 (Default) Power)
$03/C655 8D FF 38 STA $38FF  [$7E:38FF] A:0002 X:0300 Y:0000 P:envMxdizC - Store A at 7E38FF (as above)
$03/C658 AD 99 26 LDA $2699  [$7E:2699] A:0002 X:0300 Y:0000 P:envMxdizC - Load A from Caster's Attack Elemental Copy Data.
$03/C65B 8D 00 36 STA $3600  [$7E:3600] A:0008 X:0300 Y:0000 P:envMxdizC - Store A in 7E3600.
$03/C65E 2D 21 27 AND $2721  [$7E:2721] A:0008 X:0300 Y:0000 P:envMxdizC - Check the value of A against the Target's Very Weak Elemental.
$03/C661 F0 07 BEQ $07    [$C66A] A:0000 X:0300 Y:0000 P:envMxdiZC - Branch if there is no match to 03C66A.
--------------------------------------------------------------------------------------------------------------------------------
$03/C663 A9 08 LDA #$08 A:0008 X:0400 Y:0000 P:envMxdizC - Load a 08 into A.
$03/C665 8D FE 38 STA $38FE  [$7E:38FE] A:0008 X:0400 Y:0000 P:envMxdizC - Store A in 7E38FE (Presumably a data altering field - x4 Power)
$03/C668 80 2B BRA $2B    [$C695] A:0008 X:0400 Y:0000 P:envMxdizC - Always Branch to 7EC695.
--------------------------------------------------------------------------------------------------------------------------------
$03/C66A AD 99 26 LDA $2699  [$7E:2699] A:0000 X:0300 Y:0000 P:envMxdiZC - Load Caster's Attack Elemental from Data Copy into A.
$03/C66D 2D 20 27 AND $2720  [$7E:2720] A:0008 X:0400 Y:0000 P:envMxdizC - Check the value of A against the Target's Elemental Weakness.
$03/C670 F0 07 BEQ $07    [$C679] A:0008 X:0400 Y:0000 P:envMxdizC - Branch if there is no match to 03C66A.
-------------------------------------------------------------------------------------------------------------------------------
$03/C672 A9 04 LDA #$04 A:0008 X:0400 Y:0000 P:envMxdizC - Load 04 into A.
$03/C674 8D FE 38 STA $38FE  [$7E:38FE] A:0004 X:0400 Y:0000 P:envMxdizC Store it at 38FE (x2 Power)
$03/C677 80 1C BRA $1C    [$C695] A:0004 X:0400 Y:0000 P:envMxdizC - Always Branch to 03C695.
---------------------------------------------------------------------------------------------------------------------------------
$03/C679 AD 99 26 LDA $2699  [$7E:2699] A:0000 X:0000 Y:0000 P:envMxdiZC - Load Caster's Elemental Attack from Data Copy into A.
$03/C67C 2D 26 27 AND $2726  [$7E:2726] A:0000 X:0000 Y:0000 P:envMxdiZC - Check it against Target's Elemental Immunity.
$03/C67F F0 07 BEQ $07    [$C688] A:0000 X:0000 Y:0000 P:envMxdiZC - Branch if there is no match to 03C688.
----------------------------------------------------------------------------------------------------------------------------------
$03/C681 A9 00 LDA #$00 A:0008 X:0400 Y:0000 P:envMxdizC - Load 00 into A.
$03/C683 8D FE 38 STA $38FE  [$7E:38FE] A:0000 X:0400 Y:0000 P:envMxdiZC - Store A in 38FE (x0 Power=1 Damage no matter what)
$03/C686 80 0D BRA $0D    [$C695] A:0000 X:0400 Y:0000 P:envMxdiZC - Branch to 03C695.
------------------------------------------------------------------------------------------------------------------------------------
$03/C688 AD 99 26 LDA $2699  [$7E:2699] A:0000 X:0400 Y:0000 P:envMxdiZC - Load A from Caster's Elemental Attack Data in Data Copy.
$03/C68B 2D 25 27 AND $2725  [$7E:2725] A:0008 X:0400 Y:0000 P:envMxdizC - Check it against the Target's Resistance Byte in Data Copy.
$03/C68E F0 05 BEQ $05    [$C695] A:0008 X:0400 Y:0000 P:envMxdizC - Branch to 03C695 if there is no match.
-------------------------------------------------------------------------------------------------------------------------------------
$03/C690 A9 01 LDA #$01 A:0008 X:0400 Y:0000 P:envMxdizC - Load 01 into A.
$03/C692 8D FE 38 STA $38FE  [$7E:38FE] A:0001 X:0400 Y:0000 P:envMxdizC Store it in a damage altering field (x1 (1/2) Power
-----------------------------------------------------------------------------------------------------------------------------------
$03/C695 A5 CD LDA $CD    [$00:00CD] A:0000 X:0280 Y:0000 P:envMxdiZC - Seems to draw the current Caster's Class ID. If it's a monster it will always be Negative.
$03/C697 30 13 BMI $13    [$C6AC] A:0000 X:0280 Y:0000 P:envMxdiZC - Branch if Minus to 03C6AC.
$03/C699 A5 CE LDA $CE    [$00:00CE] A:0000 X:0280 Y:0000 P:envMxdiZC - ??
$03/C69B 10 20 BPL $20    [$C6BD] A:0080 X:0280 Y:0000 P:eNvMxdizC - Branch if not negative (it is, 80, -127) to 03C6BD
$03/C69D AD 9A 26 LDA $269A  [$7E:269A] A:0080 X:0280 Y:0000 P:eNvMxdizC - Load Attack Strong vs. Creature Type from Caster's Data Copy into A.
$03/C6A0 2D 40 27 AND $2740  [$7E:2740] A:0000 X:0280 Y:0000 P:envMxdiZC - Check it against the Target's Creature Type.
$03/C6A3 F0 18 BEQ $18    [$C6BD] A:0000 X:0280 Y:0000 P:envMxdiZC - Branch if there is no match, to 03C6BD
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/C6A5 A9 08 LDA #$08 A:0080 X:0400 Y:0000 P:eNvMxdizC - Load a 08 into A
$03/C6A7 8D FF 38 STA $38FF  [$7E:38FF] A:0008 X:0400 Y:0000 P:envMxdizC - Store A in 7E38FF for later presumably. (x4 Power)
$03/C6AA 80 11 BRA $11    [$C6BD] A:0008 X:0400 Y:0000 P:envMxdizC - Branch Always to 03C6BD.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/C6AC A5 CE LDA $CE    [$00:00CE] A:0082 X:0000 Y:0000 P:eNvMxdizC - ??
$03/C6AE 30 0D BMI $0D    [$C6BD] A:0000 X:0000 Y:0000 P:envMxdiZC - ??
$03/C6B0 AD C0 26 LDA $26C0  [$7E:26C0] A:0000 X:0000 Y:0000 P:envMxdiZC - Load Creature Type from Caster's Data Copy.
$03/C6B3 2D 27 27 AND $2727  [$7E:2727] A:0080 X:0000 Y:0000 P:eNvMxdizC - Check it against Strong vs. Creature Types in Target's Data Copy.
$03/C6B6 F0 05 BEQ $05    [$C6BD] A:0000 X:0000 Y:0000 P:envMxdiZC - If it is does not match than Jump to 03C6BD
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/C6B8 A9 01 LDA #$01 A:0080 X:0000 Y:0000 P:eNvMxdizC - Load 01 into A.
$03/C6BA 8D FF 38 STA $38FF  [$7E:38FF] A:0001 X:0000 Y:0000 P:envMxdizC - Store A in 7E38FF.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/C6BD 9C 00 39 STZ $3900  [$7E:3900] A:0000 X:0280 Y:0000 P:envMxdiZC
$03/C6C0 AD 9D 26 LDA $269D  [$7E:269D] A:0000 X:0400 Y:0000 P:envMxdiZC - Load Current Attack Base from Caster's Data Copy into A.
$03/C6C3 AA TAX A:0028 X:0400 Y:0000 P:envMxdizC - Transfer A to X.
$03/C6C4 8E 02 39 STX $3902  [$7E:3902] A:0028 X:0028 Y:0000 P:envMxdizC - Place the Attack Base 7E3902.
$03/C6C7 AD 84 26 LDA $2684  [$7E:2684] A:0028 X:0028 Y:0000 P:envMxdizC - Load Status Anomalies (Byte 2) from Caster's Data Copy into A.
$03/C6CA 29 04 AND #$04 A:0000 X:0028 Y:0000 P:envMxdiZC - Is the Status Berserk?
$03/C6CC F0 19 BEQ $19    [$C6E7] A:0000 X:0028 Y:0000 P:envMxdiZC - If not Jump to 03C6E7.
---------------------------------------------------------------------------------------------------------------------
03/C6CE 86 A9 STX $A9    [$00:00A9] A:0004 X:0028 Y:0000 P:envMxdizC - Store the X 0028 for later.
$03/C6D0 46 AA LSR $AA    [$00:00AA] A:0004 X:0028 Y:0000 P:envMxdizC - divide the value in AA by 2.
$03/C6D2 66 A9 ROR $A9    [$00:00A9] A:0004 X:0028 Y:0000 P:envMxdiZc - divide the value in A9 by 2
$03/C6D4 18 CLC A:0004 X:0028 Y:0000 P:envMxdizc - Clear Z Flag
$03/C6D5 AD 02 39 LDA $3902  [$7E:3902] A:0004 X:0028 Y:0000 P:envMxdizc - Load A from 7E3902
$03/C6D8 65 A9 ADC $A9    [$00:00A9] A:0028 X:0028 Y:0000 P:envMxdizc - Add the value from 00A9
$03/C6DA 8D 02 39 STA $3902  [$7E:3902] A:003C X:0028 Y:0000 P:envMxdizc - Store the new value in 7E3902
$03/C6DD AD 03 39 LDA $3903  [$7E:3903] A:003C X:0028 Y:0000 P:envMxdizc - Load A from 7E3903
$03/C6E0 65 AA ADC $AA    [$00:00AA] A:0000 X:0028 Y:0000 P:envMxdiZc - Add the value from 00AA
$03/C6E2 8D 03 39 STA $3903  [$7E:3903] A:0000 X:0028 Y:0000 P:envMxdiZc - Store the new value in 7E3903 (Berserk therefore gains 1 1/2 xdamage as DeathLike theorized)
$03/C6E5 80 0D BRA $0D    [$C6F4] A:0000 X:0028 Y:0000 P:envMxdiZc - Branch Always to 03C6F4...

(Continued in Next Post)

Because it is such an enormous post of code it needs two posts  in order to keep the originally first post (which will be made a directory for easy access) intact.
« Last Edit: October 09, 2013, 01:31:34 PM by Grimoire LD »

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Grimoire LD's Notes, Methods, and Hacks (All Spells Disassembly)
« Reply #73 on: September 27, 2013, 10:56:17 AM »
(Mostly) Full Fight Routine Continued -

Code: [Select]
------------------------------------------------------------------------------------------------------------------------
$03/C6E7 AD 85 26 LDA $2685  [$7E:2685] A:0000 X:0028 Y:0000 P:envMxdiZC - Load Status Anomalies (Byte 3) from Caster's Data Copy into A.
$03/C6EA 29 0A AND #$0A A:0008 X:0028 Y:0000 P:envMxdizC - Is it Jumping or Charging? (How it gleans this from 0A, I'm unsure. 08+02 does equal 0A though)
$03/C6EC F0 06 BEQ $06    [$C6F4] A:0008 X:0028 Y:0000 P:envMxdizC - If not jump to 03C6F4
--------------------------------------------------------------------------------------------------------------------------------
$03/C6EE 0E 02 39 ASL $3902  [$7E:3902] A:0008 X:0028 Y:0000 P:envMxdizC - Shift the value in 3902 (Attack Base) and make it x2
$03/C6F1 2E 03 39 ROL $3903  [$7E:3903] A:0008 X:0028 Y:0000 P:envMxdizc -  Do the same here?
-------------------------------------------------------------------------------------------------------------------------------
$03/C6F4 AD 84 26 LDA $2684  [$7E:2684] A:0008 X:0028 Y:0000 P:envMxdiZc - Load Status Anomalies (Byte 2) from Caster's Data Copy into A.
$03/C6F7 29 80 AND #$80 A:0000 X:0028 Y:0000 P:envMxdiZc - Is it Curse?
$03/C6F9 F0 06 BEQ $06    [$C701] A:0000 X:0028 Y:0000 P:envMxdiZc - If not Jump to 03C701
-------------------------------------------------------------------------------------------------------------------------------------
$03/C6FB 4E 03 39 LSR $3903  [$7E:3903] A:0080 X:0028 Y:0000 P:eNvMxdizc - Divide the value in 3903 by 2.
$03/C6FE 6E 02 39 ROR $3902  [$7E:3902] A:0080 X:0028 Y:0000 P:envMxdiZc - Divide the value in 3902 (Attack base) by 2.
-----------------------------------------------------------------------------------------------------------------------------------

Moves directly into Defense from here.

$03/C701 AD 2A 27 LDA $272A  [$7E:272A] A:0080 X:0028 Y:0000 P:envMxdizc - Load the Target's Physical Defense Base into A.
$03/C704 AA TAX A:0000 X:0028 Y:0000 P:envMxdiZc - Transfer A to X.
$03/C705 8E 04 39 STX $3904  [$7E:3904] A:0000 X:0000 Y:0000 P:envMxdiZc - Store X in 3904.
$03/C708 AD 01 27 LDA $2701  [$7E:2701] A:0000 X:0000 Y:0000 P:envMxdiZc -  Load the Target's Class/Row into A.
$03/C70B 10 06 BPL $06    [$C713] A:0000 X:0000 Y:0000 P:envMxdiZc - If this is a Positive, Jump to 03C713 (Not in Back Row)
-----------------------------------------------------------------------------------------------------------------------------------
$03/C70D 0E 04 39 ASL $3904  [$7E:3904] A:0080 X:0000 Y:0000 P:eNvMxdizC - Multiply the value in 3904 (Possibly evasion) by 2
$03/C710 2E 05 39 ROL $3905  [$7E:3905] A:0080 X:0000 Y:0000 P:envMxdiZc - Multiply the value in 3905 (Physical Defense) x2.
----------------------------------------------------------------------------------------------------------------------------------
$03/C713 AD 04 27 LDA $2704  [$7E:2704] A:0000 X:0000 Y:0000 P:envMxdiZc - Load Status Anomalies (Byte 2) from Target's Copy Data into A
$03/C716 29 80 AND #$80 A:0000 X:0000 Y:0000 P:envMxdiZc - Is it Curse?
$03/C718 F0 06 BEQ $06    [$C720] A:0000 X:0000 Y:0000 P:envMxdiZc - If not jump to 03C720
--------------------------------------------------------------------------------------------------------------------------------------
$03/C71A 4E 05 39 LSR $3905  [$7E:3903] A:0000 X:0000 Y:0000 P:eNvMxdizc - Divide the value in 3905 by 2.
$03/C71D 6E 04 39 ROR $3904  [$7E:3902] A:0000 X:0000 Y:0000 P:envMxdiZc - Divide the value in 3904 (Defense base) by 2.
-----------------------------------------------------------------------------------------------------------------------------------------
$03/C720 20 8B 85 JSR $858B  [$03:858B] A:0000 X:0000 Y:0000 P:envMxdiZc - Presumably Jump out of Routine (May be used for a random number generator)
$03/C723 CD AD 26 CMP $26AD  [$7E:26AD] A:0021 X:0000 Y:0000 P:envMxdizc - Does A match (or is lower than?) the Critical Hit Chance?
$03/C726 B0 0B BCS $0B    [$C733] A:0021 X:0000 Y:0000 P:envMxdizC - If the Branch Carry Flag was not set branch to 03C726.
--------------------------------------------------------------------------------------------------------------------
$03/C728 EE 00 39 INC $3900  [$7E:3900] A:0021 X:0000 Y:0000 P:eNvMxdizc - Increase the value in 7E3900 by 1.
$03/C72B A9 04 LDA #$04 A:0021 X:0000 Y:0000 P:envMxdizc - Load a 04 into A.
$03/C72D 0D C7 34 ORA $34C7  [$7E:34C7] A:0004 X:0000 Y:0000 P:envMxdizc - ?Load A from 7E34C7 (Add+80)?
$03/C730 8D C7 34 STA $34C7  [$7E:34C7] A:0084 X:0000 Y:0000 P:eNvMxdizc - Store A in 7E34C7.
----------------------------------------------------------------------------------------------------------------------
$03/C733 AD 05 27 LDA $2705  [$7E:2705] A:0021 X:0000 Y:0000 P:envMxdizC - Load Status Byte 3 from Target's Data.
$03/C736 29 10 AND #$10 A:0000 X:0000 Y:0000 P:envMxdiZC - Is the Target defending?
$03/C738 F0 06 BEQ $06    [$C740] A:0000 X:0000 Y:0000 P:envMxdiZC - If not branch to 7EC740
-----------------------------------------------------------------------------------------------------------------------
$03/C73A 0E 04 39 ASL $3904  [$7E:3904] A:0010 X:0000 Y:0000 P:envMxdizC - x2 Defense Base
$03/C73D 2E 05 39 ROL $3905  [$7E:3905] A:0010 X:0000 Y:0000 P:envMxdizc - x2 ?? (Reads 0 for Cecil currently)
------------------------------------------------------------------------------------------------------------------------
$03/C740 AD 05 27 LDA $2705  [$7E:2705] A:0000 X:0000 Y:0000 P:envMxdiZC - Load Status Byte 3 from Target's Data.
$03/C743 29 08 AND #$08 A:0010 X:0000 Y:0000 P:envMxdizc - Is the Target Charging?
$03/C745 F0 06 BEQ $06    [$C74D] A:0000 X:0000 Y:0000 P:envMxdiZc - If not branch to 03C74D
------------------------------------------------------------------------------------------------------------------------------------
$03/C747 4E 05 39 LSR $3905  [$7E:3905] A:0008 X:0000 Y:0000 P:envMxdizC - Divide Physical Defense by 2 (This is surprising if true...)
$03/C74A 6E 04 39 ROR $3904  [$7E:3904] A:0008 X:0000 Y:0000 P:envMxdiZc - Divide 3904 by 2. (Possibly Magic Defense)
-------------------------------------------------------------------------------------------------------------------------------------
$03/C74D AD 83 26 LDA $2683  [$7E:2683] A:0008 X:0000 Y:0000 P:envMxdizc - Load Status Byte 1 from Caster's data.
$03/C750 29 30 AND #$30 A:0000 X:0000 Y:0000 P:envMxdiZc - Is it Toad or Mini?
$03/C752 F0 09 BEQ $09    [$C75D] A:0000 X:0000 Y:0000 P:envMxdiZc - If not branch to 03C75D.
--------------------------------------------------------------------------------------------------------------------------------------
$03/C754 A2 01 00 LDX #$0001 A:0030 X:0000 Y:0000 P:envMxdizC - Load 01 into X
$03/C757 8E 02 39 STX $3902  [$7E:3902] A:0030 X:0001 Y:0000 P:envMxdizC - Store 1 in Attack Base
$03/C75A 9C 00 39 STZ $3900  [$7E:3900] A:0030 X:0001 Y:0000 P:envMxdizC - Store Zero in ?Attack Multiplier?
------------------------------------------------------------------------------------------------------------------------------------------
$03/C75D AD 03 27 LDA $2703  [$7E:2703] A:0030 X:0001 Y:0000 P:envMxdizC - Load Status Byte 1 from Target's Data
$03/C760 29 30 AND #$30 A:0000 X:0001 Y:0000 P:envMxdiZC - Is it Toad or Mini?
$03/C762 F0 0B BEQ $0B    [$C76F] A:0000 X:0001 Y:0000 P:envMxdiZC - If not branch to 03C76F.
--------------------------------------------------------------------------------------------------------------------------------------------
$03/C764 0E 02 39 ASL $3902  [$7E:3902] A:0030 X:0000 Y:0000 P:envMxdizC - Double Caster's Damage.
$03/C767 2E 03 39 ROL $3903  [$7E:3903] A:0030 X:0000 Y:0000 P:envMxdizc - Double ?? (Is a Zero for me at the moment)
$03/C76A 7B TDC A:0030 X:0000 Y:0000 P:envMxdiZc - ?Transfer Direct Page Accumulator?
$03/C76B AA TAX A:0000 X:0000 Y:0000 P:envMxdiZc - Transfer A to X
$03/C76C 8E 04 39 STX $3904  [$7E:3904] A:0000 X:0000 Y:0000 P:envMxdiZc Store X in 7E3904 (Possibly Magic Defense)
----------------------------------------------------------------------------------------------------------------------------------------
$03/C76F A9 01 LDA #$01 A:0000 X:0001 Y:0000 P:envMxdiZC - Load 01 into A
$03/C771 8D 06 39 STA $3906  [$7E:3906] A:0001 X:0000 Y:0000 P:envMxdizc - Store A in 7E3906
$03/C774 AD AE 26 LDA $26AE  [$7E:26AE] A:0001 X:0000 Y:0000 P:envMxdizc - Load Bonus Critical Hit Damage from Caster
$03/C777 8D 01 39 STA $3901  [$7E:3901] A:0000 X:0000 Y:0000 P:envMxdiZc - Store A in 7E3901 (Which I suppose is Critical Hit Bonus)
$03/C77A 20 AF C9 JSR $C9AF  [$03:C9AF] A:0000 X:0000 Y:0000 P:envMxdiZc - Jump out of Routine (Damage Routine)
$03/C77D AD 99 26 LDA $2699  [$7E:2699] A:0000 X:002B Y:0000 P:envMxdizc - Load Caster's Attack Elemental
$03/C780 29 40 AND #$40 A:0000 X:002B Y:0000 P:envMxdiZc  - Is it Drain Elemental?
$03/C782 D0 3C BNE $3C    [$C7C0] A:0000 X:002B Y:0000 P:envMxdiZc - If so branch to 03C7C0
$03/C784 A5 CE LDA $CE    [$00:00CE] A:0000 X:002B Y:0000 P:envMxdiZc - Load the value from CE into A.
$03/C786 20 72 CA JSR $CA72  [$03:CA72] A:0000 X:002B Y:0000 P:envMxdiZc - Jump out of routine. (Seems another kind of data cleaning routine)
$03/C789 BD D4 34 LDA $34D4,x[$7E:34D4] A:0000 X:0000 Y:0000 P:envMxdiZc - Load A from 7E34D4 - (Healing)
$03/C78C 1D D5 34 ORA $34D5,x[$7E:34D5] A:0000 X:0000 Y:0000 P:envMxdiZc - ?Add A from 7E34D5 ?
$03/C78F F0 23 BEQ $23    [$C7B4] A:0000 X:0000 Y:0000 P:envMxdiZc - If the Flag is not Set branch to 03C7B4
--------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/C7B4 A5 A4 LDA $A4    [$00:00A4] A:0000 X:0000 Y:0000 P:envMxdiZc - Load A from A4.
$03/C7B6 9D D4 34 STA $34D4,x[$7E:34D4] A:002B X:0000 Y:0000 P:envMxdizc - Store A in 7E34D4 (Healing)
$03/C7B9 A5 A5 LDA $A5    [$00:00A5] A:002B X:0000 Y:0000 P:envMxdizc - Load A from A5.
$03/C7BB 9D D5 34 STA $34D5,x[$7E:34D5] A:0000 X:0000 Y:0000 P:envMxdiZc - Store A in 7E34D5
$03/C7BE 80 4B BRA $4B    [$C80B] A:0000 X:0000 Y:0000 P:envMxdiZc - Always Branch to 03C80B
----------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/C7C0 A5 CE LDA $CE    [$00:00CE] A:0040 X:00AB Y:0000 P:envMxdizc - Load the value in CE into A
$03/C7C2 F0 27 BEQ $27    [$C7EB] A:0083 X:00AB Y:0000 P:eNvMxdizc - Branch if Carry is not Set to 03C7EB
$03/C7C4 AD 40 27 LDA $2740  [$7E:2740] A:0083 X:00AB Y:0000 P:eNvMxdizc  - Load Creature Type into A.
$03/C7C7 10 22 BPL $22    [$C7EB] A:0000 X:00AB Y:0000 P:envMxdiZc - Is it positive? If so branch to 03C7EB
--------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/C7C9 A5 CE LDA $CE    [$00:00CE] A:0080 X:0132 Y:0000 P:eNvMxdizc - Load the value in CE into A.
$03/C7CB 20 72 CA JSR $CA72  [$03:CA72] A:0083 X:0132 Y:0000 P:eNvMxdizc - Cleaning routine
$03/CA72 85 A9 STA $A9    [$00:00A9] A:0083 X:0132 Y:0000 P:eNvMxdizc - Store A in A9.
$03/C7CE A5 A4 LDA $A4    [$00:00A4] A:0010 X:0010 Y:0000 P:envMxdizc - Load A from A4.
$03/C7D0 9D D4 34 STA $34D4,x[$7E:34E4] A:0032 X:0010 Y:0000 P:envMxdizc - Store A in 7E34E4 (Damage)
$03/C7D3 A5 A5 LDA $A5    [$00:00A5] A:0032 X:0010 Y:0000 P:envMxdizc - Load A from A5.
$03/C7D5 09 80 ORA #$80 A:0001 X:0010 Y:0000 P:envMxdizc - Add a Heal Flag
$03/C7D7 9D D5 34 STA $34D5,x[$7E:34E5] A:0081 X:0010 Y:0000 P:eNvMxdizc - Store A in 7E34D5 (Store Healing Flag_
$03/C7DA A5 CD LDA $CD    [$00:00CD] A:0081 X:0010 Y:0000 P:eNvMxdizc - Load the value from CD into A.
$03/C7DC 20 72 CA JSR $CA72  [$03:CA72] A:0000 X:0010 Y:0000 P:envMxdiZc - Cleaning Routine
$03/C7DF A5 A4 LDA $A4    [$00:00A4] A:0000 X:0000 Y:0000 P:envMxdiZc - Load A from A4.
$03/C7E1 9D D4 34 STA $34D4,x[$7E:34D4] A:0032 X:0000 Y:0000 P:envMxdizc - Store A in 7E34D4 (Healing)
$03/C7E4 A5 A5 LDA $A5    [$00:00A5] A:0032 X:0000 Y:0000 P:envMxdizc - Load A from A5.
$03/C7E6 9D D5 34 STA $34D5,x[$7E:34D5] A:0001 X:0000 Y:0000 P:envMxdizc - Store A in 7E34D5 (??)
$03/C7E9 80 20 BRA $20    [$C80B] A:0001 X:0000 Y:0000 P:envMxdizc - Branch Always to 03C80B
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/C7EB A5 CD LDA $CD    [$00:00CD] A:0000 X:00AB Y:0000 P:envMxdiZc - Load the value in CD into A
$03/C7ED 20 72 CA JSR $CA72  [$03:CA72] A:0000 X:00AB Y:0000 P:envMxdiZc - Jump out of Routine (seems to be another cleaning routine)
$03/C7F0 A5 A4 LDA $A4    [$00:00A4] A:0000 X:0000 Y:0000 P:envMxdiZc - Load the value in A4 into A
$03/C7F2 9D D4 34 STA $34D4,x[$7E:34D4] A:00AB X:0000 Y:0000 P:eNvMxdizc - Store A in 7E34D4 - (Healing)
$03/C7F5 A5 A5 LDA $A5    [$00:00A5] A:00AB X:0000 Y:0000 P:eNvMxdizc - Load the value in A5 into A
$03/C7F7 09 80 ORA #$80 A:0000 X:0000 Y:0000 P:envMxdiZc - Add 80 (Healing Flag) into A.
$03/C7F9 9D D5 34 STA $34D5,x[$7E:34D5] A:0080 X:0000 Y:0000 P:eNvMxdizc - Store A in 7E34D5 - (Store Healing Flag)
$03/C7FC A5 CE LDA $CE    [$00:00CE] A:0080 X:0000 Y:0000 P:eNvMxdizc - Load A from CE.
$03/C7FE 20 72 CA JSR $CA72  [$03:CA72] A:0083 X:0000 Y:0000 P:eNvMxdizc - Cleaning Routine.
$03/C801 A5 A4 LDA $A4    [$00:00A4] A:0010 X:0010 Y:0000 P:envMxdizc - Load the value in A4 into A
$03/C803 9D D4 34 STA $34D4,x[$7E:34E4] A:00AB X:0010 Y:0000 P:eNvMxdizc - Store  the value in 7E34E4 (Damage)
$03/C806 A5 A5 LDA $A5    [$00:00A5] A:00AB X:0010 Y:0000 P:eNvMxdizc - Load A from A5.
$03/C808 9D D5 34 STA $34D5,x[$7E:34E5] A:0000 X:0010 Y:0000 P:envMxdiZc - Store A  in 7E34E5
--------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/C80B A5 CD LDA $CD    [$00:00CD] A:0000 X:0010 Y:0000 P:envMxdiZc - Load A from CD.
$03/C80D 10 0A BPL $0A    [$C819] A:0000 X:0000 Y:0000 P:envMxdiZc - Branch if Plus to 03C819
--------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/C80F AE 96 28 LDX $2896  [$7E:2896] A:0080 X:0000 Y:0000 P:eNvMxdizc Load X into 7E2896.
$03/C812 BD C2 33 LDA $33C2,x[$7E:33C3] A:0080 X:0001 Y:0000 P:envMxdizc Load an Audio/Visual Cue? (It is in that section of RAM) from 7E33C3
$03/C815 C9 F8 CMP #$F8 A:00F8 X:0001 Y:0000 P:eNvMxdizc - Does the Value in A match the CMP?
$03/C817 D0 03 BNE $03    [$C81C] A:00F8 X:0001 Y:0000 P:envMxdiZC If so do not branch to 03C81C.
--------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/C819 20 7E CA JSR $CA7E  [$03:CA7E] A:0000 X:0000 Y:0000 P:envMxdiZc Jump to Damage Step at 03CA7E
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/CA7E C2 20 REP #$20 A:00F8 X:0001 Y:0000 P:envMxdiZC - Reset Status Processor?
$03/CA80 7B TDC A:00F8 X:0001 Y:0000 P:envmxdiZC - Transfer Direct Page to Accumulator?
$03/CA81 AA TAX A:0000 X:0001 Y:0000 P:envmxdiZC - Transfer A to X
$03/CA82 86 A9 STX $A9    [$00:00A9] A:0000 X:0000 Y:0000 P:envmxdiZC - Store X in A9.
$03/CA84 A8 TAY A:0000 X:0000 Y:0000 P:envmxdiZC - Transfer A to Y
$03/CA85 98 TYA A:0000 X:0000 Y:0000 P:envmxdiZC - Transfer Y to A (Sure, why not?)
$03/CA86 4A LSR A A:0000 X:0000 Y:0000 P:envmxdiZC - Divide A by 2 (Now we're talking!)
$03/CA87 AA TAX A:0000 X:0000 Y:0000 P:envmxdiZc - Transfer A to X (Eh...)
$03/CA88 BD 40 35 LDA $3540,x[$7E:3540] A:0000 X:0000 Y:0000 P:envmxdiZc - Load A from 7E3540.
$03/CA8B 29 FF 00 AND #$00FF A:0100 X:0000 Y:0000 P:envmxdizc - Not really sure. Possibly saying to load A from 0xFF
$03/CA8E F0 03 BEQ $03    [$CA93] A:0000 X:0000 Y:0000 P:envmxdiZc - I see no way to pass it.
$03/CA93 A6 A9 LDX $A9    [$00:00A9] A:0000 X:0000 Y:0000 P:envmxdiZc - Load X from A9.
$03/CA95 B9 D4 34 LDA $34D4,y[$7E:34D4] A:0000 X:0000 Y:0000 P:envmxdiZc - Load A from 7E34D4 (Healing/Damage)
$03/CA98 29 00 40 AND #$4000 A:0005 X:0000 Y:0000 P:envmxdizc - (No idea)
$03/CA9B F0 11 BEQ $11    [$CAAE] A:0000 X:0000 Y:0000 P:envmxdiZc - Another unpassable check?
$03/CAAE B9 D4 34 LDA $34D4,y[$7E:34D4] A:0000 X:0000 Y:0000 P:envmxdiZc - Load A from 7E34D4 (Healing/Damage)
$03/CAB1 10 11 BPL $11    [$CAC4] A:0005 X:0000 Y:0000 P:envmxdizc - Branch if positive and go to 7ECAC4.
-------------------------------------------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------------------------------------------
$03/CAC4 B9 D4 34 LDA $34D4,y[$7E:34D4] A:0005 X:0000 Y:0000 P:envmxdizc  - Load A from 7E34D4. (Healing/Damage Slot)
$03/CAC7 29 FF BF AND #$BFFF A:0005 X:0000 Y:0000 P:envmxdizc - No idea.
$03/CACA 8D 98 28 STA $2898  [$7E:2898] A:0005 X:0000 Y:0000 P:envmxdizc - Store A in 7E2898.
$03/CACD 38 SEC A:0005 X:0000 Y:0000 P:envmxdizc - Set Carry Flag.
$03/CACE BD 07 20 LDA $2007,x[$7E:2007] A:0005 X:0000 Y:0000 P:envmxdizC - Load Character/Monster's HP.
$03/CAD1 F0 0E BEQ $0E    [$CAE1] A:00C8 X:0000 Y:0000 P:envmxdizC - Branch if Flag is set (it should be as far as I can see, but eh...)
$03/CAD3 ED 98 28 SBC $2898  [$7E:2898] A:00C8 X:0000 Y:0000 P:envmxdizC - Subtract A from what is in 7E2898.
$03/CAD6 F0 02 BEQ $02    [$CADA] A:00C3 X:0000 Y:0000 P:envmxdizC - If 00 branch to 03CADA.
$03/CAD8 B0 1C BCS $1C    [$CAF6] A:00C3 X:0000 Y:0000 P:envmxdizC - Branch if Carry is Set. 
---------------------------------------------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------------------------------------------------
$03/CAF6 9D 07 20 STA $2007,x[$7E:2007] A:00C3 X:0000 Y:0000 P:envmxdizC - Store the new Character/Monster's HP.
$03/CAF9 DD 09 20 CMP $2009,x[$7E:2009] A:00C3 X:0000 Y:0000 P:envmxdizC - Compare to Max HP.
$03/CAFC 90 08 BCC $08    [$CB06] A:00C3 X:0000 Y:0000 P:eNvmxdizc - Branch if Carry Cleared.
$03/CB06 BD 09 20 LDA $2009,x[$7E:2009] A:00C3 X:0000 Y:0000 P:eNvmxdizc - Load Max HP.
$03/CB09 20 86 84 JSR $8486  [$03:8486] A:00C8 X:0000 Y:0000 P:envmxdizc - Jump to dividing? Subroutine.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
$03/8486 4A LSR A A:00C8 X:0000 Y:0000 P:envmxdizc - Divide Max HP by half.
$03/8487 4A LSR A A:0064 X:0000 Y:0000 P:envmxdizc - Divide Max HP by another half
$03/8488 60 RTS A:0032 X:0000 Y:0000 P:envmxdizc - Return
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/CB0C DD 07 20 CMP $2007,x[$7E:2007] A:0032 X:0000 Y:0000 P:envmxdizc - Compare Character/Monster's Current HP with /4 HP?
$03/CB0F 90 12 BCC $12    [$CB23] A:0032 X:0000 Y:0000 P:eNvmxdizc - If unsuccessful Branch to 03CB23
$03/CB23 7B TDC A:0032 X:0000 Y:0000 P:eNvmxdizc - Transfer Direct Page to Accumulator
$03/CB24 E2 20 SEP #$20 A:0000 X:0000 Y:0000 P:envmxdiZc - Set Processor Status Bits
$03/CB26 A6 A9 LDX $A9    [$00:00A9] A:0000 X:0000 Y:0000 P:envMxdiZc - Load X from A9.
$03/CB28 BD 06 20 LDA $2006,x[$7E:2006] A:0000 X:0000 Y:0000 P:envMxdiZc - Load A from Status Byte 3 of Character/Monster.
$03/CB2B 29 FE AND #$FE A:0000 X:0000 Y:0000 P:envMxdiZc - ??
$03/CB2D 9D 06 20 STA $2006,x[$7E:2006] A:0000 X:0000 Y:0000 P:envMxdiZc - Store A in 7E2006.
$03/CB30 C2 20 REP #$20 A:0000 X:0000 Y:0000 P:envMxdiZc - Clear bit 5.
$03/CB32 A6 A9 LDX $A9    [$00:00A9] A:0000 X:0000 Y:0000 P:envmxdiZc - Load X from A9.
$03/CB34 8A TXA A:0000 X:0000 Y:0000 P:envmxdiZc - Transfer X to A
$03/CB35 18 CLC A:0000 X:0000 Y:0000 P:envmxdiZc - Clear Carry Flag.
$03/CB36 69 80 00 ADC #$0080 A:0000 X:0000 Y:0000 P:envmxdiZc - Add 80 to A.
$03/CB39 AA TAX A:0080 X:0000 Y:0000 P:envmxdizc - Transfer A to X.
$03/CB3A 86 A9 STX $A9    [$00:00A9] A:0080 X:0080 Y:0000 P:envmxdizc - Store X in A9.
$03/CB3C C8 INY A:0080 X:0080 Y:0000 P:envmxdizc - +1 to Y.
$03/CB3D C8 INY A:0080 X:0080 Y:0001 P:envmxdizc - +1 to y.
$03/CB3E C0 1A 00 CPY #$001A A:0080 X:0080 Y:0002 P:envmxdizc - ??
$03/CB41 F0 03 BEQ $03    [$CB46] A:0080 X:0080 Y:0002 P:eNvmxdizc - Branch if flag is set to 03CB46.
$03/CB43 4C 85 CA JMP $CA85  [$03:CA85] A:0080 X:0080 Y:0002 P:eNvmxdizc - Jump to Subroutine.
(I seem to have left matters of importance and will return to the normal trek from here.)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/C81C AD 07 39 LDA $3907  [$7E:3907] A:0000 X:0680 Y:001A P:envMxdiZC - Load 7E3907 into A.
$03/C81F D0 05 BNE $05    [$C826] A:0000 X:0680 Y:001A P:envMxdiZC - ??
--------------------------------------------------------------------------------------------------------------------------------------------
$03/C821 AD FC 38 LDA $38FC  [$7E:38FC] A:0000 X:0680 Y:001A P:envMxdiZC - Load 7E38FC into A.
$03/C824 D0 03 BNE $03    [$C829] A:0001 X:0680 Y:001A P:envMxdizC - ??
----------------------------------------------------------------------------------------------------------------------------------------------
$03/C826 4C 10 C9 JMP $C910  [$03:C910] A:0000 X:0000 Y:0000 P:envMxdiZC  (All paths lead here.) - Jump to 03C910.
------------------------------------------------------------------------------------------------------------------------------------------------
$03/C829 AD 9E 26 LDA $269E  [$7E:269E] A:0001 X:0680 Y:001A P:envMxdizC - Load Caster's Status Inflict Byte 1.
$03/C82C 0D 9F 26 ORA $269F  [$7E:269F] A:0002 X:0680 Y:001A P:envMxdizC - Load Caster's Status Inflict Byte 2?
$03/C82F F0 F5 BEQ $F5    [$C826] A:0002 X:0680 Y:001A P:envMxdizC - If 00 Branch?
$03/C831 AD 9E 26 LDA $269E  [$7E:269E] A:0002 X:0680 Y:001A P:envMxdizC - Load Caster's Status Inflict Byte 1. (Again?)
$03/C834 2D 2B 27 AND $272B  [$7E:272B] A:0002 X:0680 Y:001A P:envMxdizC - Check against Target's Status Immune Byte 1.
$03/C837 D0 ED BNE $ED    [$C826] A:0000 X:0680 Y:001A P:envMxdiZC - If they are equal, branch to 03C826
$03/C839 AD 9F 26 LDA $269F  [$7E:269F] A:0000 X:0680 Y:001A P:envMxdiZC - Load Caster's Status Inflict Byte 2.
$03/C83C 2D 2C 27 AND $272C  [$7E:272C] A:0000 X:0680 Y:001A P:envMxdiZC - Check against Target's Status Immune Byte 2
$03/C83F D0 E5 BNE $E5    [$C826] A:0000 X:0680 Y:001A P:envMxdiZC - If they are equal branch to 03C826. (Not sure why it isn't branching there.)
$03/C841 38 SEC A:0000 X:0680 Y:001A P:envMxdiZC - Set Carry Flag
$03/C842 AD 9C 26 LDA $269C  [$7E:269C] A:0000 X:0680 Y:001A P:envMxdiZC - Load Target's Physical Attack Percentage.
$03/C845 ED 29 27 SBC $2729  [$7E:2729] A:004D X:0680 Y:001A P:envMxdizC - Subtract A from Target's Physical Evasion.
$03/C848 F0 DC BEQ $DC    [$C826] A:004D X:0680 Y:001A P:envMxdizC - (Checking if it's 00 perhaps?)
$03/C84A 90 DA BCC $DA    [$C826] A:004D X:0680 Y:001A P:envMxdizC - ??
$03/C84C 8D FA 38 STA $38FA  [$7E:38FA] A:004D X:0680 Y:001A P:envMxdizC - Store A in 7E38FA as Accuracy?
$03/C84F AD FC 38 LDA $38FC  [$7E:38FC] A:004D X:0680 Y:001A P:envMxdizC - Load 7E38FC into A.
$03/C852 8D FB 38 STA $38FB  [$7E:38FB] A:0001 X:0680 Y:001A P:envMxdizC - Store A in 7E38FB.
$03/C855 20 97 C9 JSR $C997  [$03:C997] A:0001 X:0680 Y:001A P:envMxdizC  - Jump out of Routine (Appears to be Random Number Generator)
$03/C858 AD FD 38 LDA $38FD  [$7E:38FD] A:0039 X:0000 Y:0000 P:envMxdiZc - Looks to load a random number likely generated from the previous routine.
$03/C85B F0 C9 BEQ $C9    [$C826] A:0001 X:0000 Y:0000 P:envMxdizc - If it is 1 or higher it is considered a successful check/pass.
$03/C85D AD 70 27 LDA $2770  [$7E:2770] A:0001 X:0000 Y:0000 P:envMxdizc - Load Target's Level/Boss Bit.
$03/C860 30 C4 BMI $C4    [$C826] A:0005 X:0000 Y:0000 P:envMxdizc - Break if Minus (meaning that the Boss Bit is an 80) and branch to 03C826.
$03/C862 AD 9E 26 LDA $269E  [$7E:269E] A:0005 X:0000 Y:0000 P:envMxdizc - Load Caster's Status Inflict Byte 1.
$03/C865 8D 08 39 STA $3908  [$7E:3908] A:0002 X:0000 Y:0000 P:envMxdizc - Store A in 7E3908.
$03/C868 85 AA STA $AA    [$00:00AA] A:0002 X:0000 Y:0000 P:envMxdizc - Also store it in AA.
$03/C86A 2D 03 27 AND $2703  [$7E:2703] A:0002 X:0000 Y:0000 P:envMxdizc - I suppose checking to see if the status is already inflicted on Target?
$03/C86D D0 B7 BNE $B7    [$C826] A:0000 X:0000 Y:0000 P:envMxdiZc - If so branch 03C826.
$03/C86F AD 9F 26 LDA $269F  [$7E:269F] A:0000 X:0000 Y:0000 P:envMxdiZc - Load Caster's Status Inflict Byte 2.
$03/C872 8D 09 39 STA $3909  [$7E:3909] A:0000 X:0000 Y:0000 P:envMxdiZc - Store A in 7E3909
$03/C875 85 A9 STA $A9    [$00:00A9] A:0000 X:0000 Y:0000 P:envMxdiZc - Store A in A9.
$03/C877 2D 04 27 AND $2704  [$7E:2704] A:0000 X:0000 Y:0000 P:envMxdiZc - Making sure it is not already inflicted?
$03/C87A D0 21 BNE $21    [$C89D] A:0000 X:0000 Y:0000 P:envMxdiZc - If so branch to 03C826.
$03/C87C A5 CE LDA $CE    [$00:00CE] A:0000 X:0000 Y:0000 P:envMxdiZc - Load CE into A.
$03/C87E 10 05 BPL $05    [$C885] A:0083 X:0000 Y:0000 P:eNvMxdizc - Branch to 03C885 if plus.
$03/C880 29 7F AND #$7F A:0083 X:0000 Y:0000 P:eNvMxdizc - ??
$03/C882 18 CLC A:0003 X:0000 Y:0000 P:envMxdizc - Clear Carry Flag.
$03/C883 69 05 ADC #$05 A:0003 X:0000 Y:0000 P:envMxdizc - Add 5 to A.
$03/C885 85 CF STA $CF    [$00:00CF] A:0008 X:0000 Y:0000 P:envMxdizc - Store A in CF.
$03/C887 20 7F 84 JSR $847F  [$03:847F] A:0008 X:0000 Y:0000 P:envMxdizc - Jump to 03847F where it multiplies A a couple of times before returning.
$03/C88A AA TAX A:0020 X:0000 Y:0000 P:envMxdizc - Transfer A to X
$03/C88B 86 C7 STX $C7    [$00:00C7] A:0020 X:0020 Y:0000 P:envMxdizc - Store X in C7.
$03/C88D A5 CF LDA $CF    [$00:00CF] A:0020 X:0020 Y:0000 P:envMxdizc - Store A in CF.
$03/C88F 20 89 84 JSR $8489  [$03:8489] A:0008 X:0020 Y:0000 P:envMxdizc - Cleaning Routine.
$03/C892 A9 03 LDA #$03 A:0000 X:0900 Y:0000 P:envMxdizc - Load A into 3.
$03/C894 20 69 85 JSR $8569  [$03:8569] A:0003 X:0900 Y:0000 P:envMxdizc - Jump to Subroutine.
$03/C897 AE 98 35 LDX $3598  [$7E:3598] A:0000 X:0900 Y:0000 P:envMxdiZc - Load 7E3598 into X.
$03/C89A BD 06 2A LDA $2A06,x[$7E:2AB1] A:0000 X:00AB Y:0000 P:envMxdizc - Load 7E2AB1 into A.
$03/C89D D0 71 BNE $71    [$C910] A:0000 X:00AB Y:0000 P:envMxdiZc - ?? (Not sure how this is passed or failed)
$03/C89F AD 83 26 LDA $2683  [$7E:2683] A:0000 X:00AB Y:0000 P:envMxdiZc - Load Caster's Status Ailment Byte 1.
$03/C8A2 29 30 AND #$30 A:0000 X:00AB Y:0000 P:envMxdiZc - Is it Toad/Mini?
$03/C8A4 D0 F7 BNE $F7    [$C89D] A:0000 X:00AB Y:0000 P:envMxdiZc - If so, branch to 7EC89D.
$03/C8A6 C2 20 REP #$20 A:0000 X:00AB Y:0000 P:envMxdiZc - ??
$03/C8A8 7B TDC A:0000 X:00AB Y:0000 P:envmxdiZc - ?Transfer Direct Page to Accumulator?
$03/C8A9 AA TAX A:0000 X:00AB Y:0000 P:envmxdiZc - Transfer A to X.
$03/C8AA 9B TXY A:0000 X:0000 Y:0000 P:envmxdiZc - Transfer X t Y,
$03/C8AB 06 A9 ASL $A9    [$00:00A9] A:0000 X:0000 Y:0000 P:envmxdiZc - Multiply the value in A9 by 2.
$03/C8AD 90 0C BCC $0C    [$C8BB] A:0000 X:0000 Y:0000 P:envmxdizc - ??
$03/C8BB E8 INX A:0000 X:0000 Y:0000 P:envmxdizc - Increase X by 1.
$03/C8BC E0 10 00 CPX #$0010 A:0000 X:0001 Y:0000 P:envmxdizc - Compare X with 0010.
$03/C8BF D0 EA BNE $EA    [$C8AB] A:0000 X:0001 Y:0000 P:eNvmxdizc - If not done branch back to 03C8AB until it is done (Loop.)
$03/C8C2 E2 20 SEP #$20 A:0000 X:0010 Y:0001 P:envmxdiZC - ?Set Processor Status Bits?
$03/C8C4 20 4A CB JSR $CB4A  [$03:CB4A] A:0000 X:0010 Y:0001 P:envMxdiZC - Jump to 03CB4A
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/CB4A AD 08 39 LDA $3908  [$7E:3908] A:0000 X:0010 Y:0001 P:envMxdiZC - Load 7E3908 into A.
$03/CB4D 10 0E BPL $0E    [$CB5D] A:0002 X:0010 Y:0001 P:envMxdizC - Branch if Plus to 7ECB5D.
-----------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------
$03/CB5D C2 20 REP #$20 A:0002 X:0010 Y:0001 P:envMxdizC - ?Reset Processor Status Bits?
$03/CB5F AD 03 27 LDA $2703  [$7E:2703] A:0002 X:0010 Y:0001 P:envmxdizC - Load Target's Status Byte 1 into A.
$03/CB62 29 FF BF AND #$BFFF A:0000 X:0010 Y:0001 P:envmxdiZC - ??
$03/CB65 CD 08 39 CMP $3908  [$7E:3908] A:0000 X:0010 Y:0001 P:envmxdiZC - Compare with stored Status Infliction.
$03/CB68 90 06 BCC $06    [$CB70] A:0000 X:0010 Y:0001 P:eNvmxdizc - If the flag is not carried (not equal?) branch to 03CB70.
$03/CB70 A6 C7 LDX $C7    [$00:00C7] A:0000 X:0010 Y:0001 P:eNvmxdizc - Load C7 into X.
$03/CB72 AD 03 27 LDA $2703  [$7E:2703] A:0000 X:0020 Y:0001 P:envmxdizc - Load Target's Status Byte 1 into A.
$03/CB75 0D 08 39 ORA $3908  [$7E:3908] A:0000 X:0020 Y:0001 P:envmxdiZc - Compare the bytes again (Load them into A?)
$03/CB78 9D 8E 33 STA $338E,x[$7E:33AE] A:0002 X:0020 Y:0001 P:envmxdizc - Store A in 7E33AE.
$03/CB7B AD 08 39 LDA $3908  [$7E:3908] A:0002 X:0020 Y:0001 P:envmxdizc - Load A from 7E3908.
$03/CB7E 29 01 3B AND #$3B01 A:0002 X:0020 Y:0001 P:envmxdizc - ??
$03/CB81 D0 03 BNE $03    [$CB86] A:0000 X:0020 Y:0001 P:envmxdiZc - (Not sure how pass or fail this one.)
$03/CB83 4C 42 CC JMP $CC42  [$03:CC42] A:0000 X:0020 Y:0001 P:envmxdiZc - Jump to 03CC42.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/CC42 7B TDC A:0000 X:0020 Y:0001 P:envmxdiZc - ?Transfer Directly Accumulator?
$03/CC43 E2 20 SEP #$20 A:0000 X:0020 Y:0001 P:envmxdiZc - ?Set Process Status Bits?
$03/CC45 60 RTS A:0000 X:0020 Y:0001 P:envMxdiZc - Return.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/C8C7 AD 08 39 LDA $3908  [$7E:3908] A:0000 X:0020 Y:0001 P:envMxdiZc - Load location of currently stored Status into A.
$03/C8CA 0D 09 39 ORA $3909  [$7E:3909] A:0002 X:0020 Y:0001 P:envMxdizc - ?? (Maybe a second status byte would be added if applicable)
$03/C8CD D0 02 BNE $02    [$C8D1] A:0002 X:0020 Y:0001 P:envMxdizc - Failed check. Branch to 03C8D1.
$03/C8D1 A5 CD LDA $CD    [$00:00CD] A:0002 X:0020 Y:0001 P:envMxdizc - Load CD into A.
$03/C8D3 30 05 BMI $05    [$C8DA] A:0000 X:0020 Y:0001 P:envMxdiZc -  Branch if Minus to 03C8DA.
$03/C8D5 20 B1 85 JSR $85B1  [$03:85B1] A:0000 X:0020 Y:0001 P:envMxdiZc - Jump to Subroutine (nothing of great value as far as I can make out)
$03/C8D8 80 36 BRA $36    [$C910] A:0003 X:0020 Y:0001 P:envMxdizc - Always branch 03C910.
-------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/C910 AD E1 38 LDA $38E1  [$7E:38E1] A:0003 X:0020 Y:0001 P:envMxdizc
$03/C913 F0 0E BEQ $0E    [$C923] A:0000 X:0020 Y:0001 P:envMxdiZciZc
--------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------
$03/C923 60 RTS A:0000 X:0020 Y:0001 P:envMxdiZc - End of Entire Attack/Defense Subroutine?

If you ever thought Drain weaponry were too powerful (I know I sure do) then you would change 03C80B - 9D D5 34 - (Load some value somewhere. Doesn't appear to do anything...) to 4E D4 34 (Divides the healing done by Drain Weaponry by 2.)

And if you ever need help finding this in ROM just search a sequence of bytes closeby to your desired address you wish to deal with and you should find the offset with little issue.

What can be done with information: Well for all of the Creature Type and Elemental Resists and the like Square opted to use numbers clearly delineating the amount of damage these would cause. So while Jump/Focus is seemingly a lost cause you can change any dealings with the Creature Types, Elementals, and Weaknesses as you please. Their power is in the notes to their specific functionality. 0 = 1 Damage, 1 = 1/2 Damage, 2 = Normal Damage 4 = x2 Damage 8 = x4 Damage. (Which due to reorganization is likely in the post above this one.)

Here is more of What can be done with the Normal Fight Command.
« Last Edit: September 27, 2013, 06:48:33 PM by Grimoire LD »

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Grimoire LD's Notes, Methods, and Hacks (All Spells Disassembly)
« Reply #74 on: September 27, 2013, 01:18:00 PM »
The first post has been updated to include All Spell Routines (save Heal and Audiovisual Effects) with appropriate links and indexes for organizations.