Users browsing this thread: 1 Guest(s)
Event bits in ASM and World Map Load events

#1
Posts: 676
Threads: 44
Thanks Received: 26
Thanks Given: 21
Joined: Jan 2015
Reputation: 11
Status
Zombie
Checking event bits in ASM, anybody?

I can get on a chocobo after parking the airship... and after getting off the chocobo...

Apparently I don't know how to check event bits. Well its more the loading of event bits that's getting me. Course I've yet to figure out how any LD* command actually works... advice?


The only true wisdom is knowing you know nothing.
  Find
Quote  

#2
Posts: 3,970
Threads: 279
Thanks Received: 236
Thanks Given: 58
Joined: Oct 2011
Reputation: 65
Status
Tissue-aware
You can use the BIT instruction. BIT #$01 would check first bit, BIT #$02 the second, BIT #$04 the third and so on. Following the BIT instruction, you can have a BEQ (result 0, bit not set) or a BNE (result 1, bit set).

As for loading event bit, you can use LDA. This will load either one or two bytes depending if the accumulator is set to 8 or 16 bits. You want the first option.
  Find
Quote  

#3
Posts: 676
Threads: 44
Thanks Received: 26
Thanks Given: 21
Joined: Jan 2015
Reputation: 11
Status
Zombie
Okay, so far the checks are working (as far as I can tell, if I clear the second bit check it lands normally, if I set it, it goes in to repeat chocobo mode).
So the problem at this point is: Clearing that bit, well how to clear that bit. Nothing I've tried made a dent.
Code:
AB               PLB
28               PLP
E2 20            SEP #$20          (8-BIT A)
AF 99 1E 7E      LDA $7E1E99       (Load Event Bit $0CD-$1E99, Bit 5)(Acquired the Falcon)
89 05            BIT $05           (Check Bit 5)
D0 01            BNE +01           (Skip RTS)
60               RTS    
AF C1 1E 7E      LDA $7E1EC1       (Load Event Bit $20C-$1EC1, Bit 4)("Ready to Ride Chocobo"-Custom Bit)
89 04            BIT $04           (Check Bit 4)
D0 01            BNE +01           (Skip RTS)
60               RTS
AF C1 1E 7E      LDA $7E1EC1       (Load Event Bit $20C-$1EC1, Bit 4)("Ready to Ride Chocobo"-Custom Bit)
?? ??            ?                 (Clear Bit 4)
4C CC 86         Jump to $3C/E3E1  (Chocobo Event)
60               RTS

That's what I'm playing with at the moment. I did move the "cut in" to EE/942C so it only run this when dismounting (from the Airship or Chocobo). The downside is, from this point it doesn't show the Airship landing before you jump to the chocobo (That's something that's less of a concern atm). Either place it cuts in is replacing PLB-PLP-RTS which is why this starts and "should" default to that.

Another problem is, (I'm not sure if it would be a problem if it worked properly) when it is stuck in a loop (as it is now) it will crash the game if you dismount 20 or 30 times in a row. I figure its due to something being sloppy, or maybe the game just gets tired of that chit and dumps it.

No, its not pretty and only half ass does/doesn't work. I'm still guessing at least 80% of it.

Relocated the jump to this code to EE/47E2. If both bits are set (as in you should be on a chocobo) the ship lands, and you are put on a chocobo. Dismount bird, everything fine and dandy(battles, menu, etc). Reboard the airship, land, no chocobo. That all works.

Until you get on the airship and hit X. Then it crashes.

I added in the place of that question mark in the code above:
Code:
29 FB         AND ?FB
8D C1 1E      STA $1EC1
That was intended to only clear Bit 4 of $1EC1, but I don't know if its doing more than that or not.

And I don't what part is making it where you can't hit X to enter the airship without crashing the game. Closer but still broke.


The only true wisdom is knowing you know nothing.
  Find
Quote  

#4
Posts: 1,633
Threads: 56
Thanks Received: 13
Thanks Given: 84
Joined: Apr 2014
Reputation: 12
Status
Atma
What if some bit is set/cleared when you land the airship and then move your character? i mean, something that MUST be changed right in that moment and not later, in that case you should make that happen even if you land with a chocobo?


THE GREATEST CHALLENGE OF ALL TIMES AWAITS:
http://www.ff6hacking.com/forums/showthr...p?tid=2593
DO YOU HAVE WHAT IT TAKES TO SLAY A GOD?
------------------------------------------------------------------------
Tenkarider's project #2 is started: FF6 Curse of the Madsiur Joke (CotMJ)
http://www.ff6hacking.com/forums/showthr...p?tid=2755
What happens when Madsiur tweaks your account? This full game hack will show that!
  Find
Quote  

#5
Posts: 676
Threads: 44
Thanks Received: 26
Thanks Given: 21
Joined: Jan 2015
Reputation: 11
Status
Zombie
I'm still leaning toward my code doing something it shouldn't.


As far as what your saying, it couldn't. The part of code I cut into is nothing but an RTS. So, unless both of my bit checks pass it still ends in a RTS. If they pass it goes to the chocobo, then back through my code again when the character and airship is drawn on the world map (the reason I had never ending chocobo rides before I cleared the second bit checked) and back to an RTS after the checks fail.


That being said, the branch to "chocobo mode" could be the issue. Something might be getting bypassed thats important. It doesn't make any sense that an odd jumps to chocobo mode would break entering the airship map but...


I'll go back and look for a difference in how I'm getting to the bird and see if I can enter the normal line of code any higher in case I'm missing something. Hey, its something to try, thanks for the suggestion.

I'll be damned it actually might not be my code. Took out the jump to "chocobo mode initialization" and everything seemed to not crash.

So now I have to go back and find a better way to get to the bird then. ... hopefully


The only true wisdom is knowing you know nothing.
  Find
Quote  

#6
Posts: 3,970
Threads: 279
Thanks Received: 236
Thanks Given: 58
Joined: Oct 2011
Reputation: 65
Status
Tissue-aware
I think your code is almost ok. I remember using a JMP instruction somewhere, then wrote some code to finish it with a RTS and the game was freezing. This was due to altering the PB register. I had to have a PLB or PHB instruction before my RTS to fix this. If you strictly uses JSR, JSL, RTS or RTL this shouldn't happen though.

Also, you should do LDA $1EC1 to load the event bit. I'm not sure LDA $7E1EC1 is the same... Maybe but maybe not. I'm no ASM master.
  Find
Quote  

#7
Posts: 676
Threads: 44
Thanks Received: 26
Thanks Given: 21
Joined: Jan 2015
Reputation: 11
Status
Zombie
As far as I can tell, the problem is the jumping into the chocobo mode initialization at the point I'm jumping into it. And somehow ( I still don't understand how) that is jacking up something.

Leaving two options, start chocobo mode from a higher point in the code (which so far I haven't found anywhere better to jump in that script) or jump to an event in CA and set up chocobo mode from there.

I tried the jump to an event (copied the code used for the pheonix cave and kefka's tower events) and for some reason that fails badly (crash on landing airship with bits set).

In other words, back to not being sure where to go with it atm, well one half assed idea but...

As for the 7E1E1C thing, I dont know, I took it out once and something broke, out it back in and something worked. The opcode list has AF listed as a 4 byte command. The game uses it with three sometimes (AF 1C 1E) and other times with 7E included.
I haven't tried running it without that since I got the other stuff straight, will try removing the 7E just to find out what happens though.
*EDIT* That didn't take long... I removed the 7E from all the LDA's and... it put me back into never ending chocobo mode. It should have crashed or worked, so I have no idea.


The only true wisdom is knowing you know nothing.
  Find
Quote  

#8
Posts: 1,633
Threads: 56
Thanks Received: 13
Thanks Given: 84
Joined: Apr 2014
Reputation: 12
Status
Atma
Just to be sure... have you checked the events related to choco stables? maybe in that place, before you appear in the world map while riding a chocobo, some particular bit/var changes it's value?


THE GREATEST CHALLENGE OF ALL TIMES AWAITS:
http://www.ff6hacking.com/forums/showthr...p?tid=2593
DO YOU HAVE WHAT IT TAKES TO SLAY A GOD?
------------------------------------------------------------------------
Tenkarider's project #2 is started: FF6 Curse of the Madsiur Joke (CotMJ)
http://www.ff6hacking.com/forums/showthr...p?tid=2755
What happens when Madsiur tweaks your account? This full game hack will show that!
  Find
Quote  

#9
Posts: 3,970
Threads: 279
Thanks Received: 236
Thanks Given: 58
Joined: Oct 2011
Reputation: 65
Status
Tissue-aware
As I said in the shoutbox, you should use the debugger and set a breakpoint at "dismounting a vehicle" routine and see what goes wrong there.
  Find
Quote  

#10
Posts: 676
Threads: 44
Thanks Received: 26
Thanks Given: 21
Joined: Jan 2015
Reputation: 11
Status
Zombie
Have to remember, I'm a noob. Never seen a debugger in this realm.

On another note, I've only rewrote the code about 15 times. Ran it from every place I could come up with, split it into two parts, rewrote it a few more times... wtf...

Anyway, the code works as far as I can tell, but the damn extra bit won't reset.

I can load a savestate with bits set, land, bird, dismount, everything okay. Except doing it again. I can load the same save state, clear several bits, and no bird on landing. It acts like the code is looking at one bit and the events are playing with another, but every piece of documentation says 1EC1, bit 4 is $20C.

I know I'm able to clear whatever bit the code is using, with an event, guess I'll go through that list until I find which bit its actually using.

As far as the events for chocobo stables, it sets a vehicle bit $02. Bank EE checks that when loading the world map. One attempt involved cutting in before that check, check my bits, the set that if it should. I think that time it only did it when I came out of a town or cave, not landing the airship.I also attempted to go directly to where that check leads, which didn't work much better. Currently I'm running my code between that section between where it would jump to character mode, and actually getting to charater mode(The jump was already there and it seemed to take better than other options as well as run when I wanted it to). I could try setting that vehicle bit if I have bugs after I get the custom check to work properly, but as of now it doesnt seem to need it.

I also tried, again, to call an event from Bank EE to run the bird script as intended fully, and that failed miserably both times.


The only true wisdom is knowing you know nothing.
  Find
Quote  



Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite