Aslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&action=printpage;topic=1883.0e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/indexa9a4.htmldelayedslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&topic=1883.0e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/indexa9a4.html.zxg^@{0<OKtext/htmlISO-8859-1gzip@{0<HTue, 10 Mar 2020 04:58:46 GMT0 0Pg^{0< Print Page - Grimoire LD's Notes, Patches, and Hacks (Dark Knight/Paladin Swap In Battle!)

Board of Slick

Library of the Ancients => Final Fantasy IV Research & Development => Topic started by: Grimoire LD on September 09, 2013, 01:30:20 PM

Title: Grimoire LD's Notes, Patches, and Hacks (Dark Knight/Paladin Swap In Battle!)
Post by: Grimoire LD on September 09, 2013, 01:30:20 PM
Table of Contents

1. Spell Routine Offsets

2. Command Routine Offsets

3. Specialty Routine Offsets

4. Event Routine Offsets

5. Bug Fixes

6. Custom Routine Offsets (& Replacements)
A. Commands
B.  Spells
C. Event Instructions
D. Patches

7. Miscellaneous


Well this has been a long time coming, even I'm now having trouble keeping track of all I've found thus far, hehe. So I thought a separate thread to keep everything in a clean manner would make it easier to find and maybe others would be able to track down this information in a more efficient fashion.

I will list the Routine Maps as they appear in the Tower of Babil Docs (thereby ROM) for quick and easy reference (for myself and for others) I will have several links to the Tower of Babil Docs as well, to reference the routines I haven't done because they were completed long ago.

To find any of these values in ROM decrease the amount by 1FE00 (for v1.1) - They are in their LoRom format for efficiency purposes.

 :edit: 1/31/14 Added a Combo Patch which puts all of my released patches into one easy patch.

 :edit: 7/12/15 Finally cleaning this topic a little to put all of my work back into the main part of this topic.

This post is now updated with quick links to all of the available Command Subroutines I've commented on.

Spell Routine Offsets -

00 Damaging Spells (http://slickproductions.org/forum/index.php?topic=1883.msg20289#msg20289)- 03D388
01 Damage, Sap (http://slickproductions.org/forum/index.php?topic=1883.msg19146#msg19146) - 03D3C2
02 HP Healing (http://slickproductions.org/forum/index.php?topic=1883.msg20289#msg20289) - 03D41C
03 Single Digit HP (http://slickproductions.org/forum/index.php?topic=1883.msg19183#msg19183) - 03D453
04 Drain (http://rb.thundaga.com/tob/spellcode.txt) - 03D476
05 Psych (http://rb.thundaga.com/tob/spellcode.txt) - 03D498
06 Status (http://slickproductions.org/forum/index.php?topic=1883.msg19192#msg19192) - 03D515
07 Immobilizing Status (http://slickproductions.org/forum/index.php?topic=1883.msg19194#msg19194) - 03D5B6
08 Add Image (http://rb.thundaga.com/tob/spellcode.txt) - 03D623
09 Reflect (http://slickproductions.org/forum/index.php?topic=1883.msg19196#msg19196) - 03D62C
0A Life (http://slickproductions.org/forum/index.php?topic=1883.msg19149#msg19149) - 03D65B
0B Heal/Remove All Statuses Except.... (http://slickproductions.org/forum/index.php?topic=1883.msg19953#msg19953) - 03D6F8
0C Shape Changing Status (http://slickproductions.org/forum/index.php?topic=1883.msg19202#msg19202) - 03D82A
0D Protect (http://slickproductions.org/forum/index.php?topic=1883.msg19222#msg19222) - 03D84F
0E Shell (http://slickproductions.org/forum/index.php?topic=1883.msg19222#msg19222) - 03D873
0F Slow (http://rb.thundaga.com/tob/spellcode.txt) - 03D897
10 Dispel (http://slickproductions.org/forum/index.php?topic=1883.msg19180#msg19180) - 03D8B0
11 Stop (http://slickproductions.org/forum/index.php?topic=1883.msg19225#msg19225) - 03D8EE
12 Peep (http://slickproductions.org/forum/index.php?topic=1883.msg19227#msg19227) - 03D924
13 Exit (http://slickproductions.org/forum/index.php?topic=1883.msg19228#msg19228) - 03D97F
14 Damage Based on Caster's HP (http://slickproductions.org/forum/index.php?topic=1883.msg19237#msg19237) - 03D99D
15 MP Recovery (http://rb.thundaga.com/tob/spellcode.txt) - 03D9F9
16 Elixir (http://rb.thundaga.com/tob/spellcode.txt) - 03DA19
17 Damage, Poison (http://slickproductions.org/forum/index.php?topic=1883.msg19239#msg19239) - 03DA2B
18 Damage, Status (http://slickproductions.org/forum/index.php?topic=1883.msg19229#msg19229) - 03DA73
19 Damage, Immobilizing Status (http://slickproductions.org/forum/index.php?topic=1883.msg19236#msg19236) - 03DA8C
1A Sylph (http://slickproductions.org/forum/index.php?topic=1883.msg19241#msg19241) - 03DAAE
1B Odin (http://slickproductions.org/forum/index.php?topic=1883.msg19243#msg19243) - 03DB5F
1C Count (http://slickproductions.org/forum/index.php?topic=1883.msg19245#msg19245) - 03BB5
1D Damage Based on Target's Max HP (http://slickproductions.org/forum/index.php?topic=1883.msg19246#msg19246) - 03DBE5
1E Add Calcify (http://slickproductions.org/forum/index.php?topic=1883.msg19247#msg19247) - 03DC2B
1F Gaze (http://slickproductions.org/forum/index.php?topic=1883.msg19248#msg19248) - 03DC90
20 Blaster (http://slickproductions.org/forum/index.php?topic=1883.msg19249#msg19249) - 03DCB0
21 Slap (http://slickproductions.org/forum/index.php?topic=1883.msg19249#msg19249) - 03DCCB
22 Mind Blast (http://slickproductions.org/forum/index.php?topic=1883.msg19250#msg19250) - 03DCF0
23 Hug (http://slickproductions.org/forum/index.php?topic=1883.msg19250#msg19250) - 03DCFB
24 Explode (http://slickproductions.org/forum/index.php?topic=1883.msg19250#msg19250) - 03DD12
25 Reaction (http://slickproductions.org/forum/index.php?topic=1883.msg19250#msg19250) - 03DD2F
26 Recover 1/10 of Max HP (http://slickproductions.org/forum/index.php?topic=1883.msg19251#msg19251) - 03DD4E
27 Damage, Status(Unused?) (http://slickproductions.org/forum/index.php?topic=1883.msg19252#msg19252) - 03DD92
28 Spawn Monster (http://slickproductions.org/forum/index.php?topic=1883.msg19252#msg19252) - 03DD98
29 Black Hole (http://slickproductions.org/forum/index.php?topic=1883.msg19252#msg19252) - 03DDAE
2A Attack Based on Physical Power (http://slickproductions.org/forum/index.php?topic=1883.msg19232#msg19232) - 03DDC6
2B Recover 1/3 of Current HP (http://slickproductions.org/forum/index.php?topic=1883.msg19251#msg19251) - 03DD62
2C "Trigger A Reaction" (http://slickproductions.org/forum/index.php?topic=1883.msg19253#msg19253) - 03DDD9
2D Invincibility Counter-On (http://slickproductions.org/forum/index.php?topic=1883.msg19253#msg19253) - 03DDD6
2E Invincibility Counter-Off (http://slickproductions.org/forum/index.php?topic=1883.msg19253#msg19253) - 03DDDA
2F Revive Monster (http://slickproductions.org/forum/index.php?topic=1883.msg19253#msg19253) - 03DDDE
30 Tradeoff(Suicide, bring in Next Monster) (http://slickproductions.org/forum/index.php?topic=1883.msg19256#msg19256) - 03DE31
31 End Battle (http://slickproductions.org/forum/index.php?topic=1883.msg19256#msg19256) - 03DFCF
32 Search (http://slickproductions.org/forum/index.php?topic=1883.msg19256#msg19256) - 03DFD5
33 Hatch (http://slickproductions.org/forum/index.php?topic=1883.msg19256#msg19256) - 03DFE8
34 Rydia Returns (http://slickproductions.org/forum/index.php?topic=1883.msg19256#msg19256) - 03E004

Command Routine Offsets

00 Fight (http://slickproductions.org/forum/index.php?topic=1883.msg19266#msg19266) - 03C499
01 Damage Routines (http://slickproductions.org/forum/index.php?topic=1883.msg19269#msg19269) - 03C924
02 White/Black/Call/Ninja/Spell Item Routines (http://slickproductions.org/forum/index.php?topic=1883.msg19361#msg19361) - 03CC46
03 Spell Subroutines (Above)
04 Peep/Study (http://slickproductions.org/forum/index.php?topic=1883.msg19295#msg19295) - 03E153
05 Enemy Runs Away (http://slickproductions.org/forum/index.php?topic=1883.msg19420#msg19420) - 03E1B2
06 Steal (http://slickproductions.org/forum/index.php?topic=1883.msg19296#msg19296)- 03E1CC
07 Salve/Medicine (http://slickproductions.org/forum/index.php?topic=1883.msg19331#msg19331) - 03E2DC
08 Throw/Dart (http://slickproductions.org/forum/index.php?topic=1883.msg19271#msg19271) - 03E34C
09 Change/Row (http://slickproductions.org/forum/index.php?topic=1883.msg19275#msg19275) - 03E3D1
0A  Regen (http://slickproductions.org/forum/index.php?topic=308.msg19155#msg19155) - 03E3FA
0B Twin (http://slickproductions.org/forum/index.php?topic=1883.msg19156#msg19156) - 03E46F
0C Cover (http://slickproductions.org/forum/index.php?topic=1883.msg19347#msg19347) - 03E60F
0D Off (http://slickproductions.org/forum/index.php?topic=1883.msg19347#msg19347) - 03E653
0E Gird/Endure (http://slickproductions.org/forum/index.php?topic=1883.msg19349#msg19349) - 03E696
0F Kick (http://slickproductions.org/forum/index.php?topic=1883.msg19349#msg19349) - 03E6B4
10 Focus/Boost (http://slickproductions.org/forum/index.php?topic=1883.msg19350#msg19350) - 03EF70
11 Aim (http://slickproductions.org/forum/index.php?topic=1883.msg19351#msg19351) - 03E836
12 Pray (http://slickproductions.org/forum/index.php?topic=1883.msg19353#msg19353) - 03E852
13 Hide (http://slickproductions.org/forum/index.php?topic=1883.msg19353#msg19353) - 03E876
14 Show (http://slickproductions.org/forum/index.php?topic=1883.msg19353#msg19353) - 03E8BB
15 Sing (http://slickproductions.org/forum/index.php?topic=1883.msg19354#msg19354) - 03E900
16 Jump (http://slickproductions.org/forum/index.php?topic=1883.msg19355#msg19355) - 03E954
17 Parry (http://slickproductions.org/forum/index.php?topic=1883.msg19356#msg19356) - 03E9DE
18 Dark Wave (http://slickproductions.org/forum/index.php?topic=1883.msg19356#msg19356) - 03E9E9
19 Recall (http://slickproductions.org/forum/index.php?topic=1883.msg19358#msg19358) - 03EA1A
1A Bluff/Boast (http://slickproductions.org/forum/index.php?topic=1883.msg19359#msg19359) - 03EAC3
1B Cry (http://slickproductions.org/forum/index.php?topic=1883.msg19359#msg19359) - 03EAE6
1C Part of Steal Subroutine (http://slickproductions.org/forum/index.php?topic=1883.msg19296#msg19296) - 03EB29
1D Item (http://slickproductions.org/forum/index.php?topic=1883.msg19359#msg19359) - 03EB9D


Specialty Routine Offsets

Damage Determination (http://slickproductions.org/forum/index.php?topic=1883.msg19260#msg19260) - 03C9AF
Grimoire Item (http://slickproductions.org/forum/index.php?topic=1883.msg19359#msg19359) - 03EC0D
Out of Battle White Magic (http://slickproductions.org/forum/index.php?topic=1851.msg19538#msg19538) - 01B753
Full Disassembly on the Poison Status (http://slickproductions.org/forum/index.php?topic=1883.msg21824#msg21824) - 039E45/03A8FD
Full Disassembly on All Status Timers (http://slickproductions.org/forum/index.php?topic=1883.msg21831#msg21831)

Event Instruction Offsets
00 Load Some Type of Graphic FC (Actually Nothing) - 000000
01 Repeat XX Times the Following YY Actions EB - 000000(blank because this is looked at in respect to the Movement Patterns)
02 Play Visual Effect FD - 00C17C
03 Show Message from Bank 02 (Event Call) EE - 00E339
04 Open Namingway Screen D9 - 00E344
05 Open Fat Chocobo Screen D4 - 00E351
06 Bring Up Shop XX ED - 00E35E
07 Fade Song XX in EA - 00E379
08 Toggle Music Fade D8 - 00E38B
09 Fight Battle with Enemy Set XX EC - 00E391
0A Toggle Running D7 - 00E54B
0B Play Song XX FA - 00E559
0C Play Sound Effect XX FB - 00E56F
0D Add XX Character to Party E7 - 00E578
0E Remove XX Character from Party E8 - 00E6AF
0F Toggle Screen Tint XX F9 - 00E731
10 Toggle Screen Fade DA - 00E7C4
11 Put in Spell List XX' SpellBook, Spell YY E2 - 00E7D8
12 Restore HP (10 * XX HP) DE - 00E7FF
13 Restore MP (10 * XX MP) DF - 00E85F
14 Add Item XX to Inventory E0 - 00E8BF
15 Remove Item XX from Inventory E1 - 00E8CB
16 Toggle Status Ailments XX DB - 00E90A
17 Remove All Status Ailments but XX E3 - 00E929
18 Add Status Ailments XX E4 - 00E948
19 Add 100 * XX GP to Party E5 - 00E967
1A Subtract 100 * XX GP to Party E6 - 00E97E
1B Change Character Graphic to XX DD - 00E9B6
1C Inn DC - 00E9E6
1D End Event FF - 00EA20
1E Pause XX Cycles E9 - 00EAB5
1F Show Message 1XX (Yes/No Box) F8 - 00EAE9
20 Bring up Item Selection Window F7 - 00EB0E
21 Screen moves up 1 tile and down 1 tile D6 - 00EB65
22 Toggle Screen Shake D0 - 00EB94
23 Screen Flash D1 - 00EB9D
24 Screen blur and unblur D2 - 00EBD4
25 Travel to/from Moon D3 - 00EBEF
26 Open a Door D5 - 00EC17
27 Load Map FE - 00EDB1
28 Show Message from Bank 02 (Map Call) EF - 00EF28
29 Show Message 0XX from Bank 01. F0 - 00EF4E
2A Show Message 1XX from Bank 01. F1 - 00EF5F
2B Show Message XX (from Bank 3) F6 - 00EF70
2C Set Event Flag XX F2 - 00EF81
2D Clear Event Flag XX F3 - 00EF8A
2E Activate NPC XX F4 - 00EF93
2F Deactivate NPC XX F5 - 00EF9C

Visual Effect Offsets





Bug Fixes

Enemy Evasion Fix (http://slickproductions.org/forum/index.php?topic=1884.0)
Enemy Magic Evasion Fix (http://slickproductions.org/forum/index.php?topic=1884.msg19133#msg19133)
Infinite Arrow Fix (http://slickproductions.org/forum/index.php?topic=1887.0)
99% Evasion through Immune Byte Fix (http://slickproductions.org/forum/index.php?topic=1891.msg19377#msg19377)
Lingering x4 Weakness through Immune Byte Fix (http://slickproductions.org/forum/index.php?topic=1891.msg19388#msg19388)


Custom Routine Offsets (& Replacements)
Commands
Fight(Broken Calcify Weapon Routine) to Fight(Imbued Weapons) (http://slickproductions.org/forum/index.php?topic=1883.msg20031#msg20031)
Peep to Seek (http://slickproductions.org/forum/index.php?topic=363.msg19056#msg19056)
Peep to Geomancy (http://slickproductions.org/forum/index.php?topic=1883.msg20063#msg20063)
Cry to FFIV:CC Cry (http://slickproductions.org/forum/index.php?topic=344.msg19082#msg19082)
Cry to Coat Hammer (http://slickproductions.org/forum/index.php?topic=1883.msg20309#msg20309)
Steal to Mug (http://slickproductions.org/forum/index.php?topic=1883.msg19419#msg19419)
Salve to Item Master (http://slickproductions.org/forum/index.php?topic=1883.msg19400#msg19400)
Dart to Draw Out(Katana Soul)l (http://slickproductions.org/forum/index.php?topic=1883.msg20022#msg20022)
Twin to W.Meteo/Third Random Spell Twin (http://slickproductions.org/forum/index.php?topic=1883.msg19161#msg19161)
Twin to Targeting Dependent Spell Used Twin (http://slickproductions.org/forum/index.php?topic=1883.msg19171#msg19171)
Aim to Snipe (http://slickproductions.org/forum/index.php?topic=1883.msg19351#msg19351)
Aim to Barrage (http://slickproductions.org/forum/index.php?topic=1883.msg19351#msg19351)
Aim to Arrowstorm (http://slickproductions.org/forum/index.php?topic=1883.msg19351#msg19351)
Pray to Hunt (http://slickproductions.org/forum/index.php?topic=1883.msg19985#msg19985)
(Empty Space) to Hunt Rewards System (http://slickproductions.org/forum/index.php?topic=1883.msg19995#msg19995)
(Empty Space) to Hunt Rewards System + (http://slickproductions.org/forum/index.php?topic=1883.msg20487#msg20487)
Hide to Advnc (Advance) (http://slickproductions.org/forum/index.php?topic=1883.msg19899#msg19899)
Dark Wave to Dark Wave - Zombie Death (http://slickproductions.org/forum/index.php?topic=1883.msg19356#msg19356)
Dark Wave to FFIV:DS Darkness (http://slickproductions.org/forum/index.php?topic=1883.msg19356#msg19356)
Dark Wave to Dark Wave + Spell Cast (http://slickproductions.org/forum/index.php?topic=1883.msg19356#msg19356)
Item to Not 100% Item Accuracy (http://slickproductions.org/forum/index.php?topic=1883.msg19363#msg19363)
Sing to Harp-Dependent Sing (http://slickproductions.org/forum/index.php?topic=1883.msg20144#msg20144)
(Empty Space) to Magic Weapons (http://slickproductions.org/forum/index.php?topic=1883.msg20141#msg20141)
Recall to Dragon Speak (http://slickproductions.org/forum/index.php?topic=1883.msg20279#msg20279)
Regen to Will Based Regen (http://slickproductions.org/forum/index.php?topic=1883.msg20291#msg20291)
Kick to No Armor-Improved Kick. (http://slickproductions.org/forum/index.php?topic=1883.msg20311#msg20311)
Gird to FFI Based Armor-Gird (http://slickproductions.org/forum/index.php?topic=1883.msg20317#msg20317)
Boast to Elemental Weapon (http://slickproductions.org/forum/index.php?topic=1883.msg20319#msg20319)
(Empty Space) to Seek Remastered (http://slickproductions.org/forum/index.php?topic=1883.msg20488#msg20488)

Spells

Healing Spells to Alchemy-Cure (http://slickproductions.org/forum/index.php?topic=1883.msg20289#msg20289)
Damaging Spells to Item Lore-Damage (http://slickproductions.org/forum/index.php?topic=1883.msg20289#msg20289)
Weak to LOCK (http://slickproductions.org/forum/index.php?topic=1883.msg19428#msg19428)
Shell to SLO1 (http://slickproductions.org/forum/index.php?topic=1883.msg19428#msg19428)
Modify Speed to TMPR (http://slickproductions.org/forum/index.php?topic=1883.msg19428#msg19428)
Hug to FAST (http://slickproductions.org/forum/index.php?topic=1883.msg19428#msg19428)
Reaction to SLO2 (http://slickproductions.org/forum/index.php?topic=1883.msg19428#msg19428)
Dispel to SABR (http://slickproductions.org/forum/index.php?topic=1883.msg19428#msg19428)
Chillyfeez's Dispel to Aura (http://slickproductions.org/forum/index.php?topic=1883.msg19851#msg19851)
Count to HARM (http://slickproductions.org/forum/index.php?topic=1883.msg19428#msg19428)
Counte to Elemental Strike/Fancy Flourish (http://slickproductions.org/forum/index.php?topic=1883.msg20261#msg20261)
Blink to RUSE (http://slickproductions.org/forum/index.php?topic=1883.msg19428#msg19428)
Odin to AFIR,AICE,ALIT,ARUB, WALL, FEAR (http://slickproductions.org/forum/index.php?topic=1883.msg19428#msg19428)
Protect to Spell Power Dependent Protect (http://slickproductions.org/forum/index.php?topic=1883.msg19428#msg19428)
Blast to Magic Sword (http://slickproductions.org/forum/index.php?topic=1883.msg19946#msg19946)
Damage, Sap to Piercing Sight (http://slickproductions.org/forum/index.php?topic=1883.msg20042#msg20042)
Search to Taunt (http://slickproductions.org/forum/index.php?topic=1883.msg20048#msg20048)
Sylph to Battle Skill (http://slickproductions.org/forum/index.php?topic=1883.msg20057#msg20057)
Damage, Status (Unused) to Regen (Command) (http://slickproductions.org/forum/index.php?topic=1883.msg20291#msg20291)

Specialty
Auto-Hide to XX Armor = Dark Wave replacing Cover (http://slickproductions.org/forum/index.php?topic=1883.msg20482#msg20482)
Redundant Start of Game Code to Storing Commands in RAM! (http://slickproductions.org/forum/index.php?topic=1883.msg20483#msg20483)


Patches

Imbued Weapons (http://slickproductions.org/forum/index.php?topic=1883.msg20031#msg20031)
Katana Soul (http://slickproductions.org/forum/index.php?topic=1883.msg20051#msg20051)
Battle Skills (http://slickproductions.org/forum/index.php?topic=1883.msg20057#msg20057)
Geomancy (http://slickproductions.org/forum/index.php?topic=1883.msg20063#msg20063)
FF III Style Sing (http://slickproductions.org/forum/index.php?topic=1883.msg20144#msg20144)
FFV Style Magic Weapons (http://slickproductions.org/forum/index.php?topic=1883.msg20141#msg20141)
Combo Patch of the above 6 Patches (http://slickproductions.org/forum/index.php?topic=1883.msg20381#msg20381)

Miscellaneous

Amount of Free Space contained within Banks (http://slickproductions.org/forum/index.php?topic=1883.msg20427#msg20427)
Audiovisual Code Breakdown (http://slickproductions.org/forum/index.php?topic=1883.msg20042#msg20042)
Outside of Battle Treasure Acquiring (http://slickproductions.org/forum/index.php?topic=1883.msg19280#msg19280)
Chance to Drop Money while running and Stat Replacement (http://slickproductions.org/forum/index.php?topic=1883.msg19426#msg19426)
Auto-Hide Notes 1 (http://slickproductions.org/forum/index.php?topic=1883.msg19459#msg19459)
Auto-Hide Notes 2 (http://slickproductions.org/forum/index.php?topic=1883.msg19462#msg19462)
All Attack Building Formulas (http://slickproductions.org/forum/index.php?topic=1883.msg19474#msg19474)
Auto-Cover Notes (http://slickproductions.org/forum/index.php?topic=1883.msg19835#msg19835)
Fighting Zeromus without Cecil. (http://slickproductions.org/forum/index.php?topic=1883.msg19870#msg19870)
Command Menu Accesses (http://slickproductions.org/forum/index.php?topic=1883.msg19946#msg19946)
Back Attack/Ambush/First Strike Code (http://slickproductions.org/forum/index.php?topic=1883.msg19959#msg19959)
Level Up Code and Notes (http://slickproductions.org/forum/index.php?topic=1883.msg19497#msg19497)
Shadow Slot Procedure (http://slickproductions.org/forum/index.php?topic=1883.msg20436#msg20436)
Big Chocobo Coding (some) (http://slickproductions.org/forum/index.php?topic=1883.msg20436#msg20436)
Damage Tiles (http://slickproductions.org/forum/index.php?topic=1883.msg20436#msg20436)
Disabling Level+Shield Defense Multipliers (http://slickproductions.org/forum/index.php?topic=1883.msg20978#msg20978)
Enabling all items to be checked and decremented in the Item Use Event (http://slickproductions.org/forum/index.php?topic=1883.msg21175#msg21175)
Enabling Critical Hits for Foes (http://slickproductions.org/forum/index.php?topic=1883.msg21821#msg21821)
Stat Changing AI Routines (http://slickproductions.org/forum/index.php?topic=1883.msg22190#msg22190)
Bow/Arrow Index Routines 1 (http://slickproductions.org/forum/index.php?topic=1754.msg18127#msg18127)
Bow/Arrow Index Routines 2 (http://slickproductions.org/forum/index.php?topic=1713.msg22275#msg22275)
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Deathlike2 on September 09, 2013, 05:17:28 PM
Defend increases both evasion and defense?

I'm not entirely sure of that (I point to Tellah and FuSoYa for being wrecked so often).

Also, "resetting E4 and E3" reference is probably the simple act of "clearing" the accumulator (aka reset everything to 0).

 :edit:
I'm pretty sure being in the back row is more likely to increase evasion and/or defense.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Grimoire LD on September 09, 2013, 06:32:05 PM
I should have been clearer... Defense doesn't literally mean the Defend command (never found it yet) but the results of being attacked and how the Target's stats will respond, hence why I used the term "attack" probably not exactly the best way to put it though. Any ideas on a better name for it?
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Deathlike2 on September 09, 2013, 07:13:33 PM
I don't know at the moment.

When I use the term "Defend", it's more related to the status (the command itself invokes the status).
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Grimoire LD on September 09, 2013, 07:49:42 PM
Indeed, the stuff at the end is just related to defensive measures and calculations. Hence, Back row dealings, Cursed Dealing, Toad/Mini Dealings, etc. (though I have yet to find back row attacks and then I would need to find Long-Range weapon bit in the character data which I don't believe had been found before. However that was put together before I knew that Elemental Defenses would be present in an earlier portion of the routine.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Grimoire LD on September 10, 2013, 04:07:54 PM
Update now includes... Row Functionality - Long Range Check - Function of Blink - Jumping/Charging - Darkness - Toad/Mini - Evasion - Normal Attacks - Elemental/Very Weak/Immune Elemental Attacks - Creature Type Attack/Resistances - Berserk - Curse - Defend - Critical Hit Bonus Damage (may be directly related to Drain Elemental) Drain Elemental - Zombie Reverse Drain Elemental - The means to nerf or improve much of anything is now within our hands.  Did you ever think Berserk was too strong and now find out Charging slices your Magical Defense AND Physical Defense makes Focus too weak? Why not add a bit of challenge and strategy by making Berserk inherit those faults (thereby making it a plausible attack to use on an enemy to lower their Defenses). Is your mod a Solo Mod and therefore would logically not use Rows? The checks to disable for that are all clearly there. Do you want to nerf the damage Race Weakness does? The means to do so are above, or how about make Drain Weaponry not so powerful that they require massive stat decreases? Did the idea of Race Resistant armor ever strike you as strange and unnecessary? You can change those into Race Weaknesses so say that you have a powerful shield, but it is weak to Giant type enemies. It could add a bit more strategy to your equipment set up. The last thing notable thing (that I can think of...) we are missing now is the Status Infliction routine. All the means to do as you will are listed in the basic Attack/Defense Disassembly above. If you have any questions I'll try my best to answer them.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Dragonsbrethren on September 10, 2013, 05:23:04 PM
So cool that all of this has been found now.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Grimoire LD on September 10, 2013, 08:07:55 PM
Indeed DragonsBrethren, I can only hope that it will be put to use. This has been the labor of my time the last couple of days before school really begins to pummel me.

Unfortunately when I wrote the disassembly of that last large chunk of code I lost a fair amount of my former post (seemed to be swallowed up by the new addition to the post) It seems there are space limits on posts and much of what I wrote  that could be done with that information was lost, well no matter. I'll try to be more comprehensive here.

Here is what has been found (I don't think there's much else left to find in the normal attack/defense routines...)

 What has been found thus far in the range of normal attacking..
Row Functionality -
Function of Blink -
Jumping/Charging -
Darkness -
Toad/Mini -
Evasion -
Normal Attacks -
Elemental/Very Weak/Immune Elemental Attacks -
Creature Type Attack/Resistances -
Berserk -
Curse -
Front Row/Back Row (while being attacked) -
Defend -
Critical Hit Bonus Damage (may be directly related to Drain Elemental)
Drain Elemental -
Zombie Reverse Drain Elemental -
Status Inflictions -
And that should be it.

Now a note about weapon status inflictions... Status infliction works in a strange and frankly, incomplete manner. If it is intended to be the way it is it is heavily sided with the player over monsters. This is how it works...

$03/C842   AD 9C 26   LDA $269C  [$7E:269C]   A:0000   X:0680   Y:001A   P:envMxdiZC - Load Target's Physical Attack Percentage.
$03/C845   ED 29 27   SBC $2729  [$7E:2729]   A:004D   X:0680   Y:001A   P:envMxdizC - Subtract A by Target's Physical Evasion.

Then it is run through an RNG where it will spit out a number and if it falls in the success zone it will inflict the status (after a Lot of other checks...)

Now I checked the monster stats, they supposedly should have an Evade byte, location 29 Bytes into their stats, but they don't. The game never loads any monster's given Evasion, thereby this check is only really done when the player would be hit by an attack status. Here is where the problem lies... A weapon with 99% Accuracy will Always inflict its status if, the enemy is susceptible to it. This may go a way to explain why most of the Status Weapons have questionable accuracy. It seems like such a waste and in many ways it could unbalance the game. So here is my suggested fix....

$03/C842   AD 9C 26   LDA $269C  [$7E:269C]   A:0000   X:0680   Y:001A   P:envMxdiZC - Load Target's Physical Attack Percentage.
$03/C845   ED 2F 27   SBC $272F  [$7E:272F]   A:004D   X:0680   Y:001A   P:envMxdizC - Subtract A by Target's Run Strength.

Enemies and Allies both have Run Strengths (though you could also attach it to level if you'd like since Run Strength is always a fair bit higher), Allies however never increase their Run Strength, I don't believe and but they all have at least a 0A (Except Paladin Cecil, his is curiously 01) and this in essence would give some marginal amount of worth to Porom's Cry command as it would increase the likelihood of getting through an enemy's chance to block the status.

Jump is a grossly overpowered command and now that I have all of the data in front of me, trumps Focus in every single way. Let us see all that Jump helps and Focus hurts...

$03/C525   AD 81 26   LDA $2681  [$7E:2681]   A:0080   X:0000   Y:0000   P:eNvMxdizc - Load Caster's Class and Row
$03/C528   29 20   AND #$20   A:0080   X:0000   Y:0000   P:eNvMxdizc - Is it Long Ranged?
$03/C52A   D0 0A   BNE $0A    [$C536]   A:0000   X:0000   Y:0000   P:envMxdiZc - Long Range Check - If successful branch to 03C536
$03/C52C   AD 85 26   LDA $2685  [$7E:2685]   A:0000   X:0000   Y:0000   P:envMxdiZc - Load Status Byte 3.
$03/C52F   29 02   AND #$02   A:0000   X:0000   Y:0000   P:envMxdiZc - Is it Jump?
$03/C531   D0 03   BNE $03    [$C536]   A:0000   X:0000   Y:0000   P:envMxdiZc - If so branch to 03C536
$03/C533   4E F8 38   LSR $38F8  [$7E:38F8]   A:0000   X:0000   Y:0000   P:envMxdiZc - Divide Accuracy by 2.

It passes by one Row check...

$03/C55A   AD 81 26   LDA $2681  [$7E:2681]   A:0080   X:0000   Y:0003   P:eNvMxdizc - Load Caster's class/row/Long Range
$03/C55D   29 20   AND #$20   A:0080   X:0000   Y:0003   P:eNvMxdizc  - Is it Long Range?
$03/C55F   D0 0A   BNE $0A    [$C56B]   A:0000   X:0000   Y:0003   P:envMxdiZc - If so branch to 03C56B.
$03/C561   AD 85 26   LDA $2685  [$7E:2685]   A:0000   X:0000   Y:0003   P:envMxdiZc - Load Caster's Status Byte 3.
$03/C564   29 02   AND #$02   A:0000   X:0000   Y:0003   P:envMxdiZc - Is it Jump?
$03/C566   D0 03   BNE $03    [$C56B]   A:0000   X:0000   Y:0003   P:envMxdiZc - If so branch to 03C56B.
$03/C568   4E F8 38   LSR $38F8  [$7E:38F8]   A:0000   X:0000   Y:0003   P:envMxdiZc - Divide Accuracy by 2.

Passes by another Row Check (Target in Back Row I believe).

$03/C6E7   AD 85 26   LDA $2685  [$7E:2685]   A:0000   X:0028   Y:0000   P:envMxdiZC - Load Status Anomalies (Byte 3) from Caster's Data Copy into A.
$03/C6EA   29 0A   AND #$0A   A:0008   X:0028   Y:0000   P:envMxdizC - Is it Jumping or Charging?
$03/C6EC   F0 06   BEQ $06    [$C6F4]   A:0008   X:0028   Y:0000   P:envMxdizC - If not jump to 03C6F4
--------------------------------------------------------------------------------------------------------------------------------
$03/C6EE   0E 02 39   ASL $3902  [$7E:3902]   A:0008   X:0028   Y:0000   P:envMxdizC - Shift the value in 3902 (Attack Base) and make it x2
$03/C6F1   2E 03 39   ROL $3903  [$7E:3903]   A:0008   X:0028   Y:0000   P:envMxdizc -  Do the same here?

Double the Damage.

Whereas this is what Charging does...

$03/C6EA   29 0A   AND #$0A   A:0008   X:0028   Y:0000   P:envMxdizC - Is it Jumping or Charging? (How it gleans this from 0A, I'm unsure. 08+02 does equal 0A though)
$03/C6EC   F0 06   BEQ $06    [$C6F4]   A:0008   X:0028   Y:0000   P:envMxdizC - If not jump to 03C6F4
--------------------------------------------------------------------------------------------------------------------------------
$03/C6EE   0E 02 39   ASL $3902  [$7E:3902]   A:0008   X:0028   Y:0000   P:envMxdizC - Shift the value in 3902 (Attack Base) and make it x2
$03/C6F1   2E 03 39   ROL $3903  [$7E:3903]   A:0008   X:0028   Y:0000   P:envMxdizc -  Do the same here?

Double Damage.

$03/C740   AD 05 27   LDA $2705  [$7E:2705]   A:0000   X:0000   Y:0000   P:envMxdiZC - Load Status Byte 3 from Target's Data.
$03/C743   29 08   AND #$08   A:0010   X:0000   Y:0000   P:envMxdizc - Is the Target Charging?
$03/C745   F0 06   BEQ $06    [$C74D]   A:0000   X:0000   Y:0000   P:envMxdiZc - If not branch to 03C74D
------------------------------------------------------------------------------------------------------------------------------------
$03/C747   4E 05 39   LSR $3905  [$7E:3905]   A:0008   X:0000   Y:0000   P:envMxdizC - Divide Physical Defense by 2
$03/C74A   6E 04 39   ROR $3904  [$7E:3904]   A:0008   X:0000   Y:0000   P:envMxdiZc - Divide 3904 by 2. (Possibly Magic Defense)

Yes, Focus gets both defenses cut in half. We could easily change that to something more reasonable. I had always thought Berserk was a fairly overpowered status so why not attach this detriment to that and to do so is quite simple.

$03/C740   AD 05 27   LDA $2704  [$7E:2704]   A:0000   X:0000   Y:0000   P:envMxdiZC - Load Status Byte 2 from Target's Data.
$03/C743   29 08   AND #$04   A:0010   X:0000   Y:0000   P:envMxdizc - Is the Target Berserk?
$03/C745   F0 06   BEQ $06    [$C74D]   A:0000   X:0000   Y:0000   P:envMxdiZc - If not branch to 03C74D
------------------------------------------------------------------------------------------------------------------------------------
$03/C747   4E 05 39   LSR $3905  [$7E:3905]   A:0008   X:0000   Y:0000   P:envMxdizC - Divide Physical Defense by 2
$03/C74A   6E 04 39   ROR $3904  [$7E:3904]   A:0008   X:0000   Y:0000   P:envMxdiZc - Divide 3904 by 2. (Possibly Magic Defense)


I'll get to more uses later, but for now feel free to post any ideas you would like to see with the available information.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Deathlike2 on September 10, 2013, 08:24:05 PM
Now a note about weapon status inflictions... Status infliction works in a strange and frankly, incomplete manner. If it is intended to be the way it is it is heavily sided with the player over monsters. This is how it works...

$03/C842   AD 9C 26   LDA $269C  [$7E:269C]   A:0000   X:0680   Y:001A   P:envMxdiZC - Load Target's Physical Attack Percentage.
$03/C845   ED 29 27   SBC $2729  [$7E:2729]   A:004D   X:0680   Y:001A   P:envMxdizC - Subtract A by Target's Physical Evasion.

Then it is run through an RNG where it will spit out a number and if it falls in the success zone it will inflict the status (after a Lot of other checks...)

Now I checked the monster stats, they supposedly should have an Evade byte, location 29 Bytes into their stats, but they don't. The game never loads any monster's given Evasion, thereby this check is only really done when the player would be hit by an attack status. Here is where the problem lies... A weapon with 99% Accuracy will Always inflict its status if, the enemy is susceptible to it. This may go a way to explain why most of the Status Weapons have questionable accuracy. It seems like such a waste and in many ways it could unbalance the game. So here is my suggested fix....

It's just hit rate/accuracy vs evasion for applied status effects? That would explain a few things. My initial thought had to do with Agility or level, but considering that the Whip has a low accuracy factor and low accuracy status weapons are around (Fairy Claw, Ancient Sword, Slumber Sword), that would "screw with the numbers".

Of course, it still comes back to how evasion is everything...

With respect to monster stats, the game is probably NOT reading the evade byte... intentionally or unintentionally. It is consistent in their evasion being 0... but I don't think that is actually intentional.

For instance, Barbariccia and Cagnazzo have evasion modifiers applied with their stat changing code, so it's THERE.

It would also "imply" that you're supposed to "never hurt" any Flan type monster physically and damage variation would kinda exist (it wouldn't make the game that much harder, but the monsters would take less damage across the board).

The only monster that happens to be a special case is Zemus's Mind. It is the only non-Flan monster with 254 defense that would have benefited from the evasion stat.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Grimoire LD on September 10, 2013, 08:56:26 PM
Wow... Are you serious? Well, fine work Square, truly Fine Work! Oy, you fools...

$03/90CE   AD 1C 29   LDA $291C  [$7E:291C]   A:0002   X:0280   Y:0083   P:envMxdIzC
$03/90D1   9D 28 20   STA $2028,x[$7E:22A8]   A:0001   X:0280   Y:0083   P:envMxdIzC
$03/90D4   AD 1D 29   LDA $291D  [$7E:291D]   A:0001   X:0280   Y:0083   P:envMxdIzC
$03/90D7   9D 2A 20   STA $202A,x[$7E:22AA]   A:0046   X:0280   Y:0083   P:envMxdIzC
$03/90DA   AD 1E 29   LDA $291E  [$7E:291E]   A:0046   X:0280   Y:0083   P:envMxdIzC
$03/90DD   9D 2A 20   STA $202A,x[$7E:22AA]   A:0002   X:0280   Y:0083   P:envMxdIzC


Do you see the Problem?

Having heard from you that Evasion is Supposed to work for monsters but doesn't I decided to do a quick look. Set a breakpoint on the evasion byte, waltzed into battle and... other than a clear, nothing happened. So I thought, "Let me see how the rest of the stats get added in..." I changed the breakpoint to one byte over (2A) and what awaited me?

$03/90D7   9D 2A 20   STA $202A,x[$7E:22AA]   A:0046   X:0280   Y:0083   P:envMxdIzC

The given Evasion of my test Zombie in A. So I set my breakpoint to execute at the start of the line (3090D0) and that's what I was greeted with....

Square Literally Accidentally Wrote Their Evasion To The Physical Defense Base Instead Of Evasion!

That is some Special kind of incompetency there...

So... to fix this... you change this...

$03/90D7   9D 2A 20   STA $202A,x[$7E:22AA]   A:0046   X:0280   Y:0083   P:envMxdIzC
$03/90DA   AD 1E 29   LDA $291E  [$7E:291E]   A:0046   X:0280   Y:0083   P:envMxdIzC
$03/90DD   9D 2A 20   STA $202A,x[$7E:22AA]   A:0002   X:0280   Y:0083   P:envMxdIzC

To this...

$03/90D7   9D 29 20   STA $2029,x[$7E:22AA]   A:0046   X:0280   Y:0083   P:envMxdIzC
$03/90DA   AD 1E 29   LDA $291E  [$7E:291E]   A:0046   X:0280   Y:0083   P:envMxdIzC
$03/90DD   9D 2A 20   STA $202A,x[$7E:22AA]   A:0002   X:0280   Y:0083   P:envMxdIzC

One Byte! Happy Square? I fixed your game yet again...

(Sorry about my tone, this just incenses me greatly for some reason.)
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Grimoire LD on September 11, 2013, 02:34:46 AM
Holy Routine
Code: [Select]
$03/D3C2 20 FD E0 JSR $E0FD  [$03:E0FD] A:0003 X:0002 Y:0000 P:envMxdizc - Jump to Elemental Subroutine.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/E0FD AD 26 27 LDA $2726  [$7E:2726] A:0003 X:0002 Y:0000 P:envMxdizc - Load Target's Elemental Immunity Defense into A.
$03/E100 2D A2 28 AND $28A2  [$7E:28A2] A:0000 X:0002 Y:0000 P:envMxdiZc - Test it against stored Elemental Attack.
$03/E103 F0 11 BEQ $11    [$E116] A:0000 X:0002 Y:0000 P:envMxdiZc - If it is not the same, branch to 03E116
------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E105 7B TDC A:0010 X:0002 Y:0000 P:envMxdizc - ?Transfer Direct Page to Accumulator?
$03/E106 8D FE 38 STA $38FE  [$7E:38FE] A:0000 X:0002 Y:0000 P:envMxdiZc - Store A in Attack Altering Field.
$03/E109 AD 26 27 LDA $2726  [$7E:2726] A:0000 X:0002 Y:0000 P:envMxdiZc - Load Target's Elemental Immunity Defense into A.
$03/E10C 29 40 AND #$40 A:00D0 X:0002 Y:0000 P:eNvMxdizc - Is it Drain?
$03/E10E F0 1F BEQ $1F    [$E12F] A:0040 X:0002 Y:0000 P:envMxdizc - If not, branch to 03E12F.
-----------------------------------------------------------------------------------------------------------------------------------------------
$03/E110 A9 84 LDA #$84 A:0040 X:0002 Y:0000 P:envMxdizc - Load 84 into A. (Activating Heal Flag and dealing x2 damage)
$03/E112 8D FE 38 STA $38FE  [$7E:38FE] A:0084 X:0002 Y:0000 P:eNvMxdizc - Store A in Attack Altering Field (x2 Damage)
$03/E115 60 RTS A:0084 X:0002 Y:0000 P:eNvMxdizc - Return
-------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E116 AD 25 27 LDA $2725  [$7E:2725] A:0000 X:0002 Y:0000 P:envMxdiZc  - Load Target's Elemental Defense into A.
$03/E119 2D A2 28 AND $28A2  [$7E:28A2] A:0008 X:0002 Y:0000 P:envMxdizc - Test it against stored Elemental Attack.
$03/E11C F0 11 BEQ $11    [$E12F] A:0000 X:0002 Y:0000 P:envMxdiZc - If it is not the same, branch to 03E12F.
----------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E11E A9 01 LDA #$01 A:0010 X:0002 Y:0000 P:envMxdizc - Load 01 into A.
$03/E120 8D FE 38 STA $38FE  [$7E:38FE] A:0001 X:0002 Y:0000 P:envMxdizc - Store A in Damage Altering Field (x1/2 Power)
$03/E123 AD 25 27 LDA $2725  [$7E:2725] A:0001 X:0002 Y:0000 P:envMxdizc - Load Target's Elemental Defense into A.
$03/E126 29 40 AND #$40 A:0010 X:0002 Y:0000 P:envMxdizc - Is it Drain?
$03/E128 F0 05 BEQ $05    [$E12F] A:0000 X:0002 Y:0000 P:envMxdiZc - If not, branch to 03E12F.
----------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E12A A9 82 LDA #$82 A:0040 X:0002 Y:0000 P:envMxdizc - Load 82 into A (Thereby activating the Heal Flag and dealing normal damage)
$03/E12C 8D FE 38 STA $38FE  [$7E:38FE] A:0082 X:0002 Y:0000 P:eNvMxdizc - Store A in Damage Altering Field (x1 Power)
-----------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E12F 60 RTS A:0000 X:0002 Y:0000 P:envMxdiZc - Return
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/D3C5 AD FE 38 LDA $38FE  [$7E:38FE] A:0000 X:0002 Y:0000 P:envMxdiZc - Load A from 7E38FE
$03/D3C8 10 08 BPL $08    [$D3D2] A:0002 X:0002 Y:0000 P:envMxdizc - Branch if Plus (If Heal Tag is included it will become minus.) to 03D3D2.
----------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/D3CA 29 7F AND #$7F A:0084 X:0002 Y:0000 P:eNvMxdizc - ??
$03/D3CC 8D FE 38 STA $38FE  [$7E:38FE] A:0004 X:0002 Y:0000 P:envMxdizc - Store A in Damage Altering Field.
$03/D3CF 4C 1C D4 JMP $D41C  [$03:D41C] A:0004 X:0002 Y:0000 P:envMxdizc - Jump to Subroutine 03D41C.
------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/D3D2 20 30 E1 JSR $E130  [$03:E130] A:0002 X:0002 Y:0000 P:envMxdizc - Jump to Subroutine 03E130 (Weakness Subroutine).
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/E130 AD FE 38 LDA $38FE  [$7E:38FE] A:0002 X:0002 Y:0000 P:envMxdizc - Load A into Damage Altering Field.
$03/E133 C9 02 CMP #$02 A:0002 X:0002 Y:0000 P:envMxdizc - Is it Normal Damage?
$03/E135 D0 1B BNE $1B    [$E152] A:0002 X:0002 Y:0000 P:envMxdiZC - If it is not then branch to 03E152.
----------------------------------------------------------------------------------------------------------------------------------------------------
$03/E137 AD 21 27 LDA $2721  [$7E:2721] A:0002 X:0002 Y:0000 P:envMxdiZC - Load Target's Very Weak Element.
$03/E13A 2D A2 28 AND $28A2  [$7E:28A2] A:0000 X:0002 Y:0000 P:envMxdiZC - Check against the stored Element.
$03/E13D F0 06 BEQ $06    [$E145] A:0000 X:0002 Y:0000 P:envMxdiZC - If not, branch to 03E145
--------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E145 AD 20 27 LDA $2720  [$7E:2720] A:0000 X:0002 Y:0000 P:envMxdiZC - Load Target's Elemental Weakness.
$03/E148 2D A2 28 AND $28A2  [$7E:28A2] A:0010 X:0002 Y:0000 P:envMxdizC - Check against the stored Element.
$03/E14B F0 05 BEQ $05    [$E152] A:0010 X:0002 Y:0000 P:envMxdizC - If not, branch to 03E152.
$03/E14D A9 04 LDA #$04 A:0010 X:0002 Y:0000 P:envMxdizC - Load 04 into A.
$03/E14F 8D FE 38 STA $38FE  [$7E:38FE] A:0004 X:0002 Y:0000 P:envMxdizC - Store 04 in Damage Altering Fields (x2 Damage)
$03/E152 60 RTS A:0004 X:0002 Y:0000 P:envMxdizC
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/D41C AD 40 27 LDA $2740  [$7E:2740] A:0004 X:0002 Y:0000 P:envMxdizc - Load Target's Creature Type.
$03/D41F 29 80 AND #$80 A:0080 X:0002 Y:0000 P:eNvMxdizc - Is it 80? (Zombie)
$03/D421 F0 03 BEQ $03    [$D426] A:0080 X:0002 Y:0000 P:eNvMxdizc - If not, branch to 03D421.
$03/D423 4C BE D3 JMP $D3BE  [$03:D3BE] A:0080 X:0002 Y:0000 P:eNvMxdizc - Jump to Subroutine.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/D3BE 20 AF C9 JSR $C9AF  [$03:C9AF] A:0080 X:0002 Y:0000 P:eNvMxdizc - Jump to Subroutine. (Damage Routine)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/D3C1 60 RTS A:0000 X:002D Y:0000 P:envMxdizc - Return
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/D3D5 20 AF C9 JSR $C9AF  [$03:C9AF] A:0004 X:0002 Y:0000 P:envMxdizC - Jump to Subroutine (Damage Routine)
$03/D3D8 AD 2A 35 LDA $352A  [$7E:352A] A:0000 X:002D Y:0000 P:envMxdizc  - Load 352A into A.
$03/D3DB D0 09 BNE $09    [$D3E6] A:0000 X:002D Y:0000 P:envMxdiZc - ?? (No idea how to pass it)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/D3DD AD D2 26 LDA $26D2  [$7E:26D2] A:0000 X:002D Y:0000 P:envMxdiZc - Load Next Action/Spell taken by Caster.
$03/D3E0 C9 0B CMP #$0B A:000B X:002D Y:0000 P:envMxdizc - Is it Holy/White?
$03/D3E2 D0 10 BNE $10    [$D3F4] A:000B X:002D Y:0000 P:envMxdiZC - If not, branch to 03D3F4
--------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/D3E4 F0 07 BEQ $07    [$D3ED] A:000B X:002D Y:0000 P:envMxdiZC - ?? (No idea how to pass it)
-----------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------
$03/D3ED AD 40 27 LDA $2740  [$7E:2740] A:000B X:002D Y:0000 P:envMxdiZC - Load Target's Type
$03/D3F0 29 80 AND #$80 A:0080 X:002D Y:0000 P:eNvMxdizC - Is it Zombie?
$03/D3F2 F0 27 BEQ $27    [$D41B] A:0080 X:002D Y:0000 P:eNvMxdizC - If not branch to 03D41B.
-----------------------------------------------------------------------------------------------------------------------------------------------
$03/D3F4 AD 06 27 LDA $2706  [$7E:2706] A:0080 X:002D Y:0000 P:eNvMxdizC - Load Target's Status Byte 4 into A.
$03/D3F7 09 40 ORA #$40 A:0040 X:002D Y:0000 P:envMxdizC - Load 40 (HP Leak)into A.
$03/D3F9 8D 06 27 STA $2706  [$7E:2706] A:0040 X:002D Y:0000 P:envMxdizC -  Store HP Leak into Target's Status Byte 4.
$03/D3FC A9 09 LDA #$09 A:0040 X:002D Y:0000 P:envMxdizC - Load 09 into A.
$03/D3FE 85 D6 STA $D6    [$00:00D6] A:0009 X:002D Y:0000 P:envMxdizC - Store A in D6.
$03/D400 A5 CF LDA $CF    [$00:00CF] A:0009 X:002D Y:0000 P:envMxdizC - Load A from CF.
$03/D402 20 36 9E JSR $9E36  [$03:9E36] A:0005 X:002D Y:0000 P:envMxdizC - Jump to Subroutine.
$03/D405 A9 06 LDA #$06 A:0000 X:001E Y:001E P:envMxdizc - Load 06 into A.
$03/D407 20 C8 85 JSR $85C8  [$03:85C8] A:0006 X:001E Y:001E P:envMxdizc - Jump to Subroutine.
$03/D40A A9 40 LDA #$40 A:0000 X:006F Y:001E P:envMxdiZc - Load 40 into A.
$03/D40C 9D 06 2A STA $2A06,x[$7E:2A75] A:0040 X:006F Y:001E P:envMxdizc - Store A in 7E2A06.
$03/D40F A5 CF LDA $CF    [$00:00CF] A:0040 X:006F Y:001E P:envMxdizc - Load xCF into A.
$03/D411 0A ASL A A:0005 X:006F Y:001E P:envMxdizc - Multiply A by 2.
$03/D412 AA TAX A:000A X:006F Y:001E P:envMxdizc - Transfer A to X.
$03/D413 BD EB 29 LDA $29EB,x[$7E:29F5] A:000A X:000A Y:001E P:envMxdizc - Load A from 7E29F5.
$03/D416 09 20 ORA #$20 A:0040 X:000A Y:001E P:envMxdizc - ?Add 20?
$03/D418 9D EB 29 STA $29EB,x[$7E:29F5] A:0060 X:000A Y:001E P:envMxdizc - Store A in 7E29F5.
$03/D41B 60 RTS A:0060 X:000A Y:001E P:envMxdizc - Return

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/D3D2 20 30 E1 JSR $E130  [$03:E130] A:0002 X:0002 Y:0000 P:envMxdizc - Jump to 03E130 (Weakness Subroutine)


And that will be all for tonight. I found what I wanted, that being the absolutely worthless HP Leak (which apparently only effects Zombies which can also be changed, not necessarily enemies weak to Holy...) maybe I can change it to something better. Perhaps Berserk? (combined with my Berserk nerf to make it a viable strategy to lower an opponent's defenses)

To do so...

$03/D3F4   AD 04 27   LDA $2704  [$7E:2704]   A:0080   X:002D   Y:0000   P:eNvMxdizC - Load Target's Status Byte 2 into A.
$03/D3F7   09 04   ORA #$04   A:0040   X:002D   Y:0000   P:envMxdizC - Load 04 (Berserk)into A.
$03/D3F9   8D 04 27   STA $2704  [$7E:2704]   A:0040   X:002D   Y:0000   P:envMxdizC -  Store Berserk into Target's Status Byte 2.


It's very late so I'll get back to this tomorrow.

 :edit:  And done! Looking at the Tower of Babil Doc, and taking v1.1 into account I have completely covered Holy's routine. There is a Lot to change here for versatility. I have no idea what the developers were thinking when they gave this spell HP Leak, (-60 HP over a time at Level 45+, yeah, that'll help!). Nor do I understand why it only effects Zombie type foes. It can easily be changed to another portion to check for. Now what gets me the most is how the game Needs to make sure that it is Holy being cast... which is laughable. It is the only spell in the game to use that formula. Why look to see if it is Holy specifically being cast...?

 Oh, it's not the only spell that uses the formula. Bio, and several monster spells do as well. I'd say switch the rest to Poison if you plan on changing the effect of HP Leak into anything more substantial.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Lenophis on September 11, 2013, 08:18:48 AM
To do so...

$03/D3F4   AD 04 27   LDA $2704  [$7E:2704]   A:0080   X:002D   Y:0000   P:eNvMxdizC - Load Target's Status Byte 2 into A.
$03/D3F7   09 04   ORA #$04   A:0040   X:002D   Y:0000   P:envMxdizC - Load 04 (Berserk)into A.
$03/D3F9   8D 04 27   STA $2704  [$7E:2704]   A:0040   X:002D   Y:0000   P:envMxdizC -  Store Berserk into Target's Status Byte 2.
Try this instead:
Code: [Select]
A9 04 - LDA #$04
0C 04 27 - TSB $2704
Faster and smaller. :wink:

(Sorry about my tone, this just incenses me greatly for some reason.)
Oh man, you should see some of the "questionable" code FF6 offers. It's rather hilarious and stupid.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Grimoire LD on September 11, 2013, 08:41:29 AM
You know... not once had I ever seen FFIV use TSB, I only used the original instructions but (and since this is basically how I'm learning SNES ASM...) you could save a Lot of space by condensing the many, Many uses of LDA, ORA, STA sequentially and compound them down to nearly half of their original length. Good call Lenophis!

 :edit: And the Damage, Sap subroutine has been completed (for the most part).
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Grimoire LD on September 11, 2013, 10:16:20 AM
Life Routine

Code: [Select]
$03/D65B A9 02 LDA #$02 A:0003 X:0014 Y:FFFF P:envMxdizc - Load 02 into A.
$03/D65D 8D E6 38 STA $38E6  [$7E:38E6] A:0002 X:0014 Y:FFFF P:envMxdizc - Store A in 7E38E6.
$03/D660 AD 40 27 LDA $2740  [$7E:2740] A:0002 X:0014 Y:FFFF P:envMxdizc - Load Target's Creature Type
$03/D663 29 80 AND #$80 A:0000 X:0014 Y:FFFF P:envMxdiZc - Is it Zombie? (Wha?)
$03/D665 F0 0B BEQ $0B    [$D672] A:0000 X:0014 Y:FFFF P:envMxdiZc - If not, branch to 7ED672.
---------------------------------------------------------------------------------------------------------------------------------------------
$03/D667 A9 80 LDA #$80 A:0080 X:0014 Y:0000 P:eNvMxdizc - Load 80 into A.
$03/D669 8D A3 28 STA $28A3  [$7E:28A3] A:0080 X:0014 Y:0000 P:eNvMxdizc - Store A in 7E28A3
$03/D66C 9C A4 28 STZ $28A4  [$7E:28A4] A:0080 X:0014 Y:0000 P:eNvMxdizc - Store Zero in 7E28A4
$03/D66F 4C 24 D5 JMP $D524  [$03:D524] A:0080 X:0014 Y:0000 P:eNvMxdizc - Jump to Subroutine. (In the Status Routine)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/D524 AD 03 27 LDA $2703  [$7E:2703] A:0080 X:0014 Y:0000 P:eNvMxdizc - Load Target's Status Byte 1.
$03/D527 85 AC STA $AC    [$00:00AC] A:0000 X:0014 Y:0000 P:envMxdiZc - Store A in AC.
$03/D529 85 A9 STA $A9    [$00:00A9] A:0000 X:0014 Y:0000 P:envMxdiZc - Store A in A9.
$03/D52B AD 04 27 LDA $2704  [$7E:2704] A:0000 X:0014 Y:0000 P:envMxdiZc - Load Target's Status Byte 2.
$03/D52E 85 AA STA $AA    [$00:00AA] A:0000 X:0014 Y:0000 P:envMxdiZc - Store A in AA.
$03/D530 29 BF AND #$BF A:0000 X:0014 Y:0000 P:envMxdiZc - ??
$03/D532 85 AB STA $AB    [$00:00AB] A:0000 X:0014 Y:0000 P:envMxdiZc - Store A in AB
$03/D534 AD A3 28 LDA $28A3  [$7E:28A3] A:0000 X:0014 Y:0000 P:envMxdiZc - Load Stored Creature Type.
$03/D537 85 AE STA $AE    [$00:00AE] A:0080 X:0014 Y:0000 P:eNvMxdizc - Store A in AE
$03/D539 AD A4 28 LDA $28A4  [$7E:28A4] A:0080 X:0014 Y:0000 P:eNvMxdizc - Load Stored ??
$03/D53C 85 AD STA $AD    [$00:00AD] A:0000 X:0014 Y:0000 P:envMxdiZc - Store A in AD.
$03/D53E C2 20 REP #$20 A:0000 X:0014 Y:0000 P:envMxdiZc - Reset Processor Status Bits.
$03/D540 A5 AB LDA $AB    [$00:00AB] A:0000 X:0014 Y:0000 P:envmxdiZc - Load A from AB.
$03/D542 C5 AD CMP $AD    [$00:00AD] A:0000 X:0014 Y:0000 P:envmxdiZc - Do AB and AD match?
$03/D544 90 06 BCC $06    [$D54C] A:0000 X:0014 Y:0000 P:eNvmxdizc - If so branch to 03D54C
---------------------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------------------
$03/D54C 7B TDC A:0000 X:0014 Y:0000 P:eNvmxdizc - Transfer Direct Page to Accumulator
$03/D54D E2 20 SEP #$20 A:0000 X:0014 Y:0000 P:envmxdiZc - Set Flag
$03/D54F AD 2B 27 LDA $272B  [$7E:272B] A:0000 X:0014 Y:0000 P:envMxdiZc - Load Target's Status Immunity 1.
$03/D552 2D A3 28 AND $28A3  [$7E:28A3] A:00B9 X:0014 Y:0000 P:eNvMxdizc - Check it against Stored Creature Type?
$03/D555 D0 06 BNE $06    [$D55D] A:0080 X:0014 Y:0000 P:eNvMxdizc - If not equal, branch to 03D55D
----------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/D557 AD 2C 27 LDA $272C  [$7E:272C] A:0000 X:0014 Y:0000 P:envMxdiZc - Load Target's Status Immunity 2 .
$03/D55A 2D A4 28 AND $28A4  [$7E:28A4] A:0030 X:0014 Y:0000 P:envMxdizc - Check it against ??
---------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/D55D D0 53 BNE $53    [$D5B2] A:0080 X:0014 Y:0000 P:eNvMxdizc - If not equal, branch to 03D5B2
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/D55F AD 03 27 LDA $2703  [$7E:2703] A:0000 X:0014 Y:0000 P:envMxdiZc - Load Target's Status Byte 1
$03/D562 05 AE ORA $AE    [$00:00AE] A:0000 X:0014 Y:0000 P:envMxdiZc - Add (80?) to Status Byte 1.
$03/D564 8D 03 27 STA $2703  [$7E:2703] A:0080 X:0014 Y:0000 P:eNvMxdizc - Store A in Status Byte 1 (Death).
$03/D567 AD 04 27 LDA $2704  [$7E:2704] A:0080 X:0014 Y:0000 P:eNvMxdizc - Load Target's Status Byte 2
$03/D56A 05 AD ORA $AD    [$00:00AD] A:0000 X:0014 Y:0000 P:envMxdiZc - Load... nothing into A?
$03/D56C 8D 04 27 STA $2704  [$7E:2704] A:0000 X:0014 Y:0000 P:envMxdiZc - Store A in Target's Status Byte 2.
$03/D56F AD A4 28 LDA $28A4  [$7E:28A4] A:0000 X:0014 Y:0000 P:envMxdiZc - Load ??
$03/D572 29 28 AND #$28 A:0000 X:0014 Y:0000 P:envMxdiZc - Is it ?equal? to value in 28?
$03/D574 F0 3A BEQ $3A    [$D5B0] A:0000 X:0014 Y:0000 P:envMxdiZc - If ?so? branch to 03D5B0.
------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------
$03/D5B0 80 03 BRA $03    [$D5B5] A:0000 X:0014 Y:0000 P:envMxdiZc - Branch Alway to 03D5B5.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/D5B2 20 2D E0 JSR $E02D  [$03:E02D] A:0080 X:0014 Y:0000 P:eNvMxdizc - Jump to Subroutine. (Miss/Fail Routine)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/D5B5 60 RTS A:0000 X:0014 Y:0000 P:envMxdiZc - Return
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/D672 AD 03 27 LDA $2703  [$7E:2703] A:0000 X:0014 Y:FFFF P:envMxdiZc - Load Target's Status Byte 1
$03/D675 30 01 BMI $01    [$D678] A:0080 X:0014 Y:FFFF P:eNvMxdizc - Break if Minus (Which it will be if the target is dead.) (80).
------------------------------------------------------------------------------------------------------------------------
$03/D677 60 RTS A:0000 X:0014 Y:FFFF P:envMxdiZc - Return
------------------------------------------------------------------------------------------------------------------------
$03/D678 29 7E AND #$7E A:0080 X:0014 Y:FFFF P:eNvMxdizc - Store the value from 7E and place it in A?
$03/D67A 8D 03 27 STA $2703  [$7E:2703] A:0000 X:0014 Y:FFFF P:envMxdiZc - Store A in Target's Status Byte 1.
$03/D67D AD 04 27 LDA $2704  [$7E:2704] A:0000 X:0014 Y:FFFF P:envMxdiZc - Load Target's Status Byte 2.
$03/D680 29 C0 AND #$C0 A:0000 X:0014 Y:FFFF P:envMxdiZc - Store the value from C0 and Place it in A?
$03/D682 8D 04 27 STA $2704  [$7E:2704] A:0000 X:0014 Y:FFFF P:envMxdiZc - Store A in Target's Status Byte 2.
$03/D685 AD 05 27 LDA $2705  [$7E:2705] A:0000 X:0014 Y:FFFF P:envMxdiZc - Load  Target's Status Byte 3.
$03/D688 29 20 AND #$20 A:0000 X:0014 Y:FFFF P:envMxdiZc - Store the Value from 20 and Place it in A?
$03/D68A 8D 05 27 STA $2705  [$7E:2705] A:0000 X:0014 Y:FFFF P:envMxdiZc - Store A in Target's Status Byte 3.
$03/D68D AD 06 27 LDA $2706  [$7E:2706] A:0000 X:0014 Y:FFFF P:envMxdiZc - Load Target's Status Byte 4.
$03/D690 29 80 AND #$80 A:0000 X:0014 Y:FFFF P:envMxdiZc - Store the value from 80 and place it in A?
$03/D692 8D 06 27 STA $2706  [$7E:2706] A:0000 X:0014 Y:FFFF P:envMxdiZc  Store A in Target's Status Byte 4. (Is this all really necessary? The only status that prolongs after death outside of the first byte to my knowledge is Float.)
$03/D695 64 D6 STZ $D6    [$00:00D6] A:0000 X:0014 Y:FFFF P:envMxdiZc Store Zero in D6.
$03/D697 A5 CF LDA $CF    [$00:00CF] A:0000 X:0014 Y:FFFF P:envMxdiZc - Load A from CF.
$03/D699 20 36 9E JSR $9E36  [$03:9E36] A:0001 X:0014 Y:FFFF P:envMxdizc - Jump to Subroutine.
$03/D69C A9 03 LDA #$03 A:0000 X:0006 Y:0006 P:envMxdizc - Load 03 into A.
$03/D69E 20 C8 85 JSR $85C8  [$03:85C8] A:0003 X:0006 Y:0006 P:envMxdizc - Jump to Subroutine.
$03/D6A1 9E 06 2A STZ $2A06,x[$7E:2A1E] A:0000 X:0018 Y:0006 P:envMxdiZc - Store Zero in 7E20A6
$03/D6A4 AD 2F 35 LDA $352F  [$7E:352F] A:0000 X:0018 Y:0006 P:envMxdiZc - Load A from 7E352F.
$03/D6A7 0A ASL A A:0001 X:0018 Y:0006 P:envMxdizc - Multiply A by 2.
$03/D6A8 AA TAX A:0002 X:0018 Y:0006 P:envMxdizc - Transfer A to X.
$03/D6A9 A9 40 LDA #$40 A:0002 X:0002 Y:0006 P:envMxdizc - Load a 40 into A.
$03/D6AB 9D EB 29 STA $29EB,x[$7E:29ED] A:0040 X:0002 Y:0006 P:envMxdizc - Store A in 7E29ED
$03/D6AE A5 CF LDA $CF    [$00:00CF] A:0040 X:0002 Y:0006 P:envMxdizc - Load the value in CF into A.
$03/D6B0 C9 05 CMP #$05 A:0001 X:0002 Y:0006 P:envMxdizc - Is it 5?
$03/D6B2 90 11 BCC $11    [$D6C5] A:0001 X:0002 Y:0006 P:eNvMxdizc - If not, branch to 03D6C5 (Not sure how to trigger this one.)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/D6C5 AD 2A 35 LDA $352A  [$7E:352A] A:0001 X:0002 Y:0006 P:eNvMxdizc - Load A from 7E352A.
$03/D6C8 D0 0F BNE $0F    [$D6D9] A:0000 X:0002 Y:0006 P:envMxdiZc - Branch if ?equal?  to 7ED6D9.
$03/D6CA AD D2 26 LDA $26D2  [$7E:26D2] A:0000 X:0002 Y:0006 P:envMxdiZc - Load Next Action into A.
$03/D6CD C9 14 CMP #$14 A:0013 X:0002 Y:0006 P:envMxdizc - Is it Life 2?
$03/D6CF F0 1A BEQ $1A    [$D6EB] A:0013 X:0002 Y:0006 P:eNvMxdizc  - If so, branch to 7ED6EB.
$03/D6D1 C9 AB CMP #$AB A:0013 X:0002 Y:0006 P:eNvMxdizc - Is it Recover? (But doesn't Recover use its own Formula?)
$03/D6D3 F0 16 BEQ $16    [$D6EB] A:0013 X:0002 Y:0006 P:envMxdizc - If so, branch to 7ED6EB.
$03/D6D5 C9 AC CMP #$AC A:0013 X:0002 Y:0006 P:envMxdizc - Is it Remedy? (Again, it has its own Formula, no?)
$03/D6D7 F0 12 BEQ $12    [$D6EB] A:0013 X:0002 Y:0006 P:envMxdizc - If so, branch to 7ED6EB.
$03/D6D9 AD 16 27 LDA $2716  [$7E:2716] A:0013 X:0002 Y:0006 P:envMxdizc - Load Target's Modified Vitality.
$03/D6DC 85 DF STA $DF    [$00:00DF] A:0006 X:0002 Y:0006 P:envMxdizc - Store A in DF.
$03/D6DE A9 05 LDA #$05 A:0006 X:0002 Y:0006 P:envMxdizc - Load 05 into A (How did I miss this?!)
$03/D6E0 85 E1 STA $E1    [$00:00E1] A:000F X:0002 Y:0006 P:envMxdizc - Store A in E1
$03/D6E2 20 E0 83 JSR $83E0  [$03:83E0] A:000F X:0002 Y:0006 P:envMxdizc - Jump to Subroutine. (Cleaning Routine)
$03/D6E5 A6 E3 LDX $E3    [$00:00E3] A:0000 X:0000 Y:0006 P:envMxdiZc - Load X from E3 (where the end result of multiplying DF and E1 must have taken place)
$03/D6E7 8E 07 27 STX $2707  [$7E:2707] A:0000 X:005A Y:0006 P:envMxdizc - Store X in Character's HP.
$03/D6EA 60 RTS A:0000 X:005A Y:0006 P:envMxdizc - End of Routine.



Confirmed! Life was Supposed to kill Zombie-type enemies in a Single Blow! But All Zombies in the game are resistant to Instant-KO so this functionality of Life goes Completely unused in every version of the game to my knowledge. You can test this for yourself easily by getting rid of KO immunity on any Zombie and using Life on them.

I will finish this routine up, but I thought to post this as this was something I don't believe was commonly known.

 :edit: 2:
$03/D6DE   A9 05   LDA #$05   A:0006   X:0002   Y:0006   P:envMxdizc - Load 05 into A (What was it I said in the Life topic? (http://slickproductions.org/forum/index.php?topic=1853.msg18833#msg18833) Oh right... You fool.

And that's that. Life has been, for the most part, fully explored. Not a single reference to Asura, no wonder that multi-life problem plagued Phoenix... The only comparable effect I've seen to Asura is Salve using Phoenix Downs. It must deal something with selective targeting, which I wouldn't know where to start on that.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Deathlike2 on September 11, 2013, 11:39:35 AM
Confirmed! Life was Supposed to kill Zombie-type enemies in a Single Blow! But All Zombies in the game are resistant to Instant-KO so this functionality of Life goes Completely unused in every version of the game to my knowledge. You can test this for yourself easily by getting rid of KO immunity on any Zombie and using Life on them.

I will finish this routine up, but I thought to post this as this was something I don't believe was commonly known.

-----------------------------------------------------------------------------------------------------------------------------------------------
$03/D672   AD 03 27   LDA $2703  [$7E:2703]   A:0000   X:0014   Y:FFFF   P:envMxdiZc -

There is actually one monster that fits the criteria... it's the VampLady (Sealed Cave monster).

The existence of an attack almost FF6-like... I forget how FF5 deals with it, but it's close enough IIRC.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Grimoire LD on September 11, 2013, 12:26:38 PM
I must have missed her, but yes you are absolutely right. She is killed by Life spells and to my knowledge she is the only one to have that happen due to not having any resistance to Death.

My Life Subroutine is finished and other than the true  (which I complained about trying to find in the Life topic) and Zombie killing it is what you would expect. (I still say that data to look and restore the status of any other bytes aside from the first two is a bit misdirected though)
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Grimoire LD on September 11, 2013, 03:13:11 PM
Twin Routine

Code: [Select]
$03/E43E A2 01 00 LDX #$0001 A:0003 X:0020 Y:0000 P:envMxdizc - Load 01 into X.
$03/E441 A5 CD LDA $CD    [$00:00CD] A:0003 X:0001 Y:0000 P:envMxdizc - Load A from CD.
$03/E443 CD 39 35 CMP $3539  [$7E:3539] A:0001 X:0001 Y:0000 P:envMxdizc - Compare A with the Slots of the Character's Casting Twin.
$03/E446 F0 01 BEQ $01    [$E449] A:0001 X:0001 Y:0000 P:envMxdiZC - If it is equal branch to 03E449
--------------------------------------------------------------------------------------------------------------------------

-----------------------------------------------------------------------------------------------------------------------------
$03/E449 BD 39 35 LDA $3539,x[$7E:353A] A:0001 X:0001 Y:0000 P:envMxdiZC - Load the Second Slot of Character Casting Twin
$03/E44C 20 89 84 JSR $8489  [$03:8489] A:0003 X:0001 Y:0000 P:envMxdizC - Jump to Cleaning Routine (May Actually be how the game gets the X amounts for stat allocations to various slots!)
$03/E44F A6 A6 LDX $A6    [$00:00A6] A:0000 X:0360 Y:0000 P:envMxdizc - Load X from A6.
$03/E451 BD 03 20 LDA $2003,x[$7E:2183] A:0000 X:0180 Y:0000 P:envMxdizc - Load A from Other Twin's Status Byte 1.
$03/E454 29 C0 AND #$C0 A:0000 X:0180 Y:0000 P:envMxdiZc - Is it Dead or Petrified?
$03/E456 F0 03 BEQ $03    [$E45B] A:0000 X:0180 Y:0000 P:envMxdiZc - If not branch to 03E45B.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E458 4C D6 E4 JMP $E4D6  [$03:E4D6] A:0080 X:0180 Y:0000 P:eNvMxdizc - Jump to 03E4D6.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E45B BD 04 20 LDA $2004,x[$7E:2184] A:0000 X:0180 Y:0000 P:envMxdiZc - Load Other Twin's Status Byte 2.
$03/E45E 29 3C AND #$3C A:0000 X:0180 Y:0000 P:envMxdiZc - Is it Berserk, Charm, Sleep or Paralyzed?
$03/E460 F0 03 BEQ $03    [$E465] A:0000 X:0180 Y:0000 P:envMxdiZc - If not branch to 03E465.
--------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E462 4C D6 E4 JMP $E4D6  [$03:E4D6] A:0030 X:0180 Y:0000 P:envMxdizc (This seems like a waste of space. Why not just use a negative value to loop back to 03E458 so you can save some space?)
-----------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E465 BD 05 20 LDA $2005,x[$7E:2185] A:0000 X:0180 Y:0000 P:envMxdiZc - Load Other Twin's Status Byte 3.
$03/E468 29 40 AND #$40 A:0000 X:0180 Y:0000 P:envMxdiZc - Is it Stopped?
$03/E46A F0 03 BEQ $03    [$E46F] A:0000 X:0180 Y:0000 P:envMxdiZc - If not branch to 03E46F
-----------------------------------------------------------------------------------------------------------------------------------------------------
$03/E46C 4C D6 E4 JMP $E4D6  [$03:E4D6] A:0040 X:0180 Y:0000 P:envMxdizc - Jump to 03E4D6.
------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E46F BD 05 20 LDA $2005,x[$7E:2005] A:0000 X:0000 Y:0000 P:envMxdiZc - Load Character's Status Byte 3.
$03/E472 09 04 ORA #$04 A:0000 X:0000 Y:0000 P:envMxdiZc - Add 04 to A (Twincasting)
$03/E474 9D 05 20 STA $2005,x[$7E:2005] A:0004 X:0000 Y:0000 P:envMxdizc - Store A in Character's Status Byte 3.
$03/E477 AD D0 26 LDA $26D0  [$7E:26D0] A:0004 X:0000 Y:0000 P:envMxdizc - Load Caster's (unknown) into A
$03/E47A 9D 50 20 STA $2050,x[$7E:2050] A:0080 X:0000 Y:0000 P:eNvMxdizc - Store it in actual Character's data.
$03/E47D AD D3 26 LDA $26D3  [$7E:26D3] A:0080 X:0000 Y:0000 P:eNvMxdizc - Load Caster's Next Monster Target into A
$03/E480 9D 53 20 STA $2053,x[$7E:2053] A:00F0 X:0000 Y:0000 P:eNvMxdizc  - Store it in actual Character's data.
$03/E483 A9 20 LDA #$20 A:00F0 X:0000 Y:0000 P:eNvMxdizc- Load 20 into A.
$03/E485 9D 51 20 STA $2051,x[$7E:2051] A:0020 X:0000 Y:0000 P:envMxdizc - Store A into Character's next command.
$03/E488 AE 30 35 LDX $3530  [$7E:3530] A:0020 X:0000 Y:0000 P:envMxdizc - Load X from 7E3530.
$03/E48B 86 92 STX $92    [$00:0092] A:0020 X:0000 Y:0000 P:envMxdiZc - Store X in 92.
$03/E48D A9 20 LDA #$20 A:0020 X:0000 Y:0000 P:envMxdiZc - Load 20 into A.
$03/E48F 8D 7B 39 STA $397B  [$7E:397B] A:0020 X:0000 Y:0000 P:envMxdizc - Store A in 397B (Possibly Command location?)
$03/E492 A9 0C LDA #$0C A:0020 X:0000 Y:0000 P:envMxdizc - Load A into 0C.
$03/E494 85 D6 STA $D6    [$00:00D6] A:000C X:0000 Y:0000 P:envMxdizc - Store A in D6.
$03/E496 A5 CD LDA $CD    [$00:00CD] A:000C X:0000 Y:0000 P:envMxdizc - Load A into CD.
$03/E498 20 36 9E JSR $9E36  [$03:9E36] A:0000 X:0000 Y:0000 P:envMxdiZc - Jump to a Speed Routine.
$03/E49B A9 03 LDA #$03 A:0000 X:0002 Y:0002 P:envMxdizc - Load 03 into A.
$03/E49D 20 C8 85 JSR $85C8  [$03:85C8] A:0003 X:0002 Y:0002 P:envMxdizc - Jump to a Cleaning Routine.
$03/E4A0 A9 08 LDA #$08 A:0000 X:0003 Y:0002 P:envMxdiZc - Load 08 into A.
$03/E4A2 9D 06 2A STA $2A06,x[$7E:2A09] A:0008 X:0003 Y:0002 P:envMxdizc - Store A in 7E2A09.
$03/E4A5 18 CLC A:0008 X:0003 Y:0002 P:envMxdizc - Clear Carry Flag.
$03/E4A6 A5 92 LDA $92    [$00:0092] A:0008 X:0003 Y:0002 P:envMxdizc - Load x92 into A.
$03/E4A8 69 03 ADC #$03 A:0000 X:0003 Y:0002 P:envMxdiZc - Add 03 to A.
$03/E4AA 85 92 STA $92    [$00:0092] A:0003 X:0003 Y:0002 P:envMxdizc - Store A in 92.
$03/E4AC A5 93 LDA $93    [$00:0093] A:0003 X:0003 Y:0002 P:envMxdizc - Load x93 into A.
$03/E4AE 69 00 ADC #$00 A:0000 X:0003 Y:0002 P:envMxdiZc - Add 0 to A.
$03/E4B0 85 93 STA $93    [$00:0093] A:0000 X:0003 Y:0002 P:envMxdiZc - Store A in 93.
$03/E4B2 A6 92 LDX $92    [$00:0092] A:0000 X:0003 Y:0002 P:envMxdiZc - Load x92 into X.
$03/E4B4 A5 D4 LDA $D4    [$00:00D4] A:0000 X:0003 Y:0002 P:envMxdizc - Load xD4 into A.
$03/E4B6 9D 04 2A STA $2A04,x[$7E:2A07] A:0002 X:0003 Y:0002 P:envMxdizc - Store A in 7E2A07.
$03/E4B9 A5 D5 LDA $D5    [$00:00D5] A:0002 X:0003 Y:0002 P:envMxdizc - Load xD5 into A.
$03/E4BB 9D 05 2A STA $2A05,x[$7E:2A08] A:0000 X:0003 Y:0002 P:envMxdiZc - Store A in 7E2A08.
$03/E4BE A9 08 LDA #$08 A:0000 X:0003 Y:0002 P:envMxdiZc - Load 08 into A.
$03/E4C0 9D 06 2A STA $2A06,x[$7E:2A09] A:0008 X:0003 Y:0002 P:envMxdizc - Store A in 7E2A06.
$03/E4C3 A6 A6 LDX $A6    [$00:00A6] A:0008 X:0003 Y:0002 P:envMxdizc - Load xA6 into X.
$03/E4C5 BD 05 20 LDA $2005,x[$7E:2005] A:0008 X:0000 Y:0002 P:envMxdiZc - Load A from Character's Status Byte 3.
$03/E4C8 09 04 ORA #$04 A:0004 X:0000 Y:0002 P:envMxdizc - Add 4 (if not already 4 - Twincasting)
$03/E4CA 9D 05 20 STA $2005,x[$7E:2005] A:0004 X:0000 Y:0002 P:envMxdizc - Store A in Character's Status Byte 3.
$03/E4CD A9 20 LDA #$20 A:0004 X:0000 Y:0002 P:envMxdizc - Load 20 into A.
$03/E4CF 9D 51 20 STA $2051,x[$7E:2051] A:0020 X:0000 Y:0002 P:envMxdizc - Store A in Character's next action.
$03/E4D2 EE 0A 39 INC $390A  [$7E:390A] A:0020 X:0000 Y:0002 P:envMxdizc - Increment 7E390A by 1.
$03/E4D5 60 RTS A:0020 X:0000 Y:0002 P:envMxdizc - Return
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/E4D6 A9 FF LDA #$FF A:0080 X:0180 Y:0000 P:eNvMxdizc - Load FF into A.
$03/E4D8 8D 7B 35 STA $357B  [$7E:357B] A:00FF X:0180 Y:0000 P:eNvMxdizc - Store A in 7E357B.
$03/E4DB A9 11 LDA #$11 A:00FF X:0180 Y:0000 P:eNvMxdizc - Load 11 into A. (Failed.)
$03/E4DD 8D CA 34 STA $34CA  [$7E:34CA] A:0011 X:0180 Y:0000 P:envMxdizc - Store A in 7E34CA  (Battle Message)
$03/E4E0 4C A6 85 JMP $85A6  [$03:85A6] A:0011 X:0180 Y:0000 P:envMxdizc - Jump to 0385A6.
------------------------------------------------------------------------------------------------------------------------------
Second Portion of Routine - Not directly accessed from the start of the routine, oddly enough.

$03/E4E3 A9 FF LDA #$FF A:0003 X:0040 Y:0000 P:envMxdizc - Load FF into A,
$03/E4E5 8D 7B 35 STA $357B  [$7E:357B] A:00FF X:0040 Y:0000 P:eNvMxdizc - Store A in 7E357B.
$03/E4E8 A6 A6 LDX $A6    [$00:00A6] A:00FF X:0040 Y:0000 P:eNvMxdizc - Load xA6 into X.
$03/E4EA 86 8C STX $8C    [$00:008C] A:00FF X:0080 Y:0000 P:envMxdizc - Store X in 8C.
$03/E4EC BD 05 20 LDA $2005,x[$7E:2085] A:00FF X:0080 Y:0000 P:envMxdizc - Load Status Byte 3 of Character 2.
$03/E4EF 29 FB AND #$FB A:0004 X:0080 Y:0000 P:envMxdizc - -4 to A.
$03/E4F1 9D 05 20 STA $2005,x[$7E:2085] A:0000 X:0080 Y:0000 P:envMxdiZc - Store A in Status Byte 3. (Clearing data essentially)
$03/E4F4 AD 85 26 LDA $2685  [$7E:2685] A:0000 X:0080 Y:0000 P:envMxdiZc - Load Status Byte 3 of Caster into A.
$03/E4F7 29 FB AND #$FB A:0004 X:0080 Y:0000 P:envMxdizc - -4 to A.
$03/E4F9 8D 85 26 STA $2685  [$7E:2685] A:0000 X:0080 Y:0000 P:envMxdiZc - Store A in 7E2685.
$03/E4FC A2 01 00 LDX #$0001 A:0000 X:0080 Y:0000 P:envMxdiZc - Load 01 into X.
$03/E4FF A5 CD LDA $CD    [$00:00CD] A:0000 X:0001 Y:0000 P:envMxdizc Load xCD into A.
$03/E501 CD 39 35 CMP $3539  [$7E:3539] A:0001 X:0001 Y:0000 P:envMxdizc - Compare two values.
$03/E504 F0 01 BEQ $01    [$E507] A:0001 X:0001 Y:0000 P:envMxdiZC - If equal branch to 03E507.
---------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------
$03/E507 64 D6 STZ $D6    [$00:00D6] A:0001 X:0001 Y:0000 P:envMxdiZC - Store Zero in D6.
$03/E509 BD 39 35 LDA $3539,x[$7E:353A] A:0001 X:0001 Y:0000 P:envMxdiZC - Load A from 7E3539.
$03/E50C 20 36 9E JSR $9E36  [$03:9E36] A:0000 X:0001 Y:0000 P:envMxdiZC - Jump to Subroutine.
$03/E50F A6 A6 LDX $A6    [$00:00A6] A:0000 X:0005 Y:0005 P:envMxdizc - Load xA6 into X.
$03/E511 BD 05 20 LDA $2005,x[$7E:2005] A:0000 X:0000 Y:0005 P:envMxdiZc - Load Status Byte 3  of Character 1 into A.
$03/E514 29 FB AND #$FB A:0004 X:0000 Y:0005 P:envMxdizc - -4 to A (No idea why this is repeating again)
$03/E516 9D 05 20 STA $2005,x[$7E:2005] A:0000 X:0000 Y:0005 P:envMxdiZc - Store Status Byte 3 of Character 1 from A.
$03/E519 BD 03 20 LDA $2003,x[$7E:2003] A:0000 X:0000 Y:0005 P:envMxdiZc - Load Status Byte 1 of Character 1.
$03/E51C 29 C0 AND #$C0 A:0000 X:0000 Y:0005 P:envMxdiZc Is it ?Dead/Stone? (80+40=C0)
$03/E51E D0 07 BNE $07    [$E527] A:0000 X:0000 Y:0005 P:envMxdiZc - If not, break to 03D527.
-----------------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------------------------------
$03/E520 BD 04 20 LDA $2004,x[$7E:2004] A:0000 X:0000 Y:0005 P:envMxdiZc - Load Status Byte 2 of Character 1 into A.
$03/E523 29 3C AND #$3C A:0000 X:0000 Y:0005 P:envMxdiZc - Is it Berserk/Charm/Sleep/Paralyze?
$03/E525 F0 24 BEQ $24    [$E54B] A:0000 X:0000 Y:0005 P:envMxdiZc - If not go to 03E54B.
------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E54B A9 03 LDA #$03 A:0000 X:0000 Y:0005 P:envMxdiZc - Load 03 into A.
$03/E54D 20 C8 85 JSR $85C8  [$03:85C8] A:0003 X:0000 Y:0005 P:envMxdizc - Jump to Subroutine.
$03/E550 9E 06 2A STZ $2A06,x[$7E:2A09] A:0000 X:0003 Y:0005 P:envMxdiZc - Store Zero in 7E2A09.
$03/E553 A6 A6 LDX $A6    [$00:00A6] A:0000 X:0003 Y:0005 P:envMxdiZc - Load xA6 into X.
$03/E555 86 92 STX $92    [$00:0092] A:0000 X:0000 Y:0005 P:envMxdiZc - Store X in 92.
$03/E557 BD 05 20 LDA $2005,x[$7E:2005] A:0000 X:0000 Y:0005 P:envMxdiZc - Load Status Byte 3 of Character 1
$03/E55A 29 40 AND #$40 A:0000 X:0000 Y:0005 P:envMxdiZc - Is it Stop?
$03/E55C D0 C9 BNE $C9    [$E527] A:0000 X:0000 Y:0005 P:envMxdiZc - If so branch to 03E527.
$03/E55E A6 8C LDX $8C    [$00:008C] A:0000 X:0000 Y:0005 P:envMxdiZc - Load x8C into X.
$03/E560 BD 03 20 LDA $2003,x[$7E:2083] A:0000 X:0080 Y:0005 P:envMxdizc - Load Status Byte 1 of Character 2.
$03/E563 29 C0 AND #$C0 A:0000 X:0080 Y:0005 P:envMxdiZc - Is it Dead/Stone
$03/E565 D0 C0 BNE $C0    [$E527] A:0000 X:0080 Y:0005 P:envMxdiZc - ?/ (No idea how this is branching without saying so)
$03/E567 BD 04 20 LDA $2004,x[$7E:2084] A:0000 X:0080 Y:0005 P:envMxdiZc - Load Status Byte 2 of Character 2
$03/E56A 29 3C AND #$3C A:0000 X:0080 Y:0005 P:envMxdiZc - Is it Berserk/Charm/Sleep/Paralyze?
$03/E56C D0 B9 BNE $B9    [$E527] A:0000 X:0080 Y:0005 P:envMxdiZc - ??
$03/E56E BD 00 20 LDA $2000,x[$7E:2080] A:0000 X:0080 Y:0005 P:envMxdiZc - Load Character 1's Character ID into A.
$03/E571 29 1F AND #$1F A:0089 X:0080 Y:0005 P:eNvMxdizc - -80? to A?
$03/E573 C9 13 CMP #$13 A:0009 X:0080 Y:0005 P:envMxdizc - (Palom and Porom are 08 and 09, not 13 and 15, I have no ide... FuSoYa and Golbez.) Is it FuSoYa?
$03/E575 F0 04 BEQ $04    [$E57B] A:0009 X:0080 Y:0005 P:eNvMxdizc - If so branch to 03E57B.
$03/E577 C9 15 CMP #$15 A:0009 X:0080 Y:0005 P:eNvMxdizc - Is it Golbez?
$03/E579 D0 04 BNE $04    [$E57F] A:0009 X:0080 Y:0005 P:eNvMxdizc - If not branch to 03E57F.
-----------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E57B A9 5E LDA #$5E A:0015 X:0080 Y:0005 P:envMxdiZC - Load W. Meteo
$03/E57D 80 19 BRA $19    [$E598] A:005E X:0080 Y:0005 P:envMxdizC - Branch Always to 03E598.
-----------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E57F 20 93 85 JSR $8593  [$03:8593] A:0009 X:0080 Y:0005 P:eNvMxdizc - Jump to Subroutine (where random number seems to be generated)
$03/E582 C9 FF CMP #$FF A:008F X:0011 Y:0005 P:eNvMxdizC - Was it FF (or higher)?
$03/E584 90 08 BCC $08    [$E58E] A:008F X:0011 Y:0005 P:eNvMxdizc - If not, branch to 03E58E.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E586 A9 11 LDA #$11 A:00FF X:0033 Y:0007 P:envMxdiZC- Load x11 into A. (Failed Message)
$03/E588 8D CA 34 STA $34CA  [$7E:34CA] A:0011 X:001B Y:0005 P:envMxdizC - Store A in 7E34CA (Battle Message Area)
$03/E58B 4C A6 85 JMP $85A6  [$03:85A6] A:0011 X:001B Y:0005 P:envMxdizC - Jump to Subroutine which leads out of the Routine all together.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E58E C9 40 CMP #$40 A:008F X:0011 Y:0005 P:eNvMxdizc - Is it less than 40?
$03/E590 90 04 BCC $04    [$E596] A:008F X:0011 Y:0005 P:envMxdizC - If so, branch to 03E596.
$03/E592 A9 41 LDA #$41 A:008F X:0011 Y:0005 P:envMxdizC - Load Flare into A.
$03/E594 80 02 BRA $02    [$E598] A:0041 X:0011 Y:0005 P:envMxdizC - Branch Always to 03E598.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E596 A9 40 LDA #$40 A:0024 X:0064 Y:0007 P:eNvMxdizc - Load Comet
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E598 85 94 STA $94    [$00:0094] A:0041 X:0011 Y:0005 P:envMxdizC - Store A in 94.
$03/E59A AA TAX A:0041 X:0011 Y:0005 P:envMxdizC - Transfer A to X.
$03/E59B 86 E5 STX $E5    [$00:00E5] A:0041 X:0041 Y:0005 P:envMxdizC - Store X in E5
$03/E59D A2 A0 97 LDX #$97A0 A:0041 X:0041 Y:0005 P:envMxdizC - Load 97A0 into X.
$03/E5A0 86 80 STX $80    [$00:0080] A:0041 X:97A0 Y:0005 P:eNvMxdizC - Store X into 80.
$03/E5A2 A9 0F LDA #$0F A:0041 X:97A0 Y:0005 P:eNvMxdizC - Load 0F into A.
$03/E5A4 85 82 STA $82    [$00:0082] A:000F X:97A0 Y:0005 P:envMxdizC - Store A into 82.
$03/E5A6 A9 06 LDA #$06 A:000F X:97A0 Y:0005 P:envMxdizC - Load 06 into A.
$03/E5A8 20 5E 84 JSR $845E  [$03:845E] A:0006 X:97A0 Y:0005 P:envMxdizC -  Jump to Subroutine (Cleaning)
$03/E5AB AD A0 28 LDA $28A0  [$7E:28A0] A:000A X:0006 Y:018C P:envMxdiZC - Load 7E28A0 into A.
$03/E5AE 29 7F AND #$7F A:0000 X:0006 Y:018C P:envMxdiZC - ??
$03/E5B0 85 DF STA $DF    [$00:00DF] A:0000 X:0006 Y:018C P:envMxdiZC - Store A in DF.
$03/E5B2 A9 03 LDA #$03 A:0000 X:0006 Y:018C P:envMxdiZC - Load 03 into A,
$03/E5B4 85 E1 STA $E1    [$00:00E1] A:0003 X:0006 Y:018C P:envMxdizC - Store A in E1.
$03/E5B6 20 E0 83 JSR $83E0  [$03:83E0] A:0003 X:0006 Y:018C P:envMxdizC - Jump to Subroutine (Cleaning)
$03/E5B9 A6 E3 LDX $E3    [$00:00E3] A:0000 X:0000 Y:018C P:envMxdiZc - Load xE3 into X.
$03/E5BB 7B TDC A:0000 X:0000 Y:018C P:envMxdiZc - Transfer Direct Page.
$03/E5BC A8 TAY A:0000 X:0000 Y:018C P:envMxdiZc - Transfer A to Y.
$03/E5BD BF 90 A5 0F LDA $0FA590,x[$0F:A590] A:0000 X:0000 Y:0000 P:envMxdiZc - Load A from 0FA590.
$03/E5C1 99 A2 28 STA $28A2,y[$7E:28A2] A:0000 X:0000 Y:0000 P:envMxdiZc - Store A in 7E 28A2.
$03/E5C4 C8 INY A:0000 X:0000 Y:0000 P:envMxdiZc - Add 1 to Y
$03/E5C5 E8 INX A:0000 X:0000 Y:0001 P:envMxdizc - Add 1 to X
$03/E5C6 C0 03 00 CPY #$0003 A:0000 X:0001 Y:0001 P:envMxdizc - Copy Y to 03?
$03/E5C9 D0 F2 BNE $F2    [$E5BD] A:0000 X:0001 Y:0001 P:eNvMxdizc - Loop.
$03/E5BD BF 90 A5 0F LDA $0FA590,x[$0F:A591] A:0000 X:0001 Y:0001 P:eNvMxdizc - Load A from 0FA590.
$03/E5C1 99 A2 28 STA $28A2,y[$7E:28A3] A:0000 X:0001 Y:0001 P:envMxdiZc - Store A in 7E28A3.
$03/E5C4 C8 INY A:0000 X:0001 Y:0001 P:envMxdiZc - Add 1 to Y
$03/E5C5 E8 INX A:0000 X:0001 Y:0002 P:envMxdizc - Add 1 to X
$03/E5CB AD 8B 26 LDA $268B  [$7E:268B] A:0000 X:0003 Y:0003 P:envMxdiZC - Load Caster's MP
$03/E5CE 85 A9 STA $A9    [$00:00A9] A:0032 X:0003 Y:0003 P:envMxdizC - Store it in A9.
$03/E5D0 AD 8C 26 LDA $268C  [$7E:268C] A:0032 X:0003 Y:0003 P:envMxdizC - Load Caster's MP Byte 2.
$03/E5D3 F0 04 BEQ $04    [$E5D9] A:0000 X:0003 Y:0003 P:envMxdiZC - ?? (Possibly if not enough MP to cast spell?)
$03/E5D9 AD A1 28 LDA $28A1  [$7E:28A1] A:0000 X:0003 Y:0003 P:envMxdiZC - Load A from Spell's MP Cost?
$03/E5DC 29 7F AND #$7F A:000A X:0003 Y:0003 P:envMxdizC - ??
$03/E5DE 85 AB STA $AB    [$00:00AB] A:000A X:0003 Y:0003 P:envMxdizC - Store A in AB
$03/E5E0 C5 A9 CMP $A9    [$00:00A9] A:000A X:0003 Y:0003 P:envMxdizC - ?Is it more than in A9 (MP)?
$03/E5E2 F0 02 BEQ $02    [$E5E6] A:000A X:0003 Y:0003 P:eNvMxdizc  - If so, branch to 03E5E6
$03/E5E4 B0 28 BCS $28    [$E60E] A:000A X:0003 Y:0003 P:eNvMxdizc - If carry is set branch to 03E60E
$03/E5E6 A6 92 LDX $92    [$00:0092] A:000A X:0003 Y:0003 P:eNvMxdizc - Load x92 into X.
$03/E5E8 38 SEC A:000A X:0000 Y:0003 P:envMxdiZc - Set Carry Flag.
$03/E5E9 BD 0B 20 LDA $200B,x[$7E:200B] A:000A X:0000 Y:0003 P:envMxdiZC - Load Character 1's MP.
$03/E5EC E5 AB SBC $AB    [$00:00AB] A:00E7 X:0000 Y:0003 P:eNvMxdizC - Subtract it from AB.
$03/E5EE 85 A9 STA $A9    [$00:00A9] A:00DD X:0000 Y:0003 P:eNvMxdizC - Store new value in A9.
$03/E5F0 BD 0C 20 LDA $200C,x[$7E:200C] A:00DD X:0000 Y:0003 P:eNvMxdizC - Load Character 1's MP Byte 2.
$03/E5F3 E9 00 SBC #$00 A:0003 X:0000 Y:0003 P:envMxdizC - Subtract 00?
$03/E5F5 85 AA STA $AA    [$00:00AA] A:0003 X:0000 Y:0003 P:envMxdizC - Store A in AA.
$03/E5F7 90 15 BCC $15    [$E60E] A:0003 X:0000 Y:0003 P:envMxdizC - Branch if Carry Flag is Set to 03E60E.
$03/E5F9 A5 A9 LDA $A9    [$00:00A9] A:0003 X:0000 Y:0003 P:envMxdizC - Load A from MP Storing Area.
$03/E5FB 9D 0B 20 STA $200B,x[$7E:200B] A:00DD X:0000 Y:0003 P:eNvMxdizC - Store MP in Character 1's MP.
$03/E5FE A5 AA LDA $AA    [$00:00AA] A:00DD X:0000 Y:0003 P:eNvMxdizC - Load A from MP Storing Area 2.
$03/E600 9D 0C 20 STA $200C,x[$7E:200C] A:0003 X:0000 Y:0003 P:envMxdizC - Store MP in Character's MP Byte 2.
$03/E603 A5 94 LDA $94    [$00:0094] A:0003 X:0000 Y:0003 P:envMxdizC - Load x94 into A (Flare?)
$03/E605 8D D2 26 STA $26D2  [$7E:26D2] A:0041 X:0000 Y:0003 P:envMxdizC - Store A in Caster's Next Action.
$03/E608 EE 5D 35 INC $355D  [$7E:355D] A:0041 X:0000 Y:0003 P:envMxdizC - +1 to value in 7E355D.
$03/E60E 60 RTS A:00F0 X:0680 Y:001A P:eNvMxdizC - Return


I'm beginning to grow leery of this command structure, it looks as if these may not actually contain much of the relevant data, but none of the subroutines in this formula were unique, they were simple cleaning routines. The only thing of note here is the Twincasting status part for both participants.


 :edit: Now that's more like it! The rest of the code was sitting close-by, I guess Return commands doesn't always mean that the routine is finished.

What a trip this was! Now this was valuable information (for me) not only can I make an easy to use third Twin Spell, but I can also make a special Equipment requirement for W. Meteo (ala FFIVA) now that I know how the game puts it all into place!

 :edit: Updated the starting information which includes tenets for failing before the command begins.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Deathlike2 on September 11, 2013, 03:32:59 PM
Well, there's definitely a section of code that would show the probabilities of how Burst (mini-Flare), Comet, and "failed to cast spell".

If only we could find that out for FF4A as well...
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Grimoire LD on September 11, 2013, 11:44:40 PM
Enormous update to previous post! With this information we are now able to do several things of relative importance.

One - We can now make a special equipment (or anything in the character's stats really) that will allow the player to use W. Meteo!

Here's how...
Change this....
$03/E56E   BD 00 20   LDA $2000,x[$7E:2080]   A:0000   X:0080   Y:0005   P:envMxdiZc - Load Character 1's Character ID into A.
$03/E571   29 1F   AND #$1F   A:0089   X:0080   Y:0005   P:eNvMxdizc - -80? to A?
$03/E573   C9 13   CMP #$13   A:0009   X:0080   Y:0005   P:envMxdizc - (Palom and Porom are 08 and 09, not 13 and 15, I have no ide... FuSoYa and Golbez.) Is it FuSoYa?
$03/E575   F0 04   BEQ $04    [$E57B]   A:0009   X:0080   Y:0005   P:eNvMxdizc - If so branch to 03E57B.
$03/E577   C9 15   CMP #$15   A:0009   X:0080   Y:0005   P:eNvMxdizc - Is it Golbez?
$03/E579   D0 04   BNE $04    [$E57F]   A:0009   X:0080   Y:0005   P:eNvMxdizc - If not branch to 03E57F.
-----------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E57B   A9 5E   LDA #$5E   A:0015   X:0080   Y:0005   P:envMxdiZC - Load W. Meteo
$03/E57D   80 19   BRA $19    [$E598]   A:005E   X:0080   Y:0005   P:envMxdizC - Branch Always to 03E598.


To this...

$03/E56E   BD 00 20   LDA $2032,x[$7E:2080]   A:0000   X:0080   Y:0005   P:envMxdiZc - Load Character 1's Gauntlet into A.
$03/E571   DE DE   NULL #$1F   A:0089   X:0080   Y:0005   P:eNvMxdizc - NULL
$03/E573   C9 AF   CMP #$AF   A:0009   X:0080   Y:0005   P:envMxdizc - Is it Cursed Ring?
$03/E575   F0 04   BEQ $04    [$E57B]   A:0009   X:0080   Y:0005   P:eNvMxdizc - If so branch to 03E57B.
$03/E577   C9 FF   CMP #$FF   A:0009   X:0080   Y:0005   P:eNvMxdizc - Is it TrashCans (Which Golbez defaultly has equipped)
$03/E579   D0 04   BNE $04    [$E57F]   A:0009   X:0080   Y:0005   P:eNvMxdizc - If not branch to 03E57F.
-----------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E57B   A9 5E   LDA #$5E   A:0015   X:0080   Y:0005   P:envMxdiZC - Load W. Meteo
$03/E57D   80 19   BRA $19    [$E598]   A:005E   X:0080   Y:0005   P:envMxdizC - Branch Always to 03E598.



Two - You can make use of that worthless (barely ever seen) "Failed" Message for the Twins and turn it into a Third spell and here's how...

You take this...

$03/E57F   20 93 85   JSR $8593  [$03:8593]   A:0009   X:0080   Y:0005   P:eNvMxdizc - Jump to Subroutine (where random number seems to be generated)
$03/E582   C9 FF   CMP #$FF   A:008F   X:0011   Y:0005   P:eNvMxdizC - Was it FF (or higher)?
$03/E584   90 08   BCC $08    [$E58E]   A:008F   X:0011   Y:0005   P:eNvMxdizc - If not, branch to 03E58E.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E586   A9 11   LDA #$11   A:00FF   X:0033   Y:0007   P:envMxdiZC- Load x11 into A. (Failed Message)
$03/E588   8D CA 34   STA $34CA  [$7E:34CA]   A:0011   X:001B   Y:0005   P:envMxdizC - Store A in 7E34CA (Battle Message Area)
$03/E58B   4C A6 85   JMP $85A6  [$03:85A6]   A:0011   X:001B   Y:0005   P:envMxdizC - Jump to Subroutine which leads out of the Routine all together.

And change it to this...

$03/E57F   20 93 85   JSR $8593  [$03:8593]   A:0009   X:0080   Y:0005   P:eNvMxdizc - Jump to Subroutine (where random number seems to be generated)
$03/E582   C9 C0   CMP #$FF   A:008F   X:0011   Y:0005   P:eNvMxdizC - Was it C0 (or higher)?
$03/E584   90 08   BCC $08    [$E58E]   A:008F   X:0011   Y:0005   P:eNvMxdizc - If not, branch to 03E58E.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E586   A9 XX   LDA #$XX   A:00E8   X:00F8   Y:0007   P:envMxdizC - Whatever spell you please, as long as it targets enemies. Healing spells will still hit the enemy if chosen.
$03/E588   80 0E   BRA $0E    [$E598]   A:0011   X:00F8   Y:0007   P:envMxdizC - Branch Always to 03E598 (to get back to the normal routine.)
$03/E58B   DE DE DE NULL    $85A6  [$03:85A6]   A:0011   X:001B   Y:0005   P:envMxdizC - NULL

And there you have it! The command of Twin completely enhanced by simply knowing its basic coding!
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: chillyfeez on September 12, 2013, 12:26:02 AM
That is pretty freaking awesome, Grimoire.
Question: will a healing spell still always target the enemies even if you change its targeting to "all allies," thus nullifying its ability to target enemies under normal circumstances?
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Grimoire LD on September 12, 2013, 12:56:17 AM
Unfortunately no. It seems you had the same idea as me of having Twin actually *gasp* having something to do with the White Mage portion of the Cast! But no, All Allies still only hits enemies and there doesn't appear to be anything in that formula to change it. We're still missing some secondary targeting table for commands, I'm almost sure of it. I'm just not sure how to go about looking for it.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Deathlike2 on September 12, 2013, 01:14:44 AM
You would have to change targeting and the spells used to make the "new targeting" effective.

Otherwise, you'd probably have to write custom code to use the spell's built in behavior (that is why some of the FF4A Confuse status bugs are comical).

Just remember that Burst/mini-Flare is a single target spell that is forced to do split-damage when cast (it has almost the same spell power as Bio).
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: chillyfeez on September 12, 2013, 01:59:17 AM
Hmm...
Correct me if I'm wrong, but I think selecting Twin begins an automatic sequence that bypasses targeting.
BUT Twin's entry in the targeting table (9FFC3 - 9FFDC) is 60 (all enemies). If we changed that to 70 (one/all allies/enemies, defaults to enemy), perhaps this would enable targeting allies depending on the particulars of the spell.
I realize this is a bit optimistic, but it's worth a try.

 :edit: Nope. While it is possible to change the targeting of Twin, the command always forces its targeting on the spell cast. Even if you change it to "00" (target self with no finger), the spell just gets cast on the twin who initiates Twin.  :bah:
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Grimoire LD on September 12, 2013, 09:26:08 AM
Hmm, and if you tell it to target single/all/allies/enemies the game never takes that into account? Because I had a theory to use, if those are ever taken into account.

 :edit: Yep. Auto-Targeting, I have no idea where and how that is determined.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Grimoire LD on September 12, 2013, 10:04:26 AM
Chillyfeez your theory was right on the mark!

(http://i112.photobucket.com/albums/n198/LastingDawn/FFIVTwinsusingTwinMagiconSelves_zps986c045b.png) (http://s112.photobucket.com/user/LastingDawn/media/FFIVTwinsusingTwinMagiconSelves_zps986c045b.png.html)


Set the Targeting to F0 and you can target either Ally/Allies Enemy or Enemies.

I have a plan to use this for, but I'm out of time. I'll post when I get home, but needless to say I think I can make a way to have one White Magic spell act on Allies and another Twin Spell on enemies.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Grimoire LD on September 12, 2013, 07:45:39 PM
After roughly an hour of thinking on how to make a separate Black-esque spell and White-esque spell for Twin the answer finally came, it does involve replacing the Golbez/FuSoYa check though, but that's fine. I think Zeromus will still scriptedly die to a Comet or Flare anyhow.

$03/E56E   BD 54 20   LDA $2054,x[$7E:2054]   A:0000   X:0000   Y:0005   P:envMxdiZc - Load Character's Targeting Info (Ally).
$03/E571   C9 00   CMP #$00   A:0080   X:0000   Y:0005   P:eNvMxdizc - Is it 00? (Which it will be if the character is using an Ally target)
$03/E573   F0 0A   BEQ $0A    [$E57F]   A:0080   X:0000   Y:0005   P:eNvMxdizC - If so break to 03E57F (To the normal routine.)
$03/E575   A9 00   LDA #$00   A:0080   X:0000   Y:0005   P:eNvMxdizC - Load a 00 into A.
$03/E577   8D 54 20   STA $2054  [$7E:2054]   A:0000   X:0000   Y:0005   P:envMxdiZC - Erases the Ally Target Info so it is not saved in subsequent casts (Causing problems)
$03/E57A   EA    NOP   A:0000   X:0000   Y:0005   P:envMxdiZC -
$03/E57B   A9 85   LDA #$85   A:0000   X:0000   Y:0005   P:envMxdiZC$03/E57D   80 19   BRA $19    [$E598]   A:005E   X:0080   Y:0005   P:envMxdizC - Load Absorb (just a test, you can use anything you like)

Is what I would say if I thought about this way too hard (which I did). But this comes with a host of problems. First and foremost the byte that shows whether someone is targeting an ally or is going to target an ally is never properly cleared and there's not enough room to clear those bytes from everyone, so here is my new, simpler, and probably more effective and character defining skill. when I can just use the normal one and slightly alter it...

$03/E56E   AD 00 20   LDA $2680,[$7E:2680]   A:0000   X:0080   Y:0005   P:envMxdiZc - Load Character 1's Character ID from Caster's Data into A.
$03/E571   29 1F   AND #$1F   A:0089   X:0080   Y:0005   P:eNvMxdizc - -80? to A?
$03/E573   C9 09   CMP #$08   A:0008   X:0080   Y:0005   P:envMxdizc - Is it Palom?
$03/E575   F0 04   BEQ $04    [$E57B]   A:0009   X:0080   Y:0005   P:eNvMxdizc - If so branch to 03E57B.
$03/E577   C9 15   CMP #$15   A:0009   X:0080   Y:0005   P:eNvMxdizc - Is it Golbez?
$03/E579   D0 04   BNE $04    [$E57F]   A:0009   X:0080   Y:0005   P:eNvMxdizc - If not branch to 03E57F.
-----------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E57B   A9 5E   LDA #$5E   A:0015   X:0080   Y:0005   P:envMxdiZC - Load W. Meteo
$03/E57D   80 19   BRA $19    [$E598]   A:005E   X:0080   Y:0005   P:envMxdizC - Branch Always to 03E598.


Twincast works a very strange way. The character who initiates the Twincast is actually not attacking, but the other Twin is the one taking action. If Porom uses Twincast the game loads Palom's stats. If Palom uses Twincast the game loads Porom's stats. Unless one is occupying the middle slot. In such a case the Twins will load their own stats for their command.

This makes setting up a constant a lot more difficult than it should be since in differing circumstances the checks would be reversed. Now I know somewhere else in RAM the targeting is stored (assuming that too has a different byte for allies or enemies), but I'm not sure where. But until I find that I guess there's no logical way to separate Palom and Porom's Twincast.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Deathlike2 on September 12, 2013, 08:33:41 PM
Twincast works a very strange way. The character who initiates the Twincast is actually not attacking, but the other Twin is the one taking action. If Porom uses Twincast the game loads Palom's stats. If Palom uses Twincast the game loads Porom's stats. Unless one is occupying the middle slot. In such a case the Twins will load their own stats for their command.

Hmm... the middle slot is the best for controlling Twincast, but that behavior is odd. I kinda thought Agility had some influence with it (at least with respect to FF4A).
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Grimoire LD on September 12, 2013, 09:24:41 PM
Indeed DeathLike2, I was expecting that to play some role, but as far as the SNES versions appear to be concerned placement is Everything. You noted this in the Algorithm FAQ that the Twin in the middle is the one whose stats are calculated.


Okay! So I have it mostly figured out. There is still one problem I can't fix but that's more to do with an Inferior/Superior Twin problem. I guess it's a ?feature? of the hack then.


$03/E56E   BD 3B 39   LDA $393B,x[$7E:393B]   A:0000   X:0000   Y:0005   P:envMxdiZc - Load Character's Targeting Info (Internal).
$03/E571   C9 00   CMP #$00   A:0080   X:0000   Y:0005   P:eNvMxdizc - Is it 00? (Which it will be if the character is using an Ally target)
$03/E573   F0 0A   BEQ $0A    [$E57F]   A:0080   X:0000   Y:0005   P:eNvMxdizC - If so break to 03E57F (To the normal routine.)
$03/E575   A9 00   LDA #$00   A:0080   X:0000   Y:0005   P:eNvMxdizC - Load a 00 into A.
$03/E577   8D 54 20   STA $2054  [$7E:2054]   A:0000   X:0000   Y:0005   P:envMxdiZC - Erases the Ally Target Info so it is not saved in subsequent casts (Causing problems)
$03/E57A   EA    NOP   A:0000   X:0000   Y:0005   P:envMxdiZC -
$03/E57B   A9 85   LDA #$85   A:0000   X:0000   Y:0005   P:envMxdiZC$03/E57D   80 19   BRA $19    [$E598]   A:005E   X:0080   Y:0005   P:envMxdizC - Load Absorb (just a test, you can use anything you like)

As I had hoped I followed the targeting back to it's (halfway-house, but for our purposes...) origin and found it at 7E393B I really need to pay more attention to these Data Altering Fields which are located in this section, a lot of important stuff is drawn from, and put in to it. This switches with any action taken by anyone and therefore will not stay static as it would in the character's own Targeting info until the next true Cast-On-Party Spell is cast to overwrite the previous one.

So now there will be a unique spell cast from Twincast only if it is targeting someone in the party, or the whole party.

Now onto the Superior/Inferior Twin problem...

The Twin that is considered the current Superior is the one that seems to be placed earlier in the slots with the Twin in Slot 1 taking precedence in everything. This is already known, but what is not known is that the Inferior Twin will Always be Porom unless the two are considered Current Equals, which only occurs when Porom occupies the Main Slot or the 3rd (I think that's the top? Maybe that's the 2nd...) slot. Now this wouldn't ordinarily be that large of a problem, the game goes on like this in a normal fashion without it being noticeable at all.

However it is Very noticeable by using this hack. When Inferior Porom goes to use a spell on the party, she will instead only cast the spell on Palom no matter who is targeted. It is a Bizarre behavior. When the Twins are considered Equal, they both work the same.

Well that was a bit of interesting work, I never expected the Twincast System to be that complicated. As far as I could tell (boosted Porom's Agility to 22 while Palom's was still 8) Agility did not factor into it at all for the SNES versions.

(http://i112.photobucket.com/albums/n198/LastingDawn/FlareonTwinMagic_zps1e5d5440.png) (http://s112.photobucket.com/user/LastingDawn/media/FlareonTwinMagic_zps1e5d5440.png.html)

(http://i112.photobucket.com/albums/n198/LastingDawn/HealingTwinMagic_zps1538dff9.png) (http://s112.photobucket.com/user/LastingDawn/media/HealingTwinMagic_zps1538dff9.png.html)
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Lenophis on September 13, 2013, 10:28:12 AM
Code: [Select]
$03/E56E   BD 3B 39   LDA $393B,x[$7E:393B]   A:0000   X:0000   Y:0005   P:envMxdiZc - Load Character's Targeting Info (Internal).
$03/E571   C9 00   CMP #$00   A:0080   X:0000   Y:0005   P:eNvMxdizc - Is it 00? (Which it will be if the character is using an Ally target)
$03/E573   F0 0A   BEQ $0A    [$E57F]   A:0080   X:0000   Y:0005   P:eNvMxdizC - If so break to 03E57F (To the normal routine.)
$03/E575   A9 00   LDA #$00   A:0080   X:0000   Y:0005   P:eNvMxdizC - Load a 00 into A.
$03/E577   8D 54 20   STA $2054  [$7E:2054]   A:0000   X:0000   Y:0005   P:envMxdiZC - Erases the Ally Target Info so it is not saved in subsequent casts (Causing problems)
$03/E57A   EA    NOP   A:0000   X:0000   Y:0005   P:envMxdiZC -
$03/E57B   A9 85   LDA #$85   A:0000   X:0000   Y:0005   P:envMxdiZC
$03/E57D   80 19   BRA $19    [$E598]   A:005E   X:0080   Y:0005   P:envMxdizC - Load Absorb (just a test, you can use anything you like)
Here's some optimizing you can do:
LDA $393B,X - This will load whatever is in this address, so far so good.
CMP #$00 - You don't need this. LDA will set the Z flag appropriately upon load. Guessing this is Square's doing (they did this a lot in FF6, too).
The rest of it looks good.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Grimoire LD on September 15, 2013, 10:54:57 AM
Ah, so CMP #00 isn't needed and will always set on its own? That is very useful information and frees up crucial space in trying to make routines that should look at a 00.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Grimoire LD on September 15, 2013, 02:12:00 PM
Here's a surprisingly straightforward command in Dispel. with no jumps, nothing complicated and everything (for the most part) easily distinguishable. You can see what Square was Trying to do with the status, but you can then also notice how they messed one thing up (two since it can't dispel Reflect because it is Reflectable...) leading to a glitch.



Dispel Routine

Code: [Select]
$03/D8B0 A5 CE LDA $CE    [$00:00CE] A:0003 X:0020 Y:FFFF P:envMxdizc - Load A into CE.
$03/D8B2 10 03 BPL $03    [$D8B7] A:0080 X:0020 Y:FFFF P:eNvMxdizc - Branch if positive to 03D8B7
$03/D8B4 18 CLC A:0080 X:0020 Y:FFFF P:eNvMxdizc - Clear Carry Flag.
$03/D8B5 69 05 ADC #$05 A:0080 X:0020 Y:FFFF P:eNvMxdizc - Add 05 into A.
$03/D8B7 AA TAX A:0085 X:0020 Y:FFFF P:eNvMxdizc - Transfer A to X.
$03/D8B8 9E 6D 35 STZ $356D,x[$7E:35F2] A:0085 X:0085 Y:FFFF P:envMxdizc - Store Zero in 7E35F2.
$03/D8BB AD 04 27 LDA $2704  [$7E:2704] A:0085 X:0085 Y:FFFF P:envMxdizc - Load Status Byte 2 of Target into A.
$03/D8BE 85 A9 STA $A9    [$00:00A9] A:0040 X:0085 Y:FFFF P:envMxdizc - Store Current Status in A9. 
$03/D8C0 29 FB AND #$FB A:0040 X:0085 Y:FFFF P:envMxdizc - -4 to A (if the bit is set?) (This removes Berserk in some way. Likely because FF - FB = 4 so therefore FB would be -4. )
$03/D8C2 8D 04 27 STA $2704  [$7E:2704] A:0040 X:0085 Y:FFFF P:envMxdizc - Store A into 7E2704
$03/D8C5 A5 A9 LDA $A9    [$00:00A9] A:0040 X:0085 Y:FFFF P:envMxdizc - Load Initial Status2 from A9 into A. (Before the 04 bit was removed)
$03/D8C7 29 04 AND #$04 A:0040 X:0085 Y:FFFF P:envMxdizc - Is it Berserk?
$03/D8C9 F0 0E BEQ $0E    [$D8D9] A:0000 X:0085 Y:FFFF P:envMxdiZc - If not, branch to 03D8D9.
-----------------------------------------------------------------------------------------------------------------------------------------------------------
$03/D8CB AD CE 00 LDA $00CE  [$7E:00CE] A:0004 X:0085 Y:FFFF P:envMxdizc - Load A from CE.
$03/D8CE 10 04 BPL $04    [$D8D4] A:0080 X:0085 Y:FFFF P:eNvMxdizc - Branch to 03D8D4 if not 80. (Not sure how this wouldn't be 80..)
$03/D8D0 A9 E1 LDA #$E1 A:0080 X:0085 Y:FFFF P:eNvMxdizc - Load Value E1 into A.
$03/D8D2 80 02 BRA $02    [$D8D6] A:00E1 X:0085 Y:FFFF P:eNvMxdizc - Branch Always to 03D8D6.
(Likely used to set the Berserked character back into a usable state)
-----------------------------------------------------------------------------------------------------------------
 (Couldn't be copied since I couldn't access so...) A9 21 - Load 21 into A.
-----------------------------------------------------------------------------------------------------------------
$03/D8D6 8D 51 27 STA $2751  [$7E:2751] A:00E1 X:0085 Y:FFFF P:eNvMxdizc - Store A in ?Next Action of Target?) - (If A was not 80 before somehow, it would be 21.)
-----------------------------------------------------------------------------------------------------------------------------------------------------------
$03/D8D9 AD 06 27 LDA $2706  [$7E:2706] A:0000 X:0085 Y:FFFF P:envMxdiZc - Load Status Byte 4 of Target into A.
$03/D8DC 29 83 AND #$83 A:000C X:0085 Y:FFFF P:envMxdizc - (Add -7C (83) into A, nulling (4) Image 1, (8) 2, (10) Barrier, (20) Wall, and (40)HP Leak. (=73)
$03/D8DE 8D 06 27 STA $2706  [$7E:2706] A:0000 X:0085 Y:FFFF P:envMxdiZc - Store the new Target's Status Byte 4 into A.
$03/D8E1 A5 CF LDA $CF    [$00:00CF] A:0000 X:0085 Y:FFFF P:envMxdiZc - Load A from CF.
$03/D8E3 0A ASL A A:0005 X:0085 Y:FFFF P:envMxdizc - Multiply A by 2.
$03/D8E4 AA TAX A:000A X:0085 Y:FFFF P:envMxdizc - Transfer A to X.
$03/D8E5 BD EB 29 LDA $29EB,x[$7E:29F5] A:000A X:000A Y:FFFF P:envMxdizc - Load A into 7E29F5 . (The Tower of Babil docs say that this is 29EB-2A03 Bitmask of status events that are to expire (?) for each slot. Which must be causing the odd Stop glitch. It's actually programmed to remove the timer, but isn't programmed to remove Stop. If I had to guess it is likely supposed to remove HP Leak's timer. Or Dispel's functionality may have been different at one point in development. )
$03/D8E8 29 5F AND #$5F A:0040 X:000A Y:FFFF P:envMxdizc- ?? (Presumably removes Stop's timer if present. Not sure how though. When stopped the value reads C0. which is a +80 from 40. 5F, either positive or negative would not return it to basics.
$03/D8EA 9D EB 29 STA $29EB,x[$7E:29F5] A:0040 X:000A Y:FFFF P:envMxdizc - Store A into 7E29F5.
$03/D8ED 60 RTS A:0040 X:000A Y:FFFF P:envMxdizc - Return


$03/D8BE   85 A9   STA $A9    [$00:00A9]   A:0040   X:0085   Y:FFFF   P:envMxdizc - Store Current Status in A9.  (Just a point of curiosity, this was used on a flying enemy which apparently have Float innately. I had thought that their Quake-resistance came from their Weakness set? Or does that weakness set also give Float?)

Improvements: While having it effect Protect and Shell boosts is fairly difficult (because to my knowledge default defense is never saved and in the menu stats the increased defense is saved over from the battle stats until the start of the next battle where the battle stats are somehow corrected, but the menu stats are not, therefore finding a default for them seems quite tricky.) We could at least have it normalize speed getting rid of both Haste/Slow effects as all you would need to do is put a 10  (LDA 10, as easy as that) into that. It would probably be best to change the part where it looks and removes Stop's timer to reset Speed.

Are there any other improvements people can think of for Dispel that they think could be usable?
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: chillyfeez on September 15, 2013, 11:47:14 PM
... having it effect Protect and Shell boosts is fairly difficult (because to my knowledge default defense is never saved and in the menu stats the increased defense is saved over from the battle stats until the start of the next battle where the battle stats are somehow corrected, but the menu stats are not, therefore finding a default for them seems quite tricky.)
The (for lack of a better term) permanent stat record for each character is stored in RAM at 1000-113F, each is 40 bytes long. When a battle starts, this is copied into the more-temporary 80 byte record at 2000-227F. So, to remove Protect from the first character (for example), just re-copy 102A to 202A.

As for floating/flying and quake - this works rather unlike other elements. When using a spell or item, the elemental damage check looks for (first) is the target floating, (then) is an item being used, (if so) is it the earth drum, (if not) is the spell quake, titan or monster skill quake - if so, then the damage subroutine is skipped.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Grimoire LD on September 16, 2013, 06:45:16 AM
I had thought the same thing Chillyfeez but a while back when I was experimenting with Bluff I noticed that the stat changes were carried over into the Out-of-Battle menu stats at 1000. You can see this in action as well when you use Protect and Shell your Magic Defense and Defense will be altered outside of battle. This makes using it as a default to reset Protect and Shell as not reliable because each battle that stat could potentially increase since that heightened value isn't overwritten until after the battle. Say Cecil has 20 Defense and Protect adds 5 to Defense, outside of battle this would display 25. Next time you go into battle it would still read 25 in the Outside-of-battle but somehow it will reset properly in battle to what it should be. So you use Dispel on yourself and instead of resetting your Defense to 20 it instead raises it to 25 because of the not-yet reset stat bonuses.


Here's most of Weak's routine. It seems straightforward enough but there are still some things that need to be confirmed and reviewed.
Tornado (Weak) Routine -

Code: [Select]
$03/D453 A2 01 00 LDX #$0001 A:0003 X:0006 Y:0000 P:envMxdizc - Load 01 into X.
$03/D456 A9 09 LDA #$09 A:0003 X:0001 Y:0000 P:envMxdizc - Load 09 into A.
$03/D458 20 79 83 JSR $8379  [$03:8379] A:0009 X:0001 Y:0000 P:envMxdizc (Looks to be a random number generator where it takes the values between 1 and 9 to get their final HP, decided by the first two bytes above. So you can have it give a random value from 1-255.)
$03/8379 E2 10 SEP #$10 A:0009 X:0001 Y:0000 P:envMxdizc ?Set Processor Bits?
$03/837B 86 96 STX $96    [$00:0096] A:0009 X:0001 Y:0000 P:envMXdizc - Store the value in  to x96.
$03/837D E0 FF CPX #$FF A:0009 X:0001 Y:0000 P:envMXdizc - Compare X to ?FF?
$03/837F D0 02 BNE $02    [$8383] A:0009 X:0001 Y:0000 P:envMXdizc - Branch if ?not equal? to 038383.
------------------------------------------------------------------------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------------------------------------------------------------------------
$03/8383 C9 00 CMP #$00 A:0009 X:0001 Y:0000 P:envMXdizc - Compare A to 00.
$03/8385 F0 2F BEQ $2F    [$83B6] A:0009 X:0001 Y:0000 P:envMXdizC - Branch if 00 to 0383B6
$03/8387 C5 96 CMP $96    [$00:0096] A:0009 X:0001 Y:0000 P:envMXdizC - Is it 96?
$03/8389 F0 2B BEQ $2B    [$83B6] A:0009 X:0001 Y:0000 P:envMXdizC - If so branch to 0383B6
$03/838B A6 97 LDX $97    [$00:0097] A:0009 X:0001 Y:0000 P:envMXdizC - Load X into x97.
$03/838D 38 SEC A:0009 X:0049 Y:0000 P:envMXdizC - Clear Carry Flag
$03/838E E5 96 SBC $96    [$00:0096] A:0009 X:0049 Y:0000 P:envMXdizC - Subtract A from the value in 96.
$03/8390 C9 FF CMP #$FF A:0008 X:0049 Y:0000 P:envMXdizC - Compare to FF
$03/8392 D0 05 BNE $05    [$8399] A:0008 X:0049 Y:0000 P:envMXdizc - Branch if it is not FF to 038399
-----------------------------------------------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------------------------------------------
$03/8399 1A INC A A:0008 X:0049 Y:0000 P:envMXdizc - Increment A (how this results in 3, I have no idea, but this is what is saved into HP.)
$03/D45B AA TAX A:0003 X:0000 Y:0000 P:envMxdizc - Transfer A to X.
$03/D45C 86 A9 STX $A9    [$00:00A9] A:0003 X:0003 Y:0000 P:envMxdizc - Store X in A9.
$03/D45E C2 20 REP #$20 A:0003 X:0003 Y:0000 P:envMxdizc - Reset Professor Status (0x20?)
$03/D460 AD 07 27 LDA $2707  [$7E:2707] A:0003 X:0003 Y:0000 P:envmxdizc - Load Target's HP.
$03/D463 C5 A9 CMP $A9    [$00:00A9] A:01F4 X:0003 Y:0000 P:envmxdizc - Compare between the the value in A9.
$03/D465 90 08 BCC $08    [$D46F] A:01F4 X:0003 Y:0000 P:envmxdizC - Branch and carry flag to 03D465 if applicable.
$03/D467 A5 A9 LDA $A9    [$00:00A9] A:01F4 X:0003 Y:0000 P:envmxdizC - Load the 03 from where it was stored.
$03/D469 8D 07 27 STA $2707  [$7E:2707] A:0003 X:0003 Y:0000 P:envmxdizC - Store it in Target's HP.
$03/D46C E2 20 SEP #$20 A:0003 X:0003 Y:0000 P:envmxdizC - Set Processor Status
$03/D46E 60 RTS A:0003 X:0003 Y:0000 P:envMxdizC - Return.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------

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

I'll try to fix this later once I can find out how to get to the branches.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: chillyfeez on September 16, 2013, 07:30:49 AM
I would think, then, that the master stat would be copied to some backup location to be referenced later. The game does this a lot in-battle. Specifically I've noticed it using blocks of RAM in the 00s and the 3000s as placeholders but I'm sure there's more. Probably could be found by setting a breakpoint on reading the 1000-level defense and mag defense stats. I'd bet they copy to the 2000-level locations and somewhere else at the beginning of battle, but maybe the placeholding copy isn't set until armor/shell is cast.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Grimoire LD on September 16, 2013, 10:59:16 AM
Hmm, well here is what I've found so far but its not exactly helpful.

Code: [Select]
$03/9A18 18 CLC A:0017 X:0002 Y:0017 P:eNvMxdIzc - Clear Carry Flag
$03/9A19 B1 82 LDA ($82),y[$7E:2797] A:0017 X:0002 Y:0017 P:eNvMxdIzc Load A from 7E2797 (apparently a 2)
$03/9A1B 65 A9 ADC $A9    [$00:00A9] A:0002 X:0002 Y:0017 P:envMxdIzc - Add the value from A9 (which makes it a 10.)
$03/9A1D 85 A9 STA $A9    [$00:00A9] A:0010 X:0002 Y:0017 P:envMxdIzc - Store A in A9.
$03/9A1F 98 TYA A:0010 X:0002 Y:0017 P:envMxdIzc  - Transfer Y to A.
$03/9A20 18 CLC A:0017 X:0002 Y:0017 P:envMxdIzc - Clear Carry Flag.
$03/9A21 69 0B ADC #$0B A:0017 X:0002 Y:0017 P:envMxdIzc - Add B to A making 22.
$03/9A23 A8 TAY A:0022 X:0002 Y:0017 P:envMxdIzc - Transfer A to Y.
$03/9A24 E8 INX A:0022 X:0002 Y:0022 P:envMxdIzc Increment X.
$03/9A25 E0 03 00 CPX #$0003 A:0022 X:0003 Y:0022 P:envMxdIzc - Compare to X?
$03/9A28 D0 EE BNE $EE    [$9A18] A:0022 X:0003 Y:0022 P:envMxdIZC -  Branch if not equal to 039A18.
$03/9A2A A0 2A 00 LDY #$002A A:0022 X:0003 Y:0022 P:envMxdIZC - Load Y into 2A.
$03/9A2D 18 CLC A:0022 X:0003 Y:002A P:envMxdIzC - Clear Carry Flag.
$03/9A2E A5 A9 LDA $A9    [$00:00A9] A:0022 X:0003 Y:002A P:envMxdIzc - Load the place where 10 was stored.
$03/9A30 6D 6F 39 ADC $396F  [$7E:396F] A:0010 X:0003 Y:002A P:envMxdIzc -  Add to the value in ADC 7E396F (It's 1)
$03/9A33 20 31 9E JSR $9E31  [$03:9E31] A:0011 X:0003 Y:002A P:envMxdIzc - Jump to routine.
-----------------------------------------------------------------------------------------------------------------------------------------------------------
$03/9E31 90 02 BCC $02    [$9E35] A:0011 X:0003 Y:002A P:envMxdIzc - Branch if Carry is Cleared.
$03/9E35 60 RTS A:0011 X:0003 Y:002A P:envMxdIzc Return.
-------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/9A36 91 80 STA ($80),y[$7E:202A] A:0011 X:0003 Y:002A P:envMxdIzc Store A in Defense (11)

So it draws it somehow from somewhere in A9 adding +2 in a completely different place and finally having +1 added from 7E396F.

This seems to be the way all stats are eventually put into the battle stats. One: They're erased. Two: They are overwritten with the stats in 7E1000 and 3 some values are overwritten from the values in this block of code.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Grimoire LD on September 17, 2013, 05:54:52 PM
Effect 06 - Status Routine

Code: [Select]
$03/D515 AD A3 28 LDA $28A3  [$7E:28A3] A:0003 X:000C Y:0000 P:envMxdizc - Load Status to Inflict from 7E28A3.
$03/D518 10 0A BPL $0A    [$D524] A:0004 X:000C Y:0000 P:envMxdizc - Branch if Plus to 03D524. (Death and Curse would be the branch point here)
-----------------------------------------------------------------------------------------------------------------------------------------------
$03/D51A AD 40 27 LDA $2740  [$7E:2740] A:0080 X:000C Y:0000 P:eNvMxdizc - Check Target's Creature Type.
$03/D51D 29 8A AND #$8A A:0000 X:000C Y:0000 P:envMxdiZc - Is it Machine, Spirit, or Undead?
$03/D51F F0 03 BEQ $03    [$D524] A:0000 X:000C Y:0000 P:envMxdiZc - If not, branch to 03D524.
----------------------------------------------------------------------------------------------------------------------------------------------------
$03/D521 4C B2 D5 JMP $D5B2  [$03:D5B2] A:0008 X:000C Y:0000 P:envMxdizc - Jump to 03D5B2 (which leads to a Return)
----------------------------------------------------------------------------------------------------------------------------------------------
$03/D524 AD 03 27 LDA $2703  [$7E:2703] A:0004 X:000C Y:0000 P:envMxdizc - Load Target's Status Byte 1 into A.
$03/D527 85 AC STA $AC    [$00:00AC] A:0000 X:000C Y:0000 P:envMxdiZc - Store Current Status1 in AC.
$03/D529 85 A9 STA $A9    [$00:00A9] A:0000 X:000C Y:0000 P:envMxdiZc - Store Current Status1 in A9.
$03/D52B AD 04 27 LDA $2704  [$7E:2704] A:0000 X:000C Y:0000 P:envMxdiZc - Load Target's Status Byte 2 into A.
$03/D52E 85 AA STA $AA    [$00:00AA] A:0000 X:000C Y:0000 P:envMxdiZc - Store Current Status2 in AA.
$03/D530 29 BF AND #$BF A:0000 X:000C Y:0000 P:envMxdiZc - (-48 meaning it will get rid of ?Charm and Float? Maybe for other purposes, as that doesn't actually happen to the target)
$03/D532 85 AB STA $AB    [$00:00AB] A:0000 X:000C Y:0000 P:envMxdiZc - Store Current Status2 in AB.
$03/D534 AD A3 28 LDA $28A3  [$7E:28A3] A:0000 X:000C Y:0000 P:envMxdiZc - Load Status to inflict from 7E28A3.
$03/D537 85 AE STA $AE    [$00:00AE] A:0004 X:000C Y:0000 P:envMxdizc - Store it in AE.
$03/D539 AD A4 28 LDA $28A4  [$7E:28A4] A:0004 X:000C Y:0000 P:envMxdizc - Load Second Status to Inflict from 7E28A4.
$03/D53C 85 AD STA $AD    [$00:00AD] A:0000 X:000C Y:0000 P:envMxdiZc - Store it in AD.
$03/D53E C2 20 REP #$20 A:0000 X:000C Y:0000 P:envMxdiZc - Reset Processor.
$03/D540 A5 AB LDA $AB    [$00:00AB] A:0000 X:000C Y:0000 P:envmxdiZc - Load Current Status2 from AB.
$03/D542 C5 AD CMP $AD    [$00:00AD] A:0000 X:000C Y:0000 P:envmxdiZc - Compare it to Second Status to inflict from AD.
$03/D544 90 06 BCC $06    [$D54C] A:0000 X:000C Y:0000 P:eNvmxdizc - If equal, branch to 03D54C.
---------------------------------------------------------------------------------------------------------------------------------
(Appears to be the Miss or Resist Routine?)
$03/D546 7B TDC A:0400 X:000C Y:0000 P:envmxdizC -Transfer Direct Page to A?
$03/D547 E2 20 SEP #$20 A:0000 X:000C Y:0000 P:envmxdiZC - Set Processor Status.
$03/D549 4C B2 D5 JMP $D5B2  [$03:D5B2] A:0000 X:000C Y:0000 P:envMxdiZC - Jump to 03D5B2.
-----------------------------------------------------------------------------------------------------------------------------------
$03/D54C 7B TDC A:0000 X:000C Y:0000 P:eNvmxdizc - Transfer Direct Page to A?
$03/D54D E2 20 SEP #$20 A:0000 X:000C Y:0000 P:envmxdiZc  - Set Processor Status.
$03/D54F AD 2B 27 LDA $272B  [$7E:272B] A:0000 X:000C Y:0000 P:envMxdiZc - Load Target's Status Immunity1 into A.
$03/D552 2D A3 28 AND $28A3  [$7E:28A3] A:00B9 X:000C Y:0000 P:eNvMxdizc - Check it against Status to Inflict1.
$03/D555 D0 06 BNE $06    [$D55D] A:0000 X:000C Y:0000 P:envMxdiZc - If bits aligned branch to 03D55D.
$03/D557 AD 2C 27 LDA $272C  [$7E:272C] A:0000 X:000C Y:0000 P:envMxdiZc - Load Target's Status Immunity2 into A.
$03/D55A 2D A4 28 AND $28A4  [$7E:28A4] A:0030 X:000C Y:0000 P:envMxdizc - Check it against Status to Inflict2.
$03/D55D D0 53 BNE $53    [$D5B2] A:0000 X:000C Y:0000 P:envMxdiZc - If bits aligned branch to 03D5B2.
$03/D55F AD 03 27 LDA $2703  [$7E:2703] A:0000 X:000C Y:0000 P:envMxdiZc - Load Target's Status Byte 1 into A.
$03/D562 05 AE ORA $AE    [$00:00AE] A:0000 X:000C Y:0000 P:envMxdiZc - Somehow adds the Stored Status to inflict from AE.
$03/D564 8D 03 27 STA $2703  [$7E:2703] A:0004 X:000C Y:0000 P:envMxdizc - Store A in Target's Status Byte 1.
$03/D567 AD 04 27 LDA $2704  [$7E:2704] A:0004 X:000C Y:0000 P:envMxdizc - Load Target's Status Byte 2 into A.
$03/D56A 05 AD ORA $AD    [$00:00AD] A:0000 X:000C Y:0000 P:envMxdiZc - Somehow adds the Stored Status2 to inflict from AD.
$03/D56C 8D 04 27 STA $2704  [$7E:2704] A:0000 X:000C Y:0000 P:envMxdiZc - Store A in Target's Status Byte 2.
$03/D56F AD A4 28 LDA $28A4  [$7E:28A4] A:0000 X:000C Y:0000 P:envMxdiZc - Load A from Status to Inflict2.
$03/D572 29 28 AND #$28 A:0000 X:000C Y:0000 P:envMxdiZc - Is it Charm or Paralyze
$03/D574 F0 3A BEQ $3A    [$D5B0] A:0000 X:000C Y:0000 P:envMxdiZc - Branch if not to 03D5B0.
--------------------------------------------------------------------------------------------------------------------------------------------
$03/D576 AD 04 27 LDA $2704  [$7E:2704] A:0008 X:000C Y:0000 P:envMxdizc - Load A from Target's Status Byte 2.
$03/D579 29 FB AND #$FB A:000C X:000C Y:0000 P:envMxdizc - ?? (-4 somehow?) Replaces Berserk with Charm.
$03/D57B 8D 04 27 STA $2704  [$7E:2704] A:0008 X:000C Y:0000 P:envMxdizc  - Store A in Target's Status Byte 2.
$03/D57E A5 CF LDA $CF    [$00:00CF] A:0008 X:000C Y:0000 P:envMxdizc - Load CF into A.
$03/D580 85 DF STA $DF    [$00:00DF] A:0008 X:000C Y:0000 P:envMxdizc - Store A in DF.
$03/D582 A9 15 LDA #$15 A:0008 X:000C Y:0000 P:envMxdizc - Load 15 into A.
$03/D584 85 E1 STA $E1    [$00:00E1] A:0015 X:000C Y:0000 P:envMxdizc - Store A in E1.
$03/D586 20 E0 83 JSR $83E0  [$03:83E0] A:0015 X:000C Y:0000 P:envMxdizc - Jump to Subroutine.
$03/D589 A6 E3 LDX $E3    [$00:00E3] A:0000 X:0000 Y:0000 P:envMxdiZc - Load the value in E3 into X.
$03/D58B 8E 30 35 STX $3530  [$7E:3530] A:0000 X:00A8 Y:0000 P:envMxdizc - Store X in 7E3530.
$03/D58E A9 03 LDA #$03 A:0000 X:00A8 Y:0000 P:envMxdizc - Load 03 into A.
$03/D590 20 69 85 JSR $8569  [$03:8569] A:0003 X:00A8 Y:0000 P:envMxdizc - Jump to Subroutine.
$03/D596 AD 04 27 LDA $2704  [$7E:2704] A:0000 X:00AB Y:0000 P:envMxdizc - Target's Status Byte 2.
$03/D599 29 20 AND #$20 A:0008 X:00AB Y:0000 P:envMxdizc - Is it Paralyze?
$03/D59B F0 13 BEQ $13    [$D5B0] A:0000 X:00AB Y:0000 P:envMxdiZc - If not branch to 03D5B0
-----------------------------------------------------------------------------------------------------------------------
$03/D59D AD 04 27 LDA $2704  [$7E:2704] A:0020 X:00AB Y:FFFF P:envMxdizc - Load Target's Status Byte 2.
$03/D5A0 29 F7 AND #$F7 A:0020 X:00AB Y:FFFF P:envMxdizc - Get rid of Charm, if affecting Target.
$03/D5A2 8D 04 27 STA $2704  [$7E:2704] A:0020 X:00AB Y:FFFF P:envMxdizc - Store Paralyze in Status Byte 2.
$03/D5A5 A9 01 LDA #$01 A:0020 X:00AB Y:FFFF P:envMxdizc - Load 01 into A.
$03/D5A7 9D 04 2A STA $2A04,x[$7E:2AAF] A:0001 X:00AB Y:FFFF P:envMxdizc - Store in 7E2A04
$03/D5AA 9E 05 2A STZ $2A05,x[$7E:2AB0] A:0001 X:00AB Y:FFFF P:envMxdizc - Store Zero in 7E2A05.
$03/D5AD 9E 06 2A STZ $2A06,x[$7E:2AB1] A:0001 X:00AB Y:FFFF P:envMxdizc - Store Zero in 7E2A06
-----------------------------------------------------------------------------------------------------------------------
$03/D5B0 80 03 BRA $03    [$D5B5] A:0000 X:00AB Y:0000 P:envMxdiZc - Always Branch to 03D5B5.
--------------------------------------------------------------------------------------------------------------------------------------------
$03/D5B2 20 2D E0 JSR $E02D  [$03:E02D] A:0000 X:000C Y:0000 P:envMxdiZC - Jump to Subroutine
------------------------------------------------------------------------------------------------------------------------------------------
$03/D5B5 60 RTS A:0000 X:000C Y:0000 P:envMxdiZc - Return.


Now this is strange. As far as I can see and from my own tests there is nothing that prevents this from working on any specific monster type. Mute, Charm, Berserk, Float works perfectly fine on Zombie-type, Machine-type,  and Spirits. They all use the formula that says it shouldn't work on them. The only thing I can think of is that Yousei may have looked at the start of the data, not paying attention that this only occurs if the status to inflict is Death or Curse.
So this...

    06 status: various, does not affect spirits, undead, or machines

Is debunked. It works on anything that doesn't resist it.

However the purpose of the separate routine for statuses with timers make sense as this formula does not appear to have any safety drop for them. Even its special coding for Paralyze doesn't work (do I foresee some Free Code in our future?) the enemy will never properly recover from Paralyze when used from this routine. That is a freed up 19 bytes for us to use if we ever wanted to add something else special to the Status Routine. Even the Creature Type check at the start is rather redundant as you can set it easily enough in the monster's individual status, freeing up even more bytes.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Grimoire LD on September 17, 2013, 07:21:14 PM
07 Immobilizing Routine

Code: [Select]
$03/D5B6 A9 04 LDA #$04 A:0003 X:000E Y:FFFF P:envMxdizc - Load 04 into A.
$03/D5B8 85 D6 STA $D6    [$00:00D6] A:0004 X:000E Y:FFFF P:envMxdizc - Store A in D6.
$03/D5BA A5 CF LDA $CF    [$00:00CF] A:0004 X:000E Y:FFFF P:envMxdizc - Load A from CF.
$03/D5BC 20 36 9E JSR $9E36  [$03:9E36] A:0008 X:000E Y:FFFF P:envMxdizc - Jump to Subroutine.
$03/D5BF A9 03 LDA #$03 A:0000 X:0029 Y:0029 P:envMxdizc - Load 03 into A.
$03/D5C1 20 69 85 JSR $8569  [$03:8569] A:0003 X:0029 Y:0029 P:envMxdizc - Jump to Subroutine.
$03/D5C4 AE 98 35 LDX $3598  [$7E:3598] A:0000 X:0029 Y:0029 P:envMxdiZc - Load X from 7E3598.
$03/D5C7 BD 06 2A LDA $2A06,x[$7E:2AB1] A:0000 X:00AB Y:0029 P:envMxdizc - Load A from 7E2AB1.
$03/D5CA D0 29 BNE $29    [$D5F5] A:0000 X:00AB Y:0029 P:envMxdiZc - Seems to pass because it reads 00 so it is considered Equal, if not equal branch to 03D5F5.
$03/D5CC AD 2C 27 LDA $272C  [$7E:272C] A:0000 X:00AB Y:0029 P:envMxdiZc - Load Target's Status Immunity 2.
$03/D5CF 2D A4 28 AND $28A4  [$7E:28A4] A:0000 X:00AB Y:0029 P:envMxdiZc - Is it the same as the Second Status to Inflict?
$03/D5D2 D0 21 BNE $21    [$D5F5] A:0000 X:00AB Y:0029 P:envMxdiZc - If not branch to 03D5F5.
$03/D5D4 AD 03 27 LDA $2703  [$7E:2703] A:0000 X:00AB Y:0029 P:envMxdiZc - Load Target's Status Byte 1.
$03/D5D7 85 AC STA $AC    [$00:00AC] A:0000 X:00AB Y:0029 P:envMxdiZc - Store it in AC.
$03/D5D9 AD 04 27 LDA $2704  [$7E:2704] A:0000 X:00AB Y:0029 P:envMxdiZc - Load Target's Status Byte 2.
$03/D5DC 29 BF AND #$BF A:0000 X:00AB Y:0029 P:envMxdiZc - Ignore Flying or Charm
$03/D5DE 85 AB STA $AB    [$00:00AB] A:0000 X:00AB Y:0029 P:envMxdiZc - Store it in AB.
$03/D5E0 AD A3 28 LDA $28A3  [$7E:28A3] A:0000 X:00AB Y:0029 P:envMxdiZc - Load Status to Inflict 1 into A.
$03/D5E3 85 AE STA $AE    [$00:00AE] A:0000 X:00AB Y:0029 P:envMxdiZc - Store it in AE.
$03/D5E5 AD A4 28 LDA $28A4  [$7E:28A4] A:0000 X:00AB Y:0029 P:envMxdiZc - Load Status to Inflict 2 into A.
$03/D5E8 85 AD STA $AD    [$00:00AD] A:0020 X:00AB Y:0029 P:envMxdizc - Store it in AD.
$03/D5EA C2 20 REP #$20 A:0020 X:00AB Y:0029 P:envMxdizc - Reset Processor Status.
$03/D5EC A5 AB LDA $AB    [$00:00AB] A:0020 X:00AB Y:0029 P:envmxdizc Load Target's Status Byte 2 (after Charm and Flying have been removed) into A.
$03/D5EE C5 AD CMP $AD    [$00:00AD] A:0000 X:00AB Y:0029 P:envmxdiZc - Compare it to Status Byte 2.
$03/D5F0 90 06 BCC $06    [$D5F8] A:0000 X:00AB Y:0029 P:eNvmxdizc - If equal, branch to 03D5F8.
------------------------------------------------------------------------------------------------------------------------------------------------------

-----------------------------------------------------------------------------------------------------------------------------------------------------
$03/D5F8 A5 CE LDA $CE    [$00:00CE] A:0000 X:00AB Y:0029 P:eNvmxdizc - Load A from CE.
$03/D5FA 10 08 BPL $08    [$D604] A:0883 X:00AB Y:0029 P:envmxdizc - Branch if Plus to 03D604.
$03/D604 7B TDC A:0883 X:00AB Y:0029 P:envmxdizc - Transfer Direct Page into A.
$03/D605 E2 20 SEP #$20 A:0000 X:00AB Y:0029 P:envmxdiZc - Set Processor Status.
$03/D607 AD 04 27 LDA $2704  [$7E:2704] A:0000 X:00AB Y:0029 P:envMxdiZc - Load A from Target's Status Byte 2.
$03/D60A 0D A4 28 ORA $28A4  [$7E:28A4] A:0000 X:00AB Y:0029 P:envMxdiZc - Add the value from Status to Inflict 2.
$03/D60D 8D 04 27 STA $2704  [$7E:2704] A:0020 X:00AB Y:0029 P:envMxdizc - Store it in Target's Status Byte 2.
$03/D610 AE 98 35 LDX $3598  [$7E:3598] A:0020 X:00AB Y:0029 P:envMxdizc - Load X from 7E3598.
$03/D613 A5 D4 LDA $D4    [$00:00D4] A:0020 X:00AB Y:0029 P:envMxdizc - Load A from D4.
$03/D615 9D 04 2A STA $2A04,x[$7E:2AAF] A:0029 X:00AB Y:0029 P:envMxdizc - Store A in to Character's Speed Record.
$03/D618 A5 D5 LDA $D5    [$00:00D5] A:0029 X:00AB Y:0029 P:envMxdizc - Load A from D5.
$03/D61A 9D 05 2A STA $2A05,x[$7E:2AB0] A:0000 X:00AB Y:0029 P:envMxdiZc - Store A in Character's Speed Record 2.
$03/D61D A9 40 LDA #$40 A:0000 X:00AB Y:0029 P:envMxdiZc - Load a 40 into A.
$03/D61F 9D 06 2A STA $2A06,x[$7E:2AB1] A:0040 X:00AB Y:0029 P:envMxdizc - Store A in 7E2AB1.
$03/D622 60 RTS A:0040 X:00AB Y:0029 P:envMxdizc - Return.

So from what we've seen above there is no formulaic difference between Sleep and Hold's literal statuses. They both have a stunning duration of 29. The only difference is one's ability to hit with Hold is Will based where as hitting with Sleep is Wisdom based and that's to do with their positions in the lists rather than anything else.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Grimoire LD on September 17, 2013, 07:57:25 PM
09 Wall Routine

Code: [Select]
$03/D62C AD 06 27 LDA $2706  [$7E:2706] A:0003 X:0012 Y:0000 P:envMxdizc - Load Target's Status Byte 4.
$03/D62F 0D A4 28 ORA $28A4  [$7E:28A4] A:0000 X:0012 Y:0000 P:envMxdiZc - Add Reflect to it.
$03/D632 8D 06 27 STA $2706  [$7E:2706] A:0020 X:0012 Y:0000 P:envMxdizc - Store Reflect in Target's Status Byte 4.
$03/D635 AD 9D 28 LDA $289D  [$7E:289D] A:0020 X:0012 Y:0000 P:envMxdizc - Load 7E289D into A.
$03/D638 8D 7B 39 STA $397B  [$7E:397B] A:0000 X:0012 Y:0000 P:envMxdiZc - Store A in 7E397B.
$03/D63B A9 08 LDA #$08 A:0000 X:0012 Y:0000 P:envMxdiZc - Load 08 into A.
$03/D63D 85 D6 STA $D6    [$00:00D6] A:0008 X:0012 Y:0000 P:envMxdizc - Store A in D6.
$03/D63F A5 CF LDA $CF    [$00:00CF] A:0008 X:0012 Y:0000 P:envMxdizc - Load A from CF.
$03/D641 20 36 9E JSR $9E36  [$03:9E36] A:0000 X:0012 Y:0000 P:envMxdiZc - Jump to Subroutine.
$03/D644 A9 0F LDA #$0F A:0000 X:001E Y:001E P:envMxdizc - Load 0F into A.
$03/D646 20 C8 85 JSR $85C8  [$03:85C8] A:000F X:001E Y:001E P:envMxdizc - Jump to Subroutine.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
(There's a lot of mostly useless stuff in here, but this part is useful for our needs.)

$03/9F34 69 1E ADC #$1E A:0000 X:0300 Y:0010 P:envMxdiZc - Add 1E to A. 1E is the timer of Wall. (Then stored in A9)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/D649 A9 40 LDA #$40 A:0000 X:000F Y:001E P:envMxdiZc - Load 40 into A.
$03/D64B 9D 06 2A STA $2A06,x[$7E:2A15] A:0040 X:000F Y:001E P:envMxdizc - Store A in 7E2A15
$03/D64E A5 CF LDA $CF    [$00:00CF] A:0040 X:000F Y:001E P:envMxdizc - Load A from CF.
$03/D650 0A ASL A A:0000 X:000F Y:001E P:envMxdiZc - Divide A by 2.
$03/D651 AA TAX A:0000 X:000F Y:001E P:envMxdiZc - Transfer A to X.
$03/D652 BD EB 29 LDA $29EB,x[$7E:29EB] A:0000 X:0000 Y:001E P:envMxdiZc - Load A from 7E29EB.
$03/D655 09 04 ORA #$04 A:0040 X:0000 Y:001E P:envMxdizc - Add 04.
$03/D657 9D EB 29 STA $29EB,x[$7E:29EB] A:0044 X:0000 Y:001E P:envMxdizc Store A in 7E29EB.
$03/D65A 60 RTS A:0044 X:0000 Y:001E P:envMxdizc

Well that was interesting. So in one of these Dreadfully Dull looping jumps it eventually breaks out of it to show the timer for Wall. I should go back and see if I can't find the timer for Sleep/Paralyze in that case.

 :edit: No, I cannot. It is so deeply buried it seems that I can barely even find when it changes. It's in the middle somewhere of the looping portions that I can't seem to locate it.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Deathlike2 on September 18, 2013, 01:13:39 AM
Effect 06 - Status Routine

Now this is strange. As far as I can see and from my own tests there is nothing that prevents this from working on any specific monster type. Mute, Charm, Berserk, Float works perfectly fine on Zombie-type, Machine-type,  and Spirits. They all use the formula that says it shouldn't work on them. The only thing I can think of is that Yousei may have looked at the start of the data, not paying attention that this only occurs if the status to inflict is Death or Curse.
So this...

    06 status: various, does not affect spirits, undead, or machines

Is debunked. It works on anything that doesn't resist it.

I remember Phoenix mentioning Death as the natural immunity based on the creature type property. Curse was not mentioned, but that probably isn't too farfetched though.

With respect to "various stats", I don't think that was the intended description you are trying to get from it.

If you ever used lightning on some of the "machines" in this game, the monsters themselves have special code that operates based on a reaction to lightning, generally causing them to hur themselves at random, despite not having a Charm status.

The early monsters Spirits and Souls (and Ghost, I think) stop attacking you when hit with Ice. The IceRod with Rydia will allow you to test this...

Although... as I'm reading it, I think "Charm+Float" has more to do with the visual aspect. Float has its own set of odd bugs (being crit is one) and a Charmed character under float visually removes Float. It doesn't remove Float status though.

Quote
However the purpose of the separate routine for statuses with timers make sense as this formula does not appear to have any safety drop for them. Even its special coding for Paralyze doesn't work (do I foresee some Free Code in our future?) the enemy will never properly recover from Paralyze when used from this routine. That is a freed up 19 bytes for us to use if we ever wanted to add something else special to the Status Routine. Even the Creature Type check at the start is rather redundant as you can set it easily enough in the monster's individual status, freeing up even more bytes.

There is a reason why I've put in the fun bug report about Paralysis and Stop. Stop is a lot more gamebreaking than anything.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Grimoire LD on September 18, 2013, 12:59:52 PM
I was wrong. I thought the Status to Inflict was sequential, one after the other, but it's not. It's set by the byte it will occupy. So you and Phoenix were correct. Curse is not considered in the check (I just tested it) because it is considered the second byte.

I know what you mean by special attributes. It's written into their AI Codes rather than their initial data or formulaic manner. The Charm and Float subtracting check seems to take those two status away from consideration. As not to touch them in the final equation, (the end result will be added onto them if applicable). At least as far as I can make out.


As the Heal Routine for some reason appears to be over 200 bytes long... I'm going to skip that one for now (I can't see gleaning anywhere near as useful information from that as I did with the normal attack routine) and go to the Shape Changing Routine which is a fair amount more compact.

Shape Changing Routine

Code: [Select]
$03/D82A AD 2B 27 LDA $272B  [$7E:272B] A:0003 X:0018 Y:0000 P:envMxdizc - Load Target's Status Immunity 1.
$03/D82D 2D A3 28 AND $28A3  [$7E:28A3] A:0030 X:0018 Y:0000 P:envMxdizc - Check it against Status to Inflict 1.
$03/D830 D0 10 BNE $10    [$D842] A:0000 X:0018 Y:0000 P:envMxdiZc - Branch if equal to 03D842.
$03/D832 AD 03 27 LDA $2703  [$7E:2703] A:0000 X:0018 Y:0000 P:envMxdiZc - Load Target's Status Byte 1.
$03/D835 2D A3 28 AND $28A3  [$7E:28A3] A:0000 X:0018 Y:0000 P:envMxdiZc - Check it against Status to Inflict 1.
$03/D838 D0 0B BNE $0B    [$D845] A:0000 X:0018 Y:0000 P:envMxdiZc - If equal go to 03D845.
$03/D83A AD 03 27 LDA $2703  [$7E:2703] A:0000 X:0018 Y:0000 P:envMxdiZc - Load Target's Status Byte 1.
$03/D83D CD A3 28 CMP $28A3  [$7E:28A3] A:0000 X:0018 Y:0000 P:envMxdiZc - Compare it against Status to Inflict 1.
$03/D840 90 03 BCC $03    [$D845] A:0000 X:0018 Y:0000 P:eNvMxdizc - If they are not the same go to 03D845.
------------------------------------------------------------------------------------------------------------------------------
$03/D842 4C 2D E0 JMP $E02D  [$03:E02D] A:0008 X:0018 Y:0000 P:envMxdizc - Jump to Subroutine (which eventually Returns on its own accord out of the Routines)
-------------------------------------------------------------------------------------------------------------------------------
$03/D845 AD 03 27 LDA $2703  [$7E:2703] A:0000 X:0018 Y:0000 P:eNvMxdizc  - Load Target's Status Byte 1.
$03/D848 4D A3 28 EOR $28A3  [$7E:28A3] A:0000 X:0018 Y:0000 P:envMxdiZc - ?Exclusive Or... something... or other. Just adding Status if applicable.
$03/D84B 8D 03 27 STA $2703  [$7E:2703] A:0008 X:0018 Y:0000 P:envMxdizc -  Store A in Target's Status Byte 1.
$03/D84E 60 RTS A:0008 X:0018 Y:0000 P:envMxdizc - Return

Well. That was much simpler than I anticipated. No graphics data or anything in there apparently though.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Grimoire LD on September 23, 2013, 10:59:24 AM
Protect Routine

Code: [Select]
$03/D84F AD 2A 27 LDA $272A  [$7E:272A] A:0003 X:001A Y:0000 P:envMxdizc - Load Target's Physical Defense Base into A.
$03/D852 C9 FF CMP #$FF A:0011 X:001A Y:0000 P:envMxdizc - Is it FF?
$03/D854 D0 03 BNE $03    [$D859] A:0011 X:001A Y:0000 P:envMxdizc - If not branch to 03D859
-------------------------------------------------------------------------------------------------------------------------------------------
$03/D856 4C 2D E0 JMP $E02D  [$03:E02D] A:00FF X:001A Y:0000 P:envMxdiZC - Jump to Magic Fail Routine.
-----------------------------------------------------------------------------------------------------------------------------------------
$03/D859 AD 00 18 LDA $1800  [$7E:1800] A:0011 X:001A Y:0000 P:envMxdizc - Load Current Encounter
$03/D85C C9 B7 CMP #$B7 A:0004 X:001A Y:0000 P:envMxdizc - Is it Zeromus?
$03/D85E D0 05 BNE $05    [$D865] A:0004 X:001A Y:0000 P:envMxdizc - If not branch to 03D865 (This is what Phoenix must have been referring to)
------------------------------------------------------------------------------------------------------------------------------------------------
$03/D860 AD 01 18 LDA $1801  [$7E:1801] A:00B7 X:001A Y:0000 P:envMxdiZC - Load Current Encounter Byte 2.
$03/D863 D0 0D BNE $0D    [$D872] A:0000 X:001A Y:0000 P:envMxdiZC - If it is 01 (causing the flag to activate) branch to 03D872.
----------------------------------------------------------------------------------------------------------------------------------------------
$03/D865 18 CLC A:0004 X:001A Y:0000 P:envMxdizc - Clear Carry Flag
$03/D866 AD 2A 27 LDA $272A  [$7E:272A] A:0004 X:001A Y:0000 P:envMxdizc - Load Target's Physical Defense Base into A.
$03/D869 69 05 ADC #$05 A:0011 X:001A Y:0000 P:envMxdizc - Add 05 to A.
$03/D86B 90 02 BCC $02    [$D86F] A:0016 X:001A Y:0000 P:envMxdizc - Branch if Carry is Clear to 03D86F.
----------------------------------------------------------------------------------------------------------------------------------------------------------
(Not sure how to get there.)
-----------------------------------------------------------------------------------------------------------------------------------------------------------
$03/D86F 8D 2A 27 STA $272A  [$7E:272A] A:0016 X:001A Y:0000 P:envMxdizc - Store A in Target's Physical Defense Base.
$03/D872 60 RTS A:0016 X:001A Y:0000 P:envMxdizc - Return

Shell Routine

Code: [Select]
$03/D873 AD 24 27 LDA $2724  [$7E:2724] A:0003 X:001C Y:0000 P:envMxdizc - Load Target's Magic Defense Base into A.
$03/D876 C9 FF CMP #$FF A:0010 X:001C Y:0000 P:envMxdizc - Is it FF?
$03/D878 D0 03 BNE $03    [$D87D] A:0010 X:001C Y:0000 P:envMxdizc - If not branch to 03D87D
--------------------------------------------------------------------------------------------------------------------------
(Covered Above)
----------------------------------------------------------------------------------------------------------------------------
$03/D87D AD 00 18 LDA $1800  [$7E:1800] A:0010 X:001C Y:0000 P:envMxdizc - Load Current encounter
$03/D880 C9 B7 CMP #$B7 A:00B7 X:001C Y:0000 P:eNvMxdizc - Is it Zeromus?
$03/D882 D0 05 BNE $05    [$D889] A:00B7 X:001C Y:0000 P:envMxdiZC - If not branch to 03D889.
----------------------------------------------------------------------------------------------------------------------------------------------
(Covered Above)
-------------------------------------------------------------------------------------------------------------------------------------------------
$03/D889 18 CLC A:0000 X:001C Y:0000 P:envMxdiZC - Clear Carry Flag.
$03/D88A AD 24 27 LDA $2724  [$7E:2724] A:0000 X:001C Y:0000 P:envMxdiZc - Load Target's Magic Defense Base.
$03/D88D 69 03 ADC #$03 A:0010 X:001C Y:0000 P:envMxdizc - Add 03 to A.
$03/D88F 90 02 BCC $02    [$D893] A:0013 X:001C Y:0000 P:envMxdizc - Branch if Carry Flag is clear to 03D88F.
$03/D893 8D 24 27 STA $2724  [$7E:2724] A:0013 X:001C Y:0000 P:envMxdizc - Store A in Target's Magic Defense Base.
$03/D896 60 RTS A:0013 X:001C Y:0000 P:envMxdizc - Return


Not many surprises here. Simple confirmation of what Phoenix said a long time ago about being unable to use Protect and Shell to increase defense if in the Zeromus encounter. Aside from that everything else there is pretty par for the course.

As noted before in another thread you can easily change what Protect and Shell increases (or sets if you change the LDA to something else entirely if you want to have a Mage character load their Wisdom or Will into it or something (if such is the case you may even want to change the ADC into a ASL to double it since 99 Defense at the end game is probably weaker than what they currently have on)

As mentioned before elsewhere you could even recreate TMPR (Temper) from FFI (No, I don't mean a broken spell! I mean its intended effect.) to look at 271B and add +1 to that on each cast.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Grimoire LD on September 23, 2013, 11:36:13 AM
Stop Routine

Code: [Select]
$03/D8EE AD 05 27 LDA $2705  [$7E:2705] A:0003 X:0022 Y:0000 P:envMxdizc - Load Target's Status Byte 3 into A.
$03/D8F1 09 40 ORA #$40 A:0000 X:0022 Y:0000 P:envMxdiZc - Add 40 to its value (Stop)
$03/D8F3 8D 05 27 STA $2705  [$7E:2705] A:0040 X:0022 Y:0000 P:envMxdizc - Store it in Target's Status Byte 3.
$03/D8F6 AD 9D 28 LDA $289D  [$7E:289D] A:0040 X:0022 Y:0000 P:envMxdizc - Load 40 from 7E289D (likely something related to stop)
$03/D8F9 8D 7B 39 STA $397B  [$7E:397B] A:000A X:0022 Y:0000 P:envMxdizc - Store A in 7E397B
$03/D8FC A9 0A LDA #$0A A:000A X:0022 Y:0000 P:envMxdizc - Load 0A into A.
$03/D8FE 85 D6 STA $D6    [$00:00D6] A:000A X:0022 Y:0000 P:envMxdizc - Store A in D6.
$03/D900 A5 CF LDA $CF    [$00:00CF] A:000A X:0022 Y:0000 P:envMxdizc - Load A from CF.
$03/D902 20 36 9E JSR $9E36  [$03:9E36] A:0007 X:0022 Y:0000 P:envMxdizc - Jump to Subroutine.
$03/D905 AE 30 35 LDX $3530  [$7E:3530] A:0000 X:001E Y:001E P:envMxdizc - Load the value in 7E3530 into X.
$03/D908 A5 D4 LDA $D4    [$00:00D4] A:0000 X:0093 Y:001E P:envMxdizc - Load A from D4.
$03/D90A 9D 04 2A STA $2A04,x[$7E:2A97] A:001E X:0093 Y:001E P:envMxdizc - Store A in Slot's Timer
$03/D90D A5 D5 LDA $D5    [$00:00D5] A:001E X:0093 Y:001E P:envMxdizc - Load A from D5.
$03/D90F 9D 05 2A STA $2A05,x[$7E:2A98] A:0000 X:0093 Y:001E P:envMxdiZc - Store A in Slot's Timer (2).
$03/D912 A9 40 LDA #$40 A:0000 X:0093 Y:001E P:envMxdiZc - Load 40 (Stop) into A.
$03/D914 9D 06 2A STA $2A06,x[$7E:2A99] A:0040 X:0093 Y:001E P:envMxdizc - Store A in Slot's Status to Remove after Timer elapses?
$03/D917 A5 CF LDA $CF    [$00:00CF] A:0040 X:0093 Y:001E P:envMxdizc - Load A from CF.
$03/D919 0A ASL A A:0007 X:0093 Y:001E P:envMxdizc - Multiply A.
$03/D91A AA TAX A:000E X:0093 Y:001E P:envMxdizc - Transfer A to X.
$03/D91B BD EB 29 LDA $29EB,x[$7E:29F9] A:000E X:000E Y:001E P:envMxdizc - Load A from Slot's current Statuses.
$03/D91E 09 80 ORA #$80 A:0040 X:000E Y:001E P:envMxdizc - Add 80 to A.
$03/D920 9D EB 29 STA $29EB,x[$7E:29F9] A:00C0 X:000E Y:001E P:eNvMxdizc - Store A in Slot's Current Statuses.
$03/D923 60 RTS A:00C0 X:000E Y:001E P:eNvMxdizc - Return

This is an interesting bit of information. How this appears to work is that it loads Stop and its compatriot parts into a timer. What is most intriguing about this is we now know that Stop is measured in increments of 3. Stop's initial power is 10. This makes it last for 1E or 30 ticks. Where as the power of the Golden Hourglass is 200 making it worth 600 ticks.

Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Grimoire LD on September 23, 2013, 01:38:23 PM
Peep Routine

Code: [Select]
$03/D924 AD 00 18 LDA $1800  [$7E:1800] A:0003 X:0024 Y:0000 P:envMxdizc - Load Current Encounter
$03/D927 C9 B7 CMP #$B7 A:0010 X:0024 Y:0000 P:envMxdizc - Is it Zeromus?
$03/D929 D0 08 BNE $08    [$D933] A:0010 X:0024 Y:0000 P:envMxdizc - If not branch to 03D933
-------------------------------------------------------------------------------------------------------------------------------------------

-------------------------------------------------------------------------------------------------------------------------------------------
$03/D933 C2 20 REP #$20 A:0010 X:0024 Y:0000 P:envMxdizc - Reset Processor Status
$03/D935 AD 07 27 LDA $2707  [$7E:2707] A:0010 X:0024 Y:0000 P:envmxdizc - Load Target's HP into A
$03/D938 8D 9A 35 STA $359A  [$7E:359A] A:01F4 X:0024 Y:0000 P:envmxdizc - Store Target's HP in 7E359A (presumably a place to read from later)
$03/D93B AD 09 27 LDA $2709  [$7E:2709] A:01F4 X:0024 Y:0000 P:envmxdizc - Load Target's Max HP into A.
$03/D93E 8D 9D 35 STA $359D  [$7E:359D] A:01F4 X:0024 Y:0000 P:envmxdizc - Store Target's Max HP in 7E359D.
$03/D941 7B TDC A:01F4 X:0024 Y:0000 P:envmxdizc - Transfer Direct Page
$03/D942 E2 20 SEP #$20 A:0000 X:0024 Y:0000 P:envmxdiZc - Set Processor Status
$03/D944 9C 9C 35 STZ $359C  [$7E:359C] A:0000 X:0024 Y:0000 P:envMxdiZc - Store Zero in 7E359C.
$03/D947 9C 9F 35 STZ $359F  [$7E:359F] A:0000 X:0024 Y:0000 P:envMxdiZc - Store Zero in 7E359F.
$03/D94A AD 20 27 LDA $2720  [$7E:2720] A:0000 X:0024 Y:0000 P:envMxdiZc - Load Target's Elemental Weaknesses.
$03/D94D 2D 25 27 AND $2725  [$7E:2725] A:0010 X:0024 Y:0000 P:envMxdizc - ?And Elemental Defense?
$03/D950 49 FF EOR #$FF A:0000 X:0024 Y:0000 P:envMxdiZc - Exclusive Or Accumulator?
$03/D952 2D 20 27 AND $2720  [$7E:2720] A:00FF X:0024 Y:0000 P:eNvMxdizc - And Target's Elemental Weaknesses.
$03/D955 29 3F AND #$3F A:0010 X:0024 Y:0000 P:envMxdizc - ?And 3F?
$03/D957 85 A9 STA $A9    [$00:00A9] A:0010 X:0024 Y:0000 P:envMxdizc - Store A in A9.
$03/D959 D0 07 BNE $07    [$D962] A:0010 X:0024 Y:0000 P:envMxdizc - Branch if flag is not set to 03D962.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/D962 7B TDC A:0010 X:0024 Y:0000 P:envMxdizc - Tranfer Direct Page
$03/D963 AA TAX A:0000 X:0024 Y:0000 P:envMxdiZc - Transfer A to X.
$03/D964 A8 TAY A:0000 X:0000 Y:0000 P:envMxdiZc - Transfer A to Y.
$03/D965 46 A9 LSR $A9    [$00:00A9] A:0000 X:0000 Y:0000 P:envMxdiZc - Divide the value in A9 by 2.
$03/D967 90 08 BCC $08    [$D971] A:0000 X:0000 Y:0000 P:envMxdizc - Branch to 03D971 if carry is clear (Which will happen when A8 is rotated to 0.)
---------------------------------------------------------------------------------------------------------------------------------------------------
$03/D969 98 TYA A:0000 X:0000 Y:0004 P:envMxdiZC - Transfer Y to A.
$03/D96A 18 CLC A:0004 X:0000 Y:0004 P:envMxdizC - Clear Carry Flag.
$03/D96B 69 15 ADC #$15 A:0004 X:0000 Y:0004 P:envMxdizc - Add 15 to A.
$03/D96D 9D CB 34 STA $34CB,x[$7E:34CB] A:0019 X:0000 Y:0004 P:envMxdizc - Store Message Data Value in Message Data Byte 2.
------------------------------------------------------------------------------------------------------------------------------------------------------
$03/D971 C8 INY A:0000 X:0000 Y:0000 P:envMxdizc - +1 to Y.
$03/D972 C0 06 00 CPY #$0006 A:0000 X:0000 Y:0001 P:envMxdizc - Compare Y to 0006.
$03/D975 D0 EE BNE $EE    [$D965] A:0000 X:0000 Y:0001 P:eNvMxdizc - Loop until 0006 is reached.
====================================================
$03/D977 A9 1E LDA #$1E A:0019 X:0001 Y:0006 P:envMxdiZC - Load 1E into A.
$03/D979 8D CA 34 STA $34CA  [$7E:34CA] A:001E X:0001 Y:0006 P:envMxdizC - Store A in Battle Message data..
$03/D97C 4C B1 85 JMP $85B1  [$03:85B1] A:001E X:0001 Y:0006 P:envMxdizC - Jump to Subroutine
$03/85B1 A9 F8 LDA #$F8 A:001E X:0001 Y:0006 P:envMxdizC - Load F8 into A.
$03/85B3 8D C8 33 STA $33C8  [$7E:33C8] A:00F8 X:0001 Y:0006 P:eNvMxdizC Store A in 7E33C8.
$03/85B6 A9 03 LDA #$03 A:00F8 X:0001 Y:0006 P:eNvMxdizC - Load 03 into A.
$03/85B8 8D C9 33 STA $33C9  [$7E:33C9] A:0003 X:0001 Y:0006 P:envMxdizC Store 03 in 7E33C9.
$03/85BB 60 RTS A:0003 X:0001 Y:0006 P:envMxdizC - Return.

Now this is interesting! So far this has been the first time I've seen FFIV use a number to roll down until it reaches 00. In this case it reads the Target's Elemental Weakness and in the next portion continues to roll down that number to 00 and depending on how many times it rolled to reach that number is the amount used when determining weaknesses according to the message. Because of this behavior is it a bit difficult to change. You could change it to other values that use a bit signature like Creature Type, or Elemental Attack... or something equivalent to that.

For instance if you wanted the player to be able to tell what statuses (on one byte) they were invulnerable to, you could set this...

$03/D952   2D 20 27   AND $2720  [$7E:2720]   A:00FF   X:0024   Y:0000   P:eNvMxdizc - And Target's Elemental Weaknesses.

to...

$03/D952   2D 2B 27   AND $272B  [$7E:272B]   A:00FF   X:0024   Y:0000   P:eNvMxdizc - And Target's Status Immunity Byte 1.

So say you're fighting a Zombie which has a Status Immunity Byte of B9 and you go to use Peep. You would get their HP and then you would get message... 19, 1C, 1D, and 1E.

So if you changed those each to "Immune to Poison, Immune to Pig, Immune to Mini, Immune to Frog (because of the way the game works you wouldn't be able to check if an enemy is immune to Petrify, KO (or if you're using the second immunity byte) Float, and Curse. The reason this is, is because the game has no message to display for Absorb and Immune bytes) the game would display those when you use Peep on an Enemy telling you their effective resistances.

So there is a little bit of leeway, but not as much as one may like in some respects. This kind of change though seems more appropriate for Cid's Peep to differentiate it in effect (as it should have done in the first place...) from White Magic Peep.


Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Grimoire LD on September 23, 2013, 02:03:06 PM
Exit Routine

Code: [Select]
$03/D97F AD E5 38 LDA $38E5  [$7E:38E5] A:0003 X:0026 Y:0000 P:envMxdizc - Load Second Set of Encounter Flags.
$03/D982 29 01 AND #$01 A:0000 X:0026 Y:0000 P:envMxdiZc - Is it 01? (Cannot Flee)
$03/D984 D0 0B BNE $0B    [$D991] A:0000 X:0026 Y:0000 P:envMxdiZc - If so branch to 03D991.
$03/D986 EE F3 38 INC $38F3  [$7E:38F3] A:0000 X:0026 Y:0000 P:envMxdiZc - +1 the value in 7E38F3.
$03/D989 1A INC A A:0000 X:0026 Y:0000 P:envMxdizc - +1 to A.
$03/D98A 8D D3 38 STA $38D3  [$7E:38D3] A:0001 X:0026 Y:0000 P:envMxdizc - Store A in ?Battle Determination? (When set to 1, the player will flee)
$03/D98D 8D A3 35 STA $35A3  [$7E:35A3] A:0001 X:0026 Y:0000 P:envMxdizc - Store A in 7E35A3 (May have something to do with stopping actions or something?)
$03/D990 60 RTS A:0001 X:0026 Y:0000 P:envMxdizc
--------------------------------------------------------------------------------------------------
$03/D991 9C 50 35 STZ $3550  [$7E:3550] A:0001 X:0026 Y:0000 P:envMxdizc - Store Zero in 7E3550
$03/D994 20 B1 85 JSR $85B1  [$03:85B1] A:0001 X:0026 Y:0000 P:envMxdizc - Jump to Subroutine.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/85B1 A9 F8 LDA #$F8 A:0001 X:0026 Y:0000 P:envMxdizc - Load F8 into A.
$03/85B3 8D C8 33 STA $33C8  [$7E:33C8] A:00F8 X:0026 Y:0000 P:eNvMxdizc Store A in 7E33C8 (Must somehow cancel the Exit visual code)
$03/85B6 A9 03 LDA #$03 A:00F8 X:0026 Y:0000 P:eNvMxdizc - Load 03 into A.
$03/85B8 8D C9 33 STA $33C9  [$7E:33C9] A:0003 X:0026 Y:0000 P:envMxdizc - Store A in 7E33C9. (As above?)
$03/85BB 60 RTS A:0003 X:0026 Y:0000 P:envMxdizc - Return
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/D997 A9 22 LDA #$22 A:0003 X:0026 Y:0000 P:envMxdizc - Load 22 into A. (Message - "Can't Run.")
$03/D999 8D CA 34 STA $34CA  [$7E:34CA] A:0022 X:0026 Y:0000 P:envMxdizc - Store A in Battle Message Area.
$03/D99C 60 RTS A:0022 X:0026 Y:0000 P:envMxdizc - Return.

Short, sweet, and to the point. No surprises there really.

Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Grimoire LD on September 23, 2013, 02:33:09 PM
A bit of a jump, but nearly out of time for the day so...

Roc Routine - (Damage, Status to Living Creatures)

Code: [Select]
$03/DA73 20 FD E0 JSR $E0FD  [$03:E0FD] A:0003 X:0030 Y:0000 P:envMxdizc - Jump to "Is it Absorb?" Routine.
$03/DA76 AD FE 38 LDA $38FE  [$7E:38FE] A:0000 X:0030 Y:0000 P:envMxdiZc - Load A from 7E38FE.
$03/DA79 10 08 BPL $08    [$DA83] A:0002 X:0030 Y:0000 P:envMxdizc - Branch if Positive to 03DA83 (Branch if Heal Tag is not activated)
-----------------------------------------------------------------------------------------------------------------------------------------------------
(Further information can be found in the Mage Subroutine)
------------------------------------------------------------------------------------------------------------------------------------------------------
$03/DA83 20 30 E1 JSR $E130  [$03:E130] A:0002 X:0030 Y:0000 P:envMxdizc - Jump to Subroutine (Elemental Determination)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/E130 AD FE 38 LDA $38FE  [$7E:38FE] A:0002 X:0030 Y:0000 P:envMxdizc - Load 7E38FE.
$03/E133 C9 02 CMP #$02 A:0002 X:0030 Y:0000 P:envMxdizc - Is it 02?
$03/E135 D0 1B BNE $1B    [$E152] A:0002 X:0030 Y:0000 P:envMxdiZC - If not branch to 03E152.
$03/E137 AD 21 27 LDA $2721  [$7E:2721] A:0002 X:0030 Y:0000 P:envMxdiZC - Load Target's Elemental Very Weakness.
$03/E13A 2D A2 28 AND $28A2  [$7E:28A2] A:0000 X:0030 Y:0000 P:envMxdiZC - And Spell's Elemental.
$03/E13D F0 06 BEQ $06    [$E145] A:0000 X:0030 Y:0000 P:envMxdiZC - If they are not equal branch to 03E145.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E145 AD 20 27 LDA $2720  [$7E:2720] A:0000 X:0030 Y:0000 P:envMxdiZC - Load Target's Elemental Weakness.
$03/E148 2D A2 28 AND $28A2  [$7E:28A2] A:0010 X:0030 Y:0000 P:envMxdizC - And Spell's Elemental.
$03/E14B F0 05 BEQ $05    [$E152] A:0000 X:0030 Y:0000 P:envMxdiZC - If they are not equal branch to 03E152.
----------------------------------------------------------------------------------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E152 60 RTS A:0000 X:0030 Y:0000 P:envMxdiZC - Return
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/DA86 20 AF C9 JSR $C9AF  [$03:C9AF] A:0000 X:0030 Y:0000 P:envMxdiZC - Jump to Subroutine. (Damage Determination)
$03/DA89 4C 15 D5 JMP $D515  [$03:D515] A:0000 X:0000 Y:0000 P:envMxdizc - Jump to Subroutine (Status Routine)
(In the Status Routine it eventually RTS's out of the routine)

Hmm, apparently this routine even allows for Elemental Determination. Something that you would never see in the normal game because of its single use on Roc.

Here is Yousei's Elemental Determination Routine from the Tower of Bab-il Docs that uses 1.0 offsets to clear up the missing matters in my own records.

Code: [Select]
03:E11B   LDA  $38FE    ;check the elemental damage multiplier
03:E11E   CMP  #$02
03:E120   BNE  $E13D    ;if it isn't normal damage (there was an elemental
                        ;defense involved), return
03:E122   LDA  $2721
03:E125   AND  $28A2    ;check to see if target is very weak vs. any of the
                        ;attack elements
03:E128   BEQ  $E130    ;if not, go check for normal weakness
03:E12A   LDA  #$08
03:E12C   STA  $38FE    ;if so, set elemental damage to four times normal
03:E12F   RTS
03:E130   LDA  $2720
03:E133   AND  $28A2    ;check to see if target is weak vs. any of the attack
                        ;elements
03:E136   BEQ  $E13D    ;if not, return
03:E138   LDA  #$04
03:E13A   STA  $38FE    ;if so, set elemental damage to twice normal
03:E13D   RTS

One thing of importance I've learned is that Damage Determination is normally consisting of a JMP to 03C9AF. This is absolutely crucial if we want to make more damage-based matters down the line. I'll hopefully get to documenting that routine soon. Maybe then I'll be able to see how the game can tell what formula is being accessed at a given time.

 :edit: Slight edit to account for being slightly off at the start of the routine.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Grimoire LD on September 24, 2013, 12:17:45 AM
Counter Routine

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

Well... that seemed straightforward enough.

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

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

This is what is at 03DDD0 Ordinarily

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

To...

Say we wanted to add Elemental to this...

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


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

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

Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: chillyfeez on September 24, 2013, 09:22:43 AM
I would wonder, though, if those four bytes are used at an entirely different time.
Once or twice (though I can't remember the specifics), I've seen the game jump to the middle of a subroutine and wondered what instructions were being skipped.
The only way I can think of to test this is to put a breakpoint on 03/DDD6 and play for a while to see if it ever breaks - tedious.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Grimoire LD on September 24, 2013, 09:36:03 AM
I thought the same thing, but I saw no jump to it in the routine, what it does is Increment the value at 7E3881, which is apparently only used if Monster's are going to become invincible. Well there is the Mist Dragon to test that on...

...And yeah. Bah. It is called for the very specific purpose of turning a Monster invincible and then returning. Why would they put that there rather than place it closer to its own "increment Invincibility Counter" routine? Ah well, I'll have to keep that address jump in mind for when I get to the Increment Invincibility Counter. There has to be a cleaner way to make that work.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Grimoire LD on September 24, 2013, 11:09:46 AM
Damage, Immobolizing Status (Mage) Routine
Code: [Select]
$03/DA8C 20 FD E0 JSR $E0FD  [$03:E0FD] A:0003 X:0032 Y:FFFF P:envMxdizc - Jump to "Is it Absorb?" Subroutine.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/E0FD AD 26 27 LDA $2726  [$7E:2726] A:0003 X:0032 Y:FFFF P:envMxdizc - Load Target's Elemental Immunity.
$03/E100 2D A2 28 AND $28A2  [$7E:28A2] A:0000 X:0032 Y:FFFF P:envMxdiZc - And the Spell's Elemental.
$03/E103 F0 11 BEQ $11    [$E116] A:0000 X:0032 Y:FFFF P:envMxdiZc - Branch it the two do not match or are both 00 to 03E116.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E105 7B TDC A:0040 X:0032 Y:0000 P:envMxdizc - Transfer Direct Page
$03/E106 8D FE 38 STA $38FE  [$7E:38FE] A:0000 X:0032 Y:0000 P:envMxdiZc - Store A in 7E38FE.
$03/E109 AD 26 27 LDA $2726  [$7E:2726] A:0000 X:0032 Y:0000 P:envMxdiZc - Load Target's Elemental Immunity.
$03/E10C 29 40 AND #$40 A:00C0 X:0032 Y:0000 P:eNvMxdizc - Is Absorb included?
$03/E10E F0 1F BEQ $1F    [$E12F] A:0040 X:0032 Y:0000 P:envMxdizc - If not, branch to 03E12F.
$03/E110 A9 84 LDA #$84 A:0040 X:0032 Y:0000 P:envMxdizc - Load 84 into A. (Double the power)
$03/E112 8D FE 38 STA $38FE  [$7E:38FE] A:0084 X:0032 Y:0000 P:eNvMxdizc - Store A in 7E38FE.
$03/E115 60 RTS A:0084 X:0032 Y:0000 P:eNvMxdizc - Return.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E116 AD 25 27 LDA $2725  [$7E:2725] A:0000 X:0032 Y:FFFF P:envMxdiZc - Load Target's Elemental Resistance
$03/E119 2D A2 28 AND $28A2  [$7E:28A2] A:0000 X:0032 Y:FFFF P:envMxdiZc - And the Spell's Elemental.
$03/E11C F0 11 BEQ $11    [$E12F] A:0000 X:0032 Y:FFFF P:envMxdiZc - Branch if the two do not match or are both 00 to 03E12F.
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E11E A9 01 LDA #$01 A:0008 X:0032 Y:0000 P:envMxdizc - Load 01 into A.
$03/E120 8D FE 38 STA $38FE  [$7E:38FE] A:0001 X:0032 Y:0000 P:envMxdizc - Store A in 7E38FE.
$03/E123 AD 25 27 LDA $2725  [$7E:2725] A:0001 X:0032 Y:0000 P:envMxdizc - Load Target's Elemental Resistance
$03/E126 29 40 AND #$40 A:0008 X:0032 Y:0000 P:envMxdizc - ?Is it 40 (Absorb)
$03/E128 F0 05 BEQ $05    [$E12F] A:0000 X:0032 Y:0000 P:envMxdiZc - If not branch to 03E12F.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E12A A9 82 LDA #$82 A:0040 X:0032 Y:0000 P:envMxdizc - Load an 82 into A.
$03/E12C 8D FE 38 STA $38FE  [$7E:38FE] A:0082 X:0032 Y:0000 P:eNvMxdizc - Store A in 7E38FE.
-------------------------------------------------------------------------------------------------------------------------------------------------
$03/E12F 60 RTS A:0000 X:0032 Y:FFFF P:envMxdiZc - Return
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/DA8F AD FE 38 LDA $38FE  [$7E:38FE] A:0000 X:0032 Y:FFFF P:envMxdiZc - Load A from 7E38FE.
$03/DA92 10 08 BPL $08    [$DA9C] A:0002 X:0032 Y:FFFF P:envMxdizc - Branch if positive to 03DA9C. (Which will not happen if the above Abosrb check was passed)
-----------------------------------------------------------------------------------------------------------------------------------
$03/DA94 29 7F AND #$7F A:0082 X:0032 Y:0000 P:eNvMxdizc - Add 7F to a negative, thereby making it a positive?
$03/DA96 8D FE 38 STA $38FE  [$7E:38FE] A:0002 X:0032 Y:0000 P:envMxdizc - Store A in 7E38FE.
$03/DA99 4C 1C D4 JMP $D41C  [$03:D41C] A:0002 X:0032 Y:0000 P:envMxdizc - Jump to Cure Subroutine
(It returns from here and leaves the Subroutine)
-------------------------------------------------------------------------------------------------------------------------------------
$03/DA9C 20 30 E1 JSR $E130  [$03:E130] A:0002 X:0032 Y:FFFF P:envMxdizc - Jump to Elemental Damage Subroutine.
$03/DA9F 20 AF C9 JSR $C9AF  [$03:C9AF] A:0000 X:0032 Y:FFFF P:envMxdiZC - Jump to Damage Determination.
$03/DAA2 AD 50 35 LDA $3550  [$7E:3550] A:0000 X:02A8 Y:00FF P:envMxdizc - Load A from 7E3550.
$03/DAA5 48 PHA A:0040 X:02A8 Y:00FF P:envMxdizc - Push Accumulator.
$03/DAA6 20 B6 D5 JSR $D5B6  [$03:D5B6] A:0040 X:02A8 Y:00FF P:envMxdizc - Jump to Immobilizing Status Routine.
$03/DAA9 68 PLA A:0040 X:0081 Y:0028 P:envMxdizc - Pull Accumulator
$03/DAAA 8D 50 35 STA $3550  [$7E:3550] A:0040 X:0081 Y:0028 P:envMxdizc - Store A in 7E3550
$03/DAAD 60 RTS A:0040 X:0081 Y:0028 P:envMxdizc - Return

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






Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Grimoire LD on September 24, 2013, 12:06:21 PM
Damage Based on Caster's HP (Bomb, Mist Dragon) Routine

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

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

Other than that it is an Extremely thorough formula. With required room for jumps to all of the Status' that can be inflicted without special code. The game never attaches a status to one of these spells and this is a Lot of room that is used by that. So if one wanted to make this into quite a special formula that chance is always before them since the Status portion (the largest chunk of it) is never used normally.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Grimoire LD on September 24, 2013, 12:30:53 PM
Damage, Poison (Venom, Poison) Routine.

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



A bit of deja vu... well I guess all of those formula's follow a similar progression so it makes sense that they might somewhat repeat themselves. The definitions of the repeated Jumps are explained in the Mage Subroutine above. No surprises here. While you can change the inflicted status the Timers will likely become askewed because of the absence of Poison.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Grimoire LD on September 24, 2013, 01:59:25 PM
Here we go...

Sylph Routine

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

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

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

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


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









Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Grimoire LD on September 24, 2013, 10:54:55 PM
Odin Routine

Code: [Select]

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

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

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



Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: chillyfeez on September 24, 2013, 11:18:43 PM
Yeah, I always thought of Odin as more of a trophy than a usable spell because of the high failure rate, but I don't think I ever realized it was that high.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Grimoire LD on September 24, 2013, 11:27:02 PM
Count Routine

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

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

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


 :edit: 12/26/14 - Well, looks like the answer to Count's Timer was in front of me the whole time. It's just the Spell Power of the given Spell, hence Count's Timer is 0A.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Grimoire LD on September 25, 2013, 12:07:27 AM
Damage Based on Target's Max HP (Beam, Maser) Routine.

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

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

Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Grimoire LD on September 25, 2013, 12:46:34 AM
Calcify (Petrify) Routine -

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

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

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

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

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

Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Grimoire LD on September 25, 2013, 01:25:45 AM
Gaze Routine

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

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



Title: Re: Grimoire LD's Notes, Methods, and Hacks (All Spells Disassembly)
Post by: Grimoire LD on September 25, 2013, 10:31:37 AM
Blaster Routine -

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

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

Slap Routine

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


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

Title: Re: Grimoire LD's Notes, Methods, and Hacks (All Spells Disassembly)
Post by: Grimoire LD on September 25, 2013, 11:31:38 AM
Blast/Mind Blast Routine

Code: [Select]

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

Shortest Code ever?

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

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

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

Explode Routine

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

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


Reaction Routine

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

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


Title: Re: Grimoire LD's Notes, Methods, and Hacks (All Spells Disassembly)
Post by: Grimoire LD on September 25, 2013, 12:06:37 PM
Recover 1/10 - Recover 1/3 Target's HP (Remedy/Absorb) Routines

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

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




Title: Re: Grimoire LD's Notes, Methods, and Hacks (All Spells Disassembly)
Post by: Grimoire LD on September 25, 2013, 03:21:21 PM
Damage, Status (Unused?) Routine

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

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

Alert, Call Routine

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

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

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

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





Title: Re: Grimoire LD's Notes, Methods, and Hacks (All Spells Disassembly)
Post by: Grimoire LD on September 25, 2013, 03:39:53 PM
Trigger a Reaction Routine -

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

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

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

Yeah.

Decrement Invincibility Encounter

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

Nothing to see here.

Revive Monster

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


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

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

 :edit: Hmm, there is a noticeable difference missing here. Maybe it's data used in another formula?
Title: Re: Grimoire LD's Notes, Methods, and Hacks (All Spells Disassembly)
Post by: Pinkpuff on September 25, 2013, 03:56:11 PM
Recover 1/10 - Recover 1/3 Target's HP (Remedy/Absorb) Routines

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

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

I remember trying to modify this routine to get it to heal (1 / Spell Power) instead of a static 1/10 but I couldn't seem to get it to work. I'm sure that discussion is here somewhere, maybe archived or something.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (All Spells Disassembly)
Post by: Grimoire LD on September 25, 2013, 11:17:44 PM
Ah, I can see why this might be an issue. Spell Power in this case would refer to...


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

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

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

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

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


Or maybe I missed the obvious...

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

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

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

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

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

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

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

Here is your code...

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



Here is mine...

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

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

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

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

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

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

Instead of...

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

Then everything works out fine.

I was leery at first in changing the register it was putting the data into but it caused no code mishaps and healed the target Dependent on the Spell Power rather than anything else. Phew, that was brain-draining for such a simple little problem.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (All Spells Disassembly)
Post by: Grimoire LD on September 26, 2013, 12:48:31 AM
Tradeoff (Suicide, Bring in Next Monster) Routine

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

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

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


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

End Battle Routine

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

Search Routine

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

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

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

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

Something Happens to Adult Rydia  Routine

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

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

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


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



Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Deathlike2 on September 26, 2013, 02:19:15 AM
Counter Routine

Well... that seemed straightforward enough.

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

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

This is what is at 03DDD0 Ordinarily

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

To...

Say we wanted to add Elemental to this...

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


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

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


Damage, Poison (Venom, Poison) Routine.

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

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

Odin Routine


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

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

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

Count Routine

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

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

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

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

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

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

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

Search Routine

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

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

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

Quote
Hatch Routine

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

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

Quote
Something Happens to Adult Rydia  Routine

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

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

The status is most likely Hide (the same one Edward uses), because the animation isn't really all that special (the unhiding part, which is to show up in the battle).
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Grimoire LD on September 26, 2013, 07:49:54 AM
Well, it's a straight damage attack powered by your actual weapon power... it's the basic idea that I made for a hack that replaced the godawful Goblin's Punch to the same concept that was used in FF5 (the FF4 version is technically better... plus it's great for a hack).

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



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

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


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

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



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

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

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

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

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

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


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

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

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


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

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

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

That makes a great deal of sense! But that must mean that there is special code which not only Hides Rydia for that battle but also makes her name and HP invisible as well. These are all worthy of another glance.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (All Spells Disassembly)
Post by: Grimoire LD on September 26, 2013, 09:40:10 AM
Damage Determination Routine

Code: [Select]

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

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

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

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

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

This does seem to be the end of this routine anyhow. I know Magic also is taken through this same pattern as well (there must be some marked differences though, I haven't really explored it too well) and after this there is another routine that seems to do something similar... ish.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (All Spells Disassembly)
Post by: chillyfeez on September 26, 2013, 11:46:24 AM
Grimoire - AND is a bitwise comparison command.
When the game ANDs, it compares the bits of the value specified with those of the register in question.
So, if A is 1C (00011100) and you AND it with 38 (00111000), the result will be whichever "ones" are held in common - in this case, 00011000, or 18.
If you AND with 7F (01111111), as mentioned a few times above, the result will be zero if and only if the register starts as 80 (10000000).
 :edit: oops - or if the register is 00. Sorry.
AND is used quite a bit in displaying monster images, so I had to figure this out for what I was working on. Hope this helps.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Deathlike2 on September 26, 2013, 01:16:11 PM
Well, it's a straight damage attack powered by your actual weapon power... it's the basic idea that I made for a hack that replaced the godawful Goblin's Punch to the same concept that was used in FF5 (the FF4 version is technically better... plus it's great for a hack).

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

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

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

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


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

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


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

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

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

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


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

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

Title: Re: Grimoire LD's Notes, Methods, and Hacks (Basic Attack/Defense Disassembly)
Post by: Grimoire LD on September 27, 2013, 12:13:23 AM
@Chillyfeez - Thanks Chillyfeez! I had not taken bit operands into account whatsoever for AND's. That is really great knowledge and will help me understand the concepts a bit better now.

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

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


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

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

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



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

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


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

That's a good use of the formulas actually.

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

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


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

Haha, quite a bit of work I would imagine.

Hmm, I need to think about what to look up next. I should probably take another look at commands but this Regen thing is really bothering me... it may not be possible for it to recover MP by the way the game is set up unfortunately.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (All Spells Disassembly)
Post by: Grimoire LD on September 27, 2013, 10:49:58 AM
(Mostly) Full Fight Routine -

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

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

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

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

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

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

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

(Continued in Next Post)

Because it is such an enormous post of code it needs two posts  in order to keep the originally first post (which will be made a directory for easy access) intact.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (All Spells Disassembly)
Post by: Grimoire LD on September 27, 2013, 10:56:17 AM
(Mostly) Full Fight Routine Continued -

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

Moves directly into Defense from here.

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

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

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

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

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

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

Here is more of What can be done with the Normal Fight Command. (http://slickproductions.org/forum/index.php?topic=1883.msg19126#msg19126)
Title: Re: Grimoire LD's Notes, Methods, and Hacks (All Spells Disassembly)
Post by: Grimoire LD on September 27, 2013, 01:18:00 PM
The first post has been updated to include All Spell Routines (save Heal and Audiovisual Effects) with appropriate links and indexes for organizations.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (All Spells Disassembly)
Post by: Grimoire LD on September 27, 2013, 04:40:24 PM
Part of Damage Routine

Code: [Select]
$03/C924 AD 83 26 LDA $2683  [$7E:2683] A:0004 X:0000 Y:0000 P:envMxdizc - Load Caster's Status Byte 1.
$03/C927 29 30 AND #$30 A:0000 X:0000 Y:0000 P:envMxdiZc - Are they inflicted with Small or Toad?
$03/C929 D0 6B BNE $6B    [$C996] A:0000 X:0000 Y:0000 P:envMxdiZc - If so branch to 03C996.
$03/C92B A5 CD LDA $CD    [$00:00CD] A:0000 X:0000 Y:0000 P:envMxdiZc - Load A from CD.
$03/C92D 20 89 84 JSR $8489  [$03:8489] A:0000 X:0000 Y:0000 P:envMxdiZc - Jump to Subroutine (Preparation? Subroutine)
$03/C930 18 CLC A:0000 X:0000 Y:0000 P:envMxdiZc - Clear Carry Flag
$03/C931 AD 32 35 LDA $3532  [$7E:3532] A:0000 X:0000 Y:0000 P:envMxdiZc - Load A from 7E3532
$03/C934 69 21 ADC #$21 A:0000 X:0000 Y:0000 P:envMxdiZc - Add 21 to A.
$03/C936 85 A9 STA $A9    [$00:00A9] A:0021 X:0000 Y:0000 P:envMxdizc - Store A in A9.
$03/C938 AD 33 35 LDA $3533  [$7E:3533] A:0021 X:0000 Y:0000 P:envMxdizc - Load A from 7E3553.
$03/C93B 69 00 ADC #$00 A:0000 X:0000 Y:0000 P:envMxdiZc - Add 00 into A.
$03/C93D 85 AA STA $AA    [$00:00AA] A:0000 X:0000 Y:0000 P:envMxdiZc - Store A in AA.
$03/C93F 7B TDC A:0000 X:0000 Y:0000 P:envMxdiZc - Transfer Direct Page.
$03/C940 A8 TAY A:0000 X:0000 Y:0000 P:envMxdiZc - Transfer A to Y.
$03/C941 84 AB STY $AB    [$00:00AB] A:0000 X:0000 Y:0000 P:envMxdiZc - Store Y in a AB.
$03/C943 8D E3 38 STA $38E3  [$7E:38E3] A:0000 X:0000 Y:0000 P:envMxdiZc - Store A in 7E38E3.
$03/C946 A6 A9 LDX $A9    [$00:00A9] A:0000 X:0000 Y:0000 P:envMxdiZc - Load X from A9.
$03/C948 BD 86 27 LDA $2786,x[$7E:27A7] A:0000 X:0021 Y:0000 P:envMxdizc - Load A from 7E27A7. (Equip Index?)
$03/C94B 29 40 AND #$40 A:0015 X:0021 Y:0000 P:envMxdizc - If not 40 or none of the bits align change to lowered number
$03/C94D F0 03 BEQ $03    [$C952] A:0000 X:0021 Y:0000 P:envMxdiZc - If 00 branch to 03C94D.
--------------------------------------------------------------------------------------------------------------------------

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

-------------------------------------------------------------------------------------------------------------------------------
$03/C962 A5 CD LDA $CD    [$00:00CD] A:0000 X:0021 Y:0000 P:envMxdiZc - Load A from CD.
$03/C964 20 7E 84 JSR $847E  [$03:847E] A:0000 X:0021 Y:0000 P:envMxdiZc - Jump to Subroutine (Multiplying x6 Subroutine)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/847E 0A ASL A A:0000 X:0021 Y:0000 P:envMxdiZc - x2 to A.
$03/847F 0A ASL A A:0000 X:0021 Y:0000 P:envMxdiZc - x2 to A
$03/8480 0A ASL A A:0000 X:0021 Y:0000 P:envMxdiZc - x2 to A
$03/8481 60 RTS A:0000 X:0021 Y:0000 P:envMxdiZc - Return
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/C967 AA TAX A:0000 X:0021 Y:0000 P:envMxdiZc - Transfer A to X.
$03/C968 98 TYA A:0000 X:0000 Y:0000 P:envMxdiZc - Transfer Y to A.
$03/C969 F0 2B BEQ $2B    [$C996] A:0000 X:0000 Y:0000 P:envMxdiZc - If 00 branch to 03C996.
------------------------------------------------------------------------------------------------------------------
(Arrow Decrementing Subroutine starts here!)
$03/C96B 88 DEY A:0001 X:0008 Y:0001 P:envMxdizc - -1 to Y.
$03/C96C F0 04 BEQ $04    [$C972] A:0001 X:0008 Y:0000 P:envMxdiZc - If not 00 branch to 03C972
--------------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------------
$03/C972 38 SEC A:0001 X:0008 Y:0000 P:envMxdiZc - Set Carry Flag.
$03/C973 BD DC 32 LDA $32DC,x[$7E:32E4] A:0001 X:0008 Y:0000 P:envMxdiZC - Load A from Right Hand Quantity.
$03/C976 E9 01 SBC #$01 A:0032 X:0008 Y:0000 P:envMxdizC - -1 to A. (-1 Arrow)
$03/C978 D0 0E BNE $0E    [$C988] A:0031 X:0008 Y:0000 P:envMxdizC  - If not 00 branch to 03C988.
----------------------------------------------------------------------------------------------------------
$03/C97A A5 CD LDA $CD    [$00:00CD] A:0000 X:0008 Y:0000 P:envMxdiZC - Load A from CD.
$03/C97C AA TAX A:0001 X:0008 Y:0000 P:envMxdizC - Transfer A to X.
$03/C97D BD DC 38 LDA $38DC,x[$7E:38DD] A:0001 X:0001 Y:0000 P:envMxdizC - Load A from 7E38DC.
$03/C980 1A INC A A:0000 X:0001 Y:0000 P:envMxdiZC - +1 to A.
$03/C981 05 AB ORA $AB    [$00:00AB] A:0001 X:0001 Y:0000 P:envMxdizC - Check it against address AB.
$03/C983 9D DC 38 STA $38DC,x[$7E:38DD] A:0001 X:0001 Y:0000 P:envMxdizC - Store A in 7E38DD.
$03/C986 80 03 BRA $03    [$C98B] A:0001 X:0001 Y:0000 P:envMxdizC - Branch to 03C98B
-------------------------------------------------------------------------------------------------------------
$03/C988 9D DC 32 STA $32DC,x[$7E:32E4] A:0031 X:0008 Y:0000 P:envMxdizC - Store A in 7E32E4.
$03/C98B EE E1 38 INC $38E1  [$7E:38E1] A:0031 X:0008 Y:0000 P:envMxdizC - +1 to 7E38E1.
$03/C98E A5 CD LDA $CD    [$00:00CD] A:0031 X:0008 Y:0000 P:envMxdizC - Load A from CD.
$03/C990 8D 75 39 STA $3975  [$7E:3975] A:0001 X:0008 Y:0000 P:envMxdizC - Store A in 7E3975
$03/C993 20 08 9E JSR $9E08  [$03:9E08] A:0001 X:0008 Y:0000 P:envMxdizC - Jump to Subroutine.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/9E08 AD 75 39 LDA $3975  [$7E:3975] A:0001 X:0008 Y:0000 P:envMxdizC - Load A from 7E3975.
$03/9E0B 20 7E 84 JSR $847E  [$03:847E] A:0001 X:0008 Y:0000 P:envMxdizC - Jump to Subroutine. (Multiplying A 3 times. )
$03/9E0E A8 TAY A:0008 X:0008 Y:0000 P:envMxdizc - Transfer A to Y
$03/9E0F A6 A6 LDX $A6    [$00:00A6] A:0008 X:0008 Y:0008 P:envMxdizc - Load X from A6.
$03/9E11 B9 DB 32 LDA $32DB,y[$7E:32E3] A:0008 X:0080 Y:0008 P:envMxdizc - Load A from Right Hand Data.
$03/9E14 9D 33 20 STA $2033,x[$7E:20B3] A:0054 X:0080 Y:0008 P:envMxdizc - Store A in Character Data's Right Hand Data.
$03/9E17 B9 DC 32 LDA $32DC,y[$7E:32E4] A:0054 X:0080 Y:0008 P:envMxdizc - Load A from Right Hand Quantity.
$03/9E1A 9D 34 20 STA $2034,x[$7E:20B4] A:0031 X:0080 Y:0008 P:envMxdizc - Store A in Character Data's Right Hand Quantity.
$03/9E1D B9 DF 32 LDA $32DF,y[$7E:32E7] A:0031 X:0080 Y:0008 P:envMxdizc - Load A from Left Hand Data.
$03/9E20 9D 35 20 STA $2035,x[$7E:20B5] A:004D X:0080 Y:0008 P:envMxdizc - Store A in Character Data's Left Hand.
$03/9E23 B9 E0 32 LDA $32E0,y[$7E:32E8] A:004D X:0080 Y:0008 P:envMxdizc - Load A from Left Hand Quantity.
$03/9E26 9D 36 20 STA $2036,x[$7E:20B6] A:0001 X:0080 Y:0008 P:envMxdizc - Store A in Character's Left Hand Quantity.
$03/9E29 60 RTS A:0001 X:0080 Y:0008 P:envMxdizc - Return
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
----------------------------------------------------------------------------------------------------------------------
$03/C996 60 RTS A:0000 X:0000 Y:0000 P:envMxdiZc - Return

This is Very Important the code revolving around Arrows is included within, including how to respond where there's 1 arrow left. The game sets up a catch for this. It is not a glitch but a programmed facet that there is 1 arrow until that character's next turn comes around again. There's a number of rather useless bytes around that special catch that can be replaced. If we can just make a JSR to the proper "get rid of item and quantity" code that takes place when their turn arrives we might be able to fix that abominable glitch.

Code: [Select]
$03/C997 9C FD 38 STZ $38FD  [$7E:38FD] A:0002 X:0001 Y:0003 P:envMxdizC - Store Zero in 7E38FD
$03/C99A AD FB 38 LDA $38FB  [$7E:38FB] A:0002 X:0001 Y:0003 P:envMxdizC - Load A from 7E38FB.
$03/C99D F0 0F BEQ $0F    [$C9AE] A:0002 X:0001 Y:0003 P:envMxdizC - If 00 branch to 03C9AE
$03/C99F A8 TAY A:0002 X:0001 Y:0003 P:envMxdizC - Transfer A to Y.
--------------------------------------------------------------(Looping Point)-------------------------------------------
$03/C9A0 20 8B 85 JSR $858B  [$03:858B] A:0002 X:0001 Y:0002 P:envMxdizC - Jump to Subroutine (Random Number Generator)
$03/C9A3 CD FA 38 CMP $38FA  [$7E:38FA] A:0004 X:0000 Y:0002 P:envMxdizc - Does the Value in A match the Value in 7E38FA?
$03/C9A6 B0 03 BCS $03    [$C9AB] A:0004 X:0000 Y:0002 P:eNvMxdizc - If so branch to 03C9AB
$03/C9A8 EE FD 38 INC $38FD  [$7E:38FD] A:0004 X:0000 Y:0002 P:eNvMxdizc - +1 to 7E38FD.
$03/C9AB 88 DEY A:0004 X:0000 Y:0002 P:envMxdizc -1 to Y.
$03/C9AC D0 F2 BNE $F2    [$C9A0] A:0004 X:0000 Y:0001 P:envMxdizc - If not 00 loop back to 03C9A0
$03/C9AE 60 RTS A:0021 X:0000 Y:0000 P:envMxdiZc - Return

Code: [Select]
$03/CA72 85 A9 STA $A9    [$00:00A9] A:0080 X:0062 Y:0000 P:eNvMxdizc
$03/CA74 10 05 BPL $05    [$CA7B] A:0080 X:0062 Y:0000 P:eNvMxdizc
$03/CA76 29 7F AND #$7F A:0080 X:0062 Y:0000 P:eNvMxdizc
$03/CA78 18 CLC A:0000 X:0062 Y:0000 P:envMxdiZc
$03/CA79 69 05 ADC #$05 A:0000 X:0062 Y:0000 P:envMxdiZc
$03/CA7B 0A ASL A A:0005 X:0062 Y:0000 P:envMxdizc
$03/CA7C AA TAX A:000A X:0062 Y:0000 P:envMxdizc
$03/CA7D 60 RTS A:000A X:000A Y:0000 P:envMxdizc

Code: [Select]
$03/CA7E C2 20 REP #$20 A:00F8 X:0001 Y:0000 P:envMxdiZC - Reset Status Processor?
$03/CA80 7B TDC A:00F8 X:0001 Y:0000 P:envmxdiZC - Transfer Direct Page to Accumulator?
$03/CA81 AA TAX A:0000 X:0001 Y:0000 P:envmxdiZC - Transfer A to X
$03/CA82 86 A9 STX $A9    [$00:00A9] A:0000 X:0000 Y:0000 P:envmxdiZC - Store X in A9.
$03/CA84 A8 TAY A:0000 X:0000 Y:0000 P:envmxdiZC - Transfer A to Y
$03/CA85 98 TYA A:0000 X:0000 Y:0000 P:envmxdiZC - Transfer Y to A (Sure, why not?)
$03/CA86 4A LSR A A:0000 X:0000 Y:0000 P:envmxdiZC - Divide A by 2 (Now we're talking!)
$03/CA87 AA TAX A:0000 X:0000 Y:0000 P:envmxdiZc - Transfer A to X (Eh...)
$03/CA88 BD 40 35 LDA $3540,x[$7E:3540] A:0000 X:0000 Y:0000 P:envmxdiZc - Load A from 7E3540.
$03/CA8B 29 FF 00 AND #$00FF A:0100 X:0000 Y:0000 P:envmxdizc - Not really sure. Possibly saying to load A from 0xFF
$03/CA8E F0 03 BEQ $03    [$CA93] A:0000 X:0000 Y:0000 P:envmxdiZc - I see no way to pass it.
$03/CA93 A6 A9 LDX $A9    [$00:00A9] A:0000 X:0000 Y:0000 P:envmxdiZc - Load X from A9.
$03/CA95 B9 D4 34 LDA $34D4,y[$7E:34D4] A:0000 X:0000 Y:0000 P:envmxdiZc - Load A from 7E34D4 (Healing/Damage)
$03/CA98 29 00 40 AND #$4000 A:0005 X:0000 Y:0000 P:envmxdizc - (No idea)
$03/CA9B F0 11 BEQ $11    [$CAAE] A:0000 X:0000 Y:0000 P:envmxdiZc - Another unpassable check?
$03/CAAE B9 D4 34 LDA $34D4,y[$7E:34D4] A:0000 X:0000 Y:0000 P:envmxdiZc - Load A from 7E34D4 (Healing/Damage)
$03/CAB1 10 11 BPL $11    [$CAC4] A:0005 X:0000 Y:0000 P:envmxdizc - Branch if positive and go to 7ECAC4.
-------------------------------------------------------------------------------------------------------------------------------------------------

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

------------------------------------------------------------------------------------------------------------------------------------------------------
$03/CAF6 9D 07 20 STA $2007,x[$7E:2007] A:00C3 X:0000 Y:0000 P:envmxdizC - Store the new Character/Monster's HP.
$03/CAF9 DD 09 20 CMP $2009,x[$7E:2009] A:00C3 X:0000 Y:0000 P:envmxdizC - Compare to Max HP.
$03/CAFC 90 08 BCC $08    [$CB06] A:00C3 X:0000 Y:0000 P:eNvmxdizc - Branch if Carry Cleared.
$03/CB06 BD 09 20 LDA $2009,x[$7E:2009] A:00C3 X:0000 Y:0000 P:eNvmxdizc - Load Max HP.
$03/CB09 20 86 84 JSR $8486  [$03:8486] A:00C8 X:0000 Y:0000 P:envmxdizc - Jump to dividing? Subroutine.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
$03/8486 4A LSR A A:00C8 X:0000 Y:0000 P:envmxdizc - Divide Max HP by half.
$03/8487 4A LSR A A:0064 X:0000 Y:0000 P:envmxdizc - Divide Max HP by another half
$03/8488 60 RTS A:0032 X:0000 Y:0000 P:envmxdizc - Return
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/CB0C DD 07 20 CMP $2007,x[$7E:2007] A:0032 X:0000 Y:0000 P:envmxdizc - Compare Character/Monster's Current HP with /4 HP?
$03/CB0F 90 12 BCC $12    [$CB23] A:0032 X:0000 Y:0000 P:eNvmxdizc - If unsuccessful Branch to 03CB23
--------------------------------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------------------------------------
$03/CB23 7B TDC A:0032 X:0000 Y:0000 P:eNvmxdizc - Transfer Direct Page to Accumulator
$03/CB24 E2 20 SEP #$20 A:0000 X:0000 Y:0000 P:envmxdiZc - Set Processor Status Bits
$03/CB26 A6 A9 LDX $A9    [$00:00A9] A:0000 X:0000 Y:0000 P:envMxdiZc - Load X from A9.
$03/CB28 BD 06 20 LDA $2006,x[$7E:2006] A:0000 X:0000 Y:0000 P:envMxdiZc - Load A from Status Byte 3 of Character/Monster.
$03/CB2B 29 FE AND #$FE A:0000 X:0000 Y:0000 P:envMxdiZc - ??
$03/CB2D 9D 06 20 STA $2006,x[$7E:2006] A:0000 X:0000 Y:0000 P:envMxdiZc - Store A in 7E2006.
$03/CB30 C2 20 REP #$20 A:0000 X:0000 Y:0000 P:envMxdiZc - Clear bit 5.
$03/CB32 A6 A9 LDX $A9    [$00:00A9] A:0000 X:0000 Y:0000 P:envmxdiZc - Load X from A9.
$03/CB34 8A TXA A:0000 X:0000 Y:0000 P:envmxdiZc - Transfer X to A
$03/CB35 18 CLC A:0000 X:0000 Y:0000 P:envmxdiZc - Clear Carry Flag.
$03/CB36 69 80 00 ADC #$0080 A:0000 X:0000 Y:0000 P:envmxdiZc - Add 80 to A.
$03/CB39 AA TAX A:0080 X:0000 Y:0000 P:envmxdizc - Transfer A to X.
$03/CB3A 86 A9 STX $A9    [$00:00A9] A:0080 X:0080 Y:0000 P:envmxdizc - Store X in A9.
$03/CB3C C8 INY A:0080 X:0080 Y:0000 P:envmxdizc - +1 to Y.
$03/CB3D C8 INY A:0080 X:0080 Y:0001 P:envmxdizc - +1 to y.
$03/CB3E C0 1A 00 CPY #$001A A:0080 X:0080 Y:0002 P:envmxdizc - ??
$03/CB41 F0 03 BEQ $03    [$CB46] A:0080 X:0080 Y:0002 P:eNvmxdizc - Branch if flag is set to 03CB46.
$03/CB43 4C 85 CA JMP $CA85  [$03:CA85] A:0080 X:0080 Y:0002 P:eNvmxdizc - Jump to Subroutine.

Code: [Select]
$03/CB46 7B TDC A:0680 X:0680 Y:001A P:envmxdiZC - Transfer Direct Page with 16 Bit Accumulator
$03/CB47 E2 20 SEP #$20 A:0000 X:0680 Y:001A P:envmxdiZC - Set Processor Status
$03/CB49 60 RTS A:0000 X:0680 Y:001A P:envMxdiZC - Return

(Seems to activate every few seconds)

Code: [Select]
$03/CB4A AD 08 39 LDA $3908  [$7E:3908] A:0000 X:0010 Y:0001 P:envMxdiZC - Load Status to Inflict into A.
$03/CB4D 10 0E BPL $0E    [$CB5D] A:0080 X:0010 Y:0001 P:eNvMxdizC - If it is Positive branch to 03CB5D. (Not Death)
----------------------------------------------------------------------------------------------------------------------
$03/CB4F AD 40 27 LDA $2740  [$7E:2740] A:0080 X:0010 Y:0001 P:eNvMxdizC - Load Target's Creature Type into A.
$03/CB52 29 82 AND #$82 A:0000 X:0010 Y:0001 P:envMxdiZC - Is it Undead or Machine?
$03/CB54 F0 07 BEQ $07    [$CB5D] A:0000 X:0010 Y:0001 P:envMxdiZC - If not, branch to 03CB5D
-------------------------------------------------------------------------------------------------------------------------------
$03/CB56 9C 08 39 STZ $3908  [$7E:3908] A:0080 X:0010 Y:0001 P:eNvMxdizC - Store Zero in 7E3908
$03/CB59 9C 09 39 STZ $3909  [$7E:3909] A:0080 X:0010 Y:0001 P:eNvMxdizC - Store Zero in 7E3909
$03/CB5C 60 RTS A:0080 X:0010 Y:0001 P:eNvMxdizC - Return

---------------------------------------------------------------------------------------------------------------------------------
$03/CB5D C2 20 REP #$20 A:0000 X:0010 Y:0001 P:envMxdiZC - Reset Process Status.
$03/CB5F AD 03 27 LDA $2703  [$7E:2703] A:0000 X:0010 Y:0001 P:envmxdiZC - Load Target's Status Byte 1 into A.
$03/CB62 29 FF BF AND #$BFFF A:4000 X:0010 Y:0001 P:envmxdizC - -3F? I've never seen an AND with two bytes before.)
$03/CB65 CD 08 39 CMP $3908  [$7E:3908] A:0000 X:0010 Y:0001 P:envmxdiZC - Compare between Status to Inflict.
$03/CB68 90 06 BCC $06    [$CB70] A:0000 X:0010 Y:0001 P:eNvmxdizc - Branch if it is less than that value.
---------------------------------------------------------------------------------------------------------------------------

-------------------------------------------------------------------------------------------------------------------------------
$03/CB70 A6 C7 LDX $C7    [$00:00C7] A:0000 X:0010 Y:0001 P:eNvmxdizc - Load X from C7.
$03/CB72 AD 03 27 LDA $2703  [$7E:2703] A:0000 X:0014 Y:0001 P:envmxdizc - Load Target's Status Byte 1.
$03/CB75 0D 08 39 ORA $3908  [$7E:3908] A:4000 X:0014 Y:0001 P:envmxdizc - Add Status from before if applicable.
$03/CB78 9D 8E 33 STA $338E,x[$7E:33A2] A:4080 X:0014 Y:0001 P:envmxdizc - Store A in 7E338E.
$03/CB7B AD 08 39 LDA $3908  [$7E:3908] A:4080 X:0014 Y:0001 P:envmxdizc - Load A from Status to Inflict.
$03/CB7E 29 01 3B AND #$3B01 A:0080 X:0014 Y:0001 P:envmxdizc - ??
$03/CB81 D0 03 BNE $03    [$CB86] A:0000 X:0014 Y:0001 P:envmxdiZc -Branch if not 00.
$03/CB83 4C 42 CC JMP $CC42  [$03:CC42] A:0000 X:0014 Y:0001 P:envmxdiZc - Jump to 03CC42.

Called by the Status Infliction portion of Normal Attack as one may expect.

Code: [Select]
$03/CB86 7B TDC A:0001 X:0020 Y:0001 P:envmxdizc - Transfer Direct Page Accumulator 16 Bit
$03/CB87 E2 20 SEP #$20 A:0000 X:0020 Y:0001 P:envmxdiZc - Set Process Status
$03/CB89 AD 08 39 LDA $3908  [$7E:3908] A:0000 X:0020 Y:0001 P:envMxdiZc - Load Status to Inflict.
$03/CB8C 29 01 AND #$01 A:0001 X:0020 Y:0001 P:envMxdizc - Is it Poison?
$03/CB8E F0 29 BEQ $29    [$CBB9] A:0001 X:0020 Y:0001 P:envMxdizc - If it is not, branch to 03CBB9
----------------------------------------------------------------------------------------------------------------------------------------------------
$03/CB90 A9 06 LDA #$06 A:0001 X:0020 Y:0001 P:envMxdizc - Load 06 into A.
$03/CB92 85 D6 STA $D6    [$00:00D6] A:0006 X:0020 Y:0001 P:envMxdizc - Store A in D6.
$03/CB94 A5 CF LDA $CF    [$00:00CF] A:0006 X:0020 Y:0001 P:envMxdizc - Load A from CF.
$03/CB96 20 36 9E JSR $9E36  [$03:9E36] A:0008 X:0020 Y:0001 P:envMxdizc - Jump to Subroutine.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/9E36 9C 58 35 STZ $3558  [$7E:3558] A:0008 X:0020 Y:0001 P:envMxdizc - Store Zero in 7E3558
$03/9E39 C9 05 CMP #$05 A:0008 X:0020 Y:0001 P:envMxdizc - Is A 05?
$03/9E3B 90 03 BCC $03    [$9E40] A:0008 X:0020 Y:0001 P:envMxdizC - If so branch to 039E40.
$03/9E3D EE 58 35 INC $3558  [$7E:3558] A:0008 X:0020 Y:0001 P:envMxdizC - +1 to 7E3558.
$03/9E40 20 89 84 JSR $8489  [$03:8489] A:0008 X:0020 Y:0001 P:envMxdizC - Jump to Subroutine (Timing Routine?)
$03/9E43 A6 A6 LDX $A6    [$00:00A6] A:0000 X:0900 Y:0001 P:envMxdizc - Load X from A6.
$03/9E45 BD 60 20 LDA $2060,x[$7E:2460] A:0000 X:0400 Y:0001 P:envMxdizc - Load A from Slot's Speed Byte.
$03/9E48 85 A9 STA $A9    [$00:00A9] A:0010 X:0400 Y:0001 P:envMxdizc - Store A in A9.
$03/9E4A BD 61 20 LDA $2061,x[$7E:2461] A:0010 X:0400 Y:0001 P:envMxdizc - Load A from Slot's Speed Byte 2.
$03/9E4D 85 AA STA $AA    [$00:00AA] A:0000 X:0400 Y:0001 P:envMxdiZc - Store A in AA.
$03/9E4F BD 3B 20 LDA $203B,x[$7E:243B] A:0000 X:0400 Y:0001 P:envMxdiZc - Load A from Speed Modifier
$03/9E52 A8 TAY A:0010 X:0400 Y:0001 P:envMxdizc - Transfer A to Y.
$03/9E53 8C 79 39 STY $3979  [$7E:3979] A:0010 X:0400 Y:0010 P:envMxdizc - Store Y in 7E3979
$03/9E56 DA PHX A:0010 X:0400 Y:0010 P:envMxdizc - Push X.
$03/9E57 A5 D6 LDA $D6    [$00:00D6] A:0010 X:0400 Y:0010 P:envMxdizc - Load D6 into A.
$03/9E59 0A ASL A A:0006 X:0400 Y:0010 P:envMxdizc - x2 A.
$03/9E5A AA TAX A:000C X:0400 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 A from 03A011.
$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 A from 03A012
$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 - Push X Left.
$03/9E6C DC 80 00 JML [$0080][$03:9F0D] A:0003 X:0400 Y:0010 P:envMxdizc - Jump Long to 039F0D.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/9F0D AD 58 35 LDA $3558  [$7E:3558] A:0003 X:0400 Y:0010 P:envMxdizc - Load A from 7E3558.
$03/9F10 F0 05 BEQ $05    [$9F17] A:0001 X:0400 Y:0010 P:envMxdizc - Branch if 00 t0 039F17.
$03/9F12 BD 2F 20 LDA $202F,x[$7E:242F] A:0001 X:0400 Y:0010 P:envMxdizc - Load Slot's ?Run Strength?
$03/9F15 80 03 BRA $03    [$9F1A] A:0010 X:0400 Y:0010 P:envMxdizc - Branch to 039F1A
$03/9F1A 18 CLC A:0010 X:0400 Y:0010 P:envMxdizc - Clear Carry Flag.
$03/9F1B 69 14 ADC #$14 A:0010 X:0400 Y:0010 P:envMxdizc - Add 14 to A.
$03/9F1D AA TAX A:0024 X:0400 Y:0010 P:envMxdizc - Transfer A to X.
$03/9F1E 86 A9 STX $A9    [$00:00A9] A:0024 X:0024 Y:0010 P:envMxdizc - Store X in A9.
$03/9F20 20 E2 9F JSR $9FE2  [$03:9FE2] A:0024 X:0024 Y:0010 P:envMxdizc - Jump to Subroutine
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/9FE2 A6 A9 LDX $A9    [$00:00A9] A:0024 X:0024 Y:0010 P:envMxdizc - Load X from A9.
$03/9FE4 8E 3D 39 STX $393D  [$7E:393D] A:0024 X:0024 Y:0010 P:envMxdizc - Store X in 7E393D
$03/9FE7 AE 79 39 LDX $3979  [$7E:3979] A:0024 X:0024 Y:0010 P:envMxdizc - Load X from 7E39F9
$03/9FEA 8E 3F 39 STX $393F  [$7E:393F] A:0024 X:0010 Y:0010 P:envMxdizc - Store X in 7E393F
$03/9FED 20 B9 83 JSR $83B9  [$03:83B9] A:0024 X:0010 Y:0010 P:envMxdizc - Jump to Subroutine (Divide's several 393X values)
$03/9FF0 AE 41 39 LDX $3941  [$7E:3941] A:0000 X:0000 Y:0010 P:envMxdiZc - Load X from 7E3941
$03/9FF3 8E 45 39 STX $3945  [$7E:3945] A:0000 X:0240 Y:0010 P:envMxdizc - Store X in 7E3945.
$03/9FF6 A2 10 00 LDX #$0010 A:0000 X:0240 Y:0010 P:envMxdizc - Load 10 into X.
$03/9FF9 8E 47 39 STX $3947  [$7E:3947] A:0000 X:0010 Y:0010 P:envMxdizc - Store X in 7E3947
$03/9FFC 20 07 84 JSR $8407  [$03:8407] A:0000 X:0010 Y:0010 P:envMxdizc - Jump to Subroutine (Something with HP?)
$03/9FFF AE 49 39 LDX $3949  [$7E:3949] A:0000 X:0000 Y:0010 P:envMxdiZc - Load X from 7E3949.
$03/A002 86 AB STX $AB    [$00:00AB] A:0000 X:0024 Y:0010 P:envMxdizc - Store X in AB.
$03/A004 60 RTS A:0000 X:0024 Y:0010 P:envMxdizc - Return
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/9F23 4C D9 9F JMP $9FD9  [$03:9FD9] A:0000 X:0024 Y:0010 P:envMxdizc - Jump to Subroutine
$03/9FD9 A4 AB LDY $AB    [$00:00AB] A:0000 X:0024 Y:0010 P:envMxdizc - Load AB into Y.
$03/9FDB 10 02 BPL $02    [$9FDF] A:0000 X:0024 Y:0024 P:envMxdizc - Branch if Positive to 039FDF
-----------------------------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------------------------------
$03/9FDF 84 D4 STY $D4    [$00:00D4] A:0000 X:0024 Y:0024 P:envMxdizc - Store Y in D4.
$03/9FE1 60 RTS A:0000 X:0024 Y:0024 P:envMxdizc - Return
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/CB99 A9 09 LDA #$09 A:0000 X:0024 Y:0024 P:envMxdizc - Load 09 into A.
$03/CB9B 20 C8 85 JSR $85C8  [$03:85C8] A:0009 X:0024 Y:0024 P:envMxdizc - Jump to Subroutine (Was thought to deal something with healing, but now I'm not sure, Seems to be loading the values that were holding Run Strength and depositing them in several different areas.)
$03/CB9E A9 40 LDA #$40 A:0000 X:00B1 Y:0024 P:envMxdiZc - Load 40 into A.
$03/CBA0 9D 06 2A STA $2A06,x[$7E:2AB7] A:0040 X:00B1 Y:0024 P:envMxdizc - Store A in 7E2AB7.
$03/CBA3 A5 CF LDA $CF    [$00:00CF] A:0040 X:00B1 Y:0024 P:envMxdizc - Load A from CF.
$03/CBA5 0A ASL A A:0008 X:00B1 Y:0024 P:envMxdizc - x2 A.
$03/CBA6 AA TAX A:0010 X:00B1 Y:0024 P:envMxdizc - Transfer A to X.
$03/CBA7 BD EB 29 LDA $29EB,x[$7E:29FB] A:0010 X:0010 Y:0024 P:envMxdizc - Load A from Bitmask of Active Status.
$03/CBAA 09 10 ORA #$10 A:0040 X:0010 Y:0024 P:envMxdizc - Add 10 to A.
$03/CBAC 9D EB 29 STA $29EB,x[$7E:29FB] A:0050 X:0010 Y:0024 P:envMxdizc - Store A in Bitmask of Active Status.
$03/CBAF A5 D4 LDA $D4    [$00:00D4] A:0050 X:0010 Y:0024 P:envMxdizc - Load A from D4.
$03/CBB1 9D 2A 2B STA $2B2A,x[$7E:2B3A] A:0024 X:0010 Y:0024 P:envMxdizc - Store A in 7E2B2A (definitely worth checking this out. It's clear this isn't "Run Strength".
$03/CBB4 A5 D5 LDA $D5    [$00:00D5] A:0024 X:0010 Y:0024 P:envMxdizc - Load A from D5.
$03/CBB6 9D 2B 2B STA $2B2B,x[$7E:2B3B] A:0000 X:0010 Y:0024 P:envMxdiZc - Store A in 7E2B3B
$03/CBB9 AD 09 39 LDA $3909  [$7E:3909] A:0000 X:0010 Y:0024 P:envMxdiZc - Load A from Status Byte 2.
$03/CBBC 29 30 AND #$30 A:0000 X:0010 Y:0024 P:envMxdiZc - Is it 30? (Sleep or Stun?)
$03/CBBE F0 14 BEQ $14    [$CBD4] A:0000 X:0010 Y:0024 P:envMxdiZc - If not branch to 03CBDE.
------------------------------------------------------------------------------------------------------------------------------------------------
$03/CBC0 A9 04 LDA #$04 A:0030 X:0020 Y:0002 P:envMxdizc - Load 04 into A.
$03/CBC2 85 D6 STA $D6    [$00:00D6] A:0004 X:0020 Y:0002 P:envMxdizc - Store A in D6.
$03/CBC4 A5 CF LDA $CF    [$00:00CF] A:0004 X:0020 Y:0002 P:envMxdizc - Load A from CF.
$03/CBC6 20 36 9E JSR $9E36  [$03:9E36] A:0008 X:0020 Y:0002 P:envMxdizc - Jump to Subroutine (Shown above, it seems to do something with timers and "run strength")
$03/CBC9 A9 03 LDA #$03 A:0000 X:0027 Y:0027 P:envMxdizc - Load 03 into A.
$03/CBCB 20 C8 85 JSR $85C8  [$03:85C8] A:0003 X:0027 Y:0027 P:envMxdizc - Jump to Subroutine (Not really sure anymore)
$03/CBD0 9D 06 2A STA $2A06,x[$7E:2AB1] A:0040 X:00AB Y:0027 P:envMxdizc - Store A in 7E2AB1.
$03/CBD3 60 RTS A:0040 X:00AB Y:0027 P:envMxdizc Return
------------------------------------------------------------------------------------------------------------------------------------------
$03/CBD4 AD 09 39 LDA $3909  [$7E:3909] A:0000 X:0010 Y:0024 P:envMxdiZc - Load A from Status Byte
$03/CBD7 29 03 AND #$03 A:0000 X:0010 Y:0024 P:envMxdiZc - Is it 03? (Calcify1 or 2.)
$03/CBD9 F0 66 BEQ $66    [$CC41] A:0000 X:0010 Y:0024 P:envMxdiZc -  If not branch to 03CC41.
--------------------------------------------------------------------------------------------------------------------------------------------------
$03/CBDB A6 C7 LDX $C7    [$00:00C7] A:0001 X:0020 Y:0001 P:envMxdizc - Load X from C7.
$03/CBDD AD 04 27 LDA $2704  [$7E:2704] A:0001 X:0020 Y:0001 P:envMxdizc - Load A from Target's Status Byte 2.
$03/CBE0 29 FC AND #$FC A:0000 X:0020 Y:0001 P:envMxdiZc - Ignore anything else but Calcify 1 and 2.
$03/CBE2 85 A9 STA $A9    [$00:00A9] A:0000 X:0020 Y:0001 P:envMxdiZc - Store this in A9.
$03/CBE4 AD 04 27 LDA $2704  [$7E:2704] A:0000 X:0020 Y:0001 P:envMxdiZc - Load A from Target's Status Byte 2.
$03/CBE7 29 03 AND #$03 A:0000 X:0020 Y:0001 P:envMxdiZc - Is it 03? (Is it Calcify 1 or 2?)
$03/CBE9 F0 2C BEQ $2C    [$CC17] A:0000 X:0020 Y:0001 P:envMxdiZc - If not branch to 03CC17.
----------------------------------------------------------------------------------------------------------------------------------------------
(I don't think you can logically reach this as you can never make a foe react if they're already under Calcify 1 or 2)
----------------------------------------------------------------------------------------------------------------------------------------------
$03/CC17 A9 04 LDA #$04 A:0000 X:0020 Y:0001 P:envMxdiZc - Load 04 into A.
$03/CC19 85 D6 STA $D6    [$00:00D6] A:0004 X:0020 Y:0001 P:envMxdizc - Store A into D6.
$03/CC1B A5 CF LDA $CF    [$00:00CF] A:0004 X:0020 Y:0001 P:envMxdizc - Load A from CF.
$03/CC1D 20 36 9E JSR $9E36  [$03:9E36] A:0008 X:0020 Y:0001 P:envMxdizc - Jump to Subroutine (As above, has something to do with Timers and Run Strength)
$03/CC20 A9 0C LDA #$0C A:0000 X:0027 Y:0027 P:envMxdizc - Load 0C into A
$03/CC22 20 C8 85 JSR $85C8  [$03:85C8] A:000C X:0027 Y:0027 P:envMxdizc - Jump to Subroutine (I am going to guess now that it must deal something with Statuses.)
$03/CC25 A9 40 LDA #$40 A:0000 X:00B4 Y:0027 P:envMxdiZc - Load 40 into A.
$03/CC27 9D 06 2A STA $2A06,x[$7E:2ABA] A:0040 X:00B4 Y:0027 P:envMxdizc - Store A in 7E2A06.
$03/CC2A A5 CF LDA $CF    [$00:00CF] A:0040 X:00B4 Y:0027 P:envMxdizc - Load A from CF.
$03/CC2C 0A ASL A A:0008 X:00B4 Y:0027 P:envMxdizc - x2 A.
$03/CC2D AA TAX A:0010 X:00B4 Y:0027 P:envMxdizc - Transfer A to X.
$03/CC2E BD EB 29 LDA $29EB,x[$7E:29FB] A:0010 X:0010 Y:0027 P:envMxdizc - Load A from Bitmask of Active Status
$03/CC31 09 08 ORA #$08 A:0040 X:0010 Y:0027 P:envMxdizc - Add 08.
$03/CC33 9D EB 29 STA $29EB,x[$7E:29FB] A:0048 X:0010 Y:0027 P:envMxdizc - Store A in Bitmask of Active Status
$03/CC36 A5 D4 LDA $D4    [$00:00D4] A:0048 X:0010 Y:0027 P:envMxdizc - Load A from D4 (Run Strength?).
$03/CC38 9D 44 2B STA $2B44,x[$7E:2B54] A:0027 X:0010 Y:0027 P:envMxdizc - Store A in 7E2B54.
$03/CC3B A5 D5 LDA $D5    [$00:00D5] A:0027 X:0010 Y:0027 P:envMxdizc - Load A from D5.
$03/CC3D 9D 45 2B STA $2B45,x[$7E:2B55] A:0000 X:0010 Y:0027 P:envMxdiZc
$03/CC40 60 RTS A:0000 X:0010 Y:0027 P:envMxdiZc - Return
------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/CC41 60 RTS A:0000 X:0010 Y:0024 P:envMxdiZc - Return
--------------------------------------------------------------------------------------------------------------------------------------------------------------

Looks like this may be the true face of "Run Strength". Something to deal with Poison or possibly any Timer? It is quite interesting to think on its purpose.


Code: [Select]
$03/CC42 7B TDC A:0000 X:0014 Y:0001 P:envmxdiZc - Transfer Direct Page Accumulator 16 bit.
$03/CC43 E2 20 SEP #$20 A:0000 X:0014 Y:0001 P:envmxdiZc - Set Process Status
$03/CC45 60 RTS A:0000 X:0014 Y:0001 P:envMxdiZc - Return

And that's All Damage Subroutines (at least according to Phoenix's Notes) down! Whew, that was a marathon! But now we know where Calcify is, I wonder if its possible to just plug it into the Calcify Spell effect rather than let it run on its own flawed version. Maybe comparing the two will reveal what goes wrong when applying the status with a weapon?

 :edit: No, it is not. I don't know where the issue lies but it is apparently not as simple as linking it to the Calcify Spell Routine.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (All Spells Disassembly)
Post by: chillyfeez on September 27, 2013, 05:14:26 PM
Hey, Grimoire - Just wondering, are you planning on eventually disassembling the Dart routine?
My "things I'd like to do when I get the chance" list includes looking into whether we can hack the routine to consider the thrown weapon's elemental (and status, for that matter) properties. Something I always felt they were really silly to have left out.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (All Spells Disassembly)
Post by: Grimoire LD on September 27, 2013, 07:25:19 PM
Hmm...

08 1E537-1E5BB   Throw/Dart
--
1C 1ED14-1ED87   (part of Throw/Dart, item check?)

I wouldn't mind taking a look at that. The command (commands?) don't appear to be that long when compared to something like Steal.

So sure, let's see what's there...

Code: [Select]
$03/E34C A9 16 LDA #$16 A:0003 X:002C Y:0000 P:envMxdizc - Load 16 into A. (Dart Text)
$03/E34E 8D C8 34 STA $34C8  [$7E:34C8] A:0016 X:002C Y:0000 P:envMxdizc - Store A in Command Message.
$03/E351 A9 10 LDA #$10 A:0016 X:002C Y:0000 P:envMxdizc - Load 10 into A.
$03/E353 8D C7 34 STA $34C7  [$7E:34C7] A:0010 X:002C Y:0000 P:envMxdizc - Store A in 7E34C7.
$03/E356 A9 F8 LDA #$F8 A:0010 X:002C Y:0000 P:envMxdizc - Load F8 into A. (When changed seems to cause a variety of effects but no longer displays damage done)
$03/E358 8D C6 33 STA $33C6  [$7E:33C6] A:00F8 X:002C Y:0000 P:eNvMxdizc - Store A in Graphic/Text Data?
$03/E35B A9 04 LDA #$04 A:00F8 X:002C Y:0000 P:eNvMxdizc - Load 04 into A. (F8 and 04 seems to be related somehow)
$03/E35D 8D C7 33 STA $33C7  [$7E:33C7] A:0004 X:002C Y:0000 P:envMxdizc - Store A in 7E33C7
$03/E360 A5 CE LDA $CE    [$00:00CE] A:0004 X:002C Y:0000 P:envMxdizc - Load A from CE.
$03/E362 30 10 BMI $10    [$E374] A:0083 X:002C Y:0000 P:eNvMxdizc - Branch if negative.
-----------------------------------------------------------------------------------------------------------------------------------------

-------------------------------------------------------------------------------------------------------------------------------------------
$03/E374 AD 81 38 LDA $3881  [$7E:3881] A:0083 X:002C Y:0000 P:eNvMxdizc - Load 7E3881 into A.
$03/E377 D0 EB BNE $EB    [$E364] A:0000 X:002C Y:0000 P:envMxdiZc - If above 00 branch to 03E364
$03/E379 AD D2 26 LDA $26D2  [$7E:26D2] A:0000 X:002C Y:0000 P:envMxdiZc - Load Caster's next Sub-Action into A.
$03/E37C 8D 80 35 STA $3580  [$7E:3580] A:0016 X:002C Y:0000 P:envMxdizc - Store A in 7E3580
$03/E37F AA TAX A:0016 X:002C Y:0000 P:envMxdizc - Transfer A to X.
$03/E380 86 E5 STX $E5    [$00:00E5] A:0016 X:0016 Y:0000 P:envMxdizc - Store X in E5.
$03/E382 A2 00 91 LDX #$9100 A:0016 X:0016 Y:0000 P:envMxdizc - Load 9100 into X.
$03/E385 86 80 STX $80    [$00:0080] A:0016 X:9100 Y:0000 P:eNvMxdizc - Store X in 80.
$03/E387 A9 0F LDA #$0F A:0016 X:9100 Y:0000 P:eNvMxdizc - Load 0F into A.
$03/E389 85 82 STA $82    [$00:0082] A:000F X:9100 Y:0000 P:envMxdizc - Store A in 82.
$03/E38B A9 08 LDA #$08 A:000F X:9100 Y:0000 P:envMxdizc - Load 08 into A.
$03/E38D 20 5E 84 JSR $845E  [$03:845E] A:0008 X:9100 Y:0000 P:envMxdizc - Jump to Subroutine (??)
$03/E390 AD 9D 28 LDA $289D  [$7E:289D] A:0003 X:0008 Y:00B8 P:envMxdiZC - Load Stored Attack Power of Thrown Weapon (Casted Spell's Spell Power) into A. (30 in this case)
$03/E393 85 DF STA $DF    [$00:00DF] A:001E X:0008 Y:00B8 P:envMxdizC - Store A in DF.
$03/E395 AD 82 26 LDA $2682  [$7E:2682] A:001E X:0008 Y:00B8 P:envMxdizC - Load Caster's Level into A. (10 in this case)
$03/E398 85 E1 STA $E1    [$00:00E1] A:000A X:0008 Y:00B8 P:envMxdizC - Store A in E1
$03/E39A 20 E0 83 JSR $83E0  [$03:83E0] A:000A X:0008 Y:00B8 P:envMxdizC - Jump to Subroutine (Cleaning?)
$03/E39D A6 E3 LDX $E3    [$00:00E3] A:0000 X:0000 Y:00B8 P:envMxdiZc - Load X from E3. (300 Base Damage)
$03/E39F 8E 9C 28 STX $289C  [$7E:289C] A:0000 X:012C Y:00B8 P:envMxdizc - Store X into 7E289C
$03/E3A2 20 8B 85 JSR $858B  [$03:858B] A:0000 X:012C Y:00B8 P:envMxdizc - Jump to Subroutine (Random Number Generator)
$03/E3A5 18 CLC A:0001 X:0000 Y:00B8 P:envMxdizc - Clear Carry Flag.
$03/E3A6 6D 9C 28 ADC $289C  [$7E:289C] A:0001 X:0000 Y:00B8 P:envMxdizc - Add the value in 7E289C into A (2C + 1 = 2D This is the damage bonus)
$03/E3A9 85 E3 STA $E3    [$00:00E3] A:002D X:0000 Y:00B8 P:envMxdizc - Store A in E3.
$03/E3AB A9 00 LDA #$00 A:002D X:0000 Y:00B8 P:envMxdizc -  Load 00 into A.
$03/E3AD 6D 9D 28 ADC $289D  [$7E:289D] A:0000 X:0000 Y:00B8 P:envMxdiZc - Add the value in 7E289D into A.
$03/E3B0 85 E4 STA $E4    [$00:00E4] A:0001 X:0000 Y:00B8 P:envMxdizc - Store A in E4 (E3 and E4 are likely damage holders.)
$03/E3B2 A6 E3 LDX $E3    [$00:00E3] A:0001 X:0000 Y:00B8 P:envMxdizc - Load X from E3.
$03/E3B4 E0 0F 27 CPX #$270F A:0001 X:012D Y:00B8 P:envMxdizc - Compare X to 9999 Damage.
$03/E3B7 90 05 BCC $05    [$E3BE] A:0001 X:012D Y:00B8 P:eNvMxdizc - Is it dealing 9999 damage? (Oh I'm an idiot! That's what all of those "270F had meant!")
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E3B9 A2 0F 27 LDX #$270F A:0001 X:0188 Y:00B8 P:eNvMxdizc - Then deal 9999 damage.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E3BE A5 CE LDA $CE    [$00:00CE] A:0001 X:012D Y:00B8 P:eNvMxdizc - Load A from CE.
$03/E3C0 20 72 CA JSR $CA72  [$03:CA72] A:0080 X:012D Y:00B8 P:eNvMxdizc - Jump to Subroutine (Cleaning Routine)
$03/E3A5 18 CLC A:004F X:0000 Y:00B8 P:envMxdizc - Clear Carry Flag
$03/E3C3 A5 E3 LDA $E3    [$00:00E3] A:000A X:000A Y:00B8 P:envMxdizc - Load A from E3.
$03/E3C5 9D D4 34 STA $34D4,x[$7E:34DE] A:007B X:000A Y:00B8 P:envMxdizc - Store A in 7E34DE.
$03/E3C8 A5 E4 LDA $E4    [$00:00E4] A:007B X:000A Y:00B8 P:envMxdizc - Load A from E4,
$03/E3CA 9D D5 34 STA $34D5,x[$7E:34DF] A:0001 X:000A Y:00B8 P:envMxdizc - Store A in 7E34DF.
$03/E3CD 20 7E CA JSR $CA7E  [$03:CA7E] A:0001 X:000A Y:00B8 P:envMxdizc - Jump to Subroutine (Damage Dealing Routine)
(From there it eventually jumps into the normal routine and ends)
---------------------------------------------------------------------------------------------------------------------------------------------------------------


This is the Thrown part of the code. DeathLike2 was right on the mark as far as damage went. Level * Attack Power of Thrown Weapon + Random 0,98= Throw's damage. We can change that as we like moving forward. All the pieces in doing so are right there.

Though how to make it take Elemental into effect... hmm... that is a difficult one.


289D      Casted Spell's Spell Power
289E      Casted Spell's Hit Percentage
28A0      Casted Spell's ???
28A1      Casted Spell's MP Cost.
28A2      Casted Spell's Elemental
28A3-28A4 Casted Spell's Status Infliction.

And then the Statuses are stored in AD and AE. Of course if you can find another way to go about it then that might be for the best. I have a few ideas that I'll have to try out a little later.

 :edit: It does appear as if the Thrown Weapon's Elemental and Status Inflictions are never recorded by the game unfortunately, hmm... I'll have to take a look at the second Throw/Dart formula listed and see if that helps at all.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (All Spells Disassembly)
Post by: Grimoire LD on September 28, 2013, 12:50:07 AM
Immense Updates to Damage Subroutines at the top of the page, with a nearly full list of everything included therein.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (All Spells Disassembly)
Post by: Grimoire LD on September 28, 2013, 11:18:12 AM
I thought it was short and I'm working on limited time anyhow, so...

Change Routine
Code: [Select]
$03/E3D1 7B TDC A:0003 X:0034 Y:0000 P:envMxdizc - Transfer Direct Page.
$03/E3D2 AA TAX A:0000 X:0034 Y:0000 P:envMxdiZc - Transfer A to X.
$03/E3D3 A8 TAY A:0000 X:0000 Y:0000 P:envMxdiZc - Transfer A to Y.
$03/E3D4 BD 01 20 LDA $2001,x[$7E:2001] A:0000 X:0000 Y:0000 P:envMxdiZc - Load Character's Row/Long Range/Class byte into A.
$03/E3D7 85 A9 STA $A9    [$00:00A9] A:0020 X:0000 Y:0000 P:envMxdizc - Store A in A9.
$03/E3D9 29 80 AND #$80 A:0020 X:0000 Y:0000 P:envMxdizc - Is it 80?
$03/E3DB 49 80 EOR #$80 A:0000 X:0000 Y:0000 P:envMxdiZc - Add 80.
$03/E3DD 85 AA STA $AA    [$00:00AA] A:0080 X:0000 Y:0000 P:eNvMxdizc - Store A  in AA.
$03/E3DF A5 A9 LDA $A9    [$00:00A9] A:0080 X:0000 Y:0000 P:eNvMxdizc - Load A from A9
$03/E3E1 29 7F AND #$7F A:0020 X:0000 Y:0000 P:envMxdizc - Add +80 if applicable to A.
$03/E3E3 05 AA ORA $AA    [$00:00AA] A:0020 X:0000 Y:0000 P:envMxdizc - Add 80 into register?
$03/E3E5 9D 01 20 STA $2001,x[$7E:2001] A:00A0 X:0000 Y:0000 P:eNvMxdizc - Store A in Row/Long Range/ID.
$03/E3E8 C2 20 REP #$20 A:00A0 X:0000 Y:0000 P:eNvMxdizc - Reset Process Status.
$03/E3EA 8A TXA A:00A0 X:0000 Y:0000 P:eNvmxdizc - Transfer X to A.
$03/E3EB 18 CLC A:0000 X:0000 Y:0000 P:envmxdiZc - Clear Carry Flag.
$03/E3EC 69 80 00 ADC #$0080 A:0000 X:0000 Y:0000 P:envmxdiZc - Add 80 to A.
$03/E3EF AA TAX A:0080 X:0000 Y:0000 P:envmxdizc - Transfer A to X.
$03/E3F0 7B TDC A:0080 X:0080 Y:0000 P:envmxdizc - Transfer Direc Page.
$03/E3F1 E2 20 SEP #$20 A:0000 X:0080 Y:0000 P:envmxdiZc - Set Processor Status.
$03/E3F3 C8 INY A:0000 X:0080 Y:0000 P:envMxdiZc - Increment Y.
$03/E3F4 C0 05 00 CPY #$0005 A:0000 X:0080 Y:0001 P:envMxdizc - Has it gone through 05 times? (For each party member slot?)
$03/E3F7 D0 DB BNE $DB    [$E3D4] A:0000 X:0080 Y:0001 P:eNvMxdizc If not loop back from 03E3D4.
$03/E3F9 60 RTS A:0000 X:0280 Y:0005 P:envMxdiZC - Return

Hmm, nothing about graphical representation here as far as I can tell. It all seems fairly straightforward.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (All Spells Disassembly)
Post by: Grimoire LD on September 29, 2013, 10:12:36 PM
Code: [Select]
Let's switch gears here a little to Item Acquisition...

$00/9818 A9 01 LDA #$01 A:0000 X:0000 Y:00D0 P:envMxdizC - Load 01 into A.
$00/981A 85 06 STA $06    [$00:0606] A:0001 X:0000 Y:00D0 P:envMxdizC - Store A in 0606.
$00/981C AD FB 08 LDA $08FB  [$00:08FB] A:0001 X:0000 Y:00D0 P:envMxdizC - Load A from Item Identifier
$00/981F C9 60 CMP #$60 A:00CE X:0000 Y:00D0 P:eNvMxdizC - Compare it to 60 (End of arrows)
$00/9821 B0 08 BCS $08    [$982B] A:00CE X:0000 Y:00D0 P:envMxdizC - If it is more than 60 branch to 00982B
--------------------------------------------------------------------------------------------------------------------------

--------------------------------------------------------------------------------------------------------------------------
$00/982B A0 00 00 LDY #$0000 A:00CE X:0000 Y:00D0 P:envMxdizC - Load 00 into Y.
----------------------------------------(Looping Point)---------------------------------------------------------------------------------------
$00/982E B9 40 14 LDA $1440,y[$00:1440] A:00CE X:0000 Y:0000 P:envMxdiZC - Load A from First Item Slot
$00/9831 CD FB 08 CMP $08FB  [$00:08FB] A:0016 X:0000 Y:0000 P:envMxdizC - Is it the same item as currently in the First Item Slot?
$00/9834 D0 07 BNE $07    [$983D] A:0016 X:0000 Y:0000 P:envMxdizc - If not, branch to 00983D
-----------------------------------------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------------------------------------------
$00/983D C8 INY A:0016 X:0000 Y:0000 P:envMxdizc - +1 to X.
$00/983E C8 INY A:0016 X:0000 Y:0001 P:envMxdizc - +1 to Y.
$00/983F C0 60 00 CPY #$0060 A:0016 X:0000 Y:0002 P:envMxdizc - Has it passed through 60 slots?
$00/9842 D0 EA BNE $EA    [$982E] A:0016 X:0000 Y:0002 P:eNvMxdizc - If not loop back to 00982E.
---------------------------------------------------------------------------------------------------------------------------------------
$00/9844 A0 00 00 LDY #$0000 A:00FF X:0000 Y:0060 P:envMxdiZC - Load 00 into Y.
---------------------------------------------------(Looping Point)--------------------------------------------------------------------------------
$00/9847 B9 40 14 LDA $1440,y[$00:1440] A:00FF X:0000 Y:0000 P:envMxdiZC - Load the first Item Slot into A.
$00/984A F0 5E BEQ $5E    [$98AA] A:0016 X:0000 Y:0000 P:envMxdizC - If it is 00 branch to 0098AA.
$00/984C C8 INY A:0016 X:0000 Y:0000 P:envMxdizC - +1 to Y.
$00/984D C8 INY A:0016 X:0000 Y:0001 P:envMxdizC +1 to Y.
$00/984E C0 60 00 CPY #$0060 A:0016 X:0000 Y:0002 P:envMxdizC - Has it passed through 60 slots?
$00/9851 F0 03 BEQ $03    [$9856] A:0016 X:0000 Y:0002 P:eNvMxdizc - If so, branch to 009856.
$00/9853 4C 47 98 JMP $9847  [$00:9847] A:0016 X:0000 Y:0002 P:eNvMxdizc - Jump to 9847 (Why not loop?)
----------------------------------------------------------------------------------------------------------------------------------
$00/98AA AD FB 08 LDA $08FB  [$00:08FB] A:0000 X:0000 Y:0002 P:envMxdiZc - Load A from ?Item Storage spot?
$00/98AD 99 40 14 STA $1440,y[$00:1442] A:00CE X:0000 Y:0002 P:eNvMxdizc - Store A in Open Item Slot.
$00/98B0 B9 41 14 LDA $1441,y[$00:1443] A:00CE X:0000 Y:0002 P:eNvMxdizc - Load A from Open Item Slot Quantity.
$00/98B3 18 CLC A:0000 X:0000 Y:0002 P:envMxdiZc - Clear Carry Flag.
$00/98B4 65 06 ADC $06    [$00:0606] A:0000 X:0000 Y:0002 P:envMxdiZc - Add Value from 0606.
$00/98B6 C9 64 CMP #$64 A:0001 X:0000 Y:0002 P:envMxdizc - Has it reached 100?
$00/98B8 90 0D BCC $0D    [$98C7] A:0001 X:0000 Y:0002 P:eNvMxdizc - If so branch to 0098C7.
----------------------------------------------------------------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------------------------------------------------------------
$00/98C7 99 41 14 STA $1441,y[$00:1443] A:0001 X:0000 Y:0002 P:eNvMxdizc - Store A in Open Item Slot Quantity.
$00/98CA 60 RTS A:0001 X:0000 Y:0002 P:eNvMxdizc - Return

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


It's not quite finished, but I've found all of the essential pieces I need.


Title: Re: Grimoire LD's Notes, Methods, and Hacks (All Spells Disassembly)
Post by: Grimoire LD on October 01, 2013, 08:04:02 PM
Let's get back to commands shall we? We will start anew with Peep.

Code: [Select]
$03/E153 AD 70 27 LDA $2770  [$7E:2770] A:0003 X:0028 Y:0000 P:envMxdizc - Load Target's Boss Bit/Level Bit.
$03/E156 10 03 BPL $03    [$E15B] A:0006 X:0028 Y:0000 P:envMxdizc - If it is 00 or above branch to 03E15B. (if 80 or more which is the Boss Bit, don't branch)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E158 4C B1 E1 JMP $E1B1  [$03:E1B1] A:008A X:0028 Y:0000 P:eNvMxdizc -(Go to RTS)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E15B C2 20 REP #$20 A:0006 X:0028 Y:0000 P:envMxdizc - Reset Processor Status
$03/E15D AD 07 27 LDA $2707  [$7E:2707] A:0006 X:0028 Y:0000 P:envmxdizc - Load A from Target's Current HP.
$03/E160 8D 9A 35 STA $359A  [$7E:359A] A:01F4 X:0028 Y:0000 P:envmxdizc - Store A in 7E359A.
$03/E163 AD 09 27 LDA $2709  [$7E:2709] A:01F4 X:0028 Y:0000 P:envmxdizc - Load A from Target's Max HP.
$03/E166 8D 9D 35 STA $359D  [$7E:359D] A:01F4 X:0028 Y:0000 P:envmxdizc - Store a 7E359D.
$03/E169 7B TDC A:01F4 X:0028 Y:0000 P:envmxdizc - Transfer Direct Page.
$03/E16A E2 20 SEP #$20 A:0000 X:0028 Y:0000 P:envmxdiZc - Set Processor Status
$03/E16C 9C 9C 35 STZ $359C  [$7E:359C] A:0000 X:0028 Y:0000 P:envMxdiZc - Store Zero in 7E359C.
$03/E16F 9C 9F 35 STZ $359F  [$7E:359F] A:0000 X:0028 Y:0000 P:envMxdiZc - Store Zero in 7E359F.
$03/E172 AD 20 27 LDA $2720  [$7E:2720] A:0000 X:0028 Y:0000 P:envMxdiZc - Load Target's Weakness
$03/E175 2D 25 27 AND $2725  [$7E:2725] A:0010 X:0028 Y:0000 P:envMxdizc - -Their Resistances?
$03/E178 49 FF EOR #$FF A:0000 X:0028 Y:0000 P:envMxdiZc - ??
$03/E17A 2D 20 27 AND $2720  [$7E:2720] A:00FF X:0028 Y:0000 P:eNvMxdizc - ?And Their Weaknesses?)
$03/E17D 29 3F AND #$3F A:0010 X:0028 Y:0000 P:envMxdizc - ?And 3F?
$03/E17F 85 A9 STA $A9    [$00:00A9] A:0010 X:0028 Y:0000 P:envMxdizc - Store Weakness - Applicable Resistances in A9.
$03/E181 D0 07 BNE $07    [$E18A] A:0010 X:0028 Y:0000 P:envMxdizc - If not 00 branch to 03E18A
------------------------------------------------------------------------------------------------------

-------------------------------------------------------------------------------------------------------
$03/E18A 7B TDC A:0010 X:0028 Y:0000 P:envMxdizc - Transfer Direct Page.
$03/E18B AA TAX A:0000 X:0028 Y:0000 P:envMxdiZc - Transfer A to X
$03/E18C A8 TAY A:0000 X:0000 Y:0000 P:envMxdiZc - Transfer A to Y.
------------------------------------------------------(Looping Point)---------------------------------------------------------------------
$03/E18D 46 A9 LSR $A9    [$00:00A9] A:0000 X:0000 Y:0000 P:envMxdiZc - /2 Value in A9. (Weaknesses)
$03/E18F 90 08 BCC $08    [$E199] A:0000 X:0000 Y:0000 P:envMxdizc - If clear flag is set branch to 03E199.
------------------------------------------------------------------------------------------------------------------------------------------
$03/E191 98 TYA A:0000 X:0000 Y:0004 P:envMxdiZC - Transfer Y to A.
$03/E192 18 CLC A:0004 X:0000 Y:0004 P:envMxdizC - Clear Carry Flag
$03/E193 69 15 ADC #$15 A:0004 X:0000 Y:0004 P:envMxdizc - Add 15 to A (making it 19 which is HP message)
$03/E195 9D CB 34 STA $34CB,x[$7E:34CB] A:0019 X:0000 Y:0004 P:envMxdizc - Store A in 7E34CB. (Battle Message Data)
--------------------------------------------------------------------------------------------------------------------------------------------
$03/E199 C8 INY A:0000 X:0000 Y:0000 P:envMxdizc - +1 to Y.
$03/E19A C0 06 00 CPY #$0006 A:0000 X:0000 Y:0001 P:envMxdizc - Has it done this six times?
$03/E19D D0 EE BNE $EE    [$E18D] A:0000 X:0000 Y:0001 P:eNvMxdizc - If not, loop back ot 03E18D
$03/E19F 20 A6 85 JSR $85A6  [$03:85A6] A:0019 X:0001 Y:0006 P:envMxdiZC - Jump to Subroutine (??)
$03/E1A2 A9 1E LDA #$1E A:0003 X:0001 Y:0006 P:envMxdizC - Load Message 1E into A.
$03/E1A4 8D CA 34 STA $34CA  [$7E:34CA] A:001E X:0001 Y:0006 P:envMxdizC - Store A in 7E34CA (Battle Message Data)
$03/E1A7 A9 14 LDA #$14 A:001E X:0001 Y:0006 P:envMxdizC - Load 14 into A
$03/E1A9 8D C8 34 STA $34C8  [$7E:34C8] A:0014 X:0001 Y:0006 P:envMxdizC - Store A in...? (no idea what this value does, if it does anything)
$03/E1AC A9 10 LDA #$10 A:0014 X:0001 Y:0006 P:envMxdizC - Load 10 into A.
$03/E1AE 8D C7 34 STA $34C7  [$7E:34C7] A:0010 X:0001 Y:0006 P:envMxdizC - Store A in...? (no idea what this value does)
$03/E1B1 60 RTS A:0010 X:0001 Y:0006 P:envMxdizC - Return

Now this is mysterious! Everything about this seems stupidly similar to the spell Peep (and indeed works exactly like it in-game) but that 14 and 10, while unique to this Command that are loaded closeby into 7E34C7 and 7E34C8 don't do Anything. They can be erased and you will see no change to the normal execution of the command. I've set a breakpoint on 7E34C7 and saw several references to it looking at 10 specifically, but I could not Fathom what this is actually doing. Whatever it is doing it seems to be a heavily buried concept. In any case it can't be terribly important, as I've said I can delete both and change them to 00 and nothing different happens. Unfortunately I can't quite grasp on how to make it read a Spell (or else I would just have it use Scan) maybe that knowledge will become available once I figure out more spell based commands like Recall and Pray.


Here Square, let me help you out a little with this...

Code: [Select]
$03/E153 A9 0D LDA #$0D A:0003 X:0028 Y:0000 P:envMxdizc - Load Peep into A.
$03/E155 8D D2 26 STA $26D2  [$7E:26D2] A:000D X:0028 Y:0000 P:envMxdizc  - Store A in Next Action to Take
$03/E158 9C C4 33 STZ $33C4  [$7E:33C4] A:000D X:0028 Y:0000 P:envMxdizc - Store Zero in 7E33C4.
$03/E15B 4C 3E CD JMP $CD3E  [$03:CD3E] A:000D X:0028 Y:0000 P:envMxdizc - Jump to Magic Call.

And Done!

That accomplishes the Peep Command in only 12 Bytes. When the normal command is...

94 Bytes. That frees up 82 Bytes for "Airship" Or whatever the "crash the game" skill was supposed to be. Or should it be a Mechanize skill that looks for the Third Weapon Property to work? (As all Hammers have) That will transform the Foe into a Machine? Or maybe he should get a variation on his FFIV DS skill that would turn his weapon into an Elemental, using the system laid down by Salve that looks for the first reference to an Elemental-Damage Item, and stores that in Cid's Elemental Attack.

And if we do go the Airship Route, what would it exactly do? From the sound of things it may have been intended to be an Airstrike of some sort. (After all Cid did say he had the Enterprise on Remote Control) Non-Elemental Damage on all enemies using Strength as a base, maybe? The possibilities in this regard are literally endless. (Or within 82 Bytes worth)
Title: Re: Grimoire LD's Notes, Methods, and Hacks (All Spells Disassembly)
Post by: Grimoire LD on October 01, 2013, 09:56:58 PM
Steal Routine

Code: [Select]
$03/E1CC A9 17 LDA #$17 A:0003 X:002E Y:0000 P:envMxdizc - Load 17 into A.
$03/E1CE 8D C8 34 STA $34C8  [$7E:34C8] A:0017 X:002E Y:0000 P:envMxdizc - Store A in 7E34C8
$03/E1D1 A9 10 LDA #$10 A:0017 X:002E Y:0000 P:envMxdizc - Load 10 into A.
$03/E1D3 8D C7 34 STA $34C7  [$7E:34C7] A:0010 X:002E Y:0000 P:envMxdizc - Store A in 7E34C7
$03/E1D6 A9 F8 LDA #$F8 A:0010 X:002E Y:0000 P:envMxdizc - Load F8 into A.
$03/E1D8 8D C6 33 STA $33C6  [$7E:33C6] A:00F8 X:002E Y:0000 P:eNvMxdizc - Store A in 7E33C6,
$03/E1DB A9 04 LDA #$04 A:00F8 X:002E Y:0000 P:eNvMxdizc - Load 04 into A.
$03/E1DD 8D C7 33 STA $33C7  [$7E:33C7] A:0004 X:002E Y:0000 P:envMxdizc - Store A in 7E33C7
$03/E1E0 20 B1 85 JSR $85B1  [$03:85B1] A:0004 X:002E Y:0000 P:envMxdizc - Jump to Subroutine (Nothing of great value as far as I can tell)
$03/E1E3 A5 CE LDA $CE    [$00:00CE] A:0003 X:002E Y:0000 P:envMxdizc - Load CE into A. (Is the Target a Monster?)
$03/E1E5 30 03 BMI $03    [$E1EA] A:0081 X:002E Y:0000 P:eNvMxdizc - Branch if Negative to 03E1EA.
-----------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E1E7 4C 39 E2 JMP $E239  [$03:E239] A:0001 X:002E Y:0000 P:envMxdizc - Jump to 03E239.
----------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E1EA 20 8B 85 JSR $858B  [$03:858B] A:0081 X:002E Y:0000 P:eNvMxdizc - 03858B - Jump to RNG Routine.
$03/E1ED 85 A9 STA $A9    [$00:00A9] A:000F X:0000 Y:0000 P:eNvMxdizc - Store Random Number in A9.
$03/E1EF 18 CLC A:0035 X:0000 Y:0000 P:envMxdizc - Clear Carry Flag.
$03/E1F0 A9 32 LDA #$32 A:0035 X:0000 Y:0000 P:envMxdizc - Load 32 into A (50?)
$03/E1F2 6D 82 26 ADC $2682  [$7E:2682] A:0032 X:0000 Y:0000 P:envMxdizc - + Caster's Level.
$03/E1F5 38 SEC A:003C X:0000 Y:0000 P:envMxdizc - Set Carry Flag
$03/E1F6 ED 2F 27 SBC $272F  [$7E:272F] A:003C X:0000 Y:0000 P:envMxdizC - (Oh my God... It's the real purpose of 2F in Data... "Run Strength" is actually "Steal Prevention" - It mostly coincides with Enemy Level + 10, which is why we thought it was based solely on level. So what Cry actually does is it Increases your chance to Steal... So Why in Heaven's Name is it given to a character that can't even be in the party at the same time as the one with Steal?!.)
$03/E1F9 B0 04 BCS $04    [$E1FF] A:002C X:0000 Y:0000 P:envMxdizC - If greater than 00? branch to 03E1FF
---------------------------------------------------------------------------------------------------------------------------------------------------
$03/E1FB A9 01 LDA #$01 A:00CE X:0000 Y:0000 P:eNvMxdizc - Load 01 into A.
$03/E1FD 80 06 BRA $06    [$E205] A:0001 X:0000 Y:0000 P:envMxdizc - Branch to 03E205.
--------------------------------------------------------------------------------------------------------------------------------------------------
$03/E1FF C9 63 CMP #$63 A:002C X:0000 Y:0000 P:envMxdizC - Compare it to 100.
$03/E201 90 02 BCC $02    [$E205] A:002C X:0000 Y:0000 P:eNvMxdizc - If less than 100 branch to 03E205.
---------------------------------------------------------------------------------------------------------------------------------
$03/E203 A9 63 LDA #$63 A:0063 X:0000 Y:0000 P:envMxdiZC - Load 63 into A.
----------------------------------------------------------------------------------------------------------------------------------
$03/E205 C5 A9 CMP $A9    [$00:00A9] A:002C X:0000 Y:0000 P:eNvMxdizc - Compare A to the Random Number.
$03/E207 B0 36 BCS $36    [$E23F] A:002C X:0000 Y:0000 P:eNvMxdizc - If greater than it branch to 03E23F (Successful Steal)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E209 20 8B 85 JSR $858B  [$03:858B] A:002C X:0000 Y:0000 P:eNvMxdizc - Jump to Subroutine (Random Number Generator)
$03/E20C CD 2F 27 CMP $272F  [$7E:272F] A:0047 X:0000 Y:0000 P:envMxdizc - Compare to Target's Steal Prevention.
$03/E20F 90 28 BCC $28    [$E239] A:0047 X:0000 Y:0000 P:envMxdizC - If less than Target's Steal Prevention branch to 03E239.
------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E211 C2 20 REP #$20 A:0047 X:0000 Y:0000 P:envMxdizC - Reset Processor Status
$03/E213 AD 89 26 LDA $2689  [$7E:2689] A:0047 X:0000 Y:0000 P:envmxdizC - Load Caster's Max HP.
$03/E216 20 84 84 JSR $8484  [$03:8484] A:00C8 X:0000 Y:0000 P:envmxdizC - Jump to Subroutine (/Max HP amount by 8.)
$03/E219 85 A9 STA $A9    [$00:00A9] A:000C X:0000 Y:0000 P:envmxdizC - Store A (Damage?) in A9.
$03/E21B A9 00 00 LDA #$0000 A:000C X:0000 Y:0000 P:envmxdizC - Load 00 into A.
$03/E21E E2 20 SEP #$20 A:0000 X:0000 Y:0000 P:envmxdiZC - Reset Processor Status.
$03/E220 A5 CD LDA $CD    [$00:00CD] A:0000 X:0000 Y:0000 P:envMxdiZC - Load A from CD.
$03/E222 20 72 CA JSR $CA72  [$03:CA72] A:0000 X:0000 Y:0000 P:envMxdiZC - Jump to Subroutine (Possibly dealing something with clearing for damage)
$03/E225 A5 A9 LDA $A9    [$00:00A9] A:0000 X:0000 Y:0000 P:envMxdiZc - Load A9 into A.
$03/E227 9D D4 34 STA $34D4,x[$7E:34D4] A:0000 X:0000 Y:0000 P:envMxdiZc - Store A in 7E34D4 (Damage Slot for Slot 1.)
$03/E22A A5 AA LDA $AA    [$00:00AA] A:0000 X:0000 Y:0000 P:envMxdiZc - Load the value in AA into A.
$03/E22C 9D D5 34 STA $34D5,x[$7E:34D5] A:0000 X:0000 Y:0000 P:envMxdiZc - Store A in 7E34D5
$03/E22F 20 7E CA JSR $CA7E  [$03:CA7E] A:0000 X:0000 Y:0000 P:envMxdiZc - Jump to Subroutine (Definitely Damage)
$03/E232 A9 1C LDA #$1C A:0000 X:0680 Y:001A P:envMxdiZC - Load 1C into A. (Message 1C)
$03/E234 8D CA 34 STA $34CA  [$7E:34CA] A:001C X:0680 Y:001A P:envMxdizC - Store A in 7E34CA (Battle Message Area)
$03/E237 80 05 BRA $05    [$E23E] A:001C X:0680 Y:001A P:envMxdizC - Branch to 03E23E.
-----------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E239 A9 1B LDA #$1B A:0001 X:002E Y:0000 P:envMxdizc - Load 1B into A. (FaileD)
$03/E23B 8D CA 34 STA $34CA  [$7E:34CA] A:001B X:002E Y:0000 P:envMxdizc - Store A in Battle Message Data.
--------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E23E 60 RTS A:001C X:0680 Y:001A P:envMxdizC - Return
------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E23F AD 73 27 LDA $2773  [$7E:2773] A:002C X:0000 Y:0000 P:envMxdizC - Load Target's Item Byte.
$03/E242 29 C0 AND #$C0 A:0076 X:0000 Y:0000 P:envMxdizC - Get rid of inapplicable bits.
$03/E244 C9 C0 CMP #$C0 A:0040 X:0000 Y:0000 P:envMxdizC - Is it C0?
$03/E246 D0 01 BNE $01    [$E249] A:0040 X:0000 Y:0000 P:eNvMxdizc - If not, branch to 03E426
----------------------------------------------------------------------------------------------------------------------------------
(DeathLike2 surmised long ago that you can't steal an Auto-Drop and that's what this is likely related to)
------------------------------------------------------------------------------------------------------------------------------------
$03/E249 7B TDC A:0040 X:0000 Y:0000 P:eNvMxdizc - Transfer Direct Page.
$03/E24A 1A INC A A:0000 X:0000 Y:0000 P:envMxdiZc - +1 to A (+1 to Item)
$03/E24B 85 AA STA $AA    [$00:00AA] A:0001 X:0000 Y:0000 P:envMxdizc - Store A in Quantity Holder.
$03/E24D AD 73 27 LDA $2773  [$7E:2773] A:0001 X:0000 Y:0000 P:envMxdizc - Load Target's Item Byte.
$03/E250 29 3F AND #$3F A:0076 X:0000 Y:0000 P:envMxdizc - Get rid of inapplicable bits.
$03/E252 20 7F 84 JSR $847F  [$03:847F] A:0036 X:0000 Y:0000 P:envMxdizc - Jump to Subroutine (x4 the original value of A)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/847F 0A ASL A A:0036 X:0000 Y:0000 P:envMxdizc - x2 A.
$03/8480 0A ASL A A:006C X:0000 Y:0000 P:envMxdizc - x2 A
$03/8481 60 RTS A:00D8 X:0000 Y:0000 P:eNvMxdizc - Return
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/E255 AA TAX A:00D8 X:0000 Y:0000 P:eNvMxdizc - Transfer A to X.
$03/E256 BF 00 9F 0E LDA $0E9F00,x[$0E:9FD8] A:00D8 X:00D8 Y:0000 P:envMxdizc - Load A from Target's Drop Table.
$03/E25A F0 DD BEQ $DD    [$E239] A:00CF X:00D8 Y:0000 P:eNvMxdizc - Branch if it is 00 to E239. (likely an RTS)
$03/E25C 85 A9 STA $A9    [$00:00A9] A:00CF X:00D8 Y:0000 P:eNvMxdizc - Store Item Value in A9.
$03/E25E C9 61 CMP #$61 A:00CF X:00D8 Y:0000 P:eNvMxdizc - Compare to 61 (Armor Start, likely an Arrow Check)
$03/E260 B0 08 BCS $08    [$E26A] A:00CF X:00D8 Y:0000 P:envMxdizC - If more than 61 branch to 03E26A
-----------------------------------------------------------------------------------------------------------------------
$03/E262 C9 54 CMP #$54 A:005A X:0024 Y:0000 P:eNvMxdizc - Is it 54 or Below?
$03/E264 90 04 BCC $04    [$E26A] A:005A X:0024 Y:0000 P:envMxdizC  - If so, branch to 03E26A.
--------------------------------------------------------------------------------------------------------------------------------
$03/E266 A9 0A LDA #$0A A:005A X:0024 Y:0000 P:envMxdizC - Load 0A (10) into A.
$03/E268 85 AA STA $AA    [$00:00AA] A:000A X:0024 Y:0000 P:envMxdizC - Store A in Quantity Holder .
---------------------------------------------------------------------------------------------------------------------
$03/E26A 7B TDC A:00CF X:00D8 Y:0000 P:envMxdizC - Transfer Direct Page.
$03/E26B AA TAX A:0000 X:00D8 Y:0000 P:envMxdiZC - Transfer A to X.
$03/E26C 9B TXY A:0000 X:0000 Y:0000 P:envMxdiZC - Transfer X to Y.
----------------------------------------------------(Looping Point)--------------------------------------------------------------------------------------
$03/E26D BD 1B 32 LDA $321B,x[$7E:321B] A:0000 X:0000 Y:0000 P:envMxdiZC - Load 7E321B into A (Item menu Data)
$03/E270 C5 A9 CMP $A9    [$00:00A9] A:0016 X:0000 Y:0000 P:envMxdizC - Is the stolen item the same as the current item?
$03/E272 F0 2D BEQ $2D    [$E2A1] A:0016 X:0000 Y:0000 P:envMxdizc - If so branch to 03E2A1.
--------------------------------------------------------------------------------------------------------------------------------------------------
$03/E274 E8 INX A:0016 X:0000 Y:0000 P:envMxdizc +1 to X.
$03/E275 E8 INX A:0016 X:0001 Y:0000 P:envMxdizc + 1 to X
$03/E276 E8 INX A:0016 X:0002 Y:0000 P:envMxdizc +1 to X.
$03/E277 E8 INX A:0016 X:0003 Y:0000 P:envMxdizc +1 to X
$03/E278 C8 INY A:0016 X:0004 Y:0000 P:envMxdizc +1 to Y
$03/E279 C0 30 00 CPY #$0030 A:0016 X:0004 Y:0001 P:envMxdizc - Is Y 30? (Has it looped 30 times?)
$03/E27C D0 EF BNE $EF    [$E26D] A:0016 X:0004 Y:0001 P:eNvMxdizc - If not loop back to 03E26D.
$03/E27E AD F4 38 LDA $38F4  [$7E:38F4] A:00FF X:00C0 Y:0030 P:envMxdiZC - Load 7E38F4 into A.
$03/E281 C9 FF CMP #$FF A:0001 X:00C0 Y:0030 P:envMxdizC - Is it FF?
$03/E283 F0 B4 BEQ $B4    [$E239] A:0001 X:00C0 Y:0030 P:envMxdizc - If so branch to 03E239.
$03/E285 A8 TAY A:0001 X:00C0 Y:0030 P:envMxdizc - Transfer A to Y.
$03/E286 C2 20 REP #$20 A:0001 X:00C0 Y:0001 P:envMxdizc - Reset Processor Status.
$03/E288 0A ASL A A:0001 X:00C0 Y:0001 P:envmxdizc - x2 A.
$03/E289 0A ASL A A:0002 X:00C0 Y:0001 P:envmxdizc - x2 A.
$03/E28A AA TAX A:0004 X:00C0 Y:0001 P:envmxdizc - Transfer A to X.
$03/E28B 7B TDC A:0004 X:0004 Y:0001 P:envmxdizc - Transfer Direct Page.
$03/E28C E2 20 SEP #$20 A:0000 X:0004 Y:0001 P:envmxdiZc - Set Processor Status.
$03/E28E A5 AA LDA $AA    [$00:00AA] A:0000 X:0004 Y:0001 P:envMxdiZc - Load the value in AA into A.
$03/E290 9D 1C 32 STA $321C,x[$7E:3220] A:0001 X:0004 Y:0001 P:envMxdizc - Store A in Item Slot.(Must be the storing of the Item, with a 1 by it.)
$03/E293 A5 A9 LDA $A9    [$00:00A9] A:0001 X:0004 Y:0001 P:envMxdizc - Load A9 (Item) into A.
$03/E295 9D 1B 32 STA $321B,x[$7E:321F] A:00CF X:0004 Y:0001 P:eNvMxdizc - Store A in Item Slot.
$03/E298 86 AB STX $AB    [$00:00AB] A:00CF X:0004 Y:0001 P:eNvMxdizc - Store X in AB.
$03/E29A 5A PHY A:00CF X:0004 Y:0001 P:eNvMxdizc - Push Y.
$03/E29B 20 29 EB JSR $EB29  [$03:EB29] A:00CF X:0004 Y:0001 P:eNvMxdizc - Jump to Subroutine (Part of Item/Dart Check?)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/EB29 F0 71 BEQ $71    [$EB9C] A:00CF X:0004 Y:0001 P:eNvMxdizc - Branch if 00 to 03EB9C.
$03/EB2B C9 DE CMP #$DE A:00CF X:0004 Y:0001 P:eNvMxdizc - Is it DE or above?
$03/EB2D B0 6D BCS $6D    [$EB9C] A:00CF X:0004 Y:0001 P:eNvMxdizc - If so branch to 03EB9C.
$03/EB2F C9 B0 CMP #$B0 A:00CF X:0004 Y:0001 P:eNvMxdizc - Is it B0 or above?
$03/EB31 B0 44 BCS $44    [$EB77] A:00CF X:0004 Y:0001 P:envMxdizC - If so, branch to 03EB77.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/EB33 C9 6D CMP #$6D A:005A X:0004 Y:0001 P:eNvMxdizc - Is it Armor?
$03/EB35 B0 65 BCS $65    [$EB9C] A:005A X:0004 Y:0001 P:eNvMxdizc - If so, branch to 03EB9C.
$03/EB37 C9 61 CMP #$61 A:005A X:0004 Y:0001 P:eNvMxdizc  - Is it Less than Shields?
$03/EB39 90 04 BCC $04    [$EB3F] A:005A X:0004 Y:0001 P:eNvMxdizc - If so, branch to 03EB3F.
---------------------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------------------------
$03/EB3F AA TAX A:005A X:0004 Y:0001 P:eNvMxdizc - Transfer A to X.
$03/EB40 86 E5 STX $E5    [$00:00E5] A:005A X:005A Y:0001 P:envMxdizc - Store X in E5.
$03/EB42 A2 00 91 LDX #$9100 A:005A X:005A Y:0001 P:envMxdizc - Load 9100 into X.
$03/EB45 86 80 STX $80    [$00:0080] A:005A X:9100 Y:0001 P:eNvMxdizc - Store X in 80.
$03/EB47 A9 0F LDA #$0F A:005A X:9100 Y:0001 P:eNvMxdizc - Load 0F into A.
$03/EB49 85 82 STA $82    [$00:0082] A:000F X:9100 Y:0001 P:envMxdizc - Store A in 82.
$03/EB4B A9 08 LDA #$08 A:000F X:9100 Y:0001 P:envMxdizc - Load 08 into A
$03/EB4D 20 5E 84 JSR $845E  [$03:845E] A:0008 X:9100 Y:0001 P:envMxdizc - Jump to Subroutine (??)
$03/EB50 48 PHA A:0000 X:0008 Y:02D8 P:envMxdiZC - Push A onto Stack,
$03/EB51 AD 9C 28 LDA $289C  [$7E:289C] A:0000 X:0008 Y:02D8 P:envMxdiZC - Load Caster's Unknown (3C)
$03/EB54 20 85 84 JSR $8485  [$03:8485] A:0020 X:0008 Y:02D8 P:envMxdizC - Jump to Subroutine (Divide the Unknown 3 times)
 $03/EB57 29 08 AND #$08 A:0004 X:0008 Y:02D8 P:envMxdizc - Add 08 if applicable?
$03/EB59 85 C7 STA $C7    [$00:00C7] A:0000 X:0008 Y:02D8 P:envMxdiZc - Store A in C7.
$03/EB5B 68 PLA A:0000 X:0008 Y:02D8 P:envMxdiZc - Pull A from Stack.
$03/EB5C AA TAX A:0000 X:0008 Y:02D8 P:envMxdiZc - Transfer A to X.
$03/EB5D 86 E5 STX $E5    [$00:00E5] A:0000 X:0000 Y:02D8 P:envMxdiZc - Store X in E5.
$03/EB5F A2 A0 97 LDX #$97A0 A:0000 X:0000 Y:02D8 P:envMxdiZc - Load 97A0 into X.
$03/EB62 86 80 STX $80    [$00:0080] A:0000 X:97A0 Y:02D8 P:eNvMxdizc - Store X in 80.
$03/EB64 A9 0F LDA #$0F A:0000 X:97A0 Y:02D8 P:eNvMxdizc - Load 0F into A,
$03/EB66 85 82 STA $82    [$00:0082] A:000F X:97A0 Y:02D8 P:envMxdizc - Store A in 82.
$03/EB68 A9 06 LDA #$06 A:000F X:97A0 Y:02D8 P:envMxdizc - Load 06 into A.
$03/EB6A 20 5E 84 JSR $845E  [$03:845E] A:0006 X:97A0 Y:02D8 P:envMxdizc - Jump to Subroutine (??)
$03/EB6D A6 AB LDX $AB    [$00:00AB] A:0000 X:0006 Y:0006 P:envMxdiZC - Load X from AB.
$03/EB6F AD 9F 28 LDA $289F  [$7E:289F] A:0000 X:0004 Y:0006 P:envMxdizC - Load Load A from 7E289F.
$03/EB72 9D 1D 32 STA $321D,x[$7E:3221] A:007F X:0004 Y:0006 P:envMxdizC - Store A in 7E3221.
$03/EB75 80 1C BRA $1C    [$EB93] A:007F X:0004 Y:0006 P:envMxdizC - Branch to 03EB93.
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/EB77 38 SEC A:00CF X:0004 Y:0001 P:envMxdizC - Set Carry Flag.
$03/EB78 E9 B0 SBC #$B0 A:00CF X:0004 Y:0001 P:envMxdizC - Subtract B0 from Item.
$03/EB7A AA TAX A:001F X:0004 Y:0001 P:envMxdizC - Transfer A to X.
$03/EB7B 86 E5 STX $E5    [$00:00E5] A:001F X:001F Y:0001 P:envMxdizC - Store X in E5.
$03/EB7D A2 80 96 LDX #$9680 A:001F X:001F Y:0001 P:envMxdizC - Load 9680 into X.
$03/EB80 86 80 STX $80    [$00:0080] A:001F X:9680 Y:0001 P:eNvMxdizC - Store X in 80.
$03/EB82 A9 0F LDA #$0F A:001F X:9680 Y:0001 P:eNvMxdizC - Load 0F into A.
$03/EB84 85 82 STA $82    [$00:0082] A:000F X:9680 Y:0001 P:envMxdizC - Store A in 82.
$03/EB86 A9 06 LDA #$06 A:000F X:9680 Y:0001 P:envMxdizC - Load 06 into A.
$03/EB88 20 5E 84 JSR $845E  [$03:845E] A:0006 X:9680 Y:0001 P:envMxdizC - Jump to Subroutine.
$03/EB8B A6 AB LDX $AB    [$00:00AB] A:0080 X:0006 Y:00C0 P:envMxdiZC - Load AB into X.
$03/EB8D AD 9F 28 LDA $289F  [$7E:289F] A:0080 X:0004 Y:00C0 P:envMxdizC - Load A from 7E289F.
$03/EB90 9D 1D 32 STA $321D,x[$7E:3221] A:0002 X:0004 Y:00C0 P:envMxdizC - Store A in Item Data.
$03/EB93 AD 9C 28 LDA $289C  [$7E:289C] A:0002 X:0004 Y:00C0 P:envMxdizC - Load A from 7E289C.
$03/EB96 29 E0 AND #$E0 A:0020 X:0004 Y:00C0 P:envMxdizC - Get rid of bits.
$03/EB98 4A LSR A A:0020 X:0004 Y:00C0 P:envMxdizC - /2 A.
$03/EB99 9D 1A 32 STA $321A,x[$7E:321E] A:0010 X:0004 Y:00C0 P:envMxdizc - Store A in 7E321E.
$03/EB9C 60 RTS A:0010 X:0004 Y:00C0 P:envMxdizc - Return.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/E29E 7A PLY A:0010 X:0004 Y:00C0 P:envMxdizc - Pull Y.
$03/E29F 80 20 BRA $20    [$E2C1] A:0010 X:0004 Y:0001 P:envMxdizc - Branch to 03E2C1
------------------------------------------------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------------------------------------------------
$03/E2C1 20 CF E2 JSR $E2CF  [$03:E2CF] A:0010 X:0004 Y:0001 P:envMxdizc  - Jump to ...Own Routine?
------------------------------------------------------------------------------------------------------------------------------------------
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
(Special Code, only accessed by an RTS at the end of its ordinary routine, oddly enough.)
$03/E2C4 A5 A9 LDA $A9    [$00:00A9] A:0000 X:0004 Y:0001 P:envMxdizc - Load Stolen Item into A.
$03/E2C6 8D 9A 35 STA $359A  [$7E:359A] A:00CF X:0004 Y:0001 P:eNvMxdizc - Store A in 7E359A.
$03/E2C9 A9 1D LDA #$1D A:00CF X:0004 Y:0001 P:eNvMxdizc - Load Message 1D
$03/E2CB 8D CA 34 STA $34CA  [$7E:34CA] A:001D X:0004 Y:0001 P:envMxdizc - Store Message in Battle Message Data.
$03/E2CE 60 RTS A:001D X:0004 Y:0001 P:envMxdizc - Return
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/E2CF DA PHX A:0010 X:0004 Y:0001 P:envMxdizc - Push X.
$03/E2D0 5A PHY A:0010 X:0004 Y:0001 P:envMxdizc - Push Y.
$03/E2D1 98 TYA A:0010 X:0004 Y:0001 P:envMxdizc - Transfer Y to A.
$03/E2D2 85 01 STA $01    [$00:0001] A:0001 X:0004 Y:0001 P:envMxdizc - Store A in 01.
$03/E2D4 A9 06 LDA #$06 A:0001 X:0004 Y:0001 P:envMxdizc - Load 06 into A.
$03/E2D6 20 85 80 JSR $8085  [$03:8085] A:0006 X:0004 Y:0001 P:envMxdizc - Jump to Subroutine (A lot of jumping. A lot of things that don't make much sense to me.)
$03/E2D9 7A PLY A:0000 X:7510 Y:0018 P:envMxdiZc - Pull Y.
$03/E2DA FA PLX A:0000 X:7510 Y:0001 P:envMxdizc - Pull X.
$03/E2DB 60 RTS A:0000 X:0004 Y:0001 P:envMxdizc - Return
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Whew! Now that was work but a lot of valuable information came out of this. First and foremost is finally the purpose of that Mystery Byte that we've been calling "Run Strength" for years on end. What it actually is a "Steal Prevention" byte. It appears to be Enemy Level +10(decimal) for Enemies. Which means the Purpose of Cry is to make it easier to Steal Items. Well done Square! Under normal circumstances that situation can never happen! In addition is all the chances of success are recorded below so Cry is absolutely, positively, worthless under normal gameplay circumstances.

50 + Level - Target's Steal Prevention = Amount that will be tested against a Random Number (which seems like it can range from 1-255.) - If the value is over 100 it is an automatic success. (which can only happen in levels 60 and up.)  I wonder if this 2F Byte might also be dealing something with Odin as well....


Well no matter. That was a worthwhile venture.

 :edit: Added the branch that goes off of Arrows for quick and easy modification.

 :edit: 10/11/13 - Added information on branches.







Title: Re: Grimoire LD's Notes, Methods, and Hacks (All Spells Disassembly)
Post by: Grimoire LD on October 03, 2013, 09:44:38 PM
Next up is Salve/Heal/Medicine, whatever you wish to call it.

Salve Routine

Code: [Select]
$03/E2DC A9 C1 LDA #$C1 A:0003 X:0014 Y:0000 P:envMxdizc - Load C1 into A.
$03/E2DE 8D C4 33 STA $33C4  [$7E:33C4] A:00C1 X:0014 Y:0000 P:eNvMxdizc - Store A in Audiovisual Code.
$03/E2E1 7B TDC A:00C1 X:0014 Y:0000 P:eNvMxdizc - Transfer Direct Page.
$03/E2E2 AA TAX A:0000 X:0014 Y:0000 P:envMxdiZc - Transfer A to X
$03/E2E3 A8 TAY A:0000 X:0000 Y:0000 P:envMxdiZc - Transfer A to Y.
-------------------------------------------------(Looping Point)------------------------------------------------------------------
$03/E2E4 BD 1B 32 LDA $321B,x[$7E:321B] A:0000 X:0000 Y:0000 P:envMxdiZc - Load A from 7E321B (Start of Items in battle)
$03/E2E7 C9 D4 CMP #$CE A:00CE X:0000 Y:0000 P:eNvMxdizc - Is it Cure 1?
$03/E2E9 F0 14 BEQ $14    [$E2FF] A:00CE X:0000 Y:0000 P:eNvMxdizc - If so branch to 03E2FF.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E2EB C8 INY A:00CE X:0000 Y:0000 P:eNvMxdizc +1 Y.
$03/E2EC E8 INX A:00CE X:0000 Y:0001 P:envMxdizc +1 X.
$03/E2ED E8 INX A:00CE X:0001 Y:0001 P:envMxdizc +1 X
$03/E2EE E8 INX A:00CE X:0002 Y:0001 P:envMxdizc +1 X
$03/E2EF E8 INX A:00CE X:0003 Y:0001 P:envMxdizc +1 X
$03/E2F0 E0 C0 00 CPX #$00C0 A:00CE X:0004 Y:0001 P:envMxdizc - Has X reached C0 yet?
$03/E2F3 D0 EF BNE $EF    [$E2E4] A:00CE X:0004 Y:0001 P:eNvMxdizc - If not branch back to 03E2E4.
$03/E2F5 20 A6 85 JSR $85A6  [$03:85A6] A:00FF X:00C0 Y:0030 P:envMxdiZC - Jump to Subroutine (??)
$03/E2F8 A9 0F LDA #$0F A:0003 X:00C0 Y:0030 P:envMxdizC - Load 0F into A. (Not Enough Medicine)
$03/E2FA 8D CA 34 STA $34CA  [$7E:34CA] A:000F X:00C0 Y:0030 P:envMxdizC - Store A in Battle Message Data
$03/E2FD 80 42 BRA $42    [$E341] A:000F X:00C0 Y:0030 P:envMxdizC - Branch to 03E341.
---------------------------------------------------------------------------------------------------------------------
$03/E2FF BD 1A 32 LDA $321A,x[$7E:321A] A:00CE X:0000 Y:0000 P:envMxdiZC - Load Item Slot.
$03/E302 29 7F AND #$7F A:0010 X:0000 Y:0000 P:envMxdizC - Get rid of all negative bytes?
$03/E304 9D 1A 32 STA $321A,x[$7E:321A] A:0010 X:0000 Y:0000 P:envMxdizC - Store this in Item Slot?
$03/E307 BD 1C 32 LDA $321C,x[$7E:321C] A:0010 X:0000 Y:0000 P:envMxdizC - Load A from Item Quantity.
$03/E30A C9 01 CMP #$01 A:0002 X:0000 Y:0000 P:envMxdizC - Is it 01?
$03/E30C 90 E7 BCC $E7    [$E2F5] A:0002 X:0000 Y:0000 P:envMxdizC - If 01 or less, branch to 03E2F5
--------------------------------------------------------------------------------------------------------------------------------
$03/E30E 38 SEC A:0002 X:0000 Y:0000 P:envMxdizC  - Set Carry Flag.
$03/E30F BD 1C 32 LDA $321C,x[$7E:321C] A:0002 X:0000 Y:0000 P:envMxdizC - Load Item Quantity into A.
$03/E312 E9 01 SBC #$01 A:0002 X:0000 Y:0000 P:envMxdizC -1 to A.
$03/E314 9D 1C 32 STA $321C,x[$7E:321C] A:0001 X:0000 Y:0000 P:envMxdizC - Store A in Item Quantity.
$03/E317 D0 0B BNE $0B    [$E324] A:0001 X:0000 Y:0000 P:envMxdizC - If A is not 00 branch to 03E324.
----------------------------------------------------------------------------------------------------------------------------------------

-------------------------------------------------------------------------------------------------------------------------------------------
$03/E324 98 TYA A:0001 X:0000 Y:0000 P:envMxdizC - Transfer Y to A.
$03/E325 85 01 STA $01    [$00:0001] A:0000 X:0000 Y:0000 P:envMxdiZC - Store A in 01.
$03/E327 A9 06 LDA #$06 A:0000 X:0000 Y:0000 P:envMxdiZC - Load 06 into A.
$03/E329 20 85 80 JSR $8085  [$03:8085] A:0006 X:0000 Y:0000 P:envMxdizC - Jump to Subroutine (A lot of jumping.)
$03/E32C A9 F8 LDA #$F8 A:0000 X:7510 Y:0018 P:envMxdiZc - Load F8 into A. - Load F8 into A. (All Ally Target)
$03/E32E 8D D4 26 STA $26D4  [$7E:26D4] A:00F8 X:7510 Y:0018 P:eNvMxdizc - Store A in Targeting (!!! I finally found the first case of identifiable targeting in a Command!)
$03/E331 A9 CE LDA #$CE A:00F8 X:7510 Y:0018 P:eNvMxdizc - Load Cure 1 into A.
$03/E333 8D D2 26 STA $26D2  [$7E:26D2] A:00CE X:7510 Y:0018 P:eNvMxdizc - Store A in Action Taken.
$03/E336 EE 2A 35 INC $352A  [$7E:352A] A:00CE X:7510 Y:0018 P:eNvMxdizc - +1 to 7E352A.
$03/E339 20 3E CD JSR $CD3E  [$03:CD3E] A:00CE X:7510 Y:0018 P:envMxdizc - Jump to Subroutine (!Everything! in the Magic Call...)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/CD3E AD D2 26 LDA $26D2  [$7E:26D2] A:00CE X:7510 Y:0018 P:envMxdizc - Load Caster's Action Taken.
$03/CD41 8D C5 33 STA $33C5  [$7E:33C5] A:00CE X:7510 Y:0018 P:eNvMxdizc - Store in 7E33C5.
$03/CD44 A9 F8 LDA #$F8 A:00CE X:7510 Y:0018 P:eNvMxdizc - Load F8 into A.
$03/CD46 8D C6 33 STA $33C6  [$7E:33C6] A:00F8 X:7510 Y:0018 P:eNvMxdizc - Store A in 7E33C6.
$03/CD49 A9 04 LDA #$04 A:00F8 X:7510 Y:0018 P:eNvMxdizc - Load 04 into A.
$03/CD4B 8D C7 33 STA $33C7  [$7E:33C7] A:0004 X:7510 Y:0018 P:envMxdizc - Store A in 7E33C7.
$03/CD4E EE 5B 35 INC $355B  [$7E:355B] A:0004 X:7510 Y:0018 P:envMxdizc - +1 to 7E355B.
$03/CD51 A5 CE LDA $CE    [$00:00CE] A:0004 X:7510 Y:0018 P:envMxdizc - Load A from CE.
$03/CD53 29 80 AND #$80 A:0000 X:7510 Y:0018 P:envMxdiZc - Get rid of bits.
$03/CD55 8D C4 34 STA $34C4  [$7E:34C4] A:0000 X:7510 Y:0018 P:envMxdiZc - Store A in 7E34C4.
$03/CD58 9C 22 35 STZ $3522  [$7E:3522] A:0000 X:7510 Y:0018 P:envMxdiZc - Store Zero in 7E3522.
$03/CD5B 9C 23 35 STZ $3523  [$7E:3523] A:0000 X:7510 Y:0018 P:envMxdiZc - Store Zero in 7E3523.
$03/CD5E AD D2 26 LDA $26D2  [$7E:26D2] A:0000 X:7510 Y:0018 P:envMxdiZc - Load A from Target's Action.
$03/CD61 C9 92 CMP #$92 A:00CE X:7510 Y:0018 P:eNvMxdizc - Is it (Spell) Retreat?
$03/CD63 D0 0A BNE $0A    [$CD6F] A:00CE X:7510 Y:0018 P:envMxdizC - If not branch to 03CD6F.
------------------------------------------------------------------------------------------------------------------------
(Unless you're using the Sorcerer's Robe as the Item, I don't think this can Ever apply) from this JSR anyhow.
--------------------------------------------------------------------------------------------------------------------------
$03/CD6F AA TAX A:00CE X:7510 Y:0018 P:envMxdizC - Transfer A to X.
$03/CD70 86 E5 STX $E5    [$00:00E5] A:00CE X:00CE Y:0018 P:envMxdizC - Store X in E5.
$03/CD72 AD 2A 35 LDA $352A  [$7E:352A] A:00CE X:00CE Y:0018 P:envMxdizC - Load A from 7E352A.
$03/CD75 D0 33 BNE $33    [$CDAA] A:0001 X:00CE Y:0018 P:envMxdizC - If not 00 branch to 03CDAA.
------------------------------------------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------------------------------------------
$03/CDAA AD D2 26 LDA $26D2  [$7E:26D2] A:0001 X:00CE Y:0018 P:envMxdizC - Load A from Target's Action.
$03/CDAD 8D C8 34 STA $34C8  [$7E:34C8] A:00CE X:00CE Y:0018 P:eNvMxdizC - Store A in 7E34C8.
$03/CDB0 A9 20 LDA #$20 A:00CE X:00CE Y:0018 P:eNvMxdizC - Load 20 into A.
$03/CDB2 8D C7 34 STA $34C7  [$7E:34C7] A:0020 X:00CE Y:0018 P:envMxdizC - Store A in 7E34C7.
$03/CDB5 A2 80 96 LDX #$9680 A:0020 X:00CE Y:0018 P:envMxdizC - Load 9680 into X.
$03/CDB8 86 80 STX $80    [$00:0080] A:0020 X:9680 Y:0018 P:eNvMxdizC - Store X in 80.
$03/CDBA A9 0F LDA #$0F A:0020 X:9680 Y:0018 P:eNvMxdizC - Load 0F into A.
$03/CDBC 85 82 STA $82    [$00:0082] A:000F X:9680 Y:0018 P:envMxdizC - Store A in 82.
$03/CDBE 38 SEC A:000F X:9680 Y:0018 P:envMxdizC - Set Carry Flag.
$03/CDBF A5 E5 LDA $E5    [$00:00E5] A:000F X:9680 Y:0018 P:envMxdizC - Load the value in E5 into A.
$03/CDC1 E9 B0 SBC #$B0 A:00CE X:9680 Y:0018 P:eNvMxdizC - -B0 from A.
$03/CDC3 85 E5 STA $E5    [$00:00E5] A:001E X:9680 Y:0018 P:envMxdizC - Store A in E5.
$03/CDC5 A9 06 LDA #$06 A:001E X:9680 Y:0018 P:envMxdizC - Load 06 into A.
$03/CDC7 20 5E 84 JSR $845E  [$03:845E] A:0006 X:9680 Y:0018 P:envMxdizC - Load Stored Spell Power.
$03/CDCA AD A0 28 LDA $28A0  [$7E:28A0] A:0080 X:0006 Y:00BA P:envMxdiZC - Load  from 7E28A0.
$03/CDCD 48 PHA A:0000 X:0006 Y:00BA P:envMxdiZC - Push A.
$03/CDCE 29 80 AND #$80 A:0000 X:0006 Y:00BA P:envMxdiZC - And 80.
$03/CDD0 8D E2 38 STA $38E2  [$7E:38E2] A:0000 X:0006 Y:00BA P:envMxdiZC - Store A in 7E38E2.
$03/CDD3 68 PLA A:0000 X:0006 Y:00BA P:envMxdiZC - Pull A.
$03/CDD4 29 7F AND #$7F A:0000 X:0006 Y:00BA P:envMxdiZC - And 7F.
$03/CDD6 85 DF STA $DF    [$00:00DF] A:0000 X:0006 Y:00BA P:envMxdiZC - Store A in DF.
$03/CDD8 A9 03 LDA #$03 A:0000 X:0006 Y:00BA P:envMxdiZC - Load 03 into A.
$03/CDDA 85 E1 STA $E1    [$00:00E1] A:0003 X:0006 Y:00BA P:envMxdizC - Store A in E1.
$03/CDDC 20 E0 83 JSR $83E0  [$03:83E0] A:0003 X:0006 Y:00BA P:envMxdizC - Jump to Subroutine (HP Dealing?)
$03/CDDF A6 E3 LDX $E3    [$00:00E3] A:0000 X:0000 Y:00BA P:envMxdiZc - Load X from E3.
$03/CDE1 7B TDC A:0000 X:0000 Y:00BA P:envMxdiZc - Transfer Direct Page.
$03/CDE2 A8 TAY A:0000 X:0000 Y:00BA P:envMxdiZc - Transfer A to Y.
-------------------------------------------------------------------------------(Looping Point)--------------------------------------------------------------
$03/CDE3 BF 90 A5 0F LDA $0FA590,x[$0F:A590] A:0000 X:0000 Y:0000 P:envMxdiZc - Load A from 0FA590.
$03/CDE7 99 A2 28 STA $28A2,y[$7E:28A2] A:0000 X:0000 Y:0000 P:envMxdiZc - Store A in 7E28A2.
$03/CDEA C8 INY A:0000 X:0000 Y:0000 P:envMxdiZc - +1 Y
$03/CDEB E8 INX A:0000 X:0000 Y:0001 P:envMxdizc - +1 X
$03/CDEC C0 03 00 CPY #$0003 A:0000 X:0001 Y:0001 P:envMxdizc - Is X 03?
$03/CDEF D0 F2 BNE $F2    [$CDE3] A:0000 X:0001 Y:0001 P:eNvMxdizc - If not branch back to 03CDE3.
$03/CDF1 AD A2 28 LDA $28A2  [$7E:28A2] A:0000 X:0003 Y:0003 P:envMxdiZC - Load A from Casted Spell's Elemental?
$03/CDF4 8D 00 36 STA $3600  [$7E:3600] A:0000 X:0003 Y:0003 P:envMxdiZC - Store A in 7E3600.
$03/CDF7 A5 CE LDA $CE    [$00:00CE] A:0000 X:0003 Y:0003 P:envMxdiZC - Load A from CE.
$03/CDF9 29 80 AND #$80 A:0000 X:0003 Y:0003 P:envMxdiZC - Get rid of bits.
$03/CDFB 8D 4E 35 STA $354E  [$7E:354E] A:0000 X:0003 Y:0003 P:envMxdiZC - Store A in 7E354E.
$03/CDFE 30 0D BMI $0D    [$CE0D] A:0000 X:0003 Y:0003 P:envMxdiZC - Branch if Minus to 03CE0D.
$03/CE00 20 18 C4 JSR $C418  [$03:C418] A:0000 X:0003 Y:0003 P:envMxdiZC - Jump to Subroutine (Status Checking?)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/C418 7B TDC A:0000 X:0003 Y:0003 P:envMxdiZC - Transfer Direct Page.
$03/C419 AA TAX A:0000 X:0003 Y:0003 P:envMxdiZC - Transfer A to X.
$03/C41A A8 TAY A:0000 X:0000 Y:0003 P:envMxdiZC - Transfer A to Y.
$03/C41B 84 A9 STY $A9    [$00:00A9] A:0000 X:0000 Y:0000 P:envMxdiZC - Store Y in A9.
$03/C41D B9 40 35 LDA $3540,y[$7E:3540] A:0000 X:0000 Y:0000 P:envMxdiZC - Load A from 7E3540
$03/C420 D0 13 BNE $13    [$C435] A:0000 X:0000 Y:0000 P:envMxdiZC - Branch if not 00 to 03C435
---------------------------------------------------------------------------------------------------------------------------------------------.
$03/C422 BD 03 20 LDA $2003,x[$7E:2003] A:0000 X:0000 Y:0000 P:envMxdiZC - Load Status of Character.
$03/C425 29 C0 AND #$C0 A:0000 X:0000 Y:0000 P:envMxdiZC - Is it Petrify or KO?
$03/C427 D0 0C BNE $0C    [$C435] A:0000 X:0000 Y:0000 P:envMxdiZC - If not 00 branch to 03C435.
-------------------------------------------------------------------------------------------------------------------------------------------------------
$03/C429 BD 05 20 LDA $2005,x[$7E:2005] A:0000 X:0000 Y:0000 P:envMxdiZC - Load Character's Status Byte 3,
$03/C42C 29 82 AND #$82 A:0000 X:0000 Y:0000 P:envMxdiZC - Is it Magnetized or Twincasting?
$03/C42E D0 05 BNE $05    [$C435] A:0000 X:0000 Y:0000 P:envMxdiZC - If not 00 branch to 03C435.
-----------------------------------------------------------------------------------------------------------------------------------------------------------
$03/C430 BD 06 20 LDA $2006,x[$7E:2006] A:0000 X:0000 Y:0000 P:envMxdiZC - Load Character's Status Byte 4.
$03/C433 10 0B BPL $0B    [$C440] A:0000 X:0000 Y:0000 P:envMxdiZC - If they are not in Hide status branch to 03C440.
------------------------------------------------------------------------------------------------------------------------------------------------------------

--------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/C440 60 RTS A:0000 X:0000 Y:0000 P:envMxdiZC
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/CE03 A5 A9 LDA $A9    [$00:00A9] A:0000 X:0000 Y:0000 P:envMxdiZC - Load A9 into A.
$03/CE05 F0 06 BEQ $06    [$CE0D] A:0000 X:0000 Y:0000 P:envMxdiZC - If 00 branch to 03CE0D
-------------------------------------------------------------------------------------------------------------------------------------------------------
$03/CE0D AD D3 26 LDA $26D3  [$7E:26D3] A:0000 X:0000 Y:0000 P:envMxdiZC - Load Caster's Monster Target.
$03/CE10 D0 03 BNE $03    [$CE15] A:0000 X:0000 Y:0000 P:envMxdiZC - If not 00 branch to 03CE15.
$03/CE12 AD D4 26 LDA $26D4  [$7E:26D4] A:0000 X:0000 Y:0000 P:envMxdiZC - Load Caster's Party Targets.
$03/CE15 20 BC D2 JSR $D2BC  [$03:D2BC] A:00F8 X:0000 Y:0000 P:eNvMxdizC - Jump to Subroutine (Spell Routines?)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/D2BC 85 A9 STA $A9    [$00:00A9] A:00F8 X:0000 Y:0000 P:eNvMxdizC - Store Targeting in A9.
$03/D2BE 20 0C 85 JSR $850C  [$03:850C] A:00F8 X:0000 Y:0000 P:eNvMxdizC - Jump to Subroutine (??)
$03/D2C1 CA DEX A:0000 X:0005 Y:0000 P:envMxdiZc - -1 to X.
$03/D2C2 F0 77 BEQ $77    [$D33B] A:0000 X:0004 Y:0000 P:envMxdizc - Branch if Equal to... 00? to 03D33B.
$03/D2C4 AD E7 38 LDA $38E7  [$7E:38E7] A:0000 X:0004 Y:0000 P:envMxdizc - Load 7E38E7 into A (Maybe something to do with Encounter flags?)
$03/D2C7 D0 72 BNE $72    [$D33B] A:0001 X:0004 Y:0000 P:envMxdizc - Branch if not equal to 00 to 03D33B.
------------------------------------------------------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/D33B A5 A9 LDA $A9    [$00:00A9] A:0001 X:0004 Y:0000 P:envMxdizc - Load A9 into A.
$03/D33D 60 RTS A:00F8 X:0004 Y:0000 P:eNvMxdizc - Return
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/CE18 8D 4F 35 STA $354F  [$7E:354F] A:00F8 X:0004 Y:0000 P:eNvMxdizc - Store A in 7E354F.
$03/CE1B 8D 50 35 STA $3550  [$7E:3550] A:00F8 X:0004 Y:0000 P:eNvMxdizc - Store A in 7E3550.
$03/CE1E 20 0C 85 JSR $850C  [$03:850C] A:00F8 X:0004 Y:0000 P:eNvMxdizc - Jump to Subroutine (??)
$03/CE21 8A TXA A:0000 X:0005 Y:0000 P:envMxdiZc - Transfer X to A.
$03/CE22 8D 06 39 STA $3906  [$7E:3906] A:0005 X:0005 Y:0000 P:envMxdizc - Store A in 7E3906.
$03/CE25 8D 4D 35 STA $354D  [$7E:354D] A:0005 X:0005 Y:0000 P:envMxdizc  - Store A in 7E354D.
$03/CE28 F0 DD BEQ $DD    [$CE07] A:0005 X:0005 Y:0000 P:envMxdizc - If 00 loop back to 03CE07
$03/CE2A AD 9C 28 LDA $289C  [$7E:289C] A:0005 X:0005 Y:0000 P:envMxdizc - Load 7E289C into A. -
$03/CE2D 29 60 AND #$60 A:0020 X:0005 Y:0000 P:envMxdizc - Get rid of bits.
$03/CE2F C9 40 CMP #$40 A:0020 X:0005 Y:0000 P:envMxdizc - Is it 40?
$03/CE31 D0 05 BNE $05    [$CE38] A:0020 X:0005 Y:0000 P:eNvMxdizc - If not branch to 03CE31.
--------------------------------------------------------------------------------------------------------------------------------------------------

-----------------------------------------------------------------------------------------------------------------------------------------------
$03/CE38 AD D2 26 LDA $26D2  [$7E:26D2] A:0020 X:0005 Y:0000 P:eNvMxdizc - Load Caster's Action Taken.
$03/CE3B F0 3E BEQ $3E    [$CE7B] A:00CE X:0005 Y:0000 P:eNvMxdizc - if 00 branch to 03CE7B.
$03/CE3D AD 5D 35 LDA $355D  [$7E:355D] A:00CE X:0005 Y:0000 P:eNvMxdizc - Load 7E355D into A.
$03/CE40 F0 39 BEQ $39    [$CE7B] A:0000 X:0005 Y:0000 P:envMxdiZc - If equal branch to 03CE7B.
-----------------------------------------------------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------------------------------------------------------
$03/CE7B AD 2A 35 LDA $352A  [$7E:352A] A:0000 X:0005 Y:0000 P:envMxdiZc - Load A from 7E352A
$03/CE7E D0 37 BNE $37    [$CEB7] A:0001 X:0005 Y:0000 P:envMxdizc - If not 00 branch to 03CEB7.
--------------------------------------------------------------------------------------------------------------------------------------------------
$03/CEB7 7B TDC A:0001 X:0005 Y:0000 P:envMxdizc - Transfer Direct Page.
$03/CEB8 AA TAX A:0000 X:0005 Y:0000 P:envMxdiZc - Transfer A to X.
$03/CEB9 AD D2 26 LDA $26D2  [$7E:26D2] A:0000 X:0000 Y:0000 P:envMxdiZc - Load Target's Action.
$03/CEBC C9 19 CMP #$19 A:00CE X:0000 Y:0000 P:eNvMxdizc - Is it 19?
$03/CEBE B0 01 BCS $01    [$CEC1] A:00CE X:0000 Y:0000 P:eNvMxdizC - If it is more than 19 branch to 03CEC1. (Looking at the start of Black Magic, it seems)
---------------------------------------------------------------------------------------------------------------------------
$03/CEC0 E8 INX A:0005 X:0000 Y:0000 P:eNvMxdizc +1 to X.
---------------------------------------------------------------------------------------------------------------------------
$03/CEC1 86 C7 STX $C7    [$00:00C7] A:00CE X:0000 Y:0000 P:eNvMxdizC - Store X in C7.
$03/CEC3 BD 97 26 LDA $2697,x[$7E:2697] A:00CE X:0000 Y:0000 P:eNvMxdizC - Load Caster's Wisdom (Is Very Likely the formulaic check of Wisdom based spells)
$03/CEC6 4A LSR A A:0012 X:0000 Y:0000 P:envMxdizC - /2.
$03/CEC7 85 A9 STA $A9    [$00:00A9] A:0009 X:0000 Y:0000 P:envMxdizc - Store /2 Wisdom in A9.
$03/CEC9 AD 9E 28 LDA $289E  [$7E:289E] A:0009 X:0000 Y:0000 P:envMxdizc - Load Casted Spell's Hit Percentage
$03/CECC 29 7F AND #$7F A:0064 X:0000 Y:0000 P:envMxdizc - Get rid of bits (possibly over 80)
$03/CECE 18 CLC A:0064 X:0000 Y:0000 P:envMxdizc - Clear Carry Flag.
$03/CECF 65 A9 ADC $A9    [$00:00A9] A:0064 X:0000 Y:0000 P:envMxdizc - Add the value in A9 into A (Wisdom /2)
$03/CED1 90 02 BCC $02    [$CED5] A:006D X:0000 Y:0000 P:envMxdizc -If Greater than 00 branch to 03CED5.
----------------------------------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------------------------------------
$03/CED5 8D FA 38 STA $38FA  [$7E:38FA] A:006D X:0000 Y:0000 P:envMxdizc - Store A in 7E38FA
$03/CED8 AD 83 26 LDA $2683  [$7E:2683] A:006D X:0000 Y:0000 P:envMxdizc - Load Caster's Status Byte 1.
$03/CEDB 29 02 AND #$02 A:0000 X:0000 Y:0000 P:envMxdiZc - Is it Darkness?
$03/CEDD F0 03 BEQ $03    [$CEE2] A:0000 X:0000 Y:0000 P:envMxdiZc - If equal to 00 branch to 03CEE2.
--------------------------------------------------------------------------------------------------------------------------------------

-------------------------------------------------------------------------------------------------------------------------------------
$03/CEE2 A5 CD LDA $CD    [$00:00CD] A:0000 X:0000 Y:0000 P:envMxdiZc - Load CD into A.
$03/CEE4 29 7F AND #$7F A:0000 X:0000 Y:0000 P:envMxdiZc - Get rid of negative bits.
$03/CEE6 D0 19 BNE $19    [$CF01] A:0000 X:0000 Y:0000 P:envMxdiZc - If not 00 branch to 03CF01.
$03/CEE8 AD FA 38 LDA $38FA  [$7E:38FA] A:0000 X:0000 Y:0000 P:envMxdiZc - Load A from 7E38FA (Wis/2 +Hit%)
$03/CEEB 85 DF STA $DF    [$00:00DF] A:006D X:0000 Y:0000 P:envMxdizc - Store A in DF.
$03/CEED A9 05 LDA #$05 A:006D X:0000 Y:0000 P:envMxdizc - Load 05 into A.
$03/CEEF 85 E1 STA $E1    [$00:00E1] A:0005 X:0000 Y:0000 P:envMxdizc - Store A in E1.
$03/CEF1 20 E0 83 JSR $83E0  [$03:83E0] A:0005 X:0000 Y:0000 P:envMxdizc - Jump to Subroutine (Timing?)
$03/CEF4 46 E4 LSR $E4    [$00:00E4] A:0000 X:0000 Y:0000 P:envMxdiZc - /2 Value in E4.
$03/CEF6 66 E3 ROR $E3    [$00:00E3] A:0000 X:0000 Y:0000 P:envMxdizc - /2 Value in E3.
$03/CEF8 46 E4 LSR $E4    [$00:00E4] A:0000 X:0000 Y:0000 P:envMxdizC - /2 Value in E4.
$03/CEFA 66 E3 ROR $E3    [$00:00E3] A:0000 X:0000 Y:0000 P:envMxdiZC - /2 Value in E3
$03/CEFC A5 E3 LDA $E3    [$00:00E3] A:0000 X:0000 Y:0000 P:eNvMxdizc - Load E3 into A.
$03/CEFE 8D FA 38 STA $38FA  [$7E:38FA] A:0088 X:0000 Y:0000 P:eNvMxdizc - Store A in 7E38FA.
$03/CF01 AD 9F 28 LDA $289F  [$7E:289F] A:0088 X:0000 Y:0000 P:eNvMxdizc - Load A in 7E289F.
$03/CF04 29 80 AND #$80 A:0002 X:0000 Y:0000 P:envMxdizc - Get rid of Positive bits.
$03/CF06 F0 07 BEQ $07    [$CF0F] A:0000 X:0000 Y:0000 P:envMxdiZc - If 00 branch to 03CF0F
----------------------------------------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------------------------------------
$03/CF0F A6 C7 LDX $C7    [$00:00C7] A:0000 X:0000 Y:0000 P:envMxdiZc - Load X from C7. (If White Magic...)
$03/CF11 BD 97 26 LDA $2697,x[$7E:2697] A:0000 X:0000 Y:0000 P:envMxdiZc - Load Caster's Modified Wisdom. (If X is 01 it would load Modified Will instead, labeling it as White Magic)
$03/CF14 20 86 84 JSR $8486  [$03:8486] A:0012 X:0000 Y:0000 P:envMxdizc - Jump to Subroutine (Divide the value by 4.)
$03/CF17 1A INC A A:0004 X:0000 Y:0000 P:envMxdizC - +1 to A.
$03/CF18 8D FB 38 STA $38FB  [$7E:38FB] A:0005 X:0000 Y:0000 P:envMxdizC - Store A (Widsom/4 +1) into 7E38FB.
$03/CF1B 20 97 C9 JSR $C997  [$03:C997] A:0005 X:0000 Y:0000 P:envMxdizC - Jump to Subroutine (From my other notes, seems to be some sort of RNG)
$03/CF1E AD FD 38 LDA $38FD  [$7E:38FD] A:0010 X:0000 Y:0000 P:envMxdiZc - Load A from 7E38FD.
$03/CF21 8D 51 35 STA $3551  [$7E:3551] A:0005 X:0000 Y:0000 P:envMxdizc - Store A in 7E3551.
$03/CF24 AD 2A 35 LDA $352A  [$7E:352A] A:0005 X:0000 Y:0000 P:envMxdizc - Load From 7E352A.
$03/CF27 D0 05 BNE $05    [$CF2E] A:0001 X:0000 Y:0000 P:envMxdizc - If not 00 branch to 03CF27
---------------------------------------------------------------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------------------------------------------------------------
$03/CF2E A9 08 LDA #$08 A:0001 X:0000 Y:0000 P:envMxdizc - Load 08 into A.
$03/CF30 8D 51 35 STA $3551  [$7E:3551] A:0008 X:0000 Y:0000 P:envMxdizc - Store A in 7E3551.
$03/CF33 AD EB 38 LDA $38EB  [$7E:38EB] A:0008 X:0000 Y:0000 P:envMxdizc - Load A from 7E38EB.
$03/CF36 F0 06 BEQ $06    [$CF3E] A:0000 X:0000 Y:0000 P:envMxdiZc - If not 00 branch to 03CF3E.
$03/CF3E 9C 54 35 STZ $3554  [$7E:3554] A:0000 X:0000 Y:0000 P:envMxdiZc - Store Zero in 7E3554.
$03/CF41 7B TDC A:0000 X:0000 Y:0000 P:envMxdiZc - Transfer Direct Page.
$03/CF42 AA TAX A:0000 X:0000 Y:0000 P:envMxdiZc - Transfer A to X.
$03/CF43 AD 4F 35 LDA $354F  [$7E:354F] A:0000 X:0000 Y:0000 P:envMxdiZc - Load A from 7E354F.
$03/CF46 0A ASL A A:00F8 X:0000 Y:0000 P:eNvMxdizc - x2 Targeting (to roll back)
$03/CF47 B0 03 BCS $03    [$CF4C] A:00F0 X:0000 Y:0000 P:eNvMxdizC - Branch if more than 03.
$03/CF4C AD 4F 35 LDA $354F  [$7E:354F] A:00F0 X:0000 Y:0000 P:eNvMxdizC - Load 7E354F.
$03/CF4F 20 5A 85 JSR $855A  [$03:855A] A:00F8 X:0000 Y:0000 P:eNvMxdizC - Jump to Subroutine
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/855A 3F F6 FE 13 AND $13FEF6,x[$13:FEF6] A:00F8 X:0000 Y:0000 P:eNvMxdizC - ???
$03/855E 60 RTS A:0078 X:0000 Y:0000 P:envMxdizC - Return
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/CF59 85 CE STA $CE    [$00:00CE] A:0000 X:0000 Y:0000 P:envMxdiZC - Store CE from A.
$03/CF5B A5 CE LDA $CE    [$00:00CE] A:0000 X:0000 Y:0000 P:envMxdiZC - Load A from CE.
$03/CF5D 10 05 BPL $05    [$CF64] A:0000 X:0000 Y:0000 P:envMxdiZC - Branch if plus to 03CF64.
$03/CF64 AA TAX A:0000 X:0000 Y:0000 P:envMxdiZC - Transfer A to X.
$03/CF65 BD 40 35 LDA $3540,x[$7E:3540] A:0000 X:0000 Y:0000 P:envMxdiZC - Load 7E3540 into A.
$03/CF68 F0 03 BEQ $03    [$CF6D] A:0000 X:0000 Y:0000 P:envMxdiZC - If 00 branch to 03CF6D.
--------------------------------------------------------------------------------------------------------------------------------------------------

-----------------------------------------------------------------------------------------------------------------------------------------------------
$03/CF6D A5 CE LDA $CE    [$00:00CE] A:0000 X:0000 Y:0000 P:envMxdiZC - Load CE into A.
$03/CF6F 20 73 B1 JSR $B173  [$03:B173] A:0000 X:0000 Y:0000 P:envMxdiZC - Jump to Subroutine (??)
$03/CF72 A0 7F 00 LDY #$007F A:0020 X:0000 Y:0000 P:envMxdizc - Load 7F into Y.
$03/CF75 B1 80 LDA ($80),y[$7E:207F] A:0020 X:0000 Y:007F P:envMxdizc - Load A (from 80?) which is Character's final byte, but is unknown.
$03/CF77 99 00 27 STA $2700,y[$7E:277F] A:0000 X:0000 Y:007F P:envMxdiZc -  Store A in Target's final byte?
$03/CF7A 88 DEY A:0000 X:0000 Y:007F P:envMxdiZc - -1 to Y.
$03/CF7B 10 F8 BPL $F8    [$CF75] A:0000 X:0000 Y:007E P:envMxdizc -It's a cleaning system, which will eventually put all of the character's data into the Targets data at 2700.
$03/CF7D AD 06 27 LDA $2706  [$7E:2706] A:0081 X:0000 Y:FFFF P:eNvMxdizc - Load Target's Status Byte 4.
$03/CF80 29 20 AND #$20 A:0000 X:0000 Y:FFFF P:envMxdiZc - Is it Wall?
$03/CF82 F0 05 BEQ $05    [$CF89] A:0000 X:0000 Y:FFFF P:envMxdiZc - Branch if 00 to 03CF89.
-----------------------------------------------------------------------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------------------------------------------------------------------
$03/CF89 4C 14 D0 JMP $D014  [$03:D014] A:0000 X:0000 Y:FFFF P:envMxdiZc - Jump to 03D014. (Just further in the same subroutine)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/D014 AD 03 27 LDA $2703  [$7E:2703] A:0000 X:0000 Y:FFFF P:envMxdiZc - Load Target's Status Byte 1 into A.
$03/D017 29 C0 AND #$C0 A:0000 X:0000 Y:FFFF P:envMxdiZc - Is it Petrify or KO?
$03/D019 D0 0C BNE $0C    [$D027] A:0000 X:0000 Y:FFFF P:envMxdiZc - Branch if not equal to 03D027.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/D01B AD 05 27 LDA $2705  [$7E:2705] A:0000 X:0000 Y:FFFF P:envMxdiZc - Load Target's Status Byte 3 into A.
$03/D01E 29 02 AND #$02 A:0000 X:0000 Y:FFFF P:envMxdiZc - Is it Jumping?
$03/D020 D0 21 BNE $21    [$D043] A:0000 X:0000 Y:FFFF P:envMxdiZc - If so branch to 03D043.
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/D022 AD 06 27 LDA $2706  [$7E:2706] A:0000 X:0000 Y:FFFF P:envMxdiZc - Load Target's Status Byte 4 into A.
$03/D025 10 22 BPL $22    [$D049] A:0000 X:0000 Y:FFFF P:envMxdiZc - If it is not Hiding branch to 03D049.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/D049 A9 02 LDA #$02 A:0000 X:0000 Y:FFFF P:envMxdiZc - Load 02 into A.
$03/D04B 8D FE 38 STA $38FE  [$7E:38FE] A:0002 X:0000 Y:FFFF P:envMxdizc - Store A in 7E38FE.
$03/D04E 8D FF 38 STA $38FF  [$7E:38FF] A:0002 X:0000 Y:FFFF P:envMxdizc - Store A in 7E38FF.
$03/D051 A9 00 LDA #$00 A:0002 X:0000 Y:FFFF P:envMxdizc - Load 00 into A.
$03/D053 8D 00 39 STA $3900  [$7E:3900] A:0000 X:0000 Y:FFFF P:envMxdiZc - Store A in 7E3900.
$03/D056 85 AA STA $AA    [$00:00AA] A:0000 X:0000 Y:FFFF P:envMxdiZc - Store A in AA.
$03/D058 AD 9D 28 LDA $289D  [$7E:289D] A:0000 X:0000 Y:FFFF P:envMxdiZc - Load A in 7E289D.
$03/D05D AD 84 35 LDA $3584  [$7E:3584] A:0002 X:0000 Y:FFFF P:envMxdizc - Load A from 7E3584.
$03/D060 F0 0E BEQ $0E    [$D070] A:0000 X:0000 Y:FFFF P:envMxdiZc - Load A from 7E3584.
$03/D070 06 A9 ASL $A9    [$00:00A9] A:0000 X:0000 Y:FFFF P:envMxdiZc - /2 A9
$03/D072 26 AA ROL $AA    [$00:00AA] A:0000 X:0000 Y:FFFF P:envMxdizc /2 AA
$03/D074 06 A9 ASL $A9    [$00:00A9] A:0000 X:0000 Y:FFFF P:envMxdiZc /2 A9
$03/D076 26 AA ROL $AA    [$00:00AA] A:0000 X:0000 Y:FFFF P:envMxdizc /2 AA
$03/D078 A6 A9 LDX $A9    [$00:00A9] A:0000 X:0000 Y:FFFF P:envMxdiZc - Load A9 into A.
$03/D07A 8E 02 39 STX $3902  [$7E:3902] A:0000 X:0008 Y:FFFF P:envMxdizc - Store X in 7E3902.
$03/D07D 7B TDC A:0000 X:0008 Y:FFFF P:envMxdizc -  Transfer Direct Page.
$03/D07E AA TAX A:0000 X:0008 Y:FFFF P:envMxdiZc - Transfer A to X.
$03/D07F 86 A4 STX $A4    [$00:00A4] A:0000 X:0000 Y:FFFF P:envMxdiZc - Store X in A4.
$03/D081 86 A2 STX $A2    [$00:00A2] A:0000 X:0000 Y:FFFF P:envMxdiZc - Store X in A2.
$03/D083 A5 CD LDA $CD    [$00:00CD] A:0000 X:0000 Y:FFFF P:envMxdiZc - Load A from CD.
$03/D085 29 80 AND #$80 A:0000 X:0000 Y:FFFF P:envMxdiZc - Get rid of positive bits.
$03/D087 D0 0B BNE $0B    [$D094] A:0000 X:0000 Y:FFFF P:envMxdiZc - If not 00 branch to 03D094.
$03/D089 A5 CE LDA $CE    [$00:00CE] A:0000 X:0000 Y:FFFF P:envMxdiZc
$03/D08B 29 80 AND #$80 A:0000 X:0000 Y:FFFF P:envMxdiZc
$03/D08D D0 05 BNE $05    [$D094] A:0000 X:0000 Y:FFFF P:envMxdiZc
$03/D08F 8E 04 39 STX $3904  [$7E:3904] A:0000 X:0000 Y:FFFF P:envMxdiZc
$03/D092 80 07 BRA $07    [$D09B] A:0000 X:0000 Y:FFFF P:envMxdiZc - Branch to 03D09B.
------------------------------------------------------------------------------------------------------------------------------

--------------------------------------------------------------------------------------------------------------------------------
$03/D09B A5 CE LDA $CE    [$00:00CE] A:0000 X:0000 Y:FFFF P:envMxdiZc - Load A from CE.
$03/D09D 10 05 BPL $05    [$D0A4] A:0000 X:0000 Y:FFFF P:envMxdiZc - Branch if not negative to 03D0A4.
----------------------------------------------------------------------------------------------------------------------------------------------------------------

-------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/D0A4 85 CF STA $CF    [$00:00CF] A:0000 X:0000 Y:FFFF P:envMxdiZc - Store A in CF.
$03/D0A6 20 89 84 JSR $8489  [$03:8489] A:0000 X:0000 Y:FFFF P:envMxdiZc - Jump to Subroutine (Preparation?)
$03/D0A9 AD 23 27 LDA $2723  [$7E:2723] A:0000 X:0000 Y:FFFF P:envMxdiZc - Load Target's Magical Evasion.
$03/D0AC 8D FA 38 STA $38FA  [$7E:38FA] A:000E X:0000 Y:FFFF P:envMxdizc - Store A in 7E38FA.
$03/D0AF AD 03 27 LDA $2703  [$7E:2703] A:000E X:0000 Y:FFFF P:envMxdizc - Load Target's Status Byte 1.
$03/D0B2 29 02 AND #$02 A:0000 X:0000 Y:FFFF P:envMxdiZc - Is it Darkness?
$03/D0B4 F0 03 BEQ $03    [$D0B9] A:0000 X:0000 Y:FFFF P:envMxdiZc - If not branch to 03D0B9.
---------------------------------------------------------------------------------------------------------------------------------------------------

-------------------------------------------------------------------------------------------------------------------------------------------------
$03/D0B9 A5 CD LDA $CD    [$00:00CD] A:0000 X:0000 Y:FFFF P:envMxdiZc - Load CD into A.
$03/D0BB 29 7F AND #$7F A:0000 X:0000 Y:FFFF P:envMxdiZc - Get rid of negative bits.
$03/D0BD D0 19 BNE $19    [$D0D8] A:0000 X:0000 Y:FFFF P:envMxdiZc - Branch if not 00 to 03D0D8.
$03/D0BF AD FA 38 LDA $38FA  [$7E:38FA] A:0000 X:0000 Y:FFFF P:envMxdiZc - Load Magic Evasion into A.
$03/D0C2 85 DF STA $DF    [$00:00DF] A:000E X:0000 Y:FFFF P:envMxdizc - Store A in DF.
$03/D0C4 A9 05 LDA #$05 A:000E X:0000 Y:FFFF P:envMxdizc - Load 05 into A.
$03/D0C6 85 E1 STA $E1    [$00:00E1] A:0005 X:0000 Y:FFFF P:envMxdizc - Store A in E1.
$03/D0C8 20 E0 83 JSR $83E0  [$03:83E0] A:0005 X:0000 Y:FFFF P:envMxdizc - Jump to Subroutine (Cleaning?)
$03/D0CB 46 E4 LSR $E4    [$00:00E4] A:0000 X:0000 Y:FFFF P:envMxdiZc - /2 E4.
$03/D0CD 66 E3 ROR $E3    [$00:00E3] A:0000 X:0000 Y:FFFF P:envMxdiZc /2 E3.
$03/D0CF 46 E4 LSR $E4    [$00:00E4] A:0000 X:0000 Y:FFFF P:envMxdizc /2 E4
$03/D0D1 66 E3 ROR $E3    [$00:00E3] A:0000 X:0000 Y:FFFF P:envMxdiZc /2 E3
$03/D0D3 A5 E3 LDA $E3    [$00:00E3] A:0000 X:0000 Y:FFFF P:envMxdizC Load E3 into A.
$03/D0D5 8D FA 38 STA $38FA  [$7E:38FA] A:0011 X:0000 Y:FFFF P:envMxdizC - Store A in 7E38FA.
$03/D0D8 AD 22 27 LDA $2722  [$7E:2722] A:0011 X:0000 Y:FFFF P:envMxdizC - Load Target's Magical Defense Multiplier into A.
$03/D0DB 8D FB 38 STA $38FB  [$7E:38FB] A:0003 X:0000 Y:FFFF P:envMxdizC - Store A in 7E38FB.
$03/D0DE F0 0C BEQ $0C    [$D0EC] A:0003 X:0000 Y:FFFF P:envMxdizC - If 00 branch to 03D0EC.
$03/D0E0 AD 9F 28 LDA $289F  [$7E:289F] A:0003 X:0000 Y:FFFF P:envMxdizC - Load 7E289F into A.
$03/D0E3 29 80 AND #$80 A:0002 X:0000 Y:FFFF P:envMxdizC - Remove positive bits.
$03/D0E5 F0 05 BEQ $05    [$D0EC] A:0000 X:0000 Y:FFFF P:envMxdiZC - If 00 branch to 03D0EC.
------------------------------------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------------------------------------
$03/D0EC AD 03 27 LDA $2703  [$7E:2703] A:0000 X:0000 Y:FFFF P:envMxdiZC - Load Target's Status Byte 1.
$03/D0EF 29 20 AND #$20 A:0000 X:0000 Y:FFFF P:envMxdiZC - Is it Toad?
$03/D0F1 D0 07 BNE $07    [$D0FA] A:0000 X:0000 Y:FFFF P:envMxdiZC - If so branch to 03D0FA.
$03/D0F3 AD 05 27 LDA $2705  [$7E:2705] A:0000 X:0000 Y:FFFF P:envMxdiZC - Load Target's Status Byte 3.
$03/D0F6 29 08 AND #$08 A:0000 X:0000 Y:FFFF P:envMxdiZC - Is it Charging?
$03/D0F8 F0 03 BEQ $03    [$D0FD] A:0000 X:0000 Y:FFFF P:envMxdiZC - If not branch to 03D0FD.
-------------------------------------------------------------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------------------------------------------------------------
$03/D0FD A5 CE LDA $CE    [$00:00CE] A:0000 X:0000 Y:FFFF P:envMxdiZC - Load CE into A.
$03/D0FF 10 0F BPL $0F    [$D110] A:0000 X:0000 Y:FFFF P:envMxdiZC - If not negative branch to 03D110
---------------------------------------------------------------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------------------------------------------------------------
$03/D110 20 97 C9 JSR $C997  [$03:C997] A:0000 X:0000 Y:FFFF P:envMxdiZC - Jump to Subroutine (RNG dealings)
$03/D113 A5 CD LDA $CD    [$00:00CD] A:005E X:0000 Y:0000 P:envMxdiZC - Load CD into A.
$03/D115 29 80 AND #$80 A:0000 X:0000 Y:0000 P:envMxdiZC - Get rid of positive bits.
$03/D117 D0 0C BNE $0C    [$D125] A:0000 X:0000 Y:0000 P:envMxdiZC - If not 00 branch to 03D125.
$03/D119 A5 CE LDA $CE    [$00:00CE] A:0000 X:0000 Y:0000 P:envMxdiZC - Load CE into A.
$03/D11B 29 80 AND #$80 A:0000 X:0000 Y:0000 P:envMxdiZC - Get rid of positive bits.
$03/D11D D0 06 BNE $06    [$D125] A:0000 X:0000 Y:0000 P:envMxdiZC - If not 00 branch to 03D125.
$03/D11F 38 SEC A:0000 X:0000 Y:0000 P:envMxdiZC - Set Carry Flag.
$03/D120 AD 51 35 LDA $3551  [$7E:3551] A:0000 X:0000 Y:0000 P:envMxdiZC - Load A from 7E3551.
$03/D123 80 11 BRA $11    [$D136] A:0008 X:0000 Y:0000 P:envMxdizC - Branch to 03D136.
------------------------------------------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------------------------------------------
$03/D136 8D FC 38 STA $38FC  [$7E:38FC] A:0008 X:0000 Y:0000 P:envMxdizC - Store A in 7E38FC.
$03/D139 F0 02 BEQ $02    [$D13D] A:0008 X:0000 Y:0000 P:envMxdizC - If 00 branch to 03D13D.
$03/D13B B0 25 BCS $25    [$D162] A:0008 X:0000 Y:0000 P:envMxdizC - If 00 or above? branch to 03D162
-------------------------------------------------------------------------------------------------------------------------------------------------------

-----------------------------------------------------------------------------------------------------------------------------------------------------
$03/D162 A5 CE LDA $CE    [$00:00CE] A:0008 X:0000 Y:0000 P:envMxdizC - Load CE into A.
$03/D164 10 15 BPL $15    [$D17B] A:0000 X:0000 Y:0000 P:envMxdiZC - If positive branch to 03D17B.
-------------------------------------------------------------------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------------------------------------------------------------------
$03/D17B AD 84 35 LDA $3584  [$7E:3584] A:0000 X:0000 Y:0000 P:envMxdiZC - Load A from 7E3584.
$03/D17E F0 0F BEQ $0F    [$D18F] A:0000 X:0000 Y:0000 P:envMxdiZC - If 00 branch to 03D18F.
$03/D192 29 7F AND #$7F A:0002 X:0000 Y:0000 P:envMxdizC - Get rid of negative bits.
$03/D194 C9 7E CMP #$7E A:0002 X:0000 Y:0000 P:envMxdizC - Is it 7E?
$03/D196 F0 0C BEQ $0C    [$D1A4] A:0002 X:0000 Y:0000 P:eNvMxdizc - If so branch to 03D1A4.
$03/D198 C9 7F CMP #$7F A:0002 X:0000 Y:0000 P:eNvMxdizc - Is it 7F?
$03/D19A D0 0E BNE $0E    [$D1AA] A:0002 X:0000 Y:0000 P:eNvMxdizc - If not branch to 03D1AA.
---------------------------------------------------------------------------------------------------------------------------------------------------

-----------------------------------------------------------------------------------------------------------------------------------------------------
$03/D1AA 48 PHA A:0002 X:0000 Y:0000 P:eNvMxdizc - Push A.
$03/D1AB A5 CE LDA $CE    [$00:00CE] A:0002 X:0000 Y:0000 P:eNvMxdizc - Load A from CE.
$03/D1AD C5 CD CMP $CD    [$00:00CD] A:0000 X:0000 Y:0000 P:envMxdiZc - Is it the value that is in CD?
$03/D1AF D0 0C BNE $0C    [$D1BD] A:0000 X:0000 Y:0000 P:envMxdiZC - If not branch to 03D1BD.
$03/D1B1 AD 8B 26 LDA $268B  [$7E:268B] A:0000 X:0000 Y:0000 P:envMxdiZC - Load A from Caster's Current MP
$03/D1B4 8D 0B 27 STA $270B  [$7E:270B] A:00E7 X:0000 Y:0000 P:eNvMxdizC - Store it in Target's Current MP?
$03/D1B7 AD 8C 26 LDA $268C  [$7E:268C] A:00E7 X:0000 Y:0000 P:eNvMxdizC - Load A from Caster's Current MP Byte 2.
$03/D1BA 8D 0C 27 STA $270C  [$7E:270C] A:0003 X:0000 Y:0000 P:envMxdizC - Store it in Target's Current MP Byte 2.
$03/D1BD 68 PLA A:0003 X:0000 Y:0000 P:envMxdizC - Pull A.
$03/D1BE 20 A7 D2 JSR $D2A7  [$03:D2A7] A:0002 X:0000 Y:0000 P:envMxdizC - Jump to Subroutine (Direct Spell Subroutine Starting Point)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
(Important! This is how the game generates its Spell Offsets!)

$03/D2A7 0A ASL A A:0002 X:0000 Y:0000 P:envMxdizC - x2 A.
$03/D2A8 AA TAX A:0004 X:0000 Y:0000 P:envMxdizc - Transfer A to X.
$03/D2A9 BF 91 E0 03 LDA $03E091,x[$03:E095] A:0004 X:0004 Y:0000 P:envMxdizc - Load A from 03E091 +X
$03/D2AD 85 80 STA $80    [$00:0080] A:001C X:0004 Y:0000 P:envMxdizc - Store A in 80.
$03/D2AF BF 92 E0 03 LDA $03E092,x[$03:E096] A:001C X:0004 Y:0000 P:envMxdizc - Load A from 03E092 +X
$03/D2B3 85 81 STA $81    [$00:0081] A:00D4 X:0004 Y:0000 P:eNvMxdizc - Store A in 81.
$03/D2B5 A9 03 LDA #$03 A:00D4 X:0004 Y:0000 P:eNvMxdizc - Load 03 into A.
$03/D2B7 85 82 STA $82    [$00:0082] A:0003 X:0004 Y:0000 P:envMxdizc
$03/D2B9 DC 80 00 JML [$0080][$03:D41C] A:0003 X:0004 Y:0000 P:envMxdizc - Jump Long to Specific Spell Subroutines.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/E33C A9 CE LDA #$CE A:0080 X:0680 Y:001A P:eNvMxdizC - Load A from CE.
$03/E33E 8D C5 33 STA $33C5  [$7E:33C5] A:00CE X:0680 Y:001A P:eNvMxdizC - Store A in 7E33C5.
-----------------------------------------------------------------------------------------------------------------------------
$03/E341 A9 0A LDA #$0A A:000F X:00C0 Y:0030 P:envMxdizC - Load 0A into A.
$03/E343 8D C8 34 STA $34C8  [$7E:34C8] A:000A X:00C0 Y:0030 P:envMxdizC - Store in 7E34C8.
$03/E346 A9 10 LDA #$10 A:000A X:00C0 Y:0030 P:envMxdizC - Load 10 into A.
$03/E348 8D C7 34 STA $34C7  [$7E:34C7] A:0010 X:00C0 Y:0030 P:envMxdizC - Store in 7E34C7.
$03/E34B 60 RTS A:0010 X:00C0 Y:0030 P:envMxdizC - Return



 
This was an absolute ton of work, considering that 1/100th of the actual Subroutine does anything! A lot of it is a jump to an area I was trying to avoid for as long as possible in the Magic Call Subroutines, but I got pulled into it. However I did locate some very important things within.

First and foremost is Command Targeting!

$03/E32C   A9 F8   LDA #$F8   A:0000   X:7510   Y:0018   P:envMxdiZc - Load F8 into A. - Load F8 into A. (All Ally Target)
$03/E32E   8D D4 26   STA $26D4  [$7E:26D4]   A:00F8   X:7510   Y:0018   P:eNvMxdizc - Store A in Targeting (!!! I finally found the first case of identifiable targeting in a Command!)

00 - No Target
01 - Monster Target 1 (Slot 3)
02 - Monster Target 2 (Slot 2)
04 - Monster Target 3 (Slot 1)
08 - Character Target 1 (Slot 5)
10 - Character Target 2(Slot 2)
20 - Character Target 3(Slot 3)
40 - Character Target 4 (Slot4)
80 - Character Target 5 (Slot 1)

(I'm uncertain why I can't hit more than 3 monsters)
F8 is the ordinary command targeting, meaning target all allies, I'm not sure how to hit all monster 0F only hits 3 of them. Unfortunately by the way this particular sequence is developed it is also retargetted in the crazy Magic Call routine, so I can't quite make good use of that, not in this routine anyhow. Also because of the way the command works (Subroutine makes it act as if it were a healing spell) I don't think I can get rid of the Split Damage portion of it.

Furthermore is how the game Really tells what is considered White and Black Magic (granted Phoenix's hack a long time ago may have fixed this, I'm not really sure.)

$03/CEBC   C9 19   CMP #$19   A:00CE   X:0000   Y:0000   P:eNvMxdizc - Is it 19?
$03/CEBE   B0 01   BCS $01    [$CEC1]   A:00CE   X:0000   Y:0000   P:eNvMxdizC - If it is more than 19 branch to 03CEC1. (Looking at the start of Black Magic, it seems)
---------------------------------------------------------------------------------------------------------------------------
$03/CEC0   E8    INX   A:0005   X:0000   Y:0000   P:eNvMxdizc +1 to X.
---------------------------------------------------------------------------------------------------------------------------
$03/CEC1   86 C7   STX $C7    [$00:00C7]   A:00CE   X:0000   Y:0000   P:eNvMxdizC - Store X in C7.
$03/CEC3   BD 97 26   LDA $2697,x[$7E:2697]   A:00CE   X:0000   Y:0000   P:eNvMxdizC - Load Caster's Wisdom Or Will (dependent on whether X above was triggered)

And...

$03/CF0F   A6 C7   LDX $C7    [$00:00C7]   A:0000   X:0000   Y:0000   P:envMxdiZc - Load X from C7.
$03/CF11   BD 97 26   LDA $2697,x[$7E:2697]   A:0000   X:0000   Y:0000   P:envMxdiZc - Load Caster's Modified Wisdom or Will
$03/CF14   20 86 84   JSR $8486  [$03:8486]   A:0012   X:0000   Y:0000   P:envMxdizc - Jump to Subroutine (Divide the value by 4.)

Hmm, I'd love to try and add a Wisdom/Will combination for Summons, but that seems like it would be quite a tricky JSR to even work to.

And that should do it for Salve! ...I think. It was a lot more work than I was ever anticipating, but the yields were quite fantastic.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (All Spells Disassembly)
Post by: chillyfeez on October 03, 2013, 10:19:07 PM
Couple of questions about the targetting...
Did you try other values beyond what you listed? For example, what happens if you use 78? Does it target everyone except slot 5? Have you tried FF?
More compelling to me than that: have you noticed any other routines storing a value into 26D4? Is this always used as the targeting byte in RAM?
Title: Re: Grimoire LD's Notes, Methods, and Hacks (All Spells Disassembly)
Post by: Grimoire LD on October 03, 2013, 11:15:34 PM
I did try a few of these, but I'll check out the others and see what happens...

FF will only target your party and three of the enemy. (Splitting it eight ways, hilariously enough)
78 works just as you predicted. It hits all except Character 5 (Slot 1)

26D4? When I was just browsing through the Dark Wave routine, I may have seen it, let me check...

No, apparently I did not.

...Just did a search for it!

You were the one who found a reference, ironically enough...

"
$03/E050 A9 F8       LDA #$F8                A:0000 X:0000 Y:0000
$03/E052 8D D4 26    STA $26D4  [$7E:26D4]   A:0000 X:0000 Y:0000 ;(Don't know what's going on here, seems irrelevant)
"

Load Target All, Store A in Targeting Area. Why can the Life Item when split through Salve go through the normal check? Likely the same reason Asura can go through the normal check. A specific targetting that goes beyond the normal "Is Target Dead? Check."

To my knowledge it is always used as targeting. The reason we have a very compressed version to use in casual editing is because they shoved targeting into only a half-byte.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (All Spells Disassembly)
Post by: Grimoire LD on October 04, 2013, 09:15:59 AM
Hmm, I've just done a bit of testing Chillyfeez and it seems that you may not have tested Salve as thoroughly as possible. I can change its targeting without any issue. 80- Auto Target All Allies , 60 - Target All Enemies, 50 - Target one Enemy. 10 - Target one Ally, 20 - Target all Allies. F0 Target split Enemies/Allies.

 I wonder if we can turn the Salve Command into a "Split Any Item" effect by checking it, broadly speaking, against the first item and seeing if it falls within the B0 to DD. As the routine itself only seems to load the item routine to load from another area (Magic Call) and giving it Ally/Enemy targeting (F0) allowing the player that much more versaility in using it?

Title: Re: Grimoire LD's Notes, Methods, and Hacks (All Spells Disassembly)
Post by: chillyfeez on October 04, 2013, 02:58:24 PM
 :blush: my mistake. Did you try targeting enemies with it? Maybe I tried that first and the result was unchanged so I jumped to conclusions... wonder what else I might have missed.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (All Spells Disassembly)
Post by: Grimoire LD on October 06, 2013, 02:55:09 PM
Indeed, you can target enemies with it in a normal fashion as well.

As for some Commands though... I don't think they will have the ability to have their targeting changed, mainly the skills that invoke the normal attack routine. Jump, Focus, and Aim since they are modified normal attacks that are only given special circumstances through the same said normal attack routine. (In all fairness Aim is probably a little different) But we will see in time.

Next up is the Cover Routine -

Cover is a very special command for several reasons.

1. It is the first command (inwardly) that changes to something else depending on whether it has been used (In this case "Off")
2. It requires a specific character (and surprisingly it has a safeguard ?against cheaters? that makes it so Cover is disabled if the Dark Knight is present).
3. The behavior can be applied to all characters except the Coverer.
4. If another character uses Cover they can then set another target or themselves to be covered. In essence targeting the Coverer's Cover (perhaps a command for Rosa?)

So let's see what its routine reveals...

Code: [Select]
$03/E60F A5 CE LDA $CE    [$00:00CE] A:0003 X:0026 Y:0000 P:envMxdizc - Load CE from A (Slot of Character that will be Covered)
$03/E611 8D 7A 35 STA $357A  [$7E:357A] A:0001 X:0026 Y:0000 P:envMxdizc - Store A in 7E357A.  (Store A in Character Slot that Will be Covered)
$03/E614 20 89 84 JSR $8489  [$03:8489] A:0001 X:0026 Y:0000 P:envMxdizc - Jump to Subroutine (Preparation?)
$03/E617 A6 A6 LDX $A6    [$00:00A6] A:0000 X:0240 Y:0000 P:envMxdizc - Load the value in A6 into X.
$03/E619 BD 06 20 LDA $2006,x[$7E:2106] A:0000 X:0100 Y:0000 P:envMxdizc - Load A from the Target of Cover's Status Byte 4.
$03/E61C 09 02 ORA #$02 A:0000 X:0100 Y:0000 P:envMxdiZc - Add 02 to A if applicable.
$03/E61E 9D 06 20 STA $2006,x[$7E:2106] A:0002 X:0100 Y:0000 P:envMxdizc - Store "Covered" in Target of Cover's Status Byte 4.
$03/E621 A5 CD LDA $CD    [$00:00CD] A:0002 X:0100 Y:0000 P:envMxdizc - Load A from CD.
$03/E623 20 89 84 JSR $8489  [$03:8489] A:0000 X:0100 Y:0000 P:envMxdiZc - Jump to Subroutine. (Preparation?)
$03/E626 AE 34 35 LDX $3534  [$7E:3534] A:0000 X:0000 Y:0000 P:envMxdiZc - Load X from 7E3534.
-----------------------------------------------------------(Looping Point)-----------------------------------------------------------------------------
$03/E629 BD 03 33 LDA $3303,x[$7E:3303] A:0000 X:0000 Y:0000 P:envMxdiZc - Load A from User's Command Byte X.
$03/E62C C9 13 CMP #$13 A:0000 X:0000 Y:0000 P:envMxdiZc - Is it Cover?
$03/E62E F0 06 BEQ $06    [$E636] A:0000 X:0000 Y:0000 P:eNvMxdizc - Branch if equal to 03E636.
$03/E630 E8 INX A:0000 X:0000 Y:0000 P:eNvMxdizc - +1 to X
$03/E631 E8 INX A:0000 X:0001 Y:0000 P:envMxdizc +1 to X
$03/E632 E8 INX A:0000 X:0002 Y:0000 P:envMxdizc +1 to X
$03/E633 E8 INX A:0000 X:0003 Y:0000 P:envMxdizc +1 to X
$03/E634 80 F3 BRA $F3    [$E629] A:0000 X:0004 Y:0000 P:envMxdizc - Loop back to 03E629. - Continue looking for it.
$03/E636 A9 1D LDA #$1D A:0013 X:0004 Y:0000 P:envMxdiZC - Load 1D into A. - Load Off into A.
$03/E638 9D 03 33 STA $3303,x[$7E:3307] A:001D X:0004 Y:0000 P:envMxdizC - Store A in Command Byte.
$03/E63B 7B TDC A:001D X:0004 Y:0000 P:envMxdizC - Transfer Direct Page. - Transfer Direct Page.
$03/E63C 9D 02 33 STA $3302,x[$7E:3306] A:0000 X:0004 Y:0000 P:envMxdiZC  - Store 00 in the byte before Command.
$03/E63F A5 CD LDA $CD    [$00:00CD] A:0000 X:0004 Y:0000 P:envMxdiZC - Load A from CD. -
$03/E641 85 00 STA $00    [$00:0000] A:0000 X:0004 Y:0000 P:envMxdiZC - Store A in 00.
$03/E643 A9 09 LDA #$09 A:0000 X:0004 Y:0000 P:envMxdiZC - Load 09 into A.
$03/E645 20 85 80 JSR $8085  [$03:8085] A:0009 X:0004 Y:0000 P:envMxdizC - Jump to Subroutine. (A lot of jumping)
$03/E648 A9 13 LDA #$13 A:0005 X:7504 Y:000A P:envMxdiZC - Cover Message into A.
$03/E64A 8D C8 34 STA $34C8  [$7E:34C8] A:0013 X:7504 Y:000A P:envMxdizC - Store A in 7E34C8.
$03/E64D A9 10 LDA #$10 A:0013 X:7504 Y:000A P:envMxdizC - Load Mini-message into A.
$03/E64F 8D C7 34 STA $34C7  [$7E:34C7] A:0010 X:7504 Y:000A P:envMxdizC - Store A 7E34C7.
$03/E652 60 RTS A:0010 X:7504 Y:000A P:envMxdizC - Return
--------------------------------------------------------------------------------------------------------------------------------------------------

Well that was short and to the point. Apply Status to the Covered. Now there were a few other things in there as well, but I couldn't really make much sense of them.
Alot of its peculiarities would probably deal with the coding of status ailments and that's a completely unexplored region.



Off Routine -

Code: [Select]
$03/E653 A9 1D LDA #$1D A:0003 X:003A Y:0000 P:envMxdizc - Load 1D into A. - Load Off into Message.
$03/E655 8D C8 34 STA $34C8  [$7E:34C8] A:001D X:003A Y:0000 P:envMxdizc - Store A in 7E34C8.
$03/E658 A9 10 LDA #$10 A:001D X:003A Y:0000 P:envMxdizc - Load 10 into A. - Load Min-Message
$03/E65A 8D C7 34 STA $34C7  [$7E:34C7] A:0010 X:003A Y:0000 P:envMxdizc - Store A in 7E34C7. 
$03/E65D AD 7A 35 LDA $357A  [$7E:357A] A:0010 X:003A Y:0000 P:envMxdizc - Load A from 7E357A. (Character last covered)
$03/E660 20 89 84 JSR $8489  [$03:8489] A:0000 X:003A Y:0000 P:envMxdiZc  - Jump to Subroutine (Preparation?)
$03/E663 A6 A6 LDX $A6    [$00:00A6] A:0000 X:0000 Y:0000 P:envMxdiZc - Load Character Slot into X.
$03/E665 BD 06 20 LDA $2006,x[$7E:2006] A:0000 X:0000 Y:0000 P:envMxdiZc - Load A from Character that was Covered's Status Byte 4.
$03/E668 29 FD AND #$FD A:0002 X:0000 Y:0000 P:envMxdizc - Add -2 to it.
$03/E66A 9D 06 20 STA $2006,x[$7E:2006] A:0000 X:0000 Y:0000 P:envMxdiZc - Store A in the Character that was Covered's Status Byte 4.
$03/E66D A5 CD LDA $CD    [$00:00CD] A:0000 X:0000 Y:0000 P:envMxdiZc - Load CD into A.
$03/E66F 20 89 84 JSR $8489  [$03:8489] A:0000 X:0000 Y:0000 P:envMxdiZc - Jump to Subroutine (Preparation?)
$03/E672 AE 34 35 LDX $3534  [$7E:3534] A:0000 X:0000 Y:0000 P:envMxdiZc - Load X from 7E3534.
-------------------------------------------------------(Looping Point)----------------------------------------------------------------------
$03/E675 BD 03 33 LDA $3303,x[$7E:3303] A:0000 X:0000 Y:0000 P:envMxdiZc - Load from User's Command Byte.
$03/E678 C9 1D CMP #$1D A:0000 X:0000 Y:0000 P:envMxdiZc - Is it Off?
$03/E67A F0 06 BEQ $06    [$E682] A:0000 X:0000 Y:0000 P:eNvMxdizc - If so branch to 03E682.
$03/E67C E8 INX A:0000 X:0000 Y:0000 P:eNvMxdizc - +1 X
$03/E67D E8 INX A:0000 X:0001 Y:0000 P:envMxdizc +1 X
$03/E67E E8 INX A:0000 X:0002 Y:0000 P:envMxdizc +1 X
$03/E67F E8 INX A:0000 X:0003 Y:0000 P:envMxdizc +1 X
$03/E680 80 F3 BRA $F3    [$E675] A:0000 X:0004 Y:0000 P:envMxdizc - Loop back to 03E675. - Look for it until you find it.
$03/E682 A9 13 LDA #$13 A:001D X:0004 Y:0000 P:envMxdiZC - Load Cover into A.
$03/E684 9D 03 33 STA $3303,x[$7E:3307] A:0013 X:0004 Y:0000 P:envMxdizC - Store A in User's Command Byte.
$03/E687 A9 18 LDA #$18 A:0013 X:0004 Y:0000 P:envMxdizC - Load 18 into A -
$03/E689 9D 02 33 STA $3302,x[$7E:3306] A:0018 X:0004 Y:0000 P:envMxdizC - Store A in byte before Command Byte.
$03/E68C A5 CD LDA $CD    [$00:00CD] A:0018 X:0004 Y:0000 P:envMxdizC - Load A from CD.
$03/E68E 85 00 STA $00    [$00:0000] A:0000 X:0004 Y:0000 P:envMxdiZC - Store A in 00.
$03/E690 A9 09 LDA #$09 A:0000 X:0004 Y:0000 P:envMxdiZC - Load 09 into A.
$03/E692 20 85 80 JSR $8085  [$03:8085] A:0009 X:0004 Y:0000 P:envMxdizC (Lots of jumping)
$03/E695 60 RTS A:0005 X:7504 Y:000A P:envMxdiZC - Return

It is almost a carbon copy of what is above surprisingly enough. Except with a -2 rather than a +2.

Well that seems quite simple to figure out. But it seems because of the way it is made it can't be multi-targetted as it has no support in doing so.


:edit: 1/10/14 - Fixed up a bit of the above, adding information that I am more aware of now.


Title: Re: Grimoire LD's Notes, Methods, and Hacks (All Spells Disassembly)
Post by: Grimoire LD on October 06, 2013, 06:54:52 PM
Next up is Gird/Endure/Bear - Yang Casting Protect on Himself for free.

Gird Routine -

Code: [Select]
$03/E696 A9 05 LDA #$05 A:0003 X:001E Y:0000 P:envMxdizc - Load 05 into A. (Protect)
$03/E698 8D D2 26 STA $26D2  [$7E:26D2] A:0005 X:001E Y:0000 P:envMxdizc - Store A in Next Action (Protect)
$03/E69B 9C C4 33 STZ $33C4  [$7E:33C4] A:0005 X:001E Y:0000 P:envMxdizc - Store Zero in 7E33C4.
$03/E69E 20 3E CD JSR $CD3E  [$03:CD3E] A:0005 X:001E Y:0000 P:envMxdizc - Jump to Subroutine (Magic Call... Look at Salve Routine for more detail)
$03/E6A1 20 B1 85 JSR $85B1  [$03:85B1] A:0080 X:0680 Y:001A P:eNvMxdizC - Jump to Subroutine (Nothing of great value as far as I can tell.)
$03/E6A4 A9 3A LDA #$3A A:0003 X:0680 Y:001A P:envMxdizC - Load 3A into A. (D)
$03/E6A6 8D CA 34 STA $34CA  [$7E:34CA] A:003A X:0680 Y:001A P:envMxdizC - Store A in 7E34CA (Battle Message Area)
$03/E6A9 A9 0F LDA #$0F A:003A X:0680 Y:001A P:envMxdizC - Load 0F into A.
$03/E6AB 8D C8 34 STA $34C8  [$7E:34C8] A:000F X:0680 Y:001A P:envMxdizC - Store A in 7E34C8.
$03/E6AE A9 10 LDA #$10 A:000F X:0680 Y:001A P:envMxdizC - Load 10 into A.
$03/E6B0 8D C7 34 STA $34C7  [$7E:34C7] A:0010 X:0680 Y:001A P:envMxdizC - Store A in 7E34C7.
$03/E6B3 60 RTS A:0010 X:0680 Y:001A P:envMxdizC - Return

That was a routine? Much shorter than I expected for a literal Spell Casting routine, but this is actually Very good news. Look at how short it is to Actually make a Command cast a given spell? It seems much shorter than Peep. So in reality you could virtually copy this data, paste it into Peep, change 05 to Peep's spell number and there you go. You would probably even save yourself quite a few bytes in doing so.

Interestingly, while Gird clearly shows the character taking a defensive stance it doesn't actually give the user Defensive Status.

Next up is Kick Routine, that we already know is linked to directly to Dark Wave, unfortunately. Change the stat determination in one and you change the stats in the other.

So let's see what the Routine has to show us.


Kick Routine -

Code: [Select]
$03/E6B4 64 C1 STZ $C1    [$00:00C1] A:0003 X:001C Y:0000 P:envMxdizc - Store Zero in C1.
$03/E6B6 4C B9 E6 JMP $E6B9  [$03:E6B9] A:0003 X:001C Y:0000 P:envMxdizc - Jump to... 0 bytes away. Sure, alright.
$03/E6B9 A5 CD LDA $CD    [$00:00CD] A:0003 X:001C Y:0000 P:envMxdizc - Load CD into A. (Character ID?)
$03/E6BB 10 4A BPL $4A    [$E707] A:0000 X:001C Y:0000 P:envMxdiZc - Branch if Plus to 03E707. (If a player is not using it (and is for Enemy Yang)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E6BD 8D C7 34 STA $34C7  [$7E:34C7] A:0080 X:001C Y:0000 P:eNvMxdizc - Store A in 7E34C7.
$03/E6C0 A9 F8 LDA #$F8 A:0080 X:001C Y:0000 P:eNvMxdizc - Load F8 into A
$03/E6C2 8D C5 34 STA $34C5  [$7E:34C5] A:00F8 X:001C Y:0000 P:eNvMxdizc - Store A in 7E34C5.
$03/E6C5 7B TDC A:00F8 X:001C Y:0000 P:eNvMxdizc - Transfer Direct Page.
$03/E6C6 AA TAX A:0000 X:001C Y:0000 P:envMxdiZc - Transfer A to X.
$03/E6C7 A8 TAY A:0000 X:0000 Y:0000 P:envMxdiZc - Transfer A to Y.
------------------------------------------------------------------(Looping Point)------------------------------------------------------------------------------
$03/E6C8 BD C2 33 LDA $33C2,x[$7E:33C2] A:0000 X:0000 Y:0000 P:envMxdiZc - Load 7E33C2 into A. (Graphics of some kind?)
$03/E6CB 99 9C 28 STA $289C,y[$7E:289C] A:00F2 X:0000 Y:0000 P:eNvMxdizc - Store A in 7E289C.
$03/E6CE C9 CE CMP #$CE A:00F2 X:0000 Y:0000 P:eNvMxdizc - Is it CE?
$03/E6D0 F0 08 BEQ $08    [$E6DA] A:00F2 X:0000 Y:0000 P:envMxdizC - If so branch to 03E6DA.
$03/E6D2 C9 C5 CMP #$C5 A:00F2 X:0000 Y:0000 P:envMxdizC - Is it C5?
$03/E6D4 F0 04 BEQ $04    [$E6DA] A:00F2 X:0000 Y:0000 P:envMxdizC - If so branch to 03E6DA.
$03/E6D6 E8 INX A:00F2 X:0000 Y:0000 P:envMxdizC - +1 X.
$03/E6D7 C8 INY A:00F2 X:0001 Y:0000 P:envMxdizC - +1 Y.
$03/E6D8 80 EE BRA $EE    [$E6C8] A:00F2 X:0001 Y:0001 P:envMxdizC - Loop back to 03E6C8.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E6DA C8 INY A:00CE X:0002 Y:0002 P:envMxdiZC - +1 to Y.
$03/E6DB A9 F8 LDA #$F8 A:00CE X:0002 Y:0003 P:envMxdizC - Load F8 into A.
$03/E6DD 99 9C 28 STA $289C,y[$7E:289F] A:00F8 X:0002 Y:0003 P:eNvMxdizC - Store A in 7E289F.
$03/E6E0 C8 INY A:00F8 X:0002 Y:0003 P:eNvMxdizC - +1 to Y.
$03/E6E1 A9 04 LDA #$04 A:00F8 X:0002 Y:0004 P:envMxdizC + Load 04 into A.
$03/E6E3 99 9C 28 STA $289C,y[$7E:28A0] A:0004 X:0002 Y:0004 P:envMxdizC - Store A in 7E28A0.
$03/E6E6 C8 INY A:0004 X:0002 Y:0004 P:envMxdizC - +1 to Y.
$03/E6E7 E8 INX A:0004 X:0002 Y:0005 P:envMxdizC +1 to X.
$03/E6E8 BD C2 33 LDA $33C2,x[$7E:33C5] A:0004 X:0003 Y:0005 P:envMxdizC - Load A from 7E33C5 (Graphics of some kind?)
$03/E6EB 99 9C 28 STA $289C,y[$7E:28A1] A:00FE X:0003 Y:0005 P:eNvMxdizC - Store A in 7E28A1.
$03/E6EE C9 FF CMP #$FF A:00FE X:0003 Y:0005 P:eNvMxdizC - Is it FF?
 $03/E6F0 F0 04 BEQ $04    [$E6F6] A:00FE X:0003 Y:0005 P:eNvMxdizc - If it is branch to 03E6F6.
$03/E6F2 E8 INX A:00FE X:0003 Y:0005 P:eNvMxdizc - +1 to X.
$03/E6F3 C8 INY A:00FE X:0004 Y:0005 P:envMxdizc  - +1 to Y.
$03/E6F4 80 F2 BRA $F2    [$E6E8] A:00FE X:0004 Y:0006 P:envMxdizc - Loop back to 03E6E8.
--------------------------------------------------------------------------------------------------------------------------------------
$03/E6F6 7B TDC A:00FF X:0004 Y:0006 P:envMxdiZC - Transfer Direct Page.
$03/E6F7 AA TAX A:0000 X:0004 Y:0006 P:envMxdiZC - Transfer A to X.
$03/E6F8 BD 9C 28 LDA $289C,x[$7E:289C] A:0000 X:0000 Y:0006 P:envMxdiZC - Load 7E289C.
$03/E6FB 9D C2 33 STA $33C2,x[$7E:33C2] A:00F2 X:0000 Y:0006 P:eNvMxdizC - Store A in 7E33C2.
$03/E6FE C9 FF CMP #$FF A:00F2 X:0000 Y:0006 P:eNvMxdizC - Is it FF?
$03/E700 F0 03 BEQ $03    [$E705] A:00F2 X:0000 Y:0006 P:eNvMxdizc -If so branch to 03E705.
$03/E702 E8 INX A:00F2 X:0000 Y:0006 P:eNvMxdizc - +1 to X.
$03/E703 80 F3 BRA $F3    [$E6F8] A:00F2 X:0001 Y:0006 P:envMxdizc - Loop back to 03E6F8.
$03/E705 80 0A BRA $0A    [$E711] A:00FF X:0006 Y:0006 P:envMxdiZC - Branch to 03E711
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E707 A9 F8 LDA #$F8 A:0000 X:001C Y:0000 P:envMxdiZc - Load F8 into A. (Possibly Graphics Data of sorts)
$03/E709 8D C6 33 STA $33C6  [$7E:33C6] A:00F8 X:001C Y:0000 P:eNvMxdizc - Store A in 7E33C6.
$03/E70C A9 04 LDA #$04 A:00F8 X:001C Y:0000 P:eNvMxdizc - Load 04 into A.
$03/E70E 8D C7 33 STA $33C7  [$7E:33C7] A:0004 X:001C Y:0000 P:envMxdizc - Store A in 7E33C7.
$03/E711 AD 81 38 LDA $3881  [$7E:3881] A:0004 X:001C Y:0000 P:envMxdizc - Load A from 7E3881.
$03/E714 F0 03 BEQ $03    [$E719] A:0000 X:001C Y:0000 P:envMxdiZc - If 00 branch to 03E719.
----------------------------------------------------------------------------------------------------------------------------

--------------------------------------------------------------------------------------------------------------------------
$03/E719 A6 A6 LDX $A6    [$00:00A6] A:0000 X:001C Y:0000 P:envMxdiZc - Load X from A6 (Must be to see who is using Kick)
$03/E71B BD 1B 20 LDA $201B,x[$7E:201B] A:0000 X:0000 Y:0000 P:envMxdiZc - Load User's Physical Attack Multiplier.
$03/E71E 85 DF STA $DF    [$00:00DF] A:0003 X:0000 Y:0000 P:envMxdizc - Store A in DF.
$03/E720 A5 C1 LDA $C1    [$00:00C1] A:0003 X:0000 Y:0000 P:envMxdizc - Load A from C1.
$03/E722 D0 08 BNE $08    [$E72C] A:0000 X:0000 Y:0000 P:envMxdiZc - Branch if not 00 to 03E72C. (Skipped by Dark Wave)
$03/E724 46 DF LSR $DF    [$00:00DF] A:0000 X:0000 Y:0000 P:envMxdiZc - Divide Physical Attack Multiplier by 2.
$03/E726 A5 DF LDA $DF    [$00:00DF] A:0000 X:0000 Y:0000 P:envMxdizC - Load DF into A.
$03/E728 D0 02 BNE $02    [$E72C] A:0001 X:0000 Y:0000 P:envMxdizC - If not 00 branch to 03E72C.
$03/E72C A5 DF LDA $DF    [$00:00DF] A:0001 X:0000 Y:0000 P:envMxdizC - Load DF into A (In case it came from an earlier branch)
$03/E72E 85 84 STA $84    [$00:0084] A:0001 X:0000 Y:0000 P:envMxdizC - Store A in 84.
$03/E730 BD 1D 20 LDA $201D,x[$7E:201D] A:0001 X:0000 Y:0000 P:envMxdizC - Load User's Physical Attack Base.
$03/E733 85 C5 STA $C5    [$00:00C5] A:0027 X:0000 Y:0000 P:envMxdizC - Store A in C5.
$03/E735 85 E1 STA $E1    [$00:00E1] A:0027 X:0000 Y:0000 P:envMxdizC - Store A in E1.
$03/E737 20 E0 83 JSR $83E0  [$03:83E0] A:0027 X:0000 Y:0000 P:envMxdizC - Jump to Subroutine (HP Dealing?)
$03/E73A 46 E4 LSR $E4    [$00:00E4] A:0000 X:0000 Y:0000 P:envMxdiZc - E4 /2.
$03/E73C 66 E3 ROR $E3    [$00:00E3] A:0000 X:0000 Y:0000 P:envMxdiZc - E3 /2.
$03/E73E A6 E3 LDX $E3    [$00:00E3] A:0000 X:0000 Y:0000 P:envMxdizC - Load X from E3.
$03/E740 86 CB STX $CB    [$00:00CB] A:0000 X:0013 Y:0000 P:envMxdizC - Store X in CB.
$03/E742 A5 CD LDA $CD    [$00:00CD] A:0000 X:0013 Y:0000 P:envMxdizC - Load A from CD. (Character ID)
$03/E744 30 0C BMI $0C    [$E752] A:0000 X:0013 Y:0000 P:envMxdiZC - Branch if Negative to 03E752. (Enemy Yang using it)
$03/E746 A2 05 00 LDX #$0005 A:0000 X:0013 Y:0000 P:envMxdiZC - Load 0005 into X. (Starting points of Targets -1)
$03/E749 86 C7 STX $C7    [$00:00C7] A:0000 X:0005 Y:0000 P:envMxdizC - Store X in C7.
$03/E74B A2 0D 00 LDX #$000D A:0000 X:0005 Y:0000 P:envMxdizC - Load 0000D into X (Number of Targets)
$03/E74E 86 C3 STX $C3    [$00:00C3] A:0000 X:000D Y:0000 P:envMxdizC - Store X in C3.
$03/E750 80 09 BRA $09    [$E75B] A:0000 X:000D Y:0000 P:envMxdizC -Branch to 03E75B.
----------------------------------------------------------------------------------------------------------------------------------------
$03/E752 7B TDC A:0080 X:0081 Y:0006 P:eNvMxdizc - Transfer Direct Page.
$03/E753 AA TAX A:0000 X:0081 Y:0006 P:envMxdiZc - Transfer A to X.
$03/E754 86 C7 STX $C7    [$00:00C7] A:0000 X:0000 Y:0006 P:envMxdiZc - Store X in C7.
$03/E756 A2 05 00 LDX #$0005 A:0000 X:0000 Y:0006 P:envMxdiZc - Load 0005 into X.
$03/E759 86 C3 STX $C3    [$00:00C3] A:0000 X:0005 Y:0006 P:envMxdizc - Store X in C3 (Possibly enemy targeting works differently inwardly)
----------------------------------------------------------------------------------------------------------------------------------------
$03/E75B 7B TDC A:0000 X:000D Y:0000 P:envMxdizC - Transfer Direct Page.
$03/E75C AA TAX A:0000 X:000D Y:0000 P:envMxdiZC - Transfer A to X.
$03/E75D A5 C5 LDA $C5    [$00:00C5] A:0000 X:0000 Y:0000 P:envMxdiZC - Load Physical Attack Base into A.
$03/E75F 20 79 83 JSR $8379  [$03:8379] A:0027 X:0000 Y:0000 P:envMxdizC - Jump to Subroutine (Generated Random Number, likely between 0-Physical Attack Base)
$03/E762 85 C9 STA $C9    [$00:00C9] A:001E X:0000 Y:0000 P:envMxdizc - Store A in C9.
$03/E764 18 CLC A:001E X:0000 Y:0000 P:envMxdizc - Clear Carry Flag.
$03/E765 A5 CB LDA $CB    [$00:00CB] A:001E X:0000 Y:0000 P:envMxdizc - Load A from CB.
$03/E767 65 C9 ADC $C9    [$00:00C9] A:0013 X:0000 Y:0000 P:envMxdizc - Add A to C9.
$03/E769 85 C9 STA $C9    [$00:00C9] A:0031 X:0000 Y:0000 P:envMxdizc - Store A in C9.
$03/E76B A5 CC LDA $CC    [$00:00CC] A:0031 X:0000 Y:0000 P:envMxdizc - Load A from CC.
$03/E76D 69 00 ADC #$00 A:0000 X:0000 Y:0000 P:envMxdiZc - Add 00 to A.
$03/E76F 85 CA STA $CA    [$00:00CA] A:0000 X:0000 Y:0000 P:envMxdiZc - Store A in CA.
$03/E771 A5 C7 LDA $C7    [$00:00C7] A:0000 X:0000 Y:0000 P:envMxdiZc - Load C7 into A.
$03/E773 AA TAX A:0005 X:0000 Y:0000 P:envMxdizc - Transfer A to X.
$03/E774 BD 40 35 LDA $3540,x[$7E:3545] A:0005 X:0005 Y:0000 P:envMxdizc - Load A from 7E3545.
$03/E777 D0 68 BNE $68    [$E7E1] A:0000 X:0005 Y:0000 P:envMxdiZc - If not 00 branch to 03E7E1.
-----------------------------------------------------------------------------------------------------------------------------------------------
$03/E779 A5 C7 LDA $C7    [$00:00C7] A:0000 X:0005 Y:0000 P:envMxdiZc - Load A from C7.
$03/E77B 20 89 84 JSR $8489  [$03:8489] A:0005 X:0005 Y:0000 P:envMxdizc - Jump to Subroutine (Preparation?)
$03/E77E A6 A6 LDX $A6    [$00:00A6] A:0000 X:05A0 Y:0000 P:envMxdizc - Load X from A6 (Tells the game what is being targetted)
$03/E780 BD 03 20 LDA $2003,x[$7E:2283] A:0000 X:0280 Y:0000 P:envMxdizc - Load Status Byte 1 of Monster Slot X into A.
$03/E783 29 C0 AND #$C0 A:0000 X:0280 Y:0000 P:envMxdiZc - Are they Petrified or Dead?
$03/E785 D0 5A BNE $5A    [$E7E1] A:0000 X:0280 Y:0000 P:envMxdiZc - If so branch to 03E7E1.
----------------------------------------------------------------------------------------------------------------------------------------------------
$03/E787 BD 05 20 LDA $2005,x[$7E:2285] A:0000 X:0280 Y:0000 P:envMxdiZc - Load Status Byte 3 of Monster Slot X into A.
$03/E78A 29 02 AND #$02 A:0000 X:0280 Y:0000 P:envMxdiZc - Is it Jumping?
$03/E78C D0 53 BNE $53    [$E7E1] A:0000 X:0280 Y:0000 P:envMxdiZc - If so branch to 03E7E1.
---------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E78E BD 06 20 LDA $2006,x[$7E:2286] A:0000 X:0280 Y:0000 P:envMxdiZc - Load Status Byte 4 of Monster Slot X into A.
$03/E791 30 4E BMI $4E    [$E7E1] A:0000 X:0280 Y:0000 P:envMxdiZc - Is it Hiding?, if so branch to 03E7E1.
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E793 BD 40 20 LDA $2040,x[$7E:22C0] A:0000 X:0280 Y:0000 P:envMxdiZc - Load Creature Type of Monster Slot X into A.
$03/E796 29 20 AND #$20 A:0000 X:0280 Y:0000 P:envMxdiZc - Is it Slime?
$03/E798 D0 47 BNE $47    [$E7E1] A:0000 X:0280 Y:0000 P:envMxdiZc - If so branch to 03E7E1.
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E79A A5 C1 LDA $C1    [$00:00C1] A:0000 X:0280 Y:0000 P:envMxdiZc - Load A from C1.
$03/E79C F0 0D BEQ $0D    [$E7AB] A:0000 X:0280 Y:0000 P:envMxdiZc - If it is 00 branch to 03E7AB
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!(Special Part of Code, Used by Dark Wave)!!!!!!!!!!!!!!!!!!!!!!!!!!
$03/E79E BD 40 20 LDA $2040,x[$7E:22C0] A:002E X:0280 Y:0000 P:envMxdizc - Load Creature Type of Monster Slot X into A.
$03/E7A1 10 08 BPL $08    [$E7AB] A:0000 X:0280 Y:0000 P:envMxdiZc - If it not Zombie, branch to 03E7AB.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E7A3 46 CA LSR $CA    [$00:00CA] A:0080 X:0280 Y:0000 P:eNvMxdizc - /2 CA.
$03/E7A5 66 C9 ROR $C9    [$00:00C9] A:0080 X:0280 Y:0000 P:envMxdiZc /2 C9
$03/E7A7 46 CA LSR $CA    [$00:00CA] A:0080 X:0280 Y:0000 P:envMxdizC /2 CA
$03/E7A9 66 C9 ROR $C9    [$00:00C9] A:0080 X:0280 Y:0000 P:envMxdiZc /2 C9 9 (Divide Damage by 4)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E7AB A5 C1 LDA $C1    [$00:00C1] A:0000 X:0280 Y:0000 P:envMxdiZc  - Load A from C1.
$03/E7AD D0 20 BNE $20    [$E7CF] A:0000 X:0280 Y:0000 P:envMxdiZc - If it is not 00 branch to 03E7CF.
-------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E7AF A5 84 LDA $84    [$00:0084] A:0000 X:0280 Y:0000 P:envMxdiZc - Load A from 84.
$03/E7B1 85 DF STA $DF    [$00:00DF] A:0001 X:0280 Y:0000 P:envMxdizc  - Store A in DF (same as normal?)
$03/E7B3 BD 2A 20 LDA $202A,x[$7E:22AA] A:0001 X:0280 Y:0000 P:envMxdizc - Load Monster Slot X's Physical Defense Base.
$03/E7B6 85 E1 STA $E1    [$00:00E1] A:0000 X:0280 Y:0000 P:envMxdiZc - Store A in E1.
$03/E7B8 20 E0 83 JSR $83E0  [$03:83E0] A:0000 X:0280 Y:0000 P:envMxdiZc - Jump to Subroutine (HP Dealing?)
$03/E7BB 38 SEC A:0000 X:0000 Y:0000 P:envMxdiZc - Set Carry Flag
$03/E7BC A5 C9 LDA $C9    [$00:00C9] A:0000 X:0000 Y:0000 P:envMxdiZC - Load A from C9. (Where Random Number +Attack Base seemed to be stored)
$03/E7BE E5 E3 SBC $E3    [$00:00E3] A:0031 X:0000 Y:0000 P:envMxdizC  - A from E3. (-Random Number +Attack Base from E3.)
$03/E7C0 85 C9 STA $C9    [$00:00C9] A:0031 X:0000 Y:0000 P:envMxdizC - Store A in C9.
$03/E7C2 A5 CA LDA $CA    [$00:00CA] A:0031 X:0000 Y:0000 P:envMxdizC - Load A from CA.
$03/E7C4 E5 E4 SBC $E4    [$00:00E4] A:0000 X:0000 Y:0000 P:envMxdiZC - A from E4.
$03/E7C6 85 CA STA $CA    [$00:00CA] A:0000 X:0000 Y:0000 P:envMxdiZC - Store A in CA.
$03/E7C8 B0 05 BCS $05    [$E7CF] A:0000 X:0000 Y:0000 P:envMxdiZC - ?Branch if 00 or less than.?
------------------------------------------------------------------------------------------------------------------------------------------------------

--------------------------------------------------------------------------------------------------------------------------------------------------
$03/E7CF A6 C9 LDX $C9    [$00:00C9] A:0000 X:0000 Y:0000 P:envMxdiZC - Load X from C9 (Random Number +Attack Base)
$03/E7D1 F0 F7 BEQ $F7    [$E7CA] A:0000 X:0031 Y:0000 P:envMxdizC - Loop if equal to ?00? to 03E7CA.
$03/E7D3 A5 C7 LDA $C7    [$00:00C7] A:0000 X:0031 Y:0000 P:envMxdizC - Load C7 into A. (5 static, it seems)
$03/E7D5 0A ASL A A:0005 X:0031 Y:0000 P:envMxdizC - x2 A.
$03/E7D6 AA TAX A:000A X:0031 Y:0000 P:envMxdizc - Transfer A to X.
$03/E7D7 A5 C9 LDA $C9    [$00:00C9] A:000A X:000A Y:0000 P:envMxdizc - Load A from C9 (Random Number +Attack Base)
$03/E7D9 9D D4 34 STA $34D4,x[$7E:34DE] A:0031 X:000A Y:0000 P:envMxdizc - Store A in Damage Slot X.
$03/E7DC A5 CA LDA $CA    [$00:00CA] A:0031 X:000A Y:0000 P:envMxdizc - Load A from CA (Second byte of damage, no doubt)
$03/E7DE 9D D5 34 STA $34D5,x[$7E:34DF] A:0000 X:000A Y:0000 P:envMxdiZc - Store A in in Damage Slot X Byte 2.
$03/E7E1 E6 C7 INC $C7    [$00:00C7] A:0000 X:000A Y:0000 P:envMxdiZc - +1 to C7.
$03/E7E3 A5 C7 LDA $C7    [$00:00C7] A:0000 X:000A Y:0000 P:envMxdizc Load C7 into A.
$03/E7E5 C5 C3 CMP $C3    [$00:00C3] A:0006 X:000A Y:0000 P:envMxdizc - Is it the same value that is in C3? (Number of Targets)
$03/E7E7 F0 03 BEQ $03    [$E7EC] A:0006 X:000A Y:0000 P:eNvMxdizc - if so branch to 03E7EC.
$03/E7E9 4C 5B E7 JMP $E75B  [$03:E75B] A:0006 X:000A Y:0000 P:eNvMxdizc  - Jump Back to 03E75B and recalculate everything for all targets.
------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E7EC 20 7E CA JSR $CA7E  [$03:CA7E] A:000D X:000C Y:0000 P:envMxdiZC - Jump to Subroutine (Damage Dealing Routine)
------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E7EF 60 RTS A:0000 X:0680 Y:001A P:envMxdiZC - Return

Now this is extremely informative!

Keep the addresses below in mind because this appears to be near universal....


C5 - Where Attack Base is Stored
DF - Where Attack Multiplier is Stored
E1 - Enemies Physical Defense Base.

What is even more curious is that it seems that the programmers may have planned a way for Kick's damage not to be decremented under some special circumstance. A value stored at C1 that if it does not read 00 (which it seems it Must because of the STZ at the start of the routine) it will branch past the Decrementing Routine. I thought at first it may be something special for Enemy Yang, but C1 in his portion of the routine never changes. Turns out that it is used by Dark Wave, which likely jumps into the Kick routine fairly early on and keeps on going with it. We'll know more when we get to the Dark Wave routine. I never noticed that Dark Wave dealt more damage than Kick, that is quite curious...

Now, some more targeting news, what we're looking at here is something that we've never really seen before and its the way the game puts damage into the individual slots. Kick and Dark Wave are stupidly special in that the normal Caster/Target damage is never used. It uses a different targeting system....

Because it does not look into the section of RAM that Yousei labeled Caster/Target and only looks at their basic battle slots, I will call it "User". Dark Wave/Kick both look at the User's stats. In that same respect there is no Target as there ordinarily is considered to be, but the enemy's stats are looked at directly. Now this was puzzling, until I came across this...

$03/E746   A2 05 00   LDX #$0005   A:0000   X:0013   Y:0000   P:envMxdiZC - Load 0005 into X. (Starting points of Targets -1)
$03/E749   86 C7   STX $C7    [$00:00C7]   A:0000   X:0005   Y:0000   P:envMxdizC - Store X in C7.
$03/E74B   A2 0D 00   LDX #$000D   A:0000   X:0005   Y:0000   P:envMxdizC - Load 0000D into X (Number of Targets)
$03/E74E   86 C3   STX $C3    [$00:00C3]   A:0000   X:000D   Y:0000   P:envMxdizC - Store X in C3.

When I first saw these I had just the normal instructions for what the system was doing and moved on without another thought until I saw this as well...


$03/E7D5   0A    ASL A   A:0005   X:0031   Y:0000   P:envMxdizC - x2 A.
$03/E7D6   AA    TAX   A:000A   X:0031   Y:0000   P:envMxdizc - Transfer A to X.
$03/E7D7   A5 C9   LDA $C9    [$00:00C9]   A:000A   X:000A   Y:0000   P:envMxdizc - Load A from C9 (Random Number +Attack Base)
$03/E7D9   9D D4 34   STA $34D4,x[$7E:34DE]   A:0031   X:000A   Y:0000   P:envMxdizc - Store A in Damage Slot X.
$03/E7DC   A5 CA   LDA $CA    [$00:00CA]   A:0031   X:000A   Y:0000   P:envMxdizc - Load A from CA (Second byte of damage, no doubt)
$03/E7DE   9D D5 34   STA $34D5,x[$7E:34DF]   A:0000   X:000A   Y:0000   P:envMxdiZc - Store A in in Damage Slot X Byte 2.
$03/E7E1   E6 C7   INC $C7    [$00:00C7]   A:0000   X:000A   Y:0000   P:envMxdiZc - +1 to C7.
$03/E7E3   A5 C7   LDA $C7    [$00:00C7]   A:0000   X:000A   Y:0000   P:envMxdizc Load C7 into A.
$03/E7E5   C5 C3   CMP $C3    [$00:00C3]   A:0006   X:000A   Y:0000   P:envMxdizc - Is it the same value that is in C3? (Number of Targets)
$03/E7E7   F0 03   BEQ $03    [$E7EC]   A:0006   X:000A   Y:0000   P:eNvMxdizc - if so branch to 03E7EC.
$03/E7E9   4C 5B E7   JMP $E75B  [$03:E75B]   A:0006   X:000A   Y:0000   P:eNvMxdizc  - Jump Back to 03E75B and recalculate everything for all targets.

Then it made sense, what I was looking at earlier was "range of targets" 05+1 places it just outside the range of Allies. 0D is the final amount of times it should add data into the data slots and the x2 portion was assuring that it was giving two bytes to each slot in terms of damage. I verified this by setting the 05 to 00 and watching as Kick hurt everything on the field. Now this is a bit difficult to deal with. While you can make Kick/Dark Wave only hit one enemy, you could only make it hit a Specific Enemy Placement on the field, and that would be a difficult thing to make use of.

As of now we do not know how stats are written in and out of 2780-2800, but without that we can't change these two routines to look at anything on a Target by Target basis.

Title: Re: Grimoire LD's Notes, Methods, and Hacks (All Spells Disassembly)
Post by: Grimoire LD on October 06, 2013, 09:29:12 PM
Next up is the Focus/Power/Boost routine. It should seem simple enough in practice.

Code: [Select]
$03/E7F0 EE 0A 39 INC $390A  [$7E:390A] A:0003 X:001A Y:0000 P:envMxdizc - +1 to 7E390A.
$03/E7F3 A9 1F LDA #$1F A:0003 X:001A Y:0000 P:envMxdizc - Load 1F into A.
$03/E7F5 8D 7B 39 STA $397B  [$7E:397B] A:001F X:001A Y:0000 P:envMxdizc - Store A in 7E397B.
$03/E7F8 A9 0C LDA #$0C A:001F X:001A Y:0000 P:envMxdizc - Load 0C into A.
$03/E7FA 85 D6 STA $D6    [$00:00D6] A:000C X:001A Y:0000 P:envMxdizc  - Store A in D6.
$03/E7FC A5 CD LDA $CD    [$00:00CD] A:000C X:001A Y:0000 P:envMxdizc - Load Character Identifier Into A.
$03/E7FE 20 36 9E JSR $9E36  [$03:9E36] A:0000 X:001A Y:0000 P:envMxdiZc - Jump to Subroutine (Likely something dealing with Timers and Speed.)
$03/E801 A9 03 LDA #$03 A:0000 X:0005 Y:0005 P:envMxdizc - Load 03 into A.
$03/E803 20 C8 85 JSR $85C8  [$03:85C8] A:0003 X:0005 Y:0005 P:envMxdizc - Jump to Subroutine (Difficult to Say)
$03/E806 A9 08 LDA #$08 A:0000 X:0003 Y:0005 P:envMxdiZc - Load 08 into A.
$03/E808 9D 06 2A STA $2A06,x[$7E:2A09] A:0008 X:0003 Y:0005 P:envMxdizc - Store A in 7E2A09.
$03/E80B A6 A6 LDX $A6    [$00:00A6] A:0008 X:0003 Y:0005 P:envMxdizc - Load X from A6 (Character Slot)
$03/E80D BD 05 20 LDA $2005,x[$7E:2005] A:0008 X:0000 Y:0005 P:envMxdiZc - Load Slot X's Status Byte 3.
$03/E810 09 08 ORA #$08 A:0000 X:0000 Y:0005 P:envMxdiZc - Add 08 if not already there (Charging)
$03/E812 9D 05 20 STA $2005,x[$7E:2005] A:0008 X:0000 Y:0005 P:envMxdizc - Store Charging in Slot X's Status Byte 3.
$03/E815 A9 1F LDA #$1F A:0008 X:0000 Y:0005 P:envMxdizc - Load 1F into A. (Action to take after the timer has expired.)
$03/E817 9D 51 20 STA $2051,x[$7E:2051] A:001F X:0000 Y:0005 P:envMxdizc - Store 1F in Slot X's Next Action to Take.
$03/E81A 20 A6 85 JSR $85A6  [$03:85A6] A:001F X:0000 Y:0005 P:envMxdizc - Jump to Subroutine (??)
$03/E81D A9 39 LDA #$39 A:0003 X:0000 Y:0005 P:envMxdizc - Load 39 into A (D)
$03/E81F 8D CA 34 STA $34CA  [$7E:34CA] A:0039 X:0000 Y:0005 P:envMxdizc - Store A in Battle Message Data.
$03/E822 60 RTS A:0039 X:0000 Y:0005 P:envMxdizc - Return

Only the basics of what you would expect are in here, but most interestingly is $03/E817   9D 51 20   STA $2051,x[$7E:2051]   A:001F   X:0000   Y:0005   P:envMxdizc - Store 1F in Slot X's Next Action to Take..

What this does is it would allow you to set the next action you take. what takes away the Charging Status is held in Command 1F. You could set it to a normal command of any sort (as long as it doesn't open a sub-menu) and you would effectively have a permanent Charge status, meaning you would deal double the damage, but you would also still be heavily afflicted by Charging's detriments.

The second part of Focus as you would imagine is the actual attack.

Focus (Command 1F) Routine -

Code: [Select]
$03/E823 20 99 C4 JSR $C499  [$03:C499] A:0003 X:003E Y:0000 P:envMxdizc - Jump to Subroutine (All of the Fight Routine)
$03/E826 A5 CD LDA $CD    [$00:00CD] A:0000 X:750E Y:0018 P:envMxdiZC - Load Character Identifier into A.
$03/E828 20 89 84 JSR $8489  [$03:8489] A:0000 X:750E Y:0018 P:envMxdiZC - Jump to Subroutine (Preparation?)
$03/E82B A6 A6 LDX $A6    [$00:00A6] A:0000 X:0000 Y:0018 P:envMxdiZc - Load Character Slot into X.
$03/E82D BD 05 20 LDA $2005,x[$7E:2005] A:0000 X:0000 Y:0018 P:envMxdiZc - Load Slot X's Status Byte 3 into A.
$03/E830 29 F7 AND #$F7 A:0008 X:0000 Y:0018 P:envMxdizc - -8, getting rid of Charging Status.
$03/E832 9D 05 20 STA $2005,x[$7E:2005] A:0000 X:0000 Y:0018 P:envMxdiZc - Store A in 7E2005.
$03/E835 60 RTS A:0000 X:0000 Y:0018 P:envMxdiZc - Return.

And that is it for Focus. Maybe with a bit more wit we could refocus the JSR to not look at Fight, but then where would an applicable place be?






Title: Re: Grimoire LD's Notes, Methods, and Hacks (All Spells Disassembly)
Post by: Grimoire LD on October 06, 2013, 10:33:25 PM
Next up is Aim another self-explanatory command.

Code: [Select]
$03/E836 AD 9C 26 LDA $269C  [$7E:269C] A:0003 X:0018 Y:0000 P:envMxdizc - Load Caster's Physical Attack Percent.
$03/E839 48 PHA A:0034 X:0018 Y:0000 P:envMxdizc - Push A.
$03/E83A AD 29 27 LDA $2729  [$7E:2729] A:0034 X:0018 Y:0000 P:envMxdizc - Load Enemies (Non-existent) Evasion.
$03/E83D 48 PHA A:0000 X:0018 Y:0000 P:envMxdiZc - Push A.
$03/E83E 7B TDC A:0000 X:0018 Y:0000 P:envMxdiZc - Transfer Direct Page (thereby making it 00)
$03/E83F 8D 29 27 STA $2729  [$7E:2729] A:0000 X:0018 Y:0000 P:envMxdiZc - Store 00 in Target's Evasion.
$03/E842 3A DEC A A:0000 X:0018 Y:0000 P:envMxdiZc -1 to A.
$03/E843 8D 9C 26 STA $269C  [$7E:269C] A:00FF X:0018 Y:0000 P:eNvMxdizc - Store A  (FF - 255%) into Physical Attack Percent.
$03/E846 20 99 C4 JSR $C499  [$03:C499] A:00FF X:0018 Y:0000 P:eNvMxdizc - Jump to Subroutine (Full Fight Routine)
$03/E849 68 PLA A:0000 X:750E Y:0018 P:envMxdiZC - Pull A.
$03/E84A 8D 29 27 STA $2729  [$7E:2729] A:0000 X:750E Y:0018 P:envMxdiZC - Store A in Target's Evasion.
$03/E84D 68 PLA A:0000 X:750E Y:0018 P:envMxdiZC - Pull A.
$03/E84E 8D 9C 26 STA $269C  [$7E:269C] A:0034 X:750E Y:0018 P:envMxdizC - Store A in Caster's Accuracy.
$03/E851 60 RTS A:0034 X:750E Y:0018 P:envMxdizC - Return

It seems like only yesterday that I was flummoxed about how to make Aim into a less absolute command. At the time I knew very little and thought it was hopeless, but now I see what Square meant to do and because of what we have a bit freer space. Evasion would only ever effect battles against Valvalis/Barbariccia in the normal game. Therefore I think we could take those Evasion references and make them into something else.

I decided for this experiment to make the Accuracy of the currently equipped Bow to become the new Critical Hit Chance and x2 Accuracy.


$03/E836   AD 9C 26   LDA $269C  [$7E:269C]   A:0003   X:0018   Y:0000   P:envMxdizc - Load Caster's Accuracy.
$03/E839   48    PHA   A:0034   X:0018   Y:0000   P:envMxdizc - Push it onto the Stack in A.
$03/E83A   AE AD 26   LDX $26AD  [$7E:26AD]   A:0034   X:0018   Y:0000   P:envMxdizc - Load Caster's Critical Hit chance.
$03/E83D   DA    PHX   A:0034   X:2306   Y:0000   P:envMxdizc - Push it onto the Stack in X.
$03/E83E   0A    ASL A   A:0034   X:2306   Y:0000   P:envMxdizc - x2 A (Caster's Accuracy)
$03/E83F   8D 9C 26   STA $269C  [$7E:269C]   A:0068   X:2306   Y:0000   P:envMxdizc - Store A in current accuracy.
$03/E842   4A    LSR A   A:0068   X:2306   Y:0000   P:envMxdizc - /2 A (Caster's Accuracy)
$03/E843   8D AD 26   STA $26AD  [$7E:26AD]   A:0034   X:2306   Y:0000   P:envMxdizc - Store in Critical Hit Chance.
$03/E846   20 99 C4   JSR $C499  [$03:C499]   A:0034   X:2306   Y:0000   P:envMxdizc - Jump to Fighting Subroutine.
$03/E849   FA    PLX   A:0000   X:750E   Y:0018   P:envMxdiZC - Pull X from Stack. (To restore original values)
$03/E84A   8E AD 26   STX $26AD  [$7E:26AD]   A:0000   X:2306   Y:0018   P:envMxdizC - Store X in Critical Hit Chance.
$03/E84D   68    PLA   A:0000   X:2306   Y:0018   P:envMxdizC - Pull A from Stack. (To restore original values)
$03/E84E   8D 9C 26   STA $269C  [$7E:269C]   A:0034   X:2306   Y:0018   P:envMxdizC - Store A in Accuracy.
$03/E851   60    RTS   A:0034   X:2306   Y:0018   P:envMxdizC - Return.


It took a little bit of time to figure it out, to make all of this work but it is tried and tested and works flawlessly. It gives Aim that extra push it needs to stack up against the better Commands and it only gets better as the game goes on, with the last bow the player will likely get topping out at 60% Critical Hit Chance for each attack whenever they use Aim with the Samurai Bow. Perhaps its a bit broken, but I was working with a bit of limited space after all, hehe.

 :edit: January 5th 2014 - 2 New Aim Replacements!

Wow... Barrage (FFIII DS, FFT:War of the Lions) was a Stupidly easy thing to program in the end... at least in a basic form...

Because of space limitations I decided to call it (Arrow Symbol)Strm (Arrow Storm) after a tactic common to the Romance of the Three Kingdoms series.

Code: [Select]
$03/E836 20 99 C4 JSR $C499  [$03:C499] A:0003 X:0018 Y:0000 P:envMxdizc - Fight Routine x4
$03/E839 20 99 C4 JSR $C499  [$03:C499] A:0000 X:750E Y:0018 P:envMxdiZC
$03/E83C 20 99 C4 JSR $C499  [$03:C499] A:0000 X:750E Y:0018 P:envMxdiZC
$03/E83F 20 99 C4 JSR $C499  [$03:C499] A:0000 X:750E Y:0018 P:envMxdiZC
$03/E842 60 RTS A:0000 X:750E Y:0018 P:envMxdiZC - Return
Yes, four normal attacks. I honestly thought this was going to cause an overflow problem with the arrows, but to my amazement the game Properly decrements them without overflowing. (And if used with less than 3 Arrows you will no longer have any arrows) And as you'd expect it deals x4 Damage (though without my Infinite Arrow-Glitch fix it still has that problem as you'd expect.)


Now, these all add up properly, but there's still two pieces I'm missing. This first is how to divide the damage by 2. I may need to look back at the original Aim Command for guidance... Specifically at...

$03/E836   AD 9C 26   LDA $269C  [$7E:269C]   A:0003   X:0018   Y:0000   P:envMxdizc - Load Caster's Physical Attack Percent.
$03/E839   48    PHA   A:0034   X:0018   Y:0000   P:envMxdizc - Push A.

That seems like a fine start to a recipe actually.

Well... I learned something through this experience... Never Ever Forget to Retrieve Your Pushed Values!!

For roughly an hour I was looking at my preliminary code, wondering what I was doing wrong, when it finally dawned on me that because I was testing the pure functionality I never retrieved the Pushed value back and this causes a system crash.

So I now have Arrowstorm working like Barrage from FFT:War of the Lions! 4 half-damage attack that takes 4 Ammo for roughly 2x damage (but it attacks four times so even more chance of a status infliction if applicable)

Arrowstorm

Code: [Select]
$03/E836 AD 9D 26 LDA $269D  [$7E:269D] A:0003 X:0018 Y:0000 P:envMxdizc - Load Caster's Physical Attack Base.
$03/E839 48 PHA A:0053 X:0018 Y:0000 P:envMxdizc - Push A onto Stack.
$03/E83A 4A LSR A A:0053 X:0018 Y:0000 P:envMxdizc - Divide Physical Attack Base by 2.
$03/E83B 8D 9D 26 STA $269D  [$7E:269D] A:0029 X:0018 Y:0000 P:envMxdizC - Store A in Physical Attack Base.
$03/E83E 20 99 C4 JSR $C499  [$03:C499] A:0029 X:0018 Y:0000 P:envMxdizC - Fight Routine x 4
$03/E841 20 99 C4 JSR $C499  [$03:C499] A:0000 X:750E Y:0018 P:envMxdiZC
$03/E844 20 99 C4 JSR $C499  [$03:C499] A:0000 X:750E Y:0018 P:envMxdiZC
$03/E847 20 99 C4 JSR $C499  [$03:C499] A:0000 X:750E Y:0018 P:envMxdiZC
$03/E84A 68 PLA A:0000 X:750E Y:0018 P:envMxdiZC - Pull A
$03/E84B 8D 9D 26 STA $269D  [$7E:269D] A:0053 X:750E Y:0018 P:envMxdizC - Store A in Physical Attack Base (original value)
$03/E84E 60 RTS A:0053 X:750E Y:0018 P:envMxdizC - Return


Now, FFIII's Barrage is a little trickier to get down...

The way that works is each shot deals full damage +another 10-40% depending on the Job Level. To mimic this, (as well as I can...) I would instead make it look at Strength. At
0-39 Str. There would be no bonus. 40-60 1/8 Bonus in Damage, 60-99 1/4 Bonus in damage. It might encourage people to use Rosa in a Strength set-up rather than always going for the Will set-up possibly. But this seems like it will take a bit more space than Aim actually supports. So I'll have to hold off on that for now.

Though I suppose I could make a variant... (looks back at how he programmed Aura originally...) Yes. Instead make it so that Two Attacks will occur automatically. And if you have over 45 Strength a third one happens and at over 60 strength a fourth one occurs.

Barrage (Arrowstorm) FFIII "Style" (Sort of)

Code: [Select]
$03/E836 20 99 C4 JSR $C499  [$03:C499] A:0003 X:0018 Y:0000 P:envMxdizc - Fight Routine
$03/E839 20 99 C4 JSR $C499  [$03:C499] A:0000 X:750E Y:0018 P:envMxdiZC - Fight Routine
$03/E83C AD 94 26 LDA $2694  [$7E:2694] A:0000 X:750E Y:0018 P:envMxdiZC - Load Modified Strength
$03/E83F C9 2D CMP #$2D A:005D X:750E Y:0018 P:envMxdizC - Is it 45 or Higher?
$03/E841 90 0E BCC $0E    [$E851] A:005D X:750E Y:0018 P:envMxdizC - If lower branch to 03E851
$03/E843 20 99 C4 JSR $C499  [$03:C499] A:005D X:750E Y:0018 P:envMxdizC - Fight Routine
$03/E846 AD 94 26 LDA $2694  [$7E:2694] A:0000 X:750E Y:0018 P:envMxdiZC - Load Modified Strength
$03/E849 C9 3C CMP #$3C A:005D X:750E Y:0018 P:envMxdizC - Is it 60 or Higher?
$03/E84B 90 04 BCC $04    [$E851] A:005D X:750E Y:0018 P:envMxdizC - If lower branch to 03E851
$03/E84D 20 99 C4 JSR $C499  [$03:C499] A:005D X:750E Y:0018 P:envMxdizC - Fight Routine
$03/E850 60 RTS A:0000 X:750E Y:0018 P:envMxdiZC - Return

Geez, I must really love the Aim Command, I've now made three variants for it!
Title: Re: Grimoire LD's Notes, Methods, and Hacks (All Spells Disassembly)
Post by: Grimoire LD on October 06, 2013, 11:49:36 PM
Next up is Pray, just like with Gird, I don't expect to find many surprises and it is a fairly short command by all accounts.

Pray Routine -

Code: [Select]
$03/E852 20 93 85 JSR $8593  [$03:8593] A:0003 X:0016 Y:0000 P:envMxdizc - Jump to Subroutine (Generate Random Number)
$03/E855 C9 80 CMP #$80 A:00EA X:00CE Y:0000 P:eNvMxdizC - Is it 80?
$03/E857 90 0A BCC $0A    [$E863] A:00EA X:00CE Y:0000 P:envMxdizC - If more than 80 branch to 03E863.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E859 20 A6 85 JSR $85A6  [$03:85A6] A:00EA X:00CE Y:0000 P:envMxdizC - Jump to Subroutine (??)
$03/E85C A9 10 LDA #$10 A:0003 X:00CE Y:0000 P:envMxdizC - Load 10 into A (D) (Failed Prayer)
$03/E85E 8D CA 34 STA $34CA  [$7E:34CA] A:0010 X:00CE Y:0000 P:envMxdizC - Store A in Battle Message Data.
$03/E861 80 08 BRA $08    [$E86B] A:0010 X:00CE Y:0000 P:envMxdizC - Branch Always to 03E86B
--------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E863 A9 0E LDA #$0E A:001C X:0083 Y:0000 P:eNvMxdizc - Load Cure into A.
$03/E865 8D D2 26 STA $26D2  [$7E:26D2] A:000E X:0083 Y:0000 P:envMxdizc - Store A in Next Action to take.
$03/E868 20 3E CD JSR $CD3E  [$03:CD3E] A:000E X:0083 Y:0000 P:envMxdizc - Jump to Subroutine (Magic Call)
-------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E86B A9 0B LDA #$0B A:0010 X:00CE Y:0000 P:envMxdizC - Load 0B into A.
$03/E86D 8D C8 34 STA $34C8  [$7E:34C8] A:000B X:00CE Y:0000 P:envMxdizC - Store A in 7E34C8.
$03/E870 A9 10 LDA #$10 A:000B X:00CE Y:0000 P:envMxdizC - Load 10 into A.
$03/E872 8D C7 34 STA $34C7  [$7E:34C7] A:0010 X:00CE Y:0000 P:envMxdizC - Store A in 7E34C7.
$03/E875 60 RTS A:0010 X:00CE Y:0000 P:envMxdizC -Return

Quite short and quite simple. It's becoming alarmingly clear. It seems all you need to do to get a command to use a Spell is...


$03/E863   A9 0E   LDA #$0E   A:001C   X:0083   Y:0000   P:eNvMxdizc - Load Spell into A.
$03/E865   8D D2 26   STA $26D2  [$7E:26D2]   A:000E   X:0083   Y:0000   P:envMxdizc - Store A in Next Action to take.
$03/E868   20 3E CD   JSR $CD3E  [$03:CD3E]   A:000E   X:0083   Y:0000   P:envMxdizc - Jump to Subroutine (Magic Call)

And that's it. Gird and Pray tell the same story in this regard. Making the "break the game" Command into an Actual skill for Cid (by using the saved bytes from their copied Peep info) is becoming more and more like a simple reality.

Next is Hide, let's see what that can tell us...

Code: [Select]
$03/E876 A6 A6 LDX $A6    [$00:00A6] A:0003 X:0012 Y:0000 P:envMxdizc - Load Character Slot into A.
$03/E878 BD 06 20 LDA $2006,x[$7E:2006] A:0003 X:0000 Y:0000 P:envMxdiZc - Load Slot X's Status Byte 4.
$03/E87B 09 80 ORA #$80 A:0000 X:0000 Y:0000 P:envMxdiZc - Add 80.
$03/E87D 9D 06 20 STA $2006,x[$7E:2006] A:0080 X:0000 Y:0000 P:eNvMxdizc - Store A in Slot X's Status Byte 4.
$03/E880 AE 34 35 LDX $3534  [$7E:3534] A:0080 X:0000 Y:0000 P:eNvMxdizc - Load X from 7E3534.
$03/E883 64 A9 STZ $A9    [$00:00A9] A:0080 X:0000 Y:0000 P:envMxdiZc - Store Zero in A9.
----------------------------------------------------(Looping Point)------------------------------------------------------------------------
$03/E885 BD 03 33 LDA $3303,x[$7E:3303] A:0080 X:0000 Y:0000 P:envMxdiZc - Load A from 7E3303.
$03/E888 C9 09 CMP #$09 A:0000 X:0000 Y:0000 P:envMxdiZc - Is it 09? (Hide)
$03/E88A D0 07 BNE $07    [$E893] A:0000 X:0000 Y:0000 P:eNvMxdizc - If not, branch to 03E893.
-------------------------------------------------------------------------------------------------------------------------------------------
$03/E88C A9 1C LDA #$1C A:0009 X:0010 Y:0000 P:envMxdiZC - Load 1C into A. (Show)
$03/E88E 9D 03 33 STA $3303,x[$7E:3313] A:001C X:0010 Y:0000 P:envMxdizC - Store A in 7E3313. (Location of Command to Replace.)
$03/E891 80 08 BRA $08    [$E89B] A:001C X:0010 Y:0000 P:envMxdizC - Branch to 08.
--------------------------------------------------------------------------------------------------------------------------------------------
$03/E893 BD 02 33 LDA $3302,x[$7E:3302] A:0000 X:0000 Y:0000 P:eNvMxdizc - Load A from 7E3302
$03/E896 09 80 ORA #$80 A:0050 X:0000 Y:0000 P:envMxdizc - Add 80 into A. (Makes it so no other command is selectable but Show)
$03/E898 9D 02 33 STA $3302,x[$7E:3302] A:00D0 X:0000 Y:0000 P:eNvMxdizc - Store A in 7E3302.
$03/E89B E8 INX A:00D0 X:0000 Y:0000 P:eNvMxdizc - +1 to X
$03/E89C E8 INX A:00D0 X:0001 Y:0000 P:envMxdizc +1 to X
$03/E89D E8 INX A:00D0 X:0002 Y:0000 P:envMxdizc +1 to X
$03/E89E E8 INX A:00D0 X:0003 Y:0000 P:envMxdizc +1 to X.
$03/E89F E6 A9 INC $A9    [$00:00A9] A:00D0 X:0004 Y:0000 P:envMxdizc - +1 to A9.
$03/E8A1 A5 A9 LDA $A9    [$00:00A9] A:00D0 X:0004 Y:0000 P:envMxdizc - Load A9 into A.
$03/E8A3 C9 05 CMP #$05 A:0001 X:0004 Y:0000 P:envMxdizc - Is it 05?
$03/E8A5 D0 DE BNE $DE    [$E885] A:0001 X:0004 Y:0000 P:eNvMxdizc - If not, loop back to 03E885.
$03/E8A7 A5 CD LDA $CD    [$00:00CD] A:0005 X:0014 Y:0000 P:envMxdiZC - Load Character ID into A.
$03/E8A9 85 00 STA $00    [$00:0000] A:0000 X:0014 Y:0000 P:envMxdiZC - Store A in 00.
$03/E8AB A9 09 LDA #$09 A:0000 X:0014 Y:0000 P:envMxdiZC - Load 09 into A.
$03/E8AD 20 85 80 JSR $8085  [$03:8085] A:0009 X:0014 Y:0000 P:envMxdizC - Jump to Subroutine (Lots of jumping)
$03/E8B0 A9 09 LDA #$09 A:0005 X:7504 Y:000A P:envMxdiZC - Load 09 into A.
$03/E8B2 8D C8 34 STA $34C8  [$7E:34C8] A:0009 X:7504 Y:000A P:envMxdizC - Store A in 7E34C8.
$03/E8B5 A9 10 LDA #$10 A:0009 X:7504 Y:000A P:envMxdizC - Load 10 into A.
$03/E8B7 8D C7 34 STA $34C7  [$7E:34C7] A:0010 X:7504 Y:000A P:envMxdizC - Store A in 7E34C7.
$03/E8BA 60 RTS A:0010 X:7504 Y:000A P:envMxdizC - Return

Now this is the first command that I've actively noticed this (and is likely true to Cover and Off as well) but the forced changing of the command is purely dealt with by using the Hide command. Now this has very interesting possibilities... Due to the way the game works, changing Commands that are on a character with the normal tools available to do so are only done normally through Different References of the same character outside of battle and Commands in-battle. What this seems to show is that we can change commands with a little bit of custom code at any time we please. Say we make an item that utilizes Dispel's formula space that gives a character a new skill. For instance, giving Paladin Cecil back Dark Wave through a custom event that rewards a special item that could only be used by Cecil (Proof of Concept in Crystal) which would move Item to Slot 5 and add Dark Wave to Slot 4.

Next up is Show.

Code: [Select]

$03/E8BB A6 A6 LDX $A6    [$00:00A6] A:0003 X:0038 Y:0000 P:envMxdizc - Load Slot X into A.
$03/E8BD BD 06 20 LDA $2006,x[$7E:2006] A:0003 X:0000 Y:0000 P:envMxdiZc - Load Slot X's Status Byte 4.
$03/E8C0 29 7F AND #$7F A:0080 X:0000 Y:0000 P:eNvMxdizc - Add 7F to it.
$03/E8C2 9D 06 20 STA $2006,x[$7E:2006] A:0000 X:0000 Y:0000 P:envMxdiZc - Store A Slot X's Status Byte 4.
$03/E8C5 AE 34 35 LDX $3534  [$7E:3534] A:0000 X:0000 Y:0000 P:envMxdiZc - Load X from 7E3534.
-----------------------------------------------(Looping Point)-------------------------------------------------------------------------------
$03/E8C8 64 A9 STZ $A9    [$00:00A9] A:0000 X:0000 Y:0000 P:envMxdiZc - Store Zero in A9.
$03/E8CA BD 03 33 LDA $3303,x[$7E:3303] A:0000 X:0000 Y:0000 P:envMxdiZc - Load Command Data into A.
$03/E8CD C9 1C CMP #$1C A:0000 X:0000 Y:0000 P:envMxdiZc - Is it Show?
$03/E8CF D0 07 BNE $07    [$E8D8] A:0000 X:0000 Y:0000 P:eNvMxdizc - If not, branch to 03E8D8.
--------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E8D1 A9 09 LDA #$09 A:001C X:0010 Y:0000 P:envMxdiZC - Load Sing into A.
$03/E8D3 9D 03 33 STA $3303,x[$7E:3313] A:0009 X:0010 Y:0000 P:envMxdizC - Store Sing to its original position.
$03/E8D6 80 08 BRA $08    [$E8E0] A:0009 X:0010 Y:0000 P:envMxdizC - Branch to 03E8E0.
---------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E8D8 BD 02 33 LDA $3302,x[$7E:3302] A:0000 X:0000 Y:0000 P:eNvMxdizc - Load State of Commands (Usable/Not)
$03/E8DB 29 7F AND #$7F A:00D0 X:0000 Y:0000 P:eNvMxdizc - Add 7F (to counter 80) (Restores Commands)
$03/E8DD 9D 02 33 STA $3302,x[$7E:3302] A:0050 X:0000 Y:0000 P:envMxdizc - Store A in 7E3302.
$03/E8E0 E8 INX A:0050 X:0000 Y:0000 P:envMxdizc +1 to X.
$03/E8E1 E8 INX A:0050 X:0001 Y:0000 P:envMxdizc +1 to X.
$03/E8E2 E8 INX A:0050 X:0002 Y:0000 P:envMxdizc +1 to X.
$03/E8E3 E8 INX A:0050 X:0003 Y:0000 P:envMxdizc +1 to X.
$03/E8E4 E6 A9 INC $A9    [$00:00A9] A:0050 X:0004 Y:0000 P:envMxdizc - +1 to A9.
$03/E8E6 A5 A9 LDA $A9    [$00:00A9] A:0050 X:0004 Y:0000 P:envMxdizc - Load A9 into A
$03/E8E8 C9 05 CMP #$05 A:0001 X:0004 Y:0000 P:envMxdizc - Has it checked all 5 commands?
$03/E8EA D0 DE BNE $DE    [$E8CA] A:0001 X:0004 Y:0000 P:eNvMxdizc - If not, loop to 03E8CA.
$03/E8EC A5 CD LDA $CD    [$00:00CD] A:0005 X:0014 Y:0000 P:envMxdiZC - Load Character ID into A.
$03/E8EE 85 00 STA $00    [$00:0000] A:0000 X:0014 Y:0000 P:envMxdiZC - Store A in 00.
$03/E8F0 A9 09 LDA #$09 A:0000 X:0014 Y:0000 P:envMxdiZC - Load 09 into A.
$03/E8F2 20 85 80 JSR $8085  [$03:8085] A:0009 X:0014 Y:0000 P:envMxdizC - Jump to Subroutine (Lots of Jumping)
$03/E8F5 A9 1C LDA #$1C A:0005 X:7504 Y:000A P:envMxdiZC - Load Command Name into A.
$03/E8F7 8D C8 34 STA $34C8  [$7E:34C8] A:001C X:7504 Y:000A P:envMxdizC - Store A in Small Message Data.
$03/E8FA A9 10 LDA #$10 A:001C X:7504 Y:000A P:envMxdizC - Load 10 into A.
$03/E8FC 8D C7 34 STA $34C7  [$7E:34C7] A:0010 X:7504 Y:000A P:envMxdizC - Store A in 7E34C7.
$03/E8FF 60 RTS A:0010 X:7504 Y:000A P:envMxdizC - Return.

Some interesting information gleaned from this. Something that is not seen in other commands and wholly unique to Hide is the inability to use any Command but Show afterwards. What is clear now is that the reference to 3302 (first byte of commands) is that it governs whether it can or can't be used. You can use no Commands under hide because the only exception made in it is for Show. All the others had have 80 added to their base value.


Title: Re: Grimoire LD's Notes, Methods, and Hacks (All Spells Disassembly)
Post by: Grimoire LD on October 07, 2013, 12:24:24 AM
Let's finish this batch of information up with Sing. I don't expect to find much here, likely the percentage chance of each Song to occur and perhaps even find Frog Song.


Code: [Select]
$03/E900 AD 83 26 LDA $2683  [$7E:2683] A:0003 X:0010 Y:0000 P:envMxdizc - Load Caster's Status Byte 1.
$03/E903 29 20 AND #$20 A:0000 X:0010 Y:0000 P:envMxdiZc - Is it Frog?
$03/E905 F0 09 BEQ $09    [$E910] A:0000 X:0010 Y:0000 P:envMxdiZc -If not, branch to 03E910.
------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E907 A9 0B LDA #$0B A:0020 X:0010 Y:0000 P:envMxdizc - Load 0B into A (Song of Toad)
$03/E909 8D CA 34 STA $34CA  [$7E:34CA] A:000B X:0010 Y:0000 P:envMxdizc - Store A in Battle Message Data.
$03/E90C A9 19 LDA #$19 A:000B X:0010 Y:0000 P:envMxdizc - Load Toad into A.
$03/E90E 80 31 BRA $31    [$E941] A:0019 X:0010 Y:0000 P:envMxdizc - Branch always to 03E941.
------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E910 20 93 85 JSR $8593  [$03:8593] A:0000 X:0010 Y:0000 P:envMxdiZc - Jump to Subroutine (Generate Random Number.)
$03/E913 C9 C0 CMP #$C0 A:005C X:00BD Y:0000 P:envMxdizC - Is it C0?
$03/E915 90 09 BCC $09    [$E920] A:005C X:00BD Y:0000 P:eNvMxdizc - If it is less than C0 branch to 03E920.
-------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E924 A9 0E LDA #$0E A:0095 X:0052 Y:0000 P:envMxdizC - Load 0E into A (Song of Mute)
$03/E926 8D CA 34 STA $34CA  [$7E:34CA] A:000E X:0052 Y:0000 P:envMxdizC - Store A in Battle Message Data.
$03/E929 A9 02 LDA #$02 A:000E X:0052 Y:0000 P:envMxdizC - Load 02 into A (Mute)
$03/E92B 80 14 BRA $14    [$E941] A:0002 X:0052 Y:0000 P:envMxdizC - Branch to 03E941.
-------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E920 C9 80 CMP #$80 A:005C X:00BD Y:0000 P:eNvMxdizc - Is it 80?
$03/E922 90 09 BCC $09    [$E92D] A:005C X:00BD Y:0000 P:eNvMxdizc - If it less than 80 branch to 03E92D.
-------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E917 A9 00 LDA #$00 A:00C0 X:0054 Y:0000 P:envMxdiZC - Load 00 into A (Nothing Happened.)
$03/E919 8D CA 34 STA $34CA  [$7E:34CA] A:0000 X:0054 Y:0000 P:envMxdiZC - Store A in Battle Message Data.
$03/E91C A9 00 LDA #$00 A:0000 X:0054 Y:0000 P:envMxdiZC - Load 00 (Nothing) into A.
$03/E91E 80 21 BRA $21    [$E941] A:0000 X:0054 Y:0000 P:envMxdiZC - Branch to 03E941.
----------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E92D C9 40 CMP #$40 A:005C X:00BD Y:0000 P:eNvMxdizc - Is it 40?
$03/E92F 90 09 BCC $09    [$E93A] A:005C X:00BD Y:0000 P:envMxdizC - If it is less than 40 branch to 03E93A
--------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E931 A9 0D LDA #$0D A:005C X:00BD Y:0000 P:envMxdizC - Load 0D (Song of Charm) into A.
$03/E933 8D CA 34 STA $34CA  [$7E:34CA] A:000D X:00BD Y:0000 P:envMxdizC - Store A in Battle Message Data.
$03/E936 A9 03 LDA #$03 A:000D X:00BD Y:0000 P:envMxdizC - Load 03 into A. (Charm)
$03/E938 80 07 BRA $07    [$E941] A:0003 X:00BD Y:0000 P:envMxdizC - Branch to 03E941.
------------------------------------------------------------------------------------------------------------------------------------
$03/E93A A9 0C LDA #$0C A:0030 X:0054 Y:0000 P:eNvMxdizc - Load 0C into A. (Lullaby)
$03/E93C 8D CA 34 STA $34CA  [$7E:34CA] A:000C X:0054 Y:0000 P:envMxdizc - Load A into Battle Message Data.
$03/E93F A9 29 LDA #$29 A:000C X:0054 Y:0000 P:envMxdizc - Load 29 into A (Sleep)
$03/E941 8D D2 26 STA $26D2  [$7E:26D2] A:0029 X:0054 Y:0000 P:envMxdizc - Store A in Caster's Next Action to Take.
$03/E944 20 3E CD JSR $CD3E  [$03:CD3E] A:0029 X:0054 Y:0000 P:envMxdizc - Jump to Subroutine (Magic Call)
---------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E947 A9 08 LDA #$08 A:0010 X:0680 Y:001A P:envMxdizC - Load 08 (Sing) into A.
$03/E949 8D C8 34 STA $34C8  [$7E:34C8] A:0008 X:0680 Y:001A P:envMxdizC - Store A in Mini-Battle Message Data.
$03/E94C A9 10 LDA #$10 A:0008 X:0680 Y:001A P:envMxdizC - Load 10 into A.
$03/E94E 8D C7 34 STA $34C7  [$7E:34C7] A:0010 X:0680 Y:001A P:envMxdizC - Store A in 7E34C7.
$03/E951 4C B1 85 JMP $85B1  [$03:85B1] A:0010 X:0680 Y:001A P:envMxdizC - Jump to 0385B1. (May possibly tell the game to use a default targetting as labeled by command?)


Indeed, now this is a Command! Four random options, one easily located reasoning for how things work as they do, and a bonus of Status specialty. Which one can easily change and make look for anything they desire to make it play the special circumstance song. And plainly listed above are the chances for each song to change if they would like.

But that will do it for tonight, only a couple standard Commands left to go!

Title: Re: Grimoire LD's Notes, Methods, and Hacks (All Spells Disassembly)
Post by: Grimoire LD on October 07, 2013, 08:59:48 AM
Jump is the next object of interest I don't expect to see much different from the other "apply status to self" commands, but we'll see.

Jump Routine

Code: [Select]
$03/E954 A5 CD LDA $CD    [$00:00CD] A:0003 X:000C Y:0000 P:envMxdizc - Load Character Identifier into A.
$03/E956 30 11 BMI $11    [$E969] A:0000 X:000C Y:0000 P:envMxdiZc - Branch if Minus (If it is Enemy Kain) to 03E969.
$03/E958 A5 CE LDA $CE    [$00:00CE] A:0000 X:000C Y:0000 P:envMxdiZc - Load CE into A (Must be target's ID!)
$03/E95A 30 0D BMI $0D    [$E969] A:0083 X:000C Y:0000 P:eNvMxdizc - Branch if Minus (If Jumping on Enemy, not Ally) to 03E969.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E95C A9 D3 LDA #$D3 A:0003 X:000C Y:0000 P:envMxdizc - Load D3 into A.
$03/E95E 8D C4 33 STA $33C4  [$7E:33C4] A:00D3 X:000C Y:0000 P:eNvMxdizc - Store D3 into 7E33C4.
$03/E961 A9 00 LDA #$00 A:00D3 X:000C Y:0000 P:eNvMxdizc - Load 00 into A (Nothing Happened)
$03/E963 8D CA 34 STA $34CA  [$7E:34CA] A:0000 X:000C Y:0000 P:envMxdiZc - Store A in Battle Message Data.
$03/E966 4C A6 85 JMP $85A6  [$03:85A6] A:0000 X:000C Y:0000 P:envMxdiZc - Jump to Routine (Leaves Routine from here)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E969 EE 0A 39 INC $390A  [$7E:390A] A:0083 X:000C Y:0000 P:eNvMxdizc - +1 to 7E390A
$03/E96C A2 04 00 LDX #$0004 A:0083 X:000C Y:0000 P:envMxdizc - Load 04 into X.
$03/E96F 86 D4 STX $D4    [$00:00D4] A:0083 X:0004 Y:0000 P:envMxdizc - Store X in D4.
$03/E971 A9 03 LDA #$03 A:0083 X:0004 Y:0000 P:envMxdizc - Load 03 into A.
$03/E973 20 C8 85 JSR $85C8  [$03:85C8] A:0003 X:0004 Y:0000 P:envMxdizc - Jump to Subroutine (Difficult to say)
$03/E976 A9 08 LDA #$08 A:0000 X:0003 Y:0000 P:envMxdiZc - Load 08 into A.
$03/E978 9D 06 2A STA $2A06,x[$7E:2A09] A:0008 X:0003 Y:0000 P:envMxdizc - Store A in 7EA06 +3
$03/E97B A6 A6 LDX $A6    [$00:00A6] A:0008 X:0003 Y:0000 P:envMxdizc - Load Active Character Slot into X.
$03/E97D BD 05 20 LDA $2005,x[$7E:2005] A:0008 X:0000 Y:0000 P:envMxdiZc - Load User's Status Byte 3.
$03/E980 09 02 ORA #$02 A:0000 X:0000 Y:0000 P:envMxdiZc - Add 02 to it (Jumping)
$03/E982 9D 05 20 STA $2005,x[$7E:2005] A:0002 X:0000 Y:0000 P:envMxdizc -Store A in User's Status Byte 3.
$03/E985 A5 CD LDA $CD    [$00:00CD] A:0002 X:0000 Y:0000 P:envMxdizc - Load Character Identifier into A.
$03/E987 10 04 BPL $04    [$E98D] A:0000 X:0000 Y:0000 P:envMxdiZc - Branch if Plus (Not Enemy Kain)
----------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E989 A9 DE LDA #$DE A:0080 X:0280 Y:0000 P:eNvMxdizc - Load DE into A. (Command DE...? Wha?)
$03/E98B 80 02 BRA $02    [$E98F] A:00DE X:0280 Y:0000 P:eNvMxdizc - Branch to 03E98F
---------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E98D A9 1E LDA #$1E A:0000 X:0000 Y:0000 P:envMxdiZc - Load 1E into A.
$03/E98F 9D 51 20 STA $2051,x[$7E:2051] A:001E X:0000 Y:0000 P:envMxdizc - Store A in User's Next Command to Take
$03/E992 A5 CD LDA $CD    [$00:00CD] A:001E X:0000 Y:0000 P:envMxdizc - Load Character Identifier into A.
$03/E994 0A ASL A A:0000 X:0000 Y:0000 P:envMxdiZc - x2 to A.
$03/E995 AA TAX A:0000 X:0000 Y:0000 P:envMxdiZc - Transfer A to X.
$03/E996 BD EA 29 LDA $29EA,x[$7E:29EA] A:0000 X:0000 Y:0000 P:envMxdiZc - Load A in 7E29EA.
$03/E999 8D 7F 35 STA $357F  [$7E:357F] A:0000 X:0000 Y:0000 P:envMxdiZc - Store A in 7E357F.
$03/E99C A9 40 LDA #$40 A:0000 X:0000 Y:0000 P:envMxdiZc - Load 40 into A.
$03/E99E 9D EA 29 STA $29EA,x[$7E:29EA] A:0040 X:0000 Y:0000 P:envMxdizc - Store A in 7E29EA.
$03/E9A1 60 RTS A:0040 X:0000 Y:0000 P:envMxdizc - Return

Other than the strange part at the end, everything seems to be self-explanatory. Except for Enemy Kain having such a high Command that he branches to specifically. It's rather strange, considering it seems to functionally lead to the exact same place as 1E.





Next is 1E, "coming back down" basically Routine.

Jump (Actual Attack) Routine -

Code: [Select]
$03/E9A2 20 99 C4 JSR $C499  [$03:C499] A:0003 X:003C Y:0000 P:envMxdizc - Jump to Subroutine (Fight Routine)
$03/E9A5 A5 CD LDA $CD    [$00:00CD] A:0000 X:0680 Y:001A P:envMxdiZC - Load Character ID into A.
$03/E9A7 10 05 BPL $05    [$E9AE] A:0000 X:0680 Y:001A P:envMxdiZC - If Positive (Not Enemy Kain) branch to 03E9AE.
-------------------------------------------------------------------------------------------------------------------------------
$03/E9A9 29 7F AND #$7F A:0080 X:0680 Y:001A P:eNvMxdizC - Clear A.
$03/E9AB 18 CLC A:0000 X:0680 Y:001A P:envMxdiZC - Clear Carry Flag.
$03/E9AC 69 05 ADC #$05 A:0000 X:0680 Y:001A P:envMxdiZc - Add 05 into A.
------------------------------------------------------------------------------------------------------------------------------------
$03/E9AE 20 89 84 JSR $8489  [$03:8489] A:0000 X:0680 Y:001A P:envMxdiZC - Jump to Subroutine (Preparation?)
$03/E9B1 A6 A6 LDX $A6    [$00:00A6] A:0000 X:0000 Y:001A P:envMxdiZc - Load Appropriate Slot.
$03/E9B3 BD 05 20 LDA $2005,x[$7E:2005] A:0000 X:0000 Y:001A P:envMxdiZc - Load User's Status Byte 3.
$03/E9B6 29 FD AND #$FD A:0002 X:0000 Y:001A P:envMxdizc - Add -2 to it (Get rid of Jump)
$03/E9B8 9D 05 20 STA $2005,x[$7E:2005] A:0000 X:0000 Y:001A P:envMxdiZc - Store A User's Status Byte 3.
$03/E9BB A5 CD LDA $CD    [$00:00CD] A:0000 X:0000 Y:001A P:envMxdiZc - Load Character ID.
$03/E9BD 0A ASL A A:0000 X:0000 Y:001A P:envMxdiZc - x2 to A.
$03/E9BE AA TAX A:0000 X:0000 Y:001A P:envMxdiZc - Transfer A to X.
$03/E9BF AD 7F 35 LDA $357F  [$7E:357F] A:0000 X:0000 Y:001A P:envMxdiZc - Load 7E357F into A.
$03/E9C2 9D EA 29 STA $29EA,x[$7E:29EA] A:0000 X:0000 Y:001A P:envMxdiZc - Store A in 7E29EA.
$03/E9C5 A5 CD LDA $CD    [$00:00CD] A:0000 X:0000 Y:001A P:envMxdiZc - Load Character ID into A.
$03/E9C7 10 14 BPL $14    [$E9DD] A:0000 X:0000 Y:001A P:envMxdiZc - If it is Positive (Not Enemy Kain?), branch to 03E9DD.
--------------------------------------------------------------------------------------------------------------------------------------------------
$03/E9C9 A9 DE LDA #$DE A:0080 X:0000 Y:001A P:eNvMxdizC - Load DE into A.
$03/E9CB 8D C2 33 STA $33C2  [$7E:33C2] A:00DE X:0000 Y:001A P:eNvMxdizC - Store A in 7E33C2.
$03/E9CE A9 F8 LDA #$F8 A:00DE X:0000 Y:001A P:eNvMxdizC - Load F8 into A.
$03/E9D0 8D C3 33 STA $33C3  [$7E:33C3] A:00F8 X:0000 Y:001A P:eNvMxdizC - Store A in 7E33C3.
$03/E9D3 A9 04 LDA #$04 A:00F8 X:0000 Y:001A P:eNvMxdizC - Load 04 into A.
$03/E9D5 8D C4 33 STA $33C4  [$7E:33C4] A:0004 X:0000 Y:001A P:envMxdizC - Store A in 7E33C4.
$03/E9D8 A9 FF LDA #$FF A:0004 X:0000 Y:001A P:envMxdizC - Load FF into A.
$03/E9DA 8D C5 33 STA $33C5  [$7E:33C5] A:00FF X:0000 Y:001A P:eNvMxdizC - Store A in 7E33C5.
-----------------------------------------------------------------------------------------------------------------------------------------------------
$03/E9DD 60 RTS A:0000 X:0000 Y:001A P:envMxdiZc - Return

Quite a few "Enemy Kain Only" branches to be found within the routine, likely targeting and special circumstance. Still not sure why it doesn't use 1E like the normal Jump does or what is even different about DE.


It seems like the only purpose of the branches for Enemy Kain are to allow the Jump attack to actually go through, which is a strange thing to limit in the first place. Why shouldn't Kain be allowed to target Allies? It would free up a bit of space in the routine as well for anything a hacker would like to add.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (All Spells Disassembly)
Post by: Grimoire LD on October 07, 2013, 10:49:15 AM
Parry Routine - A very simple matter. It can be guessed what it does...

Code: [Select]
$03/E9DE A6 A6 LDX $A6    [$00:00A6] A:0003 X:0036 Y:0000 P:envMxdizc - Load User's Character Slot.
$03/E9E0 BD 05 20 LDA $2005,x[$7E:2085] A:0003 X:0080 Y:0000 P:envMxdizc - Load Character's Status Byte 3.
$03/E9E3 09 10 ORA #$10 A:0000 X:0080 Y:0000 P:envMxdiZc - Add Defend.
$03/E9E5 9D 05 20 STA $2005,x[$7E:2085] A:0010 X:0080 Y:0000 P:envMxdizc - Store A in Character's STatus Byte 3.
$03/E9E8 60 RTS A:0010 X:0080 Y:0000 P:envMxdizc - Return.

Now, let's revisit one of the first commands I looked at and see if I can completely decipher it now...

Dark Wave Routine -
Code: [Select]
$03/E9E9 A5 CD LDA $CD    [$00:00CD] A:0003 X:000A Y:0000 P:envMxdizc - Load User's ID.
$03/E9EB 30 26 BMI $26    [$EA13] A:0000 X:000A Y:0000 P:envMxdiZc - Is it Minus? (Enemy Cecil) If so, branch to 03EA13.
$03/E9ED C2 20 REP #$20 A:0000 X:000A Y:0000 P:envMxdiZc - Reset Processor Status
$03/E9EF A6 A6 LDX $A6    [$00:00A6] A:0000 X:000A Y:0000 P:envmxdiZc - Load User's Slot.
$03/E9F1 BD 09 20 LDA $2009,x[$7E:2009] A:0000 X:0000 Y:0000 P:envmxdiZc - Load User's Max HP.
$03/E9F4 20 85 84 JSR $8485  [$03:8485] A:00C8 X:0000 Y:0000 P:envmxdizc - Jump to Subroutine
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
$03/8485 4A LSR A A:00C8 X:0000 Y:0000 P:envmxdizc - /2 A.
$03/8486 4A LSR A A:0064 X:0000 Y:0000 P:envmxdizc - /2 A.
$03/8487 4A LSR A A:0032 X:0000 Y:0000 P:envmxdizc - /2 A.
$03/8488 60 RTS A:0019 X:0000 Y:0000 P:envmxdizc - Return
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/E9F7 85 A9 STA $A9    [$00:00A9] A:0019 X:0000 Y:0000 P:envmxdizc - Store A in A9. (Amount of HP to subtract)
$03/E9F9 38 SEC A:0019 X:0000 Y:0000 P:envmxdizc - Set Carry Flag.
$03/E9FA BD 07 20 LDA $2007,x[$7E:2007] A:0019 X:0000 Y:0000 P:envmxdizC - Load User's Current HP.
$03/E9FD E5 A9 SBC $A9    [$00:00A9] A:002C X:0000 Y:0000 P:envmxdizC - Reduce A by the value in A9 (1/8th of Max HP)
$03/E9FF 9D 07 20 STA $2007,x[$7E:2007] A:0013 X:0000 Y:0000 P:envmxdizC - Store A in User's Current HP.
$03/EA02 B0 0C BCS $0C    [$EA10] A:0013 X:0000 Y:0000 P:envmxdizC - If greater than 00 branch to 03EA10.
---------------------------------------------------------------------------------------------------------------------------------------
$03/EA04 A9 00 00 LDA #$0000 A:FFFA X:0000 Y:0000 P:eNvmxdizc - Load 0000 into A.
$03/EA07 9D 07 20 STA $2007,x[$7E:2007] A:0000 X:0000 Y:0000 P:envmxdiZc - Store A in User's Current HP.
$03/EA0A A9 80 00 LDA #$0080 A:0000 X:0000 Y:0000 P:envmxdiZc - Load 0080 into A. (Death)
$03/EA0D 9D 03 20 STA $2003,x[$7E:2003] A:0080 X:0000 Y:0000 P:envmxdizc - Store A in 7E2003.
------------------------------------------------------------------------------------------------------------------------------------------
$03/EA10 7B TDC A:0013 X:0000 Y:0000 P:envmxdizC - Transfer Direct Page
$03/EA11 E2 20 SEP #$20 A:0000 X:0000 Y:0000 P:envmxdiZC - Set Processor Status.
$03/EA13 A9 01 LDA #$01 A:0000 X:0000 Y:0000 P:envMxdiZC - Load 01 into A.
$03/EA15 85 C1 STA $C1    [$00:00C1] A:0001 X:0000 Y:0000 P:envMxdizC - Store A in C1 (Used in the Kick Routine)
$03/EA17 4C B9 E6 JMP $E6B9  [$03:E6B9] A:0001 X:0000 Y:0000 P:envMxdizC - Jump to Routine (Most of Kick Routine)

Well that was quite a bit simpler this time around, everything was easily deciphered.

First, I've decided to make Dark Wave's death penalty more substantial...


$03/EA04   A9 00 00   LDA #$0000   A:FFF8   X:0000   Y:0000   P:eNvmxdizc - Load 0000 into A.
$03/EA07   9D 07 20   STA $2007,x[$7E:2007]   A:0000   X:0000   Y:0000   P:envmxdiZc - Store A in User's HP.
$03/EA0A   A9 80 00   LDA #$0080   A:0000   X:0000   Y:0000   P:envmxdiZc - Load 0080 into A.
$03/EA0D   9D 40 20   STA $2040,x[$7E:2040]   A:0080   X:0000   Y:0000   P:envmxdizc - Store A in User's Creature Type (Undead)


I'm going to go out on a limb and say this is what it May have originally been, or at least planned. Because setting the HP to 0 automatically will kill the user regardless, making the Death Application superfluous. This will prevent the player from being able to revive Cecil if he killed himself with Dark Wave, as it applied the Undead-type to him.

Furthermore the jump to Kick is basically reading the entirely of the Kick Routine, meaning that you could Easily set it to the Fight Routine and have Dark Wave hit only a single target, now unfortunately, it would then only act like a normal attack without modifying the Fight Routine or Dark Wave Routine itself to compensate the new addition to it.

For instance, say you want to make Dark Wave more like Darkness in FFIV:DS, an attack that hits one enemy for Double Damage, but takes HP.

You would change...

$03/EA10   7B    TDC   A:0013   X:0000   Y:0000   P:envmxdizC - Transfer Direct Page
$03/EA11   E2 20   SEP #$20   A:0000   X:0000   Y:0000   P:envmxdiZC - Set Processor Status.
$03/EA13   A9 01   LDA #$01   A:0000   X:0000   Y:0000   P:envMxdiZC - Load 01 into A.
$03/EA15   85 C1   STA $C1    [$00:00C1]   A:0001   X:0000   Y:0000   P:envMxdizC - Store A in C1 (Used in the Kick Routine)
$03/EA17   4C B9 E6   JMP $E6B9  [$03:E6B9]   A:0001   X:0000   Y:0000   P:envMxdizC - Jump to Routine (Most of Kick Routine)

To this...

$03/EA10   E2 20   SEP #$20   A:0039   X:0000   Y:0000   P:envmxdizC - Set Processor Status (in order to have it read only one byte rather than two)
$03/EA12   A9 04   LDA #$04   A:0039   X:0000   Y:0000   P:envMxdizC - Load 04 into A. (x2 Power)
$03/EA14   8D FE 38   STA $38FE  [$7E:38FE]   A:0004   X:0000   Y:0000   P:envMxdizC - Store A in Damage Altering Field.
$03/EA17   4C 99 C4   JMP $C499  [$03:C499]   A:0004   X:0000   Y:0000   P:envMxdizC - Jump to Fight Routine.

As long as the enemy itself has no weakness or resistance to the Elemental or Creature Type Attack, then Dark Wave will carry through as a normal attack at x2 Damage. Otherwise those variables will nullify it and replace it with an ordinary one.

Or if you want to make Dark Wave cast a Spell at 1/8th of your HP you would instead...

$03/EA10   E2 20   SEP #$20   A:0039   X:0000   Y:0000   P:envmxdizC - Set Processor Status (in order to have it read only one byte rather than two)
$03/EA12   A9 A2   LDA #$A2   A:0039   X:0000   Y:0000   P:envMxdizC - Load A2 into A. (Emission)
$03/EA14   8D D2 26   STA $26D2  [$7E:26D2]   A:00A2   X:0000   Y:0000   P:envMxdizC - Store A in Next Action to take.
$03/EA17   4C 3E CD   JMP $CD3E  [$03:CD3E]   A:00A2   X:0000   Y:0000   P:envMxdizC - Jump to Spell Routine.

But it is not that simple. The Magic Call seems to put the Caster stats above all else and will put that in initial stats at the end of the routine, meaning that if you want Dark Wave to cast a spell that hurts Cecil 1/8 HP you would also bear this in mind and change an earlier part of the routine...

Change this...

$03/E9FA   BD 07 20   LDA $2007,x[$7E:2007]   A:0019   X:0000   Y:0000   P:envmxdizC - Load User's Current HP.
$03/E9FD   E5 A9   SBC $A9    [$00:00A9]   A:002C   X:0000   Y:0000   P:envmxdizC - Reduce A by the value in A9 (1/8th of Max HP)
$03/E9FF   9D 07 20   STA $2007,x[$7E:2007]   A:0013   X:0000   Y:0000   P:envmxdizC - Store A in User's Current HP.
$03/EA02   B0 0C   BCS $0C    [$EA10]   A:0013   X:0000   Y:0000   P:envmxdizC - If greater than 00 branch to 03EA10.
---------------------------------------------------------------------------------------------------------------------------------------
$03/EA04   A9 00 00   LDA #$0000   A:FFFA   X:0000   Y:0000   P:eNvmxdizc - Load 0000 into A.
$03/EA07   9D 07 20   STA $2007,x[$7E:2007]   A:0000   X:0000   Y:0000   P:envmxdiZc - Store A in User's Current HP.
$03/EA0A   A9 80 00   LDA #$0080   A:0000   X:0000   Y:0000   P:envmxdiZc - Load 0080 into A. (Death)
$03/EA0D   9D 03 20   STA $2003,x[$7E:2003]   A:0080   X:0000   Y:0000   P:envmxdizc - Store A in 7E2003.

To this...

$03/E9FA   BD 87 26   LDA $2687,x[$7E:2687]   A:0019   X:0000   Y:0000   P:envmxdizC - Load Caster's Current HP.
$03/E9FD   E5 A9   SBC $A9    [$00:00A9]   A:0079   X:0000   Y:0000   P:envmxdizC - Subtract it by the value in A9.
$03/E9FF   8D 87 26   STA $2687,[$7E:2687]   A:0060   X:0000   Y:0000   P:envmxdizC - Store A in Caster's Current HP.
$03/EA02   B0 0C   BCS $0C    [$EA10]   A:0060   X:0000   Y:0000   P:envmxdizC - If more than 00 branch to 03EA02.
----------------------------------------------------------------------------------------------------------------------
$03/EA04   A9 00 00   LDA #$0000   A:FFFA   X:0000   Y:0000   P:eNvmxdizc - Load 0000 into A. - Load 0000 into A.
$03/EA07   8D 87 26   STA $2687, [$7E:2687]   A:0000   X:0000   Y:0000   P:envmxdiZc - Store A in User's Current HP. - Store A in Caster
$03/EA0A   A9 80 00   LDA #$0080   A:0000   X:0000   Y:0000   P:envmxdiZc - Load 0080 into A. (Death)
$03/EA0D   8D 03 20   STA $2003, [$7E:2003]   A:0080   X:0000   Y:0000   P:envmxdizc - Store A in 7E2003.

And there you have it. Two different ways to modify Dark Wave, one is to simulate Darkness from FFIV:DS and the other is to allow it to cast a spell, if one actually wanted to use something more complex than Kick's routine or normal attack modification.

Title: Re: Grimoire LD's Notes, Methods, and Hacks (All Spells Disassembly)
Post by: Grimoire LD on October 07, 2013, 12:45:06 PM
Next up is a personal favorite of mine, and a very important command for documenting purposes, and that is Recall. It is the only command aside from Twin which uses MP to cast its magics and fails if the MP is not enough.

Recall Routine -

Code: [Select]
$03/EA1A 7B TDC A:0003 X:000E Y:0000 P:envMxdizc - Transfer Direct Page.
$03/EA1B AA TAX A:0000 X:000E Y:0000 P:envMxdiZc - Transfer A to X.
$03/EA1C A9 A0 LDA #$A0 A:0000 X:0000 Y:0000 P:envMxdiZc - Load A0 into A.
$03/EA1E 20 79 83 JSR $8379  [$03:8379] A:00A0 X:0000 Y:0000 P:eNvMxdizc - Jump to Subroutine (Generate Random Number Likely 00-A0)
$03/EA21 C9 08 CMP #$08 A:0087 X:0000 Y:0000 P:eNvMxdizc - Is it 08
$03/EA23 B0 04 BCS $04    [$EA29] A:0087 X:0000 Y:0000 P:envMxdizC - If it is more than 08 branch to 03EA29.
-----------------------------------------------------------------------------------------------------------------------------------------------------------
$03/EA25 A9 2A LDA #$2A A:0000 X:0000 Y:0000 P:eNvMxdizc - Load 2A (Stone) into A.
$03/EA27 80 40 BRA $40    [$EA69] A:002A X:0000 Y:0000 P:envMxdizc - Branch to 03EA69.
-----------------------------------------------------------------------------------------------------------------------------------------------------------
$03/EA29 C9 10 CMP #$10 A:0087 X:0000 Y:0000 P:envMxdizC - Is it 10?
$03/EA2B B0 04 BCS $04    [$EA31] A:0087 X:0000 Y:0000 P:envMxdizC - If it is more than 10 branch to 03EA31.
-----------------------------------------------------------------------------------------------------------------------------------------------------------
$03/EA2D A9 26 LDA #$26 A:000D X:0000 Y:0000 P:eNvMxdizc - Load 26 (Virus) into A.
$03/EA2F 80 38 BRA $38    [$EA69] A:0026 X:0000 Y:0000 P:envMxdizc - Branch to 03EA69.
-----------------------------------------------------------------------------------------------------------------------------------------------------------
$03/EA31 C9 18 CMP #$18 A:0087 X:0000 Y:0000 P:envMxdizC - Is it 18?
$03/EA33 B0 04 BCS $04    [$EA39] A:0087 X:0000 Y:0000 P:envMxdizC - If it is more than 18 branch to 03EA39.
-----------------------------------------------------------------------------------------------------------------------------------------------------------
$03/EA35 A9 27 LDA #$27 A:0016 X:0000 Y:0000 P:eNvMxdizc - Load 27 (Weak) into A.
$03/EA37 80 30 BRA $30    [$EA69] A:0027 X:0000 Y:0000 P:envMxdizc - Branch to 03EA69.
-----------------------------------------------------------------------------------------------------------------------------------------------------------
$03/EA39 C9 20 CMP #$20 A:0087 X:0000 Y:0000 P:envMxdizC - Is it 20?
$03/EA3B B0 04 BCS $04    [$EA41] A:0087 X:0000 Y:0000 P:envMxdizC - If it is more than 20 branch to 03EA41.
-----------------------------------------------------------------------------------------------------------------------------------------------------------
$03/EA3D A9 2B LDA #$2B A:001F X:0000 Y:0000 P:eNvMxdizc - Load 2B (Fatal) into A.
$03/EA3F 80 28 BRA $28    [$EA69] A:002B X:0000 Y:0000 P:envMxdizc - Branch to 03EA69.
-----------------------------------------------------------------------------------------------------------------------------------------------------------
$03/EA41 C9 38 CMP #$38 A:0087 X:0000 Y:0000 P:envMxdizC - Is it 38?
$03/EA43 B0 04 BCS $04    [$EA49] A:0087 X:0000 Y:0000 P:envMxdizC - If it is more than 38 branch to 03EA49.
-----------------------------------------------------------------------------------------------------------------------------------------------------------
$03/EA45 A9 1D LDA #$1D A:0025 X:0000 Y:0000 P:eNvMxdizc - Load 1D (Fire 1) into A.
$03/EA47 80 20 BRA $20    [$EA69] A:001D X:0000 Y:0000 P:envMxdizc - Branch to 03EA69.
-----------------------------------------------------------------------------------------------------------------------------------------------------------
$03/EA49 C9 50 CMP #$50 A:0087 X:0000 Y:0000 P:envMxdizC - Is it 50?
$03/EA4B B0 04 BCS $04    [$EA51] A:0087 X:0000 Y:0000 P:envMxdizC - If it is more than 50 branch to 03EA51.
-----------------------------------------------------------------------------------------------------------------------------------------------------------
$03/EA4D A9 20 LDA #$20 A:0045 X:0000 Y:0000 P:eNvMxdizc - Load 20 (Ice 1) into A.
$03/EA4F 80 18 BRA $18    [$EA69] A:0020 X:0000 Y:0000 P:envMxdizc - Branch to 03EA69.
-----------------------------------------------------------------------------------------------------------------------------------------------------------
$03/EA51 C9 68 CMP #$68 A:0087 X:0000 Y:0000 P:envMxdizC - Is it 68?
$03/EA53 B0 04 BCS $04    [$EA59] A:0087 X:0000 Y:0000 P:envMxdizC - If it is more than 68 branch to 03EA59.
-----------------------------------------------------------------------------------------------------------------------------------------------------------
$03/EA55 A9 23 LDA #$23 A:0067 X:0000 Y:0000 P:eNvMxdizc - Load 23 (Lit 1) into A.
$03/EA57 80 10 BRA $10    [$EA69] A:0023 X:0000 Y:0000 P:envMxdizc - Branch to 03EA69
-----------------------------------------------------------------------------------------------------------------------------------------------------------
$03/EA59 C9 80 CMP #$80 A:0087 X:0000 Y:0000 P:envMxdizC - Is it 80?
$03/EA5B B0 04 BCS $04    [$EA61] A:0087 X:0000 Y:0000 P:envMxdizC - If it is more than 80 branch to 03EA61
-----------------------------------------------------------------------------------------------------------------------------------------------------------
$03/EA5D A9 19 LDA #$19 A:006E X:0000 Y:0000 P:eNvMxdizc - Load 19 into A. (Toad)
$03/EA5F 80 08 BRA $08    [$EA69] A:0019 X:0000 Y:0000 P:envMxdizc - Branch to 03EA69.
-----------------------------------------------------------------------------------------------------------------------------------------------------------
$03/EA61 A9 09 LDA #$09 A:0087 X:0000 Y:0000 P:envMxdizC - Load 09 into A. (Failed)
$03/EA63 8D CA 34 STA $34CA  [$7E:34CA] A:0009 X:0000 Y:0000 P:envMxdizC - Store A in Battle Message Data.
$03/EA66 4C B1 85 JMP $85B1  [$03:85B1] A:0009 X:0000 Y:0000 P:envMxdizC - Jump to Routine (Leads out of Subroutine)
------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/EA69 48 PHA A:0019 X:0000 Y:0000 P:envMxdizc - Push A into Stack.
$03/EA6A AA TAX A:0019 X:0000 Y:0000 P:envMxdizc - Transfer A to X.
$03/EA6B 86 E5 STX $E5    [$00:00E5] A:0019 X:0019 Y:0000 P:envMxdizc - Store X in E5.
$03/EA6D A2 A0 97 LDX #$97A0 A:0019 X:0019 Y:0000 P:envMxdizc - Load 97A0 into X.
$03/EA70 86 80 STX $80    [$00:0080] A:0019 X:97A0 Y:0000 P:eNvMxdizc - Store X in 80.
$03/EA72 A9 0F LDA #$0F A:0019 X:97A0 Y:0000 P:eNvMxdizc - Load 0F into A.
$03/EA74 85 82 STA $82    [$00:0082] A:000F X:97A0 Y:0000 P:envMxdizc - Store A in 82.
$03/EA76 A9 06 LDA #$06 A:000F X:97A0 Y:0000 P:envMxdizc - Load 06 into A.
$03/EA78 20 5E 84 JSR $845E  [$03:845E] A:0006 X:97A0 Y:0000 P:envMxdizc - Jump to Subroutine (??)
$03/EA7B AD A0 28 LDA $28A0  [$7E:28A0] A:0007 X:0006 Y:009C P:envMxdiZC - Load the value in 28A0 into A. (?Spell Multiplier?)
$03/EA7E 29 7F AND #$7F A:0004 X:0006 Y:009C P:envMxdizC - Get rid of negative bits.
$03/EA80 85 DF STA $DF    [$00:00DF] A:0004 X:0006 Y:009C P:envMxdizC - Store A in DF. (Spell Multiplier Stored)
$03/EA82 A9 03 LDA #$03 A:0004 X:0006 Y:009C P:envMxdizC  - Load 03 into A.
$03/EA84 85 E1 STA $E1    [$00:00E1] A:0003 X:0006 Y:009C P:envMxdizC - Store A in E1.
$03/EA86 20 E0 83 JSR $83E0  [$03:83E0] A:0003 X:0006 Y:009C P:envMxdizC - Jump to Subroutine (HP Dealings?)
$03/EA89 A6 E3 LDX $E3    [$00:00E3] A:0000 X:0000 Y:009C P:envMxdiZc - Load X from E3.
$03/EA8B 7B TDC A:0000 X:000C Y:009C P:envMxdizc - Transfer Direct Page.
$03/EA8C A8 TAY A:0000 X:000C Y:009C P:envMxdiZc - Transfer A to Y.
--------------------------------------------------------(Looping Point)--------------------------------------------------------------------
$03/EA8D BF 90 A5 0F LDA $0FA590,x[$0F:A59C] A:0000 X:000C Y:0000 P:envMxdiZc - Load A from 0FA590(+X)
$03/EA91 99 A2 28 STA $28A2,y[$7E:28A2] A:0008 X:000C Y:0000 P:envMxdizc - Store A in 7E28A2.
$03/EA94 C8 INY A:0008 X:000C Y:0000 P:envMxdizc +1 to Y.
$03/EA95 E8 INX A:0008 X:000C Y:0001 P:envMxdizc +1 to X.
$03/EA96 C0 03 00 CPY #$0003 A:0008 X:000D Y:0001 P:envMxdizc - Is Y 3?
$03/EA99 D0 F2 BNE $F2    [$EA8D] A:0008 X:000D Y:0001 P:eNvMxdizc - If not, branch back to 03EA8D
-------------------------------------------------------------------------------------------------------------------------------------------------
$03/EA9B AD 8B 26 LDA $268B  [$7E:268B] A:0000 X:000F Y:0003 P:envMxdiZC - Load Caster's MP Byte 1.
$03/EA9E 85 A9 STA $A9    [$00:00A9] A:00E7 X:000F Y:0003 P:eNvMxdizC - Store A in A9.
$03/EAA0 AD 8C 26 LDA $268C  [$7E:268C] A:00E7 X:000F Y:0003 P:eNvMxdizC - Load Caster's MP Byte 2.
$03/EAA3 F0 04 BEQ $04    [$EAA9] A:0003 X:000F Y:0003 P:envMxdizC - Branch if not 00 to 03EAA9.
-------------------------------------------------------------------------------------------------------------------------------------------------
$03/EAA5 A9 FF LDA #$FF A:0003 X:000F Y:0003 P:envMxdizC - Load FF into A. (Assumes you have enough MP to cast spell)
$03/EAA7 85 A9 STA $A9    [$00:00A9] A:00FF X:000F Y:0003 P:eNvMxdizC - Store A in A9.
-----------------------------------------------------------------------------------------------------------------------------------------------
$03/EAA9 AD A1 28 LDA $28A1  [$7E:28A1] A:00FF X:000F Y:0003 P:eNvMxdizC - Load A from Spell's MP Cost.
$03/EAAC 29 7F AND #$7F A:0007 X:000F Y:0003 P:envMxdizC - Get rid of negative bits.
$03/EAAE C5 A9 CMP $A9    [$00:00A9] A:0007 X:000F Y:0003 P:envMxdizC - Is it the same as what is in A9?
$03/EAB0 F0 06 BEQ $06    [$EAB8] A:0007 X:000F Y:0003 P:envMxdizc - Branch if Equal to 03EAB8.
$03/EAB2 90 04 BCC $04    [$EAB8] A:0007 X:000F Y:0003 P:envMxdizc - Branch  if More to 03EAB8.
-------------------------------------------------------------------------------------------------------------------------------------------------
$03/EAB4 68 PLA A:0005 X:0009 Y:0003 P:envMxdizC - Pull A.
$03/EAB5 4C C2 EA JMP $EAC2  [$03:EAC2] A:0020 X:0009 Y:0003 P:envMxdizC - Jump to Routine (Return)
-------------------------------------------------------------------------------------------------------------------------------------------------
$03/EAB8 68 PLA A:0007 X:000F Y:0003 P:envMxdizc - Pull A from Stack (retrieving the spell to be cast)
$03/EAB9 8D D2 26 STA $26D2  [$7E:26D2] A:0019 X:000F Y:0003 P:envMxdizc - Store A in Caster's Action to be Taken.
$03/EABC EE 5D 35 INC $355D  [$7E:355D] A:0019 X:000F Y:0003 P:envMxdizc - +1 to 7E355D.
$03/EABF 20 46 CC JSR $CC46  [$03:CC46] A:0019 X:000F Y:0003 P:envMxdizc - Jump to Subroutine (Magic Call - Full)
$03/EAC2 60 RTS A:00E0 X:0680 Y:001A P:eNvMxdizC - Return

Well that was as expected. Except I expected MP to be in here, but I think I see what's going on... what is unique about Recall that is not in the other Commands is that it starts At The Start of the Magic Call routine. Unlike Pray and Gird, MP Cost is likely a part of the near-beginning of the Magic Call Routine.

And... that's not the reason why. The real reason it takes MP into account is because 7E355D.

$03/CE38   AD D2 26   LDA $26D2  [$7E:26D2]   A:0020   X:0005   Y:0000   P:eNvMxdizc - Load Caster's Action Taken.
$03/CE3B   F0 3E   BEQ $3E    [$CE7B]   A:00CE   X:0005   Y:0000   P:eNvMxdizc - if 00 branch to 03CE7B.
$03/CE3D   AD 5D 35   LDA $355D  [$7E:355D]   A:00CE   X:0005   Y:0000   P:eNvMxdizc - Load 7E355D into A.
$03/CE40   F0 39   BEQ $39    [$CE7B]   A:0000   X:0005   Y:0000   P:envMxdiZc - If equal branch to 03CE7B.
--------------------------------------------------------------------------------------------------------------------------------------
$03/CE42   A5 CD   LDA $CD    [$00:00CD]   A:0002   X:0001   Y:0000   P:envMxdizc - Load User's ID.
$03/CE44   30 35   BMI $35    [$CE7B]   A:0001   X:0001   Y:0000   P:envMxdizc - Branch if a Monster is using it to 03CE7B.
$03/CE46   AD 8B 38   LDA $388B  [$7E:388B]   A:0001   X:0001   Y:0000   P:envMxdizc - Load 7E388B into A.
$03/CE49   D0 30   BNE $30    [$CE7B]   A:0000   X:0001   Y:0000   P:envMxdiZc - If not 00 branch to 03CE7B.
.....
$03/CE73   8D 8B 26   STA $268B  [$7E:268B]   A:00CE   X:0003   Y:0000   P:eNvMxdizC - Store A (reduced MP) in Caster's MP Byte 1.
-----------------------------------------------------------------------------------------------------------------------------------------


So to have Recall not take any MP it is as simple as changing this...


$03/EABC   EE 5D 35   INC $355D  [$7E:355D]   A:0019   X:000F   Y:0003   P:envMxdizc - +1 to 7E355D.

To this...

$03/EABC   9C 5D 35   STZ $355D  [$7E:355D]   A:0020   X:0009   Y:0003   P:envMxdizc - Store Zero in 7E355D.


Title: Re: Grimoire LD's Notes, Methods, and Hacks (All Spells Disassembly)
Post by: Grimoire LD on October 07, 2013, 04:01:05 PM
We are at the home stretch now! All that remains are Boast/Bluff, Cry, and Item and that will be it for conventional commands.

Boast Routine -

Code: [Select]
$03/EAC3 A9 11 LDA #$11 A:0003 X:0022 Y:0000 P:envMxdizc - Load 11 (Boast) into A.
$03/EAC5 8D C8 34 STA $34C8  [$7E:34C8] A:0011 X:0022 Y:0000 P:envMxdizc - Store A in Mini-Battle Message Data.
$03/EAC8 A9 10 LDA #$10 A:0011 X:0022 Y:0000 P:envMxdizc - Type of Message.
$03/EACA 8D C7 34 STA $34C7  [$7E:34C7] A:0010 X:0022 Y:0000 P:envMxdizc - Store A in Message Type.
$03/EACD A6 A6 LDX $A6    [$00:00A6] A:0010 X:0022 Y:0000 P:envMxdizc - Load Slot of User.
$03/EACF 18 CLC A:0010 X:0000 Y:0000 P:envMxdiZc - Clear Carry Flag.
$03/EAD0 BD 17 20 LDA $2017,x[$7E:2017] A:0010 X:0000 Y:0000 P:envMxdiZc - Load User's Wisdom.
$03/EAD3 69 10 ADC #$10 A:0012 X:0000 Y:0000 P:envMxdizc - Add 10 to it.
$03/EAD5 C9 63 CMP #$63 A:0022 X:0000 Y:0000 P:envMxdizc - Is it 63? (99)
$03/EAD7 90 02 BCC $02    [$EADB] A:0022 X:0000 Y:0000 P:eNvMxdizc - If it is less than 63 branch to 03EADB.
---------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/EAD9 A9 63 LDA #$63 A:0073 X:0000 Y:0000 P:envMxdizC - Load 63 into A.
----------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/EADB 9D 17 20 STA $2017,x[$7E:2017] A:0022 X:0000 Y:0000 P:eNvMxdizc - Store A in User's Wisdom
$03/EADE A9 12 LDA #$12 A:0022 X:0000 Y:0000 P:eNvMxdizc - Load 12 into A (D)
$03/EAE0 8D CA 34 STA $34CA  [$7E:34CA] A:0012 X:0000 Y:0000 P:envMxdizc - Store A in Battle Message Data.
$03/EAE3 4C A6 85 JMP $85A6  [$03:85A6] A:0012 X:0000 Y:0000 P:envMxdizc - Jump to Routine (Leaves Routine from here)

That was simple. I've written instructions on how to have the routine read and increase any stat the player may please, but it should be very obvious by just looking at the commented data above.

Next up is Cry, that I've already discussed at some length elsewhere. I don't expect to find much here.

Code: [Select]
$03/EAE6 A9 12 LDA #$12 A:0003 X:0024 Y:0000 P:envMxdizc - Load 12 (Cry) into A.
$03/EAE8 8D C8 34 STA $34C8  [$7E:34C8] A:0012 X:0024 Y:0000 P:envMxdizc - Store A in Mini-Message Data
$03/EAEB A9 10 LDA #$10 A:0012 X:0024 Y:0000 P:envMxdizc - Load Type of Message into A.
$03/EAED 8D C7 34 STA $34C7  [$7E:34C7] A:0010 X:0024 Y:0000 P:envMxdizc - Store it in Message Type.
$03/EAF0 A6 A6 LDX $A6    [$00:00A6] A:0010 X:0024 Y:0000 P:envMxdizc - Load User's Slot.
$03/EAF2 BD 2F 20 LDA $202F,x[$7E:202F] A:0010 X:0000 Y:0000 P:envMxdiZc - Load User's ?Steal Prevention?
$03/EAF5 4A LSR A A:000A X:0000 Y:0000 P:envMxdizc - /2.
$03/EAF6 85 A9 STA $A9    [$00:00A9] A:0005 X:0000 Y:0000 P:envMxdizc Store it in A9.
$03/EAF8 A2 05 00 LDX #$0005 A:0005 X:0000 Y:0000 P:envMxdizc - Load 0005 into X. (Gets to Monster Slots)
$03/EAFB 86 AB STX $AB    [$00:00AB] A:0005 X:0005 Y:0000 P:envMxdizc - Store X in AB.
-------------------------------------------------------------------------(Looping Point)--------------------------------------------------------------------------------------
$03/EAFD A6 AB LDX $AB    [$00:00AB] A:0005 X:0005 Y:0000 P:envMxdizc - Load X from AB.
$03/EAFF BD 40 35 LDA $3540,x[$7E:3545] A:0005 X:0005 Y:0000 P:envMxdizc - Load A from 7E3545 (Slots of Monsters)
$03/EB02 D0 15 BNE $15    [$EB19] A:0000 X:0005 Y:0000 P:envMxdiZc - If not 00 branch to 03EB19.
$03/EB04 8A TXA A:0000 X:0005 Y:0000 P:envMxdiZc - Transfer X to A.
$03/EB05 20 89 84 JSR $8489  [$03:8489] A:0005 X:0005 Y:0000 P:envMxdizc - Jump to Subroutine (Preparation?)
$03/EB08 A6 A6 LDX $A6    [$00:00A6] A:0000 X:05A0 Y:0000 P:envMxdizc - Load Slot from A6.
$03/EB0A 38 SEC A:0000 X:0280 Y:0000 P:envMxdizc - Set Carry Flag.
$03/EB0B BD 2F 20 LDA $202F,x[$7E:22AF] A:0000 X:0280 Y:0000 P:envMxdizC - Load Monster's Steal Prevention.
$03/EB0E E5 A9 SBC $A9    [$00:00A9] A:006E X:0280 Y:0000 P:envMxdizC - The value from what is in A9 (which will always be 05, because it does not change throughout the game as far as I'm aware)
$03/EB10 F0 02 BEQ $02    [$EB14] A:0069 X:0280 Y:0000 P:envMxdizC - If 00 branch to 03EB14.
$03/EB12 B0 02 BCS $02    [$EB16] A:0069 X:0280 Y:0000 P:envMxdizC - If above 00 branch to 03EB16.
-------------------------------------------------------------------------------------------------------------------------------------------
$03/EB14 A9 01 LDA #$01 A:00FC X:0280 Y:0000 P:eNvMxdizc - Load 01 into A.
-------------------------------------------------------------------------------------------------------------------------------------------
$03/EB16 9D 2F 20 STA $202F,x[$7E:22AF] A:0069 X:0280 Y:0000 P:envMxdizC - Store A in Monster's Steal Prevention.
$03/EB19 E6 AB INC $AB    [$00:00AB] A:0069 X:0280 Y:0000 P:envMxdizC - +1 to AB
$03/EB1B A5 AB LDA $AB    [$00:00AB] A:0069 X:0280 Y:0000 P:envMxdizC - Load AB into A.
$03/EB1D C9 0D CMP #$0D A:0006 X:0280 Y:0000 P:envMxdizC - Is it Equal to the value in 0D?
$03/EB1F D0 DC BNE $DC    [$EAFD] A:0006 X:0280 Y:0000 P:eNvMxdizc - If not branch back to 03EAFD. (It does this for each monster slot)
--------------------------------------------------------------------------------------------------------------------------------------------
$03/EB21 A9 13 LDA #$13 A:000D X:000C Y:0000 P:envMxdiZC - Load 13 into A. (D)
$03/EB23 8D CA 34 STA $34CA  [$7E:34CA] A:0013 X:000C Y:0000 P:envMxdizC - Store A in Battle Message Data.
$03/EB26 4C A6 85 JMP $85A6  [$03:85A6] A:0013 X:000C Y:0000 P:envMxdizC - Jump to Routine (Leaves Routine from here)

Oh? So it seems as if it was not supposed to be a static value, but by the way the game works "Steal Prevention" never goes up for Porom and is always at a static 0A /2 = 5. Because it reads Monster Slots rather than any real kind of targeting, changing targeting could be difficult.

There is a part of code that Phoenix could never decipher which he just labelled "Item/Dart Check?" That I cannot figure how to access. I could not get it to activate with either Dart or Item checks, using any kind of item I couldn't get it to activate, hmm...

Last in conventional commands is Items then...

Item Routine -

Code: [Select]
$03/EB9D AD 83 26 LDA $2683  [$7E:2683] A:0003 X:0002 Y:0000 P:envMxdizc - Load Caster's Status Byte 1.
$03/EBA0 29 C0 AND #$C0 A:0000 X:0002 Y:0000 P:envMxdiZc - Are they Petrified or Dead?
$03/EBA2 D0 68 BNE $68    [$EC0C] A:0000 X:0002 Y:0000 P:envMxdiZc - If so, branch to 03EC0C.
$03/EBA4 AD 84 26 LDA $2684  [$7E:2684] A:0000 X:0002 Y:0000 P:envMxdiZc - Load Caster's Status Byte 2.
$03/EBA7 29 3C AND #$3C A:0000 X:0002 Y:0000 P:envMxdiZc - Are they Charmed, Paralyzed, Sleep, or Berserk?
$03/EBA9 D0 61 BNE $61    [$EC0C] A:0000 X:0002 Y:0000 P:envMxdiZc - If so branch to 03EC0C.
$03/EBAB AD 85 26 LDA $2685  [$7E:2685] A:0000 X:0002 Y:0000 P:envMxdiZc - Load Caster's Status Byte 3.
$03/EBAE 29 C6 AND #$C6 A:0000 X:0002 Y:0000 P:envMxdiZc - Are they Magnetized, Stopped, Jumping or Twin Casting?
$03/EBB0 D0 5A BNE $5A    [$EC0C] A:0000 X:0002 Y:0000 P:envMxdiZc - If so branch to 03EC0C.
$03/EBB2 AD D2 26 LDA $26D2  [$7E:26D2] A:0000 X:0002 Y:0000 P:envMxdiZc - Load Caster's Next Action to Take.
$03/EBB5 48 PHA A:00CE X:0002 Y:0000 P:eNvMxdizc - Push A into Stack.
$03/EBB6 AD D2 26 LDA $26D2  [$7E:26D2] A:00CE X:0002 Y:0000 - Load Caster's Next Action to Take.
$03/EBB9 C9 CA CMP #$CA A:00CE X:0002 Y:0000 P:eNvMxdizc - Is it Grimoire? (Summon Book, Call Book, etc)
$03/EBBB D0 05 BNE $05    [$EBC2] A:00CE X:0002 Y:0000 P:envMxdizC - If not, branch to 03EBC2
---------------------------------------------------------------------------------------------------------------------------------------------------------
$03/EBBD 20 0D EC JSR $EC0D  [$03:EC0D] A:00CA X:0002 Y:0000 P:envMxdiZC - Jump to Subroutine (Used Uniquely by Grimoire)
$03/EBC0 80 33 BRA $33    [$EBF5] A:00FF X:0001 Y:0000 P:eNvMxdizc - Branch to 03EBF5.
---------------------------------------------------------------------------------------------------------------------------------------------------------
$03/EBC2 C9 B0 CMP #$B0 A:00CE X:0002 Y:0000 P:envMxdizC - Is it B0? (Fire 1 Item, but likely just a check to see if it is in the proper start of items.)
$03/EBC4 90 07 BCC $07    [$EBCD] A:00CE X:0002 Y:0000 P:envMxdizC - If less than Fire 1 Item, branch to 03EBCD.
-------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/EBC6 AD D0 26 LDA $26D0  [$7E:26D0] A:00CE X:0002 Y:0000 P:envMxdizC - Load (Unknown) into A.
$03/EBC9 29 10 AND #$10 A:0040 X:0002 Y:0000 P:envMxdizC - Get rid of bits.
$03/EBCB F0 25 BEQ $25    [$EBF2] A:0000 X:0002 Y:0000 P:envMxdiZC - Branch if 00 to 03EBF2.
--------------------------------------------------------------------------------------------------------------------------------------------------------------
(NOTE: Seems to be special and possibly unique to Spell Weapons.)

$03/EBCD AE D5 26 LDX $26D5  [$7E:26D5] A:0007 X:0002 Y:0000 P:envMxdizc - Load X from 7E26D5. (Unknown)
$03/EBD0 86 80 STX $80    [$00:0080] A:0007 X:32E6 Y:0000 P:envMxdizc - Store X in 80.
$03/EBD2 AD D2 26 LDA $26D2  [$7E:26D2] A:0007 X:32E6 Y:0000 P:envMxdizc - Load A from Action taken.  (Item in this case)
$03/EBD5 C9 61 CMP #$61 A:0007 X:32E6 Y:0000 P:envMxdizc  - Is it Shields?
$03/EBD7 90 04 BCC $04    [$EBDD] A:0007 X:32E6 Y:0000 P:eNvMxdizc - If Shields or lower branch to 03EBDD.
------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/EBD9 A9 00 LDA #$00 A:0075 X:32DA Y:0000 P:envMxdizC- Load 00 into A.
$03/EBDB 80 10 BRA $10    [$EBED] A:0000 X:32DA Y:0000 P:envMxdiZC - Branch to 03EBED.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/EBDE BF 70 90 0F LDA $0F9070,x[$0F:9077] A:0007 X:0007 Y:0000 P:envMxdizc - Load A from 0F9070+X. (Spell's Power as designated by weapon)
$03/EBE2 8D EC 38 STA $38EC  [$7E:38EC] A:0001 X:0007 Y:0000 P:envMxdizc - Store A in 7E38EC. - Store A in Spell Power.
$03/EBE5 EE EB 38 INC $38EB  [$7E:38EB] A:0001 X:0007 Y:0000 P:envMxdizc - +1 to 7E38EB. - +1 to Ignore Accuracy. (Thereby ignoring the accuracy of the weapon spell)
$03/EBE8 A0 03 00 LDY #$0003 A:0001 X:0007 Y:0000 P:envMxdizc - Load 0003 into Y. (To get to the Spell)
$03/EBEB B1 80 LDA ($80),y[$7E:32E9] A:0001 X:0007 Y:0003 P:envMxdizc - Load A from Character's Hand Data - Spell.
$03/EBED 8D D2 26 STA $26D2  [$7E:26D2] A:0048 X:0007 Y:0003 P:envMxdizc - Store A in 7E26D2.
$03/EBF0 80 03 BRA $03    [$EBF5] A:0048 X:0007 Y:0003 P:envMxdizc - Branch to 03EBF5.
------------------------------------------------------------------------------------------------------------------------------------
$03/EBF2 EE 2A 35 INC $352A  [$7E:352A] A:0000 X:0002 Y:0000 P:envMxdiZC - +1 to 7E352A.
$03/EBF5 20 3E CD JSR $CD3E  [$03:CD3E] A:0000 X:0002 Y:0000 P:envMxdizC - Jump to Subroutine (Magic Call)
$03/EBFB F0 03 BEQ $03    [$EC00] A:0000 X:0680 Y:001A P:envMxdiZC - Branch if 00 to EC00.
--------------------------------------------------------------------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/EC00 68 PLA A:0000 X:0680 Y:001A P:envMxdiZC - Pull A from Stack (Item)
$03/EC01 8D C5 33 STA $33C5  [$7E:33C5] A:00CE X:0680 Y:001A P:eNvMxdizC - Store A in 7E33C5.
$03/EC04 8D C8 34 STA $34C8  [$7E:34C8] A:00CE X:0680 Y:001A P:eNvMxdizC - Store A in 7E34C8.
$03/EC07 A9 20 LDA #$20 A:00CE X:0680 Y:001A P:eNvMxdizC - Load 20 into A.
$03/EC09 8D C7 34 STA $34C7  [$7E:34C7] A:0020 X:0680 Y:001A P:envMxdizC - Store A in 7E34C7.
$03/EC0C 60 RTS A:0020 X:0680 Y:001A P:envMxdizC - Return.

Grimoire Routine -

Code: [Select]
$03/EC0D A9 E5 LDA #$E5 A:00CA X:0002 Y:0000 P:envMxdiZC - Load E5 into A. (Effect to use. E5 is used by Summons to phase the party in and out)
$03/EC0F 8D C4 33 STA $33C4  [$7E:33C4] A:00E5 X:0002 Y:0000 P:eNvMxdizC - Store A in 7E33C4.
$03/EC12 EE ED 38 INC $38ED  [$7E:38ED] A:00E5 X:0002 Y:0000 P:eNvMxdizC - +1 to 7E38ED.
$03/EC15 EE 84 35 INC $3584  [$7E:3584] A:00E5 X:0002 Y:0000 P:envMxdizC - +1 to 7E3584.
$03/EC18 7B TDC A:00E5 X:0002 Y:0000 P:envMxdizC - Transfer Direct Page.
$03/EC19 AA TAX A:0000 X:0002 Y:0000 P:envMxdiZC - Transfer A to X.
$03/EC1A A9 09 LDA #$09 A:0000 X:0000 Y:0000 P:envMxdiZC - Load 09 into A (Likely used as a benchmark of randomness to choose from)
$03/EC1C 20 79 83 JSR $8379  [$03:8379] A:0009 X:0000 Y:0000 P:envMxdizC - Jump to Subroutine (Generate Random Number 0-9)
$03/EC1F AA TAX A:0002 X:0000 Y:0000 P:envMxdizc - Transfer A to X.
$03/EC20 BF EC FE 13 LDA $13FEEC,x[$13:FEEE] A:0002 X:0002 Y:0000 P:envMxdizc - Load A from 13FEEC +X.

(NOTE: 13FEEC is a group of numbers in this order... D1,52,53,54,55,56,D7,58,59,5D - Now the AND 7F below makes it so it can't be above 80 and will always reduce them to 50's. I'm not sure what else this section of data is used for, I'm going to assume, not very much, so you should be able to change them if you are planning on it Not being Summons, because somewhere in the Grimoire Routine is something that makes the party vanish as it assumes Summons are going to be used.)

$03/EC24 48 PHA A:0053 X:0002 Y:0000 P:envMxdizc - Push A into Stack.
$03/EC25 29 7F AND #$7F A:0053 X:0002 Y:0000 P:envMxdizc - Get rid of negative bits.
$03/EC27 8D D2 26 STA $26D2  [$7E:26D2] A:0053 X:0002 Y:0000 P:envMxdizc - Store A in Caster's Next Action to take.
$03/EC2A 8D C5 33 STA $33C5  [$7E:33C5] A:0053 X:0002 Y:0000 P:envMxdizc - Store A in 7E33C5.
$03/EC2D 68 PLA A:0052 X:0001 Y:0000 P:envMxdizc - Pull A from Stack.
$03/EC2E 10 33 BPL $33    [$EC63] A:0052 X:0001 Y:0000 P:envMxdizc Branch if Positive to 03EC63. (This can only be bypassed by Chocobo and Sylph calls)
------------------------------------------------------(Looping Point)-----------------------------------------------------------------------------
$03/EC30 A2 05 00 LDX #$0005 A:00D7 X:0006 Y:0000 P:eNvMxdizc - Load 0005 into X.
$03/EC33 A9 0C LDA #$0C A:00D7 X:0005 Y:0000 P:envMxdizc - Load 0C into A.
$03/EC35 20 79 83 JSR $8379  [$03:8379] A:000C X:0005 Y:0000 P:envMxdizc - Jump to Subroutine (Generate Random Number)
$03/EC38 A8 TAY A:0006 X:0000 Y:0000 P:eNvMxdizc - Transfer A to Y.
$03/EC39 84 A9 STY $A9    [$00:00A9] A:0006 X:0000 Y:0006 P:envMxdizc - Store Y in A9.
$03/EC3B B9 40 35 LDA $3540,y[$7E:3546] A:0006 X:0000 Y:0006 P:envMxdizc - Load 7E3540+RNG into X (Ah! I see, the Grimoire has special targeting, or rather random targeting for the Chocobo and Sylph Summon)
$03/EC3E D0 F0 BNE $F0    [$EC30] A:0000 X:0000 Y:0006 P:envMxdiZc - If not 00 loop back to 03EC30.
------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/EC40 98 TYA A:0000 X:0000 Y:0006 P:envMxdiZc - Transfer Y to A.
$03/EC41 85 DF STA $DF    [$00:00DF] A:0006 X:0000 Y:0006 P:envMxdizc - Store A in DF.
$03/EC43 A9 80 LDA #$80 A:0006 X:0000 Y:0006 P:envMxdizc - Load 80 into A.
$03/EC45 85 E1 STA $E1    [$00:00E1] A:0080 X:0000 Y:0006 P:eNvMxdizc - Store A in E1.
$03/EC47 20 E0 83 JSR $83E0  [$03:83E0] A:0080 X:0000 Y:0006 P:eNvMxdizc - Jump to Subroutine (HP Dealings?)
$03/EC4A A6 E3 LDX $E3    [$00:00E3] A:0000 X:0000 Y:0006 P:envMxdiZc - Load Targeted Monster Slot into X.
$03/EC4C BD 03 20 LDA $2003,x[$7E:2303] A:0000 X:0300 Y:0006 P:envMxdizc - Load Targeted Monster's Status Byte 1 into A.
$03/EC4F 29 C0 AND #$C0 A:0000 X:0300 Y:0006 P:envMxdiZc - Is it Dead or Petrified?
$03/EC51 D0 DD BNE $DD    [$EC30] A:0000 X:0300 Y:0006 P:envMxdiZc - If so loop back to 03EC30.
-----------------------------------------------------------------------------------------------------------------------------------------------------------
$03/EC53 38 SEC A:0000 X:0300 Y:0006 P:envMxdiZc - Set Carry Flag.
$03/EC54 A5 A9 LDA $A9    [$00:00A9] A:0000 X:0300 Y:0006 P:envMxdiZC - Load Targeted Choice into A.
$03/EC56 E9 05 SBC #$05 A:0006 X:0300 Y:0006 P:envMxdizC - -5 to A.
$03/EC58 AA TAX A:0001 X:0300 Y:0006 P:envMxdizC - Transfer A to X.
$03/EC59 09 80 ORA #$80 A:0001 X:0001 Y:0006 P:envMxdizC - Add 80.
$03/EC5B 85 CE STA $CE    [$00:00CE] A:0081 X:0001 Y:0006 P:eNvMxdizC - Store A in CE.
$03/EC5D 7B TDC A:0081 X:0001 Y:0006 P:eNvMxdizC - Transfer Direct Page.
$03/EC5E 20 5F 85 JSR $855F  [$03:855F] A:0000 X:0001 Y:0006 P:envMxdiZC - Jump to Subroutine
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/855F 1F FE FE 13 ORA $13FEFE,x[$13:FEFF] A:0000 X:0001 Y:0006 P:envMxdiZC - Add the value in 13FEFE+X into A.
$03/8563 60 RTS A:0040 X:0001 Y:0006 P:envMxdizC - Return.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/EC61 80 06 BRA $06    [$EC69] A:0040 X:0001 Y:0006 P:envMxdizC - Branch to 03EC69
------------------------------------------------------------------------------------------------------------------------------------
$03/EC63 A9 80 LDA #$80 A:0052 X:0001 Y:0000 P:envMxdizc - Load 80 into A.
$03/EC65 85 CE STA $CE    [$00:00CE] A:0080 X:0001 Y:0000 P:eNvMxdizc - Store A in CE.
$03/EC67 A9 FF LDA #$FF A:0080 X:0001 Y:0000 P:eNvMxdizc - Load FF into A.
$03/EC69 8D D3 26 STA $26D3  [$7E:26D3] A:00FF X:0001 Y:0000 P:eNvMxdizc - Store A in Next Monster Target
$03/EC6C 60 RTS A:00FF X:0001 Y:0000 P:eNvMxdizc - Return.

There was a wealth of information to find there within! First and possibly most importantly is how the game makes Summons vanish the party.

$03/EC0D   A9 E5   LDA #$E5   A:00CA   X:0002   Y:0000   P:envMxdiZC - Load E5 into A. (Effect to use. E5 is used by Summons to phase the party in and out) - E5 is some sort of effect and it is very definitely an effect, considering if you change the value to say 01, it would use Hold's graphic. 00 it shows no graphic.
$03/EC0F   8D C4 33   STA $33C4  [$7E:33C4]   A:00E5   X:0002   Y:0000   P:eNvMxdizC - Store A in 7E33C4.

Secondly is how the game draws the summons in the first place and how they are specialized.

$03/EC20   BF EC FE 13   LDA $13FEEC,x[$13:FEEE]   A:0002   X:0002   Y:0000   P:envMxdizc - Load A from 13FEEC +X.

(NOTE: 13FEEC is a group of numbers in this order... D1,52,53,54,55,56,D7,58,59,5D - Now the AND 7F below makes it so it can't be above 80 and will always reduce them to 50's. I'm not sure what else this section of data is used for, I'm going to assume, not very much, so you should be able to change them if you are planning on it Not being Summons, because somewhere in the Grimoire Routine is something that makes the party vanish as it assumes Summons are going to be used.)

If you change the E5 as listed above to 00 you can use the Grimoire to use any spell and combination thereof of to spells that you would like it to use. The purpose of the negative values is for spells that only hit one enemy (Chocobo, Sylph) and the negative part allows it to go through a special part of the routine where its targeting becomes randomized, neatly enough.

$03/EC30   A2 05 00   LDX #$0005   A:00D7   X:0006   Y:0000   P:eNvMxdizc - Load 0005 into X.
$03/EC33   A9 0C   LDA #$0C   A:00D7   X:0005   Y:0000   P:envMxdizc - Load 0C into A.
$03/EC35   20 79 83   JSR $8379  [$03:8379]   A:000C   X:0005   Y:0000   P:envMxdizc - Jump to Subroutine (Generate Random Number)
$03/EC38   A8    TAY   A:0006   X:0000   Y:0000   P:eNvMxdizc - Transfer A to Y.
$03/EC39   84 A9   STY $A9    [$00:00A9]   A:0006   X:0000   Y:0006   P:envMxdizc - Store Y in A9.
$03/EC3B   B9 40 35   LDA $3540,y[$7E:3546]   A:0006   X:0000   Y:0006   P:envMxdizc - Load 7E3540+RNG into X (Ah! I see, the Grimoire has special targeting, or rather random targeting for the Chocobo and Sylph Summon)
$03/EC3E   D0 F0   BNE $F0    [$EC30]   A:0000   X:0000   Y:0006   P:envMxdiZc - If not 00 loop back to 03EC30.

The one thing I could not figure out is how the Grimoire's damage is calculated. Their default power according to the item is 00. Maybe it's something I missed in the routine.

That does it for the moment, I still need to post a full look at the Magic Call routine, but I think we're at the home stretch.

 :edit: Magic Weapon Section Added.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (All Spells Disassembly)
Post by: Grimoire LD on October 07, 2013, 11:24:40 PM
I held this off for as long as I could but there's no keeping it aside now. Onto the full Magic Call Routine... (Will likely be split into multiple posts)

White/Black/Call/Ninja Routine -

Code: [Select]
$03/CC46 7B TDC A:0003 X:0004 Y:0000 P:envMxdizc - Transfer Direct Page.
$03/CC47 AA TAX A:0000 X:0004 Y:0000 P:envMxdiZc - Transfer A to X.
$03/CC48 8E 96 28 STX $2896  [$7E:2896] A:0000 X:0000 Y:0000 P:envMxdiZc - Store X in in 7E2896.
$03/CC4B A5 CD LDA $CD    [$00:00CD] A:0000 X:0000 Y:0000 P:envMxdiZc - Load Character Slot into A.
$03/CC4D 30 03 BMI $03    [$CC52] A:0001 X:0000 Y:0000 P:envMxdizc - Branch if Monster to 03CC52.
$03/CC4F 4C 20 CD JMP $CD20  [$03:CD20] A:0001 X:0000 Y:0000 P:envMxdizc - Jump to 03CD20 (Later Part of Routine.
----------------------------------------------------------------------------------------------------------------------------------------------------------------

--------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/CD20 AD D2 26 LDA $26D2  [$7E:26D2] A:0001 X:0000 Y:0000 P:envMxdizc - Load Caster's Action to Take.
$03/CD23 C9 19 CMP #$19 A:001D X:0000 Y:0000 P:envMxdizc - Is it Lower than Toad? (White Magic)
$03/CD25 90 17 BCC $17    [$CD3E] A:001D X:0000 Y:0000 P:envMxdizC - If so, branch to 03CD3E.
------------------------------------------------------------------------------------------------------------------------------------------------------
$03/CD27 C9 31 CMP #$31 A:001D X:0000 Y:0000 P:envMxdizC - Is it Lower than Imp? (Black Magic)
$03/CD29 90 04 BCC $04    [$CD2F] A:001D X:0000 Y:0000 P:eNvMxdizc - If so branch to 03CD2F.
-------------------------------------------------------------------------------------------------------------------------------------------

-----------------------------------------------------------------------------------------------------------------------------------------
$03/CD2B C9 40 CMP #$40 A:0033 X:0000 Y:0000 P:envMxdizC - Is it Lower than Bahamut (Summon Magic)
$03/CD2D 90 04 BCC $04    [$CD33] A:0033 X:0000 Y:0000 P:eNvMxdizc - If so branch to 03CD33.
-------------------------------------------------------------------------------------------------------------------------------------------
$03/CD2F A9 C3 LDA #$C3 A:001D X:0000 Y:0000 P:eNvMxdizc - Load C3 into A. (Black Magic Aura)
$03/CD31 80 08 BRA $08    [$CD3B] A:00C3 X:0000 Y:0000 P:eNvMxdizc - Branch to 03CD3B.
-----------------------------------------------------------------------------------------------------------------------------------------------
$03/CD33 20 50 E0 JSR $E050  [$03:E050] A:0033 X:0000 Y:0000 P:eNvMxdizc - Jump to Subroutine (Unique to Summon Routine)
$03/CD36 A9 C4 LDA #$C4 A:004F X:0000 Y:0000 P:envMxdizc - Load C4 into A (Summon Orbs - Vanishing Party)
$03/CD38 8D FF 35 STA $35FF  [$7E:35FF] A:00C4 X:0000 Y:0000 P:eNvMxdizc - Store A in 7E35FF.
-----------------------------------------------------------------------------------------------------------------------------------------------
$03/CD3B 8D C4 33 STA $33C4  [$7E:33C4] A:00C3 X:0000 Y:0000 P:eNvMxdizc - Store A in 7E33C4. (Audiovisual code)
$03/CD3E AD D2 26 LDA $26D2  [$7E:26D2] A:00C3 X:0000 Y:0000 P:eNvMxdizc - Load Caster's Next Action to Take into A.
-------------------------------------------------------------------------------------------------------------------------------------------------
$03/CD3E AD D2 26 LDA $26D2  [$7E:26D2] A:00CE X:7510 Y:0018 P:envMxdizc - Load Caster's Action Taken.
$03/CD41 8D C5 33 STA $33C5  [$7E:33C5] A:00CE X:7510 Y:0018 P:eNvMxdizc - Store in 7E33C5.
$03/CD44 A9 F8 LDA #$F8 A:00CE X:7510 Y:0018 P:eNvMxdizc - Load F8 into A.
$03/CD46 8D C6 33 STA $33C6  [$7E:33C6] A:00F8 X:7510 Y:0018 P:eNvMxdizc - Store A in 7E33C6.
$03/CD49 A9 04 LDA #$04 A:00F8 X:7510 Y:0018 P:eNvMxdizc - Load 04 into A.
$03/CD4B 8D C7 33 STA $33C7  [$7E:33C7] A:0004 X:7510 Y:0018 P:envMxdizc - Store A in 7E33C7.
$03/CD4E EE 5B 35 INC $355B  [$7E:355B] A:0004 X:7510 Y:0018 P:envMxdizc - +1 to 7E355B.
$03/CD51 A5 CE LDA $CE    [$00:00CE] A:0004 X:7510 Y:0018 P:envMxdizc - Load A from CE.
$03/CD53 29 80 AND #$80 A:0000 X:7510 Y:0018 P:envMxdiZc - Get rid of bits.
$03/CD55 8D C4 34 STA $34C4  [$7E:34C4] A:0000 X:7510 Y:0018 P:envMxdiZc - Store A in 7E34C4.
$03/CD58 9C 22 35 STZ $3522  [$7E:3522] A:0000 X:7510 Y:0018 P:envMxdiZc - Store Zero in 7E3522.
$03/CD5B 9C 23 35 STZ $3523  [$7E:3523] A:0000 X:7510 Y:0018 P:envMxdiZc - Store Zero in 7E3523.
$03/CD5E AD D2 26 LDA $26D2  [$7E:26D2] A:0000 X:7510 Y:0018 P:envMxdiZc - Load A from Target's Action.
$03/CD61 C9 92 CMP #$92 A:00CE X:7510 Y:0018 P:eNvMxdizc - Is it (Spell) Retreat?
$03/CD63 D0 0A BNE $0A    [$CD6F] A:00CE X:7510 Y:0018 P:envMxdizC - If not branch to 03CD6F.
------------------------------------------------------------------------------------------------------------------------
$03/CD65 48 PHA A:0092 X:0000 Y:0006 P:envMxdiZC - Push A onto stack.
$03/CD66 A9 04 LDA #$04 A:0092 X:0000 Y:0006 P:envMxdiZC - Load 04 into A (Death Sound)
$03/CD68 8D E6 38 STA $38E6  [$7E:38E6] A:0004 X:0000 Y:0006 P:envMxdizC - Store A in 7E38E6.
$03/CD6B 68 PLA A:0004 X:0000 Y:0006 P:envMxdizC - Pull A from stack.
$03/CD6C EE 82 38 INC $3882  [$7E:3882] A:0092 X:0000 Y:0006 P:eNvMxdizC - +1 to 7E3882. (Cancels Exp. Gain)
--------------------------------------------------------------------------------------------------------------------------
$03/CD6F AA TAX A:00CE X:7510 Y:0018 P:envMxdizC - Transfer A to X.
$03/CD70 86 E5 STX $E5    [$00:00E5] A:00CE X:00CE Y:0018 P:envMxdizC - Store X in E5.
$03/CD72 AD 2A 35 LDA $352A  [$7E:352A] A:00CE X:00CE Y:0018 P:envMxdizC - Load A from 7E352A.
$03/CD75 D0 33 BNE $33    [$CDAA] A:0001 X:00CE Y:0018 P:envMxdizC - If not 00 branch to 03CDAA.
------------------------------------------------------------------------------------------------------------------------------
$03/CD77 AD D2 26 LDA $26D2  [$7E:26D2] A:0000 X:001D Y:0000 P:envMxdiZc - Load Caster's Action into A.
$03/CD7A 20 3E D3 JSR $D33E  [$03:D33E] A:001D X:001D Y:0000 P:envMxdizc - Jump to Subroutine (Spell Subroutine - Early - Not sure what is being done though)
$03/CD7D 8D C8 34 STA $34C8  [$7E:34C8] A:001D X:0003 Y:FFFF P:envMxdizc - Store A in 7E34C8.
$03/CD80 D0 08 BNE $08    [$CD8A] A:001D X:0003 Y:FFFF P:envMxdizc - Branch if not 00 to 03CD8A.
-------------------------------------------------------------------------------------------------------------------------------------

--------------------------------------------------------------------------------------------------------------------------------------
$03/CD8A AD D2 26 LDA $26D2  [$7E:26D2] A:001D X:0003 Y:FFFF P:envMxdizc - Load Caster's Action into A.
$03/CD8D 20 64 D3 JSR $D364  [$03:D364] A:001D X:0003 Y:FFFF P:envMxdizc - Jump to Subroutine (??)
-----------------------------------------------------------------------------------------------------------------------------------
$03/CD90 F0 08 BEQ $08    [$CD9A] A:0000 X:0003 Y:FFFF P:envMxdiZc - Branch if 00 to 03CD9A.
-----------------------------------------------------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------------------------------------------------
$03/CD9A A9 40 LDA #$40 A:0000 X:0003 Y:FFFF P:envMxdiZc  - Load 40 into A.
$03/CD9C 8D C7 34 STA $34C7  [$7E:34C7] A:0040 X:0003 Y:FFFF P:envMxdizc - Store A in 7E34C7.
$03/CD9F A2 A0 97 LDX #$97A0 A:0040 X:0003 Y:FFFF P:envMxdizc - Load 97A0 into X.
$03/CDA2 86 80 STX $80    [$00:0080] A:0040 X:97A0 Y:FFFF P:eNvMxdizc - Store X in 80.
$03/CDA4 A9 0F LDA #$0F A:0040 X:97A0 Y:FFFF P:eNvMxdizc - Load 0F into A.
$03/CDA6 85 82 STA $82    [$00:0082] A:000F X:97A0 Y:FFFF P:envMxdizc - Store A in 82.
$03/CDA8 80 1B BRA $1B    [$CDC5] A:000F X:97A0 Y:FFFF P:envMxdizc - Branch to 03CDC5
---------------------------------------------------------------------------------------------------------------------------------
$03/CDAA AD D2 26 LDA $26D2  [$7E:26D2] A:0001 X:00CE Y:0018 P:envMxdizC - Load A from Target's Action.
$03/CDAD 8D C8 34 STA $34C8  [$7E:34C8] A:00CE X:00CE Y:0018 P:eNvMxdizC - Store A in 7E34C8.
$03/CDB0 A9 20 LDA #$20 A:00CE X:00CE Y:0018 P:eNvMxdizC - Load 20 into A.
$03/CDB2 8D C7 34 STA $34C7  [$7E:34C7] A:0020 X:00CE Y:0018 P:envMxdizC - Store A in 7E34C7.
$03/CDB5 A2 80 96 LDX #$9680 A:0020 X:00CE Y:0018 P:envMxdizC - Load 9680 into X.
$03/CDB8 86 80 STX $80    [$00:0080] A:0020 X:9680 Y:0018 P:eNvMxdizC - Store X in 80.
$03/CDBA A9 0F LDA #$0F A:0020 X:9680 Y:0018 P:eNvMxdizC - Load 0F into A.
$03/CDBC 85 82 STA $82    [$00:0082] A:000F X:9680 Y:0018 P:envMxdizC - Store A in 82.
$03/CDBE 38 SEC A:000F X:9680 Y:0018 P:envMxdizC - Set Carry Flag.
$03/CDBF A5 E5 LDA $E5    [$00:00E5] A:000F X:9680 Y:0018 P:envMxdizC - Load the value in E5 into A.
$03/CDC1 E9 B0 SBC #$B0 A:00CE X:9680 Y:0018 P:eNvMxdizC - -B0 from A.
$03/CDC3 85 E5 STA $E5    [$00:00E5] A:001E X:9680 Y:0018 P:envMxdizC - Store A in E5.
$03/CDC5 A9 06 LDA #$06 A:001E X:9680 Y:0018 P:envMxdizC - Load 06 into A.
$03/CDC7 20 5E 84 JSR $845E  [$03:845E] A:0006 X:9680 Y:0018 P:envMxdizC - Load Stored Spell Power.
$03/CDCA AD A0 28 LDA $28A0  [$7E:28A0] A:0080 X:0006 Y:00BA P:envMxdiZC - Load  from 7E28A0.
$03/CDCD 48 PHA A:0000 X:0006 Y:00BA P:envMxdiZC - Push A.
$03/CDCE 29 80 AND #$80 A:0000 X:0006 Y:00BA P:envMxdiZC - And 80.
$03/CDD0 8D E2 38 STA $38E2  [$7E:38E2] A:0000 X:0006 Y:00BA P:envMxdiZC - Store A in 7E38E2.
$03/CDD3 68 PLA A:0000 X:0006 Y:00BA P:envMxdiZC - Pull A.
$03/CDD4 29 7F AND #$7F A:0000 X:0006 Y:00BA P:envMxdiZC - And 7F.
$03/CDD6 85 DF STA $DF    [$00:00DF] A:0000 X:0006 Y:00BA P:envMxdiZC - Store A in DF.
$03/CDD8 A9 03 LDA #$03 A:0000 X:0006 Y:00BA P:envMxdiZC - Load 03 into A.
$03/CDDA 85 E1 STA $E1    [$00:00E1] A:0003 X:0006 Y:00BA P:envMxdizC - Store A in E1.
$03/CDDC 20 E0 83 JSR $83E0  [$03:83E0] A:0003 X:0006 Y:00BA P:envMxdizC - Jump to Subroutine (HP Dealing?)
$03/CDDF A6 E3 LDX $E3    [$00:00E3] A:0000 X:0000 Y:00BA P:envMxdiZc - Load X from E3.
$03/CDE1 7B TDC A:0000 X:0000 Y:00BA P:envMxdiZc - Transfer Direct Page.
$03/CDE2 A8 TAY A:0000 X:0000 Y:00BA P:envMxdiZc - Transfer A to Y.
-------------------------------------------------------------------------------(Looping Point)--------------------------------------------------------------
$03/CDE3 BF 90 A5 0F LDA $0FA590,x[$0F:A590] A:0000 X:0000 Y:0000 P:envMxdiZc - Load A from 0FA590.
$03/CDE7 99 A2 28 STA $28A2,y[$7E:28A2] A:0000 X:0000 Y:0000 P:envMxdiZc - Store A in 7E28A2.
$03/CDEA C8 INY A:0000 X:0000 Y:0000 P:envMxdiZc - +1 Y
$03/CDEB E8 INX A:0000 X:0000 Y:0001 P:envMxdizc - +1 X
$03/CDEC C0 03 00 CPY #$0003 A:0000 X:0001 Y:0001 P:envMxdizc - Is X 03?
$03/CDEF D0 F2 BNE $F2    [$CDE3] A:0000 X:0001 Y:0001 P:eNvMxdizc - If not branch back to 03CDE3.
$03/CDF1 AD A2 28 LDA $28A2  [$7E:28A2] A:0000 X:0003 Y:0003 P:envMxdiZC - Load A from Casted Spell's Elemental?
$03/CDF4 8D 00 36 STA $3600  [$7E:3600] A:0000 X:0003 Y:0003 P:envMxdiZC - Store A in 7E3600.
$03/CDF7 A5 CE LDA $CE    [$00:00CE] A:0000 X:0003 Y:0003 P:envMxdiZC - Load A from CE.
$03/CDF9 29 80 AND #$80 A:0000 X:0003 Y:0003 P:envMxdiZC - Get rid of bits.
$03/CDFB 8D 4E 35 STA $354E  [$7E:354E] A:0000 X:0003 Y:0003 P:envMxdiZC - Store A in 7E354E.
$03/CDFE 30 0D BMI $0D    [$CE0D] A:0000 X:0003 Y:0003 P:envMxdiZC - Branch if Minus to 03CE0D.
$03/CE00 20 18 C4 JSR $C418  [$03:C418] A:0000 X:0003 Y:0003 P:envMxdiZC - Jump to Subroutine (Status Checking?)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/C418 7B TDC A:0000 X:0003 Y:0003 P:envMxdiZC - Transfer Direct Page.
$03/C419 AA TAX A:0000 X:0003 Y:0003 P:envMxdiZC - Transfer A to X.
$03/C41A A8 TAY A:0000 X:0000 Y:0003 P:envMxdiZC - Transfer A to Y.
$03/C41B 84 A9 STY $A9    [$00:00A9] A:0000 X:0000 Y:0000 P:envMxdiZC - Store Y in A9.
$03/C41D B9 40 35 LDA $3540,y[$7E:3540] A:0000 X:0000 Y:0000 P:envMxdiZC - Load A from 7E3540
$03/C420 D0 13 BNE $13    [$C435] A:0000 X:0000 Y:0000 P:envMxdiZC - Branch if not 00 to 03C435
---------------------------------------------------------------------------------------------------------------------------------------------.
$03/C422 BD 03 20 LDA $2003,x[$7E:2003] A:0000 X:0000 Y:0000 P:envMxdiZC - Load Status of Character.
$03/C425 29 C0 AND #$C0 A:0000 X:0000 Y:0000 P:envMxdiZC - Is it Petrify or KO?
$03/C427 D0 0C BNE $0C    [$C435] A:0000 X:0000 Y:0000 P:envMxdiZC - If not 00 branch to 03C435.
-------------------------------------------------------------------------------------------------------------------------------------------------------
$03/C429 BD 05 20 LDA $2005,x[$7E:2005] A:0000 X:0000 Y:0000 P:envMxdiZC - Load Character's Status Byte 3,
$03/C42C 29 82 AND #$82 A:0000 X:0000 Y:0000 P:envMxdiZC - Is it Magnetized or Twincasting?
$03/C42E D0 05 BNE $05    [$C435] A:0000 X:0000 Y:0000 P:envMxdiZC - If not 00 branch to 03C435.
-----------------------------------------------------------------------------------------------------------------------------------------------------------
$03/C430 BD 06 20 LDA $2006,x[$7E:2006] A:0000 X:0000 Y:0000 P:envMxdiZC - Load Character's Status Byte 4.
$03/C433 10 0B BPL $0B    [$C440] A:0000 X:0000 Y:0000 P:envMxdiZC - If they are not in Hide status branch to 03C440.
------------------------------------------------------------------------------------------------------------------------------------------------------------

--------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/C440 60 RTS A:0000 X:0000 Y:0000 P:envMxdiZC
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/CE03 A5 A9 LDA $A9    [$00:00A9] A:0000 X:0000 Y:0000 P:envMxdiZC - Load A9 into A.
$03/CE05 F0 06 BEQ $06    [$CE0D] A:0000 X:0000 Y:0000 P:envMxdiZC - If 00 branch to 03CE0D
-------------------------------------------------------------------------------------------------------------------------------------------------------
$03/CE0D AD D3 26 LDA $26D3  [$7E:26D3] A:0000 X:0000 Y:0000 P:envMxdiZC - Load Caster's Monster Target.
$03/CE10 D0 03 BNE $03    [$CE15] A:0000 X:0000 Y:0000 P:envMxdiZC - If not 00 branch to 03CE15.
$03/CE12 AD D4 26 LDA $26D4  [$7E:26D4] A:0000 X:0000 Y:0000 P:envMxdiZC - Load Caster's Party Targets.
$03/CE15 20 BC D2 JSR $D2BC  [$03:D2BC] A:00F8 X:0000 Y:0000 P:eNvMxdizC - Jump to Subroutine (Spell Routines?)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/D2AF BF 92 E0 03 LDA $03E092,x[$03:E092] A:0088 X:0000 Y:FFFF P:eNvMxdizc - Load 03E092+X into A.
$03/D2B3 85 81 STA $81    [$00:0081] A:00D3 X:0000 Y:FFFF P:eNvMxdizc - Store A in 81.
$03/D2B5 A9 03 LDA #$03 A:00D3 X:0000 Y:FFFF P:eNvMxdizc - Load 03 into A.
$03/D2B7 85 82 STA $82    [$00:0082] A:0003 X:0000 Y:FFFF P:envMxdizc - Store A in 82l
$03/D2B9 DC 80 00 JML [$0080][$03:D388] A:0003 X:0000 Y:FFFF P:envMxdizc - Jump to Damaging Spells Subroutine (I'm not sure how the game recognized it as such...)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/D2BC 85 A9 STA $A9    [$00:00A9] A:00F8 X:0000 Y:0000 P:eNvMxdizC - Store Targeting in A9.
$03/D2BE 20 0C 85 JSR $850C  [$03:850C] A:00F8 X:0000 Y:0000 P:eNvMxdizC - Jump to Subroutine (??)
$03/D2C1 CA DEX A:0000 X:0005 Y:0000 P:envMxdiZc - -1 to X.
$03/D2C2 F0 77 BEQ $77    [$D33B] A:0000 X:0004 Y:0000 P:envMxdizc - Branch if Equal to... 00? to 03D33B.
$03/D2C4 AD E7 38 LDA $38E7  [$7E:38E7] A:0000 X:0004 Y:0000 P:envMxdizc - Load 7E38E7 into A (Maybe something to do with Encounter flags?)
$03/D2C7 D0 72 BNE $72    [$D33B] A:0001 X:0004 Y:0000 P:envMxdizc - Branch if not equal to 00 to 03D33B.
------------------------------------------------------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/D33B A5 A9 LDA $A9    [$00:00A9] A:0001 X:0004 Y:0000 P:envMxdizc - Load A9 into A.
$03/D33D 60 RTS A:00F8 X:0004 Y:0000 P:eNvMxdizc - Return
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/CE18 8D 4F 35 STA $354F  [$7E:354F] A:00F8 X:0004 Y:0000 P:eNvMxdizc - Store A in 7E354F.
$03/CE1B 8D 50 35 STA $3550  [$7E:3550] A:00F8 X:0004 Y:0000 P:eNvMxdizc - Store A in 7E3550.
$03/CE1E 20 0C 85 JSR $850C  [$03:850C] A:00F8 X:0004 Y:0000 P:eNvMxdizc - Jump to Subroutine (??)
$03/CE21 8A TXA A:0000 X:0005 Y:0000 P:envMxdiZc - Transfer X to A.
$03/CE22 8D 06 39 STA $3906  [$7E:3906] A:0005 X:0005 Y:0000 P:envMxdizc - Store A in 7E3906.
$03/CE25 8D 4D 35 STA $354D  [$7E:354D] A:0005 X:0005 Y:0000 P:envMxdizc  - Store A in 7E354D.
$03/CE28 F0 DD BEQ $DD    [$CE07] A:0005 X:0005 Y:0000 P:envMxdizc - If 00 loop back to 03CE07
$03/CE2A AD 9C 28 LDA $289C  [$7E:289C] A:0005 X:0005 Y:0000 P:envMxdizc - Load 7E289C into A. -
$03/CE2D 29 60 AND #$60 A:0020 X:0005 Y:0000 P:envMxdizc - Get rid of bits.
$03/CE2F C9 40 CMP #$40 A:0020 X:0005 Y:0000 P:envMxdizc - Is it 40?
$03/CE31 D0 05 BNE $05    [$CE38] A:0020 X:0005 Y:0000 P:eNvMxdizc - If not branch to 03CE31.
--------------------------------------------------------------------------------------------------------------------------------------------------

-----------------------------------------------------------------------------------------------------------------------------------------------
$03/CE38 AD D2 26 LDA $26D2  [$7E:26D2] A:0020 X:0005 Y:0000 P:eNvMxdizc - Load Caster's Action Taken.
$03/CE3B F0 3E BEQ $3E    [$CE7B] A:00CE X:0005 Y:0000 P:eNvMxdizc - if 00 branch to 03CE7B.
$03/CE3D AD 5D 35 LDA $355D  [$7E:355D] A:00CE X:0005 Y:0000 P:eNvMxdizc - Load 7E355D into A.
$03/CE40 F0 39 BEQ $39    [$CE7B] A:0000 X:0005 Y:0000 P:envMxdiZc - If equal branch to 03CE7B.
-----------------------------------------------------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------------------------------------------------------
$03/CE7B AD 2A 35 LDA $352A  [$7E:352A] A:0000 X:0005 Y:0000 P:envMxdiZc - Load A from 7E352A
$03/CE7E D0 37 BNE $37    [$CEB7] A:0001 X:0005 Y:0000 P:envMxdizc - If not 00 branch to 03CEB7.
--------------------------------------------------------------------------------------------------------------------------------------------------
$03/CEB7 7B TDC A:0001 X:0005 Y:0000 P:envMxdizc - Transfer Direct Page.
$03/CEB8 AA TAX A:0000 X:0005 Y:0000 P:envMxdiZc - Transfer A to X.
$03/CEB9 AD D2 26 LDA $26D2  [$7E:26D2] A:0000 X:0000 Y:0000 P:envMxdiZc - Load Target's Action.
$03/CEBC C9 19 CMP #$19 A:00CE X:0000 Y:0000 P:eNvMxdizc - Is it 19?
$03/CEBE B0 01 BCS $01    [$CEC1] A:00CE X:0000 Y:0000 P:eNvMxdizC - If it is more than 19 branch to 03CEC1. (Looking at the start of Black Magic, it seems)
---------------------------------------------------------------------------------------------------------------------------
$03/CEC0 E8 INX A:0005 X:0000 Y:0000 P:eNvMxdizc +1 to X.
---------------------------------------------------------------------------------------------------------------------------
$03/CEC1 86 C7 STX $C7    [$00:00C7] A:00CE X:0000 Y:0000 P:eNvMxdizC - Store X in C7.
$03/CEC3 BD 97 26 LDA $2697,x[$7E:2697] A:00CE X:0000 Y:0000 P:eNvMxdizC - Load Caster's Wisdom (Is Very Likely the formulaic check of Wisdom based spells)
$03/CEC6 4A LSR A A:0012 X:0000 Y:0000 P:envMxdizC - /2.
$03/CEC7 85 A9 STA $A9    [$00:00A9] A:0009 X:0000 Y:0000 P:envMxdizc - Store /2 Wisdom in A9.
$03/CEC9 AD 9E 28 LDA $289E  [$7E:289E] A:0009 X:0000 Y:0000 P:envMxdizc - Load Casted Spell's Hit Percentage
$03/CECC 29 7F AND #$7F A:0064 X:0000 Y:0000 P:envMxdizc - Get rid of bits (possibly over 80)
$03/CECE 18 CLC A:0064 X:0000 Y:0000 P:envMxdizc - Clear Carry Flag.
$03/CECF 65 A9 ADC $A9    [$00:00A9] A:0064 X:0000 Y:0000 P:envMxdizc - Add the value in A9 into A (Wisdom /2)
$03/CED1 90 02 BCC $02    [$CED5] A:006D X:0000 Y:0000 P:envMxdizc -If Greater than 00 branch to 03CED5.
----------------------------------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------------------------------------
$03/CED5 8D FA 38 STA $38FA  [$7E:38FA] A:006D X:0000 Y:0000 P:envMxdizc - Store A in 7E38FA
$03/CED8 AD 83 26 LDA $2683  [$7E:2683] A:006D X:0000 Y:0000 P:envMxdizc - Load Caster's Status Byte 1.
$03/CEDB 29 02 AND #$02 A:0000 X:0000 Y:0000 P:envMxdiZc - Is it Darkness?
$03/CEDD F0 03 BEQ $03    [$CEE2] A:0000 X:0000 Y:0000 P:envMxdiZc - If equal to 00 branch to 03CEE2.
--------------------------------------------------------------------------------------------------------------------------------------

-------------------------------------------------------------------------------------------------------------------------------------
$03/CEE2 A5 CD LDA $CD    [$00:00CD] A:0000 X:0000 Y:0000 P:envMxdiZc - Load CD into A.
$03/CEE4 29 7F AND #$7F A:0000 X:0000 Y:0000 P:envMxdiZc - Get rid of negative bits.
$03/CEE6 D0 19 BNE $19    [$CF01] A:0000 X:0000 Y:0000 P:envMxdiZc - If not 00 branch to 03CF01.
$03/CEE8 AD FA 38 LDA $38FA  [$7E:38FA] A:0000 X:0000 Y:0000 P:envMxdiZc - Load A from 7E38FA (Wis/2 +Hit%)
$03/CEEB 85 DF STA $DF    [$00:00DF] A:006D X:0000 Y:0000 P:envMxdizc - Store A in DF.
$03/CEED A9 05 LDA #$05 A:006D X:0000 Y:0000 P:envMxdizc - Load 05 into A.
$03/CEEF 85 E1 STA $E1    [$00:00E1] A:0005 X:0000 Y:0000 P:envMxdizc - Store A in E1.
$03/CEF1 20 E0 83 JSR $83E0  [$03:83E0] A:0005 X:0000 Y:0000 P:envMxdizc - Jump to Subroutine (Timing?)
$03/CEF4 46 E4 LSR $E4    [$00:00E4] A:0000 X:0000 Y:0000 P:envMxdiZc - /2 Value in E4.
$03/CEF6 66 E3 ROR $E3    [$00:00E3] A:0000 X:0000 Y:0000 P:envMxdizc - /2 Value in E3.
$03/CEF8 46 E4 LSR $E4    [$00:00E4] A:0000 X:0000 Y:0000 P:envMxdizC - /2 Value in E4.
$03/CEFA 66 E3 ROR $E3    [$00:00E3] A:0000 X:0000 Y:0000 P:envMxdiZC - /2 Value in E3
$03/CEFC A5 E3 LDA $E3    [$00:00E3] A:0000 X:0000 Y:0000 P:eNvMxdizc - Load E3 into A.
$03/CEFE 8D FA 38 STA $38FA  [$7E:38FA] A:0088 X:0000 Y:0000 P:eNvMxdizc - Store A in 7E38FA.
$03/CF01 AD 9F 28 LDA $289F  [$7E:289F] A:0088 X:0000 Y:0000 P:eNvMxdizc - Load A in 7E289F.
$03/CF04 29 80 AND #$80 A:0002 X:0000 Y:0000 P:envMxdizc - Get rid of Positive bits.
$03/CF06 F0 07 BEQ $07    [$CF0F] A:0000 X:0000 Y:0000 P:envMxdiZc - If 00 branch to 03CF0F
----------------------------------------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------------------------------------
$03/CF0F A6 C7 LDX $C7    [$00:00C7] A:0000 X:0000 Y:0000 P:envMxdiZc - Load X from C7. (If White Magic...)
$03/CF11 BD 97 26 LDA $2697,x[$7E:2697] A:0000 X:0000 Y:0000 P:envMxdiZc - Load Caster's Modified Wisdom. (If X is 01 it would load Modified Will instead, labeling it as White Magic)
$03/CF14 20 86 84 JSR $8486  [$03:8486] A:0012 X:0000 Y:0000 P:envMxdizc - Jump to Subroutine (Divide the value by 4.)
$03/CF17 1A INC A A:0004 X:0000 Y:0000 P:envMxdizC - +1 to A.
$03/CF18 8D FB 38 STA $38FB  [$7E:38FB] A:0005 X:0000 Y:0000 P:envMxdizC - Store A (Widsom/4 +1) into 7E38FB.
$03/CF1B 20 97 C9 JSR $C997  [$03:C997] A:0005 X:0000 Y:0000 P:envMxdizC - Jump to Subroutine (From my other notes, seems to be some sort of RNG)
$03/CF1E AD FD 38 LDA $38FD  [$7E:38FD] A:0010 X:0000 Y:0000 P:envMxdiZc - Load A from 7E38FD.
$03/CF21 8D 51 35 STA $3551  [$7E:3551] A:0005 X:0000 Y:0000 P:envMxdizc - Store A in 7E3551.
$03/CF24 AD 2A 35 LDA $352A  [$7E:352A] A:0005 X:0000 Y:0000 P:envMxdizc - Load From 7E352A.
$03/CF27 D0 05 BNE $05    [$CF2E] A:0001 X:0000 Y:0000 P:envMxdizc - If not 00 branch to 03CF27
---------------------------------------------------------------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------------------------------------------------------------
$03/CF2E A9 08 LDA #$08 A:0001 X:0000 Y:0000 P:envMxdizc - Load 08 into A.
$03/CF30 8D 51 35 STA $3551  [$7E:3551] A:0008 X:0000 Y:0000 P:envMxdizc - Store A in 7E3551.
$03/CF33 AD EB 38 LDA $38EB  [$7E:38EB] A:0008 X:0000 Y:0000 P:envMxdizc - Load A from 7E38EB.
$03/CF36 F0 06 BEQ $06    [$CF3E] A:0000 X:0000 Y:0000 P:envMxdiZc - If not 00 branch to 03CF3E.
------------------------------------------------------------------------------------------------------------------------------------------------------
03/CF38 AD EC 38 LDA $38EC  [$7E:38EC] A:0001 X:0000 Y:0000 P:envMxdizc - Load A from 7E38EC.
$03/CF3B 8D 51 35 STA $3551  [$7E:3551] A:0001 X:0000 Y:0000 P:envMxdizc - Store A in 7E3551.
----------------------------------------------------------------------------------------------------------------------------------------------------------
$03/CF3E 9C 54 35 STZ $3554  [$7E:3554] A:0000 X:0000 Y:0000 P:envMxdiZc - Store Zero in 7E3554.
$03/CF41 7B TDC A:0000 X:0000 Y:0000 P:envMxdiZc - Transfer Direct Page.
$03/CF42 AA TAX A:0000 X:0000 Y:0000 P:envMxdiZc - Transfer A to X.
$03/CF43 AD 4F 35 LDA $354F  [$7E:354F] A:0000 X:0000 Y:0000 P:envMxdiZc - Load A from 7E354F.
$03/CF46 0A ASL A A:00F8 X:0000 Y:0000 P:eNvMxdizc - x2 Targeting (to roll back)
$03/CF47 B0 03 BCS $03    [$CF4C] A:00F0 X:0000 Y:0000 P:eNvMxdizC - Branch if more than 03.
$03/CF4C AD 4F 35 LDA $354F  [$7E:354F] A:00F0 X:0000 Y:0000 P:eNvMxdizC - Load 7E354F.
$03/CF4F 20 5A 85 JSR $855A  [$03:855A] A:00F8 X:0000 Y:0000 P:eNvMxdizC - Jump to Subroutine
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/855A 3F F6 FE 13 AND $13FEF6,x[$13:FEF6] A:00F8 X:0000 Y:0000 P:eNvMxdizC - ???
$03/855E 60 RTS A:0078 X:0000 Y:0000 P:envMxdizC - Return
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/CF59 85 CE STA $CE    [$00:00CE] A:0000 X:0000 Y:0000 P:envMxdiZC - Store CE from A.
$03/CF5B A5 CE LDA $CE    [$00:00CE] A:0000 X:0000 Y:0000 P:envMxdiZC - Load A from CE.
$03/CF5D 10 05 BPL $05    [$CF64] A:0000 X:0000 Y:0000 P:envMxdiZC - Branch if plus to 03CF64.
$03/CF64 AA TAX A:0000 X:0000 Y:0000 P:envMxdiZC - Transfer A to X.
$03/CF65 BD 40 35 LDA $3540,x[$7E:3540] A:0000 X:0000 Y:0000 P:envMxdiZC - Load 7E3540 into A.
$03/CF68 F0 03 BEQ $03    [$CF6D] A:0000 X:0000 Y:0000 P:envMxdiZC - If 00 branch to 03CF6D.
--------------------------------------------------------------------------------------------------------------------------------------------------

-----------------------------------------------------------------------------------------------------------------------------------------------------
$03/CF6D A5 CE LDA $CE    [$00:00CE] A:0000 X:0000 Y:0000 P:envMxdiZC - Load CE into A.
$03/CF6F 20 73 B1 JSR $B173  [$03:B173] A:0000 X:0000 Y:0000 P:envMxdiZC - Jump to Subroutine (??)
$03/CF72 A0 7F 00 LDY #$007F A:0020 X:0000 Y:0000 P:envMxdizc - Load 7F into Y.
$03/CF75 B1 80 LDA ($80),y[$7E:207F] A:0020 X:0000 Y:007F P:envMxdizc - Load A (from 80?) which is Character's final byte, but is unknown.
$03/CF77 99 00 27 STA $2700,y[$7E:277F] A:0000 X:0000 Y:007F P:envMxdiZc -  Store A in Target's final byte?
$03/CF7A 88 DEY A:0000 X:0000 Y:007F P:envMxdiZc - -1 to Y.
$03/CF7B 10 F8 BPL $F8    [$CF75] A:0000 X:0000 Y:007E P:envMxdizc -It's a cleaning system, which will eventually put all of the character's data into the Targets data at 2700.
$03/CF7D AD 06 27 LDA $2706  [$7E:2706] A:0081 X:0000 Y:FFFF P:eNvMxdizc - Load Target's Status Byte 4.
$03/CF80 29 20 AND #$20 A:0000 X:0000 Y:FFFF P:envMxdiZc - Is it Wall?
$03/CF82 F0 05 BEQ $05    [$CF89] A:0000 X:0000 Y:FFFF P:envMxdiZc - Branch if 00 to 03CF89.
-----------------------------------------------------------------------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------------------------------------------------------------------
$03/CF89 4C 14 D0 JMP $D014  [$03:D014] A:0000 X:0000 Y:FFFF P:envMxdiZc - Jump to 03D014. (Just further in the same subroutine)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/D014 AD 03 27 LDA $2703  [$7E:2703] A:0000 X:0000 Y:FFFF P:envMxdiZc - Load Target's Status Byte 1 into A.
$03/D017 29 C0 AND #$C0 A:0000 X:0000 Y:FFFF P:envMxdiZc - Is it Petrify or KO?
$03/D019 D0 0C BNE $0C    [$D027] A:0000 X:0000 Y:FFFF P:envMxdiZc - Branch if not equal to 03D027.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/D01B AD 05 27 LDA $2705  [$7E:2705] A:0000 X:0000 Y:FFFF P:envMxdiZc - Load Target's Status Byte 3 into A.
$03/D01E 29 02 AND #$02 A:0000 X:0000 Y:FFFF P:envMxdiZc - Is it Jumping?
$03/D020 D0 21 BNE $21    [$D043] A:0000 X:0000 Y:FFFF P:envMxdiZc - If so branch to 03D043.
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/D022 AD 06 27 LDA $2706  [$7E:2706] A:0000 X:0000 Y:FFFF P:envMxdiZc - Load Target's Status Byte 4 into A.
$03/D025 10 22 BPL $22    [$D049] A:0000 X:0000 Y:FFFF P:envMxdiZc - If it is not Hiding branch to 03D049.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/D049 A9 02 LDA #$02 A:0000 X:0000 Y:FFFF P:envMxdiZc - Load 02 into A.
$03/D04B 8D FE 38 STA $38FE  [$7E:38FE] A:0002 X:0000 Y:FFFF P:envMxdizc - Store A in 7E38FE.
$03/D04E 8D FF 38 STA $38FF  [$7E:38FF] A:0002 X:0000 Y:FFFF P:envMxdizc - Store A in 7E38FF.
$03/D051 A9 00 LDA #$00 A:0002 X:0000 Y:FFFF P:envMxdizc - Load 00 into A.
$03/D053 8D 00 39 STA $3900  [$7E:3900] A:0000 X:0000 Y:FFFF P:envMxdiZc - Store A in 7E3900.
$03/D056 85 AA STA $AA    [$00:00AA] A:0000 X:0000 Y:FFFF P:envMxdiZc - Store A in AA.
$03/D058 AD 9D 28 LDA $289D  [$7E:289D] A:0000 X:0000 Y:FFFF P:envMxdiZc - Load A in 7E289D.
$03/D05D AD 84 35 LDA $3584  [$7E:3584] A:0002 X:0000 Y:FFFF P:envMxdizc - Load A from 7E3584.
$03/D060 F0 0E BEQ $0E    [$D070] A:0000 X:0000 Y:FFFF P:envMxdiZc - Load A from 7E3584.
$03/D070 06 A9 ASL $A9    [$00:00A9] A:0000 X:0000 Y:FFFF P:envMxdiZc - /2 A9
$03/D072 26 AA ROL $AA    [$00:00AA] A:0000 X:0000 Y:FFFF P:envMxdizc /2 AA
$03/D074 06 A9 ASL $A9    [$00:00A9] A:0000 X:0000 Y:FFFF P:envMxdiZc /2 A9
$03/D076 26 AA ROL $AA    [$00:00AA] A:0000 X:0000 Y:FFFF P:envMxdizc /2 AA
$03/D078 A6 A9 LDX $A9    [$00:00A9] A:0000 X:0000 Y:FFFF P:envMxdiZc - Load A9 into A.
$03/D07A 8E 02 39 STX $3902  [$7E:3902] A:0000 X:0008 Y:FFFF P:envMxdizc - Store X in 7E3902.
$03/D07D 7B TDC A:0000 X:0008 Y:FFFF P:envMxdizc -  Transfer Direct Page.
$03/D07E AA TAX A:0000 X:0008 Y:FFFF P:envMxdiZc - Transfer A to X.
$03/D07F 86 A4 STX $A4    [$00:00A4] A:0000 X:0000 Y:FFFF P:envMxdiZc - Store X in A4.
$03/D081 86 A2 STX $A2    [$00:00A2] A:0000 X:0000 Y:FFFF P:envMxdiZc - Store X in A2.
$03/D083 A5 CD LDA $CD    [$00:00CD] A:0000 X:0000 Y:FFFF P:envMxdiZc - Load A from CD.
$03/D085 29 80 AND #$80 A:0000 X:0000 Y:FFFF P:envMxdiZc - Get rid of positive bits.
$03/D087 D0 0B BNE $0B    [$D094] A:0000 X:0000 Y:FFFF P:envMxdiZc - If not 00 branch to 03D094.
$03/D089 A5 CE LDA $CE    [$00:00CE] A:0000 X:0000 Y:FFFF P:envMxdiZc
$03/D08B 29 80 AND #$80 A:0000 X:0000 Y:FFFF P:envMxdiZc
$03/D08D D0 05 BNE $05    [$D094] A:0000 X:0000 Y:FFFF P:envMxdiZc
$03/D08F 8E 04 39 STX $3904  [$7E:3904] A:0000 X:0000 Y:FFFF P:envMxdiZc
$03/D092 80 07 BRA $07    [$D09B] A:0000 X:0000 Y:FFFF P:envMxdiZc - Branch to 03D09B.
------------------------------------------------------------------------------------------------------------------------------

--------------------------------------------------------------------------------------------------------------------------------
$03/D09B A5 CE LDA $CE    [$00:00CE] A:0000 X:0000 Y:FFFF P:envMxdiZc - Load A from CE.
$03/D09D 10 05 BPL $05    [$D0A4] A:0000 X:0000 Y:FFFF P:envMxdiZc - Branch if not negative to 03D0A4.
----------------------------------------------------------------------------------------------------------------------------------------------------------------

-------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/D0A4 85 CF STA $CF    [$00:00CF] A:0000 X:0000 Y:FFFF P:envMxdiZc - Store A in CF.
$03/D0A6 20 89 84 JSR $8489  [$03:8489] A:0000 X:0000 Y:FFFF P:envMxdiZc - Jump to Subroutine (Preparation?)
$03/D0A9 AD 23 27 LDA $2723  [$7E:2723] A:0000 X:0000 Y:FFFF P:envMxdiZc - Load Target's Magical Evasion.
$03/D0AC 8D FA 38 STA $38FA  [$7E:38FA] A:000E X:0000 Y:FFFF P:envMxdizc - Store A in 7E38FA.
$03/D0AF AD 03 27 LDA $2703  [$7E:2703] A:000E X:0000 Y:FFFF P:envMxdizc - Load Target's Status Byte 1.
$03/D0B2 29 02 AND #$02 A:0000 X:0000 Y:FFFF P:envMxdiZc - Is it Darkness?
$03/D0B4 F0 03 BEQ $03    [$D0B9] A:0000 X:0000 Y:FFFF P:envMxdiZc - If not branch to 03D0B9.
---------------------------------------------------------------------------------------------------------------------------------------------------

-------------------------------------------------------------------------------------------------------------------------------------------------
$03/D0B9 A5 CD LDA $CD    [$00:00CD] A:0000 X:0000 Y:FFFF P:envMxdiZc - Load CD into A.
$03/D0BB 29 7F AND #$7F A:0000 X:0000 Y:FFFF P:envMxdiZc - Get rid of negative bits.
$03/D0BD D0 19 BNE $19    [$D0D8] A:0000 X:0000 Y:FFFF P:envMxdiZc - Branch if not 00 to 03D0D8.
$03/D0BF AD FA 38 LDA $38FA  [$7E:38FA] A:0000 X:0000 Y:FFFF P:envMxdiZc - Load Magic Evasion into A.
$03/D0C2 85 DF STA $DF    [$00:00DF] A:000E X:0000 Y:FFFF P:envMxdizc - Store A in DF.
$03/D0C4 A9 05 LDA #$05 A:000E X:0000 Y:FFFF P:envMxdizc - Load 05 into A.
$03/D0C6 85 E1 STA $E1    [$00:00E1] A:0005 X:0000 Y:FFFF P:envMxdizc - Store A in E1.
$03/D0C8 20 E0 83 JSR $83E0  [$03:83E0] A:0005 X:0000 Y:FFFF P:envMxdizc - Jump to Subroutine (Cleaning?)
$03/D0CB 46 E4 LSR $E4    [$00:00E4] A:0000 X:0000 Y:FFFF P:envMxdiZc - /2 E4.
$03/D0CD 66 E3 ROR $E3    [$00:00E3] A:0000 X:0000 Y:FFFF P:envMxdiZc /2 E3.
$03/D0CF 46 E4 LSR $E4    [$00:00E4] A:0000 X:0000 Y:FFFF P:envMxdizc /2 E4
$03/D0D1 66 E3 ROR $E3    [$00:00E3] A:0000 X:0000 Y:FFFF P:envMxdiZc /2 E3
$03/D0D3 A5 E3 LDA $E3    [$00:00E3] A:0000 X:0000 Y:FFFF P:envMxdizC Load E3 into A.
$03/D0D5 8D FA 38 STA $38FA  [$7E:38FA] A:0011 X:0000 Y:FFFF P:envMxdizC - Store A in 7E38FA.
$03/D0D8 AD 22 27 LDA $2722  [$7E:2722] A:0011 X:0000 Y:FFFF P:envMxdizC - Load Target's Magical Defense Multiplier into A.
$03/D0DB 8D FB 38 STA $38FB  [$7E:38FB] A:0003 X:0000 Y:FFFF P:envMxdizC - Store A in 7E38FB.
$03/D0DE F0 0C BEQ $0C    [$D0EC] A:0003 X:0000 Y:FFFF P:envMxdizC - If 00 branch to 03D0EC.
$03/D0E0 AD 9F 28 LDA $289F  [$7E:289F] A:0003 X:0000 Y:FFFF P:envMxdizC - Load 7E289F into A.
$03/D0E3 29 80 AND #$80 A:0002 X:0000 Y:FFFF P:envMxdizC - Remove positive bits.
$03/D0E5 F0 05 BEQ $05    [$D0EC] A:0000 X:0000 Y:FFFF P:envMxdiZC - If 00 branch to 03D0EC.
------------------------------------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------------------------------------
$03/D0EC AD 03 27 LDA $2703  [$7E:2703] A:0000 X:0000 Y:FFFF P:envMxdiZC - Load Target's Status Byte 1.
$03/D0EF 29 20 AND #$20 A:0000 X:0000 Y:FFFF P:envMxdiZC - Is it Toad?
$03/D0F1 D0 07 BNE $07    [$D0FA] A:0000 X:0000 Y:FFFF P:envMxdiZC - If so branch to 03D0FA.
$03/D0F3 AD 05 27 LDA $2705  [$7E:2705] A:0000 X:0000 Y:FFFF P:envMxdiZC - Load Target's Status Byte 3.
$03/D0F6 29 08 AND #$08 A:0000 X:0000 Y:FFFF P:envMxdiZC - Is it Charging?
$03/D0F8 F0 03 BEQ $03    [$D0FD] A:0000 X:0000 Y:FFFF P:envMxdiZC - If not branch to 03D0FD.
-------------------------------------------------------------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------------------------------------------------------------
$03/D0FD A5 CE LDA $CE    [$00:00CE] A:0000 X:0000 Y:FFFF P:envMxdiZC - Load CE into A.
$03/D0FF 10 0F BPL $0F    [$D110] A:0000 X:0000 Y:FFFF P:envMxdiZC - If not negative branch to 03D110
---------------------------------------------------------------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------------------------------------------------------------
$03/D110 20 97 C9 JSR $C997  [$03:C997] A:0000 X:0000 Y:FFFF P:envMxdiZC - Jump to Subroutine (RNG dealings)
$03/D113 A5 CD LDA $CD    [$00:00CD] A:005E X:0000 Y:0000 P:envMxdiZC - Load CD into A.
$03/D115 29 80 AND #$80 A:0000 X:0000 Y:0000 P:envMxdiZC - Get rid of positive bits.
$03/D117 D0 0C BNE $0C    [$D125] A:0000 X:0000 Y:0000 P:envMxdiZC - If not 00 branch to 03D125.
$03/D119 A5 CE LDA $CE    [$00:00CE] A:0000 X:0000 Y:0000 P:envMxdiZC - Load CE into A.
$03/D11B 29 80 AND #$80 A:0000 X:0000 Y:0000 P:envMxdiZC - Get rid of positive bits.
$03/D11D D0 06 BNE $06    [$D125] A:0000 X:0000 Y:0000 P:envMxdiZC - If not 00 branch to 03D125.
$03/D11F 38 SEC A:0000 X:0000 Y:0000 P:envMxdiZC - Set Carry Flag.
$03/D120 AD 51 35 LDA $3551  [$7E:3551] A:0000 X:0000 Y:0000 P:envMxdiZC - Load A from 7E3551.
$03/D123 80 11 BRA $11    [$D136] A:0008 X:0000 Y:0000 P:envMxdizC - Branch to 03D136.
------------------------------------------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------------------------------------------
$03/D136 8D FC 38 STA $38FC  [$7E:38FC] A:0008 X:0000 Y:0000 P:envMxdizC - Store A in 7E38FC.
$03/D139 F0 02 BEQ $02    [$D13D] A:0008 X:0000 Y:0000 P:envMxdizC - If 00 branch to 03D13D.
$03/D13B B0 25 BCS $25    [$D162] A:0008 X:0000 Y:0000 P:envMxdizC - If 00 or above? branch to 03D162
-------------------------------------------------------------------------------------------------------------------------------------------------------

-----------------------------------------------------------------------------------------------------------------------------------------------------
$03/D162 A5 CE LDA $CE    [$00:00CE] A:0008 X:0000 Y:0000 P:envMxdizC - Load CE into A.
$03/D164 10 15 BPL $15    [$D17B] A:0000 X:0000 Y:0000 P:envMxdiZC - If positive branch to 03D17B.
-------------------------------------------------------------------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------------------------------------------------------------------
$03/D17B AD 84 35 LDA $3584  [$7E:3584] A:0000 X:0000 Y:0000 P:envMxdiZC - Load A from 7E3584.
$03/D17E F0 0F BEQ $0F    [$D18F] A:0000 X:0000 Y:0000 P:envMxdiZC - If 00 branch to 03D18F.
$03/D192 29 7F AND #$7F A:0002 X:0000 Y:0000 P:envMxdizC - Get rid of negative bits.
$03/D194 C9 7E CMP #$7E A:0002 X:0000 Y:0000 P:envMxdizC - Is it 7E?
$03/D196 F0 0C BEQ $0C    [$D1A4] A:0002 X:0000 Y:0000 P:eNvMxdizc - If so branch to 03D1A4.
$03/D198 C9 7F CMP #$7F A:0002 X:0000 Y:0000 P:eNvMxdizc - Is it 7F?
$03/D19A D0 0E BNE $0E    [$D1AA] A:0002 X:0000 Y:0000 P:eNvMxdizc - If not branch to 03D1AA.
---------------------------------------------------------------------------------------------------------------------------------------------------

-----------------------------------------------------------------------------------------------------------------------------------------------------
$03/D1AA 48 PHA A:0002 X:0000 Y:0000 P:eNvMxdizc - Push A.
$03/D1AB A5 CE LDA $CE    [$00:00CE] A:0002 X:0000 Y:0000 P:eNvMxdizc - Load A from CE.
$03/D1AD C5 CD CMP $CD    [$00:00CD] A:0000 X:0000 Y:0000 P:envMxdiZc - Is it the value that is in CD?
$03/D1AF D0 0C BNE $0C    [$D1BD] A:0000 X:0000 Y:0000 P:envMxdiZC - If not branch to 03D1BD.
$03/D1B1 AD 8B 26 LDA $268B  [$7E:268B] A:0000 X:0000 Y:0000 P:envMxdiZC - Load A from Caster's Current MP
$03/D1B4 8D 0B 27 STA $270B  [$7E:270B] A:00E7 X:0000 Y:0000 P:eNvMxdizC - Store it in Target's Current MP?
$03/D1B7 AD 8C 26 LDA $268C  [$7E:268C] A:00E7 X:0000 Y:0000 P:eNvMxdizC - Load A from Caster's Current MP Byte 2.
$03/D1BA 8D 0C 27 STA $270C  [$7E:270C] A:0003 X:0000 Y:0000 P:envMxdizC - Store it in Target's Current MP Byte 2.
$03/D1BD 68 PLA A:0003 X:0000 Y:0000 P:envMxdizC - Pull A.
$03/D1BE 20 A7 D2 JSR $D2A7  [$03:D2A7] A:0002 X:0000 Y:0000 P:envMxdizC - Jump to Subroutine (Direct Spell Subroutine Starting Point)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
(Important! This is how the game generates its Spell Offsets!)

$03/D2A7 0A ASL A A:0002 X:0000 Y:0000 P:envMxdizC - x2 A.
$03/D2A8 AA TAX A:0004 X:0000 Y:0000 P:envMxdizc - Transfer A to X.
$03/D2A9 BF 91 E0 03 LDA $03E091,x[$03:E095] A:0004 X:0004 Y:0000 P:envMxdizc - Load A from 03E091 +X
$03/D2AD 85 80 STA $80    [$00:0080] A:001C X:0004 Y:0000 P:envMxdizc - Store A in 80.
$03/D2AF BF 92 E0 03 LDA $03E092,x[$03:E096] A:001C X:0004 Y:0000 P:envMxdizc - Load A from 03E092 +X
$03/D2B3 85 81 STA $81    [$00:0081] A:00D4 X:0004 Y:0000 P:eNvMxdizc - Store A in 81.
$03/D2B5 A9 03 LDA #$03 A:00D4 X:0004 Y:0000 P:eNvMxdizc - Load 03 into A.
$03/D2B7 85 82 STA $82    [$00:0082] A:0003 X:0004 Y:0000 P:envMxdizc
$03/D2B9 DC 80 00 JML [$0080][$03:D41C] A:0003 X:0004 Y:0000 P:envMxdizc - Jump Long to Specific Spell Subroutines.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/E33C A9 CE LDA #$CE A:0080 X:0680 Y:001A P:eNvMxdizC - Load A from CE.
$03/E33E 8D C5 33 STA $33C5  [$7E:33C5] A:00CE X:0680 Y:001A P:eNvMxdizC - Store A in 7E33C5.
-----------------------------------------------------------------------------------------------------------------------------
$03/E341 A9 0A LDA #$0A A:000F X:00C0 Y:0030 P:envMxdizC - Load 0A into A.
$03/E343 8D C8 34 STA $34C8  [$7E:34C8] A:000A X:00C0 Y:0030 P:envMxdizC - Store in 7E34C8.
$03/E346 A9 10 LDA #$10 A:000A X:00C0 Y:0030 P:envMxdizC - Load 10 into A.
$03/E348 8D C7 34 STA $34C7  [$7E:34C7] A:0010 X:00C0 Y:0030 P:envMxdizC - Store in 7E34C7.
$03/E34B 60 RTS A:0010 X:00C0 Y:0030 P:envMxdizC - Return
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/E050 C9 3E CMP #$3E A:0033 X:0000 Y:0000 P:eNvMxdizc - Is it Asura?
$03/E052 90 1A BCC $1A    [$E06E] A:0033 X:0000 Y:0000 P:eNvMxdizc - If it is less than Asura branch to 03E06E
------------------------------------------------------------------------------------------------------------------------------------------------

--------------------------------------------------------------------------------------------------------------------------------------------------
$03/E06E 38 SEC A:0033 X:0000 Y:0000 P:eNvMxdizc - Set Carry Flag
$03/E06F E9 31 SBC #$31 A:0033 X:0000 Y:0000 P:eNvMxdizC - Subtract 31 from A.
$03/E071 18 CLC A:0002 X:0000 Y:0000 P:envMxdizC - Clear Carry Flag.
$03/E072 69 4D ADC #$4D A:0002 X:0000 Y:0000 P:envMxdizc - Add 4D to A.
$03/E074 8D D2 26 STA $26D2  [$7E:26D2] A:004F X:0000 Y:0000 P:envMxdizc - Store A in Next Action to Take.
$03/E077 EE 84 35 INC $3584  [$7E:3584] A:004F X:0000 Y:0000 P:envMxdizc - +1 to 7E3584.
$03/E07A 60 RTS A:004F X:0000 Y:0000 P:envMxdizc - Return to 03CD33.







Note:
Another mystery solved!

Code for Command Starting Graphics...
Code: [Select]
00-BF - Assigned by Spell.

C0 - Weapon Swing
C1 - None
C2 - White Magic
C3 - Black Magic
C4 - Summon Magic (Also includes the party vanishing)
C5 - Dark Wave
C6 - Character Jumps into the Air
C7 - Character does their Special Pose. (Recall)
C8 - Spell Pose is Held as White Magic light shows (Sing)
C9 - Run from battle (Hide)
CA - Just normal Spell/Item Use pose. (Salve)
CB - Pray
CC - Special Pose - Weapon Attack (Aim)
CD - Spell Pose is Held while attack happens (Focus)
CE - Kick
CF - Gird
D0 - Twincasting
D1 - Boast
D2 - Cry
D3 - Cover
D4 - Peep
D5 - Crash (Just a normal spell casting pose)
D6 - Dart (When used outside of its normal routine, shows a hand stuck in the foe as used in Fight without a weapon)
D7 - Sneak
D8 - Ninja
D9 - Regen
DA - Change
DB - Parry
DC - Character runs all the way from one side of the screen to the other, back to the front. ??
DD - Normal Spell Casting Pose.
DE - Return from Jump
DF - Second part of Focus (Attack)


I am still not finished, there's still a bit more to find and a lot of this is copy-pasted from my Salve Routine. I am not sure how MP is handled or Accuracy, or how Items with magic attached to them is calculated. As what makes the special magic graphics appear, that I have found and can go back through my earlier routine searches and point them out now that I know what they are.

 :edit: 1/10/14 - Added the branch off of what occurs when an enemy uses Retreat.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (All Spells Disassembly)
Post by: Grimoire LD on October 08, 2013, 06:57:08 PM
 I've found the Magic Weapons section! It is very small and all of the information I had hoped to find was plainly there. (For full information refer to the Item Routine post as that is where it is stored)

So now open to us is the ability to decide what powers the Weapon Spell. Default it is Magic Power (Weapon) + Spell Power of Spell.

$03/EBDE   BF 70 90 0F   LDA $0F9070,x[$0F:9077]   A:0007   X:0007   Y:0000   P:envMxdizc - Load A from 0F9070+X. (Spell's Power as designated by weapon)
$03/EBE2   8D EC 38   STA $38EC  [$7E:38EC]   A:0001   X:0007   Y:0000   P:envMxdizc - Store A in 7E38EC. - Store A in Spell Power.

To those who were never comfortable with this you can change or null both of these values (with EA's) to have the weapon use the ordinary magic routines, using Wisdom or Will dependent on the spell's location on the list.

Though more importantly is the Accuracy Exception. This took a bit of time to track down, and I imagine its likely in other attack Commands as well.
$03/EBE5   EE EB 38   INC $38EB  [$7E:38EB]   A:0001   X:0007   Y:0000   P:envMxdizc - +1 to 7E38EB. - +1 to Ignore Accuracy. (Thereby ignoring the accuracy of the weapon spell)

From preliminary testing it seems that it works for any action taken. Fighting or otherwise. Now I have to wonder why they didn't just use that for Aim rather than a rather clumsy way of making the value FF?

That said, I'm not sure how the Slumber Blade worked previously... it is the only Weapon Spell Effect that did not seem 100%, but clearly the Ignore Accuracy byte was enabled normally. I think the team must not have been aware of this byte, as the Weapon Spells clearly were not meant to be 100% seeing as they have Accuracy that are in all different amounts.

Now I wonder how difficult it would be to make the Fight Routine read the Weapon Spells and cast them on a random basis...
Title: Re: Grimoire LD's Notes, Methods, and Hacks (All Spells & Commands Disassembly)
Post by: chillyfeez on October 08, 2013, 07:41:42 PM
Quote
Now I wonder how difficult it would be to make the Fight Routine read the Weapon Spells and cast them on a random basis...

I was just thinking about that the other day. You'd definitely have to write some custom code... I guess it would look like (in english):
Check if spell is assigned
If not, return
Generate random #
Check if # is (in desired range)
If not, return
Check/store assigned spell
Jump to magic routine

... something like that?
Title: Re: Grimoire LD's Notes, Methods, and Hacks (All Spells & Commands Disassembly)
Post by: Grimoire LD on October 08, 2013, 08:11:47 PM
Quote
Now I wonder how difficult it would be to make the Fight Routine read the Weapon Spells and cast them on a random basis...

I was just thinking about that the other day. You'd definitely have to write some custom code... I guess it would look like (in english):
Check if spell is assigned
If not, return
Generate random #
Check if # is (in desired range)
If not, return
Check/store assigned spell
Jump to magic routine

... something like that?

It seems so simple in theory. I've already seen that the game is capable of showing one effect, then another, whether that effect be Dark Wave which transitions into a different graphic or what have you.

What you have there seems perfect for that idea.

Check if spell is assigned
B1 80   LDA ($80),y[$7E:32E9]   A:0001   X:0007   Y:0003   P:envMxdizc - Load A from Character's Hand Data - Spell

If not, return
BEQ XX - Branch if 00 to elsewhere.       

Generate random #
20 93 85   JSR $8593  [$03:8593]   A:0000   X:0010   Y:0000   P:envMxdiZc - Jump to Subroutine (Generate Random Number.
Check if # is (in desired range)
CMP 34 - Did it land below 34?
If not, return
BNE XX - If not, branch to elsewhere.
Check/store assigned spell
B1 80   LDA ($80),y[$7E:32E9]   A:0001   X:0007   Y:0003   P:envMxdizc - Load A from Character's Hand Data - Spell

Jump to magic routine
20 3E CD   JSR $CD3E  [$03:CD3E]   A:0029   X:0054   Y:0000   P:envMxdizc - Jump to Subroutine (Magic Call)

In theory it looks so simple. But the only problem would be, is the Spell over-riding the Normal Attack then? Only trouble is where could this be put and drawn from? When should it occur in the routine and most importantly and what will it be replacing in the routine itself?
Title: Re: Grimoire LD's Notes, Methods, and Hacks (All Spells & Commands Disassembly)
Post by: chillyfeez on October 08, 2013, 09:33:28 PM
Ideally, I guess the player would want the spell to occur in addition to the attack damage. I mean, if I just want to cast the spell, I'll just use the weapon as an item. But I sincerely doubt that the game is capable of doing that - there is no other instance of a single character attack that generates multiple damage calls.
You could (I think):

In theory, I think this would cast the spell (if luck deems it so), then attack, and combine the resultant damage. Setting A2-A3 to zero first would ensure that if no spell is cast, only the attack's damage would be applied (instead of, say, being added to residual values from whatever the last attack was).
Title: Re: Grimoire LD's Notes, Methods, and Hacks (All Spells & Commands Disassembly)
Post by: Grimoire LD on October 08, 2013, 10:21:30 PM
That is quite the theory. I can see no problem with it, only I find it a bit difficult to work through in our current Attack and Magic routines. Using Peep and turning it into a composite command (maybe a "Fight" command especially for Mages only, that have a chance to use these Weapon Spells when they attack.)

This would ideally be stacked with a "Weapon Charge" or "Weapon Decrement" hack, so as to make the choice a bit more tempting. I can see utilizing the Fight Command to full, and then something that loads the spell into the next action to take... it is quite a difficult theory to utilize, at least with thoughts of success.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (All Spells & Commands Disassembly)
Post by: Grimoire LD on October 09, 2013, 02:32:59 PM
Here Square, let me help you out a little with this...

Code: [Select]
$03/E153 A9 0D LDA #$0D A:0003 X:0028 Y:0000 P:envMxdizc - Load Peep into A.
$03/E155 8D D2 26 STA $26D2  [$7E:26D2] A:000D X:0028 Y:0000 P:envMxdizc  - Store A in Next Action to Take
$03/E158 9C C4 33 STZ $33C4  [$7E:33C4] A:000D X:0028 Y:0000 P:envMxdizc - Store Zero in 7E33C4.
$03/E15B 4C 3E CD JMP $CD3E  [$03:CD3E] A:000D X:0028 Y:0000 P:envMxdizc - Jump to Magic Call.

And Done!

That accomplishes the Peep Command in only 12 Bytes. When the normal command is...

94 Bytes. That frees up 82 Bytes for "Airship" Or whatever the "crash the game" skill was supposed to be. Or should it be a Mechanize skill that looks for the Third Weapon Property to work? (As all Hammers have) That will transform the Foe into a Machine? Or maybe he should get a variation on his FFIV DS skill that would turn his weapon into an Elemental, using the system laid down by Salve that looks for the first reference to an Elemental-Damage Item, and stores that in Cid's Elemental Attack.

And if we do go the Airship Route, what would it exactly do? From the sound of things it may have been intended to be an Airstrike of some sort. (After all Cid did say he had the Enterprise on Remote Control) Non-Elemental Damage on all enemies using Strength as a base, maybe? The possibilities in this regard are literally endless. (Or within 82 Bytes worth)

So please, feel free to give your own thoughts on what should be done with the freed up space left by Peep?
Title: Re: Grimoire LD's Notes, Methods, and Hacks (All Spells & Commands Disassembly)
Post by: chillyfeez on October 09, 2013, 04:03:43 PM
Nice! I only count eleven bytes, btw (even better).
When you say Peep was 94 bytes... is that hex or base 10?

Also... Has there been previous significant speculation that "crash" was originally planned to be a now-abandoned "airship" command?
The big problem with this would be the AV - are you thinking of just stealing the animation from, say, Fire3 (easy enough, but not particularly interesting)? I guess it's possible to use the actual airship's sprites for something, but I'm certainly not adequately skilled to write new animation for such a project.

I've actually been cooking up an idea for a custom Mime command. 84 bytes may well be enough to do it.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (All Spells & Commands Disassembly)
Post by: Grimoire LD on October 09, 2013, 04:26:07 PM
Did I really miscount?

Haha! I can discern coding but can't count to 11.

The discussion on Crash is somewhere on the boards, but I can't recall off the top of my head. But yes it's in just decimal, not hex.

I don't expect the command was anything flashier than a spell effect, in all honesty, if they even got that far with it. The idea that it is called "Airship" comes from the Japanese FFIV, where it is called... well Airship. It may have been intended to be used whenever Cid rejoined the group for the Giant of Bab-il section.

A Mime command, eh? That does sound intriguing. 84 bytes could possibly be enough. We know the game must store that data somewhere because the Avenger Sword works like an uncontrollable FFV Mime in many respects.

Also here's a little something to make Pray use one of two spells. Just replace this...

$03/E859   20 A6 85   JSR $85A6  [$03:85A6]   A:00EA   X:00CE   Y:0000   P:envMxdizC - Jump to Subroutine (??)
$03/E85C   A9 10   LDA #$10   A:0003   X:00CE   Y:0000   P:envMxdizC - Load 10 into A (D) (Failed Prayer)
$03/E85E   8D CA 34   STA $34CA  [$7E:34CA]   A:0010   X:00CE   Y:0000   P:envMxdizC - Store A in Battle Message Data.
$03/E861   80 08   BRA $08    [$E86B]   A:0010   X:00CE   Y:0000   P:envMxdizC - Branch Always to 03E86B

With This...


$03/E855   C9 80   CMP #$80   A:00DA   X:0049   Y:0000   P:eNvMxdizC
$03/E857   90 0A   BCC $0A    [$E863]   A:00DA   X:0049   Y:0000   P:envMxdizC
$03/E859   A9 0F   LDA #$0F   A:00DA   X:0049   Y:0000   P:envMxdizC
$03/E85B   8D D2 26   STA $26D2  [$7E:26D2]   A:000F   X:0049   Y:0000   P:envMxdizC
$03/E85E   20 3E CD   JSR $CD3E  [$03:CD3E]   A:000F   X:0049   Y:0000   P:envMxdizC


A very simple process, indeed.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (All Spells Disassembly)
Post by: Deathlike2 on October 09, 2013, 10:53:07 PM
That said, I'm not sure how the Slumber Blade worked previously... it is the only Weapon Spell Effect that did not seem 100%, but clearly the Ignore Accuracy byte was enabled normally. I think the team must not have been aware of this byte, as the Weapon Spells clearly were not meant to be 100% seeing as they have Accuracy that are in all different amounts.


AFAIK, the Slumber Sword's spell worked through Agility, through my testing.

I could be wrong, but that's how I remember it to be.

Also, am I reading this correctly?

Twin's #s are listed as such:
1/4 (64/256) chance to Comet, 1/256 chance to fail, and 195/256 chance for Burst (mini-Flare).

Now, if I could only get numbers for Double Meteor in the GBA port.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (All Spells & Commands Disassembly)
Post by: Grimoire LD on October 10, 2013, 12:06:47 AM
Hmm, Agility would have been an ideal use for Weapon Magic... but I could find no reference, maybe I wasn't looking in the right place, and I would find it strange that the Slumber Blade would be the odd weapon out.

Indeed, that's exactly how Twin works, which is why it is a very simple matter to include a third spell at a reasonable chance of occurrence rather than just "failed." which barely any player will ever see.

I thought Double Meteor was a near guarantee in FFIV:A when you had the Twin Stars? I guess I'm recalling incorrectly then. Possibly it just takes Comet's probability, and uses Comet's original slot (quite a simple "Is Character equipped with Twin Stars...  Will Comet Occur? Then BEQ to Double Meteor" Then again, I can't recall Double Meteor too well in FFIV:A.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (All Spells & Commands Disassembly)
Post by: Deathlike2 on October 10, 2013, 11:51:58 AM
I thought Double Meteor was a near guarantee in FFIV:A when you had the Twin Stars? I guess I'm recalling incorrectly then. Possibly it just takes Comet's probability, and uses Comet's original slot (quite a simple "Is Character equipped with Twin Stars...  Will Comet Occur? Then BEQ to Double Meteor" Then again, I can't recall Double Meteor too well in FFIV:A.

Double Meteor is almost guaranteed, but it's closer to 50-66, or even 75%. However, Comet and Burst still occur at a far lower rate and the chance to fail (1/256) is probably still there.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (All Spells & Commands Disassembly)
Post by: Grimoire LD on October 10, 2013, 07:25:04 PM
Hmm, that actually implies that there's a separate check before Comet/Mini-Flare that checks for Twin Stars, then goes to Double Meteor, runs it through an RNG, and moves on if it fails, to the normal choices.

Because this idea has been brewing in my mind for quite some time I decided to make Salve a versatile command. Meaning that it will no longer Require any One item, but will be able to read from all usable items. There is code that reads from the Start of Battle Items to the End of Battle Items, meaning that whichever applicable item you have first in your inventory will be the item that is used... This can be anything (except maybe the Drain and Osmose Spell Items) and it should work perfectly fine. If targeting is your issue you can set the targeting of Salve to F0 so you can freely target all enemies or allies. If your concerned about the already unused Elemental Items you can make the ones that hit all foes hit only one enemy for significant damage if you don't use multi-targeting (Balance isn't so much my concern in this regard, but to one more balance-oriented may want to change DD to Cure 3 at D0. And if someone still want it to be Purely for allies and to use only the Potions, you can use CE to D1 as the checks to make.

All that was removed was a set of instructions that didn't seem to do anything and in my testing I never saw a problem with these.

If you have any thoughts or suggestions on how to improve this, please let me know. I plan on touching up the majority of the commands in time to make them more useful or give them a varied purpose.

Failed Attempt - Used Item above DD
Code: [Select]
$03/E2E4 BD 1B 32 LDA $321B,x[$7E:321B] A:0000 X:0000 Y:0000 P:envMxdiZc - Load A from 7E321B+x (Start of Items)
$03/E2E7 C9 B0 CMP #$B0 A:0007 X:0000 Y:0000 P:envMxdizc - Is it a Battle Item or above? (It's not in this run around)
$03/E2E9 B0 14 BCS $14    [$E2FF] A:0007 X:0000 Y:0000 P:envMxdizc - If so, branch to 03E2FF.
-----------------------------------------------------------------------------------------------------------------------------------------------
$03/E2EB C8 INY A:0007 X:0000 Y:0000 P:envMxdizc +1 to Y
$03/E2EC E8 INX A:0007 X:0000 Y:0001 P:envMxdizc +1 to X
$03/E2ED E8 INX A:0007 X:0001 Y:0001 P:envMxdizc +1 to X
$03/E2EE E8 INX A:0007 X:0002 Y:0001 P:envMxdizc +1 to X
$03/E2EF E8 INX A:0007 X:0003 Y:0001 P:envMxdizc +1 to X
$03/E2F0 E0 C0 00 CPX #$00C0 A:0007 X:0004 Y:0001 P:envMxdizc - Has it checked all items?
$03/E2F3 D0 EF BNE $EF    [$E2E4] A:0007 X:0004 Y:0001 P:eNvMxdizc - If not loop back to 03E2E4.

###################################################################
$03/E2E4 BD 1B 32 LDA $321B,x[$7E:321F] A:0007 X:0004 Y:0001 P:eNvMxdizc - Load Item Slot 2 into A.
$03/E2E7 C9 B0 CMP #$B0 A:00E9 X:0004 Y:0001 P:eNvMxdizc - Is it a Battle Item or above?
$03/E2E9 B0 14 BCS $14    [$E2FF] A:00E9 X:0004 Y:0001 P:envMxdizC - If so, branch to 03E2FF.
----------------------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------------
$03/E2FF 85 FE STA $FE    [$00:00FE] A:00E9 X:0004 Y:0001 P:envMxdizC - Store Item Slot in FE.
$03/E301 C9 DD CMP #$DD A:00E9 X:0004 Y:0001 P:envMxdizC - Is it above the Final Battle Item?
$03/E303 B0 36 BCS $36    [$E33B] A:00E9 X:0004 Y:0001 P:envMxdizC - If so, branch to 03E33B
----------------------------------------------------------------------------------------------------------------------
$03/E33B CD A5 FE CMP $FEA5  [$7E:FEA5] A:00E9 X:0004 Y:0001 P:envMxdizC - Non applicable, only used for closing out of routine from hereon...
$03/E33E 8D C5 33 STA $33C5  [$7E:33C5] A:00E9 X:0004 Y:0001 P:eNvMxdizC
$03/E341 A9 0A LDA #$0A A:00E9 X:0004 Y:0001 P:eNvMxdizC
$03/E343 8D C8 34 STA $34C8  [$7E:34C8] A:000A X:0004 Y:0001 P:envMxdizC
$03/E346 A9 10 LDA #$10 A:000A X:0004 Y:0001 P:envMxdizC
$03/E348 8D C7 34 STA $34C7  [$7E:34C7] A:0010 X:0004 Y:0001 P:envMxdizC
$03/E34B 60 RTS A:0010 X:0004 Y:0001 P:envMxdizC - Return
#######################################################################

Successful Attempt - Couerl Whisker (Fatal)

Code: [Select]
$03/E2E4 BD 1B 32 LDA $321B,x[$7E:321F] A:0007 X:0004 Y:0001 P:eNvMxdizc - Load A from Item Slot +X
$03/E2E7 C9 B0 CMP #$B0 A:00C9 X:0004 Y:0001 P:eNvMxdizc - Is it a Battle Item?
$03/E2E9 B0 14 BCS $14    [$E2FF] A:00C9 X:0004 Y:0001 P:envMxdizC - If so, branch to 03E2FF.
-------------------------------------------------

------------------------------------------
$03/E2FF 85 FE STA $FE    [$00:00FE] A:00C9 X:0004 Y:0001 P:envMxdizC - Store A in FE
$03/E301 C9 DD CMP #$DD A:00C9 X:0004 Y:0001 P:envMxdizC - Is it Above the Final Battle Item?
$03/E303 B0 36 BCS $36    [$E33B] A:00C9 X:0004 Y:0001 P:eNvMxdizc - If so branch to 03E33B
$03/E305 EA NOP A:00C9 X:0004 Y:0001 P:eNvMxdizc - Null
$03/E306 EA NOP A:00C9 X:0004 Y:0001 P:eNvMxdizc - Null
$03/E307 BD 1C 32 LDA $321C,x[$7E:3220] A:00C9 X:0004 Y:0001 P:eNvMxdizc - Load Item Quantity into A
$03/E30A C9 01 CMP #$01 A:000A X:0004 Y:0001 P:envMxdizc - Is it 01 or below?
$03/E30C 90 E7 BCC $E7    [$E2F5] A:000A X:0004 Y:0001 P:envMxdizC - If so branch to 03E2F5.
$03/E30E 38 SEC A:000A X:0004 Y:0001 P:envMxdizC - Set Carry Flag.
$03/E30F BD 1C 32 LDA $321C,x[$7E:3220] A:000A X:0004 Y:0001 P:envMxdizC - Load Item Quantity into A.
$03/E312 E9 01 SBC #$01 A:000A X:0004 Y:0001 P:envMxdizC - -1 to A
$03/E314 9D 1C 32 STA $321C,x[$7E:3220] A:0009 X:0004 Y:0001 P:envMxdizC - Store A in Item Quantity
$03/E317 D0 0B BNE $0B    [$E324] A:0009 X:0004 Y:0001 P:envMxdizC - Branch if not 00 to 03E324.
------------------------------------------------------------------

-----------------------------------------------------------------
$03/E324 98 TYA A:0009 X:0004 Y:0001 P:envMxdizC - Transfer Y to A.
$03/E325 85 01 STA $01    [$00:0001] A:0001 X:0004 Y:0001 P:envMxdizC - Store 01 into A.
$03/E327 A9 06 LDA #$06 A:0001 X:0004 Y:0001 P:envMxdizC - Load 06 into A
$03/E329 20 85 80 JSR $8085  [$03:8085] A:0006 X:0004 Y:0001 P:envMxdizC - Jump to Subroutine (A lot of jumping, a lot of things that don't make much sense to me)
$03/E32C A9 F8 LDA #$F8 A:0000 X:7510 Y:0018 P:envMxdiZc - Load A from F8 (Targeting matters)
$03/E32E 8D D4 26 STA $26D4  [$7E:26D4] A:00F8 X:7510 Y:0018 P:eNvMxdizc - Store A in 7E26D4 (Targeting)
$03/E331 A5 FE LDA $FE    [$00:00FE] A:00F8 X:7510 Y:0018 P:eNvMxdizc - Load Item placed in FE. (Fatal)
$03/E333 8D D2 26 STA $26D2  [$7E:26D2] A:00C9 X:7510 Y:0018 P:eNvMxdizc - Store Fatal in Next Action to Take.
$03/E336 EE 2A 35 INC $352A  [$7E:352A] A:00C9 X:7510 Y:0018 P:eNvMxdizc - +1 to 7E352A.
$03/E339 20 3E CD JSR $CD3E  [$03:CD3E] A:00C9 X:7510 Y:0018 P:envMxdizc - Jump to Subroutine (Magic Call)
$03/E33C A5 FE LDA $FE    [$00:00FE] A:00F0 X:0680 Y:001A P:eNvMxdizC - Load Item from FE's Graphic.
$03/E33E 8D C5 33 STA $33C5  [$7E:33C5] A:00C9 X:0680 Y:001A P:eNvMxdizC - Store A in 7E33C5 (Graphics)
$03/E341 A9 0A LDA #$0A A:00C9 X:0680 Y:001A P:eNvMxdizC - Load Message (Salve)
$03/E343 8D C8 34 STA $34C8  [$7E:34C8] A:000A X:0680 Y:001A P:envMxdizC - Store A in Battle Message Small
$03/E346 A9 10 LDA #$10 A:000A X:0680 Y:001A P:envMxdizC - Load 10 into A.
$03/E348 8D C7 34 STA $34C7  [$7E:34C7] A:0010 X:0680 Y:001A P:envMxdizC - Store A in 7E34C7.
$03/E34B 60 RTS A:0010 X:0680 Y:001A P:envMxdizC - Return

Process in Pictures...

Salve on All Foes
(http://i112.photobucket.com/albums/n198/LastingDawn/FFIV-SalveonAllFoes_zps85fe16dc.png) (http://s112.photobucket.com/user/LastingDawn/media/FFIV-SalveonAllFoes_zps85fe16dc.png.html)

Salve Failing
(http://i112.photobucket.com/albums/n198/LastingDawn/FFIV-SalveFailing_zpse94b25d6.png) (http://s112.photobucket.com/user/LastingDawn/media/FFIV-SalveFailing_zpse94b25d6.png.html)

Salve Failed Because of the Item in the second slot having too high of a value.
(http://i112.photobucket.com/albums/n198/LastingDawn/FFIV-SalveFailedBecauseofinapplicableitemused_zps071787ea.png) (http://s112.photobucket.com/user/LastingDawn/media/FFIV-SalveFailedBecauseofinapplicableitemused_zps071787ea.png.html)

Now the Items are Switched!
(http://i112.photobucket.com/albums/n198/LastingDawn/FFIV-Nowtheitemsareswitched_zpsac25b834.png) (http://s112.photobucket.com/user/LastingDawn/media/FFIV-Nowtheitemsareswitched_zpsac25b834.png.html)


Salve is Successfully Cast!
(http://i112.photobucket.com/albums/n198/LastingDawn/FFIV-Salveissuccessfullycast_zps7c0c1534.png) (http://s112.photobucket.com/user/LastingDawn/media/FFIV-Salveissuccessfullycast_zps7c0c1534.png.html)

Title: Re: Grimoire LD's Notes, Methods, and Hacks (All Spells & Commands Disassembly)
Post by: Grimoire LD on October 10, 2013, 10:37:12 PM
Ideally, I guess the player would want the spell to occur in addition to the attack damage. I mean, if I just want to cast the spell, I'll just use the weapon as an item. But I sincerely doubt that the game is capable of doing that - there is no other instance of a single character attack that generates multiple damage calls.
You could (I think):
  • Store zero in 00A2-00A3 (end damage result location)
  • Check for weapon spell
  • If none, jump down to regular attack routine
  • RNG
  • Check if random number is within range
  • If not, jump to regular attack routine
  • Load weapon spell
  • Jump to spell subroutine (which will return here when finished)
  • Regular attack routine
  • Add attack result to 00A2-00A3

In theory, I think this would cast the spell (if luck deems it so), then attack, and combine the resultant damage. Setting A2-A3 to zero first would ensure that if no spell is cast, only the attack's damage would be applied (instead of, say, being added to residual values from whatever the last attack was).

This game is surprisingly versatile! Even moreso than I thought!

I just tested a very simple process...

$03/E153   A9 1C   LDA #$1C   A:0003   X:0028   Y:0000   P:envMxdizc - Load Spell into A.
$03/E155   8D D2 26   STA $26D2  [$7E:26D2]   A:001C   X:0028   Y:0000   P:envMxdizc - Store A in Next Action.
$03/E158   9C C4 33   STZ $33C4  [$7E:33C4]   A:001C   X:0028   Y:0000   P:envMxdizc - Store Zero in 7E33C4.
$03/E15B   20 3E CD   JSR $CD3E  [$03:CD3E]   A:001C   X:0028   Y:0000   P:envMxdizc - Jump to Magic Call.
$03/E15E   A9 C0   LDA #$C0   A:0020   X:0680   Y:001A   P:envMxdizC - Load Attack Graphic into A
$03/E160   8D C4 33   STA $33C4  [$7E:33C4]   A:00C0   X:0680   Y:001A   P:eNvMxdizC - Store A in Audio/Visual Code.
$03/E163   4C 99 C4   JMP $C499  [$03:C499]   A:00C0   X:0680   Y:001A   P:eNvMxdizC - Jump to Fight Routine.


Remarkably this is All You Need to have the game use Magic, then attack and to my vast surprise, while it shows only one damage, it is Accumulated Damage from the command. So say you're doing 200 Damage with an attack. Say you add Lit-3 onto that damage with a Low Wisdom character and you'll see that shoot up to roughly 1500-1700 damage. This is in addition. The game will show the normal attack animation, then the magic graphic, making it look seamless and may I say, beautiful.

Add a few conditions to that (maybe intelligently look for the magic by looking at the Weapon itself) and we have Exactly that, (the above was just a proof of concept). For as sometimes poorly coded as FFIV sometimes seems to be, there are times when it shines and this is definitely one of those times. It looks like making a separate Fight command for Mages or a revamped Fight Command is close on the horizon!
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Magic Activating with Fight!)
Post by: chillyfeez on October 11, 2013, 12:19:44 AM
Wow, good stuff. Nice going, Grimoire!
Title: Re: Grimoire LD's Notes, Methods, and Hacks (All Spells & Commands Disassembly)
Post by: Deathlike2 on October 11, 2013, 01:14:09 AM
Remarkably this is All You Need to have the game use Magic, then attack and to my vast surprise, while it shows only one damage, it is Accumulated Damage from the command. So say you're doing 200 Damage with an attack. Say you add Lit-3 onto that damage with a Low Wisdom character and you'll see that shoot up to roughly 1500-1700 damage. This is in addition. The game will show the normal attack animation, then the magic graphic, making it look seamless and may I say, beautiful.

Add a few conditions to that (maybe intelligently look for the magic by looking at the Weapon itself) and we have Exactly that, (the above was just a proof of concept). For as sometimes poorly coded as FFIV sometimes seems to be, there are times when it shines and this is definitely one of those times. It looks like making a separate Fight command for Mages or a revamped Fight Command is close on the horizon!

That is what FF4A already does to specific weapons, like the Lightbringer, Abel's Lance, and Fiery Hammer.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Magic Activating with Fight!)
Post by: Grimoire LD on October 11, 2013, 07:51:24 AM
Thanks Chillyfeez!

Indeed DeathLike2. I thought they must have added a fair amount of code to make that possible, but it doesn't appear to be the case whatsoever. All I did was take Peep's formula and cannibalized it to create something very different, but still something quite simple. Do FFIV:A have the means to change the magic cast from those specific weapons? (I mean, has it been found?) because if not, it may be a CMP added to the Fight routine to check to see if those work and then go into the Magic Routine to accomplish the specific spells.

I can see a new class idea come out of this though, "MKnight" "Can use the latent power of weaponry with the Fight Command".  Or something to that accord. Sort of like what I pictured Baigan being in a couple of ways.

So Salve is down, that has been made more versatile. A separate Fight command can be made, so that takes care of Fight, I wonder what I should try to modify next... Maybe work on Cid's FFIV:DS "Elemental Weapon" command?
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Magic Activating with Fight!)
Post by: chillyfeez on October 11, 2013, 08:39:14 AM
Question: when using your code, does the spell cost MP?
If not, how does it know not to (since it's using the magic routine)? And is it possible to make it cost MP? This would take a bit of the cheap out of a theorhetical MKnight's special command...
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Magic Activating with Fight!)
Post by: chillyfeez on October 11, 2013, 11:53:26 AM
Also, what would happen, in theory, if the character was using a bow and arrow, and both had a spell assignment?
Would the game only use the spell of the weapon in the dominant hand, or would both spells be cast?
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Magic Activating with Fight!)
Post by: Deathlike2 on October 11, 2013, 02:29:31 PM
Indeed DeathLike2. I thought they must have added a fair amount of code to make that possible, but it doesn't appear to be the case whatsoever. All I did was take Peep's formula and cannibalized it to create something very different, but still something quite simple. Do FFIV:A have the means to change the magic cast from those specific weapons? (I mean, has it been found?) because if not, it may be a CMP added to the Fight routine to check to see if those work and then go into the Magic Routine to accomplish the specific spells.

I don't know, but just from testing, I believe it's just another branch of code that determines from the RNG whether or not to execute (with probabilities) with Abel's Lance being a special case using Kain's level to determine success.

It would be nice to know how often it works for the other two weapons. I'm sure you could change the spell used if you wanted to (using the associated attributes of Wisdom/Intelligence and Will Power/Spirit depending on the spell).

Question: when using your code, does the spell cost MP?
If not, how does it know not to (since it's using the magic routine)? And is it possible to make it cost MP? This would take a bit of the cheap out of a theorhetical MKnight's special command...

Chances are, the spell command (White/Black/Summon/Ninjutsu) is doing the MP deduction, so LD's design skips that step unless that is manually added into the Fight or new command code.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Magic Activating with Fight!)
Post by: Grimoire LD on October 11, 2013, 04:15:22 PM
Question: when using your code, does the spell cost MP?
If not, how does it know not to (since it's using the magic routine)? And is it possible to make it cost MP? This would take a bit of the cheap out of a theorhetical MKnight's special command...

DeathLike2 had the right idea with his response, but I did find the actual byte which says whether to use MP and that was in Recall's routine...

"So to have Recall not take any MP it is as simple as changing this...


$03/EABC   EE 5D 35   INC $355D  [$7E:355D]   A:0019   X:000F   Y:0003   P:envMxdizc - +1 to 7E355D.

To this...

$03/EABC   9C 5D 35   STZ $355D  [$7E:355D]   A:0020   X:0009   Y:0003   P:envMxdizc - Store Zero in 7E355D."

Adding that +1 to 7E355D signals to the game to use that spell's MP to cast it.

As for checking to see if you have enough MP to use said spell, that too is in Recall...

"
$03/EA9B   AD 8B 26   LDA $268B  [$7E:268B]   A:0000   X:000F   Y:0003   P:envMxdiZC - Load Caster's MP Byte 1.
$03/EA9E   85 A9   STA $A9    [$00:00A9]   A:00E7   X:000F   Y:0003   P:eNvMxdizC - Store A in A9.
$03/EAA0   AD 8C 26   LDA $268C  [$7E:268C]   A:00E7   X:000F   Y:0003   P:eNvMxdizC - Load Caster's MP Byte 2.
$03/EAA3   F0 04   BEQ $04    [$EAA9]   A:0003   X:000F   Y:0003   P:envMxdizC - Branch if not 00 to 03EAA9.
-------------------------------------------------------------------------------------------------------------------------------------------------
$03/EAA5   A9 FF   LDA #$FF   A:0003   X:000F   Y:0003   P:envMxdizC - Load FF into A. (Assumes you have enough MP to cast spell)
$03/EAA7   85 A9   STA $A9    [$00:00A9]   A:00FF   X:000F   Y:0003   P:eNvMxdizC - Store A in A9.
-----------------------------------------------------------------------------------------------------------------------------------------------
$03/EAA9   AD A1 28   LDA $28A1  [$7E:28A1]   A:00FF   X:000F   Y:0003   P:eNvMxdizC - Load A from Spell's MP Cost.
$03/EAAC   29 7F   AND #$7F   A:0007   X:000F   Y:0003   P:envMxdizC - Get rid of negative bits.
$03/EAAE   C5 A9   CMP $A9    [$00:00A9]   A:0007   X:000F   Y:0003   P:envMxdizC - Is it the same as what is in A9?
$03/EAB0   F0 06   BEQ $06    [$EAB8]   A:0007   X:000F   Y:0003   P:envMxdizc - Branch if Equal to 03EAB8.
$03/EAB2   90 04   BCC $04    [$EAB8]   A:0007   X:000F   Y:0003   P:envMxdizc - Branch  if More to 03EAB8.
-------------------------------------------------------------------------------------------------------------------------------------------------
$03/EAB4   68    PLA   A:0005   X:0009   Y:0003   P:envMxdizC - Pull A.
$03/EAB5   4C C2 EA   JMP $EAC2  [$03:EAC2]   A:0020   X:0009   Y:0003   P:envMxdizC - Jump to Routine (Return)
-------------------------------------------------------------------------------------------------------------------------------------------------
$03/EAB8   68    PLA   A:0007   X:000F   Y:0003   P:envMxdizc - Pull A from Stack (retrieving the spell to be cast)
$03/EAB9   8D D2 26   STA $26D2  [$7E:26D2]   A:0019   X:000F   Y:0003   P:envMxdizc - Store A in Caster's Action to be Taken.
$03/EABC   EE 5D 35   INC $355D  [$7E:355D]   A:0019   X:000F   Y:0003   P:envMxdizc - +1 to 7E355D.
$03/EABF   20 46 CC   JSR $CC46  [$03:CC46]   A:0019   X:000F   Y:0003   P:envMxdizc - Jump to Subroutine (Magic Call - Full)
$03/EAC2   60    RTS   A:00E0   X:0680   Y:001A   P:eNvMxdizC - Return
"
Granted that uses up a fair amount of bytes. What would be easier is a way to make the command unusable at 00 MP. Which is a very easy thing to set up whether inside the command or outside of it.

Now spells that are drawn from weapons are purely on a weapon by weapon basis.

There is an unknown (and possibly unused) byte in weapons that I think could be replaced and used for this as a secondary "Spell Check" so to speak. So that it can't be cast by just using the weapon.  Now the way I would set this up is to check the character's equipment (7E2780+), look in the Right Hand, then if inapplicable look in the Left Hand, meaning that only one instance of a spell would occur as the game would branch to the next part of the routine. But let me see if the game is capable of recognizing two magic commands in  a single routine for theories sake...

The game does not take kindly to casting two spells in one action, it seems. Either that or I'm missing something, which is completely possible. I might need to look back at the Summon section of data to see how that works since that is technically two spells, even if one is just the Summoning Preparation.



Title: Re: Grimoire LD's Notes, Methods, and Hacks (Magic Activating with Fight!)
Post by: chillyfeez on October 11, 2013, 04:42:16 PM
When you cast a spell, the game checks if it is in the summon range, if so then it changes the value in the sub-action byte to the appropriate actual spell. It's a pretty straightforward process, but probably not very useful for what you're trying to do.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Magic Activating with Fight!)
Post by: Grimoire LD on October 11, 2013, 06:45:14 PM
Hmm, yeah. I don't think the game is capable of showing one spell after another, unless there is something I'm missing. Otherwise the game will choose the last spell on the list. But I suspect that the game will be able to use several commands at once.

Well though I haven't yet got Steal to work like I want it to (Take away the Item Byte when it is achieved.) I did manage to add an FFIV:A capability to it which effectively makes it Mug.

The first ten bytes of Steal are this...

$03/E1CC   A9 17   LDA #$17   A:0003   X:002E   Y:0000   P:envMxdizc - Load 17 into A.
$03/E1CE   8D C8 34   STA $34C8  [$7E:34C8]   A:0017   X:002E   Y:0000   P:envMxdizc - Store A in 7E34C8
$03/E1D1   A9 10   LDA #$10   A:0017   X:002E   Y:0000   P:envMxdizc - Load 10 into A.
$03/E1D3   8D C7 34   STA $34C7  [$7E:34C7]   A:0010   X:002E   Y:0000   P:envMxdizc - Store A in 7E34C7

Which I've come to learn are just "Put Name of Command (In this case "Sneak" into a Message Box". Things that can easily be replaced. Besides, if we're using the skill we clearly know what skill is being used.

My replacement takes these ten bytes and does this...

$03/E1CC   AD B2 26   LDA $26B2  [$7E:26B2]   A:0003   X:002E   Y:0000   P:envMxdizc - Load Caster's Gauntlet into A.
$03/E1CF   C9 9D   CMP #$9D   A:009D   X:002E   Y:0000   P:eNvMxdizc - Is it Shadow Gauntlets? (For testing)
$03/E1D1   D0 03   BNE $03    [$E1D6]   A:009D   X:002E   Y:0000   P:envMxdiZC - If not, branch to 03E1D6 (rest of normal routine)
$03/E1D3   20 99 C4   JSR $C499  [$03:C499]   A:009D   X:002E   Y:0000   P:envMxdiZC - Jump to Fight Routine.

So whether you succeed, or fail. You will always deal some damage, making Steal on its own worthwhile if you have the right Gauntlet equipped.

It is so simple to do this, yet I cannot figure how to write a 00 into an item byte into a successful steal, oy...
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Magic Activating with Fight!)
Post by: Grimoire LD on October 11, 2013, 07:33:26 PM
Let's finish this right! Just because I can't access it doesn't meant I can't jump to it.

Enemy Runs Away - Routine

Code: [Select]
$03/E1B2 A9 04 LDA #$04 A:0003 X:0028 Y:0000 P:envMxdizc - Load 04 into A.
$03/E1B4 8D E6 38 STA $38E6  [$7E:38E6] A:0004 X:0028 Y:0000 P:envMxdizc - Store A in 7E38E6
$03/E1B7 A6 A6 LDX $A6    [$00:00A6] A:0004 X:0028 Y:0000 P:envMxdizc - Load X from A6
$03/E1B9 BD 03 20 LDA $2003,x[$7E:2003] A:0004 X:0000 Y:0000 P:envMxdiZc - Load Indexed Slot's Status Byte 1 into A.
$03/E1BC 09 80 ORA #$80 A:0000 X:0000 Y:0000 P:envMxdiZc - Add 80 (Death) if applicable.
$03/E1BE 9D 03 20 STA $2003,x[$7E:2003] A:0080 X:0000 Y:0000 P:eNvMxdizc - Store A in Indexed Slot's Status Byte 1.
$03/E1C1 A9 05 LDA #$05 A:0080 X:0000 Y:0000 P:eNvMxdizc - Load 05 into A. (Ran Away)
$03/E1C3 8D CA 34 STA $34CA  [$7E:34CA] A:0005 X:0000 Y:0000 P:envMxdizc  - Store A in 7E34CA.
$03/E1C6 EE 0A 39 INC $390A  [$7E:390A] A:0005 X:0000 Y:0000 P:envMxdizc - +1 to 7E390A.
$03/E1C9 4C 9B 85 JMP $859B  [$03:859B] A:0005 X:0000 Y:0000 P:envMxdizc - Jump to Subroutine
$03/859B A9 F8 LDA #$F8 A:0005 X:0000 Y:0000 P:envMxdizc - Load F8 into A.
$03/859D 8D C2 33 STA $33C2  [$7E:33C2] A:00F8 X:0000 Y:0000 P:eNvMxdizc - Store A in 7E33C2.
$03/85A0 A9 03 LDA #$03 A:00F8 X:0000 Y:0000 P:eNvMxdizc - Load 03 into A.
$03/85A2 8D C3 33 STA $33C3  [$7E:33C3] A:0003 X:0000 Y:0000 P:envMxdizc - Store A in 7E33C3.
$03/85A5 60 RTS A:0003 X:0000 Y:0000 P:envMxdizc - Return

I'm of the opinion that this is completely unused by the game. The game opts to use Retreat over "Ran Away". What this might have been is possibly for a scrapped "Feared Away" sequence if an enemies Steal Prevention dropped too low, like in FFI and II (maybe III as well, can't recall). I never recalled "Ran Away" showing up in-game and it does give you the Exp as if you had defeated the foe, unlike Retreat does.

Though my memory could just be faulty.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Magic Activating with Fight!)
Post by: assassin on October 12, 2013, 06:55:29 AM
out of curiosity, how big is FF4's Battle Mechanics code?  in FF6, it's a little under half of a bank (C2), so about 26000 bytes.  exclude graphics and menu displaying stuff from this if possible.  (in FF6, i'm including the menu setups, but not their tile drawing or cursor navigation.)
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Magic Activating with Fight!)
Post by: Grimoire LD on October 12, 2013, 07:30:35 AM
I believe that is generally unknown. FFIV has not been explored to the same extent as FFVI has been. It is difficult to even place a possible starting point, but if I had to I would say likely say this... 038000 to 03FFFF. I cannot get the game to breakpoint in battle before 038000 and I've never seen a 04XXXX value in battle.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Magic Activating with Fight!)
Post by: Deathlike2 on October 12, 2013, 01:10:58 PM
While you're at it... it would be nice to know how dropping money works (the probabilities) and if they are modified by anything (Cry is the only logical choice).
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Magic Activating with Fight!)
Post by: Grimoire LD on October 12, 2013, 05:53:35 PM
Hmm, yeah I'll take a look and see if I can't find anything in that regards.

This is it...

Code: [Select]
$03/8840 20 8B 85 JSR $858B  [$03:858B] A:0000 X:00C0 Y:0060 P:envMxdiZC - Generate Random Number (I have reason to believe this routine loads from 0-100 only not 0-256)
$03/8843 C9 32 CMP #$32 A:0014 X:0000 Y:0060 P:envMxdizc - Is it 32 or more?
$03/8845 B0 03 BCS $03    [$884A] A:0014 X:0000 Y:0060 P:eNvMxdizc  - If so branch to 03884A.
$03/8847 4C 20 89 JMP $8920  [$03:8920] A:0014 X:0000 Y:0060 P:eNvMxdizc - Jump to Subroutine (Return out of routine)
$03/8920 60 RTS A:0014 X:0000 Y:0060 P:eNvMxdizc

But there's something more here...
Code: [Select]
$03/883F 60 RTS A:0000 X:0280 Y:000F P:envMxdiZC (The routine before this is difficult to ascertain other than its cleaning statuses)
$03/871B 20 86 F1 JSR $F186  [$03:F186] A:0000 X:0280 Y:000F P:envMxdiZC - Jump to Subroutine 03F186
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/F186 7B TDC A:0000 X:0280 Y:000F P:envMxdiZC - Transfer Direct Page
$03/F187 AA TAX A:0000 X:0280 Y:000F P:envMxdiZC - Transfer A to X
$03/F188 A8 TAY A:0000 X:0000 Y:000F P:envMxdiZC - Transfer A to Y
$03/F189 BD 41 20 LDA $2041,x[$7E:2041] A:0000 X:0000 Y:0000 P:envMxdiZC - Load Slot 1's Unknown(41) into A.
$03/F18C 9D 2D 20 STA $202D,x[$7E:202D] A:0002 X:0000 Y:0000 P:envMxdizC - Store A in Slot 1's ?Critical Hit Chance? (I wonder why...)
$03/F18F BD 42 20 LDA $2042,x[$7E:2042] A:0002 X:0000 Y:0000 P:envMxdizC - Load Slot 1's Unknown(42) into A.
$03/F192 9D 2E 20 STA $202E,x[$7E:202E] A:0014 X:0000 Y:0000 P:envMxdizC - Store A in Slot 1's Critical Hit Damage bonus.
$03/F195 B9 BF 38 LDA $38BF,y[$7E:38BF] A:0014 X:0000 Y:0000 P:envMxdizC - Load 7E38BF into A.
$03/F198 9D 03 20 STA $2003,x[$7E:2003] A:0000 X:0000 Y:0000 P:envMxdiZC - Store A in Slot 1's Status Byte 1.
$03/F19B B9 C0 38 LDA $38C0,y[$7E:38C0] A:0000 X:0000 Y:0000 P:envMxdiZC - Load 7E38C0 into A.
$03/F19E 9D 04 20 STA $2004,x[$7E:2004] A:0000 X:0000 Y:0000 P:envMxdiZC - Store A in Slot 1's Status Byte 2.
$03/F1A1 B9 C1 38 LDA $38C1,y[$7E:38C1] A:0000 X:0000 Y:0000 P:envMxdiZC - Load A in 7E38C1.
$03/F1A4 9D 06 20 STA $2006,x[$7E:2006] A:0000 X:0000 Y:0000 P:envMxdiZC - Store A in Slot 1's Status Byte 3.
$03/F1A7 20 BC 85 JSR $85BC  [$03:85BC] A:0000 X:0000 Y:0000 P:envMxdiZC - Jump to Subroutine (From here on it is a repeating cycle of 80 to reach all necessary points)

Well here's something of note... it's how the game takes the values from in-battle and puts them back into the normal positions.

Code: [Select]
$03/F1B2 7B TDC A:0000 X:0280 Y:000F P:envMxdiZC - Transfer Direct Page.
$03/F1B3 AA TAX A:0000 X:0280 Y:000F P:envMxdiZC - Transfer A to X.
$03/F1B4 A8 TAY A:0000 X:0000 Y:000F P:envMxdiZC - Transfer A to Y.
$03/F1B5 64 A9 STZ $A9    [$00:00A9] A:0000 X:0000 Y:0000 P:envMxdiZC - Store Zero in A9.
$03/F1B7 64 AB STZ $AB    [$00:00AB] A:0000 X:0000 Y:0000 P:envMxdiZC - Store Zero in AB.
$03/F1B9 BD 00 20 LDA $2000,x[$7E:2000] A:0000 X:0000 Y:0000 P:envMxdiZC - Load 2000 into A.
$03/F1BC 99 00 10 STA $1000,y[$7E:1000] A:0081 X:0000 Y:0000 P:eNvMxdizC - Store it into A.
$03/F1BF E8 INX A:0081 X:0000 Y:0000 P:eNvMxdizC - +1 X
$03/F1C0 C8 INY A:0081 X:0001 Y:0000 P:envMxdizC - +1 Y
$03/F1C1 E6 AB INC $AB    [$00:00AB] A:0081 X:0001 Y:0001 P:envMxdizC - +1 AB
$03/F1C3 A5 AB LDA $AB    [$00:00AB] A:0081 X:0001 Y:0001 P:envMxdizC - Load AB into A.
$03/F1C5 C9 40 CMP #$40 A:0001 X:0001 Y:0001 P:envMxdizC - Rinse and repeat until you fill up the unit's stats.
$03/F1C7 D0 F0 BNE $F0    [$F1B9] A:0001 X:0001 Y:0001 P:eNvMxdizc - As above.
--------------------------------------------------------

Do this 5 times for each party member...

Code: [Select]
$03/F1D0 AA TAX A:0080 X:0040 Y:0040 P:envmxdizc - Transfer A to X
$03/F1D1 7B TDC A:0080 X:0080 Y:0040 P:envmxdizc - Transfer Direct Page.
$03/F1D2 E2 20 SEP #$20 A:0000 X:0080 Y:0040 P:envmxdiZc - Set Processor.
$03/F1D4 E6 A9 INC $A9    [$00:00A9] A:0000 X:0080 Y:0040 P:envMxdiZc - +1 A9.
$03/F1D6 A5 A9 LDA $A9    [$00:00A9] A:0000 X:0080 Y:0040 P:envMxdizc - Load A9 into A
$03/F1D8 C9 05 CMP #$05 A:0001 X:0080 Y:0040 P:envMxdizc - Is it 5?
$03/F1DA D0 DB BNE $DB    [$F1B7] A:0001 X:0080 Y:0040 P:eNvMxdizc - If not, branch back to 03F1B7 to properly transfer data

Item Storing into Outside of Battle Space.

Code: [Select]
$03/F1DC 7B TDC A:0005 X:0280 Y:0140 P:envMxdiZC - Transfer Direct Page.
$03/F1DD AA TAX A:0000 X:0280 Y:0140 P:envMxdiZC - Transfer A to X.
$03/F1DE A8 TAY A:0000 X:0000 Y:0140 P:envMxdiZC - Transfer A to Y.
$03/F1DF 86 A9 STX $A9    [$00:00A9] A:0000 X:0000 Y:0000 P:envMxdiZC - Store X in A9.
$03/F1E1 BD 1B 32 LDA $321B,x[$7E:321B] A:0000 X:0000 Y:0000 P:envMxdiZC - Load Item Battle Spot.
$03/F1E4 99 40 14 STA $1440,y[$7E:1440] A:00C9 X:0000 Y:0000 P:eNvMxdizC - Store A in Item Spot.
$03/F1E7 F0 04 BEQ $04    [$F1ED] A:00C9 X:0000 Y:0000 P:eNvMxdizC - If 00 branch to 03F1ED.
$03/F1E9 C9 60 CMP #$60 A:00C9 X:0000 Y:0000 P:eNvMxdizC - Do this 60 times.
$03/F1EB D0 06 BNE $06    [$F1F3] A:00C9 X:0000 Y:0000 P:envMxdizC - If not done, branch to 03F1F3.
$03/F1F9 D0 04 BNE $04    [$F1FF] A:0002 X:0000 Y:0000 P:envMxdizC
$03/F1FF E8 INX A:0002 X:0000 Y:0000 P:envMxdizC - +1 to X
$03/F200 E8 INX A:0002 X:0001 Y:0000 P:envMxdizC - +1 to X
$03/F201 E8 INX A:0002 X:0002 Y:0000 P:envMxdizC - +1 to X
$03/F202 E8 INX A:0002 X:0003 Y:0000 P:envMxdizC - +1 to X.
$03/F203 C8 INY A:0002 X:0004 Y:0000 P:envMxdizC - +1 to Y.
$03/F204 C8 INY A:0002 X:0004 Y:0001 P:envMxdizC - +1 to Y.
$03/F205 E6 A9 INC $A9    [$00:00A9] A:0002 X:0004 Y:0002 P:envMxdizC +1 to A9.
$03/F207 A5 A9 LDA $A9    [$00:00A9] A:0002 X:0004 Y:0002 P:envMxdizC - Load A9.
$03/F209 C9 30 CMP #$30 A:0001 X:0004 Y:0002 P:envMxdizC - Has it done this 30 times?
$03/F20B D0 D4 BNE $D4    [$F1E1] A:0001 X:0004 Y:0002 P:eNvMxdizc - If not branch back to 03F1E1.

And there you have it! The chance to drop money when you run is purely a 50/50 chance  32/64 (because if it were 80/100  205/255 we would have noticed a long time ago)



Title: Re: Grimoire LD's Notes, Methods, and Hacks (Magic Activating with Fight!)
Post by: Grimoire LD on October 13, 2013, 12:41:20 AM
I rather like FFI and I think that some of its formulas could be put into FFIV and not seem that out of place. So my current goal is to replace (what I deem to be) useless or rare formulas, to make formulas that are more in-line with FFI's own. Now there might be a method to use some of the unused spell routine slots,  but I'm not 100% ready to go that far yet. But it would save a few formulas if it worked.

LOCK - (Focus - -Evasion Which will actually work in this hack!)

Replacing Tornado/Weak's formula


Lock Routine
Code: [Select]
$03/D453 AD 29 27 LDA $2729  [$7E:2729] A:0003 X:0006 Y:0000 P:envMxdizc - Load Target's Evasion into A.
$03/D456 ED 9D 28 SBC $289D  [$7E:289D] A:0000 X:0006 Y:0000 P:envMxdiZc - Subtract A from Lock's Spell Power.
$03/D459 10 02 BPL $02    [$D45D] A:00E6 X:0006 Y:0000 P:eNvMxdizc - If it is a positive number branch to 03D45D.
$03/D45B A9 00 LDA #$00 A:00E6 X:0006 Y:0000 P:eNvMxdizc - Load 00 into A.
$03/D45D 8D 29 27 STA $2729  [$7E:2729] A:0000 X:0006 Y:0000 P:envMxdiZc - Store A in Target's Evasion.
$03/D460 60 RTS A:0000 X:0006 Y:0000 P:envMxdiZc - Return

Replaces Shell Routine -
SLOW - Slow1 Routine (Basically the same as above. Both sequences are the same.) - Reduces Target's Accuracy
Code: [Select]
$03/D873 AD 1C 27 LDA $271C  [$7E:271C] A:0003 X:001C Y:FFFF P:envMxdizc - Load Target's Accuracy into A.
$03/D876 ED 9D 28 SBC $289D  [$7E:289D] A:004B X:001C Y:FFFF P:envMxdizc - Subtract A from Spell Power.
$03/D879 10 02 BPL $02    [$D87D] A:003B X:001C Y:FFFF P:envMxdizC - If it is still positive, branch to 03D87D.
-------------------------------------------------------------------------------------------------------------
(Same as above)
------------------------------------------------------------------------------------------------------------
$03/D87D 8D 1C 27 STA $271C  [$7E:271C] A:003B X:001C Y:FFFF P:envMxdizC - Store A in Target's Accuracy.
$03/D880 60 RTS A:003B X:001C Y:FFFF P:envMxdizC - Return


Replacing Modify Speed.

TMPR - Temper - Increases Attack.

Code: [Select]
$03/D897 AD 82 26 LDA $2682  [$7E:2682] A:0003 X:001E Y:0000 P:envMxdizc - Load Caster's Level into A.
$03/D89A 4A LSR A A:000A X:001E Y:0000 P:envMxdizc - Divide A by 2.
$03/D89B AA TAX A:0005 X:001E Y:0000 P:envMxdizc - Transfer A to X.
$03/D89C AD 1D 27 LDA $271D  [$7E:271D] A:0005 X:0005 Y:0000 P:envMxdizc - Load Target's Attack Base into A.
$03/D89F 8E A9 00 STX $00A9  [$7E:00A9] A:003C X:0005 Y:0000 P:envMxdizc - Store Caster's Level /2 into A9.
$03/D8A2 6D A9 00 ADC $00A9  [$7E:00A9] A:003C X:0005 Y:0000 P:envMxdizc - Add A9 onto A.
$03/D8A5 C9 FF CMP #$FF A:0041 X:0005 Y:0000 P:envMxdizc - Is it FF?
$03/D8A7 90 02 BCC $02    [$D8AB] A:0041 X:0005 Y:0000 P:envMxdizc - If it is below FF branch to 03D8AB.
----------------------------------------------------------------------------------------------------------------------------------------------------------
(Load FF into A to prevent an overflow)
---------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/D8AB 8D 1D 27 STA $271D  [$7E:271D] A:0041 X:0005 Y:0000 P:envMxdizc - Store A in 7E271D.
$03/D8AE 60 RTS A:0041 X:0005 Y:0000 P:envMxdizc - Return

This works a bit different from the other spells and that's to give Temper a use all game long, technically. It will boost attack in this manner... Attack + Level/2. So it will continue to scale as you level up.

Replaces Hug
FAST - FFI Haste (+1 Attack Multiplier)

Code: [Select]
$03/DCFB AD 1B 27 LDA $271B  [$7E:271B] A:0003 X:0048 Y:0000 P:envMxdizc - Load Target's Attack Multiplier into A.
$03/DCFE 1A INC A A:0002 X:0048 Y:0000 P:envMxdizc - +1 to A.
$03/DCFF C9 0B CMP #$0B A:0003 X:0048 Y:0000 P:envMxdizc -Is it 0B?
$03/DD01 90 02 BCC $02    [$DD05] A:0003 X:0048 Y:0000 P:eNvMxdizc - If Lower than 0B branch to 03DD01.
------------------------------------------------------------
(Set it back to 0A)
-----------------------------------------------------------
$03/DD05 8D 1B 27 STA $271B  [$7E:271B] A:0003 X:0048 Y:0000 P:eNvMxdizc - Store A in Target's Attack Multiplier into A
$03/DD08 60 RTS A:0003 X:0048 Y:0000 P:eNvMxdizc - Return

I am Well aware of how easy a spell like this would be to abuse in FFIV, I'm not even sure if setting it to a Max of 10 Attack Multipliers is fair. I may have to go lower to balance it a little further, I'm not sure in what way though.

Replaces Reaction

SLO2 - Slowra (Decreases Enemy's Attack Multipliers by 2.)

Code: [Select]
$03/DD2F AD 1B 27 LDA $271B  [$7E:271B] A:0003 X:004C Y:0000 P:envMxdizc - Load Target's Attack Multiplier into A.
$03/DD32 3A DEC A A:0000 X:004C Y:0000 P:envMxdiZc - -1 to A.
$03/DD33 3A DEC A A:00FF X:004C Y:0000 P:eNvMxdizc - -1 to A.
$03/DD34 C9 02 CMP #$02 A:00FE X:004C Y:0000 P:eNvMxdizc - Is it less than 02?
$03/DD36 90 02 BCC $02    [$DD3A] A:00FE X:004C Y:0000 P:eNvMxdizC - If not, branch to 03DD3A
$03/DD38 A9 01 LDA #$01 A:00FE X:004C Y:0000 P:eNvMxdizC - If so, load 01 into A. (To prevent overflow_
$03/DD3A 8D 1B 27 STA $271B  [$7E:271B] A:0001 X:004C Y:0000 P:envMxdizC - Store A in 7E271B.
$03/DD3D 60 RTS A:0001 X:004C Y:0000 P:envMxdizC - Return.

This one is probably really easy to abuse as well. I should probably make some of these auto-fail if used on a boss. Or just set the "Hit Boss - No" bit.


Replaces Dispel

SABR - Saber (+16 Attack, +10 Accuracy)

Code: [Select]
$03/D8B0 AD 1D 27 LDA $271D  [$7E:271D] A:0003 X:0020 Y:0000 P:envMxdizc - Load Target's Attack into A.
$03/D8B3 69 10 ADC #$10 A:003C X:0020 Y:0000 P:envMxdizc - Add 10 (16) to A.
$03/D8B5 C9 80 CMP #$80 A:004C X:0020 Y:0000 P:envMxdizc - Is it 80? (128)
$03/D8B7 90 02 BCC $02    [$D8BB] A:004C X:0020 Y:0000 P:eNvMxdizc - If not, branch to 03D8BB
--------------------------------------------------------------------------------
Load 80 into A if so. (This is to prevent a Mage (Saber is a Self-cast spell) from jumping up to over 200 attack with repeated castings)
------------------------------------------------------------------------------
$03/D8BB 8D 1D 27 STA $271D  [$7E:271D] A:004C X:0020 Y:0000 P:eNvMxdizc - Store A in Target's Attack.
$03/D8BE AD 1C 27 LDA $271C  [$7E:271C] A:004C X:0020 Y:0000 P:eNvMxdizc - Load Target's Accuracy.
$03/D8C1 69 0A ADC #$0A A:004F X:0020 Y:0000 P:envMxdizc - Add 10.
$03/D8C3 C9 FF CMP #$FF A:0059 X:0020 Y:0000 P:envMxdizc - Is it FF (255?)
$03/D8C5 90 02 BCC $02    [$D8C9] A:0059 X:0020 Y:0000 P:envMxdizc - If less than FF branch to 03D8C9.
------------------------------------------------------------------------------
Load FF into A. I don't mind players having more than 100% accuracy. Especially if enemies will have access to these very same spells.
---------------------------------------------------------------------------
$03/D8C9 8D 1C 27 STA $271C  [$7E:271C] A:0059 X:0020 Y:0000 P:envMxdizc
$03/D8CC 60 RTS A:0059 X:0020 Y:0000 P:envMxdizc


Replacing Count Routine

HARM - (Dia, deals damage only to the Undead) Well setting that up took a lot less time than I thought it would. Trying to alter Holy routine to have such an effect, oy... I'm not going to bother. It has no elemental checks or anything of that accord. Obviously if it were Holy it would deal crushing damage to Zombies that would ordinarily be weak to it.

Code: [Select]
$03/DBB5 AD 40 27 LDA $2740  [$7E:2740] A:0003 X:0038 Y:0000 P:envMxdizc - Load Target's Creature Type into A.
$03/DBB8 29 80 AND #$80 A:0080 X:0038 Y:0000 P:eNvMxdizc - Is it Zombie?
$03/DBBA D0 01 BNE $01    [$DBBD] A:0080 X:0038 Y:0000 P:eNvMxdizc -If not, branch to 03DBBD.
--------------------------------------------------------------------------------------------
$03/DBBC 60 RTS A:0000 X:0038 Y:FFFF P:envMxdiZc - Return.
------------------------------------------------------------------------------------------------
$03/DBBD 20 AF C9 JSR $C9AF  [$03:C9AF] A:0080 X:0038 Y:0000 P:eNvMxdizc - Jump to Damage Determination.
$03/DBBE 60 RTS A:0080 X:0038 Y:FFFF P:envMxdiZc - Return.


Replaces Blink

RUSE (Or... FFI's Blink. Adds Evasion) This will be very simple so as to be able to use Blink's extremely small routine. No checks, so if people want to overflow themselves back to low evasion, then they can have it. It's set to 0A but I wonder if that's a bit high...

Code: [Select]
$03/D623 AD 29 27 LDA $2729  [$7E:2729] A:0003 X:0010 Y:0000 P:envMxdizc
$03/D626 69 0A ADC #$0A A:0016 X:0010 Y:0000 P:envMxdizc
$03/D628 8D 29 27 STA $2729  [$7E:2729] A:0020 X:0010 Y:0000 P:envMxdizc
$03/D62B 60 RTS A:0020 X:0010 Y:0000 P:envMxdizc


We are surprisingly nearly there. All that remains is implementing Fear (-"Steal Prevention" Current Str/2 (maybe 4) If "Steal Prevention" is less than user's level, do an RNG check. It is is less than 50/100 put 80 in Status Byte 1.) and the various Elemental Shields. (AFir, AIce, etc)


Unlike everything else I've ever done... I'll actually be releasing this mini-mod as a patch! Just don't expect any balancing or anything of that sort, it will only include the 14 new routines and maybe some enemy AI changes to make use of them. This is merely a proof of concept. It will include Monster's evasions reimplemented as well.
 :edit:
Now onto the rest...

Replacing Odin (Odin will instead be a Dark Elemental Attack that hits all foes)

AFir, AIce, ALit, NulMgc, NulAll - (The First three are obvious on what they do, NulMgc makes it so Instant Death attacks won't kill the target and NulAll decreases the amount of damage magic does by 50%. I cannot emulate that. So instead it will just give you all resistances from elementals and protection from instant death.)

NulFir, NulIce, NulLit
Code: [Select]
$03/DB5F AD A2 28 LDA $28A2  [$7E:28A2] A:0003 X:0036 Y:0000 P:envMxdizc - Load Spell's Elemental.
$03/DB62 D0 2D BNE $2D    [$DB91] A:0000 X:0036 Y:0000 P:envMxdiZc - If it has an Elemental branch to 03DB91. (Used to transfer to Fear Routine)
$03/DB64 AD 9D 28 LDA $289D  [$7E:289D] A:0000 X:0036 Y:0000 P:envMxdiZc - Load Spell's Power.
$03/DB67 F0 0E BEQ $0E    [$DB77] A:0001 X:0036 Y:0000 P:envMxdizc - If 00 branch to 03DB77. (NulMgc, NulAll portion)
$03/DB69 AA TAX A:0001 X:0036 Y:0000 P:envMxdizc - Transfer A to X.
$03/DB6A 8E A9 00 STX $00A9  [$7E:00A9] A:0001 X:0001 Y:0000 P:envMxdizc - Store Spell Power in A9.
$03/DB6D AD 25 27 LDA $2725  [$7E:2725] A:0001 X:0001 Y:0000 P:envMxdizc - Load Target's Elemental Resistance into A.
$03/DB70 0D A9 00 ORA $00A9  [$7E:00A9] A:0000 X:0001 Y:0000 P:envMxdiZc - Add Spell Power into A if applicable.
$03/DB73 8D 25 27 STA $2725  [$7E:2725] A:0001 X:0001 Y:0000 P:envMxdizc - Store A in Target's Elemental Resistance.
$03/DB76 60 RTS A:0001 X:0001 Y:0000 P:envMxdizc - Return

What this does is allows me to save a lot of code and add some versatility to it. The Spell Powers will be as follows... AFir - 01, AIce, 02, ALit, 04, you could make other Resistance spells as well like ADrk, 08, AHly, 10, AAir, 20, ADrn, 40 if so inclined.

NulMgc (NlDth)

Code: [Select]
$03/DB5F AD A2 28 LDA $28A2  [$7E:28A2] A:0003 X:0036 Y:0000 P:envMxdizc - Load Spell's Elemental into A.
$03/DB62 D0 2D BNE $2D    [$DB91] A:0000 X:0036 Y:0000 P:envMxdiZc - If not 00 branch to 03DB91.
$03/DB64 AD 9D 28 LDA $289D  [$7E:289D] A:0000 X:0036 Y:0000 P:envMxdiZc - Load Spell's Power into A.
$03/DB67 F0 0E BEQ $0E    [$DB77] A:0000 X:0036 Y:0000 P:envMxdiZc - If 00 branch to 03DB77
---------------------------------------------------------------------------------------------
(NulFire, Ice, Lit are in here)
------------------------------------------------------------------------------------------
$03/DB77 AD 2B 27 LDA $272B  [$7E:272B] A:0000 X:0036 Y:0000 P:envMxdiZc - Load Target's Status Resistance into A.
$03/DB7A 09 80 ORA #$80 A:0000 X:0036 Y:0000 P:envMxdiZc - Add 80 (Death to it.
$03/DB7C 8D 2B 27 STA $272B  [$7E:272B] A:0080 X:0036 Y:0000 P:eNvMxdizc - Store A in Target's Resistance.
$03/DB7F AD A4 28 LDA $28A4  [$7E:28A4] A:0080 X:0036 Y:0000 P:eNvMxdizc - Load Status Infliction Byt 2 (Not real, just for Spell) of Spell.
$03/DB82 D0 01 BNE $01    [$DB85] A:0080 X:0036 Y:0000 P:eNvMxdizc - If it is not 00 branch to 03DB85.
$03/DB84 60 RTS A:00C0 X:0036 Y:0000 P:eNvMxdizC - Return

This gets by the other elemental resistance checks by seeing if it has power in the first place and since NulAll does the same thing with added all elemental resistance it goes off of that but checks if the spell has a Status Ailment to inflict (which it won't because the right tools aren't in place) and moves onto the rest of the routine.

So we will pick up NulAll there so as not to repeat most of a routine...

NulAll
Code: [Select]
....
$03/DB77 AD 2B 27 LDA $272B  [$7E:272B] A:0000 X:0036 Y:0000 P:envMxdiZc - Load Status Resistance Byte 1 of Target into A.
$03/DB7A 09 80 ORA #$80 A:0000 X:0036 Y:0000 P:envMxdiZc - Add 80 if applicable (Death)
$03/DB7C 8D 2B 27 STA $272B  [$7E:272B] A:0080 X:0036 Y:0000 P:eNvMxdizc - Store A in Status Resistance Byte.
$03/DB7F AD A4 28 LDA $28A4  [$7E:28A4] A:0080 X:0036 Y:0000 P:eNvMxdizc - Load Status Byte 2 of Spell.
$03/DB82 D0 01 BNE $01    [$DB85] A:0080 X:0036 Y:0000 P:eNvMxdizc - If it is not 00 branch to 03DB85.
$03/DB85 AD 25 27 LDA $2725  [$7E:2725] A:0080 X:0036 Y:0000 P:eNvMxdizc - Load Target's Elemental Resistance into A.
$03/DB88 09 7F ORA #$07 A:0000 X:0036 Y:0000 P:envMxdiZc - Add Fire, Ice, and Lightning Resistance into A if applicable.
$03/DB8A 8D 25 27 STA $2725  [$7E:2725] A:0007 X:0036 Y:0000 P:envMxdizc - Store A in Target's Elemental Resistance.
$03/DB8D 60 RTS A:0007 X:0036 Y:0000 P:envMxdizc - Return.

Whew! Took a little bit of fancy coding (for me, this is all virtually new to me) but everything is working properly! I just hope I have enough bytes left in Odin to make Fear work properly...

 :edit: With one byte left to spare I completed Fear to the exactions I desired! (Granted I probably could have saved even more space if I used one Branching point for the Returns.

Code: [Select]
$03/DB5F AD A2 28 LDA $28A2  [$7E:28A2] A:0003 X:0036 Y:0000 P:envMxdizc - Load Spell's Elemental.
$03/DB62 D0 2A BNE $2A    [$DB8E] A:0001 X:0036 Y:0000 P:envMxdizc - Branch if not 00 to 03DB8E.
-----------------------------------------------------------------------------------------------------------------
The Resistance Routines are in here....
----------------------------------------------------------------------------------------------------------------
$03/DB8E AD 94 26 LDA $2694  [$7E:2694] A:0001 X:0036 Y:0000 P:envMxdizc - Load Caster's Strength into A.
$03/DB91 4A LSR A A:000D X:0036 Y:0000 P:envMxdizc /Strength by 2.
$03/DB92 4A LSR A A:0006 X:0036 Y:0000 P:envMxdizC /Strength by 2.
$03/DB93 AA TAX A:0003 X:0036 Y:0000 P:envMxdizc - Transfer A to X.
$03/DB94 8E A9 00 STX $00A9  [$7E:00A9] A:0003 X:0003 Y:0000 P:envMxdizc - Store X in A9.
$03/DB97 AD 2F 27 LDA $272F  [$7E:272F] A:0003 X:0003 Y:0000 P:envMxdizc - Load Target's "Steal Prevention".
$03/DB9A ED A9 00 SBC $00A9  [$7E:00A9] A:000B X:0003 Y:0000 P:envMxdizc - Subtract Steal Prevention from Caster's Strength divided by 4.
$03/DB9D 8D 2F 27 STA $272F  [$7E:272F] A:0007 X:0003 Y:0000 P:envMxdizC - Store A in Target's "Steal Prevention".
$03/DBA0 CD 82 26 CMP $2682  [$7E:2682] A:0007 X:0003 Y:0000 P:envMxdizC - Is it less than the caster's level?
$03/DBA3 90 01 BCC $01    [$DBA6] A:0007 X:0003 Y:0000 P:eNvMxdizc - If so, branch to 03DBA6.
--------------------------------------------------------
(Return within)
--------------------------------------------------------
$03/DBA6 20 8B 85 JSR $858B  [$03:858B] A:0007 X:0003 Y:0000 P:eNvMxdizc - Jump to Random Number Generator.
$03/DBA9 C9 32 CMP #$32 A:0034 X:0000 Y:0000 P:eNvMxdizc - Is it greater than 32?
$03/DBAB B0 01 BCS $01    [$DBAE] A:0034 X:0000 Y:0000 P:envMxdizC - If so branch to 03DBAE
----------------------------------------------------
(Another Return)
------------------------------------------------------
$03/DBAE A9 80 LDA #$80 A:0034 X:0000 Y:0000 P:envMxdizC - Load 80 (Death) into A.
$03/DBB0 8D 03 27 STA $2703  [$7E:2703] A:0080 X:0000 Y:0000 P:eNvMxdizC - Store A in Target's Status Byte 1.
$03/DBB3 60 RTS A:0080 X:0000 Y:0000 P:eNvMxdizC - Return


Phew! Now this was a wonderful experiment. I've managed to include all of the unique formulas from FFI into FFIV.
Ah wait, there is one more... While Protect exists in FFIV it is nowhere near as malleable as it seems in FFI. So I will fix that routine up and see if I can't have it load Spell Power instead of Default 5.

And that was a bit more of a pain than I was expecting... ah well it works, that's all that matters.

Changes made to Protect...

Code: [Select]
$03/D859 AE 9D 28 LDX $289D  [$7E:289D] A:0011 X:001A Y:0000 P:envMxdizc - Load Spell Power into X..
$03/D85C 8E A9 00 STX $00A9  [$7E:00A9] A:0011 X:4201 Y:0000 P:envMxdizc - Store X in A9.
$03/D85F 80 04 BRA $04    [$D865] A:0011 X:4201 Y:0000 P:envMxdizc - Branch to 03D865.
--------------------------------------------------------------------------------------

-------------------------------------------------------------------------------------
$03/D865 18 CLC A:0011 X:4201 Y:0000 P:envMxdizc - Clear Carry Flag.
$03/D866 AD 2A 27 LDA $272A  [$7E:272A] A:0011 X:4201 Y:0000 P:envMxdizc - Load Target's Physical Defense into A.
$03/D869 6D A9 00 ADC $00A9  [$7E:00A9] A:0011 X:4201 Y:0000 P:envMxdizc - Add Spell Power to A.
$03/D86C 80 01 BRA $01    [$D86F] A:0012 X:4201 Y:0000 P:envMxdizc - Branch to 03D86F.
$03/D86F 8D 2A 27 STA $272A  [$7E:272A] A:0012 X:4201 Y:0000 P:envMxdizc - Store A Target's Physical Defense.
$03/D872 60 RTS A:0012 X:4201 Y:0000 P:envMxdizc - Return.


I got rid of the Zeromus check to add in a "Look at Spell Power" routine and it uses that to load the + to Defense.

Now I am finished. This was only done to supplement FFIV's existing system. I could go much further and make spells and attacks more akin to FFI's. But I think this will do for now.


The Patch will be coming soon!
Title: Re: Grimoire LD's Notes, Methods, and Hacks (FFI spell routines in FFIV!)
Post by: Grimoire LD on October 13, 2013, 01:23:35 PM
My short adventure of adding in all of FFI's unique spell routines into FFIV is now complete.

FFIV now has

LOCK (Decreases Evasion) In exchange of Single Digit HP Formula (Weak, etc)
SLO1 (Decreases Enemy Accuracy) In exchange of Increase Magic Defense (Shell)
TMPR (Gives + to Attack) In exchange of Modify Speed (Slow, Fast)
FAST (+1 Attack Multiplier) In exchange of Hug (Hug)
SLO2 (-2 Multiplier) in exchange of Reaction (Reaction)
SABR (+16 Attack, +10 Accuracy) in exchange of Get Rid of Positive Status (Dispel) (Black Hole is still active)
HARM (Damage Only the Undead) in exchange of Add Count (Count)
RUSE (+ Evasion) in exchange of Add Image (Blink)
FEAR (Decreases Target's "Steal Prevention" by Caster's Str/4, if less than Caster's Level 50% chance of fleeing.) in exchange of Odin.
ALIT,AFIR,AICE,ARUB,WALL (ALit, AFir, AIce add resistance to the predictable elements. ARub (going to be referred to as NlDth) gives the target immunity from Instant Death attacks. Wall, cannot work like it does in FFI because of my lack of control over statuses. (as I am pretty sure that is what NulAll (WALL) likely is in FFI. Instead it adds +Instant Death Protection and the three elemental resistances) also in exchange of Odin.

Look forward to news about a patch coming up soon!
Title: Re: Grimoire LD's Notes, Methods, and Hacks (All Spells Disassembly)
Post by: chillyfeez on October 16, 2013, 11:06:22 PM
Note:
Another mystery solved!

Code for Command Starting Graphics...
Code: [Select]
00-BF - Assigned by Spell.

C0 - Weapon Swing
C1 - None
C2 - White Magic
C3 - Black Magic
C4 - Summon Magic (Also includes the party vanishing)
C5 - Dark Wave
C6 - Character Jumps into the Air
C7 - Character does their Special Pose. (Recall)
C8 - Spell Pose is Held as White Magic light shows (Sing)
C9 - Run from battle (Hide)
CA - Just normal Spell/Item Use pose. (Salve)
CB - Pray
CC - Special Pose - Weapon Attack (Aim)
CD - Spell Pose is Held while attack happens (Focus)
CE - Kick
CF - Gird
D0 - Twincasting
D1 - Boast
D2 - Cry
D3 - Cover
D4 - Peep
D5 - Crash (Just a normal spell casting pose)
D6 - Dart (When used outside of its normal routine, shows a hand stuck in the foe as used in Fight without a weapon)
D7 - Sneak
D8 - Ninja
D9 - Regen
DA - Change
DB - Parry
DC - Character runs all the way from one side of the screen to the other, back to the front. ??
DD - Normal Spell Casting Pose.
DE - Return from Jump
DF - Second part of Focus (Attack)

Do you happen to know how/when/where the game uses these codes? Is it possible to assign a different pose to a command, like a spell-casting stance when using the Dart command, for example?
Title: Re: Grimoire LD's Notes, Methods, and Hacks (FFI spell routines in FFIV!)
Post by: Grimoire LD on October 16, 2013, 11:54:42 PM
I thought I would but I now come to the realization that I do not, this is for several reasons now that I think on it. This is never actually related to the routines. You could change the routines to the end of days and you would not see a change in the animation undertaken in said routine.

Now I am intrigued... let me see the reason for that, though I suspect its going to be Index based, depending on command used.

Let's see for sure...

Code: [Select]
$03/B138 BD 51 20 LDA $2051,x[$7E:2051] A:0002 X:0000 Y:0000 P:envMxdiZc - Load Action Used into A.
$03/B13B C9 02 CMP #$02 A:0005 X:0000 Y:0000 P:envMxdizc - Is it Magic of any sort?
$03/B13D F0 08 BEQ $08    [$B147] A:0005 X:0000 Y:0000 P:envMxdizC - If so branch to 03B147.
$03/B13F C9 07 CMP #$07 A:0005 X:0000 Y:0000 P:envMxdizC - Is it Think?
$03/B141 F0 04 BEQ $04    [$B147] A:0005 X:0000 Y:0000 P:eNvMxdizc - If so branch to 03B147.
$03/B143 C9 20 CMP #$20 A:0005 X:0000 Y:0000 P:eNvMxdizc - Is it ?20?
$03/B145 D0 03 BNE $03    [$B14A] A:0005 X:0000 Y:0000 P:eNvMxdizc - If so branch to 03B14A.
$03/B14A 48 PHA A:0005 X:0000 Y:0000 P:eNvMxdizc - Push A onto Stack.
$03/B14B 18 CLC A:0005 X:0000 Y:0000 P:eNvMxdizc - Clear Carry Flag.
$03/B14C 69 C0 ADC #$C0 A:0005 X:0000 Y:0000 P:eNvMxdizc - Add C0 onto A.
$03/B14E 8D C4 33 STA $33C4  [$7E:33C4] A:00C5 X:0000 Y:0000 P:eNvMxdizc - Store A in Audio/Visual. (C5 is the Animation of Dark Wave)
$03/B151 C9 C1 CMP #$C1 A:00C5 X:0000 Y:0000 P:eNvMxdizc - Is it ?None? (possibly used as a return)
$03/B153 D0 02 BNE $02    [$B157] A:00C5 X:0000 Y:0000 P:envMxdizC - If not branch to 03B157.
--------------------------------------------

-----------------------------------------------
$03/B157 8D FF 35 STA $35FF  [$7E:35FF] A:00C5 X:0000 Y:0000 P:envMxdizC - Store A in 7E35FF.
$03/B15A 9C C5 33 STZ $33C5  [$7E:33C5] A:00C5 X:0000 Y:0000 P:envMxdizC - Store Zero in another byte of Audio/Visual code.
$03/B15D 68 PLA A:00C5 X:0000 Y:0000 P:envMxdizC - Pull A.
$03/B15E 0A ASL A A:0005 X:0000 Y:0000 P:envMxdizC - x2 to A.
$03/B15F AA TAX A:000A X:0000 Y:0000 P:envMxdizc - Transer A to X.
$03/B160 BF 7C B3 03 LDA $03B37C,x[$03:B386] A:000A X:000A Y:0000 P:envMxdizc - Draw out First two bytes of the location of subroutine.
$03/B164 85 80 STA $80    [$00:0080] A:00E9 X:000A Y:0000 P:eNvMxdizc - Store it in 80.
$03/B166 BF 7D B3 03 LDA $03B37D,x[$03:B387] A:00E9 X:000A Y:0000 P:eNvMxdizc - Draw out second two bytes of the location of subroutine. (E9E9 in this case)
$03/B16C A9 03 LDA #$03 A:00E9 X:000A Y:0000 P:eNvMxdizc - Load 03 into A.
$03/B16E 85 82 STA $82    [$00:0082] A:0003 X:000A Y:0000 P:envMxdizc - Store A in 82.
$03/B170 DC 80 00 JML [$0080][$03:E9E9] A:0003 X:000A Y:0000 P:envMxdizc - Jump to Subroutine (defined by 80, which now holds the location of Commands subroutine)

Well that was unfortunate. However there is nothing stopping you from changing the used graphic within the subroutine itself... I think. And it did completely reveal where the Command Subroutines are being held which will be the way to fix "crashes game".

The way it is set up does not leave room for variables, unfortunately. (Command Number + C0 = Graphic shown) With only Magics and Think given special priority because of their variable factors.




Title: Re: Grimoire LD's Notes, Methods, and Hacks (FFI spell routines in FFIV!)
Post by: chillyfeez on October 17, 2013, 01:35:56 AM
Yeah... as long as command subroutine loads after the AV byte is loaded (which it seems to do), should be able to work that into a custom code.
I've pretty much finished developing what I'm calling a "Copy" command.

I tried to make Mime, but ran into a pretty big problem - in order to make it work, you'd have to reload $2700-$277F (the target's temporarily stored data). Unfortunately, the routine that loads the data from the in-battle character record (within $2000-$267F) to the target's temporary record is the same routine that calls the command subroutine and its AV effect. So I can mostly make it work - the Mime performs the same action on the same target as the Mimicked character - but the AV happens twice. I can perhaps best describe the phenomenon like so:
Code: [Select]
Load caster's data
Load Mime target's data
JUMP TO (command effect subroutine)
-----Copy Mime target's last action and target into caster's same
-----JUMP TO
----------Load new target's data
----------Jump to new command effect subroutine (and then return)
----------Run active command's AV
----------Return
-----Return
Run active command's AV

To make matters worse, this freezes the game when the mimicked command is Jump (probably Hide, too). I don't think there's a way to make it work...

So then I got to thinking smaller-scale. My custom Copy command essentially uses a monster's last action against it. I've tested it and it works perfectly, except that when the command is "fight" - really the only monster command that doesn't count as a spell - the character doesn't swing their weapon. I should be able to fix that now.

Something just occurred to me, though... the AV isn't indexed on the front end, but what's done with that byte after it's loaded into $33C4? Maybe I'll look into that tomorrow (after typing the summon tutorial I've been avoiding).
Title: Re: Grimoire LD's Notes, Methods, and Hacks (FFI spell routines in FFIV!)
Post by: Grimoire LD on October 17, 2013, 08:50:59 AM
Hmm, yeah I noticed similar problems in using the Un-Berserked Avenger Sword. Though for the most part things seemed well in hand before trying to mimic magic outside White froze the game. I think your idea to have this character mimic only Monster actions is probably the best idea that can be arranged.

Are you wondering what happens to the byte at 33C4 or are you wondering what becomes of the routine it arrived at 33C4 on? If it's the latter it gets overwritten for its original value, has a x2 added to it (to find its proper routine offset) and then it is replace by a 3 which is likely how the game reaches the address 03XXXX for Command Routines.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (FFI spell routines in FFIV!)
Post by: chillyfeez on October 17, 2013, 09:38:23 AM
Are you wondering what happens to the byte at 33C4 or are you wondering what becomes of the routine it arrived at 33C4 on? If it's the latter it gets overwritten for its original value, has a x2 added to it (to find its proper routine offset) and then it is replace by a 3 which is likely how the game reaches the address 03XXXX for Command Routines.

The former, actually. My guess is that the byte loaded into AV probably also gets an ASL and points to the AV sequence... whether that can be fully deciphered is another question, but if it leads to two byte pointers, then individual commands' movements are in fact replaceable (with those of other commands).

At any rate, this missing byte solved my Copy command!
Here's the code if anybody wants it:
Code: [Select]
AD 52 27  LDA $2752 ;Load target's last sub-action
F0 04     BEQ $04   ;If it's zero (not a spell), jump to the fight sequence
C9 A9     CMP #$A9  ;Compare it to A9 (the address of the highest desirable copied command)
90 0A     BCC $0A   ;If it's less (and therefore within desirable range), skip the fight sequence
A9 C0     LDA #$C0  ;Load Fight's AV identifier
8D C4 33  STA $33C4 ;Store into the AV loader byte in RAM
20 99 C4  JSR $C499 ;Jump to Fight subroutine
80 06     BRA $06   ;Jump to end
8D D2 26  STA $26D2 ;(having skipped past fight) Store target's last sub-action into caster's pending sub-action
20 46 CC  JSR $CC46 ;Jump to Magic subroutine
60        RTS

One limitation of this code that I am fine with - it only uses the action on the target, so you can't copy a monster's cure spell onto yourself. I'm OK with that. You CAN copy a white mage's cure spell back to them, so that's kinda neat.

Couple of things I haven't tested, but are probably problems (that can be fixed) -
I haven't tried to copy a party member's Dart. Items I've accounted for - they won't copy because useable items begin above A9. My guess, though, is that copying Dart will result in some weird spell being cast.
Copying summon spells will likely also be a problem, since castable summon spells get replaced in the sub-action byte by uncastable summon spells.
I think that these two issues can just be solved by changing the targeting options (in the index at 9FFC3) to "One enemy," thereby negating the ability to try copying a party member.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (FFI spell routines in FFIV!)
Post by: Grimoire LD on October 17, 2013, 09:57:59 AM
That is some clever hacking! Fantastic work there Chillyfeez. So where is this code planned to be plugged into? The newly unused portion of Peep linked to the old 0000 of "Crashes Game"?
Title: Re: Grimoire LD's Notes, Methods, and Hacks (FFI spell routines in FFIV!)
Post by: chillyfeez on October 17, 2013, 12:53:13 PM
That's where I put it for testing purposes.
In the big hack I'm working on, It may replace some other command. What's nice about this is that it's a very short block of code, so It can replace just about anything (there are quite a few existing commands that I don't plan to use in my hack). I may need the big space you created by shortening Peep for something else. See, this, I think, would be a command available to my Blue Mage character, who would also have a "Blue" command, and possibly a "Learn" command, which would be entirely custom and (I think) a much longer string of code.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (FFI spell routines in FFIV!)
Post by: Grimoire LD on October 17, 2013, 03:02:56 PM
Yes, the freed up bytes of Peep may allow you to have something much larger. A Blue Magic command fully equipped with Learning though...? Hmm... You may be able to use the code of Auto-Hide (which I should explore fuller rather than just finding who it effects.) as a start to have it always on, so when your character is hit by those specific effects they automatically (or have a chance?) to learn said spell, since all Auto-Hide does is execute (almost without a doubt) is the (7E2X86) Auto-Hider in Critical? Then Used Command Hide. If you set up a range of Monster Spells and change that to "Is Learner being hit with a spell above say 60 (Start of Monster Spells) Then... Is the Learner being hit with a spell after 60 (18 Bytes, 24 spells to a spell set so...) is it before 78? (If either of these are untrue, return). Then add the spell directly to the spell set. IF not already there.

That seems like it might be the best way to set up an FFIV Blue Mage. I'll see about finding out more about Auto-Hide shortly.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (FFI spell routines in FFIV!)
Post by: chillyfeez on October 17, 2013, 05:32:57 PM
I actually was planning on having it be a user-activated command, a la Gau's Jump in FFIV. The base would be similar to Copy - execute "Learn" after a monster uses a Tech (and before it makes its next move - while the command is still in the "next sub-action" byte in RAM) and if that spell is set to be learnable, you'll learn it (if not already learned).
But if we could figure out how to make it automatic... well that would be fantastic!
I figured that Auto-commands (remember, there's auto-Cover, too) were limited to characters that had the same command as executable, too. If I'm not mistaken, any character that can execute Hide will auto-hide when critical. I'd love to find out I was mistaken, though.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (FFI spell routines in FFIV!)
Post by: Grimoire LD on October 17, 2013, 06:43:12 PM
My notes on Auto-Hide lead me on quite a hunt and I may have found the start of a character's turn dealings in hex...

Code: [Select]
$03/A37B AD 00 18 LDA $1800  [$7E:1800] A:0003 X:0000 Y:0012 P:envMxdizc - Load Current Encounter.
$03/A37E C9 B7 CMP #$B7 A:0010 X:0000 Y:0012 P:envMxdizc - Is it B7 (Zeromus)
$03/A380 D0 0A BNE $0A    [$A38C] A:0010 X:0000 Y:0012 P:envMxdizc - If not branch to 03A38C.
-----------------------------------------------------------------------------------------------------------------------

-----------------------------------------------------------------------------------------------------------------------------
$03/A38C AD F3 38 LDA $38F3  [$7E:38F3] A:0010 X:0000 Y:0012 P:envMxdizc - Load 7E38F3 into A.
$03/A38F D0 0F BNE $0F    [$A3A0] A:0000 X:0000 Y:0012 P:envMxdiZc - If not 00 branch to 03A3A0.
$03/A391 AD 82 22 LDA $2282  [$7E:2282] A:0000 X:0000 Y:0012 P:envMxdiZc - Load Monster Slot 1's Level into A.
$03/A394 C9 63 CMP #$63 A:0001 X:0000 Y:0012 P:envMxdizc - Is it 99?
$03/A396 F0 0B BEQ $0B    [$A3A3] A:0001 X:0000 Y:0012 P:eNvMxdizc - If so branch to 03A3A3.
$03/A398 C9 62 CMP #$62 A:0001 X:0000 Y:0012 P:eNvMxdizc - Is it 98?
$03/A39A F0 07 BEQ $07    [$A3A3] A:0001 X:0000 Y:0012 P:eNvMxdizc - If so branch to 03A3A3.
$03/A39C C9 61 CMP #$61 A:0001 X:0000 Y:0012 P:eNvMxdizc - Is it 97?
$03/A39E F0 03 BEQ $03    [$A3A3] A:0001 X:0000 Y:0012 P:eNvMxdizc - If so branch to 03A3A3.
$03/A3A0 9C D6 38 STZ $38D6  [$7E:38D6] A:0001 X:0000 Y:0012 P:eNvMxdizc - Store Zero in
7E38D6.
$03/A3A3 7B TDC A:0001 X:0000 Y:0012 P:eNvMxdizc - Transfer Direct Page.
$03/A3A4 AA TAX A:0000 X:0000 Y:0012 P:envMxdiZc - Transfer A to X
-----------------------------------------------------------(Looping Point)-----------------------------------------
$03/A3A5 BD 29 39 LDA $3929,x[$7E:3929] A:0000 X:0000 Y:0012 P:envMxdiZc - Load 7E3929 into A.
$03/A3A8 C5 D2 CMP $D2    [$00:00D2] A:00FF X:0000 Y:0012 P:eNvMxdizc - Is it D2?
$03/A3AC E8 INX A:00FF X:0000 Y:0012 P:eNvMxdizC - +1 to X.
$03/A3AD E0 05 00 CPX #$0005 A:00FF X:0001 Y:0012 P:envMxdizC - Has this pattern continued five times?
$03/A3B0 D0 F3 BNE $F3    [$A3A5] A:00FF X:0001 Y:0012 P:eNvMxdizc - If not, loop back to 03A3A5.
-------------------------------------------------------------------------------------------------------------------------
$03/A3B2 A5 D0 LDA $D0    [$00:00D0] A:00FF X:0005 Y:0012 P:envMxdiZC - Load D0 into A.
$03/A3B4 85 8C STA $8C    [$00:008C] A:00FF X:0005 Y:0012 P:eNvMxdizC - Store A in 8C.
$03/A3B6 A5 D2 LDA $D2    [$00:00D2] A:00FF X:0005 Y:0012 P:eNvMxdizC - Load D2 into A.
$03/A3B8 20 89 84 JSR $8489  [$03:8489] A:0001 X:0005 Y:0012 P:envMxdizC - Jump to Subroutine (Preparation?)
$03/A3BB A9 03 LDA #$03 A:0000 X:0120 Y:0012 P:envMxdizc - Load 03 into A.
$03/A3BD 20 69 85 JSR $8569  [$03:8569] A:0003 X:0120 Y:0012 P:envMxdizc - Jump to Subroutine (Possibly something to do with timers?)
$03/A3C0 AE 98 35 LDX $3598  [$7E:3598] A:0000 X:0120 Y:0012 P:envMxdiZc - Load X from 7E3598.
$03/A3C3 BD 06 2A LDA $2A06,x[$7E:2A1E] A:0000 X:0018 Y:0012 P:envMxdizc - Load A from 7E2A06 +X (Something in the status timers.)
$03/A3C6 29 FE AND #$FE A:0081 X:0018 Y:0012 P:eNvMxdizc Add -1 to A.
$03/A3C8 9D 06 2A STA $2A06,x[$7E:2A1E] A:0080 X:0018 Y:0012 P:eNvMxdizc - Store A in 7E2A1E.
$03/A3CB A5 D2 LDA $D2    [$00:00D2] A:0080 X:0018 Y:0012 P:eNvMxdizc - Load A from D2.
$03/A3CD 85 D0 STA $D0    [$00:00D0] A:0001 X:0018 Y:0012 P:envMxdizc - Store A in D0.
$03/A3CF 20 9D A5 JSR $A59D  [$03:A59D] A:0001 X:0018 Y:0012 P:envMxdizc - Jump to Subroutine
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/A59D A5 D0 LDA $D0    [$00:00D0] A:0001 X:0018 Y:0012 P:envMxdizc - Load D0 into A.
$03/A59F C9 FF CMP #$FF A:0001 X:0018 Y:0012 P:envMxdizc - Is it FF?
$03/A5A1 F0 1A BEQ $1A    [$A5BD] A:0001 X:0018 Y:0012 P:envMxdizc - If so branch to 03A5BD.
$03/A5A3 20 89 84 JSR $8489  [$03:8489] A:0001 X:0018 Y:0012 P:envMxdizc - Jump to Subroutine (Preparation?)
$03/A5A6 A6 A6 LDX $A6    [$00:00A6] A:0000 X:0120 Y:0012 P:envMxdizc - Load A from A6.
$03/A5A8 BD 03 20 LDA $2003,x[$7E:2083] A:0000 X:0080 Y:0012 P:envMxdizc - Load Character Slot's Status Byte 1.
$03/A5AB 29 C0 AND #$C0 A:0000 X:0080 Y:0012 P:envMxdiZc - Is it Dead or Petrified?
$03/A5AD D0 0E BNE $0E    [$A5BD] A:0000 X:0080 Y:0012 P:envMxdiZc - If so branch to 03A5BD.
----------------------------------------------------------------------------------------------------------------------------------
$03/A5AF BD 04 20 LDA $2004,x[$7E:2084] A:0000 X:0080 Y:0012 P:envMxdiZc - Load Character Slot's Status Byte 2.
$03/A5B2 29 3C AND #$3C A:0000 X:0080 Y:0012 P:envMxdiZc - Is it Berserk, Charm, Sleep, or Paralyze?
$03/A5B4 D0 07 BNE $07    [$A5BD] A:0000 X:0080 Y:0012 P:envMxdiZc - If so, branch to 03A5BD.
--------------------------------------------------------------------------------------------------------------------------------------
$03/A5B6 BD 05 20 LDA $2005,x[$7E:2085] A:0000 X:0080 Y:0012 P:envMxdiZc - Load Character Slot's Status Byte 3.
$03/A5B9 29 C6 AND #$C6 A:0010 X:0080 Y:0012 P:envMxdizc - Is it Magnetized, Stopped, Twincasting, or Jumping?
$03/A5BB F0 04 BEQ $04    [$A5C1] A:0000 X:0080 Y:0012 P:envMxdiZc - If not, branch to 03A5C1.
--------------------------------------------------------------------------------------------------
$03/A5C1 60 RTS A:0000 X:0080 Y:0012 P:envMxdiZc - Return
--------------------------------------------------------------------------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/A3D2 A5 D0 LDA $D0    [$00:00D0] A:0000 X:0080 Y:0012 P:envMxdiZc - Load A from D0.
$03/A3D4 85 AA STA $AA    [$00:00AA] A:0001 X:0080 Y:0012 P:envMxdizc - Store A in AA.
$03/A3D6 A5 8C LDA $8C    [$00:008C] A:0001 X:0080 Y:0012 P:envMxdizc - Load A from 8C.
$03/A3D8 85 D0 STA $D0    [$00:00D0] A:00FF X:0080 Y:0012 P:eNvMxdizc - Store A in D0.
$03/A3DA A5 AA LDA $AA    [$00:00AA] A:00FF X:0080 Y:0012 P:eNvMxdizc - Load A from AA.
$03/A3DC C9 FF CMP #$FF A:0001 X:0080 Y:0012 P:envMxdizc - Is it FF?
$03/A3DE F0 0C BEQ $0C    [$A3EC] A:0001 X:0080 Y:0012 P:envMxdizc - If so branch to 03A3EC.
$03/A3E0 AD 2F 39 LDA $392F  [$7E:392F] A:0001 X:0080 Y:0012 P:envMxdizc - Load 7E392F into A.
$03/A3E3 AA TAX A:0000 X:0080 Y:0012 P:envMxdiZc - Transfer A to X.
$03/A3E4 A5 D2 LDA $D2    [$00:00D2] A:0000 X:0000 Y:0012 P:envMxdiZc - Load A from D2.
$03/A3E6 9D 29 39 STA $3929,x[$7E:3929] A:0001 X:0000 Y:0012 P:envMxdizc - Store A in 7E3929
$03/A3E9 EE 2F 39 INC $392F  [$7E:392F] A:0001 X:0000 Y:0012 P:envMxdizc - +1 to 7E392F.
$03/A3EC 60 RTS A:0001 X:0000 Y:0012 P:envMxdizc - Return.
--------------------------------------------------------------------------------------------------------------

I'm not really sure what the above is doing, but it seemed quite important.

Code: [Select]
$03/A3ED A5 D7 LDA $D7    [$00:00D7] A:0005 X:0004 Y:0012 P:envMxdiZC - Load A from D7.
$03/A3EF F0 52 BEQ $52    [$A443] A:0001 X:0004 Y:0012 P:envMxdizC - If it is 00 branch to 03A443.
$03/A3F1 A5 D0 LDA $D0    [$00:00D0] A:0001 X:0004 Y:0012 P:envMxdizC - Load A from D0.
$03/A3F3 C9 FF CMP #$FF A:0001 X:0004 Y:0012 P:envMxdizC - Is it FF?
$03/A3F5 F0 4B BEQ $4B    [$A442] A:0001 X:0004 Y:0012 P:envMxdizc - If so branch to 03A442.
$03/A3F7 20 9D A5 JSR $A59D  [$03:A59D] A:0001 X:0004 Y:0012 P:envMxdizc - Jump to Subroutine (Status Checking)
$03/A3FA A5 D0 LDA $D0    [$00:00D0] A:0000 X:0080 Y:0012 P:envMxdiZc - Load A from D0.
$03/A3FC C9 FF CMP #$FF A:0001 X:0080 Y:0012 P:envMxdizc - Is it FF?
$03/A3FE F0 39 BEQ $39    [$A439] A:0001 X:0080 Y:0012 P:envMxdizc - If so branch to 03A439.
$03/A400 A6 A6 LDX $A6    [$00:00A6] A:0001 X:0080 Y:0012 P:envMxdizc - Load X from A6 (character slot).
$03/A402 BD 00 20 LDA $2000,x[$7E:2080] A:0001 X:0080 Y:0012 P:envMxdizc - Load Character Slot's ID.
$03/A405 29 1F AND #$1F A:0085 X:0080 Y:0012 P:eNvMxdizc - -80 to A.
$03/A407 C9 05 CMP #$05 A:0005 X:0080 Y:0012 P:envMxdizc - Is it Edward?
$03/A409 D0 14 BNE $14    [$A41F] A:0005 X:0080 Y:0012 P:envMxdiZC - If not branch to 03A41F.
---------------------------------------------------------------------------------------------------------------------------
$03/A40B AD 82 35 LDA $3582  [$7E:3582] A:0005 X:0080 Y:0012 P:envMxdiZC - Load a value close to encounter type into A (May deal something with the WaterHag battle)
$03/A40E D0 0F BNE $0F    [$A41F] A:0000 X:0080 Y:0012 P:envMxdiZC - If it is not 00 branch to 03A41F
------------------------------------------------------------------------------------------------------------------------.
$03/A410 AD DB 38 LDA $38DB  [$7E:38DB] A:0000 X:0080 Y:0012 P:envMxdiZC - Load 7E38DB into A.
$03/A413 3A DEC A A:0000 X:0080 Y:0012 P:envMxdiZC - -1 to A.
$03/A414 F0 09 BEQ $09    [$A41F] A:00FF X:0080 Y:0012 P:eNvMxdizC - If it is 00 branch to 03A41F.
---------------------------------------------------------------------------------------------------------------------
$03/A416 BD 06 20 LDA $2006,x[$7E:2086] A:00FF X:0080 Y:0012 P:eNvMxdizC - Load Edward's Status Byte 4. 
$03/A419 30 04 BMI $04    [$A41F] A:0000 X:0080 Y:0012 P:envMxdiZC - If he is currently Hiding  branch to 03A41F.
$03/A41B 29 01 AND #$01 A:0000 X:0080 Y:0012 P:envMxdiZC - Is it 01? (Critical)
$03/A41D D0 1A BNE $1A    [$A439] A:0000 X:0080 Y:0012 P:envMxdiZC - If it is so, branch to 03A439.
-----------------------------------------------------------------------------------------------------------------------------
$03/A41F 20 AA A1 JSR $A1AA  [$03:A1AA] A:0000 X:0080 Y:0012 P:envMxdiZC - Jump to Subroutine
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/A1AA 64 A9 STZ $A9    [$00:00A9] A:0000 X:0080 Y:0012 P:envMxdiZC - Store Zero in A9.
$03/A1AC 64 AA STZ $AA    [$00:00AA] A:0000 X:0080 Y:0012 P:envMxdiZC - Store Zero in AA.
$03/A1AE 64 AB STZ $AB    [$00:00AB] A:0000 X:0080 Y:0012 P:envMxdiZC - Store Zero in AB.
$03/A1B0 64 AC STZ $AC    [$00:00AC] A:0000 X:0080 Y:0012 P:envMxdiZC - Store Zero in AC.
$03/A1B2 A6 A6 LDX $A6    [$00:00A6] A:0000 X:0080 Y:0012 P:envMxdiZC - Load Character Slot into X.
$03/A1B4 BD 03 20 LDA $2003,x[$7E:2083] A:0000 X:0080 Y:0012 P:envMxdizC - Load Character Slot's Status Byte 1 into A.
$03/A1B7 29 04 AND #$04 A:0000 X:0080 Y:0012 P:envMxdiZC - Is it Mute?
$03/A1B9 F0 04 BEQ $04    [$A1BF] A:0000 X:0080 Y:0012 P:envMxdiZC - If not branch to 03A1BF.
-------------------------------------------------------------------------------------------------------------------------

--------------------------------------------------------------------------------------------------------------------------------
$03/A1BF BD 03 20 LDA $2003,x[$7E:2083] A:0000 X:0080 Y:0012 P:envMxdiZC - Load Character's Status Byte 1 into A.
$03/A1C2 29 20 AND #$20 A:0000 X:0080 Y:0012 P:envMxdiZC - Is it Toad?
$03/A1C4 F0 04 BEQ $04    [$A1CA] A:0000 X:0080 Y:0012 P:envMxdiZC - If not branch to 03A1CA.
----------------------------------------------------------------------------------

---------------------------------------------------------------------------------------
$03/A1CA BD 03 20 LDA $2003,x[$7E:2083] A:0000 X:0080 Y:0012 P:envMxdiZC - Load Character Slot's Status Byte 1 into A.
$03/A1CD 29 08 AND #$08 A:0000 X:0080 Y:0012 P:envMxdiZC - Is it Pig?
$03/A1CF F0 04 BEQ $04    [$A1D5] A:0000 X:0080 Y:0012 P:envMxdiZC - If not branch to 03A1D5.
--------------------------------------------------------------------------------------

--------------------------------------------------------------------------------------
$03/A1D5 BD 0B 20 LDA $200B,x[$7E:208B] A:0000 X:0080 Y:0012 P:envMxdiZC - Load Character Slot's Current MP Byte 1.
$03/A1D8 85 AD STA $AD    [$00:00AD] A:0000 X:0080 Y:0012 P:envMxdiZC - Store A in AD.
$03/A1DA BD 0C 20 LDA $200C,x[$7E:208C] A:0000 X:0080 Y:0012 P:envMxdiZC - Load Character Slot's Current MP Byte 2.
$03/A1DD F0 04 BEQ $04    [$A1E3] A:0000 X:0080 Y:0012 P:envMxdiZC - If 00 branch to 03A1E3.
------------------------------------------------------------------------------------

------------------------------------------------------------------------------------
$03/A1E5 BD 06 20 LDA $2006,x[$7E:2086] A:0000 X:0080 Y:0012 P:envMxdizC - Load Character Slot's Status Byte 4 into A.
$03/A1E8 30 17 BMI $17    [$A201] A:0000 X:0080 Y:0012 P:envMxdiZC - If it is Hiding branch to 03A201.
$03/A1EA A0 05 00 LDY #$0005 A:0000 X:0080 Y:0012 P:envMxdiZC - Load 0005 into Y.
$03/A1ED AE 34 35 LDX $3534  [$7E:3534] A:0000 X:0080 Y:0005 P:envMxdizC - Load 7E3534 into A.
--------------------------------------------------------------(Looping Point)------------------------------------------------------------
$03/A1F0 BD 03 33 LDA $3303,x[$7E:331F] A:0000 X:001C Y:0005 P:envMxdizC - Load 7E3303 +X into A.
$03/A1F3 C9 FF CMP #$FF A:0000 X:001C Y:0005 P:envMxdiZC - Is it FF?
$03/A1F5 F0 03 BEQ $03    [$A1FA] A:0000 X:001C Y:0005 P:envMxdizc - If so branch to 03A1FA.
$03/A1F7 20 88 A2 JSR $A288  [$03:A288] A:0000 X:001C Y:0005 P:envMxdizc - Jump to Subroutine
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/A288 64 B5 STZ $B5    [$00:00B5] A:0000 X:001C Y:0005 P:envMxdizc - Store Zero in B5.
$03/A28A DA PHX A:0000 X:001C Y:0005 P:envMxdizc - Push X onto Stack.
$03/A28B BD 03 33 LDA $3303,x[$7E:331F] A:0000 X:001C Y:0005 P:envMxdizc - Load A from 7E331F.
$03/A28E C9 05 CMP #$05 A:0000 X:001C Y:0005 P:envMxdiZc - Is it 05?
$03/A290 F0 0C BEQ $0C    [$A29E] A:0000 X:001C Y:0005 P:eNvMxdizc -If so branch to 03A29E.
$03/A292 C9 08 CMP #$08 A:0000 X:001C Y:0005 P:eNvMxdizc - Is it 08?
$03/A294 F0 08 BEQ $08    [$A29E] A:0000 X:001C Y:0005 P:eNvMxdizc - If so branch to 03A29E.
$03/A296 C9 0C CMP #$0C A:0000 X:001C Y:0005 P:eNvMxdizc - Is it 0C?
$03/A298 F0 04 BEQ $04    [$A29E] A:0000 X:001C Y:0005 P:eNvMxdizc - If so branch to 03A29E.
$03/A29A C9 10 CMP #$10 A:0000 X:001C Y:0005 P:eNvMxdizc - Is it 10?
$03/A29C D0 07 BNE $07    [$A2A5] A:0000 X:001C Y:0005 P:eNvMxdizc - If so branch to 03A29E.
$03/A2A5 FA PLX A:0000 X:001C Y:0005 P:eNvMxdizc - Pull X from Stack.
$03/A2A6 DA PHX A:0000 X:001C Y:0005 P:envMxdizc - Push X onto Stack.
$03/A2A7 BD 03 33 LDA $3303,x[$7E:331F] A:0000 X:001C Y:0005 P:envMxdizc - Load A from 7E331F.
$03/A2AA 0A ASL A A:0000 X:001C Y:0005 P:envMxdiZc - x2 to A.
$03/A2AB AA TAX A:0000 X:001C Y:0005 P:envMxdiZc - Transfer A to X.
$03/A2AC BF 19 FD 13 LDA $13FD19,x[$13:FD19] A:0000 X:0000 Y:0005 P:envMxdiZc - Load A from LoRom.
$03/A2B0 85 B3 STA $B3    [$00:00B3] A:0000 X:0000 Y:0005 P:envMxdiZc - Store A in B3.
$03/A2B2 BF 1A FD 13 LDA $13FD1A,x[$13:FD1A] A:0000 X:0000 Y:0005 P:envMxdiZc - Load A from LoRom.
$03/A2B6 85 B4 STA $B4    [$00:00B4] A:0000 X:0000 Y:0005 P:envMxdiZc - Store A in B4.
$03/A2B8 A6 A6 LDX $A6    [$00:00A6] A:0000 X:0000 Y:0005 P:envMxdiZc - Load X from Character Slot.
$03/A2BA BD 03 20 LDA $2003,x[$7E:2083] A:0000 X:0080 Y:0005 P:envMxdizc  - Load Character Slot's Status Byte 1.
$03/A2BD 25 B3 AND $B3    [$00:00B3] A:0000 X:0080 Y:0005 P:envMxdiZc - Add the value in B3 onto A.
$03/A2BF D0 07 BNE $07    [$A2C8] A:0000 X:0080 Y:0005 P:envMxdiZc - If not 00 branch to 03A2C8.
----------------------------------------------------------------------------------------------------------------
$03/A2C1 BD 04 20 LDA $2004,x[$7E:2084] A:0000 X:0080 Y:0005 P:envMxdiZc - Load Character Slot's Status Byte 2 into A.
$03/A2C4 25 B4 AND $B4    [$00:00B4] A:0000 X:0080 Y:0005 P:envMxdiZc - Add the value in B4 onto A.
$03/A2C6 F0 04 BEQ $04    [$A2CC] A:0000 X:0080 Y:0005 P:envMxdiZc - If 00 branch to 03A2CC.
----------------------------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------------------------------
$03/A2CD BD 02 33 LDA $3302,x[$7E:331E] A:0000 X:001C Y:0005 P:envMxdizc - Load A from Character's Command Menu +X.
$03/A2D0 48 PHA A:0050 X:001C Y:0005 P:envMxdizc - Push A from Stack. (If the character may use Fight)
$03/A2D1 29 7F AND #$7F A:0050 X:001C Y:0005 P:envMxdizc - Reduce negatives to positives.
$03/A2D3 05 B5 ORA $B5    [$00:00B5] A:0050 X:001C Y:0005 P:envMxdizc - Also add the value in B5 if applicable onto A.
$03/A2D5 9D 02 33 STA $3302,x[$7E:331E] A:0050 X:001C Y:0005 P:envMxdizc - Store A in 7E331E.
$03/A2D8 68 PLA A:0050 X:001C Y:0005 P:envMxdizc - Pull A from Stack.
$03/A2D9 DD 02 33 CMP $3302,x[$7E:331E] A:0050 X:001C Y:0005 P:envMxdizc - Does the value in match the one in the Command Slot?
$03/A2DC F0 04 BEQ $04    [$A2E2] A:0050 X:001C Y:0005 P:envMxdiZC - If so branch to 03A2E2.
-----------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------------
$03/A2E2 60 RTS A:0050 X:001C Y:0005 P:envMxdiZC - Return
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/A1FA E8 INX A:0050 X:001C Y:0005 P:envMxdiZC( + 4 to X.
$03/A1FB E8 INX A:0050 X:001D Y:0005 P:envMxdizC
$03/A1FC E8 INX A:0050 X:001E Y:0005 P:envMxdizC
$03/A1FD E8 INX A:0050 X:001F Y:0005 P:envMxdizC              )
$03/A1FE 88 DEY A:0050 X:0020 Y:0005 P:envMxdizC - -1 to Y
$03/A1FF D0 EF BNE $EF    [$A1F0] A:0050 X:0020 Y:0004 P:envMxdizC - Repeat for each of the commands.
--------------------------------------------------------------------------------------------------------------------
$03/A201 A5 AA LDA $AA    [$00:00AA] A:00FF X:0030 Y:0000 P:envMxdiZC - Load AA into A.
$03/A203 F0 0A BEQ $0A    [$A20F] A:0000 X:0030 Y:0000 P:envMxdiZC - If 00 branch to 03A20F
------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------
$03/A20F AE 36 35 LDX $3536  [$7E:3536] A:0000 X:0030 Y:0000 P:envMxdiZC - Load 7E3536 into X.
$03/A212 86 AF STX $AF    [$00:00AF] A:0000 X:0120 Y:0000 P:envMxdizC - Store X in AF.
$03/A214 7B TDC A:0000 X:0120 Y:0000 P:envMxdizC - Transfer Direct Page.
$03/A215 AA TAX A:0000 X:0120 Y:0000 P:envMxdiZC - Transfer A to X.
$03/A216 86 B1 STX $B1    [$00:00B1] A:0000 X:0000 Y:0000 P:envMxdiZC - Store X in B1 -
$03/A218 A6 AF LDX $AF    [$00:00AF] A:0000 X:0000 Y:0000 P:envMxdiZC - Load X from AF.
$03/A21A BD 7B 2C LDA $2C7B,x[$7E:2D9B] A:0000 X:0120 Y:0000 P:envMxdizC  - Load Character's Spell Menu Data into A.
$03/A21D F0 4B BEQ $4B    [$A26A] A:0000 X:0120 Y:0000 P:envMxdiZC - If 00 branch to 03A26A.
----------------------------------------------------------------------------------------------------------------

--------------------------------------------------------------------------------------------------------------------
$03/A26A A6 AF LDX $AF    [$00:00AF] A:0000 X:0120 Y:0000 P:envMxdiZC - Load X from AF.
$03/A26C E8 INX A:0000 X:0120 Y:0000 P:envMxdizC - (+4 to X.)
$03/A26D E8 INX A:0000 X:0121 Y:0000 P:envMxdizC -
$03/A26E E8 INX A:0000 X:0122 Y:0000 P:envMxdizC
$03/A26F E8 INX A:0000 X:0123 Y:0000 P:envMxdizC
$03/A270 86 AF STX $AF    [$00:00AF] A:0000 X:0124 Y:0000 P:envMxdizC - Store X in AF.
$03/A272 E6 B1 INC $B1    [$00:00B1] A:0000 X:0124 Y:0000 P:envMxdizC - +1 to B1.
$03/A274 A5 B1 LDA $B1    [$00:00B1] A:0000 X:0124 Y:0000 P:envMxdizC - Load A from B1.
$03/A276 C9 48 CMP #$48 A:0001 X:0124 Y:0000 P:envMxdizC - Has it gone through 48 times? (Amount of spells one can have 48 = 72, which is 24x3)
$03/A278 F0 03 BEQ $03    [$A27D] A:0001 X:0124 Y:0000 P:eNvMxdizc - If so branch to 03A27D.
$03/A27A 4C 18 A2 JMP $A218  [$03:A218] A:0001 X:0124 Y:0000 P:eNvMxdizc - Jump to Back to 03A218.
------------------------------------------------------------------------------------------------------------------------------------------------------

-----------------------------------------------------------------------------------------------------------------------------------------------------
$03/A27D AD 22 18 LDA $1822  [$7E:1822] A:0048 X:0240 Y:0000 P:envMxdiZC - Load A from 7E1822.
$03/A280 85 00 STA $00    [$00:0000] A:0001 X:0240 Y:0000 P:envMxdizC - Store A in 00.
$03/A282 A9 0E LDA #$0E A:0001 X:0240 Y:0000 P:envMxdizC - Load 0E into A.
$03/A284 20 85 80 JSR $8085  [$03:8085] A:000E X:0240 Y:0000 P:envMxdizC - Jump to Subroutine (???)
$03/A287 60 RTS A:0000 X:0002 Y:000D P:envMxdiZc - Return
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/A422 A5 D0 LDA $D0    [$00:00D0] A:0000 X:0002 Y:000D P:envMxdiZc - Load D0 into A.
$03/A424 20 7E 84 JSR $847E  [$03:847E] A:0001 X:0002 Y:000D P:envMxdizc - Jump to Subroutine
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/847E 0A ASL A A:0001 X:0002 Y:000D P:envMxdizc - x2 A.
$03/847F 0A ASL A A:0002 X:0002 Y:000D P:envMxdizc - x2 A.
$03/8480 0A ASL A A:0004 X:0002 Y:000D P:envMxdizc - x2 A.
$03/8481 60 RTS A:0008 X:0002 Y:000D P:envMxdizc - Return
$03/A427 AA TAX A:0008 X:0002 Y:000D P:envMxdizc - Transfer A to X.
$03/A428 BD DB 32 LDA $32DB,x[$7E:32E3] A:0008 X:0008 Y:000D P:envMxdizc - Load A from Right Hand Item.
$03/A42B C9 4C CMP #$4C A:0044 X:0008 Y:000D P:envMxdizc - Is it The Avenger?
$03/A42D F0 07 BEQ $07    [$A436] A:0044 X:0008 Y:000D P:eNvMxdizc - If so branch to 03A436.
$03/A42F BD DF 32 LDA $32DF,x[$7E:32E7] A:0044 X:0008 Y:000D P:eNvMxdizc - Load A from Left Hand Item.
$03/A432 C9 4C CMP #$4C A:0000 X:0008 Y:000D P:envMxdiZc - Is it The Avenger?
$03/A434 D0 0C BNE $0C    [$A442] A:0000 X:0008 Y:000D P:eNvMxdizc - If not branch to 03A442.
-------------------------------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------------------------------------
$03/A442 60 RTS A:0000 X:0008 Y:000D P:eNvMxdizc - Return

Well that was draining and unfortunately there isn't much to show for it. But there was this...

Code: [Select]
$03/A400 A6 A6 LDX $A6    [$00:00A6] A:0001 X:0080 Y:0012 P:envMxdizc - Load X from A6 (character slot).
$03/A402 BD 00 20 LDA $2000,x[$7E:2080] A:0001 X:0080 Y:0012 P:envMxdizc - Load Character Slot's ID.
$03/A405 29 1F AND #$1F A:0085 X:0080 Y:0012 P:eNvMxdizc - -80 to A.
$03/A407 C9 05 CMP #$05 A:0005 X:0080 Y:0012 P:envMxdizc - Is it Edward?
$03/A409 D0 14 BNE $14    [$A41F] A:0005 X:0080 Y:0012 P:envMxdiZC - If not branch to 03A41F.
---------------------------------------------------------------------------------------------------------------------------
$03/A40B AD 82 35 LDA $3582  [$7E:3582] A:0005 X:0080 Y:0012 P:envMxdiZC - Load a value close to encounter type into A (May deal something with the WaterHag battle)
$03/A40E D0 0F BNE $0F    [$A41F] A:0000 X:0080 Y:0012 P:envMxdiZC - If it is not 00 branch to 03A41F
------------------------------------------------------------------------------------------------------------------------.
$03/A410 AD DB 38 LDA $38DB  [$7E:38DB] A:0000 X:0080 Y:0012 P:envMxdiZC - Load 7E38DB into A.
$03/A413 3A DEC A A:0000 X:0080 Y:0012 P:envMxdiZC - -1 to A.
$03/A414 F0 09 BEQ $09    [$A41F] A:00FF X:0080 Y:0012 P:eNvMxdizC - If it is 00 branch to 03A41F.
---------------------------------------------------------------------------------------------------------------------
$03/A416 BD 06 20 LDA $2006,x[$7E:2086] A:00FF X:0080 Y:0012 P:eNvMxdizC - Load Edward's Status Byte 4. 
$03/A419 30 04 BMI $04    [$A41F] A:0000 X:0080 Y:0012 P:envMxdiZC - If he is currently Hiding  branch to 03A41F.
$03/A41B 29 01 AND #$01 A:0000 X:0080 Y:0012 P:envMxdiZC - Is it 01? (Critical)
$03/A41D D0 1A BNE $1A    [$A439] A:0000 X:0080 Y:0012 P:envMxdiZC - If it is so, branch to 03A439.
-----------------------------------------------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------------------------------------------------
$03/A439 A9 FF LDA #$FF A:0001 X:0080 Y:0012 P:envMxdizC - Load FF into A.
$03/A43B 85 D0 STA $D0    [$00:00D0] A:00FF X:0080 Y:0012 P:eNvMxdizC - Store A in D0.
$03/A43D A9 01 LDA #$01 A:00FF X:0080 Y:0012 P:eNvMxdizC - Load 01 into A.
$03/A43F 20 85 80 JSR $8085  [$03:8085] A:0001 X:0080 Y:0012 P:envMxdizC - Jump to Subroutine (??)
$03/A442 60 RTS A:0002 X:0002 Y:0012 P:envMxdizc - Return
(Appears to somehow get rid of the pointer for choosing commands quite important when for an Auto-Hide dealing)


Which is the Routine revolving the activation of Edward's Auto-Hide command.




Hmm, you were quite mistaken about the Auto-Commands.

Auto-Cover looks for Paladin Cecil Specifically (any other character that uses Cover is thereby protected by the Paladin) but is disabled when the Dark Knight is present (which can never logically happen...)

Auto-Hide looks for Edward's ID, sees that it is his, and then uses the command.

http://slickproductions.org/forum/index.php?topic=1754.msg18211#msg18211

Quite old info. by this point, but I can see how those sorts of things could fall through the cracks.

Aside from Auto-Cover and Auto-Hide I can't think of any other Auto-Commands off the top of my head, unless you consider Berserk to give Auto-Fight (which is likely does)

Though the information is quite old. The new information above allows you to switch the conditions for activating Auto-Hide (in one instance. Its likely not too useful or reliable because this instance is so specific. It Has to be Edward's Turn, when he is put in critical for this instance to occur, which means there must be another instance I haven't located. Likely close to the second instance at 03AB56. I'll take a look at that a little bit later and see if that will make it work once and for all.










Title: Re: Grimoire LD's Notes, Methods, and Hacks (FFI spell routines in FFIV!)
Post by: chillyfeez on October 17, 2013, 07:07:53 PM
Huh... Intriguing. I might be able to alter these conditions to make an auto-learn happen (...maybe...) but unless I'm missing it, the instruction to actually execute Hide isn't here, right?
Title: Re: Grimoire LD's Notes, Methods, and Hacks (FFI spell routines in FFIV!)
Post by: Grimoire LD on October 17, 2013, 08:02:07 PM
That is correct. In what I found is If Edward is knocked into Critical While his Turn is Active, get rid of his menu. The rest of the code assumes that Auto-Hide is running from its proper course elsewhere.



Hmm, there's a bit of interesting dealings around this area as well...

Code: [Select]
$03/AA98 22 B4 FF 13 JSL $13FFB4[$13:FFB4] A:00FF X:FFFF Y:001A P:eNvMxdizC - Jump to Subroutine Long (In Lo Rom)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$13/FFB4 A0 05 00 LDY #$0005 A:00FF X:FFFF Y:001A P:eNvMxdizC - Load 0005 into A.
$13/FFB7 7B TDC A:00FF X:FFFF Y:0005 P:envMxdizC - Transfer Direct Page.
$13/FFB8 AA TAX A:0000 X:FFFF Y:0005 P:envMxdiZC - Transfer a to X.
$13/FFB9 BD 00 20 LDA $2000,x[$7E:2000] A:0000 X:0000 Y:0005 P:envMxdiZC - Load Character Slot ID into A.
$13/FFBC 29 1F AND #$1F A:0081 X:0000 Y:0005 P:eNvMxdizC - Get rid of negative bits.
$13/FFBE C9 13 CMP #$13 A:0001 X:0000 Y:0005 P:envMxdizC - Is it FuSoYa?
$13/FFC0 D0 15 BNE $15    [$FFD7] A:0001 X:0000 Y:0005 P:eNvMxdizc - If not branch to 13FFD7.
-------------------------------------------------------------------------------------------------------------------------
$13/FFC2 BD 03 20 LDA $2003,x[$7E:2083] A:0013 X:0080 Y:0004 P:envMxdiZC - Load Status Byte 1 from FuSoYa.
$13/FFC5 29 C0 AND #$C0 A:0000 X:0080 Y:0004 P:envMxdiZC - Is he Dead or Petrified?
$13/FFC7 D0 07 BNE $07    [$FFD0] A:0000 X:0080 Y:0004 P:envMxdiZC - If so branch to 13FFD0.
$13/FFC9 BD 04 20 LDA $2004,x[$7E:2084] A:0000 X:0080 Y:0004 P:envMxdiZC - Load Status Byte 2 from FuSoYa.
$13/FFCC 29 3C AND #$3C A:0000 X:0080 Y:0004 P:envMxdiZC -Is he Berserk, Charm, Sleep, or Paralyzed?
$13/FFCE F0 15 BEQ $15    [$FFE5] A:0000 X:0080 Y:0004 P:envMxdiZC - If not branch to 13FFE5.
--------------------------------------------------------------------------------------------------------------------
$13/FFD0 A9 FF LDA #$FF A:0040 X:0080 Y:0004 P:envMxdizC - Load FF into A.
$13/FFD2 8D 7C 35 STA $357C  [$7E:357C] A:00FF X:0080 Y:0004 P:eNvMxdizC - Store A in 7E357C.
$13/FFD5 80 0E BRA $0E    [$FFE5] A:00FF X:0080 Y:0004 P:eNvMxdizC - Branch to 13FFE5
-----------------------------------------------------------------------------------------------------------------------
$13/FFD7 C2 20 REP #$20 A:0001 X:0000 Y:0005 P:eNvMxdizc - Reset Processor Status
$13/FFD9 8A TXA A:0001 X:0000 Y:0005 P:eNvmxdizc - Transfer X to A.
$13/FFDA 18 CLC A:0000 X:0000 Y:0005 P:envmxdiZc - Clear Carry Flag.
$13/FFDB 69 80 00 ADC #$0080 A:0000 X:0000 Y:0005 P:envmxdiZc
$13/FFDE AA TAX A:0080 X:0000 Y:0005 P:envmxdizc - Transfer A to X.
$13/FFDF 7B TDC A:0080 X:0080 Y:0005 P:envmxdizc - Transfer Direct Page.
$13/FFE0 E2 20 SEP #$20 A:0000 X:0080 Y:0005 P:envmxdiZc
$13/FFE2 88 DEY A:0000 X:0080 Y:0005 P:envMxdiZc - -1 to Y.
$13/FFE3 D0 D4 BNE $D4    [$FFB9] A:0000 X:0080 Y:0004 P:envMxdizc Loop back to FFB9 (looks through all five characters)
-------------------------------------------------------------------------------------------------------------------
$13/FFE5 6B RTL A:0000 X:0080 Y:0004 P:envMxdiZC - Return from Long Jump.
(This may have something to do with the termination of Regen if FuSoYa is incapacitated but we've never noticed a problem with that without FuSoYa using it, have we?)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/AA9C AD 7C 35 LDA $357C  [$7E:357C] A:00FF X:0080 Y:0004 P:eNvMxdizC - Load A from 7E357C.
$03/AA9F C9 FF CMP #$FF A:00FF X:0080 Y:0004 P:eNvMxdizC - Is it FF?
$03/AAA1 F0 45 BEQ $45    [$AAE8] A:00FF X:0080 Y:0004 P:envMxdiZC - If so branch to 03AAE8
------------------------------------------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------------------------------------------
$03/AAE8 A9 11 LDA #$11 A:00FF X:0080 Y:0004 P:envMxdiZC - Load 11 into A.
$03/AAEA 20 85 80 JSR $8085  [$03:8085] A:0011 X:0080 Y:0004 P:envMxdizC - Jump to Subroutine (??)
$03/AAED A9 0C LDA #$0C A:0000 X:001A Y:0004 P:envMxdiZC - Load 0C into A,
$03/AAEF 4C 85 80 JMP $8085  [$03:8085] A:000C X:001A Y:0004 P:envMxdizC - Jump to Subroutine (??)
(I'll leave this part alone for now. It doesn't seem to have any useful information at this time and I will pick it back up at...)
$03/AB09 A6 A6 LDX $A6    [$00:00A6] A:0000 X:0000 Y:0012 P:envMxdiZc - Load X from Character Slot.
$03/AB0B BD 03 20 LDA $2003,x[$7E:2003] A:0000 X:0000 Y:0012 P:envMxdiZc - Load Character Slot's Status Byte 1 into A.
$03/AB0E 29 C0 AND #$C0 A:0000 X:0000 Y:0012 P:envMxdiZc - Is it Dead or Petrified?
$03/AB10 D0 05 BNE $05    [$AB17] A:0000 X:0000 Y:0012 P:envMxdiZc - If so branch to 03AB17.
$03/AB12 BD 04 20 LDA $2004,x[$7E:2004] A:0000 X:0000 Y:0012 P:envMxdiZc - Load Character Slot's Status Byte 2 into A.
$03/AB15 29 30 AND #$30 A:0000 X:0000 Y:0012 P:envMxdiZc - Is it Sleep or Paralyze?
$03/AB17 D0 07 BNE $07    [$AB20] A:0000 X:0000 Y:0012 P:envMxdiZc - If so branch to 03AB20.
$03/AB19 BD 05 20 LDA $2005,x[$7E:2005] A:0000 X:0000 Y:0012 P:envMxdiZc - Load Character's Status Byte 3 into A.
$03/AB1C 29 42 AND #$42 A:0000 X:0000 Y:0012 P:envMxdiZc - Is it Stopped or Jumping?
$03/AB1E F0 03 BEQ $03    [$AB23] A:0000 X:0000 Y:0012 P:envMxdiZc - If not branch to 03AB23.
----------------------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------------------------
$03/AB23 BD 04 20 LDA $2004,x[$7E:2004] A:0000 X:0000 Y:0012 P:envMxdiZc - Load Status Byte 2 into A.
$03/AB26 29 0C AND #$0C A:0000 X:0000 Y:0012 P:envMxdiZc - Is it Berserk or Charm?
$03/AB28 F0 20 BEQ $20    [$AB4A] A:0000 X:0000 Y:0012 P:envMxdiZc - If so branch to 03AB4A.
$03/AB4A BD 06 20 LDA $2006,x[$7E:2006] A:0000 X:0000 Y:0012 P:envMxdiZc - Load Status Byte 4 into A.
$03/AB4D 29 01 AND #$01 A:0000 X:0000 Y:0012 P:envMxdiZc - Is it Critical?
$03/AB4F F0 50 BEQ $50    [$ABA1] A:0000 X:0000 Y:0012 P:envMxdiZc - If not branch to 03ABA1.
------------------------------------------------------------------------------------------------------------------------------------
$03/AB51 BD 00 20 LDA $2000,x[$7E:2080] A:0001 X:0080 Y:0012 P:envMxdizc - Load Character ID into A.
$03/AB54 29 1F AND #$1F A:0085 X:0080 Y:0012 P:eNvMxdizc - -Get rid of negative bits.
$03/AB56 C9 05 CMP #$05 A:0005 X:0080 Y:0012 P:envMxdizc - Is it Edward?
$03/AB58 D0 47 BNE $47    [$ABA1] A:0005 X:0080 Y:0012 P:envMxdiZC - If not branch to 03ABA1.
----------------------------------------------------------------------------------------------------------------------------------------
$03/AB5A AD 82 35 LDA $3582  [$7E:3582] A:0005 X:0080 Y:0012 P:envMxdiZC - Load A from 7E3582 (One byte after what kind of attack the battle started in. Likely related to the WaterHag battle somehow...)
$03/AB5D D0 42 BNE $42    [$ABA1] A:0000 X:0080 Y:0012 P:envMxdiZC - If it is not 00 branch to 03ABA1.
-----------------------------------------------------------------------------------------------------------------------------------------
$03/AB5F A9 03 LDA #$03 A:0000 X:0080 Y:0012 P:envMxdiZC - Load 03 into A.
$03/AB61 20 69 85 JSR $8569  [$03:8569] A:0003 X:0080 Y:0012 P:envMxdizC - Jump to Subroutine (Something to do with timers?)
$03/AB64 AE 98 35 LDX $3598  [$7E:3598] A:0000 X:0080 Y:0012 P:envMxdiZc - Load X from 7E3598
$03/AB67 BD 06 2A LDA $2A06,x[$7E:2A1E] A:0000 X:0018 Y:0012 P:envMxdizc - Load A from Status Durations.
$03/AB6A 29 08 AND #$08 A:0000 X:0018 Y:0012 P:envMxdiZc - Is it 08?
$03/AB6C D0 33 BNE $33    [$ABA1] A:0000 X:0018 Y:0012 P:envMxdiZc - Branch if not 00 to 03ABA1.
$03/AB6E A6 A6 LDX $A6    [$00:00A6] A:0000 X:0018 Y:0012 P:envMxdiZc- Load A from Character Slot.
$03/AB70 BD 06 20 LDA $2006,x[$7E:2086] A:0000 X:0080 Y:0012 P:envMxdizc - Load Edward's Status Byte 4.
$03/AB73 10 0B BPL $0B    [$AB80] A:0001 X:0080 Y:0012 P:envMxdizc - If he is not already Hiding branch to 03AB80.
----------------------------------------------------------------------------------------------------------------------------------------------------
$03/AB80 20 33 AD JSR $AD33  [$03:AD33] A:0001 X:0080 Y:0012 P:envMxdizc - Jump to Subroutine (Checks if current characters are alive or Stone/Dead.
$03/AB83 3A DEC A A:0002 X:0080 Y:0012 P:envMxdizC - -1 to A.
$03/AB84 F0 1B BEQ $1B    [$ABA1] A:0001 X:0080 Y:0012 P:envMxdizC - If 00 branch to 03ABA1.
$03/AB86 20 09 AD JSR $AD09  [$03:AD09] A:0001 X:0080 Y:0012 P:envMxdizC - Jump to Subroutine
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/AD09 A6 A6 LDX $A6    [$00:00A6] A:0001 X:0080 Y:0012 P:envMxdizC - Load X from Character Slot.
$03/AD0B A9 09 LDA #$09 A:0001 X:0080 Y:0012 P:envMxdizC - Load 09 into A. (Command - Hide)
$03/AD0D 9D 51 20 STA $2051,x[$7E:20D1] A:0009 X:0080 Y:0012 P:envMxdizC - Store A in Next Action to Take
$03/AD10 80 07 BRA $07    [$AD19] A:0009 X:0080 Y:0012 P:envMxdizC - Branch to 03AD19.
---------------------------------------------------------------------------------------------------------------------

-------------------------------------------------------------------------------------------------------------------------
$03/AD19 A9 80 LDA #$80 A:0009 X:0080 Y:0012 P:envMxdizC - Load 80 into A.
$03/AD1B 9D 50 20 STA $2050,x[$7E:20D0] A:0080 X:0080 Y:0012 P:eNvMxdizC - Store A in 50 (Unknown)
$03/AD1E 9E 53 20 STZ $2053,x[$7E:20D3] A:0080 X:0080 Y:0012 P:eNvMxdizC - Store Zero in Targeting (Meaning Always Target Self)
$03/AD21 A5 8E LDA $8E    [$00:008E] A:0080 X:0080 Y:0012 P:eNvMxdizC - Load the value 8E into A.
$03/AD23 AA TAX A:0001 X:0080 Y:0012 P:envMxdizC - Transfer A to X.
$03/AD24 7B TDC A:0001 X:0001 Y:0012 P:envMxdizC - Transfer Direct Page.
$03/AD25 20 5F 85 JSR $855F  [$03:855F] A:0000 X:0001 Y:0012 P:envMxdiZC - Jump to Subroutine.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/855F 1F FE FE 13 ORA $13FEFE,x[$13:FEFF] A:0000 X:0001 Y:0012 P:envMxdiZC - Add the value in 13FEFE+X into A.
$03/8563 60 RTS A:0040 X:0001 Y:0012 P:envMxdizC - Return
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/AD28 A6 A6 LDX $A6    [$00:00A6] A:0040 X:0001 Y:0012 P:envMxdizC - Load Character Slot into X.
$03/AD2A 9D 54 20 STA $2054,x[$7E:20D4] A:0040 X:0080 Y:0012 P:envMxdizC - Store A in Edward's Next Party Target (but I thought 00 would suffice? Hmm...)
$03/AD2D A2 01 00 LDX #$0001 A:0040 X:0080 Y:0012 P:envMxdizC - Load 01 into X.
$03/AD30 86 D4 STX $D4    [$00:00D4] A:0040 X:0001 Y:0012 P:envMxdizC - Store X in D4.
$03/AD32 60 RTS A:0040 X:0001 Y:0012 P:envMxdizC - Return
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

And there you have it. The way Hide works and the ways to modify it. The entire point of the Critical Check seems Purely for Edward's Auto-Hiding purpose. And the means to switch conditions (and targeting from the looks of it) seems quite a simple matter. But for the purposes of what you want to use it for, it doesn't even need to be a command. Just something that especially looks at the character and responds appropriately.











Title: Re: Grimoire LD's Notes, Methods, and Hacks (FFI spell routines in FFIV!)
Post by: Grimoire LD on October 20, 2013, 06:14:35 PM
While looking for In-battle names in memory I stumbled upon what makes Yang unique as for how his damage is calculated. This is quite important as this is the first time I've seen actual damage formulas being compiled and created.

Attack Building Formula

Code: [Select]
$03/9B03 9C 77 39 STZ $3977  [$7E:3977] A:0001 X:FFFF Y:0024 P:eNvMxdizc - Store Zero in 7E3977 (this seems to be what tells the game to ignore Equipped Weapon's power and go with a different damage formula.
$03/9B06 A0 01 00 LDY #$0001 A:0001 X:FFFF Y:0024 P:eNvMxdizc - Load 1 into Y.
$03/9B09 B1 80 LDA ($80),y[$7E:2001] A:0001 X:FFFF Y:0001 P:envMxdizc - Load Slot's ID.
$03/9B0B 29 0F AND #$0F A:0000 X:FFFF Y:0001 P:envMxdiZc - Get rid of negatives?
$03/9B0D C9 00 CMP #$06 A:0000 X:FFFF Y:0001 P:envMxdiZc - Is it Yang's ID?
$03/9B0F D0 03 BNE $03    [$9B14] A:0000 X:FFFF Y:0001 P:envMxdiZC - If not branch to 039B14.
$03/9B11 EE 77 39 INC $3977  [$7E:3977] A:0000 X:FFFF Y:0001 P:envMxdiZC - +1 to 7E397 (purpose listed above)
$03/9B14 A0 33 00 LDY #$0033 A:0000 X:FFFF Y:0001 P:envMxdizC - Load 33 into Y.
$03/9B17 B1 80 LDA ($80),y[$7E:2033] A:0000 X:FFFF Y:0033 P:envMxdizC - Load Slot's Right Hand Equipped Weapon into A.
$03/9B19 F0 20 BEQ $20    [$9B3B] A:0000 X:FFFF Y:0033 P:envMxdiZC - If Nothing branch to 039B3B.
------------------------------------------------------------------------------------------------------------------------------
(Branches off to a normal weapon)
$03/9B1B A0 25 00 LDY #$0025 A:0016 X:FFFF Y:0033 P:envMxdizc - Load Slot's Right Handed Weapon ???.
$03/9B1E B1 82 LDA ($82),y[$7E:27A5] A:0016 X:FFFF Y:0025 P:envMxdizc - Load it into A.
$03/9B20 30 19 BMI $19    [$9B3B] A:002D X:FFFF Y:0025 P:envMxdizc - If it is negative branch to 039B3B.
$03/9B22 AD 77 39 LDA $3977  [$7E:3977] A:002D X:FFFF Y:0025 P:envMxdizc - Load A from Yang's Formula byte.
$03/9B25 09 80 ORA #$80 A:0000 X:FFFF Y:0025 P:envMxdiZc - Add 80 if applicable.
$03/9B27 8D 77 39 STA $3977  [$7E:3977] A:0080 X:FFFF Y:0025 P:eNvMxdizc - Store 80 in ?Yang's Formula Byte?
$03/9B2A A0 21 00 LDY #$0021 A:0080 X:FFFF Y:0025 P:eNvMxdizc - Load 20 into Y.
$03/9B2D 7B TDC A:0080 X:FFFF Y:0021 P:envMxdizc - Transfer Direct Page.
$03/9B2E AA TAX A:0000 X:FFFF Y:0021 P:envMxdiZc - Transfer A to X.
-------------------------------------------------(Looping Point)------------------------------------------------------------
$03/9B2F B1 82 LDA ($82),y[$7E:27A1] A:0000 X:0000 Y:0021 P:envMxdiZc - Load A from Right Handed Weapon Property.
$03/9B31 9D 9C 28 STA $289C,x[$7E:289C] A:0001 X:0000 Y:0021 P:envMxdizc - Store A in 7E289C+X.
$03/9B34 C8 INY A:0001 X:0000 Y:0021 P:envMxdizc + 1 to Y.
$03/9B35 E8 INX A:0001 X:0000 Y:0022 P:envMxdizc +1 to X.
$03/9B36 E0 0B 00 CPX #$000B A:0001 X:0001 Y:0022 P:envMxdizc - Has it gone through 11 times? (put the entire weapon data in another section.)
$03/9B39 D0 F4 BNE $F4    [$9B2F] A:0001 X:0001 Y:0022 P:eNvMxdizc - If not loop back to 039B2F.
------------------------------------------------------------------------------------------------------------------------------------
$03/9B3B A0 35 00 LDY #$0035 A:0000 X:FFFF Y:0033 P:envMxdiZC - Load 35 into Y.
$03/9B3E B1 80 LDA ($80),y[$7E:2035] A:0000 X:FFFF Y:0035 P:envMxdizC -  Load Slot's Left Hand Equipped Weapon into A.
$03/9B40 F0 21 BEQ $21    [$9B63] A:0062 X:FFFF Y:0035 P:envMxdizC - If nothing branch to 03B963.
------------------------------------------------------------------------------------------------
$03/9B42 A0 30 00 LDY #$0030 A:0062 X:FFFF Y:0035 P:envMxdizC - Load 30 into Y.
$03/9B45 B1 82 LDA ($82),y[$7E:27B0] A:0062 X:FFFF Y:0030 P:envMxdizC - Load A from Left-Hand Equipment.

$03/9B47 30 1A BMI $1A    [$9B63] A:0084 X:FFFF Y:0030 P:eNvMxdizC - If it is over 80 (Shield) branch to 03B963.
---------------------------------------------------------------------------------------------------------
$03/9B49 AD 77 39 LDA $3977  [$7E:3977] A:0006 X:000B Y:0030 P:envMxdizC - Load "Is it Yang?" Byte into A.
$03/9B4C 09 40 ORA #$40 A:0080 X:000B Y:0030 P:eNvMxdizC 0 Add 40 if applicable to A.
$03/9B4E 8D 77 39 STA $3977  [$7E:3977] A:00C0 X:000B Y:0030 P:eNvMxdizC - Store A in "Is it Yang?" Byte.
$03/9B51 A0 2C 00 LDY #$002C A:00C0 X:000B Y:0030 P:eNvMxdizC - Load 002C into Y.
$03/9B54 A2 0B 00 LDX #$000B A:00C0 X:000B Y:002C P:envMxdizC - Load 000B into X.
-----------------------------------------------------------------------(Looping Point)------------------------------------------------------
$03/9B57 B1 82 LDA ($82),y[$7E:27E3] A:00C0 X:000B Y:002C P:envMxdizC - Load A from Weapon Property.
$03/9B59 9D 9C 28 STA $289C,x[$7E:28A7] A:0020 X:000B Y:002C P:envMxdizC - Store A in 7E28A7.(Where it will store weapon dealings now)
$03/9B5C C8 INY A:0020 X:000B Y:002C P:envMxdizC - +1 X.
$03/9B5D E8 INX A:0020 X:000B Y:002D P:envMxdizC - +1 Y.
$03/9B5E E0 16 00 CPX #$0016 A:0020 X:000C Y:002D P:envMxdizC - Has it gone through 11 times?
$03/9B61 D0 F4 BNE $F4    [$9B57] A:0020 X:000C Y:002D P:eNvMxdizc - If not loop back to 039B57.
-----------------------------------------------------------------------------------------------------------------
$03/9B63 AD 77 39 LDA $3977  [$7E:3977] A:0084 X:FFFF Y:0030 P:eNvMxdizC - Load 7E3977 into A.
$03/9B66 29 C0 AND #$C0 A:0001 X:FFFF Y:0030 P:envMxdizC - Get rid of inapplicable bits.
$03/9B68 F0 09 BEQ $09    [$9B73] A:0000 X:FFFF Y:0030 P:envMxdiZC - If it is 00 branch to 039B73.
----------------------------------------------------------------------------------------------------------------------
$03/9B6A 49 C0 EOR #$C0 A:0080 X:000B Y:0030 P:eNvMxdizC - Add C0 if applicable to A.
$03/9B6C D0 55 BNE $55    [$9BC3] A:0040 X:000B Y:0030 P:envMxdizC - If not 00 branch to 039BC3.
-------------------------------------------------------------------------------------------------------------------------------
$03/9B6E AD A2 28 LDA $28A2  [$7E:28A2] A:0000 X:0016 Y:0037 P:envMxdiZC - Load A from Equip Index (Arrow Bit presumably it what it is looking at)
$03/9B71 29 C0 AND #$C0 A:0042 X:0016 Y:0037 P:envMxdizc - Get rid of inapplicable bits.
--------------------------------------------------------------------------------------------------------------------------
$03/9B73 F0 4C BEQ $4C    [$9BC1] A:0000 X:FFFF Y:0030 P:envMxdiZC - If it is 00 branch to 03B8C1.
---------------------------------------------------------------------------------------------------------------
(Only takes this path if it is arrows)
$03/9B75 A9 80 LDA #$80 A:0040 X:0016 Y:0037 P:envMxdizC - Load 80 into A.
$03/9B77 8D 78 39 STA $3978  [$7E:3978] A:0080 X:0016 Y:0037 P:eNvMxdizC - Store A in 7E3978.
$03/9B7A AD A2 28 LDA $28A2  [$7E:28A2] A:0080 X:0016 Y:0037 P:eNvMxdizC - Load A from Equipment Branch.
$03/9B7D 29 80 AND #$80 A:0042 X:0016 Y:0037 P:envMxdizC - Get rid of inapplicable bits. (Positive bits?)
$03/9B7F D0 36 BNE $36    [$9BB7] A:0000 X:0016 Y:0037 P:envMxdiZC - If not 00 branch to 039BB7.
$03/9B81 A9 40 LDA #$40 A:0000 X:0016 Y:0037 P:envMxdiZC - Load 40 into A.
$03/9B83 8D 78 39 STA $3978  [$7E:3978] A:0040 X:0016 Y:0037 P:envMxdizC - Store A in 7E3978.
$03/9B86 7B TDC A:0040 X:0016 Y:0037 P:envMxdizC - Transfer Direct Page.
$03/9B87 AA TAX A:0000 X:0016 Y:0037 P:envMxdiZC - Transfer A to X.
$03/9B88 A0 16 00 LDY #$0016 A:0000 X:0000 Y:0037 P:envMxdiZC - Load 16 into Y.
----------------------------------------------------------------------------------(Looping Point)-------------------------------------
$03/9B8B BD 9C 28 LDA $289C,x[$7E:289C] A:0000 X:0000 Y:0016 P:envMxdizC - Load A from 7E289C+x (Weapon property?)
$03/9B8E 99 9C 28 STA $289C,y[$7E:28B2] A:00A0 X:0000 Y:0016 P:eNvMxdizC - Store A in 7E289C+Y
$03/9B91 E8 INX A:00A0 X:0000 Y:0016 P:eNvMxdizC +1 X
$03/9B92 C8 INY A:00A0 X:0001 Y:0016 P:envMxdizC +1 Y
$03/9B93 E0 0B 00 CPX #$000B A:00A0 X:0001 Y:0017 P:envMxdizC - Compare X to 0B (11 times, copying Weapon information... again)
$03/9B96 D0 F3 BNE $F3    [$9B8B] A:00A0 X:0001 Y:0017 P:eNvMxdizc - If not done 11 times loop back to 039B8B
-------------------------------------------------------------------------------------------------------------------------------------------
$03/9B98 7B TDC A:0000 X:000B Y:0021 P:envMxdiZC - Transfer Direct Page.
$03/9B99 A8 TAY A:0000 X:000B Y:0021 P:envMxdiZC - Transfer A to Y.
--------------------------------------------------------(Looping Point)-------------------------------------------------------
$03/9B9A BD 9C 28 LDA $289C,x[$7E:28A7] A:0000 X:000B Y:0000 P:envMxdiZC - Load A from Left-Handed Weapon Property.
$03/9B9D 99 9C 28 STA $289C,y[$7E:289C] A:0020 X:000B Y:0000 P:envMxdizC - Store A in 7E289C.
$03/9BA0 E8 INX A:0020 X:000B Y:0000 P:envMxdizC - +1 X
$03/9BA1 C8 INY A:0020 X:000C Y:0000 P:envMxdizC - +1 Y
$03/9BA2 E0 16 00 CPX #$0016 A:0020 X:000C Y:0001 P:envMxdizC - Repeat this 11 times.
$03/9BA5 D0 F3 BNE $F3    [$9B9A] A:0020 X:000C Y:0001 P:eNvMxdizc - If not loop back to 039B9A.
-------------------------------------------------------------------------------------------------------------------
$03/9BA7 A0 0B 00 LDY #$000B A:0000 X:0016 Y:000B P:envMxdiZC - Load 000B into Y.
---------------------------------------------------------(Looping Point)---------------------------------------------
$03/9BAA BD 9C 28 LDA $289C,x[$7E:28B2] A:0000 X:0016 Y:000B P:envMxdizC - Load Weapon Property from Right Hand into A.
$03/9BAD 99 9C 28 STA $289C,y[$7E:28A7] A:00A0 X:0016 Y:000B P:eNvMxdizC - Store A in 7E289C.
$03/9BB0 E8 INX A:00A0 X:0016 Y:000B P:eNvMxdizC +1 X
$03/9BB1 C8 INY A:00A0 X:0017 Y:000B P:envMxdizC - +1 Y
$03/9BB2 C0 16 00 CPY #$0016 A:00A0 X:0017 Y:000C P:envMxdizC - Has it gone through 11 times?
$03/9BB5 D0 F3 BNE $F3    [$9BAA] A:00A0 X:0017 Y:000C P:eNvMxdizc - If not branch back to 039BAA.
-----------------------------------------------------------------------------------------------------------------------
$03/9BB7 AD 77 39 LDA $3977  [$7E:3977] A:0000 X:0021 Y:0016 P:envMxdiZC - Load "Is it Yang?" Byte into A.
$03/9BBA 29 3F AND #$3F A:00C0 X:0021 Y:0016 P:eNvMxdizC - Get rid of inapplicable bits.
$03/9BBC 09 A0 ORA #$A0 A:0000 X:0021 Y:0016 P:envMxdiZC - Add A0 if applicable.
$03/9BBE 8D 77 39 STA $3977  [$7E:3977] A:00A0 X:0021 Y:0016 P:eNvMxdizC - Store A in 7E3977
---------------------------------------------------------------------------------------------------------------
$03/9BC1 80 2B BRA $2B    [$9BEE] A:0000 X:FFFF Y:0030 P:envMxdiZC - Branch to 039BEE.
-------------------------------------------------------------------------------------------------------------------
$03/9BC3 AD 77 39 LDA $3977  [$7E:3977] A:0040 X:000B Y:0030 P:envMxdizC - Load Yang's Damage Byte into A.
$03/9BC6 30 26 BMI $26    [$9BEE] A:0080 X:000B Y:0030 P:eNvMxdizC - Branch if negative to 039BEE.

------------------------------------------------------------------------------------------------------------------------
$03/9BEE 7B TDC A:0000 X:FFFF Y:0030 P:envMxdiZC - Transfer Direct Page.
$03/9BEF AA TAX A:0000 X:FFFF Y:0030 P:envMxdiZC - Transfer A to X.
$03/9BF0 86 A9 STX $A9    [$00:00A9] A:0000 X:0000 Y:0030 P:envMxdiZC - Store X in A9.
$03/9BF2 AD A0 28 LDA $28A0  [$7E:28A0] A:0000 X:0000 Y:0030 P:envMxdiZC - Load A from 7E28A0.
$03/9BF5 30 05 BMI $05    [$9BFC] A:0000 X:0000 Y:0030 P:envMxdiZC - If negative (Shield) branch to 039BFC.
$03/9BF7 AD A4 28 LDA $28A4  [$7E:28A4] A:0000 X:0000 Y:0030 P:envMxdiZC - Load A from Weapon Elemental.
$03/9BFA 85 A9 STA $A9    [$00:00A9] A:0000 X:0000 Y:0030 P:envMxdiZC - Store A in A9.
$03/9BFC AD AB 28 LDA $28AB  [$7E:28AB] A:0000 X:0000 Y:0030 P:envMxdiZC - Load A from 7E28AB.
$03/9BFF 30 05 BMI $05    [$9C06] A:0000 X:0000 Y:0030 P:envMxdiZC - If negative(Shield) branch to 039C06
$03/9C01 AD AF 28 LDA $28AF  [$7E:28AF] A:0000 X:0000 Y:0030 P:envMxdiZC - Load A from 7E28AF.
$03/9C04 85 AA STA $AA    [$00:00AA] A:0000 X:0000 Y:0030 P:envMxdiZC - Store A in AA.
$03/9C06 A5 A9 LDA $A9    [$00:00A9] A:0000 X:0000 Y:0030 P:envMxdiZC - Load A from A9.
$03/9C08 05 AA ORA $AA    [$00:00AA] A:0000 X:0000 Y:0030 P:envMxdiZC - Add the applicable value from AA onto it.
$03/9C0A A0 19 00 LDY #$0019 A:0000 X:0000 Y:0030 P:envMxdiZC - Load 0019 into Y.
$03/9C0D 91 80 STA ($80),y[$7E:2019] A:0000 X:0000 Y:0019 P:envMxdizC - Store A in Yang's Attack Elemental.
$03/9C0F 7B TDC A:0000 X:0000 Y:0019 P:envMxdizC - Transfer Direct Page.
$03/9C10 AA TAX A:0000 X:0000 Y:0019 P:envMxdiZC - Transfer A to X.
$03/9C11 86 A9 STX $A9    [$00:00A9] A:0000 X:0000 Y:0019 P:envMxdiZC - Store X in A9.
$03/9C13 AD A0 28 LDA $28A0  [$7E:28A0] A:0000 X:0000 Y:0019 P:envMxdiZC - Load A from 7E28A0.
$03/9C16 30 05 BMI $05    [$9C1D] A:0000 X:0000 Y:0019 P:envMxdiZC - If negative branch to 039C1B.
$03/9C18 AD A1 28 LDA $28A1  [$7E:28A1] A:0000 X:0000 Y:0019 P:envMxdiZC - Load A from Character's Weapon Creature Strength.
$03/9C1B 85 A9 STA $A9    [$00:00A9] A:0000 X:0000 Y:0019 P:envMxdiZC - Store A in A9.
$03/9C1D AD AB 28 LDA $28AB  [$7E:28AB] A:0000 X:0000 Y:0019 P:envMxdiZC - Load A from 7E28AB.
$03/9C20 30 05 BMI $05    [$9C27] A:0000 X:0000 Y:0019 P:envMxdiZC - Branch if negative to 039C27.
$03/9C22 AD AC 28 LDA $28AC  [$7E:28AC] A:0000 X:0000 Y:0019 P:envMxdiZC - Load A from Weapon's Creature Strength.
$03/9C25 85 AA STA $AA    [$00:00AA] A:0000 X:0000 Y:0019 P:envMxdiZC - Store A in AA.
$03/9C27 A5 A9 LDA $A9    [$00:00A9] A:0000 X:0000 Y:0019 P:envMxdiZC - Load A from A9.
$03/9C29 05 AA ORA $AA    [$00:00AA] A:0000 X:0000 Y:0019 P:envMxdiZC - Add applicable bits from AA as well.
$03/9C2B A0 1A 00 LDY #$001A A:0000 X:0000 Y:0019 P:envMxdiZC - Load Character's Creature Type Weaknesses into A..
$03/9C2E 91 80 STA ($80),y[$7E:201A] A:0000 X:0000 Y:001A P:envMxdizC - Store A in Character's Creature Type Weaknesses.
$03/9C30 AD 66 39 LDA $3966  [$7E:3966] A:0000 X:0000 Y:001A P:envMxdizC - Load Character's Strength (from a copy) into A.
$03/9C33 20 85 84 JSR $8485  [$03:8485] A:000D X:0000 Y:001A P:envMxdizC - Jump to Subroutine (Value /8 = A)
$03/9C38 AD 67 39 LDA $3967  [$7E:3967] A:0001 X:0000 Y:001A P:envMxdizC - Load A from Character's Agility  into A.
$03/9C3B 20 84 84 JSR $8484  [$03:8484] A:000D X:0000 Y:001A P:envMxdizC - Jump to Subroutine (Value /16 = A)
$03/9C3E 18 CLC A:0000 X:0000 Y:001A P:envMxdiZC - Clear Carry Flag.
$03/9C3F 65 A9 ADC $A9    [$00:00A9] A:0000 X:0000 Y:001A P:envMxdiZc - Add the value in A9 (Str/8) into A
$03/9C41 1A INC A A:0001 X:0000 Y:001A P:envMxdizc - +1 to A.
$03/9C42 A0 1B 00 LDY #$001B A:0002 X:0000 Y:001A P:envMxdizc - Load Character's Attack Multiplier.
$03/9C45 91 80 STA ($80),y[$7E:201B] A:0002 X:0000 Y:001B P:envMxdizc - Store A in Character's Attack Multiplier.
$03/9C47 AD 65 39 LDA $3965  [$7E:3965] A:0002 X:0000 Y:001B P:envMxdizc - Load Character's Level into A.
$03/9C4A 20 86 84 JSR $8486  [$03:8486] A:000A X:0000 Y:001B P:envMxdizc - Jump to Subroutine (Value/4 = A)
$03/9C4D 85 A9 STA $A9    [$00:00A9] A:0002 X:0000 Y:001B P:envMxdizC - Store A in A9.
$03/9C4F AD 77 39 LDA $3977  [$7E:3977] A:0002 X:0000 Y:001B P:envMxdizC - Load A from "Weapon Equipped - Is it Yang?" from much earlier.
$03/9C52 29 C0 AND #$C0 A:0001 X:0000 Y:001B P:envMxdizC - Get rid of inapplicable bytes.
$03/9C54 F0 21 BEQ $21    [$9C77] A:0000 X:0000 Y:001B P:envMxdiZC - If 00 branch to 039C77
---------------------------------------------------------------------------------------------------------
$03/9C56 49 C0 EOR #$C0 A:0080 X:0000 Y:001B P:eNvMxdizC - -40 to A.
$03/9C58 D0 26 BNE $26    [$9C80] A:0040 X:0000 Y:001B P:envMxdizC - If not 00 branch to 039C80.
--------------------------------------------------------------------------------------------------------------
(Unique to Dual-Wielding? - Not Yang?)
$03/9C5A 18 CLC A:0000 X:0000 Y:001B P:envMxdiZc - Clear Carry Flag.
$03/9C5B AD 9E 28 LDA $289E  [$7E:289E] A:0000 X:0000 Y:001B P:envMxdiZc - Load A from Weapon Hit%
$03/9C5E 29 7F AND #$7F A:005A X:0000 Y:001B P:envMxdizc - Get rid of negative bits.
$03/9C60 65 A9 ADC $A9    [$00:00A9] A:005A X:0000 Y:001B P:envMxdizc - Add the value of Level/4 into A.
$03/9C62 85 AA STA $AA    [$00:00AA] A:0060 X:0000 Y:001B P:envMxdizc - Store A in AA.
$03/9C64 18 CLC A:0060 X:0000 Y:001B P:envMxdizc - Clear Carry Flag.
$03/9C65 AD A9 28 LDA $28A9  [$7E:28A9] A:0060 X:0000 Y:001B P:envMxdizc - Load A from Second Weapon Hit %.
$03/9C68 29 7F AND #$7F A:005A X:0000 Y:001B P:envMxdizc - Get rid of negative bits.
$03/9C6A 65 A9 ADC $A9    [$00:00A9] A:005A X:0000 Y:001B P:envMxdizc - Add this value onto A9.
$03/9C6C 65 AA ADC $AA    [$00:00AA] A:0060 X:0000 Y:001B P:envMxdizc - Add AA onto that value.
$03/9C6E 4A LSR A A:00C0 X:0000 Y:001B P:eNVMxdizc - / A by 2.
$03/9C6F C9 63 CMP #$63 A:0060 X:0000 Y:001B P:enVMxdizc - Is it over 99?
$03/9C71 90 18 BCC $18    [$9C8B] A:0060 X:0000 Y:001B P:eNVMxdizc - If not branch to 039C8B
-----------------------------------------------------------------------------------------------------------------

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

---------------------------------------------------------------------------------------------------------------
$03/9C77 18 CLC A:0000 X:0000 Y:001B P:envMxdiZC - Clear Carry Flag.
$03/9C78 AF 02 91 0F LDA $0F9102[$0F:9102] A:0000 X:0000 Y:001B P:envMxdiZc - Load A from 0F9102. (Default Accuracy of Nothing)
$03/9C7C 65 A9 ADC $A9    [$00:00A9] A:0032 X:0000 Y:001B P:envMxdizc - Add Level /4 onto the accuracy.
$03/9C7E 80 08 BRA $08    [$9C88] A:0034 X:0000 Y:001B P:envMxdizc - Branch to 039C88
--------------------------------------------------------------------------------------------------------------------
$03/9C80 18 CLC A:0040 X:0000 Y:001B P:envMxdizC - Clear Carry Flag.
$03/9C81 AD 9E 28 LDA $289E  [$7E:289E] A:0040 X:0000 Y:001B P:envMxdizc - Load A from Weapon Accuracy.
$03/9C84 29 7F AND #$7F A:005A X:0000 Y:001B P:envMxdizc - Get rid of negative bits?
$03/9C86 65 A9 ADC $A9    [$00:00A9] A:005A X:0000 Y:001B P:envMxdizc - Add the value in A9 into it (Level /4)
------------------------------------------------------------------------------------------------------------------------
$03/9C88 20 2A 9E JSR $9E2A  [$03:9E2A] A:0034 X:0000 Y:001B P:envMxdizc - Jump to Subroutine
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/9E2A C9 63 CMP #$63 A:0034 X:0000 Y:001B P:envMxdizc - Is the accuracy 99?
$03/9E2C 90 02 BCC $02    [$9E30] A:0034 X:0000 Y:001B P:eNvMxdizc - If 99 or below branch to 039E30
-----------------------------------------------------------------------------------------------------
(This likely mitigates the accuracy back down to 99)
-------------------------------------------------------------------------------------------------
$03/9E30 60 RTS A:0034 X:0000 Y:001B P:eNvMxdizc - Return
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/9C8B A0 1C 00 LDY #$001C A:0034 X:0000 Y:001B P:eNvMxdizc - Load Character's Physical Accuracy.
$03/9C8E 91 80 STA ($80),y[$7E:201C] A:0034 X:0000 Y:001C P:envMxdizc - Store Accuracy+Level/4 into Character's Physical Accuracy.
$03/9C90 AD 66 39 LDA $3966  [$7E:3966] A:0034 X:0000 Y:001C P:envMxdizc - Load A from Character's Strength.
$03/9C93 20 86 84 JSR $8486  [$03:8486] A:000D X:0000 Y:001C P:envMxdizc - Jump to Subroutine (Value/4 = A)
$03/9C96 85 AA STA $AA    [$00:00AA] A:0003 X:0000 Y:001C P:envMxdizc - Store Str/4 into AA.
$03/9C98 AD 77 39 LDA $3977  [$7E:3977] A:0003 X:0000 Y:001C P:envMxdizc - Load "Weapon Equipped - Is it Yang?" into A.
$03/9C9B 29 01 AND #$01 A:0001 X:0000 Y:001C P:envMxdizc - Is it 01?
$03/9C9D F0 0B BEQ $0B    [$9CAA] A:0001 X:0000 Y:001C P:envMxdizc - If not branch to 039DAA.
$03/9C9F AD 65 39 LDA $3965  [$7E:3965] A:0001 X:0000 Y:001C P:envMxdizc - Load Character's Level.
$03/9CA2 0A ASL A A:000A X:0000 Y:001C P:envMxdizc - Level x2.
$03/9CA3 18 CLC A:0014 X:0000 Y:001C P:envMxdizc - Clear Carry Flag.
$03/9CA4 65 AA ADC $AA    [$00:00AA] A:0014 X:0000 Y:001C P:envMxdizc - Add Levelx2 + Str/4 into A.
$03/9CA6 69 02 ADC #$02 A:0017 X:0000 Y:001C P:envMxdizc - Add 02 onto the value.
$03/9CA8 80 66 BRA $66    [$9D10] A:0019 X:0000 Y:001C P:envMxdizc  - Branch to 03D910
-----------------------------------------------------------------------------------
$03/9CAA AD 77 39 LDA $3977  [$7E:3977] A:0000 X:0000 Y:001C P:envMxdiZc - Load A from "Is it Yang?" Byte.
$03/9CAD 29 C0 AND #$C0 A:0080 X:0000 Y:001C P:eNvMxdizc - Is it C0?
$03/9CAF F0 57 BEQ $57    [$9D08] A:0080 X:0000 Y:001C P:eNvMxdizc - If it is, branch to 039D08.
$03/9CB1 49 C0 EOR #$C0 A:0080 X:0000 Y:001C P:eNvMxdizc - Get rid of inapplicable bits.
$03/9CB3 D0 17 BNE $17    [$9CCC] A:0040 X:0000 Y:001C P:envMxdizc - If not 00 branch to 039CCC
--------------------------------------------------------------------------------------
(Unique to Dual-Wielding?)
03/9CB5 18 CLC A:0000 X:0000 Y:001C P:enVMxdiZC - Clear Carry Flag.
$03/9CB6 AD 9D 28 LDA $289D  [$7E:289D] A:0000 X:0000 Y:001C P:enVMxdiZc - Load 1st Weapon Attack Power into A.
$03/9CB9 65 A9 ADC $A9    [$00:00A9] A:0019 X:0000 Y:001C P:enVMxdizc - Add Level /4 onto A.
$03/9CBB 65 AA ADC $AA    [$00:00AA] A:001F X:0000 Y:001C P:envMxdizc - Add Str/4 onto A.
$03/9CBD 85 AB STA $AB    [$00:00AB] A:0026 X:0000 Y:001C P:envMxdizc - Store Weapon +Str/4 +Lvl/4 into AB.
$03/9CBF 18 CLC A:0026 X:0000 Y:001C P:envMxdizc - Clear Carry Flag.
$03/9CC0 AD A8 28 LDA $28A8  [$7E:28A8] A:0026 X:0000 Y:001C P:envMxdizc - Load 2nd Weapon Attack Power into A.
$03/9CC3 65 A9 ADC $A9    [$00:00A9] A:0019 X:0000 Y:001C P:envMxdizc -Add Level/4 into A.
$03/9CC5 65 AA ADC $AA    [$00:00AA] A:001F X:0000 Y:001C P:envMxdizc - Add Str/4 into A.
$03/9CC7 18 CLC A:0026 X:0000 Y:001C P:envMxdizc - Clear Carry Flag.
$03/9CC8 65 AB ADC $AB    [$00:00AB] A:0026 X:0000 Y:001C P:envMxdizc - Add 1st Weapon Power + Str/4 + Level/4 onto A.
$03/9CCA 80 44 BRA $44    [$9D10] A:004C X:0000 Y:001C P:envMxdizc - Branch to 039D10.
-------------------------------------------------------------------------------------------
$03/9CCC AD 77 39 LDA $3977  [$7E:3977] A:0040 X:0000 Y:001C P:envMxdizc - Load A from "Is it Yang?" Byte.
$03/9CCF 29 20 AND #$20 A:0080 X:0000 Y:001C P:eNvMxdizc - Get rid of inapplicable bits.
$03/9CD1 F0 35 BEQ $35    [$9D08] A:0000 X:0000 Y:001C P:envMxdiZc - Branch if 00 to 039D08
------------------------------------------------------------------------------------------------
(Only carried through by Bow+Arrow?)
$03/9CD3 AD 9D 28 LDA $289D  [$7E:289D] A:0020 X:0000 Y:001C P:envMxdizc - Load Bow's Attack Power into A.
$03/9CD6 4A LSR A A:000A X:0000 Y:001C P:envMxdizc - /2.
$03/9CD7 18 CLC A:0005 X:0000 Y:001C P:envMxdizc - Clear Carry Flag.
$03/9CD8 6D A8 28 ADC $28A8  [$7E:28A8] A:0005 X:0000 Y:001C P:envMxdizc - Add the Value of the  Arrow into A.
$03/9CDB 65 AA ADC $AA    [$00:00AA] A:000A X:0000 Y:001C P:envMxdizc - Add the value from Str/4 onto A.
$03/9CDD 85 BF STA $BF    [$00:00BF] A:000C X:0000 Y:001C P:envMxdizc - Store A in BF.
$03/9CDF A0 00 00 LDY #$0000 A:000C X:0000 Y:001C P:envMxdizc - Load 00 into Y.
$03/9CE2 B1 80 LDA ($80),y[$7E:2080] A:000C X:0000 Y:0000 P:envMxdiZc - Load Character ID.
$03/9CE4 29 C0 AND #$C0 A:0086 X:0000 Y:0000 P:eNvMxdizc - Get rid of inapplicable bits.
$03/9CE6 2D 78 39 AND $3978  [$7E:3978] A:0080 X:0000 Y:0000 P:eNvMxdizc - Get rid of inapplicable bits.
$03/9CE9 F0 19 BEQ $19    [$9D04] A:0000 X:0000 Y:0000 P:envMxdiZc - Branch if 00 to 039D04.
-----------------------------------------------------------------------------------------------------------------------------------------
(Only accessible if the Bow is in the dominant hand and the Arrow is in the recessive hand)

$03/9CEB A5 BF LDA $BF    [$00:00BF] A:0080 X:0000 Y:0000 P:eNvMxdizc - Load A from Culminated Attack Power
$03/9CED AA TAX A:000C X:0000 Y:0000 P:envMxdizc - Transfer A to X.
$03/9CEE 8E 45 39 STX $3945  [$7E:3945] A:000C X:000C Y:0000 P:envMxdizc - Store X in 7E3945.
$03/9CF1 A2 05 00 LDX #$0005 A:000C X:000C Y:0000 P:envMxdizc - Load 0005 into X.
$03/9CF4 8E 47 39 STX $3947  [$7E:3947] A:000C X:0005 Y:0000 P:envMxdizc - Store X in 7E3947.
$03/9CF7 20 07 84 JSR $8407  [$03:8407] A:000C X:0005 Y:0000 P:envMxdizc - Jump to Subroutine (Rolls a 0 value at 3949 16 times before spitting out a 2) - In other word it takes away 1/16th of the final result)
$03/9CFB A5 BF LDA $BF    [$00:00BF] A:0000 X:0000 Y:0000 P:envMxdiZC - Load A from Culminated Attack Power.
$03/9CFD ED 49 39 SBC $3949  [$7E:3949] A:000C X:0000 Y:0000 P:envMxdizC - Subtract the value from 7E3949.
$03/9D00 85 BF STA $BF    [$00:00BF] A:000A X:0000 Y:0000 P:envMxdizC - Store A in Culminated Attack Power
$03/9D02 80 0F BRA $0F    [$9D13] A:000A X:0000 Y:0000 P:envMxdizC - Branch to 039D13.
----------------------------------------------------------------------------------------------------------------------------------
(Only Accessible from Bows)
$03/9D04 A5 BF LDA $BF    [$00:00BF] A:0000 X:0000 Y:0000 P:envMxdiZc - Load A from Bow Attack /2, +Arrow Attack + Str/4.
$03/9D06 80 0B BRA $0B    [$9D13] A:000C X:0000 Y:0000 P:envMxdizc - Branch to 039D13
-------------------------------------------------------------------------------------------------
$03/9D08 18 CLC A:0000 X:0000 Y:001C P:envMxdiZc - Clear Carry Flag.
$03/9D09 AD 9D 28 LDA $289D  [$7E:289D] A:0000 X:0000 Y:001C P:envMxdiZc - Load Weapon's Physical Attack.
$03/9D0C 65 A9 ADC $A9    [$00:00A9] A:001E X:0000 Y:001C P:envMxdizc - Add the value from A9 into it (Level/4)
$03/9D0E 65 AA ADC $AA    [$00:00AA] A:0020 X:0000 Y:001C P:envMxdizc - Add the value from AA into it. (Str/4)
$03/9D10 20 31 9E JSR $9E31  [$03:9E31] A:0023 X:0000 Y:001C P:envMxdizc - Jump to Subroutine (Checking to see if it is above 00)
 (Continued in the second section of code, below)
-----------------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------------
$03/9E31 90 02 BCC $02    [$9E35] A:0019 X:0000 Y:001C P:envMxdizc - If more than 00 branch to 039E35.
$03/9E35 60 RTS A:0019 X:0000 Y:001C P:envMxdizc - Return

Well, well! Looks like DeathLike2's Formula for Yang's Attack was almost 100% on the mark! The only miscalculation was Level x2 +2 rather than +1, but its so miniscule anyhow. This is where I would normally stop and look at the collected results above, but unlike a normal routine, this just ends abruptly so I have to follow it back from the RTS. Maybe this will, in the end, reveal the location of all Attack Formula.


Code: [Select]
$03/9D13 A0 1D 00 LDY #$001D A:0019 X:0000 Y:001C P:envMxdizc - Load Slot's Attack Base into A.
$03/9D16 91 80 STA ($80),y[$7E:201D] A:0019 X:0000 Y:001D P:envMxdizc - Store Levelx2 +2 + Str/4 into Physical Attack Base.
$03/9D18 AD A5 28 LDA $28A5  [$7E:28A5] A:0019 X:0000 Y:001D P:envMxdizc - Load Slot's Attack Status from Weapon into A.
$03/9D1B 0D B0 28 ORA $28B0  [$7E:28B0] A:0000 X:0000 Y:001D P:envMxdiZc - Add the value from the other weapon onto that if applicable.
$03/9D1E A0 1E 00 LDY #$001E A:0000 X:0000 Y:001D P:envMxdiZc - Load Slot's Attack Status into A.
$03/9D21 91 80 STA ($80),y[$7E:201E] A:0000 X:0000 Y:001E P:envMxdizc - Store A in Attack Status 1.
$03/9D23 AD A6 28 LDA $28A6  [$7E:28A6] A:0000 X:0000 Y:001E P:envMxdizc - Load Slot's Attack Status 2 from Weapon into A.
$03/9D26 0D B1 28 ORA $28B1  [$7E:28B1] A:0000 X:0000 Y:001E P:envMxdiZc - Add the value from the other weapon onto that if applicable.
$03/9D29 C8 INY A:0000 X:0000 Y:001E P:envMxdiZc - +1 to Y (making it read the very next byte)
$03/9D2A 91 80 STA ($80),y[$7E:201F] A:0000 X:0000 Y:001F P:envMxdizc - Store A in Attack Status 2.
$03/9D2F B1 80 LDA ($80),y[$7E:2041] A:0000 X:0000 Y:0041 P:envMxdizc - Load A from Slot's Unknown.
$03/9D31 85 A9 STA $A9    [$00:00A9] A:0000 X:0000 Y:0041 P:envMxdiZc - Store A in A9
$03/9D33 C8 INY A:0000 X:0000 Y:0041 P:envMxdiZc - +1 to Y.
$03/9D34 B1 80 LDA ($80),y[$7E:2042] A:0000 X:0000 Y:0042 P:envMxdizc - Load A from Slot's Unknown2.
$03/9D36 85 AA STA $AA    [$00:00AA] A:0000 X:0000 Y:0042 P:envMxdiZc - Store A in AA.
$03/9D38 AD 77 39 LDA $3977  [$7E:3977] A:0000 X:0000 Y:0042 P:envMxdiZc - Load A from "No Weapon, is it Yang?" Byte.
$03/9D3B 29 C0 AND #$C0 A:0001 X:0000 Y:0042 P:envMxdizc - Get rid of inapplicable bits.
$03/9D3D F0 51 BEQ $51    [$9D90] A:0000 X:0000 Y:0042 P:envMxdiZc - Branch if 00 to 039D90.
-----------------------------------------------------------------------------------------
$03/9D3F 49 C0 EOR #$C0 A:0080 X:0000 Y:0042 P:eNvMxdizc - Get rid of inapplicable bits.
$03/9D41 F0 4D BEQ $4D    [$9D90] A:0040 X:0000 Y:0042 P:envMxdizc - If 00 branch to 039D90
$03/9D43 AD 77 39 LDA $3977  [$7E:3977] A:0040 X:0000 Y:0042 P:envMxdizc - Load A from "Is it Yang?" byte.
$03/9D46 29 20 AND #$20 A:0080 X:0000 Y:0042 P:eNvMxdizc - Get rid of inapplicable bits.
$03/9D48 F0 22 BEQ $22    [$9D6C] A:0000 X:0000 Y:0042 P:envMxdiZc - If 00 branch to 039D6C
--------------------------------------------------------------------------------------------------------------------------
(Unique to Bow/Arrows?)
$03/9D4A A5 A9 LDA $A9    [$00:00A9] A:0020 X:0000 Y:0042 P:envMxdizc - Load A from Level/4.
$03/9D4C C9 21 CMP #$21 A:0002 X:0000 Y:0042 P:envMxdizc - Is it the same value that is in 21?
$03/9D4E 90 02 BCC $02    [$9D52] A:0002 X:0000 Y:0042 P:eNvMxdizc  - If greater than or equal branch to 039D52.
------------------------------------------------------------------------------------------------------------------------

-------------------------------------------------------------------------------------------------------------------------------
$03/9D52 85 DF STA $DF    [$00:00DF] A:0002 X:0000 Y:0042 P:eNvMxdizc - Store Level /4 into DF.
$03/9D54 A9 03 LDA #$03 A:0002 X:0000 Y:0042 P:eNvMxdizc - Load 03 into A.
$03/9D56 85 E1 STA $E1    [$00:00E1] A:0003 X:0000 Y:0042 P:envMxdizc - Store A in E1.
$03/9D58 20 E0 83 JSR $83E0  [$03:83E0] A:0003 X:0000 Y:0042 P:envMxdizc - Jump to Subroutine (??)
$03/9D5D 85 A9 STA $A9    [$00:00A9] A:0006 X:0000 Y:0042 P:envMxdizc - Store A in A9.
$03/9D5F 18 CLC A:0006 X:0000 Y:0042 P:envMxdizc - Clear Carry Flag.
$03/9D60 A5 AA LDA $AA    [$00:00AA] A:0006 X:0000 Y:0042 P:envMxdizc - Load A from AA.
$03/9D62 6D A8 28 ADC $28A8  [$7E:28A8] A:003C X:0000 Y:0042 P:envMxdizc - Add Arrow's Attack Power onto A.
$03/9D65 20 31 9E JSR $9E31  [$03:9E31] A:0041 X:0000 Y:0042 P:envMxdizc - Jump to Subroutine.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/9E31 90 02 BCC $02    [$9E35] A:0041 X:0000 Y:0042 P:envMxdizc - Is it less than 00 or 00 if so branch to 039E35.
$03/9E35 60 RTS A:0041 X:0000 Y:0042 P:envMxdizc - Return.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/9D68 85 AA STA $AA    [$00:00AA] A:0041 X:0000 Y:0042 P:envMxdizc - Store A in AA.
$03/9D6A 80 18 BRA $18    [$9D84] A:0041 X:0000 Y:0042 P:envMxdizc - Branch to 039D84.
------------------------------------------------------------------------------------------------------------------------------
$03/9D6C 06 A9 ASL $A9    [$00:00A9] A:0000 X:0000 Y:0042 P:envMxdiZc - x2 the Slot Unknown.
$03/9D6E 90 04 BCC $04    [$9D74] A:0000 X:0000 Y:0042 P:envMxdizc - Branch if 00 or less to 039D74
----------------------------------------------------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------------------------------------------------
$03/9D74 A5 A9 LDA $A9    [$00:00A9] A:0000 X:0000 Y:0042 P:envMxdizc - Load A from Unknown x2
$03/9D76 85 A9 STA $A9    [$00:00A9] A:0004 X:0000 Y:0042 P:envMxdizc - Store A in A9.
$03/9D78 AD 9D 28 LDA $289D  [$7E:289D] A:0004 X:0000 Y:0042 P:envMxdizc - Load Weapon's Attack.
$03/9D7B 4A LSR A A:001E X:0000 Y:0042 P:envMxdizc - /2.
$03/9D7C 18 CLC A:000F X:0000 Y:0042 P:envMxdizc - Clear Carry Flag.
$03/9D7D 65 AA ADC $AA    [$00:00AA] A:000F X:0000 Y:0042 P:envMxdizc - Add A from Slot's Unknown2.
$03/9D7F 20 31 9E JSR $9E31  [$03:9E31] A:0023 X:0000 Y:0042 P:envMxdizc - If over 99, make 99 routine.
$03/9D82 85 AA STA $AA    [$00:00AA] A:0023 X:0000 Y:0042 P:envMxdizc - Store A in AA.
$03/9D84 A0 2D 00 LDY #$002D A:0023 X:0000 Y:0042 P:envMxdizc - Load  2D into Y.
$03/9D87 A5 A9 LDA $A9    [$00:00A9] A:0023 X:0000 Y:002D P:envMxdizc - Load A from Level/4. (Or in Arrow/Bow's Case Load A from ???)
$03/9D89 91 80 STA ($80),y[$7E:202D] A:0004 X:0000 Y:002D P:envMxdizc - Store A in Critical Hit%.
$03/9D8C A5 AA LDA $AA    [$00:00AA] A:0004 X:0000 Y:002E P:envMxdizc - Load A from Str/4. (In Bow/Arrow's Case Load A from ?Levelx6?)
$03/9D8E 91 80 STA ($80),y[$7E:202E] A:0023 X:0000 Y:002E P:envMxdizc - Store A in Critical Hit Bonus.
--------------------------------------------------------------------------------------------------------------------------------------------------
$03/9D90 AD 77 39 LDA $3977  [$7E:3977] A:0023 X:0000 Y:002E P:envMxdizc - Load "Is it Yang?" byte.
$03/9D93 29 20 AND #$20 A:0080 X:0000 Y:002E P:eNvMxdizc - Get rid of bits.
$03/9D95 D0 07 BNE $07    [$9D9E] A:0000 X:0000 Y:002E P:envMxdiZc - If not 00 branch to 039D9E.
$03/9D97 AD 9C 28 LDA $289C  [$7E:289C] A:0000 X:0000 Y:002E P:envMxdiZc - Load A from Weapon Properties.
$03/9D9A 29 20 AND #$20 A:0001 X:0000 Y:002E P:envMxdizc - Get rid of bits.
$03/9D9C F0 09 BEQ $09    [$9DA7] A:0000 X:0000 Y:002E P:envMxdiZc - If 00 branch to 039DA7
-------------------------------------------------------------------------------------------
(Only for Bow/Arrow?)
$03/9DA1 B1 80 LDA ($80),y[$7E:2081] A:0020 X:0000 Y:0001 P:envMxdizc - Load Character Class/Row/Long Range.
$03/9DA3 09 20 ORA #$20 A:0025 X:0000 Y:0001 P:envMxdizc - Add Long Range Bit.
$03/9DA5 91 80 STA ($80),y[$7E:2081] A:0025 X:0000 Y:0001 P:envMxdizc - Store A in Character Class/Row/Long Range.
----------------------------------------------------------------------------------------------------------------------

$03/9DA7 60 RTS A:0000 X:0000 Y:0042 P:envMxdiZc - Return
----------------------------------------------------------------------------------------------

And there we go! I have to head out for a short while, but this should be good enough to post. It is clear now that the other attack formula are probably very nearby. Likely in between the bytes that read specifically Yang in the first bit of code above. Because clearly this second portion of code is used by every attack formula I would imagine.


And it seems I was right. The normal attack building formula is within. Though there is a lot of reference to this 3977 byte that I've erroneously called "Is it Yang?" since it seems to be used for a lot of other dealings as well.

And it would seem I was wrong all around for Critical Hits and Critical Hit Bonuses. They aren't unique to each character but it seemed that way to me because I did not think Level or Strength would play into it at all.

This did reveal two more things as well...

Bytes 41 and 42 of Character's data is Level /4 and Levelx2. When not cheating, it appears. Hence why just changing the levell doesn't actually appear to do much of anything on its own.

 :edit: And the Bow and Arrow section has been added! That only leaves dual weapons, I would think.

As to how to figure out Bow/Arrow Formula... well let's see...

Code: [Select]
$03/9CD3 AD 9D 28 LDA $289D  [$7E:289D] A:0020 X:0000 Y:001C P:envMxdizc - Load Left-Handed Weapon's Power.
$03/9CD6 4A LSR A A:000A X:0000 Y:001C P:envMxdizc - /2.
$03/9CD7 18 CLC A:0005 X:0000 Y:001C P:envMxdizc - Clear Carry Flag.
$03/9CD8 6D A8 28 ADC $28A8  [$7E:28A8] A:0005 X:0000 Y:001C P:envMxdizc - Add the Value of the Right Handed Weapon onto A.
$03/9CDB 65 AA ADC $AA    [$00:00AA] A:000A X:0000 Y:001C P:envMxdizc - Add the value from Level/4 onto A.
$03/9CDD 85 BF STA $BF    [$00:00BF] A:000C X:0000 Y:001C P:envMxdizc - Store A in BF.
$03/9CDF A0 00 00 LDY #$0000 A:000C X:0000 Y:001C P:envMxdizc - Load 00 into Y.
$03/9CE2 B1 80 LDA ($80),y[$7E:2080] A:000C X:0000 Y:0000 P:envMxdiZc - Load Character ID.
$03/9CE4 29 C0 AND #$C0 A:0086 X:0000 Y:0000 P:eNvMxdizc - Get rid of inapplicable bits.
$03/9CE6 2D 78 39 AND $3978  [$7E:3978] A:0080 X:0000 Y:0000 P:eNvMxdizc - Get rid of inapplicable bits.
$03/9CE9 F0 19 BEQ $19    [$9D04] A:0000 X:0000 Y:0000 P:envMxdiZc - Branch if 00 to 039D04.
-----------------------------------------------------------------------------------------------------------------------------------------------------
(Only accessible if the Bow is in the dominant hand and the Arrow is in the recessive hand)

$03/9CEB A5 BF LDA $BF    [$00:00BF] A:0080 X:0000 Y:0000 P:eNvMxdizc - Load A from Culminated Attack Power
$03/9CED AA TAX A:000C X:0000 Y:0000 P:envMxdizc - Transfer A to X.
$03/9CEE 8E 45 39 STX $3945  [$7E:3945] A:000C X:000C Y:0000 P:envMxdizc - Store X in 7E3945.
$03/9CF1 A2 05 00 LDX #$0005 A:000C X:000C Y:0000 P:envMxdizc - Load 0005 into X.
$03/9CF4 8E 47 39 STX $3947  [$7E:3947] A:000C X:0005 Y:0000 P:envMxdizc - Store X in 7E3947.
$03/9CF7 20 07 84 JSR $8407  [$03:8407] A:000C X:0005 Y:0000 P:envMxdizc - Jump to Subroutine (Rolls a 0 value at 3949 16 times before spitting out a 1/5 value)
$03/9CFB A5 BF LDA $BF    [$00:00BF] A:0000 X:0000 Y:0000 P:envMxdiZC - Load A from Culminated Attack Power.
$03/9CFD ED 49 39 SBC $3949  [$7E:3949] A:000C X:0000 Y:0000 P:envMxdizC - Subtract the value from 7E3949.
$03/9D00 85 BF STA $BF    [$00:00BF] A:000A X:0000 Y:0000 P:envMxdizC - Store A in Culminated Attack Power
$03/9D02 80 0F BRA $0F    [$9D13] A:000A X:0000 Y:0000 P:envMxdizC - Branch to 039D13.

-----------------------------------------------------------------------------------------------------------------------------------------
$03/9D04 A5 BF LDA $BF    [$00:00BF] A:0000 X:0000 Y:0000 P:envMxdiZc - Load A from Bow Attack /2, +Arrow Attack + Str/4.
$03/9D06 80 0B BRA $0B    [$9D13] A:000C X:0000 Y:0000 P:envMxdizc - Branch to 039D13

Deathlike 2's formula says...
Bow and Arrow (with Bow in recessive hand):
Base Attack Power = Bow's Attack Power/2 + Arrow's Attack Power + Str/4

This is entirely accurate as the data above would attest.

It appears to be Bow Attack /2 + Arrow Attack, + Str/4 = Attack Power. Testing with default Rosa shows the power of the bow is turned to 05, then the Arrow's attack is added and the Strength bonus is included.

Now for...

If the bow is in the character's primary hand...

Base Attack Power = Base Attack Power (Bow and Arrow) * 4/5

That too is 100% accurate. The game takes it through a routine which chops the main power of the attack by 1/5 in total.

 :edit: And Dual Wielding is finished which means this Formula Building should be done all in all.

Code: [Select]
03/9CB5 18 CLC A:0000 X:0000 Y:001C P:enVMxdiZC - Clear Carry Flag.
$03/9CB6 AD 9D 28 LDA $289D  [$7E:289D] A:0000 X:0000 Y:001C P:enVMxdiZc - Load 1st Weapon Attack Power into A.
$03/9CB9 65 A9 ADC $A9    [$00:00A9] A:0019 X:0000 Y:001C P:enVMxdizc - Add Level /4 onto A.
$03/9CBB 65 AA ADC $AA    [$00:00AA] A:001F X:0000 Y:001C P:envMxdizc - Add Str/4 onto A.
$03/9CBD 85 AB STA $AB    [$00:00AB] A:0026 X:0000 Y:001C P:envMxdizc - Store Weapon +Str/4 +Lvl/4 into AB.
$03/9CBF 18 CLC A:0026 X:0000 Y:001C P:envMxdizc - Clear Carry Flag.
$03/9CC0 AD A8 28 LDA $28A8  [$7E:28A8] A:0026 X:0000 Y:001C P:envMxdizc - Load 2nd Weapon Attack Power into A.
$03/9CC3 65 A9 ADC $A9    [$00:00A9] A:0019 X:0000 Y:001C P:envMxdizc -Add Level/4 into A.
$03/9CC5 65 AA ADC $AA    [$00:00AA] A:001F X:0000 Y:001C P:envMxdizc - Add Str/4 into A.
$03/9CC7 18 CLC A:0026 X:0000 Y:001C P:envMxdizc - Clear Carry Flag.
$03/9CC8 65 AB ADC $AB    [$00:00AB] A:0026 X:0000 Y:001C P:envMxdizc - Add 1st Weapon Power + Str/4 + Level/4 onto A.
$03/9CCA 80 44 BRA $44    [$9D10] A:004C X:0000 Y:001C P:envMxdizc - Branch to 039D10.

The Algorithm FAQ says...


Edge (when he has both hands in use):

Base Attack Power = Weapon on Left Hand's Attack Power +
                    Weapon on Right Hand's Attack Power +
                    (Str/4 + Level/4)*2

And it was right on the dot. Weapon Attack Power + Str/4 + Level/4 * 2 is indeed the formula that is put together for this.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (FFI spell routines in FFIV!)
Post by: Grimoire LD on October 22, 2013, 07:17:47 PM
The post above now contains the Attack Building Formulas for...

Normal Weapons, Yang, Bow/Arrows (Arrows/Bow as well), and Dual-Wielding, this is of most value in the special cases as the normal weapon routine only goes through the necessities that these others mostly go through as well.  However changing the special cases is likely difficult since they only reinforce values from the normal routines for the most part.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (FFI spell routines in FFIV!)
Post by: Deathlike2 on October 23, 2013, 12:45:26 AM
Maybe I'll get around to updating my guide, but that seems like forever and maybe some event would get me going on that.

I got the Yang algo and Edge algo from the original BSiron FAQ.

With respect to the Bow+Arrow algo, I had an actual epiphany one day. It never made sense as to how it was calculated until I went trying out different Bows and doing the math. FF4A revealed quite a bit of the critical hit details.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (FFI spell routines in FFIV!)
Post by: Grimoire LD on October 30, 2013, 02:01:11 PM
Hmm... Well let's take a closer look at that Level Up Data (After 70) shall we?

Random Level Up Selection.

Code: [Select]
$03/EF20 C9 46 CMP #$46 A:0046 X:0000 Y:0004 P:envMxdizc - Is the Level 70?
$03/EF22 90 02 BCC $02    [$EF26] A:0046 X:0000 Y:0004 P:envMxdiZC - If less, branch to 03EF26
----------------------------------------------------------------------------------------------------------------------------------------
$03/EF24 A9 45 LDA #$45 A:0046 X:0000 Y:0004 P:envMxdiZC - Load 69 into A.
---------------------------------------------------------------------------------------------------------------------------------------------
$03/EF26 3A DEC A A:0045 X:0000 Y:0004 P:envMxdizC - -1 to A.
$03/EF27 85 DF STA $DF    [$00:00DF] A:0044 X:0000 Y:0004 P:envMxdizC - Store A in DF.
$03/EF29 A9 05 LDA #$05 A:0044 X:0000 Y:0004 P:envMxdizC - Load 05 into A.
$03/EF2B 85 E1 STA $E1    [$00:00E1] A:0005 X:0000 Y:0004 P:envMxdizC - Store A in E1.
$03/EF2D 20 E0 83 JSR $83E0  [$03:83E0] A:0005 X:0000 Y:0004 P:envMxdizC - Jump to Subroutine (??)
$03/EF30 A4 E3 LDY $E3    [$00:00E3] A:0000 X:0000 Y:0004 P:envMxdiZc - Load Y from E3.
$03/EF32 7B TDC A:0000 X:0000 Y:0154 P:envMxdizc - Transfer Direct Page.
$03/EF33 AA TAX A:0000 X:0000 Y:0154 P:envMxdiZc - Transfer A to X.
---------------------------------------------------------(Looping Point)-------------------------------------------------------------
$03/EF34 B7 80 LDA [$80],y[$0F:B78B] A:0000 X:0000 Y:0154 P:envMxdiZc - Load A from Address in 80+Y (0154)
$03/EF36 9D 9C 28 STA $289C,x[$7E:289C] A:00A9 X:0000 Y:0154 P:eNvMxdizc - Store A in 7E289C.
$03/EF39 C8 INY A:00A9 X:0000 Y:0154 P:eNvMxdizc - +1 to Y.
$03/EF3A E8 INX A:00A9 X:0000 Y:0155 P:envMxdizc - +1 to X
$03/EF3B E0 05 00 CPX #$0005 A:00A9 X:0001 Y:0155 P:envMxdizc - Has it looped five times?
$03/EF3E D0 F4 BNE $F4    [$EF34] A:00A9 X:0001 Y:0155 P:eNvMxdizc - If not loop back to 03EF34
--------------------------------------------------------------------------------------------------------------------------------------------
$03/EF42 BD 02 10 LDA $1002,x[$7E:1002] A:00CB X:0000 Y:0159 P:envMxdiZC - Load Character Level into A.
$03/EF45 C9 46 CMP #$46 A:0046 X:0000 Y:0159 P:envMxdizC - Is it 70?
$03/EF47 90 1C BCC $1C    [$EF65] A:0046 X:0000 Y:0159 P:envMxdiZC - If below 70 branch to 03EF65
----------------------------------------------------------------------------------------------------------------------------------------------
$03/EF4A A2 00 00 LDX #$0000 A:0046 X:0000 Y:0159 P:envMxdiZC - Load 00 into X.
$03/EF4D A9 07 LDA #$07 A:0046 X:0000 Y:0159 P:envMxdiZC - Load 07 into A.
$03/EF4F 20 79 83 JSR $8379  [$03:8379] A:0007 X:0000 Y:0159 P:envMxdizC - Put 00-07 into a Random Number Generator (choosing which of the eight selections to take)
$03/EF52 AA TAX A:0003 X:0000 Y:0059 P:eNvMxdizc - Transfer A to X.
$03/EF53 86 AD STX $AD    [$00:00AD] A:0003 X:0003 Y:0059 P:envMxdizc - Store X in AD.
$03/EF55 7A PLY A:0003 X:0003 Y:0059 P:envMxdizc - Pull Y from Stack.
$03/EF56 C2 20 REP #$20 A:0003 X:0003 Y:0159 P:envMxdizc - Reset Processor Status.
$03/EF58 98 TYA A:0003 X:0003 Y:0159 P:envmxdizc - Transfer Y to A.
$03/EF59 18 CLC A:0159 X:0003 Y:0159 P:envmxdizc - Clear Carry Flag.
$03/EF5A 65 AD ADC $AD    [$00:00AD] A:0159 X:0003 Y:0159 P:envmxdizc - Add the value in AD onto A.
$03/EF5C A8 TAY A:015C X:0003 Y:0159 P:envmxdizc - Transfer A to Y.
$03/EF5D 7B TDC A:015C X:0003 Y:015C P:envmxdizc - Transfer Direct Page.
$03/EF5E E2 20 SEP #$20 A:0000 X:0003 Y:015C P:envmxdiZc - Set Processor STatus.
$03/EF60 B7 80 LDA [$80],y[$0F:B793] A:0000 X:0003 Y:015C P:envMxdiZc - Load A from Address in 80 + y (to reach appropriate section of data)
$03/EF62 8D 9C 28 STA $289C  [$7E:289C] A:00F9 X:0003 Y:015C P:eNvMxdizc - Store A in 7E289C.
$03/EF65 AD 9F 28 LDA $289F  [$7E:289F] A:00F9 X:0003 Y:015C P:eNvMxdizc - Load A from 7E289F.
$03/EF68 85 AD STA $AD    [$00:00AD] A:0062 X:0003 Y:015C P:envMxdizc - Store A in AD.
$03/EF6A AD A0 28 LDA $28A0  [$7E:28A0] A:0062 X:0003 Y:015C P:envMxdizc - Load A from 7E28A0.
$03/EF6D 85 AE STA $AE    [$00:00AE] A:00CB X:0003 Y:015C P:eNvMxdizc - Store A in AE.
$03/EF6F AD 9E 28 LDA $289E  [$7E:289E] A:00CB X:0003 Y:015C P:eNvMxdizc - Load A from 7E289E.
$03/EF72 20 83 84 JSR $8483  [$03:8483] A:00BA X:0003 Y:015C P:eNvMxdizc - Jump to Subroutine (Divide the value in A 5 times.)
$03/EF75 85 AF STA $AF    [$00:00AF] A:0005 X:0003 Y:015C P:envMxdizC - Store A in AF.
$03/EF77 A6 A6 LDX $A6    [$00:00A6] A:0005 X:0003 Y:015C P:envMxdizC - Load X from A6 (I swear the random choice above wasn't even used...)
$03/EF79 18 CLC A:0005 X:0000 Y:015C P:envMxdiZC - Clear Carry Flag.
$03/EF7A BD 3D 10 LDA $103D,x[$7E:103D] A:0005 X:0000 Y:015C P:envMxdiZc - Load Experience Byte 1.
(A lot of basic experience computing here for a while, skipping it...)

Yet even with all of this I can't figure it out properly, hmm...





Title: Re: Grimoire LD's Notes, Methods, and Hacks (FFI spell routines in FFIV!)
Post by: Grimoire LD on December 23, 2013, 05:46:00 PM
Code: [Select]
It's been a while since I delved into the coding, but I decided to take a look at how Auto-Cover works and I think I found Part of the answer.

$03/AFA8 AD 5E 35 LDA $355E  [$7E:355E] A:0081 X:0000 Y:0000 P:eNvMxdizC - Load Paladin Slot
$03/AFAB C5 CE CMP $CE    [$00:00CE] A:0000 X:0000 Y:0000 P:envMxdiZC - Compare it to Current Slot.
$03/AFAD F0 4C BEQ $4C    [$AFFB] A:0000 X:0000 Y:0000 P:eNvMxdizc - If the two are equal branch to 03AFFB (seems to be if it is "not allowed" to Cover.)
$03/AFAF AD 5E 35 LDA $355E  [$7E:355E] A:0000 X:0000 Y:0000 P:eNvMxdizc - Load Paladin Slot
$03/AFB2 20 89 84 JSR $8489  [$03:8489] A:0000 X:0000 Y:0000 P:envMxdiZc - Jump to Subroutine (unimportant for this)
$03/8489 8D 2F 35 STA $352F  [$7E:352F] A:0000 X:0000 Y:0000 P:envMxdiZc - Store A in 7E352F.
$03/848C 85 DF STA $DF    [$00:00DF] A:0000 X:0000 Y:0000 P:envMxdiZc - Store A in DF.
$03/848E A9 80 LDA #$80 A:0000 X:0000 Y:0000 P:envMxdiZc - Load 80 into A.
$03/8490 85 E1 STA $E1    [$00:00E1] A:0080 X:0000 Y:0000 P:eNvMxdizc - Store A in E1.
$03/8492 20 E0 83 JSR $83E0  [$03:83E0] A:0080 X:0000 Y:0000 P:eNvMxdizc - Jump to Subroutine (unimportant for this)
$03/83E0 64 E0 STZ $E0    [$00:00E0] A:0080 X:0000 Y:0000 P:eNvMxdizc - Store Zero in E0.
$03/AFB5 A6 A6 LDX $A6    [$00:00A6] A:0000 X:0000 Y:0000 P:envMxdiZc - Load X from A6 (Character Position)
$03/AFB7 BD 03 20 LDA $2003,x[$7E:2003] A:0000 X:0000 Y:0000 P:envMxdiZc - Load Coverer's Status Byte 1.
$03/AFBA 29 C0 AND #$C0 A:0000 X:0000 Y:0000 P:envMxdiZc - Are they Petrified or Dead?
$03/AFBC D0 38 BNE $38    [$AFF6] A:0000 X:0000 Y:0000 P:envMxdiZc - If so branch to 03AFF6.
$03/AFBE BD 04 20 LDA $2004,x[$7E:2004] A:0000 X:0000 Y:0000 P:envMxdiZc - Load Coverer's Status Byte 2.
$03/AFC1 29 3C AND #$3C A:0000 X:0000 Y:0000 P:envMxdiZc - Are they Berserk, Charm, Sleep, or Paralyzed?
$03/AFC3 D0 31 BNE $31    [$AFF6] A:0000 X:0000 Y:0000 P:envMxdiZc - If so branch to 03AFF6.
$03/AFC5 BD 05 20 LDA $2005,x[$7E:2005] A:0000 X:0000 Y:0000 P:envMxdiZc - Load Coverer's Status Byte 3.
$03/AFC8 29 50 AND #$50 A:0000 X:0000 Y:0000 P:envMxdiZc - Are they ?Defending? or Stopped?
$03/AFCA D0 2A BNE $2A    [$AFF6] A:0000 X:0000 Y:0000 P:envMxdiZc - If so branch to 03AFF6.
$03/AFCC BD 06 20 LDA $2006,x[$7E:2006] A:0000 X:0000 Y:0000 P:envMxdiZc - Load Coverer's Status Byte 4.
$03/AFCF 29 01 AND #$01 A:0000 X:0000 Y:0000 P:envMxdiZc - Are they in Critical?
$03/AFD1 D0 23 BNE $23    [$AFF6] A:0000 X:0000 Y:0000 P:envMxdiZc - If so branch to 03AFF6.

That's the important parts of it, but I might be missing necessary portions that could be used to modify it effectively.

Title: Re: Grimoire LD's Notes, Methods, and Hacks (FFI spell routines in FFIV!)
Post by: Grimoire LD on December 23, 2013, 07:59:26 PM
Final Fantasy II (The Real Final Fantasy II) was an interesting experiment with some good ideas here and there.

I was looking through their spells and came across a very interesting Black Magic which seems like it would be a neat addition to FFIV.

Aura - Aura is a Black Magic spell that adds elements to physical attacks depending on its level. Any character can learn Aura by the use of Aura Tome (called the Aura Scroll in the Origins release).

Aura adds the following effects per success:

1: Extra damage vs. Magic Beasts
2: Extra damage vs. Aquatic
3: Extra damage vs. Earth
4: Extra damage vs. Giants
5: Extra damage vs. Spellcasters
6: Extra damage vs. Dragon
7: Extra damage vs. Werebeasts

This is a very creative and absolutely fascinating idea! I think it would fit perfectly in FFIV with a bit of a different execution...

Every 10 Wisdom will enable a new addition to the effectiveness of the spell so...

Default - x4 Zombie (Add 80)
20 Wisdom - x4 Mage (Add C0)
30 Wisdom - x4 Spirit (Add C8)
40 Wisdom - x4 Robot (Add CA)
50 Wisdom - x4 Reptile (Add CE)
60 Wisdom - x4 Giant (Add DE)
70 Wisdom - x4 Slime (Add FE)
80 Wisdom - x4 Dragon (Add FF)

Now I've built code but for some reason it doesn't work. It makes the game hang, but not outright crash and I can't figure out why... (Currently replacing Dispel for testing purposes)

Code: [Select]
$03/D8B0 EA NOP A:0003 X:0020 Y:0000 P:envMxdizc - NOP (Not used in the final, just a remnant and has been replaced. Is not the issue)
$03/D8B1 E2 10 SEP #$10 A:0003 X:0020 Y:0000 P:envMxdizc - Set Processor to 8 bit (so X only reads one byte instead f 2)
$03/D8B3 AD 18 27 LDA $2717  [$7E:2717] A:0003 X:0020 Y:0000 P:envMXdizc - Load Target's Wisdom into A.
$03/D8B6 A2 80 LDX #$80 A:0063 X:0020 Y:0000 P:envMXdizc - Load 80 into X (Strong against Zombies)
$03/D8B8 C9 14 CMP #$14 A:0063 X:0080 Y:0000 P:eNvMXdizc - Compare to 20 (20 Wisdom)
$03/D8BA 90 26 BCC $26    [$D8E2] A:0063 X:0080 Y:0000 P:envMXdizC - Branch if less to 03D8E2 (X being placed into Strong vs. Creature Type byte.)
$03/D8BC A2 C0 LDX #$C0 A:0063 X:0080 Y:0000 P:envMXdizC - Load C0 into X.
$03/D8BE C9 1E CMP #$1E A:0063 X:00C0 Y:0000 P:eNvMXdizC - Compare to 30.
$03/D8C0 90 20 BCC $20    [$D8E2] A:0063 X:00C0 Y:0000 P:envMXdizC - Branch if less to 03D8E2.
$03/D8C2 A2 C8 LDX #$C8 A:0063 X:00C0 Y:0000 P:envMXdizC - Load C8 into X.
$03/D8C4 C9 28 CMP #$28 A:0063 X:00C8 Y:0000 P:eNvMXdizC - Compare to 40.
$03/D8C6 90 1A BCC $1A    [$D8E2] A:0063 X:00C8 Y:0000 P:envMXdizC - Branch if less to 03D8E2.
$03/D8C8 A2 CA LDX #$CA A:0063 X:00C8 Y:0000 P:envMXdizC - Load CA into X.
$03/D8CA C9 32 CMP #$32 A:0063 X:00CA Y:0000 P:eNvMXdizC - Compare to 50.
$03/D8CC 90 14 BCC $14    [$D8E2] A:0063 X:00CA Y:0000 P:envMXdizC - Branch if less to 03D8E2.
$03/D8CE A2 CE LDX #$CE A:0063 X:00CA Y:0000 P:envMXdizC - Load CE into X.
$03/D8D0 C9 3C CMP #$3C A:0063 X:00CE Y:0000 P:eNvMXdizC - Compare to 60.
$03/D8D2 90 0E BCC $0E    [$D8E2] A:0063 X:00CE Y:0000 P:envMXdizC - Branch if less to 03D8E2.
$03/D8D4 A2 DE LDX #$DE A:0063 X:00CE Y:0000 P:envMXdizC - Load DE into X.
$03/D8D6 C9 46 CMP #$46 A:0063 X:00DE Y:0000 P:eNvMXdizC - Compare to 70.
$03/D8D8 90 08 BCC $08    [$D8E2] A:0063 X:00DE Y:0000 P:envMXdizC - Branch if less to 03D8E2.
$03/D8DA A2 FE LDX #$FE A:0063 X:00DE Y:0000 P:envMXdizC - Load FE into X.
$03/D8DC C9 50 CMP #$50 A:0063 X:00FE Y:0000 P:eNvMXdizC - Compare to 80
$03/D8DE 90 02 BCC $02    [$D8E2] A:0063 X:00FE Y:0000 P:envMXdizC - Branch if less to 03D8E2.
$03/D8E0 A2 FF LDX #$FF A:0063 X:00FE Y:0000 P:envMXdizC - Load FF into X.
$03/D8E2 8E 1A 27 STX $271A  [$7E:271A] A:0063 X:00FF Y:0000 P:eNvMXdizC - Store X in Strong vs. Creature Type Byte.
$03/D8E5 C2 10 REP #$10 A:0000 X:0080 Y:0000 P:envMXdiZc - Reset Processor Status from 8-Bit
$03/D8E7 60 RTS A:0063 X:00FF Y:0000 P:eNvMXdizC - Return

Now for some reason this doesn't appear to work. I've followed it in code and everything Should work right, it goes through the new formula without a whimper but it is never actually written to 271A and the game hangs from there on. The only thing I can figure is that SEP 10 which is crucial to having this keep the proper amount of space is wrecking the game somehow, despite it being put right back to 20.

Oh... I figured it out. I wanted to Reset the Processor Status of 10, not force a switch.

Alright! Looks like Aura works just as I had hoped!

Well that was fun and I learned a bit more about ASM in the process!


Title: Re: Grimoire LD's Notes, Methods, and Hacks (FFI spell routines in FFIV!)
Post by: Grimoire LD on December 24, 2013, 12:04:35 AM
I was looking at FFIII DS's commands and some of them are rather neat. I've tried to port a couple of them into FFIV while keeping the spirit of the original command alive starting with Advance (now renamed Advnc).

In FFIII DS this increases your attack power and lowers your defense dependent on how high your job level is. In FFIV I decided to change it so that it your attack power will increase dependent on your current Strength and will subtract your Strength from your defense. To prevent stacking this, when it is used the command changes (invisibly) to Parry, so it cannot be stacked.

Code: [Select]
$03/E876 A6 A6 LDX $A6    [$00:00A6] A:0003 X:0012 Y:0000 P:envMxdizc - Load User's Position into X.
$03/E878 A9 09 LDA #$09 A:0003 X:0000 Y:0000 P:envMxdiZc - Load 09 into A (Graphic for Berserk)
$03/E87A 8D C4 33 STA $33C4  [$7E:33C4] A:0009 X:0000 Y:0000 P:envMxdizc - Store A in Audiovisual Code.
$03/E87D BD 14 20 LDA $2014,x[$7E:2014] A:0009 X:0000 Y:0000 P:envMxdizc - Load User's Modified Strength into A.
$03/E880 7D 1D 20 ADC $201D,x[$7E:201D] A:000D X:0000 Y:0000 P:envMxdizc - Add User's Attack Base into A.
$03/E883 C9 FF CMP #$FF A:002E X:0000 Y:0000 P:envMxdizc - Is it above 255?
$03/E885 90 02 BCC $02    [$E889] A:002E X:0000 Y:0000 P:envMxdizc - If not branch to 03E889
-------------------------------------------------------------------------------------------------------------------------
(Code here to set Attack to FF) A9 FF
------------------------------------------------------------------------------------------------------------------------
$03/E889 8D 1D 20 STA $201D  [$7E:201D] A:002E X:0000 Y:0000 P:envMxdizc - Store A in User's Attack Base.
$03/E88C BD 2A 20 LDA $202A,x[$7E:202A] A:002E X:0000 Y:0000 P:envMxdizc - Load User's Defense Base into A.
$03/E88F FD 14 20 SBC $2014,x[$7E:2014] A:0011 X:0000 Y:0000 P:envMxdizc - Subtract A from User's Strength.
$03/E892 B0 02 BCS $02    [$E896] A:0003 X:0000 Y:0000 P:envMxdizC - If more than 00 branch to 03E896.
--------------------------------------------------------------------------------------------------------------------------
(Code here to set Defense to 01) A9 01
----------------------------------------------------------------------------------------------------------------------------
$03/E896 8D 2A 20 STA $202A  [$7E:202A] A:0003 X:0000 Y:0000 P:envMxdizC - Store A in User's Defense Base.
$03/E899 A9 1B LDA #$1B A:0003 X:0000 Y:0000 P:envMxdizC - Load 1B (Parry) into A.
$03/E89B 9D 0F 33 STA $330F,x[$7E:330F] A:001B X:0000 Y:0000 P:envMxdizC - Store A in Advnc's current position.
$03/E89E 60 RTS A:001B X:0000 Y:0000 P:envMxdizC - Return.

And this works absolutely flawlessly! It keeps the spirit of the FFIII Command (using Strength instead of Job Level) and goes on from there.

Unfortunately most of the other commands seem a bit beyond me (Barrage seems neat, with 4 random attacks using 4 arrows, but having it target random foes is tricky as is multiple attacks) and Geomancy is a bit silly in a game where 75% of the game is Caves) and while I would Love to include some form of Item Lore, there's really no room in the Magic Formula where it counts. It wouldn't be difficult to combine FFIII DS's version of Scan with FFIV's Command. Maybe next I'll try to tackle some FFIV-TAY abilities. Piercing Sight was always one of my favorite from a thematic basis.

Title: Re: Grimoire LD's Notes, Methods, and Hacks (FFI spell routines in FFIV!)
Post by: chillyfeez on December 24, 2013, 01:01:57 AM
Regarding your Aura spell - is there a particular reason you chose
Zombie
Mage
Spirit
Robot
Reptile
Giant
Slime
Dragon

Instead of
Zombie
Mage
Slime
Giant
Spirit
Reptile
Machine
Dragon

I think I can think of a way the code could be shorter if you were to follow the "natural order" of creature types. Not that it needs to be, it's just fun for me to think about that kind of thing.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (FFI spell routines in FFIV!)
Post by: Grimoire LD on December 24, 2013, 09:56:11 AM
Ah, the reason I put it that way was to keep it useful through the entire game rather than lulls off in usefulness or is a little too overpowered. That's the problem with Slime being a bit early, it could make Flans not very threatening. But perhaps at 70 Wisdom it comes too late... and if you can squeeze the instructions down a bit so that it can occupy another spot and not Dispel, per se that might be for the best as well.

Sure, the natural order might work better from an efficiency stand point.

Title: Re: Grimoire LD's Notes, Methods, and Hacks (FFI spell routines in FFIV!)
Post by: Pinkpuff on December 24, 2013, 01:53:04 PM
You could get the best of both worlds with a lot of work, by changing around which monsters have which race flags set so that the "natural order" is the preferred order... (i.e. make it so all the slime monsters have the race that normally would indicate spirit, all the giant monsters to have the race that would normally indicate robot, etc.) That would be where FF4kster's handy-dandy config files come into play (I'm looking at you, races.dat)...
Title: Re: Grimoire LD's Notes, Methods, and Hacks (FFI spell routines in FFIV!)
Post by: Grimoire LD on December 24, 2013, 03:21:55 PM
From an editing standpoint, I find the initial races to be rather silly and underused. I once did a count and roughly 60% of the enemies in the game (not counting bosses) have a race and those that do are few and far between, here's some info. I wrote up about it a while back...

19 Reptile (+0 Bosses)
14 Mage (+4 Bosses)
13 Zombie (+2 Bosses)
6 Slime (+0 Bosses)
5 Spirit (+0 Bosses)
13 Dragon (+1 Bosses)
8 Giant (+0 Bosses)
9 Robots (+2 Robots)

61 Bosses (give or take the Dummy's)

161 Enemies

20/160 = 1/8
15/160 = 1/11
15/160 = 1/11
06/160 = 1/27
05/160 = 1/27
15/160 = 1/11
08/160 = 1/20
09/160 = 1/19

87/160 Enemies have a Creature Type, and they most comprise a pathetic amount of enemies. I think Races need an overhaul all around or more foes need to be labeled as one of the existing races. And this is where races.dat would come in handy indeed.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (FFI spell routines in FFIV!)
Post by: chillyfeez on December 27, 2013, 12:05:41 AM
So I was finally getting around to looking at Aura, and I have a question - do you want the effect to vary based on the target's wisdom, or based on the caster's wisdom? I think the code you wrote uses the target's, but in the normal context of FFIV, it seems to me it might make more sense based on the caster's. Not a big deal, it's a difference of one byte, but I just thought I'd ask.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (FFI spell routines in FFIV!)
Post by: Grimoire LD on December 27, 2013, 12:59:58 AM
Uh... wow, how did I write that whole thing and not even realize how Silly that seems? Yes it's supposed be Caster's Wisdom, not Target's Wisdom, haha! Good catch.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (FFI spell routines in FFIV!)
Post by: chillyfeez on December 27, 2013, 12:13:20 PM
Ok, here's my version of Aura:
Code: [Select]
$03/D8B0 AD 97 26    LDA $2697  [$7E:2697]   ;Load caster's Wisdom into A
$03/D8B3 A2 00 00    LDX #$0000              ;Load 0000 into X
$03/D8B6 C9 50       CMP #$50                ;Compare caster's Wisdom with 50(H), or 80(Dec)
$03/D8B8 90 02       BCC $02    [$D8BC]      ;If it is less, skip the next op
$03/D8BA A9 50       LDA #$50                ;If it is 50 or more, load 50 into A
$03/D8BC C9 14       CMP #$14                ;Compare caster's Wisdom with 14(H), or 20(Dec)
$03/D8BE 90 06       BCC $06    [$D8C6]      ;If it is less, skip ahead to 03/D8C6
$03/D8C0 E8          INX                     ;Increase X by 1
$03/D8C1 38          SEC                     
$03/D8C2 E9 0A       SBC #$0A                ;Subtract 0A, or 10(Dec), from A
$03/D8C4 80 F6       BRA $F6    [$D8BC]      ;Loop back up to 03/D8BC
$03/D8C6 A9 01       LDA #$01                ;load 01 into A
$03/D8C8 E0 00 00    CPX #$0000              ;Compare X with 0000
$03/D8CB F0 05       BEQ $05    [$D8D2]      ;if X is 0000 (first time around, this means caster's wisdom is less than 20), then skip ahead to 03/D8D2
$03/D8CD CA          DEX                     ;Decrease X by 1
$03/D8CE 0A          ASL A                   ;Multiply A by 2, or more appropriately here, shift the bits in A one spot to the left
$03/D8CF 1A          INC A                   ;increase A by 1, or more appropriately here, set A's bit 0 to 1
$03/D8D0 80 F6       BRA $F6    [$D8C8]      ;Loop back up to 03/D8C8
$03/D8D2 0D 1A 27    ORA $271A  [$7E:271A]   ;OR A with Target's "strong against" byte
$03/D8D5 8D 1A 27    STA $271A  [$7E:271A]   ;Store A in target's "strong against" byte
$03/D8D8 60          RTS
It's shorter by 14 bytes.
Also, I used an OR to ensure any current "strong against" data won't be wiped out by the spell. That is, if the target character is already strong against machines, and the caster's Wisdom is only 30, the target will end up strong against Undead, Mages, Slimes and Machines.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (FFI spell routines in FFIV!)
Post by: Grimoire LD on December 27, 2013, 01:21:42 PM
This seems pretty good! I especially like the looping matters. My only concern towards this is...

How is it starting in reverse? The Natural Order of Monsters goes... Dragon, Robot, Reptile, Spirit, Giant, Slime, Mage, Zombie...

The way your script seems to work would be to go (Less than 20 Wisdom) Dragon, and the A would be multiplied until at 80 Wisdom Undead is added...

Now, what if this is done instead...?


Code: [Select]
$03/D8C6 A9 80       [b]LDA #$80               ;load 80 into A[/b]
$03/D8C8 E0 00 00    CPX #$0000              ;Compare X with 0000
$03/D8CB F0 05       BEQ $05    [$D8D2]      ;if X is 0000 (first time around, this means caster's wisdom is less than 20), then skip ahead to 03/D8D2
$03/D8CD CA          DEX                     ;Decrease X by 1
$03/D8CE 4A         [b] LSR A                   ;Divide A by 2, or more appropriately here, shift the bits in A one spot to the right[/b]
$03/D8CF 1A          INC A                   ;increase A by 1, or more appropriately here, set A's bit 0 to 1 [b](Not sure what to do with this one in this arrangement)[/b]
$03/D8D0 80 F6       BRA $F6    [$D8C8]      ;Loop back up to 03/D8C8
$03/D8D2 0D 1A 27    ORA $271A  [$7E:271A]   ;OR A with Target's "strong against" byte
$03/D8D5 8D 1A 27    STA $271A  [$7E:271A]   ;Store A in target's "strong against" byte
$03/D8D8 60          RTS

Since the original code you have set up seems to go with the normal order 01 to 80 rather than 80 to 01.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (FFI spell routines in FFIV!)
Post by: chillyfeez on December 27, 2013, 02:25:39 PM
I didn't check the actual effect on live monsters, but the bab-il docs say bit 0 (00000001)=undead and bit 7 (10000000)=dragon, so that's what I wrote. Is creature type actually reversed?
Title: Re: Grimoire LD's Notes, Methods, and Hacks (FFI spell routines in FFIV!)
Post by: Grimoire LD on December 27, 2013, 02:35:06 PM
Indeed, 80 is Undead because its used in a bunch of "If Undead..." checks and it doesn't use CMP 80 but BMI or BPL
.

I think at times Yousei may have been mixing himself up. In one document he has...

bit 0 fire
bit 1 ice
bit 2 lightning
bit 3 darkness
bit 4 sacred
bit 5 spears/arrows
bit 6 drain
bit 7 (for armors) immunity to elements for which the bits are set, otherwise
    unknown

And in another he has...

bit 0: immune to elements
        bit 1: absorbs elements
        bit 2: resists elements
        bit 3: sacred
        bit 4: darkness
        bit 5: lightning
        bit 6: ice
        bit 7: fire

When from a technical standpoint we should know that they are reversed.

80 is Undead, 40 is Mage, etc.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (FFI spell routines in FFIV!)
Post by: chillyfeez on December 27, 2013, 03:42:33 PM
Hmm... then you'd have to LSR A, then ORA #$80 (that'd be the most economical route). It would be an extra byte long, so would affect the operand of a couple of branches, too. I'm doing this on my phone right now. Will update the code when I get home.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (FFI spell routines in FFIV!)
Post by: Grimoire LD on December 27, 2013, 04:58:55 PM
Sounds good. Thanks for taking a look at this for me as well. The last thing I want to present is unnecessarily long code.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (FFI spell routines in FFIV!)
Post by: chillyfeez on December 27, 2013, 06:00:03 PM
The last thing I want to present is unnecessarily long code.
What? You mean you don't want to be like the FFIV developers?
Thanks for taking a look at this for me as well.
Assuming this is not tongue-in-cheek (since you didn't ask, I just kinda butted in), no problem. This kinda stuff is fun for me compared to where I am in my little preview project - writing in character palettes using SNESPal. Ugh!

So here's the updated code. I tested it and it works, though as before, I did not test the resultant character's attacks on the pertinent monsters.
Code: [Select]
$03/D8B0 AD 97 26 LDA $2697  [$7E:2697] ;Load caster's Wisdom into A
$03/D8B3 A2 00 00 LDX #$0000 ;Load 0000 into X
$03/D8B6 C9 50 CMP #$50 ;Compare caster's Wisdom with 50(H), or 80(Dec)
$03/D8B8 90 02 BCC $02    [$D8BC] ;If it is less, skip the next op
$03/D8BA A9 50 LDA #$50 ;If it is 50 or more, load 50 into A
$03/D8BC C9 14 CMP #$14 ;Compare caster's Wisdom with 14(H), or 20(Dec)
$03/D8BE 90 06 BCC $06    [$D8C6] ;If it is less, skip ahead to 03/D8C6
$03/D8C0 E8 INX ;Increase X by 1
$03/D8C1 38 SEC                     
$03/D8C2 E9 0A SBC #$0A ;Subtract 0A, or 10(Dec), from A
$03/D8C4 80 F6 BRA $F6    [$D8BC] ;Loop back up to 03/D8BC
$03/D8C6 A9 80 LDA #$80 ;load 01 into A
$03/D8C8 E0 00 00 CPX #$0000 ;Compare X with 0000
$03/D8CB F0 06 BEQ $06    [$D8D3] ;if X is 0000 (first time around, this means caster's wisdom is less than 20), then skip ahead to 03/D8D3
$03/D8CD CA DEX ;Decrease X by 1
$03/D8CE 4A LSR A ;Divide A by 2, or more appropriately here, shift the bits in A one spot to the right
$03/D8CF 09 80 ORA #$80 ;OR A with 80, or more appropriately here, set A's bit 7 to 1
$03/D8D1 80 F5 BRA $F5    [$D8C8] ;Loop back up to 03/D8C8
$03/D8D3 0D 1A 27 ORA $271A  [$7E:271A] ;OR A with Target's "strong against" byte
$03/D8D6 8D 1A 27 STA $271A  [$7E:271A] ;Store A in target's "strong against" byte
$03/D8D9 60 RTS
Title: Re: Grimoire LD's Notes, Methods, and Hacks (FFI spell routines in FFIV!)
Post by: Grimoire LD on December 27, 2013, 06:39:12 PM
Not tongue-in-cheek at all. As you pointed out above I don't Want to be like the original developers, hehe (speaking of such there is probably a lot of CMP/BEQ combo's in the code that could be covered with a simple TSB, but I've never seen FFIV use a TSB command anywhere despite it appearing the most efficient way to check if a byte reads a specific value.

I'll test this out and tell you how it goes.

Oy, image editing in this game so far has been atrocious for me, outside of your Summon Tutorial I can't really grasp it, nor even figure out how to load the proper palettes in TileMolester if I ever wanted to change a character's sprite. So best of luck with what you're up to. The lack of a decent image editor is one of the things keeping back my hacks.

Title: Re: Grimoire LD's Notes, Methods, and Hacks (FFI spell routines in FFIV!)
Post by: Grimoire LD on December 27, 2013, 06:57:31 PM
I see... I think you made the same mistake I had.

With less than 20 Wisdom it works flawlessly 80 is added to the value and that is it, but when more than 20...

Code: [Select]
$03/D8B0 AD 97 26 LDA $2697  [$7E:2697] A:0003 X:0020 Y:0000 P:envMxdizc
$03/D8B3 A2 00 00 LDX #$0000 A:0022 X:0020 Y:0000 P:envMxdizc
$03/D8B6 C9 50 CMP #$50 A:0022 X:0000 Y:0000 P:envMxdiZc
$03/D8B8 90 02 BCC $02    [$D8BC] A:0022 X:0000 Y:0000 P:eNvMxdizc
$03/D8BC C9 14 CMP #$14 A:0022 X:0000 Y:0000 P:eNvMxdizc
$03/D8BE 90 06 BCC $06    [$D8C6] A:0022 X:0000 Y:0000 P:envMxdizC
$03/D8C0 E8 INX A:0022 X:0000 Y:0000 P:envMxdizC
$03/D8C1 38 SEC A:0022 X:0001 Y:0000 P:envMxdizC
$03/D8C2 39 0A 80 AND $800A,y[$7E:800A] A:0022 X:0001 Y:0000 P:envMxdizC
$03/D8C5 F6 A9 INC $A9,x  [$00:00AA] A:0000 X:0001 Y:0000 P:envMxdiZC
$03/D8C7 80 E0 BRA $E0    [$D8A9] A:0000 X:0001 Y:0000 P:envMxdizC
$03/D8A9 02 A9 COP #$A9 A:0000 X:0001 Y:0000 P:envMxdizC
$00/FFFF FF 0A 2F 0A SBC $0A2F0A,x[$0A:2F0B] A:0000 X:0001 Y:0000 P:envMxdIzC
$00/0003 80 F2 BRA $F2    [$FFF7] A:00F6 X:0001 Y:0000 P:eNvMxdIzc
$00/FFF7 FF FF FF FF SBC $FFFFFF,x[$FF:0000] A:00F6 X:0001 Y:0000 P:eNvMxdIzc
$00/FFFB FF 00 80 FF SBC $FF8000,x[$FF:8001] A:00EB X:0001 Y:0000 P:eNvMxdIzC
(And so on and so forth in garbage code...)

Your Set Carry Flag is not adequate to change it to read one byte, it will continue to read two bytes. The way I found to get around this is to use..

$03/D8B1   E2 10   SEP #$10   A:0003   X:0020   Y:0000   P:envMxdizc - Set Processor to 8 bit (so X only reads one byte instead of 2)

Then when it is near the end of the script reset it with...

$03/D8E5   C2 10   REP #$10   A:0000   X:0080   Y:0000   P:envMXdiZc - Reset Processor Status from 8-Bit

Unless there is a much simpler way to go about it that I don't know of.

 :edit: Though if this screwed up for me, why did it show up fine for you? You're pulling the raw code from the same place I was I presume, Geiger's emulator.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (FFI spell routines in FFIV!)
Post by: chillyfeez on December 27, 2013, 07:42:23 PM
You left out the LDA #$50 at 03/D8BA. I think that might be screwing everything else up.
This code doesn't need to worry about 16/32-bit processor status. It uses the default statuses (stati?) for A (16) and X (32).

 :edit: there's more wrong there. Try recopying the whole code, I think.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (FFI spell routines in FFIV!)
Post by: Grimoire LD on December 27, 2013, 07:49:42 PM
Hmm, but as per the code if it reads More than 20 but less than 80 it automatically skips that...


Code: [Select]
$03/D8B0 AD 97 26 LDA $2697  [$7E:2697] A:0003 X:0020 Y:0000 P:envMxdizc
$03/D8B3 A2 00 00 LDX #$0000 A:0022 X:0020 Y:0000 P:envMxdizc
$03/D8B6 C9 50 CMP #$50 A:0022 X:0000 Y:0000 P:envMxdiZc
$03/D8B8 90 02 BCC $02    [$D8BC] A:0022 X:0000 Y:0000 P:eNvMxdizc (Compares it, finds it isn't valid and moves on.
$03/D8BC C9 14 CMP #$14 A:0022 X:0000 Y:0000 P:eNvMxdizc

Oh! I see! Gah! How careless of me... I confused E9 for 39! I blame it on my slight dyslexia.

The copied code ingame does have A950 where it should be.

And there we go... it's working as intended. Eh heh. Sorry about that Chillyfeez, I'm not sure why my mind jumped to the SEC being the culprit.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (FFI spell routines in FFIV!)
Post by: Grimoire LD on December 27, 2013, 11:56:15 PM
From Dragoon-ZERO's Long Range Fix patch, he was helpful enough to include what he changed and what was Originally there in ROM! (Commented for readability)

Code: [Select]
$03/9D90 AD 77 39    LDA $3977  [$7E:3977]   A:001E X:0000 Y:002E P:envMxdIzc - (???)
$03/9D93 29 20       AND #$20                A:0080 X:0000 Y:002E P:eNvMxdIzc - Is it 20? (???)
$03/9D95 D0 07       BNE $07    [$9D9E]      A:0000 X:0000 Y:002E P:envMxdIZc - If not 00 branch to 039D9E.
$03/9D97 AD 9C 28    LDA $289C  [$7E:289C]   A:0000 X:0000 Y:002E P:envMxdIZc - Load (???)
$03/9D9A 29 20       AND #$20                A:00FF X:0000 Y:002E P:eNvMxdIzc - Is it 20?? (???)
$03/9D9C F0 09       BEQ $09    [$9DA7]      A:0020 X:0000 Y:002E P:envMxdIzc - Branch if 00 to 039DA7.
$03/9D9E A0 01 00    LDY #$0001              A:0020 X:0000 Y:002E P:envMxdIzc - Load 0001 into Y.
$03/9DA1 B1 80       LDA ($80),y[$7E:2001]   A:0020 X:0000 Y:0001 P:envMxdIzc - Load A from 7E2000 (+1)  Row/Character ID.
$03/9DA3 09 20       ORA #$20                A:0000 X:0000 Y:0001 P:envMxdIZc - Add 20 if applicable.
$03/9DA5 91 80       STA ($80),y[$7E:2001]   A:0020 X:0000 Y:0001 P:envMxdIzc - Store A in 7E2001.
$03/9DA7 60          RTS                     A:0020 X:0000 Y:0001 P:envMxdIzc - Return.


(Custom Code by Dragoon ZERO)
A0 01 00    LDY #$0001 - Load 1 into Y.
B1 80       LDA ($80),y - Load A from 7E2001.
29 DF       AND #$DF - Add DF (-20) if Applicable.
91 80       STA ($80),y - Store A in 7E2001.
AD 9C 28    LDA $289C - Load (???)
29 20       AND #$20 - Is it 20?
F0 06       BEQ $06 - If so branch.
B1 80       LDA ($80),y - Load 7E2001 into A.
09 20       ORA #$20 - Add 20 into A if applicable.
91 80       STA ($80),y - Store A in 7E2001.
60          RTS - Return

Now that is a fantastic piece of work there!  And that is a place of much interest and if the information for that weapon bit is there, who is to say if the data for the other weapon bits maybe closeby?
Title: Re: Grimoire LD's Notes, Methods, and Hacks (FFI spell routines in FFIV!)
Post by: Grimoire LD on December 28, 2013, 03:22:41 PM
Oh Zeromus, you are nothing but trouble...

I'm finally at the end of testing this and have learned Zeromus will not let it go quietly...

There's a few special parts to the Zeromus battle which look specifically for Cecil, the Crystal, the Paladin, and everything else is considered Dead with 0 HP. I will have to go back and figure out why this is. It is nothing in the Event Script that's for certain.

It's all before the Golbez/FuSoYa battle or after that. It's difficult to say.

If you are Not Paladin Cecil - Lower HP to 0, set Status Byte 1 to 80 (Dead)

...Alright, the moment Zeromus does his "shaking" animation he kills all characters that aren't Paladin Cecil. A very exact place to put it, but okay.

And I found it! In RAM at...
$00/C21F   C9 0B   CMP #$0B   A:0001   X:0000   Y:0002   P:envMxdizc - Is it Paladin Cecil?

Just change this to whichever character you want to be alive with 1 HP, for my purposes that is 01

And finally the Crystal... I tackled this a long time ago actually...

RAM: 0x3A127 - C9 C8 (Compare Crystal Item Number)
RAM: 0x3A132 - C9 0B (Only this Unit ID may use the item designated as "Crystal")

ROM...

0x1A327 - C9 C8 (Compare Crystal Item Number)
0x1A332 - C9 0B (Only this Unit ID may use the item designated as "Crystal")


And finally one more check...

"If Unit 11 Uses Dark Magic" Counter that Zeromus has set up. I'll change that to 01 for my purposes.

And that is that! Finally my Solo Rydia Challenge patch is ready for release! And I can use this as a template for other Solo Challenge patches as well.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (FFI spell routines in FFIV!)
Post by: chillyfeez on December 28, 2013, 11:18:58 PM
I was looking at your Advnc command...
First of all, it's a cool idea to invisibly change the command once it's been used. I've never had much luck deciphering what all of the "command menu data" means in in-battle RAM.
A couple of things on that, though:
1) Would the location of the command in RAM change depending on which of the character's command slots Advnc occupies? Not a big deal as long as nobody edits a hack that already has this set. Not as big a deal as...
2) Looks like you're changing the command based on an X that is set by the character's character slot. Fine if the character is in slot 0, because then X will be 0. But if thcharacter is in slot 1, then X will be 80, and "330F, 80" is 338F, which is another section of RAM. If my calculations are correct, you'd have to somehow make X equal to the character's slot times 1C for this to work right... Right?
Title: Re: Grimoire LD's Notes, Methods, and Hacks (FFI spell routines in FFIV!)
Post by: Grimoire LD on December 28, 2013, 11:42:54 PM
Thanks! The system is very wide open and has not been used to its full potential, though my uncreative self can only think to recreate things from other games, hehe.

For the first concern, the normal Hide command surprisingly does a balanced search through all five commands before seeing where it lays (Which is the Second Slot). It used a bit of code to do so originally. I didn't want to deal with that, so yes. It is fully dependent on its particular place in a character's command slots.

The second concern is troubling now that you mention it... the original Hide code uses "$03/E880   AE 34 35   LDX $3534  [$7E:3534]   A:0080   X:0000   Y:0000   P:eNvMxdizc - Load X from 7E3534." to keep track... I should have tried the command with more than the person in the first slot and saw that this would happen. I can only assume that the data in there looks specifically at the command options for each character. Hmm, maybe basing it more on the initial code for the relevant portions of Hide may have been the better idea.

Code: [Select]
$03/E876 A6 A6 LDX $A6    [$00:00A6] A:0003 X:0012 Y:0000 P:envMxdizc - Load Character Slot into A.
$03/E878 BD 06 20 LDA $2006,x[$7E:2006] A:0003 X:0000 Y:0000 P:envMxdiZc - Load Slot X's Status Byte 4.
$03/E87B 09 80 ORA #$80 A:0000 X:0000 Y:0000 P:envMxdiZc - Add 80.
$03/E87D 9D 06 20 STA $2006,x[$7E:2006] A:0080 X:0000 Y:0000 P:eNvMxdizc - Store A in Slot X's Status Byte 4.
$03/E880 AE 34 35 LDX $3534  [$7E:3534] A:0080 X:0000 Y:0000 P:eNvMxdizc - Load X from 7E3534.
$03/E883 64 A9 STZ $A9    [$00:00A9] A:0080 X:0000 Y:0000 P:envMxdiZc - Store Zero in A9.
----------------------------------------------------(Looping Point)------------------------------------------------------------------------
$03/E885 BD 03 33 LDA $3303,x[$7E:3303] A:0080 X:0000 Y:0000 P:envMxdiZc - Load A from 7E3303.
$03/E888 C9 09 CMP #$09 A:0000 X:0000 Y:0000 P:envMxdiZc - Is it 09? (Hide)
$03/E88A D0 07 BNE $07    [$E893] A:0000 X:0000 Y:0000 P:eNvMxdizc - If not, branch to 03E893.
-------------------------------------------------------------------------------------------------------------------------------------------
$03/E88C A9 1C LDA #$1C A:0009 X:0010 Y:0000 P:envMxdiZC - Load 1C into A. (Show)
$03/E88E 9D 03 33 STA $3303,x[$7E:3313] A:001C X:0010 Y:0000 P:envMxdizC - Store A in 7E3313. (Location of Command to Replace.)
$03/E891 80 08 BRA $08    [$E89B] A:001C X:0010 Y:0000 P:envMxdizC - Branch to 08.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (FFI spell routines in FFIV!)
Post by: chillyfeez on December 29, 2013, 01:19:42 AM
Aha! From the bab-il docs:
Quote
3534-3535 Pointer into the 3302-338D area for the current or most recently
    referenced character. Equal to the slot number times 1C.
That's it! So if you insert a "LDX $3534" in there, that should make it work regardless of character slot (stick it just before editing the command data, like at 03/E89B).
Title: Re: Grimoire LD's Notes, Methods, and Hacks (FFI spell routines in FFIV!)
Post by: Grimoire LD on December 29, 2013, 01:43:13 AM
Good catch! I hadn't noticed that in the babil docs. That would seem to be the way the game intends to, phew. I thought I was going to have to tear it apart and start from scratch.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (FFI spell routines in FFIV!)
Post by: Grimoire LD on December 30, 2013, 09:25:23 PM
That did the trick, just plugged it there in the end as you suggested and Now it works flawlessly!

Code: [Select]
$03/E876 A6 A6 LDX $A6    [$00:00A6] A:0003 X:0012 Y:0000 P:envMxdizc - Load User's Position into X.
$03/E878 A9 09 LDA #$09 A:0003 X:0000 Y:0000 P:envMxdiZc - Load 09 into A (Graphic for Berserk)
$03/E87A 8D C4 33 STA $33C4  [$7E:33C4] A:0009 X:0000 Y:0000 P:envMxdizc - Store A in Audiovisual Code.
$03/E87D BD 14 20 LDA $2014,x[$7E:2014] A:0009 X:0000 Y:0000 P:envMxdizc - Load User's Modified Strength into A.
$03/E880 7D 1D 20 ADC $201D,x[$7E:201D] A:000D X:0000 Y:0000 P:envMxdizc - Add User's Attack Base into A.
$03/E883 C9 FF CMP #$FF A:002E X:0000 Y:0000 P:envMxdizc - Is it above 255?
$03/E885 90 02 BCC $02    [$E889] A:002E X:0000 Y:0000 P:envMxdizc - If not branch to 03E889
-------------------------------------------------------------------------------------------------------------------------
(Code here to set Attack to FF) A9 FF
------------------------------------------------------------------------------------------------------------------------
$03/E889 8D 1D 20 STA $201D  [$7E:201D] A:002E X:0000 Y:0000 P:envMxdizc - Store A in User's Attack Base.
$03/E88C BD 2A 20 LDA $202A,x[$7E:202A] A:002E X:0000 Y:0000 P:envMxdizc - Load User's Defense Base into A.
$03/E88F FD 14 20 SBC $2014,x[$7E:2014] A:0011 X:0000 Y:0000 P:envMxdizc - Subtract A from User's Strength.
$03/E892 B0 02 BCS $02    [$E896] A:0003 X:0000 Y:0000 P:envMxdizC - If more than 00 branch to 03E896.
--------------------------------------------------------------------------------------------------------------------------
(Code here to set Defense to 01) A9 01
----------------------------------------------------------------------------------------------------------------------------
$03/E896 8D 2A 20 STA $202A  [$7E:202A] A:0003 X:0000 Y:0000 P:envMxdizC - Store A in User's Defense Base.
$03/E899 A9 1B LDA #$1B A:0003 X:0000 Y:0000 P:envMxdizC - Load 1B (Parry) into A.
$03/E89B AE 34 35 LDX $3534  [$7E:3534] A:001B X:0000 Y:0000 P:envMxdizc - Load Pointer to Current Character's Command
$03/E89E 9D 0F 33 STA $330F,x[$7E:330F] A:001B X:0000 Y:0000 P:envMxdiZc - Store Parry in Character's 4th Command.
$03/E8A1 60 RTS A:001B X:0000 Y:0000 P:envMxdiZc - Return


Again, thank you very much Chillyfeez!
Title: Re: Grimoire LD's Notes, Methods, and Hacks (FFI spell routines in FFIV!)
Post by: Grimoire LD on January 04, 2014, 02:11:04 AM
I love Magic Swordskills in video games and especially in Final Fantasy. With a routine which took me... a minute to cook up, I changed Blast's small routine(could probably even go somewhere smaller) to make this, it's a very simple routine which loads a Weapon Swing before the spell effect to simulate a Magic Sword.

Code: [Select]
$03/DCF0 A9 C0 LDA #$C0 A:0003 X:0046 Y:FFFF P:envMxdizc - Load Weapon Swing into A.
$03/DCF2 8D C4 33 STA $33C4  [$7E:33C4] A:00C0 X:0046 Y:FFFF P:eNvMxdizc - Store A in Audio/visual commands.
$03/DCF5 4C 88 D3 JMP $D388  [$03:D388] A:00C0 X:0046 Y:FFFF P:eNvMxdizc - Jump to Magic Routine.


Now maybe we can turn Cecil into a Paladin that Agrias would be proud of!

When you come down to it, there's a good amount of magic sets available. There is of course, Unused Kain and though possibly controversial, changing Porom's spellset and linking it to Rosa's for cost saving purposes could be done, and then there's FuSoYa's Complete Spell Sets. Hey game, do you know who already Has a nearly complete spell set for Black and White? That's right! Tellah! So use his spell sets for FuSoYa's and you can add in the missing spells through FuSoYa's entrance event.

That gives four extra spell-sets to play around with. Maybe not an ideal number, but it is better than none.


Now in larger news I am very close to figuring out what constitutes a menu opening!

Fight Command Access

Code: [Select]
$02/B9C1 C9 18 CMP #$18 A:0000 X:0000 Y:0006 P:eNvMxdIzc - Is it Ninja?
$02/B9C3 F0 64 BEQ $64    [$BA29] A:0000 X:0000 Y:0006 P:eNvMxdIzc - If so branch to Black Magic Menu.
$02/B9C5 C9 05 CMP #$05 A:0000 X:0000 Y:0006 P:eNvMxdIzc - Is it Dark Wave?
$02/B9C7 90 03 BCC $03    [$B9CC] A:0000 X:0000 Y:0006 P:eNvMxdIzc - If greater than Dark Wave use secondary Access Routine.
$02/B9CC 0A ASL A A:0000 X:0000 Y:0006 P:eNvMxdIzc - x2 A (to reach the proper address.)
$02/B9CD AA TAX A:0000 X:0000 Y:0006 P:envMxdIZc - Transfer A to X.
$02/B9CE BF E6 B9 02 LDA $02B9E6,x[$02:B9E6] A:0000 X:0000 Y:0006 P:envMxdIZc - Load Pointer from 02B9E6.
$02/B9D2 85 0E STA $0E    [$00:000E] A:00F2 X:0000 Y:0006 P:eNvMxdIzc - Store A in 0E.
$02/B9D4 BF E7 B9 02 LDA $02B9E7,x[$02:B9E7] A:00F2 X:0000 Y:0006 P:eNvMxdIzczc - Load A from 02B9E7.
$02/B9D8 85 0F STA $0F    [$00:000F] A:00B9 X:0000 Y:0006 P:eNvMxdIzc - Store A in 0F.
$02/B9DA 6C 0E 00 JMP ($000E)[$02:B9F2] A:00B9 X:0000 Y:0006 P:eNvMxdIzc - Jump to Fight Access Routine.

White Magic Command Access

Code: [Select]
$02/B9C5 C9 05 CMP #$05 A:0002 X:0004 Y:0000 P:eNvMxdIzc - Is it Dark Wave?
$02/B9C7 90 03 BCC $03    [$B9CC] A:0002 X:0004 Y:0000 P:eNvMxdIzc - If greater than Dark Wave, branch to
$02/B9CC 0A ASL A A:0002 X:0004 Y:0000 P:eNvMxdIzc - x2 A.
$02/B9CD AA TAX A:0004 X:0004 Y:0000 P:envMxdIzc - Transfer A to X
$02/B9CE BF E6 B9 02 LDA $02B9E6,x[$02:B9EA] A:0004 X:0004 Y:0000 P:envMxdIzc - Load A from 02B9E6+X.
$02/B9D2 85 0E STA $0E    [$00:000E] A:001C X:0004 Y:0000 P:envMxdIzc - Store A in 0E
$02/B9D4 BF E7 B9 02 LDA $02B9E7,x[$02:B9EB] A:001C X:0004 Y:0000 P:envMxdIzc - Load A from 02B9E7+X
$02/B9D8 85 0F STA $0F    [$00:000F] A:00BA X:0004 Y:0000 P:eNvMxdIzc - Store A in 0F.
$02/B9DA 6C 0E 00 JMP ($000E)[$02:BA1C] A:00BA X:0004 Y:0000 P:eNvMxdIzc - Jump to White Magic Access routine.

This is going to lead to an entirely new area to explore! Though for now I have confirmed that it works in a simple manner.

0000 - Fight
0001(turns to 2) - Item
0002(turns to 4) - White Magic
0003(turns to 6) - Black Magic
0004(turns to 8) - Summon Magic

The trick to All of this is what lays at 02B9E6...

And lo and behold, it is pointers to addresses!


F2 B9 - Fight
05 BA - Item
1C BA - White
29 BA - Black
36 BA - Summon
43 BA - ?? (Fight again?)

Fight Access Call
Code: [Select]
$02/B9F2 A9 80 LDA #$80 A:00B9 X:0000 Y:0004 P:eNvMxdIzc - Load 80 into A.
$02/B9F4 85 D8 STA $D8    [$00:00D8] A:0080 X:0000 Y:0004 P:eNvMxdIzc - Store A in D8.
$02/B9F6 A5 60 LDA $60    [$00:0060] A:0080 X:0000 Y:0004 P:eNvMxdIzc - Load A from 60.
$02/B9F8 85 D9 STA $D9    [$00:00D9] A:0000 X:0000 Y:0004 P:envMxdIZc - Store A in D9.
$02/B9FA A9 01 LDA #$01 A:0000 X:0000 Y:0004 P:envMxdIZc - Load 01 into A.
$02/B9FC 8D 91 EF STA $EF91  [$7E:EF91] A:0001 X:0000 Y:0004 P:envMxdIzc - Store A in 7EEF91.
$02/B9FF A9 04 LDA #$04 A:0001 X:0000 Y:0004 P:envMxdIzc - Load 04 into A.
$02/BA01 8D 23 18 STA $1823  [$7E:1823] A:0004 X:0000 Y:0004 P:envMxdIzc - Load this into Targeting matters.
$02/BA04 60 RTS A:0004 X:0000 Y:0004 P:envMxdIzc - Return.

Item Access Call

Code: [Select]
$02/BA05 9C 9A EF STZ $EF9A  [$7E:EF9A] A:00BA X:0002 Y:0000 P:eNvMxdIzc - Store Zer in 7EEF9A.
$02/BA08 A9 05 LDA #$05 A:00BA X:0002 Y:0000 P:eNvMxdIzc - Load 05 into A.
$02/BA0A 8D 23 18 STA $1823  [$7E:1823] A:0005 X:0002 Y:0000 P:envMxdIzc - Load this into Targeting matters.
$02/BA0D 9C 94 EF STZ $EF94  [$7E:EF94] A:0005 X:0002 Y:0000 P:envMxdIzc - Store Zero into 7EEF94.
$02/BA10 9C 97 EF STZ $EF97  [$7E:EF97] A:0005 X:0002 Y:0000 P:envMxdIzc - Store Zero into 7EEF97.
$02/BA13 9C 98 EF STZ $EF98  [$7E:EF98] A:0005 X:0002 Y:0000 P:envMxdIzc - Store Zero into 7EEF98
$02/BA16 9C 99 EF STZ $EF99  [$7E:EF99] A:0005 X:0002 Y:0000 P:envMxdIzc (as above_
$02/BA19 4C E2 AA JMP $AAE2  [$02:AAE2] A:0005 X:0002 Y:0000 P:envMxdIzc - Jump to 02AAE2.

White Magic Access Call
Code: [Select]
$02/BA1C A9 00 LDA #$00 A:00BA X:0004 Y:0000 P:eNvMxdIzc -  - Load 00 into A (Spell Menu Position)
$02/BA1E 8D 93 EF STA $EF93  [$7E:EF93] A:0000 X:0004 Y:0000 P:envMxdIZc - Store A in 7EEF93.
$02/BA21 A9 09 LDA #$09 A:0000 X:0004 Y:0000 P:envMxdIZc - Load 09 into A
$02/BA23 8D 23 18 STA $1823  [$7E:1823] A:0009 X:0004 Y:0000 P:envMxdIzc - Store A in Targeting Matters.
$02/BA26 4C 57 AB JMP $AB57  [$02:AB57] A:0009 X:0004 Y:0000 P:envMxdIzc - Jump to 02AB57.

Black Magic Access Call

Code: [Select]
$02/BA29 A9 60 LDA #$60 A:00BA X:0006 Y:0000 P:eNvMxdIzc - Load 60 into A (Spell Menu Position)
$02/BA2B 8D 93 EF STA $EF93  [$7E:EF93] A:0060 X:0006 Y:0000 P:envMxdIzc - Store A in 7EEF93.
$02/BA2E A9 09 LDA #$09 A:0060 X:0006 Y:0000 P:envMxdIzc - Load 09 into A.
$02/BA30 8D 23 18 STA $1823  [$7E:1823] A:0009 X:0006 Y:0000 P:envMxdIzc - Store A in Targeting Matters.
$02/BA33 4C 77 AB JMP $AB77  [$02:AB77] A:0009 X:0006 Y:0000 P:envMxdIzc - Jump to 02AB77.

Summon Magic Access Call

Code: [Select]
$02/BA36 A9 C0 LDA #$C0 A:00BA X:0008 Y:0000 P:eNvMxdIzc - Load C0 into A (Spell Menu Position)
$02/BA38 8D 93 EF STA $EF93  [$7E:EF93] A:00C0 X:0008 Y:0000 P:eNvMxdIzc - Store A in 7EEF93.
$02/BA3B A9 09 LDA #$09 A:00C0 X:0008 Y:0000 P:eNvMxdIzc - Load 09 into A.
$02/BA3D 8D 23 18 STA $1823  [$7E:1823] A:0009 X:0008 Y:0000 P:envMxdIzc - Store A in Targeting Matters.
$02/BA40 4C 98 AB JMP $AB98  [$02:AB98] A:0009 X:0008 Y:0000 P:envMxdIzc - Jump to 02AB98.

Most Other Commands Access Call

Code: [Select]
$02/BA43 A9 80 LDA #$80 A:00BA X:000A Y:0004 P:eNvMxdIzc - Load 80 into A.
$02/BA45 85 D8 STA $D8    [$00:00D8] A:0080 X:000A Y:0004 P:eNvMxdIzc - Store A in D8.
$02/BA47 A5 60 LDA $60    [$00:0060] A:0080 X:000A Y:0004 P:eNvMxdIzc - Load 60 into A.
$02/BA49 85 D9 STA $D9    [$00:00D9] A:0000 X:000A Y:0004 P:envMxdIZc - Store A in D9.
$02/BA4B A9 01 LDA #$01 A:0000 X:000A Y:0004 P:envMxdIZc - Load 01 into A.
$02/BA4D 8D 91 EF STA $EF91  [$7E:EF91] A:0001 X:000A Y:0004 P:envMxdIzc - Store A 7EEF91.
$02/BA50 A9 07 LDA #$07 A:0001 X:000A Y:0004 P:envMxdIzc - Load 07  into A.
$02/BA52 8D 23 18 STA $1823  [$7E:1823] A:0007 X:000A Y:0004 P:envMxdIzc - Load A into Targeting Matters.
$02/BA55 60 RTS A:0007 X:000A Y:0004 P:envMxdIzc - Return.

Now Ninja is handled a little differently. Ninja is looked at...
$02/B9C1   C9 18   CMP #$18   A:0000   X:0000   Y:0006   P:eNvMxdIzc -
$02/B9C3   F0 64   BEQ $64    [$BA29]   A:0000   X:0000   Y:0006   P:eNvMxdIzc - Here.

And as we know from above that links Directly to Black Magic. Right before this is a CMP 16 which must look at the Dart Menu.

Now interestingly enough though there is a Special unique formula for Dark Wave... but its never used. The only difference in this data is a 07 instead of a 04. Now modifying this, it seems to be targeting in someway...

00 - Cursor vanishes
01 - Cursor stays on Command
02 - Seems to force the cursor left onto the Parry Command, causing the Parry Command to be shown throughout the fight.
03 - Same as above, except with Change.
04 - Normal Targeting
05 - Targeting as if from Item Menu (with normal command menu still showing, causes graphical anomalies)
06 - Freeze
07 - Normal Targeting as far as I can tell.
08 - Auto-Attack on Self
09 - Magic Menu Targeting
0A - Forces open the Black Magic Menu over the Commands and HP of characters, with the selections still being the commands.


I will fill in the data above tomorrow. It is very late where I am and this information was discovered last minute and I just couldn't leave it hanging, hehe.

 :edit: Bah, I need sleep...

Dark Wave Access

Code: [Select]
(Same as Above)
$02/B9C5 C9 05 CMP #$05 A:0005 X:0004 Y:0004 P:eNvMxdIzc
$02/B9C7 90 03 BCC $03    [$B9CC] A:0005 X:0004 Y:0004 P:envMxdIZC
$02/B9C9 4C 43 BA JMP $BA43  [$02:BA43] A:0005 X:0004 Y:0004 P:envMxdIZC
---------------------------------------------------------------------------------------------------
$02/BA43 A9 80 LDA #$80 A:0005 X:0004 Y:0004 P:envMxdIZC
$02/BA45 85 D8 STA $D8    [$00:00D8] A:0080 X:0004 Y:0004 P:eNvMxdIzC
$02/BA47 A5 60 LDA $60    [$00:0060] A:0080 X:0004 Y:0004 P:eNvMxdIzC
$02/BA49 85 D9 STA $D9    [$00:00D9] A:0001 X:0004 Y:0004 P:envMxdIzC
$02/BA4B A9 01 LDA #$01 A:0001 X:0004 Y:0004 P:envMxdIzC
$02/BA4D 8D 91 EF STA $EF91  [$7E:EF91] A:0001 X:0004 Y:0004 P:envMxdIzC
$02/BA50 A9 07 LDA #$07 A:0001 X:0004 Y:0004 P:envMxdIzC
$02/BA52 8D 23 18 STA $1823  [$7E:1823] A:0007 X:0004 Y:0004 P:envMxdIzC
$02/BA55 60 RTS A:0007 X:0004 Y:0004 P:envMxdIzC

Wait! This is the same exact thing as 05? Why doesn't it just go down the normal line then?! Bah...

Dart Command Access

Code: [Select]
(Same as Item Above)
$02/B9DE A9 08 LDA #$08 A:0016 X:0008 Y:0004 P:envMxdIZC -
$02/B9E0 8D 9A EF STA $EF9A  [$7E:EF9A] A:0008 X:0008 Y:0004 P:envMxdIzC
$02/B9E3 4C 08 BA JMP $BA08  [$02:BA08] A:0008 X:0008 Y:0004 P:envMxdIzC
-----------------------------------------------------------------------------------------------
$02/BA08 A9 05 LDA #$05 A:0008 X:0008 Y:0004 P:envMxdIzC
$02/BA0A 8D 23 18 STA $1823  [$7E:1823] A:0005 X:0008 Y:0004 P:envMxdIzC
$02/BA0D 9C 94 EF STZ $EF94  [$7E:EF94] A:0005 X:0008 Y:0004 P:envMxdIzC
$02/BA10 9C 97 EF STZ $EF97  [$7E:EF97] A:0005 X:0008 Y:0004 P:envMxdIzC
$02/BA13 9C 98 EF STZ $EF98  [$7E:EF98] A:0005 X:0008 Y:0004 P:envMxdIzC
$02/BA16 9C 99 EF STZ $EF99  [$7E:EF99] A:0005 X:0008 Y:0004 P:envMxdIzC
$02/BA19 4C E2 AA JMP $AAE2  [$02:AAE2] A:0005 X:0008 Y:0004 P:envMxdIzC

Same as Item Access, I guess that was to be expected. That felt like a waste of 10 minutes editing that I could have used on sleep, hehe.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (FFI spell routines in FFIV!)
Post by: Grimoire LD on January 04, 2014, 11:34:50 AM
Post above updated with comments on the various links to the Menus.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (FFI spell routines in FFIV!)
Post by: Grimoire LD on January 04, 2014, 01:24:12 PM
I've put this off for too long...

Heal/Remove All Status Except... Routine

Code: [Select]
$03/D6FB F0 0A BEQ $0A    [$D707] A:0000 X:0016 Y:FFFF P:envMxdiZc - If 00 branch to 03D707
-------------------------------------------------------------------------------------------------------------------------------------

-------------------------------------------------------------------------------------------------------------------------------------------
$03/D707 AD D2 26 LDA $26D2  [$7E:26D2] A:0000 X:0016 Y:FFFF P:envMxdiZc - Load Current Action Taken.
$03/D70A C9 12 CMP #$12 A:0012 X:0016 Y:FFFF P:envMxdizc - Is it Heal?
$03/D70C F0 07 BEQ $07    [$D715] A:0012 X:0016 Y:FFFF P:envMxdiZC - If so branch to 03D715.
-----------------------------------------------------------------------------------------------------------------------
$03/D70E C9 86 CMP #$86 A:004B X:0016 Y:0000 P:envMxdizC - Is it (Enemy Spell) Heal?
$03/D710 F0 03 BEQ $03    [$D715] A:004B X:0016 Y:0000 P:eNvMxdizc - If so branch to 03D715.
$03/D712 4C 83 D7 JMP $D783  [$03:D783] A:004B X:0016 Y:0000 P:eNvMxdizc - Jump to 03D783.
----------------------------------------------------------------------------------------------------------------------------
$03/D715 A5 CE LDA $CE    [$00:00CE] A:0012 X:0016 Y:FFFF P:envMxdiZC - Load ?Character ID? into A.
$03/D717 10 03 BPL $03    [$D71C] A:0001 X:0016 Y:FFFF P:envMxdizC - Branch if less than 80 (being used by a PC)
----------------------------------------------------------------------------------------------------------------------------------

-------------------------------------------------------------------------------------------------------------------------------------
$03/D71C AA TAX A:0001 X:0016 Y:FFFF P:envMxdizC - Transfer A to X.
$03/D71D 9E 60 35 STZ $3560,x[$7E:3561] A:0001 X:0001 Y:FFFF P:envMxdizC - Store Zero in 7E3560+X.
$03/D720 AD 03 27 LDA $2703  [$7E:2703] A:0001 X:0001 Y:FFFF P:envMxdizC - Load Target's Status Byte 1.
$03/D723 85 A9 STA $A9    [$00:00A9] A:0000 X:0001 Y:FFFF P:envMxdiZC - Store A in A9.
$03/D725 29 80 AND #$80 A:0000 X:0001 Y:FFFF P:envMxdiZC - Add 80 (thus getting rid of all ailments Except Death)
$03/D727 8D 03 27 STA $2703  [$7E:2703] A:0000 X:0001 Y:FFFF P:envMxdiZC - Store A in Target's Status Byte 1.
$03/D72A AD 04 27 LDA $2704  [$7E:2704] A:0000 X:0001 Y:FFFF P:envMxdiZC - Load Target's Status Byte 2.
$03/D72D 85 AA STA $AA    [$00:00AA] A:0008 X:0001 Y:FFFF P:envMxdizC - Store A in AA.
$03/D72F 29 44 AND #$44 A:0008 X:0001 Y:FFFF P:envMxdizC - Get rid of Calcification, Petrify,Charm, Sleep, Paralyze and Curse)
$03/D731 8D 04 27 STA $2704  [$7E:2704] A:0000 X:0001 Y:FFFF P:envMxdiZC -Store A in Target's Status Byte 2.
$03/D734 A9 10 LDA #$10 A:0000 X:0001 Y:FFFF P:envMxdiZC - Load 10 into A.
$03/D736 8D 3B 27 STA $273B  [$7E:273B] A:0010 X:0001 Y:FFFF P:envMxdizC - Store 7E273B into A. (Resets Speed? I had no idea that Heal actually reset speed! It does! That means Heal could actually work against you if you hasted this unit previously. Interesting...)
$03/D739 A5 CF LDA $CF    [$00:00CF] A:0010 X:0001 Y:FFFF P:envMxdizC - Load the value in CF into A.
$03/D73B 0A ASL A A:0001 X:0001 Y:FFFF P:envMxdizC - x2 A.
$03/D73C AA TAX A:0002 X:0001 Y:FFFF P:envMxdizc - Transfer A to X.
$03/D73D BD EB 29 LDA $29EB,x[$7E:29ED] A:0002 X:0002 Y:FFFF P:envMxdizc - Load Bitmask of Status.
$03/D740 29 E6 AND #$E6 A:0040 X:0002 Y:FFFF P:envMxdizc - ??
$03/D742 9D EB 29 STA $29EB,x[$7E:29ED] A:0040 X:0002 Y:FFFF P:envMxdizc - Store A in  Bitmask of Status.
$03/D745 A5 A9 LDA $A9    [$00:00A9] A:0040 X:0002 Y:FFFF P:envMxdizc - Load A from A9.
$03/D747 29 40 AND #$40 A:0000 X:0002 Y:FFFF P:envMxdiZc - Ignore Stop Timer?
$03/D749 D0 08 BNE $08    [$D753] A:0000 X:0002 Y:FFFF P:envMxdiZc - Branch if not 00 to 03D753.
$03/D74B A5 AA LDA $AA    [$00:00AA] A:0000 X:0002 Y:FFFF P:envMxdiZc - Load A from AA.
$03/D74D 29 30 AND #$30 A:0008 X:0002 Y:FFFF P:envMxdizc - ??
$03/D74F F0 1D BEQ $1D    [$D76E] A:0000 X:0002 Y:FFFF P:envMxdiZc - Branch if 00 to 03D76E
-------------------------------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------------------------------
$03/D76E A5 A9 LDA $A9    [$00:00A9] A:0000 X:0002 Y:FFFF P:envMxdiZc - Load A from A9.
$03/D770 29 08 AND #$08 A:0000 X:0002 Y:FFFF P:envMxdiZc - ??
$03/D772 F0 0E BEQ $0E    [$D782] A:0000 X:0002 Y:FFFF P:envMxdiZc - If 00 branch to 03D782
-----------------------------------------------------------------------------------

---------------------------------------------------------------------------------------
$03/D782 60 RTS A:0000 X:0002 Y:FFFF P:envMxdiZc - Return.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(Accessed only by Status Healing that is not the Heal Spells)
$03/D783 AD 03 27 LDA $2703  [$7E:2703] A:004B X:0016 Y:0000 P:eNvMxdizc - Load Target's Status Byte 1.
$03/D786 85 8A STA $8A    [$00:008A] A:0000 X:0016 Y:0000 P:envMxdiZc - Store A in 8A.
$03/D788 2D A3 28 AND $28A3  [$7E:28A3] A:0000 X:0016 Y:0000 P:envMxdiZc - Add the value from Skill's Status Byte 1 onto A, if applicable.
$03/D78B 8D 03 27 STA $2703  [$7E:2703] A:0000 X:0016 Y:0000 P:envMxdiZc - Store A in Target's Status Byte 1.
$03/D78E AD 04 27 LDA $2704  [$7E:2704] A:0000 X:0016 Y:0000 P:envMxdiZc - Load Target's Status Byte 2 onto A.
$03/D791 85 8B STA $8B    [$00:008B] A:0000 X:0016 Y:0000 P:envMxdiZc - Store A in 8B.
$03/D793 2D A4 28 AND $28A4  [$7E:28A4] A:0000 X:0016 Y:0000 P:envMxdiZc - Add the value from Skill's Status Byte 2 onto A, if applicable.
$03/D796 8D 04 27 STA $2704  [$7E:2704] A:0000 X:0016 Y:0000 P:envMxdiZc - Store A in Target's Status Byte 2.
$03/D799 AD A3 28 LDA $28A3  [$7E:28A3] A:0000 X:0016 Y:0000 P:envMxdiZc - Load value from Skill's Status 1 into A.
$03/D79C 49 FF EOR #$FF A:00FE X:0016 Y:0000 P:eNvMxdizc - Exclusive Or onto A.
$03/D79E 85 8C STA $8C    [$00:008C] A:0001 X:0016 Y:0000 P:envMxdizc - Store A in 8C.
$03/D7A0 AD A4 28 LDA $28A4  [$7E:28A4] A:0001 X:0016 Y:0000 P:envMxdizc - Load A from 7E28A4.
$03/D7A3 49 FF EOR #$FF A:00FF X:0016 Y:0000 P:eNvMxdizc - Exclusive Or onto A.
$03/D7A5 85 8D STA $8D    [$00:008D] A:0000 X:0016 Y:0000 P:envMxdiZc - Store A in 8D
$03/D7A7 A5 8A LDA $8A    [$00:008A] A:0000 X:0016 Y:0000 P:envMxdiZc - Load A from 8A.
$03/D7A9 29 01 AND #$01 A:0000 X:0016 Y:0000 P:envMxdiZc - Erase all but Poison
$03/D7AB F0 12 BEQ $12    [$D7BF] A:0000 X:0016 Y:0000 P:envMxdiZc - If 00 branch to 03D7BF.
--------------------------------------------------------------------------------------------------------------------------
$03/D7AD A5 8C LDA $8C    [$00:008C] A:0001 X:0016 Y:0000 P:envMxdizc - Load A from 8C.
$03/D7AF 29 01 AND #$01 A:0001 X:0016 Y:0000 P:envMxdizc - Erase all but Poison.
$03/D7B1 F0 0C BEQ $0C    [$D7BF] A:0001 X:0016 Y:0000 P:envMxdizc - Branch if 00 to 03D7BF.
$03/D7B3 A5 CF LDA $CF    [$00:00CF] A:0001 X:0016 Y:0000 P:envMxdizc - Load A from CF.
$03/D7B5 0A ASL A A:0000 X:0016 Y:0000 P:envMxdiZc - x2 A.
$03/D7B6 AA TAX A:0000 X:0016 Y:0000 P:envMxdiZc - Transfer A to X.
$03/D7B7 BD EB 29 LDA $29EB,x[$7E:29EB] A:0000 X:0000 Y:0000 P:envMxdiZc - Load A from Bitmask of Status.
$03/D7BA 29 EF AND #$EF A:0050 X:0000 Y:0000 P:envMxdizc - Place-10 to it.
$03/D7BC 9D EB 29 STA $29EB,x[$7E:29EB] A:0040 X:0000 Y:0000 P:envMxdizc - Store A in Bitmask of Status.
----------------------------------------------------------------------------------------------------------------------------
$03/D7BF A5 8A LDA $8A    [$00:008A] A:0000 X:0016 Y:0000 P:envMxdiZc - Load A from 8A.
$03/D7C1 29 40 AND #$40 A:0000 X:0016 Y:0000 P:envMxdiZc - Erase all but Stone.
$03/D7C3 F0 11 BEQ $11    [$D7D6] A:0000 X:0016 Y:0000 P:envMxdiZc - Branch if 00 to 03D7D6.
--------------------------------------------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------------------------------------------
$03/D7D6 A5 8B LDA $8B    [$00:008B] A:0000 X:0016 Y:0000 P:envMxdiZc - Load A from 8B.
$03/D7D8 29 30 AND #$30 A:0000 X:0016 Y:0000 P:envMxdiZc - Erase all but Sleep and Paralyze.
$03/D7DA F0 15 BEQ $15    [$D7F1] A:0000 X:0016 Y:0000 P:envMxdiZc - Branch if 00 to 03D7F1.
------------------------------------------------------------------------------------------------------------------------------------

-------------------------------------------------------------------------------------------------------------------------------------
$03/D7F1 A5 8B LDA $8B    [$00:008B] A:0000 X:0016 Y:0000 P:envMxdiZc - Load A from 8B.
$03/D7F3 29 08 AND #$08 A:0000 X:0016 Y:0000 P:envMxdiZc - Erase all but Charm.
$03/D7F5 F0 1A BEQ $1A    [$D811] A:0000 X:0016 Y:0000 P:envMxdiZc - Branch if 00 to 03D811.
--------------------------------------------------------------------------------------------------------------------------------------

--------------------------------------------------------------------------------------------------------------------------------------
$03/D811 A5 8B LDA $8B    [$00:008B] A:0000 X:0016 Y:0000 P:envMxdiZc - Load A from 8B.
$03/D813 29 03 AND #$03 A:0000 X:0016 Y:0000 P:envMxdiZc - Erase all but Calcify and Petrify.
$03/D815 F0 12 BEQ $12    [$D829] A:0000 X:0016 Y:0000 P:envMxdiZc - Branch if 00 to 03D829.
-----------------------------------------------------------------------------------------------------------------------------------------

-------------------------------------------------------------------------------------------------------------------------------------------
$03/D829 60 RTS A:0000 X:0016 Y:0000 P:envMxdiZc





There's a few things I simply don't have the knowledge to access or fathom their purpose. That said this was informative. I at least learned that Heal resets Speed. This means that you could potentially use that against Cagnazzo when he uses Haste.

Come to think of it, I guess it was always a given that Heal was special, considering it has nothing in its information for its actual spell. Well that solves that ?mystery?.

 :edit: Generic healing spells and healing items go through a completely different process as labeled above. The stuff at the end likely relates to timers, I'd imagine.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (FFI spell routines in FFIV!)
Post by: LordGarmonde on January 04, 2014, 02:56:20 PM
Nice - that's a good find! You =  :cycle:

Also - Healing Cagnazzo to slow him down - I'm laughing picturing that - if I do that I want him to have a battle message of  :wtf:
Title: Re: Grimoire LD's Notes, Methods, and Hacks (FFI spell routines in FFIV!)
Post by: Grimoire LD on January 04, 2014, 06:31:55 PM
Here's some information on entering battle and levels...

Ally Level Calculations

Code: [Select]
$03/8C99 B9 40 35 LDA $3540,y[$7E:3541] A:0000 X:0080 Y:0001 P:eNvMxdIzc - Load 7E3540 into A.
$03/8C9C D0 10 BNE $10    [$8CAE] A:0000 X:0080 Y:0001 P:envMxdIZc - If not 00 Branch to 038CAE.
$03/8C9E 18 CLC A:0000 X:0080 Y:0001 P:envMxdIZc - Clear Carry Flag.
$03/8C9F BD 02 20 LDA $2002,x[$7E:2082] A:0000 X:0080 Y:0001 P:envMxdIZc - Load Character's Level into A.
$03/8CA2 65 A9 ADC $A9    [$00:00A9] A:000A X:0080 Y:0001 P:envMxdIzc - Add it to A9 (where the other character's levels are added up)
$03/8CA4 85 A9 STA $A9    [$00:00A9] A:0014 X:0080 Y:0001 P:envMxdIzc - Store A in A9.
$03/8CA6 A9 00 LDA #$00 A:0014 X:0080 Y:0001 P:envMxdIzc - Load 00 into A.
$03/8CA8 65 AA ADC $AA    [$00:00AA] A:0000 X:0080 Y:0001 P:envMxdIZc - Add ?00? into AA.
$03/8CAA 85 AA STA $AA    [$00:00AA] A:0000 X:0080 Y:0001 P:envMxdIZc - Store A in AA.
$03/8CAC E6 AD INC $AD    [$00:00AD] A:0000 X:0080 Y:0001 P:envMxdIZc - +1 to AD.
$03/8CAE 20 BC 85 JSR $85BC  [$03:85BC] A:0000 X:0080 Y:0001 P:envMxdIzc - Jump to Subroutine 0385BC
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~```
$03/85BC C2 20 REP #$20 A:0000 X:0080 Y:0001 P:envMxdIzc - Reset Processor Status
$03/85BE 8A TXA A:0000 X:0080 Y:0001 P:envmxdIzc - Transfer X to A.
$03/85BF 18 CLC A:0080 X:0080 Y:0001 P:envmxdIzc - Clear Carry Flag.
$03/85C0 69 80 00 ADC #$0080 A:0080 X:0080 Y:0001 P:envmxdIzc - Add 80 to A.
$03/85C3 AA TAX A:0100 X:0080 Y:0001 P:envmxdIzc - Transfer A to X.
$03/85C4 7B TDC A:0100 X:0100 Y:0001 P:envmxdIzc - Transfer Direct Page.
$03/85C5 E2 20 SEP #$20 A:0000 X:0100 Y:0001 P:envmxdIZc - Set Processor Status to 2 Bytes.
$03/85C7 60 RTS A:0000 X:0100 Y:0001 P:envMxdIZc - Return
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/8CB1 C8 INY A:0000 X:0100 Y:0001 P:envMxdIZc - +1 to Y.
$03/8CB2 C0 05 00 CPY #$0005 A:0000 X:0100 Y:0002 P:envMxdIzc - Has it checked all five slots?
$03/8CB5 D0 E2 BNE $E2    [$8C99] A:0000 X:0100 Y:0002 P:eNvMxdIzc - If not loop back to 038C99
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Monster Level Calculation

Code: [Select]
$03/8CB7 B9 40 35 LDA $3540,y[$7E:3545] A:0000 X:0280 Y:0005 P:envMxdIZC - Load 7E3545 into A.
$03/8CBA D0 10 BNE $10    [$8CCC] A:0000 X:0280 Y:0005 P:envMxdIZC - Branch if not 00 to 038CCC.
$03/8CBC 18 CLC A:0000 X:0280 Y:0005 P:envMxdIZC - Clear Carry Flag.
$03/8CBD BD 02 20 LDA $2002,x[$7E:2282] A:0000 X:0280 Y:0005 P:envMxdIZc - Load Monster Level into A.
$03/8CC0 65 AB ADC $AB    [$00:00AB] A:0005 X:0280 Y:0005 P:envMxdIzc - Add this value to AB.
$03/8CC2 85 AB STA $AB    [$00:00AB] A:0005 X:0280 Y:0005 P:envMxdIzc - Store A in AB.
$03/8CC4 A9 00 LDA #$00 A:0005 X:0280 Y:0005 P:envMxdIzc - Load 00 into A.
$03/8CC6 65 AC ADC $AC    [$00:00AC] A:0000 X:0280 Y:0005 P:envMxdIZc - Add this to AC.
$03/8CC8 85 AC STA $AC    [$00:00AC] A:0000 X:0280 Y:0005 P:envMxdIZc - Store A in AC.
$03/8CCA E6 AE INC $AE    [$00:00AE] A:0000 X:0280 Y:0005 P:envMxdIZc - +1 to AE.
$03/8CCC 20 BC 85 JSR $85BC  [$03:85BC] A:0000 X:0280 Y:0005 P:envMxdIzc - Jump to Subroutine (above)
$03/8CCF C8 INY A:0000 X:0300 Y:0005 P:envMxdIZc - +1 to Y.
$03/8CD0 C0 08 00 CPY #$0008 A:0000 X:0300 Y:0006 P:envMxdIzc - Has it looked at all Eight Monster Slots?
$03/8CD3 D0 E2 BNE $E2    [$8CB7] A:0000 X:0300 Y:0006 P:eNvMxdIzc - If not branch back to 038CB7

For some reason Ally Levels are rolled over 10 times...
Code: [Select]
$03/8CD5 A6 A9 LDX $A9    [$00:00A9] A:0000 X:0400 Y:0008 P:envMxdIZC - Load X from Ally's Accumulated Levels.
$03/8CD7 8E 45 39 STX $3945  [$7E:3945] A:0000 X:001E Y:0008 P:envMxdIzC - Store X in 7E3945.
$03/8CDA A5 AD LDA $AD    [$00:00AD] A:0000 X:001E Y:0008 P:envMxdIzC - Load A from Amount of Characters.
$03/8CDC AA TAX A:0003 X:001E Y:0008 P:envMxdIzC - Transfer A to X.
$03/8CDD 8E 47 39 STX $3947  [$7E:3947] A:0003 X:0003 Y:0008 P:envMxdIzC - Store X in 7E3947.
$03/8CE0 20 07 84 JSR $8407  [$03:8407] A:0003 X:0003 Y:0008 P:envMxdIzC - Jump to Subroutine
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/8407 C2 20 REP #$20 A:0003 X:0003 Y:0008 P:envMxdIzC - Reset Processor Status
$03/8409 9C 49 39 STZ $3949  [$7E:3949] A:0003 X:0003 Y:0008 P:envmxdIzC - Store Zero in 7E3949.
$03/840C 9C 4B 39 STZ $394B  [$7E:394B] A:0003 X:0003 Y:0008 P:envmxdIzC - Store Zero in 7E394B.
$03/840F AD 45 39 LDA $3945  [$7E:3945] A:0003 X:0003 Y:0008 P:envmxdIzC - Load Accumulated Ally Levels into A.
$03/8412 F0 2B BEQ $2B    [$843F] A:001E X:0003 Y:0008 P:envmxdIzC - Branch if 00 (Wha...?) to 03843F.
$03/8414 AD 47 39 LDA $3947  [$7E:3947] A:001E X:0003 Y:0008 P:envmxdIzC - Load Amount of Allies into A.
$03/8417 F0 26 BEQ $26    [$843F] A:0003 X:0003 Y:0008 P:envmxdIzC - Branch if 00 (Sigh...) to 03843F.
$03/8419 18 CLC A:0003 X:0003 Y:0008 P:envmxdIzC - Clear Carry Flag.
$03/841A A2 10 00 LDX #$0010 A:0003 X:0003 Y:0008 P:envmxdIzc - Load 10 into X.
--------------------------------------------------------------(Looping Point)---------------------------------------------------
$03/841D 2E 45 39 ROL $3945  [$7E:3945] A:0003 X:0010 Y:0008 P:envmxdIzc - x2 Ally Levels.
$03/8420 2E 4B 39 ROL $394B  [$7E:394B] A:0003 X:0010 Y:0008 P:envmxdIzc - x2
$03/8423 38 SEC A:0003 X:0010 Y:0008 P:envmxdIZc - Set Carry Flag.
$03/8424 AD 4B 39 LDA $394B  [$7E:394B] A:0003 X:0010 Y:0008 P:envmxdIZC - Load A from 7E394B.
$03/8427 ED 47 39 SBC $3947  [$7E:3947] A:0000 X:0010 Y:0008 P:envmxdIZC - Subtract Amount of Characters from 7E3947.
$03/842A 8D 4B 39 STA $394B  [$7E:394B] A:FFFD X:0010 Y:0008 P:eNvmxdIzc - Store A in 7E394B.
$03/842D B0 0A BCS $0A    [$8439] A:FFFD X:0010 Y:0008 P:eNvmxdIzc - Branch if More than 00 to 038439.
$03/842F AD 4B 39 LDA $394B  [$7E:394B] A:FFFD X:0010 Y:0008 P:eNvmxdIzc - Load 7E394B into A.
$03/8432 6D 47 39 ADC $3947  [$7E:3947] A:FFFD X:0010 Y:0008 P:eNvmxdIzc - Add the value in 7E3947 onto A.
$03/8435 8D 4B 39 STA $394B  [$7E:394B] A:0000 X:0010 Y:0008 P:envmxdIZC - Store A in 7E394B.
$03/8438 18 CLC A:0000 X:0010 Y:0008 P:envmxdIZC - Clear Carry Flag.
$03/8439 2E 49 39 ROL $3949  [$7E:3949] A:0000 X:0010 Y:0008 P:envmxdIZc - x2 the value in 7E3949 (which is currently 0)
$03/843C CA DEX A:0000 X:0010 Y:0008 P:envmxdIZc - -1 from .
$03/843D D0 DE BNE $DE    [$841D] A:0000 X:000F Y:0008 P:envmxdIzc - Branch if... ?Not 00? (likely using X as a base) to 03841D.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`````
$03/843F 7B TDC A:0000 X:0000 Y:0008 P:envmxdIZc - Transfer Direct Page.
$03/8440 E2 20 SEP #$20 A:0000 X:0000 Y:0008 P:envmxdIZc - Set Processor Status.
$03/8442 60 RTS A:0000 X:0000 Y:0008 P:envMxdIZc - Return
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/8CE3 AE 49 39 LDX $3949  [$7E:3949] A:0000 X:0000 Y:0008 P:envMxdIZc - Load Final Value (0A) from Median into X.
$03/8CE6 8A TXA A:0000 X:000A Y:0008 P:envMxdIzc - Transfer X to A.
$03/8CE7 8D D4 38 STA $38D4  [$7E:38D4] A:000A X:000A Y:0008 P:envMxdIzc - Store Median Ally Level in 7E38D4.
$03/8CEA 7B TDC A:000A X:000A Y:0008 P:envMxdIzc - Transfer Direct Page.
$03/8CEB A6 AB LDX $AB    [$00:00AB] A:0000 X:000A Y:0008 P:envMxdIZc - Load Accumulated Enemy Levels.
$03/8CED 8E 45 39 STX $3945  [$7E:3945] A:0000 X:000F Y:0008 P:envMxdIzc - Store X in 7E3945.
$03/8CF0 A5 AE LDA $AE    [$00:00AE] A:0000 X:000F Y:0008 P:envMxdIzc - Load Accumulated amount of enemies.
$03/8CF2 AA TAX A:0003 X:000F Y:0008 P:envMxdIzc - Transfer A to X.
$03/8CF3 8E 47 39 STX $3947  [$7E:3947] A:0003 X:0003 Y:0008 P:envMxdIzc - Store X in 7E3947.
$03/8CF6 20 07 84 JSR $8407  [$03:8407] A:0003 X:0003 Y:0008 P:envMxdIzc - Jump to Subroutine (same one as above.)

Median Ally /Enemy Level vs. RNG
Code: [Select]
$03/8CF9 AE 49 39 LDX $3949  [$7E:3949] A:0000 X:0000 Y:0008 P:envMxdIZc - Load X from Median Enemy Level.
$03/8CFC 8A TXA A:0000 X:0005 Y:0008 P:envMxdIzc - Transfer X to A.
$03/8CFD 8D D5 38 STA $38D5  [$7E:38D5] A:0005 X:0005 Y:0008 P:envMxdIzc - Store Median Enemy Level in 7E38D5,
$03/8D00 7B TDC A:0005 X:0005 Y:0008 P:envMxdIzc - Transfer Direct Page.
$03/8D01 7B TDC A:0000 X:0005 Y:0008 P:envMxdIZc - Transfer Direct Page (Coding Error?)
$03/8D02 AA TAX A:0000 X:0005 Y:0008 P:envMxdIZc - Transfer A to X.
$03/8D03 86 A9 STX $A9    [$00:00A9] A:0000 X:0000 Y:0008 P:envMxdIZc - Store Enemy Median Level into A9.
$03/8D05 E6 A9 INC $A9    [$00:00A9] A:0000 X:0000 Y:0008 P:envMxdIZc - +1 to A9,
$03/8D07 E6 AA INC $AA    [$00:00AA] A:0000 X:0000 Y:0008 P:envMxdIzc - +1 to AA
$03/8D09 A9 63 LDA #$63 A:0000 X:0000 Y:0008 P:envMxdIzc - Load 63 (100) into A.
$03/8D0B 20 79 83 JSR $8379  [$03:8379] A:0063 X:0000 Y:0008 P:envMxdIzc - Load 100 into Random Number Generator.
$03/8D0ECD D4 38 CMP $38D4  [$7E:38D4] A:0014 X:0000 Y:0008 P:envMxdIzc - Compare Random Number to Median Ally Level.
$03/8D11 B0 02 BCS $02    [$8D15] A:0014 X:0000 Y:0008 P:envMxdIzC - If less than Random Number branch to 038D15.
---------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/8D13 E6 A9 INC $A9    [$00:00A9] A:0007 X:0000 Y:0008 P:eNvMxdIzc +1 to A9.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/8D15 20 8B 85 JSR $858B  [$03:858B] A:0014 X:0000 Y:0008 P:envMxdIzC - Jump to a Different Random Number Generator
$03/8D18 CD D5 38 CMP $38D5  [$7E:38D5] A:0057 X:0000 Y:0008 P:envMxdIzc - Compare Random Number to Median Enemy Level.
$03/8D1B B0 02 BCS $02    [$8D1F] A:0057 X:0000 Y:0008 P:envMxdIzC - If less than Random Number branch to 038D1F
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/8D1D E6 AA INC $AA    [$00:00AA] A:0051 X:0000 Y:0008 P:eNvMxdIzc - +1 to AA.
--------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/8D1F A5 A9 LDA $A9    [$00:00A9] A:0057 X:0000 Y:0008 P:envMxdIzC - Load A9 into A. (which it won't be 01 if the Ally RNG check succeeded)
$03/8D21 C5 AA CMP $AA    [$00:00AA] A:0001 X:0000 Y:0008 P:envMxdIzC - Compare it to AA.
$03/8D23 F0 29 BEQ $29    [$8D4E] A:0001 X:0000 Y:0008 P:envMxdIZC - If they equal branch to 038D4E.
---------------------------------------------------------------------------------------------------------------------------------
(Ally Success)
$03/8D25 90 08 BCC $08    [$8D2F] A:0002 X:0000 Y:0008 P:envMxdIzC - If 00 branch to 038D2F (I can't see how it could be 00...)
$03/8D27 EE D7 38 INC $38D7  [$7E:38D7] A:0002 X:0000 Y:0008 P:envMxdIzC - +1 to 7E38D7 (When these two are both 01, they cause First Strikes)
$03/8D2A EE D8 38 INC $38D8  [$7E:38D8] A:0002 X:0000 Y:0008 P:envMxdIzC - +1 to 7E38D8
$03/8D2D 80 1F BRA $1F    [$8D4E] A:0002 X:0000 Y:0008 P:envMxdIzC - Branch always to 038D4E.
------------------------------------------------------------------------------------------------------------------------------------------------
(Monster Success)
$03/8D2F A9 80 LDA #$80 A:0001 X:0000 Y:0008 P:eNvMxdIzc - Load 80 into A
$03/8D31 8D D7 38 STA $38D7  [$7E:38D7] A:0080 X:0000 Y:0008 P:eNvMxdIzc - Store A in 7E38D7. (Causes Ambush)
$03/8D34 8D D8 38 STA $38D8  [$7E:38D8] A:0080 X:0000 Y:0008 P:eNvMxdIzc - Store A in 7E38D8.
$03/8D37 AD D5 38 LDA $38D5  [$7E:38D5] A:0080 X:0000 Y:0008 P:eNvMxdIzc - Load A from 7E38D5.
$03/8D3A 4A LSR A A:0063 X:0000 Y:0008 P:envMxdIzc - Divide it by 2.
$03/8D3B 85 A9 STA $A9    [$00:00A9] A:0031 X:0000 Y:0008 P:envMxdIzC - Store A in A9.
$03/8D3D 7B TDC A:0031 X:0000 Y:0008 P:envMxdIzC - Transfer Direct Page.
$03/8D3E AA TAX A:0000 X:0000 Y:0008 P:envMxdIZC - Transfer A to X.
$03/8D3F AD D4 38 LDA $38D4  [$7E:38D4] A:0000 X:0000 Y:0008 P:envMxdIZC - Load Median Ally Level into A.
$03/8D42 20 79 83 JSR $8379  [$03:8379] A:000A X:0000 Y:0008 P:envMxdIzC - Jump to Random Number Generator. (0-Party Level)
$03/8D45 C5 A9 CMP $A9    [$00:00A9] A:0000 X:0000 Y:0008 P:envMxdIzc - Is it less than Enemy Level/2?
$03/8D47 B0 05 BCS $05    [$8D4E] A:0000 X:0000 Y:0008 P:eNvMxdIzc - If so branch to 038D4E.
$03/8D49 A9 08 LDA #$08 A:0000 X:0000 Y:0008 P:eNvMxdIzc - Load 08 into A.
$03/8D4B 8D 81 35 STA $3581  [$7E:3581] A:0008 X:0000 Y:0008 P:envMxdIzc - Store A in 7E35811 (Back Attack)
---------------------------------------------------------------------------------------------------------------------------------------
$03/8D4E 7B TDC A:0001 X:0000 Y:0008 P:envMxdIZC - Transfer Direct Page
$03/8D4F AA TAX A:0000 X:0000 Y:0008 P:envMxdIZC - Transfer A to X.
$03/8D50 A8 TAY A:0000 X:0000 Y:0008 P:envMxdIZC - Transfer A to Y.
$03/8D51 86 C7 STX $C7    [$00:00C7] A:0000 X:0000 Y:0000 P:envMxdIZC - Store X in C7.
$03/8D53 B9 40 35 LDA $3540,y[$7E:3540] A:0000 X:0000 Y:0000 P:envMxdIZC - Load A from 7E3540.
$03/8D56 D0 11 BNE $11    [$8D69] A:0000 X:0000 Y:0000 P:envMxdIZC - If not 00 branch to 038D69.
$03/8D58 A5 C7 LDA $C7    [$00:00C7] A:0000 X:0000 Y:0000 P:envMxdIZC - Load A from C7.
$03/8D5A D0 28 BNE $28    [$8D84] A:0000 X:0000 Y:0000 P:envMxdIZC - Branch if Not 00 to 038D84.
$03/8D5C BD 00 20 LDA $2000,x[$7E:2000] A:0000 X:0000 Y:0000 P:envMxdIZC - Load Character ID into A.
$03/8D5F 29 1F AND #$1F A:0081 X:0000 Y:0000 P:eNvMxdIzC - Get rid of 80.
$03/8D61 C9 20 CMP #$20 A:0001 X:0000 Y:0000 P:envMxdIzC - Is it 20? (Invalid, Normally Dark Knight Cecil)
$03/8D63 F0 1F BEQ $1F    [$8D84] A:0001 X:0000 Y:0000 P:eNvMxdIzc - If so branch to 038D84.
$03/8D65 C9 01 CMP #$01 A:0001 X:0000 Y:0000 P:eNvMxdIzc - Is it Dark Knight Cecil (Normally Paladin)
$03/8D67 F0 18 BEQ $18    [$8D81] A:0001 X:0000 Y:0000 P:envMxdIZC - If so branch to 038D81.
-------------------------------------------------------------------------------------------------------------------------------------------------
(I have left new areas an am back in the area that makes Cover work that means this is done.)

And there we go! Judging by this data the higher your level is the more likely you are to get a First strike, and vice versa with enemies. The enemy level is never directly confronted by the ally level, but both are put into RNG's of 1-100. If the Player succeeds they get a First Strike. If the Enemy succeeds they get an Ambush, then the Party Level is put as the limit in an RNG vs. the Enemy Level/2 and should the Enemy Level still be higher, a Back Attack occurs.

Now that was quite a fun little trip! And another piece of the puzzle solved!





Title: Re: Grimoire LD's Notes, Methods, and Hacks (Back Attacks/First Strike Info!)
Post by: LordGarmonde on January 04, 2014, 06:41:05 PM
YES! You rock so hard dude!  :banonsmash:

Also - I layed out the general terms of my plan...I'll write it up in a step-by step this evening/tomorrow...but it's a long post, don't go unless you're ready for battle. - lol

But what you've got here...  :childish:
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Back Attacks/First Strike Info!)
Post by: LordGarmonde on January 04, 2014, 11:50:05 PM
Found it. Aim is programmed in a way which makes it Very difficult to change without significantly modifying its code. This is how it works... It starts out as a 0000 Accumulator. Then it is Decremented once. Resetting it to FF. And there you have it. That's how the game gets the FF. Maybe taking a further look at the data will show me a solution, hmm...

I just caught that post in my crusing around the forum - what are your feelings on that as a method? Is it something that in my mind I should keep as a good tool, or don't do it unless you have to. A couple other noob Assembly questions I have are with the method above, what happens to all the flags, do any of them reset? My other question is why do this at all - is it really that much faster as opposed to reading it from somewhere, or just assigning it as a constant...I'm definitely missing something I think...

Maybe it's sleep  :sleep:   - lol
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Back Attacks/First Strike Info!)
Post by: Grimoire LD on January 05, 2014, 01:35:39 AM
I don't like how its used here because it cuts down on what you can logically do with the instruction. As a tool to set things to FFFF it saves one or two bytes and those bytes may be quite precious in the long run.

However... http://slickproductions.org/forum/index.php?topic=1883.msg19351#msg19351

I eventually got around it and took control of Aim to make it work for me the way I desired. (at least somewhat. I would still rather have Barrage, but this is nice as well)

What annoys me now most about their Aim command, is that its extremely haphazard. There is a specific byte that controls whether an attack Can miss or not, all they technically had to do was trigger that byte. But hey, more space to play around with I suppose.

Code: [Select]
$03/E836 AD 9C 26 LDA $269C  [$7E:269C] A:0003 X:0018 Y:0000 P:envMxdizc - Load Caster's Physical Attack Percent.
$03/E839 48 PHA A:0034 X:0018 Y:0000 P:envMxdizc - Push A.
$03/E83A AD 29 27 LDA $2729  [$7E:2729] A:0034 X:0018 Y:0000 P:envMxdizc - Load Enemies (Non-existent) Evasion.
$03/E83D 48 PHA A:0000 X:0018 Y:0000 P:envMxdiZc - Push A.
$03/E83E 7B TDC A:0000 X:0018 Y:0000 P:envMxdiZc - Transfer Direct Page (thereby making it 00)
$03/E83F 8D 29 27 STA $2729  [$7E:2729] A:0000 X:0018 Y:0000 P:envMxdiZc - Store 00 in Target's Evasion.
$03/E842 3A DEC A A:0000 X:0018 Y:0000 P:envMxdiZc -1 to A.
$03/E843 8D 9C 26 STA $269C  [$7E:269C] A:00FF X:0018 Y:0000 P:eNvMxdizc - Store A  (FF - 255%) into Physical Attack Percent.

They didn't use it correctly, they wasted bytes, and they screwed up their intention. Aim might be the worst programmed Command in the game due to inefficiency on their part.

When a routine is left Completely, the game will ordinarily enter a "cleaning" routine. A very long, very boring process of code, indeed. In this there are no bytes being triggered. Assiging FF as a constant would have been A9 FF, rather than just 3A. In this case it saved one byte... and wasted so many others...
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Back Attacks/First Strike Info!)
Post by: Grimoire LD on January 05, 2014, 02:24:39 PM
Wow... Barrage (FFIII DS, FFT:War of the Lions) was a Stupidly easy thing to program in the end... at least in a basic form...

Because of space limitations I decided to call it (Arrow Symbol)Strm (Arrow Storm) after a tactic common to the Romance of the Three Kingdoms series.

Code: [Select]
$03/E836 20 99 C4 JSR $C499  [$03:C499] A:0003 X:0018 Y:0000 P:envMxdizc - Fight Routine x4
$03/E839 20 99 C4 JSR $C499  [$03:C499] A:0000 X:750E Y:0018 P:envMxdiZC
$03/E83C 20 99 C4 JSR $C499  [$03:C499] A:0000 X:750E Y:0018 P:envMxdiZC
$03/E83F 20 99 C4 JSR $C499  [$03:C499] A:0000 X:750E Y:0018 P:envMxdiZC
$03/E842 60 RTS A:0000 X:750E Y:0018 P:envMxdiZC - Return
Yes, four normal attacks. I honestly thought this was going to cause an overflow problem with the arrows, but to my amazement the game Properly decrements them without overflowing. (And if used with less than 3 Arrows you will no longer have any arrows) And as you'd expect it deals x4 Damage (though without my Infinite Arrow-Glitch fix it still has that problem as you'd expect.)


Now, these all add up properly, but there's still two pieces I'm missing. This first is how to divide the damage by 2. I may need to look back at the original Aim Command for guidance... Specifically at...

$03/E836   AD 9C 26   LDA $269C  [$7E:269C]   A:0003   X:0018   Y:0000   P:envMxdizc - Load Caster's Physical Attack Percent.
$03/E839   48    PHA   A:0034   X:0018   Y:0000   P:envMxdizc - Push A.

That seems like a fine start to a recipe actually.

Well... I learned something through this experience... Never Ever Forget to Retrieve Your Pushed Values!!

For roughly an hour I was looking at my preliminary code, wondering what I was doing wrong, when it finally dawned on me that because I was testing the pure functionality I never retrieved the Pushed value back and this causes a system crash.

So I now have Arrowstorm working like Barrage from FFT:War of the Lions! 4 half-damage attack that takes 4 Ammo for roughly 2x damage (but it attacks four times so even more chance of a status infliction if applicable)

Arrowstorm

Code: [Select]
$03/E836 AD 9D 26 LDA $269D  [$7E:269D] A:0003 X:0018 Y:0000 P:envMxdizc - Load Caster's Physical Attack Base.
$03/E839 48 PHA A:0053 X:0018 Y:0000 P:envMxdizc - Push A onto Stack.
$03/E83A 4A LSR A A:0053 X:0018 Y:0000 P:envMxdizc - Divide Physical Attack Base by 2.
$03/E83B 8D 9D 26 STA $269D  [$7E:269D] A:0029 X:0018 Y:0000 P:envMxdizC - Store A in Physical Attack Base.
$03/E83E 20 99 C4 JSR $C499  [$03:C499] A:0029 X:0018 Y:0000 P:envMxdizC - Fight Routine x 4
$03/E841 20 99 C4 JSR $C499  [$03:C499] A:0000 X:750E Y:0018 P:envMxdiZC
$03/E844 20 99 C4 JSR $C499  [$03:C499] A:0000 X:750E Y:0018 P:envMxdiZC
$03/E847 20 99 C4 JSR $C499  [$03:C499] A:0000 X:750E Y:0018 P:envMxdiZC
$03/E84A 68 PLA A:0000 X:750E Y:0018 P:envMxdiZC - Pull A
$03/E84B 8D 9D 26 STA $269D  [$7E:269D] A:0053 X:750E Y:0018 P:envMxdizC - Store A in Physical Attack Base (original value)
$03/E84E 60 RTS A:0053 X:750E Y:0018 P:envMxdizC - Return


Now, FFIII's Barrage is a little trickier to get down...

The way that works is each shot deals full damage +another 10-40% depending on the Job Level. To mimic this, (as well as I can...) I would instead make it look at Strength. At
0-39 Str. There would be no bonus. 40-60 1/8 Bonus in Damage, 60-99 1/4 Bonus in damage. It might encourage people to use Rosa in a Strength set-up rather than always going for the Will set-up possibly. But this seems like it will take a bit more space than Aim actually supports. So I'll have to hold off on that for now.

Though I suppose I could make a variant... (looks back at how he programmed Aura originally...) Yes. Instead make it so that Two Attacks will occur automatically. And if you have over 45 Strength a third one happens and at over 60 strength a fourth one occurs.

Barrage (Arrowstorm) FFIII "Style" (Sort of)

Code: [Select]
$03/E836 20 99 C4 JSR $C499  [$03:C499] A:0003 X:0018 Y:0000 P:envMxdizc - Fight Routine
$03/E839 20 99 C4 JSR $C499  [$03:C499] A:0000 X:750E Y:0018 P:envMxdiZC - Fight Routine
$03/E83C AD 94 26 LDA $2694  [$7E:2694] A:0000 X:750E Y:0018 P:envMxdiZC - Load Modified Strength
$03/E83F C9 2D CMP #$2D A:005D X:750E Y:0018 P:envMxdizC - Is it 45 or Higher?
$03/E841 90 0E BCC $0E    [$E851] A:005D X:750E Y:0018 P:envMxdizC - If lower branch to 03E851
$03/E843 20 99 C4 JSR $C499  [$03:C499] A:005D X:750E Y:0018 P:envMxdizC - Fight Routine
$03/E846 AD 94 26 LDA $2694  [$7E:2694] A:0000 X:750E Y:0018 P:envMxdiZC - Load Modified Strength
$03/E849 C9 3C CMP #$3C A:005D X:750E Y:0018 P:envMxdizC - Is it 60 or Higher?
$03/E84B 90 04 BCC $04    [$E851] A:005D X:750E Y:0018 P:envMxdizC - If lower branch to 03E851
$03/E84D 20 99 C4 JSR $C499  [$03:C499] A:005D X:750E Y:0018 P:envMxdizC - Fight Routine
$03/E850 60 RTS A:0000 X:750E Y:0018 P:envMxdiZC - Return

Geez, I must really love the Aim Command, I've now made three variants for it!
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Back Attacks/First Strike Info!)
Post by: Grimoire LD on January 05, 2014, 05:19:34 PM
Now for my most ambitious hack yet. Turning the Pray command into the Hunt command.

Now I absolutely love Final Fantasy Tactics and one of things I always thought was really neat in it was Poaching and the Fur Shop where you could use your ill-gotten gains to get powerful equipment.

So I thought "Why not add a similar thing to FFIV?"

Originally I scoffed at myself, but after completing the Barrage commands, I got to thinking that it Might be possible... so I wrote up a check list of what it would need.

Hunt Command - Can be used to automatically kill a Critical Beast and Obtain an Item

-Load Weapon Swing Animation
-Load Boss Byte (2770)
-If a Boss, branch to Fight Routine
-----------------------------
-Load Creature Type (2740)
-If Not Reptile branch to Fight Routine
-----------------------------------------
-Load Enemy's Status Byte 4. (2706)
-If Not Critical, branch to Fight Routine
------------------------------------------
- Jump to Steal Command Success (03E249)
- Place 80 in Status Byte 1 (Dead)
- Place 80 in Creature Type (Zombie, to prevent Revival)
- Jump to Return
-----------------------
- Jump to Fight Routine (03C499)
- Return

Not a very difficult thing to make work on paper. But is there enough room in Pray for this? Well only one way to find out...

Hunt Command

Code: [Select]
$03/E852 A9 C0 LDA #$C0 A:0003 X:0016 Y:0000 P:envMxdizc - Load Weapon Swing into A.
$03/E854 8D C4 33 STA $33C4  [$7E:33C4] A:00C0 X:0016 Y:0000 P:eNvMxdizc - Store A in Audiovisual Code
$03/E857 AD 40 27 LDA $2740  [$7E:2740] A:00C0 X:0016 Y:0000 P:eNvMxdizc - Load Creature Type into A.
$03/E85A C9 04 CMP #$04 A:0004 X:0016 Y:0000 P:envMxdizc - Is it Reptile?
$03/E85C D0 13 BNE $13    [$E871] A:0004 X:0016 Y:0000 P:envMxdiZC - If not branch to 03E871
---------------------------------------------
$03/E85E AD 06 27 LDA $2706  [$7E:2706] A:0004 X:0016 Y:0000 P:envMxdiZC - Load Creature Status Byte 4.
$03/E861 C9 01 CMP #$01 A:0001 X:0016 Y:0000 P:envMxdizC - Is it in Critical?
$03/E863 D0 0C BNE $0C    [$E871] A:0001 X:0016 Y:0000 P:envMxdiZC - If not branch to 03E871.
---------------------------------------
$03/E865 20 49 E2 JSR $E3FF  [$03:E3FF] A:0001 X:0016 Y:0000 P:envMxdiZC - Jump to Hunt Rewards Routine.
$03/E868 A9 7B LDA #$7B A:001D X:0008 Y:0002 P:envMxdizc - Load Vanish into A.
$03/E86A 8D D2 26 STA $26D2  [$7E:26D2] A:007B X:0008 Y:0002 P:envMxdizc - Store Vanish in Next Action to Take.
$03/E86D 4C 3E CD JMP $CD3E  [$03:CD3E] A:007B X:0008 Y:0002 P:envMxdizc - Jump and Stay with Magic Call Routine
--------------------------------------------
$03/E871 4C 99 C4 JMP $C499  [$03:C499] A:0000 X:0016 Y:0000 P:eNvMxdizc - Jump and Stay with Fight Routine


And that's all it took! Granted I had to make a few concessions because of space and weirdness (apparently in "commands" you're unable to inflict status but you can in Spell Subroutines or Fight... go figure. I also had to get rid of the boss check, which means... well be careful with placing your boss Reptiles. Just be sure to give them another creature type in addition and that will send it down to the normal fight routine.

I would also ideally want the stealing procedure to be different so you would steal one item, while poaching another. Unfortunately that is currently not possible. You can steal what you poach and vice-versa. Now the game doesn't tell you what you've stolen, likely because those are programmed only to appear at the end of the Steal Routine, but you can see you have a new Item in the Item menu.

Note: In the pictures I use Imps changed to the Reptile Creature Type. So no worries there.

(http://i112.photobucket.com/albums/n198/LastingDawn/Hunt1_zps66aa1c64.png) (http://s112.photobucket.com/user/LastingDawn/media/Hunt1_zps66aa1c64.png.html)

(http://i112.photobucket.com/albums/n198/LastingDawn/Hunt2_zps3bfef543.png) (http://s112.photobucket.com/user/LastingDawn/media/Hunt2_zps3bfef543.png.html)

(http://i112.photobucket.com/albums/n198/LastingDawn/Hunt3_zps384408bb.png) (http://s112.photobucket.com/user/LastingDawn/media/Hunt3_zps384408bb.png.html)

And that will do it! This is probably my favorite command I've created yet. I just need to differentiate it from Steal and it will be golden!

 :edit:Updated with JSR to Hunt Rewards System.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Poaching from FFT put into FFIV!)
Post by: chillyfeez on January 05, 2014, 05:40:35 PM
Nifty. I considered a while ago writing a command like this (inspired by FFIV's Morph, not by Poaching, but same diff). You could, maybe, rewrite the monster's item byte before running the steal routine...
Perhaps:
Load Monster's level
Store into item byte
Run steal routine

Or:
Load level
Add item byte
Store in item byte
Run steal

Or even:
RNG
Store in item byte
Run steal

Or however you want to determine the "new" item byte. Whatever you do would just be a few bytes of code. Doesn't matter that you're changing it because pending success, the monster is gone after the command is done.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Poaching from FFT put into FFIV!)
Post by: Grimoire LD on January 05, 2014, 05:58:52 PM
That sounds like it would be a great idea! The only issue being that I have only two free bytes left to work with... I guess I could move it to another command, hmm... you did mention free space at the end of the section, didn't you? Maybe I could use a few bytes to set that up? Change the Steal Routine to this unused portion write a couple of bytes for the RNG and the steal routine and go from there. With that I could create a item drop section entirely for Poaching. Great thinking Chillyfeez!
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Back Attacks/First Strike Info!)
Post by: LordGarmonde on January 05, 2014, 06:04:24 PM
I don't like how its used here because it cuts down on what you can logically do with the instruction. As a tool to set things to FFFF it saves one or two bytes and those bytes may be quite precious in the long run....

- Gotcha: thank you for your insight; it's good to have reasoning for things floating around in my head - it helps me to understand what's going on more-so than just reading it somewhere. In fact, as I think about it: were I ever to know enough about Assembly (or programming in general even) to teach a course, I think I would spend some time going through this game. The more and more I read into it the more variety I see making up the spectrum of coding quality:

 surprisingly clever --- cute  --- decent --- good enough --- almost had it --- doesn't quite work --- flat-out broken

 - With special consideration, of course for my favorite:  --- not only broken, but wouldn't have worked anyway  :tongue:

Also, given the conversation at present I must also say that this is one of the things I like most about Assembly: the constant challenge to be clever
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Poaching from FFT put into FFIV!)
Post by: Grimoire LD on January 05, 2014, 08:13:51 PM
Well for hackers the goal is to be clever. We're normally using limited space in many situations. Back then though programmers did have to be clever as well, yeah. There was only so much space and so much they could shove into that space.

And thanks to Chillyfeez for his inspiration! (Some inspiration was taken from the Aura hack, granted he could probably make it even thinner) We now have a fully realized Poach system! (sort of....)

Hunting Rewards System

Code: [Select]
$03/FEE3 AD 02 27 LDA $2702  [$7E:2702] A:0001 X:0016 Y:0000 P:envMxdiZC - Load Target's Level into A.
$03/FEE6 A2 01 00 LDX #$0001 A:0003 X:0016 Y:0000 P:envMxdizC - Load 0001 into X.
$03/FEE9 69 14 ADC #$14 A:0003 X:0001 Y:0000 P:envMxdizC - Add 14 (20) to A.
$03/FEEB 20 79 83 JSR $8379  [$03:8379] A:0018 X:0001 Y:0000 P:envMxdizc - Jump to RNG (1 to Enemy Level +20)
$03/FEEE A2 3F 00 LDX #$003F A:000E X:0000 Y:0000 P:envMxdizc - Load 003F (End of Item Index) into X.
$03/FEF1 C9 3C CMP #$3C A:000E X:003F Y:0000 P:envMxdizc - Is the amount in A (Enemy Level + 20 (RNG)) 3C (60) or above?
$03/FEF3 B0 0B BCS $0B    [$FF00] A:000E X:003F Y:0000 P:eNvMxdizc - If so branch to end.
------------------------------
$03/FEF5 CA DEX A:000E X:003F Y:0000 P:eNvMxdizc - -1 to X (3F is now unavailable.)
$03/FEF6 C9 28 CMP #$28 A:000E X:003E Y:0000 P:envMxdizc - Is the amount in A 28 (40) or above?
$03/FEF8 B0 06 BCS $06    [$FF00] A:000E X:003E Y:0000 P:eNvMxdizc - If so branch to end.
---------------------------------------
$03/FEFA CA DEX A:000E X:003E Y:0000 P:eNvMxdizc - -1 to X (3E is now unavailable.)
$03/FEFB C9 14 CMP #$14 A:000E X:003D Y:0000 P:envMxdizc - Is the amount in A 14 (20) or above?
$03/FEFD B0 01 BCS $01    [$FF00] A:000E X:003D Y:0000 P:eNvMxdizc - If so branch to end.
----------------------------------------
$03/FEFF CA DEX A:000E X:003D Y:0000 P:eNvMxdizc -1 to X (3D is now unavailable.)
$03/FF00 8A TXA A:000E X:003C Y:0000 P:envMxdizc - Transfer X to A. (For the purposes of correct RNG figuring)
$03/FF01 A2 3A 00 LDX #$003A A:003C X:003C Y:0000 P:envMxdizc - Load 3A (Lowest Item Index possible) into A.
$03/FF04 20 79 83 JSR $8379  [$03:8379] A:003C X:003A Y:0000 P:envMxdizc - Jump to RNG (3A-3F at Max, but since all checks failed the range the possible item bytes are now only 3A to 3C)
$03/FF07 8D 73 27 STA $2773  [$7E:2773] A:003C X:0000 Y:0000 P:envMxdizc - Store 3A-3F in Target's Item Byte. (Despite having a fairly low RNG to go on , 3C was still achieved!)
$03/FF0A 20 49 E2 JSR $E249  [$03:E249] A:003C X:0000 Y:0000 P:envMxdizc - Jump to Steal Success Routine.

And there you have it! With this method you can get 1 of 6 items for poaching and the higher level Reptile you fight, the more likely you will get something good! Granted, if a hack were to use this it would be suggested to make 3A-3F specific to Hunted Enemies though. I do wish I could change the Actual drop, but that would require writing a dummy Steal routine for just this alone. I think 1/6 items is good enough. At lower levels you only have access to 3 (if you're lucky, 4) of them and at higher levels there's a chance to get some really good items.



Title: Re: Grimoire LD's Notes, Methods, and Hacks (Poaching from FFT put into FFIV!)
Post by: chillyfeez on January 06, 2014, 01:45:43 AM
I don't think I would/could make this one thinner. I like what you've done here. Nice work!
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Poaching from FFT put into FFIV!)
Post by: Grimoire LD on January 06, 2014, 03:36:09 PM
So while at work today (I work retail, alone.) I decided to jot down a couple of hack ideas that I might be able to implement... Since I saw that I could take an outline, as I did with Hunt, and make what I have written into a reality with my knowledge.

As a fan of FFT, I decided to include "Sword Spirit" (or rather it will be shown as (Katana symbol)Soul) as possibly a Replacement to Dart.

There are two plans for this one...

Katana Soul
-Unleash the Power of the Sword in the Right Hand. The Power unleashed is Sword Dependent and the Sword may Shatter on use.

Planned Process

Load Weapon in Right Hand
Is it Weapon 2B? (Short)
If so Load Magic Routine
Branch to RNG Portion
-------------------------
Is it Weapon 2C? (Middle)
If so Load Magic Routine
Branch to RNG Portion
-------------------------
Is it Weapon 2D? (Long)
If so Load Magic Routine
Branch to RNG Portion
------------------------
Is it Weapon 2E? (Ninja)
If so Load Magic Routine
Branch to RNG Portion
------------------------
Is it Weapon 2F? (Murasame)
If so Load Magic Routine
Branch to RNG Routine
------------------------------------------------------
Is it Weapon 30? (Masamune)
Retarget to All Allies
Branch to RNG Routine
Cast Protect, Shell, and Haste in that Order (If Possible!)
--------------------------------------------------
All other Weapons Return
-----------------------
(RNG Section)
Load Weapon Attack Power
Divide it by 2.
Load this value into First character's boss byte (its never used anyhow and these aren't getting anywhere Close to 80 with their power divided in half.)
Load 0001 into X
Load 64 (100) into A
RNG Routine
Compare it to Boss Byte Value
If more than Value branch to Return
If Less than Value Load 00 00 into Caster's Right Hand Weapon Data.

Or I need to learn more about Dart's default targeting,

Another thing FFIV is sorely lacking is Elemental Boosting. My plan to fix this is simple, but then the issue becomes, where can I plug this in at?

Element Amplify Routine

(Off of Spell Routine)
Load Caster's Weapon Element into A.
Compare it to Spell Element.
If both are same load Spell Power into A.
Transfer A to X.
LSR X * 2
Add X to A. (Thereby giving it +25% Power)
Return to Main Routine

In addition to that I think I have what it takes now to load a Spell on Swing which doesn't need to correspond to the Cast Spell nor does it need to be a new command. It can fit right into the Fight routine (part of it anyhow)

This plan takes advantage of the Broken Calcify effect which happens because of the Medusa Blade (which also freezes the game sometimes) Any weapon with Calcify enabled would enter in this area if it is successful in making the effect happen.

In addition there is a byte in the Weapon data I never figured out which might be useful for this purpose...

Lord 0001 int X
Load 0064 into A (100)
RNG
Compare Value to Caster's Wisdom, if more than Return
-------------------------------------------------
Load Caster's Slot
(Here is the only problem. The data for each character's weapon and armor are at 7E2780 and each piece is 11 (decimal) bytes each, but I can't think of a way to find a specific starting place for characters that aren't in the first slot.)
Load Unused Byte into A.
Load it into Character's Next Action
Return

Piercing Sight is basically ready, I just need to add a random factor to Chillyfeez's Aura instead of Wisdom and that should be good to go.

And the most ambitious idea current would be to emulate (and add a few) Break Skills from FFT.

Break Skills/ - use Swordskills to lower the attributes of your enemy.

Boss Byte Check
----------------------
Load Stored Elemental Byte
---------------------
01 - Fire - Power Break
Load Target's Attack
Lower it by Caster's Vitality/8
Branch to Return
-------------------
02 - Ice - Speed Break
Load Target's Speed
Lower it by Target's Level/8
Branch to Return
------------------
04 - Lit - Mind Break
Load Target's Spell Power
Lower it by Caster's Vitality/8
------------------
08 - Dark - Armor Break
Load Target's Defense
Lower it by Caster's Vitality/16
-------------------
10 - Holy - Seal Break
Load Target's Magic Defense
Lower it by Caster's Vitality/8
------------------
20 - Air - Claw Break
Load Target's Status to Inflict on Hit 1
Store Zero
Load Target's Status to Inflict on Hit 2
Store Zero
-------------------------
40 - Ele Break
Load Target's Resistance
Store Zero
------------------------
80 - Fate Break
Load  1 into X
Load 40 into A
Go through RNG
Store result in Status to Inflict 1 Byte
Jump to Status Routine
--------------------------

Which of these (if any) would you like to see completed first?
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Poaching from FFT put into FFIV!)
Post by: Pinkpuff on January 06, 2014, 03:48:14 PM
-------------------
02 - Ice - Magic Break
Load Target's MP
Lower it by Vitalityx8
Branch to Return
------------------

MP? Is this a skill intended to be used on monsters? If so what will it do? They don't have MP...
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Poaching from FFT put into FFIV!)
Post by: Grimoire LD on January 06, 2014, 03:55:21 PM
I thought Deathlike2 said that an enemy's MP is 1/4 of its HP... let me check that out...

Okay...

When a Monster has 10,000 HP it will have... 625 MP... What equation is that even?

Ah!

Monster's MP is 1/16 of their HP. Alright, fair enough I suppose. It explains why Osmose is pretty worthless at the start then.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Poaching from FFT put into FFIV!)
Post by: Pinkpuff on January 06, 2014, 03:59:43 PM
But it's just for Osmose right? I mean, monsters don't actually use their MP to cast spells and run out and such do they? I've certainly never seen anything like that happen ever.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Poaching from FFT put into FFIV!)
Post by: Grimoire LD on January 06, 2014, 04:02:30 PM
That is a good point... let me see...

Wow. You are absolutely correct. I don't know why I thought otherwise... I never recalled seeing them react that way either. Back to the drawing board on that one then.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Poaching from FFT put into FFIV!)
Post by: Grimoire LD on January 06, 2014, 04:23:07 PM
I guess I'll go with Speed Break (which is a skill in FFT) it will lower an Enemy's speed by 1/8 of its level so its power is consistent the entire game.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Poaching from FFT put into FFIV!)
Post by: Grimoire LD on January 07, 2014, 12:58:32 AM
Immense update on the first page including links to all of my (at least I think that's all of them...) custom command routines and bug fixes.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Poaching from FFT put into FFIV!)
Post by: chillyfeez on January 07, 2014, 09:34:43 AM
Mage characters, who use regular black magic spells, have and can run out of MP. It doesn't kill them like in FFIV. Still, unless you gave an MP value to each monster skill (no reason you couldn't), MP Break would be pretty useless.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Poaching from FFT put into FFIV!)
Post by: Grimoire LD on January 07, 2014, 01:36:54 PM
Hmm, that's what I tested originally Chillyfeez, I gave Imp's 10000 HP, saw they had 625 MP and allowed them to use Cure4 every cast. Their MP never went down, despite that I was using the "Use Black or White Magic" AI command. And just now tested it with "Use Special Spell"and I never saw MP budge, like you I was under the impression that monster's had finite supply of MP, but it doesn't appear that they do unfortunately. Also I think you meant it doesn't kill them like in FFVI, hehe.

This was addressed yesterday though, I decided to change Mind Break for Speed Break. Lower Enemy Speed by 1/8 of its level.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Poaching from FFT put into FFIV!)
Post by: Pinkpuff on January 07, 2014, 02:09:52 PM
Mage characters, who use regular black magic spells, have and can run out of MP.

Player characters yes, but not monsters.

Have you ever charmed a Gargoyle? It casts Weak on its own guys. And it works; it doesn't just come up "out of MP" or show the spell name with no effect or anything. It has 160 Max HP meaning it should in theory have 10 MP, nowhere near enough to cast Weak even once.

Better yet, ever fight TinyMages? As in, physically attack them? They only have 69 HP, so 4 MP, meaning they shouldn't even be able Hold once, but they don't seem to have any trouble casting Hold all day on your guys, not to mention all the Lit-1s and stuff.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Poaching from FFT put into FFIV!)
Post by: chillyfeez on January 07, 2014, 05:35:03 PM
Hmm. I would swear I've seen the "Not enough MP" message from a monster before, but you make a pretty convincing case.

Hah - FFVI. Yes, that was a typo. :blush:
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Poaching from FFT put into FFIV!)
Post by: Grimoire LD on January 07, 2014, 11:59:58 PM
Alright then, let's get started with implementing these ideas... maybe one day I should release a patch that includes all of my changes (bug fixes, routine edits, editing to make those routine edits effective, etc.) but I think that day is still a bit of a ways of.

Katana Soul - (Replacing Dart) I was concerned at first that Dart had forced targeting, but then I remembered that I found the ways to change targeting through routines (Grimoire as a proof of concept) which actually works a bit better for my purposes anyhow.

NOTE: I had to change the order a couple of times to get things working correctly and this document is not all compiled at once, therefore the addresses to the side may be a little inaccurate but rest assured the order is correct.


Code: [Select]
$03/E34C A9 C8 LDA #$C8 A:0003 X:002C Y:0000 P:envMxdizc - Load C8 into A (Animation from Sing)
$03/E34E 8D C4 33 STA $33C4  [$7E:33C4] A:00C7 X:002C Y:0000 P:eNvMxdizc - Store it in Audiovisual Code
$03/E351 A9 FF LDA #$FF A:00C7 X:002C Y:0000 P:eNvMxdizc - Load FF into A (Targeting)
$03/E353 8D D3 26 STA $26D3  [$7E:26D3] A:00FF X:002C Y:0000 P:eNvMxdizc - Store A in Next Monster Target
$03/E356 AD D2 26 LDA $26D2  [$7E:26D2] A:00FF X:002C Y:0000 P:eNvMxdizc - Load Ability (or Item)  ("Thrown" Weapon) from A
$03/E359 48 PHA A:002E X:002C Y:0000 P:envMxdizc - Push A for Later in the Routine
$03/E359 C9 2C CMP #$2C A:002C X:002C Y:0000 P:envMxdizc - Is it Middle?
$03/E35B D0 08 BNE $08    [$E365] A:002C X:002C Y:0000 P:envMxdiZC - If not, branch to next CMP.
-----------------------------------------------------------------------------------------------------------------
$03/E35D A9 9A LDA #$9A A:002E X:002C Y:0000 P:envMxdiZC - Load 9A (D.Breath) into A.
$03/E35F 8D D2 26 STA $26D2  [$7E:26D2] A:009A X:002C Y:0000 P:eNvMxdizC - Store A in next action to take.
$03/E362 20 3E CD JSR $CD3E  [$03:CD3E] A:009A X:002C Y:0000 P:eNvMxdizC - Jump to Magic Routine
$03/E365 C9 2D CMP #$2D A:002D X:002C Y:0000 P:envMxdizC - Is it Long?
$03/E367 D0 08 BNE $08    [$E371] A:002E X:002C Y:0000 P:envMxdiZC - If not, branch to next CMP.
----------------------------------------------------------------------------------------------------------------
$03/E369 A9 A3 LDA #$A3 A:002E X:002C Y:0000 P:envMxdiZC- - Load A3 (Heat Ray) into A.
$03/E36B 8D D2 26 STA $26D2  [$7E:26D2] A:00A3 X:002C Y:0000 P:eNvMxdizC - Store A in next action to take
$03/E36E 20 3E CD JSR $CD3E  [$03:CD3E] A:00A3 X:002C Y:0000 P:eNvMxdizC - Jump to Magic Routine
$03/E371 C9 2E CMP #$2E A:002E X:002C Y:0000 P:envMxdizC - Is it Ninja?
$03/E373 D0 08 BNE $08    [$E37D] A:002E X:002C Y:0000 P:envMxdiZC - If not, branch to next CMP.
-------------------------------------------------------------------------------------------------------------------
$03/E375 A9 2F LDA #$2E A:002E X:002C Y:0000 P:envMxdiZC - Load 2E into A. (Group-Osmose, Shockingly works!)
$03/E377 8D D2 26 STA $26D2  [$7E:26D2] A:002E X:002C Y:0000 P:envMxdizC - Store A in Next action to take.
$03/E37A 20 3E CD JSR $CD3E  [$03:CD3E] A:002E X:002C Y:0000 P:envMxdizC - Jump to Magic Routine
$03/E37D C9 2F CMP #$2F A:002F X:002C Y:0000 P:envMxdizC - Is it Muramasa?
$03/E37F D0 10 BNE $10    [$E391] A:002E X:002C Y:0000 P:envMxdiZC - If not, branch to next CMP
--------------------------------------------------------------------------------------------------------------------------------------
$03/E381 9C D3 26 STZ $26D3  [$7E:26D3] A:002E X:002C Y:0000 P:envMxdiZC - Store Zero in Monster Targeting (To prevent override)
$03/E384 A9 F0 LDA #$F0 A:002E X:002C Y:0000 P:envMxdiZC - Load F0 into A (Target All Allies)
$03/E386 8D D4 26 STA $26D4  [$7E:26D4] A:00F0 X:002C Y:0000 P:eNvMxdizC - Store A in Ally Targets
$03/E389 A9 85 LDA #$85 A:00F0 X:002C Y:0000 P:eNvMxdizC - Load Absorb into A.
$03/E38B 8D D2 26 STA $26D2  [$7E:26D2] A:0085 X:002C Y:0000 P:eNvMxdizC - Store A in Next Action
$03/E38E 20 3E CD JSR $CD3E  [$03:CD3E] A:0085 X:002C Y:0000 P:eNvMxdizC - Jump to Magic Routine
$03/E391 C9 30 CMP #$30 A:0030 X:002C Y:0000 P:eNvMxdizc - Is it Masamune?
$03/E393 D0 10 BNE $10    [$E3A5] A:002E X:002C Y:0000 P:envMxdiZC - If not, branch to next CMP.
-------------------------------------------------------------------------------------------------------------------------
$03/E395 9C D3 26 STZ $26D3  [$7E:26D3] A:002E X:002C Y:0000 P:envMxdiZC - Store Zero in Monster Target (otherwise it takes precedence.)
$03/E398 A9 F0 LDA #$F0 A:002E X:002C Y:0000 P:envMxdiZC - Load F0 into A (Target All Allies.)
$03/E39A 8D D4 26 STA $26D4  [$7E:26D4] A:00F0 X:002C Y:0000 P:eNvMxdizC - Store A in Ally Targets.
$03/E39D A9 08 LDA #$08 A:00F0 X:002C Y:0000 P:eNvMxdizC - Load Fast into A.
$03/E39F 8D D2 26 STA $26D2  [$7E:26D2] A:0008 X:002C Y:0000 P:envMxdizC - Store A in Next Action to Take
$03/E3A2 20 3E CD JSR $CD3E  [$03:CD3E] A:0008 X:002C Y:0000 P:envMxdizC - Jump to Magic Routine
$03/E3A6 C9 3E CMP #$3E A:00E0 X:0680 Y:001A P:eNvMxdizC - Is it Spoon?
$03/E3A8 D0 08 BNE $08    [$E3B2] A:003E X:0680 Y:001A P:envMxdiZC - If not, branch to RNG Routine.
-----------------------------------------------------------------------------------------------------------------------------------------------------
$03/E3AA A9 87 LDA #$87 A:003E X:0680 Y:001A P:envMxdiZC - Load Big Bang into A.
$03/E3AC 8D D2 26 STA $26D2  [$7E:26D2] A:0087 X:0680 Y:001A P:eNvMxdizC - Store A in Next Action to Take
$03/E3AF 20 3E CD JSR $CD3E  [$03:CD3E] A:0087 X:0680 Y:001A P:eNvMxdizC - Load Magic Routine


And here is where I came to a slight... issue. When you use a weapon with Throw, you lose it. I had thought that was done through the routine itself, for some reason, but it is not. It is done elsewhere. I knocked my head thinking of ways around this then I just decided to breakpoint on the decrement itself and found it, I tested it and it is fully unique to the Dart Menu, thank goodness...

Code: [Select]
$03/A664 B1 80 LDA ($80),y[$7E:321C] A:002E X:0000 Y:0002 P:envMxdizc - Load Item that is to be thrown into A.
$03/A666 3A DEC A A:0001 X:0000 Y:0002 P:envMxdizc - -1 to A.
$03/A667 91 80 STA ($80),y[$7E:321C] A:0000 X:0000 Y:0002 P:envMxdiZc - Store A in Thrown Item Quantity.

I nulled that and was good to go, but then I realized I didn't know how to actually remove the item. So it may be best to leave it be for the time being, I have another scheme which may help me get the item. Which may be even more efficient.

I am very proud of myself for being able to fit this in the amount of bytes and even take part of another routine to use for my own purposes. Because of space though I did have to sacrifice my loftier plans of each Katana having its own percentage to break, so it's a straight 50% chance to break with all of the Katanas.

RNG And +1 to Current Soul Sword Routine
Code: [Select]
$03/E3B2 A2 01 00 LDX #$0001 A:00E0 X:0680 Y:001A P:eNvMxdizC - Load 0001 as lowest value in X
$03/E3B5 A9 64 LDA #$64 A:00E0 X:0001 Y:001A P:envMxdizC - Load 64 (100) as highest value in A.
$03/E3B7 20 79 83 JSR $8379  [$03:8379] A:0064 X:0001 Y:001A P:envMxdizC - RNG Routine
$03/E3BA C9 32 CMP #$32 A:0007 X:0000 Y:001A P:envMxdizc -Is it 50 or above?
$03/E3BC 90 09 BCC $09    [$E3C7] A:0032 X:0000 Y:001A P:envMxdiZC - If lower than 50 branch to 03E3C7.
$03/E3BE A9 01 LDA #$01 A:0032 X:0000 Y:001A P:envMxdiZC - Load 01 into A.
$03/E3C0 85 AA STA $AA    [$00:00AA] A:0001 X:0000 Y:001A P:envMxdizC - Store A in AA (this gives you only +1 rather than whatever value AA had stored previously)
$03/E3C2 68 PLA A:0001 X:0000 Y:001A P:envMxdizC - Pull A from the start of the routine (The Item Number)
$03/E3C3 20 5A E2 JSR $E25A  [$03:E25A] A:002E X:0000 Y:001A P:envMxdizC - Run Steal Routine - Item Acquisition Portion.
$03/E3C6 60 RTS A:001D X:001C Y:0007 P:envMxdizc - Return (though I could easily just make the last instruction be a "Jump" rather than a "JSR"
-----------------------------------------------------------------------------------------------------------------------------------------
$03/E3C7 68 PLA A:0006 X:0000 Y:001A P:eNvMxdizc - Pull A (Otherwise there are Major problems)
$03/E3C8 60 RTS A:002E X:0000 Y:001A P:envMxdizc - Return

And there you have it! A system akin to the Samurai's in FFT in FFIV. I thought this was going to be really difficult, but it was a lot of fun and I learned a lot through this. It was a real brain teaser.


(http://i112.photobucket.com/albums/n198/LastingDawn/KatanaSoul3_zpsc30b812a.png) (http://s112.photobucket.com/user/LastingDawn/media/KatanaSoul3_zpsc30b812a.png.html)

(http://i112.photobucket.com/albums/n198/LastingDawn/KatanaSoul1_zpsf5c768d3.png) (http://s112.photobucket.com/user/LastingDawn/media/KatanaSoul1_zpsf5c768d3.png.html)

(http://i112.photobucket.com/albums/n198/LastingDawn/KatanaSoul2_zps47f0b564.png) (http://s112.photobucket.com/user/LastingDawn/media/KatanaSoul2_zps47f0b564.png.html)

Now you have to be careful... The Murasame and Masamune cast Beneficial Spells only when you target an ally.

(http://i112.photobucket.com/albums/n198/LastingDawn/KatanaSoul4_zps68cf4ca4.png) (http://s112.photobucket.com/user/LastingDawn/media/KatanaSoul4_zps68cf4ca4.png.html)

But when you cast it on an enemy...

(http://i112.photobucket.com/albums/n198/LastingDawn/KatanaSoul5_zps10335f19.png) (http://s112.photobucket.com/user/LastingDawn/media/KatanaSoul5_zps10335f19.png.html)

Should I start releasing standalone patches? Things like this and my Hunter's patch might be worth releasing separately on their own.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Draw Out from FFT put into FFIV!)
Post by: chillyfeez on January 08, 2014, 12:54:39 AM
Should I start releasing standalone patches? Things like this and my Hunter's patch might be worth releasing separately on their own.
My philosophy on that is, might as well. Even if nobody uses them right away, somebody will remember or stumble across them down the road and will really appreciate having them. Making the patch is the easy part of the process.
Though Dragonsbrethren may disagree with me...

Btw, does Cecil know Tellah has been wearing his dark armor?
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Draw Out from FFT put into FFIV!)
Post by: Pinkpuff on January 08, 2014, 04:09:11 AM
I'm a big fan of large numbers of small patches rather than small numbers of composite patches. It gives people more choice and customizability. Maybe I want to make a hack that has Rapid Fire (I assume that's what <arrow>Strm does?) but want to keep Dart/Throw. Of course there are certain things it makes sense to package together, like if it's hard to imagine someone wanting one without the other, or if it's particularly difficult or a lot of work to separate them, or if you're dealing with a whole game as opposed to just some specific mechanics or bugfixes, but as a general philosophy I prefer the piecemeal approach.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Draw Out from FFT put into FFIV!)
Post by: Grimoire LD on January 08, 2014, 08:48:49 AM
I will keep that in mind moving forward then, thank you for the suggestions PinkPuff and Chillyfeez. Haha! Yes, Tellah was the name I originally used to test the "in-battle names=out of battle name" hack, and most pictures that you see come from "FFIV Test" which is a rom of mine for testing changes to the editor and routine changes to make sure they are safe before I put them on any actual modding rom. It is surprisingly more stable than it had been in the past. Maybe because I have a more firm idea of what I'm doing.

Ah, Rapid Fire... I don't think FFIV's system allows for that, unfortunately. There seems to be no way I can tell to refresh the audio-visual code to show more than one Character Animation & Spell Effect before each action is taken, that might require more exploration though.

 What (Arrow)Strm does is dependent on which hack is used. One is more akin to FFT:War of the Lions Barrage used by Balthier. x4 Attacks with damage cut in half (so x2 attack) at the use of 4 Arrows each time. The second (Arrow)Strm is based more on FFIII DS's version. In this it will by default do two attacks. But if you have above 45 Str. It will do 3 and if you have above 60 it will do 4. It's to possibly encourage a more Str. based set-up for Rosa and make it a viable choice rather than a fun derivative, and to keep in the spirit of FFIII DS that relied on Job Level for its power. (I seem to have a thing for Aim, making Snipe,Barrage, and ArrowStorm all out of the same basic space and skill).
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Draw Out from FFT put into FFIV!)
Post by: chillyfeez on January 08, 2014, 10:12:47 AM
Ah, Rapid Fire... I don't think FFIV's system allows for that, unfortunately. There seems to be no way I can tell to refresh the audio-visual code to show more than one Character Animation & Spell Effect before each action is taken, that might require more exploration though.
One of the Limit skills in my (I swear!) forthcoming hack is something I've been calling Attack Barrage (they don't have displayed names, so the name is really irrelevant). The skill is five consecutive attacks with no wait time between. This is achieved by manipulating the wait time (at 2A04,x as discovered in my "whose turn is it" thread) within the command code and making tallies of how many attacks have been used in the character's Dropped Item byte (which is unused for PCs). It works well, though takes a while, and other characters cued for a command can act in between its attacks. But this is the only way I could think of to execute such an attack.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Draw Out from FFT put into FFIV!)
Post by: Grimoire LD on January 08, 2014, 10:19:51 AM
Very clever! Could you post the code regarding that? I'm not too well versed in wait-functions when it comes to routines (I've never dealt much with the ATB in fear of screwing up terribly) and I should be able to add in the "target randomly" command from Grimoire and that could work ideally as a Rapid-Fire.
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Draw Out from FFT put into FFIV!)
Post by: LordGarmonde on January 08, 2014, 02:44:02 PM
Very clever!

Agreed! That is clever. It reminds me of the Quick spell. I could see expanding that to work as an X-Magic ability - but that of course is more work, but just throwing it out as an idea. I could see it working like Hide and Show - just giving two turns of only Magic available on the menu. The one that gets me (just off the top of my head) is casting time.

Well, it's something to think about I suppose. :hmm:

Also, I too am for the individual patch approach - there's some fun mixing and matching to be had!  :childish:
Title: Re: Grimoire LD's Notes, Methods, and Hacks (Draw Out from FFT put into FFIV!)
Post by: Grimoire LD on January 08, 2014, 10:36:24 PM
So while adding Magic to the normal attack as a possibility seemed great on the surface, it would be Way too complicated to actually use properly. I was wrong, there is no unknown byte in data that can be written in ROM that I could use for a secondary spell index on weapons.

But one thing you can do, and quite easily may I add is add Command-Executions to the normal Fight Routine, to simulate things like the "Thief Dagger" and the "Dancing Knife" from FFV in FFIV.

Applicable Commands
Peep - E153 (Doesn't show damage, but does display actual data)
Steal - E1CC (Works perfectly)
Salve/Item Master - E2DC (Consider using as a Specialty for Cid!)
Regen - E3FA (Applicable. Puts Character using it out of commission as Regen begins could be interesting on a really good weapon)
Twin - E46F(Only to be used on a Twin Only Weapon!)
Kick - E6B4 (A Hit-All Attack from the normal attack! Now that is cool!)
Focus- E7F0 (Works as you'd expect, except damage isn't shown on the first attack, again another interesting facet to a powerful weapon)
X-"Aim" - E836 (Could potentially result in an Extraneous amount of extra damage, (Because it will go through the Fight Routine again and may possibly trigger again) it may be best to avoid this one.)
X-Hide - E876 (Appears to make it use on the enemy? May not be worthwhile, is worth rechecking.)
Sing - E900 (Almost as if it was made for this! The attack connects, the animation is shown, and the damage is displayed.
X-Jump - E954 (Does weird things, cannot be used.)
X-Parry - E9D0 (It does not display the damage done, nor the attack animation, but it does still do the normal damage, there could be a work around.)
Dark Wave - E9E9 (Acts like Kick as one would expect, will need to add a custom animation store before it.)
Recall - EA1A (Works perfectly! No complaints here.)
X-Boast - EAC3 (It gives the Int. Bonus to the foe (or friend) it strikes... not very useful.
X-Cry - EAE6 (??? It's very difficult to say if its doing anything at all.)
X-Grimoire - EC0D (While they work and the correct graphics show, the damage dealt is normal weapon damage and it doesn't seem as if it can be specially targeted.

So with this upcoming hack you will be able to tie command executions to weapons!

I will likely have to cannibalize a different routine if I want Magic+Weapon Strike. (though there may be a handful of space I can use here if I want to) It's not a difficult thing to set up in theory. The only problem is that the damage displayed may be slightly off from what it actually is.

And there goes my entire day! This one was much more painful than I thought it would be only because of hunting down the byte which wouldn't let you apply a status twice (in this case Calcify). This means that you could that an Imbued Weapon would use its special command Once and that would be it because you can't apply the same status on top of another status.

I searched RAM and ROM high and low and finally found the answer in an unlikely spot. Unfortunately fixing this problem was a lot more taxing than I had originally planned... however the final effort is all worth it. This hack includes "Command Executions" for 10 weapons in the game and after agonizing over space limits (I had to cut one out eventually) for several hours I finally put it together in a very efficient manner.

I would say this is my most impressive hack yet, but I say that for every hack I make say... take that with a grain of salt.

Unlike some of my other hacks, this fits into the game Seamlessly. There's nothing inherently "hackish" about it. (Well... somewhat). This will feel almost natural in some respects. Also I have some great news about Visual effects! The place where they are stored has a Lot of room. The problem with our approach is that we kept overwriting one visual effect with another. When there's at least room for 10 linear visual effects. This will lend itself to very interesting possibilities in the future.

Now this hack is only for the Right Hand (Sorry Palom and Kain) I had no room to fit in a Left Hand Check.

Imbued Weapons (I think I stole that name from one of Deathlike2's hacks?) Code

 :edit: 7/4/2014 - Changed the code to be more efficient to compensate for unforeseen difficulties.

Code: [Select]
[code]
(Changed "Is Target Charging? Than divide Defenses by 2" into "Is Caster using a Calcify1 Weapon? If so branch to routine.")
-----------------------------------------------------------------------------------------------------------------------------------------
$03/C740 AD 9F 26 LDA $269F  [$7E:269F] A:0000 X:0000 Y:0000 P:envMxdiZC - Load Caster's Attack Status Byte 2 into A.
$03/C743 29 01 AND #$01 A:0001 X:0000 Y:0000 P:envMxdizC - Is it Calcify 1?
$03/C745 F0 06 BEQ $06    [$C74D] A:0001 X:0000 Y:0000 P:envMxdizC - If not, branch to next portion of Defense determination...
-----------------------------------------------------------------------------------------------------------------------------------------
$03/C747 AD 9C 26 LDA $269C  [$7E:269C] A:0001 X:0000 Y:0000 P:envMxdizC - Load Caster's Accuracy into A.
$03/C74A 20 E6 CB JSR $CBE6  [$03:CBE6] A:0063 X:0000 Y:0000 P:envMxdizC - Jump to Imbued Weapons Subroutine - (Past Status clearing)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/CBDB 7B TDC A:0001 X:0014 Y:0001 P:envMxdizc - Transfer Direct Page (Clear A without using 2 bytes.
$03/CBDC AA TAX A:0000 X:0014 Y:0001 P:envMxdiZc - Transfer A to X.
$03/CBDD 9E A0 33 STZ $33A0,x[$7E:33A0] A:0000 X:0000 Y:0001 P:envMxdiZc - Store Zero in Statuses to Inflict on Enemies (this gets rid of Calcify, which is the catalyst for this particular hack and this data sits atop the ruins of the broken Calcify Weapon Routine so nothing is lost)
$03/CBE0 E8 INX A:0000 X:0000 Y:0001 P:envMxdiZc - +1 to X
$03/CBE1 E0 1F 00 CPX #$001F A:0000 X:0001 Y:0001 P:envMxdizc - Has X gone all the way to 33BF in clearing?
$03/CBE4 D0 F7 BNE $F7    [$CBDD] A:0000 X:0001 Y:0001 P:eNvMxdizc - If not, branch back to Clearing.
---------------------------------------------------------------------------------------------------------
$03/CBE6 20 79 83 JSR $8379  [$00:8379] A:0012 X:000F Y:0000 P:envMxdizc - Jump to RNG Routine (00 to Accuracy)
$03/CBE9 C9 32 CMP #$32 A:000B X:0000 Y:0000 P:envMxdizc - Is it 50 or above?
$03/CBEB 90 54 BCC $54    [$CC41] A:000B X:0000 Y:0000 P:eNvMxdizc - If not, branch to end of routine.
------------------------------------------------------------------------------------------------------
$03/CBED A9 FF LDA #$FF A:0010 X:0000 Y:0000 P:eNvMxdizc - Load All Enemies into Targeting
$03/CBEF 8D D3 26 STA $26D3  [$7E:26D3] A:00FF X:0000 Y:0000 P:eNvMxdizc - Store A in Monster Targets.
$03/CBF2 AD B3 26 LDA $26B3  [$7E:26B3] A:00FF X:0000 Y:0000 P:eNvMxdizc - Load Right Handed Weapon
$03/CBF5 C9 06 CMP #$05 A:0005 X:0000 Y:0000 P:envMxdizc - Is it the Poison Claw?
$03/CBF7 D0 08 BNE $08    [$CC01] A:0016 X:0000 Y:0000 P:envMxdizC - If not, branch to next Weapon Check.
$03/CBF9 A9 CE LDA #$CE A:0016 X:0000 Y:0000 P:envMxdiZC - Load Kick Graphic into A.
$03/CBFB 8D C4 33 STA $33C4  [$7E:33C4] A:00CE X:0000 Y:0000 P:eNvMxdizC - Store A in Audiovisual Code
$03/CBFE 4C B4 E6 JMP $E6B4  [$03:E6B4] A:00CE X:0000 Y:0000 P:eNvMxdizC - Jump and Stay with Kick Routine
-------------------------------------------------------------------------------------------------------------------------
$03/CC01 C9 0B CMP #$0B A:000B X:0000 Y:0000 P:envMxdizC - Is it the Change Rod?
$03/CC03 D0 03 BNE $03    [$CC08] A:0016 X:0000 Y:0000 P:envMxdiZC - If not, branch to next Weapon Check.
$03/CC05 4C 1A EA JMP $EA1A  [$03:EA1A] A:0016 X:0000 Y:0000 P:envMxdiZC - Jump to Recall Routine
----------------------------------------------------------------------------------------------------------------------
$03/CC08 C9 11 CMP #$11 A:0011 X:0000 Y:0000 P:envMxdizC - Is it the Silver Staff?
$03/CC0A D0 03 BNE $03    [$CC0F] A:0016 X:0000 Y:0000 P:envMxdiZC - If not, branch to next Weapon Check.
$03/CC0C 4C DC E2 JMP $E2DC  [$03:E2DC] A:0016 X:0000 Y:0000 P:envMxdiZC - Jump to Salve(But moreso Item Master, so the released patch will include Item Master, normal Salve will probably heal Foe, if I had to guess)
-------------------------------------------------------------------------------------------------------------------------
$03/CC0F C9 17 CMP #$17 A:0017 X:0000 Y:0000 P:envMxdizC - Is it the Darkness Sword?
$03/CC11 D0 08 BNE $08    [$CC1B] A:0016 X:0000 Y:0000 P:envMxdiZC - If not, branch to next Weapon Check.
$03/CC13 A9 C5 LDA #$C5 A:0016 X:0000 Y:0000 P:envMxdiZC - Load Dark Wave graphic into A.
$03/CC15 8D C4 33 STA $33C4  [$7E:33C4] A:00C5 X:0000 Y:0000 P:eNvMxdizC - Store A in Audiovisual Code.
$03/CC18 4C E9 E9 JMP $E9E9  [$03:E9E9] A:00C5 X:0000 Y:0000 P:eNvMxdizC - Jump to Dark Wave Routine.
----------------------------------------------------------------------------------------------------------------------------
$03/CC1B C9 20 CMP #$20 A:0020 X:0000 Y:0000 P:eNvMxdizc - Is it the Ancient Sword?
$03/CC1D D0 03 BNE $03    [$CC22] A:0016 X:0000 Y:0000 P:envMxdiZC - If not, branch to next Weapon Check.
$03/CC1F 4C FA E3 JMP $E3FA  [$03:E3FA] A:0016 X:0000 Y:0000 P:envMxdiZC - Jump to Regen Routine
-----------------------------------------------------------------------------------------------------------------------
$03/CC22 C9 3B CMP #$3B A:003B X:0000 Y:0000 P:eNvMxdizc - Is it the Silver Knife?
$03/CC24 D0 03 BNE $03    [$CC29] A:0016 X:0000 Y:0000 P:envMxdiZC - If not, branch to next Weapon Check.
$03/CC26 4C CC E1 JMP $E1CC  [$03:E1CC] A:0016 X:0000 Y:0000 P:envMxdiZC - Jump to Steal Routine
-----------------------------------------------------------------------------------------------------------------------
$03/CC29 C9 3F CMP #$3F A:003F X:0000 Y:0000 P:eNvMxdizc - Is it the Crystal Sword?
$03/CC2B D0 03 BNE $03    [$CC30] A:0016 X:0000 Y:0000 P:envMxdiZC - If not, branch to next Weapon Check.
$03/CC2D4C F0 E7 JMP $E7F0  [$03:E7F0] A:0016 X:0000 Y:0000 P:envMxdiZC - Jump to Focus Routine.
----------------------------------------------------------------------------------------------------------------------------
$03/CC30 C9 46 CMP #$46 A:0046 X:0000 Y:0000 P:eNvMxdizc - Is it the Dummy Weapon?
$03/CC32 D0 08 BNE $08    [$CC3C] A:0016 X:0000 Y:0000 P:envMxdiZC - If not, branch to Sing
$03/CC34 A9 C5 LDA #$C5 A:0016 X:0000 Y:0000 P:envMxdiZC - Load Dark Wave Animation into A.
$03/CC36 8D C4 33 STA $33C4  [$7E:33C4] A:00C5 X:0000 Y:0000 P:eNvMxdizC - Store A in Audiovisual Code
$03/CC39 4C E9 E9 JMP $E9E9  [$03:E9E9] A:00C5 X:0000 Y:0000 P:eNvMxdizC - Jump to Dark Wave Routine
----------------------------------------------------------------------------------------------------------------------------
$03/CC3C 4C 00 E9 JMP $E900  [$03:E900] A:0016 X:0000 Y:0000 P:eNvMxdizc - Jump to Sing Routine




Despite my complaining about space, if I would have been a little wiser I could have saved a lot more. I only noticed now that I used JSR's instead of JMP's for the Commands when there is no longer (the STZ code that is at the start was once at the end... yeah, I'm a poor programmer) reason for them being there. And only now are they being changed... hmm, I wonder if this will give me enough space to put the Peep Weapon back in...

No thanks, that thing wasn't that great either. Instead I opted to give the Dummy Crystal Sword Dark Wave. In the end I had one byte to spare. Well again, this was an incredible adventure.


You can expect the patch forthcoming, here is what you can expect in it...

Silver Dagger - Steal
Silver Staff - Salve/Item Master
Ancient Sword - Regen
Poison Claw - Kick
Crystal Sword - Focus
Harps - Sing
Darkness Sword - Dark Wave
Change Rod - Recall
Dummy - Dark Wave

Along with several equipment changes to make these... actually work.

No pictures this time I'm afraid, its a difficult thing to actually portray.

And the Patch is done! It uses Vivify93's absolutely awesome ProjectII Patch as a base for several reasons...

One, treasure put in all of its proper spots.
Two, better translation.
Three, bug fixes.
Four, general improvements.

This patch includes Imbued Weapons and Item Master.
In addition is the changing of several weapons stats to reflect their new purposes.

The Poison Claw loses Poison and is now the "Martial Claw" when you attack with it is has a chance to use Kick.
The Change Rod now has Immense physical power for a Caster's weapon of that level and randomly uses Recall.
The Silver Staff is now the Scholar Staff that can be bought for a princely sum at the Silvera Weapon Shop, it can randomly use Item Master.
The Darkness Blade (called Shadow in the normal FFIV translations,, confusing) can use Dark Wave and when used from a weapon it curiously does not reduce HP.
The Ancient Sword's power has been immensely upgraded its ability is a powerful Regen. So you have to be careful when and how you use it, it has lost Curse though.
The Silver Knife is now the Thief's Knife which can be found lying around as always, it goes without saying its ability is Steal.

The Medusa Blade (broken piece of junk... entire point of this hack anyhow...) has been replaced by the Coral Sword, which is a rare drop from Baron Guards. But they've had their drop table changed so it may be worth grinding for. Its power is on par with the other Elemental Swords and we know that Lightning rules the day in the Tower of Babil.

The Ragnarok now has Focus as its ability so using it can be a double edged sword, you may stall yourself for several turns in a row.

On the other hand this hack introduces the Dark Crystal Sword. A copy of the Crystal Sword (Ragnarok) but two handed (yep, really created it there...). Its ability is Dark Wave, which can be Very useful late game and with the added bonus of not losing any life when its used. The Dark Crystal Sword is obtained along with the Ragnarok so you can mix and match as you please, per the situation.

Last but not least the Charmer's Harp becomes the Siren's Harp... I bet you can guess what it will do. Taking a cue from Paladin's old mod, Rydia can equip Harps as well so it is worth holding onto this for her return.

As for character changes... there's only been one.

Edward has lost Salve(now (Item)Lord (Item Master)) and it now belongs to Cid.

I should give a brief synopsis of what ItemLord does... ItemLord will read the first usable item in your inventory and split it, it can be used on Friend or Foe. Single, in case you want that powerful attack magic item to focus on a single target, or multiple for when you're in a bit of trouble and everyone could use a bit of healing or if you're down to your last man and a mass Life Potion can turn the tides. ItemLord is used in this because of Salve, because Salve will only target whoever it is currently targeting and use that assigned item spell on it. Default that is a use of a Cure Potion for deficient amount of healing, granted in Project II it's a cure potion for Cure3 Potion healing, but... it would be on the enemy.

I decided to give it to Cid because you might Actually need it when he's in the party, rather than breezing through the Dark Knight portion of the game with yet another useless skill.

And without further ado, here is the patch...

Keep in mind it must be a v1.1 and Unheadered! (I made this mistake too many times.)

And please, give me your thoughts on it!


Title: Re: Grimoire LD's Notes, Patches, and Hacks (Ability Weapons from FFV put into FFIV)
Post by: Grimoire LD on January 09, 2014, 09:33:46 PM
So I've now completely (well somewhat) cracked the Audiovisual code. Every byte there is a check to see if an animation is called, Every Byte... Let me put that into perspective... There are 152 bytes In Hex reserved for Audiovisual alone. You know how many are filled in with a normal spell or attack? About five or six. You can create a spell chain technically that goes on through the length of spells and beyond.

Audiovisual starts at 7E33C2 you will Never have to worry about overflowing this. This game is Extremely Capable of showing more than one spell at one time, as long as those next spell graphics are written into the next section over.

Title: Re: Grimoire LD's Notes, Patches, and Hacks (Ability Weapons from FFV put into FFIV)
Post by: Grimoire LD on January 10, 2014, 01:26:51 AM
I tried to use Aura to make Piercing Sight, but I couldn't grasp how to keep the value from being rewritten to a higher value as it is in Chillyfeez's code... so instead I opted to use as much code as possible in making the Piercing Sight Routine. This replaces Damage, Sap because Damage, Sap is stupid. (Normal damage formula with a Zombie Check, Timer for HP Leak, and the 60 tick, HP Leak... yeah...)

This works identically to how it works in FFIV:The After Years, except that the Dispel portion of it will even hit bosses. The Weakness adding effect will not though. It even casts Peep so you can see the new weakness!

Code: [Select]
$03/D3C2 AD 70 27 LDA $2770  [$7E:2770] A:0003 X:0002 Y:0000 P:envMxdizc - Load Target's Boss Bit.
$03/D3C5 30 48 BMI $48    [$D40F] A:0006 X:0002 Y:0000 P:envMxdizc - If a Boss branch to Black Hole Routine Jump.
$03/D3C7 A2 01 00 LDX #$0001 A:0006 X:0002 Y:0000 P:envMxdizc - Load 0001 into X.
$03/D3CA A9 80 LDA #$80 A:0006 X:0001 Y:0000 P:envMxdizc - Load 80 into A.
$03/D3CC 20 79 83 JSR $8379  [$03:8379] A:0080 X:0001 Y:0000 P:eNvMxdizc - Jump to RNG.
$03/D3CF C9 70 CMP #$70 A:001B X:0000 Y:0000 P:eNvMxdizc - Is it 70?
$03/D3D1 90 04 BCC $04    [$D3D7] A:001B X:0000 Y:0000 P:eNvMxdizc - If less than 70 branch to next RNG check.
-----------------------------------------------------------------------------------------------------------------------------------
$03/D3D3 A9 80 LDA #$80 A:0078 X:0000 Y:0000 P:envMxdizC - Load x4 Weakness into A.
$03/D3D5 80 32 BRA $32    [$D409] A:0080 X:0000 Y:0000 P:eNvMxdizC - Branch to Weakness Store.
------------------------------------------------------------------------------------------------------------------------------------
$03/D3D7 C9 60 CMP #$60 A:001B X:0000 Y:0000 P:eNvMxdizc - Is it 60?
$03/D3D9 90 04 BCC $04    [$D3DF] A:001B X:0000 Y:0000 P:eNvMxdizc - If less than 60 branch to next RNG check.
-------------------------------------------------------------------------------------------------------------------------------
$03/D3DB A9 40 LDA #$40 A:006F X:0000 Y:0000 P:envMxdizC - Load Absorb Weakness into A.
$03/D3DD 80 2A BRA $2A    [$D409] A:0040 X:0000 Y:0000 P:envMxdizC - Branch to Weakness Store.
------------------------------------------------------------------------------------------------------------------------------
$03/D3DF C9 50 CMP #$50 A:001B X:0000 Y:0000 P:eNvMxdizc - Is it 50?
$03/D3E1 90 04 BCC $04    [$D3E7] A:001B X:0000 Y:0000 P:eNvMxdizc - If less than 50 branch to next RNG check.
-----------------------------------------------------------------------------------------------------------------------------
$03/D3E3 A9 20 LDA #$20 A:0054 X:0000 Y:0000 P:envMxdizC - Load Air Weakness into A.
$03/D3E5 80 22 BRA $22    [$D409] A:0020 X:0000 Y:0000 P:envMxdizC - Branch to Weakness Store.
------------------------------------------------------------------------------------------------------------------------------
$03/D3E7 C9 40 CMP #$40 A:001B X:0000 Y:0000 P:eNvMxdizc - Is it 40?
$03/D3E9 90 04 BCC $04    [$D3EF] A:001B X:0000 Y:0000 P:eNvMxdizc - If less than 40 branch to next RNG check.
------------------------------------------------------------------------------------------------------------------------------
$03/D3EB A9 10 LDA #$10 A:0040 X:0000 Y:0000 P:envMxdiZC - Load Holy Weakness into A.
$03/D3ED 80 1A BRA $1A    [$D409] A:0010 X:0000 Y:0000 P:envMxdizC - Branch to Weakness Store.
----------------------------------------------------------------------------------------------------------------------------
$03/D3EF C9 30 CMP #$30 A:001B X:0000 Y:0000 P:eNvMxdizc - Is it 30?
$03/D3F1 90 04 BCC $04    [$D3F7] A:001B X:0000 Y:0000 P:eNvMxdizc - If less than 30 branch to next RNG check.
-----------------------------------------------------------------------------------------------------------------------------
$03/D3F3 A9 08 LDA #$08 A:0030 X:0000 Y:0000 P:envMxdiZC - Load Dark Weakness into A.
$03/D3F5 80 12 BRA $12    [$D409] A:0008 X:0000 Y:0000 P:envMxdizC - Branch to Weakness Store.
-----------------------------------------------------------------------------------------------------------------------------
$03/D3F7 C9 20 CMP #$20 A:001B X:0000 Y:0000 P:eNvMxdizc -Is it 20?
$03/D3F9 90 04 BCC $04    [$D3FF] A:001B X:0000 Y:0000 P:eNvMxdizc - If less than 20 branch to next RNG check.
--------------------------------------------------------------------------------------------------------------------------
$03/D3FB A9 04 LDA #$04 A:0020 X:0000 Y:0000 P:envMxdiZC - Load Lightning Weakness into A.
$03/D3FD 80 0A BRA $0A    [$D409] A:0004 X:0000 Y:0000 P:envMxdizC  - Branch to Weakness Store.
------------------------------------------------------------------------------------------------------------------------------
$03/D3FF C9 10 CMP #$10 A:001B X:0000 Y:0000 P:eNvMxdizc - Is it 10?
$03/D401 90 04 BCC $04    [$D407] A:001B X:0000 Y:0000 P:envMxdizC - If less than 10 branch to next RNG check.
---------------------------------------------------------------------------------------------------------------------------
$03/D403 A9 02 LDA #$02 A:001B X:0000 Y:0000 P:envMxdizC - Load Ice Weakness into A.
$03/D405 80 08 BRA $02   [$D40F] A:0002 X:0000 Y:0000 P:envMxdizC - Branch to Weakness Store.
-------------------------------------------------------------------------------------------------------------------------
$03/D407 A9 01 LDA #$01 A:0002 X:0000 Y:0000 P:eNvMxdizc - Load Fire Weakness into A.
$03/D409 0D 20 27 ORA $2720  [$7E:2720] A:0001 X:0000 Y:0000 P:envMxdizc - See if Weakness is already there.
$03/D40C 8D 20 27 STA $2720  [$7E:2720] A:0001 X:0000 Y:0000 P:envMxdizc - Store A in Weakness Byte.
$03/D40F 20 AE DD JSR $DDAE  [$03:DDAE] A:0001 X:0000 Y:0000 P:envMxdizc - Jump to Black Hole Routine.
$03/D412 4C 24 D9 JMP $D924  [$03:D924] A:0010 X:0000 Y:0000 P:envMxdizC - Jump and stay with Peep Routine.

Very simple, but pretty effective. I love Scholar classes in FF and Piercing Sight fits right along with them.

Let's see... if I were to make a Scholar Class now they could have...

Piercing Sight...
ItemLord...

Hah, I thought I made more for them. I suppose not. I still need to figure out an ItemLore scheme, grumble, grumble...

Title: Re: Grimoire LD's Notes, Patches, and Hacks (Ability Weapons from FFV put into FFIV)
Post by: chillyfeez on January 10, 2014, 10:09:47 AM
I know you've told me before, but I forget (and though I've watched HCBailley's LP, he pretty much sticks to his favorite characters, and Edward's girlfriend is not one of them) - is the effect of piercing sight to assign one random elemental weakness to the target and wipe out all status anomalies? Seems like that's what this code is doing... and I guess jumping to Peep at the end displays a message about which weakness was added? Pretty ingeneous.
I'm not sure my aura code would have worked any better to this end, unless you wanted to compound multiple weaknesses.

Regarding your cracking the AV code... I'd be interested in seeing what you've found. I've kicked the tires on writing some brand new spell animations for my hack, but so far have dismissed the notion as beyond the scope of my knowledge.

My holiday season is finally over (that is, it's back to business as usual at work and I'm finally done visiting various branches of the family tree) so I plan to get back into hacking more. I'll post the code for my "attack barrage" today per your request.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Ability Weapons from FFV put into FFIV)
Post by: Grimoire LD on January 10, 2014, 11:38:34 AM
I know you've told me before, but I forget (and though I've watched HCBailley's LP, he pretty much sticks to his favorite characters, and Edward's girlfriend is not one of them) - is the effect of piercing sight to assign one random elemental weakness to the target and wipe out all status anomalies? Seems like that's what this code is doing... and I guess jumping to Peep at the end displays a message about which weakness was added? Pretty ingeneous.

Thanks!  That is precisely what it does. Except normally Piercing Sight misses bosses and doesn't even apply the Dispel-esque effect. Making it... marginally useless. Another facet of Piercing Sight is that the weakness added can Only be told by the color of the flash on the screen. Obviously I didn't have the space required to do that. Nor was I overly fond of that. When I think of "Sight", I think of seeing the enemy's stats and what good is an ability that you can't be sure what it did (granted it if it applies Absorb or x4 Weakness, you won't ever actually know since there is no Peep check for those, but you can at least be sure its one of the two.)


Quote
I'm not sure my aura code would have worked any better to this end, unless you wanted to compound multiple weaknesses.

Oh? My original plan was to take what you basically had as the Aura code, roll a random number between 1 and 80, and get rid of the compounding... but I couldn't comprehend how the compounding was done in the end so I had to abandon that idea. It seemed simple in theory, I'm not sure if it would have worked in practice.

Quote
Regarding your cracking the AV code... I'd be interested in seeing what you've found. I've kicked the tires on writing some brand new spell animations for my hack, but so far have dismissed the notion as beyond the scope of my knowledge.

My holiday season is finally over (that is, it's back to business as usual at work and I'm finally done visiting various branches of the family tree) so I plan to get back into hacking more. I'll post the code for my "attack barrage" today per your request.

Well the "AV Code"... (that's probably not the Actually use for the area.) Is an extremely simple set of  bytes. Each byte there says to do something. Here is normal attack...
Starting from 7E33C2

C2 (First Byte) - F8 - (Tied to System Commands as displayed by next byte. such as Damage Display, and some possibly debug functions.)
C3 (Second Byte) 02 -  Looks to be a Kind of message, when changed to 00 it will show the character's name in a mini-message box who is attacking. May have been used for debugging or earlier plans 01 shows the name of the foe you are striking (if it is not the last one), again may have been used in an earlier system. 03 shows no difference. 04 is used by by the last few bytes of most attack commands. Ever wonder why some routines support showing damage and others may not? Well here is your answer, F804 is the Key. 06 and up are very glitchy.

C4 (Third Byte) C0 - What we often tend to write to in our routines. This is the basic attack animation.

C5 (Fourth Byte) 00 - This is another Effect Byte, used primarily by spells.

C6 (Fifth Byte) F8 - (Another System Command Call)
C7 (Sixth Byte)04 - (Display Damage done.)

And there you have it! Creating multiple spell effects or even multiple Command effects is a very simple thing to do and displaying damage is no longer a mystery, just be sure to finish off any damaging routine with F804 and you should be golden!

You can put off displaying damage as long as you need to show as many animations/effects that your heart desires! Just be sure to write in the F804 Somewhere along the lines though.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Ability Weapons from FFV put into FFIV)
Post by: chillyfeez on January 10, 2014, 12:53:49 PM
OK, Attack Barrage:
Code: [Select]
A9 CO LDA #$CO
8D C4 33 STA $33C4 ;Load attack animation
A6 A6 LDX $A6 ;Load character's slot into X
FE 73 20 INC $2073,X ;+1 to "dropped item" byte
BD 73 20 LDA $2073,X
C9 05 CMP #$05 ;Check if "dropped item" byte is 05
F0 04 BEQ $04 ;If it is, skip the next two ops
A9 ** LDA #$** ;Load [whichever command this is] into A
80 02 BRA $02 ;Skip the next op
A9 00 LDA #$00 ;Load 00 [Fight] into A
9D 51 20 STA $2051,X ;Store A in character's next command
20 99 C4 JSR $C499 ;Jump to attack subroutine
A9 03 LDA #$03
20 C8 85 JSR $85C8 ;Load character's "turn queue" slot into X
A9 08 LDA #$08 ;Load 08 [ready to perform next action] into A
9D 06 2A STA $2A06,X ;Store A in character's "turn queue" status
9E 04 2A STZ $2A04,X ;Store zero in character's "next turn wait time"
EE 0A 39 INC $390A ;Required op to prevent "turn queue" from resetting
60 RTS
Now, something to note here - my Limit skills are designed to execute a maximum of once per battle. They won't activate if the character's "dropped item" byte is anything other than 00 (and every limit skill increases the byte by at least 1). If you were to execute this command a second time, the character would attack 255 times before you regain control (2073,X would cycle up to FF then back to zero before finally reaching 05 again).

You could, add a "STZ $2073,X" in there to reset the byte back to 00. That should make the command work flawlessly as many times as you want...
So:
Code: [Select]
A9 CO LDA #$CO
8D C4 33 STA $33C4 ;Load attack animation
A6 A6 LDX $A6 ;Load character's slot into X
FE 73 20 INC $2073,X ;+1 to "dropped item" byte
BD 73 20 LDA $2073,X
C9 05 CMP #$05 ;Check if "dropped item" byte is 05
F0 04 BEQ $04 ;If it is, skip the next two ops
A9 ** LDA #$** ;Load [whichever command this is] into A
80 05 BRA $05 ;Skip the next two ops
A9 00 LDA #$00 ;Load 00 [Fight] into A
9E 73 20 STZ $2073,X ;Reset "dropped item" byte to 00
9D 51 20 STA $2051,X ;Store A in character's next command
20 99 C4 JSR $C499 ;Jump to attack subroutine
A9 03 LDA #$03
20 C8 85 JSR $85C8 ;Load character's "turn queue" slot into X
A9 08 LDA #$08 ;Load 08 [ready to perform next action] into A
9D 06 2A STA $2A06,X ;Store A in character's "turn queue" status
9E 04 2A STZ $2A04,X ;Store zero in character's "next turn wait time"
EE 0A 39 INC $390A ;Required op to prevent "turn queue" from resetting
60 RTS
This adds the needed STZ and alters the necessary BRA op to make this work the way you want it to.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Ability Weapons from FFV put into FFIV)
Post by: Grimoire LD on January 10, 2014, 01:12:31 PM
Very great work! Limit skills, eh? I take it you know then how to darken a command so it cannot be used, correct? Or are they activated completely differently from a chosen selection? Or does it build up over five attacks using this command eventually using a 5 Attack string?
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Ability Weapons from FFV put into FFIV)
Post by: Grimoire LD on January 10, 2014, 01:56:07 PM
Here's a Very simple one that I only just now noticed how simple it Really could be... Search to Taunt

Original Search Code that was altered...

Code: [Select]
$03/DFD5 A5 CE LDA $CE    [$00:00CE] A:0003 X:0066 Y:0000 P:envMxdizc - Load A from CE. - Load Caster's Slot.
$03/DFD7 A8 TAY A:0080 X:0066 Y:0000 P:eNvMxdizc - Transfer A to Y.
$03/DFD8 A5 CD LDA $CD    [$00:00CD] A:0080 X:0066 Y:0080 P:envMxdizc - Load A from CD.- Load Target's Slot.

New Taunt Code

Code: [Select]
$03/DFD5 A5 CD LDA $CD    [$00:00CD] A:0003 X:0066 Y:FFFF P:envMxdizc - Load Target's Slot.
$03/DFD7 A8 TAY A:0001 X:0066 Y:FFFF P:envMxdizc - Transfer A to Y.
$03/DFD8 A5 CE LDA $CE    [$00:00CE] A:0001 X:0066 Y:0001 P:envMxdizc - Load Caster's Slot.

This reverses its functionality. And it only took a two byte swap! But this does have its limits... it can't be multi-targeted without some real problems appearing.

In essence though this makes it so the chosen enemy will only target that specific character for its next action.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Ability Weapons from FFV put into FFIV)
Post by: LordGarmonde on January 10, 2014, 04:06:58 PM
SWEET!
One of my longer term goals is to put Golbez into the party and I'd love to have this ability to give him.  :childish:

Unrelated - I'm still working on my experience mod to eliminate the need for the reference tables. Do you know where the routine is that updates stats/TNL upon level up?
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Ability Weapons from FFV put into FFIV)
Post by: Grimoire LD on January 10, 2014, 04:24:06 PM
Well I'm glad you like it! I'll be putting the Sword Spirit into its own patch shortly, so there's that as well.

I do believe I had found something like that before... (goes back to newly updated first post which has all of his miscellaneous notes linked, realizes he forgot to include it...) Hah. (looks through the topic for it...)
http://slickproductions.org/forum/index.php?topic=1883.msg19497#msg19497 There we are. That is some relation to what's going on.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Ability Weapons from FFV put into FFIV)
Post by: Grimoire LD on January 10, 2014, 04:40:27 PM
Sword Spirit/Iaido/Draw Out/Katana Soul, what have you is now in patch form.

 :edit: (Looks at Avatar) (http://slickproductions.org/forum/Themes/default/images/777.gif)  I never want to post again...
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Ability Weapons from FFV put into FFIV)
Post by: chillyfeez on January 10, 2014, 05:02:27 PM
I take it you know then how to darken a command so it cannot be used, correct? Or are they activated completely differently from a chosen selection? Or does it build up over five attacks using this command eventually using a 5 Attack string?
The activation is automatic and (basically) random.
I cannibalized auto-hide in order to make it work (thanks to your research on the subject).

Conditions for auto-hide:
-Character is in critical status
-Character is Edward
-Character is not already hiding
Results in:
-Character targets self
-Character executes Hide

Conditions for limit break:
-Character is in critical status
-Character's lower HP byte has bits 0 and 1 set (mathematically, this means [HP] - 3 is evenly divisible by 4)
-Character has not already used a limit skill this battle (Dropped Item byte is 00)
Results in:
-Character targets all enemies
-Character executes "limit break" ability

Now, the Limit Break ability checks the character's Sprite/Class byte ($2001,X), then based on what value is there, re-targets if necessary and queues a Limit skill - One of Four new abilities (of which Attack Barrage is one) and Four super-spells (Phoenix is one, and the other three are beefed-up versions of Virus, Holy and Cure), depending on which character is limit breaking.

So the activation, like in FFVI, is essentially random. That is, it's not unpredictable, but it's nearly impossible to force. While I did this because it was the easier way to go (I imagine, given enough time and motivation, that I could make a conditionally darked-out, user-initiated command, but I'm not sure I have either), I also prefer for Limits to be, well, limited. I personally have abused the living hell out of them in FFVII and FFX and find the inability to do so in FFIX refreshing. I was considering, though, working in a high-level white magic spell that essentially forces Limit conditions so that for a price, a high-level player could use them (still only once per battle) at will, sort of reminiscent of the Aura status in FFVIII.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Ability Weapons from FFV put into FFIV)
Post by: chillyfeez on January 10, 2014, 05:04:52 PM
(http://slickproductions.org/forum/Themes/default/images/777.gif)  I never want to post again...
Right? only 477 more posts for me!
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Ability Weapons from FFV put into FFIV)
Post by: Grimoire LD on January 10, 2014, 05:09:46 PM
That is Beyond cool Chillyfeez! Talk about taking something that's already there and turning it on its head, you've added an Entire new facet to battle!

Your idea is a lot more workable, then the plan to put a command in people's menus that darken. One, you don't waste a precious Command spot, two, you can decide when it will be activated, not the player, and three. It's just all around more aesthetically pleasing. FFVI had it right with desperation attacks I feel. Just their rarity made them pretty rare sights.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Ability Weapons from FFV put into FFIV)
Post by: Grimoire LD on January 10, 2014, 09:00:03 PM
Hmm, though I had to sacrifice a bit of what I wanted I am not upset at all with the results...

Break Skills are complete! I only added 5 though and only the ones that hit stats. Not because I ran out of room with my chosen point, but because I think they're good enough and they capture the original spirit of the Break Skills (without the potential for absurd brokenness.)

Sylph was the victim this time. I haven't yet filled up the entire data though. There's a lot of free space I might want to use for other purposes perhaps.

Code: [Select]
EDIT: Code added to prevent crashes when enemies use these, meaning that the original byte placement representations are off by 4.)

$03/DAAE A5 CD LDA $CD    [$00:06CD] A:00F0 X:0140 Y:0000 P:eNvMxdizc - Load Character ID into A.
$03/DAB0 30 05 BMI $05    [$DAB7] A:00F0 X:0140 Y:0000 P:eNvMxdizc - If a monster skip Audiovisual Call
----------------------------------------------------------------------------------------------------------------
$03/DAAE A9 C0 LDA #$C0 A:0003 X:0034 Y:0000 P:envMxdizc - Load Weapon Swing into A.
$03/DAB0 8D C4 33 STA $33C4  [$7E:33C4] A:00C0 X:0034 Y:0000 P:eNvMxdizc - Store A in Audiovisual Call.
---------------------------------------------------------------------------------------------------------------
$03/DAB3 AD A2 28 LDA $28A2  [$7E:28A2] A:00C0 X:0034 Y:0000 P:eNvMxdizc - Load Stored Element into A.
$03/DAB6 C9 01 CMP #$01 A:0001 X:0034 Y:0000 P:envMxdizc - Is it Fire?
$03/DAB8 D0 13 BNE $13    [$DACD] A:0001 X:0034 Y:0000 P:envMxdiZC - If not, branch to next check.
----------------------------------------------------------------------------------------------------------------------------------------------------------
$03/DABA AD 1D 27 LDA $271D  [$7E:271D] A:0001 X:0034 Y:0000 P:envMxdiZC - Load Target's Attack Power into A.
$03/DABD C9 09 CMP #$09 A:000E X:0034 Y:0000 P:envMxdizC - Is it more than 08?
$03/DABF 90 0B BCC $0B    [$DACC] A:000E X:0034 Y:0000 P:envMxdizC - If not, branch to Return.
$03/DAC1 48 PHA A:000E X:0034 Y:0000 P:envMxdizC - Push A onto stack
$03/DAC2 4A LSR A A:000E X:0034 Y:0000 P:envMxdizC - /2
$03/DAC3 4A LSR A A:0007 X:0034 Y:0000 P:envMxdizc - /2
$03/DAC4 85 E3 STA $E3    [$00:00E3] A:0003 X:0034 Y:0000 P:envMxdizC - Store A in E3.
$03/DAC6 68 PLA A:0003 X:0034 Y:0000 P:envMxdizC - Pull A from Stack.
$03/DAC7 E5 E3 SBC $E3    [$00:00E3] A:000E X:0034 Y:0000 P:envMxdizC - Minus current stat by 1/4 of its original value.
$03/DAC9 8D 1D 27 STA $271D  [$7E:271D] A:000B X:0034 Y:0000 P:envMxdizC - Store A in Attack Power.
$03/DACC 60 RTS A:000B X:0034 Y:0000 P:envMxdizC - Return
-------------------------------------------------------------------------------------------------------------------------------
$03/DACD C9 02 CMP #$02 A:0002 X:0034 Y:0000 P:envMxdizC - Is it Ice?
$03/DACF D0 13 BNE $13    [$DAE4] A:0002 X:0034 Y:0000 P:envMxdiZC - If not, branch to next check.
$03/DAD1 AD 3B 27 LDA $273B  [$7E:273B] A:0002 X:0034 Y:0000 P:envMxdiZC - Load Target's Speed into A.
$03/DAD4 C9 20 CMP #$20 A:0010 X:0034 Y:0000 P:envMxdizC - Is it 20 or above?
$03/DAD6 B0 0B BCS $0B    [$DAE3] A:0010 X:0034 Y:0000 P:eNvMxdizc - If so branch to return.
$03/DAD8 48 PHA A:0010 X:0034 Y:0000 P:eNvMxdizc - Push Speed onto stack.
$03/DAD9 4A LSR A A:0010 X:0034 Y:0000 P:eNvMxdizc - /2
$03/DADA 4A LSR A A:0008 X:0034 Y:0000 P:envMxdizc - /2
$03/DADB 85 E3 STA $E3    [$00:00E3] A:0004 X:0034 Y:0000 P:envMxdizc - Store A  in E3.
$03/DADD 68 PLA A:0004 X:0034 Y:0000 P:envMxdizc - Pull A from Stack.
$03/DADE 65 E3 ADC $E3    [$00:00E3] A:0010 X:0034 Y:0000 P:envMxdizc - Add the value in E3 onto A (to slow target down.)
$03/DAE0 8D 3B 27 STA $273B  [$7E:273B] A:0014 X:0034 Y:0000 P:envMxdizc - Store A in Target's Speed.
$03/DAE3 60 RTS A:0014 X:0034 Y:0000 P:envMxdizc - Return
---------------------------------------------------------------------------------------------------------------------------------
$03/DAE4 C9 04 CMP #$04 A:0004 X:0034 Y:0000 P:envMxdizC - Is it Lightning?
$03/DAE6 D0 12 BNE $12    [$DAFB] A:0004 X:0034 Y:0000 P:envMxdiZC - If not, branch to next check.
$03/DAE8 AD 28 27 LDA $2728  [$7E:2728] A:0004 X:0034 Y:0000 P:envMxdiZC - Load Target's Physical Defense Multiplier into A.
$03/DAEF 48 PHA A:0002 X:0034 Y:0000 P:envMxdiZC - Push A.
$03/DAF1 4A LSR A A:0001 X:0034 Y:0000 P:envMxdizc - /2
$03/DAF2 85 E3 STA $E3    [$00:00E3] A:0000 X:0034 Y:0000 P:envMxdiZC - Store Physical Defense into E3.
$03/DAF4 68 PLA A:0000 X:0034 Y:0000 P:envMxdiZC - Pull A.
$03/DAF5 E5 E3 SBC $E3    [$00:00E3] A:0002 X:0034 Y:0000 P:envMxdizC - Subtract value in E3 from Physical Defense.
$03/DAFA 30 05 BMI $05    [$DB01] A:00FF X:02A6 Y:0000 P:eNvMxdizc - If negative, branch to End.
$03/DAF7 8D 28 27 STA $2728  [$7E:2728] A:0002 X:0034 Y:0000 P:envMxdizC - Store in Target's Physical Defense.
$03/DAFA 60 RTS A:0002 X:0034 Y:0000 P:envMxdizC - Return
---------------------------------------------------------------------------------------------------------------------------------------------------------
$03/DAFB C9 08 CMP #$08 A:0008 X:0034 Y:0000 P:envMxdizC - Is it Darkness Element?
$03/DAFD D0 14 BNE $14    [$DB19] A:00F0 X:01BE Y:4510 P:eNvMxdIzc - Branch to next one if not.
$03/DAFF AD 17 27 LDA $2717  [$7E:2717] A:0008 X:0034 Y:0000 P:envMxdiZC - Load A from Target's Spell Power.
$03/DB06 48 PHA A:0028 X:0034 Y:0000 P:envMxdizC - Push A onto Stack.
$03/DB07 4A LSR A A:0028 X:0034 Y:0000 P:envMxdizC - /2
$03/DB08 4A LSR A A:0014 X:0034 Y:0000 P:envMxdizc - /2
$03/DB09 85 E3 STA $E3    [$00:00E3] A:000A X:0034 Y:0000 P:envMxdizc - Store A in E3.
$03/DB0B 68 PLA A:000A X:0034 Y:0000 P:envMxdizc - Pull A from Stack.
$03/DB0C E5 E3 SBC $E3    [$00:00E3] A:0028 X:0034 Y:0000 P:envMxdizc - Subtract A from E3.
                        30 07 BMI $07    [$DB19] A:00F0 X:01BE Y:4510 P:eNvMxdIzc - Branch if Minus to End.
$03/DB0E 8D 17 27 STA $2717  [$7E:2717] A:001D X:0034 Y:0000 P:envMxdizC - Store A in Target's Wisdom
$03/DB15 8D 18 27 STA $2718  [$7E:2718] A:00F0 X:01BE Y:4510 P:eNvMxdIzc - Store A in Target's Will
$03/DB11 60 RTS A:001D X:0034 Y:0000 P:envMxdizC - Return
-----------------------------------------------------------------------------------------------------------------------------------------------------
$03/DB12 C9 10 CMP #$10 A:0010 X:0034 Y:0000 P:envMxdizC - Is it Holy?
$03/DB14 D0 13 BNE $13    [$DB29] A:0010 X:0034 Y:0000 P:envMxdiZC - If not, branch to 13 bytes away, (left open just in case I want to expand)
$03/DB16 AD 24 27 LDA $2724  [$7E:2724] A:0010 X:0034 Y:0000 P:envMxdiZC - Load Target's Magical Defense into A.
$03/DB19 C9 02 CMP #$02 A:000B X:0034 Y:0000 P:envMxdizC - Is it less than 02?
$03/DB1B 90 0B BCC $0B    [$DB28] A:000B X:0034 Y:0000 P:envMxdizC - If so branch to return.
$03/DB1D 48 PHA A:000B X:0034 Y:0000 P:envMxdizC - Push A.
$03/DB1E 4A LSR A A:000B X:0034 Y:0000 P:envMxdizC - /2
$03/DB1F 4A LSR A A:0005 X:0034 Y:0000 P:envMxdizC - /2
$03/DB20 85 E3 STA $E3    [$00:00E3] A:0002 X:0034 Y:0000 P:envMxdizC - - Store Magical Defense into A.
$03/DB22 68 PLA A:0002 X:0034 Y:0000 P:envMxdizC  - Pull A.
$03/DB23 E5 E3 SBC $E3    [$00:00E3] A:000B X:0034 Y:0000 P:envMxdizC - Subtract A from E3.
$03/DB25 8D 24 27 STA $2724  [$7E:2724] A:0009 X:0034 Y:0000 P:envMxdizC - Store A in Magical Defense.
$03/DB28 60 RTS A:0009 X:0034 Y:0000 P:envMxdizC - Return
------------------------------------------------------------------------------------------------------------------------------------------------

And there you have it! The way it works is that it reads the Element as assigned by the Stored Elemental of the spell and from there branches onto different paths. From there it will take an enemy stat and divide it by 1/4. I wanted to originally make calculations between the target's stats and your own. But I don't think its worth the trouble. To prevent overflow issues each branch has a set limit to how far it can be pushed down.

(http://i112.photobucket.com/albums/n198/LastingDawn/BreakSkill1_zps671f7c17.png) (http://s112.photobucket.com/user/LastingDawn/media/BreakSkill1_zps671f7c17.png.html)

(http://i112.photobucket.com/albums/n198/LastingDawn/BreakSkill2_zps7ef2f99b.png) (http://s112.photobucket.com/user/LastingDawn/media/BreakSkill2_zps7ef2f99b.png.html)

(http://i112.photobucket.com/albums/n198/LastingDawn/BreakSkill3_zps0a2d44e9.png) (http://s112.photobucket.com/user/LastingDawn/media/BreakSkill3_zps0a2d44e9.png.html)



In the Patch you will see that Dark Knight Cecil starts with a Break Skill and 50 MP, he will gain more as you level. He'll learn the last one at Level 20.

In addition, Tellah can now use Swords and will learn the Break Skills when he relearns all of his spells on Mt. Ordeals.

Paladin Cecil will have a much slower time of obtaining the Break Skills again, learning the first one at 24 and the last one at 40.

Cecil and Tellah are the only two that will be able to use Break Skills in this patch. (of course as the patch is aimed at modders you can do whatever you want with it, heh.)


Everything has a cost, and the cost this time was the Sylph Formula. This means that Sylph's effect has been changed as well. The effect is now a more powerful Osmose (you weren't spending MP to use it anyhow...)

In addition because of the new Break Skills, five spells had to be replaced...

Hold - Seal Break (Lowers Target's Magic Defense by 1/4)
Armor - Power Break (Lowers Target's Attack by 1/4)
Safe - Speed Break (Increases Target's Speed Rating by 1/4, generally making it half as powerful as Slow)
Dispel/Curse - Armor Break (Lowers Target's Defense Multipliers by 1/2)
Sight - Mind Break (Lowers Target's Wisdom and Will by 1/4)


Not huge losses, I should hope. I do hope the new Battle Skills were worth it.

 :edit: 3/14/15 - I changed the routines of Armor Break and Mind Break. Armor Break now decreases an enemy's Defense Multiplier's by 2/3 to a minimum of 00. Mind Break now properly cuts Wisdom AND Will by 1/4. I was unaware enemy's used the Will stat beforehand.


Title: Re: Grimoire LD's Notes, Patches, and Hacks (Patch-Battle Skill from FFT in FFIV!)
Post by: Grimoire LD on January 11, 2014, 02:34:14 AM
Geomancy is coming along great! I am finished with the coding, now I just need to test it all. I have to say I am very proud of myself on this one. It works Nearly identical (in function, not so much in skills) to how it works in FFIII!

Here's a few snapshots...

(http://i112.photobucket.com/albums/n198/LastingDawn/Geomancy1_zps72a07c54.png) (http://s112.photobucket.com/user/LastingDawn/media/Geomancy1_zps72a07c54.png.html)

(http://i112.photobucket.com/albums/n198/LastingDawn/Geomancy2_zpscd1628f1.png) (http://s112.photobucket.com/user/LastingDawn/media/Geomancy2_zpscd1628f1.png.html)

(http://i112.photobucket.com/albums/n198/LastingDawn/Geomancy3_zps87d11500.png) (http://s112.photobucket.com/user/LastingDawn/media/Geomancy3_zps87d11500.png.html)

(http://i112.photobucket.com/albums/n198/LastingDawn/Geomancy4_zpsd5f0ed11.png) (http://s112.photobucket.com/user/LastingDawn/media/Geomancy4_zpsd5f0ed11.png.html)

Have a good night everyone. This patch will be released tomorrow!
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Patch-Battle Skill from FFT in FFIV!)
Post by: Grimoire LD on January 11, 2014, 01:08:40 PM
When I first thought of this project I cynically said "Geomancy? For what? The three types of cave that you visit endlessly through the game?" And though there are a Lot of caves, there's also a fair amount of other dungeon types with different backgrounds, so I decided to take advantage of it.

Geomancy has been flawlessly included into FFIV! This command replaces Peep and uses every last byte Peep had to offer to make it work. This command, as true to Geomancy in FFIII NES, reads the battle background and will use an ability in correspondence. Because of space limitations several backgrounds share the same Geomancy effect unfortunately. The majority of moves are enemy only spells, but this patch also adds in two new spells. CalmWind for the Field and AirBlade for Forests, Deserts, Beaches, and Mountains. Like FFIII however there is a 35% chance upon use that it will Backfire, self destructing the User and dealing the User's HP damage to the enemies.


Code: [Select]
$03/E153 20 8B 85 JSR $858B  [$03:858B] A:0003 X:0028 Y:0000 P:envMxdizc - Generate Random Number
$03/E156 C9 28 CMP #$28 A:0027 X:0000 Y:0000 P:envMxdizc - Is it 35 or less?
$03/E158 B0 04 BCS $04    [$E15E] A:0027 X:0000 Y:0000 P:eNvMxdizc - If not, branch to Field Check
$03/E15A A9 91 LDA #$91 A:0027 X:0000 Y:0000 P:eNvMxdizc - Load Backfire into A.
$03/E15C 80 49 BRA $49    [$E1A7] A:0091 X:0000 Y:0000 P:eNvMxdizc - Branch to End
-------------------------------------------------------------------------------------------------------------------------------
$03/E15E AD 02 18 LDA $1802  [$7E:1802] A:0039 X:0000 Y:0000 P:envMxdizC - Load battle background into A.
$03/E161 D0 04 BNE $04    [$E167] A:0000 X:0000 Y:0000 P:envMxdiZC - If not 00 branch to next Field Check. (Field)
$03/E163 A9 5F LDA #$5F A:0000 X:0000 Y:0000 P:envMxdiZC - Load CalmWind into A.
$03/E165 80 40 BRA $40    [$E1A7] A:005F X:0000 Y:0000 P:envMxdizC - Branch to End
--------------------------------------------------------------------------------------------------------------------------------
$03/E167 C9 04 CMP #$04 A:0001 X:0000 Y:0000 P:envMxdizC - Is it Forest, Mountain, or Indoors?
$03/E169 B0 04 BCS $04    [$E16F] A:0001 X:0000 Y:0000 P:eNvMxdizc - If not, branch to next Field Check.
$03/E16B A9 60 LDA #$60 A:0001 X:0000 Y:0000 P:eNvMxdizc - Load AirBlade into A.
$03/E16D 80 38 BRA $38    [$E1A7] A:0060 X:0000 Y:0000 P:envMxdizc - Branch to End.
---------------------------------------------------------------------------------------------------------------------------
$03/E16F C9 07 CMP #$07 A:0004 X:0000 Y:0000 P:envMxdiZC - Is it Cave with Rivers, Moon, or On Board Ship?
$03/E171 B0 04 BCS $04    [$E177] A:0004 X:0000 Y:0000 P:eNvMxdizc - If not, branch to next Field Check
$03/E173 A9 74 LDA #$74 A:0004 X:0000 Y:0000 P:eNvMxdizc - Load ColdMist into A.
$03/E175 80 30 BRA $30    [$E1A7] A:0074 X:0000 Y:0000 P:envMxdizc - Branch to End.
-------------------------------------------------------------------------------------------------------------------------------
$03/E177 C9 07 CMP #$07 A:0007 X:0000 Y:0000 P:envMxdiZC - Is it Watery Caves?
$03/E179 D0 04 BNE $04    [$E17F] A:0007 X:0000 Y:0000 P:envMxdiZC - If not, branch to next Field Check.
$03/E17B A9 9B LDA #$9B A:0007 X:0000 Y:0000 P:envMxdiZC - Load Big Wave into A.
$03/E17D 80 28 BRA $28    [$E1A7] A:009B X:0000 Y:0000 P:eNvMxdizC - Branch to End.
--------------------------------------------------------------------------------------------------------------------------------
$03/E17F C9 08 CMP #$08 A:0008 X:0000 Y:0000 P:envMxdizC - Is it Cave Background?
$03/E181 D0 04 BNE $04    [$E187] A:0008 X:0000 Y:0000 P:envMxdiZC - If not, branch to next Field Check.
$03/E183 A9 A1 LDA #$A1 A:0008 X:0000 Y:0000 P:envMxdiZC - Load (Enemy) Quake into A.
$03/E185 80 20 BRA $20    [$E1A7] A:00A1 X:0000 Y:0000 P:eNvMxdizC - Branch to End.
----------------------------------------------------------------------------------------------------------------------------------
$03/E187 C9 0B CMP #$0B A:0009 X:0000 Y:0000 P:envMxdizC - Is it Desert or Beach?
$03/E189 B0 02 BCS $02    [$E18D] A:0009 X:0000 Y:0000 P:eNvMxdizc - If not, branch to next Field Check.
$03/E18B 80 DE BRA $DE    [$E16B] A:0009 X:0000 Y:0000 P:eNvMxdizc - Loop back to AirBlade Routine.
----------------------------------------------------------------------------------------------------------------------------------
$03/E18D C9 0B CMP #$0B A:000B X:0000 Y:0000 P:envMxdiZC - Is it Sylph Cave/Feymarch?
$03/E18F D0 04 BNE $04    [$E195] A:000B X:0000 Y:0000 P:envMxdiZC - If not, branch to next Field Check.
$03/E191 A9 6F LDA #$6F A:000B X:0000 Y:0000 P:envMxdiZC - Load Breath into A.
$03/E193 80 12 BRA $12    [$E1A7] A:006F X:0000 Y:0000 P:envMxdizC - Branch to End.
--------------------------------------------------------------------------------------------------------------------------------------
$03/E195 C9 0D CMP #$0D A:000D X:0000 Y:0000 P:envMxdizC - Is it Technological Background, Lunar Caverns?
$03/E197 B0 04 BCS $04    [$E19D] A:000D X:0000 Y:0000 P:eNvMxdizc -If not,  branch to Random Choice.
$03/E199 A9 99 LDA #$99 A:000C X:0000 Y:0000 P:eNvMxdizc - Load Thunder into A.
$03/E19B 80 0A BRA $0A    [$E1A7] A:0099 X:0000 Y:0000 P:eNvMxdizc - Branch to End.
-----------------------------------------------------------------------------------------------------------------------------------------
$03/E19D A2 00 00 LDX #$0000 A:000D X:0000 Y:0000 P:envMxdiZC - Load 0000 into X
$03/E1A0 A9 0D LDA #$0D A:000D X:0000 Y:0000 P:envMxdiZC - Load 0D into A
$03/E1A2 20 79 83 JSR $8379  [$03:8379] A:000D X:0000 Y:0000 P:envMxdizC - Jump to RNG.
$03/E1A5 80 BA BRA $BA    [$E161] A:0001 X:0000 Y:0000 P:eNvMxdizc - Loop back to first Field Check.
------------------------------------------------------------------------------------------------------------------------------------------
$03/E1A7 8D D2 26 STA $26D2  [$7E:26D2] A:0091 X:0000 Y:0000 P:eNvMxdizc - Store A in Next Action to take
$03/E1AA 4C 46 CC JMP $CC46  [$03:CC46] A:0091 X:0000 Y:0000 P:eNvMxdizc - Jump to Magic Routine

I think this is probably one of my finest crafted routines, I used every bit of space meticulously and cannot think of a way to shorten it at all.

Now what you can expect from this patch... Rydia will be given the Geomancy skill in this patch in replacement of White Magic and will have it throughout the game. This was a difficult decision. I wanted to give Geomancy to a character with staying power, my initial thought was Rosa, but she's not with you in one or two Geomancy unique areas (Watery Caves comes to mind) my other thought was Cecil, but that just seemed a bit out of character for him, so in the end I went with Rydia. Aside from Rosa she is with Cecil for the most time, Kain has large gaps of being gone and Edge joins pretty late into the fray.

(http://i112.photobucket.com/albums/n198/LastingDawn/Geomancy5png_zps046098e2.png) (http://s112.photobucket.com/user/LastingDawn/media/Geomancy5png_zps046098e2.png.html)

(http://i112.photobucket.com/albums/n198/LastingDawn/Geomancy6_zps8666e805.png) (http://s112.photobucket.com/user/LastingDawn/media/Geomancy6_zps8666e805.png.html)

The battlefields that represent which effect will be used are as follows.

CalmWind (Puts all enemies to sleep) - Field
AirBlade (Deals Wind Elemental Damage) - Forests, Mountains, Indoors, Beach, Desert
ColdMist (Deals Low Ice Elemental Damage) - Caves with Rivers, Moon, On Board Ship
Big Wave (Deals 1/4 of target's life to target.) - Watery Caves
(Enemy) Quake (Deals High Damage)- Caves with Holes
Breath (Causes a multitude of stats effects) - Sylph Cave/Feymarch
Thunder  (Deals 1/4 of target's life to target. Lightning Elemental) - Towers and Giant
Random Choice - Lunar Caverns, Lunar Core, Underworld, Zeromus, Night Battle (in case a hacker wanted to give Edward Geo.)

And that is that! As always, please give me your thoughts on these.

Title: Re: Grimoire LD's Notes, Patches, and Hacks (Patch-Geomancy from FFIII in FFIV!)
Post by: JCE3000GT on January 11, 2014, 04:24:43 PM
Wow, that's pretty cool.  I like it. 
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Patch-Geomancy from FFIII in FFIV!)
Post by: Grimoire LD on January 11, 2014, 05:44:13 PM
Thanks JCE3000GT. Also are my patches, patching correctly? They're working fine for me obviously when I patch them to my roms, I just want to make sure that there's no issue with other v1.1's or anything like that.

I have an idea for the next project (FFIII Sing) but the problem with that is it would be going to Edward... Cecil already has his Break Skills, Sing couldn't be more unfitting for Kain if it tried to be, Rosa already has ArrowStorm and Hunt, and Rydia has Geomancy... Though FFIII's Sing uses a spell on the party which was dependent on the Harp Equipped. That is a neat idea and very easy to implement, but in the normal game you have Edward for maybe an hour or two tops and a scheme to include him in the final party would go a bit beyond a simple Command Upgrade Hack.

Should I just release the Patch with the three new Harps (Five spells) and allow Sing to work with the weapon chosen, even though Edward would only be around to collect one or two of them and let the hackers have their go at it? Or should I put some effort to include Edward into the party in a narrative sense so he can collect and use the other three harps?
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Patch-Geomancy from FFIII in FFIV!)
Post by: chillyfeez on January 11, 2014, 09:09:02 PM
Depends, I'd think...
Would the spells be hard-coded into the command and entirely dependent on specific harps, or would they take spell data from the weapon itself, thereby allowing a hacker to create his/her own new harps that would work with the command?
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Patch-Geomancy from FFIII in FFIV!)
Post by: Grimoire LD on January 11, 2014, 09:20:41 PM
That is difficult to say... It was planned to be a CMP/BNE fest, but your ideas sounds Much more appealing. The only issue is that then they would be able to cast it from the weapon itself... unless the visual byte is read instead.... even some weapons in the final game have some visuals attached to weapons without abilities any longer. This might even lend itself well to Magic Weapons that don't need to use their spell from the weapon!

This has really got me thinking Chillyfeez, thank you for simple, but poignant advice. I think I might want to try it your way. With just that I really might be able to exchange the normal Sing formula for a much smaller formula like Boast or Cry. (Load Weapon Visual), (Store it in Next Action to Take) and you're done. And this will free up the fairly large Sing formula for something on a grander scale.

 :edit: Or I could be Smart and realize that Spells at 0 Power do Not Activate! Which means you can tie any spell to any weapon, if it has 0 power it cannot activate. Thank you very much Square! This was some pretty good foresight on your part.

That makes this much simpler.

Title: Re: Grimoire LD's Notes, Patches, and Hacks (Patch-Geomancy from FFIII in FFIV!)
Post by: Grimoire LD on January 12, 2014, 02:48:31 AM
While getting ready to put the finishing touches on Sing (Harp Dependent) I noticed that the Slot command, A6 I was using didn't necessarily correspond to the stored weapon selection. Instead that uses some numerical slot rather than place in data.

Now I think I'm just missing this numerical slot command, I don't recall seeing it anywhere. Do you happen to know what the other Slot commands are Chillyfeez? In this case it would be in regards to placement, not order from 7E2000. Because as it stands now Sing would only reliably be able to be used if you have the Singer in a correct slot in data which corresponds to where his weapon is. (For instance, I have Edward in Slot3, but I only have two characters at the moment, so his data doesn't read the area correctly). If Edward is in any of the normal slots, then its fine, but when he's not the command doesn't work (it will read 00's into the Magic Routine, which is just "Nothing Happened".

Title: Re: Grimoire LD's Notes, Patches, and Hacks (Patch-Geomancy from FFIII in FFIV!)
Post by: chillyfeez on January 12, 2014, 05:05:35 AM
I'm having trouble visualizing what you're saying. Can you post the code for the command as is so far?
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Patch-Geomancy from FFIII in FFIV!)
Post by: Grimoire LD on January 12, 2014, 11:56:29 AM
Yeah, it was... nearly 4 AM when I wrote that and needed to head to bed, haha! Let me get the code for you then. It's a very simple piece of work, actually...

Code: [Select]
$03/E900 A5 A6 LDA $A6    [$00:00A6] A:0000 X:0010 Y:0000 P:envMxdizc - Load Caster's Current Slot into A.
$03/E902 AA TAX A:0000 X:0010 Y:0000 P:envMxdiZc - Transfer A to X.
$03/E903 D0 1F BNE $1F    [$E924] A:0000 X:0000 Y:0000 P:envMxdiZc - If not 00 branch to next Slot Check.
-------------------------------------------------------------------------------------------------------------------
$03/E905 7B TDC A:0000 X:0000 Y:0000 P:envMxdiZc - Set A to 00 (It's all I've ever seen this instruction used for)
$03/E906 AA TAX A:0000 X:0000 Y:0000 P:envMxdiZc - Transfer A to X.
$03/E907 E8 INX A:0000 X:0000 Y:0000 P:envMxdiZc - +1 X
$03/E908 E8 INX A:0000 X:0001 Y:0000 P:envMxdizc - +1 X
$03/E909 7B TDC A:0000 X:0002 Y:0000 P:envMxdizc - Clear A (from when returning from loops.)
$03/E90A AD 80 26 LDA $2680  [$7E:2680] A:0000 X:0002 Y:0000 P:envMxdiZc - Load Character ID.
$03/E90D C9 60 CMP #$60 A:0085 X:0002 Y:0000 P:eNvMxdizc - Is it below 60? (Thereby, left handed)
$03/E90F 90 08 BCC $08    [$E919] A:0085 X:0002 Y:0000 P:envMxdizC - Branch to Left Handed version of this.
$03/E911 BD D9 32 LDA $32D9,x[$7E:32DB] A:0085 X:0002 Y:0000 P:envMxdizC - Load Equipped Weapon Right Hand into A.
$03/E914 CD B3 26 CMP $26B3  [$7E:26B3] A:0044 X:0002 Y:0000 P:envMxdizC - Is it the same as the Equipped Weapon according to Main Stats?
$03/E917 F0 05 BEQ $05    [$E91E] A:0044 X:0002 Y:0000 P:envMxdiZC - If so branch to Magic Implement.
----------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E919 CD B5 26 CMP $26B5  [$7E:26B5] A:0040 X:0002 Y:0000 P:eNvMxdizc - Does the weapon match what is in the Left Hand?
$03/E91C D0 E9 BNE $E9    [$E907] A:0040 X:0002 Y:0000 P:envMxdizC - If not, loop back to above branch.
-------------------------------------------------------------------------------------------------------------------------------------------------------
$03/E91E E8 INX A:0044 X:0002 Y:0000 P:envMxdiZC +1 to X.
$03/E91F BD D9 32 LDA $32D9,x[$7E:32DC] A:0044 X:0003 Y:0000 P:envMxdizC - Load A from Equipped Weapon+1 (thereby the Spell)
$03/E922 80 23 BRA $23    [$E947] A:0001 X:0003 Y:0000 P:envMxdizC - Branch to Finishing Routine.
------------------------------------------------------------------------------------------------------------------------------------------
$03/E924 E0 80 00 CPX #$0080 A:0080 X:0080 Y:0000 P:envMxdizc - Is it 0080? (Slot 2)
$03/E927 D0 05 BNE $05    [$E92E] A:0080 X:0080 Y:0000 P:envMxdiZC - If not, branch to next Slot Check.
$03/E929 A2 08 00 LDX #$0008 A:0080 X:0080 Y:0000 P:envMxdiZC - Load 0008 into X (to keep pace with the location of the weapons. 8 bytes per character 4 bytes per hand.)
$03/E92C 80 D9 BRA $D9    [$E907] A:0080 X:0008 Y:0000 P:envMxdizC - Loop back to main finding routine above.
----------------------------------------------------------------------------------------------------------------------------------------------------
$03/E92E E0 00 01 CPX #$0100 A:0100 X:0100 Y:0000 P:envMxdizC - Is it 0100? (Slot 3)
$03/E931 D0 05 BNE $05    [$E938] A:0100 X:0100 Y:0000 P:envMxdiZC - If not branch to next Slot Check.
$03/E933 A2 10 00 LDX #$0010 A:0100 X:0100 Y:0000 P:envMxdiZC - Load 0010 into X.
$03/E936 80 CF BRA $CF    [$E907] A:0100 X:0010 Y:0000 P:envMxdizC - Loop back to main finding routine.
---------------------------------------------------------------------------------------------------------------------------------------------
03/E938 E0 80 01 CPX #$0180 A:0180 X:0180 Y:0000 P:envMxdizC - Is it 0180? (Slot 4)
$03/E93B D0 05 BNE $05    [$E942] A:0180 X:0180 Y:0000 P:envMxdiZC - If not branch to next Slot Check.
$03/E93D A2 18 00 LDX #$0018 A:0180 X:0180 Y:0000 P:envMxdiZC - Load 0018 into X.
$03/E940 80 C5 BRA $C5    [$E907] A:0180 X:0018 Y:0000 P:envMxdizC - Loop back to main finding routine.
-----------------------------------------------------------------------------------------------------------------------------------------
$03/E942 A2 20 00 LDX #$0020 A:0200 X:0200 Y:0000 P:envMxdizC Load 0020 into X  (Slot 5)
$03/E945 80 C0 BRA $C0    [$E907] A:0200 X:0020 Y:0000 P:envMxdizC  - Loop back to main finding routine.
$03/E947 8D D2 26 STA $26D2  [$7E:26D2] A:0001 X:0003 Y:0000 P:envMxdizC - Store Spell in Next Action to take.
$03/E94A 4C 3E CD JMP $CD3E  [$03:CD3E] A:0001 X:0003 Y:0000 P:envMxdizC - Jump to Magic Routine.


I hope that makes it a little clearer. The entire method of this routine is to look for the proper slot the character is in, calculate the amount of extra X that is needed to reach the weapon to go through the main loop at the start.

7E32DA is composed of 40 Bytes (In decimal) 4 for each hand. Now the order doesn't correspond to ID Slot (as in 7E2000-2080-etc.) as most matters are but is dependent on the location slot and will change location in that regards. The problem is I'm not sure what that corresponding might be... Unless... hmm...

352F appears to be my answer in this case. Let's try it out...

 :edit: That did the trick! Now my only issue is whether the Comparisons to Equipped Weapon is really necessary. If I get rid of those bytes I might be able to work in some FFIII like functionality by looking at the User's Will and using the spell twice as a result.

 :edit: They are not. That should give me enough room at the end to do something special with this.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Patch-Geomancy from FFIII in FFIV!)
Post by: chillyfeez on January 12, 2014, 03:21:21 PM
So... You're good, then?
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Patch-Geomancy from FFIII in FFIV!)
Post by: Grimoire LD on January 12, 2014, 03:47:02 PM
Alright! Now that this debacle is done (it wasn't really a debacle, I learned a lot about properly using loops and where to look for assigned slots) I can release the FFIII Sing patch.

First off the code, it differs fairly significantly than what was in the last post in some key sections that were shortened when old pieces didn't work to what the new code needed.

There was one piece I couldn't working optimally and that's because of the lack of space to do so, in FFIII NES, an ability of the Bard is Cheer which raises Atk based on the amount of Cheers used. Now unfortunately there isn't enough space for me to have this run through all of the slots, so I had to go with having it only raise the Singer's Attack by 5 each time he or she sings, I couldn't get the reference to FFIII NES to fit in the amount of space I had left to use, unfortunately.

I'll post the finalized code and patch soon enough.

Yeah, I should be fine. I think.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Patch-Geomancy from FFIII in FFIV!)
Post by: Grimoire LD on January 12, 2014, 07:37:44 PM
I hate to say it, but this is probably one of the only routines I've made that I am not 100% proud of. I really wanted to get an effect similar to FFIII Cheer, but I didn't have the space required for a look at every character's battle data with loops. Regardless the heart of this will be what will make a future "Magic Weapons" work. I just need to re-point the Fight Command to either empty space or another command, load in a jump to the fight routine and then plug in what I used for much of the Sing-Harp Routine, and that's that. That will be my next endeavor though.

Sing-Harp Dependent Code

Code: [Select]
$03/E900 AD 2F 35 LDA $352F  [$7E:352F] A:0003 X:0010 Y:0000 P:envMxdizc - Load Singer's Slot into A.
$03/E903 AA TAX A:0003 X:0010 Y:0000 P:envMxdizc - Transfer A to X.
$03/E904 D0 16 BNE $16    [$E91C] A:0000 X:0000 Y:0000 P:envMxdiZc - If not Slot 0 (Middle) branch to Slot Checking
$03/E906 7B TDC A:0000 X:0000 Y:0000 P:envMxdiZc - Set A to 00.
$03/E907 AA TAX A:0000 X:0000 Y:0000 P:envMxdiZc - Transfer A to X.
-------------------------------(Looping Point)-----------------------------------------------------------------
$03/E908 E8 INX A:0000 X:0000 Y:0000 P:envMxdiZc - +1 to X.
$03/E909 7B TDC A:0000 X:0001 Y:0000 P:envMxdizc - Set A to 00
$03/E90A AD 80 26 LDA $2680  [$7E:2680] A:0000 X:0001 Y:0000 P:envMxdiZc - Load Character's ID into A.
$03/E90D C9 60 CMP #$60 A:0085 X:0001 Y:0000 P:eNvMxdizc - Are they left handed?
$03/E90F 90 02 BCC $02    [$E913] A:0085 X:0001 Y:0000 P:envMxdizC - If so, branch to +4 X branch.
$03/E911 80 02 BRA $02    [$E915] A:0085 X:0001 Y:0000 P:envMxdizC - Branch to Spell Loading.
--------------------------------------------------------------------------------------------------------------------------------------------------
E8 E8 (+2 X) (This allows a left handed character to reach their weapon check.)
------------------------------------------------------------------------------------------------------------------------------------------------
$03/E915 E8 INX A:0085 X:0001 Y:0000 P:envMxdizC - +1 to X
$03/E916 E8 INX A:0085 X:0002 Y:0000 P:envMxdizC - +1 to X.
$03/E917 BD DA 32 LDA $32DA,x[$7E:32DD] A:0085 X:0003 Y:0000 P:envMxdizC - Load A from Character's Weapon Spell.
$03/E91A 80 20 BRA $20    [$E93C] A:009F X:0003 Y:0000 P:eNvMxdizC - Branch to +5 Power Branch.
-------------------------------------------------------------------------------------------------------------------------------------------------
$03/E91C C9 01 CMP #$01 A:0001 X:0001 Y:0000 P:envMxdizc - Is it Slot 2 (Top Spot)
$03/E91E D0 05 BNE $05    [$E925] A:0001 X:0001 Y:0000 P:envMxdiZC - If not branch to next Slot Check.
$03/E920 A2 08 00 LDX #$0008 A:0001 X:0001 Y:0000 P:envMxdiZC - Load 0008 into A (To reach Weapon Spell)
$03/E923 80 E3 BRA $E3    [$E908] A:0001 X:0008 Y:0000 P:envMxdizC - Loop back to Weapon Spell Loading
-------------------------------------------------------------------------------------------------------------------------------------------------
$03/E925 C9 02 CMP #$02 A:0002 X:0002 Y:0000 P:envMxdizC - Is it Slot 3? (Bottom Spot)
$03/E927 D0 05 BNE $05    [$E92E] A:0002 X:0002 Y:0000 P:envMxdiZC - If not, branch to next Slot Check.
$03/E929 A2 10 00 LDX #$0010 A:0002 X:0002 Y:0000 P:envMxdiZC - Load 0010 into A (To reach Weapon Spell)
$03/E92C 80 DA BRA $DA    [$E908] A:0002 X:0010 Y:0000 P:envMxdizC - Loop back to Weapon Spell Loading.
-----------------------------------------------------------------------------------------------------------------------------------------------
$03/E92E C9 03 CMP #$03 A:0003 X:0003 Y:0000 P:envMxdizC - Is it Slot 4? (Upper Middle)
$03/E930 D0 05 BNE $05    [$E937] A:0003 X:0003 Y:0000 P:envMxdiZC - If not branch to next Slot Check.
$03/E932 A2 18 00 LDX #$0018 A:0003 X:0003 Y:0000 P:envMxdiZC - Load 0018 into A (To reach Weapon Spell)
$03/E935 80 D1 BRA $D1    [$E908] A:0003 X:0018 Y:0000 P:envMxdizC - Loop  to Weapon Spell Loading.
--------------------------------------------------------------------------------------------------------------------------------------------
$03/E937 A2 20 00 LDX #$0020 A:0004 X:0004 Y:0000 P:envMxdizC - Load 0020 into X (To reach Weapon Spell)
$03/E93A 80 CC BRA $CC    [$E908] A:0004 X:0020 Y:0000 P:envMxdizC - Loop to Weapon Spell Loading.
---------------------------------------------------------------------------------------------------------------------------------------------
$03/E93C 48 PHA A:009F X:0003 Y:0000 P:eNvMxdizC - Push A onto Stack.
$03/E93D AD 9D 26 LDA $269D  [$7E:269D] A:009F X:0003 Y:0000 P:eNvMxdizC - Load Singer's Physical Attack into A.
$03/E940 69 05 ADC #$05 A:0066 X:0003 Y:0000 P:envMxdizC - Add + 05
$03/E942 8D 9D 26 STA $269D  [$7E:269D] A:006C X:0003 Y:0000 P:envMxdizc - Store A in Singer's Physical Attack.
$03/E945 68 PLA A:006C X:0003 Y:0000 P:envMxdizc - Pull A from Stack (Spell Chosen)
$03/E946 8D D2 26 STA $26D2  [$7E:26D2] A:009F X:0003 Y:0000 P:eNvMxdizc - Store A in Next Action to Take.
$03/E949 4C 3E CD JMP $CD3E  [$03:CD3E] A:009F X:0003 Y:0000 P:eNvMxdizc - Jump to Magic Routine.
------------------------------------------------------------------------------------------------------------------------------------------

I made some space (was left with 5 spare bytes) but not enough, I'm afraid...



Enough about the future though, let's talk about now. This patch will make Sing:
A - Target All Allies.
B - Use a Spell dependent on the Harp Equipped (Note: If spells have 0 Power from the weapon they cannot be used successfully from the Item Menu, (there may be exceptions) but can be easily used for other purposes. Which is what this routine is built upon)
C - Will raise the Singer's Physical Attack by 5 each time you use Sing.

Now because FFIII is the theme, this tries its best to try and mimic the effects from the FFIII DS's Harps because of this there are now three new harps in replacement of two axes (will use the empty slot that was used as the Dark Crystal Sword in my other patch as well)


Sing Effect -
Madhura Harp - Casts Protect
Dream Harp - Casts Remedy (10% Max HP recovery)
Apollo Harp - Casts Shell
Loki Harp - Casts Haste
Lamia Harp - Casts Angelic(Music) - Restores a small amount of MP per cast.


Paladin Cecil will be able to Sing and equip Harps (only because I'm out of usable spots to give it to anyone else and Kain singing is a little silly...ier than Cecil.) and I plan on each of my patches being stackable.) so don't throw those Harps away when Edward leaves!

You will be able to get Loki Harps as Uncommon and Rare drops from Moon enemies. Full party Haste with no downside, can't complain with that, no?

(http://i112.photobucket.com/albums/n198/LastingDawn/Harp-Sing2_zpsa2573a7e.png) (http://s112.photobucket.com/user/LastingDawn/media/Harp-Sing2_zpsa2573a7e.png.html)

(http://i112.photobucket.com/albums/n198/LastingDawn/Harp-Sing_zps14a52fa3.png) (http://s112.photobucket.com/user/LastingDawn/media/Harp-Sing_zps14a52fa3.png.html)



Title: Re: Grimoire LD's Notes, Patches, and Hacks (Patch-FFIII Style Sing in FFIV!)
Post by: LordGarmonde on January 12, 2014, 11:47:16 PM
Though not in reference in anything particular take this as more of a general response to your efforts as of late: In the words of Michael J. Fox: (during his appearance on Scrubs)

"I believe the words you're looking for are 'holy crap.'"

- So yeah - Holy crap dude! And of course I mean that in the best way possible! You =  :yabin:

I've been thinking that for a while but  what put me over was seeing your use of Fission for Backfire. I LOLed with that one: that was one of the first things I tried with FF4kster: only in my case it wsa an ability I was testing out with Palom to simulate his overreaching a bit. I took Sing and replaced the calls with Fire 1,2,3 and Fission - with responses of "Lame...", "I guess", "ALRIGHT!", & "uh-oh..."

So yeah - LOL  :childish:

That said, great job! Hopefully I'll be able to carve out a bunch more space in the ROM so you can really go nuts - see upcoming post on "Apropos..."  :wink:
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Patch-FFIII Style Sing in FFIV!)
Post by: Grimoire LD on January 13, 2014, 11:26:22 PM
Thanks LordGarmonde! I needed to finish up all of my planned major projects before... today came, and I succeeded and even threw in FFIII Sing for good measure. Starting from today (well now yesterday) though I have a punishing assortment of classes, American Literature then Environmental Sciences, then four hours later Teaching Techniques for the Classroom and eventually will need to do some on-site observation again. Tuesdays and Thursdays should be a bit of a relaxer though. I only have one class each those days which is World Literature 2. So... busier schedule than I've ever had. Likely don't expect me to see post too much on Mondays, hehe.

I have a scheme to get Magic Weapons working, something odd happens when that 352F value (Slot Value) is connected to normal attacks rather than skills and it's no longer accurate because of it. I'll have to take my Sing routine and make it look at a different pointer which refers to character's equipment rather than what they currently have equipped. Needles to say, my original plans for it didn't work out.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Patch-FFIII Style Sing in FFIV!)
Post by: LordGarmonde on January 14, 2014, 02:32:29 AM
That's quite the class-load; best of luck. I'll never hold against you not posting - you do more than your fair share, you've got big buffer built up.

As for you pointer problem - G.I. Joe says knowing is half the battle; there's a way to be found.  :finger:
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Patch-FFIII Style Sing in FFIV!)
Post by: Grimoire LD on January 15, 2014, 01:09:57 AM
Finally after hours of searching I located where the game in a default sense stores Weapon Info. in LoROM and draws it into RAM once battle begins!

This is excellent. Every other attempt to set up a semblance of sense with my Magic Weapons Routines failed Miserably, but now I have a firm starting point and an end point, with this I should even be able to improve my Sing-Harp Dependent. I just need to take the default Magic Weapon Routine as seen...

Code: [Select]
$03/EBDE BF 70 90 0F LDA $0F9070,x[$0F:9077] A:0007 X:0007 Y:0000 P:envMxdizc - Load A from 0F9070+X. (Spell's Power as designated by weapon)
$03/EBE2 8D EC 38 STA $38EC  [$7E:38EC] A:0001 X:0007 Y:0000 P:envMxdizc - Store A in 7E38EC. - Store A in Spell Power.
$03/EBE5 EE EB 38 INC $38EB  [$7E:38EB] A:0001 X:0007 Y:0000 P:envMxdizc - +1 to 7E38EB. - +1 to Ignore Accuracy. (Thereby ignoring the accuracy of the weapon spell)
$03/EBE8 A0 03 00 LDY #$0003 A:0001 X:0007 Y:0000 P:envMxdizc - Load 0003 into Y. (To get to the Spell)
$03/EBEB B1 80 LDA ($80),y[$7E:32E9] A:0001 X:0007 Y:0003 P:envMxdizc - Load A from Character's Hand Data - Spell.
$03/EBED 8D D2 26 STA $26D2  [$7E:26D2] A:0048 X:0007 Y:0003 P:envMxdizc - Store A in 7E26D2.
$03/EBF0 80 03 BRA $03    [$EBF5] A:0048 X:0007 Y:0003 P:envMxdizc - Branch to 03EBF5.
------------------------------------------------------------------------------------------------------------------------------------
$03/EBF2 EE 2A 35 INC $352A  [$7E:352A] A:0000 X:0002 Y:0000 P:envMxdiZC - +1 to 7E352A.
$03/EBF5 20 3E CD JSR $CD3E  [$03:CD3E] A:0000 X:0002 Y:0000 P:envMxdizC - Jump to Subroutine (Magic Call)
$03/EBFB F0 03 BEQ $03    [$EC00] A:0000 X:0680 Y:001A P:envMxdiZC - Branch if 00 to EC00.

Here. This accomplishes in roughly 30 (hex) bytes what it took me nearly double that to figure out. This is something I should have been looking at from the start. How to set it up is very simple when this is used as a template. Ignoring pointers, and all of that sorry business, all this formula will need to do this...


Check for character's handedness.
----------------------------------
If Right Hand - Read Character's Weapon
If 00 Return
-------------------------------
Reset Processor Status (Allows A to read two bytes)
Load Character's Weapon (+x to reach left hand)
LSR x3 = (Equals 8 times its value, lucky for us this section of rom stores items in 8 byte values!)
Add +03 to A
Transfer A to X
Load Address 0F9100+X (To reach Weapon Spell) into A
Store A in Next Action to take
Set Processor Status
Jump to Magic Routine.
-----------------------------------
If Left Handed read Weapon Number.
If it is 00 Return
------------------------------------
 branch to LSR routine above.

And this idea worked flawlessly! The code is so much cleaner and compact that I should be able to add a Slot Check to my previous Sing-Harp Dependent code.

It is late, tomorrow I have school, but I will leave you with a picture of my success...

(http://i112.photobucket.com/albums/n198/LastingDawn/MagicWeapons1_zps001971d3.png) (http://s112.photobucket.com/user/LastingDawn/media/MagicWeapons1_zps001971d3.png.html)

(http://i112.photobucket.com/albums/n198/LastingDawn/MagicWeapons2_zps894498f1.png) (http://s112.photobucket.com/user/LastingDawn/media/MagicWeapons2_zps894498f1.png.html)


Once I stopped looking for Pointers everything fell right into place. Expect a Weapon Magic Activates with Attack Patch tomorrow!
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Patch-FFIII Style Sing in FFIV!)
Post by: LordGarmonde on January 15, 2014, 03:21:31 AM
That school better look out for you - you continue to ace the course in kickassery over here :wink:

Enjoy your win; you earned it!

I was about to ask a follow up - but I don't have to: you nailed it  :banonsmash:

Different followup did come to mind: Certainly not a problem in this case (unless there's something you neglected to tell me) but how does the game interpret two handed weapons? (apologies if I missed the answer somewhere) Looking at your algorithm my first thought was "Hmm...so what about that Poison Axe...would that get read twice" which became "No, stupid - he said look at the character's handedness" - so then I'm left with "What about Edge & Yang, would they read twice?" If I gave Yang two Ice Claws and I wanted to build something off of that: not sure what, but I'm sure you could dream up something :P - But how would that work? I feel like I must be missing something because in trying to work it out I can't pinpoint the exact course of action:

I swear it was a simple question when I clicked "Reply..." For me to to try and work it out in my head I have your code split into 5 sections:

(ST = Start Turn), (RH = R-Hand Check), (LH = L-Hand Check), (CA = Calculate, etc.), & (ET = End Turn)

Would the order be:

Path A)   ST --> RH (True) --> CA --> ET
or
Path B)   ST --> RH (True) --> CA --> LH (True) --> CA --> ET
The actual code looks (to me) like Path A - but the description looks like Path B    me = :blits:
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Patch-FFIII Style Sing in FFIV!)
Post by: Pinkpuff on January 15, 2014, 03:53:43 AM
So will this patch make it so that you:

* Cast instead of physical damage? (so, attacking with ice rod never causes physical damage and always casts Ice-1)
* Cast in addition to physical damage, always? (so attacking with the ice rod always causes physical damage and always casts Ice-1)
* Cast in addition to physical damage, sometimes? (so attacking with the ice rod always causes physical damage but may or may not cast Ice-1)
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Patch-FFIII Style Sing in FFIV!)
Post by: LordGarmonde on January 15, 2014, 04:18:01 AM
A couple other things that came to mind:

Paladin Cecil will be able to Sing and equip Harps (only because I'm out of usable spots to give it to anyone else and Kain singing is a little silly...ier than Cecil.)

 - He does have his unused casting animation - maybe he was born to sing - perhaps that's where he's falling short with Rosa   :wink:

...and I plan on each of my patches being stackable.

- Just thinking about keeping all that organized hurt me in the brain-box: but quite sincerely I have no doubts you; but best of luck there all the same - and if I can somehow help I'd certainly like to  :happy:

Hopefully when I get the Exp/TNL mod going my hope is to leave you with more room than even you know what to do with - yes, I know it's not that much :tongue:

But I did have an idea: You're down to Cecil & Kain as the only ones with room left. What if skills were not fixed? FF5 popped into mind: << [Fight] / [Skill] / [Empty] / [Item] >> I'm certainly not suggesting going as far as that game did - but what if say in each town (maybe in the Training Room) - someone is hanging out with a unique skill to offer: something like "OK Kain - your voice is terrible - I say forget [Sing] - learn [Kick] instead - sound good? [Yes/No]"

I don't know - but I think it's a thought experiment worth the time. The pointer for the currently learned skill would have to be stored somewhere in the RAM, not sure where to most easily work it in - but Phoenix really went after that problem for the Shadow Data - and as to where exactly it failed if my mod doesn't bypass the problem I'd bet you could tie up that loose end.

- Another thought would be the storage points for the Event Flags; take out one of the Behemoth battles in Bahamut's Cave and there's a freebee - or hijack some of the code that checks the Flags and consolidate: 3 Behemoths (A,B,C) need only 8 index values to describe every combination (2^3 *) for if allowed to encounter them in any order: or only 4 if it must be A->B->C (how many are dead, 0,1,2,or 3?) - But then you only need one Byte for all 3 - there's always some way

* My brain refuses to memorize that: CP - Choices to the Power of People - 2 choices, 3 people - Instead I take "the scenic route..."
   all yes + all no = 2 & 3 singles = 5 & 3 pairs = 8  - thus leaving efficiency to be approximately  :sad:
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Patch-FFIII Style Sing in FFIV!)
Post by: Grimoire LD on January 15, 2014, 07:56:01 AM
That school better look out for you - you continue to ace the course in kickassery over here :wink:

Enjoy your win; you earned it!

I was about to ask a follow up - but I don't have to: you nailed it  :banonsmash:

Different followup did come to mind: Certainly not a problem in this case (unless there's something you neglected to tell me) but how does the game interpret two handed weapons? (apologies if I missed the answer somewhere) Looking at your algorithm my first thought was "Hmm...so what about that Poison Axe...would that get read twice" which became "No, stupid - he said look at the character's handedness" - so then I'm left with "What about Edge & Yang, would they read twice?" If I gave Yang two Ice Claws and I wanted to build something off of that: not sure what, but I'm sure you could dream up something :P - But how would that work? I feel like I must be missing something because in trying to work it out I can't pinpoint the exact course of action:

I swear it was a simple question when I clicked "Reply..." For me to to try and work it out in my head I have your code split into 5 sections:

(ST = Start Turn), (RH = R-Hand Check), (LH = L-Hand Check), (CA = Calculate, etc.), & (ET = End Turn)

Would the order be:

Path A)   ST --> RH (True) --> CA --> ET
or
Path B)   ST --> RH (True) --> CA --> LH (True) --> CA --> ET
The actual code looks (to me) like Path A - but the description looks like Path B    me = :blits:

I should have been clearer, that code above is drawn straight from the Item Routine in regards to Spell Weapons which was an initial inspiration but in the end my code turned out to be a... little different.

Ah, Ambidextrous would look at Right Hand. As in my original code for Sing-Dependent Harp it looks at 60 as the Dividing Line, no Left Handed ID goes up that high and no Right Handed character starts that low. It is indeed Path B. Check if Right Hand is Applicable, if not, Check Left Hand. (This is nothing new for FFIV, even the original code has Right Hand Priority in some cases, Edge with Boomerang in Right Hand for full damage from back-row with Katana in Left Hand comes immediately to mind. (At the end of this I'm going to need to Completely rewrite the tutorial rooms to make mention of all the new things, hehe.)

So will this patch make it so that you:

* Cast instead of physical damage? (so, attacking with ice rod never causes physical damage and always casts Ice-1)
* Cast in addition to physical damage, always? (so attacking with the ice rod always causes physical damage and always casts Ice-1)
* Cast in addition to physical damage, sometimes? (so attacking with the ice rod always causes physical damage but may or may not cast Ice-1)

This patch will make is so that it is C - Cast in Addition to Physical Damage, Sometimes (Either a straight 25% or possibly basing it on Wisdom in some way) What you see above was just a proof of concept to see if it would all fall together smoothly and it worked marvelously. After the successful "does it have magic" check it will be run through an RNG with a CMP 19 (25) and return if it reads more than 25. (Base 25 seems best, if its based on Wisdom the more Magically Apt characters could have it more, but it makes it only decent chances near end game.) then casts the spell if it succeeds.

A couple other things that came to mind:

Paladin Cecil will be able to Sing and equip Harps (only because I'm out of usable spots to give it to anyone else and Kain singing is a little silly...ier than Cecil.)

 - He does have his unused casting animation - maybe he was born to sing - perhaps that's where he's falling short with Rosa   :wink:

...and I plan on each of my patches being stackable.

- Just thinking about keeping all that organized hurt me in the brain-box: but quite sincerely I have no doubts you; but best of luck there all the same - and if I can somehow help I'd certainly like to  :happy:

Hopefully when I get the Exp/TNL mod going my hope is to leave you with more room than even you know what to do with - yes, I know it's not that much :tongue:

But I did have an idea: You're down to Cecil & Kain as the only ones with room left. What if skills were not fixed? FF5 popped into mind: << [Fight] / [Skill] / [Empty] / [Item] >> I'm certainly not suggesting going as far as that game did - but what if say in each town (maybe in the Training Room) - someone is hanging out with a unique skill to offer: something like "OK Kain - your voice is terrible - I say forget [Sing] - learn [Kick] instead - sound good? [Yes/No]"

I don't know - but I think it's a thought experiment worth the time. The pointer for the currently learned skill would have to be stored somewhere in the RAM, not sure where to most easily work it in - but Phoenix really went after that problem for the Shadow Data - and as to where exactly it failed if my mod doesn't bypass the problem I'd bet you could tie up that loose end.

- Another thought would be the storage points for the Event Flags; take out one of the Behemoth battles in Bahamut's Cave and there's a freebee - or hijack some of the code that checks the Flags and consolidate: 3 Behemoths (A,B,C) need only 8 index values to describe every combination (2^3 *) for if allowed to encounter them in any order: or only 4 if it must be A->B->C (how many are dead, 0,1,2,or 3?) - But then you only need one Byte for all 3 - there's always some way

* My brain refuses to memorize that: CP - Choices to the Power of People - 2 choices, 3 people - Instead I take "the scenic route..."
   all yes + all no = 2 & 3 singles = 5 & 3 pairs = 8  - thus leaving efficiency to be approximately  :sad:

Haha! While Kain does have an unused Magic Animation, I couldn't see someone giving up Kain's Almighty Jump to have him use any spell from the Harp that wasn't Angelic Song or Full-Party Haste. Whereas with Cecil they might be encouraged to use some of the other magics, for no other reason than the +5 Attack that the party will receive, in a stackable sense.

Unfortunately with commands... they handled them in a pretty terrible way in FFIV...

1. They are read from Rom. Every battle they are reset to what they look like in Rom's specifications. If you make a change to this, you make a change Permanently to that character that even a New Game Start won't erase. I toyed with the idea of the Apples and Drop being able to teach a Character a Command if they had a Command Slot of FF anywhere in their information. And while this would work it would cause the issue as labelled above.

2. They are tied to Actor in a way that I'm not 100% sure I've ever really looked at.

Now if we could find some free space in RAM to copy down this data (an excellent application of the free space your Experience mod will bring) and with the pointers on hand that should be able to solve that dastardly problem. Until then though, it is a bit unfeasible,
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Patch-FFIII Style Sing in FFIV!)
Post by: LordGarmonde on January 15, 2014, 09:18:15 AM
Damn it Square  :wtf:

I'd like to read about new commands in the training room - I already know how to save the game  :wink:

I'm going to think about the command swapping some more - but in the meantime allow, if you will, my feelings on that to be best expressed through the words of HCBailly:   "GAME...!!!"
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Patch-FFIII Style Sing in FFIV!)
Post by: Grimoire LD on January 15, 2014, 04:38:33 PM
My thoughts exactly LordGarmonde, that said when in battle you can switch commands on the fly (I'm not 100% sure on displayed name yet though). So you could potentially make a mod with a Command called "(Sword-symbol)Skil" with the Sword only meaning "Battle" and have that routine look at the weapon you have equipped and give you a skill regarding that...

For instance, you have Claw equipped, you get Kick. Rod-Boast, Staff-Pray, Sword/Hammer-Focus (couldn't think of any default choice better), Maybe the normal swords would impart Dark Wave, while the Light Swords would give Focus, Spears-Jump, Katana/Boomerangs-Throw, Knife-Steal, Whip-Recall, Axe-Gird, Harp-Sing, Bow-Aim...

Granted these would all be going to a special character and hopefully not one of the normal characters who would already have one of these skills.

Maybe I'll think about that down the line.


Well I am pleased to announce that Magic Weapons is complete! A full routine that only ended up being 38 bytes when all was said and done.

I know I say this a lot but This is my Finest work yet. With the most applications in any normal sense.

Now there are a few... oddities... to this whole process.

First, the damage you deal is not 100% accurate to what you're Actually dealing. It's ordinarily a little more. and I'm not sure how it is calculated. I know that it's not ignoring the Weapon Damage or the Spell.(though for curing or buffing spells things get a little strange.)

Second, when a Spell Misses its target the normal weapon damage swing may show elsewhere, most likely on another enemy. However the damage will show on the enemy you are properly aiming towards.

Thirdly, this is only Single Target enemies. Anything more would have been a bit too powerful in my opinion.

Fourthly - Curing Spells will Not Work Period. They are turned into Damage, even spell formulas that don't ordinarily do damage deal a small amount of damage, interestingly enough. This does have interesting applications... say you combine my Sing-Harp Dependent Hack with this patch, you would see that yes, Edward is casting beneficial spells on the foe, but what you might find interesting, especially with the Dream Harp in particular. Instead of recovering 1/10 of their Max HP, you're actually Dealing 1/10 of their Max HP. This also applies to Party Members. Granted you Can attack say... Kain with the Madhura Harp and cast Protect on him (if you're lucky), you would hurt him a bit and Protect would deal an extra damage or 2, but it would effect him as if he were hit by the spell.

Fifthly - The damage dealt is dependent on your own Wisdom and Will. The Weapon's Spell Power itself is not taken into account. This means that attacking with the Ice Rod for instance may be more beneficial in the hopes of activating the Magic Weapon  instead of a mediocre spell multiplier from the Weapon itself, as shown here...

(http://i112.photobucket.com/albums/n198/LastingDawn/MagicWeapons7_zps533efd57.png) (http://s112.photobucket.com/user/LastingDawn/media/MagicWeapons7_zps533efd57.png.html)

(http://i112.photobucket.com/albums/n198/LastingDawn/MagicWeapons8_zps7131ee6b.png) (http://s112.photobucket.com/user/LastingDawn/media/MagicWeapons8_zps7131ee6b.png.html)

With this all in mind, let's get to the code!

Magic Weapons Routine

Code: [Select]
$03/FF33 AD 80 26 LDA $2680  [$7E:2680] A:0000 X:0680 Y:001A P:envMxdiZC - Load Handedness into A.
$03/FF36 C9 60 CMP #$60 A:0085 X:0680 Y:001A P:eNvMxdizC - Is it Left Handed?
$03/FF38 90 26 BCC $26    [$FF60] A:0085 X:0680 Y:001A P:envMxdizC - If so branch to Left Hand portion.
$03/FF3A AD B3 26 LDA $26B3  [$7E:26B3] A:0085 X:0680 Y:001A P:envMxdizC - Load Weapon in Right Hand into A.
$03/FF3D F0 1B BEQ $1B    [$FF5A] A:0044 X:0680 Y:001A P:envMxdizC - If 00 branch to End.
$03/FF3F C2 20 REP #$20 A:0044 X:0680 Y:001A P:envMxdizC - Reset Processor Statues (Very Important! It allows A to hold 2-byte values which was Crucial to this)
---------------------------------------------(Looping Point)---------------------------------------------------
$03/FF41 0A ASL A A:0044 X:0680 Y:001A P:envmxdizC - x2 A
$03/FF42 0A ASL A A:0088 X:0680 Y:001A P:envmxdizc - x2 A
$03/FF43 0A ASL A A:0110 X:0680 Y:001A P:envmxdizc - 2x A
$03/FF44 69 03 00 ADC #$0003 A:0220 X:0680 Y:001A P:envmxdizc + 0003 (This all allows it to reach the Weapon, than the Weapon Spell.)
$03/FF47 AA TAX A:0223 X:0680 Y:001A P:envmxdizc - Transfer A to X.
$03/FF48 7B TDC A:0223 X:0223 Y:001A P:envmxdizc - Clear A
$03/FF49 E2 20 SEP #$20 A:0000 X:0223 Y:001A P:envmxdiZc - Set Processor Status to 20 (Changes A back to one byte.)
$03/FF4B BF 00 91 0F LDA $0F9100,x[$0F:9323] A:0000 X:0223 Y:001A P:envMxdiZc - Load the Location of the Weapons +.
$03/FF4F F0 14 BEQ $14    [$FF65] A:0005 X:0223 Y:001A P:envMxdizc - If the end result is 00 branch to End.
$03/FF51 48 PHA A:0005 X:0223 Y:001A P:envMxdizc - Push A onto Stack (To keep the value for after the RNG Calculations
$03/FF52 20 79 83 JSR $8379  [$03:8379] A:0005 X:0223 Y:001A P:envMxdizc - RNG Routine
$03/FF55 C9 3F CMP #$3F A:00D6 X:0000 Y:001A P:eNvMxdizc - is it 3F (of FF, 25%) or more
$03/FF57 68 PLA A:00D6 X:0000 Y:001A P:eNvMxdizC - Pull A from Stack.
$03/FF58 D0 0D BCS $0D    [$FF66] A:0005 X:0000 Y:001A P:envMxdizC -If so  Branch to End.
$03/FF5A 8D D2 26 STA $26D2  [$7E:26D2] A:0005 X:0000 Y:001A P:envMxdizC - Store A in Next Action.
(Add a Weapon Swing Loading Routine)
$03/FF5D 4C 10 FF JMP $FF10  [$03:FF10] A:0005 X:0000 Y:001A P:envMxdizC - Jump to New Part of Routine.
--------------------------------------------------------------------------------------
(Left Hand Portion)
$03/FF60 AD B5 26 LDA $26B5  [$7E:26B5] A:0042 X:0680 Y:001A P:eNvMxdizc - Load Left Handed Weapon into A.
$03/FF63 D0 03 BNE $03    [$FF68] A:0023 X:0680 Y:001A P:envMxdizc - Branch if not 00 to next portion
----------------------------------------------------------------------------------
$03/FF65 E2 20 SEP #$20 A:0000 X:011B Y:001A P:envMxdiZc - Set Processor Status to 20 (Makes A one byte again)
$03/FF67 60 RTS A:0000 X:011B Y:001A P:envMxdiZc - Return
-------------------------------------------------------------------------------
$03/FF68 80 D5 BRA $D5    [$FF3F] A:0023 X:0680 Y:001A P:envMxdizc - Loop back to Weapon Finding Routine above.


Code: [Select]

And that's the code. Short, sweet, and to the point. To improve my Sing-Harp Dependent hack I'll want to take this routine, get rid of the RNG dealings and plug it in right there. A very simple process. (Watch me still not have enough room to make it look at other characters...)

This hack is very easy to utilize. Nothing other than targeting in it is hardcoded, so you can have it use any spell you like.

Here's a few more pictures of it in action.

(http://i112.photobucket.com/albums/n198/LastingDawn/MagicWeapons3_zpsbd7741ee.png) (http://s112.photobucket.com/user/LastingDawn/media/MagicWeapons3_zpsbd7741ee.png.html)

(http://i112.photobucket.com/albums/n198/LastingDawn/MagicWeapons6_zps8380e697.png) (http://s112.photobucket.com/user/LastingDawn/media/MagicWeapons6_zps8380e697.png.html)

(http://i112.photobucket.com/albums/n198/LastingDawn/MagicWeapons5_zps3fee3fe8.png) (http://s112.photobucket.com/user/LastingDawn/media/MagicWeapons5_zps3fee3fe8.png.html)



And here's the patch!

As always, any complaints, comments, or questions regarding my patches, post them here.

 :edit: Update! I decided to revisit this since I planned on expanding its use in my hack and I noticed that it didn't work properly with Summons.

Instead of a jump to the magic routine at the end there I have it jump to a new section where it will load the full magic routine then add the weapon swing afterwards. So while it won't look as clean as it did prior. It will work effectively with every kind of spell. Instead now the character will go into their spellcasting pose, then after the effect is done, use their weapon to attack.

If I could just think of someway to have the initial spell start one byte over I could add a C0 and be perfectly fine, but alas...

And I did just that! I've finally got everything looking the way it should and it looks great!

Here is the new code that is now mentioned above...

New Code for Magic Weapons

Code: [Select]
$03/FF10 C9 31 CMP #$31 A:00F0 X:01CF Y:0006 P:eNvMxdIzc - Is it Imp or Lower?
$03/FF12 90 04 BCC $04    [$FF18] A:00F0 X:01CF Y:0006 P:eNvMxdIzc - If so branch to part-way through Magic Routine
---------------------------------------------------------------------------
$03/FF14 C9 40 CMP #$40 A:00F0 X:01CF Y:0006 P:eNvMxdIzc - Is it lower than Bahamut?
$03/FF16 90 03 BCC $03    [$FF1B] A:00F0 X:01CF Y:0006 P:eNvMxdIzc - If so branch to Full Magic Routine
----------------------------------------------------------------------
$03/FF18 4C 3E CD JMP $CD3E  [$02:CD3E] A:00F0 X:01CF Y:0006 P:eNvMxdIzc - Jump and stay with part way through Magic Routine.
-------------------------------------------------------------------
$03/FF1B 20 46 CC JSR $CC46  [$02:CC46] A:00F0 X:01CF Y:0006 P:eNvMxdIzc - Jump to Full Magic Routine
$03/FF1E A9 C0 LDA #$C0 A:00F0 X:01CF Y:0006 P:eNvMxdIzc - Load Weapon Swing into A.
$03/FF20 8D C2 33 STA $33C2  [$7E:33C2] A:00F0 X:01CF Y:0006 P:eNvMxdIzc - Store A in First Visual cue.
$03/FF23 A9 00 LDA #$00 A:00F0 X:01CF Y:0006 P:eNvMxdIzc - Load 00 into A.
$03/FF25 8D C3 33 STA $33C3  [$7E:33C3] A:00F0 X:01CF Y:0006 P:eNvMxdIzc - Store A in Second visual cue.
$03/FF28 60 RTS A:00F0 X:01CF Y:0006 P:eNvMxdIzc - Return
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Magic Weapons from FFV in FFIV!)
Post by: Grimoire LD on January 15, 2014, 06:38:32 PM
And Sing-Harp Dependent has been renewed and finished! The new one, while working better functionally still is not 100% what I wanted, but I like it a Lot better than what was originally there. (as the code is very similar to the Magic Weapons hack I'll leave it be). This will add +5 Attack Power to characters in the First, Second, and Third Slot, +the Singer (meaning if the Singer is occupying any of those spots he would get a +10 Boost). Nothing happens with the Fourth and Fifth Slot though if the Singer isn't occupying either. It's not perfect, but it is interesting at least.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Patch-FFIII Style Sing in FFIV!)
Post by: LordGarmonde on January 15, 2014, 06:47:53 PM
My thoughts exactly LordGarmonde, that said when in battle you can switch commands on the fly (I'm not 100% sure on displayed name yet though). So you could potentially make a mod with a Command called "(Sword-symbol)Skil" with the Sword only meaning "Battle" and have that routine look at the weapon you have equipped and give you a skill regarding that...
For instance, you have Claw equipped, you get Kick. Rod-Boast, Staff-Pray, Sword/Hammer-Focus (couldn't think of any default choice better), Maybe the normal swords would impart Dark Wave, while the Light Swords would give Focus, Spears-Jump, Katana/Boomerangs-Throw, Knife-Steal, Whip-Recall, Axe-Gird, Harp-Sing, Bow-Aim...
:childish: <--- that's me! I think that's an awesome strategy!
As for the name if Square really gives you some lip I can think of a low-brow attack that might work: What about having it next to the Character Name like a Status Effect. Granted - that list is obvious enough that even if I didn't remember I'd know what's going on - I wouldn't think rod => dark-wave (I'd need even less sleep still to be that wrong!)

I know I say this a lot but This is my Finest work yet.

If each effort surpasses the last then it is always true - and aptly demonstrates a string of fine work: fine job! I was a little amused (if you'll forgive me) at your statement about not being 100% satisfied -btw you redoing that to further satisfaction I think is about as certain as my post-length stretching the limits of imagination :P - but your's is a much better, and more fruitful, compulsion (for lack of a better term) - which I typed out as you were posting your update about Edward :wink:

Now there are a few... oddities... to this whole process...

1) Why do you have to tease me like that?  I almost quit reading to go look into it - one half of my brain is still screaming at the  "NO-NO: STOP THE CAR - WE CAN SOLVE THIS ONE - STOP!!!"
2) I'm sure I'll see it (since I'll provoke it!) - but until then quick question: is it on another enemy or in between a few?
3) Agreed!
4) What about zombies? If I remember correctly damage inversion for the undead is last in the calculation - but that may not be so when that routine returns back to you.
5) Nice!

This is pretty rad, dude; kudos!

I know you have a list of your routines at the beginning of this thread - but do you have reference for your patches somewhere? I thought of something during the discussions about individual vs consolidated patching but totally spaced-it: While I love the freedom of singles, it can get annoying if someone builds from a new copy of the ROM and the has to apply 10 patches again - also, even though I trust you to do your homework so installation order won't matter; I'll still be paranoid if I run into trouble amidst testing. I had tried a program out a while back to pull sections out of IPS patches:


IPSelect 1.0 - Selective file patcher
=====================================
Copyright 2000 James Churchill/Naruto
http://optera.net/~pelrun/
Overview
--------
IPSelect is a utility for only applying parts of an IPS patch to a file. It is
intended to help in tracking down which of hundreds of edits may be causing a
bug in a game patch.

Usage
-----
1) Use the Browse buttons to select the source, patch and destination files.
2) A list of patch hunks (the discrete sections of a patch) will be displayed
   in the Hunk List box. Use the checkboxes beside each entry to enable/disable
   hunks as required.
3) Click the Patch file to apply the enabled patch hunks to the source file, and
   write it out to the destination file.

Version History
---------------
1.0 - Initial release.
----
James Churchill
Naruto
pelrun@hotmail.com
27/06/2000
-----------------------------------------------------

The link is broken but just Google IPSelect10 (or I can send it to you) - It's from the guy who built DisPel so he seems to know what's what

If you had a list of the patches and the sections they replace (or probably just where they each start) that program might compliment a larger build nicely - just a thought :)
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Patch-FFIII Style Sing in FFIV!)
Post by: Grimoire LD on January 15, 2014, 07:19:09 PM
My thoughts exactly LordGarmonde, that said when in battle you can switch commands on the fly (I'm not 100% sure on displayed name yet though). So you could potentially make a mod with a Command called "(Sword-symbol)Skil" with the Sword only meaning "Battle" and have that routine look at the weapon you have equipped and give you a skill regarding that...
For instance, you have Claw equipped, you get Kick. Rod-Boast, Staff-Pray, Sword/Hammer-Focus (couldn't think of any default choice better), Maybe the normal swords would impart Dark Wave, while the Light Swords would give Focus, Spears-Jump, Katana/Boomerangs-Throw, Knife-Steal, Whip-Recall, Axe-Gird, Harp-Sing, Bow-Aim...
:childish: <--- that's me! I think that's an awesome strategy!
As for the name if Square really gives you some lip I can think of a low-brow attack that might work: What about having it next to the Character Name like a Status Effect. Granted - that list is obvious enough that even if I didn't remember I'd know what's going on - I wouldn't think rod => dark-wave (I'd need even less sleep still to be that wrong!)

That would require quite a bit of... know how, which I'm afraid I don't possess, heh. The easiest thing to do is to look at how its done, my only concern in that regard is space. You may notice in most of my routines the first thing I've done is get rid of Messages, because they use up valuable space. And everybody knows they're using the Ability they just Used. They don't have to be reminded when they Use it!

I know I say this a lot but This is my Finest work yet.

If each effort surpasses the last then it is always true - and aptly demonstrates a string of fine work: fine job! I was a little amused (if you'll forgive me) at your statement about not being 100% satisfied -btw you redoing that to further satisfaction I think is about as certain as my post-length stretching the limits of imagination :P - but your's is a much better, and more fruitful, compulsion (for lack of a better term) - which I typed out as you were posting your update about Edward :wink:

Haha, well I think its with every routine that makes me delve into newish territory I learn another useful tool to utilize. For this one I've learned that A: You can attach a routine to any code you like as long as you have your pointers straight.

Now there are a few... oddities... to this whole process...

1) Why do you have to tease me like that?  I almost quit reading to go look into it - one half of my brain is still screaming at the  "NO-NO: STOP THE CAR - WE CAN SOLVE THIS ONE - STOP!!!"
2) I'm sure I'll see it (since I'll provoke it!) - but until then quick question: is it on another enemy or in between a few?
3) Agreed!
4) What about zombies? If I remember correctly damage inversion for the undead is last in the calculation - but that may not be so when that routine returns back to you.
5) Nice!

I never tried it out on Zombies, but I don't think that's the offender here.

It is on another enemy (ordinarily the furthest one back). Though the damage will still show properly.

This is pretty rad, dude; kudos!

I know you have a list of your routines at the beginning of this thread - but do you have reference for your patches somewhere? I thought of something during the discussions about individual vs consolidated patching but totally spaced-it: While I love the freedom of singles, it can get annoying if someone builds from a new copy of the ROM and the has to apply 10 patches again - also, even though I trust you to do your homework so installation order won't matter; I'll still be paranoid if I run into trouble amidst testing. I had tried a program out a while back to pull sections out of IPS patches:

Near the bottom of the post at the start of the thread there is a Patches section... above of Miscellaneous. Do you think I should move that up to the top?

IPSelect 1.0 - Selective file patcher
=====================================
Copyright 2000 James Churchill/Naruto
http://optera.net/~pelrun/
Overview
--------
IPSelect is a utility for only applying parts of an IPS patch to a file. It is
intended to help in tracking down which of hundreds of edits may be causing a
bug in a game patch.

Usage
-----
1) Use the Browse buttons to select the source, patch and destination files.
2) A list of patch hunks (the discrete sections of a patch) will be displayed
   in the Hunk List box. Use the checkboxes beside each entry to enable/disable
   hunks as required.
3) Click the Patch file to apply the enabled patch hunks to the source file, and
   write it out to the destination file.

Version History
---------------
1.0 - Initial release.
----
James Churchill
Naruto
pelrun@hotmail.com
27/06/2000
-----------------------------------------------------

The link is broken but just Google IPSelect10 (or I can send it to you) - It's from the guy who built DisPel so he seems to know what's what

If you had a list of the patches and the sections they replace (or probably just where they each start) that program might compliment a larger build nicely - just a thought :)

That is a neat program! I'll have to keep that in mind for later, thanks!
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Magic Weapons from FFV in FFIV!)
Post by: LordGarmonde on January 15, 2014, 09:09:41 PM
Near the bottom of the post at the start of the thread there is a Patches section... above of Miscellaneous. Do you think I should move that up to the top?

Nah - now I know - I think I missed it because by that point the list was so extensive that I was just wowed beyond comprehension. I mean that too - like damn...wow!

Maybe a a list of all the subheadings at the top - I'm still playing around with a Table of Contents of the Drawing Board - I don't know - either way really
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Magic Weapons from FFV in FFIV!)
Post by: Grimoire LD on January 16, 2014, 05:55:42 PM
That's not a bad idea. "Table of Contents" so to speak? A lot of FAQ's have those after all.

Alright, so I made one slight error in my Magic Weapons code, unless you activate it specifically it is fairly unnoticeable. When you have no weapon equipped and you attack and you are Right Handed, (monsters all count as Left Handed because they are 00) the game cast a "Nothing Happened" spell. This is only really noticeable with Rydia in the Project II Patch if you attacked without a weapon. It happened because I forgot to change one branch that, while working, did not work appropriately (it branched to the loading and magic running routine rather than an RTS) The original patch will be fixed and uploaded in its original post.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Magic Weapons from FFV in FFIV!)
Post by: LordGarmonde on January 16, 2014, 09:01:30 PM
That's not a bad idea. "Table of Contents" so to speak? A lot of FAQ's have those after all.

Spell Routine Offsets
Command Routine Offsets
Specialty Routine Offsets
Bug Fixes
Custom (aka KICK-ASS!) Routine Offsets (& Replacements)
Spells
Patches
Miscellaneous


I just saved a copy of that post (if you don't mind) - Lot of good stuff!

I expect you'll change one of those headings back - but I'll always know! :wink:
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Magic Weapons from FFV in FFIV!)
Post by: Grimoire LD on January 17, 2014, 12:01:33 AM
That's not a bad idea. "Table of Contents" so to speak? A lot of FAQ's have those after all.

Spell Routine Offsets
Command Routine Offsets
Specialty Routine Offsets
Bug Fixes
Custom (aka KICK-ASS!) Routine Offsets (& Replacements)
Spells
Patches
Miscellaneous


I just saved a copy of that post (if you don't mind) - Lot of good stuff!

I expect you'll change one of those headings back - but I'll always know! :wink:

Pasted and (for the most part) used. Thanks for that LordGarmonde. I'm not 100% sure what I want for my next patch. I was fiddling around with an ability which would somehow teach spells to the chosen character, but that might be a little too tricky to implement. The theory behind it is simple and sound. Take a specific event in battle, learn spell (using the Summon Orb learning as a base) the problem is I'm not sure who to give it to or to what purpose it would hold. I originally thought of giving it to Kain. The idea was that he could "speak" to Dragons and if a Dragon was knocked into Critical he would gain a spell from the Dragon, gain a few extra max MP (Level/8) and the Dragon would retreat. But what spells even fit Kain, and how many more normal spells can I afford to take away? I guess Flare and Comet (there's no reason for them to be in the castable section) are up for grabs, but beyond that there's very few worthless spells left. Well let's see... Warp and Venom could also be turned into something else. Weak is a little bit abusable. That would give four spells to use for custom spells, since the 5 worthless White Magics were turned into Break Skills. Hmm...

Does anyone have any suggestions what I can do with the "spells earned in battle" concept? And where it could be applied?
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Magic Weapons from FFV in FFIV!)
Post by: chillyfeez on January 17, 2014, 12:37:05 AM
We talked a while ago about a Learn ability for my Blue Mage. I got it working.
I don't have a commented disassembly, but here it is:
Code: [Select]
$03/E876 A2 00 00    LDX #$0000              ;load 0000 into X
$03/E879 AD 52 27    LDA $2752  [$7E:2752]   ;load last (sub) ability used by target into A
$03/E87C C9 60       CMP #$60               
$03/E87E 90 2B       BCC $2B    [$E8AB]     
$03/E880 C9 78       CMP #$78               
$03/E882 B0 27       BCS $27    [$E8AB]      ;specifies valid range of learnable spells. In this code, it's 60 through 77
$03/E884 DD 60 15    CMP $1560,x[$7E:174C]   ;specifies first slot of interested spell set
$03/E887 F0 22       BEQ $22    [$E8AB]      ;if the spell to learn is in this slot already, jump to (fail)
$03/E889 E8          INX                     
$03/E88A E0 18 00    CPX #$0018             
$03/E88D D0 F5       BNE $F5    [$E884]      ;loop 17 hex more times. If the spell is not in this spell set, then...
$03/E88F A2 00 00    LDX #$0000              ;load 0000 into X
$03/E892 BD 60 15    LDA $1560,x[$7E:174C]   ;load spell set's first slot again
$03/E895 F0 03       BEQ $03    [$E89A]      ;now we're looking for an empty slot. If we found one, move on, otherwise...
$03/E897 E8          INX                     
$03/E898 80 F8       BRA $F8    [$E892]      ;loop until you find an empty slot
$03/E89A AD 52 27    LDA $2752  [$7E:2752]   ;load the spell to learn back into A
$03/E89D 9D 60 15    STA $1560,x[$7E:174C]   ;store A into the empty slot
$03/E8A0 8D 9A 35    STA $359A  [$7E:359A]   ;store A into the parameter for the "learned [spell]" message
$03/E8A3 A9 23       LDA #$23               
$03/E8A5 8D CA 34    STA $34CA  [$7E:34CA]   ;load "learned [spell]" into next battle message
$03/E8A8 4C 5A FF    JMP $FF5A  [$02:FF5A]   ;jump to a portion in my mime code that activates battle message
$03/E8AB 4C 55 FF    JMP $FF55  [$02:FF55]   ;jump to a portion in my mime code that displays "nothing happened."
       
Essentially, this ability specifies a valid range of spells. If the enemy has just cast one of them, then the game checks to see if the spell is already in the spell list specified. if not, then it puts the spell in the first empty spot in the list, and displays the message "Learned [spell]."
The spell is not available until the next battle, though.
Feel free to use this however you like.
I can comment on the disassembly, but it'll take a while to look at it again and figure it all out.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Magic Weapons from FFV in FFIV!)
Post by: Grimoire LD on January 17, 2014, 01:09:55 AM
That is really cool Chillyfeez! I think I understand what's going on...

Load Action Taken. If it is between 60 and 78 (24 slots exactly) . Load it into Magic Slot if applicable, search through the 24 slots for a 00, several messages and two jumps to custom code.

One thing I don't understand is how the Magic Check has a value of x7E174C, when you specifically loaded 0000 into X at the start of the routine.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Magic Weapons from FFV in FFIV!)
Post by: chillyfeez on January 17, 2014, 01:31:39 AM
This wasn't a live disassembly, so geiger's just uses whatever values are currently in X, A, and Y. Sorry for the confusion.
The code above is commented now, but yeah, you seem to have figured it out.  :edit: I also removed a few lines of nonpertinent code originally included. Oops.
Not as cool in a practical sense as my Mime command, but a great example of "if you can think it, you can do it."

You may have noticed by the offset that this code replaces Hide. That's not an accident. Before I started making Limits, I toyed with the idea of making this an automatically-activated ability (pending specific parameters). That is theorhetically possible.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Magic Weapons from FFV in FFIV!)
Post by: Grimoire LD on January 20, 2014, 07:14:02 PM
Alright, so I decided to expand upon my Dragon Speak idea and have everything set up from a planning portion.

There will be three new dragons added that each can give Kain a unique spell that only he can use. (Warp/Weak/Twin Spells/Smoke was sacrificed for it), along with the MecDragon and RedDragon teaching Kain. The other Dragons throughout the game teach Kain White Magic if he speaks with them.

Once the Dragon (Only pure Dragons, not undead dragons) is weakened to Critical, it will listen to Kain with his Dragon Speech ability and will impart part of its knowledge to Kain before Retreating.

Because two of these spells will use custom routines, I'll post those now. One is a simple "Add Weapon Elemental" routine to do the best I can in mimicking Lancet/Dragon Sword (Absorb HP/MP) this will obviously only cure HP the other is a Flourish to add to spells.


Add Elemental Weapon Attack/Fancy Flourish - (Replaces Count)

Code: [Select]
$03/DBB5 AD 9D 28 LDA $289D  [$7E:289D] A:0003 X:003A Y:0000 P:envMxdizc - Load Spell Power into A.
$03/DBB8 D0 1B BNE $1B    [$DBD5] A:0000 X:003A Y:0000 P:envMxdiZc - If above 00 branch to Fancy Flourish.
$03/DBBA A9 C0 LDA #$C0 A:0000 X:003A Y:0000 P:envMxdiZc - Load Weapon Swing into A.
$03/DBBC 8D C4 33 STA $33C4  [$7E:33C4] A:00C0 X:003A Y:0000 P:eNvMxdizc - Store A in Audiovisual Cue
$03/DBBF AD 99 26 LDA $2699  [$7E:2699] A:00C0 X:003A Y:0000 P:eNvMxdizc - Load Caster's Weapon Elemental into A.
$03/DBC2 0D A2 28 ORA $28A2  [$7E:28A2] A:0020 X:003A Y:0000 P:envMxdizc - Check to see if the Spell Elemental is applicable.
$03/DBC5 8D 99 26 STA $2699  [$7E:2699] A:0060 X:003A Y:0000 P:envMxdizc - Store A in Caster's Weapon Elemental
$03/DBC8 20 99 C4 JSR $C499  [$03:C499] A:0060 X:003A Y:0000 P:envMxdizc - Jump to Fight Routine
$03/DBCB AD 99 26 LDA $2699  [$7E:2699] A:0000 X:0680 Y:001A P:envMxdiZC - Load Caster's Weapon Elemental into A.
$03/DBCE ED A2 28 SBC $28A2  [$7E:28A2] A:0060 X:0680 Y:001A P:envMxdizC - Subtract Weapon Elemental from Spell Elemental.
$03/DBD1 8D 99 26 STA $2699  [$7E:2699] A:0020 X:0680 Y:001A P:envMxdizC - Store A in Caster's Weapon Elemental.
$03/DBD4 60 RTS A:0020 X:0680 Y:001A P:envMxdizC - Return
-------------------------------------------------------------------------------------------------------------
(Fancy Flourish)
$03/DBD5 A9 C6 LDA #$C6 A:0046 X:0038 Y:0000 P:envMxdizc - Load Jump into A.
$03/DBD7 8D C4 33 STA $33C4  [$7E:33C4] A:00C6 X:0038 Y:0000 P:eNvMxdizc - Store A in Audiovisual Cue.
$03/DBDA 20 88 D3 JSR $D388  [$03:D388] A:00C6 X:0038 Y:0000 P:eNvMxdizc - Jump to Spell Damage Routine
$03/DBDD A9 DE LDA #$DE A:0000 X:0110 Y:0000 P:envMxdizc - Load Jump Return into A.
$03/DBDF 8D C8 33 STA $33C8  [$7E:33C8] A:00DE X:0110 Y:0000 P:eNvMxdizc - Store A in Further Audiovisual Cue (right after the spell's own so one is not replacing the other)
$03/DBE2 60 RTS A:00DE X:0110 Y:0000 P:eNvMxdizc - Return.

When used from a "Spell Sense" curiously the Drain Elemental will only Absorb 50% of the damage done from this special "spell strike".

The way it is set up, the routine looks at the Spell's Element and applies it to the Weapon for this single attack, then immediately removes it. For my purposes that was Drain Elemental. Because there is no second check in this routine (only the first) say you have a skill called "(Sword)Fire" and you're already using the Flame sword, this would actually remove the Fire Elemental from your sword for that attack, so it can be used in those certain strategies where non-Elemental attacks may be the best idea.

Now the Fancy Flourish is just to add a bit of flavor to attacks. I have an attack called "Sky Rave" that Kain has in Dissidia 012 which makes Kain jump into the Air, Lightning strikes around the area and he returns back from his jump as if he threw down the Lightning.

I'll post these first. Even if the Dragon Speech idea doesn't pan out, (I see no reason it should fail, especially with Chillyfeez's help above) Kain will still be getting these spells.

Sky Rave
(http://i112.photobucket.com/albums/n198/LastingDawn/SkyRave1_zps4478bf77.png) (http://s112.photobucket.com/user/LastingDawn/media/SkyRave1_zps4478bf77.png.html)

(http://i112.photobucket.com/albums/n198/LastingDawn/SkyRave2_zpsd6df1afd.png) (http://s112.photobucket.com/user/LastingDawn/media/SkyRave2_zpsd6df1afd.png.html)

(http://i112.photobucket.com/albums/n198/LastingDawn/SkyRave3_zps67d9751b.png) (http://s112.photobucket.com/user/LastingDawn/media/SkyRave3_zps67d9751b.png.html)

(http://i112.photobucket.com/albums/n198/LastingDawn/SkyRave1_zps76de0649.png) (http://s112.photobucket.com/user/LastingDawn/media/SkyRave1_zps76de0649.png.html)


Lancet
(http://i112.photobucket.com/albums/n198/LastingDawn/Lancet_zps229692ce.png) (http://s112.photobucket.com/user/LastingDawn/media/Lancet_zps229692ce.png.html)
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Magic Weapons from FFV in FFIV!)
Post by: Grimoire LD on January 20, 2014, 08:36:57 PM
Hmm, Chillyfeez, I just tried to make messages appear in my custom routine and no matter what I tried, no message would appear. It seems you put something special in your code to activate the battle message to appear. I haven't found anything akin to that. Would you share what that address or method is?

 :edit:

$03/EADE   A9 12   LDA #$12   A:0022   X:0000   Y:0000   P:eNvMxdizc - Load 12 into A (D)
$03/EAE0   8D CA 34   STA $34CA  [$7E:34CA]   A:0012   X:0000   Y:0000   P:envMxdizc - Store A in Battle Message Data.
$03/EAE3   4C A6 85   JMP $85A6  [$03:85A6]   A:0012   X:0000   Y:0000   P:envMxdizc - Jump to Routine (Leaves Routine from here)

Oh... right.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Magic Weapons from FFV in FFIV!)
Post by: chillyfeez on January 20, 2014, 09:37:41 PM
In addition to loading the message into the "battle message" byte of RAM, you have to activate otherbytes of RAM (that I don't fully understand). I don't exactly know why, but adding these four instructions will make it work:
Code: [Select]
$03/FF73 A9 F8       LDA #$F8               
$03/FF75 8D C6 33    STA $33C6  [$00:33C6]   
$03/FF78 A9 03       LDA #$03               
$03/FF7A 8D C7 33    STA $33C7  [$00:33C7]
For my hack, I have this at the end of one command (Mime, right before the RTS), and anytime I need to display messages in a command, I make the end of the command jump there, to save code space.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Magic Weapons from FFV in FFIV!)
Post by: Grimoire LD on January 20, 2014, 09:46:13 PM
Hmm, it seems the address that I had in my edit also accomplishes successful showing of a message with no issues as far as I can see.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Magic Weapons from FFV in FFIV!)
Post by: chillyfeez on January 20, 2014, 09:57:14 PM
Good. Wherever that is is probably doing the same thing.

I meant to say, btw, I didn't realize you figured out how to execute all of those av routines in the same command. I think I thought it was just multiple spell routines. Anyway, that's awesome. Nice work!
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Magic Weapons from FFV in FFIV!)
Post by: Grimoire LD on January 20, 2014, 11:16:45 PM
Spells can be tricky to switch effects around. If you have enough free space you can take the three commands that are used when a spell is called and move them 3 to the right and so on and so forth, but I haven't experimented much with that yet.

Though Chillyfeez your rin-battle Spell Routine works better than I could have imagined!

Kain will now have a unique command called "Dragon Speech" in which he will try to soothe and tame wounded dragons.
(http://i112.photobucket.com/albums/n198/LastingDawn/DragonSpeech1_zps757d638c.png) (http://s112.photobucket.com/user/LastingDawn/media/DragonSpeech1_zps757d638c.png.html)

If the Dragon is not in critical, this message will appear. Signifying that it must be weakened further until it can be reasoned with.
(http://i112.photobucket.com/albums/n198/LastingDawn/DragonSpeech2_zpse4460b8f.png) (http://s112.photobucket.com/user/LastingDawn/media/DragonSpeech2_zpse4460b8f.png.html)

If the Dragon is in Critical and this command is used, it will impart knowledge to Kain and will Retreat from battle.
(http://i112.photobucket.com/albums/n198/LastingDawn/DragonSpeech3_zps9e5de049.png) (http://s112.photobucket.com/user/LastingDawn/media/DragonSpeech3_zps9e5de049.png.html)

In the Wind Drake's Case it is Reis' Wind or "WindR" which will restore 1/3 of all party member's HP.
(http://i112.photobucket.com/albums/n198/LastingDawn/DragonSpeech4_zps83dde2c3.png) (http://s112.photobucket.com/user/LastingDawn/media/DragonSpeech4_zps83dde2c3.png.html)

With the basics down, I cannot foresee this project taking anymore than two or three days, maybe sooner depending on other obligations.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Magic Weapons from FFV in FFIV!)
Post by: chillyfeez on January 21, 2014, 12:17:50 AM
Question - have you merged Black and White to make a seperate "Skill" command? Or did you do something much cooler than that, like crack the conditional Black/Ninja mystery?
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Magic Weapons from FFV in FFIV!)
Post by: Grimoire LD on January 21, 2014, 12:48:27 AM
I really wish I did the cool thing but unfortunately, I haven't figured any of that out, though I haven't really looked (I imagine its a Class check, that sort of thing ordinarily tends to be). So yes, Skill and Magic are just renamed Black and White. Skill mostly has an assortment of Magic and Physical Skills while Magic... mostly has an assortment of Magic (and in Tellah's case the Break skills) This does also truncate magicians down to one menu, this would only really effect characters like FuSoYa and Tellah in any meaningful manner I would think. (though spellbooks all together had a few pages cut out to make room for physical skills and the Dragon skills).

Once I get the Dragon Speak down that will be it for the Final Five, but I'd still need to decide what to do with the other fellows. I've already decided to cut the Twins special abilities and use them elsewhere.  (no offense against them but they are the characters that are in the game for the shortest length of areas. Mt Ordeals/Old Waterway, I love them both, I swear! They are almost tied with Edward as shortest appearances, but Edward also gets to participate in the Fabul Siege so he beats them out there if only by a hair.)

Title: Re: Grimoire LD's Notes, Patches, and Hacks (Magic Weapons from FFV in FFIV!)
Post by: chillyfeez on January 21, 2014, 08:19:03 AM
Too bad - but understandable - that the twins get the shaft. You know, it's funny you say that, because I can't remember the last time I played through ffiv without level grinding the twins at mt. Ordeals until palom has meteo. I always get a kick out of how "wowwed" they are at Tellah's perceived abilities when they're already beyond him (I'm a dork, I know).

I should look into the Ninja thing. Seems like it shouldn't be too tough to figure out. Also, given that they provided space for a few other options, I wouldn't be surprised if the conditions were expandable (wouldn't that be cool). Maybe the next time I need a side project... The hack's really coming along now. Soon...
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Magic Weapons from FFV in FFIV!)
Post by: Grimoire LD on January 21, 2014, 09:37:30 AM
Ah wait, as in do you mean what calls the Ninja Menu to be a Black Magic Menu?

Yes, I have found that, earlier in this thread.

"Now Ninja is handled a little differently. Ninja is looked at...
$02/B9C1   C9 18   CMP #$18   A:0000   X:0000   Y:0006   P:eNvMxdIzc -
$02/B9C3   F0 64   BEQ $64    [$BA29]   A:0000   X:0000   Y:0006   P:eNvMxdIzc - Here.

And as we know from above that links Directly to Black Magic. Right before this is a CMP 16 which must look at the Dart Menu."

Now if you were referring to the actual stat menu to say "Ninja" instead of "Black" I have little idea.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Magic Weapons from FFV in FFIV!)
Post by: chillyfeez on January 21, 2014, 11:26:00 AM
No I meant the part that turns the (Black) magic list into "Ninja."
Now that you mention it, though, there would need to be a corresponding battle command, which would definitely complicate matfers...
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Magic Weapons from FFV in FFIV!)
Post by: Grimoire LD on January 21, 2014, 01:21:06 PM
It always annoyed me that Kain's entire backstory in the Scenario Guide is about him caring for the last living Dragon in Baron, yet not once, in any release, does he ever talk about Dragons or that the Dragoon Corps were known as Dragon Riders. While I can't make Kain a Dragon Rider, I can at least give him Something to do with Dragons and I always felt that in FFIV actions speak louder than words, so I gave him a command that will allow Kain to soothe the hearts of wounded dragons and allow them to Retreat without harm. In thanks they impart their wisdom to Kain and will teach him either a new Dragon Skill or a White Magic spell.

I am proud to say that my attempt to have Kain learn spells from All Wounded Dragons is a resounding success! Thanks to Chillyfeez's code and the mass amount of space that Recall gave me I managed to include a unique entry for nine dragons and the rest are handled with a Level Algorithm.



This patch will add three new dragons (replacing the "rare enemies" on the Three-Step Peninsula). One in the Overworld, two in the Underworld. Wind Dragon, Sol Dragon, and Great Dragon (WndDragn, SolDragn, GrtDragn)

The Wind Dragon can be challenged in the forests around Troia and yields the spell Reis' Wind, which will restore 1/3 of everyone's current HP.

(http://i112.photobucket.com/albums/n198/LastingDawn/DragonSkill5_zps450a3f5a.png) (http://s112.photobucket.com/user/LastingDawn/media/DragonSkill5_zps450a3f5a.png.html)

The Sol Dragon is fought in the Underworld and teaches the spell Cyclone, which is an Air Elemental Magic Attack.

(http://i112.photobucket.com/albums/n198/LastingDawn/DragonSkill2_zpse86174ce.png) (http://s112.photobucket.com/user/LastingDawn/media/DragonSkill2_zpse86174ce.png.html)

The Great Dragon is fought in somewhat rare encounters in both the Sylph Cave and Sealed Cave and can impart the situationally useful Dragon Breath.

(http://i112.photobucket.com/albums/n198/LastingDawn/DragonSkill3_zps40294177.png) (http://s112.photobucket.com/user/LastingDawn/media/DragonSkill3_zps40294177.png.html)

The MecDragon (formerly known as D. Machin) is no longer in just the Giant of Babil (or else Kain could never fight it) but is the 1/64 chance in the area outside of Baron (and yet I've Still run into it three times) and will likely need a Siren to locate. It teaches the powerful Lancet skill which will turn Kain's ordinary attack into a Drain attack, restoring half of the damage that he inflicted.

(http://i112.photobucket.com/albums/n198/LastingDawn/Lancet_zps229692ce.png) (http://s112.photobucket.com/user/LastingDawn/media/Lancet_zps229692ce.png.html)

Finally the Red Dragon can also be found not just in the Lunar Subterrane but on the Moon's Surface itself, and the Red Dragon gives the mighty Sky Rave skill, which is a powerful Holy and Air elemental attack on all foes.

(http://i112.photobucket.com/albums/n198/LastingDawn/SkyRave1_zps4478bf77.png) (http://s112.photobucket.com/user/LastingDawn/media/SkyRave1_zps4478bf77.png.html)

(http://i112.photobucket.com/albums/n198/LastingDawn/SkyRave2_zpsd6df1afd.png) (http://s112.photobucket.com/user/LastingDawn/media/SkyRave2_zpsd6df1afd.png.html)

The other Dragons teach White Magic and are merely meant to supplement Kain where as the Five Main Dragons all are given ample opportunity to challenge.

Green D. - Teaches Blink (Underworld/Tower of Babil 2)
Silver D.- Teaches Esuna (Lunar Subterrane)
Yellow D.- Teaches Haste (Underworld (3-Step Peninsula)) - Siren, likely
Wyvern   - Teaches White (Boss)
Blue D.  - Teaches Bersk (Lunar Subterrane)
Gold D.  - Teaches Slow  (Lunar Subterrane)
Clapper  - Teaches Charm (Cave of Summon Monsters)
Pale Dim - Teaches Exit   (Boss)

And here is the code (much of the looping and spell section credit goes to Chillyfeez!)

With this the Final Five are finalized. I can give Advance to Cid, but I'm not sure what I want done with Yang... His skills are only marginally useful and a whole skillset doesn't really fit the character. I might be able to make Gird to be more effective than it currently is (right now its awful) Focus is virtually untouchable (other than those Stupid /2 Defenses while Charging!) and Kick could take Elemental Weapons into account. Dark Wave will likely use a spell rather than its ordinary "go to kick" end to its formula. Cry and Boast are still up in the air and Regen will hopefully be made into a spell rather than a full command (Regen should have been a spell in the first place...)

Dragon Speech

Code: [Select]
$03/EA1A AD 40 27 LDA $2740  [$7E:2740] A:0003 X:000E Y:0000 P:envMxdizc - Load Target's Creature Type into A.
$03/EA1D C9 01 CMP #$01 A:0000 X:000E Y:0000 P:envMxdiZc - Is it Dragon?
$03/EA1F F0 01 BEQ $01    [$EA22] A:0000 X:000E Y:0000 P:eNvMxdizc - If so, branch past here.
$03/EA21 60 RTS A:0000 X:000E Y:0000 P:eNvMxdizc - Return
-------------------------------------------------------------------------------------------
$03/EA22 AD 06 27 LDA $2706  [$7E:2706] A:0001 X:000E Y:0000 P:envMxdiZC - Load Target's Status Byte 4 into A.
$03/EA25 C9 01 CMP #$01 A:0000 X:000E Y:0000 P:envMxdiZC - Are they in Critical?
$03/EA27 F0 07 BEQ $07    [$EA30] A:0000 X:000E Y:0000 P:eNvMxdizc - If so, branch to Dragon Identifier.
$03/EA29 A9 07 LDA #$07 A:0000 X:000E Y:0000 P:eNvMxdizc - Load Message 07 into A (The Dragon is Prideful!)
$03/EA2B 8D CA 34 STA $34CA  [$7E:34CA] A:0007 X:000E Y:0000 P:envMxdizc - Message Data.
$03/EA2E 80 7E BRA $7E    [$EAAE] A:0007 X:000E Y:0000 P:envMxdizc - Branch to Message Jump
-------------------------------------------------------------------------------------------------
$03/EA30 AD AD 29 LDA $29AD  [$7E:29AD] A:0000 X:000E Y:0000 P:envMxdiZC - Load Monster Type 1 into A.
$03/EA33 C9 6F CMP #$6F A:006F X:000E Y:0000 P:envMxdizC - Is it Wind Dragon?
$03/EA35 D0 04 BNE $04    [$EA3B] A:006F X:000E Y:0000 P:envMxdiZC - If not, jump to next Dragon check.
$03/EA37 A9 1C LDA #$1C A:006F X:000E Y:0000 P:envMxdiZC - Load Reis' Wind into A.
$03/EA39 80 45 BRA $45    [$EA80] A:001C X:000E Y:0000 P:envMxdizC - Branch to Spell Finding Routine
--------------------------------------------------------------------------------------------------
$03/EA3B C9 50 CMP #$50 A:0501 X:05B0 Y:BDB2 P:eNvMxdIzc - Is it Sol Dragon?
$03/EA3D D0 04 BNE $04    [$EA43] A:0501 X:05B0 Y:BDB2 P:eNvMxdIzc - If not, jump to next Dragon Check.
$03/EA3F A9 27 LDA #$27 A:0501 X:05B0 Y:BDB2 P:eNvMxdIzc - Load Cyclone into A.
$03/EA41 80 3D BRA $3D    [$EA80] A:0501 X:05B0 Y:BDB2 P:eNvMxdIzc - Branch to Spell Finding Routine.
--------------------------------------------------------------------------------------------------------
$03/EA43 C9 48 CMP #$48 A:0501 X:05B0 Y:BDB2 P:eNvMxdIzc - Is it Great Dragon?
$03/EA45 D0 04 BNE $04    [$EA4B] A:0501 X:05B0 Y:BDB2 P:eNvMxdIzc - If not, jump to next Dragon Check.
$03/EA47 A9 40 LDA #$40 A:0501 X:05B0 Y:BDB2 P:eNvMxdIzc - Load Dragon Breath into A.
$03/EA49 80 35 BRA $35    [$EA80] A:0501 X:05B0 Y:BDB2 P:eNvMxdIzc - Branch to Spell Finding Routine.
--------------------------------------------------------------------------------------------------------
$03/EA4B C9 6E CMP #$6E A:0501 X:05B0 Y:BDB2 P:eNvMxdIzc - Is it MecDragon?
$03/EA4D D0 04 BNE $04    [$EA53] A:0501 X:05B0 Y:BDB2 P:eNvMxdIzc - If not, jump to next Dragon Check.
$03/EA4F A9 41 LDA #$41 A:0501 X:05B0 Y:BDB2 P:eNvMxdIzc - Load Lancet into A.
$03/EA51 80 2D BRA $2D    [$EA80] A:0501 X:05B0 Y:BDB2 P:eNvMxdIzc - Branch to Spell Finding Routine.
-------------------------------------------------------------------------------------------------------
$03/EA53 C9 9F CMP #$9F A:0501 X:05B0 Y:BDB2 P:eNvMxdIzc  - Is it Red Dragon?
$03/EA55 D0 04 BNE $04    [$EA5B] A:0501 X:05B0 Y:BDB2 P:eNvMxdIzc - If not, jump to next Dragon Check.
$03/EA57 A9 46 LDA #$46 A:0501 X:05B0 Y:BDB2 P:eNvMxdIzc - Load Sky Rave into A.
$03/EA59 80 25 BRA $25    [$EA80] A:0501 X:05B0 Y:BDB2 P:eNvMxdIzc - Branch to Spell Finding Routine.
---------------------------------------------------------------------------------------------------------------
$03/EA5B C9 85 CMP #$85 A:0501 X:05B0 Y:BDB2 P:eNvMxdIzc - Is it Green Dragon?
$03/EA5D D0 04 BNE $04    [$EA63] A:0501 X:05B0 Y:BDB2 P:eNvMxdIzc - If not, jump to next Dragon Check.
$03/EA5F A9 04 LDA #$04 A:0501 X:05B0 Y:BDB2 P:eNvMxdIzc - Load Blink into A.
$03/EA61 80 1D BRA $1D    [$EA80] A:0501 X:05B0 Y:BDB2 P:eNvMxdIzc - Branch to Spell Finding Routine.
-----------------------------------------------------------------------------------------------------------------------------
$03/EA63 C9 8C CMP #$8C A:0501 X:05B0 Y:BDB2 P:eNvMxdIzc - Is it Silver Dragon?
$03/EA65 D0 04 BNE $04    [$EA6B] A:0501 X:05B0 Y:BDB2 P:eNvMxdIzc - If not, jump to next Dragon Check.
$03/EA67 A9 12 LDA #$12 A:0501 X:05B0 Y:BDB2 P:eNvMxdIzc - Load Esuna into A.
$03/EA69 80 15 BRA $15    [$EA80] A:0501 X:05B0 Y:BDB2 P:eNvMxdIzc - Branch to Spell Finding Routine.
-------------------------------------------------------------------------------------------------------------------------------
$03/EA6B C9 8D CMP #$8D A:0501 X:05B0 Y:BDB2 P:eNvMxdIzc - Is it Yellow Dragon?
$03/EA6D D0 04 BNE $04    [$EA73] A:0501 X:05B0 Y:BDB2 P:eNvMxdIzc - If not, jump to next Dragon Check.
$03/EA6F A9 08 LDA #$08 A:0501 X:05B0 Y:BDB2 P:eNvMxdIzc - Load Haste into A.
$03/EA71 80 0D BRA $0D    [$EA80] A:0501 X:05B0 Y:BDB2 P:eNvMxdIzc - Branch to Spell Finding Routine.
-------------------------------------------------------------------------------------------------------------------
$03/EA73 C9 9B CMP #$9B A:0501 X:05B0 Y:BDB2 P:eNvMxdIzc - Is it Blue Dragon?
$03/EA75 D0 04 BNE $04    [$EA7B] A:0501 X:05B0 Y:BDB2 P:eNvMxdIzc - If not, jump to next Dragon Check.
$03/EA77 A9 09 LDA #$09 A:0501 X:05B0 Y:BDB2 P:eNvMxdIzc - Load Bersk into A.
$03/EA79 80 05 BRA $05    [$EA80] A:0501 X:05B0 Y:BDB2 P:eNvMxdIzc - Branch to Spell Finding Routine.
--------------------------------------------------------------------------------------------------------------------
$03/EA7B AD 02 27 LDA $2702  [$04:2702] A:0501 X:05B0 Y:BDB2 P:eNvMxdIzc - Load Dragon's Level into A.
$03/EA7E E9 4B SBC #$4B A:0501 X:05B0 Y:BDB2 P:eNvMxdIzc - Subtract 75 from Level (becomes the spell you will learn)
-----------------------------------------------------------------------------------------------------------
$03/EA80 48 PHA A:001C X:000E Y:0000 P:envMxdizC - Push A onto Stack (to retrieve later)
$03/EA81 A2 00 00 LDX #$0000 A:001C X:000E Y:0000 P:envMxdizC - Load 0000 into X.
--------------------------------------------------------------(Looping Point)-----------------------------------------------------
$03/EA84 DD 50 16 CMP $1650,x[$7E:1650] A:001C X:0000 Y:0000 P:envMxdiZC - Compare the first byte in FuSoYa's White Spell Book with A +X
$03/EA87 F0 29 BEQ $29    [$EAB2] A:001C X:0000 Y:0000 P:envMxdiZC  - If they are equal (meaning the spell is already known) branch to end.
$03/EA89 E8 INX A:001C X:0000 Y:0000 P:envMxdizC - +1 to X.
$03/EA8A E0 18 00 CPX #$0018 A:001C X:0001 Y:0000 P:envMxdizC - Has it checked through the entire spell book? (24 slots)
$03/EA8D D0 F5 BNE $F5    [$EA84] A:001C X:0001 Y:0000 P:eNvMxdizc - If not loop back to checking.
------------------------------------------------------------------------------------------------------
$03/EA8F A2 00 00 LDX #$0000 A:001C X:0018 Y:0000 P:envMxdiZC - Load 0000 into X.
------------------------------------------------(Looping Point)------------------------------------------------------------------
$03/EA92 BD 50 16 LDA $1650,x[$7E:1650] A:001C X:0000 Y:0000 P:envMxdiZC - Load FuSoYa's White Spell Book Slot 1 into A.
$03/EA95 F0 03 BEQ $03    [$EA9A] A:0000 X:0000 Y:0000 P:envMxdiZC - Branch if 00 is found (free space)
----------------------------------------------------------------------------------------------------------------------------------
$03/EA97 E8 INX A:0501 X:05B0 Y:BDB2 P:eNvMxdIzc - +1 to .
$03/EA98 80 F8 BRA $F8    [$EA92] A:0501 X:05B0 Y:BDB2 P:eNvMxdIzc - Loop back if it is not found.
-------------------------------------------------------------------------------------------------------------
$03/EA9A 68 PLA A:0000 X:0000 Y:0000 P:envMxdiZC - Pull A from Stack.
$03/EA9B 9D 50 16 STA $1650,x[$7E:1650] A:001C X:0000 Y:0000 P:envMxdizC - Store A in Spell Book.
$03/EA9E 8D 9A 35 STA $359A  [$7E:359A] A:001C X:0000 Y:0000 P:envMxdizC - Store A Message
$03/EAA1 A9 92 LDA #$92 A:001C X:0000 Y:0000 P:envMxdizC - Load Retreat into A.
$03/EAA3 8D D2 26 STA $26D2  [$7E:26D2] A:0092 X:0000 Y:0000 P:eNvMxdizC - Store A in Next Action to Take.
$03/EAA6 20 3E CD JSR $CD3E  [$03:CD3E] A:0092 X:0000 Y:0000 P:eNvMxdizC - Jump to Magic Routine.
$03/EAA9 A9 08 LDA #$08 A:0080 X:0680 Y:001A P:eNvMxdizC - Load Message 08 (The Dragon shares its wisdom)
$03/EAAB 8D CA 34 STA $34CA  [$7E:34CA] A:0008 X:0680 Y:001A P:envMxdizC - Load it into Message Area,
------------------------------------------------------------------------------------------------------------
$03/EAAE 20 A6 85 JSR $85A6  [$03:85A6] A:0007 X:000E Y:0000 P:envMx - Jump to Message Input
$03/EAB1 60 RTS A:0003 X:000E Y:0000 P:envMxdizc - Return
------------------------------------------------------------------------------------------------------------------
$03/EAB2 68 PLA A:001C X:0000 Y:0000 P:envMxdiZC - Pull A from Stack.
$03/EAB3 A9 92 LDA #$92 A:001C X:0000 Y:0000 P:envMxdizC - Load Retreat into A.
$03/EAB5 8D D2 26 STA $26D2  [$7E:26D2] A:0092 X:0000 Y:0000 P:eNvMxdizC - Store A in Caster's Next Action.
$03/EAB8 4C 3E CD JMP $CD3E  [$03:CD3E] A:0092 X:0000 Y:0000 P:eNvMxdizC - Jump and stay with Magic Routine.
-----------------------------------------------------------------------------------------------------------------------

And there you go. If I were more clever I could have put even more dealings into that Level Algorithm, but I thought of it fairly late in the process when I was strapped for bytes.

Things you can expect in this patch -

New Foes in various areas. Refer to above for locations.

A completely new and unique way for Kain to learn Spells.

Several enemies and bosses received minor changes to compensate the new skills and what was replaced in order for them.

All characters lost Venom and Weak/Gale and Edge lost Image.

FuSoYa and Tellah share the same spell sets.

Kain will gain MP up until Level 40.

With all of this in mind, I hope you enjoy the patch!



Title: Re: Grimoire LD's Notes, Patches, and Hacks (Kain Now Learns Spell from Dragon Foes)
Post by: chillyfeez on January 21, 2014, 02:46:43 PM
Ah, after sharpening your claws on some other-FF rewrites, now your truly creative side starts to show. This is all really cool!
One question... what's the three step peninsula?
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Kain Now Learns Spell from Dragon Foes)
Post by: Grimoire LD on January 21, 2014, 03:06:26 PM
Thanks Chillyfeez! Ideas like this come few and far between for me unfortunately. I can't think of anything else that is this far off the beaten path to attempt to implement.

The Three-Step Peninsula is...

(http://i112.photobucket.com/albums/n198/LastingDawn/ThreeStepPeninsula_zpsc0e6a061.png) (http://s112.photobucket.com/user/LastingDawn/media/ThreeStepPeninsula_zpsc0e6a061.png.html)

This small little area is home to normally three monsters that you cannot find anywhere else in the game. Glomwing, Gorgon, and Tarantla.

I took those three monsters (On second thought I don't know Why, there's more than enough Dummy's to use) and turned them into the three new Dragons. The Yellow Dragon can only be located here as well (Outside of a Treasure Chest which holds one) at a 1/64 chance.

I don't know Why Square decided to waste three good monster slots on a Literally Three Step Area, but eh, that's Square logic for you, I believe that the Underworld was likely meant to be larger at one point and the "Three Step" encounters is probably a remnant of the monsters you were going to fight in this expanded area.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Kain Now Learns Spell from Dragon Foes)
Post by: chillyfeez on January 21, 2014, 06:21:57 PM
Huh... I was completely unaware of the Three Step Peninsula.
But, yeah, Square does that a lot, though... there's the Island Closest to Heaven/Hell in viii, the Goblin island in vii, several rare monsters on small islands in ix (though ix sort of encourages you to explore small islands), and I don't remember specifics, but I think there are some rare monsters only appearing in some specific parts of the ocean that can only be encountered while riding the ship in v.

Isn't the yellow dragon a rare encounter on one floor in bab-il? I think after you fall through the trap door in the crystal room?
 :edit: No. I was thinking of the Green Dragon. Sorry.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Kain Now Learns Spell from Dragon Foes)
Post by: Grimoire LD on January 21, 2014, 08:16:23 PM
I thought so too, but when I looked in the data and rechecked with the reference site, I didn't see any reference. I do believe though that the Yellow Dragon is an enemy in a chest in the Tower of Babil, which is probably why my memory told me that he was encounterable normally in the Tower of Babil.

The Green Dragon however is all over the Tower of Babil Revisited (as a rare encounter), which has the same graphic as the Yellow Dragon. Which probably also threw me off.

So I decided to take a closer look at the Damage and Healing Spell Routines, because I never actually copied them since Yousei did it long ago, I didn't think too much of them, but now I'm starting to think that I can make an "Item Lore" function from them...

(Heavily borrowed from Yousei's notes, but this is for 1.1 and cuts down on that confusion and is easier for me to make use of)
Damaging Spells

Code: [Select]
$03/D388 20 FD E0 JSR $E0FD  [$00:E0FD] A:0001 X:0100 Y:1A35 P:envMxdIzC - Jump to Elemental Determination
$03/D38B AD FE 38 LDA $38FE  [$00:38FE] A:0001 X:0100 Y:1A35 P:envMxdIzC - Load Result.
$03/D38E 10 08 BPL $08    [$D398] A:0001 X:0100 Y:1A35 P:envMxdIzC - If it is positive branch to rest of routine.
$03/D390 29 7F AND #$7F A:0001 X:0100 Y:1A35 P:envMxdIzC - Get rid of the negative amounts.
$03/D392 8D FE 38 STA $38FE  [$00:38FE] A:0001 X:0100 Y:1A35 P:envMxdIzC - Store A in 7E38FE.
$03/D395 4C 26 D4 JMP $D426  [$00:D426] A:0001 X:0100 Y:1A35 P:envMxdIzC - Jump to Healing Routine
------------------------------------------------------------------------------------------
$03/D398 20 30 E1 JSR $E130  [$00:E130] A:0001 X:0100 Y:1A35 P:envMxdIzC - Jump to Weakness Subroutine
-----------------------------------------------------------------------------------------------
$03/D39B AD 04 27 LDA $2704  [$00:2704] A:0001 X:0100 Y:1A35 P:envMxdIzC - Load Target's Status Byte 2.
$03/D39E 29 40 AND #$40 A:0001 X:0100 Y:1A35 P:envMxdIzC - Is it Floating?
$03/D3A0 F0 1C BEQ $1C    [$D3BE] A:0001 X:0100 Y:1A35 P:envMxdIzC - If not, branch to Damage Determination.
--------------------------------------------------------------------------------
$03/D3A2 AD 2A 35 LDA $352A  [$00:352A] A:0001 X:0100 Y:1A35 P:envMxdIzC - Was an Item used?
$03/D3A5 D0 10 BNE $10    [$D3B7] A:0001 X:0100 Y:1A35 P:envMxdIzC - If so branch to Quake Drum check.
---------------------------------------------------------------------------
$03/D3A7 AD D2 26 LDA $26D2  [$00:26D2] A:0001 X:0100 Y:1A35 P:envMxdIzC - Load Caster's Action Taken.
$03/D3AA C9 28 CMP #$28 A:0001 X:0100 Y:1A35 P:envMxdIzC - Is it Quake?
$03/D3AC F0 13 BEQ $13    [$D3C1] A:0001 X:0100 Y:1A35 P:envMxdIzC - If so branch to End.
-----------------------------------------------------------------------------------------------------------------------------------------
$03/D3AE C9 55 CMP #$55 A:0001 X:0100 Y:1A35 P:envMxdIzC - Is it Titan?
$03/D3B0 F0 0F BEQ $0F    [$D3C1] A:0001 X:0100 Y:1A35 P:envMxdIzC - If so branch to end.
--------------------------------------------------------------------------------------------------------------------------------------
$03/D3B2 C9 A1 CMP #$A1 A:0001 X:0100 Y:1A35 P:envMxdIzC - Is it (Enemy) Quake?
$03/D3B4 D0 08 BNE $08    [$D3BE] A:0001 X:0100 Y:1A35 P:envMxdIzC - If not branch to Damage Determination.
$03/D3B6 60 RTS A:0001 X:0100 Y:1A35 P:envMxdIzC - Return
--------------------------------------------------------------------------------------------------------------------------
$03/D3B7 AD D2 26 LDA $26D2  [$00:26D2] A:0001 X:0100 Y:1A35 P:envMxdIzC - Load Caster's Action taken.
$03/D3BA C9 C7 CMP #$C7 A:0001 X:0100 Y:1A35 P:envMxdIzC - Is it Quake Drum?
$03/D3BC F0 03 BEQ $03    [$D3C1] A:0001 X:0100 Y:1A35 P:envMxdIzC - If so branch to End.
$03/D3BE 20 AF C9 JSR $C9AF  [$00:C9AF] A:0001 X:0100 Y:1A35 P:envMxdIzC - Damage Determination.
$03/D3C1 60 RTS A:0001 X:0100 Y:1A35 P:envMxdIzC - Return

I'm wondering if I can use that Item check in sacrificing the Gaia Drum (small loss) and  Titan's float check to look at Item-Character Parameter-x2 to Damage Tally. I think it may be worth the sacrifice.

Item Lore?
Code: [Select]
$03/D39B AD 2A 35 LDA $352A  [$00:352A] A:0002 X:004B Y:0000 P:envMxdizc - Was an Item used?
$03/D39E D0 13 BNE $13    [$D3B3] A:0002 X:004B Y:0000 P:envMxdizc - If so, branch to Item Section.
--------------------------------------------------------------------------------------------------------------------------------------
$03/D3A0 AD 04 27 LDA $2704  [$00:2704] A:0002 X:004B Y:0000 P:envMxdizc - Load Target's Status Byte 02.
$03/D3A3 29 40 AND #$40 A:0002 X:004B Y:0000 P:envMxdizc - Is it Float?
$03/D3A5 F0 17 BEQ $17   [$D3BE] A:0002 X:004B Y:0000 P:envMxdizc - If not branch to Damage Determination
----------------------------------------------------------------------------------------------------------------------------------.
$03/D3A7 AD D2 26 LDA $26D2  [$00:26D2] A:0002 X:004B Y:0000 P:envMxdizc - Load Caster's Action into A.
$03/D3AA C9 28 CMP #$28 A:0002 X:004B Y:0000 P:envMxdizc - Is it Quake?
$03/D3AC F0 13 BEQ $13    [$D3C1] A:0002 X:004B Y:0000 P:envMxdizc - If so branch to End.
$03/D3AE C9 A1 CMP #$A1 A:0002 X:004B Y:0000 P:envMxdizc - Is it (Enemy) Quake? -
$03/D3B0 D0 0C BNE $0C   [$D3EB] A:0002 X:004B Y:0000 P:envMxdizc - If not, branch to Damage
$03/D3B2 60 RTS A:0002 X:004B Y:0000 P:envMxdizc - Return
$03/D3B3 AD B0 26 LDA $26B0  [$00:26B0] A:0002 X:004B Y:0000 P:envMxdizc - Load Caster's Helmet into A.
$03/D3B6 C9 78 CMP #$78 A:0002 X:004B Y:0000 P:envMxdizc - Is it Leather Cap? (Scholar's Cap for me)
$03/D3B8 D0 05 BNE $04    [$D3BE] A:0002 X:004B Y:0000 P:envMxdizc - Branch if it is not to Damage Determination.
$03/D3BA 0E FE 38 ASL $38FE  [$00:38FE] A:0002 X:004B Y:0000 P:envMxdizc - x2 the Value in Damage Defining Fields
$03/D3BD EA NOP A:0002 X:004B Y:0000 P:envMxdizc - Space waster for the original code.
$03/D3BE 20 AF C9 JSR $C9AF  [$00:C9AF] A:0002 X:004B Y:0000 P:envMxdizc - Jump to Damage Routine.
$03/D3C1 60 RTS A:0002 X:004B Y:0000 P:envMxdizc - Return

And it works flawlessly!


(http://i112.photobucket.com/albums/n198/LastingDawn/ItemLore_zpsb41f6e68.png) (http://s112.photobucket.com/user/LastingDawn/media/ItemLore_zpsb41f6e68.png.html)

Observe Cecil's damage, 100-120 with a Lit-1 Item

(http://i112.photobucket.com/albums/n198/LastingDawn/ItemLore2_zps3b707ee1.png) (http://s112.photobucket.com/user/LastingDawn/media/ItemLore2_zps3b707ee1.png.html)
Now look at Palom's damage and notice that it is roughly twice of that.

In essence I succeeded in making Item Lore! Now that I have something in particular for Scholar, lets go with classic Chemist and see if I can't give them their version of Item Lore, also called "Alchemy".

Now let's take a look at the Healing Formula...

Curing Routine (Borrowed from Yousei's notes with 1.1 definitions)

Code: [Select]
$03/D41C AD 40 27 LDA $2740  [$7E:2740] A:00F0 X:01C3 Y:4510 P:envMxdIzc - Load Target's Creature Type into A.
$03/D41F 29 80 AND #$80 A:00F0 X:01C3 Y:4510 P:envMxdIzc - Is it Zombie?
$03/D421 F0 03 BEQ $03    [$D426] A:00F0 X:01C3 Y:4510 P:envMxdIzc - If not branch to 03D421
-------------------------------------------------------------------------------------------------------------------------------
$03/D423 4C BE D3 JMP $D3BE  [$02:D3BE] A:00F0 X:01C3 Y:4510 P:envMxdIzc - Jump to Damage Determination
------------------------------------------------------------------------------------------------------------------------------------------
$03/D426 AD 2A 35 LDA $352A  [$7E:352A] A:00F0 X:01C3 Y:4510 P:envMxdIzc - Was an Item used?
$03/D429 D0 1E BNE $1E    [$D449] A:00F0 X:01C3 Y:4510 P:envMxdIzc - If so skip the Cure 4 check.
-------------------------------------------------------------------------------------------------------------------------------------------
$03/D42B AD D2 26 LDA $26D2  [$7E:26D2] A:00F0 X:01C3 Y:4510 P:envMxdIzc - Load Caster's Action into A.
$03/D42E C9 11 CMP #$11 A:00F0 X:01C3 Y:4510 P:envMxdIzc - Is it Cure 4?
$03/D430 D0 17 BNE $17    [$D449] A:00F0 X:01C3 Y:4510 P:envMxdIzc - If not branch to Healing Routine.
-----------------------------------------------------------------------------------------------------------------------------------------------------
$03/D432 AD 06 39 LDA $3906  [$7E:3906] A:00F0 X:01C3 Y:4510 P:envMxdIzc - Load Number of Targets.
$03/D435 C9 01 CMP #$01 A:00F0 X:01C3 Y:4510 P:envMxdIzc - Is it 01?
$03/D437 D0 10 BNE $10    [$D449] A:00F0 X:01C3 Y:4510 P:envMxdIzc  - If not branch to Healing Routine.
------------------------------------------------------------------------------------------------------------------------------------------
$03/D439 C2 20 REP #$20 A:00F0 X:01C3 Y:4510 P:envMxdIzc - Make A support two bytes.
$03/D43B 38 SEC A:00F0 X:01C3 Y:4510 P:envmxdIzc - Set Carry Flag.
$03/D43C AD 09 27 LDA $2709  [$7E:2709] A:00F0 X:01C3 Y:4510 P:envmxdIzc - Load Target's Max HP into A.
$03/D43F ED 07 27 SBC $2707  [$7E:2707] A:00F0 X:01C3 Y:4510 P:envmxdIzc - Subtract it from Target's Current HP.
$03/D442 85 A4 STA $A4    [$00:00A4] A:00F0 X:01C3 Y:4510 P:envmxdIzc - Store  A in A4. (Yousei explained it well...) ";damage done to target = target's max HP target's ;current HP"
$03/D444 7B  TDC A:00F0 X:01C3 Y:4510 P:envmxdIzc - Clear A.
$03/D445 E2 20 SEP #$20 A:00F0 X:01C3 Y:4510 P:envmxdIzc - Set A back to one byte.
$03/D447 80 03 BRA $03    [$D44C] A:00F0 X:01C3 Y:4510 P:envMxdIzc - Branch to special portion.
$03/D449 20 AF C9 JSR $C9AF  [$02:C9AF] A:00F0 X:01C3 Y:4510 P:envMxdIzc - Jump to Healing Routine/Damage Determination.
$03/D44C A5 A5 LDA $A5    [$00:00A5] A:00F0 X:01C3 Y:4510 P:envMxdIzc - Load A5 into A.
$03/D44E 09 80 ORA #$80 A:00F0 X:01C3 Y:4510 P:envMxdIzc - Add an 80 (Heal Flag) if not already done so.
$03/D450 85 A5 STA $A5    [$00:00A5] A:00F0 X:01C3 Y:4510 P:envMxdIzc - Store A in A5.
$03/D452 60 RTS A:00F0 X:01C3 Y:4510 P:envMxdIzc - Return.

Hmm, the obvious code to look at and get rid of is the Cure 4 check. I don't think it's necessary by any means. But will it give me enough space? There is already an item check for... some reason. Unless someone were to give the Silver Staff a Healing Spell (which it doesn't have), it was superfluous in the first place, which I can use to link to the Cure 4 code and have other things skip by it. Basically this one is all but wrapped in a bow for me.

Well... that didn't take long at all. Good bye Cure 4 Check and hello Ring-Dependent Alchemy!

Now this is full of redundant and old code, that I didn't want to touch as there was no need for my purposes. I have it working exactly as I had hoped.

Code: [Select]
$03/D426 AD 2A 35 LDA $352A  [$7E:352A] A:00F0 X:01C2 Y:4510 P:eNvMxdIzc - Is it an Item?
$03/D429 F0 1E BEQ $1E    [$D449] A:00F0 X:01C2 Y:4510 P:eNvMxdIzc - If not branch to Healing Routine.
$03/D42B AD B2 26 LDA $26B2  [$7E:26B2] A:00F0 X:01C2 Y:4510 P:eNvMxdIzc - Load Gauntlet into A.
$03/D42E C9 AF CMP #$AF A:00F0 X:01C2 Y:4510 P:eNvMxdIzc - Is it the Chemist Gloves? (Cursed Ring)
$03/D430 D0 17 BNE $17    [$D449] A:00F0 X:01C2 Y:4510 P:eNvMxdIzc - If not, branch to Damage routine.
$03/D432 0E FE 38 ASL $38FE  [$7E:38FE] A:00F0 X:01C2 Y:4510 P:eNvMxdIzc - x2 Damage/Healing Field.
$03/D435 C9 06 CMP #$06 A:00F0 X:01C2 Y:4510 P:eNvMxdIzc - Remnant.
$03/D437 D0 10 BNE $10    [$D449] A:009D X:0004 Y:0000 P:eNvMxdizC - Leads to final calculation.

(http://i112.photobucket.com/albums/n198/LastingDawn/Alchemy2_zps2f6576b2.png) (http://s112.photobucket.com/user/LastingDawn/media/Alchemy2_zps2f6576b2.png.html)
When Rosa uses an Item she only heals the normal amount.


(http://i112.photobucket.com/albums/n198/LastingDawn/Alchemy1_zps2774a93a.png) (http://s112.photobucket.com/user/LastingDawn/media/Alchemy1_zps2774a93a.png.html)
But when someone with the right Accessory uses it, the healing done is doubled!
And in one fell swoop, with a little bit of research I accomplish both of my goals. Item Lore/Alchemy is complete!

This should increase the use of Battle Items while also making a chosen character better for using healing items.

So my Scholar Class (should I ever make one) could have... Piercing Sight, Black and White Magic, and (Default class specialty, not a command) Item Lore. Not a bad skillset all things considered.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Kain Now Learns Spell from Dragon Foes)
Post by: Grimoire LD on January 21, 2014, 11:08:40 PM
Well this "hack" is right up there with changing Search to Taunt.

Damage, Status (Unused) to Regen

$03/DD92   20 FA E3   JSR $E3FA  [$03:E3FA]   A:0003   X:0050   Y:FFFF   P:envMxdizc

In addition I changed the healing of Regen to be less static, instead it recovers HP equal to the Caster's Will. It still makes little sense to me why they chose to make this into a command rather than a Spell because... it works perfectly fine As a spell.

$03/E3FD   AE 98 26   LDX $2698  [$7E:2698]   A:0003   X:0050   Y:0000   P:envMxdizc

Title: Re: Grimoire LD's Notes, Patches, and Hacks (Kain Now Learns Spell from Dragon Foes)
Post by: LordGarmonde on January 22, 2014, 12:18:29 AM
In addition I changed the healing of Regen to be less static, instead it recovers HP equal to the Caster's Will. It still makes little sense to me why they chose to make this into a command rather than a Spell because... it works perfectly fine As a spell.

I can't figure out why they would think to lock-up FuSoYa while using it. Fortunately the fix for that is just one toggle away in FF4kster  :wink:

Well this "hack" is right up there with changing Search to Taunt.

- Love it! :childish:
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Kain Learns Spells from Dragon Foes)
Post by: Grimoire LD on January 22, 2014, 11:05:32 PM
Well this next post is small, and more for my own purposes. I wanted to make Cid use a "Mechanize" skill that would turn his foes into Robots and while everything looked fine on the surface I couldn't get it to actually "stick" to enemies (despite being put into their temporary stats, it isn't carried out of it) so I thought to look at something that would fit with Cid's character, but effect him. Then I thought to take the idea presented in FFIV DS of "Upgrade" where it uses an elemental item to apply that element to the weapon, and use it in a different manner.

This instead is called "Coat Hammer". If the first item in your inventory is Maiden's Kiss, Echo Herb, Dwarf Bread, Eyedrops, or Antidote, the status it would cure is applied to Cid's Weapon. So say you have an Antidote as the item in the first slot, this would put Poison on Cid's Weapon. It also uses the item, but in this a glitch appeared that I cannot figure out... though the item decrements correctly, it still looks to have its original value until used or moved.

This routine also makes an exception for when you have 1 Item left and that's to end the routine.

Now I am not feeling all that well today so this code is a little sloppier than I ordinarily produce, however it works fine. You can tell it worked when a cloud of smoke is shown around Cid (to symbolize him "working" on something.) And it fails when no cloud of smoke appears.

This gives an added use to Status Healing Items and can make Cid into a fairly versatile character.

I thought this a neat way to show him as an Engineer and as a fairly knowledgeable fellow in a different way from Item Lord.

The lost command was Cry this time.

Code: [Select]
$03/EAE0 4C CF FF JMP $FFCF  [$02:FFCF] A:00F0 X:01CF Y:0010 P:eNvMxdIzc  - New Jump Point (used by later in Routine)
------------------------------------------------------------------------------------------------------------------------------------------------
$03/EAE6 A6 A6 LDX $A6    [$00:00A6] A:004A X:000D Y:012D P:envMxdIzc - Load Slot of User.
$03/EAE8 AD 1C 32 LDA $321C  [$7E:321C] A:004A X:000D Y:012D P:envMxdIzc - Load First Item Quantity into A.
$03/EAEB C9 02 CMP #$02 A:004A X:000D Y:012D P:envMxdIzc - Is there two or more?
$03/EAED B0 01 BCS $01    [$EAF0] A:004A X:000D Y:012D P:envMxdIzc - If so skip past the Return
----------------------------------------------------------------------------------------------------------------------------------
$03/EAEF 60 RTS A:004A X:000D Y:012D P:envMxdIzc - Return
--------------------------------------------------------------------------------------------------------------------------------------
$03/EAF0 AD 1B 32 LDA $321B  [$7E:321B] A:004A X:000D Y:012D P:envMxdIzc - Load First Item into A.
$03/EAF3 C9 D6 CMP #$D6 A:004A X:000D Y:012D P:envMxdIzc - Is it Maiden's Kiss?
$03/EAF5 D0 04 BNE $04    [$EAFB] A:004A X:000D Y:012D P:envMxdIzc - If not, branch to next check.
$03/EAF7 A9 20 LDA #$20 A:004A X:000D Y:012D P:envMxdIzc  - Load 20 into A (Frog)
$03/EAF9 80 1E BRA $1E    [$EB19] A:004A X:000D Y:012D P:envMxdIzc - Branch to Status Storing.
--------------------------------------------------------------------------------------------------------------------------------------
$03/EAFB C9 D7 CMP #$D7 A:004A X:000D Y:012D P:envMxdIzc - Is it Dwarf's Bread?
$03/EAFD D0 04 BNE $04    [$EB03] A:004A X:000D Y:012D P:envMxdIzc - If not, branch to next check.
$03/EAFF A9 10 LDA #$10 A:004A X:000D Y:012D P:envMxdIzc - Load 10 into A (Mini)
$03/EB01 80 16 BRA $16    [$EB19] A:004A X:000D Y:012D P:envMxdIzc - Branch to Status Storing.
-------------------------------------------------------------------------------------------------------------------------------------
$03/EB03 C9 D9 CMP #$D9 A:004A X:000D Y:012D P:envMxdIzc - Is it EchoHerb?
$03/EB05 D0 04 BNE $04    [$EB0B] A:004A X:000D Y:012D P:envMxdIzc - If not, branch to next check.
$03/EB07 A9 04 LDA #$04 A:004A X:000D Y:012D P:envMxdIzc - Load 04 into A (Silence)
$03/EB09 80 0E BRA $0E    [$EB19] A:004A X:000D Y:012D P:envMxdIzc - Branch to Status Storing.
-------------------------------------------------------------------------------------------------------------------------------------------------
$03/EB0B C9 DA CMP #$DA A:004A X:000D Y:012D P:envMxdIzc - Is it Eyedrops?
$03/EB0D D0 04 BNE $04    [$EB13] A:004A X:000D Y:012D P:envMxdIzc - If not, branch to next check.
$03/EB0F A9 02 LDA #$02 A:004A X:000D Y:012D P:envMxdIzc - Load 02 into A (Bliind)
$03/EB11 80 06 BRA $06    [$EB19] A:004A X:000D Y:012D P:envMxdIzc - Branch to Status Storing.
-----------------------------------------------------------------------------------------------------------------------------------------------------
$03/EB13 C9 DB CMP #$DB A:004A X:000D Y:012D P:envMxdIzc - Is it Antidote?
$03/EB15 D0 C9 BNE $C9    [$EAE0] A:00F0 X:01CF Y:0010 P:eNvMxdIzc - If none of the current items match, Branch back to new Jump. (Covered Below)
----------------------------------------------------------------------------
$03/EAE0 4C CF FF JMP $FFCF  [$02:FFCF] A:00F0 X:01CF Y:0010 P:eNvMxdIzc - (New Coat Weapon Area)
$03/EB17 A9 01 LDA #$01 A:004A X:000D Y:012D P:envMxdIzc - Load 01 into A (Poison)
-------------------------------------------------------------------------------------------------------------------------------------------------------
$03/EB19 9D 1E 20 STA $201E,x[$7E:202B] A:004A X:000D Y:012D P:envMxdIzc - Store A in Attack Status 1.
$03/EB1C CE 1C 32 DEC $321C  [$7E:321C] A:004A X:000D Y:012D P:envMxdIzc - Subtract 1 from Item Quantity.
-----------------------------------
(New Section - using a copy of the data in Item Master's code to load the item, subtract it by 1, and save it back.)
$03/EB1F A9 45 LDA #$45 A:004A X:000D Y:012D P:envMxdIzc - Load Smoke's Graphic into A.
$03/EB21 8D C5 33 STA $33C5  [$7E:33C5] A:004A X:000D Y:012D P:envMxdIzc - Store A in Audiovisual Cue.
$03/EB24 60 RTS A:004A X:000D Y:012D P:envMxdIzc - Return.

Extra Functionality for Coat Weapon
Code: [Select]
$03/FFCF C9 B8 CMP #$B8 A:00F0 X:01CF Y:0010 P:eNvMxdIzc - Is the Item VampFang?
$03/FFD1 D0 07 BNE $07    [$FFDA] A:00F0 X:01CF Y:0010 P:eNvMxdIzc - If not branch to Carrot/Greens Check.
----------------------------------------------------------------------------------------------------------------------------------
$03/FFD3 A9 40 LDA #$40 A:00F0 X:01CF Y:0010 P:eNvMxdIzc - Load 40 (Drain) into A.
$03/FFD5 9D 19 20 STA $2019,x[$7E:21E8] A:00F0 X:01CF Y:0010 P:eNvMxdIzc - Store A in Weapon Elemental.
$03/FFD8 80 08 BRA $08    [$FFE2] A:00F0 X:01CF Y:0010 P:eNvMxdIzc - Branch to Jump back to normal routine.
-----------------------------------------------------------------------------------------------------------------------------------
$03/FFDA C9 EB CMP #$EB A:00F0 X:01CF Y:0010 P:eNvMxdIzc - Is the Item Carrot/Greens?
$03/FFDC D0 08 BNE $08    [$FFE6] A:00F0 X:01CF Y:0010 P:eNvMxdIzc - If not, branch to End.
$03/FFDE A9 FF LDA #$FF A:00F0 X:01CF Y:0010 P:eNvMxdIzc - Load FF into A (255 Accuracy)
$03/FFE0 9D 1C 20 STA $201C,x[$7E:21EB] A:00F0 X:01CF Y:0010 P:eNvMxdIzc - Store A in Physical Accuracy.
$03/FFE3 4C 1C EB JMP $EB1C  [$02:EB1C] A:00F0 X:01CF Y:0010 P:eNvMxdIzc - Jump back to normal Routine.
$03/FFE6 60 RTS A:00F0 X:01CF Y:0010 P:eNvMxdIzc - Return Out of Routine.


 :edit: 2/5/2014 Added a fix for the Coat Hammer skill to properly decrement an item.

 :edit: 7/27/2014 Added a new functionality which looks at the Drain Item and the Gysahl Greens Item (changed for my purposes)

Because Whistles (10 GP in every store) have replaced all need of the Big Chocobo spots, Gysahl Green/Carrots in my hack are being turned into Homing Devices (Wrench)Homing. This will give Cid 255 Accuracy for the rest of the battle as long as he doesn't switch his weapons. This combined with the innate power of the other Coat Hammer statuses can be a powerful combination. As this should guarantee that each hit will 100% apply the status.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Cid uses Items to give Status to Foes!)
Post by: Grimoire LD on January 23, 2014, 01:30:22 AM
I made a small change to Kick, giving it like some of my other command and spells (Twin, Steal, Curing, Damaging)  an Equipment defined specific function.

First off, I got rid of that idiotic jump at the start which takes it... to its current location and used that free space to add in a "Load Armor" function. Because Dark Wave isn't using Kick any longer as a base, I used that part which looks at Dark Wave and instead made it look at Armor. If Yang is wearing no Armor (reference to FFI where a Monk is strongest when not wearing Armor of any kind) the Kick does roughly double damage. Making it as powerful as classic Dark Wave without the 1/8th HP Loss.

Situationally useful as are many of my hacks it seems.

$03/E71D   AD B1 26   LDA $26B1  [$7E:26B1]   A:0002   X:0080   Y:0000   P:envMxdizc - Load User's Armor into A.
$03/E720   F0 08   BEQ $08    [$E72A]   A:0000   X:0080   Y:0000   P:envMxdiZc - If none, branch past the /2 Power.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Cid uses Items to give Status to Foes!)
Post by: Grimoire LD on January 23, 2014, 03:42:57 PM
Gird has been reworked to not be useless, but at the same time, not be overpowered, going off of the FFI Theme where a Monk's Defense was equal to their level, Gird does just this. Gird will change Yang's defense to his current level. In addition if you have a new helmet called the Master's Wrap equipped, it will add Yang's current Agility to the Level defense, making it even more effective. This only happens if you use Gird though and is more or less meant to be used in combination with builds that use Strengthened Kick.

Code: [Select]
$03/E696 A6 A6 LDX $A6    [$00:00A6] A:0003 X:001E Y:0000 P:envMxdizc - Load Slot of User into X..
$03/E698 AD 82 26 LDA $2682  [$7E:2682] A:0003 X:0080 Y:0000 P:envMxdizc - Load Caster's Level into A
$03/E69B 9D 2A 20 STA $202A,x[$7E:20AA] A:000A X:0080 Y:0000 P:envMxdizc - Store A in Character's Defense.
$03/E69E AD B0 26 LDA $26B0  [$7E:26B0] A:000A X:0080 Y:0000 P:envMxdizc - Load Equipped Helmet.
$03/E6A1 C9 80 CMP #$80 A:0000 X:0080 Y:0000 P:envMxdiZc - Is it Glass Mask/Master's Wrap?
$03/E6A3 D0 0E BNE $0E    [$E6B3] A:0000 X:0080 Y:0000 P:envMxdiZC - If not, branch to End.
-------------------------------------------------------------------------------------------------------------------------------------
$03/E6A5 AD 82 26 LDA $2682  [$7E:2682] A:0000 X:0080 Y:0000 P:envMxdiZC - Load Caster's Level into A.
$03/E6A8 6D 95 26 ADC $2695  [$7E:2695] A:000A X:0080 Y:0000 P:envMxdizC - Add Caster's Agility onto A.
$03/E6AB 9D 2A 20 STA $202A,x[$7E:20AA] A:0013 X:0080 Y:0000 P:envMxdizc - Store A in Character's Defense.
$03/E6AE A9 05 LDA #$05 A:0013 X:0080 Y:0000 P:envMxdizc - Load the Protect Graphic into A.
$03/E6B0 8D C4 33 STA $33C4  [$7E:33C4] A:0005 X:0080 Y:0000 P:envMxdizc - Store A in Audiovisual Cue.
$03/E6B3 60 RTS A:0005 X:0080 Y:0000 P:envMxdizc - Return.

Now this leaves only Focus to modify, hmm...
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Cid uses Items to give Status to Foes!)
Post by: Grimoire LD on January 23, 2014, 07:01:01 PM
Changes made to make Focus more effective.

1. In the Fight Routine - Changed it so Focus does not lose potency when attacking the backrow. (03C564)
2. In the Fight Routine - Changed it so Focus no longer divides defenses by 2. (Instead this has been put on Berserk) (03C740)

That completes Yang

And that leaves only Boast... Boast is a fine enough skill that I might leave it alone, but I don't want it to do the same thing, hmm...

I think I'll give it to Tellah, change it to a x2 store, and make it cycle through the Elements. "Ele(Sword)" symbol should do... or maybe just have it call a random number between 1-20 and apply it to the sword. That way it won't be "all right, let's use this 4 times for Holy Elemental..." and is a bit more freeform...

And that's what I decided on.

So... looks like I didn't Really keep Boast in any fashion after all.

Boast to Elemental Weapon
Code: [Select]
EAC3 A2 01 00 LDX #$0001 A:0003 X:0022 Y:0000 P:envMxdizc - Load 0001 into X.
$03/EAC6 A9 40 LDA #$40 A:0003 X:0001 Y:0000 P:envMxdizc - Load 40 into A (01-40 is the amount that can be reached)
$03/EAC8 20 79 83 JSR $8379  [$03:8379] A:0040 X:0001 Y:0000 P:envMxdizc - Jump to RNG Routine.
$03/EACB A6 A6 LDX $A6    [$00:00A6] A:001D X:0000 Y:0000 P:eNvMxdizc - Load Slot into X.
$03/EACD 9D 19 20 STA $2019,x[$7E:2099] A:001D X:0080 Y:0000 P:envMxdizc - Store New Weapon Element into A.
$03/EAD0 A9 81 LDA #$81 A:001D X:0080 Y:0000 P:envMxdizc - Load Magnet graphic into A.
$03/EAD2 8D C5 33 STA $33C5  [$7E:33C5] A:0081 X:0080 Y:0000 P:eNvMxdizc - Store A Audiovisual Cue.
$03/EAD5 A9 12 LDA #$12 A:0081 X:0080 Y:0000 P:eNvMxdizc - Load Message 12 (Forces swirl around weapon) into A.
$03/EAD7 8D CA 34 STA $34CA  [$7E:34CA] A:0012 X:0080 Y:0000 P:envMxdizc - Store A in Message
$03/EADA 4C A6 85 JMP $85A6  [$03:85A6] A:0012 X:0080 Y:0000 P:envMxdizc - Jump to Message Display Routine

And there we go! That is the final basic routine that had yet to be modified (not that you can call some of the things I've done "modifying" allowing Focus to deal full damage to the back row and not take increased damage isn't really modification) There's still a bit of free space, especially in regards to the Crash command which could have a new home eventually)


With the preliminary work all but complete, I think I can legitimately get to work on my project, now that I am confident it won't be seen as too similar to the base game.

 :edit: 85A6 not 81A6! And I was wondering why Elemental Sword was crashing the game... how absolutely stupid of me.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Cid uses Items to give Status to Foes!)
Post by: LordGarmonde on January 23, 2014, 10:31:58 PM
...
With the preliminary work all but complete, I think I can legitimately get to work on my project, now that I am confident it won't be seen as too similar to the base game.

I'm confident too - and in a good way, not the  :wtf: way  :tongue:

I can't wait to see it all come together. Good luck!  :yabin:
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Cid uses Items to give Status to Foes!)
Post by: chillyfeez on January 24, 2014, 11:55:12 PM
Hey, Grimoire.
Quck question - the spell visuals for Kain's SkyRv command... which spell do they come from?
It doesn't look like Lit 1, 2 or 3.
Is it Indra or Blitz?
I ask because I'm hoping beyond hope it's the Lit-Bolt item.
I figure the AV for the three elemental spell items must follow the same format that spells do, but I've never seen the data documented.
 :hmm:
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Cid uses Items to give Status to Foes!)
Post by: Grimoire LD on January 26, 2014, 12:53:42 PM
Oh no, it's Lit-Bolt.  Hmm... did I never fully explain this yet?

 Default Graphics (not overtaken by the Summon Orbs) of summons are used in different ways when called by items. Chocobo (FireBomb), Shiva (IceBomb), Ramuh (LitBolt) Indra(Crystal), Bomb Core(Bomb). This is why their default graphics have things listed, while other summons don't. So if you want to use FireBomb, IceBomb, Lit-Bolt Graphics you would look at the graphics that are there on the Default Summon.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Cid uses Items to give Status to Foes!)
Post by: chillyfeez on January 26, 2014, 02:20:10 PM
 :omg:
Thanks!

I must have just missed wherever that's explained (whether by you or someone else) because FF4kster seems to know about it, too...
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Cid uses Items to give Status to Foes!)
Post by: Grimoire LD on January 26, 2014, 04:57:57 PM
For a long time I thought it was a specific "It's looking at This graphic pointer, which means that because this is an Item it's actually looking at That graphic pointer... somewhere". I was wrong and I think I found this out... a couple weeks ago, I don't know if I actually posted it.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Cid uses Items to give Status to Foes!)
Post by: chillyfeez on January 26, 2014, 08:56:40 PM
Well anyway, this is great to know. My grown-up Palom is going to be able to learn Fire/Ice/Lit-4, and now I have access to appropriate graphics!
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Cid uses Items to give Status to Foes!)
Post by: Grimoire LD on January 26, 2014, 10:13:40 PM
The -ja level spells did originate with FFI of all things with Diaja. (HRM4) it wouldn't be unfitting to have them in FFIV, or any FF for that matter. A good choice!
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Cid uses Items to give Status to Foes!)
Post by: Grimoire LD on January 30, 2014, 09:19:23 PM
Well, here's a check I never knew existed! It's quite baffling that it does as in the normal game it goes nearly completely unused to my knowledge...

Code: [Select]
$03/F14E B9 1C 29 LDA $291C,y[$7E:291C] A:0000 X:0109 Y:0000 P:envMxdiZc - Load Spell to Learn into A.
$03/F151 85 B9 STA $B9    [$00:00B9] A:0020 X:0109 Y:0000 P:envMxdizc - Store it in B9.
$03/F153 C9 FF CMP #$FF A:0020 X:0109 Y:0000 P:envMxdizc - Is it FF? (No spell?)
$03/F155 F0 2E BEQ $2E    [$F185] A:0020 X:0109 Y:0000 P:envMxdizc - If so branch to End.
$03/F157 C9 19 CMP #$19 A:0020 X:0109 Y:0000 P:envMxdizc - Is it White Magic?
$03/F159 B0 06 BCS $06    [$F161] A:0020 X:0109 Y:0000 P:envMxdizC - If greater than White Magic branch to Black Magic Check
-----------------------------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------------------------------
$03/F161 C9 31 CMP #$31 A:0020 X:0109 Y:0000 P:envMxdizC - Is it Black Magic?
$03/F163 B0 07 BCS $07    [$F16C] A:0020 X:0109 Y:0000 P:eNvMxdizc - If not, branch elsewhere.

I think I understand its purpose. It's so the proper magic is put into its proper spell book. But the game uses this only for Three Spells from Child Rydia's White Spellbook. No other character Learns spells that can use Black and White Magic. So if you want your spell books to mix and match the schools of magic you want to actually do something a little different...

Instead of going through any of these needless checks you want to change 03F157 to...

$03/F157   9D 60 15   STA $1560,x[$7E:1579]   A:000C   X:0019   Y:0000   P:envMxdizc
$03/F15A   F0 1F   BEQ $1F    [$F17B]   A:000C   X:0019   Y:0000   P:envMxdizc

That way it adds the spell to the spellset properly. Without any worry of what the spell number is...

I just tested this with two spellbooks and it really is a Useless check, only included to prevent Black and White magic to be learned in the "wrong set" as located on the Job's spellset links. It is a Bizarre thing, to say the least. But at least I finally fixed it for myself. (A Dark Knight Cecil with Break skills labeled White Magic is not my idea of sense.)

Title: Re: Grimoire LD's Notes, Patches, and Hacks (Cid uses Items to give Status to Foes!)
Post by: chillyfeez on January 30, 2014, 10:47:20 PM
Out of curiousity, how did you even stumble upon that?

MAN... Did'ja ever stop and think about how much is going on in the LoROM 30000s in this game? And if I'm not mistaken there is no 30000-37FFF.
 :hmm:
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Cid uses Items to give Status to Foes!)
Post by: Grimoire LD on January 30, 2014, 10:58:46 PM
Oh yeah. There's a lot.

Well I was testing out a Combo Patch (basically a patch of everything I've made as patches so far and a few other little extras) and I noticed that though I gained Level 13, the game said "Cecil Learned (Sword)Armor!" That it wasn't appearing on his menu. So I did the logical thing and breakpointed on his spellbook. That's when I found that and the reasoning Why the spell wasn't being written (the Break skills replace White Magic while the Job Link is to his Black Magic section) I tried to play nice with it, but nothing worked so instead I just wrote the save to Data there and made a branch to the rest of the routine. Worked out fine. I still have no idea what is going on there.

Eh? Earlier 03 Bank? Hmm... let me think about that...

You're right. There doesn't appear to be any ASM routines or anything there. Just What is the lower part of that bank used for?
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Cid uses Items to give Status to Foes!)
Post by: Dragonsbrethren on January 30, 2014, 11:08:05 PM
That's just how LoROM works. There's nothing mapped to xx0000-xx7FFFF. That's the major difference between LoROM and HiROM, from a non-hardware standpoint.

 :edit:

This is the simplest reference I've found: http://romhack.wikia.com/wiki/SNES_ROM_layout (http://romhack.wikia.com/wiki/SNES_ROM_layout) (yes, on Wikia  :sad:)
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Cid uses Items to give Status to Foes!)
Post by: Grimoire LD on January 30, 2014, 11:27:17 PM
Thanks Dragonsbrethren. A peculiar way these machines work... in any case I have exciting news!

Here is the ComboPatch I just mentioned in the previous post! It is a culmination of all of my work that was in separate patches now combined into one large patch for a highly different experience than the normal game (some things were changed from the original patch as these things were altered in others e.g. the Change rod now uses the (updated) Cry Command instead of Recall because Recall became Dragon Speech, etc)

Various Bug Fixes! Including Infinite Arrow Fix, Monster Evasion/Magical Evasion, Fixed worthless spellbook check which does nothing except prevent different school of magic spells from being added to assign spellbook slot. (As far as I could make out)

Dark Knight/Paladin Cecil has Battle Skills
Kain can learn Spells from Wounded Dragons
Rydia has lost White Magic but has learned Geomancy
There is a chance on hit that certain Weapons will use specific Commands on Hit (e.g. Thief's Knife can use Steal)
There is a chance on hit that if the Weapon has magic that it will be used in addition to a normal attack. In this it is important to note it uses the character's Wisdom/Will rather than the Weapon's innate version.
Tellah can use Swords as to make his ability to use Battle Skills make sense.

Cry will reduce all Magic Evasion by the amount of Porom's Will.
Yang now has Fury which will cast Berserk on him when he uses it.
Cid now has Item Lord, which will look for the first usable item the player has and can make it hit a single target (for those powerful Attack Magic spells) or can be used to to split an item, in case of an Ether or Cure Potion for instance.
Songs now used are dependent on the Harp equipped, in addition Paladin Cecil can equip Harps and has Bardsong, and every Song you Sing will raise the attack of most of the party!

Rosa will, instead of Aim, have ArrowBarrage. Depending on her strength she may use 3 or even 4 normal attacks!
Finally, Edge can use Katanas that are in the inventory to unleash their power with a chance that they will break upon use with the Katana Soul command.

This is a combination of all of my patches thus far and a little extra. If you're looking for one complete package than here it is!

Will these changes make the game easier? Almost without a doubt, but that is because these are parts of what's for my real project and now that I have the preliminary work done you may look forward to seeing the progress on that soon enough which will make the new abilities invaluable to one's survival.

And this isn't all! You can think of these as a "taste" or a demo rather of what you can expect in the main project.

Title: Re: Grimoire LD's Notes, Patches, and Hacks (Combo Patch of other patches released!)
Post by: fedorajoe on January 31, 2014, 03:26:46 PM
Grimoire LD:  your work is impressive to say the least!!!

One thing that I wanted to do for my Playable Golbez hack was give Golbez a Pressure command.  The idea was to take the broken command that Cid was apparently supposed to have, and make it cast Hold on all enemies (kind of like what Golbez does when you fight him at the Dwarf Castle).  I was never clear on how to edit commands but it looks like you've pretty much mastered it.  Is this something that could be done?

Thanks!
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Combo Patch of other patches released!)
Post by: chillyfeez on January 31, 2014, 05:10:39 PM
Hey, fedorajoe (where you goin' with that gun in your hand) (sorry)
I know you didn't ask me, but it is absolutely possible.
Question, though... Do you want this command to simply target all enemies and cast Hold?
That could, theorhetically, be done simply by manipulating existing commands in FF4kster (I'm lookin at you, Gird and Pray).
It is, with a bit of hacking wizardry, possible to do more than that though. It could be made to have a better success rate than Hold, I can even think of a way for it to be permanent and successful against monsters that are immune to hold status (but that would probably be too cheap).
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Combo Patch of other patches released!)
Post by: fedorajoe on January 31, 2014, 05:38:24 PM
LOL  Hey chillyfeez, what's up?

I really didn't want to change one of the "normal" commands into Pressure.  I would only proceed if I could use the unused/broken command, since all of the other commands are in fact used in my hack, and I don't think it's worth dropping one of them just to put another gimmicky command onto Golbez (he's already got Dark Wave plus every Black Magic spell).

To answer your question though, yes, my intent was simply to have Golbez cast Hold on all enemies, at no MP cost.  I might have made adjustments to the accuracy/duration of the hold effect, but that was a secondary concern, because I don't want the command to be overly cheap.

Thanks!
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Combo Patch of other patches released!)
Post by: chillyfeez on January 31, 2014, 06:31:47 PM
I should be able to whip that up... given the five letter command name limit, what would you like the command to be called?
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Combo Patch of other patches released!)
Post by: fedorajoe on January 31, 2014, 07:10:28 PM
Oh wow neat!!! :omg:

I would probably just go with Press.  Actually I think I already changed the name of that command from Dummy to Press a long time ago, if memory serves!
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Combo Patch of other patches released!)
Post by: Grimoire LD on January 31, 2014, 07:28:30 PM
Hey Fedorajoe! I recall playing your Golbez patch a while ago, I absolutely loved it! And to think you did the vast majority of it without FF4kster's extremely helpful system! Now it looks like Chillyfeez is handling this part for you but it's actually a very simple process. You go to the location of the Command Pointers (LoRom- 03B37C), look for These values before and after it....

14 - 53E1 (03E153 - Peep)
15 - 0000 (030000 - Crash)
16 - 4CE3 (03E34C - Throw)

You change the 0000's snuggled in between there to...

(05 1E39D-1E3B6   (enemy runs away) 3E1B2-3E1CB) - (This is an unused command that might have been intended for lowering an enemy's "Steal Evade" to 00 Similar to FFI-III with a "fear" amount. It does nothing in the final game, instead there is a special exception made for Retreat within the Spell Routine code to change the sound of "dying" enemy, (and something small to do with graphics)
and the code to rob the player of the Exp. they would have earned had they defeated the foe. That makes this go completely unused.

For all intents and purposes we will change the 0000 to B2E1.

Now let's view the routine itself...

Quote
$03/E1B2   A9 04   LDA #$04   A:0003   X:0028   Y:0000   P:envMxdizc - Load 04 into A.
$03/E1B4   8D E6 38   STA $38E6  [$7E:38E6]   A:0004   X:0028   Y:0000   P:envMxdizc - Store A in 7E38E6
$03/E1B7   A6 A6   LDX $A6    [$00:00A6]   A:0004   X:0028   Y:0000   P:envMxdizc - Load X from A6
$03/E1B9   BD 03 20   LDA $2003,x[$7E:2003]   A:0004   X:0000   Y:0000   P:envMxdiZc - Load Indexed Slot's Status Byte 1 into A.
$03/E1BC   09 80   ORA #$80   A:0000   X:0000   Y:0000   P:envMxdiZc - Add 80 (Death) if applicable.
$03/E1BE   9D 03 20   STA $2003,x[$7E:2003]   A:0080   X:0000   Y:0000   P:eNvMxdizc - Store A in Indexed Slot's Status Byte 1.
$03/E1C1   A9 05   LDA #$05   A:0080   X:0000   Y:0000   P:eNvMxdizc - Load 05 into A. (Ran Away)
$03/E1C3   8D CA 34   STA $34CA  [$7E:34CA]   A:0005   X:0000   Y:0000   P:envMxdizc  - Store A in 7E34CA.
$03/E1C6   EE 0A 39   INC $390A  [$7E:390A]   A:0005   X:0000   Y:0000   P:envMxdizc - +1 to 7E390A.
$03/E1C9   4C 9B 85   JMP $859B  [$03:859B]   A:0005   X:0000   Y:0000   P:envMxdizc - Jump to Subroutine
-------------------------------------------------------------------------------------------------------
$03/859B   A9 F8   LDA #$F8   A:0005   X:0000   Y:0000   P:envMxdizc - Load F8 into A.
$03/859D   8D C2 33   STA $33C2  [$7E:33C2]   A:00F8   X:0000   Y:0000   P:eNvMxdizc - Store A in 7E33C2.
$03/85A0   A9 03   LDA #$03   A:00F8   X:0000   Y:0000   P:eNvMxdizc - Load 03 into A.
$03/85A2   8D C3 33   STA $33C3  [$7E:33C3]   A:0003   X:0000   Y:0000   P:envMxdizc - Store A in 7E33C3.
$03/85A5   60    RTS   A:0003   X:0000   Y:0000   P:envMxdizc - Return

Now to change this to just cast Hold is a well known matter now.

You would change this...
$03/E1B2   A9 04   LDA #$04   A:0003   X:0028   Y:0000   P:envMxdizc - Load 04 into A.
$03/E1B4   8D E6 38   STA $38E6  [$7E:38E6]   A:0004   X:0028   Y:0000   P:envMxdizc - Store A in 7E38E6
$03/E1B7   A6 A6   LDX $A6    [$00:00A6]   A:0004   X:0028   Y:0000   P:envMxdizc - Load X from A6


To this...


$03/E1B2   A9 01   LDA #$01   A:0039   X:0000   Y:0000   P:envMxdizC - Load 01 into A. (Hold)
$03/E1B4   8D D2 26   STA $26D2  [$7E:26D2]   A:00A2   X:0000   Y:0000   P:envMxdizC - Store A in Next Action to take.
$03/E1B7   4C 3E CD   JMP $CD3E  [$03:CD3E]   A:00A2   X:0000   Y:0000   P:envMxdizC - Jump to Spell Routine.

There is still a decent amount of free room here since this only takes 8 of the 19 (25) Bytes. You might even be able to get away with an item or stat conditional to increase the power of the command beyond just "Hold". I forget if Pressure was multi-targeted but the unused command by default is. 

Also I had created Taunt as well (which works on one enemy by reversing the functionality of Search), it would cost you Search though (which is used by... two enemies.)
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Combo Patch of other patches released!)
Post by: fedorajoe on January 31, 2014, 08:30:12 PM
Wow!  So I just tried that code and it works well.

One thing I noticed.  When you use the command, Golbez goes into his "about to do something" pose, as you would expect.  But, then he stays like that until his next turn, which looks odd.  It makes it look like he didn't do anything, especially if the command fails.  Would there be a way to change this so that he goes into, maybe, his "use item" pose while executing the command, and then returns to a normal waiting stance?

Also, since the command is basically just casting Hold, a text box comes up with the name of the spell.  Would there be any way to change this so that instead a message box comes up with text in it, like happens with some other commands?  (I don't know if this is really feasible, but thought I would ask, what the hell!  Not a big deal.)

Lastly, thank you for your kind comments on the Golbez hack!  I worked very hard on it!!!
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Combo Patch of other patches released!)
Post by: Grimoire LD on January 31, 2014, 09:48:26 PM
We most certainly can. If you change the 3ECD (this is part way through the magic routine. It is past the Spell Casting Poses) to 46CC you would have the entire spell casting pose (including the White Magic squares, which you might not want) but there is a way around that as well, but it will take a few more bytes... first before we get ahead of ourselves lets look at how messages are input... that too is a sequence of 8 bytes.

From my Dragon Speech hack...

A9 07   LDA #$07   A:0000   X:000E   Y:0000   P:eNvMxdizc - Load Message 07 into A (The Dragon is Prideful!)
8D CA 34   STA $34CA  [$7E:34CA]   A:0007   X:000E   Y:0000   P:envMxdizc - Store A in Message Data.
20 A6 85   JSR $85A6  [$03:85A6]   A:0007   X:000E   Y:0000   P:envMx - Jump to Message Input
60    RTS   A:0003   X:000E   Y:0000   P:envMxdizc - Return

I am afraid though we'd be cutting it close for a defined Sprite Animation change Unless you also want it tied to the message. (Command 07 is Recall which shows a special animation so the two would go hand in hand.

Here is how your routine would ideally look now...

$03/E1B2   A9 01   LDA #$01   A:0039   X:0000   Y:0000   P:envMxdizC - Load 01 into A. (Hold)
$03/E1B4   8D D2 26   STA $26D2  [$7E:26D2]   A:00A2   X:0000   Y:0000   P:envMxdizC - Store A in Next Action to take.
$03/E1B7   20 3E CD   JSR $CD3E  [$03:CD3E]   A:00A2   X:0000   Y:0000   P:envMxdizC - Jump to Start of Spell Routine
$03/E1BA   A9 07   LDA #$07   A:0000   X:000E   Y:0000   P:eNvMxdizc - Load Message 07 into A (unused, feel free to use it)
$03/E1BC   8D C4 33 STA $33C4  [$7E:33C4]   A:00C0   X:0046   Y:FFFF   P:eNvMxdizc - Store A in Audio/visual commands.
$03/E1BF  8D CA 34   STA $34CA  [$7E:34CA]   A:0007   X:000E   Y:0000   P:envMxdizc - Store A in Message Data.
$03/E1C2 4C A6 85   JMP $85A6  [$03:85A6]   A:0007   X:000E   Y:0000   P:envMx - Jump to Message Input Routine.




Title: Re: Grimoire LD's Notes, Patches, and Hacks (Combo Patch of other patches released!)
Post by: chillyfeez on January 31, 2014, 10:40:06 PM
Just got home from work. Looks like you don't need me to make a patch anymore?
My plan was to (mostly) copy the code from Gird into the big empty space at (LoROM) ~3FEFF.
The Gird code includes the instructions to display a battle message, so you could essentially make it say whatever you want.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Combo Patch of other patches released!)
Post by: fedorajoe on February 01, 2014, 12:11:50 AM
chillyfeez and Grimoire LD:  a big thank you to both of you for your assistance!

chillyfeez:  I would still be very interested in seeing what you would come up with, if you're still willing to give it a go.  Right now I want to get a handle on how this bit of the code works.  I've never looked at command editing before and it's quite interesting!

Grimoire LD:  I tried using the code that you provided.  It does come up with the blank message window and all.  But, it plays the animation for Slow before playing the animation for Hold, and I don't understand what is causing that.  Also, making the 3ECD/46CC substitution does not seem to affect the pose issue.

Thanks again!!!
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Combo Patch of other patches released!)
Post by: chillyfeez on February 01, 2014, 12:28:09 AM
If I can pull myself out of bed early enough tomorrow I'll put one together for you before I go to work. What I have planned shouldn't take too long.

Writing custom commands seems like such a daunting proposition, but once you read up on how they're put together in this game (which is all here, in great detail, thanks to Grimoire), and try it out a bit, you'll get the hang of it I'm sure. It's kinda nice that every little bit of game data is independently controlled, so you really can make a command that does whatever you can imagine with enough time and research.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Combo Patch of other patches released!)
Post by: Grimoire LD on February 01, 2014, 06:36:43 AM
Oh, I wasn't feeling very well last night and I forgot a clear basic, haha! Sorry about that. 07 is the Slow graphic.... C7 is the Recall Command, sorry. I've been feeling a bit under the weather and forgot that step.

Let's see then... the Routine can go up until CB so...


$03/E1B2   A9 01   LDA #$01   A:0039   X:0000   Y:0000   P:envMxdizC - Load 01 into A. (Hold)
$03/E1B4   8D D2 26   STA $26D2  [$7E:26D2]   A:00A2   X:0000   Y:0000   P:envMxdizC - Store A in Next Action to take.
$03/E1B7   20 3E CD   JSR $CD3E  [$03:CD3E]   A:00A2   X:0000   Y:0000   P:envMxdizC - Jump to Start of Spell Routine
$03/E1BA   A9 C7   LDA #$C7   A:0003   X:0046   Y:FFFF   P:envMxdizc - Load Recall Pose into A.
$03/E1BC   8D C4 33   STA $33C4  [$7E:33C4]   A:00C0   X:0046   Y:FFFF   P:eNvMxdizc - Store A in Audio/visual commands.
$03/E1BF   A9 07   LDA #$07   A:0000   X:000E   Y:0000   P:eNvMxdizc - Load Message 07 into A (unused, feel free to use it)
$03/E1C1  8D CA 34   STA $34CA  [$7E:34CA]   A:0007   X:000E   Y:0000   P:envMxdizc - Store A in Message Data.
$03/E1C4 4C A6 85   JMP $85A6  [$03:85A6]   A:0007   X:000E   Y:0000   P:envMx - Jump to Message Input Routine.

That should do it!
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Combo Patch of other patches released!)
Post by: LordGarmonde on February 01, 2014, 07:41:31 AM
Oh, I wasn't feeling very well last night and I forgot a clear basic, haha! Sorry about that...

It's ok; we still love you anyway!  :wink:

Seriously though - this is an impressive body of work. I'm glad that the forum is a standing fixture for reference; this is certainly the kind of wizardry that makes perfect sense when it is presented in class but then come homework time is like...huh??

I've much enjoyed watching these ideas develop and the continual expansion of what is possible! Praise now given time for a noob question: given what I've seen in looking at live dissasemblies everything in memory while the game is running is addressed BK:8000 - FFFF (BK= bank) - as was confirmed by Dragonsbrethren**:

That's just how LoROM works. There's nothing mapped to xx0000-xx7FFFF. That's the major difference between LoROM and HiROM, from a non-hardware standpoint...
This is the simplest reference I've found: http://romhack.wikia.com/wiki/SNES_ROM_layout (http://romhack.wikia.com/wiki/SNES_ROM_layout) (yes, on Wikia  :sad:)

My question (again, noob-alert) is how do I write up code to go in the ROM? My first attempts (with hooking into the map updating code around Mist) was done with the assembly kit making the changes as I went along (since it wasn't a long stretch) - but for what I am getting ready to try and code for my experience mod the obvious location for such a brick of code would be where the table is currently: 7B728-7C5C8...right? But if I'm understanding things correctly that ROM location would put me at 0F/B728-0F/C5C8 <-- does that work / is it a good idea or should I leave that area alone only for static reference data and have the work-horse code elsewhere? The second part to my question (even noobier) is how do I write it: When specifying addresses for loads would it be written in reference to where it is, or where it will be when the game is running?


 **A possible alternative reference is on Bazz's webpage; it's where I first read up in trying to figure this all out:

http://www.cs.umb.edu/~bazz/snes/lorom.html   

 :offtopic: What's wrong with Wikipedia? Obviously it shouldn't be cited professionally - but otherwise it's fine (as long as you check it yourself to make sure it hasn't changed). I once had a technician (age 65) as me how to spell 'Wikipedia' since I mentioned it as where I was able to look up info so quickly - I was about to tell him but stopped when I say him poised to write it in his lab notebook - then the spelling became "N...o...n...o...n...o"  :tongue:

Also funny: turns out Bazz isn't too far from me in Boston - Perhaps it's time to build the "Bazz-Signal" - lol  :happy:
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Combo Patch of other patches released!)
Post by: chillyfeez on February 01, 2014, 08:09:13 AM
Fedorajoe, at this point, whether it's identical code or not, what Grimoire's presented you with here would yield the same result as what I would have come up with. Geez, does this guy ever sleep?
 :laugh:

LordGarmonde, it's safe to use any space in the ROM, as long as you KNOW you won't need it for anything else. Whatever code or data is/are right before that, any chance any future modifications might necessitate using that space? If not, you're good to go.
Another thing to consider, though, would be the limitations of jumping and subroutines presented by picking an arbitrary empty space. You're planning on using space in the LoROM 0F's. That means any JSR or JMP would have to reference another offset within the 0F's - that's the way those commands work. They have sister commands, JSL and JML, which allow you to specify a long address, but those require an extra byte to use. Also, the return code from a JSL (RTL) is different from that of a JSR (RTS). If you jump to an existing subrotine using a long address it will crash the game if it tries to return with an RTS. There may also be references that are impossible within a different chapter of ROM (block of 0xXX0000). Some or all of this might not matter at all depending on the code you're planning. Just some things to consider.

You would reference the in-game (LoROM) address, by the way. Those are the offsets the game recognizes. We tend to speak mostly in ROM addresses because those are universally recognized by hex editors. An unfortunate and highly obnoxious (imh and completely irrelevant o) but unavoidable fact of hacking...
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Combo Patch of other patches released!)
Post by: LordGarmonde on February 01, 2014, 08:56:19 AM
You would reference the in-game (LoROM) address, by the way. Those are the offsets the game recognizes. We tend to speak mostly in ROM addresses because those are universally recognized by hex editors. An unfortunate and highly obnoxious (imh and completely irrelevant o) but unavoidable fact of hacking...

Good deal; thanks chillyfeez. That's what made the most sense to me - hence my worry - making sense to me =/= making sense - lol

...it's safe to use any space in the ROM, as long as you KNOW you won't need it for anything else. Whatever code or data is/are right before that, any chance any future modifications might necessitate using that space? If not, you're good to go.
Another thing to consider, though, would be the limitations of jumping and subroutines presented by picking an arbitrary empty space. You're planning on using space in the LoROM 0F's. That means any JSR or JMP would have to reference another offset within the 0F's - that's the way those commands work. They have sister commands, JSL and JML, which allow you to specify a long address, but those require an extra byte to use. Also, the return code from a JSL (RTL) is different from that of a JSR (RTS). If you jump to an existing subrotine using a long address it will crash the game if it tries to return with an RTS. There may also be references that are impossible within a different chapter of ROM (block of 0xXX0000). Some or all of this might not matter at all depending on the code you're planning. Just some things to consider...

Very good advice, sir; my thanks! Also, given that warning I say up front that I'm willing to bet that if I get into coding more - enough so that I'm frequently using short and long calls that my inadvertently interchanging them will become a contender for the "LordGarmonde Most-Common-Error" title: current champion: Infinite-Loop-Because-I-Forgot-To-Increment-the-Count  :tongue:
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Combo Patch of other patches released!)
Post by: fedorajoe on February 01, 2014, 06:08:45 PM
This is a big thank you again to everybody who pitched in to answer my questions.  The Pressure command is functioning great!

Just one last question.  When I was working on my hack, I was able to figure out, just through trial and error, which text pointers linked up to the commands, and restore the dummied text (I'm not a great hacker, but I'm very thorough).  But, I'm not sure how I would assign text to the text block that the new command generates.  Could someone give me a simple example of how this could be done?  Everything else is perfect and ready for showcasing in the next release of the hack.

Thanks again!!!

Edited to add:  Oh, one other thing...  Not a big deal, just curious about it.  The command still displays the @Hold spell name when first executing the command, as you would expect.  Is there any way to stop it from doing this?  (Again, not a big deal, just curious.)
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Combo Patch of other patches released!)
Post by: Grimoire LD on February 01, 2014, 08:35:09 PM
For your first question... you Really need to get the latest version of FF4kster (unless that screws up your mod somehow) that allows you to just go to Edit Messages, go to Alerts, change Message 08 (01 being 00 in Hex) to whatever you want the message to display, and there you go!

Hmm to your second question, that is likely because there is a "suppress" order to that in the other command routines, let me look at both Pray and Gird and the answer should be fairly obvious...

I did what would seem to suppress it now let's check the available bytes again...

$03/E1B2   A9 01   LDA #$01   A:0039   X:0000   Y:0000   P:envMxdizC - Load 01 into A. (Hold)
$03/E1B4   8D D2 26   STA $26D2  [$7E:26D2]   A:00A2   X:0000   Y:0000   P:envMxdizC - Store A in Next Action to take.
$03/E1B7   20 3E CD   JSR $CD3E  [$03:CD3E]   A:00A2   X:0000   Y:0000   P:envMxdizC - Jump to Start of Spell Routine
$03/E1BA   A9 C7   LDA #$C7   A:0003   X:0046   Y:FFFF   P:envMxdizc - Load Recall Pose into A.
$03/E1BC   8D C4 33   STA $33C4  [$7E:33C4]   A:00C0   X:0046   Y:FFFF   P:eNvMxdizc - Store A in Audio/visual commands.
$03/E1BF   A9 07   LDA #$07   A:0000   X:000E   Y:0000   P:eNvMxdizc - Load Message 07 into A (unused, feel free to use it)
$03/E1C1  8D CA 34   STA $34CA  [$7E:34CA]   A:0007   X:000E   Y:0000   P:envMxdizc - Store A in Message Data.
$03/E1C4 4C A6 85   JMP $85A6  [$03:85A6]   A:0007   X:000E   Y:0000   P:envMx - Jump to Message Input Routine.


We ended at C6... that leaves us 5 Bytes.

$03/E86B   A9 0B   LDA #$0B   A:0010   X:00CE   Y:0000   P:envMxdizC - Load 0B into A. (Specific Command to Show in your case it would be 15 )
$03/E86D   8D C8 34   STA $34C8  [$7E:34C8]   A:000B   X:00CE   Y:0000   P:envMxdizC - Store A in 7E34C8.
$03/E870   A9 10   LDA #$10   A:000B   X:00CE   Y:0000   P:envMxdizC - Load 10 into A. (Mini-Message Data)
$03/E872   8D C7 34   STA $34C7  [$7E:34C7]   A:0010   X:00CE   Y:0000   P:envMxdizC - Store A in 7E34C7.
$03/E875   60    RTS   A:0010   X:00CE   Y:0000   P:envMxdizC -Return

Now if you didn't want to use a message and wanted to use this instead, you would copy this from where you start at E1BF. That should give you Just enough room to make that work, should you want to suppress Hold showing itself.

Otherwise you can use both, but you would then have to use the free space at the end of all routines and repoint to there.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Combo Patch of other patches released!)
Post by: fedorajoe on February 01, 2014, 10:52:19 PM
Grimoire LD, I just want to thank you again.  Pressure is now working absolutely perfectly.  I learned A LOT about how commands work from the discussion we've been having here, and it's really exciting to think about the possibilities.  For example, I can't help thinking how fun it might be to bring some characters from The After Years into an old school FFIV hack and experience some of their earlier adventures.  It would be work but it would be totally doable with command hacking now at everyone's disposal.

Also, I am definitely going to take a look at FF4kster.  That project was just getting off the ground around the time that I felt my Golbez hack was more or less settled, and so I've never tried it yet.  Definitely going to remedy that situation now.

Thanks again!!!
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Combo Patch of other patches released!)
Post by: Grimoire LD on February 01, 2014, 11:03:06 PM
Wonderful! I am glad to hear everything worked out exemplary in the end. I am glad to hear that the command work you've done to get Pressure working has made you start thinking about possibilities, if you need any assistance Chillyfeez and myself are here to help you. FFIV is limited... in some ways... but not so in others. It is a decently wide open system.

But let me think of which FFIVTAY characters would apply...

Child Luca, I suppose. Eight year old Leonora... I guess that's as reasonable as the Twins really.  Gekkou and Zangetsu, Definitely. They both seem to be men past their prime, so there's little reason why they shouldn't be in FFIV in some manner or another. Elder (for one battle...) seems like he could be an interesting character to tag along. We know Harley was Edward's Secretary in the Interlude as well, so she would also have been old enough to join the party (if you do put her in give her Blue Magic! She was Supposed to have it originally before Square decided not to for whatever reason.)

So there is Child Luca, Leonora, Gekkou, Zangetsu, Elder, and Harley

That's not a bad pool to actually borrow from.

The best part about FF4kster is most things have been bug tested fairly extensively by myself and others so there won't be anything in the newer versions like Corrupt your Game or Enemy AI as was standard in Zyrthofar's good attempts, but just not the right ironing out that was necessary to make it great.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Combo Patch of other patches released!)
Post by: fedorajoe on February 02, 2014, 01:09:03 AM
Harley is the character I was really thinking about.  I've always loved Scholar-type characters despite almost always feeling that they are under-utilized and under-developed.  I saw your entry earlier in the thread about Piercing Sight and had to smile.  I would definitely want to include Blue Magic and Coin Toss as her other abilities if it came to that.

So, I remembered that I wasn't using the Steal command in my Golbez hack since Edge doesn't join the party, and I've now converted it into a fully-workable Taunt command, thanks to your earlier work!

One question, is it possible to apply just the visual and sound effects of a spell to a command, without including the spell's effect?  For example, I think it would be nice if Taunt had the visual effect of Confuse or Berserk, but I don't want to actually confuse or berserk the target.  (I realize that FF4kster might be able to do this, but even if so, I like to at least have a basic grounding in how the concept works.  I often find that I like to go beyond what an editor can do in one way or the other.)

Thanks again!
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Combo Patch of other patches released!)
Post by: Grimoire LD on February 02, 2014, 01:28:28 AM
It always pleases me to see another fan of Harley! Like you I too love the Scholar class and find it criminally underused (then again it was one of the classes chosen for FFXI...) but found their attempt at doing so in FFIV:TAY to be... haphazard at best. Especially knowing that Harley was supposed to have an Item Lore ability which Also got cut, it almost seems like they purposely took additional staying power away from her. Thankfully I was able to find a way to include the Item Lore ability and the x2 Item Healing Ring.


Oh yes, that can be done quite easily.(If you're not using Edge that gives you two commands to change as you will, Steal (and with a bit of creative thinking) Throw. Do you recall my coding mishap with telling you to set 07 at 33C4? Well if you would change that to 33C5 (the next byte over, which holds the default spell graphic)  and put 03 in there, you would have the Charm effect.

But... the easiest way to go about it is to take the spell you plan for Taunt in FF4kster and change the animations to match the White Magic Charm.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Combo Patch of other patches released!)
Post by: Pinkpuff on February 02, 2014, 04:38:17 AM
DISCLAIMER

Be sure to backup your ROM before saving with FF4kster; as efficient as we are at nailing bugs when they appear, it is by no means certain that using it will not cause something to go horribly horribly wrong, espeically if the ROM in question has been edited using any other tools. Depending on how it is that you're handling the whole Golbez thing on a fundamental level, FF4kster may be perfectly safe or it may be quite volatile.

Also be aware that when it saves, it saves everything, even if you've changed nothing. So if you've moved any data locations, they'll probably get messed up even if you didn't edit that data using FF4kster (assuming it didn't hang trying to read from where the program expected to see that data).
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Combo Patch of other patches released!)
Post by: LordGarmonde on February 02, 2014, 10:03:37 AM
DISCLAIMER...

-lol  :tongue: but you forgot "allows for so many possible changes that editing may become addictive"  :wink:

So, I remembered that I wasn't using the Steal command in my Golbez hack since Edge doesn't join the party, and I've now converted it into a fully-workable Taunt command, thanks to your earlier work!

Well ok then; I will file this under 'K' for kick-ass! Also, I never praised you proper for your Golbez hack; though I will say I really thought I did something wrong when "The-Ghost-of-Edward-Past" joined me in Toria - I didn't see that one coming!

We know Harley was Edward's Secretary in the Interlude as well, so she would also have been old enough to join the party (if you do put her in give her Blue Magic! She was Supposed to have it originally before Square decided not to for whatever reason.)

Harley + Blue Magic =  :childish:
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Combo Patch of other patches released!)
Post by: fedorajoe on February 02, 2014, 11:55:09 AM
Unfortunately, it doesn't look like I can use FF4kster at all, because my Golbez hack is not based on the 1.1 ROM.  But, I do think I'll use it for any future projects.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Combo Patch of other patches released!)
Post by: Grimoire LD on February 02, 2014, 04:49:23 PM
Ah? I thought FF4kster now worked regardless of version? Or are there still a few kinks with the v1.0 version?
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Combo Patch of other patches released!)
Post by: chillyfeez on February 02, 2014, 06:51:38 PM
No. Unless this has changed very recently, It can load 1.0, but it can't edit all of it correctly. Specifically, I know level up data and command code have different offsets.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Combo Patch of other patches released!)
Post by: Grimoire LD on February 02, 2014, 07:28:16 PM
@Chillyfeez - I had thought PinkPuff put certain checks in place for 1.0? Since the difference is literally... sixteen bytes to offset or so. I must be thinking of something else then.

First off, about my "Spell fix" I mentioned a few posts back, looks like Phoenix found it six years ago and he ran into the same problem I did. He did this to fix his issue.

http://slickproductions.org/forum/index.php?topic=795.msg7622#msg7622 - This is definitely something to keep firmly in mind.

After Chillyfeez pointed out the empty space at the end of Bank 03 I began to wonder... what other banks might have free space in them? After all as great as battle matters are we shouldn't be confined to them forever, so I set out to search for some other free room in which we can link to and fro.

00 Bank - Situations that involve on-map matters including Obtaining Treasure and special event dealings like killing your party for Zeromus. Starts at 008000.

Ladies and Gentleman we hit the motherlode! This contains a Whopping 028A (650) bytes that are located from 00FD31-00FFBB

01 Bank - All Dealings with the normal Menu. Starts at 018000

Hmm, not much here unfortunately. At least on a basic End Bank manner. Only blank space is at 01FF35-01FFFF. Giving us only CA (202) bytes to add to the menu dealings.

From an Actual bank not just end data there is a quizzically large absence of data from 01DE4F-01E2FF. This is another large helping of 4B0 (1200!) freed bytes! And since this is the Main Menu imagine how much this frees us up to do what we want?! This sort of empty space not at the end of a bank means though that something was gutted and it left a gaping hole. I have to wonder what was originally here?

02 Bank - This one I've only seen used in very few instances and mostly in relation to Battle Menu dealings. Starts at 028000.

Very little free room here, even less than 01 Bank. Starting 02FFBE-02FFFF which is only 32 (50) bytes to work with.

This has some weird spacing issues. At 029AB7 there's six lonely FF bytes, with some nonsensical instructions thrown in there that simply can't be used as there is no way out of this weird quagmire of FF's which would just crash the game if read. So that means that this set of free bytes extends to 029AB7 to 029AC8.

03 Bank - The bank that is Chillyfeez's and my specialty. This is everything related directly to battle. This thread contains a good amount of information of what can be found within.

As Chillyfeez pointed out some time ago there is a bit of free space here. This starts at 03FEE3-03FFFF which is 11C (284) bytes. This is a decent amount of room to work with.

At 03F210 there is a sequence of FF's that run from 03F210-03F27F, Eh 6F (111) more free bytes. It could be useful.

04 Bank - ?? We have never found any code that has to do with a Bank 04. If it is a bank there is no free space allocated at the end of its bank.

So in conclusion...

Bank 00 - Maps and Events -   28A (650) bytes that are located from 00FD31-00FFBB
Bank 01 - Main Menu           -   4B0 (1200!) bytes that are located from 01DE4F-01E2FF
Bank 01 - Main Menu           -     CA (202) bytes that are located from 01FF35-01FFFF
Bank 02 - Battle Menu(etc)  -     32 (50) bytes that are located from 02FFBE-02FFFF
Bank 02 - Battle Menu(etc)  -     11 (17) bytes that are located from 029AB7-029AC8
Bank 03 - Battle Dealings    -     6F (111) bytes that are located from 03F210-03F27F
Bank 03 - Battle Dealings    -    11C (284) bytes that are located from 03FEE3-03FFFF

And there you have it! There's quite a bit of room to mess around with in areas that we likely should take into greater consideration, knowing that we don't necessarily need to replace Anything, just adding a proper JSR to the right areas to enhance anything.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Combo Patch of other patches released!)
Post by: chillyfeez on February 02, 2014, 09:06:10 PM
I gave up using 1.0 in late november/early december last year because of FF4kster compatability. I guess we could look to find out for sure...

Nope, still doesn't read Recall or Sing right.
Maybe you're thinking of the check she put in for header/non-header?
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Combo Patch of other patches released!)
Post by: koala_knight on February 02, 2014, 09:19:04 PM
01 Bank - All Dealings with the normal Menu. Starts at 018000

Hmm, not much here unfortunately. At least on a basic End Bank manner. Only blank space is at 01FF35-01FFFF. Giving us only CA (202) bytes to add to the menu dealings.

From an Actual bank not just end data there is a quizzically large absence of data from 01DE4F-01E2FF. This is another large helping of 4B0 (1200!) freed bytes! And since this is the Main Menu imagine how much this frees us up to do what we want?! This sort of empty space not at the end of a bank means though that something was gutted and it left a gaping hole. I have to wonder what was originally here?

I believe that *might* be all the options that were left out of the US version of the game; Battle Mode, Custom Controls, and Multiplayer.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Combo Patch of other patches released!)
Post by: Grimoire LD on February 02, 2014, 10:07:32 PM
@Chillyfeez - I must be, thanks for the reminder.

@Vanya - That is an Extremely likely possibility.  I didn't think about that, but hey. More data for us to use as we like, right?
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Combo Patch of other patches released!)
Post by: Grimoire LD on February 02, 2014, 11:10:18 PM
@Chillyfeez - I must be, thanks for the reminder.

Alright, now that I know more about Banks thanks to Dragonsbrethren lets try something new... and that is recording data anywhere I can find it (if I can understand what its doing)

Start of Game
Code: [Select]
$00/8290 9C 00 17 STZ $1700  [$00:1700] A:0000 X:1000 Y:2000 P:envMxdIZC
$00/8293 9C 01 17 STZ $1701  [$00:1701] A:0000 X:1000 Y:2000 P:envMxdIZC
$00/8296 9C 03 17 STZ $1703  [$00:1703] A:0000 X:1000 Y:2000 P:envMxdIZC
$00/8299 9C 0F 17 STZ $170F  [$00:170F] A:0000 X:1000 Y:2000 P:envMxdIZC
$00/829C 9C 12 17 STZ $1712  [$00:1712] A:0000 X:1000 Y:2000 P:envMxdIZC
$00/829F 9C 18 17 STZ $1718  [$00:1718] A:0000 X:1000 Y:2000 P:envMxdIZC
$00/82A2 9C 1C 17 STZ $171C  [$00:171C] A:0000 X:1000 Y:2000 P:envMxdIZC
$00/82A5 9C 20 17 STZ $1720  [$00:1720] A:0000 X:1000 Y:2000 P:envMxdIZC
$00/82A8 9C 24 17 STZ $1724  [$00:1724] A:0000 X:1000 Y:2000 P:envMxdIZC
$00/82AB 9C 28 17 STZ $1728  [$00:1728] A:0000 X:1000 Y:2000 P:envMxdIZC
$00/82AE 9C 2B 17 STZ $172B  [$00:172B] A:0000 X:1000 Y:2000 P:envMxdIZC
$00/82B1 9C 1B 17 STZ $171B  [$00:171B] A:0000 X:1000 Y:2000 P:envMxdIZC
$00/82B4 9C 1F 17 STZ $171F  [$00:171F] A:0000 X:1000 Y:2000 P:envMxdIZC
$00/82B7 9C 23 17 STZ $1723  [$00:1723] A:0000 X:1000 Y:2000 P:envMxdIZC
$00/82BA 9C 27 17 STZ $1727  [$00:1727] A:0000 X:1000 Y:2000 P:envMxdIZC -  All of this Simply means Get rid of any and all Map Locations being Saved.
$00/82BD A2 00 00 LDX #$0000 A:0000 X:1000 Y:2000 P:envMxdIZC - Load 0000 into X.
$00/82C0 8E 2C 17 STX $172C  [$00:172C] A:0000 X:0000 Y:2000  - Store 0000 in... wait a second! You just stored Zero there!
$00/82C3 A2 00 00 LDX #$0000 A:0000 X:0000 Y:2000 P:envMxdIZC - Load 0000 into X (this better be because of a loop...)
---------------------------------------------------------------------------------------(Looping Point)-------------------------------------------------------------------
$00/82C6 BF 00 F2 12 LDA $12F200,x[$12:F200] A:0000 X:0000 Y:2000 P:envMxdIZC - Load sequence of bytes starting from 12F200, looks to be something dealing with default NPC placements.
$00/82CA 9D E0 12 STA $12E0,x[$00:12E0] A:00DB X:0000 Y:2000 P:eNvMxdIzC - Store in 12E0 (NPC Placements?)
$00/82CD E8 INX A:00DB X:0000 Y:2000 P:eNvMxdIzC - +1 to X.
$00/82CE E0 40 00 CPX #$0040 A:00DB X:0001 Y:2000 P:envMxdIzC - Do this 40 times more (one for each area?)
$00/82D1 D0 F3 BNE $F3    [$82C6] A:00DB X:0001 Y:2000 P:eNvMxdIzc - Loop back to start of this process.
----------------------------------------------------------------------Looping Point-------------------------------------------------------------------------
$00/82D6 BF 40 F2 12 LDA $12F240,x[$12:F240] A:00FF X:0000 Y:2000 P:envMxdIZC - Load A from 12F240 (Default NPC Visibility Arrangements?)
$00/82DA 9D 80 12 STA $1280,x[$00:1280] A:0000 X:0000 Y:2000 P:envMxdIZC - Store A in Default-NPC visibility area.
$00/82DD E8 INX A:0000 X:0000 Y:2000 P:envMxdIZC - +1 to X.
$00/82DE E0 20 00 CPX #$0020 A:0000 X:0001 Y:2000 P:envMxdIzC - Do this 20 times more (I'm no longer sure. Obviously there are more than 32 maps!)
$00/82E1 D0 F3 BNE $F3    [$82D6] A:0000 X:0001 Y:2000 P:eNvMxdIzc - Loop back to start of Process.
-------------------------------------------------------------------------Looping Point-------------------------------------------------------
$00/82E3 A2 00 00 LDX #$0000 A:0000 X:0020 Y:2000 P:envMxdIZC - Load 0000 into X.
$00/82E6 9E A0 12 STZ $12A0,x[$00:12A0] A:0000 X:0000 Y:2000 P:envMxdIZC - Store Zero in Default Treasure Areas.
$00/82E9 E8 INX A:0000 X:0000 Y:2000 P:envMxdIZC - +1 to X
$00/82EA E0 20 00 CPX #$0020 A:0000 X:0001 Y:2000 P:envMxdIzC - Do this 20 times more (There are more than 32 maps!)
$00/82ED D0 F7 BNE $F7    [$82E6] A:0000 X:0001 Y:2000 P:eNvMxdIzc - Loop back to Start of Process.
----------------------------------------------------------------------
$00/82EF A9 FE LDA #$FE A:0000 X:0020 Y:2000 P:envMxdIZC - Load Sort.
$00/82F1 8D 9C 14 STA $149C  [$00:149C] A:00FE X:0020 Y:2000 P:eNvMxdIzC - Store Sort in Items.
$00/82F4 A9 FF LDA #$FF A:00FE X:0020 Y:2000 P:eNvMxdIzC - Load TrashCan into A.
$00/82F6 8D 9E 14 STA $149E  [$00:149E] A:00FF X:0020 Y:2000 P:eNvMxdIzC - Store Trashcan in Items.
$00/82F9 A9 01 LDA #$01 A:00FF X:0020 Y:2000 P:eNvMxdIzC - Load Quantity of 1.
$00/82FB 8D 9D 14 STA $149D  [$00:149D] A:0001 X:0020 Y:2000 P:envMxdIzC - Store A in Sort Amount.
$00/82FE 8D 9F 14 STA $149F  [$00:149F] A:0001 X:0020 Y:2000 P:envMxdIzC - Store A in Trashcan Amount.
$00/8301 60 RTS A:0001 X:0020 Y:2000 P:envMxdIzC - Return.

Well... that wasn't as enlightening as I'd hoped it would be... by any stretch. At the start of game the game clears NPC sets, NPC placements, Treasures Found, and loads Sort and Trashcan into items... let's hope the next piece of code is better than this.

Start of Game Part 2 -

Code: [Select]
$00/805C 20 D0 92 JSR $92D0  [$00:92D0] A:0001 X:0020 Y:2000 P:envMxdIzC - Jump to Subroutine
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
$00/92D0 A2 00 00 LDX #$0000 A:0001 X:0020 Y:2000 P:envMxdIzC - Load 0000 into X.
$00/92D3 A0 00 00 LDY #$0000 A:0001 X:0000 Y:2000 P:envMxdIZC - Load 0000 into Y.
------------------------------------------------------------------Looping Point--------------------------------------------------------------------------
$00/92D6 BF 00 A9 0F LDA $0FA900,x[$0F:A900] A:0001 X:0000 Y:0000 P:envMxdIZC - Load Character 1 from ROM.
$00/92DA 99 00 10 STA $1000,y[$00:1000] A:0081 X:0000 Y:0000 P:eNvMxdIzC - Store A in Character Slot 1.
$00/92DD E8 INX A:0081 X:0000 Y:0000 P:eNvMxdIzC - +1 to X.
$00/92DE C8 INY A:0081 X:0001 Y:0000 P:envMxdIzC - +1 to Y.
$00/92DF C0 14 00 CPY #$0014 A:0081 X:0001 Y:0001 P:envMxdIzC - Do this for each pertinent stat.
$00/92E2 D0 F2 BNE $F2    [$92D6] A:0081 X:0001 Y:0001 P:eNvMxdIzc - Loop back to start of process
------------------------------------------------------------------------------
$00/92E4 A0 00 00 LDY #$0000 A:0003 X:0014 Y:0014 P:envMxdIZC - Load 0000 into Y.
------------------------------------------------------Looping Point-------------------------------------------------
$00/92E7 BF 00 A9 0F LDA $0FA900,x[$0F:A914] A:0003 X:0014 Y:0000 P:envMxdIZC - Load Character 1's Default Critical Hit Chance into A. )
$00/92EB 99 2D 10 STA $102D,y[$00:102D] A:0002 X:0014 Y:0000 P:envMxdIzC - Store A in Slot's Critical Hit Chance.
$00/92EE E8 INX A:0002 X:0014 Y:0000 P:envMxdIzC - +1 to X
$00/92EF C8 INY A:0002 X:0015 Y:0000 P:envMxdIzC - +1 to Y.
$00/92F0 C0 03 00 CPY #$0003 A:0002 X:0015 Y:0001 P:envMxdIzC - Do this for Critical Hit Chance/Critical Bonus Damage/And ?Steal Evade?
$00/92F3 D0 F2 BNE $F2    [$92E7] A:0002 X:0015 Y:0001 P:eNvMxdIzc - Loop back to start of process.
-----------------------------------------------------------------------
$00/92F5 A0 00 00 LDY #$0000 A:000A X:0017 Y:0003 P:envMxdIZC - Load 0000 into Y.
--------------------------------------------------------------------------Looping Point---------------------------------------------------------------------
$00/92F8 BF 00 A9 0F LDA $0FA900,x[$0F:A917] A:000A X:0017 Y:0000 P:envMxdIZC - Load Experience to Level Up (etc)
$00/92FC 99 37 10 STA $1037,y[$00:1037] A:00B8 X:0017 Y:0000 P:eNvMxdIzC - Store A in Experience (etc)
$00/92FF E8 INX A:00B8 X:0017 Y:0000 P:eNvMxdIzC +1 X
$00/9300 C8 INY A:00B8 X:0018 Y:0000 P:envMxdIzC +1 Y
$00/9301 C0 09 00 CPY #$0009 A:00B8 X:0018 Y:0001 P:envMxdIzC - Do this 9 more times.
$00/9304 D0 F2 BNE $F2    [$92F8] A:00B8 X:0018 Y:0001 P:eNvMxdIzc - Loop back to start of process.
----------------------------------------------------------------------
$00/9306 A0 00 00 LDY #$0000 A:0000 X:0020 Y:0009 P:envMxdIZC - Load 0000 into Y.
$00/9309 84 3D STY $3D    [$00:063D] A:0000 X:0020 Y:0000 P:envMxdIZC - Store Y in ?Current Encounter? Wha?
$00/930B 20 5E E6 JSR $E65E  [$00:E65E] A:0000 X:0020 Y:0000 P:envMxdIZC - Jump to Subroutine
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$00/E65E A9 00 LDA #$00 A:0000 X:0020 Y:0000 P:envMxdIZC - Load 00 into A.
$00/E660 4C 6E E6 JMP $E66E  [$00:E66E] A:0000 X:0020 Y:0000 P:envMxdIZC - Jump to... E bytes away! Come on Square! Make this a Branch Always, not a Jump.
-----------------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------------------
$00/E66E 85 07 STA $07    [$00:0607] A:0000 X:0020 Y:0000 P:envMxdIZC - Store A in 07.
$00/E670 0A ASL A A:0000 X:0020 Y:0000 P:envMxdIZC - x2 A
$00/E671 0A ASL A A:0000 X:0020 Y:0000 P:envMxdIZc - x2 A
$00/E672 0A ASL A A:0000 X:0020 Y:0000 P:envMxdIZc -x2 A
$00/E673 38 SEC A:0000 X:0020 Y:0000 P:envMxdIZc - Set Carry Flag.
$00/E674 E5 07 SBC $07    [$00:0607] A:0000 X:0020 Y:0000 P:envMxdIZC - Subtract A from the value in 0607.
$00/E676 AA TAX A:0000 X:0020 Y:0000 P:envMxdIZC - Transfer A to X.
$00/E677 A9 07 LDA #$07 A:0000 X:0000 Y:0000 P:envMxdIZC - Load 07 into A.
$00/E679 85 07 STA $07    [$00:0607] A:0007 X:0000 Y:0000 P:envMxdIzC - Store A in 0607
$00/E67B A4 3D LDY $3D    [$00:063D] A:0007 X:0000 Y:0000 P:envMxdIzC - Load 063D into Y (why...?)
-------------------------------------------------------------Looping Point-------------------------------------------
(This section of data might also be used by Actors taken in from Shadow Slots or Fresh)
$00/E67D BF 00 AB 0F LDA $0FAB00,x[$0F:AB00] A:0007 X:0000 Y:0000 P:envMxdIZC - Load starting equipment of character into A.
$00/E681 99 30 10 STA $1030,y[$00:1030] A:006E X:0000 Y:0000 P:envMxdIzC - Store A in Character's Equipment Section.
$00/E684 E8 INX A:006E X:0000 Y:0000 P:envMxdIzC - +1 X
$00/E685 C8 INY A:006E X:0001 Y:0000 P:envMxdIzC - +1 Y
$00/E686 C6 07 DEC $07    [$00:0607] A:006E X:0001 Y:0001 P:envMxdIzC - Subtract A from the value in 0607?
$00/E688 D0 F3 BNE $F3    [$E67D] A:006E X:0001 Y:0001 P:envMxdIzC - Loop back to start of process.
------------------------------------------------------------------
$00/E68A 46 3E LSR $3E    [$00:063E] A:0001 X:0007 Y:0007 P:envMxdIZC - /2 063E.
$00/E68C 66 3D ROR $3D    [$00:063D] A:0001 X:0007 Y:0007 P:envMxdIZc - /2 063D
$00/E68E A5 3D LDA $3D    [$00:063D] A:0001 X:0007 Y:0007 P:envMxdIZc - Load 063D into A.
$00/E690 4A LSR A A:0000 X:0007 Y:0007 P:envMxdIZc - /2 A
$00/E691 4A LSR A A:0000 X:0007 Y:0007 P:envMxdIZc - /2 A
$00/E692 4A LSR A A:0000 X:0007 Y:0007 P:envMxdIZc - /2 A
$00/E693 4A LSR A A:0000 X:0007 Y:0007 P:envMxdIZc - /2 A
$00/E694 4A LSR A A:0000 X:0007 Y:0007 P:envMxdIZc - /2 A
$00/E695 22 06 80 03 JSL $038006[$03:8006] A:0000 X:0007 Y:0007 P:envMxdIZc - Jump to Subroutine... in the Battle Bank?
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/8006 4C 36 80 JMP $8036  [$03:8036] A:0000 X:0007 Y:0007 P:envMxdIZc - Jump to a byte 36 bytes away (Cute. So instead of jumping directly to it with the above JSL you instead waste more bytes by making this instruction jump 30 bytes away with 3 bytes instead of branching with 2. - All that's in there seems to be battle resetting stuff.
--------------------------------------------------------------------------------
++++++++++++++++++++++++++++++++++++++++++++++++++++
$00/E699 60 RTS A:0000 X:0007 Y:0007 P:envMxdIZc - Return
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$00/930E A9 00 LDA #$00 A:0000 X:0007 Y:0007 P:envMxdIZc - Load 00 into A
$00/9310 22 06 80 03 JSL $038006[$03:8006] A:0000 X:0007 Y:0007 P:envMxdIZc - Jump to Same Exact Subroutine as above.
$00/9314 60 RTS A:0000 X:0007 Y:0007 P:envMxdIZc - Return
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$00/805F 22 3E C2 15 JSL $15C23E[$15:C23E] A:0000 X:0007 Y:0007 P:envMxdIZc - Jump to Rom - (Spells put in Spellbooks)

I think that's enough for tonight.





Title: Re: Grimoire LD's Notes, Patches, and Hacks (Combo Patch of other patches released!)
Post by: Grimoire LD on February 03, 2014, 12:39:02 PM

Normal Shadow Slot procedure.

Code: [Select]
$00/E6B9 B9 00 10 LDA $1000,y[$00:1040] A:0000 X:0001 Y:0040 P:envMxdizc - Load Indexed Slot ID from A
$00/E6BC 29 1F AND #$1F A:0084 X:0001 Y:0040 P:eNvMxdizc - Check character's ID.
$00/E6BE DD D5 09 CMP $09D5,x[$00:09D6] A:0004 X:0001 Y:0040 P:envMxdizc - Is it the same as the value in 09D6 (What ID the event is looking to remove)
$00/E6C1 F0 17 BEQ $17    [$E6DA] A:0004 X:0001 Y:0040 P:envMxdiZC - If so branch to 00E6DA
-----------------------------------------------------------------------------------------------------------------------------------------

--------------------------------------------------------------------------------------------------------------------------------------
$00/E6DA BD D5 09 LDA $09D5,x[$00:09D6] A:0004 X:0001 Y:0040 P:envMxdiZC - Load Slot ID into A.
$00/E6DD 3A DEC A A:0004 X:0001 Y:0040 P:envMxdizC - -1 to A.
$00/E6DE AA TAX A:0003 X:0001 Y:0040 P:envMxdizC - Transfer A to X.
$00/E6DF BD 1D E7 LDA $E71D,x[$00:E720] A:0003 X:0003 Y:0040 P:envMxdizC - Load A from 7EE71D (first I've ever seen this address)
$00/E6E2 30 31 BMI $31    [$E715] A:0000 X:0003 Y:0040 P:envMxdiZC - Branch if minus to 00E715.
$00/E6E4 C2 20 REP #$20 A:0000 X:0003 Y:0040 P:envMxdiZC - Reset Processor Status (for two bytes in A)
$00/E6E6 0A ASL A A:0000 X:0003 Y:0040 P:envmxdiZC
$00/E6E7 0A ASL A A:0000 X:0003 Y:0040 P:envmxdiZc
$00/E6E8 0A ASL A A:0000 X:0003 Y:0040 P:envmxdiZc
$00/E6E9 0A ASL A A:0000 X:0003 Y:0040 P:envmxdiZc
$00/E6EA 0A ASL A A:0000 X:0003 Y:0040 P:envmxdiZc
$00/E6EB 0A ASL A A:0000 X:0003 Y:0040 P:envmxdiZc - x12 A.
$00/E6EC 85 40 STA $40    [$00:0640] A:0000 X:0003 Y:0040 P:envmxdiZc - Store A in 0640.
$00/E6EE A9 00 00 LDA #$0000 A:0000 X:0003 Y:0040 P:envmxdiZc - Load 0000 into A (why not just use a TDC?)
$00/E6F1 E2 20 SEP #$20 A:0000 X:0003 Y:0040 P:envmxdiZc - Set Processor Status back to one byte.
$00/E6F3 A9 40 LDA #$40 A:0000 X:0003 Y:0040 P:envMxdiZc - Load 40 into A. (Amount of times to loop)
$00/E6F5 85 07 STA $07    [$00:0607] A:0040 X:0003 Y:0040 P:envMxdizc - Store A in 0607.
$00/E6F7 A6 3D LDX $3D    [$00:063D] A:0040 X:0003 Y:0040 P:envMxdizc - Store X in 063D.
$00/E6F9 A4 40 LDY $40    [$00:0640] A:0040 X:0040 Y:0040 P:envMxdizc - Load Y from 40.
--------------------------------------------------------Looping Point-----------------------------------------------------------------------------------
$00/E6FB BD 00 10 LDA $1000,x[$00:1040] A:0040 X:0040 Y:0000 P:envMxdiZc - Load Character ID into A. (+ other stats)
$00/E6FE 99 40 11 STA $1140,y[$00:1140] A:0084 X:0040 Y:0000 P:eNvMxdizc - Store A in Shadow Slot.
$00/E701 E8 INX A:0084 X:0040 Y:0000 P:eNvMxdizc - +1 X
$00/E702 C8 INY A:0084 X:0041 Y:0000 P:envMxdizc - +1 Y
$00/E703 C6 07 DEC $07    [$00:0607] A:0084 X:0041 Y:0001 P:envMxdizc - -1 to 0607.
$00/E705 D0 F4 BNE $F4    [$E6FB] A:0084 X:0041 Y:0001 P:envMxdizc - If not 00 loop back to start of process.
-------------------------------------------------------------
$00/E707 A6 40 LDX $40    [$00:0640] A:0000 X:0080 Y:0040 P:envMxdiZc - Load 0040 into X.
$00/E709 9E 43 11 STZ $1143,x[$00:1143] A:0000 X:0000 Y:0040 P:envMxdiZc
$00/E70C 9E 44 11 STZ $1144,x[$00:1144] A:0000 X:0000 Y:0040 P:envMxdiZc 
$00/E70F 9E 45 11 STZ $1145,x[$00:1145] A:0000 X:0000 Y:0040 P:envMxdiZc
$00/E712 9E 46 11 STZ $1146,x[$00:1146] A:0000 X:0000 Y:0040 P:envMxdiZc - Store Zero in Shadow Slot's Status Bytes.
$00/E715 A6 3D LDX $3D    [$00:063D] A:0000 X:0000 Y:0040 P:envMxdiZc - Load 063D into A.
$00/E717 9E 00 10 STZ $1000,x[$00:1040] A:0000 X:0040 Y:0040 P:envMxdizc - Store Zero in Slot's ID.
$00/E71A 4C D3 E0 JMP $E0D3  [$00:E0D3] A:0000 X:0040 Y:0040 P:envMxdizc - Jump to 00E0D3.
(Unrelated it appears)

Hmm... so we will need part of data that is empty enough for 14x40 bytes which is 500 bytes. That's asking a lot for a section or RAM... I'll take a look though and see if there's any such place, but I somewhat doubt it. Ah well...

Damage Panels

Code: [Select]
$00/9601 BD 07 10 LDA $1007,x[$00:1007] A:0000 X:0000 Y:0003 P:envmxdizC - Load slot's HP.
$00/9604 F0 11 BEQ $11    [$9617] A:089D X:0000 Y:0003 P:envmxdizC - If 00 skip to end.
$00/9606 38 SEC A:089D X:0000 Y:0003 P:envmxdizC - Set Carry Flag.
$00/9607 E9 32 00 SBC #$0032 A:089D X:0000 Y:0003 P:envmxdizC - -50 HP.
$00/960A 9D 07 10 STA $1007,x[$00:1007] A:086B X:0000 Y:0003 P:envmxdizC - Store A in Slot's HP.

Easy enough to change the damage Damage Panels inflict, even above 255 if so desired because it was used in two bytes.

Big Chocobo Code

Big Chocobo Code -

Code: [Select]
$01/CF8F BD 40 14 LDA $1440,x[$7E:1442] A:0002 X:0002 Y:0468 P:envMxdizc - Load Indexed Item.
$01/CF92 F0 0C BEQ $0C    [$CFA0] A:00CE X:0002 Y:0468 P:eNvMxdizc - If 00 branch to 01CFA0
$01/CF94 C9 19 CMP #$19 A:00CE X:0002 Y:0468 P:eNvMxdizc - Is it the Legend Sword?
$01/CF96 F0 08 BEQ $08    [$CFA0] A:00CE X:0002 Y:0468 P:eNvMxdizC - If so branch to 01CFA0.
$01/CF98 C9 C8 CMP #$C8 A:00CE X:0002 Y:0468 P:eNvMxdizC -Is it the Crystal?
$01/CF9A F0 04 BEQ $04    [$CFA0] A:00CE X:0002 Y:0468 P:envMxdizC - If so branch to 01CFA0.
$01/CF9C C9 EE CMP #$EE A:00CE X:0002 Y:0468 P:envMxdizC - Is it Package or above? (Key Items)
$01/CF9E 90 02 BCC $02    [$CFA2] A:00CE X:0002 Y:0468 P:eNvMxdizc - If not, branch to 01CFA2.
$01/CFA2 A9 7E LDA #$7E A:00CE X:0002 Y:0468 P:eNvMxdizc - Load 7E into A.
$01/CFA4 85 45 STA $45    [$00:0145] A:007E X:0002 Y:0468 P:envMxdizc - Store A in 45.
$01/CFA6 A4 41 LDY $41    [$00:0141] A:007E X:0002 Y:0468 P:envMxdizc - Load Y from 41.
$01/CFA8 B9 40 13 LDA $1340,y[$7E:1340] A:007E X:0002 Y:0000 P:envMxdiZc - Load A from 1340+y.
$01/CFAB F0 23 BEQ $23    [$CFD0] A:0000 X:0002 Y:0000 P:envMxdiZc - If 00 branch to 01CFD0.
$01/CFD0 BD 40 14 LDA $1440,x[$7E:1442] A:0000 X:0002 Y:0000 P:envMxdiZc - Load item indexed by X.
$01/CFD3 99 40 13 STA $1340,y[$7E:1340] A:00CE X:0002 Y:0000 P:eNvMxdizc - Store item into location indexed by y.
$01/CFD6 BD 41 14 LDA $1441,x[$7E:1443] A:00CE X:0002 Y:0000 P:eNvMxdizc - Load item quantity indexed by x.
$01/CFD9 18 CLC A:0003 X:0002 Y:0000 P:envMxdizc - Clear Carry Flag.
$01/CFDA 79 41 13 ADC $1341,y[$7E:1341] A:0003 X:0002 Y:0000 P:envMxdizc - Add the quantity onto the already existing quantity.
$01/CFDD 99 41 13 STA $1341,y[$7E:1341] A:0003 X:0002 Y:0000 P:envMxdizc - Store Item quantity in Big Chocobo inventory.
$01/CFE0 9E 40 14 STZ $1440,x[$7E:1442] A:0003 X:0002 Y:0000 P:envMxdizc - Store Zero in indexed item x.
$01/CFE3 9E 41 14 STZ $1441,x[$7E:1443] A:0003 X:0002 Y:0000 P:envMxdizc - Store Zero in indexed item quantity x.
$01/CFE6 20 85 84 JSR $8485  [$01:8485] A:0003 X:0002 Y:0000 P:envMxdizc - Jump to Subroutine

What I'm missing that's important from the above is how to load that extremely long scrolling screen. If we had that we could forget all about ever needing a storage anyhow considering that would allow us to carry 168 items alone (still only the first 48 carried into battle though)
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Combo Patch of other patches released!)
Post by: LordGarmonde on February 03, 2014, 01:37:18 PM
"The circle is now complete..."    OK, not actually, but I see it forming  :tongue:

  It's funny because the Fat Chocobo code was one of the 1st things I looked into when trying to mess around after joining the Forum. But I was scared away by assembly; ran like a kid from a barking dog.  :sad:

 But that's what edged me over to the experience mod...need for more storage space in RAM - with aim of eliminating the need to store stats: just calculate everything when someone joins the party. Things are going well there, after I finishing some tile-editing for Pinkpuff I went back to my experience spreadsheets to attack the stats. I'll write more about that on the other thread, but the short of it is that's even easier than experience, they are all more or less straight formulas - DkC: +1 to Vit on odd levels, +1 to Agl on even levels, etc.

So that and the previous work Phoenix did with the shadow party expansion should clear up space. I figure that for any character all that needs be stored is current experience, level, maybe TNL (depends on slowdown) - and equipment*: and I was thinking instead of FC taking equipment away I might try converting Namingway and have him access those spots in RAM for each characters' equipment.

I'm working to finish up the stat/HP/MP gain algorithms and then pseudo-code in hand try and face the barking dog called Assembly. One thing slowing me down** is how close I should stick to the original stats. Obviously as close as possible is the goal, but if I give a character 2 extra points of strength at the beginning to better ensure coherence later is that going to screw things up? I'd love to hear any thoughts anyone has on that.

Damn it all...that was such a long way to say "agreed, RAM space is hard to come by..." But anyway, back to the spreadsheets  :cycle:

*I have to think about spells too - most them are level based, but I have to look into how best to attack who has what. I think (in the interest of saving space) I'll hook them into the event flags which grant them - Mt. Hobs = Fire 1. This may actually be the procedure now; not sure yet.

**I plan to look at the damage routines to see how big a deal a difference of 1-3 in stats means - opinions also welcome

 -  :edit: OK, need to think with reference to Str/4 --- http://slickproductions.org/forum/index.php?topic=341.msg2633#msg2633
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Combo Patch of other patches released!)
Post by: Grimoire LD on February 04, 2014, 04:39:58 PM
Ah, one thing that Phoenix didn't take into account was the Critical Hit Rate/Critical Hit Bonus Damage/?Steal Evade, because we didn't know what those bytes were back them he likely thought them useless so he didn't include them in his hack. His hack unfortunately would make it so a character would never hit a critical (0 x 2 is still 0).

Converting Namingway... I imagine a lot of work went into his functionality... but I think that functionality can be scrapped and remade... I'm not yet sure to What though. So your working on another project? What is its aim?

Also Large Update - It has come to my attention that monsters cannot use the Animation Cues for Any Commands (or else the game implodes) so I will need to re-release my Break Skills Patch and the Combo Patch with this fix. When this occurs this post will be edited to say that those patches have been updated in their respective topic sections.

 :edit: The patches of Break Skill and Combo have been updated to include the fix so monsters no longer freeze the game when they use break skills.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Combo Patch of other patches released!)
Post by: LordGarmonde on February 04, 2014, 07:58:39 PM
Ah, one thing that Phoenix didn't take into account was the Critical Hit Rate/Critical Hit Bonus Damage/?Steal Evade, because we didn't know what those bytes were back them he likely thought them useless so he didn't include them in his hack. His hack unfortunately would make it so a character would never hit a critical (0 x 2 is still 0).

Tricky-tricky...but good catch!

Quote
Converting Namingway... I imagine a lot of work went into his functionality... but I think that functionality can be scrapped and remade... I'm not yet sure to What though. So your working on another project? What is its aim?

I'm not a re-namer, never have been; hence my willingness to work things around regarding Namingway. That goes back to what I was interested in before I ended-up on the experience/level tangent which was stripping members of gear automatically when they leave. Originally I was going to throw it in Fat Chocobo's storage, but then I worry about cluttering that up and not knowing it because it's happening behind the scenes and you only check in sporadically.

My lazy/limited ability approach was basically to try and reuse the Fat Chocobo code, just changing the storage addresses and the portrait from FC to Namingway. But since that requires a separate block of memory for storage I went looking into how to save room, which lead me to Phoenix's approach where I fell down the hole chasing down the experience issue in efforts to eliminate as much of the need to use memory as possible. Admittedly the other sticking point for me was that the setup Square settled on pissed me off - our friend the Dark Knight never gains MP - but that doesn't mean an entry of 00 every 5th byte on the ROM is the way to go...but anyway...

Looking at the data, I pared the stat list down to: character id (1 byte), class id (1), level (1), max HP (2), max MP (2), base str/agil/vit/wis/will (5), helmet (1), armor (1), gauntlet (1), right-hand weapon (2), left-hand weapon (2), and experience (3). This adds up to 22 essential bytes per character. Finally, I divided the 320-byte block by 22, and lo and behold there's room for 320/22 = 14.54 characters. It's like it was fated to be.

I'm thinking given that same list that the base stats can be eliminated, since they can be redetermined when a character rejoins - perhaps max HP & MP similarly but that's an issue with fixed gains vs slightly random variance and consistency, but it should work. I'd have to use 3 bytes for the TNL value; I'm pretty sure that's where the problem came from in Edward rejoining at his starting level of 5.

I just got an idea in writing this - if I build off the above - then there are already enough slots for everyone's equipment. Could there be a way to look at those addresses when talking to Namingway leaving FC exactly as he is?

So somewhat separate projects as they ended up but they all came out of the same desire to be able to swap people in and out at will and not leave the player frustrated at losing equipment all the time and not being stuck with Cid not being able to have a level below 20.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Combo Patch of other patches released!)
Post by: chillyfeez on February 04, 2014, 09:45:48 PM
I've considered rewriting Namingway's routine to turn him into a party-changer, but I only have a very vague idea of how I would even begin to tackle that.
The party changing dynamics of my hack (I promise, the preview is coming - the demo first chapter is actually complete, it's the character sampling portion afterward that's takng so long. Seems I grossly underestimated how much of an undertaking it would be) are worked out in a way that very specifically avoids the need for "one single action to change the entire party," so if Iever get around to attempting it, it will be a side project.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Combo Patch of other patches released!)
Post by: LordGarmonde on February 04, 2014, 09:55:29 PM
I was never quite that ambitious (even in my mind) about switching out the party; even a vague idea is still a good start. I always had in the back of my mind something like FF4A's end swapping, but simplified. I'm thinking in my hack of only defaulting to 4 characters for the lunar subterrane/core to up the challenge a bit more. But as a fun option I was thinking of having the rest of the gang waiting in the tower like in FF4A and you could grab any one of them as the 5th member. That wouldn't be so bad to set up I think - each character has a response action of remove the current 5th member (if any) and add themselves - but that's still in the dream vault - experience/stats are still first up (almost done!)
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Combo Patch of other patches released!)
Post by: Grimoire LD on February 04, 2014, 10:20:28 PM
Very interesting discussion here... there are parts of RAM around 7E1C00 that never seem to have anything in them and have roughly 200 bytes to spare in that. I toyed around with the idea of adding all of the character's default data in that area at the start of the game by using Cecil's default code and redirecting it and while that section of it works perfectly. It is actually turning them into a character which is the difficult part. The Shadow Slot is normally saved in byte by byte. It's not piecemeal as it is with Default Cecil. But if we changed it to be Piecemeal... I see no reason why this section of RAM couldn't be our own Shadow Slot data.

Upon request I have touched up Geomancy. It will no longer Backfire on you, instantly killing Rydia, but will instead just say "Nothing happened". In addition to this change though is the addition of a Conditional and for that I added new code in the free space. So this is Geomancy-Eidolon Whip


Code: [Select]
$03/FF6A AD B3 26 LDA $26B3  [$7E:26B3] A:00F0 X:01CF Y:0010 P:eNvMxdIzc - Load Weapon from Right Hand into A.
$03/FF6D C9 35 CMP #$35 A:00F0 X:01CF Y:0010 P:eNvMxdIzc - Is it the Eidolon Whip (Blitz Whip)?
$03/FF6F F0 05 BEQ $05    [$FF76] A:00F0 X:01CF Y:0010 P:eNvMxdIzc - If so, branch to actual routine.
--------------------------------------------------------------------------------------------------------------------
$03/FF71 A9 00 LDA #$00 A:00F0 X:01CF Y:0010 P:eNvMxdIzc - Load 00 (Nothing happened) into A.
$03/FF73 4C A7 E1 JMP $E1A7  [$02:E1A7] A:00F0 X:01CF Y:0010 P:eNvMxdIzc - Jump to End of Geomancy Routine.
------------------------------------------------------------------------------------------------------------------------------
$03/FF76 20 8B 85 JSR $858B  [$02:858B] A:00F0 X:01CF Y:0010 P:eNvMxdIzc - Generate Random Number.
$03/FF79 C9 21 CMP #$21 A:00F0 X:01CF Y:0010 P:eNvMxdIzc - Is it less than 33?
$03/FF7B B0 04 BCS $04    [$FF81] A:00F0 X:01CF Y:0010 P:eNvMxdIzc - If so branch to next check.
$03/FF7D A9 36 LDA #$36 A:00F0 X:01CF Y:0010 P:eNvMxdIzc - Load Shiva into A.
$03/FF7F 80 0A BRA $0A    [$FF8B] A:00F0 X:01CF Y:0010 P:eNvMxdIzc - Branch to End of Routine.
-------------------------------------------------------------------------------------------------------------------------------------
$03/FF81 C9 42 CMP #$42 A:00F0 X:01CF Y:0010 P:eNvMxdIzc - Is it less than 66?
$03/FF83 B0 04 BCS $04    [$FF89] A:00F0 X:01CF Y:0010 P:eNvMxdIzc - If so, branch to Ramuh.
$03/FF85 A9 37 LDA #$37 A:00F0 X:01CF Y:0010 P:eNvMxdIzc - Load Ramuh into A.
$03/FF87 80 02 BRA $02    [$FF8B] A:00F0 X:01CF Y:0010 P:eNvMxdIzc - Branch to End of Routine.
---------------------------------------------------------------------------------------------------------------------------------------------
$03/FF89 A9 38 LDA #$38 A:00F0 X:01CF Y:0010 P:eNvMxdIzc - Load Ifrit into A.
$03/FF8B 4C A7 E1 JMP $E1A7  [$02:E1A7] A:00F0 X:01CF Y:0010 P:eNvMxdIzc - Jump to End of Geomancy.

In addition I changed the original "failed check" to have this Jump in the original Geomancy Routine at...

Code: [Select]
$03/E156 C9 28 CMP #$28 A:0022 X:0000 Y:0000 P:eNvMxdizc
$03/E158 B0 04 BCS $04    [$E15E] A:0022 X:0000 Y:0000 P:eNvMxdizc
$03/E15A 4C 6A FF JMP $FF6A  [$03:FF6A] A:0022 X:0000 Y:0000 P:eNvMxdizc

After that I decided to try and do something... interesting. I think the Whips in FFIV were a neat idea, but they are just so basic and boring. So I touched them up and in so doing discovered some previous limitations to my Magic Weapons routine. I made every Whip (except the Eidolon Whip which changes Geomancy) allow a possibility of summoning an Eidolon on hit. Impish Whip, Bird Whip, Dynamite Whip, and the Dragon Whip.

 If you try to summon an Eidolon the game will not load the actual graphics... at all.

So I changed some things in the routine and I now have Eidolons working perfectly! It just required a little more space and a couple more conditionals but it is working optimally now.

Code: [Select]
$03/FF10 C9 31 CMP #$31 A:00F0 X:01CF Y:0006 P:eNvMxdIzc - Is it Imp or Lower?
$03/FF12 90 04 BCC $04    [$FF18] A:00F0 X:01CF Y:0006 P:eNvMxdIzc - If so branch to part-way through Magic Routine
---------------------------------------------------------------------------
$03/FF14 C9 40 CMP #$40 A:00F0 X:01CF Y:0006 P:eNvMxdIzc - Is it lower than Bahamut?
$03/FF16 90 03 BCC $03    [$FF1B] A:00F0 X:01CF Y:0006 P:eNvMxdIzc - If so branch to Full Magic Routine
----------------------------------------------------------------------
$03/FF18 4C 3E CD JMP $CD3E  [$02:CD3E] A:00F0 X:01CF Y:0006 P:eNvMxdIzc - Jump and stay with part way through Magic Routine.
-------------------------------------------------------------------
$03/FF1B 20 46 CC JSR $CC46  [$02:CC46] A:00F0 X:01CF Y:0006 P:eNvMxdIzc - Jump to Full Magic Routine
$03/FF1E A9 C0 LDA #$C0 A:00F0 X:01CF Y:0006 P:eNvMxdIzc - Load Weapon Swing into A.
$03/FF20 8D C2 33 STA $33C2  [$7E:33C2] A:00F0 X:01CF Y:0006 P:eNvMxdIzc - Store A in First Visual cue.
$03/FF23 A9 00 LDA #$00 A:00F0 X:01CF Y:0006 P:eNvMxdIzc - Load 00 into A.
$03/FF25 8D C3 33 STA $33C3  [$7E:33C3] A:00F0 X:01CF Y:0006 P:eNvMxdIzc - Store A in Second visual cue.
$03/FF28 60 RTS A:00F0 X:01CF Y:0006 P:eNvMxdIzc - Return

What those first two bytes do that are replaced are show the name of the spell being used... not a big loss considering I'd rather have an actual attack animation rather than have the name of the summon's attack show up and then attacking After the spell is done being cast.

And there you have it! I now have Eidolons being summoned from Whips and the Eidolon Whip summoning randomly Shiva, Ifrit, or Ramuh!
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Combo Patch of other patches released!)
Post by: Dark Knight on February 07, 2014, 04:18:55 PM
Wow, this is an amazing piece of work that's been going on around here. Similar to fedorajoe, I've created a new command for Cid out of the dummied out command. I've removed the message popping up after the execution of the command. All works fine as I want it, but one thing alludes me is the name of the spell appears in the pop up box instead of the command's name popping up during battle. Basically, I want it to be like the Pray command where the player will see Pray instead of Cure1. How is this preform?
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Combo Patch of other patches released!)
Post by: Grimoire LD on February 07, 2014, 04:42:39 PM
Excellent! I am glad to see that the tutorial with the back and forth was easy enough to follow.

The information you want is here...
(Ordinarily done at the end of routines so that is why the Return is here)

A9 0B   LDA #$0B   A:0010   X:00CE   Y:0000   P:envMxdizC - Load 15 into A. (Cid's Unused Command is Command ID 15)
8D C8 34   STA $34C8  [$7E:34C8]   A:000B   X:00CE   Y:0000   P:envMxdizC - Store A in 7E34C8.
A9 10   LDA #$10   A:000B   X:00CE   Y:0000   P:envMxdizC - Load 10 into A. (Mini-Message Data)
8D C7 34   STA $34C7  [$7E:34C7]   A:0010   X:00CE   Y:0000   P:envMxdizC - Store A in 7E34C7.
60    RTS   A:0010   X:00CE   Y:0000   P:envMxdizC -Return

That should be all you need.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Combo Patch of other patches released!)
Post by: Grimoire LD on February 07, 2014, 07:00:51 PM
Alright! For a while now I have been agonizing on how to properly use the space left to me by Auto-Hide's departure and I think I finally have it figured out...

Ever since playing Dissidia I had always wondered if there could be some story or plot event where Cecil would regain Dark Wave, after all Dark is not inherently evil in FFIV's world, the King of Baron appears to have been a Dark Knight of some sort if judging by FFIV:DS.

But it wouldn't be proper to just Give Paladin Cecil the ability to use Dark Wave just after he became a Paladin, then I got to thinking... "what if he reobtained Dark Wave somehow on his journey?" Then that dream was crushed by Square's mind bogglingly silly manner of drawing commands directly from ROM at the start of every battle, dependent on the Actor. Though I am still brainstorming ideas on how to get by that bout of curious game design, I did find a way to accomplish this dream of mine in a way that feels compatible with FFIV's basic story and in a way, a neat reference to FFIV DS.

In FFIV DS you can steal the Darkness Augment from Odin.

What I will do then is turn that idea into Odin's Armor. This is obtained in addition to the Odin Summon.

When worn this will change the effect of Cover into Dark Wave (Curse you non-standard manner of switching Command names! That unfortunately doesn't work outside of it actually Being in a command).

So if you want Paladin Cecil to retain that Dark Knight-like manner of being, you can use the Odin's Armor (which will have some nice stat bonuses as well). That seems like a Much better prize to me than Odin himself is.

Here is the code...

Odin's Armor turns Cover's Effect into Dark

Code: [Select]
$03/AB4A BD 31 20 LDA $2031,x[$7E:2031] A:0000 X:0000 Y:0012 P:envMxdiZc - Load Armor into A.
$03/AB4D C9 86 CMP #$86 A:0082 X:0000 Y:0012 P:eNvMxdizc - Is it Odin's Armor? (Silver Armor)
$03/AB4F D0 50 BNE $50    [$ABA1] A:0086 X:0000 Y:0012 P:envMxdiZC - If not, branch to rest of "turn start routine".
---------------------------------------------------(Looping Point)---------------------------------------------------------------
$03/AB51 BD 03 33 LDA $3303,x[$7E:3303] A:0086 X:0000 Y:0012 P:envMxdiZC - Load the first command byte.
$03/AB54 C9 13 CMP #$13 A:0000 X:0000 Y:0012 P:envMxdiZC - Is it Cover?
$03/AB56 D0 07 BNE $07    [$AB5F] A:0000 X:0000 Y:0012 P:eNvMxdizc - If not, branch to rest of routine.
-----------------------------------------------------------------------------------------
$03/AB58 A9 05 LDA #$05 A:0013 X:000C Y:0012 P:envMxdiZC - Load 05 (Dark) into A.
$03/AB5A 9D 03 33 STA $3303,x[$7E:330F] A:0005 X:000C Y:0012 P:envMxdizC - Store Dark in place of Cover.
$03/AB5D 80 0C BRA $0C    [$AB6B] A:0005 X:000C Y:0012 P:envMxdizC - Branch to rest of end of routine.
---------------------------------------------------------------------------------------------
$03/AB5F E8 INX A:0000 X:0000 Y:0012 P:eNvMxdizc
$03/AB60 E8 INX A:0000 X:0001 Y:0012 P:envMxdizc
$03/AB61 E8 INX A:0000 X:0002 Y:0012 P:envMxdizc
$03/AB62 E8 INX A:0000 X:0003 Y:0012 P:envMxdizc + 4 X, to reach next command.
$03/AB63 E6 FE INC $FE    [$00:00FE] A:0000 X:0004 Y:0012 P:envMxdizc - +1 to FE (first command checked)
$03/AB65 A5 FE LDA $FE    [$00:00FE] A:0000 X:0004 Y:0012 P:envMxdizc - Load FE into A.
$03/AB67 C9 19 CMP #$1A A:0001 X:0004 Y:0012 P:envMxdizc - Has it looked through all 25(+1) commands?
$03/AB69 D0 E6 BNE $E6    [$AB51] A:0001 X:0004 Y:0012 P:eNvMxdizc - If not, loop back to start.
--------------------------------------------------------------------------------------------------
$03/AB6B CA DEX A:0005 X:000C Y:0012 P:envMxdizC - -1 to X (to reach targeting of command)
$03/AB6C A9 60 LDA #$60 A:0005 X:000B Y:0012 P:envMxdizC - Load Target All Enemies into A.
$03/AB6E 9D 03 33 STA $3303,x[$7E:330E] A:0060 X:000B Y:0012 P:envMxdizC - Store A in Command Targeting.
$03/AB71 A5 CD LDA $CD    [$00:00CD] A:0060 X:000B Y:0012 P:envMxdizC - Load Character ID into A.
$03/AB73 85 00 STA $00    [$00:0000] A:0005 X:000B Y:0012 P:envMxdizC - Store A in 00.
$03/AB75 60 RTS A:0005 X:000B Y:0012 P:envMxdizC - Return.

I am fiddling with ideas on how to make this look at a range of commands. The only exception is that the command Must be unique to the character. So as not to replace an earlier character's command.  I'll think more on it later. For now I managed to give Paladin Cecil Dark Wave back without it feeling out of place!

Here are some pictures of the process in action...

Without Odin's Armor Cover will act as it always has.
(http://i112.photobucket.com/albums/n198/LastingDawn/FFIV-OdinsArmor1_zpsdc66c3d7.png) (http://s112.photobucket.com/user/LastingDawn/media/FFIV-OdinsArmor1_zpsdc66c3d7.png.html)

With Odin's Armor equipped however...
(http://i112.photobucket.com/albums/n198/LastingDawn/OdinsArmor2_zps0c84b033.png) (http://s112.photobucket.com/user/LastingDawn/media/OdinsArmor2_zps0c84b033.png.html)

You can use Cover as if it were Dark Wave!
(http://i112.photobucket.com/albums/n198/LastingDawn/OdinsArmor3_zpsa2a8cb4d.png) (http://s112.photobucket.com/user/LastingDawn/media/OdinsArmor3_zpsa2a8cb4d.png.html)

Well this was an intriguing experiment. I am glad to see if worked without flaws.


Though this is a good use of it. I think
Chillyfeez knocks it out of the park by using this section for Limit Breaks.

Title: Re: Grimoire LD's Notes, Patches, and Hacks (Combo Patch of other patches released!)
Post by: Grimoire LD on February 07, 2014, 07:58:28 PM
Wow. I did it. And it was so easy too... I have concocted a way to take those absolutely worthless "start of game" code and turn them into something that will expand our options by a fair amount!

This is all it took...

(Start of Game Character Creation)
$00/92D6   BF 55 FD 13   LDA $13FD55,x[$13:FD55]   A:0006   X:0000   Y:0000   P:envMxdIZc -  Load Character's Commands.
$00/92DA   99 00 1C   STA $1C00,y[$00:1C00]   A:0000   X:0000   Y:0000   P:envMxdIZc - Store them in unused section of RAM.
$00/92DD   E8    INX   A:0000   X:0000   Y:0000   P:envMxdIZc - +1 X
$00/92DE   C8    INY   A:0000   X:0001   Y:0000   P:envMxdIzc - +1 Y
$00/92DF   C0 6B 00   CPY #$006B   A:0000   X:0001   Y:0001   P:envMxdIzc - Has it placed all commands within memory?

And that was step 1.

Step 2 was even easier...

$03/8BA1   A6 E3   LDX $E3    [$00:00E3]   A:0005   X:0000   Y:0000   P:envMxdIzc - Load Slot Pointer.
$03/8BA3   BF 00 1C 00   LDA $001C00,x[$00:1C00]   A:0005   X:0000   Y:0000   P:envMxdIZc - Load New Location of Commands.
$03/8BA7   99 03 33   STA $3303,y[$7E:3303]   A:0000   X:0000   Y:0000   P:envMxdIZc - Store A in appropriate location.


At first I had the fear that this was a universal "Add Character to Party"... which would have made sense. But it's not. It is used purely by Start of Game Cecil, and do you know the way around this? Add Cecil to the party manually by the event. Does the same exact thing.
And that is All.

I am amazed at how simple this really was. Now you could use the Apples/Soma Drops to give any character you please any skill you please within the rules of the Game! An "Augment" system can be created out of this with a bit of work, make no mistake about it...

This is an enormous breakthrough for me. I am wondering what else I can use this fairly large empty space of RAM for...
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Commands stored directly in RAM!)
Post by: Dark Knight on February 08, 2014, 11:48:48 AM
Thanks Grimoire LD, its working as intended. Everything is well explained and easy to follow, you're doing great work here. Good luck in your future endeavors.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Commands stored directly in RAM!)
Post by: Grimoire LD on February 08, 2014, 04:42:23 PM
Thank you Dark Knight, should you ever have any requests or any more questions you can feel free to ask either Chillyfeez or myself.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Commands stored directly in RAM!)
Post by: Grimoire LD on February 08, 2014, 06:55:00 PM
So I fixed up my Hunt code, I ended up making part of a Dummy-Steal Routine, that links into the actual Steal Routine. This allows the Hunt to support the possibility for 24 Different Items! This is up from only 6, which was a little underwhelming. At the end of the original section of the Hunt Rewards System there is a JMP to the new section of code at FF90.

Hunt Rewards System+
Code: [Select]
$03/FF90 7B TDC A:003A X:0000 Y:0000 P:envMxdiZc - Set A to 00 basically.
$03/FF91 1A INC A A:0000 X:0000 Y:0000 P:envMxdiZc - +1 to Item Quantity.
$03/FF92 85 AA STA $AA    [$00:00AA] A:0001 X:0000 Y:0000 P:envMxdizc - Store A in Item Quantity.
$03/FF94 AD 73 27 LDA $2773  [$7E:2773] A:0001 X:0000 Y:0000 P:envMxdizc - Load Target's (now modified by original Hunt Rewards System) Item Byte.
$03/FF97 0A ASL A A:003A X:0000 Y:0000 P:envMxdizc
$03/FF98 0A ASL A A:0074 X:0000 Y:0000 P:envMxdizc - x4.
$03/FF99 85 FE STA $FE    [$00:00FE] A:00E8 X:0000 Y:0000 P:eNvMxdizc - Store the value in FE (The Value is how the game normally finds the item reference)
$03/FF9B A9 03 LDA #$03 A:00E8 X:0000 Y:0000 P:eNvMxdizc - Load 03 into A. (Rank 4 Obtaining Item compared to 0000 as Rank 1 obtaining item. But these Item Drops go unused except for Hunting)
$03/FF9D 20 79 83 JSR $8379  [$03:8379] A:0003 X:0000 Y:0000 P:envMxdizc - Jump to RNG Subroutine.
$03/FFA0 65 FE ADC $FE    [$00:00FE] A:0000 X:0000 Y:0000 P:envMxdizc - Add FE onto the RNG chosen.
$03/FFA2 AA TAX A:00E8 X:0000 Y:0000 P:eNvMxdizc - Transfer A to X.
$03/FFA3 BF 00 9F 0E LDA $0E9F00,x[$0E:9FE8] A:00E8 X:00E8 Y:0000 P:envMxdizc - Load Item Byte + the extra 0-3 to give it the range of all possibilities
$03/FFA7 20 5A E2 JSR $E25A  [$03:E25A] A:00B0 X:00E8 Y:0000 P:eNvMxdizc - Jump to rest of Steal Routine.
$03/FFAA 20 B1 85 JSR $85B1  [$03:85B1] A:001D X:0020 Y:0008 P:envMxdizc - Load Message Data Set-up
$03/FFAD 60 RTS A:0003 X:0020 Y:0008 P:envMxdizc - Return

Item is Displayed
(http://i112.photobucket.com/albums/n198/LastingDawn/Hunt4_zps16f9b3f6.png) (http://s112.photobucket.com/user/LastingDawn/media/Hunt4_zps16f9b3f6.png.html)

Enemy Dies
(http://i112.photobucket.com/albums/n198/LastingDawn/Hunt5_zpsf5a7f6fb.png) (http://s112.photobucket.com/user/LastingDawn/media/Hunt5_zpsf5a7f6fb.png.html)

The Items are as follows...

Item Rewards for Hunting

1 - Bomb Part, Notus, ZeusRage, Silk Web
2 - Tonic, Potion, Mute Bell, VampFang
3 - GaeaRobe, Revive, Scanner, Dark Kiss
4 - Ether, Bomb Arm, Impish Whip, Siren - RNG 20+
5 - Remedy, Whisker, Ranger Key (Will Allow you into the first part of the Troian Artemis Cult), Scholar Cap - RNG 30+
6 - Artemis Arrows, Silver Stopwatch, StarVeil, Artemis Key (Will allow you into the Inner Temple of the Artemis Cult where you can purchase the best equipment for Rosa.) - RNG 40+

A quick reminder how Hunt Rewards work... When you have a Beast-type (replacing Reptile, but also includes previous Reptiles) enemy in Critical and you use Hunt you will automatically kill the foe and obtain an item. The formula for the item chosen is this...

1 - (Enemy's Level +20). Which means that if you're lucky you could use this on a Gargoyle and get an item of the 4th Table. for higher level foes like an IceBeast (Level 40) You might not get anything more than a 1st Table Item. But the IceBeast itself is Level 40 which would also be your first chance to get a 60+ Item, which is the final table where the end goal in that is to get the Artemis Key. Though you'd have to be extremely lucky. First the RNG has to read 40+20 so that's 1 in 40 there. Then the table loaded has to be the 6th Table which is a 1/6 chance, finally you will need to get the 4th slot of the 6th Table which is a 1 /4 chance.

By fighting later game Beasts you should have a better chance at it, and its not like any of the rewards you get from Hunting are worthless (well maybe the GaeaRobe after Rosa is kidnapped)


Let me know if you think any of those might be a touch too overpowered, please.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Commands stored directly in RAM!)
Post by: Grimoire LD on February 08, 2014, 08:09:17 PM
My first command I ever made, Seek, has been redone with the knowledge I now have.

What this command does is it looks at the targeted Enemy's Item Byte, looks for the Item Byte's mention in RAM, and changes that to +40 making the odds you will receive an item from defeating that Foe about 20% chance better. (5% for 40+, 25% for 80+, Always for C0+)

Because of its... kind of overpowered nature, it is a rare weapon in my mod, and because it is a weapon it's effect is not always guaranteed.
Seek - Remastered
Code: [Select]
$03/FFAE 7B TDC A:0001 X:0100 Y:1A35 P:envMxdIzC - Clear A.
$03/FFAF AA TAX A:0001 X:0100 Y:1A35 P:envMxdIzC - Transfer A to X.
$03/FFB0 AD 73 27 LDA $2773  [$00:2773] A:0001 X:0100 Y:1A35 P:envMxdIzC - Load Targeted Enemy's Item Byte into A.
--------------------------------------------------------------------(Looping Point)------------------------------------------------------------------------------
$03/FFB3 DD 8E 35 CMP $358E,x[$00:368E] A:0001 X:0100 Y:1A35 P:envMxdIzC - Is it the same as the byte in Stored Item Byte?
$03/FFB6 F0 08 BEQ $08    [$FFC0] A:0001 X:0100 Y:1A35 P:envMxdIzC - If so, branch to rest of routine.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
$03/FFB8 E0 02 00 CPX #$0002 A:0001 X:0100 Y:1A35 P:envMxdIzC - Has it looked at all enemy type Item Drops?
$03/FFBB F0 0D BEQ $0D    [$FFCA] A:0001 X:0100 Y:1A35 P:envMxdIzC - If so, branch to Return.
$03/FFBD E8 INX A:0001 X:0100 Y:1A35 P:envMxdIzC - +1 to X.
$03/FFBE 80 F3 BRA $F3    [$FFB3] A:0001 X:0100 Y:1A35 P:envMxdIzC - Loop back to Stored Item Bytes
-----------------------------------------------------------------------------------------------------------------------
$03/FFC0 69 3F ADC #$3F A:0001 X:0100 Y:1A35 P:envMxdIzC - Add 3F (+1) into A.
$03/FFC2 9D 8E 35 STA $358E,x[$00:368E] A:0001 X:0100 Y:1A35 P:envMxdIzC - Store A in Stored Item Byte.
$03/FFC5 A9 90 LDA #$90 A:0001 X:0100 Y:1A35 P:envMxdIzC - Load Search Graphic into A.
$03/FFC7 8D C4 33 STA $33C2  [$00:33C4] A:0001 X:0100 Y:1A35 P:envMxdIzC - Store A in Audiovisual Cue.
7B TDC - Clear A
STA $33C3 - Store 00 in Audiovisual Cue (to make the Scan graphic show before the attack graphic, rather than the Scan graphic making the rest of the animation look off)

 :edit: 4/15/14 - Changed the routine slightly to account for Scan's graphic.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Commands stored directly in RAM!)
Post by: chillyfeez on February 08, 2014, 10:04:22 PM
Re: Seek (remastered)
Is it stackable?
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Commands stored directly in RAM!)
Post by: Grimoire LD on February 08, 2014, 10:21:04 PM
It is not... for fairly obvious reasons. What the code does is it looks at the Item Byte of the Targeted Foe, it will then search for that Item Byte in the Stored Item Byte section of RAM (358E) should it find that exact byte, it will increase it by 40, should it fail to find that byte (meaning that's its already been +40'd) it will jump to a Return after three searches.

You can target each type of foe one by one though to increase the likelihood of getting items from all types that are present.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Commands stored directly in RAM!)
Post by: Grimoire LD on February 08, 2014, 11:23:42 PM
Bah! Looks like it was too good to be true... while 7E1C00 doesn't look to be read by anything, it is also not saved when you go to reload your file, so any changes you make to your commands will be set back to default. An idea of "abilities that last a session" is a strange one that doesn't seem to really work in a thematic sense.
Back to the drawing board on that then...
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Hunt now supports 24 possible items!)
Post by: LordGarmonde on February 09, 2014, 02:14:20 PM
Don't get discouraged - there's still plenty of kick-ass work! I just had a random thought about the above problem: what about modifying the code that is called when saving and forcing it to deal with the RAM in question?
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Hunt now supports 24 possible items!)
Post by: Grimoire LD on February 09, 2014, 10:26:44 PM
I've never checked the save format, in all honesty I'm not even sure where in RAM it is located at. I do have to casually wonder what all is saved though... however that should be dealt with in the Main Menu section, which as we know, is Made of free space... you might be on to something there. I'll take a look later.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Hunt now supports 24 possible items!)
Post by: Grimoire LD on February 14, 2014, 11:03:15 AM
Because Evasion is seriously out of balance in FFIV, I did what I could to rebalance that aspect of the game. I removed part of the accuracy divisor when attacking the backrow. This means that this character will no longer have stupid amounts of dodging and damage reduction for being in the backrow. By removing this it also seems as if the damage done to the back row is minimal to normal. Which... I wasn't expecting, but it works well enough for my purposes. This means that the backrow is no longer a haven for armored characters to stay safe and there should be a new tension for characters you would normally place in the backrow.

Code: [Select]
$03/C55A AD 81 26 LDA $2681  [$7E:2681] A:0080 X:0000 Y:0003 P:eNvMxdizc - Load Caster's class/row/Long Range
$03/C55D 29 20 AND #$20 A:0080 X:0000 Y:0003 P:eNvMxdizc  - Is it Long Range?
$03/C55F D0 0A BNE $0A    [$C56B] A:0000 X:0000 Y:0003 P:envMxdiZc - If so branch to 03C56B.
$03/C561 AD 85 26 LDA $2685  [$7E:2685] A:0000 X:0000 Y:0003 P:envMxdiZc - Load Caster's Status Byte 3.
$03/C564 29 02 AND #$02 A:0000 X:0000 Y:0003 P:envMxdiZc - Is it Jump?
$03/C566 D0 03 BNE $03    [$C56B] A:0000 X:0000 Y:0003 P:envMxdiZc - If so branch to 03C56B.
$03/C568 4E F8 38 LSR $38F8  [$7E:38F8] A:0000 X:0000 Y:0003 P:envMxdiZc - Divide Accuracy by 2.

To...

Code: [Select]
$03/C55A AD 81 26 LDA $2681  [$7E:2681] A:0080 X:0000 Y:0003 P:eNvMxdizc - Load Caster's class/row/Long Range
$03/C55D 29 20 AND #$20 A:0080 X:0000 Y:0003 P:eNvMxdizc  - Is it Long Range?
$03/C55F D0 0A BNE $0A    [$C56B] A:0000 X:0000 Y:0003 P:envMxdiZc - If so branch to 03C56B.
$03/C561 AD 85 26 LDA $2685  [$7E:2685] A:0000 X:0000 Y:0003 P:envMxdiZc - Load Caster's Status Byte 3.
$03/C564 29 02 AND #$02 A:0000 X:0000 Y:0003 P:envMxdiZc - Is it Jump?
$03/C566 D0 03 BNE $03    [$C56B] A:0000 X:0000 Y:0003 P:envMxdiZc - If so branch to 03C56B.
$03/C568 EA EA EA NOP (x3)

My mod is coming along beautifully. I only need to change a couple more things in coding, then the big task of making all the monsters more difficult will become the forefront of the mod. After all, all these new abilities should have something of equal value to fight. So far I have up through the Mist Cave balanced. And it looks pretty good so far. There is a "high risk, high reward" mentality with each battle. Enemies are more difficult than they ever were, but in this difficulty comes the opportunity for great amounts of Exp. and their completely altered drop tables makes each battle a (hopefully) exciting encounter until the end. Granted at the start you can probably just use Dark Omen a bunch then heal up at the Inn to gain some quick and easy Exp.

 :edit: I made another change to the basic battle system, I noticed that while my Calcify to Imbued Weapons worked wonderfully, it still didn't work on bosses, so I went through my Fight notes, found that important piece, and changed it to a different value...

Code: [Select]
$03/C855 20 97 C9 JSR $C997  [$03:C997] A:0001 X:0680 Y:001A P:envMxdizC  - Jump out of Routine (Appears to be Random Number Generator)
$03/C858 AD FD 38 LDA $38FD  [$7E:38FD] A:0039 X:0000 Y:0000 P:envMxdiZc - Looks to load a random number likely generated from the previous routine.
$03/C85B F0 C9 BEQ $C9    [$C826] A:0001 X:0000 Y:0000 P:envMxdizc - If it is 1 or higher it is considered a successful check/pass.
$03/C85D AD 70 27 LDA $2770  [$7E:2770] A:0001 X:0000 Y:0000 P:envMxdizc - Load Target's Level/Boss Bit.
$03/C860 30 C4 BMI $C4    [$C826] A:0005 X:0000 Y:0000 P:envMxdizc - Break if Minus (meaning that the Boss Bit is an 80) and branch to 03C826.
$03/C862 AD 9E 26 LDA $269E  [$7E:269E] A:0005 X:0000 Y:0000 P:envMxdizc - Load Caster's Status Inflict Byte 1.
$03/C865 8D 08 39 STA $3908  [$7E:3908] A:0002 X:0000 Y:0000 P:envMxdizc - Store A in 7E3908.

To...

Code: [Select]
$03/C855 20 97 C9 JSR $C997  [$03:C997] A:0001 X:0680 Y:001A P:envMxdizC  - Jump out of Routine (Appears to be Random Number Generator)
$03/C858 AD FD 38 LDA $38FD  [$7E:38FD] A:0039 X:0000 Y:0000 P:envMxdiZc - Looks to load a random number likely generated from the previous routine.
$03/C85B F0 C9 BEQ $C9    [$C826] A:0001 X:0000 Y:0000 P:envMxdizc - If it is 1 or higher it is considered a successful check/pass.
$03/C85D AD 19 27 LDA $2719  [$7E:2719] A:0001 X:0000 Y:0000 P:envMxdizc - Load Target's Attack Elemental
$03/C860 30 C4 BMI $C4    [$C826] A:0005 X:0000 Y:0000 P:envMxdizc - Break if Minus (meaning that the Immune bit is triggered) and branch to 03C826.
$03/C862 AD 9E 26 LDA $269E  [$7E:269E] A:0005 X:0000 Y:0000 P:envMxdizc - Load Caster's Status Inflict Byte 1.
$03/C865 8D 08 39 STA $3908  [$7E:3908] A:0002 X:0000 Y:0000 P:envMxdizc - Store A in 7E3908.

So I can decide which foes I want immune to Imbued Weapons that doesn't rely solely on the Boss Bit.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Hunt now supports 24 possible items!)
Post by: Grimoire LD on February 16, 2014, 12:15:28 AM
Made one change to the Dark Wave formula which was causing some strange issues with targeting. The game uses a "target" to look at for Dark Wave instead of using the Mirror Data at 2680. When this is used from a weapon the game draws the amount of HP to remove from the Current Target's HP rather than the Caster. So I changed this to look at the mirror data here...

$03/E9F1   AD 89 26   LDA $2689  [$7E:2689]   A:0004   X:0280   Y:0000   P:envmxdizC - And everything looks to be working great!
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Hunt now supports 24 possible items!)
Post by: Grimoire LD on February 19, 2014, 04:47:19 PM
I did so much cool with Cid that I didn't want him to be just be there and then be gone as the normal plot of the game, so instead I did something else...

First I need to disable any Item Switching when a character is loaded from a Shadow Slot for obvious reasons for this plan to work.

Secondly... the means in which this is done is without hacking of any kind (except for what I just mentioned above)

I am not sure if this known, but if you have a default character load to a Shadow Slot and say... we load Kain to Shadow Slot 2. When his second actor joins it will be loaded from Shadow Slot 2 but Also Saved to Shadow Slot 2 so his third iteration no longer needs an Actor Slot to himself and can self load from Shadow Slot 2.

So with that in mind I changed Kain3 to load Cid2 and Tellah3 to load Edge2.

Now here is how my event works. I changed the Magazine to "Switch" when used it will ask "Choose Yes to replace Cid for Edge. Choose No to replace Edge for Cid or keep Edge."

This is done by removing three actors.

Remove Edge from Party
Remove Kain3(Cid2) from Party
Remove Tellah3(Edge2) from Party
Yes/No Dialogue IF Yes:
Add Kain3(Cid2) to Party

If No
Add Tellah3(Edge2) to party

And it was as simple as that. I suppose if you didn't want to use any hacking you can Explicitly warn the player about removing the current equipment on Cid/Edge so they will return with nothing and need re-equipped.

Title: Re: Grimoire LD's Notes, Patches, and Hacks (1 Party Member Switch Item Created!)
Post by: koala_knight on February 19, 2014, 10:08:52 PM
I don't recall the state of event editing in FF4, nor am I very aware of the availability of space for such a thing, but would it be viable to create something like the party switching thing they did for FF4A?
Title: Re: Grimoire LD's Notes, Patches, and Hacks (1 Party Member Switch Item Created!)
Post by: Grimoire LD on February 19, 2014, 10:25:53 PM
That would be a highly unfortunate no...

The issue is not event space, there's Tons of it, FFIV's event system has been Completely cracked and the editor lets you edit events so easily. The issue is with the way the Shadow Slot system is set up. When a character leaves your party (and aren't specifically excluded from battle, Rydia at Fabul as the largest case of this) they are either Discarded or placed into an assigned Shadow Slot. Now unfortunately there are only five Shadow Slots and one of those Shadow Slots are foolishly enough occupied by FuSoYa at the end game. But even if we had more Shadow Slots it wouldn't make a difference without the actors to load and FFIV is strapped for usable actors. In this Shadow Slot they can only be drawn by drawing these characters from their Shadow Slot over their preferably corresponding abilities and equipment (that part is easy enough to change) but the default game basically only has Two (Possibly Three. Since Anna does count as a character but for some reason the editor doesn't let you edit her or Golbez) available Slots.

Now Phoenix made a patch to make all the characters fit into the prescribed space by changing the way the storing system worked. At the time he wasn't aware that his compounding of data was also making it so you could never Critical Hit again and it screwed up the Experience tables.

So in short... it is not plausible at this very moment. Should we find more space in RAM there might be a way to make it work from a Main Menu branch. But how we would go about that is completely obscure to me. Granted I have found a roughly 200 byte area in RAM that never seems to be used around 7E1C00.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (1 Party Member Switch Item Created!)
Post by: koala_knight on February 20, 2014, 10:59:15 AM
Interesting. Thanks for the insight. It would be an impressive feat.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (1 Party Member Switch Item Created!)
Post by: Pinkpuff on February 20, 2014, 02:24:54 PM
Now Phoenix made a patch to make all the characters fit into the prescribed space by changing the way the storing system worked. At the time he wasn't aware that his compounding of data was also making it so you could never Critical Hit again and it screwed up the Experience tables.

It made me so sad that it never quite worked out. If someone were to ever figure out a way to accomplish this seamlessly (or even playably!) I think I would cry tears of joy IRL.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (1 Party Member Switch Item Created!)
Post by: fedorajoe on March 04, 2014, 08:21:56 PM
Grimoire LD, I had another question in follow up to our prior conversation on command editing.

When a spell is cast by a command (like in my example, where the Pressure command casts Hold), is it possible to edit the palette of the spell visual?  In other words, if I wanted Pressure's visuals to be a different palette than you see when you normally cast Hold, is this possible?  I'm not sure if one could load such an instruction into the command without having to alter the spell itself.

Thanks!
Title: Re: Grimoire LD's Notes, Patches, and Hacks (1 Party Member Switch Item Created!)
Post by: Grimoire LD on March 04, 2014, 08:37:42 PM
I'm afraid that is all in the spell data. I've never come across anything that did anything which loaded specific palettes. That sort of matter is mostly pre-loaded in ROM with the Spell. I could be wrong though to say it is never completely stored in RAM. What you can do however is make a dummy Hold that is used purely for the spell and switch the casted spell to that one. Right after W Meteo there are two unused spell slots that you could use for this very purpose. This would also have the effect of making the spell's success based on Wisdom rather than Will and you can change accuracy rates as you please in such an event.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (1 Party Member Switch Item Created!)
Post by: fedorajoe on March 04, 2014, 09:23:29 PM
Oh gosh, how cool is that???  I had thought that all of the dummy spells were in fact used somewhere, but if there are two truly unused spots, then that is exactly what I'll do.

Thanks again!
Title: Re: Grimoire LD's Notes, Patches, and Hacks (1 Party Member Switch Item Created!)
Post by: Grimoire LD on March 05, 2014, 05:31:57 PM
Here's a little trick I learned (probably not new) but I was wondering how I would go about nerfing the power of Bio (Virus) against certain foes. So a trick I used was to make Bio "Immune" element. If an enemy has Immune they will then treat it as an Immune spell as in it will deal 1 damage. This decreases its effectiveness against certain varieties of foes, but it's still a powerful choice to make in most circumstances.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (1 Party Member Switch Item Created!)
Post by: chillyfeez on March 05, 2014, 06:46:00 PM
That's cool! New to me, anyway. How does the game react if the target is "immune" to a different element?
Title: Re: Grimoire LD's Notes, Patches, and Hacks (1 Party Member Switch Item Created!)
Post by: Grimoire LD on March 05, 2014, 06:56:59 PM
It will react as if they Resist Immune as well, but looking through the default game there aren't that many foes with Immunity to elements. On a little more extra testing, this also has the side effect of making anything with a x4 Weakness x4 Weak to Bio. But if you give them Resist Immune then it will deal only one damage to them regardless.

I was growing a little worried at first that I would need to make Bio not hit bosses to compensate for some bosses., but giving them the Immune Resistance fixes that worry.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (1 Party Member Switch Item Created!)
Post by: Grimoire LD on March 05, 2014, 08:15:30 PM
I've been working on my actual patch for a while now (you can see all of the detailed changes here (http://www.romhacking.net/forum/index.php/topic,17723.20.html))

But I thought it was a good idea to post what I've done with some of my research. I've managed to turn Piercing Sight and Aura into their own sections of gameplay rather than just curiousities that might get one look at and never used again. So in essence this post is about putting theory into practice (this is a repost from my romhacking.net topic on my patch but it displays in full the integration of Piercing Sight and Aura)

This update has been a bit of time coming. I always liked that The After Years made the Devil's Road (Serpent Road in this) into an actual area so I took my own interpretation of it.

The party of Palom/Porom/Tellah is highly unique in that there is a strong focus on magic moreso than anything, but the problem with the party formation is that it's only around for half of a pretty small area. I decided to let this crew tackle another area called the Serpent Road.

The unique enemies here are inescapable and each one has their own powerful tactics against the player.

(http://i112.photobucket.com/albums/n198/LastingDawn/FFIV-SerpentRoad2_zpsf85df3d5.png) (http://s112.photobucket.com/user/LastingDawn/media/FFIV-SerpentRoad2_zpsf85df3d5.png.html)

The area is based around fake walls so there is a heavy element of trickery and because of this the place becomes labyrinthine with false leads and dashed hope (remember this Is a difficulty hack as well, hehe)

The enemies here are more geared towards this party, but I made one specific decision. Each enemy here would be resistant to Bio (Virus). Which will be the only spell in the game to be Immune Elemental. Which means that you may find it dealing 1 damage to some foes you might not expect it to.

(http://i112.photobucket.com/albums/n198/LastingDawn/FFIV-SerpentRoad1_zps39dde95a.png) (http://s112.photobucket.com/user/LastingDawn/media/FFIV-SerpentRoad1_zps39dde95a.png.html)


You may find your weapons lacking in damage...

(http://i112.photobucket.com/albums/n198/LastingDawn/FFIV-SerpentRoad3_zpsb2e68a40.png) (http://s112.photobucket.com/user/LastingDawn/media/FFIV-SerpentRoad3_zpsb2e68a40.png.html)

But there are ways around that! The unique enemies in the Serpent Road are mostly Mage types, which if Palom is sufficiently leveled or Tellah sufficiently geared he can cast the new spell Aura on Cecil and give him several Strong Against certain races of Foe.

(http://i112.photobucket.com/albums/n198/LastingDawn/FFIV-SerpentRoad4_zps82999bca.png) (http://s112.photobucket.com/user/LastingDawn/media/FFIV-SerpentRoad4_zps82999bca.png.html)

This makes Cecil's damage go from that to this....

(http://i112.photobucket.com/albums/n198/LastingDawn/FFIV-SerpentRoad5_zpsc8934136.png) (http://s112.photobucket.com/user/LastingDawn/media/FFIV-SerpentRoad5_zpsc8934136.png.html)
(Note: In this particular picture Cecil is using the Traveler's Knife which has a chance to cast Scan on hit which it did here, and that is why Scan is displayed as if Cast... because it was cast along with damage)

If you find your lack of strong damage against these foes as worrying, you may use Tellah's Piercing Sight spell to randomly change the elemental weakness of the foe!

(http://i112.photobucket.com/albums/n198/LastingDawn/FFIV-SerpentRoad6_zpsef0274f9.png) (http://s112.photobucket.com/user/LastingDawn/media/FFIV-SerpentRoad6_zpsef0274f9.png.html)

(http://i112.photobucket.com/albums/n198/LastingDawn/FFIV-SerpentRoad7_zpsef3a692d.png) (http://s112.photobucket.com/user/LastingDawn/media/FFIV-SerpentRoad7_zpsef3a692d.png.html)
Now it is weak to Fire which Tellah or Palom can exploit to the fullest!

(http://i112.photobucket.com/albums/n198/LastingDawn/FFIV-SerpentRoad8_zps981d9e4e.png) (http://s112.photobucket.com/user/LastingDawn/media/FFIV-SerpentRoad8_zps981d9e4e.png.html)

With these new tools at your disposal the harrowing Serpent Road will still be a trek, but it is doable, make no mistake about it.

However this is the point in the game where the player should adapt to their new toys or else they will be outclassed by many manner of foes moving forward.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (1 Party Member Switch Item Created!)
Post by: Grimoire LD on July 04, 2014, 11:14:03 AM
It's been a while since I posted in my own topic, but my interests have swayed here and there over the past few months, I had decided to revisit one of my hacks which always bothered me because of its "just-so" point of execution, my Imbued Weapons hack.

In theory it was a great idea. Take the broken code of the Calcify Routine and add a bunch of conditional checks for weapons that would activate their special Commands from normal weapons, unfortunately in practice it left a little to be desired... When the check failed the message "The Weapon glows bright!" showed up which indicated that yes the Status Check passed, but the secondary RNG check failed. This made it's occurrence a bit rarer than actually intended and it wouldn't work against certain foes at all! Also if you happened to kill the Foe with the weapon the status would Never occur so the Command could never execute. Meaning that the downside or upside of some of the commands (Ancient Sword - Regen, Thief Knife - Steal, etc) couldn't occur if the enemy was also being killed. This was not optimum and made the effects much rarer than intended.

Now I've changed the hack to be more... well moddable. The new hack takes the ill-planned "IF Target is Charging divide their defenses by 2" and changes it to "IF Caster is using a weapon with the Calcify1 Routine Place Caster's Accuracty into A then JSR to Imbued Weapons Routine."

This has an RNG bounced off of it where it will return a value from 00 to the Caster's Accuracy, if the check fails (Vs. Above 50) (which it always will by status infliction default due to the status coding above it, that is not accessed by this Jump) then Return.

Here is the new code which will be edited into the Imbued Weapons post...

Code: [Select]
-----------------------------------------------------------------------------------------------------------------------------------------
$03/C740 AD 9F 26 LDA $269F  [$7E:269F] A:0000 X:0000 Y:0000 P:envMxdiZC - Load Caster's Attack Status Byte 2 into A.
$03/C743 29 01 AND #$01 A:0001 X:0000 Y:0000 P:envMxdizC - Is it Calcify 1?
$03/C745 F0 06 BEQ $06    [$C74D] A:0001 X:0000 Y:0000 P:envMxdizC - If not, branch to next portion of Defense determination...
-----------------------------------------------------------------------------------------------------------------------------------------
$03/C747 AD 9C 26 LDA $269C  [$7E:269C] A:0001 X:0000 Y:0000 P:envMxdizC - Load Caster's Accuracy into A.
$03/C74A 20 E6 CB JSR $CBE6  [$03:CBE6] A:0063 X:0000 Y:0000 P:envMxdizC - Jump to Imbued Weapons Subroutine
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/CBE6 20 79 83 JSR $8379  [$00:8379] A:0012 X:000F Y:0000 P:envMxdizc - Jump to RNG Routine (00 to Accuracy)
$03/CBE9 C9 32 CMP #$32 A:000B X:0000 Y:0000 P:envMxdizc - Is it 50 or above?
$03/CBEB 90 54 BCC $54    [$CC41] A:000B X:0000 Y:0000 P:eNvMxdizc - If not, branch to end of routine.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

So much more effective than my original coding! Now Imbued Weapons is working 100% as intended.





Title: Re: Grimoire LD's Notes, Patches, and Hacks (1 Party Member Switch Item Created!)
Post by: Grimoire LD on July 20, 2014, 02:29:17 PM
Alright, so I am still playtesting my hack when I noticed something strange... Shields were giving Dark Knight Cecil a consistent x1 Defense Multiplier, no matter what shield the game would give him x1 Multiplier. I took a look through the Shield bytes and there was nothing in there specifically about that. Now this is a problem from a balancing standpoint... All of my other characters have 0-2 Defense Multipliers but Dark Knight Cecil has 3, making many hits to him as glancing blows, even though that was not the intention.

I did some quick searches to find why this was, but continued to come up empty... I tried it on a fresh file and saw that Shields at Level 10 don't effect the Defense Multiplier and I jumped to a late level file and saw that it was giving Kain x3 Defense Multipliers and it was independent of which shield was equipped. So I changed Cecil to Level 99 and saw that his Defense Multipliers jumped to x6, despite his stats being 00 and the only thing equipped was a shield.

This makes it clear to me that Level not only increases Base Hit% by 1 every few levels , but for Shield Bearers it increases their overall Defense Multipliers  every 16 levels.
96/6 = 16x6 thereby giving Shield Bearers an unfair curve against all other characters. I think I'll need to find where this is in code and squelch it for this project since Shield Bearers by their nature already have such high HP...

Alright, I've learned at least that looking at the basic stats is useless because the game first writes all of its proper calculations to the battle stats before transferring the changed values to the basic stats so to find this I set a breakpoint of write on the Defense Multipliers in the battle stat section...

In a short time I located what I was looking for.

$03/99C9   A0 28 00   LDY #$0028   A:0000   X:0003   Y:0027   P:envMxdIZC - Load 0028 (used for 2028 location of Battle Defense Multipliers...) into Y.
$03/99CC   AD 65 39   LDA $3965  [$7E:3965]   A:0000   X:0003   Y:0028   P:envMxdIzC - Load Copy of Level into A.
$03/99CF   20 84 84   JSR $8484  [$03:8484]   A:0063   X:0003   Y:0028   P:envMxdIzC - Jump to Dividing subroutine.
$03/8484   4A    LSR A   A:0063   X:0003   Y:0028   P:envMxdIzC
$03/8485   4A    LSR A   A:0031   X:0003   Y:0028   P:envMxdIzC
$03/8486   4A    LSR A   A:0018   X:0003   Y:0028   P:envMxdIzC
$03/8487   4A    LSR A   A:000C   X:0003   Y:0028   P:envMxdIzc
$03/8488   60    RTS   A:0006   X:0003   Y:0028   P:envMxdIzc - Return

This is only called if a Shield is equipped (which places a 01 in the Stat Copy Section which is used to somehow multiply the existing defense multiplier by x1, if no shield is equipped it returns a x0 and nullifies the Level Bonus for Shield Bearers. And there we have it! All I need to change is the LDA 3965 to look at an area that will always read 00. Or if I wanted to make it available to everyone independent of a shield I would change the second value that is looked for into a guaranteed value of 01. For this project I want to eliminate this unfair addition so...

$03/99CC   AD 65 39   LDA $3900  [$7E:3900]   A:0000   X:0003   Y:0028   P:envMxdIzC - Load 00 into A.


There's quite a bit in this section actually! I should take some time out one of these days to research this entire area since it flows so well into one another and there might be some other useful information in here.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (1 Party Member Switch Item Created!)
Post by: Grimoire LD on July 20, 2014, 07:30:42 PM
Here's a little trick I learned (probably not new) but I was wondering how I would go about nerfing the power of Bio (Virus) against certain foes. So a trick I used was to make Bio "Immune" element. If an enemy has Immune they will then treat it as an Immune spell as in it will deal 1 damage. This decreases its effectiveness against certain varieties of foes, but it's still a powerful choice to make in most circumstances.

 :edit: There is an exception to this rule and that's if the monster has the Absorb bit set, the enemy will then take double the damage from an Immune bit spell if the Immune bit is also triggered.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Information on Shield+Level Multiplier)
Post by: Grimoire LD on July 23, 2014, 01:20:56 PM
Because some parts of this game were designed in a frankly silly fashion, I couldn't really completely get rid of the bonus defense multipliers because, outside of gaining Agility it is the Only way to get Defense Multipliers. So I instead have linked Defense Multipliers to Vitality /16 (rather than Level/16) and have forced a 01 to be loaded so there is no longer any sort of shield check, thereby everybody with enough vitality will be gaining Defense Multipliers and in my opinion this works out nicer than the initial setup.

Code: [Select]
$03/99C9 A0 28 00 LDY #$0028 A:0088 X:0003 Y:0027 P:eNvMxdIzC - Load 2028 reference intoY.
$03/99CC AD 68 39 LDA $3968  [$7E:3968] A:0088 X:0003 Y:0028 P:envMxdIzC - Load Copy of Vitality into A.
$03/99CF 20 84 84 JSR $8484  [$03:8484] A:001A X:0003 Y:0028 P:envMxdIzC - Jump to dividing Subroutine.
$03/8484 4A LSR A A:001A X:0003 Y:0028 P:envMxdIzC
$03/8485 4A LSR A A:000D X:0003 Y:0028 P:envMxdIzc
$03/8486 4A LSR A A:0006 X:0003 Y:0028 P:envMxdIzC
$03/8487 4A LSR A A:0003 X:0003 Y:0028 P:envMxdIzc
$03/8488 60 RTS A:0001 X:0003 Y:0028 P:envMxdIzC
$03/99D2 85 DF STA $DF    [$00:00DF] A:0001 X:0003 Y:0028 P:envMxdIzC - Store A in DF.
$03/99D4 A9 01 LDA #$01 A:0001 X:0003 Y:0028 P:envMxdIzC - Load 01 into A.
$03/99D6 EA NOP A:0001 X:0003 Y:0028 P:envMxdIzC - NULL
$03/99D7 85 E1 STA $E1    [$00:00E1] A:0001 X:0003 Y:0028 P:envMxdIzC - Store 01 in E1 (these two are multiplied together to give the final amount) (01xVit/16 xAgi/16 = Defense Multiplier now)[/quote]

And there you have it. I'll be moving forward with this. Since I noticed I was making Defense kind of worthless if you only ever get 2-3 Defense Multipliers, big deal if you can shrug off 40 damage from 2 blows when another 5 or 6 were waiting.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Information on Shield+Level Multiplier)
Post by: Grimoire LD on July 27, 2014, 09:26:37 PM
I've touched up Coat Hammer to make it more useful, now that I've made it to the point in my hack where he's usable I've noticed that he's not as useful as I had hoped. He can deal decent damage... some times and that's it/ I noticed that while in theory it's great to have a skill which puts a Status on a weapon (kind of the opposite of Tellah's Elemental Weapon ability) taking enemy evasion into consideration makes it difficult to predict, but since I had a free item in Greens (known at the time as "Key1" since it was replaced basically by the Whistle)  I changed it to the Homing Device "(Wrench)Homing" It's a little bit of a shame I came up with this "Wrench" idea so late as I'd love to use that symbol for other Coat Hammer or Item Lord abilities, maybe I'll think about it down the line, because it would be neat to have Cid unique items. (Currently there's only the Homing Device).

This will give Cid the ability to turn his weapon into a Drain Elemental weapon for the battle, if you're lucky enough to get a VampFang. This will give Cid the needed longevity he needs and his Homing Device will give him 255 Accuracy, making a combo with his normal Coat Hammer items so much better.




Code: [Select]
$03/EAE0 4C CF FF JMP $FFCF  [$02:FFCF] A:00F0 X:01CF Y:0010 P:eNvMxdIzc  - New Jump Point (used by later in Routine)
------------------------------------------------------------------------------------------------------------------------------------------------
$03/EAE6 A6 A6 LDX $A6    [$00:00A6] A:004A X:000D Y:012D P:envMxdIzc - Load Slot of User.
$03/EAE8 AD 1C 32 LDA $321C  [$7E:321C] A:004A X:000D Y:012D P:envMxdIzc - Load First Item Quantity into A.
$03/EAEB C9 02 CMP #$02 A:004A X:000D Y:012D P:envMxdIzc - Is there two or more?
$03/EAED B0 01 BCS $01    [$EAF0] A:004A X:000D Y:012D P:envMxdIzc - If so skip past the Return
----------------------------------------------------------------------------------------------------------------------------------
$03/EAEF 60 RTS A:004A X:000D Y:012D P:envMxdIzc - Return
--------------------------------------------------------------------------------------------------------------------------------------
$03/EAF0 AD 1B 32 LDA $321B  [$7E:321B] A:004A X:000D Y:012D P:envMxdIzc - Load First Item into A.
$03/EAF3 C9 D6 CMP #$D6 A:004A X:000D Y:012D P:envMxdIzc - Is it Maiden's Kiss?
$03/EAF5 D0 04 BNE $04    [$EAFB] A:004A X:000D Y:012D P:envMxdIzc - If not, branch to next check.
$03/EAF7 A9 20 LDA #$20 A:004A X:000D Y:012D P:envMxdIzc  - Load 20 into A (Frog)
$03/EAF9 80 1E BRA $1E    [$EB19] A:004A X:000D Y:012D P:envMxdIzc - Branch to Status Storing.
--------------------------------------------------------------------------------------------------------------------------------------
$03/EAFB C9 D7 CMP #$D7 A:004A X:000D Y:012D P:envMxdIzc - Is it Dwarf's Bread?
$03/EAFD D0 04 BNE $04    [$EB03] A:004A X:000D Y:012D P:envMxdIzc - If not, branch to next check.
$03/EAFF A9 10 LDA #$10 A:004A X:000D Y:012D P:envMxdIzc - Load 10 into A (Mini)
$03/EB01 80 16 BRA $16    [$EB19] A:004A X:000D Y:012D P:envMxdIzc - Branch to Status Storing.
-------------------------------------------------------------------------------------------------------------------------------------
$03/EB03 C9 D9 CMP #$D9 A:004A X:000D Y:012D P:envMxdIzc - Is it EchoHerb?
$03/EB05 D0 04 BNE $04    [$EB0B] A:004A X:000D Y:012D P:envMxdIzc - If not, branch to next check.
$03/EB07 A9 04 LDA #$04 A:004A X:000D Y:012D P:envMxdIzc - Load 04 into A (Silence)
$03/EB09 80 0E BRA $0E    [$EB19] A:004A X:000D Y:012D P:envMxdIzc - Branch to Status Storing.
-------------------------------------------------------------------------------------------------------------------------------------------------
$03/EB0B C9 DA CMP #$DA A:004A X:000D Y:012D P:envMxdIzc - Is it Eyedrops?
$03/EB0D D0 04 BNE $04    [$EB13] A:004A X:000D Y:012D P:envMxdIzc - If not, branch to next check.
$03/EB0F A9 02 LDA #$02 A:004A X:000D Y:012D P:envMxdIzc - Load 02 into A (Bliind)
$03/EB11 80 06 BRA $06    [$EB19] A:004A X:000D Y:012D P:envMxdIzc - Branch to Status Storing.
-----------------------------------------------------------------------------------------------------------------------------------------------------
$03/EB13 C9 DB CMP #$DB A:004A X:000D Y:012D P:envMxdIzc - Is it Antidote?
$03/EB15 D0 C9 BNE $C9    [$EAE0] A:00F0 X:01CF Y:0010 P:eNvMxdIzc - If none of the current items match, Branch back to new Jump. (Covered Below)
----------------------------------------------------------------------------
$03/EAE0 4C CF FF JMP $FFCF  [$02:FFCF] A:00F0 X:01CF Y:0010 P:eNvMxdIzc - (New Coat Weapon Area)
$03/EB17 A9 01 LDA #$01 A:004A X:000D Y:012D P:envMxdIzc - Load 01 into A (Poison)
-------------------------------------------------------------------------------------------------------------------------------------------------------
$03/EB19 9D 1E 20 STA $201E,x[$7E:202B] A:004A X:000D Y:012D P:envMxdIzc - Store A in Attack Status 1.
$03/EB1C CE 1C 32 DEC $321C  [$7E:321C] A:004A X:000D Y:012D P:envMxdIzc - Subtract 1 from Item Quantity.
-----------------------------------
(New Section - using a copy of the data in Item Master's code to load the item, subtract it by 1, and save it back.)
$03/EB1F A9 45 LDA #$45 A:004A X:000D Y:012D P:envMxdIzc - Load Smoke's Graphic into A.
$03/EB21 8D C5 33 STA $33C5  [$7E:33C5] A:004A X:000D Y:012D P:envMxdIzc - Store A in Audiovisual Cue.
$03/EB24 60 RTS A:004A X:000D Y:012D P:envMxdIzc - Return.

Extra Functionality for Coat Weapon
Code: [Select]
$03/FFCF C9 B8 CMP #$B8 A:00F0 X:01CF Y:0010 P:eNvMxdIzc - Is the Item VampFang?
$03/FFD1 D0 07 BNE $07    [$FFDA] A:00F0 X:01CF Y:0010 P:eNvMxdIzc - If not branch to Carrot/Greens Check.
----------------------------------------------------------------------------------------------------------------------------------
$03/FFD3 A9 40 LDA #$40 A:00F0 X:01CF Y:0010 P:eNvMxdIzc - Load 40 (Drain) into A.
$03/FFD5 9D 19 20 STA $2019,x[$7E:21E8] A:00F0 X:01CF Y:0010 P:eNvMxdIzc - Store A in Weapon Elemental.
$03/FFD8 80 08 BRA $08    [$FFE2] A:00F0 X:01CF Y:0010 P:eNvMxdIzc - Branch to Jump back to normal routine.
-----------------------------------------------------------------------------------------------------------------------------------
$03/FFDA C9 EB CMP #$EB A:00F0 X:01CF Y:0010 P:eNvMxdIzc - Is the Item Carrot/Greens?
$03/FFDC D0 08 BNE $08    [$FFE6] A:00F0 X:01CF Y:0010 P:eNvMxdIzc - If not, branch to End.
$03/FFDE A9 FF LDA #$FF A:00F0 X:01CF Y:0010 P:eNvMxdIzc - Load FF into A (255 Accuracy)
$03/FFE0 9D 1C 20 STA $201C,x[$7E:21EB] A:00F0 X:01CF Y:0010 P:eNvMxdIzc - Store A in Physical Accuracy.
$03/FFE3 4C 1C EB JMP $EB1C  [$02:EB1C] A:00F0 X:01CF Y:0010 P:eNvMxdIzc - Jump back to normal Routine.
$03/FFE6 60 RTS A:00F0 X:01CF Y:0010 P:eNvMxdIzc - Return Out of Routine.


 :edit: 2/5/2014 Added a fix for the Coat Hammer skill to properly decrement an item.

 :edit: 7/27/2014 Added a new functionality which looks at the Drain Item and the Gysahl Greens Item (changed for my purposes)

Because Whistles (10 GP in every store) have replaced all need of the Big Chocobo spots, Gysahl Green/Carrots in my hack are being turned into Homing Devices (Wrench)Homing. This will give Cid 255 Accuracy for the rest of the battle as long as he doesn't switch his weapons. This combined with the innate power of the other Coat Hammer statuses can be a powerful combination. As this should guarantee that each hit will 100% apply the status.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Touched up Coat Hammer Command)
Post by: koala_knight on July 31, 2014, 12:45:16 PM
Hmmm... speaking of Cid exclusive items and maxing out accuracy immediately made me think of the Sight Scope in FF6.
What would be cool is for the Homing command to normally only increase accuracy by say 50%, and then if the Sight Scope is equipped it does the accuracy max out.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Touched up Coat Hammer Command)
Post by: Grimoire LD on July 31, 2014, 01:55:56 PM
Ah, but it's not quite a command (otherwise it would be Aim under a different name...) It's Coat Hammer/Weapon. The Homing Device is just one of the seven items that can be applied to the hammer (and should probably be applied first). If an Antidote is in the First Slot, Cid's weapon acquires Poison, If a DietFood is in the First Slot Cid's weapon acquires Pig, If a Maiden's Kiss is in the First Slot, Cid's weapon acquires Frog, If a Mallet is in the First Slot, Cid's Weapon acquires Mini, If an EchoHerb Cid's weapon acquires Mute, If a Vampire Fang, Cid's Weapon acquires Drain Elemental and if it is a Homing Device Cid's Weapon acquires 255% Accuracy (making the other status ailment ones a guarantee if the enemy is vulnerable to them.

 I also need to keep things in perspective. Would people sacrifice their accessory slot for Sight Scope to increase their already 80%+ Accuracy to 130%+ Accuracy to go to a strict 255% (Never miss) Accuracy? Remember, the Accessory Slot is quite important, this also works really well for the Backrow, (Since Tellah can actually deal some significant damage in this hack, there's room for him in the front row) as it assures Cid maximum damage, even from the Backrow.

My thought was to make more use of that "wrench" symbol and give him something else unique for either ItemLord or Coat Hammer. Accessories are pretty set in stone by this point. That said, I might consider something to allow a character to Auto-Cover like True Knight... but that could be difficult to set-up, and at the moment it's not quite a priority.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Touched up Coat Hammer Command)
Post by: koala_knight on August 03, 2014, 04:41:52 AM
Ah, gotcha. That makes more sense then. Disregard my nonsense. :P
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Touched up Coat Hammer Command)
Post by: Grimoire LD on August 06, 2014, 10:05:04 PM
Hehe, it's not nonsense, in a more blank slate sense that would have been a great idea, but since I'm so far along with my hack I wouldn't be able to use that.

But if you have any other ideas for things in a basic sense for FFIV than please let me know and I'll see what can be done. I am getting a little rusty in actual coding lately.

Title: Re: Grimoire LD's Notes, Patches, and Hacks (Touched up Coat Hammer Command)
Post by: koala_knight on August 07, 2014, 11:05:33 AM
Will do! :)
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Touched up Coat Hammer Command)
Post by: Grimoire LD 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.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Touched up Coat Hammer Command)
Post by: LordGarmonde 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:
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Touched up Coat Hammer Command)
Post by: Grimoire LD 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.

Title: Re: Grimoire LD's Notes, Patches, and Hacks (New Info. on Item Use Event Routine)
Post by: Grimoire LD 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!
Title: Re: Grimoire LD's Notes, Patches, and Hacks (New Info. on Item Use Event Routine)
Post by: chillyfeez 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?
Title: Re: Grimoire LD's Notes, Patches, and Hacks (New Info. on Item Use Event Routine)
Post by: Grimoire LD 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.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (New Info. on Item Use Event Routine)
Post by: Grimoire LD 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.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (How to enable Criticals for Foes!)
Post by: Grimoire LD 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!
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Rebalanced Poison Status)
Post by: Grimoire LD 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.**

Title: Re: Grimoire LD's Notes, Patches, and Hacks (Full Disassembly on the Poison Status)
Post by: avalanche on December 25, 2014, 04:09:20 PM
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.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Full Disassembly on the Poison Status)
Post by: Grimoire LD on December 25, 2014, 04:43:55 PM
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.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Full Disassembly on the Poison Status)
Post by: avalanche on December 25, 2014, 05:31:00 PM
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.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Full Disassembly on the Poison Status)
Post by: Grimoire LD on December 25, 2014, 06:15:37 PM
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.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Full Disassembly on the Poison Status)
Post by: Grimoire LD on December 25, 2014, 11:35:09 PM
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 (http://slickproductions.org/forum/index.php?topic=1883.msg19245#msg19245)





Title: Re: Grimoire LD's Notes, Patches, and Hacks (Full Disassembly on All Status Timers)
Post by: Grimoire LD on December 26, 2014, 01:56:23 PM
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.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Full Disassembly on All Status Timers)
Post by: Grimoire LD on December 26, 2014, 05:47:36 PM
Under Charm Routine

Code: [Select]
$03/AB3E BD 04 20 LDA $2004,x[$7E:2004] A:0000 X:0000 Y:0012 P:envMxdiZc - Load Status Byte 02 into A.
$03/AB41 29 08 AND #$08 A:0008 X:0000 Y:0012 P:envMxdizc - Is it Charm?
$03/AB43 F0 05 BEQ $05    [$AB4A] A:0008 X:0000 Y:0012 P:envMxdizc - If not, branch.
$03/AB45 20 AD AB JSR $ABAD  [$03:ABAD] A:0008 X:0000 Y:0012 P:envMxdizc - Jump to Subroutine.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/ABAD A6 A6 LDX $A6    [$00:00A6] A:0008 X:0000 Y:0012 P:envMxdizc - Load Target Identifier.
$03/ABAF 9E 53 20 STZ $2053,x[$7E:2053] A:0008 X:0000 Y:0012 P:envMxdiZc - Store Zero in Monster Target
$03/ABB2 9E 54 20 STZ $2054,x[$7E:2054] A:0008 X:0000 Y:0012 P:envMxdiZc - Store Zero in Party Target
$03/ABB5 20 8B 85 JSR $858B  [$03:858B] A:0008 X:0000 Y:0012 P:envMxdiZc - Jump to Subroutine (Random Number)
$03/ABB8 C9 46 CMP #$46 A:0025 X:0000 Y:0012 P:envMxdizc - Compare the number to 46
$03/ABBA B0 24 BCS $24    [$ABE0] A:0025 X:0000 Y:0012 P:eNvMxdizc - If greater than 46, branch to normal Fight Routine
$03/ABBC AE 34 35 LDX $3534  [$7E:3534] A:0025 X:0000 Y:0012 P:eNvMxdizc - Load Slot into X.
$03/ABBF A0 05 00 LDY #$0005 A:0025 X:0000 Y:0012 P:envMxdiZc - Load 0005 into Y.
$03/ABC2 BD 03 33 LDA $3303,x[$7E:3303] A:0025 X:0000 Y:0005 P:envMxdizc - Load A from Command Locations.
$03/ABC5 C9 02 CMP #$02 A:0000 X:0000 Y:0005 P:envMxdiZc - Is it Black Magic?
$03/ABC7 F0 0D BEQ $0D    [$ABD6] A:0000 X:0000 Y:0005 P:eNvMxdizc - If so branch.
------------------------------------------------------------------------------------------------------------------
$03/ABC9 C9 03 CMP #$03 A:0000 X:0000 Y:0005 P:eNvMxdizc - Is it White Magic?
$03/ABCB F0 09 BEQ $09    [$ABD6] A:0000 X:0000 Y:0005 P:eNvMxdizc - If so branch.
--------------------------------------------------------------------------------------------------------------------
$03/ABCD E8 INX A:0000 X:0000 Y:0005 P:eNvMxdizc - +4
$03/ABCE E8 INX A:0000 X:0001 Y:0005 P:envMxdizc
$03/ABCF E8 INX A:0000 X:0002 Y:0005 P:envMxdizc
$03/ABD0 E8 INX A:0000 X:0003 Y:0005 P:envMxdizc
$03/ABD1 88 DEY A:0000 X:0004 Y:0005 P:envMxdizc -1 Y
$03/ABD2 D0 EE BNE $EE    [$ABC2] A:0000 X:0004 Y:0004 P:envMxdizc - Branch back if not gone through all five commands looking for White/Black Magic.
$03/ABD4 80 0A BRA $0A    [$ABE0] A:0001 X:0014 Y:0000 P:envMxdiZc - Branch always.
---------------------------------------------------------------------------------------------------------------------
$03/ABD6 64 90 STZ $90    [$00:0090] A:0002 X:0058 Y:0004 P:envMxdiZC - Store Zero in 90
$03/ABD8 20 FD AB JSR $ABFD  [$03:ABFD] A:0002 X:0058 Y:0004 P:envMxdiZC - Jump to Subroutine

---------------------------------------------------------------------------------------------------------------------
$03/ABE0 A6 A6 LDX $A6    [$00:00A6] A:0001 X:0014 Y:0000 P:envMxdiZc - Load Slot Identity.
$03/ABE2 A9 80 LDA #$80 A:0001 X:0000 Y:0000 P:envMxdiZc - Load 80 into A.
$03/ABE4 9D 50 20 STA $2050,x[$7E:2050] A:0080 X:0000 Y:0000 P:eNvMxdizc - Store A in 2050
$03/ABE7 9E 51 20 STZ $2051,x[$7E:2051] A:0080 X:0000 Y:0000 P:eNvMxdizc - Store Zero in 2051 (Fight)
$03/ABEA 20 82 85 JSR $8582  [$03:8582] A:0080 X:0000 Y:0000 P:eNvMxdizc - Jump to Subroutine (0-4 Random Choice)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/8582 A2 00 00 LDX #$0000 A:0080 X:0000 Y:0000 P:eNvMxdizc - Load 00 into X.
$03/8585 A9 04 LDA #$04 A:0080 X:0000 Y:0000 P:envMxdiZc - Load 04 into A.
$03/8587 20 79 83 JSR $8379  [$03:8379] A:0004 X:0000 Y:0000 P:envMxdizc - Jump to RNG.
$03/8379 E2 10 SEP #$10 A:0004 X:0000 Y:0000 P:envMxdizc - Set Processor to 10.
$03/858A 60 RTS A:0004 X:0000 Y:0000 P:envMxdizc - Return
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/ABEE BD 40 35 LDA $3540,x[$7E:3544] A:0004 X:0004 Y:0000 P:envMxdizc - Load Slot to Target ?Status?
$03/ABF1 D0 F7 BNE $F7    [$ABEA] A:0000 X:0004 Y:0000 P:envMxdiZc - Branch if ?Incapacitated? back to roll again.
$03/ABF3 7B TDC A:0000 X:0004 Y:0000 P:envMxdiZc - Tranfer Direct Page.
$03/ABF4 20 5F 85 JSR $855F  [$03:855F] A:0000 X:0004 Y:0000 P:envMxdiZc  - Jump to Subroutine
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/855F 1F FE FE 13 ORA $13FEFE,x[$13:FF02] A:0000 X:0004 Y:0000 P:envMxdiZc - ??
$03/8563 60 RTS A:0008 X:0004 Y:0000 P:envMxdizc - Return
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/ABF7 A6 A6 LDX $A6    [$00:00A6] A:0008 X:0004 Y:0000 P:envMxdizc - Load Slot Identifier
$03/ABF9 9D 54 20 STA $2054,x[$7E:2054] A:0008 X:0000 Y:0000 P:envMxdiZc - Store A in Party Target.
$03/ABFC 60 RTS A:0008 X:0000 Y:0000 P:envMxdiZc - Return
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/ABFD AE 36 35 LDX $3536  [$7E:3536] A:0002 X:0058 Y:0004 P:envMxdiZC - Load Spell Pointer
$03/AC00 86 A9 STX $A9    [$00:00A9] A:0002 X:0360 Y:0004 P:envMxdizC - Store X in A9.
$03/AC02 A0 30 00 LDY #$0030 A:0002 X:0360 Y:0004 P:envMxdizC - Load 0030 into Y.
$03/AC05 BD 7A 2C LDA $2C7A,x[$7E:2FDA] A:0002 X:0360 Y:0030 P:envMxdizC - Load A from Spell Menu Data
$03/AC08 10 0C BPL $0C    [$AC16] A:0020 X:0360 Y:0030 P:envMxdizC -Branch if Positive (meaning a spell is there).
-------------------------------------------------------------------------------------------------------------------

-------------------------------------------------------------------------------------------------------------------
$03/AC16 7B TDC A:0020 X:0360 Y:0030 P:envMxdizC - Transfer Direct Page
$03/AC17 AA TAX A:0000 X:0360 Y:0030 P:envMxdiZC - Transfer A to X.
$03/AC18 A9 2F LDA #$2F A:0000 X:0000 Y:0030 P:envMxdiZC - Load 2F into A.
$03/AC1A 20 79 83 JSR $8379  [$03:8379] A:002F X:0000 Y:0030 P:envMxdizC - Jump to RNG
$03/AC1E 8E 3D 39 STX $393D  [$7E:393D] A:0002 X:0002 Y:0030 P:envMxdizc - Store X in 393D.
$03/AC21 A2 04 00 LDX #$0004 A:0002 X:0002 Y:0030 P:envMxdizc - Load 04 into X.
$03/AC24 8E 3F 39 STX $393F  [$7E:393F] A:0002 X:0004 Y:0030 P:envMxdizc - Store X in 393F.
$03/AC27 20 B9 83 JSR $83B9  [$03:83B9] A:0002 X:0004 Y:0030 P:envMxdizc - Jump to Subroutine (Divides several 393X values)
$03/AC2A 18 CLC A:0000 X:0000 Y:0030 P:envMxdiZc - Clear Carry Flag.
$03/AC2B A5 A9 LDA $A9    [$00:00A9] A:0000 X:0000 Y:0030 P:envMxdiZc - Load A from A9.
$03/AC2D 6D 41 39 ADC $3941  [$7E:3941] A:0060 X:0000 Y:0030 P:envMxdizc - Add value from 3941 onto A.
$03/AC30 85 AB STA $AB    [$00:00AB] A:0068 X:0000 Y:0030 P:envMxdizc - Store A in AB.
$03/AC32 A5 AA LDA $AA    [$00:00AA] A:0068 X:0000 Y:0030 P:envMxdizc - Load A from AA.
$03/AC34 6D 42 39 ADC $3942  [$7E:3942] A:0003 X:0000 Y:0030 P:envMxdizc - Add value from 3942 onto A.
$03/AC37 85 AC STA $AC    [$00:00AC] A:0003 X:0000 Y:0030 P:envMxdizc - Store A in AC.
$03/AC39 A6 AB LDX $AB    [$00:00AB] A:0003 X:0000 Y:0030 P:envMxdizc - Load X from AB.
$03/AC3B BD 7A 2C LDA $2C7A,x[$7E:2FE2] A:0003 X:0368 Y:0030 P:envMxdizc - Load A from next Spell.
$03/AC3E 85 AD STA $AD    [$00:00AD] A:0080 X:0368 Y:0030 P:eNvMxdizc - Store A in AD.
$03/AC40 30 D4 BMI $D4    [$AC16] A:0080 X:0368 Y:0030 P:eNvMxdizc - Branch back if 80.
------------------------------------------------------------------------------------------------------------------------------
$03/AC42 BD 7B 2C LDA $2C7B,x[$7E:2FDB] A:0020 X:0360 Y:0030 P:envMxdizc - Load Spell Number into A.
$03/AC45 A6 A6 LDX $A6    [$00:00A6] A:001C X:0360 Y:0030 P:envMxdizc - Load Slot ID into A.
$03/AC47 9D 52 20 STA $2052,x[$7E:21D2] A:001C X:0180 Y:0030 P:envMxdizc - Store A in Spell Choice.
$03/AC4A A9 20 LDA #$20 A:001C X:0180 Y:0030 P:envMxdizc - Load 20 into A.
$03/AC4C 9D 50 20 STA $2050,x[$7E:21D0] A:0020 X:0180 Y:0030 P:envMxdizc - Store A in 2050.
$03/AC4F A9 02 LDA #$02 A:0020 X:0180 Y:0030 P:envMxdizc - Load 02 into A.
$03/AC51 9D 51 20 STA $2051,x[$7E:21D1] A:0002 X:0180 Y:0030 P:envMxdizc - Store A in Command.
$03/AC54 A5 AD LDA $AD    [$00:00AD] A:0002 X:0180 Y:0030 P:envMxdizc - Load AD into A.
$03/AC56 29 40 AND #$40 A:0020 X:0180 Y:0030 P:envMxdizc - Get rid of all bytes that not 40.
$03/AC58 D0 25 BNE $25    [$AC7F] A:0000 X:0180 Y:0030 P:envMxdiZc - Branch if not 00.
-------------------------------------------------------------------------------------------------------------------
$03/AC5A A5 AD LDA $AD    [$00:00AD] A:0000 X:0180 Y:0030 P:envMxdiZc - Load AD into A (Targeting?)
$03/AC5C 29 10 AND #$10 A:0020 X:0180 Y:0030 P:envMxdizc - Get rid of all bytes that are not 10.
$03/AC5E F0 17 BEQ $17    [$AC77] A:0000 X:0180 Y:0030 P:envMxdiZc - Branch if 00.
-------------------------------------------------------------------------------------

---------------------------------------------------------------------------------
$03/AC77 A9 FF LDA #$FF A:0000 X:0180 Y:0030 P:envMxdiZc - Load FF into A.
$03/AC79 A6 A6 LDX $A6    [$00:00A6] A:00FF X:0180 Y:0030 P:eNvMxdizc - Load A from A6.
$03/AC7B 9D 53 20 STA $2053,x[$7E:21D3] A:00FF X:0180 Y:0030 P:envMxdizc - Store A in Party Target.
$03/AC7E 60 RTS A:00FF X:0180 Y:0030 P:envMxdizc - Return

Whew! A lot of coding there, but worth it in some respects, the way the game draws spells can easily be discerned, but I somewhat doubt this set is used for monsters at all.








Title: Re: Grimoire LD's Notes, Patches, and Hacks (Full Disassembly on All Status Timers)
Post by: LordGarmonde on December 27, 2014, 01:08:16 PM
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.
...
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 (http://slickproductions.org/forum/index.php?topic=1883.msg19245#msg19245)

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


That is so cool!  :cycle:  It's the little the little things like that (regardless of whether or not they actually work) that always keep me coming back. It's what made me a scientist too. But truly; as always, excellent work my friend.  :cookie:

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.

I was actually screwing around late last night, thinking about this topic specifically: Would it be possible to cause Zeromus to die from HP Leak when he is in the last phase of his battle script and sitting there casting Meteo over and over. I remember discovering on this forum (I think) that negating status effects was built into his routine - but I wasn't sure if that carried into the final phase where he is no longer scripted to shake. I'll poke around more into that but these kinds of things pique my curiosity and it's always neat to see the gears that make the works.  -- It was also for my own more personal interests a bit of a math puzzle - I was trying in the end to balance out damage done by Palom's Virus amount restored by Porom's Cure 2/3 and then (save-state / rewind ) - repeat. It was an amusing way to kill a spot of time  :tongue:  Note: For extra fun notice the slightly non-standard party  :wink:


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.


Agreed! ATB in FF IV is very "except after 'C'." I would love to have formulas that you could easily follow the changes in - but that's my answer to everything.  :wink:   One thing that interests me is that I know that there are problems (at least in some versions) with Stop - some pretty severe...I'm curious as to where the game actually fails.  :hmm:  BTW - Welcome to the Forum, avalanche!  :happy: that notes you posted on ATB seemed pretty interesting: keep up the good work!  :childish:


Title: Re: Grimoire LD's Notes, Patches, and Hacks (Full Disassembly on All Status Timers)
Post by: Grimoire LD on December 27, 2014, 05:47:51 PM
Interesting experiment, I would see no reason why you couldn't kill Zeromus with HP Leak, he is just another enemy. The only thing I'd wonder is if the line "HP Ran out" would show up. You didn't quite write if the experiment worked or not. I imagine it would have, but you can never be too sure with FFIV.

That is a good question on why Stop breaks the game in several ways in the SNES versions, my guess is something about timers not clearing correctly, hence the entire battle system grinds to a halt. In theory all of the information to figure that out is now available. I would also love to know what goes wrong with Count. Death Sentence is such a neat idea for a status and would make an ideal replacement to any "instant-ko" weapon, but Count doesn't work properly on enemies for some reason...

Title: Re: Grimoire LD's Notes, Patches, and Hacks (Full Disassembly on All Status Timers)
Post by: chillyfeez on December 27, 2014, 08:00:10 PM
Weirdest part about count is that it works fine on the first monster it's used on each battle, but doesn't work at all after that. I believe, too, that if the effects are split, it doesn't work on any of the monsters (I might be wrong about that - it was a while ago that I played around with it).
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Full Disassembly on All Status Timers)
Post by: Grimoire LD on December 27, 2014, 09:31:06 PM
Weirdest part about count is that it works fine on the first monster it's used on each battle, but doesn't work at all after that. I believe, too, that if the effects are split, it doesn't work on any of the monsters (I might be wrong about that - it was a while ago that I played around with it).

Oh no, if you try to use Count on all or split-all monsters, the game locks up when the timers reach 00, seemingly unable to figure out what to do next. I think Count can take out the first two enemies (as seen with the plague enemies), but it cannot take out the last one at all. It is rather strange and my bet is some built-in safeguards against it which actually end up making things worse, but without seeing the routine it's difficult to say.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Full Disassembly on All Status Timers)
Post by: LordGarmonde on December 29, 2014, 05:08:20 AM
Interesting experiment, I would see no reason why you couldn't kill Zeromus with HP Leak, he is just another enemy. The only thing I'd wonder is if the line "HP Ran out" would show up. You didn't quite write if the experiment worked or not. I imagine it would have, but you can never be too sure with FFIV.

I didn't say because the vote wasn't in yet - though at the very least I could have said that  :tongue:  I was trying to batt Zeromus' HP around - without watching the RAM (I was in ZSNES at the time) - but eventually I fell asleep. But I saddled up for another round in good ol' 9X and - yep! You see no reason it shouldn't work because there is no reason it wouldn't work: it did work!! :laugh:

Does anyone have a line on how accurate or recent this list is:     http://datacrystal.romhacking.net/wiki/Final_Fantasy_IV:RAM_map

I will say that:   "7E2307-8 - Enemy's current HP - Slot 01"    is spot on even for US_IIv1.1 - That's what I ended up exploiting to finish him off: Cast Virus, made sure the leak was is full effect, paused and took his HP down to 5 (see how he likes it!) and then when I called 'time-in' - that was pretty much that.  :wink:

 :hmm:  -- Very strange about count. I've seen a lot of speed runs where through various methods they manage to get "Reaction" as spell that that FuSoYa can cast - labeled "upt Co" from falling between Disrupt and ColdMist. Anyway...the reason I bring that up is I've heard Reaction explained as a change of state: straight Living --> Dead...rather than inflicting death. I was wondering if Count worked the same way. Also, looking in Pink's editor it looks like the "Reaction" Spell is entry 173 in the spell list marked Dummy - with and effect of: "Suicide, bring in next monster" - hmmm
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Full Disassembly on All Status Timers)
Post by: Grimoire LD on December 29, 2014, 08:41:32 AM
Interesting experiment, I would see no reason why you couldn't kill Zeromus with HP Leak, he is just another enemy. The only thing I'd wonder is if the line "HP Ran out" would show up. You didn't quite write if the experiment worked or not. I imagine it would have, but you can never be too sure with FFIV.

I didn't say because the vote wasn't in yet - though at the very least I could have said that  :tongue:  I was trying to batt Zeromus' HP around - without watching the RAM (I was in ZSNES at the time) - but eventually I fell asleep. But I saddled up for another round in good ol' 9X and - yep! You see no reason it shouldn't work because there is no reason it wouldn't work: it did work!! :laugh:

Does anyone have a line on how accurate or recent this list is:     http://datacrystal.romhacking.net/wiki/Final_Fantasy_IV:RAM_map

I will say that:   "7E2307-8 - Enemy's current HP - Slot 01"    is spot on even for US_IIv1.1 - That's what I ended up exploiting to finish him off: Cast Virus, made sure the leak was is full effect, paused and took his HP down to 5 (see how he likes it!) and then when I called 'time-in' - that was pretty much that.  :wink:

 :hmm:  -- Very strange about count. I've seen a lot of speed runs where through various methods they manage to get "Reaction" as spell that that FuSoYa can cast - labeled "upt Co" from falling between Disrupt and ColdMist. Anyway...the reason I bring that up is I've heard Reaction explained as a change of state: straight Living --> Dead...rather than inflicting death. I was wondering if Count worked the same way. Also, looking in Pink's editor it looks like the "Reaction" Spell is entry 173 in the spell list marked Dummy - with and effect of: "Suicide, bring in next monster" - hmmm

Reaction is indeed a change of state, you can see this here...

http://slickproductions.org/forum/index.php?topic=1883.msg19250#msg19250

Load Death into All enemy's status bytes. No checks, no nothing. Count is the same way since even if you are protected from Death you will still be killed by Count.

Surprisingly, this can be fixed very easily...

$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

This does show that they intended to have Edward come back to the party, but it's never utilized in the original FFIV,  you can switch that to look at the Status Resistance Byte which is literally the same value in this case as Hide (80) and you could fix it like that. I don't think that will solve the issue... but you may be onto something... if instead of going through with the original routine, I wonder if linking it to the basic "Status Routine" might fix these weird timer problems, I will have to try that soon, thanks for the idea LordGarmonde.

You are under one misinterpretation though. Reaction's Routine is called... well, Reaction, it's fully unique. What you are thinking of is a routine I've dubbed "Tradeoff" since it's one enemy trading off for another and that is utilized by several enemies, Calbrena, Dr. Lugae, and the Fiends in the Giant of Babil are the most notable examples.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Full Disassembly on All Status Timers)
Post by: avalanche on December 29, 2014, 10:30:20 AM
My take on all status-inflicting spell routines is that they are only good for the limited set of statuses for which they're intended.  Especially true with the status timers.  The "plain" status routine doesn't setup Count's timer, for example, or HP leak or poison...  Otherwise there is no good reason why there are multiple status related routines. I think it kept it simpler on the coders.  Actually that one might not even touch status bytes 3 and 4 if I'm remembering correctly, and hp leak and count are in those.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Full Disassembly on All Status Timers)
Post by: Grimoire LD on December 29, 2014, 10:38:32 AM
My take on all status-inflicting spell routines is that they are only good for the limited set of statuses for which they're intended.  Especially true with the status timers.  The "plain" status routine doesn't setup Count's timer, for example, or HP leak or poison...  Otherwise there is no good reason why there are multiple status related routines. I think it kept it simpler on the coders.  Actually that one might not even touch status bytes 3 and 4 if I'm remembering correctly, and hp leak and count are in those.

They are, you're right. But my plan was to set up the basic necessities of a Death status in the expiration of Count's Timer Load 80, store it in 28A3, then jump to the normal status routine...

For some reason it did not work. I tried an alternative method to load 0000 into an enemy's HP and they did die when their turn elapsed, but there was still that"only 2 can be killed by Count" enforced limit that I've had no luck locating.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Full Disassembly on All Status Timers)
Post by: LordGarmonde on December 29, 2014, 04:15:39 PM
You are under one misinterpretation though. Reaction's Routine is called... well, Reaction, it's fully unique. What you are thinking of is a routine I've dubbed "Tradeoff" since it's one enemy trading off for another and that is utilized by several enemies, Calbrena, Dr. Lugae, and the Fiends in the Giant of Babil are the most notable examples.

 :blush: Yep there it is... 142: Dummy "Trigger a Reaction"  -  Between 141: Call and 143: Vanish   :isuck:   --  But in the future I also plan to call Spell # 173 "Tradeoff" - good call!   :terrydia:


Tradeoff reminds me of something I once read about Dummy Kefka:    http://finalfantasy.wikia.com/wiki/Kefka_(Boss)

"The dummy version of Kefka inherently has the Hide status so it never appears and cannot be targeted. The AI script of the dummy implies that the enemy was a device used to help switch the tiers in the final battle. However, since the enemy does not actually appear in the final battle, the enemy is a dummied enemy."

I tried an alternative method to load 0000 into an enemy's HP and they did die when their turn elapsed, but there was still that"only 2 can be killed by Count" enforced limit that I've had no luck locating.

One thing that might work - though not ideal - could be (if I'm understanding this correctly) to stagger the deaths. Say if there were three Imps (A, B & C) - and they all had Count with turn order A-B-C. A dies...B dies...and normally at this point the game would lock up while trying to kill C, correct? What if part the count routine was to increment the counts of others that haven't hit zero yet. I sketched something out but retracted it while typing it up... I feel like there's got to be a way around this.  :hmm:

I liked 0000 HP - that should have been nice and clean. What about what I just did to Zeromus: 0000 for Imp-A, 0003 (With HP Leak) for Imp-B, and 0005 (With HP Leak) for Imp-C - then they'd go down like dominos. Not as clean, and it's getting further from Counts purpose of knock-knock--you're-dead...but then again, the way things are in this game sometimes it's just crazy enough to work.  :wink:
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Full Disassembly on All Status Timers)
Post by: Grimoire LD on December 29, 2014, 04:40:01 PM
It's not so much that the game locks up when you use Count thrice, it's that the timer for Count just stops running and will stay at 0A, what does freeze the game is when you inflict it on many enemies at once.

You might be onto something with the Set HP to 0005 (HP Drain) or something like that to kill an enemy, but I think the way they've developed the status is probably the problem.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Full Disassembly on All Status Timers)
Post by: chillyfeez on December 29, 2014, 05:00:18 PM
That's a nifty idea as a fix for Count. You'd have to get rid of the "Ran out of HP" message in order to complete the illusion, though.
 :hmm:
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Full Disassembly on All Status Timers)
Post by: LordGarmonde on December 29, 2014, 05:38:46 PM
It's not so much that the game locks up when you use Count thrice, it's that the timer for Count just stops running and will stay at 0A, what does freeze the game is when you inflict it on many enemies at once.

Ahh - That is tricky... I mean - it shouldn't be  :wink:   but that's why we're here.    :laugh:

You might be onto something with the Set HP to 0005 (HP Drain) or something like that to kill an enemy, but I think the way they've developed the status is probably the problem.

That's a nifty idea as a fix for Count. You'd have to get rid of the "Ran out of HP" message in order to complete the illusion, though.
 :hmm:

Aww, thanks guys  :blush:   --  Perhaps we could banish the message along with its cousin: "Damaged By Poison"  :yabin:

And speaking of battle messages... is there a reason to keep "The Water is Gathering" - it has a visual...or am I neglecting something as I'm thinking it out in my head?
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Full Disassembly on All Status Timers)
Post by: Pinkpuff on December 30, 2014, 05:52:05 AM
And speaking of battle messages... is there a reason to keep "The Water is Gathering" - it has a visual...or am I neglecting something as I'm thinking it out in my head?

I think that battle just has a lot of unnecessary narration generally... "Hiding in the shell!" "The Lit scared him!"
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Full Disassembly on All Status Timers)
Post by: LordGarmonde on December 30, 2014, 06:42:30 AM
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:
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Full Disassembly on All Status Timers)
Post by: Grimoire LD on December 30, 2014, 10:33:05 AM
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.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Disassembly on Enemy AI Commands)
Post by: Grimoire LD 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.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Disassembly on Enemy AI Commands)
Post by: Grimoire LD 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.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Disassembly on Enemy AI Commands)
Post by: chillyfeez 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!
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Disassembly on Enemy AI Commands)
Post by: Grimoire LD 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!

(http://i112.photobucket.com/albums/n198/LastingDawn/FFIV-UnusedGraphicEffect_zps9e6bfaee.png) (http://s112.photobucket.com/user/LastingDawn/media/FFIV-UnusedGraphicEffect_zps9e6bfaee.png.html)

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:

(http://i112.photobucket.com/albums/n198/LastingDawn/FFIV-DarkKnightCecilsCarpetBombingDamcyan_zpsd779a5bb.png) (http://s112.photobucket.com/user/LastingDawn/media/FFIV-DarkKnightCecilsCarpetBombingDamcyan_zpsd779a5bb.png.html)


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.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Disassembly on Visual Effects)
Post by: Grimoire LD 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.

Title: Re: Grimoire LD's Notes, Patches, and Hacks (Disassembly on Visual Effects)
Post by: Grimoire LD 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.



Title: Re: Grimoire LD's Notes, Patches, and Hacks (Solving Character Battle Weapon)
Post by: LordGarmonde 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:
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Solving Character Battle Weapon)
Post by: Grimoire LD 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?
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Solving Character Battle Weapon)
Post by: LordGarmonde 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:
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Solving Character Battle Weapon)
Post by: Grimoire LD 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.

Title: Re: Grimoire LD's Notes, Patches, and Hacks (Protect/Shell Status)
Post by: Grimoire LD 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.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Protect/Shell Status not Incremental)
Post by: koala_knight on February 15, 2015, 03:48:43 AM
Yes! Absolutely , yes! A stand  alone  patch for this would be fantastic. :)
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Protect/Shell Status not Incremental)
Post by: Grimoire LD on February 15, 2015, 07:01:41 PM
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.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Protect/Shell Status not Incremental)
Post by: Grimoire LD on February 16, 2015, 05:27:26 PM
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.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Protect/Shell Status now with Dispel!)
Post by: Grimoire LD on February 16, 2015, 07:09:37 PM
Here is the patch. It's as basic as basic can be only including the new routines, allowing Rosa, Porom, FuSoYa, and Tellah to have the three dummied spells, giving Asura Protect back, changing the MP cost of Protect and Shell to 25 and changing the targeting of those spells to a single person and reimplementing the weapons to have those dummied spells, and allowing Cecil to learn those spells...

Alright so not As basic as can be, but it will give it a standalone feel that doesn't seem useless without additional modding.

Title: Re: Grimoire LD's Notes, Patches, and Hacks (Protect/Shell Status now with Dispel!)
Post by: koala_knight on February 18, 2015, 01:05:13 AM
Awesome!! It just so happens that I recently read an article about how working with limited resources can lead to impressive feats of creativity.
Thanks a bunch for working on the stand alone patch. :)
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Pointer Table to Event ID Routines)
Post by: Grimoire LD on March 16, 2015, 07:38:25 PM
I've started work on figuring out the Event Instructions Routines and my focus is primarily on the unused ones at the moment for some future plans.

Subtract XX *  100 Gil

Code: [Select]
$00/E97E 20 CB E2 JSR $E2CB  [$00:E2CB] A:00E9 X:0000 Y:0002 P:envMxdiZc - Jump to Event Progression Routine
$00/E981 85 18 STA $18    [$00:0618] A:0001 X:0001 Y:0002 P:envMxdizc - Store Event Variable in to 0618.
$00/E983 64 19 STZ $19    [$00:0619] A:0001 X:0001 Y:0002 P:envMxdizc - Store Zero in 0619.
$00/E985 A9 64 LDA #$64 A:0001 X:0001 Y:0002 P:envMxdizc - Load 100 into A (Remove 100 Gil)
$00/E987 85 1A STA $1A    [$00:061A] A:0064 X:0001 Y:0002 P:envMxdizc - Store a in Event Variable(2)
$00/E989 64 1B STZ $1B    [$00:061B] A:0064 X:0001 Y:0002 P:envMxdizc - Store Zero in 1B.
$00/E98B 22 95 C3 15 JSL $15C395[$15:C395] A:0064 X:0001 Y:0002 P:envMxdizc - Jump to Subroutine (?)
$00/E98F AD A0 16 LDA $16A0  [$00:16A0] A:0000 X:0001 Y:0000 P:envMxdiZc - Load Gil Total (Byte 1)
$00/E992 38 SEC A:00DB X:0001 Y:0000 P:eNvMxdizc - Set Carry Flag
$00/E993 E5 30 SBC $30    [$00:0630] A:00DB X:0001 Y:0000 P:eNvMxdizC - Subtract it by the value in 0630 (event designated value)
$00/E995 8D A0 16 STA $16A0  [$00:16A0] A:003F X:0001 Y:0000 P:envMxdizC - Store A in Gil Total (Byte 1)
$00/E998 AD A1 16 LDA $16A1  [$00:16A1] A:003F X:0001 Y:0000 P:envMxdizC - Load Gil Total (Byte 2)
$00/E99B E5 31 SBC $31    [$00:0631] A:0000 X:0001 Y:0000 P:envMxdiZC - Subtract it by the value in 0631.
$00/E99D 8D A1 16 STA $16A1  [$00:16A1] A:009D X:0001 Y:0000 P:eNvMxdizc - Store A in Gil Total (Byte 2)
$00/E9A0 AD A2 16 LDA $16A2  [$00:16A2] A:009D X:0001 Y:0000 P:eNvMxdizc - Load A from Gil Total (Byte 3)
$00/E9A3 E5 32 SBC $32    [$00:0632] A:0000 X:0001 Y:0000 P:envMxdiZc - Subtract it by the value in 0632.
$00/E9A5 8D A2 16 STA $16A2  [$00:16A2] A:00FF X:0001 Y:0000 P:eNvMxdizc - Store A in Gil Total (Byte 3)
$00/E9A8 B0 09 BCS $09    [$E9B3] A:00FF X:0001 Y:0000 P:eNvMxdizc - If above 00, skip to End.
---------------------------------------------------------------------------------------------------------------------------------
$00/E9AA 9C A0 16 STZ $16A0  [$00:16A0] A:00FF X:0001 Y:0000 P:eNvMxdizc - Store Zero in Gil Total 1,2, and 3.
$00/E9AD 9C A1 16 STZ $16A1  [$00:16A1] A:00FF X:0001 Y:0000 P:eNvMxdizc
$00/E9B0 9C A2 16 STZ $16A2  [$00:16A2] A:00FF X:0001 Y:0000 P:eNvMxdizc
$00/E9B3 4C D3 E0 JMP $E0D3  [$00:E0D3] A:00FF X:0001 Y:0000 P:eNvMxdizc - Jump to rest of routine


For such an unused command it came with a fair amount of space 37 Bytes all in all which is a nice tidy sum and may be enough room to set further functionalities of events. FFII for instance has a rather strange one-time event where at the top of the Mysidia Tower there are four orbs which increase Stats. Surely FFIV could have such a thing as well, no? The best way to handle this idea would be to make the value a stat can increase from 1-4 (10,20,40,80 bit booleans) and use the second value as the functional "X" value (7E100F/7E1014 for the start) To simplify things it would probably be the character in Slot 1 that would get the stat boosts. This is all in theory of course, but it seems like it should work.

Despite the Event Instruction of Add 100 * GP never being used in-game the routine it links to is used by Treasure Chests with Gil in them as well. The objective then would be to change that link to unused space.

$00/E978   20 DD 97   JSR $97DD  [$00:97DD]   A:0000   X:0001   Y:0000   P:envMxdiZc - Jump to Gil Acquisition Routine. Called by events...

Though I seem to have found the basic routines for events so I should probably set those first...

Code: [Select]
$00/E01A A2 00 00 LDX #$0000 A:00FF X:4B0E Y:0002 P:eNvMxdizc - Load 0000 into X.
$00/E01D 86 B3 STX $B3    [$00:06B3] A:00FF X:0000 Y:0002 P:envMxdiZc - Store X in B3.
$00/E01F BD D5 09 LDA $09D5,x[$00:09D5] A:00FF X:0000 Y:0002 P:envMxdiZc - Load A from Event Instruction ID.
$00/E022 8D 16 0A STA $0A16  [$00:0A16] A:00E5 X:0000 Y:0002 P:eNvMxdizc -  Store A in 0A16.
$00/E025 C9 D0 CMP #$D0 A:00E5 X:0000 Y:0002 P:eNvMxdizc - Is this event ID Below Toggle Screen Shake? (Meaning Movement)
$00/E027 90 03 BCC $03    [$E02C] A:00E5 X:0000 Y:0002 P:envMxdizC - Then branch to Movement Patterns.
--------------------------------------------------------------------------------
$00/E029 4C B8 E0 JMP $E0B8  [$00:E0B8] A:00E5 X:0000 Y:0002 P:envMxdizC - Jump to Rest of Event ID's Routines.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$00/E0B8 38 SEC A:00E5 X:0000 Y:0002 P:envMxdizC - Set Carry Flag
$00/E0B9 E9 D0 SBC #$D0 A:00E5 X:0000 Y:0002 P:envMxdizC - Subtract D0
$00/E0BB 64 3E STZ $3E    [$00:063E] A:0015 X:0000 Y:0002 P:envMxdizC - Store Zero in 3E.
$00/E0BD 0A ASL A A:0015 X:0000 Y:0002 P:envMxdizC - x2 A.
$00/E0BE 26 3E ROL $3E    [$00:063E] A:002A X:0000 Y:0002 P:envMxdizc
$00/E0C0 85 3D STA $3D    [$00:063D] A:002A X:0000 Y:0002 P:envMxdiZc - Store A in 063D.
$00/E0C2 A6 3D LDX $3D    [$00:063D] A:002A X:0000 Y:0002 P:envMxdiZc - Load X from x2 Event ID -D0
$00/E0C4 BD E6 E2 LDA $E2E6,x[$00:E310] A:002A X:002A Y:0002 P:envMxdizc - Load A from E2E6+X (Event ID Table)
$00/E0C7 85 3D STA $3D    [$00:063D] A:0067 X:002A Y:0002 P:envMxdizc - Store A in 063D.
$00/E0C9 BD E7 E2 LDA $E2E7,x[$00:E311] A:0067 X:002A Y:0002 P:envMxdizc - Load A from E2E7 +  (Event ID Table)
$00/E0CC 85 3E STA $3E    [$00:063E] A:00E9 X:002A Y:0002 P:eNvMxdizc - Store A in 063E.
$00/E0CE A6 B3 LDX $B3    [$00:06B3] A:00E9 X:002A Y:0002 P:eNvMxdizc - Load X from B3.
$00/E0D0 6C 3D 06 JMP ($063D)[$00:E967] A:00E9 X:0000 Y:0002 P:envMx - Jump to portion in designated table...


And there it is! The Event ID Table, similar to any other pointer table we've found thus far. I'll list them in order, though I probably won't tackle their contents for a while.


EB94 - Toggle Screen Shake D0
EB9D - Screen Flash D1
EBD4 - Screen blur and unblur D2
EBEF - Travel to/from Moon D3
E351 - Open Fat Chocobo Screen D4
EC17 - Open a Door D5
EB65 - Screen moves up 1 tile and down 1 tile D6
E54B - Toggle Running D7
E38B - Toggle Music Fade D8
E344 - Open Namingway Screen D9 (Judging from the amount of bytes here I imagine this is just a jump to another Jump)
E7C4 - Toggle Screen Fade DA
E90A - Toggle Status Ailments XX DB
E9E6 - Inn DC
E9B6 - Change Character Graphic to XX DD
E7FF - Restore HP (10 * XX HP) DE
E85F - Restore MP (10 * XX MP) DF
E8BF - Add Item XX to Inventory E0
E8CB - Remove Item XX from Inventory E1
E7D8 - Put in Spell List XX' SpellBook, Spell YY E2
E929 - Remove All Status Ailments but XX E3
E948 - Add Status Ailments XX E4
E967 - Add 100 * XX GP to Party E5
E97E - Subtract 100 * XX GP to Party E6
E578 - Add XX Character to Party E7
E6AF - Remove XX Character from Party E8
EAB5 - Pause XX Cycles E9
E379 - Fade Song XX in EA
0000 - Repeat Xx Time the Following YY Actions EB (blank because this is looked at in respect to the Movement Patterns)
E391 - Fight Battle with Enemy Set XX EC
E35E - Bring Up Shop XX ED
E339 - Show Message from Bank 02 (Event Call) EE
EF28 - Show Message from Bank 02 (Map Call) EF
EF4E - Show Message 0XX from Bank 01. F0
EF5F - Show Message 1XX from Bank 01. F1
EF81 - Set Event Flag XX F2
EF8A - Clear Event Flag XX F3
EF93 - Activate NPC XX F4
EF9C - Deactivate NPC XX F5
EF70 - Show Message XX (from Bank 3) F6
EB0E - Bring up Item Selection Window F7
EAE9 - Show Message 1XX (Yes/No Box) F8
E731 - Toggle Screen Tint XX F9
E559 - Play Song XX FA
E56F - Play Sound Effect XX FB
0000 - Load Some Type of Graphic FC (Actually Nothing)
C17C - Play Visual Effect FD
EDB1 - Load Map FE
EA20 - End Event FF

So we now know that "Load Some Type of Graphic?" is literally "Crash the Game". Why they would put it so high up is beyond me. Maybe they had an idea for an event function that just did not pan out as planned... so that alone is a free event slot.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Pointer Table to Event ID Routines)
Post by: chillyfeez on March 16, 2015, 08:15:34 PM
I actually had no idea there was an unused event code.
I was thinking to myself recently that I wished there was, but then I just shrugged it off. Now I can't remember what I wanted it for... Oh well, good to know.
Good stuff, Grimoire.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Pointer Table to Event ID Routines)
Post by: Pinkpuff on March 17, 2015, 10:52:20 AM
I'd love to see an event instruction of the form:

Change character graphic to graphic of character at slot XX in party

So for example, 01 would, instead of changing the graphic to Dark Knight Cecil necessarily, would change to the graphic of the character in the 1st slot, whoever it is.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Pointer Table to Event ID Routines)
Post by: chillyfeez on March 17, 2015, 12:10:37 PM
I'm curious as to what the presumed function of that instruction would be, PinkPuff, considering the fluidity of party slots?

I remember what I wanted as an event instruction now. It was, "reduce HP by XX."
I ended up putting some event-specific ASM in my hack to reduce party HP whenever a particular event occurs instead.
Wouldn't it make sense, for example, for the "Ouch!" event to reduce HP? That's not what I wanted it for, but it's a relatable example.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Pointer Table to Event ID Routines)
Post by: Pinkpuff on March 17, 2015, 01:21:29 PM
Upon reflection, it wouldn't do what I wanted anyway.

The situation I'm thinking of is this:

Suppose you have a scenario involving the twins, but it could be done while Cecil is still a Dark Knight, or it could be done while he's a Paladin. Furthermore, you don't have any guarantees over who else might be in the party when the scenario is executed.

So I guess it would make more sense to have a function like,
"Change character graphic to DK Cecil if the 'became a paladin' flag is off, otherwise change character graphic to Paladin Cecil"

 :edit: ACTUALLY!! How about this:

"If Flag XX is on, do the following YY actions; otherwise skip past them"
Title: Re: Grimoire LD's Notes, Patches, and Hacks (New Event Instructions!)
Post by: Grimoire LD on March 17, 2015, 05:56:25 PM
I'm curious as to what the presumed function of that instruction would be, PinkPuff, considering the fluidity of party slots?

I remember what I wanted as an event instruction now. It was, "reduce HP by XX."
I ended up putting some event-specific ASM in my hack to reduce party HP whenever a particular event occurs instead.
Wouldn't it make sense, for example, for the "Ouch!" event to reduce HP? That's not what I wanted it for, but it's a relatable example.

That's some good thinking there Chillyfeez, I personally would like the first option more you described by using an event instruction to do that.

Upon reflection, it wouldn't do what I wanted anyway.

The situation I'm thinking of is this:

Suppose you have a scenario involving the twins, but it could be done while Cecil is still a Dark Knight, or it could be done while he's a Paladin. Furthermore, you don't have any guarantees over who else might be in the party when the scenario is executed.

So I guess it would make more sense to have a function like,
"Change character graphic to DK Cecil if the 'became a paladin' flag is off, otherwise change character graphic to Paladin Cecil"

 :edit: ACTUALLY!! How about this:

"If Flag XX is on, do the following YY actions; otherwise skip past them"

This will require disassembly of the Yes/No Option for optimal use, while I would assume that your method here would work, there is no YY option allowed here because the instruction only has a single variable and that would be some heavily advanced hacking to get the game to read another variable for event instruction. While if you tie it into the  Yes/No Option of "If Flag XX is on keep following this event, if not, go to second event" would work much better I'd imagine.

So let's get to disassembling the Yes/No option and see how it works!

EAE9 - Show Message 1XX (Yes/No Box) F8

Or at least that was the plan, but this is doing so many functions I can't keep them straight, nor do I understand much about the graphics processing part, so I will skip to the important part to purely create another event instruction which can skip to the next event.

Alright, I understand now... that is rather simple and should be easy to manipulate. It looks like the game has a built in "check" there already, when the cursor is on Yes, it is 00 which means nothing special, all normal events proceed off of this. But when the cursor is on No, the game changes a certain value to 01 and through a series of code uses the game will skip to the next event through this instruction.

Here is what is being done...

$00/AC53   A5 8C   LDA $8C    [$00:068C]   A:0011   X:3745   Y:00D0   P:envMxdiZC - Load A from 068C (Cursor Choice)
$00/AC55   85 DB   STA $DB    [$00:06DB]   A:0001   X:3745   Y:00D0   P:envMxdizC - Store A in in Event Switcher
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
$00/EB00   A5 DB   LDA $DB    [$00:06DB]   A:0000   X:0010   Y:00D0   P:envMxdiZC - Load A from Event Switcher.
$00/EB02   F0 07   BEQ $07    [$EB0B]   A:0000   X:0010   Y:00D0   P:envMxdiZC - Branch if 00 past Event Switching.
----------------------------------------------------------------------------------
00/EB04   20 D2 E2   JSR $E2D2  [$00:E2D2]   A:00FF   X:006C   Y:00D0   P:envMxdiZC - Jump to Event Switching Routine
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
$00/E2D2   AE D3 09   LDX $09D3  [$00:09D3]   A:0001   X:0010   Y:00D0   P:envMxdizC - Load X from Event Position
$00/E2D5   E8    INX   A:0001   X:006B   Y:00D0   P:envMxdizC - +1 X.
$00/E2D6   BF 00 82 12   LDA $128200,x[$12:826C]   A:0001   X:006C   Y:00D0   P:envMxdizC - Load Event Instruction ID.
$00/E2DA   C9 FF   CMP #$FF   A:00FF   X:006C   Y:00D0   P:eNvMxdizC - Is it End Event?
$00/E2DC   F0 04   BEQ $04    [$E2E2]   A:00FF   X:006C   Y:00D0   P:envMxdiZC - If so, branch
----------------------------------------------------------------------------------------------------
$00/E2DE   E8    INX   A:00FF   X:006C   Y:00D0   P:envMxdiZC + 1 X
$00/E2DF   4C D6 E2   JMP $E2D6  [$00:E2D6]   A:00FF   X:006C   Y:00D0   P:envMxdiZC - Jump (backwards) to E2D6 to +1 X again to look for the end of the event.
-------------------------------------------------------------------------------------------------------
$00/E2E2   8E D3 09   STX $09D3  [$00:09D3]   A:00FF   X:006C   Y:00D0   P:envMxdiZC - Store X in Event Position
$00/E2E5   60    RTS   A:00FF   X:006C   Y:00D0   P:envMxdiZC - Return


And that's all it seems to take. If the new instruction looks at an Event Flag instead of at a cursor position to use the same Event Switch code everything should work properly.

This would also be the way to set up branching paths in a way where Actions in addition to Yes/No Options could influence the course of gameplay

My thinking is to make this two-pronged...

Say I wanted a scenario where a battle could be won, but didn't have to be and the outcome would be the way the game would branch to two different scenarios. To The first would be this... "Is Characters 1-5 Dead?" IF so, play Event Switcher"  That would accomplish this. Then in the code, do as you suggest; "Is Event Flag XX on? If so, branch to next event". In normal gameplay all characters can't be dead so the first part would never play, but that scenario can happen in events and event battles.

I will try an experiment shortly to see if I can put theory into practice...

Changing Event Instruction FC (Nothing) to (If All Characters are Dead move to next event)

First thing is first, we will need to go to the Pointer Table and make sure that FC's instruction start is read properly, so change the 0000 at E33E to 71FD (free space at the end of Bank 0)

And it worked in such an easy manner, I'm somewhat shocked! I created a custom Event Instruction as a test using my "dead party" idea and it was flawless. It jumped to the next event once it saw that the entire party was dead and if a party member was alive it would not use the Event Switcher.

$00/FD71   BD 03 10   LDA $1003,x[$00:1003]   A:00FD   X:0000   Y:0002   P:envMxdiZc - Load Character 1's Status Byte 1.
$00/FD74   10 17   BPL $17    [$FD8D]   A:0000   X:0000   Y:0002   P:envMxdiZc - If they are not dead, branch to End.
$00/FD71   BD 03 10   LDA $1003,x[$00:1003]   A:00FD   X:0000   Y:0002   P:envMxdiZc - Do this for the rest of the Slots.
$00/FD74   10 17   BPL $17    [$FD8D]   A:0080   X:0000   Y:0002   P:eNvMxdizc
$00/FD76   BD 43 10   LDA $1043,x[$00:1043]   A:0080   X:0000   Y:0002   P:eNvMxdizc
$00/FD79   10 12   BPL $12    [$FD8D]   A:0080   X:0000   Y:0002   P:eNvMxdizc
$00/FD7B   BD 83 10   LDA $1083,x[$00:1083]   A:0080   X:0000   Y:0002   P:eNvMxdizc
$00/FD7E   10 0D   BPL $0D    [$FD8D]   A:0080   X:0000   Y:0002   P:eNvMxdizc
$00/FD80   BD C3 10   LDA $10C3,x[$00:10C3]   A:0080   X:0000   Y:0002   P:eNvMxdizc
$00/FD83   10 08   BPL $08    [$FD8D]   A:0080   X:0000   Y:0002   P:eNvMxdizc
$00/FD85   BD 03 11   LDA $1103,x[$00:1103]   A:0080   X:0000   Y:0002   P:eNvMxdizc
$00/FD88   10 03   BPL $03    [$FD8D]   A:0080   X:0000   Y:0002   P:eNvMxdizc
$00/FD8A   20 04 EB   JSR $EB04  [$00:EB04]   A:0080   X:0000   Y:0002   P:eNvMxdizc - Jump to Subroutine (Event Switcher)
$00/FD8D   60    RTS   A:0000   X:0000   Y:0002   P:envMxdiZc

That's all it took.

Now as for the rest of your idea Pinkpuff, that is a bit more complicated... while I can easily set F8's variable to act as an event flag searcher, I do not know how the game actually tells if an event flag is off or on in a numerical fashion since the Event Flags are booleans (I think that's the right term) and they comprise of much more than one byte. So how the game turns them on and off, I do not know. Once that is found though your idea would work fine.

Though there is another suggestion I would make...

I would suggest looking for Dark Knight Cecil or Paladin Cecil rather than holding to Event Flag dealings. It would be something as simple as above...

Look through the each slots. If the slot is Dark Knight Cecil keep on with the current event.  If the slot is Paladin Cecil switch events. If neither, move on to the next slot.

Something like this would be really easy to build especially with all of the free space at the end of Bank 1, but from what you described the event would not be too terribly different. In such a case I think modifying the "Change Character Graphic" to look only at the two Cecil's (it doesn't ever use it for anything else in the default game) and using the pattern I mentioned above should do the trick.

Title: Re: Grimoire LD's Notes, Patches, and Hacks (Pointer Table to Event ID Routines)
Post by: chillyfeez on March 17, 2015, 07:03:16 PM
Can anyone think of any events that use the "move camera up one space then down again" instruction?

That seems like a silly one that could be easily changed to something else with very few consequences...
Though it has no natural parameters...
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Pointer Table to Event ID Routines)
Post by: Grimoire LD on March 17, 2015, 07:50:22 PM
Can anyone think of any events that use the "move camera up one space then down again" instruction?

That seems like a silly one that could be easily changed to something else with very few consequences...
Though it has no natural parameters...

Haha! I had a post written up a few days ago about useless or unused event codes.

That "move camera up one space then down again" one was the very first one I mentioned due to its absurd uselessness.

From there I addressed the the two Add/Subtract Gils... then I noticed that was it so I never made the post.

All in all we have four event instructions to change as we will without disrupting anything the game normally does.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Pointer Table to Event ID Routines)
Post by: Pinkpuff on March 18, 2015, 05:13:21 AM
So, with the code you posted that uses the Yes/No routine... would that replace the Yes/No routine? So you could have a game that has yes/no boxes or you could have a game that has flag-based branches, but not both? Also, can you only have one branch in an event with this method?

How does the "Repeat the next XX actions YY times" work? I was picturing the branch instruction to work more similar to that one where you could have code that uses multiple branches like

Code: [Select]
Show Message: "Elder: There are many paths ahead of you."
Show Message: " You can go to the moon using the Lunar Whale..."
If "awakened Yang" is off do the next 1 actions:
 Show Message: "Elder: Your friend Yang may still be alive"
If "found Yang" is on do the next 1 actions:
 Show Message: "Elder: Perhaps his wife knows how to wake him"
If "found Adamant" is off do the next 1 actions:
 Show Message: "Elder: A blacksmith in the underworld needs a rare ore, perhaps he can make something useful with it!"
If "found Tail" is on do the next 1 actions:
 Show Message: "Elder: There is a miner that collects tails, perhaps he will trade that one for something useful"
If "defeated Odin" is off do the next 1 actions:
 Show Message: "Elder: The ghost of Odin waits for you in Baron's basement"
Show Message: "Elder: Good luck, Cecil!"

So I take it it isn't as simple as "check flag value, compare to 0, if equal load A with YY, skip ahead bytes in the event code while decrementing A until 0"?

In any case, I guess something like that would involve hijacking an instruction that took two parameters, wouldn't it?
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Pointer Table to Event ID Routines)
Post by: Grimoire LD on March 18, 2015, 05:37:35 AM
So, with the code you posted that uses the Yes/No routine... would that replace the Yes/No routine? So you could have a game that has yes/no boxes or you could have a game that has flag-based branches, but not both? Also, can you only have one branch in an event with this method?

How does the "Repeat the next XX actions YY times" work? I was picturing the branch instruction to work more similar to that one where you could have code that uses multiple branches like

Code: [Select]
Show Message: "Elder: There are many paths ahead of you."
Show Message: " You can go to the moon using the Lunar Whale..."
If "awakened Yang" is off do the next 1 actions:
 Show Message: "Elder: Your friend Yang may still be alive"
If "found Yang" is on do the next 1 actions:
 Show Message: "Elder: Perhaps his wife knows how to wake him"
If "found Adamant" is off do the next 1 actions:
 Show Message: "Elder: A blacksmith in the underworld needs a rare ore, perhaps he can make something useful with it!"
If "found Tail" is on do the next 1 actions:
 Show Message: "Elder: There is a miner that collects tails, perhaps he will trade that one for something useful"
If "defeated Odin" is off do the next 1 actions:
 Show Message: "Elder: The ghost of Odin waits for you in Baron's basement"
Show Message: "Elder: Good luck, Cecil!"

So I take it it isn't as simple as "check flag value, compare to 0, if equal load A with YY, skip ahead bytes in the event code while decrementing A until 0"?

In any case, I guess something like that would involve hijacking an instruction that took two parameters, wouldn't it?

Slight misunderstanding... this custom code I made actually jumps into the final portion of the Yes/No routine without disrupting the original at all, as it uses the original jump's content within its entirety. (I didn't account for petrify though, which means I'll need to rewrite my custom code to make it a little lengthier for the purposes of covering all bases)

The idea you present would work, IF there was a YY portion. None of the four unused/redundant Event Instructions have a YY portion to draw from and to add a YY portion to an instruction that did not originally have it to any of the existing Event Instructions would need a large rewrite to Events all together.

While it is rather neat idea, it would not be usable in the basic sense, perhaps the custom code could have a table of its own to make it work. In any event I have not yet checked how the game accurately switches on and off booleans using a numeric value to jump into the flags and switch bits on and off. Once that portion is researched that part of it should be able to be done.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Pointer Table to Event ID Routines)
Post by: Pinkpuff on March 18, 2015, 06:58:41 AM
The idea you present would work, IF there was a YY portion. None of the four unused/redundant Event Instructions have a YY portion to draw from and to add a YY portion to an instruction that did not originally have it to any of the existing Event Instructions would need a large rewrite to Events all together.

Hm, well if that's the only problem (besides the issue of deciphering how to read flag values) I have a very hack-ish solution:

"Do the following action if Flag XX is (on/off)"

Top bit of XX indicates whether you're looking for on or off, the rest indicate the flag number (since it seems all the used flags besides 255 are under 128 ^_^)

That way if you want multiple conditional instructions, it can still be done, though rather tediously:

Code: [Select]
If "saved Yang" is ON do the next action
 Placement 4: Yang toggles visibility
If "saved Yang" is ON do the next action
 Placement 4: Yang moves up
If "saved Yang" is ON do the next action
 Show Message: "Yang: Leave it to me"
If "saved Yang" is OFF do the next action
 Show Message: "Cecil: If only Yang were here"

Also I do like the stop-gap solution you proposed for my more immediate problem of switching to paladin/DK cecil, but I think if we can somehow swing a more general "conditional" instruction, it would vastly improve the expressiveness of the event code generally and open a lot of new doors.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Pointer Table to Event ID Routines)
Post by: chillyfeez on March 18, 2015, 09:37:55 AM
A small amount of custom ASM could also be written that tells the default "change character graphic to xx" instruction that, if the parameter indicates DK Cecil, P Cecil is an acceptable alternative.
I actually did something like that for my hack, though not exactly that.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Pointer Table to Event ID Routines)
Post by: Pinkpuff on March 18, 2015, 11:54:15 AM
A small amount of custom ASM could also be written that tells the default "change character graphic to xx" instruction that, if the parameter indicates DK Cecil, P Cecil is an acceptable alternative.
I actually did something like that for my hack, though not exactly that.

That's exactly my plan for now.

If we have the pointers to the code for "set event flag" and "clear event flag", can't we just reverse-engineer whatever those are doing to figure out how to read an event flag?
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Pointer Table to Event ID Routines)
Post by: Grimoire LD on March 18, 2015, 11:39:08 PM
The idea you present would work, IF there was a YY portion. None of the four unused/redundant Event Instructions have a YY portion to draw from and to add a YY portion to an instruction that did not originally have it to any of the existing Event Instructions would need a large rewrite to Events all together.

Hm, well if that's the only problem (besides the issue of deciphering how to read flag values) I have a very hack-ish solution:

"Do the following action if Flag XX is (on/off)"

Top bit of XX indicates whether you're looking for on or off, the rest indicate the flag number (since it seems all the used flags besides 255 are under 128 ^_^)

That way if you want multiple conditional instructions, it can still be done, though rather tediously:

Code: [Select]
If "saved Yang" is ON do the next action
 Placement 4: Yang toggles visibility
If "saved Yang" is ON do the next action
 Placement 4: Yang moves up
If "saved Yang" is ON do the next action
 Show Message: "Yang: Leave it to me"
If "saved Yang" is OFF do the next action
 Show Message: "Cecil: If only Yang were here"

Also I do like the stop-gap solution you proposed for my more immediate problem of switching to paladin/DK cecil, but I think if we can somehow swing a more general "conditional" instruction, it would vastly improve the expressiveness of the event code generally and open a lot of new doors.

This is a workable idea and quite easy (in theory) to put together. The first step would involve decrementing the value to -80 to reach the proper event Flag check and then reloading the  byte and checking to see if it is negative (which it will be if it is 80) to branch to the Event Flag Check. 80 will check to see if it is On while 00 will check to see if it is Off. But again, this does require reverse-engineering as you put it. So... I'll get on that and see what I can find. Hopefully it won't be too much math.

Alright, that was easy to find...

$00/EF81   20 CB E2   JSR $E2CB  [$00:E2CB]   A:00EF   X:0000   Y:0002   P:envMxdiZc - Jump to Event Instruction Jump Routine (Looks like this is already prepared as well)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$00/E2CB   E8    INX   A:00EF   X:0000   Y:0002   P:envMxdiZc - +1 to X.
$00/E2CC   86 B3   STX $B3    [$00:06B3]   A:00EF   X:0001   Y:0002   P:envMxdizc - store X in 06B3.
$00/E2CE   BD D5 09   LDA $09D5,x[$00:09D6]   A:00EF   X:0001   Y:0002   P:envMxdizc - Load Event Instruction Location +X (meaning next byte over) into A (in this case the Flag Number)
$00/E2D1   60    RTS   A:0005   X:0001   Y:0002   P:envMxdizc - Return
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$00/EF84   20 33 F1   JSR $F133  [$00:F133]   A:0005   X:0001   Y:0002   P:envMxdizc
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$00/F133   20 7F F1   JSR $F17F  [$00:F17F]   A:0005   X:0001   Y:0002   P:envMxdizc
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$00/F17F   48    PHA   A:0005   X:0001   Y:0002   P:envMxdizc - Push A onto Stack
$00/F180   4A    LSR A   A:0005   X:0001   Y:0002   P:envMxdizc -
$00/F181   4A    LSR A   A:0002   X:0001   Y:0002   P:envMxdizC -
$00/F182   4A    LSR A   A:0001   X:0001   Y:0002   P:envMxdizc - /8
$00/F183   85 3D   STA $3D    [$00:063D]   A:0000   X:0001   Y:0002   P:envMxdiZC - Store A in 063D.
$00/F185   64 3E   STZ $3E    [$00:063E]   A:0000   X:0001   Y:0002   P:envMxdiZC - Store Zero in 063E.
$00/F187   68    PLA   A:0000   X:0001   Y:0002   P:envMxdiZC - Pull A from Stack,
$00/F188   29 07   AND #$07   A:0005   X:0001   Y:0002   P:envMxdizC - AND 07 Only saves bits 1,2, and 4. Anything above them is set to 00.
$00/F18A   A8    TAY   A:0005   X:0001   Y:0002   P:envMxdizC - Transfer A to Y.
$00/F18B   60    RTS   A:0005   X:0001   Y:0005   P:envMxdizC - Return
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
$00/F136   A9 01   LDA #$01   A:0005   X:0001   Y:0005   P:envMxdizC - Load 01 into A.
$00/F138   C0 00 00   CPY #$0000   A:0001   X:0001   Y:0005   P:envMxdizC - Compare Y to 00.
$00/F13B   F0 05   BEQ $05    [$F142]   A:0001   X:0001   Y:0005   P:envMxdizC - If so, branch to end.
$00/F13D   0A    ASL A   A:0001   X:0001   Y:0005   P:envMxdizC - x2 A
$00/F13E   88    DEY   A:0002   X:0001   Y:0005   P:envMxdizc - 1 Y.
$00/F13F   4C 38 F1   JMP $F138  [$00:F138]   A:0002   X:0001   Y:0004   P:envMxdizc - Jump back to F138.
--------------------------------------------------------------------------------------------------
$00/F142   A6 3D   LDX $3D    [$00:063D]   A:0020   X:0001   Y:0000   P:envMxdiZC  - Load X from 063D (would be the Event Flag byte to look at)
$00/F144   1D 80 12   ORA $1280,x[$00:1280]   A:0020   X:0000   Y:0000   P:envMxdiZC - Add the amount of the flag present from the Event Flag Byte.
$00/F147   9D 80 12   STA $1280,x[$00:1280]   A:0039   X:0000   Y:0000   P:envMxdizC - Store A in the Event Flag.
[/code]

Very nicely done Square! This is very simple and effective.

It it quite simple really, I'll explain what Square did to look at it as well as I can...

It looks at raw hex of the Event Flag. (in this case it was 05)

It then takes that 05 and divides it by 8. This is how it finds what Event Flag Byte it is meant to be changing.

From there it stores the original flag hex and puts it into the stack and quickly withdraws it after the Event Flag Byte is found.

Once it is withdrawn it is AND'd to assure that the value is correct (remember the Event Flag Byte has already been chosen) making the last valid value as 07. Which corresponds with the last bit of a boolean)

A is transferred to Y and then is set to 01. This sets it for the proper path of being put successfully into the Event Flag Byte.

Y is compared to 00 to pass the branching condition which will occur when the original value (5 in this case) is successfully reached as an Event Flag Bit, in this case 05 would be the 5th Bit, which is 20 and that is where it is stored in the first Event Flag Byte as a 20.

I would basically just have to copy this code for the proper flag checks and your idea should be rather simple to put together PinkPuff! But I don't think I can handle that tonight. I'll give it a go tomorrow though.

Title: Re: Grimoire LD's Notes, Patches, and Hacks (Pointer Table to Event ID Routines)
Post by: avalanche on March 19, 2015, 08:32:39 AM
Can anyone think of any events that use the "move camera up one space then down again" instruction?

This one is used in some events that really want to shake the screen for effect. I think when the Enterprise is crash landing in the underground, maybe the Leviathan... It it usually combined with the horizontal screen shake rumble.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Pointer Table to Event ID Routines)
Post by: LordGarmonde on March 19, 2015, 11:42:22 AM
...
I would basically just have to copy this code for the proper flag checks and your idea should be rather simple to put together PinkPuff! But I don't think I can handle that tonight. I'll give it a go tomorrow though.

Oh that's pretty nifty Grimoire LD.  :cycle:         -Best of luck with it; I'm excited to see how it comes out.  :childish:
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Pointer Table to Event ID Routines)
Post by: Grimoire LD on March 19, 2015, 02:07:13 PM
Can anyone think of any events that use the "move camera up one space then down again" instruction?

This one is used in some events that really want to shake the screen for effect. I think when the Enterprise is crash landing in the underground, maybe the Leviathan... It it usually combined with the horizontal screen shake rumble.

Ah, you're right. I hadn't considered that.. that means we have 3 free Event Instructions, (+Gil/-Gil/Nothing) not 4, my mistake.

Alright then PinkPuff with this knowledge let's see if I can build your event instruction... For continuity purposes I'll build it right out of my "Are all characters dead or petrified?" routine, as I said, it won't interfere with anything unless it's built into an event where the entire party has died (in which case you should set the healing instructions to occur immediately after the battle. This event instruction would also serve purpose for the Side Project to give some presence to the optional party for Zeromus.

Hmm... well after working on this for a little while I noticed a glaring issue...

There's no easy way to tell the game that an event instruction has been skipped and since they're of variable length this means that either...

1. A hack of this sort would need to be set to only skip Either 1 Byte Event Instructions OR Two Byte Instructions.

2. Create an "artificial" YY. This can be done in a fairly easy fashion, but it would involve manipulating the basic movement patterns... as the amount of instructions to skip. So let's say this... in the editor (at the moment. You might be able to program this into the editor with full capability PinkPuff) You would use "Load Graphic" and say you set it to 85, this implies that the game will look to see if Yang has been freed from brainwashing (80 acting as the "On Check", 5 Acting as the Event Flag to check) Secondly you put "Placement 1 Faces Up" Immediately After this would then be the "YY" and that would technically be 04 +1 Instructions skipped (since it will be using the basic Event Routine Progress your choice will Always have to be (Value skipped +1))

I'd much rather try and work out of 2, than 1, since 1 is too binding. I'll see what I can do.


And the first part is done! I now have part of it successfully implemented, here is my redone "check if dead/petrified" and then here is my "Is Event Flag XX on? If so, skip the next (as designated by next event instruction byte over) actions.

Code: [Select]
$00/FD71 AD 03 10 LDA $1003  [$00:1003] A:00FD X:0000 Y:0002 P:envMxdiZc - Load Slot 1's Status Byte 1.
$00/FD74 29 C0 AND #$C0 A:0040 X:0000 Y:0002 P:envMxdizc - Get rid of all bits that are not Petrify or Dead
$00/FD76 F0 1F BEQ $1F    [$FD97] A:0040 X:0000 Y:0002 P:envMxdizc - If 00, branch to Flag Check Portions.
$00/FD78 AD 43 10 LDA $1043  [$00:1043] A:0040 X:0000 Y:0002 P:envMxdizc (Do this for the next four slots)
$00/FD7B 29 C0 AND #$C0 A:0080 X:0000 Y:0002 P:eNvMxdizc
$00/FD7D F0 18 BEQ $18    [$FD97] A:0080 X:0000 Y:0002 P:eNvMxdizc
$00/FD7F AD 83 10 LDA $1083  [$00:1083] A:0080 X:0000 Y:0002 P:eNvMxdizc
$00/FD82 29 C0 AND #$C0 A:0080 X:0000 Y:0002 P:eNvMxdizc
$00/FD84 F0 11 BEQ $11    [$FD97] A:0080 X:0000 Y:0002 P:eNvMxdizc
$00/FD86 AD C3 10 LDA $10C3  [$00:10C3] A:0080 X:0000 Y:0002 P:eNvMxdizc
$00/FD89 29 C0 AND #$C0 A:0080 X:0000 Y:0002 P:eNvMxdizc
$00/FD8B F0 0A BEQ $0A    [$FD97] A:0080 X:0000 Y:0002 P:eNvMxdizc
$00/FD8D AD 03 11 LDA $1103  [$00:1103] A:0080 X:0000 Y:0002 P:eNvMxdizc
$00/FD90 29 C0 AND #$C0 A:0080 X:0000 Y:0002 P:eNvMxdizc
$00/FD92 F0 03 BEQ $03    [$FD97] A:0080 X:0000 Y:0002 P:eNvMxdizc
$00/FD94 4C 04 EB JMP $EB04  [$00:EB04] A:0080 X:0000 Y:0002 P:eNvMxdizc - Branch to Event Switch Routine
-----------------------------------------------------------------------------------------------------------------------------
$00/FD97 20 CB E2 JSR $E2CB  [$00:E2CB] A:0000 X:0000 Y:0002 P:envMxdiZc - Jump to Event Instruction position
00/FD9A 10 31 BPL $31    [$FDCD] A:0084 X:0001 Y:0002 P:eNvMxdizc - Branch if the Value is Positive (Flag is Off Portion)
----------------------------------------------------------------------------------------------------------------------------------
$00/FD9C 29 7F AND #$7F A:0084 X:0001 Y:0002 P:eNvMxdizc - Clear all negative bits.
$00/FD9E 20 7F F1 JSR $F17F  [$00:F17F] A:0004 X:0001 Y:0002 P:envMxdizc - Jump to Event Flag Byte Placement Routine
$00/FDA1 A9 01 LDA #$01 A:0004 X:0001 Y:0004 P:envMxdizC - Load 01 into A.
$00/FDA3 C0 00 00 CPY #$0000 A:0001 X:0001 Y:0004 P:envMxdizC - Compare Y to 00 (due to subroutine above, it is now the amount of times it needs to loop to reach appropriate Event Flag)
$00/FDA6 F0 04 BEQ $04    [$FDAC] A:0001 X:0001 Y:0004 P:envMxdizC - If 00 branch.
$00/FDA8 0A ASL A A:0001 X:0001 Y:0004 P:envMxdizC - x2 A
$00/FDA9 88 DEY A:0002 X:0001 Y:0004 P:envMxdizc -1 Y
$00/FDAA 80 F7 BRA $F7    [$FDA3] A:0002 X:0001 Y:0003 P:envMxdizc - Loop back to FDA3.
------------------------------------------------------------------------------------------------------------------
$00/FDAC A6 3D LDX $3D    [$00:063D] A:0010 X:0001 Y:0000 P:envMxdiZC - Load Event Flag Bit into X.
$00/FDAE 48 PHA A:0010 X:0000 Y:0000 P:envMxdiZC - Push Event flag onto Stack
$00/FDAF BD 80 12 LDA $1280,x[$00:1280] A:0010 X:0000 Y:0000 P:envMxdiZC - Load Event Flag Byte
$00/FDB2 AA TAX A:0019 X:0000 Y:0000 P:envMxdizC - Transfer Event Flag Byte to X.
$00/FDB3 85 FF STA $FF    [$00:06FF] A:0019 X:0019 Y:0000 P:envMxdizC - Store Event Flag Byte into 06FF.
$00/FDB5 68 PLA A:0019 X:0019 Y:0000 P:envMxdizC - Pull Event Flag Bit from Stack.
$00/FDB6 2D FF 06 AND $06FF  [$00:06FF] A:0010 X:0019 Y:0000 P:envMxdizC - Test it against the Event Flag Byte to see if it goes through.
$00/FDB9 D0 01 BNE $01    [$FDBC] A:0010 X:0019 Y:0000 P:envMxdizC - If it is not 00, proceed.
-------------------------------------------------------------------------------------------------------------------------
$00/FDBB 60 RTS A:006D X:006B Y:0000 P:envMxdizc - Return
----------------------------------------------------------------------------------------------------------------------
$00/FDBC AE D3 09 LDX $09D3  [$00:09D3] A:006D X:006B Y:0000 P:envMxdizc - Load  X from Event Placements.
$00/FDBF BF 00 82 12 LDA $128200,x[$12:826B] A:0010 X:006B Y:0000 P:envMxdizC - Load A from Next Byte over (This is the dummy movement bit I mentioned above, which would correspond to how many instructions are skipped)
$00/FDC3 86 FF STX $FF    [$00:06FF] A:0001 X:006B Y:0000 P:envMxdizC - Store X in 06FF.
$00/FDC5 65 FF ADC $FF    [$00:06FF] A:0001 X:006B Y:0000 P:envMxdizC - Add the value of Event Placements onto A (Dummy Movement Bit set to 01, + Event Placement)
$00/FDC7 8D D3 09 STA $09D3  [$00:09D3] A:006D X:006B Y:0000 P:envMxdizc - Store this into the current Progress of Event Placement.

Whew! Now that was an interesting experiment and it seems to work great! I just need to throw in a check for "Is Event Flag XX Off?" Which as you can see, is already planned. I just need to get to it. So I think I can conclude this experiment to be a success!


 :edit: Let's get to the "If Event Flag is OFF then, shall we?

Code: [Select]

And that's done... it's is clean as I can get it, I'm sure someone else could condense it more, but it works perfectly fine as is, I rewrote the code to make it work with the Event Flag OFF Option.

[code]
$00/FD97 20 CB E2 JSR $E2CB  [$00:E2CB] A:000C X:0000 Y:0000 P:envMxdizc  - Jump to Event Instruction Pull Routine
$00/FD9A 29 7F AND #$7F A:000C X:0000 Y:0000 P:envMxdizc - Get rid of negative bit.
$00/FD9C 20 7F F1 JSR $F17F  [$00:F17F] A:000C X:0000 Y:0000 P:envMxdizc - Jump to Event Flag Byte Placement routine.
$00/FD9F A9 01 LDA #$01 A:000C X:0000 Y:0000 P:envMxdizc -  Load 01 into A.
$00/FDA1 C0 00 00 CPY #$0000 A:000C X:0000 Y:0000 P:envMxdizc - Compare Y to 0000 (Reaches Event Flag bit eventually)
$00/FDA4 F0 04 BEQ $04    [$FDAA] A:000C X:0000 Y:0000 P:envMxdizc - Branch if 00.
----------------------------------------------------------------------------------------------------------------
$00/FDA6 0A ASL A A:000C X:0000 Y:0000 P:envMxdizc - x2 A
$00/FDA7 88 DEY A:000C X:0000 Y:0000 P:envMxdizc - -1 Y
$00/FDA8 80 F7 BRA $F7    [$FDA1] A:000C X:0000 Y:0000 P:envMxdizc - Loop back.
---------------------------------------------------------------------------------------------------------------
$00/FDAA A6 3D LDX $3D    [$00:063D] A:000C X:0000 Y:0000 P:envMxdizc - Load Event Flag Bit into X.
$00/FDAC 48 PHA A:000C X:0000 Y:0000 P:envMxdizc - Push Event Flag onto Stack.
$00/FDAD AD D6 09 LDA $09D6  [$00:09D6] A:000C X:0000 Y:0000 P:envMxdizc - Load Event Flag Byte into X.
$00/FDB0 10 0D BPL $0D    [$FDBF] A:000C X:0000 Y:0000 P:envMxdizc - If positive, branch.
----------------------------------------------------------------------------------------------------------------------
$00/FDB2 BD 80 12 LDA $1280,x[$00:1280] A:000C X:0000 Y:0000 P:envMxdizc - Load Event Flag Byte Placement into A.
$00/FDB5 AA TAX A:000C X:0000 Y:0000 P:envMxdizc - Transfer Event Flag Byte into X.
$00/FDB6 85 FF STA $FF    [$00:06FF] A:000C X:0000 Y:0000 P:envMxdizc - Store A in 06FF.
$00/FDB8 68 PLA A:000C X:0000 Y:0000 P:envMxdizc - Pull Event Flag Bit from Stack
$00/FDB9 2D FF 06 AND $06FF  [$00:06FF] A:000C X:0000 Y:0000 P:envMxdizc - Get rid of all bits not present in 06FF in A.
$00/FDBC D0 0E BNE $0E    [$FDCC] A:000C X:0000 Y:0000 P:envMxdizc - Branch if Not 00 (Meaning Event Flag is On) to rest of routine
--------------------------------------------------------------------------------------------------------------------
$00/FDBE 60 RTS A:000C X:0000 Y:0000 P:envMxdizc
-----------------------------------------------------------------------------------------------------------------
$00/FDBF BD 80 12 LDA $1280,x[$00:1280] A:000C X:0000 Y:0000 P:envMxdizc
$00/FDC2 AA TAX A:000C X:0000 Y:0000 P:envMxdizc
$00/FDC3 85 FF STA $FF    [$00:06FF] A:000C X:0000 Y:0000 P:envMxdizc
$00/FDC5 68 PLA A:000C X:0000 Y:0000 P:envMxdizc
$00/FDC6 2D FF 06 AND $06FF  [$00:06FF] A:000C X:0000 Y:0000 P:envMxdizc
$00/FDC9 F0 01 BEQ $01    [$FDCC] A:000C X:0000 Y:0000 P:envMxdizc - (As above, except it is looking for a match within 06FF's bits and the Event Flag bit it is searching for)
----------------------------------------------------------------------------------------------------------
$00/FDCB 60 RTS A:000C X:0000 Y:0000 P:envMxdizc - Return
--------------------------------------------------------------------------------------------------------
$00/FDCC AE D3 09 LDX $09D3  [$00:09D3] A:000C X:0000 Y:0000 P:envMxdizc- Load X from Event Progress Placement.
$00/FDCF BF 00 82 12 LDA $128200,x[$12:8200] A:000C X:0000 Y:0000 P:envMxdizc - Load A from Event Placement +X (Dummy Movement Bit acting as the numerical value of actions to skip)
$00/FDD3 86 FF STX $FF    [$00:06FF] A:000C X:0000 Y:0000 P:envMxdizc - Store X in 06FF.
$00/FDD5 65 FF ADC $FF    [$00:06FF] A:000C X:0000 Y:0000 P:envMxdizc - Add 06FF onto A. (Event Placement + Dummy Movement Bit)
$00/FDD7 8D D3 09 STA $09D3  [$00:09D3] A:000C X:0000 Y:0000 P:envMxdizc  - Store A in Event Progress Placement.
$00/FDDA 60 RTS A:000C X:0000 Y:0000 P:envMxdizc - Return

And there we are! Now you may have Event Flags control actions taken within events and have different effects depending on whether it is On or Off and thrown in is the Dead/Petrified characters check.

Title: Re: Grimoire LD's Notes, Patches, and Hacks (Custom Flag Check Event Instruction!)
Post by: Pinkpuff on March 19, 2015, 04:37:54 PM
Grimoire, you are indeed a miracle worker!!

So let me see if I understand this correctly...

If this is correct, what I can do as far as the editor is concerned is get it to detect the patch on startup and set a flag in the editor which will tell it how to interpret the "Load Graphic" command (which I guess should now default to "Crash Game"?); that way it will be readable for both patched and unpatched roms.

Speaking of which, this could definitely be its own standalone patch, "Grimoire LD's Event Instruction Expansion Patch" or something
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Custom Flag Check Event Instruction!)
Post by: Grimoire LD on March 19, 2015, 09:18:14 PM
Grimoire, you are indeed a miracle worker!!

So let me see if I understand this correctly...
  • The instruction in question is the one currently interpreted as "Load Graphic"
  • It will now essentially become "If flag XX is [ON/OFF] (based on top bit of XX; 1 = on, 0 = off), do the next YY actions"
  • The YY in this description is not a parameter in the usual sense but is read by the next byte following the instruction
  • If the specified flag matches the specified value, it will do the next number of bytes worth of actions (not counting the "fake parameter" byte)
  • If it does not, it will skip them (also skipping the "fake parameter" byte)

If this is correct, what I can do as far as the editor is concerned is get it to detect the patch on startup and set a flag in the editor which will tell it how to interpret the "Load Graphic" command (which I guess should now default to "Crash Game"?); that way it will be readable for both patched and unpatched roms.

Speaking of which, this could definitely be its own standalone patch, "Grimoire LD's Event Instruction Expansion Patch" or something

Title: Re: Grimoire LD's Notes, Patches, and Hacks (Custom Flag Check Event Instruction!)
Post by: Grimoire LD on March 19, 2015, 10:29:14 PM
Alright, so next will turn "Decrement x100 Gil" into Gain Stat (X) by Y amount, for Z Character.

This will be approached with the Dummy Movement Bit as all for the character.

Here is the plan...

XY.

X =

08=Strength
10=Agility
20=Vitality
40=Wisdom
80=Will

Y = Stat Increase (up to 7)

Z will be looked at on an Actor Basis so if you want Dark Knight Cecil to gain +5 Strength you would use Movement Byte 00 (Move Left). If the character is not present then they simply will not gain the stat.



But that plan will come for another day. As of now here is the Party Dead/Flag Check Patch.

(Please let me know if this patch actually works. I tried something a little different for the patching process so I'm not sure if it will work correctly.)

As always the patch must be unheadered!

If anyone has other ideas for new Event Instructions let me know and I'll see what I can do.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Flag Check Event Instruction Patch!)
Post by: chillyfeez on March 20, 2015, 01:21:14 AM
If I'm understanding correctly, you could actually make the max stat increase 8.
0,1,2,3,4,5,6,7 would raise the stat 1,2,3,4,5,6,7,8 respectively. You wouldn't use the instruction to raise a stat by zero, after all.
Also, would this be able to raise multiple stats with one instruction? For instance, if I made my parameter "CX" would it raise both Wis and Will by X?
Also, I don't really understand what you're saying about Z...
I'm going to disappear for about a week - got some real world stuff I need to do - so this will be my last message for a while.
Some cool stuff happening here, though. I look forward to seeing what develops!
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Flag Check Event Instruction Patch!)
Post by: Pinkpuff on March 20, 2015, 06:16:51 AM
Ok so if it matches it will skip, and if it does not match, it will execute them...
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Flag Check Event Instruction Patch!)
Post by: Grimoire LD on March 20, 2015, 09:16:37 AM
If I'm understanding correctly, you could actually make the max stat increase 8.
0,1,2,3,4,5,6,7 would raise the stat 1,2,3,4,5,6,7,8 respectively. You wouldn't use the instruction to raise a stat by zero, after all.
Also, would this be able to raise multiple stats with one instruction? For instance, if I made my parameter "CX" would it raise both Wis and Will by X?
Also, I don't really understand what you're saying about Z...
I'm going to disappear for about a week - got some real world stuff I need to do - so this will be my last message for a while.
Some cool stuff happening here, though. I look forward to seeing what develops!

Hah, I didn't think about that Chillyfeez, I just assumed it would be easier to use the half-byte in its basic sense, but I could throw in a "+1" to the entire thing to make it whatever is chosen +1.

Now Z is using the same system I used for the Flag Check, using a Dummy Movement bit to choose the actor that would get the stat boost. And yes, as you pointed out you could use this to increase two or more (or all) stats by Y.

Ok so if it matches it will skip, and if it does not match, it will execute them...

That is purely if it is a Positive.

If the bit reads Negative it will look to Not Match the Event Flag to Skip Instructions, it the correct Event Flag is ON then the instructions will play. If the bit reads Positive it will be the opposite. It will look to see if a certain Event Flag is OFF otherwise it will skip the instructions.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Flag Check Event Instruction Patch!)
Post by: Pinkpuff on March 20, 2015, 11:47:25 AM
Ok so if it matches it will skip, and if it does not match, it will execute them...

That is purely if it is a Positive.

If the bit reads Negative it will look to Not Match the Event Flag to Skip Instructions, it the correct Event Flag is ON then the instructions will play. If the bit reads Positive it will be the opposite. It will look to see if a certain Event Flag is OFF otherwise it will skip the instructions.

What in the world?...

Ok so if the high bit of XX is 1, it will play on a match (ON) and skip on a mismatch (OFF), but if the high bit of XX is 0, it will skip on a match (OFF) and play on a mismatch (ON)?

 :edit: I tried downloading and applying the patch but it looks like it messed with many of my events... (yes I used an unheadered rom)... are you sure the patch changes nothing else besides those instructions?
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Flag Check Event Instruction Patch!)
Post by: Grimoire LD on March 20, 2015, 10:21:21 PM
Ok so if it matches it will skip, and if it does not match, it will execute them...

That is purely if it is a Positive.

If the bit reads Negative it will look to Not Match the Event Flag to Skip Instructions, it the correct Event Flag is ON then the instructions will play. If the bit reads Positive it will be the opposite. It will look to see if a certain Event Flag is OFF otherwise it will skip the instructions.

What in the world?...

Ok so if the high bit of XX is 1, it will play on a match (ON) and skip on a mismatch (OFF), but if the high bit of XX is 0, it will skip on a match (OFF) and play on a mismatch (ON)?

 :edit: I tried downloading and applying the patch but it looks like it messed with many of my events... (yes I used an unheadered rom)... are you sure the patch changes nothing else besides those instructions?

Yes, you have it right now.

Hmm, I was worried that might be the case, what events are messed up out of curiosity?
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Flag Check Event Instruction Patch!)
Post by: Pinkpuff on March 21, 2015, 06:15:20 AM
Ok so if the high bit of XX is 1, it will play on a match (ON) and skip on a mismatch (OFF), but if the high bit of XX is 0, it will skip on a match (OFF) and play on a mismatch (ON)?

Yes, you have it right now.

So suppose I want some event instructions to play when a certain flag is OFF and skip when it's ON. How do I express that using this?

Because the way I understand it, if I send it the flag + 0x00 then it will play the event on a mismatch (i.e. if the flag is ON). But if I send it the flag + 0x80 then it will play the event on a match (i.e. if the flag is... ON). So regardless of whether I add 0x80 or not, it will play when the flag is ON, and skip when it's OFF, making the high bit toggle completely redundant as far as I can tell...

Hmm, I was worried that might be the case, what events are messed up out of curiosity?

Tons of them...
Among a bunch more... I can make an exhaustive list if needed.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Flag Check Event Instruction Patch!)
Post by: Grimoire LD on March 21, 2015, 08:27:47 AM
Ok so if the high bit of XX is 1, it will play on a match (ON) and skip on a mismatch (OFF), but if the high bit of XX is 0, it will skip on a match (OFF) and play on a mismatch (ON)?

Yes, you have it right now.

So suppose I want some event instructions to play when a certain flag is OFF and skip when it's ON. How do I express that using this?

Because the way I understand it, if I send it the flag + 0x00 then it will play the event on a mismatch (i.e. if the flag is ON). But if I send it the flag + 0x80 then it will play the event on a match (i.e. if the flag is... ON). So regardless of whether I add 0x80 or not, it will play when the flag is ON, and skip when it's OFF, making the high bit toggle completely redundant as far as I can tell...

Hmm, I was worried that might be the case, what events are messed up out of curiosity?

Tons of them...
  • "Receiving the pan" contains a YES/NO box
  • "Do you have the clerics permission" is empty
  • "Open a door" contains a battle with Rubicant
  • So does "Locked"
  • So does "Namingway"
  • "Opening Events" adds and then immediately removes a bunch of actors
Among a bunch more... I can make an exhaustive list if needed.

Ah, I should have known better than to try and use my Side-Project Rom for that. That's the core of the screw ups. Sorry about that. I should have just made an unaltered ROM (remove the header) and patched it with an unaltered ROM. Those reports at first scared me that I Really did screw up something with the entire event system, but thankfully that is not the case.

I had thought though since the two ROMs I used were copies of one another with the only differences being (admittedly Namingway) and the new event instruction space the only changes carried over would be the differences, but it seems the entire thing was carried over. Eh, maybe I misunderstand something fundamentally about IPS.

Now as for your query about the flags...

(Admittedly even I'm getting a bit tripped up here)

IF you want the event instructions to Skip when a Flag is ON you would use 0x00. (This looks for a mismatch which implies the Flag to Check is Off and to Skip instructions if So)
IF you want the event instructions to skip when a Flag is OFF you would use 0x80. (This looks for a match which implies the Flag to Check is On and to Skip Instructions if So)

Quote
So suppose I want some event instructions to play when a certain flag is OFF and skip when it's ON. How do I express that using this?

Something like that was listed in my example.

"Crash Game 2XX" (2)(Is Event Flag (unused) OFF?)
NPC 1 Face Right (1) (If Not 5  (+1) Skips)
Show Message: (2)"King: You've returned not a moment too soon, Yang. A Dragon in Mt. Hobbs is disrupting our daily training. As our High Monk I ask you to vanquish it."
Show Message: "(2) Yang: You have my word."
Activate Event Flag XX (2) (Unused one from above)
END

I do hope that makes a little more sense, I probably made this more obtuse than it should have been (as is often my failing with hacking)


Alright, now  this patch was made from two fresh ROMs (with the headers removed with the only differences being the new event instruction and a location in the pointer table to the new event instruction.

(1 KB so that seems like it should be the ticket)
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Flag Check Event Instruction Patch!)
Post by: Pinkpuff on March 21, 2015, 08:51:46 AM
IF you want the event instructions to Skip when a Flag is ON you would use 0x00. (This looks for a mismatch which implies the Flag to Check is Off and to Skip instructions if So)
IF you want the event instructions to skip when a Flag is OFF you would use 0x80. (This looks for a match which implies the Flag to Check is On and to Skip Instructions if So)

A given event flag is "OFF" when it has a value of 0 correct? So when the high bit of the XX parameter is 0 (i.e. we added 0x00 / didn't add anything / just the raw flag number), then the high bit matches when the flag also has a value of 0, meaning it is OFF... right? In the above, you seem to be saying that an OFF flag (0) mismatches a high bit of 0...

Something like that was listed in my example.

"Crash Game 2XX" (2)(Is Event Flag (unused) OFF?)
NPC 1 Face Right (1) (If Not 5  (+1) Skips)
Show Message: (2)"King: You've returned not a moment too soon, Yang. A Dragon in Mt. Hobbs is disrupting our daily training. As our High Monk I ask you to vanquish it."
Show Message: "(2) Yang: You have my word."
Activate Event Flag XX (2) (Unused one from above)
END

What is "2XX" in this example? double XX? can't be.. 0x200 + XX? Also seems like it can't be that either....

Sorry if I'm being bothersome about this, but I need to make sure I fully and correctly understand what's going on before I can code it into the editor...

Alright, now  this patch was made from two fresh ROMs (with the headers removed with the only differences being the new event instruction and a location in the pointer table to the new event instruction.

(1 KB so that seems like it should be the ticket)

The events are no longer messed up. Looks like a success so far! Time to start toying with the new instruction  :childish:

 :edit: After some initial experimentation, this is how I would describe what this instruction appears to be doing:

If the flag value matches the high bit of the XX parameter, skip a number of bytes worth of instructions specified by the next byte. This includes skipping that byte (perfect).
If the flag value does not match the high bit of the XX parameter, execute all the next instructions... including the "dummy parameter" byte. In other words, if the byte following the "Crash Game XX" instruction said "Placement 1 moves up", then placement 1 will indeed move up (not ideal).
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Flag Check Event Instruction Patch!)
Post by: Grimoire LD on March 21, 2015, 09:18:38 AM
IF you want the event instructions to Skip when a Flag is ON you would use 0x00. (This looks for a mismatch which implies the Flag to Check is Off and to Skip instructions if So)
IF you want the event instructions to skip when a Flag is OFF you would use 0x80. (This looks for a match which implies the Flag to Check is On and to Skip Instructions if So)

A given event flag is "OFF" when it has a value of 0 correct? So when the high bit of the XX parameter is 0 (i.e. we added 0x00 / didn't add anything / just the raw flag number), then the high bit matches when the flag also has a value of 0, meaning it is OFF... right? In the above, you seem to be saying that an OFF flag (0) mismatches a high bit of 0...

Something like that was listed in my example.

"Crash Game 2XX" (2)(Is Event Flag (unused) OFF?)
NPC 1 Face Right (1) (If Not 5  (+1) Skips)
Show Message: (2)"King: You've returned not a moment too soon, Yang. A Dragon in Mt. Hobbs is disrupting our daily training. As our High Monk I ask you to vanquish it."
Show Message: "(2) Yang: You have my word."
Activate Event Flag XX (2) (Unused one from above)
END

What is "2XX" in this example? double XX? can't be.. 0x200 + XX? Also seems like it can't be that either....

Sorry if I'm being bothersome about this, but I need to make sure I fully and correctly understand what's going on before I can code it into the editor...

Alright, now  this patch was made from two fresh ROMs (with the headers removed with the only differences being the new event instruction and a location in the pointer table to the new event instruction.

(1 KB so that seems like it should be the ticket)

The events are no longer messed up. Looks like a success so far! Time to start toying with the new instruction  :childish:

No need to apologize, I'm just rather careless in my explanations, despite writing the matter and it making sense in my head, it seems the explanation on my part is not as adequate as it could be.


Quote
What is "2XX" in this example? double XX? can't be.. 0x200 + XX? Also seems like it can't be that either....

Quite literally it is just an example of an unused Event Flag in the negative range (since 127+ would be the negative range) using decimal base (since the editor normally doesn't deal in hex).

Quote
A given event flag is "OFF" when it has a value of 0 correct? So when the high bit of the XX parameter is 0 (i.e. we added 0x00 / didn't add anything / just the raw flag number), then the high bit matches when the flag also has a value of 0, meaning it is OFF... right? In the above, you seem to be saying that an OFF flag (0) mismatches a high bit of 0...

Close. The OFF flag mismatches purely because the Positive uses a BEQ, which if it reads an Active Event Flag, the "AND" check Cannot return a 00, it will return an amount with a variable causing the routine to end.

This is for Negative

"$00/FDB9   2D FF 06   AND $06FF  [$00:06FF]   A:000C   X:0000   Y:0000   P:envMxdizc - Get rid of all bits not present in 06FF in A.
$00/FDBC   D0 0E   BNE $0E    [$FDCC]   A:000C   X:0000   Y:0000   P:envMxdizc - Branch if Not 00 (Meaning Event Flag is ON, the attempt to match it with an active Event Flag has succeeded.) to rest of Event Instruction skipping routine"

This is for Positive

$00/FDC6   2D FF 06   AND $06FF  [$00:06FF]   A:000C   X:0000   Y:0000   P:envMxdizc - Get rid of all bits not present in 06FF in A.
$00/FDC9   F0 01   BEQ $01    [$FDCC]   A:000C   X:0000   Y:0000   P:envMxdizc - Branch if 00 (Meaning Event Flag is OFF, as the attempt to match it with an active Event Flag has failed and thus will read 00 as none of the bits in 06FF correspond to the bit of the Event Flag so it returns a 00.) to rest of Event Instruction skipping routine.
(A BEQ  without a CMP is always compared to 00 in FFIV)

Is that any clearer?
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Flag Check Event Instruction Patch!)
Post by: Pinkpuff on March 21, 2015, 09:46:31 AM
Not even remotely I'm afraid  :isuck:

How can we be considering event flags in the "negative range" (I assume you mean flags greater than 127) for a parameter to begin with? (a) There are none relevant besides the dark elf attack, (b) there's no way to tell such a flag from it's "positive" counterpart with 0x80 added, and (c) you can't exactly add 0x80 to it...

How about you just fill out this form for me:

Event FlagCurrent ValueXX ParameterSKIP or DO next YY instructions?
05ON0x05____
05ON0x85____
05OFF0x05____
05OFF0x85____
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Flag Check Event Instruction Patch!)
Post by: Grimoire LD on March 21, 2015, 10:15:11 AM
Not even remotely I'm afraid  :isuck:

How can we be considering event flags in the "negative range" (I assume you mean flags greater than 127) for a parameter to begin with? (a) There are none relevant besides the dark elf attack, (b) there's no way to tell such a flag from it's "positive" counterpart with 0x80 added, and (c) you can't exactly add 0x80 to it...

How about you just fill out this form for me:

Event FlagCurrent ValueXX ParameterSKIP or DO next YY instructions?
05ON0x05____
05ON0x85____
05OFF0x05____
05OFF0x85____

Oh! I see where the confusion arises...

Remember when you said..

Quote
Hm, well if that's the only problem (besides the issue of deciphering how to read flag values) I have a very hack-ish solution:

"Do the following action if Flag XX is (on/off)"

Top bit of XX indicates whether you're looking for on or off, the rest indicate the flag number (since it seems all the used flags besides 255 are under 128 ^_^)

And that is what I did. This does not take into account Negative Range Event Flags. My example above used a very high hypothetical Flag 88-125+127, hence why I used the term "2XX". When my routine reads an 80 bit it instead turns it into its positive form for the Event Checking and the negative portion of it is only brought into play later on in the routine for the branching of checking whether an Event Flag is Off/On, I'll fill out that chart though and see if it helps any.

I was using the bit in its negative form in the editor for my experiments in that format, hence why I used the negative form in that manner.

Event FlagCurrent ValueXX ParameterSKIP or DO next YY instructions?
05ON0x05DO
05ON0x85SKIP
05OFF0x05DO
05OFF0x85SKIP

Good idea with the chart though. Hopefully that will make a little sense.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Flag Check Event Instruction Patch!)
Post by: Pinkpuff on March 21, 2015, 10:25:53 AM
So wait... if XX = 05, then it will DO the next YY instructions, regardless of whether flag 05 is ON or OFF??
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Flag Check Event Instruction Patch!)
Post by: Grimoire LD on March 21, 2015, 10:34:43 AM
So wait... if XX = 05, then it will DO the next YY instructions, regardless of whether flag 05 is ON or OFF??

Ahem... got a bit tripped up there...

Event FlagCurrent ValueXX ParameterSKIP or DO next YY instructions?
05ON0x05DO
05ON0x85SKIP
05OFF0x05SKIP
05OFF0x85DO

This boils my mind because I'm trying to disassociate "success of routine" from "event instructions playing" when I have to remember that when it Skips the instructions it means my routine was successful.


Title: Re: Grimoire LD's Notes, Patches, and Hacks (Flag Check Event Instruction Patch!)
Post by: Pinkpuff on March 21, 2015, 10:40:17 AM
ALRIGHT! I get it now!  :childish:

Thanks, sorry that took so long to sort out.

Also, in case you missed my edit a few posts ago, the patch seems to be executing the instruction that should be the pseudo YY parameter. So like if I say something like:

Visual Effect 05
Placement 1 Moves down
Change character graphic to 1
You face down

Then if it skips, it skips correctly, but if it executes, it will move Placement 1 down (seems like it shouldn't, since that's just the parameter byte and I don't actually want Placement 1 to move down).
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Flag Check Event Instruction Patch!)
Post by: Grimoire LD on March 21, 2015, 10:45:30 AM
ALRIGHT! I get it now!  :childish:

Thanks, sorry that took so long to sort out.

Also, in case you missed my edit a few posts ago, the patch seems to be executing the instruction that should be the pseudo YY parameter. So like if I say something like:

Visual Effect 05
Placement 1 Moves down
Change character graphic to 1
You face down

Then if it skips, it skips correctly, but if it executes, it will move Placement 1 down (seems like it shouldn't, since that's just the parameter byte and I don't actually want Placement 1 to move down).

Oh, was I really so careless that I forgot to include a clause for that? Knowing my shoddy coding, quite likely...

Yeah. I didn't include an exception for that. Truly, how careless of me, I'll fix that as soon as I can.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Flag Check Event Instruction Patch!)
Post by: Grimoire LD on March 21, 2015, 11:10:16 AM
Alright. Here we are, after the routine fails to Skip a routine it now Increments the Event Progress byte to skip the Dummy Movement bit (I had this originally planned, but I must have forgotten about it when I saw that the main concept was working well enough)

Thank you for finding that PinkPuff.

Title: Re: Grimoire LD's Notes, Patches, and Hacks (Flag Check Event Instruction Patch!)
Post by: Pinkpuff on March 21, 2015, 11:40:46 AM
Now it crashes the game...

I tried patching it to a fresh rom and to a rom already patched with the previous patch, in both cases inserting a "Load Graphic" instruction crashed the game. Unheadered in both cases.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Flag Check Event Instruction Patch!)
Post by: Grimoire LD on March 21, 2015, 11:45:52 AM
Geez! I always make that mistake with IPS patching at least once or twice. I think I used the default ROM as the modified one and the modified rom as the default one. Now it Should work.

Title: Re: Grimoire LD's Notes, Patches, and Hacks (Flag Check Event Instruction Patch!)
Post by: Pinkpuff on March 21, 2015, 11:59:47 AM
SUCCESS!!

Alright now to get it coded into the editor. What bytes are changed by the patch? You don't have to list all of them necessarily, just enough to be sure it's your patch and not some other one someone might do up. This is strictly for the purposes of the editor determining whether the patch has been applied to the rom it's loading.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Flag Check Event Instruction Patch!)
Post by: Grimoire LD on March 21, 2015, 12:23:17 PM
SUCCESS!!

Alright now to get it coded into the editor. What bytes are changed by the patch? You don't have to list all of them necessarily, just enough to be sure it's your patch and not some other one someone might do up. This is strictly for the purposes of the editor determining whether the patch has been applied to the rom it's loading.

Fantastic! This patch  changes bytes from 7D71 to 7DE1.

In addition 633E is also filled with a pointer rather than 00's.

As always, unheadered.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Flag Check Event Instruction Patch!)
Post by: Grimoire LD on March 22, 2015, 07:36:09 AM
Change Graphic to XX

Code: [Select]
$00/E9B6 20 CB E2 JSR $E2CB  [$00:E2CB] A:00E9 X:0000 Y:0002 P:envMxdiZc - Jump to Subroutine (Load XX Parameter, +1 to X)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~``
$00/E2CB E8 INX A:00E9 X:0000 Y:0002 P:envMxdiZc - +1 to X.
$00/E2CC 86 B3 STX $B3    [$00:06B3] A:00E9 X:0001 Y:0002 P:envMxdizc - Store Event Progress in 06B3.
$00/E2CE BD D5 09 LDA $09D5,x[$00:09D6] A:00E9 X:0001 Y:0002 P:envMxdizc - Load Event Variable into A.
$00/E2D1 60 RTS A:0001 X:0001 Y:0002 P:envMxdizc - Return
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$00/E9B9 85 06 STA $06    [$00:0606] A:0001 X:0001 Y:0002 P:envMxdizc - Store A (in this case desired Character Graphic) in 0606.
$00/E9BB A2 00 00 LDX #$0000 A:0003 X:0001 Y:0002 P:envMxdizc - Load 0000 into X.
$00/E9BE A0 00 00 LDY #$0000 A:0003 X:0000 Y:0002 P:envMxdiZc - Load 0000 into Y.
$00/E9C1 B9 00 10 LDA $1000,y[$00:1000] A:0003 X:0000 Y:0000 P:envMxdiZc - Load A from 1000+Y
$00/E9C4 29 1F AND #$1F A:0081 X:0000 Y:0000 P:eNvMxdizc - Get rid of bits 20,40,80.
$00/E9C6 C5 06 CMP $06    [$00:0606] A:0001 X:0000 Y:0000 P:envMxdizc - Compare it to the value in the stored Event Variable.
$00/E9C8 F0 11 BEQ $11    [$E9DB] A:0001 X:0000 Y:0000 P:eNvMxdizc - If equal, branch.
----------------------------------------------------------------------------------------------------
$00/E9CA C2 20 REP #$20 A:0001 X:0000 Y:0000 P:eNvMxdizc - Reset Processor Status (16 bit rather than 8 bit, I believe)
$00/E9CC 98 TYA A:0001 X:0000 Y:0000 P:eNvmxdizc - Transfer Y to A.
$00/E9CD 18 CLC A:0000 X:0000 Y:0000 P:envmxdiZc - Clear Carry Flag.
$00/E9CE 69 40 00 ADC #$0040 A:0000 X:0000 Y:0000 P:envmxdiZc - Add 40 onto A.
$00/E9D1 A8 TAY A:0040 X:0000 Y:0000 P:envmxdizc - Transfer A to Y.
$00/E9D2 A9 00 00 LDA #$0000 A:0040 X:0000 Y:0040 P:envmxdizc - Load 0000 into A.
$00/E9D5 E2 20 SEP #$20 A:0000 X:0000 Y:0040 P:envmxdiZc - Set Processor Status
$00/E9D7 E8 INX A:0000 X:0000 Y:0040 P:envMxdiZc - +1 to X.
$00/E9D8 4C C1 E9 JMP $E9C1  [$00:E9C1] A:0000 X:0001 Y:0040 P:envMxdizc - Loop back to E9C1.
-----------------------------------------------------------------------------------------------------
$00/E9DB 8A TXA A:0001 X:0000 Y:0000 P:envMxdiZC - Transfer X to A.
$00/E9DC 8D 03 17 STA $1703  [$00:1703] A:0000 X:0000 Y:0000 P:envMxdiZC - Store A in 1703 (Slot number I believe, not sure what's being done in this case though)
$00/E9DF A9 01 LDA #$01 A:0000 X:0000 Y:0000 P:envMxdiZC - Load 01 into A.
$00/E9E1 85 CC STA $CC    [$00:06CC] A:0001 X:0000 Y:0000 P:envMxdizC - Store A in 06CC.
$00/E9E3 4C D3 E0 JMP $E0D3  [$00:E0D3] A:0001 X:0000 Y:0000 P:envMxdizC - Jump to ?Event Execution?

And that's it... the game makes no actual change to find the character graphic and seems like it will look through All of RAM to find a match, hence why we get some unintended graphics, it would seem. How to fix this though... it's admittedly much shorter than I thought it would be. I can always have it Jump to unused space for my purposes.

What was your suggestion for this one again, PinkPuff?
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Flag Check Event Instruction Patch!)
Post by: Pinkpuff on March 22, 2015, 08:25:44 AM
I retracted my suggestion in favor of the more general branching statement.

But I think if I had to suggest something for this, it would be "Change character graphic to XX even if that actor isn't in your party". That way you can do things like, simulate having the camera follow a different character in a "meanwhile" scene or something. E.g.:

Code: [Select]
Load Tower of Zot Command Center
Change character graphic to (Kain)
You face down
You move down
Show message "Kain: Let me be the one to take out Cecil"
Show message "Golbez: No"
You bow head
You toggle turning
You move up
You toggle turning
Show message "Kain: As you wish"
Load Mount Ordeals 1F
Change character graphic to (DK Cecil)
You face left

I know you can already simulate something like that by making the main character invisible and just moving it around in tandem with the other character, but this way is less clunky and at the very least doesn't irrevokably turn your appearance into a pig or tiny person when you make a mistake. It could also help save NPC placement space. Imagine all the placements you could free up if in the "attack on the giant" sequence you just teleported your main character around, turning him into the various other characters (Yang, Edward, etc). You could even free up entire maps using that technique in combination with activating/deactivating NPCs as you teleport.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Changing Battle Commands Events!)
Post by: Grimoire LD on March 22, 2015, 09:27:04 PM
 :bah: that 1703 check is really the core of how this routine works. The game simply looks to see which slot should be loaded. It doesn't actually load a sprite in the basic sense at all. I'm afraid that there's no way that I can tell (I'm sure there must be, but it's a bit beyond me) to load a sprite from "Load Character Graphic". But I have had major success in an older idea of mine.

Does anyone recall my old "Commands in RAM" hack? Well it failed because the section of "RAM" I was using, never got saved. It wasn't SRAM so characters were stuck with their default commands, even though they were technically moved in RAM, they were reflected the same in all files. But there's a decent chunk of unused SRAM data at 4A0 right before the names that due to Chillyfeez's Shadow Party hack, I was able to fill with all character's Commands (the commands are actor based and are just 4 Bytes too long before they overflow into Names, meaning that FuSoYa would have four commands based on Cecil's name, a shame.) I *Could* make them based on Character ID, which would take up the same amount of space as they do in this (it would mean that Tellah would not lose Recall *normally* however as this is a hack it is meant to be compatible with some other upcoming hacks.)

Here's the associated data with this hack when entering battle...

Code: [Select]
$03/8B8B BD 01 20 LDA $2001,x[$7E:2001] A:0000 X:0000 Y:0000 P:envMxdIZC - Load A from Class.
$03/8B8E 29 1F AND #$1F A:0081 X:0000 Y:0000 P:eNvMxdIzC - Get rid of all 20,40,80 bits.
$03/8B90 D0 01 BNE $01    [$8B93] A:0001 X:0000 Y:0000 P:envMxdIzC - If not 00, branch.
---------------------------------------------------------------
$03/8B92 EA NOP A:0000 X:0000 Y:0000 P:envMxdIZC
$03/8B93 EA NOP A:0000 X:0000 Y:0000 P:envMxdIZC.
-----------------------------------------------
$03/8B94 85 DF STA $DF    [$00:00DF] A:0000 X:0000 Y:0000 P:envMxdIZC - Store A in DF.
$03/8B96 A9 05 LDA #$05 A:0000 X:0000 Y:0000 P:envMxdIZC - Load Amount of Commands into A.
$03/8B98 85 E1 STA $E1    [$00:00E1] A:0005 X:0000 Y:0000 P:envMxdIzC - Store Amount into E1.
$03/8B9A 20 E0 83 JSR $83E0  [$03:83E0] A:0005 X:0000 Y:0000 P:envMxdIzC - Jump to Subroutine (?)
$03/83E0 64 E0 STZ $E0    [$00:00E0] A:0005 X:0000 Y:0000 P:envMxdIzC - Store Zero in E1.
$03/8B9D A9 05 LDA #$05 A:0000 X:0000 Y:0000 P:envMxdIZc - Load 05 into A.
$03/8B9F 85 AB STA $AB    [$00:00AB] A:0005 X:0000 Y:0000 P:envMxdIzc - Store A in EB.
$03/8BA1 A6 E3 LDX $E3    [$00:00E3] A:0005 X:0000 Y:0000 P:envMxdIzc - Load X from Class Slot.
$03/8BA3 BF A0 14 00 LDA $0014A0,x[$00:14A0] A:0005 X:0000 Y:0000 P:envMxdIZc - Load A from SRAM based Command Location.
$03/8BA7 99 03 33 STA $3303,y[$7E:3303] A:0000 X:0000 Y:0000 P:envMxdIZc - Store A in Battle Commands.

And that's it. Just like that you can put Commands into RAM. Now another important step is getting them into RAM in the first place... I was ignorant way back when in trying to get rid of the initial loading of Dark Knight Cecil, but there should be other room to work with in that start of game section.

I would be safe just tying this process into the first part of a custom event instruction routine, rather than messing with the game start routines.


So... let's get to it!

This is one of my finest works, in my opinion, very simple and very efficient. Making use of another Dummy Movement Bit plan the game can change commands of characters on the fly! (A note, however. This is only intended to work with a certain configuration. Since it looks at Class now rather than Actor, you will want to change the first 13 Actors Commands to the overall Commands of the characters. You won't have to worry about Tellah's Recall since you can easily remove it with this Event Instruction hack).

Replacing Gil -100 XX to Moving the Battle Command Table/Changing Battle Commands by XX to YY.

First Time Using Instruction - These are the instructions that will play the first time the instructions are used it is Imperative that you put this as the first event in the game as this loads the Battle Commands into RAM.

Code: [Select]
$00/E97E A9 00 LDA #$00 A:00E9 X:0000 Y:0002 P:envMxdiZc - Load 00 into A.
$00/E980 CD A1 14 CMP $14A1  [$00:14A1] A:0000 X:0000 Y:0002 P:envMxdiZc - Does the Second Battle Command in RAM read 00 as well? (This would be a second Fight command in Dark Knight Cecil's Commands, as no player would want that, this assumes that the Battle Commands have not been placed in RAM.)
$00/E983 D0 15 BNE $15    [$E99A] A:0000 X:0000 Y:0002 P:envMxdiZC - Branch if it reads anything but 00.
$00/E985 A0 00 00 LDY #$0000 A:0000 X:0000 Y:0002 P:envMxdiZC - Load 0000 into Y.
$00/E988 A2 00 00 LDX #$0000 A:0000 X:0000 Y:0000 P:envMxdiZC - Load 0000 into X.
$00/E98B BF 55 FD 13 LDA $13FD55,x[$13:FD55] A:0000 X:0000 Y:0000 P:envMxdiZC - Load A from ROM Battle Commands.
$00/E98F 99 A0 14 STA $14A0,y[$00:14A0] A:0000 X:0000 Y:0000 P:envMxdiZC - Store A in New Battle Commands RAM Location.
$00/E992 E8 INX A:0000 X:0000 Y:0000 P:envMxdiZC - +1 to X
$00/E993 C8 INY A:0000 X:0001 Y:0000 P:envMxdizC - +1 to Y
$00/E994 C0 41 00 CPY #$0041 A:0000 X:0001 Y:0001 P:envMxdizC - Has it done this 65 times (13 x 5)?
$00/E997 D0 F2 BNE $F2    [$E98B] A:0000 X:0001 Y:0001 P:eNvMxdizc - If not, branch back.
--------------------------------------
$00/E999 60 RTS A:0001 X:0041 Y:0041 P:envMxdiZC - Return

And that's it for getting the Commands into RAM, note that there IS No Dummy Movement Byte for the Initialization!

Now to manipulate them you will need another Dummy Movement Bit in addition to your variable. Your Variable will be the Command you are changing another Command into. Your Dummy Movement byte will be the Slot of the Command you are changing. So for instance if you wanted to get rid of Tellah's Recall and put Item in it's place you would use...

"x50 Gil " - 01 (Item). And realizing that Tellah's commands would fall in the 16-20(Decimal) range you would set the Dummy Movement Bit to 13(Hex) 19(Dec) (NPC 2 Moves Down) - You would use another Event Instruction of x50 Gil set it to FF (Null) and use a Dummy Movement Bit of 14 (Hex) 20 (Dec) (NPC 2 Moves Left)

Once you get the hang of it, while a little cumbersome in the current event setup, it is much better than the alternative, which doesn't exist.

Changing Battle Commands

Code: [Select]
$00/E99A A2 00 00 LDX #$0000 A:0000 X:0000 Y:0002 P:eNvMxdizc - Load 0000 into X.
$00/E99D 20 CB E2 JSR $E2CB  [$00:E2CB] A:0000 X:0000 Y:0002 P:envMxdiZc - Jump to Event Instruction Progress Subroutine
$00/E2CB E8 INX A:0000 X:0000 Y:0002 P:envMxdiZc - +1.
$00/E2CC 86 B3 STX $B3    [$00:06B3] A:0000 X:0001 Y:0002 P:envMxdizc - Store X in Event Instruction Progress.
$00/E2CE BD D5 09 LDA $09D5,x[$00:09D6] A:0000 X:0001 Y:0002 P:envMxdizc - Load Event Variable (Battle Command) into A.
$00/E2D1 60 RTS A:0001 X:0001 Y:0002 P:envMxdizc - Return.
$00/E9A0 48 PHA A:0001 X:0001 Y:0002 P:envMxdizc - Push A onto Stack.
$00/E9A1 AE D3 09 LDX $09D3  [$00:09D3] A:0001 X:0001 Y:0002 P:envMxdizc - Load X from Event Progress (Dummy Movement Bit - Command Slot Location)
$00/E9A4 BF 00 82 12 LDA $128200,x[$12:826B] A:0001 X:006B Y:0002 P:envMxdizc - Load A from next Event Instruction.
$00/E9A8 AA TAX A:0012 X:006B Y:0002 P:envMxdizc - Transfer A to X.
$00/E9A9 68 PLA A:0012 X:0012 Y:0002 P:envMxdizc - Pull A from Stack.
$00/E9AA 9D A0 14 STA $14A0,x[$00:14B2] A:0001 X:0012 Y:0002 P:envMxdizc - Store Battle Command in Slot designated by Dummy Movement Bit.
$00/E9AD EE D3 09 INC $09D3  [$00:09D3] A:0001 X:0012 Y:0002 P:envMxdizc - +1 to Event Progress.
$00/E9B0 60 RTS A:0001 X:0012 Y:0002 P:envMxdizc - Return

Would you believe that setting this scheme up actually took less bytes than the initial -100 Gil command?

And there we have it! My crushed dreams of the past have finally been fulfilled. We may now alter character's battle commands in-game as easily as we can edit events!

Here is the process in pictures, using Tellah as the example (which the eagle-eyed among you may have noticed was the example within the actual code above)

As can be seen here, Tellah has his normal set-up. White, Black, Recall
(http://i112.photobucket.com/albums/n198/LastingDawn/FFIV%20-%20Battle%20Command%20Instruction%201_zpskynxhd7x.png) (http://s112.photobucket.com/user/LastingDawn/media/FFIV%20-%20Battle%20Command%20Instruction%201_zpskynxhd7x.png.html)

But with a little trip to our friendly Test Buddy Namingway...

(http://i112.photobucket.com/albums/n198/LastingDawn/FFIV%20-%20Battle%20Command%20Instruction%202_zpslstgmiui.png) (http://s112.photobucket.com/user/LastingDawn/media/FFIV%20-%20Battle%20Command%20Instruction%202_zpslstgmiui.png.html)

Tellah has forgotten Recall and Item has taken it's place! Take that original programmers of FFIV who used one of the Precious actor slots on getting rid of a single Command!

(http://i112.photobucket.com/albums/n198/LastingDawn/FFIV%20-%20Battle%20Command%20Instruction%203_zps9g8e3fp3.png) (http://s112.photobucket.com/user/LastingDawn/media/FFIV%20-%20Battle%20Command%20Instruction%203_zps9g8e3fp3.png.html)

Title: Re: Grimoire LD's Notes, Patches, and Hacks (Changing Battle Commands in Events!)
Post by: Grimoire LD on March 23, 2015, 11:28:18 AM
Well, I've come across an interesting realization...

The game only supports 23 (Hex) Commands by default because that is the length of the table. What is interesting about this is that the name table for the commands supports a whopping 1C extra support for Command names! (Not including commands that are used by the game but are not named such as Jump''s Return/Focus' Attack/Twincast Success/

If we could relocate the Command Table we could increase the amount of available commands to a much improved 3F (Decimal 63!) That is up from the default 1D (Decimal 29)

I see no reason not to try my hand at it. If it succeeds that means in combination with my Battle Command Switch Event we could have a much more robust Command system than the original FFIV had.

This would also mean that we'd have to change the locations of the Command Stances, but since they take up only one byte that shouldn't be too difficult.

...

Pointers - Check
Targeting - Check
Timers - Yet to do
Monster AI Bypass Routine - In progress

I'm making good progress, the last hurdle thus far has been the Monster AI Bypass. The game only ever intends the player to use commands from C0-E7, after which the command bytes take on Monster Parameters, for instance if I set my Command to 31 and use it, despite what formula it may have, it will still display a message because of the correlation with the Monster Parameters. My objective now is to force that information to JMP to a new section of data where I can create a conditional on whether a character or a monster is accessing that command (because players never use monster commands and monsters don't use anything else aside from fight.)



 :edit: Grr... After several hours of trying to make a workaround there is just too much linked into the position (animations are the big part) to go beyond the sponsored 27 line. So while I was able to set aside a new section for the pointers, stances, and targeting I couldn't actually use the expanded data in any meaningful way.  Despite coming so close, I am afraid this experiment was a failure.

Here is the information for anyone if they'd like to give it a shot. Maybe I'm missing something really simple.

Location of Command Pointers

08B850

(Change 03B160 to BF 50 BA 08) - New Location of Command Pointers

(Change 02B201 to BF 00 BB 08) - New Location of Command Stances

(Change 038BB3 to BF 80 BB 08) - New Location of Command Targets

Bah, hopefully my next experiment will be more fruitful.

 :edit: Important Note

The bank that the Command Routines are stored is not deadset to 03.

Purely because of...

03/B160   BF 50 BA 08   LDA $08BA50,x[$08:BA86]   A:0036   X:0036   Y:0000   P:envMxdizc
$03/B160   BF 50 BA 08   LDA $08BA50,x[$08:BAA0]   A:0050   X:0050   Y:0000   P:envMxdizc
$03/B164   85 80   STA $80    [$00:0080]   A:0052   X:0050   Y:0000   P:envMxdizc
$03/B166   BF 51 BA 08   LDA $08BA51,x[$08:BAA1]   A:0052   X:0050   Y:0000   P:envMxdizc
$03/B16A   85 81   STA $81    [$00:0081]   A:00E8   X:0050   Y:0000   P:eNvMxdizc
$03/B16C   A9 03   LDA #$03   A:00E8   X:0050   Y:0000   P:eNvMxdizc
$03/B16E   85 82   STA $82    [$00:0082]   A:0003   X:0050   Y:0000   P:envMxdizc

Does it look in Bank 3. We could technically move all of those to a more space-friendly bank if eventually desired.

 :edit:
E8-EF despite being AI Orders don't appear to react strangely like anything above F0 tends to do. So if I can get this working right I can at least get us 2F slots, rather than 1C. While a hit to the thought, it's better than abandoning the idea all together. The oddity in graphics mean very little if the new Commands they have include a couple of Audiovisual Cues of their own.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Changing Battle Commands in Events!)
Post by: Grimoire LD on March 25, 2015, 04:59:24 PM
I was going over this in my head and wondering "where can I find this space that will be needed for these new Command instructions? The 03 Bank is already glutted with an immense amount of data. Then it hit me, I won't Need to confine myself to a bank, the instructions right there show that it uses a variable number of bank. Expanding with a JSR to look for certain amounts beyond a certain range would be the most preferable way to to do this. In fact this could be the ticket for including more table subroutines for a variety of matters. Granted they don't coincide with a natural barrier. Commands are stuck at 3F Max because of the C0+ which is added for any and all commands. Events likewise are tied to their amount of 30 because of 00-CF being reserved for NPC movement.

What is not tied to a known limit though are Spell Subroutines. That number is never used for anything else that we are aware of outside of FF acting as Audiovisual Effect calls, but I think the more proper term for that may be "blank" because those sorts of calls are internally checking the spell number used. Play a Visual Effect Event Instruction should be similarly unbound. It's all a matter of finding a new space for the Tables to support more than their intended max.

I was also wrong about the F0-FF Commands(Except for F0 and F2, they do not function correctly, but I haven't ruled out that those are Timer issues, rather than anything wrong with the Hex assignment.) The F1+ Commands, if they are overwritten within their Command routine this causes no oddities. What this means, for me, is that my custom commands will largely be able to exist alongside the older commands, and while this would ordinarily be worthless because of only so many Command Slots a character would have (3 unique Commands for each character would only be decimal 39 (27 hex) and that''s not taking away slots devoted to magic use. When you factor those in it's a lot less at, decimal 28 (1C hex). So in a normal sense roughly 39-3A Commands is overkill, unless my new hack is taken into account. Imagine this scenario... 3 variants of Dark Wave. One is the traditional Dark Wave, 1/8 HP for low-decent physical damage. This is what Cecil starts with. But say the Training Hall is replaced with the "Command Hall"

Now, using my other Flag Check hack that would look to see if Dark Knight Cecil is in the party through the use of Flags, they will offer a change of command for a low price (might be free, if I can I may include some sort of Quasi-Job system where they may ask for a certain amount of battles fought before you can change command? It's all a little up in the air at the moment)

This would allow Cecil to change up Dark Wave for Combat Boost's Dark Omen, with the added stipulation of turning into a Zombie when used. The third one would be Darkness (Probably truncated down to Dark(Sword)- Which would give him x2 damage for the cost of 1/8 of his HP each time he attacks as a reference to the DS version.

These are all just ideas, but it would give a lot of use and variety to the game if used and balanced accordingly.

My end objective is to give as much room as possible for the determined hacker to fool around with, without the need to expand the Rom.

I'll make a new topic on this to get people's inputs on it to see if they have anything they would like to see expanded.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Changing Battle Commands in Events!)
Post by: Grimoire LD on March 28, 2015, 10:06:03 PM
Well, the good news is that my plan worked! There are now 3F amount of Command and Pointers and 7D worth of Spell Subroutine Pointers compared to the original 27 and 35. Now it comes to finding empty space for these new routines and that will quickly become a difficulty I would imagine. It's a place like this where an expanded ROM would be most desired, but alas it would break FF4kster compatibility.

There's empty space scattered about the ROM, but now knowing where Text begins and ends, I fear that some of these large swaths of empty information may be reserved for text...

So if anyone knows, could they divulge the locations of Text Locations and Maps? If I know the blank space is not revolving about them, then we should have a large amount of empty space.

 :edit: After a bit of research on the forums I found an old post from JCE3000GT in regards to empty space, and with his hacking document on rb.thundaga.com I also found what these empty spaces were correlated to (if known) and if they were safe to change. The vast majority were and I think I can say that we can create A Lot of new routines without any issue as far as space is concerned...


0001DE55 - 1195 Bytes!
00023C38-23C80
0023C94- 23FFF (A fair amount of Bytes.)
5FD58 - 680 Bytes!
6E3A0-6F25F EBF (3775 Bytes!)
977F0-97FFF - 80F (2063 Bytes!)

To put that into perspective the game uses Bank 03 for the Spell Subroutines and crams them into...
E02C
D388-

CA4 amount of Bytes, The section in Bank D0000 (6E3A0) holds EBF bytes alone more than enough space for any new routines, I would imagine.

Past the Fight Command, Damage Routines, and Spell Routines, the Commands become much more compact and take up maybe 1000 more bytes, which is of course, large, but with space available elsewhere, then there is no worries in terms of space so all of the (mostly useless) original commands can exist alongside brand new ones as the hacker chooses.

This gets rid of any space problem we've ever had as far as Battle is concerned.  There is also a large section of free space around 438B9, but this hack is using a Lot of that space for more table space, mostly.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Changing Battle Commands in Events!)
Post by: Pinkpuff on March 29, 2015, 07:38:01 AM
It's a place like this where an expanded ROM would be most desired, but alas it would break FF4kster compatibility.

I actually had an idea regarding this issue. It would be somewhat of an undertaking but I could make a config file that contains all the major addresses for data and code that people would be likely to move and then use that instead of hardcoded addresses.

The upside is that it would still work normally on a normal ROM if you change nothing, while at the same time allowing you to expand the rom and/or move things around and still use the editor.

The downside is that if you don't know the correct addresses for some reason or if you make a typo, KABOOM! Also it will take quite a bit of time and effort, meaning that's time and effort not spent on expanding the editor's functionality in other areas.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Changing Battle Commands in Events!)
Post by: Grimoire LD on March 29, 2015, 11:05:56 AM
It's a place like this where an expanded ROM would be most desired, but alas it would break FF4kster compatibility.

I actually had an idea regarding this issue. It would be somewhat of an undertaking but I could make a config file that contains all the major addresses for data and code that people would be likely to move and then use that instead of hardcoded addresses.

The upside is that it would still work normally on a normal ROM if you change nothing, while at the same time allowing you to expand the rom and/or move things around and still use the editor.

The downside is that if you don't know the correct addresses for some reason or if you make a typo, KABOOM! Also it will take quite a bit of time and effort, meaning that's time and effort not spent on expanding the editor's functionality in other areas.

While I was originally in favor of expanding the ROM, finding that extra space helps me immensely as far as the Routines are concerned.

My plan is to change the LDA XX, STA 82's that create dynamic addresses. use that to JSL to (likely the 08 bank area) Load the original Spell Subroutine OR Command Subroutine (due to slightly different data, they would have two similar, but different routines to reach their proper assigned new banks. If the Spell Subroutines read 35 or over, load the new bank's location in A. If it reads below, Load a 03 into A and store that in 82.

For Commands it would look past 27 for the same measures as listed above.

Therefore the new Commands and the old Commands could exist without any conflict and the same goes for the Spell Subroutines. The only that would need to be remembered is that these custom addresses will have to JSL (4 bytes instead of 3 bytes) to reach specific information pertaining to the 03 Bank.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Freeing Up Summon Spell Space)
Post by: Grimoire LD on March 30, 2015, 07:07:45 PM
As we all know in FFIV they use an idiotic method of reaching Summons. They use a byte within the valid 6 character names, then jump to the Summon outside of it to display the name and where the image is assigned. They waste 15 Spell Slots with this, seemingly all for the random effect of Asura (this could have been achieved with a unique routine, rather than wasting all of that space!) and a slightly longer name.

With recent talk of having spell names of 6 characters in the editor this seemed the best time to approach this problem.

So I did a little digging and found the answer, it was in a JSR that I called back in the day "unique to Summon Routine".

Code: [Select]
$03/E050 C9 3E CMP #$3E A:004F X:0000 Y:0000 P:eNvMxdizc - Is it Asura?
$03/E052 90 1A BCC $1A    [$E06E] A:004F X:0000 Y:0000 P:envMxdizC - If less than Asura branch.
-----------------------------------------------------------------------------------------------------------------------
$03/E054 C9 3F CMP #$3F A:004F X:0000 Y:0000 P:envMxdizC - Is it Bahamut?
$03/E056 D0 04 BNE $04    [$E05C] A:004F X:0000 Y:0000 P:envMxdizC - If not Bahamut, branch.
-----------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------
$03/E05C A2 00 00 LDX #$0000 A:004F X:0000 Y:0000 P:envMxdizC - Load 0000 into X.
$03/E05F A9 02 LDA #$02 A:004F X:0000 Y:0000 P:envMxdiZC - Load 02 into A.
$03/E061 20 79 83 JSR $8379  [$03:8379] A:0002 X:0000 Y:0000 P:envMxdizC - Jump to Subroutine (RNG between 00-02 to get the random result for Asura)
$03/E064 48 PHA A:0001 X:0000 Y:0000 P:envMxdizc -  - Push A onto Stack.
$03/E065 A9 F8 LDA #$F8 A:0001 X:0000 Y:0000 P:envMxdizc - Load F8 into A.
$03/E067 8D D4 26 STA $26D4  [$7E:26D4] A:00F8 X:0000 Y:0000 P:eNvMxdizc - Store A in Targeting (Target All Allies)
$03/E06A 68 PLA A:00F8 X:0000 Y:0000 P:eNvMxdizc - Pull A from Stack.
$03/E06B 18 CLC A:0001 X:0000 Y:0000 P:envMxdizc - Clear Carry Flag.
--------------------------------------------------------------------------------------------------------------
$03/E06C 69 3E ADC #$3E A:0001 X:0000 Y:0000 P:envMxdizc - Add 3E onto A (3E-40)
$03/E06E 38 SEC A:003F X:0000 Y:0000 P:envMxdizc  - Set Carry Flag
$03/E06F E9 31 SBC #$31 A:003F X:0000 Y:0000 P:envMxdizC - Subtract 31 from A.
$03/E071 18 CLC A:000E X:0000 Y:0000 P:envMxdizC - Clear Carry Flag.
$03/E072 69 4D ADC #$4D A:000E X:0000 Y:0000 P:envMxdizc - Add 4D onto A.
$03/E074 8D D2 26 STA $26D2  [$7E:26D2] A:005B X:0000 Y:0000 P:envMxdizc - That is the Random Asura  (or nomal summon)Action to Perform.

As you can imagine the issue purely comes from this setup. If you null the Storing at the end of the Routine the game will play out That Slot as the chosen summon meaning with the 6 Character Limit throughout the entirety of Spells, you free up the original location of Summons completely. With a slight rewrite Asura doesn't even have to lose her randomness but that math they use for it and making it apply to all Summons was just an idiotic idea when there was only so much Spell Space they had in the first place.

But this does it. Just null $03/E074   8D D2 26   STA $26D2 and you can use those Summon Slots anywhere and anyhow you like.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Freeing up Summon Spell Space!)
Post by: Pinkpuff on April 08, 2015, 07:45:31 AM
That's awesome!

I also had an idea for a spell routine I'd like to see (a couple actually ^_^):

Race-specific damage
Something like the "Harm"/"Dia" series from FF1. I was originally trying to achieve this by making a spell that healed all enemies; thus it doesn't hurt non-undeads but does hurt undeads. It just seems a little weird when a spell called "Harm" causes healing, especially if someone unfamiliar with the first game tries to cast it; they'd probably get super confused. Anyway it could be regular damage with a racial bonus, like attacks, or could only deal its damage to monsters of that race and miss on others (like Quake with fliers). Speaking of which...

Earth damage
Instead of the game looking for specific spell indexes, we could have a separate damage routine that causes damage only to non-flying enemies. Perhaps it could even be more generalized by looking at the element index ("damage all enemies that aren't weak to XX").

Full HP heal / Full MP heal (separate routines)
There is a routine for "Fully heal all HP and MP" but Cure 4 seems to have something special about it checking for its particular index that causes it to fully heal only HP, and only when it's single-targeted. It might be useful for hackers in general to have a routine that could fully heal all of either HP or MP but not the other.

Heal status + some HP
There is a routine for damage + add status, why not heal HP + remove status? Something like Chakra from FF5.

Damage + extended byte status
Currently Sap/HP-Leak is the only "extended" status you can add with damage. For that matter it might be nice to have a routine that can add an extended status (or combination thereof?) based on the element/status parameter rather than having one routine for stop, one for reflect, one for count, etc.

That's all I got for now, just trying to brainstorm for ideas. I might have more later ^_^
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Freeing up Summon Spell Space!)
Post by: Grimoire LD on April 08, 2015, 12:18:12 PM
That's awesome!

I also had an idea for a spell routine I'd like to see (a couple actually ^_^):

Race-specific damage
Something like the "Harm"/"Dia" series from FF1. I was originally trying to achieve this by making a spell that healed all enemies; thus it doesn't hurt non-undeads but does hurt undeads. It just seems a little weird when a spell called "Harm" causes healing, especially if someone unfamiliar with the first game tries to cast it; they'd probably get super confused. Anyway it could be regular damage with a racial bonus, like attacks, or could only deal its damage to monsters of that race and miss on others (like Quake with fliers). Speaking of which...

These are all interesting ideas PinkPuff! I love doing requests, as I've said many times "give me a line and I'll follow it to the end."

The only ones I find exception with is "Fully Restore HP & Fully Restore MP" because if that is the goal  why not just make a spell with 255 Power that Cures HP and one that Cures MP? It seems like it would be a waste of two routine slots when the game has a ready made manner of doing so.

As for Dia, I actually made a formula for that Long ago, haha. It was a replacement of Count's formula though.

$03/DBB5   AD 40 27   LDA $2740  [$7E:2740]   A:0003   X:0038   Y:0000   P:envMxdizc - Load Target's Creature Type into A.
$03/DBB8   29 80   AND #$80   A:0080   X:0038   Y:0000   P:eNvMxdizc - Is it Zombie?
$03/DBBA   D0 01   BNE $01    [$DBBD]   A:0080   X:0038   Y:0000   P:eNvMxdizc -If not, branch to 03DBBD.
--------------------------------------------------------------------------------------------
$03/DBBC   60    RTS   A:0000   X:0038   Y:FFFF   P:envMxdiZc - Return.
------------------------------------------------------------------------------------------------
$03/DBBD   20 AF C9   JSR $C9AF  [$03:C9AF]   A:0080   X:0038   Y:0000   P:eNvMxdizc - Jump to Damage Determination.
$03/DBBE   60    RTS   A:0080   X:0038   Y:FFFF   P:envMxdiZc - Return.

But this was done in very slight space. If I were to remake this I would make it so it would not be considered an elemental attack and the Eight Elemental designations would be the Race the formula has to match to deal damage. Adversely it could be no statuses allowed and use the Status designations as the Race matching, which sounds like it would work better as it would allow Elementals to work with it.

Quote
Earth damage
Instead of the game looking for specific spell indexes, we could have a separate damage routine that causes damage only to non-flying enemies. Perhaps it could even be more generalized by looking at the element index ("damage all enemies that aren't weak to XX").

I don't know why I never thought of this... yes this sounds like an easily workable idea. It would also fix the error in Combat Boost where the Gaia Drum doesn't count as an Earth type attack because of the Scholar Cap check. Making it more generalized is also a wonderful idea. Like say a massive Fire Attack "damage all enemies that aren't weak to Ice". Because generally that type of Foe would be Fire. If the Status Designation byte is used for the "If Weak to XX, Skip". that would work best.

Quote
Heal status + some HP
There is a routine for damage + add status, why not heal HP + remove status? Something like Chakra from FF5.

That is another great idea. In theory this is a simple request as you would just set a Jump to the Cure formula and then put another Jump to the "heal status routine".

Quote
Damage + extended byte status
Currently Sap/HP-Leak is the only "extended" status you can add with damage. For that matter it might be nice to have a routine that can add an extended status (or combination thereof?) based on the element/status parameter rather than having one routine for stop, one for reflect, one for count, etc.

That's all I got for now, just trying to brainstorm for ideas. I might have more later ^_^

This could really make it a simpler matter instead of having everything split up as you said... but they are normally split for a reason.

Blink/Reflect/Stop/Count/HP Leak/Covered/Barrier could be condensed into one Routine that use the Elementals  would then jump to the appropriate data so while it would save on the pointer space which could be critical for a hack which doesn't want to expand them but is not adverse to using free space. It could be linked to the Elementals and designate itself from there.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Freeing up Summon Spell Space!)
Post by: Pinkpuff on April 16, 2015, 05:02:00 AM
As for Dia, I actually made a formula for that Long ago, haha. It was a replacement of Count's formula though.

$03/DBB5   AD 40 27   LDA $2740  [$7E:2740]   A:0003   X:0038   Y:0000   P:envMxdizc - Load Target's Creature Type into A.
$03/DBB8   29 80   AND #$80   A:0080   X:0038   Y:0000   P:eNvMxdizc - Is it Zombie?
$03/DBBA   D0 01   BNE $01    [$DBBD]   A:0080   X:0038   Y:0000   P:eNvMxdizc -If not, branch to 03DBBD.
--------------------------------------------------------------------------------------------
$03/DBBC   60    RTS   A:0000   X:0038   Y:FFFF   P:envMxdiZc - Return.
------------------------------------------------------------------------------------------------
$03/DBBD   20 AF C9   JSR $C9AF  [$03:C9AF]   A:0080   X:0038   Y:0000   P:eNvMxdizc - Jump to Damage Determination.
$03/DBBE   60    RTS   A:0080   X:0038   Y:FFFF   P:envMxdiZc - Return.

Ok so if I apply this as specified above, the "add Count" routine will instead become "Undead Damage", allowing me to make Harm/Dia spells but breaking any existing Count spells/techniques?

But this was done in very slight space. If I were to remake this I would make it so it would not be considered an elemental attack and the Eight Elemental designations would be the Race the formula has to match to deal damage. Adversely it could be no statuses allowed and use the Status designations as the Race matching, which sounds like it would work better as it would allow Elementals to work with it.

Personally I'd prefer to keep the statuses; usually races and weaknesses match up pretty well (undeads = fire/holy, reptiles = ice, robots = bolt, etc), and even where they don't it just seems more interesting to have f.ex. Undead Damage + Blind, or Undead Damage + Mute, than to have, say, Fire Undead Damage or Ice Undead Damage...

Also, another idea:

Damage based on target's current HP / Damage based on caster's Max HP
The game already has the reverse of these, a routine for damage based on caster's current HP and one for damage based on target's Max HP. But it would be nice to be able to do the opposite sometimes. For example, in my hack, Demi is currently dealing damage equal to target's Max HP / 4. Ideally, it should be dealing target's current HP / 2.

Fixed Damage
Damage that always hits and somehow ignores the normal damage dealing routine that modifies damage based on weaknesses and resistances and such, and instead deals a constant amount of damage no matter what. For example, 1000 Needles from the subsequent FF games. Perhaps the amount can be specified by the Power byte x the Hit byte? So to get 1000 you could have 100 Power and 10 Hit or vice versa. To get Globe199 you could have 100 Power and 100 Hit (presumably the game would apply the usual damage cap to prevent things from going wonkee). You could even have smaller versions for earlier in the game, like "100 Needles" or something. I dunno, might be interesting.

Also, back on the topic of custom event instructions, I thought of something that might be useful in certain contexts:

"Remove spell xx from spell set yy"

In fact, it may not even need to be its own instruction; maybe it could just be a modification of the existing "Add spell" instruction to make it into a sort of "Toggle spell"; so I guess it would first check if the spell is in the set, and if it is, remove it, otherwise add it.

This might be usable to, for example, have an event something like Rydia's Trial from FF4 Advance. She forgets a bunch of summons when you enter and you have to add them back one by one. Or perhaps some kind of event where Tellah forgets a bunch of spells again and has to get them back somehow or something. Just a thought ^_^
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Freeing up Summon Spell Space!)
Post by: chillyfeez on April 16, 2015, 07:28:41 PM
I made both a Gravity routine (damage based on target's current HP) and a 1000 needles routine (damage in specified multiples of 1000) in my hack. In each case, the spell's "power" works as the variable operand (so there's Gravity 1, 2 and 3; and 1000 Needles and 10000 Needles)
I can dig 'em up for you if you want...
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Freeing up Summon Spell Space!)
Post by: Grimoire LD on April 16, 2015, 07:59:01 PM
As for Dia, I actually made a formula for that Long ago, haha. It was a replacement of Count's formula though.

$03/DBB5   AD 40 27   LDA $2740  [$7E:2740]   A:0003   X:0038   Y:0000   P:envMxdizc - Load Target's Creature Type into A.
$03/DBB8   29 80   AND #$80   A:0080   X:0038   Y:0000   P:eNvMxdizc - Is it Zombie?
$03/DBBA   D0 01   BNE $01    [$DBBD]   A:0080   X:0038   Y:0000   P:eNvMxdizc -If not, branch to 03DBBD.
--------------------------------------------------------------------------------------------
$03/DBBC   60    RTS   A:0000   X:0038   Y:FFFF   P:envMxdiZc - Return.
------------------------------------------------------------------------------------------------
$03/DBBD   20 AF C9   JSR $C9AF  [$03:C9AF]   A:0080   X:0038   Y:0000   P:eNvMxdizc - Jump to Damage Determination.
$03/DBBE   60    RTS   A:0080   X:0038   Y:FFFF   P:envMxdiZc - Return.

Ok so if I apply this as specified above, the "add Count" routine will instead become "Undead Damage", allowing me to make Harm/Dia spells but breaking any existing Count spells/techniques?

Yes... it is a bit of a mess and as I've said I have been meaning to redo it. Since I have the basics of the Job hack worked out, I will try to get to your requests in the coming days.
Quote
But this was done in very slight space. If I were to remake this I would make it so it would not be considered an elemental attack and the Eight Elemental designations would be the Race the formula has to match to deal damage. Adversely it could be no statuses allowed and use the Status designations as the Race matching, which sounds like it would work better as it would allow Elementals to work with it.

Personally I'd prefer to keep the statuses; usually races and weaknesses match up pretty well (undeads = fire/holy, reptiles = ice, robots = bolt, etc), and even where they don't it just seems more interesting to have f.ex. Undead Damage + Blind, or Undead Damage + Mute, than to have, say, Fire Undead Damage or Ice Undead Damage...

You make a good point. Status infliction it is then!

Quote
Also, another idea:

Damage based on target's current HP / Damage based on caster's Max HP
The game already has the reverse of these, a routine for damage based on caster's current HP and one for damage based on target's Max HP. But it would be nice to be able to do the opposite sometimes. For example, in my hack, Demi is currently dealing damage equal to target's Max HP / 4. Ideally, it should be dealing target's current HP / 2.

Fixed Damage
Damage that always hits and somehow ignores the normal damage dealing routine that modifies damage based on weaknesses and resistances and such, and instead deals a constant amount of damage no matter what. For example, 1000 Needles from the subsequent FF games. Perhaps the amount can be specified by the Power byte x the Hit byte? So to get 1000 you could have 100 Power and 10 Hit or vice versa. To get Globe199 you could have 100 Power and 100 Hit (presumably the game would apply the usual damage cap to prevent things from going wonkee). You could even have smaller versions for earlier in the game, like "100 Needles" or something. I dunno, might be interesting.

Looks like Chillyfeez has got those handled. I imagine those will be quite simple. I could be wrong though.


Quote
Also, back on the topic of custom event instructions, I thought of something that might be useful in certain contexts:

"Remove spell xx from spell set yy"

In fact, it may not even need to be its own instruction; maybe it could just be a modification of the existing "Add spell" instruction to make it into a sort of "Toggle spell"; so I guess it would first check if the spell is in the set, and if it is, remove it, otherwise add it.

This might be usable to, for example, have an event something like Rydia's Trial from FF4 Advance. She forgets a bunch of summons when you enter and you have to add them back one by one. Or perhaps some kind of event where Tellah forgets a bunch of spells again and has to get them back somehow or something. Just a thought ^_^

I was just thinking about this as well. It was the original idea behind my Job Change hack when it was still a dismal "use as many events as possible!" idea, rather than tying everything directly into equipment. In theory it shouldn't be too difficult. I will need to explore how that event is put together. I feel good about the chances of its success though.

Title: Re: Grimoire LD's Notes, Patches, and Hacks (Freeing up Summon Spell Space!)
Post by: chillyfeez on April 16, 2015, 10:41:30 PM
I remember something weird happening with my 1000 needles routine... I'll have to go back and look again, but I think it didn't work right when the multiple was 1, so I ended up making a 500*[spell power] routine, and spell power was 2 for 1000 needles.
Other than that, these two routines were pretty simple.
The gravity routine is a carbon copy of "damage based on target's max HP" except it draws on current HP.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (A Working Job System!)
Post by: Grimoire LD on April 27, 2015, 11:31:22 PM
I have Finally completed my Job Change system! It took a long time, and was a lot of work, but I have everything, and I mean Everything working to my optimum specifications!

This will be a bit different from my other code postings as this will have information from several places in LoROM rather than one place. I was hesitant to post this for several weeks because it had been in a constant state of motion, but this is now working better than I had hoped so here we go.

Changing Job Names -
The way the game changes Jobs in this hack is to look at the Accessory the character has equipped (hitherto known as Jobs in any reference) when the Equip screen is activated or is left.

Code: [Select]
$01/DFC5 B9 32 00 LDA $0032,y[$7E:1072] A:FF00 X:1040 Y:1040 P:envMxdIzc - Load Character's Job into A.
$01/DFC8 D0 04 BNE $04    [$DFCE] A:FF9D X:1040 Y:1040 P:eNvMxdIzc - If not 00, branch.
-------------------------------
$01/DFCA B9 01 00 LDA $0001,y[$7E:1001] A:FF00 X:1000 Y:1000 P:envMxdIZc
$01/DFCD 60 RTS A:FF0B X:1000 Y:1000 P:envMxdIzc
---------------------
$01/DFCE E9 8D SBC #$8D A:FF9D X:1040 Y:1040 P:eNvMxdIzc
$01/DFD0 99 2F 00 STA $002F,y[$7E:106F] A:FF0F X:1040 Y:1040 P:envMxdIzC
$01/DFD3 B9 2F 00 LDA $002F,y[$7E:106F] A:FF0F X:1040 Y:1040 P:envMxdIzC
$01/DFD6 60 RTS A:FF0F X:1040 Y:1040 P:envMxdIzC

(The code being left open like that is to make the text properly read it for the extended Job Names)

Places Commands into Character's Commands in RAM dependent on Job Equipped.

Code: [Select]
$00/FDE5 A9 05 LDA #$05 A:0000 X:0000 Y:0000 P:envMxdIZc - Load 05 into A.
$00/FDE7 85 AB STA $AB    [$00:00AB] A:0005 X:0000 Y:0000 P:envMxdIzc - Store A in AB.
$00/FDE9 A6 FE LDX $FE    [$00:00FE] A:0005 X:0000 Y:0000 P:envMxdIzc - Load X from FE (That is a bit of prior custom code since A6  is not active at this time which ordinarily stores current slot)
$00/FDEB BD 32 20 LDA $2032,x[$7E:2032] A:0005 X:0000 Y:0000 P:envMxdIZc - Load Character's Job.
$00/FDEE D0 04 BNE $04    [$FDF4] A:009F X:0000 Y:0000 P:eNvMxdIzc - If there is a job, branch.
-----------------------------------------------
$00/FDF0 5C A1 8B 03 JMP $038BA1[$03:8BA1] A:001A X:0014 Y:0014 P:envMxdIzC - If no job equipped Jump back to normal routine.
--------------------------------------------
$00/FDF4 A2 00 00 LDX #$0000 A:009F X:0000 Y:0000 P:eNvMxdIzc - Load 0000 into X.
$00/FDF7 E9 9B SBC #$9B A:009F X:0000 Y:0000 P:envMxdIZc - Subtract 9B from Job (to reach actual job commands)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Looping Point)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
$00/FDF9 F0 08 BEQ $08    [$FE03] A:0003 X:0000 Y:0000 P:envMxdIzC - If 00, branch.
$00/FDFB E8 INX A:0003 X:0000 Y:0000 P:envMxdIzC -  +5 to X
$00/FDFC E8 INX A:0003 X:0001 Y:0000 P:envMxdIzC
$00/FDFDE8 INX A:0003 X:0002 Y:0000 P:envMxdIzC
$00/FDFE E8 INX A:0003 X:0003 Y:0000 P:envMxdIzC
$00/FDFF E8 INX A:0003 X:0004 Y:0000 P:envMxdIzC
$00/FE00 3A DEC A A:0003 X:0005 Y:0000 P:envMxdIzC - -1 from A
$00/FE01 80 F6 BRA $F6    [$FDF9] A:0002 X:0005 Y:0000 P:envMxdIzC - Loop back (In other words this is setting X to the value of the Job''s Commands)
~~~~~~~~~~~~~~~~~~~~~(Looping Point)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$00/FE03 BF 48 FE 0B LDA $0BFE48,x[$0B:FE57] A:0000 X:000F Y:0000 P:envMxdIZC - Load A from New Location of Commands.
$00/FE07 99 03 33 STA $3303,y[$7E:3303] A:0000 X:000F Y:0000 P:envMxdIZC - Store A in RAM Command.
$00/FE0A C9 FF CMP #$FF A:0000 X:000F Y:0000 P:envMxdIZC - Is it Nothing?
$00/FE0C D0 03 BNE $03    [$FE11] A:0000 X:000F Y:0000 P:envMxdIzc - If not, branch.
----------------------------------------------------------
 00/FE0E DA PHX A:001A X:0014 Y:0014 P:envMxdIzC - Push X onto Stack
$00/FE0F 80 06 BRA $06    [$FE17] A:001A X:0014 Y:0014 P:envMxdIzC - Branch Always.
--------------------------------------------------------------
$00/FE11 DA PHX A:0000 X:000F Y:0000 P:envMxdIzc - Push Command onto Stack.
$00/FE12 AA TAX A:0000 X:000F Y:0000 P:envMxdIzc - Transfer Command to A.
$00/FE13 BF 80 BB 08 LDA $08BB80,x[$08:BB80] A:0000 X:0000 Y:0000 P:envMxdIZc - Load A from New Location of Command Timers.
$00/FE17 99 02 33 STA $3302,y[$7E:3302] A:0050 X:0000 Y:0000 P:envMxdIzc - Store A in command Timer. (The first time always assumes the command is Fight)
$00/FE1A FA PLX A:0050 X:0000 Y:0000 P:envMxdIzc - Pull X.
$00/FE1B E8 INX A:0050 X:000F Y:0000 P:envMxdIzc - +1 X
$00/FE1C C8 INY A:0050 X:0010 Y:0000 P:envMxdIzc - +4 Y
$00/FE1D C8 INY A:0050 X:0010 Y:0001 P:envMxdIzc
$00/FE1E C8 INY A:0050 X:0010 Y:0002 P:envMxdIzc
$00/FE1F C8 INY A:0050 X:0010 Y:0003 P:envMxdIzc
$00/FE20 C6 AB DEC $AB    [$00:00AB] A:0050 X:0010 Y:0004 P:envMxdIzc -1 from Command Amount
$00/FE22 A5 AB LDA $AB    [$00:00AB] A:0050 X:0010 Y:0004 P:envMxdIzc - Load Command Amount
$00/FE24 D0 DD BNE $DD    [$FE03] A:0004 X:0010 Y:0004 P:envMxdIzc - Loop if not 00.
---------------------------------------------------------------------------------------
$00/FE26 5C C6 8B 03 JMP $038BC6[$03:8BC6] A:0000 X:0014 Y:0014 P:envMxdIZ - Return to original routine


Next is the largest part and easily my magnum opus of custom hacking... the way the Job System actually works, the progression it takes and uses and the Job Level Up system.

Everything else in this from the Job Names and the Commands has been small fry compared to this!


Job System Progression

This was the crux of the work and I worked and reworked this routine many times over the last few weeks, but I have it Exactly where I want it. Through this I have completely skipped the ordinary means of learning magic (much of the magic learning routine was cannabalized) by Level Up and instead the Level Up Counters are used for Job Tracking Counters. Every Job learns up to Eight Spells and every Job Level gives a random stat gain.

Note (This runs out of the Exp. Routine hence why at the start and end there are some references to that)

Code: [Select]
$00/FE30 85 AF STA $AF    [$00:00AF] A:0000 X:0000 Y:002D P:envMxdiZc - Store 3rd Exp byte in AF.
$00/FE32 48 PHA A:0000 X:0000 Y:002D P:envMxdiZc - Push A
$00/FE33 5A PHY A:0000 X:0000 Y:002D P:envMxdiZc - Push Y.
$00/FE34 BD 32 10 LDA $1032,x[$7E:1032] A:0000 X:0000 Y:002D P:envMxdiZc - Load Character's Job.
$00/FE37 D0 0A BNE $0A    [$FE43] A:009F X:0000 Y:002D P:eNvMxdizc - Branch if Job Present.
--------------------------------------------------
$00/FE38 0A ASL A A:0000 X:0011 Y:002D P:envMxdiZC - x2 A.
$00/FE39 BD 01 10 LDA $1001,x[$7E:1000] A:0000 X:0011 Y:002D P:envMxdiZC - Load Character's Class.
$00/FE3C 29 0F AND #$0F A:0000 X:0011 Y:002D P:envMxdiZC - Get rid of bits.
$00/FE3E 20 A0 FF JSR $FFA0  [$00:FFA0] A:0000 X:0011 Y:002D P:envMxdiZC - Jump to subroutine (See below)
$00/FE41 80 02 BRA $02    [$FE45] A:0000 X:0011 Y:002D P:envMxdiZC - Branch Always.
--------------------------------------------------
$00/FE43 E9 8D SBC #$8D A:009F X:0000 Y:002D P:eNvMxdizc - Subtract 8D to reach 0E+ for the Jobs.
--------------------
$00/FE45 AA TAX A:0011 X:0000 Y:002D P:envMxdizC - Transfer Job to X.
$00/FE46 BD A0 14 LDA $14A0,x[$7E:14B1] A:0011 X:0011 Y:002D P:envMxdizC - Load A from Job Tracker
$00/FE49 C9 FF CMP #$FF A:0000 X:0011 Y:002D P:envMxdiZC - Is it 255?
$00/FE4B F0 03 BEQ $03    [$FE50] A:0000 X:0011 Y:002D P:envMxdizc - If so, branch.
------------------------------------------------------------------------------
$00/FE4D FE A0 14 INC $14A0,x[$7E:14B1] A:0000 X:0011 Y:002D P:envMxdizc +1 to Job Tracker.
------------------------------------------------------------------------------
$00/FE50 BD A0 14 LDA $14A0,x[$7E:14B1] A:0000 X:0011 Y:002D P:envMxdizc - Load Job Tracker into A.
$00/FE53 85 B5 STA $B5    [$00:00B5] A:0001 X:0011 Y:002D P:envMxdizc - Store Job Tracker into Storage.
$00/FE57 BD 32 10 LDA $1032,x[$7E:1032] A:0001 X:0000 Y:002D P:envMxdiZc - Load Job into A.
$00/FE5A F0 06 BEQ $06    [$FE62] A:009F X:0000 Y:002D P:eNvMxdizc - If no Job, branch.
---------------------------------------------------------------------------------------------------
$00/FE5C BD 2F 10 LDA $102F,x[$7E:102F] A:009F X:0000 Y:002D P:eNvMxdizc - Load Job Byte 2 into A.
$00/FE5F 3A DEC A A:0011 X:0000 Y:002D P:envMxdizc - -1 from A.
$00/FE60 80 08 BRA $08    [$FE6A] A:0010 X:0000 Y:002D P:envMxdizc - Branch Always.
------------------------------------------------------------------------------
$00/FE62 BD 01 10 LDA $1001,x[$7E:1001] A:0010 X:0000 Y:002D P:envMxdizc - Load A from Class.
$00/FE65 29 0F AND #$0F A:0010 X:0000 Y:002D P:envMxdizc - Get rid of bits.
$00/FE67 20 A0 FF JSR $FFA0  [$00:FFA0] A:0010 X:0000 Y:002D P:envMxdi - Jump to Subroutine (See below)
-------------------------------------------------------------------------------
$00/FE6A AA TAX A:0010 X:0000 Y:002D P:envMxdizc  - Transfer Job Byte 2 to X.
$00/FE6B A9 00 LDA #$00 A:0010 X:0010 Y:002D P:envMxdizc - Load 00 into A.
$00/FE6D A8 TAY A:0000 X:0010 Y:002D P:envMxdiZc - Transfer A to Y. (Clear A and Y basically)
$00/FE6E C2 30 REP #$30 A:0000 X:0010 Y:0000 P:envMxdiZc - Set A to 16 bit (to hold 4 digits)
~~~~~~~~~~~~~~(Looping Point~~~~~~~~~~~~~~~~~
$00/FE70 E0 00 00 CPX #$0000 A:0000 X:0010 Y:0000 P:envmxdiZc - Is X 0000?
$00/FE73 F0 06 BEQ $06    [$FE7B] A:0000 X:0010 Y:0000 P:envmxdizC - If so, branch
---------------------------------------------------------------------------
$00/FE75 69 0F 00 ADC #$000F A:0000 X:0010 Y:0000 P:envmxdizC - Add 0F (10 actually) into A.
$00/FE78 CA DEX A:0010 X:0010 Y:0000 P:envmxdizc - -1 to X.
$00/FE79 80 F5 BRA $F5    [$FE70] A:0010 X:000F Y:0000 P:envmxdizc - Loop back
(This lets the Job or Class get to the appropriate Job Level Checker)
-------------------------------------------------------------------------------
$00/FE7B AA TAX A:0100 X:0000 Y:0000 P:envmxdiZC  - Transfer Job Level Checker Location into X.
$00/FE7C 7B TDC A:0100 X:0100 Y:0000 P:envmxdizC - Clear A.
$00/FE7D E2 20 SEP #$20 A:0000 X:0100 Y:0000 P:envmxdiZC - Set Processor Status back to 8 Bit.
~~~~~~~~~~~~~~~~(Looping Point)-----------------------------------
$00/FE7F BF 40 C6 0F LDA $0FC640,x[$0F:C740] A:0000 X:0100 Y:0000 P:envMxdiZC - Load A from new Job Level Section
$00/FE83 C5 B5 CMP $B5    [$00:00B5] A:00FF X:0100 Y:0000 P:eNvMxdizC - Does it match the Stored Job Tracker?
$00/FE85 F0 0E BEQ $0E    [$FE95] A:00FF X:0100 Y:0000 P:eNvMxdizC - If so, branch.
$00/FE87 E8 INX A:00FF X:0100 Y:0000 P:eNvMxdizC - +2 to X. (Moves it to the next byte to check)
$00/FE88 E8 INX A:00FF X:0101 Y:0000 P:envMxdizC
$00/FE89 C8 INY A:00FF X:0102 Y:0000 P:envMxdizC - +1 to Y
$00/FE8A C0 08 00 CPY #$0008 A:00FF X:0102 Y:0001 P:envMxdizC - If Y is 0008 (As in its read all available Job Levels) ...
$00/FE8D D0 F0 BNE $F0    [$FE7F] A:00FF X:0102 Y:0001 P:eNvMxdizc - Do not Loop.
----------------------------------------------------------------------------------
$00/FE8F A6 A6 LDX $A6    [$00:00A6] A:00FF X:0110 Y:0008 P:envMxdiZC - Load Slot into A.
$00/FE91 EA NOP A:00FF X:0000 Y:0008 P:envMxdiZC 
$00/FE92 68 PLA A:00FF X:0000 Y:0008 P:envMxdiZC - Return original Exp numbers back into their proper registers
$00/FE93 7A PLY A:002D X:0000 Y:0008 P:envMxdizC
$00/FE94 6B RTL A:002D X:0000 Y:0000 P:envMxdiZC - Return.
(This is read at this time if it fails to find a spell in the Job Level Checker)
------------------------------------------------------------------------------------
$00/FE95 E8 INX A:0001 X:00D0 Y:0000 P:envMxdiZC  - +1 to X.
$00/FE96 BF 40 C6 0F LDA $0FC640,x[$0F:C711] A:0001 X:00D1 Y:0000 P:envMxdizC - Load A from Job Level Checker Spell.
$00/FE9A 48 PHA A:0084 X:00D1 Y:0000 P:eNvMxdizC - Push Spell onto Stack.
$00/FE9B A6 A6 LDX $A6    [$00:00A6] A:0084 X:00D1 Y:0000 P:eNvMxdizC - Load Slot into X.
$00/FE9D 9B TXY A:0084 X:0040 Y:0000 P:envMxdizC - Transfer Slot to Y.
$00/FE9E BD 01 10 LDA $1001,x[$7E:1041] A:0084 X:0040 Y:0040 P:envMxdizC - Load Character's Slot.
$00/FEA1 20 A0 FF JSR $FFA0  [$00:FFA0] A:0001 X:0040 Y:0040 P:envMxdizC - Jump to Subroutine (See Below)
~~~~~~~~~~~~~~~~~~~~~(Looping Point)~~~~~~~~~~~~~~~~~~~~~~
$00/FEA4 E0 00 00 CPX #$0000 A:0001 X:0001 Y:0040 P:envMxdizc - Is X 0000?
$00/FEA7 F0 05 BEQ $05    [$FEAE] A:0001 X:0001 Y:0040 P:envMxdizC - Branch if so.
$00/FEA9 69 16 ADC #$16 A:0001 X:0001 Y:0040 P:envMxdizC - Add 16 (17 with Carry) onto A. (This is 23, the amount of Spells in a Spellbook)
$00/FEAB CA DEX A:0018 X:0001 Y:0040 P:envMxdizc - -1 to X (This reaches the proper spellbook)
$00/FEAC 80 F6 BRA $F6    [$FEA4] A:0018 X:0000 Y:0040 P:envMxdiZc - Loop back.
----------------------------------------------------------------------------------
$00/FEAE AA TAX A:0018 X:0000 Y:0040 P:envMxdiZC  - Transfer A to X.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Looping Point)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$00/FEAF BD 60 15 LDA $1560,x[$7E:1578] A:0018 X:0018 Y:0040 P:envMxdizC - Load Spellbook start into A.
$00/FEB2 F0 03 BEQ $03    [$FEB7] A:0084 X:0018 Y:0040 P:eNvMxdizC - Branch if nothing is in this byte.
-------------------------------------------------------------------------------------------------
$00/FEB4 E8 INX A:0084 X:0018 Y:0040 P:eNvMxdizC +1 to X (to reach the next slot)
$00/FEB5 80 F8 BRA $F8    [$FEAF] A:0084 X:0018 Y:0040 P:eNvMxdizC - Loop Back
$00/FEB7 68 PLA A:0084 X:0018 Y:0040 P:eNvMxdizC - Pull Spell from Stack.
$00/FEB8 9D 60 15 STA $1560,x[$7E:1578] A:0084 X:0018 Y:0040 P:eNvMxdizC - Store A in Spellbook.
$00/FEBB 22 11 F1 03 JSL $03F111[$03:F111] A:0084 X:0018 Y:0040 P:eNvMxdizC - Jump to Message & Random Stat Gain Subroutine
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/F111 85 FE STA $FE    [$00:00FE] A:0084 X:0018 Y:0040 P:eNvMxdizC - Store Spell in FE.
$03/F113 C2 30 REP #$30 A:0084 X:0018 Y:0040 P:eNvMxdizC - Set A to 16 Bit.
$03/F115 A6 A6 LDX $A6    [$00:00A6] A:0084 X:0018 Y:0040 P:eNvmxdizC - Load X from Slot.
$03/F117 8A TXA A:0084 X:0040 Y:0040 P:envmxdizC - Transfer X to A.
$03/F118 A2 00 00 LDX #$0000 A:0040 X:0040 Y:0040 P:envmxdizC - Load 0000 into X.
~~~~~~~~~~~~~~~~~~~~(Looping Point)~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/F11B C9 00 00 CMP #$0000 A:0040 X:0000 Y:0040 P:envmxdiZC - Is A 0000?
$03/F11E F0 06 BEQ $06    [$F126] A:0040 X:0000 Y:0040 P:envmxdizC - Branch if so.
---------------------------------------------------------------------------------------------
$03/F120 E9 40 00 SBC #$0040 A:0040 X:0000 Y:0040 P:envmxdizC - -40 from A (This lets it reach the appropriate slot for the message subroutine since that uses 00-04 to display the appropriate character's name.)
$03/F123 E8 INX A:0000 X:0000 Y:0040 P:envmxdiZC - +1 to X.
$03/F124 80 F5 BRA $F5    [$F11B] A:0000 X:0001 Y:0040 P:envmxdizC - Loop back.
---------------------------------------------------------------------------------------------
$03/F126 E2 20 SEP #$20 A:0000 X:0001 Y:0040 P:envmxdiZC - Set A back to 8-Bit
$03/F128 8A TXA A:0000 X:0001 Y:0040 P:envMxdiZC - Transfer X to A.
$03/F129 8D 9A 35 STA $359A  [$7E:359A] A:0001 X:0001 Y:0040 P:envMxdizC - Store A in Code Display Byte.
$03/F12C A9 07 LDA #$07 A:0001 X:0001 Y:0040 P:envMxdizC - Load Alert 07 (Unused normally) into A. (Here is it (Character) Job Level Up!)
$03/F12E 8D CA 34 STA $34CA  [$7E:34CA] A:0007 X:0001 Y:0040 P:envMxdizC - Store A in Message Display Bye.
$03/F131 A9 05 LDA #$05 A:0007 X:0001 Y:0040 P:envMxdizC - Load 05 into A (??)
$03/F133 20 85 80 JSR $8085  [$03:8085] A:0005 X:0001 Y:0040 P:envMxdizC - Jump to Message Display Subroutine.
03/F136 A9 23 LDA #$23 A:0000 X:7940 Y:0004 P:envMxdiZC - Load "Learned X" into A.
$03/F138 8D CA 34 STA $34CA  [$7E:34CA] A:0023 X:7940 Y:0004 P:envMxdizC - Store A in Message Display Byte.
$03/F13B A5 FE LDA $FE    [$00:00FE] A:0023 X:7940 Y:0004 P:envMxdizC - Load Spell from Storage.
$03/F13D C9 FF CMP #$FF A:0084 X:7940 Y:0004 P:eNvMxdizC - Is the spell FF (This is used if a character is gaining a Job Level, but Not learning a Spell)
$03/F13F F0 08 BEQ $08    [$F149] A:0084 X:7940 Y:0004 P:eNvMxdizc - If so, branch past.
-------------------------------------------------------
$03/F141 8D 9A 35 STA $359A  [$7E:359A] A:0084 X:7940 Y:0004 P:eNvMxdizc - Store A in Code Display Byte.
$03/F144 A9 05 LDA #$05 A:0084 X:7940 Y:0004 P:eNvMxdizc - Load 05 into A.
$03/F146 20 85 80 JSR $8085  [$03:8085] A:0005 X:7940 Y:0004 P:envMxdizc - Jump to Message Display Subroutine
------------------------------------------------------
$03/F149 A2 00 00 LDX #$0000 A:0000 X:7940 Y:0004 P:envMxdiZC - Load 0000 into X.
$03/F14C A9 04 LDA #$04 A:0000 X:0000 Y:0004 P:envMxdiZC - Load 04 into A.
$03/F14E 20 79 83 JSR $8379  [$03:8379] A:0004 X:0000 Y:0004 P:envMxdizC - RNG these two values.
$03/F151 85 FE STA $FE    [$00:00FE] A:0000 X:0000 Y:0004 P:envMxdizc - Store RNG in Storage.
$03/F153 A5 A6 LDA $A6    [$00:00A6] A:0000 X:0000 Y:0004 P:envMxdizc - Load Slot into A.
$03/F155 65 FE ADC $FE    [$00:00FE] A:0040 X:0000 Y:0004 P:envMxdizc - Add RNG onto Slot.
$03/F157 AA TAX A:0040 X:0000 Y:0004 P:envMxdizc - Transfer A to X. (This lets it reach the proper character's stats)
$03/F158 BD 0F 10 LDA $100F,x[$7E:104F] A:0040 X:0040 Y:0004 P:envMxdizc - Load Character Stat into A.
$03/F15B 1A INC A A:000B X:0040 Y:0004 P:envMxdizc +1 to A.
$03/F15C C9 64 CMP #$64 A:000C X:0040 Y:0004 P:envMxdizc - Is it 100?
$03/F15E D0 02 BNE $02    [$F162] A:000C X:0040 Y:0004 P:eNvMxdizc - If not, branch.
-----------------------------------------------------------------------------------
$03/F160 A9 63 LDA #$63 A:000C X:0040 Y:0004 P:eNvMxdizc - Load 99 into A.
-------------------------------------------------------------
$03/F162 9D 0F 10 STA $100F,x[$7E:104F] A:000C X:0040 Y:0004 P:eNvMxdizc - Store A in Stat.
$03/F165 6B RTL A:000C X:0040 Y:0004 P:eNvMxdizc - Return from Long.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~``
$00/FEBF 80 2F BRA $2F    [$FEF0] A:000C X:0040 Y:0004 P:eNvMxdizc - Branch always to 2F.
$00/FEF0 A6 A6 LDX $A6    [$00:00A6] A:000C X:0040 Y:0004 P:eNvMxdizc - Load Slot into X.
$00/FEF2 EA NOP A:000C X:0040 Y:0004 P:envMxdizc - Retrieve Exp. values
$00/FEF3 68 PLA A:000C X:0040 Y:0004 P:envMxdizc
$00/FEF4 7A PLY A:003C X:0040 Y:0004 P:envMxdizc
$00/FEF5 6B RTL A:003C X:0040 Y:0000 P:envMxdiZc - Return from Long

And there you have it! That is probably the Best piece of code I've yet to put together.
One small little addendum, the change to the Jump from Magic Learning to the rest of the Level up Subroutine...

$03/F076   20 C8 F0   JSR $F0C8  [$03:F0C8]   A:0009   X:270F   Y:0000   P:envMxdiz - Jump past most of Magic Learning Subroutine.



Job/Spell Setter Subroutine
(Used for Adult Rydia, Edge, and FuSoYa to reach their proper placements as not to waste space)
Code: [Select]
$00/FFA0 C9 0B CMP #$0B A:0001 X:0040 Y:0040 P:envMxdizC - Is the Class 0B (Adult Rydia)
$00/FFA2 D0 02 BNE $02    [$FFA6] A:0001 X:0040 Y:0040 P:eNvMxdizc - Branch if not.
----------------------------------------------------------------------------------------------
$00/FFA4 A9 02 LDA #$02 A:0001 X:0040 Y:0040 P:eNvMxdizc - Load Child Rydia's Class into A.
-----------------------------------------------------------------------------------------------
$00/FFA6 C9 0C CMP #$0C A:0001 X:0040 Y:0040 P:eNvMxdizc - It is Edge or FuSoYa?
$00/FFA8 90 01 BCC $01    [$FFAB] A:0001 X:0040 Y:0040 P:eNvMxdizc - If not, branch.
-------------------
$00/FFAA 3A DEC A A:0001 X:0040 Y:0040 P:eNvMxdizc -1 to A.
-----------------------
$00/FFAB AA TAX A:0001 X:0040 Y:0040 P:eNvMxdizc - Transfer A to X.
$00/FFAC 60 RTS A:0001 X:0040 Y:0040 P:eNvMxdizc - Return

None of this is experimental or theoretical any longer, I've put together all the pieces I needed and have tested it to a pretty good extent. I may have a demo ready sometime in the future showing this off.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (A Working Job System!)
Post by: chillyfeez on April 28, 2015, 12:14:01 AM
Is there any way for the player to know how close they are to the next job level?
I bet the Status screen could be reworked to include that information. Cuz, you know, I know you want more stuff to do, right?
;)

Also, it looks like jobs now have two bytes of stored data each... Does that mean you've worked out  way for the game to fully keep track of job progression even when the job isn't equipped?
Title: Re: Grimoire LD's Notes, Patches, and Hacks (A Working Job System!)
Post by: Grimoire LD on April 28, 2015, 12:41:11 AM
Is there any way for the player to know how close they are to the next job level?
I bet the Status screen could be reworked to include that information. Cuz, you know, I know you want more stuff to do, right?
;)

Also, it looks like jobs now have two bytes of stored data each... Does that mean you've worked out  way for the game to fully keep track of job progression even when the job isn't equipped?

Haha! I... honestly cannot conceive of a way. Because the way it works now is that it just checks the Job Tracker, checks the eight values, if it matches it will earn the spell... now there may be a way actually, now that I think on it... It could work if I do a quick load of the Job Tracker Byte. Do a BCC to see if it the value is above the current Job Level, and store that value... somewhere. But I have no idea how I would do that. The concept of storing specific data of either "Job Level 2 - 14 till Job Level Up" or "Job 18 - Job Lvl Up. 28" is a bit beyond me. I've heard that windows and menus are the worst parts about hacking... anything.

I do suppose the Class Name and the HP/MP in the Status Menu isn't actually necessary and if I can highjack the pointers to all of those I Could have something that works. I'll give that a shot tomorrow then, thanks for the idea!

As for keeping track, oh yes. It was one of my first undertakings. I undid my Commands in RAM as... in the end they ironically served no purpose and moved the pointer back to the original section while adding a new section for the Job Commands separate from Class Commands. So that gave me a bit more free SRAM Space. It is very simple how it works... 31 Jobs now have a byte dedicated for each.

When you win a battle with a Job or nothing equipped to the Accessory Slot your Base Class or your Job will go up by 1. (Actually it goes up in as many levels a character gained in the battle +1, a little side effect which I'm fine with, it helps reach Job Level Ups a little faster).

De-quiping the Job doesn't change the amount that was originally stored in SRAM.

The purpose of the two bytes is to reach certain areas without a lot of complicated math having two is easier for me. 32 is the Accessory/Job Slot and is looked at several times, but the secondary Job Byte, 2F is only looked at in conjunction with 32 and is never looked at on its own since its never corrected until another Job is equipped.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (A Working Job System!)
Post by: chillyfeez on April 28, 2015, 06:07:28 AM
Quote
I've heard that windows and menus are the worst parts about hacking... anything.
What, like you heard of some guy one time who drove himself crazy trying to expand command and spell names? I'm not familiar with that story...

But, seriously, there's actually a fair amount of space after the character's name and handedness. Finding a way to use it would require custom assembly, but shouldn't be too hard.
The biggest deal would probably be telling the game how to know the job level. I think I thought that was being stored by that second byte. I know I could examine your code to figure this out, but how does it know which spell to add when a job levels up? That'd likely be the key.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (A Working Job System!)
Post by: Grimoire LD on April 28, 2015, 09:33:43 AM
Quote
I've heard that windows and menus are the worst parts about hacking... anything.
What, like you heard of some guy one time who drove himself crazy trying to expand command and spell names? I'm not familiar with that story...

But, seriously, there's actually a fair amount of space after the character's name and handedness. Finding a way to use it would require custom assembly, but shouldn't be too hard.
The biggest deal would probably be telling the game how to know the job level. I think I thought that was being stored by that second byte. I know I could examine your code to figure this out, but how does it know which spell to add when a job levels up? That'd likely be the key.

Heh, no, no. Not just your experience, but even the famed Justin3009 mentioned that the most laborious part of hacking is the menus and screens. Thankfully with FFIV we already have a pretty good map of the menus compiled by... I want to say DragonsBrethren. As for moving things around on the Status screen... A quick breakpoint actually uncovered pretty much everything I'm going to need and I will post that data shortly for others who want to move certain aspects of the screen around. As I said I think I'm just going to replace superfluous aspects of the screen, there's no need for HP/MP to be displayed for example when they're Right there in the normal screen. I can replace those with custom strings.

The game has no default way of knowing Job Level as there technically *isn't* one, unlike Exp, it does not reach an amount and loop back to read another value, instead it works like this...

Say Rydia has 02 Job Points as a Caller. She fights one more battle the game, after each battle, will do this...

(Look at Caller Rydia's Magic to Learn - a section of 16 Bytes)

03 - Ice, 10 - Pure, 18 - Cure,  and so on and so forth. Since the code will find a match the Job Tracker with this "Check if Job Tracker is this". And it goes from there.

How to display this would be done in a similar set up, check to see what value is above Current Job Points/Tracker (so if Rydia has 5 battles fought it will display something like... "Job Points 5"
          "Next Skill 10"

At max it would have to read something different.  So like...

"Job Points 200"
"Next Skill None" or something like that.

Here is the code regarding (most) of the Status Screen anyhow...


Status Screen Building Code
Code: [Select]
$01/A91E 20 07 90 JSR $9007  [$01:9007] A:0000 X:0002 Y:0300 P:envMxdIZc - Jump to Subroutine
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~````
$01/9007 48 PHA A:0000 X:0002 Y:0300 P:envMxdIZc - Push A.
$01/9008 29 0F AND #$0F A:0000 X:0002 Y:0300 P:envMxdIZc - Get rid of bits...
$01/900A 0A ASL A A:0000 X:0002 Y:0300 P:envMxdIZc - x2 A.
$01/900B 20 B4 87 JSR $87B4  [$01:87B4] A:0000 X:0002 Y:0300 P:envMxdIZc - Jump to Subroutine
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$01/87B4 85 43 STA $43    [$00:0143] A:0000 X:0002 Y:0300 P:envMxdIZc - Store A in 0143.
$01/87B6 A6 43 LDX $43    [$00:0143] A:0000 X:0002 Y:0300 P:envMxdIZc - Load X from 0143.
$01/87B8 60 RTS A:0000 X:0000 Y:0300 P:envMxdIZc - Return
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$01/900E C2 20 REP #$20 A:0000 X:0000 Y:0300 P:envMxdIZc  - Set A to 16 Bit.
$01/9010 BF 25 C6 0F LDA $0FC625,x[$0F:C625] A:0000 X:0000 Y:0300 P:envmxdIZc - Load A from Pointer Area (in this case 1000)
$01/9014 AA TAX A:1000 X:0000 Y:0300 P:envmxdIzc - Transfer A to X.
$01/9015 E2 20 SEP #$20 A:1000 X:1000 Y:0300 P:envmxdIzc - Set A to 8 Bit.
$01/9017 68 PLA A:1000 X:1000 Y:0300 P:envMxdIzc - Pull A.
$01/9018 60 RTS A:1000 X:1000 Y:0300 P:envMxdIZc - Return
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$01/A921 86 60 STX $60    [$00:0160] A:1000 X:1000 Y:0300 P:envMxdIZc - Store 1000 in 0160.
$01/A923 B2 60 LDA ($60)  [$7E:1000] A:1000 X:1000 Y:0300 P:envMxdIZc - Load A from 0160. (in this case Name is being Loaded)
$01/A925 29 3F AND #$3F A:1091 X:1000 Y:0300 P:eNvMxdIzc - Get rid of Bits
$01/A927 D0 01 BNE $01    [$A92A] A:1011 X:1000 Y:0300 P:envMxdIzc. Branch if not 00. (... since this Is the Status Screen I don't think you'd ever have to worry about that one?)
-------------------------------
$01/A929 60 RTS A:1011 X:1000 Y:0300 P:envMxdIzc
------------------------------------
$01/A92A 20 AF 94 JSR $94AF  [$01:94AF] A:1011 X:1000 Y:0300 P:envMxdIzc - Jump to Subroutine (Sets up Status Screen Window)
$01/A92D 20 CC 94 JSR $94CC  [$01:94CC] A:0000 X:1000 Y:0000 P:envMxdIzc - Continual Setup
$01/A930         20 6C 8D JSR $8D6C  [$01:8D6C] A:FFFF X:A100 Y:A300 P:eNvMxdIzc - More setup.
$01/A933         20 38 8D JSR $8D38  [$01:8D38] A:AAAA X:0220 Y:0000 P:eNvMxdIzc - More setup.
$01/A936        20 3D 8D JSR $8D3D  [$01:8D3D] A:2000 X:0000 Y:1000 P:envMxdIZc - Even more.
(Skipping the rest of that...)
$01/A93F A9 0C LDA #$0C A:4301 X:0200 Y:1000 P:envMxdIzc - Load 0C into A.
$01/A941 85 C2 STA $C2    [$00:01C2] A:430C X:0200 Y:1000 P:envMxdIzc - Store A in 1C2.
$01/A943 A9 04 LDA #$04 A:430C X:0200 Y:1000 P:envMxdIzc - Load 04 into A.
$01/A945 85 B1 STA $B1    [$00:01B1] A:4304 X:0200 Y:1000 P:envMxdIzc - Store A in B1
$01/A947 85 A5 STA $A5    [$00:01A5] A:4304 X:0200 Y:1000 P:envMxdIzc - And A5.
$01/A949 20 88 84 JSR $8488  [$01:8488] A:4304 X:0200 Y:1000 P:envMxdIzc - Jump to Subroutine
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$01/848A A2 00 C6 LDX #$C600 A:4304 X:0200 Y:1000 P:envMxdIzc - Load C600 into X (some kind of graphics display, I imagine.)
$01/848D 86 29 STX $29    [$00:0129] A:4304 X:C600 Y:1000 P:eNvMxdIzc - Store X in 0129.
$01/848F A2 00 78 LDX #$7800 A:4304 X:C600 Y:1000 P:eNvMxdIzc - Load 7800 into X.
$01/8492 86 35 STX $35    [$00:0135] A:4304 X:7800 Y:1000 P:envMxdIzc - Store X in 0135.
$01/8494 A9 02 LDA #$02 A:4304 X:7800 Y:1000 P:envMxdIzc - Load 02 into A.
$01/8496 85 C3 STA $C3    [$00:01C3] A:4302 X:7800 Y:1000 P:envMxdIzc - Store A in 01C3.
$01/8498 A9 20 LDA #$20 A:4302 X:7800 Y:1000 P:envMxdIzc - Load 20 into A.
$01/849A 85 34 STA $34    [$00:0134] A:4320 X:7800 Y:1000 P:envMxdIzc - Store A in 0134.
$01/849C FA PLX A:4320 X:7800 Y:1000 P:envMxdIzc - Pull X
$01/849D 68 PLA A:4320 X:0200 Y:1000 P:envMxdIzc - Pull A
$01/849E 60 RTS A:4304 X:0200 Y:1000 P:envMxdIzc - Return
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
$01/A94C A0 70 02 LDY #$0270 A:4304 X:0200 Y:1000 P:envMxdIzc - Load 0270 into Y/
$01/A94F A9 05 LDA #$05 A:4304 X:0200 Y:0270 P:envMxdIzc - Load 05 into A
$01/A951 18 CLC A:4305 X:0200 Y:0270 P:envMxdIzc - Clear Carry Flag
$01/A952 20 79 87 JSR $8779  [$01:8779] A:4305 X:0200 Y:0270 P:envMxdIzc - Jump to Subroutine (??)
$01/A955 A0 2A D8 LDY #$D82A A:C805 X:0200 Y:C8BA P:envMxdIzc - Load D82A into Y.
$01/A958 A2 1B DA LDX #$DA1B A:C805 X:0200 Y:D82A P:eNvMxdIzc - Load DA1B into X.
$01/A95B 20 D0 84 JSR $84D0  [$01:84D0] A:C805 X:DA1B Y:D82A P:eNvMxdIzc - Jump to Portrait Clearing Routine.
$01/A95E 20 33 94 JSR $9433  [$01:9433] A:0100 X:858C Y:0000 P:eNvMxdIzC - Jump to Subroutine.
$01/A961 A9 30 LDA #$30 A:0001 X:858C Y:0000 P:eNvMxdIzc - Load 30 into A.
$01/A963 85 C1 STA $C1    [$00:01C1] A:0030 X:858C Y:0000 P:envMxdIzc - Store A in C1.
$01/A965 A5 E8 LDA $E8    [$00:01E8] A:0030 X:858C Y:0000 P:envMxdIzc - Load A from 1E8
$01/A967 A0 98 08 LDY #$0898 A:0000 X:858C Y:0000 P:envMxdIZc - Load 0898 into Y.
$01/A96A 20 70 8E JSR $8E70  [$01:8E70] A:0000 X:858C Y:0898 P:envMxdIzc - Jump to Subroutine
(The rest will be skipped until we reach pertinent data...)


Code: [Select]
[b]$01/A98B B2 60 LDA ($60)  [$7E:1000] A:FFC7 X:0200 Y:DAB5 P:eNvMxdIzC - Load A from 0160 (1000)
$01/A98D 29 3F AND #$3F A:FF91 X:0200 Y:DAB5 P:eNvMxdIzC - Get rid of Bits.
$01/A98F A0 84 00 LDY #$0084 A:FF11 X:0200 Y:DAB5 P:envMxdIzC - Load 0084 into Y (Placement code)[/b]
(Sectioned Part is only important part here)


$01/A992 20 AB 83 JSR $83AB  [$01:83AB] A:FF11 X:0200 Y:0084 P:envMxdIz - Jump to Subroutine
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~```
$01/83AB 29 3F AND #$3F A:FF11 X:0200 Y:0084 P:envMxdIzC - Clear Bots.
$01/83AD D0 01 BNE $01    [$83B0] A:FF11 X:0200 Y:0084 P:envMxdIzC - Is not 00, branch.
(Return)
$01/83B0 3A DEC A A:FF11 X:0200 Y:0084 P:envMxdIzC - -1 A.
$01/83B1 20 B4 87 JSR $87B4  [$01:87B4] A:FF10 X:0200 Y:0084 P:envMxdIzC - Jump to Subroutine
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$01/87B4 85 43 STA $43    [$00:0143] A:FF10 X:0200 Y:0084 P:envMxdIzC - Store A in 0143.
$01/87B6 A6 43 LDX $43    [$00:0143] A:FF10 X:0200 Y:0084 P:envMxdIzC - Load X from 143
$01/87B8 60 RTS A:FF10 X:0010 Y:0084 P:envMxdIzC - Return
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
$01/83B4 BF 57 84 01 LDA $018457,x[$01:8467] A:FF10 X:0010 Y:0084 P:envMxdIzC - Load A from Character's Name.
$01/83B8 0A ASL A A:FF02 X:0010 Y:0084 P:envMxdIzC - x2 A.
$01/83B9 85 45 STA $45    [$00:0145] A:FF04 X:0010 Y:0084 P:envMxdIzc - Store A in 0145.
$01/83BB 0A ASL A A:FF04 X:0010 Y:0084 P:envMxdIzc - x2 A.
$01/83BC 65 45 ADC $45    [$00:0145] A:FF08 X:0010 Y:0084 P:envMxdIzc - Add the original x2 onto the x4'd A.
$01/83BE 20 B4 87 JSR $87B4  [$01:87B4] A:FF0C X:0010 Y:0084 P:envMxdIzc - Jump to Subroutine (Above)
$01/83C1 C2 20 REP #$20 A:FF0C X:000C Y:0084 P:envMxdIzc - Set X to 8 Bit.
$01/83C3 98 TYA A:FF0C X:000C Y:0084 P:envmxdIzc - Transfer Y to A.
$01/83C4 18 CLC A:0084 X:000C Y:0084 P:envmxdIzc - Clear Carry Flag
$01/83C5 65 29 ADC $29    [$00:0129] A:0084 X:000C Y:0084 P:envmxdIzc - Add A from 0129.
$01/83C7 A8 TAY A:B684 X:000C Y:0084 P:eNvmxdIzc - Transfer A to Y.
$01/83C8 E2 20 SEP #$20 A:B684 X:000C Y:B684 P:eNvmxdIzc - Set A to 16 Bit.
$01/83CA A9 06 LDA #$06 A:B684 X:000C Y:B684 P:eNvMxdIzc - Load 06 into A.
$01/83CC 85 45 STA $45    [$00:0145] A:B606 X:000C Y:B684 P:envMxdIzc - Store A in 0145.
$01/83CE BD 00 15 LDA $1500,x[$7E:150C] A:B606 X:000C Y:B684 P:envMxdIzc - Load A from 1500 (Oh? So this bit of RAM is used, thank goodness I erred on the side of caution with it. I do not know what it does though.)
$01/83D1 E8 INX A:B653 X:000C Y:B684 P:envMxdIzc - +1 to X
$01/83D2 20 34 8E JSR $8E34  [$01:8E34] A:B653 X:000D Y:B684 P:envMxdIzc  - jump to Subroutine
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$01/8E35 C9 42 CMP #$42 A:B653 X:000D Y:B684 P:envMxdIzc - Is it 42?
$01/8E37 B0 15 BCS $15    [$8E4E] A:B653 X:000D Y:B684 P:envMxdIzC - If above 42 branch.
------------------------------------

------------------------------------
$01/8E4E EB XBA A:B653 X:000D Y:B684 P:envMxdIzC -  Exchange B and A eight bit accumulators. (I'll need to remember that one)
$01/8E4F A9 FF LDA #$FF A:53B6 X:000D Y:B684 P:eNvMxdIzC  - Load FF into A.
$01/8E51 FA PLX A:53FF X:000D Y:B684 P:eNvMxdIzC - Pull X
$01/8E52 60 RTS A:53FF X:000D Y:B684 P:envMxdIzC - Return
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~``
$01/83D5 99 00 00 STA $0000,y[$7E:B684] A:53FF X:000D Y:B684 P:envMxdIzC - Store A into 7DB684.
$01/83D8 EB XBA A:53FF X:000D Y:B684 P:envMxdIzC - Exchange X and A.
$01/83D9 99 40 00 STA $0040,y[$7E:B6C4] A:FF53 X:000D Y:B684 P:envMxdIzC - Store A in 7EB6C4.
$01/83DC C8 INY A:FF53 X:000D Y:B684 P:envMxdIzC - +1 2
$01/83DD C8 INY A:FF53 X:000D Y:B685 P:eNvMxdIzC
$01/83DE C6 45 DEC $45    [$00:0145] A:FF53 X:000D Y:B686 P:eNvMxdIzC - -1 to 0145. -
$01/83E0 D0 EC BNE $EC    [$83CE] A:FF53 X:000D Y:B686 P:envMxdIzC - Loop back
(We'll be leaving this section for a while...)
...........

Most of the Actual Placing of the stats for the Status Screen. (Only one above is Name and due to the way they set it up that is difficult to change)
Code: [Select]
$01/A99D A0 02 00 LDY #$0002 A:FF01 X:1000 Y:0088 P:envMxdIzc - Load 0002 into Y. (Character Level)
$01/A9A0 B1 60 LDA ($60),y[$7E:1002] A:FF01 X:1000 Y:0002 P:envMxdIzc - Load Character's Level into A.
$01/A9A2 A0 5C 01 LDY #$015C A:FF0A X:1000 Y:0002 P:envMxdIzc - Load Location to place into Y.
$01/A9A5 20 69 83 JSR $8369  [$01:8369] A:FF0A X:1000 Y:015C P:envMxdIzc - Load Location Routine.

$01/A9A8 A0 14 00 LDY #$0014 A:8180 X:1000 Y:B75C P:eNvMxdIzc - Load 0014 into Y (Modified Character Strength)
$01/A9AB B1 60 LDA ($60),y[$7E:1014] A:8180 X:1000 Y:0014 P:envMxdIzc - Load Character's Strength into A
$01/A9AD A0 12 04 LDY #$0412 A:8107 X:1000 Y:0014 P:envMxdIzc - Load Location to place into Y.
$01/A9B0 20 69 83 JSR $8369  [$01:8369] A:8107 X:1000 Y:0412 P:envMxdIzc - Load Location Routine.

$01/A9B3 A0 15 00 LDY #$0015 A:FF87 X:1000 Y:BA12 P:eNvMxdIzc - Load Modified Agility into Y.
$01/A9B6 B1 60 LDA ($60),y[$7E:1015] A:FF87 X:1000 Y:0015 P:envMxdIzc - "  "
$01/A9B8 A0 92 04 LDY #$0492 A:FF09 X:1000 Y:0015 P:envMxdIzc
$01/A9BB 20 69 83 JSR $8369  [$01:8369] A:FF09 X:1000 Y:0492 P:envMxdIzc

$01/A9BE A0 16 00 LDY #$0016 A:FF89 X:1000 Y:BA92 P:eNvMxdIzc - Load Modified Vitality into Y.
$01/A9C1 B1 60 LDA ($60),y[$7E:1016] A:FF89 X:1000 Y:0016 P:envMxdIzc "   "
$01/A9C3 A0 12 05 LDY #$0512 A:FF05 X:1000 Y:0016 P:envMxdIzc
$01/A9C6 20 69 83 JSR $8369  [$01:8369] A:FF05 X:1000 Y:0512 P:envMxdIzc

$01/A9C9 A0 17 00 LDY #$0017 A:FF85 X:1000 Y:BB12 P:eNvMxdIzc - Load Modified Wisdom into Y
$01/A9CC B1 60 LDA ($60),y[$7E:1017] A:FF85 X:1000 Y:0017 P:envMxdIzc "    "
$01/A9CE A0 92 05 LDY #$0592 A:FF0F X:1000 Y:0017 P:envMxdIzc
$01/A9D1 20 69 83 JSR $8369  [$01:8369] A:FF0F X:1000 Y:0592 P:envMxdIzc

$01/A9D4 A0 18 00 LDY #$0018 A:8185 X:1000 Y:BB92 P:eNvMxdIzc - Load Modified Will into Y.
$01/A9D7 B1 60 LDA ($60),y[$7E:1018] A:8185 X:1000 Y:0018 P:envMxdIzc - "        "
$01/A9D9 A0 12 06 LDY #$0612 A:8109 X:1000 Y:0018 P:envMxdIzc
$01/A9DC 20 69 83 JSR $8369  [$01:8369] A:8109 X:1000 Y:0612 P:envMxdIzc


$01/A9DF A0 1B 00 LDY #$001B A:FF89 X:1000 Y:BC12 P:eNvMxdIzc - Load Attack Mutliplier into Y
$01/A9E2 B1 60 LDA ($60),y[$7E:101B] A:FF89 X:1000 Y:001B P:envMxdIzc - "   "
$01/A9E4 A0 AA 03 LDY #$03AA A:FF01 X:1000 Y:001B P:envMxdIzc
$01/A9E7 20 69 83 JSR $8369  [$01:8369] A:FF01 X:1000 Y:03AA P:envMxdIzc

$01/A9EA A0 28 00 LDY #$0028 A:FF81 X:1000 Y:B9AA P:eNvMxdIzc - Load Physical Defense Multiplier into Y.
$01/A9ED B1 60 LDA ($60),y[$7E:1028] A:FF81 X:1000 Y:0028 P:envMxdIzc - "   "
$01/A9EF A0 AA 04 LDY #$04AA A:FF01 X:1000 Y:0028 P:envMxdIzc
$01/A9F2 20 69 83 JSR $8369  [$01:8369] A:FF01 X:1000 Y:04AA P:envMxdIzc

$01/A9F5 A0 22 00 LDY #$0022 A:FF81 X:1000 Y:BAAA P:eNvMxdIzc - Load Magical Defense Multiplier into Y
$01/A9F8 B1 60 LDA ($60),y[$7E:1022] A:FF81 X:1000 Y:0022 P:envMxdIzc - "   "
$01/A9FA A0 AA 05 LDY #$05AA A:FF00 X:1000 Y:0022 P:envMxdIZc
$01/A9FD 20 69 83 JSR $8369  [$01:8369] A:FF00 X:1000 Y:05AA P:envMxdIzc

$01/AA00 A0 1C 00 LDY #$001C A:FF80 X:1000 Y:BBAA P:eNvMxdIzc - Load Physical Accuracy into Y.
$01/AA03 B1 60 LDA ($60),y[$7E:101C] A:FF80 X:1000 Y:001C P:envMxdIzc - "   "
$01/AA05 A0 34 04 LDY #$0434 A:FF34 X:1000 Y:001C P:envMxdIzc
$01/AA08 20 69 83 JSR $8369  [$01:8369] A:FF34 X:1000 Y:0434 P:envMxdIzc

$01/AA0B A0 29 00 LDY #$0029 A:8582 X:1000 Y:BA34 P:eNvMxdIzc - Load Physical Evasion into Y.
$01/AA0E B1 60 LDA ($60),y[$7E:1029] A:8582 X:1000 Y:0029 P:envMxdIzc "   "
$01/AA10 A0 34 05 LDY #$0534 A:851E X:1000 Y:0029 P:envMxdIzc
$01/AA13 20 69 83 JSR $8369  [$01:8369] A:851E X:1000 Y:0534 P:envMxdIzc

$01/AA16 A0 23 00 LDY #$0023 A:8380 X:1000 Y:BB34 P:eNvMxdIzc - Load Magical Evasion into Y.
$01/AA19 B1 60 LDA ($60),y[$7E:1023] A:8380 X:1000 Y:0023 P:envMxdIzc"       "
$01/AA1B A0 34 06 LDY #$0634 A:8303 X:1000 Y:0023 P:envMxdIzc
$01/AA1E 20 69 83 JSR $8369  [$01:8369] A:8303 X:1000 Y:0634 P:envMxdIzc

$01/AA21 A0 37 00 LDY #$0037 A:FF83 X:1000 Y:BC34 P:eNvMxdIzc - Load Placement Location into Y.
$01/AA24 B1 60 LDA ($60),y[$7E:1037] A:FF83 X:1000 Y:0037 P:envMxdIzc - Load Exp Byte 1 into A.
$01/AA26 85 45 STA $45    [$00:0145] A:FFE9 X:1000 Y:0037 P:eNvMxdIzc - Store A in 0145.
$01/AA28 C8 INY A:FFE9 X:1000 Y:0037 P:eNvMxdIzc - +1 to Y.
$01/AA29 B1 60 LDA ($60),y[$7E:1038] A:FFE9 X:1000 Y:0038 P:envMxdIzc - Load Exp Byte 2 into A
$01/AA2B 85 46 STA $46    [$00:0146] A:FF0B X:1000 Y:0038 P:envMxdIzc - Store A in 0146.
$01/AA2D C8 INY A:FF0B X:1000 Y:0038 P:envMxdIzc - +1 to Y.
$01/AA2E B1 60 LDA ($60),y[$7E:1039] A:FF0B X:1000 Y:0039 P:envMxdIzc - Load Exp Byte 3 into A.
$01/AA30 A6 45 LDX $45    [$00:0145] A:FF00 X:1000 Y:0039 P:envMxdIZc - Load X from 40145.
$01/AA32 A0 26 02 LDY #$0226 A:FF00 X:0BE9 Y:0039 P:envMxdIzc - Load Placement Location (2?) into Y.
$01/AA35 20 A8 8F JSR $8FA8  [$01:8FA8] A:FF00 X:0BE9 Y:0226 P:envMxdIzc - Jump to Placement Subroutine.

01/AA38 C2 20 REP #$20 A:02FF X:0007 Y:0226 P:envMxdIzC - Set A to 16 Bits.
$01/AA3A A0 07 00 LDY #$0007 A:02FF X:0007 Y:0226 P:envmxdIzC  - Load HP into Y.
$01/AA3D B1 60 LDA ($60),y[$7E:1007] A:02FF X:0007 Y:0007 P:envmxdIzC "    "
$01/AA3F A0 88 02 LDY #$0288 A:105C X:0007 Y:0007 P:envmxdIzC
$01/AA42 20 83 83 JSR $8383  [$01:8383] A:105C X:0007 Y:0288 P:envmxdIzC - Different subroutine.

$01/AA45 A0 09 00 LDY #$0009 A:B888 X:0007 Y:B888 P:envmxdIzC - Load Max HP into Y.
$01/AA48 B1 60 LDA ($60),y[$7E:1009] A:B888 X:0007 Y:0009 P:envmxdIzC "    "
$01/AA4A A0 92 02 LDY #$0292 A:1076 X:0007 Y:0009 P:envmxdIzC
$01/AA4D 20 83 83 JSR $8383  [$01:8383] A:1076 X:0007 Y:0292 P:envmxdIzC

$01/AA50 A0 0B 00 LDY #$000B A:B884 X:0007 Y:B892 P:envmxdIzC - Load MP into Y.
$01/AA53 B1 60 LDA ($60),y[$7E:100B] A:B884 X:0007 Y:000B P:envmxdIzC "   "
$01/AA55 A0 08 03 LDY #$0308 A:03AB X:0007 Y:000B P:envmxdIzC
$01/AA58 20 83 83 JSR $8383  [$01:8383] A:03AB X:0007 Y:0308 P:envmxdIzC

$01/AA5B A0 0D 00 LDY #$000D A:B989 X:0007 Y:B908 P:envmxdIzC - Load Max MP into Y.
$01/AA5E B1 60 LDA ($60),y[$7E:100D] A:B989 X:0007 Y:000D P:envmxdIzC "  "
$01/AA60 A0 12 03 LDY #$0312 A:03E7 X:0007 Y:000D P:envmxdIzC
$01/AA63 20 83 83 JSR $8383  [$01:8383] A:03E7 X:0007 Y:0312 P:envmxdIzC

$01/AA66 E2 20 SEP #$20 A:B989 X:0007 Y:B912 P:envmxdIzC - Set A to 8 Bits.
$01/AA68 7B TDC A:B989 X:0007 Y:B912 P:envMxdIzC - Clear A (First half of byte?)
$01/AA69 EB XBA A:0100 X:0007 Y:B912 P:envMxdIzC - Swap X and A.
$01/AA6A A0 1D 00 LDY #$001D A:0001 X:0007 Y:B912 P:envMxdIzC - Load Physical Attack into Y.
$01/AA6D B1 60 LDA ($60),y[$7E:101D] A:0001 X:0007 Y:001D P:envMxdIzC - "   "
$01/AA6F A0 B2 03 LDY #$03B2 A:0003 X:0007 Y:001D P:envMxdIzC
$01/AA72 20 7F 83 JSR $837F  [$01:837F] A:0003 X:0007 Y:03B2 P:envMxdIzC - (Different Subroutine)

$01/AA75 A0 2A 00 LDY #$002A A:B983 X:0007 Y:B9B2 P:envMxdIzC - Load Defense into Y.
$01/AA78 B1 60 LDA ($60),y[$7E:102A] A:B983 X:0007 Y:002A P:envMxdIzC - "   "
$01/AA7A A0 B2 04 LDY #$04B2 A:B903 X:0007 Y:002A P:envMxdIzC
$01/AA7D 20 7F 83 JSR $837F  [$01:837F] A:B903 X:0007 Y:04B2 P:envMxdIzC

$01/AA80 A0 24 00 LDY #$0024 A:BA83 X:0007 Y:BAB2 P:envMxdIzC - Load Magical Defense into Y
$01/AA83 B1 60 LDA ($60),y[$7E:1024] A:BA83 X:0007 Y:0024 P:envMxdIzC - "    "
$01/AA85 A0 B2 05 LDY #$05B2 A:BA00 X:0007 Y:0024 P:envMxdIZC
$01/AA88 20 7F 83 JSR $837F  [$01:837F] A:BA00 X:0007 Y:05B2 P:envMxdIzC

$01/AA8B B2 60 LDA ($60)  [$7E:1000] A:BB80 X:0007 Y:BBB2 P:envMxdIZC - Load Character's Handedness into A.
$01/AA8D 29 C0 AND #$C0 A:BB91 X:0007 Y:BBB2 P:eNvMxdIzC - (Get rid of unapplicable bits)
$01/AA8F 4A LSR A A:BB80 X:0007 Y:BBB2 P:eNvMxdIzC - /2 A.
$01/AA90 4A LSR A A:BB40 X:0007 Y:BBB2 P:envMxdIzc - /2 A
$01/AA91 4A LSR A A:BB20 X:0007 Y:BBB2 P:envMxdIzc - /2 A
$01/AA92 85 45 STA $45    [$00:0145] A:BB10 X:0007 Y:BBB2 P:envMxdIzc - Store A in 45.
$01/AA94 64 46 STZ $46    [$00:0146] A:BB10 X:0007 Y:BBB2 P:envMxdIzc - Store Zero in 46.
$01/AA96 C2 20 REP #$20 A:BB10 X:0007 Y:BBB2 P:envMxdIzc - Set A to 16 Bits.
$01/AA98 A9 34 DE LDA #$DE34 A:BB10 X:0007 Y:BBB2 P:envmxdIzc - Load DE34 into A.
$01/AA9B 18 CLC A:DE34 X:0007 Y:BBB2 P:eNvmxdIzc - Clear Carry Flag.
$01/AA9C 65 45 ADC $45    [$00:0145] A:DE34 X:0007 Y:BBB2 P:eNvmxdIzc - Add the value from 45 onto A.
$01/AA9E A8 TAY A:DE44 X:0007 Y:BBB2 P:eNvmxdIzc - Transfer A to Y.
$01/AA9F E2 20 SEP #$20 A:DE44 X:0007 Y:DE44 P:eNvmxdIzc - Set A back to 8 bits.
$01/AAA1 A2 86 01 LDX #$0186 A:DE44 X:0007 Y:DE44 P:eNvMxdIzc -  - Load 0186 into X.
$01/AAA4 20 CD 82 JSR $82CD  [$01:82CD] A:DE44 X:0186 Y:DE44 P:envMxdIzc - Jump to Subroutine

$01/AAA7 A0 01 00 LDY #$0001 A:FF00 X:0186 Y:DE4A P:envMxdIzC - Load Character Class into Y.
$01/AAAA B1 60 LDA ($60),y[$7E:1001] A:FF00 X:0186 Y:0001 P:envMxdIzC - "   "
$01/AAAC A0 06 01 LDY #$0106 A:FF0B X:0186 Y:0001 P:envMxdIzC
$01/AAAF 20 C8 8F JSR $8FC8  [$01:8FC8] A:FF0B X:0186 Y:0106 P:envMxdIzC - Unique Subroutine
(Note to Self: Remember to change this to look at Second Job Byte)

$01/AAB5 A0 02 00 LDY #$0002 A:FFC7 X:0054 Y:B714 P:eNvMxdIzC - Load Character's Level into Y
$01/AAB8 B1 60 LDA ($60),y[$7E:1002] A:FFC7 X:0054 Y:0002 P:envMxdIzC - "  "
$01/AABA C9 63 CMP #$63 A:FF0A X:0054 Y:0002 P:envMxdIzC - Is it 99?
$01/AABC D0 03 BNE $03    [$AAC1] A:FF0A X:0054 Y:0002 P:eNvMxdIzc - If not, branch.
--------------------------
01/AABE 4C 48 AB JMP $AB48  [$01:AB48] A:FF00 X:0054 Y:DAC4 P:envMxdIzC - Jump out of Routine.
------------------------
$01/AAC1 A0 B6 DA LDY #$DAB6 A:FF0A X:0054 Y:0002 P:eNvMxdIzc - Load Location Code.
$01/AAC4 20 01 83 JSR $8301  [$01:8301] A:FF0A X:0054 Y:DAB6 P:eNvMxdIzc - Jump to Subroutine.

$01/AAC7 A0 3D 00 LDY #$003D A:FF00 X:0054 Y:DAC4 P:envMxdIzC - Load Exp to Level Up Byte 1 into Y.
$01/AACA B1 60 LDA ($60),y[$7E:103D] A:FF00 X:0054 Y:003D P:envMxdIzC - " " (Same as the above Exp one basically)
$01/AACC 85 45 STA $45    [$00:0145] A:FF4B X:0054 Y:003D P:envMxdIzC
$01/AACE C8 INY A:FF4B X:0054 Y:003D P:envMxdIzC
$01/AACF B1 60 LDA ($60),y[$7E:103E] A:FF4B X:0054 Y:003E P:envMxdIzC
$01/AAD1 85 46 STA $46    [$00:0146] A:FF0B X:0054 Y:003E P:envMxdIzC
$01/AAD3 C8 INY A:FF0B X:0054 Y:003E P:envMxdIzC
$01/AAD4 B1 60 LDA ($60),y[$7E:103F] A:FF0B X:0054 Y:003F P:envMxdIzC
$01/AAD6 85 47 STA $47    [$00:0147] A:FF00 X:0054 Y:003F P:envMxdIZC
$01/AAD8 B2 60 LDA ($60)  [$7E:1000] A:FF00 X:0054 Y:003F P:envMxdIZC
$01/AADA 29 3F AND #$3F A:FF91 X:0054 Y:003F P:eNvMxdIzC
$01/AADC 3A DEC A A:FF11 X:0054 Y:003F P:envMxdIzC
$01/AADD 0A ASL A A:FF10 X:0054 Y:003F P:envMxdIzC
$01/AADE 20 B4 87 JSR $87B4  [$01:87B4] A:FF20 X:0054 Y:003F P:envMxdIzc


$01/AAE1 C2 20 REP #$20 A:FF20 X:0020 Y:003F P:envMxdIzc  - Change A to 16 Bit.
$01/AAE3 BF 00 B5 0F LDA $0FB500,x[$0F:B520] A:FF20 X:0020 Y:003F P:envmxdIzc - Load A from 0FB500 (something to do with Level 70?)
$01/AAE7 85 48 STA $48    [$00:0148] A:B790 X:0020 Y:003F P:eNvmxdIzc - Store A in 0148.
$01/AAE9 E2 20 SEP #$20 A:B790 X:0020 Y:003F P:eNvmxdIzc - Change A to 8 Bit.
$01/AAEB A0 02 00 LDY #$0002 A:B790 X:0020 Y:003F P:eNvMxdIzc - Load Level into Y.
$01/AAEE B1 60 LDA ($60),y[$7E:1002] A:B790 X:0020 Y:0002 P:envMxdIzc - "   "
$01/AAF0 C9 45 CMP #$45 A:B70A X:0020 Y:0002 P:envMxdIzc - Is it 69 or above?
$01/AAF2 90 02 BCC $02    [$AAF6] A:B70A X:0020 Y:0002 P:eNvMxdIzc - If not, branch.
------------------------------
$01/AAF4 A9 45 LDA #$45 A:B709 X:0020 Y:0002 P:envMxdIzc - Load 69 into A (?)
---------------------------------
$01/AAF6 3A DEC A A:B70A X:0020 Y:0002 P:eNvMxdIzc - -1 to A,
$01/AAF7 85 43 STA $43    [$00:0143] A:B709 X:0020 Y:0002 P:envMxdIzc - Store A in 0143.
(This just seriously goes off on its own indecipherable tangent for a while, so I'll pick back up when this makes sense again...)


And it doesn't. Alright, that seems to be all I can decipher, but I found all of the major points here.

This should give me the means to change the screen as I will... what I think I'm actually going to do is change the HP value to read "Job (Current Job Points)/(Until Next Job Level) so to go back to Rydia again... It would read "Job 5/10" Then when she reaches 10 it would read 10/18 and so on and so forth. This seems the easiest way to deal with it at least in my opinion. I'll figure out what to do with the MP Maybe try to turn that into a pseudo "Job Lvl." that reads the amount out of how may spells it has skipped (+1 to X, load X in here, etc.)

It may be trickier than I think though. It is worth a shot though. Some visual representation Somewhere is needed, you are right.

 :edit: Just a quick update that I have the Job Name showing properly in the Status Screen with a very simple jump and code.

Code: [Select]
$01/AAA7 22 C1 FE 00 JSL $00FEC1[$00:FEC1] A:FF00 X:0186 Y:DE4A P:envMxdIzC - Jump to Custom Routine
$00/FEC1 A0 2F 00 LDY #$002F A:FF00 X:0186 Y:DE4A P:envMxdIzC - Load Job Byte 1 into Y.
$00/FEC4 B1 60 LDA ($60),y[$7E:1032] A:FF00 X:0186 Y:002F P:envMxdIzC - Load Job Byte 1
$00/FEC6 D0 05 BNE $05    [$FECD] A:FF10 X:0186 Y:002F P:envMxdIzC - If not 00, branch.
----------------------------------------------------
$00/FEC8 A0 01 00 LDY #$0001 A:FF00 X:0186 Y:0032 P:envMxdIZC - Load Class into Y.
$00/FECB B1 60 LDA ($60),y[$7E:1001] A:FF00 X:0186 Y:0001 P:envMxdIzC - Load Class.
$00/FECD 6B RTL A:FF10 X:0186 Y:002F P:envMxdIzC - Return from Long.
------------------------------------------
$00/FECE A0 2F 00 LDY #$002F A:FF9C X:0186 Y:0032 P:eNvMxdIzC - Load Job Byte 1 into Y.
$00/FED1 B1 60 LDA ($60),y[$7E:106F] A:FF9C X:0186 Y:002F P:envMxdIzC - Load Job Byte 1.
$00/FED3 6B RTL A:FF0E X:0186 Y:002F P:envMxdIzC - Return

 :edit: 2

Alright, that went smoothly enough, I managed to load the current Job Points into Status, now comes the hard part... thankfully I've already laid the groundwork in this routine for the "Check how many Job Points until the Next Level"

Displaying Current Job Points...

Code: [Select]
$00/FED4 8A TXA A:02FF X:0007 Y:0226 P:envmxdIzC - Transfer X to A (to get rid of bits.)
$00/FED5 E2 20 SEP #$20 A:0007 X:0007 Y:0226 P:envmxdIzC - Set A to 8 Bits.
$00/FED7 A0 32 00 LDY #$0032 A:0007 X:0007 Y:0226 P:envMxdIzC - Load Job Location into Y.
$00/FEDA B1 60 LDA ($60),y[$7E:1072] A:0007 X:0007 Y:0032 P:envMxdIzC - Load Job into A.
$00/FEDC D0 11 BNE $11    [$FEEF] A:009C X:0007 Y:0032 P:eNvMxdIzC - Branch if not 00.
------------------------------------
$00/FEDE A0 01 00 LDY #$0001 A:0000 X:0007 Y:0032 P:envMxdIZC - Load Class Location into Y.
$00/FEE1 B1 60 LDA ($60),y[$7E:1081] A:0000 X:0007 Y:0001 P:envMxdIzC - Load Class into Y.
$00/FEE3 29 0F AND #$0F A:0000 X:0007 Y:0001 P:envMxdIZC - Get rid of bits.
$00/FEE5 20 A0 FF JSR $FFA0  [$00:FFA0] A:0000 X:0007 Y:0001 P:envMxdIZ - Jump to Character Setting Subroutine
$00/FEE8 C2 20 REP #$20 A:0000 X:0000 Y:0001 P:envMxdIZc - Set A to 16 Bits.
$00/FEEA 80 06 BRA $06    [$FEF2] A:0000 X:0000 Y:0001 P:envmxdIZc - Branch.
-----------------------------------
$00/FEEF E9 8E SBC #$8E A:009C X:0007 Y:0032 P:eNvMxdIzC - Subtract 8E to reach the proper Job Point Tracker.
$00/FEF1 18 CLC A:000E X:0007 Y:0032 P:envMxdIzC - Clear Carry Flag.
$00/FEF2 AA TAX A:000E X:0007 Y:0032 P:envMxdIzc - Transfer A to X.
$00/FEF3 BD A0 14 LDA $14A0,x[$7E:14AE] A:000E X:000E Y:0032 P:envMxdIzc - Load Job Tracker Location into A.
$00/FEF6 8D FE 14 STA $14FE  [$7E:14FE] A:0003 X:000E Y:0032 P:envMxdIzc - Store A in 14FE (to be retrieved later)
$00/FEF9 C2 20 REP #$20 A:0003 X:000E Y:0032 P:envMxdIzc - Set A to 16-Bit.
$00/FEFB 6B RTL A:0003 X:000E Y:0032 P:envmxdIzc - Return

One more update and that will be the "till next job level" portion, then I will have a beautiful picture of my work to show!


 :edit: 3 And it is finally here! It took a bit of delicate handiwork, but I got it to display the amount needed until the next Job Level.

Displaying Job Points Needed to Reach Next Level

Code: [Select]
$0B/FEB0 29 FF 00 AND #$00FF A:B883 X:0000 Y:B888 P:envmxdIzc - Get rid of any bits in the second byte.
$0B/FEB3 E2 20 SEP #$20 A:0083 X:0000 Y:B888 P:envmxdIzc - Set A to 8-Bits.
$0B/FEB5 A0 32 00 LDY #$0032 A:0083 X:0000 Y:B888 P:envMxdIzc - Load Job Location into Y.
$0B/FEB8 B1 60 LDA ($60),y[$7E:10B2] A:0083 X:0000 Y:0032 P:envMxdIzc - Load Job into A.
$0B/FEBA C2 20 REP #$20 A:0000 X:0000 Y:0032 P:envMxdIZc - Set A to 16-Bits.
$0B/FEBC F0 08 BEQ $08    [$FEC6] A:0000 X:0000 Y:0032 P:envmxdIZc - Branch if 00.
-----------------------------------------------
$0B/FEBE E9 8D 00 SBC #$008D A:009C X:000E Y:0032 P:eNvmxdIzc - Subtract 8D (8E) from A.
$0B/FEC1 29 FF 00 AND #$00FF A:000E X:000E Y:0032 P:envmxdIzC - Get rid of Bits.
$0B/FEC4 80 14 BRA $14    [$FEDA] A:000E X:000E Y:0032 P:envmxdIzC - Branch.
------------------------------------------------
$0B/FEC6 A0 01 00 LDY #$0001 A:0000 X:0000 Y:0032 P:envmxdIZc - Load Class Location into Y.
$0B/FEC9 B1 60 LDA ($60),y[$7E:1081] A:0000 X:0000 Y:0001 P:envmxdIzc - Load Class into Y.
$0B/FECB 29 0F 00 AND #$000F A:0C00 X:0000 Y:0001 P:envmxdIzc - Get rid of Bits.
$0B/FECE E2 20 SEP #$20 A:0000 X:0000 Y:0001 P:envmxdIZc - Set A to 8-Bits.
$0B/FED0 C9 0B CMP #$0B A:0000 X:0000 Y:0001 P:envMxdIZc - Is it Adult Rydia? (Had to recreate this routine since we were outside of the bank that originally contained it)
$0B/FED2 D0 02 BNE $02    [$FED6] A:0000 X:0000 Y:0001 P:eNvMxdIzc - If not, branch.
----------------------------------------
(Sets a 02 in A)
-------------------------------------
$0B/FED6 C9 0C CMP #$0C A:0000 X:0000 Y:0001 P:eNvMxdIzc - It it Edge or FuSoYa?
$0B/FED8 90 01 BCC $01    [$FEDB] A:0000 X:0000 Y:0001 P:eNvMxdIzc - If not, branch.
-------------------------
$0B/FEDA 3A DEC A A:000E X:000E Y:0032 P:envmxdIzC (For jobs this helps reach the Actual Spell Learning Table.
-----------------------
$0B/FEDB AA TAX A:0000 X:0000 Y:0001 P:eNvMxdIzc - Transfer A to X.
$0B/FEDC C2 20 REP #$20 A:0000 X:0000 Y:0001 P:envMxdIZc - Set A to 16-Bits.
$0B/FEDE A8 TAY A:0000 X:0000 Y:0001 P:envmxdIZc - Transfer A to Y.
$0B/FEDF A9 00 00 LDA #$0000 A:0000 X:0000 Y:0000 P:envmxdIZc - Load 0000 into A
~~~~~~~~~~~~(Looping Point)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$0B/FEE2 C0 00 00 CPY #$0000 A:0000 X:0000 Y:0000 P:envmxdIZc - Is Y 0000? (Has it reached the proper Spell Learning Point)
$0B/FEE5 F0 06 BEQ $06    [$FEED] A:0000 X:0000 Y:0000 P:envmxdIZC - If so, branch.
---------------------------------------------
$0B/FEE7 69 0F 00 ADC #$000F A:0000 X:000D Y:000D P:envmxdIzC - Add 0F (10) into A.
$0B/FEEA 88 DEY A:0010 X:000D Y:000D P:envmxdIzc  - 1 from Y.
$0B/FEEB 80 F5 BRA $F5    [$FEE2] A:0010 X:000D Y:000C P:envmxdIzc - Loop back.
-----------------------------------------------
$0B/FEED AA TAX A:0000 X:0000 Y:0000 P:envmxdIZC - Transfer A to X.
$0B/FEEE E2 20 SEP #$20 A:0000 X:0000 Y:0000 P:envmxdIZC - Set A to 8 Bits.
$0B/FEF0 A0 08 00 LDY #$0008 A:0000 X:0000 Y:0000 P:envMxdIZC - Load 0008 into Y (checking all eight spells)
~~~~~~~~~~~~~~~~~~~~(Looping Point)~~~~~~~~~~~~~~~~~~~~~~~~``
$0B/FEF3 BF 40 C6 0F LDA $0FC640,x[$0F:C640] A:0000 X:0000 Y:0008 P:envMxdIzC - Load Spell Learning Point.
$0B/FEF7 CD FE 14 CMP $14FE  [$7E:14FE] A:000A X:0000 Y:0008 P:envMxdIzC - Compare it with the Job Tracker stored by the previous Routine.
$0B/FEFA B0 0B BCS $0B    [$FF07] A:000A X:0000 Y:0008 P:envMxdIzC - Branch if more.
------------------------------------------
$0B/FEFC E8 INX A:0001 X:00D0 Y:0008 P:eNvMxdIzc - +2 X
$0B/FEFD E8 INX A:0001 X:00D1 Y:0008 P:envMxdIzc
$0B/FEFE 88 DEY A:0001 X:00D2 Y:0008 P:envMxdIzc -1 Y
$0B/FEFF C0 00 00 CPY #$0000 A:0001 X:00D2 Y:0007 P:envMxdIzc - Is Y 00?
$0B/FF02 D0 EF BNE $EF    [$FEF3] A:0001 X:00D2 Y:0007 P:envMxdIzC - If not, loop back.
-----------------------------------------------------------
(Load 0000 into A) This is used if the job is Mastered.
----------------------------------------------
$0B/FF07 C2 20 REP #$20 A:000A X:0000 Y:0008 P:envMxdIzC  - Set A to 16 Bits
$0B/FF09 6B RTL A:000A X:0000 Y:0008 P:envmxdIzC - Return

And it is done! As I promised here is a picture, probably the most underwhelming thing ever seen, but it took a Lot of work to display it all correctly.

(http://i112.photobucket.com/albums/n198/LastingDawn/FFIV%20-%20Job%20Point%20Display_zps4buz9jc8.png) (http://s112.photobucket.com/user/LastingDawn/media/FFIV%20-%20Job%20Point%20Display_zps4buz9jc8.png.html)




Title: Re: Grimoire LD's Notes, Patches, and Hacks (A Working Job System!)
Post by: chillyfeez on April 28, 2015, 06:33:11 PM
That's awesome!
It feels much more authentic when the game is actually tracking progression for the player.
Nice work!
Title: Re: Grimoire LD's Notes, Patches, and Hacks (A Working Job System!)
Post by: JCE3000GT on April 28, 2015, 08:27:59 PM
Omg how much HP does he have?!  In all seriousness great work! 
Title: Re: Grimoire LD's Notes, Patches, and Hacks (A Working Job System!)
Post by: Grimoire LD on April 30, 2015, 09:04:20 PM
Thanks fellows! With the Job System raring to go I'm now in the progress of creating the routine for the 72 new spells (note, this does not mean 72 new routines, or else I would be at that step forever...) to make sure each character will be receiving a robust spell book where each character will feel and play unique. (I'm hoping). With Rydia, what I'm likely going to do is have several of her summons learned through her Jobs, things like Chocobo, the three Elemental Summons, and Titan for instance. If I can ever grasp what Chillyfeez did with changing Summon Monsters, I would even plan on changing Imp, Bomb, Roc, and Mage summons for something else to mix it up.  Ideally I would also like to turn Asura into different summons, but that would involve finding out what causes her summon formation to cycle through her masks in the first place, which sounds like a lot of work.

As for now I'm looking at another lesser explored portion, that which decides what graphics or palettes to attach to characters when falling under status.

What I've learned...

7EF015-18 looks to be what the game looks at (for the first slot) to determine what state that character is in and from there I can distinguish all else...

In any case this is some great fodder for new additions for FF4kster!

Status Graphical Effects on Characters



Code: [Select]
$02/DE9A B9 15 F0 LDA $F015,y[$7E:F015] A:0001 X:0000 Y:0000 P:envMxdIzC - Load Status Byte 1 into A.
$02/DE9D 85 0E STA $0E    [$00:000E] A:0001 X:0000 Y:0000 P:envMxdIzC - Store it in 0E (rinse and repeat thrice more)
$02/DE9F B9 16 F0 LDA $F016,y[$7E:F016] A:0001 X:0000 Y:0000 P:envMxdIzC
$02/DEA2 85 0F STA $0F    [$00:000F] A:0000 X:0000 Y:0000 P:envMxdIZC
$02/DEA4 B9 17 F0 LDA $F017,y[$7E:F017] A:0000 X:0000 Y:0000 P:envMxdIZC
$02/DEA7 85 10 STA $10    [$00:0010] A:0000 X:0000 Y:0000 P:envMxdIZC
$02/DEA9 B9 18 F0 LDA $F018,y[$7E:F018] A:0000 X:0000 Y:0000 P:envMxdIZC
$02/DEAC 85 11 STA $11    [$00:0011] A:0000 X:0000 Y:0000 P:envMxdIZC
$02/DEAE A5 0E LDA $0E    [$00:000E] A:0000 X:0000 Y:0000 P:envMxdIZC - Load Status Byte 1 from 0E.
$02/DEB0 29 80 AND #$80 A:0001 X:0000 Y:0000 P:envMxdIzC - Is it KO'ed?
$02/DEB2 F0 0A BEQ $0A    [$DEBE] A:0000 X:0000 Y:0000 P:envMxdIZC - If not, branch.
------------------------------------------------------------------------------------------------------
$02/DEB4 E6 64 INC $64    [$00:0064] A:0080 X:0000 Y:0000 P:eNvMxdIzC - Add +1 to 64.
$02/DEB6 A9 09 LDA #$09 A:0080 X:0000 Y:0000 P:envMxdIzC - Load Swoon into A
$02/DEB8 9D D0 EF STA $EFD0,x[$7E:EFD0] A:0009 X:0000 Y:0000 P:envMxdIzC - Store A in Pose Byte.
$02/DEBB 4C DB DF JMP $DFDB  [$02:DFDB] A:0009 X:0000 Y:0000 P:envMxdIzC - Ignore all other Status Graphics.
-----------------------------------------------------------------------------------------------------------
$02/DEBE A5 0E LDA $0E    [$00:000E] A:0000 X:0000 Y:0000 P:envMxdIZC - Load Status Byte 1.
$02/DEC0 29 40 AND #$40 A:0001 X:0000 Y:0000 P:envMxdIzC - Is it Stone?
$02/DEC2 F0 0E BEQ $0E    [$DED2] A:0000 X:0000 Y:0000 P:envMxdIZC - If not, branch.
---------------------------------------------------------------------------------------
$02/DEC6 A9 03 LDA #$03 A:0040 X:0000 Y:0000 P:envMxdIzc - Load something into A. (It colors the body, gray, but different values have different shades of coloration)
$02/DEC8 9D CC EF STA $EFCC,x[$7E:EFCC] A:0003 X:0000 Y:0000 P:envMxdIzc - Store A in Stone-Color Area?
$02/DECB 1A INC A A:0003 X:0000 Y:0000 P:envMxdIzc - +1 to A.
$02/DECC 9D D0 EF STA $EFD0,x[$7E:EFD0] A:0004 X:0000 Y:0000 P:envMxdIzc - Store Pose of Crouching into Pose Byte.
$02/DECF 4C DB DF JMP $DFDB  [$02:DFDB] A:0004 X:0000 Y:0000 P:envMxdIzc - Ignore all other status graphics.
-----------------------------------------------------------------------------------
$02/DED2 A5 0F LDA $0F    [$00:000F] A:0000 X:0000 Y:0000 P:envMxdIZC - Load Status Byte 2
$02/DED4 29 03 AND #$03 A:0000 X:0000 Y:0000 P:envMxdIZC - Keep 1/3 and 2/3 Petrified.
$02/DED6 9D CC EF STA $EFCC,x[$7E:EFCC] A:0000 X:0000 Y:0000 P:envMxdIZC - Store A in 7EEFCC
$02/DED9 A5 0E LDA $0E    [$00:000E] A:0000 X:0000 Y:0000 P:envMxdIZC - Load Status Byte 1 into A
$02/DEDB 29 01 AND #$01 A:0001 X:0000 Y:0000 P:envMxdIzC - Is it Poison?
$02/DEDD F0 08 BEQ $08    [$DEE7] A:0001 X:0000 Y:0000 P:envMxdIzC - If not, branch.
---------------------------------------------------------------------------------------------
$02/DEDF 20 D9 DA JSR $DAD9  [$02:DAD9] A:0001 X:0000 Y:0000 P:envMxdIzC - Jump to Subroutine
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$02/DAD9 DA PHX A:0001 X:0000 Y:0000 P:envMxdIzC - Push X onto Stack
$02/DADA A5 47 LDA $47    [$00:0047] A:0001 X:0000 Y:0000 P:envMxdIzC - Load A from 47.
$02/DADC 18 CLC A:0000 X:0000 Y:0000 P:envMxdIZC - Clear Carry.
$02/DADD 69 09 ADC #$09 A:0000 X:0000 Y:0000 P:envMxdIZc - Add 09 into A.
$02/DADF C2 20 REP #$20 A:0009 X:0000 Y:0000 P:envMxdIzc - Set A to 16 Bits
$02/DAE1 0A ASL A A:0009 X:0000 Y:0000 P:envmxdIzc
$02/DAE2 0A ASL A A:0012 X:0000 Y:0000 P:envmxdIzc
$02/DAE3 0A ASL A A:0024 X:0000 Y:0000 P:envmxdIzc
$02/DAE4 0A ASL A A:0048 X:0000 Y:0000 P:envmxdIzc
$02/DAE5 0A ASL A A:0090 X:0000 Y:0000 P:envmxdIzc A x20
$02/DAE6 AA TAX A:0120 X:0000 Y:0000 P:envmxdIzc - Transfer A to X.
$02/DAE7 A9 7D F6 LDA #$F67D A:0120 X:0120 Y:0000 P:envmxdIzc - Load Changed Skin Palette into A..
$02/DAEA 9D 56 ED STA $ED56,x[$7E:EE76] A:F67D X:0120 Y:0000 P:eNvmxdIzc - Store A in ?Palette Area?
$02/DAED A9 30 7D LDA #$7D30 A:F67D X:0120 Y:0000 P:eNvmxdIzc - Load 2nd Changed Skin Palette into A.
$02/DAF0 9D 58 ED STA $ED58,x[$7E:EE78] A:7D30 X:0120 Y:0000 P:envmxdIzc - Store A in ?Palette Area?
$02/DAF3 7B TDC A:7D30 X:0120 Y:0000 P:envmxdIzc - Set A to 00 (normally)
$02/DAF7 E2 20 SEP #$20 A:0000 X:0120 Y:0000 P:envmxdIZc - Set A to 8 Bits.
$02/DAF9 FA PLX A:0000 X:0120 Y:0000 P:envMxdIZc - Pull X
$02/DAFA 60 RTS A:0000 X:0000 Y:0000 P:envMxdIZc - Return
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$02/DEE2 A9 04 LDA #$04 A:0000 X:0000 Y:0000 P:envMxdIZc - Load !Pose! into A. (Finally! Poison should not be enough to kneel!)
$02/DEE4 9D D0 EF STA $EFD0,x[$7E:EFD0] A:0004 X:0000 Y:0000 P:envMxdIzc - Store A in (what must be the poses area)
-----------------------------------------------------------------------------------------------------------
$02/DEE7 A5 10 LDA $10    [$00:0010] A:0001 X:0000 Y:0000 P:envMxdIzc - Load Status Byte 3 into A.
$02/DEE9 29 01 AND #$01 A:0000 X:0000 Y:0000 P:envMxdIZc - Is it Count?
$02/DEEB F0 12 BEQ $12    [$DEFF] A:0000 X:0000 Y:0000 P:envMxdIZc - If not, branch.
----------------------------------------------------------------------------------------------------------
$02/DEED 5A PHY A:0001 X:0000 Y:0000 P:envMxdIzc - Push Y onto Stack.
$02/DEEE A5 47 LDA $47    [$00:0047] A:0001 X:0000 Y:0000 P:envMxdIzc - Load A from 47.
$02/DEF0 A8 TAY A:0000 X:0000 Y:0000 P:envMxdIZc - Transfer A to Y.
$02/DEF1 B9 AF F0 LDA $F0AF,y[$7E:F0AF] A:0000 X:0000 Y:0000 P:envMxdIZc - Load F0AF into A.
$02/DEF4 D0 08 BNE $08    [$DEFE] A:0000 X:0000 Y:0000 P:envMxdIZc - If not 00, branch.
-----------------------------------------------------------------------------------------
$02/DEF6 7A PLY A:0000 X:0000 Y:0000 P:envMxdIZc - Pull Y from Stack.
$02/DEF7 22 AE EA 01 JSL $01EAAE[$01:EAAE] A:0000 X:0000 Y:0000 P:envMxdIZc - Jump Long to Subroutine
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$01/EAAE DA PHX A:0000 X:0000 Y:0000 P:envMxdIZc - Push X onto Stack
$01/EAAF A5 47 LDA $47    [$00:0047] A:0000 X:0000 Y:0000 P:envMxdIZc - Load A from 47.
$01/EAB1 AA TAX A:0000 X:0000 Y:0000 P:envMxdIZc - Transfer A to X.
$01/EAB2 BF 17 FD 0D LDA $0DFD17,x[$0D:FD17] A:0000 X:0000 Y:0000 P:envMxdIZc - Load A from 0DFD17.
$01/EAB6 AA TAX A:0000 X:0000 Y:0000 P:envMxdIZc - Transfer A to X.
$01/EAB7 BD 16 2A LDA $2A16,x[$7E:2A16] A:0000 X:0000 Y:0000 P:envMxdIZc - Load A from 7E2A16.
$01/EABA AA TAX A:0000 X:0000 Y:0000 P:envMxdIZc - Transfer A to X.
$01/EABB 86 1C STX $1C    [$00:001C] A:0000 X:0000 Y:0000 P:envMxdIZc - Store X in 1C.
$01/EABD A2 0A 00 LDX #$000A A:0000 X:0000 Y:0000 P:envMxdIZc - Load 000A into X.
$01/EAC0 86 1E STX $1E    [$00:001E] A:0000 X:000A Y:0000 P:envMxdIzc - Store X in 1E.
$01/EAC2 20 7D EA JSR $EA7D  [$01:EA7D] A:0000 X:000A Y:0000 P:envMxdIzc - Jump to Subroutine (Cleaning)
$01/EAC5 A5 22 LDA $22    [$00:0022] A:0000 X:000A Y:0000 P:envMxdIzc - Load A from 22.
$01/EAC7 18 CLC A:0000 X:000A Y:0000 P:envMxdIZc - Clear Carry.
$01/EAC8 69 70 ADC #$70 A:0000 X:000A Y:0000 P:envMxdIZc - Add 70 onto a. (Base graphic number of the 1st Doom Digit)
$01/EACA 8D 7A F0 STA $F07A  [$7E:F07A] A:0070 X:000A Y:0000 P:envMxdIzc - Store A in F07A.
$01/EACD A5 20 LDA $20    [$00:0020] A:0070 X:000A Y:0000 P:envMxdIzc - Load A from 20.
$01/EACF 18 CLC A:0000 X:000A Y:0000 P:envMxdIZc - Clear Carry.
$01/EAD0 69 70 ADC #$70 A:0000 X:000A Y:0000 P:envMxdIZc - Add 70 onto A. (Basic graphic number of the 2nd Doom Digit.
$01/EAD2 8D 79 F0 STA $F079  [$7E:F079] A:0070 X:000A Y:0000 P:envMxdIzc - Store A in F079.
$01/EAD5 FA PLX A:0070 X:000A Y:0000 P:envMxdIzc - Pull X from Stack.
$01/EAD6 A9 04 LDA #$04 A:0070 X:0000 Y:0000 P:envMxdIZc - Load Crouching into A.
$01/EAD8 9D D0 EF STA $EFD0,x[$7E:EFD0] A:0004 X:0000 Y:0000 P:envMxdIzc - Store A in Pose Byte.
$01/EADB A9 09 LDA #$09 A:0004 X:0000 Y:0000 P:envMxdIzc - Load Count Numbers above head into A.
$01/EADD 8D 78 F0 STA $F078  [$7E:F078] A:0009 X:0000 Y:0000 P:envMxdIzc - Store A in Status Special Graphic Display.
$01/EAE0 6B RTL A:0009 X:0000 Y:0000 P:envMxdIzc - Return from Long.
$02/DEFB 4C CD DF JMP $DFCD  [$02:DFCD] A:0009 X:0000 Y:0000 P:envMxdIzc - Ignore all other Status Graphics.
------------------------------------------------------------------------------------------------------------
$02/DEFF A5 10 LDA $10    [$00:0010] A:0000 X:0000 Y:0000 P:envMxdIZc - Load Status Byte 3 into A.
$02/DF01 29 80 AND #$80 A:0000 X:0000 Y:0000 P:envMxdIZc  - Is it Magnetized?
$02/DF03 F0 0B BEQ $0B    [$DF10] A:0000 X:0000 Y:0000 P:envMxdIZc - If not, branch.
---------------------------------------------------------------------------------------------------------
$02/DF05 A9 04 LDA #$04 A:0080 X:0000 Y:0000 P:eNvMxdIzc - Load Crouching into A.
$02/DF07 9D D0 EF STA $EFD0,x[$7E:EFD0] A:0004 X:0000 Y:0000 P:envMxdIzc - Store A in Pose Byte.
$02/DF0A 8D 78 F0 STA $F078  [$7E:F078] A:0004 X:0000 Y:0000 P:envMxdIzc - Store A in Special Status Graphic Byte.
$02/DF0D 4C CD DF JMP $DFCD  [$02:DFCD] A:0004 X:0000 Y:0000 P:envMxdIzc - Ignore all other Status Graphics.
---------------------------------------------------------------------------------------------------------
$02/DF10 A5 0E LDA $0E    [$00:000E] A:0000 X:0000 Y:0000 P:envMxdIZc - Load Status Byte 1 into A.
$02/DF12 29 04 AND #$04 A:0001 X:0000 Y:0000 P:envMxdIzc - Is it Mute?
$02/DF14 F0 0D BEQ $0D    [$DF23] A:0000 X:0000 Y:0000 P:env - If not, branch.
---------------------------------------------------------------------------------------------------------
$02/DF16 A9 04 LDA #$04 A:0004 X:0000 Y:0000 P:envMxdIzc - Load Crouching into A.
$02/DF18 9D D0 EF STA $EFD0,x[$7E:EFD0] A:0004 X:0000 Y:0000 P:envMxdIzc - Store A in Pose Byte. 
$02/DF1B A9 01 LDA #$01 A:0004 X:0000 Y:0000 P:envMxdIzc - Load 01 into A.
$02/DF1D 8D 78 F0 STA $F078  [$7E:F078] A:0001 X:0000 Y:0000 P:envMxdIzc - Store A in Special Status Graphic.
$02/DF20 4C CD DF JMP $DFCD  [$02:DFCD] A:0001 X:0000 Y:0000 P:envMxdIzc - Ignore all other Status Graphics.
-------------------------------------------------------------------------------------------------------------
$02/DF23 A5 0E LDA $0E    [$00:000E] A:0000 X:0000 Y:0000 P:envMxdIZc - Load Status Byte 1 into A.
$02/DF25 29 02 AND #$02 A:0001 X:0000 Y:0000 P:envMxdIzc - Is it Blind?
$02/DF27 F0 0D BEQ $0D    [$DF36] A:0000 X:0000 Y:0000 P:envMxdIZc - If not, branch.
-----------------------------------------------------------------------------------------------------------
$02/DF29 A9 04 LDA #$04 A:0002 X:0000 Y:0000 P:envMxdIzc - Load Crouching into A.
$02/DF2B 9D D0 EF STA $EFD0,x[$7E:EFD0] A:0004 X:0000 Y:0000 P:envMxdIzc - Store A in Pose Byte.
$02/DF2E A9 02 LDA #$02 A:0004 X:0000 Y:0000 P:envMxdIzc - Load Blind Eyes into A
$02/DF30 8D 78 F0 STA $F078  [$7E:F078] A:0002 X:0000 Y:0000 P:envMxdIzc - Store A in Special Status Graphic.
$02/DF33 4C CD DF JMP $DFCD  [$02:DFCD] A:0002 X:0000 Y:0000 P:envMxdIzc - Ignore all other Status Graphic.
------------------------------------------------------------------------------------------------------------
$02/DF36 A5 0F LDA $0F    [$00:000F] A:0000 X:0000 Y:0000 P:envMxdIZc - Load Status Byte 2 into A.
$02/DF38 29 80 AND #$80 A:0000 X:0000 Y:0000 P:envMxdIZc - Is it Curse?
$02/DF3A F0 0C BEQ $0C    [$DF48] A:0000 X:0000 Y:0000 P:envMxdIZc - If not, branch.
-----------------------------------------------------------------------------------------------------------
$02/DF3C A9 04 LDA #$04 A:0080 X:0000 Y:0000 P:eNvMxdIzC - Load Crouching into A.
$02/DF3E 9D D0 EF STA $EFD0,x[$7E:EFD0] A:0004 X:0000 Y:0000 P:envMxdIzC - Store A in Pose Byte.
$02/DF41 0A ASL A A:0004 X:0000 Y:0000 P:envMxdIzC - x2 A (Skull)
$02/DF42 8D 78 F0 STA $F078  [$7E:F078] A:0008 X:0000 Y:0000 P:envMxdIzc - Store A in Special Status Graphic.
$02/DF45 4C CD DF JMP $DFCD  [$02:DFCD] A:0008 X:0000 Y:0000 P:envMxdIzc - Ignore all other Status Graphic.
----------------------------------------------------------------------------------------------------------
$02/DF49 A5 47 LDA $47    [$00:0047] A:0000 X:0000 Y:0000 P:envMxdIZc - Load A from 0047.
$02/DF4B A8 TAY A:0000 X:0000 Y:0000 P:envMxdIZc - Transfer A to Y.
$02/DF4C B9 AF F0 LDA $F0AF,y[$7E:F0AF] A:0000 X:0000 Y:0000 P:envMxdIZc - Load A from 7EF0AF.
$02/DF4F F0 04 BEQ $04    [$DF55] A:0000 X:0000 Y:0000 P:envMxdIZc - Branch if 00.
----------------------------------------------------

------------------------------------------------------
$02/DF55 7A PLY A:0000 X:0000 Y:0000 P:envMxdIZc - Pull Y from Stack
$02/DF56 A5 0F LDA $0F    [$00:000F] A:0000 X:0000 Y:0000 P:envMxdIZc - Load Status Byte 2 into A.
$02/DF58 29 20 AND #$20 A:0000 X:0000 Y:0000 P:envMxdIZc - Is it Paralyze?
$02/DF5A F0 0D BEQ $0D    [$DF69] A:0000 X:0000 Y:0000 P:envMxdIZc - If not, branch.
----------------------------------------------------
$02/DF5C E6 64 INC $64    [$00:0064] A:0020 X:0000 Y:0000 P:envMxdIzc - +1 to 64.
$02/DF5E A9 04 LDA #$04 A:0020 X:0000 Y:0000 P:envMxdIzc - Load Crouching/Paralysis Waves into A.
$02/DF60 9D D0 EF STA $EFD0,x[$7E:EFD0] A:0004 X:0000 Y:0000 P:envMxdIzc - Store A in Pose Byte.
$02/DF63 8D 78 F0 STA $F078  [$7E:F078] A:0004 X:0000 Y:0000 P:envMxdIzc - Store A in Special Status Graphic
$02/DF66 4C CD DF JMP $DFCD  [$02:DFCD] A:0004 X:0000 Y:0000 P:envMxdIzc - Ignore other Status Graphics.
-----------------------------------------------
$02/DF69 A5 0F LDA $0F    [$00:000F] A:0000 X:0000 Y:0000 P:envMxdIZc - Load Status Byte 2 into A.
$02/DF6B 29 10 AND #$10 A:0000 X:0000 Y:0000 P:envMxdIZc - Is it Sleep?
$02/DF6D F0 0E BEQ $0E    [$DF7D] A:0000 X:0000 Y:0000 P:envMxdIZc - Branch if not.
-----------------------------------
$02/DF6F E6 64 INC $64    [$00:0064] A:0010 X:0000 Y:0000 P:envMxdIzc - +1 to 64.
$02/DF71 A9 04 LDA #$04 A:0010 X:0000 Y:0000 P:envMxdIzc - Load Crouching into A.
$02/DF73 9D D0 EF STA $EFD0,x[$7E:EFD0] A:0004 X:0000 Y:0000 P:envMxdIzc - Store A in Pose Byte.
$02/DF76 1A INC A A:0004 X:0000 Y:0000 P:envMxdIzc - +1 to A (Sleep Bubble)
$02/DF77 8D 78 F0 STA $F078  [$7E:F078] A:0005 X:0000 Y:0000 P:envMxdIzc - Store A in Special Graphic Data.
$02/DF7A 4C CD DF JMP $DFCD  [$02:DFCD] A:0005 X:0000 Y:0000 P:envMxdIzc - Ignore Other Status (except now they're wasting bytes, since they can Branch to them since they're now in range)
------------------------------------
$02/DF7D A5 0F LDA $0F    [$00:000F] A:0000 X:0000 Y:0000 P:envMxdIZc- Load Status Byte 2.
$02/DF7F 29 08 AND #$08 A:0000 X:0000 Y:0000 P:envMxdIZc - Is it Charm?
$02/DF81 F0 0A BEQ $0A    [$DF8D] A:0000 X:0000 Y:0000 P:envMxdIZc - If not, branch.
--------------------------------
$02/DF83 E6 64 INC $64    [$00:0064] A:0008 X:0000 Y:0000 P:envMxdIzc - +1 to 64.
$02/DF85 A9 07 LDA #$07 A:0008 X:0000 Y:0000 P:envMxdIzc - Load Confusion Circles into A.
$02/DF87 8D 78 F0 STA $F078  [$7E:F078] A:0007 X:0000 Y:0000 P:envMxdIzc - Store A in Special Status Graphic.
$02/DF8A 4C CD DF JMP $DFCD  [$02:DFCD] A:0007 X:0000 Y:0000 P:envMxdIzc - Ignore Other Status (Copy and paste fellows, copy and paste...)
-----------------------------------
$02/DF8D A5 0F LDA $0F    [$00:000F] A:0000 X:0000 Y:0000 P:envMxdIZc - Load Status Byte 2.
$02/DF8F 29 40 AND #$40 A:0000 X:0000 Y:0000 P:envMxdIZc - Is it Float?
$02/DF91 F0 2B BEQ $2B    [$DFBE] A:0000 X:0000 Y:0000 P:envMxdIZc - Branch if not.
--------------------------------------------
02/DF93 AD 2D 35 LDA $352D  [$7E:352D] A:0040 X:0000 Y:0000 P:envMxdIzc - Load A from 7E352D into A.
$02/DF96 D0 26 BNE $26    [$DFBE] A:0000 X:0000 Y:0000 P:envMxdIZc -  - If not 00, branch.
$02/DF98 A5 64 LDA $64    [$00:0064] A:0000 X:0000 Y:0000 P:envMxdIZc - Load A from 64.
$02/DF9A D0 22 BNE $22    [$DFBE] A:0000 X:0000 Y:0000 P:envMxdIZc - If not 00, branch.
$02/DF9C DA PHX A:0000 X:0000 Y:0000 P:envMxdIZc - Push X onto Stack.
$02/DF9D A9 04 LDA #$04 A:0000 X:0000 Y:0000 P:envMxdIZc - Load 04 into A. (Velocity of the bouncing with Float)
$02/DF9F 85 1E STA $1E    [$00:001E] A:0004 X:0000 Y:0000 P:envMxdIzc - Store A in 1E.
$02/DFA1 A5 47 LDA $47    [$00:0047] A:0004 X:0000 Y:0000 P:envMxdIzc - Load A from 47.
$02/DFA3 0A ASL A A:0000 X:0000 Y:0000 P:envMxdIZc - x2 A
$02/DFA4 0A ASL A A:0000 X:0000 Y:0000 P:envMxdIZc - x2 A
$02/DFA5 18 CLC A:0000 X:0000 Y:0000 P:envMxdIZc - Clear Carry.
$02/DFA6 6D 13 18 ADC $1813  [$7E:1813] A:0000 X:0000 Y:0000 P:envMxdIZc - Add... something from some out of battle area?
$02/DFA9 0A ASL A A:0062 X:0000 Y:0000 P:envMxdIzc - x6 A.
$02/DFAA 0A ASL A A:00C4 X:0000 Y:0000 P:eNvMxdIzc
$02/DFAB 0A ASL A A:0088 X:0000 Y:0000 P:eNvMxdIzC
$02/DFAC 20 15 E0 JSR $E015  [$02:E015] A:0010 X:0000 Y:0000 P:envMxdIzC - Jump to Subroutine (???)
$02/DFAF FA PLX A:0000 X:0010 Y:0000 P:envMxdIZc - Pull X from Stack.
$02/DFB0 18 CLC A:0000 X:0000 Y:0000 P:envMxdIZc - Clear Carry Flag.
$02/DFB1 69 F8 ADC #$F8 A:0000 X:0000 Y:0000 P:envMxdIZc - Add F8 (How elevated the character floating is from their starting point).
$02/DFB3 9D C8 EF STA $EFC8,x[$7E:EFC8] A:00F8 X:0000 Y:0000 P:eNvMxdIzc - Store A in Character Position?
$02/DFB6 A9 06 LDA #$06 A:00F8 X:0000 Y:0000 P:eNvMxdIzc - Load Floating Shadow into A.
$02/DFB8 8D 78 F0 STA $F078  [$7E:F078] A:0006 X:0000 Y:0000 P:envMxdIzc - Store A in Special Status Graphic.
$02/DFBB 4C CD DF JMP $DFCD  [$02:DFCD] A:0006 X:0000 Y:0000 P:envMxdIzc - Ignore other Status.
---------------------------------------------
$02/DFBE A5 11 LDA $11    [$00:0011] A:0000 X:0000 Y:0000 P:envMxdIZc - Load Status Byte 4 into A.
$02/DFC0 29 01 AND #$01 A:0000 X:0000 Y:0000 P:envMxdIZc - Is it Critical?
$02/DFC2 F0 09 BEQ $09    [$DFCD] A:0000 X:0000 Y:0000 P:envMxdIZc - If not, branch.
-------------------------------------------
$02/DFC4 A9 04 LDA #$04 A:0001 X:0000 Y:0000 P:envMxdIzc - Load Crouching into A.
$02/DFC6 9D D0 EF STA $EFD0,x[$7E:EFD0] A:0004 X:0000 Y:0000 P:envMxdIzc - Store A in Pose Byte.
$02/DFC9 3A DEC A A:0004 X:0000 Y:0000 P:envMxdIzc - -1 from A (Critical Sweat)
$02/DFCA 8D 78 F0 STA $F078  [$7E:F078] A:0003 X:0000 Y:0000 P:envMxdIzc - Store A in Special Status Graphic
-------------------------------------------
$02/DFCD A5 0F LDA $0F    [$00:000F] A:0000 X:0000 Y:0000 P:envMxdIZc - Load Status Byte 2 into A.
$02/DFCF 29 08 AND #$08 A:0000 X:0000 Y:0000 P:envMxdIZc - Is it Charm? (Hmm? But that's above?)
$02/DFD1 F0 05 BEQ $05    [$DFD8] A:0000 X:0000 Y:0000 P:envMxdIZc - Branch if not.
------------------------------------------
02/DFD3 20 D7 DB JSR $DBD7  [$02:DBD7] A:0008 X:0000 Y:0000 P:envMxdIzc - Jump to Subroutine
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~````
$02/DBD7 DA PHX A:0008 X:0000 Y:0000 P:envMxdIzc - Push X onto Stack.
$02/DBD8 A5 47 LDA $47    [$00:0047] A:0008 X:0000 Y:0000 P:envMxdIzc - Load A from 47.
$02/DBDA AA TAX A:0000 X:0000 Y:0000 P:envMxdIZc - Transfer A to X.
$02/DBDB BD BC F2 LDA $F2BC,x[$7E:F2BC] A:0000 X:0000 Y:0000 P:envMxdIZc - Load A from 7EF2BC
$02/DBDE D0 05 BNE $05    [$DBE5] A:0000 X:0000 Y:0000 P:envMxdIZc - Branch if not 00.
$02/DBE0 BD AF F0 LDA $F0AF,x[$7E:F0AF] A:0000 X:0000 Y:0000 P:envMxdIZc - Load A from F0AF
$02/DBE3 F0 02 BEQ $02    [$DBE7] A:0000 X:0000 Y:0000 P:envMxdIZc - Branch if 00.
-------------------

---------------------
$02/DBE7 FA PLX A:0000 X:0000 Y:0000 P:envMxdIZc - Pull X.
$02/DBE8 BD CE EF LDA $EFCE,x[$7E:EFCE] A:0000 X:0000 Y:0000 P:envMxdIZc - Load A from 7EEFCE.
$02/DBEB 29 0F AND #$0F A:0001 X:0000 Y:0000 P:envMxdIzc - Get rid of Bits.
$02/DBED 9D CE EF STA $EFCE,x[$7E:EFCE] A:0001 X:0000 Y:0000 P:envMxdIzc - Store A in 7EEFCE.
$02/DBF0 BD C5 EF LDA $EFC5,x[$7E:EFC5] A:0001 X:0000 Y:0000 P:envMxdIzc - Load A from 7EEFC5.
$02/DBF3 C9 B0 CMP #$B0 A:00B0 X:0000 Y:0000 P:eNvMxdIzc - It is B0? (When set to other values will be closer or further away when they move to join the enemy)
$02/DBF5 F0 4F BEQ $4F    [$DC46] A:00B0 X:0000 Y:0000 P:envMxdIZC - Branch if so.
---------------------

------------------------
$02/DC46 BD CE EF LDA $EFCE,x[$7E:EFCE] A:00B0 X:0000 Y:0000 P:envMxdIZC - Load A from 7EEFCE
$02/DC49 09 01 ORA #$01 A:0001 X:0000 Y:0000 P:envMxdIzC - Get rid of Bits. (When set to 02 Character will face enemies)
$02/DC4B 9D CE EF STA $EFCE,x[$7E:EFCE] A:0001 X:0000 Y:0000 P:envMxdIzC - Store A in 7EEFCE
$02/DC4E 60 RTS A:0001 X:0000 Y:0000 P:envMxdIzC - Return
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$02/DFD6 80 03 BRA $03    [$DFDB] A:0001 X:0000 Y:0000 P:envMxdIzC - Branch to 3 bytes away.
------------------------------------------
$02/DFD8 20 4F DC JSR $DC4F  [$02:DC4F] A:0000 X:0000 Y:0000 P:envMxdIZc - Jump to Subroutine (???)

$01/EADB   A9 09   LDA #$09   A:0004   X:0000   Y:0000   P:envMxdIzc - Load Count Numbers above head into A.
$01/EADD   8D 78 F0   STA $F078  [$7E:F078]   A:0009   X:0000   Y:0000   P:envMxdIzc - Store A in Status Special Graphic Display.

Ah? New list to compile then...

00 - Nothing
01 - Mute
02 - Blind
03 - Critical
04 - Paralysis
05 - Sleeping
06 - Floating (I think, shadow shows on the floor)
07 - Confusion
08 - Curse
09 - Count

And that's it... hmm, a little disappointing, but at least that's there now.


Alright, now there's a bit from a basic hackers standpoint here that could easily be utilized if they wanted to change some things, most importantly for someone delving into new statuses (myself) would be some graphical representation. While I can't use any of the Special Status Graphics, I can manipulate the way Poison's works to create status ailments which changes the characters palette (could even throw in an exception to add Berserk to it all.

But here is the easily manipulable info...


KO'd
$02/DEB6   A9 09   LDA #$09   A:0080   X:0000   Y:0000   P:envMxdIzC - Load Swoon into A
$02/DEB8   9D D0 EF   STA $EFD0,x[$7E:EFD0]   A:0009   X:0000   Y:0000   P:envMxdIzC - Store A in Pose Byte.


Poison
$02/DAE7   A9 7D F6   LDA #$F67D   A:0120   X:0120   Y:0000   P:envmxdIzc - Load Changed Skin Palette into A..
$02/DAEA   9D 56 ED   STA $ED56,x[$7E:EE76]   A:F67D   X:0120   Y:0000   P:eNvmxdIzc - Store A in ?Palette Area?
$02/DAED   A9 30 7D   LDA #$7D30   A:F67D   X:0120   Y:0000   P:eNvmxdIzc - Load 2nd Changed Skin Palette into A.
$02/DAF0   9D 58 ED   STA $ED58,x[$7E:EE78]   A:7D30   X:0120   Y:0000   P:envmxdIzc - Store A in ?Palette Area?
$02/DEE2   A9 04   LDA #$04   A:0000   X:0000   Y:0000   P:envMxdIZc - Load !Pose! into A. (Finally! Poison should not be enough to kneel!)
$02/DEE4   9D D0 EF   STA $EFD0,x[$7E:EFD0]   A:0004   X:0000   Y:0000   P:envMxdIzc - Store A in (what must be the poses area)

Count
$01/EAD6   A9 04   LDA #$04   A:0070   X:0000   Y:0000   P:envMxdIZc - Load Crouching into A.
$01/EAD8   9D D0 EF   STA $EFD0,x[$7E:EFD0]   A:0004   X:0000   Y:0000   P:envMxdIzc - Store A in Pose Byte.

Magnetized
$02/DF05   A9 04   LDA #$04   A:0080   X:0000   Y:0000   P:eNvMxdIzc - Load Crouching into A.
$02/DF07   9D D0 EF   STA $EFD0,x[$7E:EFD0]   A:0004   X:0000   Y:0000   P:envMxdIzc - Store A in Pose Byte.

Mute
$02/DF16   A9 04   LDA #$04   A:0004   X:0000   Y:0000   P:envMxdIzc - Load Crouching into A.
$02/DF18   9D D0 EF   STA $EFD0,x[$7E:EFD0]   A:0004   X:0000   Y:0000   P:envMxdIzc - Store A in Pose Byte. 
Title: Re: Grimoire LD's Notes, Patches, and Hacks (A Working Job System!)
Post by: chillyfeez on April 30, 2015, 09:43:48 PM
Quote
If I can ever grasp what Chillyfeez did with changing Summon Monsters, I would even plan on changing Imp, Bomb, Roc, and Mage summons for something else to mix it up.  Ideally I would also like to turn Asura into different summons, but that would involve finding out what causes her summon formation to cycle through her masks in the first place, which sounds like a lot of work.

Lemme know if I can help you understand it. It's mind-bendingly complicated at first, but once you get a grasp of it it's not so bad.

Regarding Asura's changing, it's essentially the same principle used by sylph, Odin, bahamut, any summoned monster that changes its image during the summon. She has three different sprite arrangements, and the AV routine controls the rotation between them.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (A Working Job System!)
Post by: Grimoire LD on May 01, 2015, 11:44:37 AM
Quote
If I can ever grasp what Chillyfeez did with changing Summon Monsters, I would even plan on changing Imp, Bomb, Roc, and Mage summons for something else to mix it up.  Ideally I would also like to turn Asura into different summons, but that would involve finding out what causes her summon formation to cycle through her masks in the first place, which sounds like a lot of work.

Lemme know if I can help you understand it. It's mind-bendingly complicated at first, but once you get a grasp of it it's not so bad.

Regarding Asura's changing, it's essentially the same principle used by sylph, Odin, bahamut, any summoned monster that changes its image during the summon. She has three different sprite arrangements, and the AV routine controls the rotation between them.

If I could have six new summons (2 for replacing Asura, 4 for the original monster summons) I would be quite happy! I'm just surprised the matter is so complicated. Her AV routine you say? Well I can test something out on that...

No, her face continues to shift even if its not her proper Effect, I thought if maybe I switched the effect to one that didn't alter sprite like any of the four monsters it would not change the mask. I was wrong. How peculiar... but you must know something about this, since Summons seem tied to their hex byte, I've had no luck locating its location though.

In any event I would love to ask for you help on this eventually, but I should probably wait until it becomes pertinent. So far there's more important things to iron out...

Well I've made good on my newest information, I now have the means to create unique glows, (I use the term "glow loosely, it's more a changing of a character's outer palette which gives it  a glow-like effect) through the status graphic info above, meaning that statuses like Protect/Shell/Ruse/Elemental Shield/Lock/Sharp/Dull/Temper/and Saber can all have their own unique glows! Here's a sample...

Now I should note the one side effect of this is that the character will no longer continually shine when their turn arrives. But seeing their Command Skillset and their name light up should be enough of an idea of whose turn it is.

(http://i112.photobucket.com/albums/n198/LastingDawn/FFIV%20-%20Shell%20Aura_zpstgdof0hc.png) (http://s112.photobucket.com/user/LastingDawn/media/FFIV%20-%20Shell%20Aura_zpstgdof0hc.png.html)

(http://i112.photobucket.com/albums/n198/LastingDawn/FFIV%20-%20Protect%20Aura_zpsz5wk0czn.png) (http://s112.photobucket.com/user/LastingDawn/media/FFIV%20-%20Protect%20Aura_zpsz5wk0czn.png.html)

What's neat about this is that with a handy tool I found by another person who was having trouble understanding the 2 byte colors...


https://gbatemp.net/threads/4-digit-hex-colours.339549/

You can set whatever outer palette (or inner palette) that you like!

Now if I can somehow apply this to enemies and I'll be golden...



Title: Re: Grimoire LD's Notes, Patches, and Hacks (A Working Job System!)
Post by: chillyfeez on May 01, 2015, 12:27:26 PM
Actually, you're right about Asura.

I think in my testing, I looked into other summons that change their sporting, and when I observed a few that all change in the same way, I assumed the pattern extended to all summons. Silly me, thinking that anything in this game actually made sense, right?

So... I guess I'll have to look into that one at some point.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (A Working Job System!)
Post by: Grimoire LD on May 14, 2015, 06:33:31 AM
I better start doing some house cleaning for this thread... it's been far too long since I added many of my notes to the front of the topic and I haven't posted any of my Cecil Swap Hack yet because I wasn't sure if it was 100% working. At this point it appears to do so, so I will start with posting that...

I should note however this is Not one of my cleanest codes, there's a lot of redundant or older coding in here because it's so long and complex (for me) I was worried about messing up the branching points.

Cecil Swap Hack - Game Start Code

This section of the code is accessed when you start a new game.

Code: [Select]
$00/E65F 5C A0 E3 0D JMP $0DE3A0[$0D:E3A0] A:0600 X:0020 Y:0000 P:envMxdIzC - Jump to Custom Code
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~``
$0D/E3A0 DA PHX A:0600 X:0020 Y:0000 P:envMxdIzC - Push X onto Stack
$0D/E3A1 A0 00 00 LDY #$0000 A:0600 X:0020 Y:0000 P:envMxdIzC - Load 0000 into Y.
$0D/E3A4 C2 20 REP #$20 A:0600 X:0020 Y:0000 P:envMxdIZC - Set A to 16 Bit.
$0D/E3A6 A9 00 00 LDA #$0000 A:0600 X:0020 Y:0000 P:envmxdIZC - Load 0000 into A.
$0D/E3A9 E2 20 SEP #$20 A:0000 X:0020 Y:0000 P:envmxdIZC - Set A to 8 Bit.
$0D/E3AB A2 00 00 LDX #$0000 A:0000 X:0020 Y:0000 P:envMxdIZC - Load 0000 into X. (These could all be condensed to setting A to 16 Bit, and transferring A to X and Y.)
~~~~~~~~~~~~~~~~~~~~~~~Looping Point~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$0D/E3AE BF 00 A9 0F LDA $0FA900,x[$0F:A900] A:0000 X:0000 Y:0000 P:envMxdIZC - Load Character 1's ROM Data into A.
$0D/E3B2 99 A0 14 STA $14A0,y[$00:14A0] A:0081 X:0000 Y:0000 P:eNvMxdIzC - Store A in Unused SRam.
$0D/E3B5 E8 INX A:0081 X:0000 Y:0000 P:eNvMxdIzC - +1 X
$0D/E3B6 C8 INY A:0081 X:0001 Y:0000 P:envMxdIzC - +1 Y
$0D/E3B7 C0 14 00 CPY #$0014 A:0081 X:0001 Y:0001 P:envMxdIzC - Is Y 14? (Has it transferred Actor, ID, Level, Status, HP, MP, and basic stats to Unused SRam?
$0D/E3BA D0 F2 BNE $F2    [$E3AE] A:0081 X:0001 Y:0001 P:eNvMxdIzc - If not, loop.
------------------------------------------------
$0D/E3BC A0 00 00 LDY #$0000 A:0003 X:0014 Y:0014 P:envMxdIZC - Load 0000 into Y.
~~~~~~~~~~~~~~~~~~~~~~~~~(Looping Point)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$0D/E3BF BF 00 A9 0F LDA $0FA900,x[$0F:A914] A:0003 X:0014 Y:0000 P:envMxdIZC - Load A from Character 1's ROM Data.
$0D/E3C3 99 CD 14 STA $14CD,y[$00:14CD] A:0002 X:0014 Y:0000 P:envMxdIzC  - Store A in (Critical Hil Chance/Damage/Unused Byte)
$0D/E3C6 E8 INX A:0002 X:0014 Y:0000 P:envMxdIzC - +1 X
$0D/E3C7 C8 INY A:0002 X:0015 Y:0000 P:envMxdIzC - +1 Y
$0D/E3C8 C0 03 00 CPY #$0003 A:0002 X:0015 Y:0001 P:envMxdIzC - Does Y = 0003?
$0D/E3CB D0 F2 BNE $F2    [$E3BF] A:0002 X:0015 Y:0001 P:eNvMxdIzc - If not, loop.
--------------------------------------------------
$0D/E3CD A0 00 00 LDY #$0000 A:000A X:0017 Y:0003 P:envMxdIZC - Load 0000 into Y.
~~~~~~~~~~~~~~~~~~~~~~~(Looping Point)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$0D/E3D0 BF 00 A9 0F LDA $0FA900,x[$0F:A917] A:000A X:0017 Y:0000 P:envMxdIZC - Load Character 1's Rom Data into A.
$0D/E3D4 99 D7 14 STA $14D7,y[$00:14D7] A:00B8 X:0017 Y:0000 P:eNvMxdIzC - Store A in Experience Sections.
$0D/E3D7 E8 INX A:00B8 X:0017 Y:0000 P:eNvMxdIzC - +1 X
$0D/E3D8 C8 INY A:00B8 X:0018 Y:0000 P:envMxdIzC - +1 Y
$0D/E3D9 C0 09 00 CPY #$0009 A:00B8 X:0018 Y:0001 P:envMxdIzC - Has it entered all data in Exp, Speed Modifier, Unknown, Exp to Level Up?
$0D/E3DC D0 F2 BNE $F2    [$E3D0] A:00B8 X:0018 Y:0001 P:eNvMxdIzc - If not, loop.
-----------------------------------------------
$0D/E3DE A0 00 00 LDY #$0000 A:0000 X:0020 Y:0009 P:envMxdIZC - Load 0000 into Y.
$0D/E3E1 A2 00 00 LDX #$0000 A:0000 X:0020 Y:0000 P:envMxdIZC - Load 0000 into X.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Looping Point)~~~~~~~~~~~~~~~~~~~~~
$0D/E3E4 BF 62 AB 0F LDA $0FAB62,x[$0F:AB62] A:0000 X:0000 Y:0000 P:envMxdIZC - Load A from Character 1's ROM Equipment.
$0D/E3E8 99 D0 14 STA $14D0,y[$00:14D0] A:0070 X:0000 Y:0000 P:envMxdIzC - Store A in (Helmet, Armor, Gauntlet, Right Hand/Quantity, Left Hand/Quantity)
$0D/E3EB E8 INX A:0070 X:0000 Y:0000 P:envMxdIzC - +1 X
$0D/E3EC C8 INY A:0070 X:0001 Y:0000 P:envMxdIzC - +1 Y.
$0D/E3ED C0 07 00 CPY #$0007 A:0070 X:0001 Y:0001 P:envMxdIzC - Has it stored all of those?
$0D/E3F0 D0 F2 BNE $F2    [$E3E4] A:0070 X:0001 Y:0001 P:eNvMxdIzc - If not, loop.
----------------------------------
$0D/E3F2 A2 00 00 LDX #$0000 A:0001 X:0007 Y:0007 P:envMxdIZC - Load 0000 into X.
$0D/E3F5 A0 00 00 LDY #$0000 A:0001 X:0000 Y:0007 P:envMxdIZC - Load 0000 into Y.
~~~~~~~~~~~~~~~~~~~~~~~~(Looping Point)~~~~~~~~~~~~~~~~~~~~~~~~~
$0D/E3F8 BF 00 E5 0D LDA $0DE500,x[$0D:E500] A:0001 X:0000 Y:0000 P:envMxdIZC - Load Custom Predetermined Character Statistic into A.
$0D/E3FC 99 B4 14 STA $14B4,y[$00:14B4] A:0012 X:0000 Y:0000 P:envMxdIzC - Store A in Modified Stats, Attack Dealings, Defense Dealing, Status Dealing, Etc)
$0D/E3FF E8 INX A:0012 X:0000 Y:0000 P:envMxdIzC - +1 X
$0D/E400 C8 INY A:0012 X:0001 Y:0000 P:envMxdIzC - +1 Y
$0D/E401 C0 16 00 CPY #$0016 A:0012 X:0001 Y:0001 P:envMxdIzC - Has it done this for all 16 bytes?
$0D/E404 D0 F2 BNE $F2    [$E3F8] A:0012 X:0001 Y:0001 P:eNvMxdIzc - If not, loop.
--------------------------------------------------
$0D/E406 FA PLX A:0018 X:0016 Y:0016 P:envMxdIZC - Pull X from Stack
$0D/E407 A0 00 00 LDY #$0000 A:0018 X:0020 Y:0016 P:envMxdIzC - Load 0000 into Y
$0D/E40A A9 00 LDA #$00 A:0018 X:0020 Y:0000 P:envMxdIZC - Load 00 into A.
$0D/E40C 5C 6E E6 00 JMP $00E66E[$00:E66E] A:0000 X:0020 Y:0000 P:envMxdIZC - Return to normal routines.

That's the first part... a simple process of storing the data as well as the pre-determined statistics which needed drawn from a source to make sure they matched with the actual stats upon return.

Cecil Swap Hack - Morph Command

This next part assumes that the Crash command was turned into the Morph Command. Here is the data on that...

Code: [Select]
$03/FF00 AD 9F 12 LDA $129F  [$7E:129F] A:0003 X:002A Y:0000 P:envMxdizc - Load Event Flag 248-255 into A.
$03/FF03 D0 09 BNE $09    [$FF0E] A:0080 X:002A Y:0000 P:eNvMxdizc - If not 00, branch.
------------------------------------------
$03/FF05 A9 07 LDA #$07 A:0000 X:002A Y:0000 P:envMxdiZc - Load Unused Message 07 into A. 
$03/FF07 8D CA 34 STA $34CA  [$7E:34CA] A:0007 X:002A Y:0000 P:envMxdizc - Store A in Message Section
$03/FF0A 4C A6 85 JMP $85A6  [$03:85A6] A:0007 X:002A Y:0000 P:envMxdizc - Jump to Message Routine (And out of custom routine.
--------------------------------------------
$03/FF0E A6 A6 LDX $A6    [$00:00A6] A:0080 X:002A Y:0000 P:eNvMxdizc - Load Character Slot into A.
$03/FF10 A9 15 LDA #$15 A:0080 X:0180 Y:0000 P:envMxdizc - Load 15 into A.
$03/FF12 8D 40 1C STA $1C40  [$7E:1C40] A:0015 X:0180 Y:0000 P:envMxdizc - Store A in Unused RAM (This is important, the game looks at this value once before changing it back to 00 to prevent a constant Morphing)
$03/FF15 BD 01 20 LDA $2001,x[$7E:2181] A:0015 X:0180 Y:0000 P:envMxdizc - Load Character Class into A.
$03/FF18 29 0F AND #$0F A:0009 X:0180 Y:0000 P:envMxdizc - Get rid of other bits.
$03/FF1A F0 0A BEQ $0A    [$FF26] A:0009 X:0180 Y:0000 P:envMxdizc - If Dark Knight, branch.
-----------------------------------
$03/FF1C A9 7F LDA #$7F A:0009 X:0180 Y:0000 P:envMxd - Load Disrupt Graphic into A.
$03/FF1E 8D C4 33 STA $33C4  [$7E:33C4] A:007F X:0180 Y:0000 P:envMxdizc - Store A in AV Effect.
$03/FF21 8D 8F 12 STA $128F  [$7E:128F] A:007F X:0180 Y:0000 P:envMxdizc - Store A in Event Flag 120-127. (This is how the game itself tells whether it is the Paladin or Dark Knight to display in conjunction with my Custom Event Flag Check Routine)
$03/FF24 80 08 BRA $08    [$FF2E] A:007F X:0180 Y:0000 P:envMxdizc - Branch Always.
--------------------------------
$03/FF26 A9 09 LDA #$09 A:0000 X:0180 Y:0000 P:envMxdiZc - Load Berserk Graphic into A.
$03/FF28 8D C4 33 STA $33C4  [$7E:33C4] A:0009 X:0180 Y:0000 P:envMxdizc - Store A in AV Effect.
$03/FF2B 8D 8F 12 STA $128F  [$7E:128F] A:0009 X:0180 Y:0000 P:envMxdizc - Store A in Event Flag 120-127. (How the game tells itself whether it is the Paladin or Dark Knight to display in conjunction with my Custom Event Flag Check Routine)
--------------------------------------------
$03/FF2E 60 RTS A:007F X:0180 Y:0000 P:envMxdizc - Return

The Actual Morph

This is spliced into the Status Check code and is checked after every action for every character. It also contains a jump to the 03 bank to get a couple of 03 bank capable JSR's.

Code: [Select]
$02/BFA4 5C 10 E4 0D JMP $0DE410[$0D:E410] A:0000 X:0000 Y:0000 P:envMxdiZc - Jump to Custom Code
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$0D/E410 86 FF STX $FF    [$00:00FF] A:0000 X:0000 Y:0000 P:envMxdiZc - Store Slot Identifier in FF (Crucial!!)
$0D/E412 BD 03 20 LDA $2003,x[$7E:2003] A:0000 X:0000 Y:0000 P:envMxdiZc - Load Character's Status Byte 1.
$0D/E415 29 08 AND #$08 A:0000 X:0000 Y:0000 P:envMxdiZc - Is it Pig?
$0D/E417 F0 04 BEQ $04    [$E41D] A:0000 X:0000 Y:0000 P:envMxdiZc - If not, branch.
-----------------------------------------------------------------------------------------
$0D/E419 5C AB BF 02 JMP $02BFAB[$02:BFAB] A:0000 X:0180 Y:000A P:envMxdizC - Jump to Pig Status Check and Application.
----------------------------------------------------------------------------------------------
$0D/E41D BD 51 20 LDA $2051,x[$7E:2051] A:0000 X:0000 Y:0000 P:envMxdiZc - Load Character's Action.
$0D/E420 C9 15 CMP #$15 A:001B X:0000 Y:0000 P:envMxdizc - Is it Morph?
$0D/E422 F0 04 BEQ $04    [$E428] A:001B X:0000 Y:0000 P:envMxdizC - If so, branch.
-------------------------------------------------------------------------------------------------------
$0D/E424 5C B6 BF 02 JMP $02BFB6[$02:BFB6] A:001B X:0000 Y:0000 P:envMxdizC - Jump back to normal Status Routine.
-------------------------------------------------------------------------------------------------
$0D/E428 AD 40 1C LDA $1C40  [$7E:1C40] A:0015 X:0180 Y:0003 P:envMxdiZC - Load A from Unused RAM.
$0D/E42B C9 15 CMP #$15 A:0015 X:0180 Y:0003 P:envMxdizC - Is it 15?
$0D/E42D D0 F5 BNE $F5    [$E424] A:0015 X:0180 Y:0003 P:envMxdiZC - If not, 15. Branch to the Jump to the Normal Status Routine (This is used to make sure that Cecil is not constantly morphing as this value is 00'd out at the end of this routine.)
$0D/E42F BD 01 20 LDA $2001,x[$7E:2181] A:0015 X:0180 Y:0003 P:envMxdiZC - Load A from Character's Class.
$0D/E432 29 0F AND #$0F A:0009 X:0180 Y:0003 P:envMxdizC - Get rid of Bits.
$0D/E434 D0 04 BNE $04    [$E43A] A:0009 X:0180 Y:0003 P:envMxdizC - Branch if not Dark Knight Cecil.
---------------------------------------------------------------------------------------------------------
$0D/E436 A9 09 LDA #$09 A:0000 X:0180 Y:0003 P:envMxdiZC - Load Paladin into A.
$0D/E438 80 02 BRA $02    [$E43C] A:0009 X:0180 Y:0003 P:envMxdizC - Branch.
--------------------------------------------------------------------------------------------------------------
$0D/E43A A9 00 LDA #$00 A:0009 X:0180 Y:0003 P:envMxdizC - Load Dark Knight into A.
$0D/E43C 9D 01 20 STA $2001,x[$7E:2181] A:0000 X:0180 Y:0003 P:envMxdiZC - Store A in Class (Paladin Cecil is now Dark Knight Cecil.)
$0D/E43F 99 35 F2 STA $F235,y[$7E:F238] A:0000 X:0180 Y:0003 P:envMxdiZC - Store A in Sprite.
$0D/E442 99 A3 F0 STA $F0A3,y[$7E:F0A6] A:0000 X:0180 Y:0003 P:envMxdiZC - Store A in Palette.
$0D/E445 BD 01 20 LDA $2001,x[$7E:2181] A:0000 X:0180 Y:0003 P:envMxdiZC - Load Character's Class into A.
$0D/E448 DA PHX A:0000 X:0180 Y:0003 P:envMxdiZC - Push X onto Stack.
$0D/E449 F0 22 BEQ $22    [$E46D] A:0000 X:0180 Y:0003 P:envMxdiZC - Branch if Dark Knight Cecil.
----------------------------------------------------------------------------------------------------------------------------
$0D/E44B 22 70 FF 03 JSL $03FF70[$03:FF70] A:0009 X:0180 Y:0003 P:envMxdizC - (See Below)
-----------------------------------------------------------------(Looping Point)-----------------------------------------
$0D/E44F BD 03 33 LDA $3303,x[$7E:3357] A:0054 X:0054 Y:0000 P:envMxdizC - Load Character's Commands.
 $0D/E452 C9 15 CMP #$15 A:0000 X:0054 Y:0000 P:envMxdiZC - Is it Morph?
$0D/E454 F0 06 BEQ $06    [$E45C] A:0000 X:0054 Y:0000 P:eNvMxdizc - If so, branch.
------------------------------------------------------------------------------------
$0D/E456 E8 INX A:0000 X:0054 Y:0000 P:eNvMxdizc +4 to X (To reach next command)
$0D/E457 E8 INX A:0000 X:0055 Y:0000 P:envMxdizc
$0D/E458 E8 INX A:0000 X:0056 Y:0000 P:envMxdizc
$0D/E459 E8 INX A:0000 X:0057 Y:0000 P:envMxdizc
$0D/E45A 80 F3 BRA $F3    [$E44F] A:0000 X:0058 Y:0000 P:envMxdizc - Loop back.
------------------------------------------------------------------------------------------
$0D/E45C A9 0D LDA #$0D A:0015 X:0060 Y:0000 P:envMxdiZC - Load Focus into A.
$0D/E45E 9D FF 32 STA $32FF,x[$7E:335F] A:000D X:0060 Y:0000 P:envMxdizC - Store A in Command Slot.
$0D/E461 A9 50 LDA #$50 A:000D X:0060 Y:0000 P:envMxdizC - Load Targeting into A.
$0D/E463 9D FE 32 STA $32FE,x[$7E:335E] A:0050 X:0060 Y:0000 P:envMxdizC - Store Targeting in Focus Targeting.
$0D/E466 A9 0E LDA #$0E A:0050 X:0060 Y:0000 P:envMxdizC - Load Kick into A.
$0D/E468 9D FB 32 STA $32FB,x[$7E:335B] A:000E X:0060 Y:0000 P:envMxdizC - Store A in Command Slot. (Kick and Recall have the same targeting so no need to switch those)
-------------------------------------------------------------------------------------------------------------------------------
$0D/E46D 22 70 FF 03 JSL $03FF70[$03:FF70] A:0000 X:0180 Y:0003 P:envMxdiZC - Jump to Custom Subroutine
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/FF70 C2 20 REP #$20 A:0000 X:0180 Y:0003 P:envMxdiZC - Set A to 16 Bit.
$03/FF72 A5 FF LDA $FF    [$00:00FF] A:0000 X:0180 Y:0003 P:envmxdiZC - Load A from Stored FF (Slot Identifier)
$03/FF74 4A LSR A A:0180 X:0180 Y:0003 P:envmxdizC Chop the Slot down to its most basic form.
$03/FF75 4A LSR A A:00C0 X:0180 Y:0003 P:envmxdizc
$03/FF76 4A LSR A A:0060 X:0180 Y:0003 P:envmxdizc
$03/FF77 4A LSR A A:0030 X:0180 Y:0003 P:envmxdizc
$03/FF78 4A LSR A A:0018 X:0180 Y:0003 P:envmxdizc
$03/FF79 4A LSR A A:000C X:0180 Y:0003 P:envmxdizc
$03/FF7A 4A LSR A A:0006 X:0180 Y:0003 P:envmxdizc
$03/FF7B A8 TAY A:0003 X:0180 Y:0003 P:envmxdizc - Transfer A to Y.
$03/FF7C E2 20 SEP #$20 A:0003 X:0180 Y:0003 P:envmxdizc - Set A back to 8 Bit.
$03/FF7E A9 00 LDA #$00 A:0003 X:0180 Y:0003 P:envMxdizc - Load 00 into A.
----------------------------------(Looping Point)-----------------------------------------------
$03/FF80 C0 00 00 CPY #$0000 A:0000 X:0180 Y:0003 P:envMxdiZc - Is Y 00?
$03/FF83 F0 05 BEQ $05    [$FF8A] A:0000 X:0180 Y:0003 P:envMxdizC - Branch if so.
-------------------------------------------------------------
$03/FF85 69 1B ADC #$1B A:0000 X:0180 Y:0003 P:envMxdizC - Add 1B to A.
$03/FF87 88 DEY A:001C X:0180 Y:0003 P:envMxdizc - -1 to Y.
$03/FF88 80 F6 BRA $F6    [$FF80] A:001C X:0180 Y:0002 P:envMxdizc - Loop back.
---------------------------------------------------------
$03/FF8A AA TAX A:0054 X:0180 Y:0000 P:envMxdiZC - Transfer A to X.
$03/FF8B 6B RTL A:0054 X:0054 Y:0000 P:envMxdizC - Return from Subroutine
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(What this is doing is setting X to reach Commands based on Slot Index. It's a possibility now that I actually look at it that it may have been able to do this just by transferring Y to A, but I didn't understand that for some reason.)
-------------------------------(Looping Point)-------------------------------------------------------------
$0D/E471 BD 03 33 LDA $3303,x[$7E:3357] A:0054 X:0054 Y:0000 P:envMxdizC - Load Slot Command into A.
$0D/E474 C9 15 CMP #$15 A:0000 X:0054 Y:0000 P:envMxdiZC - Is it Morph?
$0D/E476 F0 06 BEQ $06    [$E47E] A:0000 X:0054 Y:0000 P:eNvMxdizc - If so, branch.
------------------------------------------------------------------------------------------
$0D/E478 E8 INX A:0000 X:0054 Y:0000 P:eNvMxdizc - +4 X (to reach next command)
$0D/E479 E8 INX A:0000 X:0055 Y:0000 P:envMxdizc
$0D/E47A E8 INX A:0000 X:0056 Y:0000 P:envMxdizc
$0D/E47B E8 INX A:0000 X:0057 Y:0000 P:envMxdizc
$0D/E47C 80 F3 BRA $F3    [$E471] A:0000 X:0058 Y:0000 P:envMxdizc - Loop back.
------------------------------------------------------------------------------------------
$0D/E47E A9 05 LDA #$05 A:0015 X:0060 Y:0000 P:envMxdiZC - Load Dark Wave into A.
$0D/E480 9D FF 32 STA $32FF,x[$7E:335F] A:0005 X:0060 Y:0000 P:envMxdizC - Store A in Slot.
$0D/E483 A9 60 LDA #$60 A:0005 X:0060 Y:0000 P:envMxdizC - Load Targeting into A.
$0D/E485 9D FE 32 STA $32FE,x[$7E:335E] A:0060 X:0060 Y:0000 P:envMxdizC - Store A in Dark Wave Command Slot Targeting.
$0D/E488 9D FA 32 STA $32FA,x[$7E:335A] A:0060 X:0060 Y:0000 P:envMxdizC - Store A in Recall Command Slot Targeting.
$0D/E48B A9 07 LDA #$07 A:0060 X:0060 Y:0000 P:envMxdizC - Load Recall into A.
$0D/E48D 9D FB 32 STA $32FB,x[$7E:335B] A:0007 X:0060 Y:0000 P:envMxdizC - Store A in Recall Command Slot
$0D/E490 22 E3 FE 03 JSL $03FEE3[$03:FEE3] A:0007 X:0060 Y:0000 P:envMxdizC - Jump to Custom Subroutine
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$03/FEE3 A5 CD LDA $CD    [$00:00CD] A:0007 X:0060 Y:0000 P:envMxdizC
$03/FEE5 85 00 STA $00    [$00:0000] A:0003 X:0060 Y:0000 P:envMxdizC
$03/FEE7 A9 09 LDA #$09 A:0003 X:0060 Y:0000 P:envMxdizC
$03/FEE9 20 85 80 JSR $8085  [$03:8085] A:0009 X:0060 Y:0000 P:envMxdizC - (All Important parts of refreshing the Command List)
$03/FEEC 6B RTL A:0005 X:7504 Y:000A P:envMxdiZC - Return
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$0D/E494 5A PHY A:0005 X:7504 Y:000A P:envMxdiZC - Push Y onto Stack.
$0D/E495 A0 00 00 LDY #$0000 A:0005 X:7504 Y:000A P:envMxdiZC - Load 0000 into Y.
$0D/E498 EA NOP A:0005 X:7504 Y:0000 P:envMxdiZC - (Old code remnant).
$0D/E499 EA NOP A:0005 X:7504 Y:0000 P:envMxdiZC
--------------------------------(Looping Point)-----------------------------------------------
$0D/E49A B9 80 26 LDA $2680,y[$7E:2680] A:0005 X:7504 Y:0000 P:envMxdiZC - Load Mirror of Character into A.
$0D/E49D 99 00 1C STA $1C00,y[$7E:1C00] A:008A X:7504 Y:0000 P:eNvMxdizC - Store A in Unused RAM.
$0D/E4A0 E8 INX A:008A X:7504 Y:0000 P:eNvMxdizC - +1 X
$0D/E4A1 C8 INY A:008A X:7505 Y:0000 P:envMxdizC - +1 Y
$0D/E4A2 C0 40 00 CPY #$0040 A:008A X:7505 Y:0001 P:envMxdizC - Do this for the entire character's main data.
$0D/E4A5 D0 F3 BNE $F3    [$E49A] A:008A X:7505 Y:0001 P:eNvMxdizc - Loop if not done so.
---------------------------------------------------------------------------------
$0D/E4AA A6 FF LDX $FF    [$00:00FF] A:0000 X:7544 Y:0000 P:envMxdiZC - Load X from FF (Slot)
---------------------------------------------------------------(Looping Point)------------------------------------------------
$0D/E4AC B9 A0 14 LDA $14A0,y[$7E:14A0] A:0000 X:0180 Y:0000 P:envMxdizC - Load Unused SRam into A.
$0D/E4AF 9D 00 20 STA $2000,x[$7E:2180] A:0081 X:0180 Y:0000 P:eNvMxdizC - Store A in Character's Slot.
$0D/E4B2 E8 INX A:0081 X:0180 Y:0000 P:eNvMxdizC - +1 X
$0D/E4B3 C8 INY A:0081 X:0181 Y:0000 P:envMxdizC - +1 Y
$0D/E4B4 C0 40 00 CPY #$0040 A:0081 X:0181 Y:0001 P:envMxdizC - Do this for the entire character's main data.
$0D/E4B7 D0 F3 BNE $F3    [$E4AC] A:0081 X:0181 Y:0001 P:eNvMxdizc - Loop if not done so.
---------------------------------------------------------------------------------
$0D/E4B9 A0 00 00 LDY #$0000 A:0000 X:01C0 Y:0040 P:envMxdiZC - Load 0000 into Y.
$0D/E4BC EA NOP A:0000 X:01C0 Y:0000 P:envMxdiZC - Remnants.
$0D/E4BD EA NOP A:0000 X:01C0 Y:0000 P:envMxdiZC
---------------------------------------------(Looping Point)--------------------------------------------------------
$0D/E4BE B9 00 1C LDA $1C00,y[$7E:1C00] A:0000 X:01C0 Y:0000 P:envMxdiZC - Load A from Unused RAM.
$0D/E4C1 99 A0 14 STA $14A0,y[$7E:14A0] A:008A X:01C0 Y:0000 P:eNvMxdizC - Store A in Unused SRAM.
$0D/E4C4 E8 INX A:008A X:01C0 Y:0000 P:eNvMxdizC - +1 X
$0D/E4C5 C8 INY A:008A X:01C1 Y:0000 P:envMxdizC - +1 Y
$0D/E4C6 C0 40 00 CPY #$0040 A:008A X:01C1 Y:0001 P:envMxdizC - Do this for the entire character's main data.
$0D/E4C9 D0 F3 BNE $F3    [$E4BE] A:008A X:01C1 Y:0001 P:eNvMxdizc - Loop if not done so.
-----------------------------------------------------------------
$0D/E4CD BD 33 20 LDA $2033,x[$7E:21B3] A:0000 X:0180 Y:0040 P:envMxdizC - Load New Character's Right Hand Item into A.
$0D/E4D0 48 PHA A:0018 X:0180 Y:0040 P:envMxdizC - Push A,
$0D/E4D1 BD 35 20 LDA $2035,x[$7E:21B5] A:0018 X:0180 Y:0040 P:envMxdizC - Load New Character's Left Hand Item into A.
$0D/E4D4 48 PHA A:0063 X:0180 Y:0040 P:envMxdizC - Push A.
$0D/E4D5 8A TXA A:0063 X:0180 Y:0040 P:envMxdizC - Transfer X to A. (Remnant basically)
$0D/E4D6 22 90 FF 03 JSL $03FF90[$03:FF90] A:0080 X:0180 Y:0040 P:eNvMxdizC - Jump to Subroutine.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
$03/FF90 C2 20 REP #$20 A:0080 X:0180 Y:0040 P:eNvMxdizC - Set A to 16 Bit.
$03/FF92 A5 FF LDA $FF    [$00:00FF] A:0080 X:0180 Y:0040 P:eNvmxdizC - Load Slot into A.
$03/FF94 4A LSR A A:0180 X:0180 Y:0040 P:envmxdizC - /by many to reach base Slot.
$03/FF95 4A LSR A A:00C0 X:0180 Y:0040 P:envmxdizc
$03/FF96 4A LSR A A:0060 X:0180 Y:0040 P:envmxdizc
$03/FF97 4A LSR A A:0030 X:0180 Y:0040 P:envmxdizc
$03/FF98 4A LSR A A:0018 X:0180 Y:0040 P:envmxdizc
$03/FF99 4A LSR A A:000C X:0180 Y:0040 P:envmxdizc
$03/FF9A 4A LSR A A:0006 X:0180 Y:0040 P:envmxdizc
$03/FF9B A8 TAY A:0003 X:0180 Y:0040 P:envmxdizc - Transfer A to Y.
$03/FF9C E2 20 SEP #$20 A:0003 X:0180 Y:0003 P:envmxdizc - Set A back to 8 Bit.
$03/FF9E A9 00 LDA #$00 A:0003 X:0180 Y:0003 P:envMxdizc - Load 00 into A.
-------------------------------------(Looping Point)-----------------------------------------------
$03/FFA0 C0 00 00 CPY #$0000 A:0000 X:0180 Y:0003 P:envMxdiZc - Is Y 0000?
$03/FFA3 F0 05 BEQ $05    [$FFAA] A:0000 X:0180 Y:0003 P:envMxdizC - If so, branch.
----------------------------------------------------------------------------
$03/FFA5 69 07 ADC #$07 A:0000 X:0180 Y:0003 P:envMxdizC - Add 07 onto A (reaches next slot's equipment specifications)
$03/FFA7 88 DEY A:0008 X:0180 Y:0003 P:envMxdizc - -1 to Y.
$03/FFA8 80 F6 BRA $F6    [$FFA0] A:0008 X:0180 Y:0002 P:envMxdizc Loop back.
--------------------------------------------------------------------------
$03/FFAA AA TAX A:0018 X:0180 Y:0000 P:envMxdiZC - Transfer A to X.
$03/FFAB 6B RTL A:0018 X:0018 Y:0000 P:envMxdizC - Return.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~```
$0D/E4DA AA TAX A:0018 X:0018 Y:0000 P:envMxdizC - Transfer A to X (Remnant)
$0D/E4DB 68 PLA A:0018 X:0018 Y:0000 P:envMxdizC - Pull Item 1 from Stack
$0D/E4DC 9D DF 32 STA $32DF,x[$7E:32F7] A:0063 X:0018 Y:0000 P:envMxdizC - Store A in Right Hand.
$0D/E4DF 68 PLA A:0063 X:0018 Y:0000 P:envMxdizC - Pull Item 2 from Stack.
$0D/E4E0 9D DB 32 STA $32DB,x[$7E:32F3] A:0018 X:0018 Y:0000 P:envMxdizC - Store A in Left Hand.
$0D/E4E3 A6 FF LDX $FF    [$00:00FF] A:0018 X:0018 Y:0000 P:envMxdizC - Load Slot into X.
$0D/E4E5 A9 00 LDA #$00 A:0018 X:0180 Y:0000 P:envMxdizC - Load 00 into A.
$0D/E4E7 8D 40 1C STA $1C40  [$7E:1C40] A:0000 X:0180 Y:0000 P:envMxdiZC - Store A in Morph Designator.
$0D/E4EA 7A PLY A:0000 X:0180 Y:0000 P:envMxdiZC - Pull Y.
$0D/E4EB FA PLX A:0000 X:0180 Y:000A P:envMxdizC - Pull X.
$0D/E4EC 5C BD BF 02 JMP $02BFBD[$02:BFBD] A:0000 X:0180 Y:000A P:envMxdizC - Jump back to Status Check Routines.

And there it is! The code laid bare, it was immensely complicated and I still won't be surprised if I missed some crucial component to basic usability, but only time will tell. As this hack was quite enormous, there's a bit of remnant code from older plans which didn't pan out but also because this code is so large (especially eating up the vast majority of the unused SRAM) I can't see myself ever implementing it into any of my own hacks which tries to use space more guardedly.

Here are a couple of pictures. Though it's not a very flashy setup.


(http://i112.photobucket.com/albums/n198/LastingDawn/FFIV%20-%20Cecil%20Transforming%20into%20Dark%20Knight_zpsyhs4lizl.png) (http://s112.photobucket.com/user/LastingDawn/media/FFIV%20-%20Cecil%20Transforming%20into%20Dark%20Knight_zpsyhs4lizl.png.html)

(http://i112.photobucket.com/albums/n198/LastingDawn/FFIV%20-%20Cecil%20Transformed%20into%20Dark%20Knight_zpssfxkfmyc.png) (http://s112.photobucket.com/user/LastingDawn/media/FFIV%20-%20Cecil%20Transformed%20into%20Dark%20Knight_zpssfxkfmyc.png.html)

(http://i112.photobucket.com/albums/n198/LastingDawn/FFIV%20-%20Cecil%20Transforming%20into%20a%20Paladin_zps5rvo932n.png) (http://s112.photobucket.com/user/LastingDawn/media/FFIV%20-%20Cecil%20Transforming%20into%20a%20Paladin_zps5rvo932n.png.html)

(http://i112.photobucket.com/albums/n198/LastingDawn/Cecil%20Transformed%20into%20a%20Paladin_zps41h6g0gy.png) (http://s112.photobucket.com/user/LastingDawn/media/Cecil%20Transformed%20into%20a%20Paladin_zps41h6g0gy.png.html)








Title: Re: Grimoire LD's Notes, Patches, and Hacks (Dark Knight/Paladin Swap In Battle!)
Post by: Bahamut ZERO on May 17, 2015, 04:55:34 PM
Stumbled across something awesome related to Morph while playing around with actor add/removal that I felt I should share.  Bear in mind I'm using Chillyfeez's Shadow Mod, so this may not be as useful for those who aren't using it, but regardless I'm posting this in case it will work without it when it's released.

Basically, i accidently managed to swap the data for the Duplicate Dark Knight with the Actor 1 Dark Knight through eventing, and here's how I managed it!   


1: Morph into Dark Knight Cecil during a fight.
2.Trigger an a event with the following commands in it:

Add Dark Knight Cecil to the Party
Remove Paladin Cecil from the Party

Add Paladin Cecil to the Party
Remove Dark Knight Cecil


This will not work if you're in Paladin Form. You MUST be in Dark Knight form for this to work. When Paladin Cecil is re-added to the party, he will be in a different spot in the party than before the event actions took place (the spot the added Dark Knight would be). Now your Dark Knight form will be the one you started the game with, which means he'll have all the gear/experience he had when he left if you happen to also use the Shadow Mod, or he'll have his initial lv/gear if you don't use Shadow Mod.

Like I said it's not a very useful trick to do without Shadow Mod, but it's like a dream come true if you do.





Title: Re: Grimoire LD's Notes, Patches, and Hacks (Dark Knight/Paladin Swap In Battle!)
Post by: Grimoire LD on May 17, 2015, 06:46:29 PM
Stumbled across something awesome related to Morph while playing around with actor add/removal that I felt I should share.  Bear in mind I'm using Chillyfeez's Shadow Mod, so this may not be as useful for those who aren't using it, but regardless I'm posting this in case it will work without it when it's released.

Basically, i accidently managed to swap the data for the Duplicate Dark Knight with the Actor 1 Dark Knight through eventing, and here's how I managed it!   


1: Morph into Dark Knight Cecil during a fight.
2.Trigger an a event with the following commands in it:

Add Dark Knight Cecil to the Party
Remove Paladin Cecil from the Party

Add Paladin Cecil to the Party
Remove Dark Knight Cecil


This will not work if you're in Paladin Form. You MUST be in Dark Knight form for this to work. When Paladin Cecil is re-added to the party, he will be in a different spot in the party than before the event actions took place (the spot the added Dark Knight would be). Now your Dark Knight form will be the one you started the game with, which means he'll have all the gear/experience he had when he left if you happen to also use the Shadow Mod, or he'll have his initial lv/gear if you don't use Shadow Mod.

Like I said it's not a very useful trick to do without Shadow Mod, but it's like a dream come true if you do.

Hah, I find it strange that this would happen... I can't think of any reason this code would be called in that manner. Maybe I'm missing something obvious.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Dark Knight/Paladin Swap In Battle!)
Post by: Bahamut ZERO on May 18, 2015, 12:58:23 PM
I'm not sure, but the results of this are phenominal - Morph still functions perfectly when swapping between Paladin and the Actor 1 Dark Knight in every sense, as well as fix the character OW sprite changing problem I was having, which I'm fairly certain was from Shadow Mod, or the game trying to point to Actor 1 DK Cecil's sprite instead of the duplicate. 

The something you may have missed allows me to force it to do what you thought was impossible, by perhaps the greatest one-time glitch I've ever seen, so I'm perfectly content with this. :D


I like the results of this so much it reinforces an idea I've been shooting back and forth with my friend that basically will be a side dungeon directly after the fight with the Dark Knight at Mt Ordeals involving both Cecils, and an autobattle with a Paladin where it forces Cecil to use Morph (which willl be the first time a player will get to see it in action). Little scene explaining that good and evil comes in many flavors, cause the DK data swap glitch, and the player never knows there was a duplicate involved at all!


Title: Re: Grimoire LD's Notes, Patches, and Hacks (Dark Knight/Paladin Swap In Battle!)
Post by: Grimoire LD on May 18, 2015, 03:21:18 PM
I'm not sure, but the results of this are phenominal - Morph still functions perfectly when swapping between Paladin and the Actor 1 Dark Knight in every sense, as well as fix the character OW sprite changing problem I was having, which I'm fairly certain was from Shadow Mod, or the game trying to point to Actor 1 DK Cecil's sprite instead of the duplicate. 

The something you may have missed allows me to force it to do what you thought was impossible, by perhaps the greatest one-time glitch I've ever seen, so I'm perfectly content with this. :D


I like the results of this so much it reinforces an idea I've been shooting back and forth with my friend that basically will be a side dungeon directly after the fight with the Dark Knight at Mt Ordeals involving both Cecils, and an autobattle with a Paladin where it forces Cecil to use Morph (which willl be the first time a player will get to see it in action). Little scene explaining that good and evil comes in many flavors, cause the DK data swap glitch, and the player never knows there was a duplicate involved at all!

Wow! That's a really neat way to go about it! An incredibly good use of what is technically unintended behavior.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Dark Knight/Paladin Swap In Battle!)
Post by: Bahamut ZERO on May 19, 2015, 12:32:39 PM
Quote
Wow! That's a really neat way to go about it! An incredibly good use of what is technically unintended behavior.

Why thank you!

Though it appears I need to do some tests with this concerning Shadow Mod. I'm currently setting up a backup of my project so I can see that effects of other actors being added/removed before and after the DK Actor/Dup swap to make sure they are saving/loading correctly. I'm going set some NPCs in Baron to perform the data swap so I can see how/if it effects Shadow Mod from the start.


Last night while I was testplaying my project, Kain rejoined during the Zot events at his initial level. At the time I chalked it up to the fact that he was KO'ed during the Rydia/Titan event, thus leaving him KO'd in the shadow and not receiving experience. But then when I got to the scene where Adult Rydia joins in to save the day, she is added as a muted, poisoned, midget/toad/pig with Golbez's name. This may be caused by the fact I was toying around with equipment indexes  to allow the Dark Knight to use a couple more weapons/armors than he originally could.

To counter this I figured "Well, I'll just have her rejoin as a child until I figure out what's going on.", and she rejoined at her initial level/gear. So I have a sneaking suspicion that the Actor/Dup swap I did caused Shadow Mod to implode (although Yang appeared to rejoin with his experience instact directly after doing this). Perhaps doing so trips up how Shadow save/loads actors, causing it to steadily cease functioning due to the way I forced the DK Duplicate into the actor data during the swap (that's my theory, anyway).



UPDATE - After some tests I found out some interesting thing:

1) The DK Actor/Dup seems to mess with the Shadow Mod a bit, Resetting Kain0, Rydia, and Yang's Shadows. But afterwards they all save and load correctly, so if I perhaps have this swap happen as early as possible (like have part of my Paladin side dungeon idea occur when Cecil goes to sleep instead of Cecil and Rosa talking) I should be able to workaround this completely. :D  Adult Rydia also loads correctly after Child Rydia's shadow resets, which is a major relief!

2) I noticed tht when you Morph to Dark Knight mode for the very first time (pre-swap) The Hades Shield reads as "Hades    :0" in the in-battle equipment menu, and if removed, disappears completely. This ONLY happens the very first time for morph, and I see no reason why anyone would want to switch shields that very first battle (being it's his best one under normal circumstances), so it's no big deal.

3) It seems the DK actor/dup swap won't trigger if the party is only Kain and Cecil.  A party of four seems to be the ideal set up for this to occur (for the testing I used Palom, Porom and Tellah as they where my party members when I first did this)


All in all, I'm confident that all should work amazingly well together once I rig it up to do so!

6/1 UPDATE: I've got everything set up so the swap happens during the opening areas. I need to do a few adjustments, but it works like a charm!

Also, I noticed something very neat the other night while testing out a sprite I've been working on - whenever you morph, whatever status effects or buffs Cecil has BEFORE morphing are stored alongside the rest of the stuff when he's put into SRAM. Meaning one could power up one of his forms with haste, shell, safe, float, blink, and wall, use Morph, and save that buffed up form for a different fight altogether. It's awesome!
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Dark Knight/Paladin Swap In Battle!)
Post by: Grimoire LD on July 03, 2015, 10:27:22 PM
Bit of a belated update, but I just realized I never posted my fixed Event Instruction Skip Hack. The old one had several issues dealing with rollovers that the newer one has fixed and is the one used in Unprecedented Crisis and will be the version of the hack I'll put on Romhacking.net

As noted before this hack fills in the empty Event Instruction labeled as "Load some type of graphic?" - It allows a complete event skip to the next event if the entire party is dead when the instruction is reached and will check chosen flags to see how many event instructions should be skipped as based upon a dummy movement byte.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Dark Knight/Paladin Swap In Battle!)
Post by: chillyfeez on July 04, 2015, 12:00:33 AM
And, might I add, is a rad little tool that is going to make my romhacking life much more pleasant. To what extent I've used it so far, it works like a dream!
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Dark Knight/Paladin Swap In Battle!)
Post by: Grimoire LD on July 04, 2015, 01:18:28 AM
And, might I add, is a rad little tool that is going to make my romhacking life much more pleasant. To what extent I've used it so far, it works like a dream!

In truth it was the one big basic event instruction that FFIV is missing, and it has the "if dead" option to finally make battles that can have multiple outcomes. I am glad to see it is working very well for you. It is probably the most useful piece of hacking I've ever done for FFIV, much of everything else I've done has been rather niche in all honesty.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Dark Knight/Paladin Swap In Battle!)
Post by: Bahamut ZERO on July 04, 2015, 12:30:16 PM
The old vesion had rollover issues? That would explain why my "Adding Heat Shield to Falcon" event keeps rolling back to the "finding Falcon" event when it reaches the "Which Cecil" check lol.


And yes, it's definitely the one basic command FF4 was missing! If it weren't for this mod, half of my ideas would immediately be dead in the water. I certainly wouldn't be able to use 3 events and 2 event calls to use one map for multiple maps' events (now that I think about it, I could probably do that with just two events hehe). I also wouldn't have realized I could transfer from Overworld maps to Moon maps through eventing only (which is what I had to do to use Lunar Palace Crystal Room as Babil's crystal room, jumping my amount of free space to a nice 1099 bytes).

Though I must ask: How safe is it to patch the updated Conditional Branching to Rom using the original version?


Quote
much of everything else I've done has been rather niche in all honesty.

Whether that's true or false, most of everything else you've done has breathed life into FF4 in ways I didn't think were even possible (the same can said about anyone else who creates  tweaks or modifications and shares thier work with the public).



Hell, just the other night I realiized Imbued Weapons effects can be used by monsters (granted only Sing seems to occur), It's great having a Screamer or a gang of imps that are a serious threat, randomly pulling off Sing's effects (sometimes on one person, sometimes on everyone).
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Dark Knight/Paladin Swap In Battle!)
Post by: Grimoire LD on July 10, 2015, 11:44:52 AM
The old vesion had rollover issues? That would explain why my "Adding Heat Shield to Falcon" event keeps rolling back to the "finding Falcon" event when it reaches the "Which Cecil" check lol.


And yes, it's definitely the one basic command FF4 was missing! If it weren't for this mod, half of my ideas would immediately be dead in the water. I certainly wouldn't be able to use 3 events and 2 event calls to use one map for multiple maps' events (now that I think about it, I could probably do that with just two events hehe). I also wouldn't have realized I could transfer from Overworld maps to Moon maps through eventing only (which is what I had to do to use Lunar Palace Crystal Room as Babil's crystal room, jumping my amount of free space to a nice 1099 bytes).

Though I must ask: How safe is it to patch the updated Conditional Branching to Rom using the original version?


Quote
much of everything else I've done has been rather niche in all honesty.

Whether that's true or false, most of everything else you've done has breathed life into FF4 in ways I didn't think were even possible (the same can said about anyone else who creates  tweaks or modifications and shares thier work with the public).



Hell, just the other night I realiized Imbued Weapons effects can be used by monsters (granted only Sing seems to occur), It's great having a Screamer or a gang of imps that are a serious threat, randomly pulling off Sing's effects (sometimes on one person, sometimes on everyone).

Default FFIV commands are notoriously unreliable when monsters use them, these issues likely derive from lack of targeting. That still doesn't explain why something like Aim doesn't work though. It may eventually be worth going back to seeing what prevents enemies from using more commands than Dark Wave and Kick, even Item would be really nice to see.

Well, while trying to figure out a way to display damage done outside of the established routines (F8 04 being placed in the AV Routine is an important part of it, but there's a bit more than that which goes into it, what that is, I'm still uncertain) I stumbled across an unused functionality in Kick's Routine.

$03/E76D   69 00   ADC #$00   A:0000   X:0000   Y:0000   P:envMxdiZc - Add 00 to A.

What this actually is an Overall multiplier. Changing this to a value will double the final results of the Kick/Dark Wave. It seems at one point they were testing out making Kick/Dark Wave more powerful at the source but then decided against it, leaving the original result as "Add nothing". Knowing this it would be possible to make some special conditional for Kick to deal x3 or x4 it's base power. (x2 is sort of useless as it already does /2 damage compared to Dark Wave due to a flag being set in the Dark Wave routine that is looked for in the Kick routine.
Title: Re: Grimoire LD's Notes, Patches, and Hacks (Dark Knight/Paladin Swap In Battle!)
Post by: Grimoire LD on July 10, 2015, 12:18:07 PM
Alright! I've just about cracked this I think. Chillyfeez was right, but the odd thing is I had this in my Kick notes all along and must have just skimming over it. The proper way to deal damage to (just Slot1) is this...

Code: [Select]
$03/E17C A9 F8 LDA #$F8 A:0003 X:002A Y:0000 P:envMxdizc - Load F8 into A.
$03/E17E 8D C6 33 STA $33C6  [$7E:33C6] A:00F8 X:002A Y:0000 P:eNvMxdizc - Store A in AV Code.
$03/E181 A9 04 LDA #$04 A:00F8 X:002A Y:0000 P:eNvMxdizc - Load 04 ino A.
$03/E183 8D C7 33 STA $33C7  [$7E:33C7] A:0004 X:002A Y:0000 P:envMxdizc - Store A in AV Code (These two combine can display Damage)
$03/E186 20 E0 83 JSR $83E0  [$03:83E0] A:0004 X:002A Y:0000 P:envMxdizc - This is Crucial, but I'm still not sure what it is doing...
$03/E189 A9 0A LDA #$0A A:0000 X:0000 Y:0000 P:envMxdiZc - (TEST) - Load 10 Damage into A.
$03/E18B 9D D4 34 STA $34D4,x[$7E:34D4] A:000A X:0000 Y:0000 P:envMxdizc - Store A in Damage Slot.
$03/E18E A9 00 LDA #$00 A:000A X:0000 Y:0000 P:envMxdizc - Load 00 Damage into A.
$03/E190 9D D5 34 STA $34D5,x[$7E:34D5] A:0000 X:0000 Y:0000 P:envMxdiZc - Store A in Damage Slot 2 (255 each number)
$03/E193 20 7E CA JSR $CA7E  [$03:CA7E] A:0000 X:0000 Y:0000 P:envMxdiZc - Jump to Attack Compiling Subroutine.
$03/E196 60 RTS A:0000 X:0680 Y:001A P:envMxdiZC - Return.

With a little more finesse I should be able to get it to target... well the target. But as of now this simple bit of coding hits the character in Slot 1.