Users browsing this thread: 2 Guest(s)
Battle commands change

#11
Posts: 831
Threads: 41
Thanks Received: 16
Thanks Given: 12
Joined: Nov 2009
Reputation: 18
Status
None
(06-21-2012, 10:56 PM)Madsiur Wrote: What a constructive answer Angelo!

Nothing occurred to me as to what to suggest to make this possible, sorry Madsiur Tongue

But on the other hand, looks like someone thought about things we didn't. To be honest, Gau isn't at all interesting to me...
Quote  

#12
Posts: 62
Threads: 16
Thanks Received: 10
Thanks Given: 4
Joined: May 2012
Reputation: 10
Status
None
oh! awesome...!

Madsiur, QuickFix, Gi Nattak, Angelo26, Synchysi, thank you very much!

i tried it,

Code:
C2/5432: D0 04 BNE $5438 (This may not even be necessary, as it just branches to the RTS below)
C2/5434: A9 FF LDA #$10 (Loading the Rage index rather than the blank index)
C2/5436: 83 03 STA $03,S
C2/5438: 60 RTS

Gau can Rage not on veldt, can Leap on veldt!

really thank you. i love FF6, and i love All those people on this web site!

poor my English, sorry ><
  Find
Quote  

#13
Posts: 3,970
Threads: 279
Thanks Received: 236
Thanks Given: 58
Joined: Oct 2011
Reputation: 65
Status
Tissue-aware
(06-22-2012, 12:28 AM)Angelo26 Wrote: Nothing occurred to me as to what to suggest to make this possible, sorry Madsiur Tongue

Dude you don't have to be sorry. It was a joke. I think I should put an Tongue or something when I try to be funny.

Nice finding Synchysi! It is simpler than I thought but I'll admit I didn't checked C2 either. Sometimes I tend to write long text for nothing.

If you absolutely want to be able to switch commands with no problem, there is a portion of code use for morph that could be adapted for this purpose. It checks where the morph command is and switch it to revert. I don't have access to C2 but it does the following (in pseudo-code):

Code:
Foreach (command com in ActiveCharacterCommands)
{
     if (com.commandNumber == Morph.commandNumber)
     {
           com.commandNumber = Revert.commandNumber
     }
}

All it does is loop for each slot and check where Morph is, with the command number. When it is found it switch the command number of the command in the specific slot. This way you can put Morph in whatever slot you want.

  Find
Quote  

#14
Posts: 290
Threads: 3
Thanks Received: 40
Thanks Given: 1
Joined: Apr 2012
Reputation: 9
Status
None
(06-22-2012, 07:49 AM)Tsushiy Wrote: oh! awesome...!

Madsiur, QuickFix, Gi Nattak, Angelo26, Synchysi, thank you very much!

i tried it,

Code:
C2/5432: D0 04 BNE $5438 (This may not even be necessary, as it just branches to the RTS below)
C2/5434: A9 FF LDA #$10 (Loading the Rage index rather than the blank index)
C2/5436: 83 03 STA $03,S
C2/5438: 60 RTS

Gau can Rage not on veldt, can Leap on veldt!

really thank you. i love FF6, and i love All those people on this web site!

poor my English, sorry ><

It's not perfect. That particular set of code you edited is also used by Magic and X-Magic, so at the beginning of the game before acquiring espers, everyone will have the Rage command available to them until equipping an esper.

What you would need to do is put the following bit of code at some free space somewhere:

Code:
C2/5432: D0 04        BNE $5438 (This may not even be necessary, as it just branches to the RTS below)
  C2/5434: A9 FF        LDA #$10 (Loading the Rage index rather than the blank index)
  C2/5436: 83 03        STA $03,S
  C2/5438: 60           RTS

and have $C25443 jump to that block instead.


GET A SILK BAG FROM THE GRAVEYARD DUCK TO LIVE LONGER.

Brave New World
  Find
Quote  

#15
Posts: 76
Threads: 20
Thanks Received: 2
Thanks Given: 4
Joined: Apr 2012
Reputation: 0
Status
None
I've given Gau a few weapons he can equip and lowered his attack power significantly. I first thought of asking here by posting a new thread about if it was possible to make Gau use his equipped weapon instead of the monster's predetermined weapon when Gau uses a Rage at first. Example, Guard attacks with a Dirk, Soldier attacks with a Rune Edge, etc. Then I came across this thread, and I preferred the idea of Gau having a Fight command instead.

I've been trying to get this to work, I've check out the C2 bank document and also google some stuff to help me out. But in the end, I've hit a dead end... Here is what I've written down in my notes on Notepad when doing the process, nothing much compare to the time I've spend trying to figure it out on my own, trial and errors, googling, etc...

Leap/Rage - with header rom (+200)

That bit of code branches to a function that blanks out the battle command slot: C2/5632 Change FF to 10 at C2/5634
FF = Empty/Null
10 = Rage
------------------------------------------------------------------------------------------------------------
Put this in blank area -> Empty area starts at C2/66F0
D0 04 A9 10 83 03 60 -> Leap to Rage

Have C2/5643 jump to that block instead. -> What's a "block"?
------------------------------------------------------------------------------------------------------------
The Leap menu entry

C2/543E: AD E4 11 LDA $11E4
C2/5441: 89 02 BIT #$02 (is Leap available?)
C2/5443: 80 ED BRA $5432 (if it's not, menu entry will be nulled after branch)

Offset C2/5643: change 80 ED to (D0 ??) BRA $66F0 - empty area (if it's not, menu entry will be Rage after branch)

Change 80 ED to D0 ??

D0 = Branch if? -> found this value within the C2 bank document
?? = ?? -> What's ?? (value)? Could be related to this "block" thing?

Google didn't show me any results with hex and "block", and I've only found a few terms which I had written within my notes on Notepad. But I didn't find them all.
------------------------------------------------------------------------------------------------------------
LDA = means "load accumulator"
STA = means "store the value of the accumulator into the memory address"
BRK = means "break"
RTS = ???
BNE = ???
BRA = ???

The big question is, what's a "block"?
  Find
Quote  

#16
 
Status
None
I implimented this not to long ago, and it does work, however as mentioned by ...someone (not easy to browse and type from cell phone) if you do it this way you also get a glitched command for characters that dont have a magic command listed. (As in havent learned any spells yet, since you tell the code to slip in a Rage command instead of a blank, which means glitched before rage is available) other than that easily overlooked side effect, the code is good. I would have to get home and check notes to clarify how though.

As for your question, I believe the block refers to a chunk/section of code, or other area of info.
 
Quote  

#17
Posts: 76
Threads: 20
Thanks Received: 2
Thanks Given: 4
Joined: Apr 2012
Reputation: 0
Status
None
Yep, I've easily implemented the code posted in this thread and it works 100%. But like you said, blank is replace by Rage which I do not like. That's why I'm trying to implement what Synchysi said, put a piece of code into the empty area so that blank still stays blank, and Rage/Leap interchange depending where you are (not on the Veldt/on the Veldt respectably).

Unfortunately, my limited knowledge on hex editing is quite limited. I know the basics, and a few otehr stuff. But that's it, nothing fancy. I've learn a lot, heck, a year ago I didn't know how to use a hex editor when I opened it or what an offset was or meant, etc or how to use it. I'm still no expert at it, but I don't mind learning.

I try using examples of other commands and stuff provided within the C2 document and tried to decipher it with a online hexadecimal calculator to see if there was a pattern with the numbers/bytes and the branches/etc that could understand and come to a conclusion, but nothing conclusive came out of it. In other words, a complete waste of time...

Now, I just need to know how to calculate this " chunk/section of code, or other area of info" thingy. That is the biggest mystery right now, maybe that's all I need to get it to work or lead me into figuring it out.
  Find
Quote  

#18
 
Status
None
Okay, I think I can help ya now. First off, this may help fill in a few spaces on your notepad.

Machine Hex Opcodes

Now, I haven't had much luck getting all of these to work 100% of the time, but you can look up what some mean like:

RTS: Return to script (as in, now that your done here, go back to where you came from)
BNE: Branch if not equal
BRA: Branch always
JMP: Jump to (4C in hex seems to be popular)

This should also help make some sense from the phrase "block", generally ends with RTS (which is 60 in hex) and begins with what ever the code starts with.
(.... read that stuff over and if you have any questions, ask... maybe I can answer, maybe not. I think I've covered the main points in question to this topic though)

Okay, with all that in mind, when he says "Jump to that block" he means literally "JUMP" (4C) to the offset you wrote that block of code in. So if you wrote it in at offset C2/66FO that's where you need it to go, instead of BRA (branch) to 5432 (80 ED does this by saying 80=branch always, and ED tells it how many bytes to skip before it gets where it wants to go, ED equals... 237... okay at some point that value tells it to go in the opposite direction (I'm not really qualified to give lessons on hex, at least good lessons anyway) Regardless what you want to do is get that chunk of code to go to your newly added code by dropping in a 4C F0 66 (JMP $66F0 , yes, address have to be typed in backwards, that's just how it works)

Next problems, how do you make 4C F0 66 fit in the hole where 80 ED came from without jacking everything around and breaking something? Well... that part gets left up to smart people. Me? I did this:

Code:
C2/543E: AD E4 11    (no clue what this does, so I left it alone)
C2/5441: 4C 7F 64   (My free space started at C2/647F so...)
C2/5444: FF   (Just to fill in the extra space)

Down at the free space:
C2/647F: D0 04
C2/6481: A9 10 (Load Rage command)
C2/6483: 83 03
C2/6485: 60      (RTS)

Now, I intended to add the C2/5441: 89 02 BIT #$02 that I had cut out to make the jump back into the code in free space, but forgot... worked when I tested it though so... your guess is as good as mine.

Welp, hope I helped you more than confused you. Let me know if I can clarify any of this gibberish I've typed.

Note: Something I haven't tested, if this line of code actually works completly, will the Rage menu still show up in the skills screen if he doesn't actually have it as a command... if not, the next order of buisness would be to try and make Leap the relevant command to make it non-gray in the skills menu.
 
Quote  

#19
Posts: 290
Threads: 3
Thanks Received: 40
Thanks Given: 1
Joined: Apr 2012
Reputation: 9
Status
None
Quote:RTS: Return to script (as in, now that your done here, go back to where you came from)
BNE: Branch if not equal
BRA: Branch always
JMP: Jump to (4C in hex seems to be popular)

RTS is actually return from subroutine and is used in conjunction with JSR (jump to subroutine) to execute a set of commands without interrupting the current routine. The reason for this is JSR stores the address you're at when the command is executed, and RTS returns to that address. JMP and the various branches do not store the address they're executed from.

There are two main differences between JMP and BRA. One is that BRA is relative to your current location, whereas JMP is absolute. This generally doesn't have a huge impact on what you do, but BRA is only a two-byte opcode where JMP is three. The other difference, which is far more significant, is that BRA (and other various branches) is limited to only going 127-128 bytes in either direction, whereas JMP (and JSR) can access an entire 65536-byte code bank.

Now, as for the actual topic at hand...

For one, when you want to fill in blank space don't use $FF. That's actually the SBC (subtract with carry) opcode. Use $EA, which is NOP (no operation). Using $FF doesn't hurt in your specific case because that particular byte is never executed (if it were the game would crash), but $EA is still safer.

Here are a couple of exceptionally useful documents. Use them together and you shouldn't have anymore issues figuring out what an opcode does or how to use it.

http://www.defence-force.org/computing/o.../annexe_2/
http://www14.brinkster.com/assassin17/thegun.htm

Secondly, you're on the right track but you're still cutting out key bytes.

Code:
(Leap menu entry)

C2/543E: AD E4 11     LDA $11E4   [This loads the commands in a battle menu for the following check]
C2/5441: 89 02        BIT #$02   (is Leap available?) [This is the actual check for Leap]
C2/5443: 80 ED        BRA $5432  (if it's not, menu entry will be nulled after branch)

So you do need to maintain the BIT #$02. Here's what I would go for:

Code:
(Leap menu entry)

C2/543E: AD E4 11        LDA $11E4
C2/5441: 4C 7F 64        JMP $647F
C2/5444: EA              NOP  (just to fill up free space)

Code:
(Free space)

C2/647F: 89 02        BIT #$02
C2/6481: D0 04        BNE $6487
C2/6483: A9 10        LDA #$10 (Loading the Rage index rather than the blank index)
C2/6485: 83 03        STA $03,S
C2/6487: 60           RTS

That should maintain Rage as the unique battle command for Gau, rather than having it replace Fight, without giving Rage to everyone that doesn't have the Magic command yet.


GET A SILK BAG FROM THE GRAVEYARD DUCK TO LIVE LONGER.

Brave New World
  Find
Quote  

#20
 
Status
None
See, I told you I wasn't qualified to give lessons on hex coding.

Second, that "Bit #$02" is the part I can't figure out, yes I know what it is commented as in most C2 disassembly... then if so, why does the code I typed work? That is minus the Bit #$02, and worked as in I have Leap show on the Veldt, and Rage anywhere else (yes I tried it before I typed it).
 
Quote  



Forum Jump:

Users browsing this thread: 2 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite