Users browsing this thread: 1 Guest(s)
A Guide to Ability Learning

#31
Posts: 175
Threads: 11
Thanks Received: 10
Thanks Given: 8
Joined: May 2013
Reputation: 13
Status
Well-Fed
(07-10-2020, 10:46 PM)madsiur Wrote:
(07-09-2020, 03:00 PM)Mutteo Wrote: Is there a way to set Dance Learning by Level Up ONLY?  I wanted to give this ability to Locke, but I didn't want him to learn them via the Battle Maps.

Yes. You would need to check if the character is Mog in the natural magic/swtech/blitz learning function ($C0A17F) then add some code somewhere where is free space where you would jump to if the character is mog. Basically it would work like natural magic but you have two tables of 8 entries, one for the levels where the dance are learned and one for the dances IDs. You first check mog's level, if it match to one of the levels in the table you load the corresponding dance and turn the corresponding bit of that dance ID in $7E1D4C (in a similar way to $C25EED). You'd also need to NOP $C25EE5-$C25EFA to not learn dances the normal way.

If dances are listed in the order they're learned, as with Blitz and SwdTech, it's doable with only one 8-entry table of levels at which you learn a new dance. Blitz and SwdTech reference only their level-at-which-learned table in C2, for leveling up after combat, and the recruitment/level averaging code in C0 references that same table and a shared bitfield table (C0/A22C) that you could also use for learning Dances.


Current Project: FF6: Tensei | Discord ID: TristanGrayse
  Find
Quote  

#32
Posts: 35
Threads: 2
Thanks Received: 0
Thanks Given: 0
Joined: Apr 2018
Reputation: 2
Status
Afterglow
(07-10-2020, 10:46 PM)madsiur Wrote:
(07-09-2020, 03:00 PM)Mutteo Wrote: Is there a way to set Dance Learning by Level Up ONLY?  I wanted to give this ability to Locke, but I didn't want him to learn them via the Battle Maps.

Yes. You would need to check if the character is Mog in the natural magic/swtech/blitz learning function ($C0A17F) then add some code somewhere where is free space where you would jump to if the character is mog. Basically it would work like natural magic but you have two tables of 8 entries, one for the levels where the dance are learned and one for the dances IDs. You first check mog's level, if it match to one of the levels in the table you load the corresponding dance and turn the corresponding bit of that dance ID in $7E1D4C (in a similar way to $C25EED). You'd also need to NOP $C25EE5-$C25EFA to not learn dances the normal way.
So I have been at this for a week, and I.....have no idea what I'm doing.  I appreciate your help on this, but I don't think I made much leeway on this.

I actually did not know of a NOP command.  Honestly I tend to glance over words like BEQ or JSR in the coding.  Anyway I was trying to do research on NOP commands and from my observation the byte is $EA.  So I started by trying to change the first byte in every code of the Mog Dances, since commands strings I saw started with that byte.
Code:
C2/5EE5: EA 0A 30 LDA $300A
C2/5EE8: EA 16 BMI $5F00
C2/5EEA: EA E2 11 LDX $11E2 (get combat background)
C2/5EED: EA 5B 8E ED LDA $ED8E5B,X (get corresponding dance #)
And....I broke he game.  I tried adding the byte to a couple of the strings, and it either broke the game or defaulted to the "Wind Song" learned.  I tried to replace the codes with FF to all of them and it resulted in him learning ALL the songs.  So clearly I'm not understanding these command prompts like I thought I did.

Of course even if I did manage it correctly, I was unable to figure out how to change the dances to level up.  The first problem is adding a new line of code to this
Code:
Who learns what at level up
C0/A182: C900 CMP #$00 (is character Terra? note there's no need for this CMP here)
C0/A184: F010 BEQ $A196 (branch if so)
C0/A186: C906 CMP #$06 (is character Celes?)
C0/A188: F02E BEQ $A1B8 (branch if so)
C0/A18A: C902 CMP #$02 (is character Cyan?)
C0/A18C: F04C BEQ $A1DA (branch if so)
C0/A18E: C905 CMP #$05 (is character Sabin?)
C0/A190: D003 BNE $A195 (branch if not)
C0/A192: 4C01A2 JMP $A201
C0/A195: 60 RTS
I thought that maybe I could try to divert one of these branches to some free space then bounce back to this code afterwards so I can add an extra line of code for Mog, though I wasn't sure if I could do that properly.  I found using a Hex calculator IF you take the last byte and add it to the Next offset, gives you the correct branch,  (IE: C0/A184: F010 BEQ $A196 [Take 10 from F010 and add to A186, which is the code after this and it works) However with Sabin's code it's not a branch, it's a jump, and not only do I not know how those work, I don't know where Sabin's leveling code is since his codes says "Branch if NOT"  Of course there's also the problem of the recruitment strings.
Code:
Who learns what at recruitment
C2/61B9: C9 00 CMP #$00 (is it character #0, Terra?)
C2/61C0: C9 06 CMP #$06 (is it character #6, Celes?)
C2/61C7: C9 02 CMP #$02 (if it character #2, Cyan?)
C2/61E3: C9 05 CMP #$05 (is it character #5, Sabin?)
and I have no idea what CMP commands do, let alone how to make room to add and extra line of code for Mog.  So by now I'm just lost.

I was able to find Terra's natural magic data at ECE3C0-ECE3DF as well as Celes's, Sabin's, and Cyan's.  Using FF3USME I was able to make the comparison about each byte controlling the Level and Magic ID, which was about the only thing I was able to understand, though finding out which line of code is supposed to direct to this code of magic data I couldn't say.  Even if I did, I am also left with the issue that Dance Abilities are different from individual spells so I could not find where the index is kept on them.  

You mentioned to me the Dance ID is $7E1D4C, but when I went to look for it on HXD, the number was too high.  So then I thought maybe I need to subtract $C00000 to it and it's I found the number to be $-41E2B4, and that can't be right.

Sigh, I am the fails...

(07-11-2020, 10:39 PM)GrayShadows Wrote: If dances are listed in the order they're learned, as with Blitz and SwdTech, it's doable with only one 8-entry table of levels at which you learn a new dance. Blitz and SwdTech reference only their level-at-which-learned table in C2, for leveling up after combat, and the recruitment/level averaging code in C0 references that same table and a shared bitfield table (C0/A22C) that you could also use for learning Dances.
I think so?  I know the dances are organized in the same place in the command window.  Of course knowing where anything is located is another story.
  Find
Quote  

#33
Posts: 377
Threads: 34
Thanks Received: 10
Thanks Given: 7
Joined: Dec 2018
Reputation: 18
Status
Moog
(07-18-2020, 08:40 PM)Mutteo Wrote: So I have been at this for a week, and I.....have no idea what I'm doing.  I appreciate your help on this, but I don't think I made much leeway on this.

I actually did not know of a NOP command.  Honestly I tend to glance over words like BEQ or JSR in the coding.  Anyway I was trying to do research on NOP commands and from my observation the byte is $EA.  So I started by trying to change the first byte in every code of the Mog Dances, since commands strings I saw started with that byte.
Code:
C2/5EE5: EA 0A 30 LDA $300A
C2/5EE8: EA 16 BMI $5F00
C2/5EEA: EA E2 11 LDX $11E2 (get combat background)
C2/5EED: EA 5B 8E ED LDA $ED8E5B,X (get corresponding dance #)
And....I broke he game.  I tried adding the byte to a couple of the strings, and it either broke the game or defaulted to the "Wind Song" learned.  I tried to replace the codes with FF to all of them and it resulted in him learning ALL the songs.  So clearly I'm not understanding these command prompts like I thought I did.
Ooch, if you do this, you're going to have a bad time.
NOP, or "No Operation", is a one-byte command.  That means the processor reads it as 'hey, take a breath and then read the next byte'.  However, you didn't NOP the rest of the former command, so it reads 0A as a new command instead of what it used to be... the little end of an address.
That means it's interpreted as ASL, "Arithmetic Shift Left".  The value of A is multiplied by 2.  ASL is too a one-byte command, so the processor does this command and moves to the next byte, assuming it's a new command (instead of what it used to be... the big end of an address.)
But the next byte is 30, which the processor reads as BMI, a conditional local jump "Branch if Minus".  It checks A for the minus flag (that is, is the high-bit set, or is A greater than or equal to $80?), and branches if so.  The distance it branches is determined by the value of the next byte, which is EA because you were trying to NOP the next line.
...The result?  A gets arbitrarily checked if it is minus.  If it is, the code jumps back -$12 bytes, likely ending up in the middle of OTHER code.  The sequence of logic has no way to get back on-sequence, so the game unravels like a ratty sweater.

If you're going to NOP a line, you need to replace each byte of that line with an EA.  For instance, if you're removing LDA $300A, you need to replace all three bytes with EA.

EA EA EA

I want to reply to your other stuff too, but this is too important to be ninja'd.  I'll edit in more as soon as I can.



(07-18-2020, 08:40 PM)Mutteo Wrote: Of course even if I did manage it correctly, I was unable to figure out how to change the dances to level up. The first problem is adding a new line of code to this
Code:
Who learns what at level up
C0/A182: C900 CMP #$00 (is character Terra? note there's no need for this CMP here)
C0/A184: F010 BEQ $A196 (branch if so)
C0/A186: C906 CMP #$06 (is character Celes?)
C0/A188: F02E BEQ $A1B8 (branch if so)
C0/A18A: C902 CMP #$02 (is character Cyan?)
C0/A18C: F04C BEQ $A1DA (branch if so)
C0/A18E: C905 CMP #$05 (is character Sabin?)
C0/A190: D003 BNE $A195 (branch if not)
C0/A192: 4C01A2 JMP $A201
C0/A195: 60 RTS
I thought that maybe I could try to divert one of these branches to some free space then bounce back to this code afterwards so I can add an extra line of code for Mog, though I wasn't sure if I could do that properly. I found using a Hex calculator IF you take the last byte and add it to the Next offset, gives you the correct branch, (IE: C0/A184: F010 BEQ $A196 [Take 10 from F010 and add to A186, which is the code after this and it works) However with Sabin's code it's not a branch, it's a jump, and not only do I not know how those work, I don't know where Sabin's leveling code is since his codes says "Branch if NOT" Of course there's also the problem of the recruitment strings.
Code:
Who learns what at recruitment
C2/61B9: C9 00 CMP #$00 (is it character #0, Terra?)
C2/61C0: C9 06 CMP #$06 (is it character #6, Celes?)
C2/61C7: C9 02 CMP #$02 (if it character #2, Cyan?)
C2/61E3: C9 05 CMP #$05 (is it character #5, Sabin?)
and I have no idea what CMP commands do, let alone how to make room to add and extra line of code for Mog. So by now I'm just lost.
CMP is 'Compare A', and is extremely important. It checks if A has a certain value, by subtracting the number that follows from it (without updating it) and setting the carry accordingly. For instance, if the current value in A is 7, and you CMP 6, then the result of the subtraction is 1 and the carry is not set (because 7 doesn't have to 'borrow' a number to subtract 6). If you took A is 7 and you CMP 8, then the result of the subtraction is -1 ($FF) and the carry IS set, as 7 was too small to subtract 8.

Next, we need to discuss BNE and BEQ. BNE is "Branch if not equal". It checks if the result of a CMP is anything BUT 0. If it is, then it skips a number of bytes equal to the number that follows (forward if less than $80, backward if more than $80... to find out how many bytes backward, subtract the hex value from $100). BEQ is "Branch if equal", and does the same thing but only branches if the result of the CMP is 0. In the context of level learning, this method is used to check the identity of the character who is gaining the level.

So, we need to insert a redirection to some freespace somewhere in this comparison list that will let us check if the character is Mog and handle him accordingly. Here's a trick I learned from Hatzen's patches: if you need to jump to new code or a subroutine and all the commands are two bytes long, the easiest way to insert something is to make the jump you use use 4 bytes total. That means it should be long-addressed.

So, what we're going to do is overwrite Terra's check with a jump to freespace.

Code:
C2/61B9: C9 00        CMP #$00       (is it character #0, Terra?)
C2/61BB: F0 3F        BEQ $61FC      (if yes, branch to see if she learns any spells)

replace with

C2/61B9: 5C Za Yb Xc      JML $XcYbZa
JML is "Jump to address, long". It goes to the exact address listed in the processor, in this case whatever freespace you have to work with. The address is listed little-endian, meaning the largest number of the address is the rightmost byte. For instance, if this were to say 5C 42 63 C3, it would make the processor jump to $C36342.

Code:
{Your freespace here.}
XC/YBZA:
C9 0A         CMP #$0A  (Mog is character #$0A, so we check if it's him)
D0 04         BNE #$04  (If it's not Mog, skip the next four bytes, effectively skipping the next line)
5C TT RR QQ   JML $QQRRTT  (Jump long to more freespace after all this stuff)
C9 00         CMP #$00  (Now we need to recreate the code we replaced, so we check for Terra)
F0 04         BEQ #$04  (If it is Terra, we branch to her natural learning, skipping the next line)
5C BD 61 C2   JML $C261BD (If it isn't Terra or Mog, go back to checking the characters, by jumping to the Celes check)
5C FC 61 C2   JML $C261FC (This goes to Terra learning magic at level-up)
Determining what goes at TT/RRQQ is going to be dependent on what freespace you're using. The above check takes 20 bytes, and from my estimate setting up a dance learning routine will take at least 47 bytes, so we need a space that has 67 or more free bytes to work with (four blank lines in HxD, with three extra on the front or back).
  Find
Quote  
[-] The following 1 user says Thank You to C-Dude for this post:
  • Mutteo (07-19-2020)

#34
Posts: 35
Threads: 2
Thanks Received: 0
Thanks Given: 0
Joined: Apr 2018
Reputation: 2
Status
Afterglow
(07-19-2020, 01:49 PM)C-Dude Wrote: If you're going to NOP a line, you need to replace each byte of that line with an EA.  For instance, if you're removing LDA $300A, you need to replace all three bytes with EA.

EA EA EA
Oooh, That makes much more sense now that I know what that command actually does.  So yes I changed all the bytes in the offset $C25EE5-$C25EF0 to EA and that fixed that problem.

Quote:C-Dude

CMP is 'Compare A', and is extremely important.  It checks if A has a certain value, by subtracting the number that follows from it (without updating it) and setting the carry accordingly.  For instance, if the current value in A is 7, and you CMP 6, then the result of the subtraction is 1 and the carry is not set (because 7 doesn't have to 'borrow' a number to subtract 6).  If you took A is 7 and you CMP 8, then the result of the subtraction is -1 ($FF) and the carry IS set, as 7 was too small to subtract 8
You lost me on that, maybe an example would help cement that better. Phew, this reminds me of Calculus class in college, what a nightmare that was.  Still, I shall try my best tackling this problem, let's see...

So I was trying to incorporate the information you gave me regarding JMLs to both the Level Up check and the Recruitment Guides.  I actually have free space at $D095F0-$D097FF (probably from allocating instruments or music data from my last project) so I used that for the Level up Guide. (I also used Locke, since I want him to learn Dance instead of Mog)
Code:
C0/A18E: C905 CMP #$05 (is character Sabin?)
C0/A190: D003 BNE $A195 (branch if not)
C0/A192: 4C01A2 JMP $A201
C0/A195: 60 RTS

Changed $C0/A18E

C0/A18E: 5C F0 95 D0 JMP #D095F0

D0/95F0: C905 CMP #$05 (is character Sabin?)
D0/95F2: D004 BNE $95F8 (branch if not)
D0/95F4: 5C 01 A2 4C JML $C0A201 (this goes to Sabins learning)
D0/95F8: C901 CMP #01 (is character Locke?)
D0/95FA: D004 BNE $9600 (Branch if not)
D0/95FC: 5C QQ RR TT JML(This goes to Locke's Dance Learning)*
D0/9600: 5C 95 A1 C0 JML $C0A195 (This goes back up to the RTS 60)
I believe I managed to keep that routine form breaking, though I haven't chose a code for D0/95FC yet.  Then I applied what you gave me for the recruitment code
Code:
C2/61B9: 5C 04 96 D0      JML $D09604

D0/9604: C9 01         CMP #$01  (Is Character Locke?)
D0/9606: D0 04         BNE #$04  (If it's not Locke, skip the next four bytes)
D0/9608: 5C TT RR QQ   JML $QQRRTT  (Jump to Dance learning, Freespace)*
D0/960C: C9 00         CMP #$00  (Is Character Terra?)
D0/960E: F0 04         BEQ #$04  (If it is Terra, we branch to her natural learning)
D0/96A1: 5C BD 61 C2   JML $C261BD (If it isn't Terra or Locke, jump to Celes check)
Again I left out the code here too.  I'm assuming in both cases both $D095FC and $D09608 should jump to the same place, right?  I was thinking it should jump to $D096A9, i still have plenty of space for Dancing code.

I'm just not sure how to create a Dance Learning Routine yet.
  Find
Quote  

#35
Posts: 377
Threads: 34
Thanks Received: 10
Thanks Given: 7
Joined: Dec 2018
Reputation: 18
Status
Moog
Sorry I was being too technical about the carry.  There's a much easier way to explain it, if the number you're comparing against is larger than your current number, the carry is set.  If it's smaller, the carry is not set.  This won't be important for natural learning, but does come up in other ways, like if you want to check if it's at LEAST a certain character number (the code does this often to handle guests).

After a CMP, you can throw all sorts of conditional situations at your code.

BEQ (Branch if Equal) = The compared number and your number are the same.  In this case, we've found the character we're looking for.
BNE (Branch if Unequal) = The compared number and your number are different.  For instance, if the game is running Celes's check, it will skip the Terra code.
BCC (Branch if Carry Clear) = The compared number is smaller than your number.  Or put another way, your number is bigger than the checked number.  In this context, it could be used to check if the character is a guest.  Not really important to your current goal, though.
BCS (Branch if Carry Set) = The compared number is larger than your number.  Sometimes used by the spell learning system to distinguish between Attack, Effect, and Healing spells, and has lots of uses elsewhere.  Again, not so important to your current goal.

As for your question, we'll be putting all of the relevant code to your tweak in the same space (this makes it easier to document, rather than having it all over the rom in bits and pieces), but the C0 jump will be going to a different spot than the C2 jump will.
Let's build a learning dance subroutine!
Code:
{Pointers}
*D0/95FC: 5C AA 96 D0     JML $D096A2    {Locke's dance learning on Recruit}
...
*D0/9608: 5C D4 96 D0      JML $D096D4  {Locke's dance learning on Level Up}
...
{Locke's dance learning on Recruit}
D0/96A2:    01 04 0A 0E 12 1C 2C 46              DATA  {Levels at which dances are learned}
            {I just grabbed the swordtech levels from my project, you'll want to tweak these}

D0/96AA:    64 1B        STZ $1B
D0/96AC:    A6 00        LDX $00
D0/96AE:    BF A2 96 D0    LDA $D096A2,X    (Natural Dances)    [We made this table up above]
D0/96B2:    D9 08 16      CMP $1608,Y        {Character's current level}
D0/96B5:    F0 02        BEQ $96B9   {Skip the next line}
D0/96B7:    B0 0A        BCS {If level is lower, exit}
D0/96B9:    E6 1B        INC $1B
D0/96BB:    E8          INX    {Increase our counter by one}
D0/96BC:    E0 08 00      CPX #$0008  {Have we checked 8 dances?}
D0/96BF:    F0 02        BEQ $96C3   {If so, skip the next line}
D0/96C1:    80 EB        BRA $96AE   {Otherwise, check another dance}
D0/96C3:    A5 1B        LDA $1B
D0/96C5:    AA          TAX
D0/96C6:    AD 4C 1D      LDA $1D4C      (known Dances)
D0/96C9:    1F 2C A2 C0    ORA $C0A22C,X   {This is a bitfield table for Blitzes and SwdTechs, but it'll work here too}
D0/96CD:    8D 4C 1D      STA $1D4C      (new known Dances)
D0/96D0:    5C 95 A1 C0 JML $C0A195 (This goes back up to the RTS 60)
{This is basically copied verbatim from the SwdTech learning code, save which table and variable is referenced.  There's no reason it shouldn't work for Dance}
{Locke's dance learning on Level Up}
{This one's a lot trickier, because we can't use the subroutine that was shared by Blitz and SwdTech... for several reasons}
D0/96D4:    A9 01        LDA #$01
D0/96D6:     85 EE        STA $EE        (start by marking Dance #0)
D0/96D8:     EB           XBA            (get current level from top of A?)
D0/96D9:     DF A2 96 D0  CMP $D096A2,X  (does level match the one in our Dance table?)
D0/96DD:    F0 05        BEQ $6232      (if so, branch)
D0/96DF:    E8           INX            (otherwise, move to check next level)
D0/96E0:    06 EE        ASL $EE        (mark the next Dance as learned instead)
D0/96E2:    90 F5        BCC $96D9      (loop for all 8 bits.  if Carry is set, we've
                                     checked all 8 to no avail, and $EE will be 0,
                                     indicating no Dance is learned)
D0/96E4:    A5 EE        LDA $EE        (get the Dance bitfield.. where the number
                                     of the bit that is set represents the number of
                                     the SwdTech/Blitz to learn)
D0/96E6:    D0 04        BNE $96EC      (if a Dance is learned this level, skip the next line)
D0/96E8:    5C 21 62 C2     JML $C0A195    (This is our Return to Sender!)
                        (It goes to an RTS in the C2 bank, one used by Terra's learning so we know we won't touch it)
D0/96EC:    0C 4C 1D     TSB $1D4C      (if so, enable the newly learnt Dance)
D0/96EF:    D0 F7        BNE $96E8      (if it was already enabled, return to sender)
                        [If a crash occurs, try changing this value "F7".  It's supposed to be -9, but I have trouble with these]
D0/96F1:    A9 40        LDA #$40
D0/96F3:    04 F0        TSB $F0
D0/96F5:    D0 F1        BNE $96E8      (branch to RTS if we already learned another Dance.)
                        [If that other number doesn't fix a crash, check this one "F1".  It's supposed to be -F, to branch back F bytes]
D0/96F7:    A9 40        LDA #$40
D0/96F9:    5C D4 5F C2  JML $C25FD4      (buffer and display "Mastered a new dance!" message)
D0/96FD:    EA            NOP            [Just here to mark we're done with our custom code, you can leave this off if you wish]
{Herein we see some trouble with using freespace that isn't in the bank of the existing code.}
{If we had used freespace in C2, we could have relocated the SwdTech/Blitz table and expanded it with another 8 entries for dance}
{Then, we could reuse the subroutine to check for 'blitz learned this level' that was already present in C2}
{In the D0 bank, we are forced to recreate the essence of this subroutine}
I'm not sure this code will work, but I'm hopeful.  You should try it and see if it does what you want; it's built on the principles I learned from GrayShadows' work (and from Assassin's and NovaliaSpirit's disassemblies).  You'll also want to try counting the bytes for branches... when you see a D0 04, count the next four bytes to see that it's pointing to the command you want it to land on.  For branches higher than $80, count up to $100 as you move backwards; when you hit $100 that's the byte the branch should be pointing to.

Also... be ABSOLUTELY sure you have a copy of your ROM from before you started hexing stuff like this.  You'll need it to make a difference patch to repair damages if something unexpected happens.  In fact, once you think you've got it working, you should probably make that reversal patch right away.  Using LunarIPS, select the hexed ROM as the original and your previous version as the "patch", and it'll give you a nice reversal patch that'll work so long as you don't do other stuff in that same section of the ROM.
  Find
Quote  
[-] The following 1 user says Thank You to C-Dude for this post:
  • Mutteo (07-20-2020)

#36
Posts: 35
Threads: 2
Thanks Received: 0
Thanks Given: 0
Joined: Apr 2018
Reputation: 2
Status
Afterglow
(07-20-2020, 12:56 AM)C-Dude Wrote: I'm not sure this code will work, but I'm hopeful.  You should try it and see if it does what you want; it's built on the principles I learned from GrayShadows' work (and from Assassin's and NovaliaSpirit's disassemblies).  You'll also want to try counting the bytes for branches... when you see a D0 04, count the next four bytes to see that it's pointing to the command you want it to land on.  For branches higher than $80, count up to $100 as you move backwards; when you hit $100 that's the byte the branch should be pointing to.

Also... be ABSOLUTELY sure you have a copy of your ROM from before you started hexing stuff like this.  You'll need it to make a difference patch to repair damages if something unexpected happens.  In fact, once you think you've got it working, you should probably make that reversal patch right away.  Using LunarIPS, select the hexed ROM as the original and your previous version as the "patch", and it'll give you a nice reversal patch that'll work so long as you don't do other stuff in that same section of the ROM.

Wow...I had no idea how much work it took to make a new learning subroutine.  It's all so much to take in and understand every little detail that goes into coding.  I may never be able to grasp how all this works.  Even when I locate a string of code somewhere, I just get lost in a sea of bytes.  I'd like to think that I learned some things today though.

Anyway I plugged in all the information you gave me and it seems to be working fine as far as I can tell.  I am extremely grateful that you went out of your way to do this for me.  It is very much appreciated.  I wish I could return the favor somehow, though coding is not my strong suit.
  Find
Quote  

#37
Posts: 377
Threads: 34
Thanks Received: 10
Thanks Given: 7
Joined: Dec 2018
Reputation: 18
Status
Moog
(07-20-2020, 09:55 PM)Mutteo Wrote: Anyway I plugged in all the information you gave me and it seems to be working fine as far as I can tell.  I am extremely grateful that you went out of your way to do this for me.  It is very much appreciated.  I wish I could return the favor somehow, though coding is not my strong suit.

No problem, I was glad to help.  You've had the courage to actually attack the animation code (your harp thing), so you've got coding talents that I don't.  I understand the hesitation, too, when I started just a year ago (or has it been two?) I wasn't even going to jump into this stuff: I thought it was like learning to speak robot.

As for hacking assembly in hex, there are a lot of documents on the Wiki that will help explain what each op code is actually doing.
https://www.ff6hacking.com/wiki/doku.php...s:doc:snes

If you're going to be doing more coding with hex, try to think of it like a logic flow chart.  You've got a few variables (A, X, and Y mostly), you test to see if they've got the value you want, and then you modify or record something.  In the case of the dance code above, we're basically doing the following:

A) Making a copy of the "Learn SwdTech" code
B) Replacing JSR $6222 with the block of code found at C26222, since we're in the D0 bank
C) Replacing instances of $E6F490 with our Dance Level table, $D096A2
D) Replacing instances of SwdTech RAM location $1CF7 with the Dance RAM location $1D4C
E) Replacing JMPs with JMLs to the appropriate spots, since we're in the D0 bank
F) Making sure all short jumps (BNE, BEQ, BCC, BCS) are pointing to the starts of the right lines, since we had to insert extra bytes to make room for the JMLs relative to the code we're patterning.
  Find
Quote  



Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite