Users browsing this thread: 8 Guest(s)
terra's magitek

#18
Posts: 3
Threads: 0
Thanks Received: 0
Thanks Given: 4
Joined: Apr 2014
Reputation: 0
Status
None
(06-09-2013, 08:37 PM)Edrin Wrote: You are correct, Mad. Its because Terra's sprite ID is 0 that it doesn't need a CMP to have BNE branch properly. There are a bunch of ASL that you can move off to another portion of the code to make it all fit.

this:
Code:
C1/4D45:    0A          ASL A
C1/4D46:     0A          ASL A
C1/4D47:     0A          ASL A
C1/4D48:     0A          ASL A
C1/4D49:    0A          ASL A
C1/4D4A:    A8          TAY
C1/4D4B:    B9AE2E      LDA $2EAE,Y
C1/4D4E:    D010        BNE $4D60      (branch if not Terra)

change to this:
Code:
C1/4D45:    22XXXXXX  JSL XX/XXXX (Where XX/XXXX is the location of the moved code, remember to enter your byte words backwards, so a jump to 12/3456 goes 22 56 34 12)
C1/4D4A:    EA          NOP
C1/4D4B:    EA          NOP
C1/4D4C:    C903      CMP #$03       (Is this Shadow?)
C1/4D4E:    D010        BNE $4D60      (branch if not)

Then just shove off the ASLs and sprite index loading elsewhere:
Code:
XX/XXXX:    0A           ASL A
XX/XXXX:     0A          ASL A
XX/XXXX:     0A          ASL A
XX/XXXX:     0A          ASL A
XX/XXXX:    0A          ASL A
XX/XXXX:    A8          TAY
XX/XXXX:    B9AE2E      LDA $2EAE,Y
XX/XXXX:   6B             RTL

Thanks for this code, Edrin! I got it to work sort of, but I had to add an extra NOP for the bytes to add up:
Code:
C1/4D45:    22XXXXXX  JSL XX/XXXX (Where XX/XXXX is the location of the moved code, remember to enter your byte words backwards, so a jump to 12/3456 goes 22 56 34 12)
*C1/4D49:    EA          NOP
C1/4D4A:    EA          NOP
C1/4D4B:    EA          NOP
C1/4D4C:    C903      CMP #$03       (Is this Shadow?)
C1/4D4E:    D010        BNE $4D60      (branch if not)

But it seems to only change the list of spells displayed. It doesn't change the spells actually selected, if that makes sense. I tested by changing all the standard and Terra magitek spells and found that while it was displaying Terra's abilities, the actual (hidden) selection is standard abilities. So for example I changed the first spell to Quasar in Terra's list using FF3usME. It displayed as Quasar, but it cast fire beam, which I had left as the first spell in the standard magitek list.

I thought it might be an SRAM issue, so I tried saving in game and resetting the emulator. I tried reacquiring Mog to redo the character acquisition events (I was testing on Mog since I had a handy save state). I tried fighting multiple battles. All with the same results - it displays Terra's list but it's only a visual; the actual list it lets you select is the standard list.

So then I changed C1/4D4D to $0E for Vicks and started a fresh game. This is what I found:
Terra - standard list displayed, Terra's list selected (opposite as Mog)
Wedge - Terra's list displayed, standard list selected (same as Mog - but this was unexpected - I thought Wedge would have been unaffected)
Vicks - Terra's list displayed, standard list selected (same as Mog)

Next I changed the byte to $0F for Wedge and started a fresh game. Same exact results.

Next I changed the byte to $00 for Terra, which should produce the same results as an unmodified ROM. Same exact results.

So I think I ruled out SRAM carrying over old data.

I feel like there are two problems. First, it always branches for Terra and never for anyone else. So BNE only fails for Terra. That would mean that the zero flag is set iff Terra. That would mean that CMP sets the zero bit iff Terra. But how is that possible if we're comparing against $0E??? Maybe I'm not jumping code and returning properly? Is the M bit off? It sounds almost like round-off error comparing against zero every time thus only finding equality against Terra's $00.

The second problem is that the actual list selected does not appear to change. Is there perhaps a different part of the code where a second check is done to see which list to pull the spell from? Nothing jumped out at me searching through the various decompiled documents.

This is tested on a fresh unheadered us v1.0 ROM, the only changes being editing the magitek lists via FF3usME and using this IPS data from Edrin's code (braces added for readability):
Code:
[50 41 54 43 48] [01 4D 45] [00 0B] [22 A4 FC 0E EA EA EA C9 0E D0 10] [0E FC A4] [00 0A] [0A 0A 0A 0A 0A A8 B9 AE 2E 6B] [45 4F 46]

Any insight would be greatly appreciated!
  Find
Quote  



Messages In This Thread
terra's magitek - by luxador - 06-09-2013, 01:43 PM
RE: terra's magitek - by CrumpledMedal - 06-09-2013, 01:56 PM
RE: terra's magitek - by madsiur - 06-09-2013, 02:00 PM
RE: terra's magitek - by luxador - 06-09-2013, 05:10 PM
RE: terra's magitek - by madsiur - 06-09-2013, 06:28 PM
RE: terra's magitek - by Angelo26 - 06-09-2013, 06:47 PM
RE: terra's magitek - by B-Run - 06-09-2013, 08:37 PM
RE: terra's magitek - by madsiur - 06-09-2013, 09:01 PM
RE: terra's magitek - by B-Run - 06-09-2013, 09:10 PM
RE: terra's magitek - by luxador - 06-10-2013, 09:07 AM
RE: terra's magitek - by B-Run - 06-10-2013, 09:22 AM
RE: terra's magitek - by luxador - 06-10-2013, 10:03 AM
RE: terra's magitek - by B-Run - 06-10-2013, 10:07 AM
RE: terra's magitek - by Synchysi - 06-10-2013, 10:27 AM
RE: terra's magitek - by B-Run - 06-10-2013, 11:48 AM
RE: terra's magitek - by luxador - 06-10-2013, 12:15 PM
RE: terra's magitek - by B-Run - 06-10-2013, 12:18 PM
RE: terra's magitek - by yeoldeusrename - 04-06-2014, 02:46 PM
RE: terra's magitek - by yeoldeusrename - 04-08-2014, 12:05 AM
RE: terra's magitek - by B-Run - 04-08-2014, 07:31 AM
RE: terra's magitek - by yeoldeusrename - 04-11-2014, 11:14 AM
RE: terra's magitek - by Zozma - 11-26-2015, 08:40 AM
RE: terra's magitek - by Catone - 11-26-2015, 09:56 AM
RE: terra's magitek - by Zozma - 11-26-2015, 10:20 AM
RE: terra's magitek - by Catone - 11-26-2015, 11:14 AM
RE: terra's magitek - by Zozma - 11-26-2015, 11:37 AM
RE: terra's magitek - by Catone - 11-26-2015, 04:04 PM
RE: terra's magitek - by Zozma - 11-26-2015, 04:30 PM
RE: terra's magitek - by Catone - 11-27-2015, 08:21 AM
RE: terra's magitek - by Zozma - 11-27-2015, 09:27 AM
RE: terra's magitek - by Catone - 11-27-2015, 09:57 AM
RE: terra's magitek - by Zozma - 11-27-2015, 11:27 AM
RE: terra's magitek - by Catone - 11-27-2015, 12:35 PM
RE: terra's magitek - by Zozma - 11-27-2015, 02:47 PM
RE: terra's magitek - by Zozma - 11-30-2015, 12:57 PM
RE: terra's magitek - by Catone - 11-30-2015, 02:41 PM
RE: terra's magitek - by Zozma - 11-30-2015, 03:12 PM

Forum Jump:

Users browsing this thread: 8 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite