øAslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&topic=1883.msg21841e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index6f15.htmlslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&topic=1883.360e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index6f15.html.zx!g^ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÈ P,\>OKtext/htmlISO-8859-1gzip8:Ö\>ÿÿÿÿÿÿÿÿTue, 10 Mar 2020 05:25:48 GMT0ó°° ®0®P®€§²ð®!g^ÿÿÿÿÿÿÿÿt\> 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 78675 times)

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Grimoire LD's Notes, Patches, and Hacks (Touched up Coat Hammer Command)
« Reply #360 on: August 11, 2014, 09:27:56 PM »
Since it was a matter of some interest, here is how the "Hide Rydia" for the Golbez fight is programmed...

Code: [Select]
$02/E14E AD 00 18 LDA $1800  [$7E:1800] A:0001 X:0000 Y:0000 P:envMxdIzc - Load Formation Byte.
$02/E151 C9 B6 CMP #$B6 A:00B6 X:0000 Y:0000 P:eNvMxdIzc - Is it B6? (Golbez Fight)
$02/E153 D0 1B BNE $1B    [$E170] A:00B6 X:0000 Y:0000 P:envMxdIZC - If not, branch to normal formation setup.
--------------------------------------------------------------------------------------------------------------------------------------
$02/E155 BD 01 20 LDA $2001,x[$7E:2001] A:00B6 X:0000 Y:0000 P:envMxdIZC - Load Character ID of X Slot.
$02/E158 29 0F AND #$0F A:00AB X:0000 Y:0000 P:eNvMxdIzC - Get rid of unnecessary bits.
$02/E15A C9 0B CMP #$0B A:000B X:0000 Y:0000 P:envMxdIzC - Is it Adult Rydia?
$02/E15C D0 12 BNE $12    [$E170] A:000B X:0000 Y:0000 P:envMxdIZC - If not, branch to normal formation setup.
--------------------------------------------------------------------------------------------------------------------------------------------
$02/E15E BD 05 20 LDA $2005,x[$7E:2005] A:000B X:0000 Y:0000 P:envMxdIZC - Load Adult Rydia's Status Byte 3.
$02/E161 09 82 ORA #$82 A:0000 X:0000 Y:0000 P:envMxdIZC - Add Magnetized and Jumping to Adult Rydia (Not Hide? Wha?)
$02/E163 9D 05 20 STA $2005,x[$7E:2005] A:0082 X:0000 Y:0000 P:eNvMxdIzC - Store A in Adult Rydia's Status Byte 3.
$02/E166 A6 00 LDX $00    [$00:0000] A:0082 X:0000 Y:0000 P:eNvMxdIzC - Load 00 into X.
$02/E168 A9 01 LDA #$01 A:0082 X:0000 Y:0000 P:envMxdIZC - Load 01 into A.
$02/E16A 9D C1 F2 STA $F2C1,x[$7E:F2C1] A:0001 X:0000 Y:0000 P:envMxdIzC  - Store A in 7EF2C1 (Looks to be an unknown part of RAM as far as my notes are concerned.)
$02/E16D 7B TDC A:0001 X:0000 Y:0000 P:envMxdIzC - Transfer Direct Page.
$02/E16E 80 05 BRA $05    [$E175] A:0000 X:0000 Y:0000 P:envMxdIZC - Branch to rest of formation routine.

I just did a test with that and that F2C1 being 0001 is Actually what is hiding Rydia's name and HP. If that is 00 the name and HP appears.

Oh wow, this is some RAM that can actually hide all names and HP! It's slot based, but it's also not intended for normal gameplay. it's true that you can no longer target an ally, but the enemy can still target them just fine.

I haven't yet looked to see how the "shade" is removed from Adult Rydia's return though, how that 01 becomes a 00 exactly. It doesn't appear to be the normal set up of the "Rydia Returns" routine as far as I can see.

LordGarmonde

  • Baigan
  • *
  • Posts: 271
  • Gender: Male
  • "Power only breeds war..."
    • View Profile
Re: Grimoire LD's Notes, Patches, and Hacks (Touched up Coat Hammer Command)
« Reply #361 on: August 11, 2014, 09:43:20 PM »
That's pretty cool to read - thanks Grimoire LD!  :happy:

"Add Magnetized and Jumping to Adult Rydia (Not Hide? Wha?)" - Agreed!  :wtf:  :hmm:
"Now I know; and knowing makes it even more confusing..."

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Grimoire LD's Notes, Patches, and Hacks (Touched up Coat Hammer Command)
« Reply #362 on: August 14, 2014, 01:28:43 PM »
So while working on Combat Boost I noticed an inherent flaw in my FFT-type Katana Spirits... there was no way to get more of the rarer blades such as the Murasame and Masamune, despite the possibility of them still breaking when used... so I thought up a new scheme. This plan would replace the dancers in six towns for "Swordsmiths" and these Swordsmiths will copy the Katana's you have if you give them the Katana and a new enemy-drop only item, the Power Ore.

To make this worth the player's while you get multiples of a weapon (5 Kunai, 4 Ashura, 3 Kotetsu, 2 Kikuichimoji and 1 Masamune/Murasame) though that still might be too low (considering the prices of Katanas were lowered by a ton to compensate their use-function.) and I'm toying with the idea of doubling it all together, as I don't have Edge in my party yet I can't see how useful the small multiples of the blades will be.

In any case I came across a distinct problem that I failed to notice in creating this plan... the Power Ore replaces the Pass and here's something I forgot about the Pass. You keep it when you use it. Now I can see the reasoning in this in the normal game and every other item from thereon follows suit. (Which is why the game takes away All of your Pink tails, rather than just one) They wanted to have the player unlock the doors in Baron with the key and didn't want the key to vanish when used in this manner. The problem is, aside from the Pass this is the Only functionality of this and as this would interfere with later plans, I will be changing the instruction to look at an invalid item to compare against so an item will always be decremented.

So here is the data associated with all of this...

$00/EB3E   C9 EC   CMP #$EC   A:00EC   X:0001   Y:005B   P:envMxdiZC - Is the Item being used, the Pass?
$00/EB40   F0 20   BEQ $20    [$EB62]   A:00EC   X:0001   Y:005B   P:eNvMxdizc - If so, branch past the Item Decrement Routine.
$00/EB42   C9 FE   CMP #$FE   A:000B   X:0001   Y:005B   P:envMxdizc - Is the Item being used lower than Sort? (It Has to be because of the way the "use-item" event is set up so...?)
$00/EB44   B0 04   BCS $04    [$EB4A]   A:000B   X:0001   Y:005B   P:envMxdizc - If it is Sort or Greater, branch to Item Decrement Routine (What...? Decrement the Trash Can?)
$00/EB46   C9 ED   CMP #$ED   A:000B   X:0001   Y:005B   P:envMxdizc - Is it the Baron Key?
$00/EB48   B0 18    BCS $18    [$EB62]   A:000B   X:0001   Y:005B   P:envMxdizc - If so, branch past the Item Decrement Routine.

Kind of strange the way they have it set up, but eh. It works.

And there you go! Oh yes, I know I mentioned this in another thread, but the game doesn't actually show all items to use, in fact it only shows Healing Items to Key Items and that's it.

So to change this you would change these to your desired values.

$00/B0AE   C9 CE   CMP #$CE   A:0001   X:0100   Y:1A35   P:envMxdIzC - Is it Healing Item or below?
$00/B0B0   90 17   BCC $17    [$B0C9]   A:0001   X:0100   Y:1A35   P:envMxdIzC - If so, branch to skip item show.
$00/B0B2   C9 E7   CMP #$E7   A:0001   X:0100   Y:1A35   P:envMxdIzC - Is it Imp or Lower?
$00/B0B4   90 08   BCC $08    [$B0BE]   A:0001   X:0100   Y:1A35   P:envMxdIzC - If so, branch to Show Item Routine.
$00/B0B6   C9 EB   CMP #$EB   A:0001   X:0100   Y:1A35   P:envMxdIzC - Is it Carrot or Lower?
$00/B0B8   90 0F   BCC $0F    [$B0C9]   A:0001   X:0100   Y:1A35   P:envMxdIzC - If so, branch to skip item show.
$00/B0BA   C9 FE   CMP #$FE   A:0001   X:0100   Y:1A35   P:envMxdIzC - Is it Sort or Above?
$00/B0BC   B0 0B   BCS $0B    [$B0C9]   A:0001   X:0100   Y:1A35   P:envMxdIzC - If so, branch to skip item show.

So if you want all items to show all you basically have to do is null these checks (Except the FE one for fairly obvious reasons)

And there you have it!

Sure, I could have just changed the location of the Homing Device and the Power Ore, but what would have been the fun in that? Haha, I learned something new along the way after all and may be of use to someone down the line.


Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Grimoire LD's Notes, Patches, and Hacks (New Info. on Item Use Event Routine)
« Reply #363 on: December 07, 2014, 11:27:33 PM »
So I found a rather neat work around for Overworld/Moon script silliness the game tries to impose and it's quite simple, but it does involve the use of AI Conditionals.

The simple trick is to set a moon-type enemy to respond to a certain "If Formation" (Note: In the editor, the Formations are somehow off by 11 For instance the FlameDog is set to respond special in Formation Index 451, but when you open the Formation editor you'll see it's actually 452. (1 probably counted as 0 or something somewhere) and though it will display as Moon formations, you should write down the Index number of the desired Script and it will play it just fine.

I noticed this when I tried to use the Silver Dragon (Ging-Ryu) who in the editor is set as a Moon monster and I didn't want to take away the Silver Dragon from the moon either, so I decided to take a Charm script that was no longer being used and gave that to the Silver Dragon for an Overworld battle and it worked out great!

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Grimoire LD's Notes, Patches, and Hacks (New Info. on Item Use Event Routine)
« Reply #364 on: December 08, 2014, 05:09:40 AM »
Sorry, to clarify, are you saying you got Ging Ryu to work properly in the Overworld? And if so, can you explain again exactly what you did?

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Grimoire LD's Notes, Patches, and Hacks (New Info. on Item Use Event Routine)
« Reply #365 on: December 08, 2014, 09:48:20 AM »
Yes, I got Ging-Ryu to work properly in the Overworld and the Moon the only oddity will be is if Call is used against him, he'll counter with RockBeak (because that's what the index is in the Overworld, where on the Moon he'll counter with Cyclone.)

It is a very simple process, but one easy to overlook...

As I wrote in my AI Index References there are a fair number of AI Conditionals which are superfluous (springing immediately to mind is the five for Rubicante which looks to see if any character is dead and if a Fire Attack was used against him to return the favor and revive them and the same 3 for the Magus Sisters) so replace something that is either not used or rather redundant with an "IF Formation Index" conditional and using another Overworld monster as reference. For instance when I was setting up the Silver Dragon I was using the Basilisk as the means in which to choose the script and modify the script as needed, then after I was done I set the Basilisk back to normal and moved back down to the Silver Dragon, I kept in mind that the Formation Index is one off (as mentioned above) and set the script for him to use to that.

Because the Silver Dragon only uses this Formation while on the Overworld he will be able to fight with two completely different attack scripts when again encountered on the Moon. (I think this would work Really Well with your Enemy Level Patch Chillyfeez in Many respects because it means older enemies in different formations can fight back in a different manner.)

I do wish we had more space to use with Conditionals though as there is a lot of neat stuff which can be done with them.

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Grimoire LD's Notes, Patches, and Hacks (New Info. on Item Use Event Routine)
« Reply #366 on: December 14, 2014, 03:12:23 PM »
Due to Chillyfeez's suggestions and older information from Phoenix (to me, of all people, to completely forget specific matters I asked about, haha) I've located all of the necessary information on the Alternate Battle Background Palettes.


$03/F779   29 20   AND #$20   A:0020   X:0000   Y:00D0   P:envMxdIzc - Is the Field being loaded using an Alternate Palette?
$03/F77B   F0 06   BEQ $06    [$F783]   A:0020   X:0000   Y:00D0   P:envMxdIzc - If not, branch elsewhere.
$03/F77D   BF BC F7 03   LDA $03F7BC,x[$03:F7BC]   A:0020   X:0000   Y:00D0   P:envMxdIzc - Load alternate palette for field.

That's all the ASM we need to be worried about for the moment. This is an odd matter as there is pure data not even 100 bytes away from this instruction, from what I've seen that is rare.

In any event I was searching for a suitable background palette for the Everwhite Woods, a new area in Combat Boost, and though I originally had no plans to change the palette, Chillyfeez pointed me in the right direction and found exactly what I was looking for.

To those not in the know, the Alternate Palettes are loaded by the "Mystery Byte" in FF4kster's Map Info. (A 20 in front of the battle background). This is how the game loads a special palette for Edward's night battle. It is also used in Eblan Cave, Sylph Cave, Tower of Babil, and Sealed Cave. The worry and thought was at first is that the game ran CMP's to check if specific backgrounds were being used and if so to load the special palette. This thankfully did not turn out to be the case at all.

This is in ROM at 1F7BC (unheadered). The data is as follows..

16 (Field)
00 (Forest) 
00 (Mountain)
00 (Castle)
11 (Cave)
00 (Moon)
00 (Ship)
12 (Water)
14 (Magnes/Sealed Cave)
00 (Desert)
00 (Beach)
13 (Land of Monsters/Sylph)
15 (Tower of Zot/Babil)
00 (Lunar Subterrane)
00 (Crystal Room)
00 (Underground)

What this means is that each background can support an alternate palette, whether it be an existing palette (01-0F are used by the normal background palettes)  or an alternate palette.

For the record all field backgrounds (Field, Forest, Desert, Beach) look pretty good with 16 (Night) used. Unfortunately Mountains don't fare as wwell.

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Grimoire LD's Notes, Patches, and Hacks (How to enable Criticals for Foes!)
« Reply #367 on: December 24, 2014, 02:39:13 PM »
This is more a note for myself so I don't forget it. For a very long time I've been working under a false pretense on how Defense worked and I assumed it was just like Attack. Attack x Attack Multipliers = Base Attack
Defense x Defense Multipliers = Base Defense

This was wrong. While I was right with Attacks, Defense works much more differently than I had thought. I had thought Defense worked in this manner...

Attack x Attack Multiplier vs. Defense x Defense Multiplier = Base Damage.

They aren't Defense Multipliers at all, but Evasion Multipliers and I feel rather silly for never realizing this until now.

So it's literally

Defense = Base Defense / Evasion Multiplier x Base Evade = Evasion possibility.

So it works like this...

Attack x Attack Multiplier vs. Defense & Evasion Multiplier x Base Evade = This mitigates damage by straight "misses" that are caused from attacks.Due to the systematic way in which FFIV handled Evasion and Evasion Multipliers on monsters in their data it's clear they never really thought either system out. Defense is simple enough, but the original game Barely uses this, with even end game enemies having a max of 12 Defense, that's not going to stop a 200 Attack Power Weapon with over 10 Attack Multipliers from cutting through the enemy like butter. If Evasion was properly added two or three of those blows may have a chance to miss.

I wish I had discovered that this is how the system worked out a long time ago It's not 4x4 Defense Multipliers with a 20% chance at Evasion, but is 4 Defense with 20% chance in four multipliers to cause a Miss. Like that will make a difference Square! So it's clear if I want enemies to have strong physical defense I'm going to need to rewrite those values rather than leave them at default.

This was probably common knowledge to others, but I am shocked it took me so long to realize this.

 :edit: Also enemies could be capable of critical hits, if there was a way to set that up for them. I'd have to take a look at the general building of enemies (as I did when I restored the Evasions) and see if there's room to put in a static Critical Hit Chance.

 :edit: 2 Well, after a little digging I found this bit of silliness. It's the routine which puts Level+10 into Steal Defense. I'm pretty sure I could change this to just putting that 0A into the Critical Hit chance while putting the base level into Steal Defense.

Steal Defense Start Routine

$03/9035   9D 02 20   STA $2002,x[$7E:2282]   A:000C   X:0280   Y:0014   P:envMxdIzc - Store Level in Level Byte
$03/9038   18    CLC   A:000C   X:0280   Y:0014   P:envMxdIzc - Clear Carry Flag
$03/9039   69 0A   ADC #$0A   A:000C   X:0280   Y:0014   P:envMxdIzc - Add 10 to A.
$03/903B   9D 2F 20   STA $202F,x[$7E:22AF]   A:0016   X:0280   Y:0014   P:envMxdIzc - Store A in Steal Defense Byte.

Enemy MP Start Routine

$03/9050   C2 20   REP #$20   A:0000   X:0280   Y:0014   P:envMxdIZc - Reset Processor Status
$03/9052   AD 9D 28   LDA $289D  [$7E:289D]   A:0000   X:0280   Y:0014   P:envmxdIZc - Load Max HP of Enemy
$03/9055   20 84 84   JSR $8484  [$03:8484]   A:0028   X:0280   Y:0014   P:envmxdIzc - Jump to /8 Routine
$03/9058   9D 0B 20   STA $200B,x[$7E:228B]   A:0002   X:0280   Y:0014   P:envmxdIzC - Store this as MP for Enemy.
$03/905B   9D 0D 20   STA $200D,x[$7E:228D]   A:0002   X:0280   Y:0014 P:envmxdIzC - Store as Max MP

Enemy Spell Power Start

$03/9164   B9 A6 28   LDA $28A6,y[$7E:28A9]   A:0010   X:0280   Y:0003   P:envMxdIzC - Load Enemy Spell Power
$03/9167   9D 12 20   STA $2012,x[$7E:2292]   A:0014   X:0280   Y:0003   P:envMxdIzC - Store A in Base Wisdom
$03/916A   9D 13 20   STA $2013,x[$7E:2293]   A:0014   X:0280   Y:0003   P:envMxdIzC - Store A in Base Will
$03/916D   9D 17 20   STA $2017,x[$7E:2297]   A:0014   X:0280   Y:0003   P:envMxdIzC - Store A in Modified Wisdom
$03/9170   9D 18 20   STA $2018,x[$7E:2298]   A:0014   X:0280   Y:0003   P:envMxdIzC - Store A in Modified Will

The first two entries are superfluous and could be safely changed, this would make a good place to store Critical Hit chance and Critical Hit Bonus Damage, though they would be equal to enemy Spell Power.

As such...

$03/9167   9D 2D 20   STA $2012,x[$7E:2292]   A:0014   X:0280   Y:0003   P:envMxdIzC - Store A in Critical Hit Chance
$03/916A   9D 2E 20   STA $2013,x[$7E:2293]   A:0014   X:0280   Y:0003   P:envMxdIzC - Store A in Critical Hit Bonus Damage

And it works perfectly!
« Last Edit: December 25, 2014, 07:29:38 AM by Grimoire LD »

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Grimoire LD's Notes, Patches, and Hacks (Rebalanced Poison Status)
« Reply #368 on: December 24, 2014, 05:23:00 PM »
Poison Timer Dealings

Code: [Select]
$03/9E45 BD 60 20 LDA $2060,x[$7E:2360] A:0000 X:0300 Y:0000 P:envMxdizc - Load Target's Relative Speed
$03/9E48 85 A9 STA $A9    [$00:00A9] A:000F X:0300 Y:0000 P:envMxdizc - Store A in A9
$03/9E4A BD 61 20 LDA $2061,x[$7E:2361] A:000F X:0300 Y:0000 P:envMxdizc - Load Target's Relative Speed Byte 2
$03/9E4D 85 AA STA $AA    [$00:00AA] A:0000 X:0300 Y:0000 P:envMxdiZc - Store A in AA
$03/9E4F BD 3B 20 LDA $203B,x[$7E:233B] A:0000 X:0300 Y:0000 P:envMxdiZc - Load Target's Speed Modifier
$03/9E52 A8 TAY A:0010 X:0300 Y:0000 P:envMxdizc - Transfer A to Y
$03/9E53 8C 79 39 STY $3979  [$7E:3979] A:0010 X:0300 Y:0010 P:envMxdizc - Store Y in 3979
$03/9E56 DA PHX A:0010 X:0300 Y:0010 P:envMxdizc - Push X
$03/9E57 A5 D6 LDA $D6    [$00:00D6] A:0010 X:0300 Y:0010 P:envMxdizc - Load $D6 into A.
$03/9E5A AA TAX A:000C X:0300 Y:0010 P:envMxdizc - Transfer A to X
$03/9E5B BF 05 A0 03 LDA $03A005,x[$03:A011] A:000C X:000C Y:0010 P:envMxdizc - Load Something from Bank 3?
$03/9E5F 85 80 STA $80    [$00:0080] A:000D X:000C Y:0010 P:envMxdizc - Store A in 80.
$03/9E61 BF 06 A0 03 LDA $03A006,x[$03:A012] A:000D X:000C Y:0010 P:envMxdizc - Load the second byte of this from Byte 3?
$03/9E65 85 81 STA $81    [$00:0081] A:009F X:000C Y:0010 P:eNvMxdizc - Store A in 81.
$03/9E67 A9 03 LDA #$03 A:009F X:000C Y:0010 P:eNvMxdizc - Load 03 into A.
$03/9E69 85 82 STA $82    [$00:0082] A:0003 X:000C Y:0010 P:envMxdizc - Store A in 82.
$03/9E6B FA PLX A:0003 X:000C Y:0010 P:envMxdizc - Pull X
$03/9E6C DC 80 00 JML [$0080][$03:9F0D] A:0003 X:0300 Y:0010 P:envMxdizc - Jump Long to 039F0D (Why not branch Always? It's less than FF Bytes away after all?)
--------------------------------
03/9F0D AD 58 35 LDA $3558  [$7E:3558] A:0003 X:0300 Y:0010 P:envMxdizc - Load A from 3558. (PC or Enemy?)
$03/9F10 F0 05 BEQ $05    [$9F17] A:0001 X:0300 Y:0010 P:envMxdizc  - Branch if PC to 039F17
$03/9F12 BD 2F 20 LDA $202F,x[$7E:232F] A:0001 X:0300 Y:0010 P:envMxdizc - Load A from [b]?Target's Steal Defense?[/b]
$03/9F15 80 03 BRA $03    [$9F1A] A:000F X:0300 Y:0010 P:envMxdizc - Branch to 9F1A.
--------------------------------------
$03/9F17 BD 16 20 LDA $2016,x[$7E:2026] A:0023 X:0010 Y:0010 P:envMxdizc - Load A from Target's Modified Vitality
----------------------------------
$03/9F1A 18 CLC A:000F X:0300 Y:0010 P:envMxdizc - Clear Carry Flag
$03/9F1B 69 14 ADC #$14 A:000F X:0300 Y:0010 P:envMxdizc - [b]Add 14 to A.[/b]
$03/9F1D AA TAX A:0023 X:0300 Y:0010 P:envMxdizc - Transfer A to X
$03/9F1E 86 A9 STX $A9    [$00:00A9] A:0023 X:0023 Y:0010 P:envMxdizc - Store X in A9.
$03/9F20 20 E2 9F JSR $9FE2  [$03:9FE2] A:0023 X:0023 Y:0010 P:envMxdizc - Jump to Poison (Status?) Applying Routine.

 Well would you look at that! Another use for Cry, it... makes the target take Poison Damage just a little faster...

That is worthless, absolutely stupidly worthless. Well, fixing Poison to do something on the enemy rather than a silly wait Forever, is thankfully easier to change than I would have expected. Why the higher level an enemy is allows them to resist poison for much longer is frankly foolish. It's also too long on PC's so I think a good thing to change this to would be this..


$03/9F0D   AD 58 35   LDA $3558  [$7E:3558]   A:0023   X:0010   Y:0010   P:envMxdizc - Load A from 3558 (Enemy or PC?)
$03/9F10   F0 05   BEQ $05    [$9F17]   A:0023   X:0010   Y:0010   P:envMxdizc - Branch if PC to 039F17
$03/9F12   BD 3B 20   LDA $203B,x[$7E:204B]   A:0023   X:0010   Y:0010   P:envMxdizc - Load A from Monster's Speed Modifier (Default 10)
$03/9F15   80 03   BRA $03    [$9F1A]   A:0023   X:0010   Y:0010   P:envMxdizc - Branch to 039F1A
----------------------------------------------------------------------------------------------------------------
$03/9F17   BD 1F 20   LDA $202F,x[$7E:202F]   A:0023   X:0000   Y:0010   P:envMxdizc - Load PC's Status Resistance (A static value of varying amount depending on character)
-----------------------------------------------------------------------------------------------------------------
$03/9F1A   18    CLC   A:0023   X:0010   Y:0010   P:envMxdizc - Clear Carry Flag
$03/9F1B   69 04   ADC #$04   A:0023   X:0010   Y:0010   P:envMxdizc - Add 04 to end result
$03/9F1D   AA    TAX   A:0023   X:0010   Y:0010   P:envMxdizc - Transfer A to X.


And there we are! Poison has been rebalanced to occur much more often, rather than once in fifteen turns.

This may make it necessary to change the divisor though... so let's find that fast.

Poison's Damage Tick - Full Disassembly

Code: [Select]
$03/A8FD A6 A6 LDX $A6    [$00:00A6] A:0003 X:0006 Y:000D P:envMxdizc - Load Stat Location into X.
$03/A8FF BD 05 20 LDA $2005,x[$7E:2385] A:0003 X:0380 Y:000D P:envMxdizc - Load Afflicted's Status Byte 3
$03/A902 29 02 AND #$02 A:0000 X:0380 Y:000D P:envMxdiZc - Are they jumping?
$03/A904 D0 71 BNE $71    [$A977] A:0000 X:0380 Y:000D P:envMxdiZc - If so, branch past Poison.
$03/A906 BD 06 20 LDA $2006,x[$7E:2386] A:0000 X:0380 Y:000D P:envMxdiZc - Load Afflicted's Status Byte 4
$03/A909 30 6C BMI $6C    [$A977] A:0000 X:0380 Y:000D P:envMxdiZc - If they are Hiding, branch past Poison.
$03/A90B A5 D2 LDA $D2    [$00:00D2] A:0000 X:0380 Y:000D P:envMxdiZc - Load the value in D2 into A.
$03/A90D 0A ASL A A:0007 X:0380 Y:000D P:envMxdizc - x2 A.
$03/A90E AA TAX A:000E X:0380 Y:000D P:envMxdizc - Transfer A to X
$03/A90F BD 2A 2B LDA $2B2A,x[$7E:2B38] A:000E X:000E Y:000D P:envMxdizc - Load 2B2A into A.
$03/A912 85 A9 STA $A9    [$00:00A9] A:0014 X:000E Y:000D P:envMxdizc - Store A in A9.
$03/A914 BD 2B 2B LDA $2B2B,x[$7E:2B39] A:0014 X:000E Y:000D P:envMxdizc - Load 2B2B into A
$03/A917 85 AA STA $AA    [$00:00AA] A:0000 X:000E Y:000D P:envMxdiZc - Store A in AA.
$03/A919 AE 55 35 LDX $3555  [$7E:3555] A:0000 X:000E Y:000D P:envMxdiZc - Load X from 3555.
$03/A91C A5 A9 LDA $A9    [$00:00A9] A:0000 X:009C Y:000D P:envMxdizc - Load A9 into A.
$03/A91E 9D 04 2A STA $2A04,x[$7E:2AA0] A:0014 X:009C Y:000D P:envMxdizc - Store A in Status Duration.
$03/A921 A5 AA LDA $AA    [$00:00AA] A:0014 X:009C Y:000D P:envMxdizc - Load AA into A.
$03/A923 9D 05 2A STA $2A05,x[$7E:2AA1] A:0000 X:009C Y:000D P:envMxdiZc- Store A in Status Duration.
$03/A926 A9 40 LDA #$40 A:0000 X:009C Y:000D P:envMxdiZc - Load 40 into A.
$03/A928 9D 06 2A STA $2A06,x[$7E:2AA2] A:0040 X:009C Y:000D P:envMxdizc  Store A in 2A06.
$03/A92B C2 20 REP #$20 A:0040 X:009C Y:000D P:envMxdizc - Reset Processor Status
$03/A92D A6 A6 LDX $A6    [$00:00A6] A:0040 X:009C Y:000D P:envmxdizc - Load X from A6.
$03/A92F BD 09 20 LDA $2009,x[$7E:2389] A:0040 X:0380 Y:000D P:envmxdizc - **Load Target's Max HP into A**
$03/A932 20 85 84 JSR $8485  [$03:8485] A:0011 X:0380 Y:000D P:envmxdizc - **/8 Routine.**
$03/A935 85 A9 STA $A9    [$00:00A9] A:0002 X:0380 Y:000D P:envmxdizc - Store A in A9.
$03/A937 A5 A9 LDA $A9    [$00:00A9] A:0002 X:0380 Y:000D P:envmxdizc - Load A from A9.  (But... it was never changed?)
$03/A939 D0 02 BNE $02    [$A93D] A:0002 X:0380 Y:000D P:envmxdizc - Branch if not 00 to 03A93D
----------------------------------------------------------------------------------
$03/A93B E6 A9 INC $A9    [$00:00A9] A:0000 X:0380 Y:000D P:envmxdiZc - +1 to A9 (guaranteeing 1 damage)
----------------------------------------------------------------------------------
$03/A93D 7B TDC A:0002 X:0380 Y:000D P:envmxdizc - Transfer Direct Page.
$03/A93E E2 20 SEP #$20 A:0000 X:0380 Y:000D P:envmxdiZc - Set Processor Status.
$03/A940 A5 D2 LDA $D2    [$00:00D2] A:0000 X:0380 Y:000D P:envMxdiZc - Load A from D2.
$03/A942 0A ASL A A:0007 X:0380 Y:000D P:envMxdizc - x2 A.
$03/A943 AA TAX A:000E X:0380 Y:000D P:envMxdizc - Transfer A to X.
$03/A944 A5 A9 LDA $A9    [$00:00A9] A:000E X:000E Y:000D P:envMxdizc - Load enemy's /8 HP into A.
$03/A946 9D D4 34 STA $34D4,x[$7E:34E2] A:0002 X:000E Y:000D P:envMxdizc - Store A in Damage for the Slot.
$03/A949 A5 AA LDA $AA    [$00:00AA] A:0002 X:000E Y:000D P:envMxdizc - Load A from AA.
$03/A94B 9D D5 34 STA $34D5,x[$7E:34E3] A:0000 X:000E Y:000D P:envMxdiZc - Store A in second byte of Damage Slot.
$03/A94E 20 7E CA JSR $CA7E  [$03:CA7E] A:0000 X:000E Y:000D P:envMxdiZc - Jump to Damage Calculations.
$03/A951 A9 F8 LDA #$F8 A:0000 X:0680 Y:001A P:envMxdiZC - Load Damage Display into A.
$03/A953 8D C2 33 STA $33C2  [$7E:33C2] A:00F8 X:0680 Y:001A P:eNvMxdizC - Store A in Audiovisual Code.
$03/A956 A9 03 LDA #$03 A:00F8 X:0680 Y:001A P:eNvMxdizC - Load Damage Display into A.
$03/A958 8D C3 33 STA $33C3  [$7E:33C3] A:0003 X:0680 Y:001A P:envMxdizC - Store Message Box in Audiovisual Code.
$03/A95B A9 35 LDA #$35 A:0003 X:0680 Y:001A P:envMxdizC  - Load Message 35 into A.
$03/A95D 8D CA 34 STA $34CA  [$7E:34CA] A:0035 X:0680 Y:001A P:envMxdizC - Store Message 35 ("Damaged by Poison") into A.
(From this point on I don't understand what is happening)
$03/A960 A9 05 LDA #$05 A:0035 X:0680 Y:001A P:envMxdizC - Load 05 into A.
$03/A962 20 85 80 JSR $8085  [$03:8085] A:0005 X:0680 Y:001A P:envMxdizC - Jump to Subroutine (??)
$03/A965 20 B0 B1 JSR $B1B0  [$03:B1B0] A:0000 X:7940 Y:0004 P:envMxdiZC- Jump to Subroutine (??)
$03/A968 A9 11 LDA #$11 A:000D X:0600 Y:0033 P:envMxdiZC - Load 11 into A.
$03/A96A 20 85 80 JSR $8085  [$03:8085] A:0011 X:0600 Y:0033 P:envMxdizC - Jump to Subroutine (Maybe something with advancing frames?)
$03/A96D A9 0C LDA #$0C A:0000 X:0050 Y:0005 P:envMxdiZc - Load 0C into A.
$03/A96F 20 85 80 JSR $8085  [$03:8085] A:000C X:0050 Y:0005 P:envMxdizc - Jump to Subroutine (??)
$03/A972 A9 10 LDA #$10 A:0078 X:0004 Y:0012 P:envMxdizc - Load 10 into A.
$03/A974 20 85 80 JSR $8085  [$03:8085] A:0010 X:0004 Y:0012 P:envMxdizc - Jump to Subroutine (??)
$03/A977 60 RTS A:00FF X:0008 Y:0012 P:envMxdiZC - Return






Yes, I decided not to make it 1/16th as that would make it Completely useless, but what I did was change Poison to deal 1/8 of the afflicted's Current HP, therefore it is not broken, but it is not worthless as it deals continual damage to an enemy that you might not necessarily want to focus on at the moment.

$03/A92F   BD 09 20   LDA $2007,x[$7E:2387]   A:0040   X:0380   Y:000D   P:envmxdizc - **Load Target's Current HP into A**
$03/A932   20 85 84   JSR $8485  [$03:8485]   A:0011   X:0380   Y:000D   P:envmxdizc - **/8 Routine.**

« Last Edit: December 25, 2014, 08:40:41 PM by Grimoire LD »

avalanche

  • Mom Bomb
  • *
  • Posts: 122
    • View Profile
This poison post reminds me about some ATB status timer notes I made.  I don't want to hijack your post, but maybe you'll find it relevant with the disassembly analysis you do.  Sorry if this stuff is already well-known, just tell me to hush.  : )

First an area of RAM that the ToB docs didn't have full info for.
$29EB: 2-byte entries for each PC/monster slot in battle
  byte 0:  bits to enable each status timer for this PC/monster
      80: Stop
      40: "Main control timer" - used by normal player/AI control, also by impairment statuses like Sleep, Paralyze
      20: HP Leak
      10: Poison
      08: Gradual Petrification
      04: Wall/Reflect
      02: Count/Doom
      01: unknown
   byte 1:  Unknown

The bank 3 address you mentioned, at 03:A005 (ROM 1A205) is a table with at least 10 pointers to assembly routines that are used to calculate the duration for timers.  I don't have these fully figured out, but here's what I scribbled down.  BaseSpeed and SpeedModifier are the two speed elements in the ToB character record doc.

   0: (BaseSpeed * SpeedModifier) / 16 
        (aka normal time to next turn)
   1: 0 if player, SpeedModifier / 16 if monster
   2: duplicate pointer of #1
   3: ?
   4: MinOf1(300 - 4 * [ModifiedWill or unknown byte for monster]) * SpeedModifier / 16 / 6
        used by immobilizing status
   5: duplicate pointer of #4
   6: ([ModifiedVitality or unknown byte for monster] + 20) * SpeedModifier / 16
        used by poison, damage+poison, etc
   7: duplicate pointer of #6
        used by gradual petrification
   8: (SpellPowerByte? * 2 + 30) * SpeedModifier / 16
        used by Wall/Reflect
   9: ?
        used by HP Leak
   A: (SpellPowerByte? * 3) * SpeedModifier / 16
        Used by Stop, Magnet. I think Stop passes 10 decimal, Magnet 50 decimal.

   Not sure that the table stops there, but that is where I stopped.


Then at $2A04 are where the timers are stored for each slot.  As I think the ToB docs mentioned, they are $15 (hex) bytes long for each PC/monster which corresponds to 7 timer entries at 3 bytes each.  The order for these is the same as the enabling bits above:  Stop, "Main", HP Leak, Poison, Petrification, Wall, Count.

   bytes 0,1:  16-bit timer value.  This is decremented each ATB tick (if enabled with bits above)
                      and does something at zero.  Most of these are assigned by calling one of the assembly routines
                      listed above.  Count/Doom, for example, just copies the 10 from the spell power into it directly
                      (which to me is damning evidence that fast/slow does not affect Count, because the
                      SpeedModifier is not used in the formula)

   byte 2:       some flag bits.  I know when the main control timer's has 00 here, it means the player
                     or AI gets to choose what to do for the next turn.  I saw a lot of the others use 40 hex here frequently.
                     In short, it tells the code what to do when the timer reaches zero, but I didn't get many details.
                     I remember seeing another post here relating to values used here for queueing up actions, etc.


Happy Holidays everyone.

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Now this is useful! Extraordinarily so, in fact! Great work there Avalanche! As I've said before, (I don't believe to you) supply me with a line and a hook and I can catch a fish of any size! This is definitely the line to catch the Status Timer school of fish (granted your notes show that you've already dived through there, but may not have recorded the specifics down). So I'll mop that up and we should have a lot more freedom on status ailment timers by the time I'm finished.

Also a note: The "unknown byte" referred to as 2F is used by Enemies to resist Steal, and apparently status timers. (May also deal something with Odin) That amount is always Enemy Level +0A and the only thing that can effect it is Porom's Cry which reduces this byte by half of her own "Steal Defense" (which is always a default 0A) so 05.

I'll post on my results and edit this post as I go through the list. Again, thank you for setting this straight! How careless of me to not notice that a pointer was being generated.



3 - 039EA3 is called when a Spell is Cast.
Code: [Select]
$03/9EA3 AD 7B 39 LDA $397B  [$7E:397B] A:0003 X:0180 Y:0010 P:envMxdizc - Load A from Spell Number
$03/9EA6 85 DF STA $DF    [$00:00DF] A:0041 X:0180 Y:0010 P:envMxdizc - Store A in DF.
$03/9EA8 A9 06 LDA #$06 A:0041 X:0180 Y:0010 P:envMxdizc - Load 06 into A.
$03/9EAA 85 E1 STA $E1    [$00:00E1] A:0006 X:0180 Y:0010 P:envMxdizc - Store A in E1.
$03/9EAC 20 E0 83 JSR $83E0  [$03:83E0] A:0006 X:0180 Y:0010 P:envMxdizc - Jump to Subroutine (??)
$03/83E0 64 E0 STZ $E0    [$00:00E0] A:0006 X:0180 Y:0010 P:envMxdizc - Store Zero in E0.
$03/9EAF A6 E3 LDX $E3    [$00:00E3] A:0000 X:0000 Y:0010 P:envMxdiZc - Load X from E3.
$03/9EB1 BF A0 97 0F LDA $0F97A0,x[$0F:9926] A:0000 X:0186 Y:0010 P:envMxdizc - Load A from ROM 0F97A0 (Spell Designation)
$03/9EB5 29 1F AND #$1F A:00A0 X:0186 Y:0010 P:eNvMxdizc - Get rid of bits.
$03/9EB7 AA TAX A:0000 X:0186 Y:0010 P:envMxdiZc - Transfer A to X.
$03/9EB8 86 A9 STX $A9    [$00:00A9] A:0000 X:0000 Y:0010 P:envMxdiZc - Store X in A9.
$03/9EBA 06 A9 ASL $A9    [$00:00A9] A:0000 X:0000 Y:0010 P:envMxdiZc - x2 A9.
$03/9EBC 26 AA ROL $AA    [$00:00AA] A:0000 X:0000 Y:0010 P:envMxdiZc - x2 AA
$03/9EBE AD 8B 38 LDA $388B  [$7E:388B] A:0000 X:0000 Y:0010 P:envMxdiZc - Load Battle-Type (Battle or Auto-Battle)
$03/9EC1 F0 04 BEQ $04    [$9EC7] A:0000 X:0000 Y:0010 P:envMxdiZc - If Normal Battle, branch.
---------------------------------------------------------------

--------------------------------------------------------------
$03/9EC7 20 E2 9F JSR $9FE2  [$03:9FE2] A:0000 X:0000 Y:0010 P:envMxdiZc - Jump to Subroutine  (??)
$03/9ECA 4C D9 9F JMP $9FD9  [$03:9FD9] A:0000 X:0000 Y:0010 P:envMxdiZc - Jump out of Routine.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/9FD9 A4 AB LDY $AB    [$00:00AB] A:0000 X:0000 Y:0010 P:envMxdiZc - Load Y from AB.
$03/9FDB 10 02 BPL $02    [$9FDF] A:0000 X:0000 Y:0000 P:envMxdiZc - Branch if plus
----------------------------------------------------

-------------------------------------------------
$03/9FDF 84 D4 STY $D4    [$00:00D4] A:0000 X:0000 Y:0000 P:envMxdiZc - Store Y in D4.
$03/9FE1 60 RTS A:0000 X:0000 Y:0000 P:envMxdiZc - Return
(Of note, this jump to 9FD9 seems to be universal in these timer dealings.)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

To my eyes it seems as if this routine is only meant to be used in Auto-Battles which likely makes the spell take place close to immediately rather than using it's actual Charge time, possibly? It did reveal that the Spell Number is stored somewhere when cast and where, so that could be useful.

4 - Sleep/Hold Timer 039ECD

Code: [Select]
$03/9ECD AD 58 35 LDA $3558  [$7E:3558] A:0003 X:0100 Y:0010 P:envMxdizc - PC or Enemy
$03/9ED0 F0 05 BEQ $05    [$9ED7] A:0000 X:0100 Y:0010 P:envMxdiZc - If PC branch.
-------------------------------------------------------------------------------------------------------
$03/9ED2 BD 2F 20 LDA $202F,x[$7E:212F] A:0000 X:0100 Y:0010 P:envMxdiZC - Load Target's "Status/Steal Defense" into A.
$03/9ED5 80 03 BRA $03    [$9EDA] A:0000 X:0100 Y:0010 P:envMxdiZC - Branch past the Will check.
----------------------------------------------------------------------------------------------------------
$03/9ED7 BD 18 20 LDA $2018,x[$7E:2118] A:0000 X:0100 Y:0010 P:envMxdiZc - Load Target's Will into A.
$03/9EDA 85 AD STA $AD    [$00:00AD] A:0027 X:0100 Y:0010 P:envMxdizc - Store A in AD.
$03/9EDC 06 AD ASL $AD    [$00:00AD] A:0027 X:0100 Y:0010 P:envMxdizc - x2 A
$03/9EDE 06 AD ASL $AD    [$00:00AD] A:0027 X:0100 Y:0010 P:envMxdizc - x2 A
$03/9EE0 38 SEC A:0027 X:0100 Y:0010 P:eNvMxdizc - Set Carry
$03/9EE1 A9 2C LDA #$2C A:0027 X:0100 Y:0010 P:eNvMxdizC - Load 2C into A.
$03/9EE3 E5 AD SBC $AD    [$00:00AD] A:002C X:0100 Y:0010 P:envMxdizC - Subtract 2C from Target's x4 Will/SD.
$03/9EE5 85 A9 STA $A9    [$00:00A9] A:0090 X:0100 Y:0010 P:eNVMxdizc - Store A in A9.
$03/9EE7 A9 01 LDA #$01 A:0090 X:0100 Y:0010 P:eNVMxdizc - Load 01 into A.
$03/9EE9 E9 00 SBC #$00 A:0001 X:0100 Y:0010 P:enVMxdizc - Subtract A?
$03/9EEB 85 AA STA $AA    [$00:00AA] A:0000 X:0100 Y:0010 P:envMxdiZC - Store A in AA.
$03/9EED B0 05 BCS $05    [$9EF4] A:0000 X:0100 Y:0010 P:envMxdiZC - Branch if 00 or less? (I fail to see how this could be anything but 00)
------------------------------------------------------------------------------------------------------
$03/9EEF A2 01 00 LDX #$0001 A:0000 X:0100 Y:0010 P:envMxdiZC - Load 0001 into X.
$03/9EF2 86 A9 STX $A9    [$00:00A9] A:0000 X:0100 Y:0010 P:envMxdiZC - Store X in A9. (Seems to be an "If below 00, make 01"?
-------------------------------------------------------------------------------------------------------
$03/9EF4 20 E2 9F JSR $9FE2  [$03:9FE2] A:0000 X:0100 Y:0010 P:envMxdiZC - ? Universal to Status Timers.
$03/9EF7 A6 AB LDX $AB    [$00:00AB] A:0000 X:0090 Y:0010 P:envMxdizc - Load X from AB (Speed Modifier?)
$03/9EF9 8E 45 39 STX $3945  [$7E:3945] A:0000 X:0090 Y:0010 P:envMxdizc - Store X in 3945.
$03/9EFC A2 06 00 LDX #$0006 A:0000 X:0090 Y:0010 P:envMxdizc - Load 0006 into X.
$03/9EFF 8E 47 39 STX $3947  [$7E:3947] A:0000 X:0006 Y:0010 P:envMxdizc - Store X in 3947.
$03/9F02 20 07 84 JSR $8407  [$03:8407] A:0000 X:0006 Y:0010 P:envMxdizc - ??
$03/8407 C2 20 REP #$20 A:0000 X:0006 Y:0010 P:envMxdizc - Reset Processor Status
$03/9F05 AE 49 39 LDX $3949  [$7E:3949] A:0000 X:0000 Y:0010 P:envMxdiZc - Load X from 3949.
$03/9F08 86 AB STX $AB    [$00:00AB] A:0000 X:0018 Y:0010 P:envMxdizc - Store X in AB
$03/9F0A 4C D9 9F JMP $9FD9  [$03:9FD9] A:0000 X:0018 Y:0010 P:envMxdizc - Finish status Timer (Universal to Status Timers)


That 2C would likely be the matter to change for Paralysis/Sleep Status from a default point. I'm not sure I saw where a /16 or a /6 was. Did I miss the meaning somewhere in there?


Poison's already been taken care of, so... wait, Gradual Petrification is in there as well...? Hmm... phew, well I can just tie Gradual Petrification's timer than to the timer of Hold/Sleep, the timing seems similar and I would think that a magical fortitude would be better for resisting the petrification of the body personally.

This did alert me to a really stupid coding mistake I made with Rebalanced Poison though, oy... I set the resistance to 201F, rather than the character's innate "Status Defense" byte.


8 - Timer used by Wall/(Barrier?) 039F26

Code: [Select]
$03/9F26 AD 7B 39 LDA $397B  [$7E:397B] A:0003 X:0200 Y:0010 P:envMxdizc - Load Spell Power (Why it's spell power and not in the Spell Cast, I have no idea) into A.
$03/9F29 85 AD STA $AD    [$00:00AD] A:0000 X:0200 Y:0010 P:envMxdiZc - Store A in AD
$03/9F2B 64 AE STZ $AE    [$00:00AE] A:0000 X:0200 Y:0010 P:envMxdiZc - Store Zero in AE.
$03/9F2D 06 AD ASL $AD    [$00:00AD] A:0000 X:0200 Y:0010 P:envMxdiZc - x2 AD
$03/9F2F 26 AE ROL $AE    [$00:00AE] A:0000 X:0200 Y:0010 P:envMxdiZc - x2 AD
$03/9F31 18 CLC A:0000 X:0200 Y:0010 P:envMxdiZc - Clear Carry Flag.
$03/9F32 A5 AD LDA $AD    [$00:00AD] A:0000 X:0200 Y:0010 P:envMxdiZc - Load the value from AD into A.
$03/9F34 69 1E ADC #$1E A:0000 X:0200 Y:0010 P:envMxdiZc - Add 1E into A.
$03/9F36 85 A9 STA $A9    [$00:00A9] A:001E X:0200 Y:0010 P:envMxdizc - Store A in A9.
$03/9F38 A5 AE LDA $AE    [$00:00AE] A:001E X:0200 Y:0010 P:envMxdizc - Load the value from AE into A.
$03/9F3A 69 00 ADC #$00 A:0000 X:0200 Y:0010 P:envMxdiZc - Add 00.
$03/9F3C 85 AA STA $AA    [$00:00AA] A:0000 X:0200 Y:0010 P:envMxdiZc - Store A in AA.
$03/9F3E 20 E2 9F JSR $9FE2  [$03:9FE2] A:0000 X:0200 Y:0010 P:envMxdiZc - ? Universal to Status Timers.
$03/9F41 4C D9 9F JMP $9FD9  [$03:9FD9] A:0000 X:0046 Y:0010 P:envMxdizc - Finish Status Timer.

An interesting thought, so it takes the Spell Power of which Wall is being used (default Wall spell is 00, Item is 10, and Barrier is 14) and x4's that value before adding 1E to it. Simple enough, and simple enough for anyone desiring to change.


9 - HP Leak 039F44

Code: [Select]
$03/9F44 AD 58 35 LDA $3558  [$7E:3558] A:0003 X:0080 Y:0010 P:envMxdizc - PC or Enemy
$03/9F47 F0 0B BEQ $0B    [$9F54] A:0000 X:0080 Y:0010 P:envMxdiZc - Branch if Enemy
-------------------------------------------------
$03/9F49 BD 2F 20 LDA $202F,x[$7E:204D] A:0000 X:001E Y:0010 P:envMxdizc - Load Enemy's Status Resistance Byte
$03/9F4C 85 AD STA $AD    [$00:00AD] A:0000 X:001E Y:0010 P:envMxdizc - Store A in AD.
$03/9F4E A9 04 LDA #$04 A:0000 X:001E Y:0010 P:envMxdizc - Load 04 into A.
$03/9F50 85 AE STA $AE    [$00:00AE] A:0000 X:001E Y:0010 P:envMxdizc - Store A in AE,
$03/9F52 80 0D BRA $0D    [$9F61] A:0000 X:001E Y:0010 P:envMxdizc - Branch past Wisdom/Will adding.
-------------------------------------------------
$03/9F54 18 CLC A:0000 X:0080 Y:0010 P:envMxdiZc - Clear Carry Flag
$03/9F55 BD 17 20 LDA $2017,x[$7E:2097] A:0000 X:0080 Y:0010 P:envMxdiZc - Load Target's Modified Wisdom
$03/9F58 7D 18 20 ADC $2018,x[$7E:2098] A:0003 X:0080 Y:0010 P:envMxdizc - Add Target's Modified Will - Store value in AD.
$03/9F5B 85 AD STA $AD    [$00:00AD] A:0009 X:0080 Y:0010 P:envMxdizc - Store A in AD.
$03/9F5D A9 02 LDA #$02 A:0009 X:0080 Y:0010 P:envMxdizc - Load 02 into A.
$03/9F5F 85 AE STA $AE    [$00:00AE] A:0002 X:0080 Y:0010 P:envMxdizc - Store A in AE.
$03/9F61 A5 AD LDA $AD    [$00:00AD] A:0002 X:0080 Y:0010 P:envMxdizc - Load Wisdom+Will into A.
$03/9F63 85 DF STA $DF    [$00:00DF] A:0009 X:0080 Y:0010 P:envMxdizc - Store A in DF.
$03/9F65 A5 AE LDA $AE    [$00:00AE] A:0009 X:0080 Y:0010 P:envMxdizc - Load AE into A.
$03/9F67 85 E2 STA $E2    [$00:00E2] A:0002 X:0080 Y:0010 P:envMxdizc - Store A in E2.
$03/9F69 20 E0 83 JSR $83E0  [$03:83E0] A:0002 X:0080 Y:0010 P:envMxdizc - Jump to Subroutine (??)
$03/9F6C 18 CLC A:0000 X:0000 Y:0010 P:envMxdiZc - Clear Carry Flag
$03/9F6D A5 E3 LDA $E3    [$00:00E3] A:0000 X:0000 Y:0010 P:envMxdiZc - Load A from E3.
$03/9F6F 69 1E ADC #$1E A:0000 X:0000 Y:0010 P:envMxdiZc - Add 1E to A.
$03/9F71 85 A9 STA $A9    [$00:00A9] A:001E X:0000 Y:0010 P:envMxdizc - Store A in A9.
$03/9F73 A5 E4 LDA $E4    [$00:00E4] A:001E X:0000 Y:0010 P:envMxdizc - Load A from E4.
$03/9F75 69 00 ADC #$00 A:0000 X:0000 Y:0010 P:envMxdiZc - Add 00 into A.
$03/9F77 85 AA STA $AA    [$00:00AA] A:0000 X:0000 Y:0010 P:envMxdiZc - Store A in AA.
$03/9F79 20 E2 9F JSR $9FE2  [$03:9FE2] A:0000 X:0000 Y:0010 P:envMxdiZc - ? Universal to Status Timers
$03/9F7C 4C D9 9F JMP $9FD9  [$03:9FD9] A:0000 X:001E Y:0010 P:envMxdizc - Finish Status Timers.


I thought that HP Leak was a guaranteed 30 ticks? This shows a different reality, what that means is difficult though. You can change the 1E to anything you like though and generally that makes it so you can control the duration.

 A: (SpellPowerByte? * 3) * SpeedModifier / 16
        Used by Stop, Magnet. I think Stop passes 10 decimal, Magnet 50 decimal. - 039F7F

Code: [Select]
$03/9F7F AD 7B 39 LDA $397B  [$7E:397B] A:0003 X:0280 Y:0010 P:envMxdizc - Load Spell Power Byte
$03/9F82 85 DF STA $DF    [$00:00DF] A:0032 X:0280 Y:0010 P:envMxdizc - Store Spell Power in DF.
$03/9F84 A9 03 LDA #$03 A:0032 X:0280 Y:0010 P:envMxdizc - Load 03 into A.
$03/9F86 85 E1 STA $E1    [$00:00E1] A:0003 X:0280 Y:0010 P:envMxdizc - Store A in E1.
$03/9F88 20 E0 83 JSR $83E0  [$03:83E0] A:0003 X:0280 Y:0010 P:envMxdizc - Jump to Subroutine (??)
$03/9F8B A6 E3 LDX $E3    [$00:00E3] A:0000 X:0000 Y:0010 P:envMxdiZc - Load X from E3.
$03/9F8D 86 A9 STX $A9    [$00:00A9] A:0000 X:0096 Y:0010 P:envMxdizc - Store X in A9.
$03/9F8F 20 E2 9F JSR $9FE2  [$03:9FE2] A:0000 X:0096 Y:0010 P:envMxdizc - ? Universal to Status Timers
$03/9F92 4C D9 9F JMP $9FD9  [$03:9FD9] A:0000 X:0096 Y:0010 P:envMxdizc - Finish Status Timers.
Well, that was short. Like Very short. Apparently that's stop. Hah.

Count still needs accounted for so it must be one of these remaining ones.

Count is in 03A005, which is even before the normal timer, they must have really wanted this status.

-1 - Count 039E6F

Code: [Select]
$03/9E6F 20 E2 9F JSR $9FE2  [$03:9FE2] A:0003 X:0300 Y:0010 P:envMxdizc - ? Universal in Status Timers
$03/9FE2 A6 A9 LDX $A9    [$00:00A9] A:0003 X:0300 Y:0010 P:envMxdizc - Load X from A9.
$03/9E72 A4 AB LDY $AB    [$00:00AB] A:0000 X:0041 Y:0010 P:envMxdizc - Load Y from AB.
$03/9E74 D0 02 BNE $02    [$9E78] A:0000 X:0041 Y:0041 P:envMxdizc - Branch if not 00.
------------------------------------------
$03/9E76 E6 AB INC $AB    [$00:00AB] A:0000 X:0041 Y:0041 P:envMxdizc - +1 to AB
--------------------------------------------
$03/9E78 4C D9 9F JMP $9FD9  [$03:9FD9] A:0000 X:0041 Y:0041 P:envMxdizc - Finish Status Timer (What?!)

Well... that was uneventful, so nothing with Count is actually in Count's status timer address.


Well that covers (most) Status Timers. Now it's just a matter of finding specifics in the Status themselves.
« Last Edit: December 26, 2014, 12:00:34 PM by Grimoire LD »

avalanche

  • Mom Bomb
  • *
  • Posts: 122
    • View Profile
Thanks!  My purposes were just to figure out the fundamentals of the ATB system, including how long between each turn and how long each status timer typically lasts.  I hadn't come across discussion that quite satisfied my need for something more formulaic.  The most interesting thing to me is that the ATB ticks are paused almost all the time.  Any time a character or monster is performing an action, showing a spell animation, showing a message on the top of the screen, the timers all wait.  This can be witnessed with a very short casting period for a spell when nothing else is happening vs a very long casting period if any other players or monsters are "doing" something.

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Far too long if you ask me, yes I noticed this as well that the game's battle system is generally slow, I even removed the "Damaged from Poison" text box because it is generally clear why something is taking the damage that they're taking. I do wonder if they made an error with HP Leak though, wearing off after 40 ticks of 1 HP seems ill-made, I imagine it was meant to go for a lot longer or deal a lot more damage at one point in time. But as far as I'm aware no remake has bothered to make it do more than that.

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Well, that was interesting. I found what I was looking for and here is the useful information to the casual hacker who may not want to pore through code to find inexact numbers.

Sleep/Hold Timer

Enemy Only
$03/9ED2   BD 2F 20   LDA $202F,x[$7E:212F]   A:0000   X:0100   Y:0010   P:envMxdiZC - Load Target's "Status/Steal Defense" into A.

PC Only
$03/9ED7   BD 18 20   LDA $2018,x[$7E:2118]   A:0000   X:0100   Y:0010   P:envMxdiZc - Load Target's Will into A.

Timer
$03/9EE1   A9 2C   LDA #$2C   A:0027   X:0100   Y:0010   P:eNvMxdizC - Load 2C into A. (From there it subtracts 2C from the value of Will/Status Defense x4)

Wall/Barrier Timer

What is Loaded
$03/9F26   AD 7B 39   LDA $397B  [$7E:397B]   A:0003   X:0200   Y:0010   P:envMxdizc - Load Spell Power (10 for Wall Item and 20 for Barrier Item)
$03/9F2D   06 AD   ASL $AD    [$00:00AD]   A:0000   X:0200   Y:0010   P:envMxdiZc - x2 AD
$03/9F2F   26 AE   ROL $AE    [$00:00AE]   A:0000   X:0200   Y:0010   P:envMxdiZc - x2 AD (if over 255 only)

Timer
$03/9F34   69 1E   ADC #$1E   A:0000   X:0200   Y:0010   P:envMxdiZc - Add 1E into A. (Spell Power x2 +1E (30) Ticks.)

HP Leak - There's some kind of Wisdom+Will combo here which does... something, but it's likely not that major. What is the important part is this...

Timer
$03/9F6F   69 1E   ADC #$1E   A:0000   X:0000   Y:0010   P:envMxdiZc - Add 1E to A. (30 Ticks as DeathLike2's FAQ says.)

Stop

Timer is based on Spell Power only.

$03/9F7F   AD 7B 39   LDA $397B  [$7E:397B]   A:0003   X:0280   Y:0010   P:envMxdizc - Load Spell Power Byte

Poison/Gradual Petrification (Yes they share the same timer, not sure what idiot thought that was a good idea!)

Enemy
$03/9F12   BD 2F 20   LDA $202F,x[$7E:232F]   A:0001   X:0300   Y:0010   P:envMxdizc - Load A from Target's Status Defense

PC
$03/9F17   BD 16 20   LDA $2016,x[$7E:2026]   A:0023   X:0010   Y:0010   P:envMxdizc - Load A from Target's Modified Vitality

Timer
$03/9F1B   69 14   ADC #$14   A:000F   X:0300   Y:0010   P:envMxdizc - Add 14 to Target's Modified Vitality/Status Defense

And there you have it! All of the Status Timers to see where these are in ROM just add 1FE00 to these values. (Remember, non-headered ROM)

 :edit:
Heh, well Count's Timer is silly simple. It's the Spell Power of any spell that casts Count. All things with Count are mostly drawn from my initial Routine recording.

Count Routine





« Last Edit: December 26, 2014, 12:21:44 PM by Grimoire LD »

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Well, I had a post all ready to go but now I've lost the vast majority of it due to my idiocy so here are the notes at least, but now I need to collect the pointers again and what they reference. Thankfully I saved (most) of the ASM work, I will need to redo Count again though.

Pointers to Status Expirations

Located at 038922

Status Expirations

03A897 - Stop Timer
03A8CC - Hold/Sleep Timer
03A8E6 - HP Leak
03A8FD - Poison
03A978 - Gradual Petrification
03A9D8 - Wall
03A9EF  - Count

Stop Timer Expiration

Code: [Select]
$03/A897 A6 A6 LDX $A6    [$00:00A6] A:0003 X:0000 Y:000D P:envMxdizc - Load Target Identifier.
$03/A899 BD 05 20 LDA $2005,x[$7E:2305] A:0003 X:0300 Y:000D P:envMxdizc - Load Status Byte 04 into A.
$03/A89C 29 BF AND #$BF A:0040 X:0300 Y:000D P:envMxdizc - Get rid of 40 (Stop) from A.
$03/A89E 9D 05 20 STA $2005,x[$7E:2305] A:0000 X:0300 Y:000D P:envMxdiZc - Store A in Status Byte 05.
$03/A8A1 AE 30 35 LDX $3530  [$7E:3530] A:0000 X:0300 Y:000D P:envMxdiZc - Load X from a Pointer x15?
$03/A8A4 9E 06 2A STZ $2A06,x[$7E:2A84] A:0000 X:007E Y:000D P:envMxdizc - Store Zero in Status Duration.
$03/A8A7 A9 03 LDA #$03 A:0000 X:007E Y:000D P:envMxdizc - Load 03 into A.
$03/A8A9 20 69 85 JSR $8569  [$03:8569] A:0003 X:007E Y:000D P:envMxdizc - Jump to Subroutine (??)
$03/A8AF BD 06 2A LDA $2A06,x[$7E:2A87] A:0000 X:0081 Y:000D P:envMxdizc - Load Status Duration into A.
$03/A8B2 10 0B BPL $0B    [$A8BF] A:0000 X:0081 Y:000D P:envMxdiZc - Branch if positive.
--------------------------------------------------------------------------------------------------
$03/A8B4 9E 06 2A STZ $2A06,x[$7E:2A12] A:0040 X:000C Y:000D P:envMxdizc - Store Zero in Status Duration3.
$03/A8B7 A9 01 LDA #$01 A:0040 X:000C Y:000D P:envMxdizc - Load 01 into A.
$03/A8B9 9D 04 2A STA $2A04,x[$7E:2A10] A:0040 X:000C Y:000D P:envMxdizc - Store A in Status Duration1.
$03/A8BC 9E 05 2A STZ $2A05,x[$7E:2A11] A:0040 X:000C Y:000D P:envMxdizc Store Zero in Status Duration2.
--------------------------------------------------------------------------------------------------------
$03/A8BF A5 D2 LDA $D2    [$00:00D2] A:0000 X:0081 Y:000D P:envMxdiZc - Load A from D2.
$03/A8C1 0A ASL A A:0006 X:0081 Y:000D P:envMxdizc - x2 A.
$03/A8C2 AA TAX A:000C X:0081 Y:000D P:envMxdizc - Transfer A to X.
$03/A8C3 BD EB 29 LDA $29EB,x[$7E:29F7] A:000C X:000C Y:000D P:envMxdizc - Load Status Expirations.
$03/A8C6 29 7F AND #$7F A:00C0 X:000C Y:000D P:eNvMxdizc - Get rid of 81.
$03/A8C8 9D EB 29 STA $29EB,x[$7E:29F7] A:0040 X:000C Y:000D P:envMxdizc - Store A in Status Expirations.
$03/A8CB 60 RTS A:0040 X:000C Y:000D P:envMxdizc - Return



Sleep/Paralysis Timer Expiration.
Code: [Select]
$03/A8CC A6 A6 LDX $A6    [$00:00A6] A:0003 X:0002 Y:000D P:envMxdizc - Load Target Identifier.
$03/A8CE BD 04 20 LDA $2004,x[$7E:2404] A:0003 X:0400 Y:000D P:envMxdizc - Load Status Byte 2.
$03/A8D1 29 CF AND #$CF A:0020 X:0400 Y:000D P:envMxdizc - Get rid of Sleep and Paralysis (30)
$03/A8D3 9D 04 20 STA $2004,x[$7E:2404] A:0000 X:0400 Y:000D P:envMxdiZc - Store A in Status Byte 2.
$03/A8D6 64 D6 STZ $D6    [$00:00D6] A:0000 X:0400 Y:000D P:envMxdiZc - Store Zero in D6.
$03/A8D8 A5 D2 LDA $D2    [$00:00D2] A:0000 X:0400 Y:000D P:envMxdiZc - Load A from D2.
$03/A8DA 20 36 9E JSR $9E36  [$03:9E36] A:0008 X:0400 Y:000D P:envMxdizc - Jump to Subroutine (??)
$03/A8DD A9 03 LDA #$03 A:0000 X:0041 Y:0041 P:envMxdizc - Load 03 into A.
$03/A8DF 20 C8 85 JSR $85C8  [$03:85C8] A:0003 X:0041 Y:0041 P:envMxdizc - ??
$03/A8E2 9E 06 2A STZ $2A06,x[$7E:2AB1] A:0000 X:00AB Y:0041 P:envMxdiZc - Store Zero in Status Duration
$03/A8E5 60 RTS A:0000 X:00AB Y:0041 P:envMxdiZc - Return.

HP Leak Expiration

Code: [Select]
$03/A8E6 A6 A6 LDX $A6    [$00:00A6] A:0003 X:0004 Y:000D P:envMxdizc - Load Target Identifier Byte
$03/A8E8 BD 06 20 LDA $2006,x[$7E:2206] A:0003 X:0200 Y:000D P:envMxdizc - Load Status Byte 04.
$03/A8EB 29 BF AND #$BF A:0040 X:0200 Y:000D P:envMxdizc - Get rid of 40 (HP Leak).
$03/A8ED 9D 06 20 STA $2006,x[$7E:2206] A:0000 X:0200 Y:000D P:envMxdiZc - Store A in Status Byte 04.
$03/A8F0 A5 D2 LDA $D2    [$00:00D2] A:0000 X:0200 Y:000D P:envMxdiZc - Load Pointer into A.
$03/A8F2 0A ASL A A:0004 X:0200 Y:000D P:envMxdizc  - x2 A.
$03/A8F3 AA TAX A:0008 X:0200 Y:000D P:envMxdizc - Transfer A to X.
$03/A8F4 BD EB 29 LDA $29EB,x[$7E:29F3] A:0008 X:0008 Y:000D P:envMxdizc - Load Status Duration into A.
$03/A8F7 29 DF AND #$DF A:0060 X:0008 Y:000D P:envMxdizc - Get rid of 20 bit.
$03/A8F9 9D EB 29 STA $29EB,x[$7E:29F3] A:0040 X:0008 Y:000D P:envMxdizc - Store A Status Duration.
$03/A8FC 60 RTS A:0040 X:0008 Y:000D P:envMxdizc - Return


Poison Progress (Is up several posts)




Gradual Petrification Progress

Code: [Select]
$03/A978 A6 A6 LDX $A6    [$00:00A6] A:0003 X:0008 Y:000D P:envMxdizc - Load Target Identifier into A.
$03/A97A BD 05 20 LDA $2005,x[$7E:2105] A:0003 X:0100 Y:000D P:envMxdizc - Load Target's Status Byte 3 into A.
$03/A97D 29 02 AND #$02 A:0000 X:0100 Y:000D P:envMxdiZc - Get rid of all bits that are not Jumping
$03/A97F D0 56 BNE $56    [$A9D7] A:0000 X:0100 Y:000D P:envMxdiZc - If Jumping branch to Return.
$03/A981 BD 06 20 LDA $2006,x[$7E:2106] A:0000 X:0100 Y:000D P:envMxdiZc - Load Status Byte 04.
$03/A984 30 51 BMI $51    [$A9D7] A:0001 X:0100 Y:000D P:envMxdizc - Branch if Hiding to Return.
$03/A986 BD 04 20 LDA $2004,x[$7E:2104] A:0001 X:0100 Y:000D P:envMxdizc - Load Status Byte 02.
$03/A989 29 03 AND #$03 A:0001 X:0100 Y:000D P:envMxdizc - Get rid of all bits that are not Petrify1/2.
$03/A98B 1A INC A A:0001 X:0100 Y:000D P:envMxdizc - +1 to A.
$03/A98C 85 A9 STA $A9    [$00:00A9] A:0002 X:0100 Y:000D P:envMxdizc - Store A in A9.
$03/A98E C9 04 CMP #$04 A:0002 X:0100 Y:000D P:envMxdizc - Is it 04? (Full Petrification)
$03/A990 D0 1D BNE $1D    [$A9AF] A:0002 X:0100 Y:000D P:eNvMxdizc If not, branch.
-------------------------------------------------------------------------------------------------------------
$03/A992 BD 04 20 LDA $2004,x[$7E:2104] A:0004 X:0100 Y:000D P:envMxdiZC - Load Status Byte 02 into A.
$03/A995 29 FC AND #$FC A:0003 X:0100 Y:000D P:envMxdizC - Get rid of these Petrify1/2.
$03/A997 9D 04 20 STA $2004,x[$7E:2104] A:0000 X:0100 Y:000D P:envMxdiZC - Store A in Status Byte 02.
$03/A99A BD 03 20 LDA $2003,x[$7E:2103] A:0000 X:0100 Y:000D P:envMxdiZC - Load Status byte 01. 
$03/A99D 09 40 ORA #$40 A:0000 X:0100 Y:000D P:envMxdiZC - Add Petrification to A.
$03/A99F 9D 03 20 STA $2003,x[$7E:2103] A:0040 X:0100 Y:000D P:envMxdizC - Store A in Status Byte 01.
$03/A9A2 A5 D2 LDA $D2    [$00:00D2] A:0040 X:0100 Y:000D P:envMxdizC - Load A from D2.
$03/A9A4 0A ASL A A:0002 X:0100 Y:000D P:envMxdizC - x2 A.
$03/A9A5 AA TAX A:0004 X:0100 Y:000D P:envMxdizc - Transfer A to X.
$03/A9A6 AD EB 29 LDA $29EB  [$7E:29EB] A:0004 X:0004 Y:000D P:envMxdizc - Load A from Status Expiration
$03/A9A9 29 F7 AND #$F7 A:0048 X:0004 Y:000D P:envMxdizc - Get rid of Bit 08.
$03/A9AB 8D EB 29 STA $29EB  [$7E:29EB] A:0040 X:0004 Y:000D P:envMxdizc - Store A in Status Expiration
$03/A9AE 60 RTS A:0040 X:0004 Y:000D P:envMxdizc - Return
-------------------------------------------------------------------------------------------------------------
$03/A9AF BD 04 20 LDA $2004,x[$7E:2104] A:0002 X:0100 Y:000D P:eNvMxdizc - Load Status Byte 02.
$03/A9B2 05 A9 ORA $A9    [$00:00A9] A:0001 X:0100 Y:000D P:envMxdizc - Add 1 if applicable.
$03/A9B4 9D 04 20 STA $2004,x[$7E:2104] A:0003 X:0100 Y:000D P:envMxdizc - Store A in Status Byte 02
$03/A9B7 A5 D2 LDA $D2    [$00:00D2] A:0003 X:0100 Y:000D P:envMxdizc - Load D2 into A.
$03/A9B9 0A ASL A A:0002 X:0100 Y:000D P:envMxdizc - x2 A.
$03/A9BA AA TAX A:0004 X:0100 Y:000D P:envMxdizc - Transfer A to X.
$03/A9BB BD 44 2B LDA $2B44,x[$7E:2B48] A:0004 X:0004 Y:000D P:envMxdizc - Load A from 2B44.
$03/A9BE 85 A9 STA $A9    [$00:00A9] A:0021 X:0004 Y:000D P:envMxdizc - Store A in A9.
$03/A9C0 BD 45 2B LDA $2B45,x[$7E:2B49] A:0021 X:0004 Y:000D P:envMxdizc - Load A from 2B46.
$03/A9C3 85 AA STA $AA    [$00:00AA] A:0000 X:0004 Y:000D P:envMxdiZc - Store A in AA
$03/A9C5 AE 55 35 LDX $3555  [$7E:3555] A:0000 X:0004 Y:000D P:envMxdiZc - Load X into 3555.
$03/A9C8 A5 A9 LDA $A9    [$00:00A9] A:0000 X:0036 Y:000D P:envMxdizc - Load A from A9.
$03/A9CA 9D 04 2A STA $2A04,x[$7E:2A3A] A:0021 X:0036 Y:000D P:envMxdizc - Store A in Status Duration Slot.
$03/A9CD A5 AA LDA $AA    [$00:00AA] A:0021 X:0036 Y:000D P:envMxdizc - Load A from AA.
$03/A9CF 9D 05 2A STA $2A05,x[$7E:2A3B] A:0000 X:0036 Y:000D P:envMxdiZc - Store A in Status Duration Slot.
$03/A9D2 A9 40 LDA #$40 A:0000 X:0036 Y:000D P:envMxdiZc - Load 40 into A.
$03/A9D4 9D 06 2A STA $2A06,x[$7E:2A3C] A:0040 X:0036 Y:000D P:envMxdizc  Store A in Status Duration Slot.
$03/A9D7 60 RTS A:0040 X:0036 Y:000D P:envMxdizc - Return

Wall's Expiration Timer

Code: [Select]

$03/A9D8 A6 A6 LDX $A6    [$00:00A6] A:0003 X:000A Y:000D P:envMxdizc - Load Target Identifier into A.
$03/A9DA BD 06 20 LDA $2006,x[$7E:2206] A:0003 X:0200 Y:000D P:envMxdizc - Load Status Byte 04 into A.
$03/A9DD 29 DF AND #$DF A:0020 X:0200 Y:000D P:envMxdizc - Get rid of 20 Bit (Wall)
$03/A9DF 9D 06 20 STA $2006,x[$7E:2206] A:0000 X:0200 Y:000D P:envMxdiZc - Store A in Status Byte 04.
$03/A9E2 A5 D2 LDA $D2    [$00:00D2] A:0000 X:0200 Y:000D P:envMxdiZc - Load A from D2 (Possibly a pointer)
$03/A9E4 0A ASL A A:0004 X:0200 Y:000D P:envMxdizc - x2 A
$03/A9E5 AA TAX A:0008 X:0200 Y:000D P:envMxdizc - Transfer A to X.
$03/A9E6 BD EB 29 LDA $29EB,x[$7E:29F3] A:0008 X:0008 Y:000D P:envMxdizc - Load Status Duration into A.
$03/A9E9 29 FB AND #$FB A:0044 X:0008 Y:000D P:envMxdizc - Get rid of 4 Bit.
$03/A9EB 9D EB 29 STA $29EB,x[$7E:29F3] A:0040 X:0008 Y:000D P:envMxdizc Store A in Status Duration
$03/A9EE 60 RTS A:0040 X:0008 Y:000D P:envMxdizc - Return

Is this glitched? I noticed that the effect of Barrier does not wear when the Wall does and I tested this in battle. This seems like a fairly large oversight, but it is easy enough to fix and since I've never seen it as a bug for FFIV it seems to never have been noticed. To fix this you would just change...

$03/A9DD   29 DF   AND #$DF   A:0020   X:0200   Y:000D   P:envMxdizc - Get rid of 20 Bit (Wall)

To CF to make it account for Barrier as well.

Count Timer Expiration

Code: [Select]
$03/A9EF A6 A6 LDX $A6    [$00:00A6] A:0003 X:000C Y:000D P:envMxdizc - Load Target Identifier.
$03/A9F1 BD 05 20 LDA $2005,x[$7E:2011] A:0003 X:000C Y:000D P:envMxdizc - Load Status Byte 03 into A.
$03/A9F4 29 02 AND #$02 A:0003 X:000C Y:000D P:envMxdizc - Get rid of all but Jumping.
$03/A9F6 D0 16 BNE $16    [$AA0E] A:0003 X:000C Y:000D P:envMxdizc - If Jumping branch to Return.
$03/A9F8 BD 06 20 LDA $2006,x[$7E:2012] A:0003 X:000C Y:000D P:envMxdizc - Load Status Byte 04 into A.
$03/A9FB 30 11 BMI $11    [$AA0E] A:0003 X:000C Y:000D P:envMxdizc - Branch if Hiding to Return.
$03/A9FD A6 A6 LDX $A6    [$00:00A6] A:0003 X:000C Y:000D P:envMxdizc - Load Target Identifier (But you just did that!)
$03/A9FF BD 03 20 LDA $2003,x[$7E:200F] A:0003 X:000C Y:000D P:envMxdizc - Load Status Byte 01 into A.
$03/AA02 09 80 ORA #$80 A:0003 X:000C Y:000D P:envMxdizc - Add 80 (Death) if applicable.
$03/AA04 9D 03 20 STA $2003,x[$7E:200F] A:0003 X:000C Y:000D P:envMxdizc - Store A in Status Byte 01.
$03/AA07 A5 D2 LDA $D2    [$00:00D2] A:0003 X:000C Y:000D P:envMxdizc - Load A from D2.
$03/AA09 0A ASL A A:0003 X:000C Y:000D P:envMxdizc - x2 A
$03/AA0A AA TAX A:0003 X:000C Y:000D P:envMxdizc - Transfer A to X.
$03/AA0B 9E EB 29 STZ $29EB,x[$7E:29F7] A:0003 X:000C Y:000D P:envMxdizc - Store Zero in Status Expirations.
$03/AA0E 60 RTS A:0003 X:000C Y:000D P:envMxdizc - Return


And that covers all timers and what happens when those timers expire.
« Last Edit: December 29, 2014, 09:46:46 AM by Grimoire LD »