Taking more than 65535 GP From Party

If it has bytes, we can change it. Talk about anything relating to hacking and emulation here.

Moderators: General Moderator, Game Moderator

Taking more than 65535 GP From Party

Postby Gogo13 » Mon Oct 10, 2011 2:10 am

Trying to touch up my auction house, and hit a wall when I only had two spaces of code to take gold from the party, limiting 65535 GP as an item cost, as usual. Anyone know how to multiply this function aside from doing it until 9,900,900 GP has been taken?

Code: Select all
CB/56C0: 85 50 C3   Take 50,000 GP from party
User avatar
Gogo13
Regular User
Regular User
 
Posts: 163
Joined: Sun Nov 14, 2010 10:42 pm

Re: Taking more than 65535 GP From Party

Postby Lenophis » Mon Oct 10, 2011 9:56 am

There is no way to multiply the way you want, you would have to do checks for each amount beyond 65,535. I would recommend writing your own event command which would support 24-bits.
Image
Lenophis
Veteran
Veteran
 
Posts: 588
Joined: Sat Mar 26, 2005 5:52 am
Location: Duluth, MN

Re: Taking more than 65535 GP From Party

Postby Gogo13 » Tue Oct 11, 2011 12:06 am

Thank you greatly for the perfect and timely advice, as always. Of course I have no idea how to do that, so I will have to see what spamming the code does. (This will hopefully be my last code changing to the game, so any heavy learning would be a waste).
User avatar
Gogo13
Regular User
Regular User
 
Posts: 163
Joined: Sun Nov 14, 2010 10:42 pm

Re: Taking more than 65535 GP From Party

Postby Drakkhen » Tue Oct 11, 2011 1:05 am

Code: Select all
Take XXXX amount of GP from party
(gen. act. 85)

...
C0/AD89: 4C XX YY      JMP $New Function
...

New Function -- Place somewhere in bank C0

C0/YYXX: A5 EB         LDA $EB
C0/####: 1A            INC
C0/####: F0 06         BEQ $####
C0/####: AD 60 18      LDA $1860
C0/####: 4C 8C AD      JMP $AD8C
C0/####: AD 60 18      LDA $1860
C0/####: 38            SEC
C0/####: E9 64 13      SBC #$1364
C0/####: 85 2A         STA $2A
C0/####: 7B            TDC
C0/####: E2 20         SEP #$20
C0/####: AD 62 18      LDA $1862
C0/####: E9 97         SBC #$97
C0/####: 85 2C         STA $2C
C0/####: 4C 9B AD      JMP $AD9B


I didn't actually test this code, but I think it should work.
With this in place, trying to take 65535 GP should take 9900900 GP instead.
Drakkhen
Active User
Active User
 
Posts: 71
Joined: Thu Sep 09, 2004 9:06 am
Location: Dry Land, Earth

Re: Taking more than 65535 GP From Party

Postby Gogo13 » Tue Oct 11, 2011 1:53 am

For posterity, anyone will have the game freeze if they don't follow an "85: take XX YY gold" command with a "C0BE81 KKJJ 01" If ($1E80($1BE) [$1EB7, bit 6] is set), branch to $CBJJKK to test for negative gold. The game will freeze even if you have the gold. This means each taking of gold uses 9 slots of code.

Drakkhen, woah. You always have heavy hitting posts. That is pure awesome what you just said. What I'm afraid of is that maybe the game takes away 65535 gold at some point and then I've warped the reality of gold taking into a game-crashing dimension, where scantily clad anime women probably get tentacle raped. And as crazy as it sounds, I don't like tentacle rape. I'm really trying to make my ROM as ruin-proof as possible, but I'll probably end up trying this out anyways, because an item that costs 9,900,000 is a bit desperately needed to be the final cherry on my hardcore-ROM sundae.

Ok, so can I ask why the code has to start at AD89? And all this code has to go in the C0 bank, because the code will only act accordingly there? Deep down I'm worried I don't know enough to even use your code. And the BEQ has ####, but what do I put there? Feel free not to walk me through this, as like I said, my ROM is basically finalmundo completed.
User avatar
Gogo13
Regular User
Regular User
 
Posts: 163
Joined: Sun Nov 14, 2010 10:42 pm

Re: Taking more than 65535 GP From Party

Postby Gogo13 » Tue Oct 11, 2011 2:01 am

Would there be an easy but long way to just jump to a place where I have tons of gold-taking code? I only know how to use 80 as always branch, and BNE, but I've read in the manual that there is a long-branch also (80 just branches up to 255, and it just goes down the code, not up, right?)
User avatar
Gogo13
Regular User
Regular User
 
Posts: 163
Joined: Sun Nov 14, 2010 10:42 pm

Re: Taking more than 65535 GP From Party

Postby Gogo13 » Tue Oct 11, 2011 2:11 am

I think I might have enough space already, miraculously
User avatar
Gogo13
Regular User
Regular User
 
Posts: 163
Joined: Sun Nov 14, 2010 10:42 pm

Re: Taking more than 65535 GP From Party

Postby Drakkhen » Tue Oct 11, 2011 2:44 am

What I'm afraid of is that maybe the game takes away 65535 gold at some point

Unless you've added such a point yourself, it shouldn't.

Ok, so can I ask why the code has to start at AD89?

C0/AD89 is merely where I am hijacking the GP taking function. The JMP there should be pointed to where you place the code I provided.

And the BEQ has ####, but what do I put there?

Look at the actual code bytes to the left and you will see exactly what to put where.
F0 is Branch if EQual, and 06 is how far to branch.
Since branching is relative, I can't know ahead of time the exact address that the #### will be.

but I've read in the manual that there is a long-branch also

Branch Long is 82.

(80 just branches up to 255, and it just goes down the code, not up, right?)

Incorrect, all branches are in the ranges -127/+128 or -32767/+32768 in the case of Branch Long
Drakkhen
Active User
Active User
 
Posts: 71
Joined: Thu Sep 09, 2004 9:06 am
Location: Dry Land, Earth

Re: Taking more than 65535 GP From Party

Postby Gogo13 » Tue Oct 11, 2011 3:58 am

Tried putting lots of 85 code, but it always says I don't have enough gold, very lame. I'll try out the sweet Drakkhenness when it's not 3am anymore. My plan was so simple, how could it fail?!>!>2.

Thanks for the pro-tips on coding--it feels great to finally get some things cleared up.
User avatar
Gogo13
Regular User
Regular User
 
Posts: 163
Joined: Sun Nov 14, 2010 10:42 pm

Re: Taking more than 65535 GP From Party

Postby Gogo13 » Wed Oct 12, 2011 11:25 pm

Because it starts at AD89, and jumps back to AD9B, will it be missing some code possibly vital to normal gold taking events?
User avatar
Gogo13
Regular User
Regular User
 
Posts: 163
Joined: Sun Nov 14, 2010 10:42 pm

Re: Taking more than 65535 GP From Party

Postby Drakkhen » Thu Oct 13, 2011 1:18 am

No, we're skipping the part of the code that subtracts the amount of gold specified in the event parameters when we want the 9900900 taken.
The conditional branch near the beginning of the code will jump back to the default code unless 65535 gold was specified.
Drakkhen
Active User
Active User
 
Posts: 71
Joined: Thu Sep 09, 2004 9:06 am
Location: Dry Land, Earth

Re: Taking more than 65535 GP From Party

Postby Gogo13 » Thu Oct 13, 2011 9:36 pm

I put the code in, but my code is making it freeze still when I buy the item that used to be an imp robot. Thanks for the help and sorry I couldn't see this to fruition, because now there's no reason to get gold in late-game WoR.
User avatar
Gogo13
Regular User
Regular User
 
Posts: 163
Joined: Sun Nov 14, 2010 10:42 pm

Re: Taking more than 65535 GP From Party

Postby Drakkhen » Fri Oct 14, 2011 1:38 pm

Well, I tested the code I put up. It had a problem, but it wouldn't freeze the game. It just doesn't correctly determine whether you had enough GP.
If you can fix the freezing, change the end of the code like this:
Code: Select all
Change the end of the code from this:
C0/####: E9 97         SBC #$97
C0/####: 85 2C         STA $2C
C0/####: 4C 9B AD      JMP $AD9B

To this:

C0/####: E9 97         SBC #$97
C0/####: 85 2C         STA $2C
C0/####: C9 40         CMP #$40
C0/####: 90 03         BCC $????
C0/####: 4C 9F AD      JMP $AD9F
C0/####: 4C A9 AD      JMP $ADA9

With the above code change, everything worked perfectly.
Drakkhen
Active User
Active User
 
Posts: 71
Joined: Thu Sep 09, 2004 9:06 am
Location: Dry Land, Earth

Re: Taking more than 65535 GP From Party

Postby Gogo13 » Sat Oct 15, 2011 8:14 am

I'm trying to branch, but in the Auction house code, it seems like 80 isn't branch, but a command to move objects. Is this true?

wtb Pandora's Auction House
User avatar
Gogo13
Regular User
Regular User
 
Posts: 163
Joined: Sun Nov 14, 2010 10:42 pm

Re: Taking more than 65535 GP From Party

Postby Lenophis » Sat Oct 15, 2011 2:58 pm

Considering events are done with scripts and not assembly, yes.
Image
Lenophis
Veteran
Veteran
 
Posts: 588
Joined: Sat Mar 26, 2005 5:52 am
Location: Duluth, MN

Re: Taking more than 65535 GP From Party

Postby Gogo13 » Sat Oct 15, 2011 11:54 pm

WeLLLLLL no one plays my ROM anyways ;) --- thanks for all the help guys. I think the last coding has been done and you guys know how impossible it would've been to get here without you FF6 experts
User avatar
Gogo13
Regular User
Regular User
 
Posts: 163
Joined: Sun Nov 14, 2010 10:42 pm

Re: Taking more than 65535 GP From Party

Postby Gogo13 » Sun Feb 24, 2013 10:56 am

I just wanted to say thanks for the help on this, as I'm currently trying it again to top things off on making the best possible FF6. I spent a good hour trying to make sure I understood the Drakkhen code and now I got it, so it's just a matter of not fucking up my replacement code for the auction items that suck at the end ( F U imp robot).
User avatar
Gogo13
Regular User
Regular User
 
Posts: 163
Joined: Sun Nov 14, 2010 10:42 pm

Re: Taking more than 65535 GP From Party

Postby Gogo13 » Sat Mar 02, 2013 8:24 pm

It works!
it works it works itworksitworksitworks!!!!!

Any favors you guys ever need will be hastily granted with no questions asked. To begin with, might I mention that I have a package of fresh, unopened applewood bacon residing in my quarters.
User avatar
Gogo13
Regular User
Regular User
 
Posts: 163
Joined: Sun Nov 14, 2010 10:42 pm

Re: Taking more than 65535 GP From Party

Postby Lenophis » Wed Mar 06, 2013 11:55 am

...Bacon? :lol:
Image
Lenophis
Veteran
Veteran
 
Posts: 588
Joined: Sat Mar 26, 2005 5:52 am
Location: Duluth, MN

Re: Taking more than 65535 GP From Party

Postby Imzogelmo » Fri Mar 08, 2013 7:29 pm

Bacon? That remind me of an old hack...


I know the question was answered and already working, but I wanted to add my own solution too.

Lenophis' answer would be to make a new event command, which would extend the 16-bit method into a 24-bit method. This would allow you to make any amount easily.
Drakkhen's answer is to substitute the value of 65,636 with the desired value of 9,900,900. This works because of the coincidence that 65536 is never actually used in the game.

However, there is another way. The event code actually has flow control, specifically a repeat command. You could note that 9900900 = 33003 * 300 (or better yet, 57900 * 171) and make a loop that takes 33003 each pass for 300 passes (or 57900 * 171). It doesn't require any assembly, but it does require you to make a new event function. The upside is that there's plenty of space and it is supported by the vanilla engine.

Just wanted to add that tidbit. If there's interest, I could probably come along and give you an example of what that would look like.
User avatar
Imzogelmo
Veteran
Veteran
 
Posts: 659
Joined: Wed Sep 08, 2004 4:07 pm
Location: On the spirtual plane

Next

Return to ROM Hacking and Emulation

Who is online

Users browsing this forum: No registered users and 3 guests

cron