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

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
I think that battle just has a lot of unnecessary narration generally... "Hiding in the shell!" "The Lit scared him!"

Oh yeah - I forgot about those! So even in my head I was cutting that battle too much slack.  :tongue:

One legit reason I could have thought of could have been to somehow buffer the counters, etc. while the transition is taking place. But it didn't take long to counterexample that with Valvalis - when Kain hits her she stops spinning and they don't have to tell us about it...because they already told us to do it in the first place...  :bah:

These are all great ideas to cut down on some fat, (I used up a lot of space in the battle messages and feared I was nearly out) but if I get rid of the more tutorialish messages I think I can probably free up some more things for later on.

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Grimoire LD's Notes, Patches, and Hacks (Disassembly on Enemy AI Commands)
« Reply #391 on: January 06, 2015, 11:33:49 PM »
I was just considering a scheme on how to make it so that some foes could use multiple AI sets, sure I could go back and program in special exceptions for some enemies, but that's more work than its worth, again the idea I had was to strike it at its source. Recalling that there was an AI instruction which properly allocated Magical Evasion (the base of the Random AI in my side project) I did a quick break on that and found everything I needed for changing or modifying stat allocations when used from AI commands. We should start from the top...

Race Changes

Code: [Select]
$03/B781 C9 E8 CMP #$E8 A:0002 X:0280 Y:0083 P:envMxdizC - Is the AI Command E8?
$03/B783 D0 08 BNE $08    [$B78D] A:0002 X:0280 Y:0083 P:envMxdizC - If not, branch to next.
$03/B785 A5 A9 LDA $A9    [$00:00A9] A:0002 X:0280 Y:0083 P:envMxdizC - Load the value from A9 (where the variable is stored)
$03/B787 9D 40 20 STA $2040,x[$7E:22C0] A:0002 X:0280 Y:0083 P:envMxdizC - Store A in Race Byte.
$03/B78A 4C 0E B8 JMP $B80E  [$03:B80E] A:0002 X:0280 Y:0083 P:envMxdizC - Jump Elsewhere.

Change Physical Attack Values
Code: [Select]
$03/B78D C9 E9 CMP #$E9 A:0002 X:0280 Y:0083 P:envMxdizC - Is it Command E9?
$03/B78F D0 18 BNE $18    [$B7A9] A:0002 X:0280 Y:0083 P:envMxdizC - If not, branch past.
$03/B791 A5 A9 LDA $A9    [$00:00A9] A:0002 X:0280 Y:0083 P:envMxdizC - Load AI Variable.
$03/B793 20 93 94 JSR $9493  [$03:9493] A:0002 X:0280 Y:0083 P:envMxdizC - Jump to Subroutine (?)
$03/B796 AD 1C 29 LDA $291C  [$7E:291C] A:0002 X:0280 Y:0083 P:envMxdizC - Load Physical Attack Storage into A.
$03/B799 9D 1B 20 STA $201B,x[$7E:229B] A:0002 X:0280 Y:0083 P:envMxdizC - Store A in Physical Attack.
$03/B79C AD 1D 29 LDA $291D  [$7E:291D] A:0002 X:0280 Y:0083 P:envMxdizC - Load Physical Attack Multipliers Storage into A.
$03/B79F 9D 1C 20 STA $201C,x[$7E:229C] A:0002 X:0280 Y:0083 P:envMxdizC - Store A in Physical Attack Multipliers
$03/B7A2 AD 1E 29 LDA $291E  [$7E:291E] A:0002 X:0280 Y:0083 P:envMxdizC - Load Accuracy Storage into A.
$03/B7A5 9D 1D 20 STA $201D,x[$7E:229D] A:0002 X:0280 Y:0083 P:envMxdizC - Store A in Accuracy
$03/B7A8 60 RTS A:0002 X:0280 Y:0083 P:envMxdizC - Return

Change Physical Defense Values
Code: [Select]
$03/B7A9 C9 EA CMP #$EA A:0002 X:0280 Y:0083 P:envMxdizC - Is it Command EA?
$03/B7AB D0 18 BNE $18    [$B7C5] A:0002 X:0280 Y:0083 P:envMxdizC - If not, branch past.
$03/B7AD A5 A9 LDA $A9    [$00:00A9] A:0002 X:0280 Y:0083 P:envMxdizC - Load AI Variable into A.
$03/B7AF 20 93 94 JSR $9493  [$03:9493] A:0002 X:0280 Y:0083 P:envMxdizC - Run it through AI Variable Placing? Subroutine.
$03/B7B2 AD 1C 29 LDA $291C  [$7E:291C] A:0002 X:0280 Y:0083 P:envMxdizC - Load A from Physical Defense Storage.
$03/B7B5 9D 28 20 STA $2028,x[$7E:22A8] A:0002 X:0280 Y:0083 P:envMxdizC - Store A in Physical Defense.
$03/B7B8 AD 1D 29 LDA $291D  [$7E:291D] A:0002 X:0280 Y:0083 P:envMxdizC - Load A from Physical Defense Multiplier Storage.
$03/B7BB 9D 29 20 STA $2029,x[$7E:22A9] A:0002 X:0280 Y:0083 P:envMxdizC - Store A in Physical Defense Multiplier
$03/B7BE AD 1E 29 LDA $291E  [$7E:291E] A:0002 X:0280 Y:0083 P:envMxdizC - Load A from Evasion Storage.
$03/B7C1 9D 2A 20 STA $202A,x[$7E:22AA] A:0002 X:0280 Y:0083 P:envMxdizC - Store A in Evasion.
$03/B7C4 60 RTS A:0002 X:0280 Y:0083 P:envMxdizC - Return

Magical Defense Changes
Code: [Select]
$03/B7C5 C9 EB CMP #$EB A:0002 X:0280 Y:0083 P:envMxdizC - Is it Command EB?
$03/B7C7 D0 18 BNE $18    [$B7E1] A:0002 X:0280 Y:0083 P:envMxdizC - If not, branch past.
$03/B7C9 A5 A9 LDA $A9    [$00:00A9] A:0002 X:0280 Y:0083 P:envMxdizC - Load A from AI Variable.
$03/B7CB 20 93 94 JSR $9493  [$03:9493] A:0002 X:0280 Y:0083 P:envMxdizC - Jump to AI Variable Routine.
$03/B7CE AD 1C 29 LDA $291C  [$7E:291C] A:0002 X:0280 Y:0083 P:envMxdizC - Load A from (now will be called AI Variable1/2/3) AI Variable1
$03/B7D1 9D 22 20 STA $2022,x[$7E:22A2] A:0002 X:0280 Y:0083 P:envMxdizC - Store A in Magical Defense.
$03/B7D4 AD 1D 29 LDA $291D  [$7E:291D] A:0002 X:0280 Y:0083 P:envMxdizC - Load A from AI Variable2.
$03/B7D7 9D 24 20 STA $2024,x[$7E:22A4] A:0002 X:0280 Y:0083 P:envMxdizC - Store A in Magical Defense Multiplier.
$03/B7DA AD 1E 29 LDA $291E  [$7E:291E] A:0002 X:0280 Y:0083 P:envMxdizC - Load A from AI Variable3.
$03/B7DD 9D 24 20 STA $2024,x[$7E:22A4] A:0002 X:0280 Y:0083 P:envMxdizC - Store A in Magical Evasion.
$03/B7E0 60 RTS A:0002 X:0280 Y:0083 P:envMxdizC - Return

Changing Speed Index

Code: [Select]
$03/B7E1 C9 EC CMP #$EC A:0002 X:0280 Y:0083 P:envMxdizC - Is it Command EC?
$03/B7E3 D0 03 BNE $03    [$B7E8] A:0002 X:0280 Y:0083 P:envMxdizC - If not, branch past.
$03/B7E5 4C 0F B8 JMP $B80F  [$03:B80F] A:0002 X:0280 Y:0083 P:envMxdizC - Jump to Speed Index routine
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/B80F DA PHX A:0002 X:0280 Y:0083 P:envMxdizC - Push X.
$03/B810 A5 A9 LDA $A9    [$00:00A9] A:0002 X:0280 Y:0083 P:envMxdizC - Load A from AI Variable.
$03/B812 8D 3D 39 STA $393D  [$7E:393D] A:0002 X:0280 Y:0083 P:envMxdizC - Store A in AI Storage?
$03/B815 9C 3E 39 STZ $393E  [$7E:393E] A:0002 X:0280 Y:0083 P:envMxdizC - Store Zero in AI Storage2?
$03/B818 BD 60 20 LDA $2060,x[$7E:22E0] A:0002 X:0280 Y:0083 P:envMxdizC - Load A into Relative Speed 1.
$03/B81B 8D 3F 39 STA $393F  [$7E:393F] A:0002 X:0280 Y:0083 P:envMxdizc - Store A in AI Storage3?
$03/B81E BD 61 20 LDA $2061,x[$7E:22E1] A:0002 X:0280 Y:0083 P:envMxdizC - Load A into Relative Speed 2.
...(A lot of stuff from here that I don't understand)
$03/B856 BD 60 20 LDA $2060,x[$7E:22E0] A:0002 X:0280 Y:0083 P:envMxdizC - Load Relative Speed 1 into A.
$03/B859 6D 49 39 ADC $3949  [$7E:3949] A:0002 X:0280 Y:0083 P:envMxdizC - Add... value.
$03/B85C 9D 60 20 STA $2060,x[$7E:22E0] A:0002 X:0280 Y:0083 P:envMxdizC - Store A in Relative Speed 1.
$03/B85F BD 61 20 LDA $2061,x[$7E:22E1] A:0002 X:0280 Y:0083 P:envMxdizC - Load Relative Speed 2 into A.
$03/B862 6D 4A 39 ADC $394A  [$7E:394A] A:0002 X:0280 Y:0083 P:envMxdizC - Add value2.
$03/B865 9D 61 20 STA $2061,x[$7E:22E1] A:0002 X:0280 Y:0083 P:envMxdizC - Store A in Relative Speed 2.
$03/B868 60 RTS A:0002 X:0280 Y:0083 P:envMxdizC - Return

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Changing Elemental Defenses

Code: [Select]
$03/B7E8 C9 ED CMP #$ED A:0002 X:0280 Y:0083 P:envMxdizC - Is it Command ED?
$03/B7EA D0 0E BNE $0E    [$B7FA] A:0002 X:0280 Y:0083 P:envMxdizC - If not, branch past.
$03/B7EC A5 A9 LDA $A9    [$00:00A9] A:0002 X:0280 Y:0083 P:envMxdizC - Load AI Variable.
$03/B7EE 9D 25 20 STA $2025,x[$7E:22A5] A:0002 X:0280 Y:0083 P:envMxdizC - Store A in Elemental Defense
$03/B7F1 10 1B BPL $1B    [$B80E] A:0002 X:0280 Y:0083 P:envMxdizC - If it is non-Immune branch elsewhere.
------------------------------------------------------------------------------------------------------------------
$03/B80E 60 RTS A:0002 X:0280 Y:0083 P:envMxdizC - Return
--------------------------------------------------------------------------------------------------------------------
$03/B7F3 9D 26 20 STA $2026,x[$7E:22A6] A:0002 X:0280 Y:0083 P:envMxdizC - Store A in Immune Byte
$03/B7F6 9E 25 20 STZ $2025,x[$7E:22A5] A:0002 X:0280 Y:0083 P:envMxdizC - Store Zero in Resistance Byte.
$03/B7F9 60 RTS A:0002 X:0280 Y:0083 P:envMxdizC - Return

Changing Spell Power

Code: [Select]
$03/B7FA C9 EE CMP #$EE A:0002 X:0280 Y:0083 P:envMxdizC - Is it Command EE?
$03/B7FC D0 06 BNE $06    [$B804] A:0002 X:0280 Y:0083 P:envMxdizC - If not so, branch past.
$03/B7FE A5 A9 LDA $A9    [$00:00A9] A:0002 X:0280 Y:0083 P:envMxdizC - Load AI Variable.
$03/B800 9D 17 20 STA $2017,x[$7E:2297] A:0002 X:0280 Y:0083 P:envMxdizC - Store A in Modified Wisdom (not noticeably not Will, hmm...)
$03/B803 60 RTS A:0002 X:0280 Y:0083 P:envMxdizC - Return

Changing Weaknesses (which if all other options seem to fail, is automatically assumed, oddly enough.

Code: [Select]
$03/B804 A5 A9 LDA $A9    [$00:00A9] A:0002 X:0280 Y:0083 P:envMxdizC - Load A from AI Variable.
$03/B806 10 03 BPL $03    [$B80B] A:0002 X:0280 Y:0083 P:envMxdizC - Branch if Positive (not x4 Weak)
------------------------------------------------------------------------------------------------------------------------------
$03/B808 9D 21 20 STA $2021,x[$7E:22A1] A:0002 X:0280 Y:0083 P:envMxdizC - Store A in x4 Weak Byte.
------------------------------------------------------------------------------------------------------------------------------
$03/B80B 9D 20 20 STA $2020,x[$7E:22A0] A:0002 X:0280 Y:0083 P:envMxdizC - Store A in Weak Byte
$03/B80E 60 RTS A:0002 X:0280 Y:0083 P:envMxdizC - Return



The trail goes cold there I'm afraid, this group of instructions are all put nicely together and what comes beyond this is beyond my skills to decipher, granted I still think its dealing with calculating speed at that point. The best way to find out would be to check the original CMP's with other AI instructions.
« Last Edit: January 06, 2015, 11:48:12 PM by Grimoire LD »

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Grimoire LD's Notes, Patches, and Hacks (Disassembly on Enemy AI Commands)
« Reply #392 on: February 03, 2015, 10:53:54 PM »
Here is some preliminary instructions on Visual Effects. To be more specific Visual Effect 01. Credit goes to Avalanche for finding the pointer...

Now Speaking of pointers oh boy... does this Ever love to use them,  Jumps to Jumps to sometimes even More Jumps!

All to do with graphics and timing I imagine, but I didn't find out much, and ended up being more confused than enlightened.

Visual Effect 01 - Airships Flying over Mt. Ordeals.


Effect 01 - Red Wings Flying over Islands 011BD8

Code: [Select]
$00/D81B A9 E1 LDA #$E1 A:00D8 X:0000 Y:0002 P:eNvMxdizc - Load (?X Coordinate) E1 into A
$00/D81D 8D 06 17 STA $1706  [$00:1706] A:00E1 X:0000 Y:0002 P:eNvMxdizc - Store A in Map Location X.
$00/D820 A9 FE LDA #$FE A:00E1 X:0000 Y:0002 P:eNvMxdizc - Load (?Y Coordinate) FE into A.
$00/D822 8D 07 17 STA $1707  [$00:1707] A:00FE X:0000 Y:0002 P:eNvMxdizc - Store A in Map Location Y.
$00/D825 20 4A D9 JSR $D94A  [$00:D94A] A:00FE X:0000 Y:0002 P:eNvMxdizc - Jump to Subroutine. (Might be Map Drawing routine)


----------------------------------
$00/D94A 9C 00 17 STZ $1700  [$00:1700] A:00FE X:0000 Y:0002 P:eNvMxdizc - Store Zero in Index of Current World
$00/D94D A9 04 LDA #$04 A:00FE X:0000 Y:0002 P:eNvMxdizc - Load 04 into A.
$00/D94F 8D 04 17 STA $1704  [$00:1704] A:0004 X:0000 Y:0002 P:envMxdizc - Load Vehicle into A. (It says this, clearly, but changing it doesn't accomplish anything)
$00/D952 20 02 85 JSR $8502  [$00:8502] A:0004 X:0000 Y:0002 P:envMxdizc - Jump to Subroutine


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$00/8502 20 4E 83 JSR $834E  [$00:834E] A:0004 X:0000 Y:0002 P:envMxdizc - Jump to Subroutine
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$00/834E A9 80 LDA #$80 A:0004 X:0000 Y:0002 P:envMxdizc - Load 80 into A.
$00/8350 8D 00 21 STA $2100  [$00:2100] A:0080 X:0000 Y:0002 P:eNvMxdizc - Store A in ?Slot 3's Identifier?
$00/8353 9C 0C 42 STZ $420C  [$00:420C] A:0080 X:0000 Y:0002 P:eNvMxdizc - Store Zero in 420C.
$00/8356 9C 00 42 STZ $4200  [$00:4200] A:0080 X:0000 Y:0002 P:eNvMxdizc - Store Zero in 4200.
$00/8359 78 SEI A:0080 X:0000 Y:0002 P:eNvMxdizc - Set Interrupt Disabled Flag
$00/835A 20 59 8F JSR $8F59  [$00:8F59] A:0080 X:0000 Y:0002 P:eNvMxdIzc - Jump to Subroutine (???)
(Store lots of Zero's and lots of ones in the 0006XX part of RAM)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$00/85AB 20 DB 85 JSR $85DB  [$00:85DB] A:0010 X:0000 Y:0002 P:envMxdIZC Jump to Subroutine (Clear Status Byte 2 of all but Float... I don't get it either.)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$00/85DB A2 00 00 LDX #$0000 A:0010 X:0000 Y:0002 P:envMxdIZC - Load 0000 into X.
$00/85DE BD 04 10 LDA $1004,x[$00:1004] A:0010 X:0000 Y:0002 P:envMxdIZC - Load A from Slot 1's Status Byte 2.
$00/85E1 29 BF AND #$BF A:0000 X:0000 Y:0002 P:envMxdIZC  - Clear Curse, Paralyze, Sleep, Charm, Berserk, Petrify, or Calcify... (WHY?! All of those are in-battle status!)
$00/85E3 9D 04 10 STA $1004,x[$00:1004] A:0000 X:0000 Y:0002 P:envMxdIZC - Store A in Slot 1's Status Byte 2.
$00/85E6 20 30 E5 JSR $E530  [$00:E530] A:0000 X:0000 Y:0002 P:envMxdIZC - Jump to Subroutine
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
$00/E530 C2 20 REP #$20 A:0000 X:0000 Y:0002 P:envMxdIZC - Reset Processor Status.
$00/E532 8A TXA A:0000 X:0000 Y:0002 P:envmxdIZC - Transfer X to A.
$00/E533 18 CLC A:0000 X:0000 Y:0002 P:envmxdIZC - Clear Carry.
$00/E534 69 40 00 ADC #$0040 A:0000 X:0000 Y:0002 P:envmxdIZc - Add 40 onto A.
$00/E537 AA TAX A:0040 X:0000 Y:0002 P:envmxdIzc - Transfer A to X.
$00/E538 A9 00 00 LDA #$0000 A:0040 X:0040 Y:0002 P:envmxdIzc - Load 0000 into A.
$00/E53B E2 20 SEP #$20 A:0000 X:0040 Y:0002 P:envmxdIZc - Set Processor Status
$00/E53D 60 RTS A:0000 X:0040 Y:0002 P:envMxdIZc - Return
~~~~~~~~~~~~~~~~~~~`
$00/85E9 E0 40 01 CPX #$0140 A:0000 X:0040 Y:0002 P:envMxdIZc - Has it done this for all five slots?
$00/85EC D0 F0 BNE $F0    [$85DE] A:0000 X:0040 Y:0002 P:eNvMxdIzc - If not, loop back until done.
$00/85EE 60 RTS A:0000 X:0140 Y:0002 P:envMxdIZC
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$00/85AE 64 D1 STZ $D1    [$00:06D1] A:0000 X:0140 Y:0002 P:envMxdIZC - Store Zero in 06D1.
$00/85B0 A5 85 LDA $85    [$00:0685] A:0000 X:0140 Y:0002 P:envMxdIZC - Load A from 0685.
$00/85B2 D0 05 BNE $05    [$85B9] A:0000 X:0140 Y:0002 P:envMxdIZC - If 00, branch past.
$00/85B4 A9 02 LDA #$02 A:0000 X:0140 Y:0002 P:envMxdIZC - Load 02 into A.
$00/85B6 8D 05 17 STA $1705  [$00:1705] A:0002 X:0140 Y:0002 P:envMxdIzC - Load "Facing Down" into Direction
$00/85B9 64 85 STZ $85    [$00:0685] A:0002 X:0140 Y:0002 P:envMxdIzC - Store Zero in 06B5.
$00/85BB A9 07 LDA #$07 A:0002 X:0140 Y:0002 P:envMxdIzC - Load 07 into A.
$00/85BD 8D 05 21 STA $2105  [$00:2105] A:0007 X:0140 Y:0002 P:envMxdIzC - These are odd and do not actually correspond to what they're listed as. I'm not sure what is going on there.)
$00/85C0 A9 11 LDA #$11 A:0007 X:0140 Y:0002 P:envMxdIzC
$00/85C2 8D 2C 21 STA $212C  [$00:212C] A:0011 X:0140 Y:0002 P:envMxdIzC
$00/85C5 9C 30 21 STZ $2130  [$00:2130] A:0011 X:0140 Y:0002 P:envMxdIzC
$00/85C8 9C 31 21 STZ $2131  [$00:2131] A:0011 X:0140 Y:0002 P:envMxdIzC
$00/85CB A5 B1 LDA $B1    [$00:06B1] A:0011 X:0140 Y:0002 P:envMxdIzC
$00/85CD D0 03 BNE $03    [$85D2] A:0001 X:0140 Y:0002 P:envMxdIzC
$00/85D2 22 81 B1 15 JSL $15B181[$15:B181] A:0001 X:0140 Y:0002 P:envMxdIzC
(The rest of this is gobbledegook to me, I'm afraid.)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

$00/D828 A2 80 00 LDX #$0080 A:0081 X:0010 Y:0080 P:eNvMxdIzc - Load 0080 into A.
$00/D82B 20 56 DF JSR $DF56  [$00:DF56] A:0081 X:0080 Y:0080 P:envMxdIzc - Jump to Subroutine (???)
$00/D82E 20 0F 8F JSR $8F0F  [$00:8F0F] A:0000 X:0000 Y:0080 P:envMxdIZc - Jump to Subroutine (flashes the ships in and out when nulled?)
$00/D831 20 36 D9 JSR $D936  [$00:D936] A:0000 X:0000 Y:0080 P:envMxdIzc - Jump to Subroutine
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~```
$00/D936 A5 7A LDA $7A    [$00:067A] A:0000 X:0000 Y:0080 P:envMxdIzc - Load the value from 067A into A.
$00/D938 29 07 AND #$07 A:0081 X:0000 Y:0080 P:eNvMxdIzc - Get rid of 1,2,4.
$00/D93A D0 08 BNE $08    [$D944] A:0001 X:0000 Y:0080 P:envMxdIzc - If not 00 branch elsewhere.
-------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------
$00/D944 A5 80 LDA $80    [$00:0680] A:0001 X:0000 Y:0080 P:envMxdIzc - Load the value from 0680 into A.
$00/D946 8D 00 21 STA $2100  [$00:2100] A:0000 X:0000 Y:0080 P:envMxdIZc  - Store A in ?2100?
$00/D949 60 RTS A:0000 X:0000 Y:0080 P:envMxdIZc - Return
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$00/D834 A9 08 LDA #$08 A:0000 X:0000 Y:0080 P:envMxdIZc - Load 08 into A.
$00/D836 85 05 STA $05    [$00:0605] A:0008 X:0000 Y:0080 P:envMxdIzc - Store A in 0605.
$00/D838 A9 01 LDA #$01 A:0008 X:0000 Y:0080 P:envMxdIzc - Load 01 into A.
$00/D83A 85 D5 STA $D5    [$00:06D5] A:0001 X:0000 Y:0080 P:envMxdIzc - Store A in 06D5.
$00/D83C 20 E9 D8 JSR $D8E9  [$00:D8E9] A:0001 X:0000 Y:0080 P:envMxdIzc - Jump to Subroutine.
$00/D83F A5 80 LDA $80    [$00:0680] A:0000 X:0010 Y:0050 P:enVMxdIZC - Load A from 80.
$00/D841 C9 0F CMP #$0F A:0000 X:0010 Y:0050 P:enVMxdIZC - Is it 0F? (Something with a timer of some kind?)
$00/D843 D0 E9 BNE $E9    [$D82E] A:0000 X:0010 Y:0050 P:eNVMxdIzc - If not, loop back.
------------------------------------------Ships starting to move--------------------------
$00/D845 A2 E0 01 LDX #$01E0 A:000F X:0010 Y:0050 P:enVMxdIZC - Load 01E0 into X. (Length of time to display the Visual Effect)
$00/D848 86 89 STX $89    [$00:0689] A:000F X:01E0 Y:0050 P:enVMxdIzC - Store X in 0689.
$00/D84A 20 0F 8F JSR $8F0F  [$00:8F0F] A:000F X:01E0 Y:0050 P:enVMxdIzC - (May actually be a time routine of some sort)
$00/D84D A9 08 LDA #$08 A:0000 X:01E0 Y:0050 P:enVMxdIzC - Load 08 into A (Direction moving?)
00 - Stop
01 - Right
02 - Left
04 - Down
08 - Up
$00/D84F 85 05 STA $05    [$00:0605] A:0008 X:01E0 Y:0050 P:enVMxdIzC - Store A in 0605 (I've just noticed that the entry above of 0605 is also the same case.)
$00/D851 20 E9 D8 JSR $D8E9  [$00:D8E9] A:0008 X:01E0 Y:0050 P:enVMxdIzC - Jump to Subroutine (which jumps immediately to Another subroutine...)
$00/D854 A6 89 LDX $89    [$00:0689] A:0000 X:0010 Y:0050 P:enVMxdIZC - Load the value from 89 (In this case, Timer) into X.
$00/D856 CA DEX A:0000 X:01E0 Y:0050 P:enVMxdIzC - -1 to X.
$00/D857 86 89 STX $89    [$00:0689] A:0000 X:01DF Y:0050 P:enVMxdIzC - Store X in 89.
$00/D859 D0 EF BNE $EF    [$D84A] A:0000 X:01DF Y:0050 P:enVMxdIzC - Loop if not 00.
-----------------------------------------Ships moving up--------------------------
$00/D85B 20 0F 8F JSR $8F0F  [$00:8F0F] A:0000 X:0000 Y:0050 P:enVMxdIZC - Same Timer Subroutine.
$00/D85E 20 24 D9 JSR $D924  [$00:D924] A:0000 X:0000 Y:0050 P:enVMxdIzC - Subroutine (???)
$00/D861 A9 08 LDA #$08 A:000F X:0000 Y:0050 P:enVMxdIzC - Load Direction to move into A.
$00/D863 85 05 STA $05    [$00:0605] A:0008 X:0000 Y:0050 P:enVMxdIzC - Store A in 0605.
$00/D865 20 E9 D8 JSR $D8E9  [$00:D8E9] A:0008 X:0000 Y:0050 P:enVMxdIzC - Subroutine (???)
$00/D868 A5 80 LDA $80    [$00:0680] A:0000 X:0010 Y:0050 P:enVMxdIZC - Load the value from 80 into A.
$00/D86A D0 EF BNE $EF    [$D85B] A:000F X:0010 Y:0050 P:enVMxdIzC - If not 00 loop back.
-----------------(As the ships fade out)-------------
$00/D86C A9 03 LDA #$03 A:0000 X:0010 Y:0050 P:enVMxdIZC - Load 03 into A (Not sure... maybe to note normal play?)
$00/D86E 8D 00 17 STA $1700  [$00:1700] A:0003 X:0010 Y:0050 P:enVMxdIzC - Store A in 1700.
$00/D871 64 AC STZ $AC    [$00:06AC] A:0003 X:0010 Y:0050 P:enVMxdIzC - Store Zero in AC.
$00/D873 9C 04 17 STZ $1704  [$00:1704] A:0003 X:0010 Y:0050 P:enVMxdIzC - Store Zero in Vehicle.
$00/D876 4C D3 E0 JMP $E0D3  [$00:E0D3] A:0003 X:0010 Y:0050 P:enVMxdIzC - Jump Elsewhere.

Hopefully when I get out of the Overworld sections this will start to make a little more logical sense...

What I did find easily was Where on the World Map this was taking place. The timer for the visual effect, the directions the ships move in. what I did not find is how 5 Airships are spawned, their directional facing, and how to properly allocate the world maps (say to place this even on the Moon or the Underworld, trying as such only lead to glitched graphics)

The most confusing aspects is the reference to Stats, but even then I know it's not actually modifying stats. Or doing anything to the part of RAM it's claiming to change. I can't say at all what is happening there.

But maybe this will provide a framework nonetheless.

Here's the second one. It seems to follow the same suit.

Effect 02 - Red Wings Landing in Baron    01D879

Code: [Select]
---------------------------------------Ships Fly North------------------------
$00/D879 A9 65 LDA #$65 A:00D8 X:0002 Y:0002 P:eNvMxdizc - Load 65 into A (X Axis)
$00/D87B 8D 06 17 STA $1706  [$00:1706] A:0065 X:0002 Y:0002 P:envMxdizc - Store A in X Axis.
$00/D87E A9 00 LDA #$00 A:0065 X:0002 Y:0002 P:envMxdizc - Load 00 into A.
$00/D880 8D 07 17 STA $1707  [$00:1707] A:0000 X:0002 Y:0002 P:envMxdiZc - Store A in Y Axis.
$00/D883 20 4A D9 JSR $D94A  [$00:D94A] A:0000 X:0002 Y:0002 P:envMxdiZc - Jump to Possibly Map Drawing Routine
$00/D886 20 0F 8F JSR $8F0F  [$00:8F0F] A:0081 X:0010 Y:0080 P:eNvMxdIzc - Jump to Timer Routine
$00/D889 20 36 D9 JSR $D936  [$00:D936] A:0000 X:0010 Y:0080 P:envMxdIzc - Subroutine (???)
$00/D88C A9 08 LDA #$08 A:0000 X:0010 Y:0080 P:envMxdIZc - Load Direction moving into A.
$00/D88E 85 05 STA $05    [$00:0605] A:0008 X:0010 Y:0080 P:envMxdIzc - Store A in 0605
$00/D890 20 E9 D8 JSR $D8E9  [$00:D8E9] A:0008 X:0010 Y:0080 P:envMxdIzc - Jump to Moving Routine
$00/D893 A5 80 LDA $80    [$00:0680] A:0000 X:0010 Y:0050 P:enVMxdIZC - Load A from 80.
$00/D895 C9 0F CMP #$0F A:0000 X:0010 Y:0050 P:enVMxdIZC - Has it looped 16 times?
$00/D897 D0 ED BNE $ED    [$D886] A:0000 X:0010 Y:0050 P:eNVMxdIzc - If not, loop back.

------------------------------Ships continuing to Fly North-------------------------
$00/D899 A2 10 01 LDX #$0110 A:000F X:0010 Y:0050 P:enVMxdIZC - Load Timer of Effect into X.
$00/D89C 86 89 STX $89    [$00:0689] A:000F X:0110 Y:0050 P:enVMxdIzC - Store X in 89.
$00/D89E 20 0F 8F JSR $8F0F  [$00:8F0F] A:000F X:0110 Y:0050 P:enVMxdIzC - Timer Routine.
$00/D8A1 A9 08 LDA #$08 A:0000 X:0110 Y:0050 P:enVMxdIzC - Load Direction moving into A.
$00/D8A3 85 05 STA $05    [$00:0605] A:0008 X:0110 Y:0050 P:enVMxdIzC - Store A 0605.
$00/D8A5 20 E9 D8 JSR $D8E9  [$00:D8E9] A:0008 X:0110 Y:0050 P:enVMxdIzC - Jump to Moving Routine
$00/D8A8 A6 89 LDX $89    [$00:0689] A:0000 X:0010 Y:0050 P:enVMxdIZC - Load X from 89 (Timer)
$00/D8AA CA DEX A:0000 X:0110 Y:0050 P:enVMxdIzC - -1 to X.
$00/D8AB 86 89 STX $89    [$00:0689] A:0000 X:010F Y:0050 P:enVMxdIzC - Store X in Timer.
$00/D8AD D0 EF BNE $EF    [$D89E] A:0000 X:010F Y:0050 P:enVMxdIzC - If Timer is not 00 loop back.
-----------------------------Ships Stop Over Baron--------------------------------
$00/D8AF A2 40 00 LDX #$0040 A:0000 X:0000 Y:0050 P:enVMxdIZC - Load 0040 into X.
$00/D8B2 86 89 STX $89    [$00:0689] A:0000 X:0040 Y:0050 P:enVMxdIzC - Store X in Timer.
$00/D8B4 20 0F 8F JSR $8F0F  [$00:8F0F] A:0000 X:0040 Y:0050 P:enVMxdIzC - Timer Routine
$00/D8B7 64 05 STZ $05    [$00:0605] A:0000 X:0040 Y:0050 P:enVMxdIzC - Store Zero in Direction moving (Stop)
$00/D8B9 20 E9 D8 JSR $D8E9  [$00:D8E9] A:0000 X:0040 Y:0050 P:enVMxdIzC - Jump to Moving Routine
$00/D8BC A6 89 LDX $89    [$00:0689] A:0000 X:0010 Y:0050 P:enVMxdIZC - Load X from 89 (Timer)
$00/D8BE CA DEX A:0000 X:0040 Y:0050 P:enVMxdIzC - -1 to X.
$00/D8BF 86 89 STX $89    [$00:0689] A:0000 X:003F Y:0050 P:enVMxdIzC - Store X in Timer.
$00/D8C1 D0 F1 BNE $F1    [$D8B4] A:0000 X:003F Y:0050 P:enVMxdIzC - If Timer is not 00 loop back.
---------------------------Ships Landing in Baron-----------------------------------
$00/D8C3 20 35 8B JSR $8B35  [$00:8B35] A:0000 X:0000 Y:0050 P:enVMxdIZC - ???
$00/D8C6 20 0F 8F JSR $8F0F  [$00:8F0F] A:0085 X:0000 Y:0050 P:enVMxdIZC - Timer Routine
$00/D8C9 64 05 STZ $05    [$00:0605] A:0000 X:0000 Y:0050 P:enVMxdIzC - Store Zero in Movement.
$00/D8CB 20 24 D9 JSR $D924  [$00:D924] A:0000 X:0000 Y:0050 P:enVMxdIzC - (Partner to Timer)
$00/D8CE A5 80 LDA $80    [$00:0680] A:000F X:0000 Y:0050 P:enVMxdIzC - Load A from 80.
$00/D8D0 18 CLC A:000F X:0000 Y:0050 P:enVMxdIzC - Clear Carry Flag.
$00/D8D1 69 10 ADC #$10 A:000F X:0000 Y:0050 P:enVMxdIzc - Add 10 to A. (Height for landing)
$00/D8D3 85 AD STA $AD    [$00:06AD] A:001F X:0000 Y:0050 P:envMxdIzc - Store A in AD.
$00/D8D5 20 E9 D8 JSR $D8E9  [$00:D8E9] A:001F X:0000 Y:0050 P:envMxdIzc - ???
$00/D8D8 A5 80 LDA $80    [$00:0680] A:0000 X:0010 Y:0050 P:enVMxdIZC - Load A from 80.
$00/D8DA D0 EA BNE $EA    [$D8C6] A:000F X:0010 Y:0050 P:enVMxdIzC - Loop if not 00.
---------------------------------Screen fading to Black-------------------
$00/D8DC A9 03 LDA #$03 A:0000 X:0010 Y:0050 P:enVMxdIZC - Load 03 into A.
$00/D8DE 8D 00 17 STA $1700  [$00:1700] A:0003 X:0010 Y:0050 P:enVMxdIzC - Store A in World Index.
$00/D8E1 64 AC STZ $AC    [$00:06AC] A:0003 X:0010 Y:0050 P:enVMxdIzC - Load Zero in A
$00/D8E3 9C 04 17 STZ $1704  [$00:1704] A:0003 X:0010 Y:0050 P:enVMxdIzC - Store Zero in Vehicle
$00/D8E6 4C D3 E0 JMP $E0D3  [$00:E0D3] A:0003 X:0010 Y:0050 P:enVMxdIzC - Jump to Rest of Routine.
« Last Edit: February 03, 2015, 11:26:30 PM by Grimoire LD »

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Grimoire LD's Notes, Patches, and Hacks (Disassembly on Enemy AI Commands)
« Reply #393 on: February 03, 2015, 11:27:53 PM »
All of those 2000 RAM addresses are not the 2000s we usually deal with.
Above 1FFF, that "7E" actually means something. There's a whole bunch of RAM (at least 00:2000 to 00:4300) that we aren't able to view in Geiger's. The math registers are in the 4200s. I think the 2000s are used in graphics processing (because I'm pretty sure I've seen them used in spell visuals). But we'd likely need the help of someone with more knowledge of how the SNES actually works to fully decipher what's going on here.
Still, like you said, maybe some more will come to light the more you look into these. I'd be interested in seeing how this compares to, say, the Enterprise-Falcon chase sequence.

 :edit: Hey, I just made my "mark of the beast" post.  :laugh:
Just 111 to go til I hit the jackpot!

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Grimoire LD's Notes, Patches, and Hacks (Disassembly on Enemy AI Commands)
« Reply #394 on: February 04, 2015, 01:27:17 PM »
All of those 2000 RAM addresses are not the 2000s we usually deal with.
Above 1FFF, that "7E" actually means something. There's a whole bunch of RAM (at least 00:2000 to 00:4300) that we aren't able to view in Geiger's. The math registers are in the 4200s. I think the 2000s are used in graphics processing (because I'm pretty sure I've seen them used in spell visuals). But we'd likely need the help of someone with more knowledge of how the SNES actually works to fully decipher what's going on here.
Still, like you said, maybe some more will come to light the more you look into these. I'd be interested in seeing how this compares to, say, the Enterprise-Falcon chase sequence.

 :edit: Hey, I just made my "mark of the beast" post.  :laugh:
Just 111 to go til I hit the jackpot!

That makes a lot more sense Chillyfeez, thanks for the clarification.

Well as expected a Visual Effect in a map turned out to be a Lot simpler than the mess of World Map events... the Bomb Ring event had some wonderful information as well as some (I believe anyhow) unused effect sprites!



There was a lot of wonderful information in here and I *think* I decoded all of the important bits.

Visual Effect 03 - Bomb Ring Activation.
Code: [Select]
$00/D711 64 AD STZ $AD    [$00:06AD] A:00D7 X:0004 Y:0002 P:eNvMxdizc - Store Zero in 06AD.
$00/D713 A2 00 00 LDX #$0000 A:00D7 X:0004 Y:0002 P:eNvMxdizc - Load 0000 into X. (Distance of how far the Bombs should start from the center of the screen.)
$00/D716 8E FB 06 STX $06FB  [$00:06FB] A:00D7 X:0000 Y:0002 P:envMxdiZc - Store X in 06FB
$00/D719 86 24 STX $24    [$00:0624] A:00D7 X:0000 Y:0002 P:envMxdiZc - Store X in 0624.
$00/D71B A9 C4 LDA #$C4 A:00D7 X:0000 Y:0002 P:envMxdiZc - Load SPRITE!! into A.
$00/D71D 85 8F STA $8F    [$00:068F] A:00C4 X:0000 Y:0002 P:eNvMxdizc - Store A in 068F
$00/D71F A9 08 LDA #$08 A:00C4 X:0000 Y:0002 P:eNvMxdizc - Load Number of Sprites to display into A. (To the game's credit it can load 255 of these things!)
$00/D721 85 90 STA $90    [$00:0690] A:0008 X:0000 Y:0002 P:envMxdizc - Store A in 0690.
$00/D723 A9 39 LDA #$39 A:0008 X:0000 Y:0002 P:envMxdizc - Load (A Lot read below on 0691)
$00/D725 85 91 STA $91    [$00:0691] A:0039 X:0000 Y:0002 P:envMxdizc - Store A in 0691.
$00/D727 20 1E 8F JSR $8F1E  [$00:8F1E] A:0039 X:0000 Y:0002 P:envMxdizc - Jump to Subroutine (am not touching that)
$00/D72A 20 99 D7 JSR $D799  [$00:D799] A:0000 X:0070 Y:001C P:envMxdizc -
$00/D72D C2 20 REP #$20 A:0008 X:0070 Y:001C P:envMxdiZC - Reset Processor Status
$00/D72F AD FB 06 LDA $06FB  [$00:06FB] A:0008 X:0070 Y:001C P:envmxdiZC - Load A from 06FB (0000 from above)
$00/D732 1A INC A A:0000 X:0070 Y:001C P:envmxdiZC - +1 to A.
$00/D733 8D FB 06 STA $06FB  [$00:06FB] A:0001 X:0070 Y:001C P:envmxdizC - Store it back.
$00/D736 A5 24 LDA $24    [$00:0624] A:0001 X:0070 Y:001C P:envmxdizC - Load A from 0624
$00/D738 1A INC A A:0000 X:0070 Y:001C P:envmxdiZC - +1 A
$00/D739 85 24 STA $24    [$00:0624] A:0001 X:0070 Y:001C P:envmxdizC - Store it Back
$00/D73B 4A LSR A A:0001 X:0070 Y:001C P:envmxdizC - /2
$00/D73C 4A LSR A A:0000 X:0070 Y:001C P:envmxdiZC - /2
$00/D73D 29 FF 00 AND #$00FF A:0000 X:0070 Y:001C P:envmxdiZc - Get rid of all bits?
$00/D740 E2 20 SEP #$20 A:0000 X:0070 Y:001C P:envmxdiZc - Set Processor to 20.
$00/D742 85 AD STA $AD    [$00:06AD] A:0000 X:0070 Y:001C P:envMxdiZc - Store A in 06AD.
$00/D744 C9 5F CMP #$5F A:0000 X:0070 Y:001C P:envMxdiZc - Is it 5F? (How long the Visual Effect will play) (Interestingly if you let it play until FF the bombs will converge back to the middle)
$00/D746 F0 03 BEQ $03    [$D74B] A:0000 X:0070 Y:001C P:eNvMxdizc - If so, branch to D74B.
$00/D748 4C 27 D7 JMP $D727  [$00:D727] A:0000 X:0070 Y:001C P:eNvMxdizc - Loop back to JSR.
----------------------------------------------------------------------------------------------
$00/D74B 4C D3 E0 JMP $E0D3  [$00:E0D3] A:00FF X:0073 Y:001C P:envMxdiZC - Jump to rest of routine.

Visual Effect 03 -

Sprites... (Bizarrely there are no real valid entries until C0)

C0- Healing Sparkles
C2- Healing Sparkles (Slightly different looking)
C4- Bombs
C6- Nothing
C8- Unused circling fireball effect?
CA- Definitely unused, pretty cool looking Orb Effect!
(All the rest look like explosions, that don't fit into this sprite space.)

Theory time! The  Sparkles were meant to be used to symbolize White Magic, The Fireballs were meant to symbolize Black Magic and the Orbs were meant to symbolize Summon Orbs on the map.

0691 Matter

This is a very interesting byte. This decides what Layer the Visual Effect will appear on, what palette the visual effect will have, and what direction the visual effect is facing.

NOTE: For some reason it Has to be set to Odd values only, or it will have the wrong graphics.

Layer Appearances (Every 40 it repeats)
0X - Layer 2 Only
1X - Layer 2 Only
2X - Will be hidden by walk-behind tiles.
3X - Appear above all Layers.

Palettes (To my untrained Eye...)

X1 - Bluish, Whitish, Black, Red
X3 - Bluish, Greenish, Black, Orange
x5 - Whitish, Purplish, Black, Maroon?
x7 - Yellow, Green, Black, Orange
x9 - Orange, Pink, Red, Black, White (Default Bomb Color)
xB - Brown, Light Blue, Blue, Black, White (Ballon's Colors)
xD - Brown, Light Purple, Purple, Black, White (Grenade's Colors)
xF - Blue, Green, Black, Yellow

Directional Facings

01-3F Right
40-7F Left
80-BF Up
C0-FF Down

And there you have it! So much, in just one byte. Something tells me that this is probably already known and how NPC's probably look, graphically.




You're almost there Chillyfeez! A shame we don't have sprites back yet.

 :edit:




Effect 04 - Damcyan Being Bombed 00D36E


Code: [Select]
$00/D36E A9 04 LDA #$04 A:00D3 X:0006 Y:0002 P:eNvMxdizc - Load 04 into A.
$00/D370 8D CD 0A STA $0ACD  [$00:0ACD] A:0004 X:0006 Y:0002 P:envMxdizc - Store A in 0ACD.
$00/D373 9C CE 0A STZ $0ACE  [$00:0ACE] A:0004 X:0006 Y:0002 P:envMxdizc - Store 00 in 0ACE.
$00/D376 20 ED DD JSR $DDED  [$00:DDED] A:0004 X:0006 Y:0002 P:envMxdizc - Jump to Subroutine
$00/D379 A2 00 00 LDX #$0000 A:00FC X:0040 Y:0090 P:envMxdiZC
$00/D37C A9 FF LDA #$FF A:00FC X:0000 Y:0090 P:envMxdiZC - Load FF into A.
$00/D37E 9D 6D 0A STA $0A6D,x[$00:0A6D] A:00FF X:0000 Y:0090 P:eNvMxdizC - Store A in 0A6D.
$00/D381 E8 INX A:00FF X:0000 Y:0090 P:eNvMxdizC - X +4
$00/D382 E8 INX A:00FF X:0001 Y:0090 P:envMxdizC
$00/D383 E8 INX A:00FF X:0002 Y:0090 P:envMxdizC
$00/D384 E8 INX A:00FF X:0003 Y:0090 P:envMxdizC
$00/D385 E0 60 00 CPX #$0060 A:00FF X:0004 Y:0090 P:envMxdizC - Has it done this loop 18 times?
$00/D388 D0 F4 BNE $F4    [$D37E] A:00FF X:0004 Y:0090 P:eNvMxdizc - If not, loop back.
-----------------------------------------
$00/D38A A9 3E LDA #$3E A:00FF X:0060 Y:0090 P:envMxdiZC - Load 3E into A.
$00/D38C 20 62 E5 JSR $E562  [$00:E562] A:003E X:0060 Y:0090 P:envMxdizC - Jump to Sound Routine
$00/D38F A2 00 01 LDX #$0100 A:0001 X:0060 Y:0090 P:envMxdiZC - Load 0100 into X. (Seemingly amount of times Damcyan is bombed... in repeated sequence not very valid to change though.)
$00/D392 86 2C STX $2C    [$00:062C] A:0001 X:0100 Y:0090 P:envMxdizC - Store X in 062C.
$00/D394 A2 10 00 LDX #$0010 A:0001 X:0100 Y:0090 P:envMxdizC - Load 0010 into X. (Position of Red Wings on X Axis)
$00/D397 86 2E STX $2E    [$00:062E] A:0001 X:0010 Y:0090 P:envMxdizC - Store X in 062E.
$00/D399 20 2D 8F JSR $8F2D  [$00:8F2D] A:0001 X:0010 Y:0090 P:envMxdizC - Jump to Subroutine
$00/D39C 20 59 8F JSR $8F59  [$00:8F59] A:0000 X:001E Y:0000 P:envMxdiZC - Jump to Subroutine
$00/D39F 20 A2 92 JSR $92A2  [$00:92A2] A:00F0 X:0020 Y:0000 P:envMxdiZC -
$00/D3A4 38 SEC A:0010 X:0008 Y:0000 P:envMxdizC - Set Carry Flag
$00/D3A5 E9 10 SBC #$10 A:0010 X:0008 Y:0000 P:envMxdizC - Subtract 10 from A.
$00/D3A7 22 0B C5 15 JSL $15C50B[$15:C50B] A:0000 X:0008 Y:0000 P:envMxdiZC - Jump to Subroutine Long
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~```
15/C50B 29 FE AND #$FE A:0000 X:0008 Y:0000 P:envMxdiZC - Get rid of all but 01.
$15/C50D AA TAX A:0000 X:0008 Y:0000 P:envMxdiZC - Transfer A to X.
$15/C50E AD 00 17 LDA $1700  [$00:1700] A:0000 X:0000 Y:0000 P:envMxdiZC - Load World Index.
$15/C511 D0 16 BNE $16    [$C529] A:0000 X:0000 Y:0000 P:envMxdiZC - If not 00, branch.
$15/C513 C2 20 REP #$20 A:0000 X:0000 Y:0000 P:envMxdiZC - Reset Processor Status.
$15/C515 BF B7 C6 15 LDA $15C6B7,x[$15:C6B7] A:0000 X:0000 Y:0000 P:envmxdiZC - Load A from There.
$15/C519 8D 25 0D STA $0D25  [$00:0D25] A:6520 X:0000 Y:0000 P:envmxdizC - Store A in 0D25.
$15/C51C BF C9 C6 15 LDA $15C6C9,x[$15:C6C9] A:6520 X:0000 Y:0000 P:envmxdizC - Load A from That.
$15/C520 8D 29 0D STA $0D29  [$00:0D29] A:2460 X:0000 Y:0000 P:envmxdizC - Store A in 0D29.
$15/C523 A9 00 00 LDA #$0000 A:2460 X:0000 Y:0000 P:envmxdizC - Load 0000 into A.
$15/C526 E2 20 SEP #$20 A:0000 X:0000 Y:0000 P:envmxdiZC - Set Processor Status to 20.
$15/C528 6B RTL A:0000 X:0000 Y:0000 P:envMxdiZC - Return
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$00/D3AB AD 7A 06 LDA $067A  [$00:067A] A:0000 X:0000 Y:0000 P:envMxdiZC - Load A from 067A.
$00/D3AE 29 03 AND #$03 A:00D4 X:0000 Y:0000 P:eNvMxdizC - Get rid of all but 01 and 02.
$00/D3B0 D0 E7 BNE $E7    [$D399] A:0000 X:0000 Y:0000 P:envMxdiZC - If 00 loop back.
-----------------------------------------------------------------------
$00/D3B2 A5 AD LDA $AD    [$00:06AD] A:0000 X:0000 Y:0000 P:envMxdiZC - Load A from 06AD.
$00/D3B4 1A INC A A:0010 X:0000 Y:0000 P:envMxdizC - +1 to A.
$00/D3B5 85 AD STA $AD    [$00:06AD] A:0011 X:0000 Y:0000 P:envMxdizC - Store A from in 06AD.
$00/D3B7 C9 20 CMP #$20 A:0011 X:0000 Y:0000 P:envMxdizC - Has it gone through 20 times? (This is actually how high off the ground the event takes place. The default is 11. Too low and the graphics bug out. Too high and the same.)
$00/D3B9 D0 DE BNE $DE    [$D399] A:0011 X:0000 Y:0000 P:eNvMxdizc - If not branch All the way back.
$00/D3BB 20 2D 8F JSR $8F2D  [$00:8F2D] A:0020 X:000E Y:0000 P:envMxdiZC - Movement Subroutine
$00/D3BE 20 D0 D4 JSR $D4D0  [$00:D4D0] A:0000 X:001E Y:0000 P:envMxdiZC - Subroutine
$00/D3C1 20 77 8F JSR $8F77  [$00:8F77] A:0000 X:001E Y:0000 P:eNvMxdizc -
$00/D3C4 20 47 DF JSR $DF47  [$00:DF47] A:00F0 X:0020 Y:0000 P:envMxdiZC -
$00/D3C7 64 79 STZ $79    [$00:0679] A:00AA X:0010 Y:0000 P:envMxdiZC - Store Zero in 679.
$00/D3C9 A5 79 LDA $79    [$00:0679] A:00AA X:0010 Y:0000 P:envMxdiZC - Load A from 679.
$00/D3CB 0A ASL A A:0000 X:0010 Y:0000 P:envMxdiZC - x2 A
$00/D3CC A8 TAY A:0000 X:0010 Y:0000 P:envMxdiZc - Transfer A to Y.
$00/D3CD C2 20 REP #$20 A:0000 X:0010 Y:0000 P:envMxdiZc - Reset Processor Status
$00/D3CF A5 2C LDA $2C    [$00:062C] A:0000 X:0010 Y:0000 P:envmxdiZc - Load A from 62C.
$00/D3D1 18 CLC A:0100 X:0010 Y:0000 P:envmxdizc - Clear Carry Flag
$00/D3D2 79 11 D5 ADC $D511,y[$00:D511] A:0100 X:0010 Y:0000 P:envmxdizc - Add the value from D511 into A. (The X location of the Top Ship) (Read section on Ship Locations)
$00/D3D5 85 0C STA $0C    [$00:060C] A:0110 X:0010 Y:0000 P:envmxdizc - Store A in 60C.
$00/D3D7 A5 2E LDA $2E    [$00:062E] A:0110 X:0010 Y:0000 P:envmxdizc - Load A from 2E.
$00/D3D9 18 CLC A:0010 X:0010 Y:0000 P:envmxdizc - Clear Carry Flag.
$00/D3DA 79 17 D5 ADC $D517,y[$00:D517] A:0010 X:0010 Y:0000 P:envmxdizc - Add the value from D517 into A. (The Y location of the Top Ship)
$00/D3DD 85 0E STA $0E    [$00:060E] A:0020 X:0010 Y:0000 P:envmxdizc - Store A in 060E.
$00/D3DF A5 79 LDA $79    [$00:0679] A:0020 X:0010 Y:0000 P:envmxdizc - Load A from 679.
$00/D3E1 29 FF 00 AND #$00FF A:1100 X:0010 Y:0000 P:envmxdizc - Clear it.
$00/D3E4 0A ASL A A:0000 X:0010 Y:0000 P:envmxdiZc - x2 A.
$00/D3E5 0A ASL A A:0000 X:0010 Y:0000 P:envmxdiZc - x2 A
$00/D3E6 0A ASL A A:0000 X:0010 Y:0000 P:envmxdiZc - x2 A.
$00/D3E7 0A ASL A A:0000 X:0010 Y:0000 P:envmxdiZc - x2 A.
$00/D3E8 09 00 01 ORA #$0100 A:0000 X:0010 Y:0000 P:envmxdiZc - Add 0100 if applicable.
$00/D3EB A8 TAY A:0100 X:0010 Y:0000 P:envmxdizc - Transfer A to Y.
$00/D3EC A9 00 00 LDA #$0000 A:0100 X:0010 Y:0100 P:envmxdizc - Load 0000 into A.
$00/D3EF E2 20 SEP #$20 A:0000 X:0010 Y:0100 P:envmxdiZc - Set Processor Status into A.
$00/D3F1 A9 1C LDA #$1C A:0000 X:0010 Y:0100 P:envMxdiZc - Load 1C into A. (Palette used)
$00/D3F3 85 91 STA $91    [$00:0691] A:001C X:0010 Y:0100 P:envMxdizc - Store A 0691.
$00/D3F5 A9 78 LDA #$78 A:001C X:0010 Y:0100 P:envMxdizc - Load 78 into A. (Finally Real True Sprites!!)
$00/D3F7 85 8F STA $8F    [$00:068F] A:0078 X:0010 Y:0100 P:envMxdizc - Store A 68F.
$00/D3F9 A9 60 LDA #$60 A:0078 X:0010 Y:0100 P:envMxdizc - Load 60 into A (The way the ships are facing)
$00/D3FB 85 92 STA $92    [$00:0692] A:0060 X:0010 Y:0100 P:envMxdizc - Store A in 0692.
$00/D3FD 20 3C DD JSR $DD3C  [$00:DD3C] A:0060 X:0010 Y:0100 P:envMxdizc - Jump to Subroutine.
$00/D400 E6 79 INC $79    [$00:0679] A:0000 X:0070 Y:0110 P:enVMxdiZc - +1 to 679.
$00/D402 A5 79 LDA $79    [$00:0679] A:0000 X:0070 Y:0110 P:enVMxdizc - Load A from 679.
$00/D404 C9 03 CMP #$03 A:0001 X:0070 Y:0110 P:enVMxdizc - Has this repeated 3 times? (How many times the game should draw the sprites. You can put a fair amount of Airships in the sky! Not 255 Though.)
$00/D406 D0 C1 BNE $C1    [$D3C9] A:0001 X:0070 Y:0110 P:eNVMxdizc - If not loop far back. (The way to draw sprites on screen must be within that code from C9 to here.)
----------------------------------------------------

There is a Lot that was found here, but it's a very long routine and I'm only halfway through it, if not less. But I did figure out the way the ships are drawn on screen (but not their animations I imagine that would come later). I may leave that be for the moment and just move on to more map-based visual effects.


 :edit: Or not...

Effect 05 - Rydia Battle 00D2D3


Code: [Select]
$00/D2D3 A9 EC LDA #$EC A:00D2 X:0008 Y:0002 P:eNvMxdizc - Load EC (Rydia Formation) into A.
$00/D2D5 8D 00 18 STA $1800  [$00:1800] A:00EC X:0008 Y:0002 P:eNvMxdizc - Store A in Encounter Index.
$00/D2D8 9C 01 18 STZ $1801  [$00:1801] A:00EC X:0008 Y:0002 P:eNvMxdizc - Store Zero in World Encounter Byte.
$00/D2DB AD DB 0F LDA $0FDB  [$00:0FDB] A:00EC X:0008 Y:0002 P:eNvMxdizc - Load A from 0FDB.
$00/D2DE 29 8F AND #$8F A:0000 X:0008 Y:0002 P:envMxdiZc - Get rid of all 1,2,3,4,8,80.
$00/D2E0 8D 02 18 STA $1802  [$00:1802] A:0000 X:0008 Y:0002 P:envMxdiZc - Store A in 1802 (Battle background).
$00/D2E3 20 F8 86 JSR $86F8  [$00:86F8] A:0000 X:0008 Y:0002 P:envMxdiZc- Battle Transition Subroutine?
-----------------------------------The mountains of Mist rising----------------------------------------

$00/D2E6 20 35 8B JSR $8B35  [$00:8B35] A:000C X:0030 Y:0020 P:envMxdiZC - Subroutine
$00/D2E9 22 E5 C8 15 JSL $15C8E5[$15:C8E5] A:0085 X:0030 Y:0020 P:envMxdiZC -
00/D2ED AE 06 17 LDX $1706  [$00:1706] A:00FF X:0030 Y:0020 P:eNvMxdizC - Load X from Location Data.
$00/D2F0 DA PHX A:00FF X:0617 Y:0020 P:envMxdizC - Push X onto Stack.
$00/D2F1 A2 63 77 LDX #$7763 A:00FF X:0617 Y:0020 P:envMxdizC - Load 7763 into X. (X and Y of the visual effect on the World Map.)
$00/D2F4 8E 06 17 STX $1706  [$00:1706] A:00FF X:7763 Y:0020 P:envMxdizC - Store X in 1706.
$00/D2F7 9C 00 17 STZ $1700  [$00:1700] A:00FF X:7763 Y:0020 P:envMxdizC - Store Zero in 1700.
$00/D2FA 20 02 85 JSR $8502  [$00:8502] A:00FF X:7763 Y:0020 P:envMxdizC - Subroutine
$00/D2FD A9 20 LDA #$20 A:007F X:5A00 Y:0080 P:envMxdIzc - Load Camera distance into A (10 is default for World Map)
$00/D2FF 85 AD STA $AD    [$00:06AD] A:0020 X:5A00 Y:0080 P:envMxdIzc - Store in 06AD
$00/D301 A9 81 LDA #$81 A:0020 X:5A00 Y:0080 P:envMxdIzc - Load 81 into A.
$00/D303 8D 00 42 STA $4200  [$00:4200] A:0081 X:5A00 Y:0080 P:eNvMxdIzc - Store A in 4200.
$00/D306 A9 03 LDA #$03 A:0081 X:5A00 Y:0080 P:eNvMxdIzc - Load 03 into A.
$00/D308 20 92 8B JSR $8B92  [$00:8B92] A:0003 X:5A00 Y:0080 P:envMxdIzc - Subroutine
$00/D30B A2 40 00 LDX #$0040 A:0010 X:5A00 Y:0080 P:envMxdIzC - Load 0040 into X. (Amount of time for the quakes to begin.)
$00/D30E 20 56 DF JSR $DF56  [$00:DF56] A:0010 X:0040 Y:0080 P:envMxdIzC - Jump to Subroutine.
$00/D311 A9 01 LDA #$01 A:0000 X:0000 Y:0080 P:envMxdIZC - Load 01 into A,
$00/D313 85 E3 STA $E3    [$00:06E3] A:0001 X:0000 Y:0080 P:envMxdIzC - Store A in 06E3.
$00/D315 A9 20 LDA #$20 A:0001 X:0000 Y:0080 P:envMxdIzC - Load 20 into A.
$00/D317 8D CF 0A STA $0ACF  [$00:0ACF] A:0020 X:0000 Y:0080 P:envMxdIzC - Store A in 0ACF.
$00/D31A A9 02 LDA #$02 A:0020 X:0000 Y:0080 P:envMxdIzC - Load 02 into A. (Amount of quake sprites around the screen X.)
$00/D31C 8D D0 0A STA $0AD0  [$00:0AD0] A:0002 X:0000 Y:0080 P:envMxdIzC  - Store A 0AD0
$00/D31F A9 03 LDA #$03 A:0002 X:0000 Y:0080 P:envMxdIzC - Load 03 into A. (Amount of Quake Sprites around the screen Y.)
$00/D321 8D D1 0A STA $0AD1  [$00:0AD1] A:0003 X:0000 Y:0080 P:envMxdIzC - Store A in 0AD1.
$00/D324 A2 70 70 LDX #$7070 A:0003 X:0000 Y:0080 P:envMxdIzC - Load 7070 into X. (Location on Screen to hit with quake sprites)
$00/D327 8E D4 0A STX $0AD4  [$00:0AD4] A:0003 X:7070 Y:0080 P:envMxdIzC - Store X in 0AD4.
$00/D32A A2 40 00 LDX #$0040 A:0003 X:7070 Y:0080 P:envMxdIzC - Load 0040 into X. (Amount of time for the Visual Effect to continue to play)
$00/D32D 8E D2 0A STX $0AD2  [$00:0AD2] A:0003 X:0040 Y:0080 P:envMxdIzC - Store X in 0AD2.
$00/D330 9C CD 0A STZ $0ACD  [$00:0ACD] A:0003 X:0040 Y:0080 P:envMxdIzC - Store 00 in 0ACD.
$00/D333 A9 02 LDA #$02 A:0003 X:0040 Y:0080 P:envMxdIzC - Load 02 into A. (Sprite configuration?)
$00/D335 8D CE 0A STA $0ACE  [$00:0ACE] A:0002 X:0040 Y:0080 P:envMxdIzC - Store A 0ACE.
$00/D338 A9 42 LDA #$42 A:0002 X:0040 Y:0080 P:envMxdIzC - Load 42 into A. (Song to play while Visual Effect occurs)
$00/D33A 8D 01 1E STA $1E01  [$00:1E01] A:0042 X:0040 Y:0080 P:envMxdIzC - Store A in 1E01.
$00/D33D A9 01 LDA #$01 A:0042 X:0040 Y:0080 P:envMxdIzC - Load 01 into A. (Sound effect to play at start)
$00/D33F 8D 00 1E STA $1E00  [$00:1E00] A:0001 X:0040 Y:0080 P:envMxdIzC - Store A in 1E00
$00/D342 22 04 80 04 JSL $048004[$04:8004] A:0001 X:0040 Y:0080 P:envMxdIzC - Subroutine
$00/D346 20 ED DD JSR $DDED  [$00:DDED] A:0001 X:0040 Y:0080 P:envMxdIZC -
$00/D349 20 2D 8F JSR $8F2D  [$00:8F2D] A:00FC X:0040 Y:0010 P:envMxdIZC - Movement Routine
$00/D34C 20 2F DE JSR $DE2F  [$00:DE2F] A:0000 X:001E Y:0000 P:envMxdIZC
$00/D34F AE D2 0A LDX $0AD2  [$00:0AD2] A:0001 X:001C Y:0000 P:envMxdIzC - Load X from 0AD2.
$00/D352 E0 10 00 CPX #$0010 A:0001 X:0040 Y:0000 P:envMxdIzC - Has it looped...?
$00/D355 B0 07 BCS $07    [$D35E] A:0001 X:0040 Y:0000 P:envMxdIzC - - If not branch elsewhere
--------------------------------------------------------------------------------

----------------------------------------------------------------------------------
$00/D35E AE D2 0A LDX $0AD2  [$00:0AD2] A:0001 X:0040 Y:0000 P:envMxdIzC - Load X from 0AD2
$00/D361 D0 E6 BNE $E6    [$D349] A:0001 X:0040 Y:0000 P:envMxdIzC - Loop back if not 00.
---------------------------------------------------------------------------------
$00/D364 8E 06 17 STX $1706  [$00:1706] A:0085 X:0617 Y:0080 P:envMxdIzc - Store X in 1706.
$00/D367 64 E3 STZ $E3    [$00:06E3] A:0085 X:0617 Y:0080 P:envMxdIzc - Store Zero in 06E3.
$00/D369 64 80 STZ $80    [$00:0680] A:0085 X:0617 Y:0080 P:envMxdIzc - Store Zero in 0080.
$00/D36B 4C D3 E0 JMP $E0D3  [$00:E0D3] A:0085 X:0617 Y:0080 P:envMxdIzc - Go to Rest of Routine.
« Last Edit: February 04, 2015, 05:36:48 PM by Grimoire LD »

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Grimoire LD's Notes, Patches, and Hacks (Disassembly on Visual Effects)
« Reply #395 on: February 06, 2015, 09:28:24 AM »
Small Update with just the Shelter Visual Effect documentation.

Effect 06 - Erecting a Shelter 00D137
Code: [Select]
$00/D137 20 2D 8F JSR $8F2D  [$00:8F2D] A:00D1 X:000A Y:0002 P:eNvMxdizc - Subroutines
$00/D13A 20 59 8F JSR $8F59  [$00:8F59] A:0000 X:001E Y:0000 P:envMxdiZC
$00/D13D 20 0C D8 JSR $D80C  [$00:D80C] A:00F0 X:0020 Y:0000 P:envMxdiZC
$00/D140 AD 00 17 LDA $1700  [$00:1700] A:00AA X:0008 Y:0000 P:envMxdiZC - Load World Index
$00/D143 C9 03 CMP #$03 A:0000 X:0008 Y:0000 P:envMxdiZC - Is it in an Area?
$00/D145 F0 06 BEQ $06    [$D14D] A:0000 X:0008 Y:0000 P:eNvMxdizc - If so, branch past.
---------------------------------------------------------------------------------------------------
$00/D147 20 A2 92 JSR $92A2  [$00:92A2] A:0000 X:0008 Y:0000 P:eNvMxdizc - Subroutine
$00/D14A 4C 4D D1 JMP $D14D  [$00:D14D] A:0000 X:0008 Y:0000 P:envMxdiZC -Jump to D14D (why not branch always?)
--------------------------------------------------------------------------------
$00/D14D A2 70 70 LDX #$7070 A:0000 X:0008 Y:0000 P:envMxdiZC - Load Sprite to middle of screen.
$00/D150 8E 00 03 STX $0300  [$00:0300] A:0000 X:7070 Y:0000 P:envMxdizC - Store X in 0300.
$00/D153 AD 03 1A LDA $1A03  [$00:1A03] A:0000 X:7070 Y:0000 P:envMxdizC - Load A from 1A03.
$00/D156 3A DEC A A:0001 X:7070 Y:0000 P:envMxdizC - -1 A
$00/D157 0A ASL A A:0000 X:7070 Y:0000 P:envMxdiZC - x2 A
$00/D158 18 CLC A:0000 X:7070 Y:0000 P:envMxdiZC - Clear Carry Flag.
$00/D159 69 E8 ADC #$E8 A:0000 X:7070 Y:0000 P:envMxdiZc - Add E8 into A. (E8 is Tent) (EA is Cabin) (EC is Fire)
$00/D15B 8D 02 03 STA $0302  [$00:0302] A:00E8 X:7070 Y:0000 P:eNvMxdizc - Store A in 0302.
$00/D15E AD 03 1A LDA $1A03  [$00:1A03] A:00E8 X:7070 Y:0000 P:eNvMxdizc - Load A from 1A03.
$00/D161 0A ASL A A:0001 X:7070 Y:0000 P:envMxdizc - x2 A.
$00/D162 09 31 ORA #$31 A:0002 X:7070 Y:0000 P:envMxdizc - Add 31 if applicable. (Evens- Ship/Odds - Tent, Palettes thrown in through each two values.)
$00/D164 8D 03 03 STA $0303  [$00:0303] A:0033 X:7070 Y:0000 P:envMxdizc - Store A 0303.
$00/D167 4C D3 E0 JMP $E0D3  [$00:E0D3] A:0033 X:7070 Y:0000 P:envMxdizc - Jump to Rest of Routine.


Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Grimoire LD's Notes, Patches, and Hacks (Disassembly on Visual Effects)
« Reply #396 on: February 08, 2015, 01:35:47 PM »
Short break from Visual Effects to finally put the nail in the coffin to Battle Character weapons!

When looking what was special about Throw, I stumbled upon a piece of info. I didn't follow up on about the weapon being stored 7E3580, this would make sense as this is the area with all the other command special bytes like Twin Presence, Cover, Regen, etc.

So with this information in hand I set a Read Breakpoint to see how the graphics are loaded because Chillyfeez long ago was having issues with his Elemental Daggers showing up as fists. This is because they replaced the Shuriken and Ninja Shuriken which slots are special exceptions

Code: [Select]
$02/C118 AD 80 35 LDA $3580  [$7E:3580] A:00C0 X:0020 Y:000A P:envMxdiZC - Load Thrown Item into A.
$02/C11B C9 41 CMP #$41 A:0023 X:0020 Y:000A P:envMxdizC - Is it Ninja Shuriken?
$02/C11D F0 04 BEQ $04    [$C123] A:0023 X:0020 Y:000A P:eNvMxdizc - If so, unique branch.
$02/C11F C9 40 CMP #$40 A:0023 X:0020 Y:000A P:eNvMxdizc - Is it Shuriken?
$02/C121 D0 09 BNE $09    [$C12C] A:0023 X:0020 Y:000A P:eNvMxdizc - If not, branch past.
--------------------------------------------------------------------------------------------------------------------------
$02/C123 A9 40 LDA #$40 A:0011 X:0020 Y:000A P:envMxdizc - Load 40 into A.
$02/C125 85 50 STA $50    [$00:0050] A:0011 X:0020 Y:000A P:envMxdizc - Store A into 50.
$02/C127 64 51 STZ $51    [$00:0051] A:0011 X:0020 Y:000A P:envMxdizc - Store Zero in 51.
$02/C129 4C C8 CF JMP $CFC8  [$02:CFC8] A:0011 X:0020 Y:000A P:envMxdizc - Jump elsewhere
-------------------------------------------------------------------------------------------------------------------------------
$02/C12C A9 11 LDA #$11 A:0023 X:0020 Y:000A P:eNvMxdizc - Load 11 into A.
$02/C12E 20 6D D9 JSR $D96D  [$02:D96D] A:0011 X:0020 Y:000A P:envMxdizc - Jump to Subroutine (Weapon Graphics)

That subroutine is actually rather special as it looks to see what the weapon graphic is and goes from there.

Knowing this I Finally knew where Weapon Graphics were being allocated to.

I knew then that I had the means to change what weapons Battle Character's wielded instead of the Deathbringer. Why they wield the Deathbringer is probably because of a scrapped part of the Dark Knight battle where he may normally attack once or twice. Through loading up Rydia and giving her several fight commands in her AI routine I pinpointed where the Battle Character Weapon spot is and how it is used. The bizarre thing about this I found was that this was all in Bank 02. I was unaware of that doing anything outside of battle menus.

Code: [Select]
$02/D028 AD 4E ED LDA $ED4E  [$7E:ED4E] A:0080 X:0000 Y:0012 P:eNvMxdizc - Load Monster... something (Yousei's RAM notes say that ED50 is palette data so it may deal something with size or graphic or something)
$02/D02B 29 10 AND #$10 A:001F X:0000 Y:0012 P:envMxdizc - Get rid of all but 10.
$02/D02D F0 1B BEQ $1B    [$D04A] A:0010 X:0000 Y:0012 P:envMxdizc - All normal monsters branch here where Battle Characters continue on.
----------------------------------------------------------------------------------------------------------------
$02/D02F A9 18 LDA #$18 A:0010 X:0000 Y:0012 P:envMxdizc - Load Deathbringer into A.
$02/D031 20 BA D8 JSR $D8BA  [$02:D8BA] A:0018 X:0000 Y:0012 P:envMxdizc - Jump to Subroutine
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
02/D8BA C2 20 REP #$20 A:0018 X:0000 Y:0012 P:envMxdizc - Reset Processor Status
$02/D8BC 0A ASL A A:0018 X:0000 Y:0012 P:envmxdizc - x2 A
$02/D8BD 0A ASL A A:0030 X:0000 Y:0012 P:envmxdizc - x2 A
$02/D8BE AA TAX A:0060 X:0000 Y:0012 P:envmxdizc - Transfer A to X
$02/D8BF 7B TDC A:0060 X:0060 Y:0012 P:envmxdizc - Clear A.
$02/D8C0 E2 20 SEP #$20 A:0000 X:0060 Y:0012 P:envmxdiZc - Set Processor to 20.
$02/D8C2 BF 11 9E 0F LDA $0F9E11,x[$0F:9E71] A:0000 X:0060 Y:0012 P:envMxdiZc - Load Weapon Graphic into A.
$02/D8C6 20 6D D9 JSR $D96D  [$02:D96D] A:0006 X:0060 Y:0012 P:envMxdizc - Jump to Subroutine
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~``
$02/D96D DA PHX A:0006 X:0060 Y:0012 P:envMxdizc - Push X
$02/D96E AA TAX A:0006 X:0060 Y:0012 P:envMxdizc - Transfer A to X.
$02/D96F BF 6D FB 16 LDA $16FB6D,x[$16:FB73] A:0006 X:0006 Y:0012 P:envMxdizc - ???
$02/D973 85 26 STA $26    [$00:0026] A:0018 X:0006 Y:0012 P:envMxdizc - Store A in 26.
$02/D975 A9 18 LDA #$18 A:0018 X:0006 Y:0012 P:envMxdizc - Load 18 into A.
$02/D977 85 28 STA $28    [$00:0028] A:0018 X:0006 Y:0012 P:envMxdizc - Store A in 28.

If we can conjure up some free space we can have a team of Battle Character's all use different weaponry if we compare it to graphic call or palette it could be a much more convincing system. The only issue with it is that the Swing seems to be preset to basic attacking, so no harps, arrows, or fists basically.

 (Having gone through the weapon graphics it's kind of ridiculous how much space was wasted on Edge's throwing and thrown weapons, I honestly think we could replace some of them to have more weapon graphics to use.

I can think of several from other FF's which are noticeably missing in FFIV...

Okay two. Bells and Books. Surprisingly FF doesn't really get any real sort of weapon type upgrades until FFXII (I don't count Volleyballs as logical weapons from FFX, Dolls were a neat idea though) I can think we could use a few more sword graphic due to the amount there are in the game, I mean FFII on PSP gets a unique graphic for every weapon and FFIV PSP gets nothing new? A bit of a rip off in some respects.

I'll post the graphics that are not in FF4kster correctly already...

Sprite 008 - Thrown Axe Graphic.
Sprite 012 - Ninja Shuriken Graphic (yes there are two graphics wasted on Shurikens and yet they made Dark Swords look the same as Katanas.
Sprite 014 - Thrown Boomerang
Sprite 016 - Thrown Chakram
Sprite 017 - Returning Chakram
Sprite 018 - Thrown Weapon Spinning
Sprite 019 - Coiled Whip
Sprite 020 - Whip Lash
Sprite 023 - Bow
Sprite 024 - Bow Drawn
Sprite 025 - Arrow

Sprite 027 - Light Burst, possibly from an attack animation hit. Look good regardless.
Sprite 028 - Two halves of some sprite, but the way it is connected makes it look rather legitimate. Could possibly substitute for a graphic for elemental whips.

Sprite 031 - Another Drawn Bow

Sprite 035 - Another Bow

Sprite 037 - Another attack animation hit, looks good though for a magical weapon.
Sprite 038 - Spinning Weapon from Throw Again

Sprite 040 - Another Drawn Bow
Sprite 041 - Another animation hit, slightly different, looks good.

I think I'll stop there though.




LordGarmonde

  • Baigan
  • *
  • Posts: 271
  • Gender: Male
  • "Power only breeds war..."
    • View Profile
Re: Grimoire LD's Notes, Patches, and Hacks (Solving Character Battle Weapon)
« Reply #397 on: February 08, 2015, 08:21:14 PM »
I knew then that I had the means to change what weapons Battle Character's wielded instead of the Deathbringer. Why they wield the Deathbringer is probably because of a scrapped part of the Dark Knight battle where he may normally attack once or twice. Through loading up Rydia and giving her several fight commands in her AI routine I pinpointed where the Battle Character Weapon spot is and how it is used. The bizarre thing about this I found was that this was all in Bank 02. I was unaware of that doing anything outside of battle menus.

I had wondered that about the weapon choice. I know Yang busts out the Deathbringer if you fix his targeting glitch for the Baron Inn fight. Makes sense about couple of attacks and then Dark Wave for the mirror match; that would make it like the fight with Yang is scripted: back and forth between regular attacks and special attacks.

Nice work on the above breakdown. Always makes for interesting reading - and source of ideas  :wink:
"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 (Solving Character Battle Weapon)
« Reply #398 on: February 08, 2015, 09:30:12 PM »
I knew then that I had the means to change what weapons Battle Character's wielded instead of the Deathbringer. Why they wield the Deathbringer is probably because of a scrapped part of the Dark Knight battle where he may normally attack once or twice. Through loading up Rydia and giving her several fight commands in her AI routine I pinpointed where the Battle Character Weapon spot is and how it is used. The bizarre thing about this I found was that this was all in Bank 02. I was unaware of that doing anything outside of battle menus.

I had wondered that about the weapon choice. I know Yang busts out the Deathbringer if you fix his targeting glitch for the Baron Inn fight. Makes sense about couple of attacks and then Dark Wave for the mirror match; that would make it like the fight with Yang is scripted: back and forth between regular attacks and special attacks.

Nice work on the above breakdown. Always makes for interesting reading - and source of ideas  :wink:

Possibly of note, Yang is shown with two swords at his side in the concept art so maybe that's how they planned to explain how he was wielding a blade in that battle originally?

LordGarmonde

  • Baigan
  • *
  • Posts: 271
  • Gender: Male
  • "Power only breeds war..."
    • View Profile
Re: Grimoire LD's Notes, Patches, and Hacks (Solving Character Battle Weapon)
« Reply #399 on: February 08, 2015, 09:33:00 PM »
Possibly of note, Yang is shown with two swords at his side in the concept art so maybe that's how they planned to explain how he was wielding a blade in that battle originally?

Nice spotting - I had no idea about that. Maybe they were hinting at him being brain-washed and brought into the Dark Knights Corps.  :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 (Solving Character Battle Weapon)
« Reply #400 on: February 11, 2015, 08:43:23 PM »
$15/C8C0   BD 01 10   LDA $1001,x[$00:1101]   A:0000   X:0100   Y:0000   P:envMxdIZc - Load Slot X's Class.
$15/C8C3   29 1F   AND #$1F   A:0003   X:0100   Y:0000   P:envMxdIzc - Clear 1F portion.
$15/C8C5   85 06   STA $06    [$00:0606]   A:0003   X:0100   Y:0000   P:envMxdIzc - Store A in 0606
$15/C8C7   0A    ASL A   A:0003   X:0100   Y:0000   P:envMxdIzc - x2 A
$15/C8C8   18    CLC   A:0006   X:0100   Y:0000   P:envMxdIzc - Clear Carry Flag
$15/C8C9   65 06   ADC $06    [$00:0606]   A:0006   X:0100   Y:0000   P:envMxdIzc - Add the value from 0606 (so essentially x3)
$15/C8CB   18    CLC   A:0009   X:0100   Y:0000   P:envMxdIzc - Clear Carry Flag
$15/C8CC   69 80   ADC #$80   A:0009   X:0100   Y:0000   P:envMxdIzc - Add 80 onto A.
$15/C8CE   85 4B   STA $4B    [$00:064B]   A:0089   X:0100   Y:0000   P:eNvMxdIzc - Store A in 064B (where the game will later draw from for sprite)
$15/C8D0   64 4A   STZ $4A    [$00:064A]   A:0089   X:0100   Y:0000   P:eNvMxdIzc - Store Zero in 4A.
$15/C8D2   A2 00 40   LDX #$4000   A:0089   X:0100   Y:0000   P:eNvMxdIzc - Load X from 4000.
$15/C8D5   86 4C   STX $4C    [$00:064C]   A:0089   X:4000   Y:0000   P:envMxdIzc - Store X in 064C.
$15/C8D7   A2 00 02   LDX #$0200   A:0089   X:4000   Y:0000   P:envMxdIzc - Load 0200 into X.
$15/C8DA   86 4E   STX $4E    [$00:064E]   A:0089   X:0200   Y:0000   P:envMxdIzc - Store X in 064E.
$15/C8DC   A9 1B   LDA #$1B   A:0089   X:0200   Y:0000   P:envMxdIzc - Load 1B into A.
$15/C8DE   85 49   STA $49    [$00:0649]   A:001B   X:0200   Y:0000   P:envMxdIzc - Store A into 0659.
$15/C8E0   22 00 B0 15   JSL $15B000[$15:B000]   A:001B   X:0200   Y:0000   P:envMxdIzc - Jump to Sprite Display Routine.

This tells us some interesting things, but this regimented system is rather disappointing, from a gameplay perspective it makes sense, they knew what they wanted and had no reason to do it any other way. But from a modding perspective it is annoying to have Sprite tied to Class. Mainly because it makes classes past 0D as all but unusable. For instance if you wanted to fix Golbez to actually work on the Overworld map (and not be a frog with the em Whit class...) you would need to do a lot more than what is currently in play. If we switch the Sprite Check to say the Character's never used Steal Defense byte, then that opens up All of those sprites for use (outside of battle, in-battle is an entirely different beast)

When you try to use classes above 11 you'll notice odd things start to occur. I cannot say why that happens, but when used from the previous Steal Defense byte, these sprite's work properly, but it doesn't follow the normal sprite index, presumably because normal sprites are loaded in a different way and soon the sprite index gets thrown off after Man, it then jumps to Dancer. Bizarrely enough, Golbez is unreachable in this setup. Because Golbez is 24 and the sprite decides to stop at 23 then 25, and skips over Golbez. I assume this is because the party sprites have (likely twice) as many animations as normal NPC's. Humorously enough his detached hand is an applicable choice of sprite though.

Of course if you flip around those two sprites you can have a working (Overworld and Battle) Golbez. you'll just need to switch the indexes around a bit.

However that may just be a little more trouble than it's worth, but this method at least does free the Sprite from Class Byte as it was originally set.


Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Grimoire LD's Notes, Patches, and Hacks (Protect/Shell Status)
« Reply #401 on: February 14, 2015, 11:51:05 AM »
FFIV is the last FF (possibly FFII NES had a proper status as well) to make Protect and Shell a stat boosting spell which increases it in increments... in FFI this was really good, in FFII it was variable... FFIV however it is mostly useless. Not once have I read in any guide "Use Protect/Shell" so I was thinking of a way to make more statuses that we can create but didn't want to create the broken measures of +25 Defense, +25% Defense for each cast, so I put together a short formula which looks at a (presumed) unused stat byte that is cleared at the start of each battle and use that for more statuses. This would make it vulnerable to a redone Dispel/Black Hole routine. Here was my plan, it was simple and efficient and seemed to work flawlessly when tested...

Protect Status Routine

Code: [Select]
$03/D84F         AD 74 27 LDA $2774  [$7E:2774] A:0003 X:001A Y:0000 P:envMxdizc - Load A from Unused Byte.
$03/D852 29 01 AND #$01 A:0002 X:001A Y:0000 P:envMxdizc - Get rid of all bits but 01.
$03/D854 F0 03 BEQ $03    [$D859] A:0000 X:001A Y:0000 P:envMxdiZc - If 00, branch.
---------------------------------------------------------------------------------------------------------------------
$03/D856 4C 2D E0 JMP $E02D  [$03:E02D] A:0001 X:001A Y:0000 P:envMxdiZC - Jump to Magic Fail Routine.
----------------------------------------------------------------------------------------------------------------------- 
$03/D859 AD 2A 27 LDA $272A  [$7E:272A] A:0000 X:001A Y:0000 P:eNvMxdizc - Load A from Target's Defense.
$03/D85C 4A LSR A A:000A X:001A Y:0000 P:envMxdizc
$03/D85D 4A LSR A A:0005 X:001A Y:0000 P:envMxdizc /4.
$03/D85E 6D 2A 27 ADC $272A  [$7E:272A] A:0002 X:001A Y:0000 P:envMxdizC - Add the Target's Defense to the /4 Defense.
$03/D861 8D 2A 27 STA $272A  [$7E:272A] A:000D X:001A Y:0000 P:envMxdizc - Store A in Target's Defense.
$03/D864 AD 74 27 LDA $2774  [$7E:2774] A:000D X:001A Y:0000 P:envMxdizc - Load Unused Byte into A.
$03/D867 09 01 ORA #$01 A:0000 X:001A Y:0000 P:envMxdiZc - Add 01 if applicable.
$03/D869 8D 74 27 STA $2774  [$7E:2774] A:0001 X:001A Y:0000 P:envMxdizc - Store A in Unused Byte
$03/D86C 60 RTS A:0001 X:001A Y:0000 P:envMxdizc - Return

Shell Status Routine
Code: [Select]
$03/D873 AD 74 27 LDA $2774  [$7E:2774] A:0003 X:001C Y:0000 P:envMxdizc - Load A from Unused Byte
$03/D876 29 02 AND #$02 A:0001 X:001C Y:0000 P:envMxdizc - Is 02 (Shell) already there?
$03/D878 F0 03 BEQ $03    [$D87D] A:0000 X:001C Y:0000 P:envMxdiZc - If not, branch.
----------------------------------------------------------------------------------------------------------------

-----------------------------------------------------------------------------------------------------------------
$03/D87D AD 24 27 LDA $2724  [$7E:2724] A:0000 X:001C Y:0000 P:envMxdiZc - Load A from Target's Magic Defense Byte.
$03/D880 4A LSR A A:0006 X:001C Y:0000 P:envMxdizc -
$03/D881 4A LSR A A:0003 X:001C Y:0000 P:envMxdizc - /4
$03/D882 6D 24 27 ADC $2724  [$7E:2724] A:0001 X:001C Y:0000 P:envMxdizC - Add the value in Magic Defense Byte into Magic Defense /4,
$03/D885 8D 24 27 STA $2724  [$7E:2724] A:0008 X:001C Y:0000 P:envMxdizc - Store A in Magic Defense Byte
$03/D888 AD 74 27 LDA $2774  [$7E:2774] A:0008 X:001C Y:0000 P:envMxdizc - Load Unused Byte.
$03/D88B 09 02 ORA #$02 A:0001 X:001C Y:0000 P:envMxdizc - Add 02 if applicable.
$03/D88D 8D 74 27 STA $2774  [$7E:2774] A:0003 X:001C Y:0000 P:envMxdizc  - Store 02 (Shell) in Unused Byte.



5 Bytes shorter than the original code with a little more optimization I may be able to make just one routine contain several checks. For instance say you wanted to add Brave and Faith from FFIV:DS in...

You could put checks in for spell power to see where the proper branching point should be all stored by bits as illustrated above. Should I release a standalone patch for a Shell/Protect Mod which makes it into a status moreso than a continually applied buff?

This was made more or less for the Side Project to give those spells more utility all in all (FFIV:CB used them in a way where the gradual increment would be preferable)

And that's all it took! These are both tested and they look to be working optimally and due to the open nature of it, it can be applied to pretty much any statistic.

koala_knight

  • Tunnel Armor
  • *
  • Posts: 166
  • Gender: Male
    • View Profile
Yes! Absolutely , yes! A stand  alone  patch for this would be fantastic. :)

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Hmm, I'm having a lot of trouble getting Dispel to work with this at all, only because of limited space.

Would a patch that does not have Dispel working properly to get rid of Protect/Shell still be desired? I could easily do it with empty space, but since I would like this compatible with other people's hacks I feel that would kill the entire process, I tried using Black Hole into Dispel's Routine, but still ran out of room to get rid of the +1/4 bonus to the defenses.

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Finally! After an hour or so of pondering the issue I used all I had to create probably my most efficient routine.

This builds the Dispel Routine right into Black Hole and replaces the Entire Dispel Routine (Not a Single byte to spare in the end) with the means to get rid of Protect/Shell successfully.

Code: [Select]
$03/DDC0 AD 74 27 LDA $2774  [$7E:2774] A:0000 X:0054 Y:0000 P:envMxdiZc - Load A from Protect/Shell Byte.
$03/DDC3 4C B0 D8 JMP $D8B0  [$03:D8B0] A:0003 X:0054 Y:0000 P:envMxdizc - Jump to Dispel Routine
$03/D8B0 29 02 AND #$02 A:0003 X:0054 Y:0000 P:envMxdizc - Isolate Shell if Present.
$03/D8B2 C9 02 CMP #$02 A:0002 X:0054 Y:0000 P:envMxdizc - Is it Shell?
$03/D8B4 D0 11 BNE $11    [$D8C7] A:0002 X:0054 Y:0000 P:envMxdiZC - If not, branch to Protect section.
$03/D8B6 A2 00 00 LDX #$0000 A:0002 X:0054 Y:0000 P:envMxdiZC - Load 0000 into .
$03/D8B9 BD 24 27 LDA $2724,x[$7E:2724] A:0002 X:0000 Y:0000 P:envMxdiZC - Load A from Magical Defense (Or Defense) into A.
$03/D8BC 48 PHA A:0008 X:0000 Y:0000 P:envMxdizC - Push Magical Defense/Defense onto stack.
$03/D8BD 4A LSR A A:0008 X:0000 Y:0000 P:envMxdizC -
$03/D8BE 4A LSR A A:0004 X:0000 Y:0000 P:envMxdizc - /4
$03/D8BF 85 E3 STA $E3    [$00:00E3] A:0002 X:0000 Y:0000 P:envMxdizc - Store A in placeholder.
$03/D8C1 68 PLA A:0002 X:0000 Y:0000 P:envMxdizc - Pull Magical Defense/Defense from stack.
$03/D8C2 E5 E3 SBC $E3    [$00:00E3] A:0008 X:0000 Y:0000 P:envMxdizc - Subtract Magical Defense/Defense from it's value /4 (sets it back to normal)
$03/D8C4 8D 24 27 STA $2724  [$7E:2724] A:0005 X:0000 Y:0000 P:envMxdizC - Store A in Magical Defense/Defense.
------------------------------------------------------------------------------------
$03/D8C7 AD 74 27 LDA $2774  [$7E:2774] A:0005 X:0000 Y:0000 P:envMxdizC - Load A from Protect/Shell Byte.
$03/D8CA 9C 74 27 STZ $2774  [$7E:2774] A:0003 X:0000 Y:0000 P:envMxdizC - Store Zero in Protect/Shell Byte.
$03/D8CD 29 01 AND #$01 A:0003 X:0000 Y:0000 P:envMxdizC - Isolate Protect if Present
$03/D8CF C9 01 CMP #$01 A:0001 X:0000 Y:0000 P:envMxdizC - Is it Protect?
$03/D8D1 D0 05 BNE $05    [$D8D8] A:0001 X:0000 Y:0000 P:envMxdiZC - If not, branch past.
$03/D8D3 A2 06 00 LDX #$0006 A:0001 X:0000 Y:0000 P:envMxdiZC - Load 0006 into X (allows the adress to reach normal Defense)
$03/D8D6 80 E1 BRA $E1    [$D8B9] A:0001 X:0006 Y:0000 P:envMxdizC - Loop back to stat /4 Routine except looking at Defense this time.
"                                                                                                                                                  "
$03/D8C7 AD 74 27 LDA $2774  [$7E:2774] A:000B X:0006 Y:0000 P:envMxdizC - Once loop is complete, reload Protect/Shell Byte.
$03/D8CA 9C 74 27 STZ $2774  [$7E:2774] A:0000 X:0006 Y:0000 P:envMxdiZC - Is it now 00 due to the first STZ in the first loop.
$03/D8CD 29 01 AND #$01 A:0000 X:0006 Y:0000 P:envMxdiZC - Cannot be passed now.
$03/D8CF C9 01 CMP #$01 A:0000 X:0006 Y:0000 P:envMxdiZC
$03/D8D1 D0 05 BNE $05    [$D8D8] A:0000 X:0006 Y:0000 P:eNvMxdizc - Branch to end.
$03/D8D8 60 RTS A:0000 X:0006 Y:0000 P:eNvMxdizc - Return.


This is some of my finest optimized code due to the extraordinarily limited scope I had to work with. I will release a Protect/Shell improvement patch shortly.

The one normal functionality of Black Hole that had to be deleted for this was the resetting of Speed, but keep in mind that Esuna also reflects Speed, so if people want Zeromus to still reset Speed, just have him cast Esuna on the party, since he doesn't use any Status Ailments after all.

 :edit: Or I'm an idiot. There was still at least another 20 bytes to work with. Bah, I'll fix this, all that would really happen here is that the JMP to the Dispel Routine will close the Speed Reset.
« Last Edit: February 16, 2015, 06:08:27 PM by Grimoire LD »