Aslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&topic=1930.msg20745e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/indexd7f9-2.htmlslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&topic=1930.0e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/indexd7f9-2.html.zx;g^0P.tOKtext/htmlISO-8859-1gzip8:tTue, 10 Mar 2020 07:18:49 GMT0 0P;g^At Event Flag log

Author Topic: Event Flag log  (Read 3633 times)

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Event Flag log
« on: April 04, 2014, 01:29:00 PM »
this is a log I made for my own purposes. Mostly I wanted to avoid setting flags in my hack that would have unexpected effects, like changing the landscape or adding the drill to the Falcon.
Code: [Select]
FLAG (Dec) SET FIRST (w/hex event #) CLEAR SET SECOND
---- ------------------- ------------------- -----------
00 10 Opening events
01 12 Speaking to Kain in Baron
02 51 Rosa getting captured
03 11 Cid greeting cecil
04 15 Cecil sleeping, prologue
05 21 Cecil/Yang fight
06 1B Cagnazzo battle, losing twins
07 8C Meeting Giott, Calbrena Battle, Rydia Rejoins
08 19 Odin battle
09 1A Baigan Battle
10 96 Jump from Bab-il, airship escape 95 Yang Destroys Super Cannon
11 62 Becoming Paladin, Tellah remembers
12 82 Kain regaining his senses
13 2F Mist Dragon Battle
14 30 Mist Events
15 39 Kaipo events, Y Rydia Joining
16 43 Tellah fights Edward, leaves, Edward Joins
17 3A Curing Rosa
18 45 Antlion battle
19 3D Octomamm battle
20 42 Redwings bomb Damcyan
21 46 Rydia melts Hobbs ice, learns Fire
22 47 Yang joins, Mombomb battle
23 31 Watery Cave camping
24 83 Depart Fabul, Leviatan attack
25 95 Yang destroys Super Cannon F7 Speaking to sylph before Yang Awakes
26 (nothing)
27 48 Fabul battle
28 5E Talking with Elder, Twins join
29 5F Palom puts out Ordeals fire
30 60 Meeting Tellah on Mt. Ordeals
31 61 Milon battle
32 63 Milon Z. battle
33 64 Talking to Elder after becoming paladin
34 14 Rosa greeting Cecil
35 74 Obtaining Earth Crystal
36 71 Meeting Edward in Toroia, receiving TwinHarp
37 72 Speaking with Edward in Toroia after Dark Elf
38 66 Entering Tower of Zot first time
39 43 Tellah fights Edward, leaves, Edward Joins
40 18 Finding Odin before Feymarch
41 (nothing)
42 79 Magus Sisters battle
43 7C Valvalis battle
44 52 Discussion about rescuing Rosa
45 7F Entering Cave Magnes
46 73 Dark Elf 'me attack you' battle
47 7A Top of Zot events C6 Drilling to the surface
48 84 Usinhg Magma Key
49 4A Toroia clerics after Earth Crystal
50 8B First visit to Underworld, Enterprise crash
51 94 Lugae battles
52 9A Edge joins, Rubicant battle
53 (nothing)
54 0E Rubicant main battle 1D Attaching Enterprise hook
55 A5 Finding the Falcon
56 A7 Heat shielding the Falcon
57 A6 Obtaining Luca Key
58 B6 Kain stealing dark crystal and leaving
59 A8 Opening the Sealed Cave
60 C5 Attaching airship drill
61 (nothing)
62 A9 Feymarch entrance
63 AF Obtaining Dark Crystal
64 AA Demon Wall battle
65 B6 Kain stealing Dark Crystal and leaving
66 9E Lunar Whale surfacing
67 C9 Asura battle
68 CA Leviatan battle
69 CF Bahamut battle
70 D0 meeting FuSoYa and having him join
71 E6 Giant of Bab-il CPU battle
72 ED Four Fiends battle
73 E2 trading rat tail for adamant
74 EE Giving Adamant and Legend to Kokkol
75 E1 Obtaining Excalibur
76 (nothing)
77 09 Receiving the Pan E5 Using the Pan and learning Sylph
78 F9 Trading Pan for Spoon
79 F3 Behemoth battle 50
80 (nothing)
81 04 Behemoth battle 51
82 A1 Fighting Edge's parents 05 Behemoth battle 52
83 (nothing)
84 08 Rydia learning Sylph FC Obtaining Ribbon
85 (nothing)
86 F2 Exiting Watery Pass - North
(then nothing, until...)
225 73 Dark Elf 'Me attack you' battle

There are some curiosities here, some that seem to indicate that I've missed something. Certain flags get set twice without ever being cleared. Or cleared without ever being set. I'll make edits if I find anything I've missed.
Do you suppose it's possible some flags get set or cleared by other means besides events?

I may, at some point, look into figuring out how the landscape and vehicles are changed by flags. Those findings would be posted here as well.

Anybody happen to know where in RAM the flags are actually stored? It must be a 0x20 byte block, likely somewhere in the 1000-17FF range (because that's apparently what is saved in save data). I can go searching for it, but I don't want to bother if it's already known.

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Event Flag log
« Reply #1 on: April 06, 2014, 05:37:26 PM »
Wow! So there's over 120 unused Event Flags, eh? Great work there Chillyfeez! This is a nice piece of work you made here. But there are a few curiosities... Unfortunately I have no idea where the Event Flags are located either. It is reasonable they are in the section you mentioned, but I have never come across them.

Pinkpuff

  • Flan Princess
  • *
  • Posts: 924
  • Find a Megalixir in Unprecedented Crisis!
    • View Profile
Re: Event Flag log
« Reply #2 on: April 06, 2014, 06:41:18 PM »
I just put a "plot flag" config file into FF4kster. Next time I upload it'll be there.
Let's dance!

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Event Flag log
« Reply #3 on: April 06, 2014, 09:01:22 PM »
I have a plan for how I'm gonna find them, but it'll take a solid, uninterrupted hour or so of experimentation. I'm getting over a pretty bad cold so I haven't had that in a few days. Tomorrow, I think, if I can get a slew of neglected errands done in good time.

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Event Flag log
« Reply #4 on: April 07, 2014, 10:14:28 AM »
OK, that was remarkably easy.

Event flags are stored in RAM at 1280-129F.

It works exactly the way I imagined it would.

Each bit represents a flag: 32(d) bytes * 8 = 256
Flag 0 is bit 0 of byte 0 in this range. Flag FF (255) is bit 7 of byte 1F.
So, if you have flag 0 (and only flag 0) set, your RAM at 1280 will look like this:
Code: [Select]
01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

If you have flag 255 (and only flag 255) set, your RAM at 1280 will look like this:
Code: [Select]
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80

Setting flags 8,17,26,35,44,53,62,71,80,89,98,107,116,125,134,143,152,161,170,179,188,197,206,215,224,233,242 and 251 (and only those flags) yields:
Code: [Select]
00 01 02 04 08 10 20 40 80 00 01 02 04 08 10 20
40 80 00 01 02 04 08 10 20 40 80 00 01 02 04 08
Sorry, I ended up with more time than I expected...
 :blush:

And there you have it!

ON the surface, knowing this doesn't change much (I suppose someone with a lot of time on their hands could play the whole game through to look for changes in this range not made by events, but I have no plans of doing that), but this will be the first step toward learning how flags affect the landscape and vehicle travel.
 :happy:

 :edit: Interestingly enough, flag 225 - the one cleared during the Dark Elf 'Me Attack You' event, and the only one above 86 that seems to be used at all - is the only one set at the start of the game... I don't know off the top of my head, but I'd put money on this being the flag that controls the magnetic property in Magnes Cave. Another instance of the Square team wasting some time. They could have easily had the magnetic property turned ON when this flag is clear and OFF when it's set, have it set during 'Me Attack You!' and not bother setting it at the start of the game. Well... whatever.

 :edit: 2 - Also worth noting: Setting/clearing flag 255 terminates the event. The flag is totally usable, but somehow the game interprets the FF as both which flag to set, and the "End Event" command.
« Last Edit: April 07, 2014, 10:24:25 AM by chillyfeez »

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Event Flag log
« Reply #5 on: April 07, 2014, 07:43:02 PM »
That is some fantastic work there Chillyfeez! I can't believe I missed that considering it is Right After the Character Stats!

So the rest of the flags are usable, hmm? I am sure that can be put to some good use.

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Event Flag log
« Reply #6 on: April 07, 2014, 09:24:16 PM »
Thanks.
Well, regular party data runs through 113F, then shadow party data, then flags.
But you'd probably have to be looking for the flags in order to find them, they'd seem pretty cryptic otherwise.

Yeah, there's only one used between 86 and 255, so that's 168 unused flags.

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Event Flag log
« Reply #7 on: April 11, 2014, 11:09:43 AM »
So I've found the code that creates the mountains that block off Mist after the Mist events, which are related to the flag set during that event. As of now, all I know how to do with that info is change what type of land appears there (say, keep the grassland, or turn it into desert instead, or whatever), or to alter which flag makes these changes. I think that with a bit of playing around, I can use this knowledge to make mountains appear elsewhere (instead of near Mist), but that's not really a concern for me at the moment.

I'm much more interested in how the ship appears outside of Fabul after the Fabul battle. It is not the flag set during that event (44, I think). Nor is it the flag set during "Discussion about rescuing Rosa" (27). The ship does appear during one of the two events, though.
Time to put on my sleuthing cap.
 :hmm:

Anybody got any ideas about this one?

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Event Flag log
« Reply #8 on: April 12, 2014, 10:23:49 PM »
Well, that was interesting.

What makes the ship appear near Fabul is Visual Effect 13 (0D), previously thought to do nothing.
Playing Visual Effect 13 runs the following code:
Code: [Select]
$00/D0BA A9 01       LDA #$01               
$00/D0BC 8D 28 17    STA $1728  [$00:1728] 
$00/D0BF A2 DE 38    LDX #$38DE             
$00/D0C2 8E 29 17    STX $1729  [$00:1729]

So, 1714-172B in RAM is where the game stores the information about where all of the vehicles are parked.
There's an entry for Black Chocobo, Hovercraft, Enterprise, Falcon, Lunar Whale and Ship, and each entry is four bytes long.
Byte 00:
 01: visible
 00: not visible
Byte 01:x-position
Byte 02:y-position
Byte 03:Which world it's on (00-Overworld, 01-Underworld, 02-Moon)

So Visual Effect 13 parks the Ship just off the Fabul dock.
You could change which vehicle is parked by the visual effect by decreasing the values at D0BE-F and D0C3-4 by increments of four.
So:
Code: [Select]
$00/D0BA A9 01       LDA #$01               
$00/D0BC 8D 20 17    STA $1720  [$00:1720] 
$00/D0BF A2 DE 38    LDX #$38DE             
$00/D0C2 8E 21 17    STX $1721  [$00:1721]
would put the Falcon at the Fabul dock.

You can also change where the vehicle is placed by changing D0C0-1
Changing
$00/D0BF A2 DE 38    LDX #$38DE 
to
$00/D0BF A2 66 9E    LDX #$9E66
Would place the ship outside of Baron.

Note that:
a) You can't board the ship, even if you place it somewhere where you can walk on top of it
b) The ship disappears by way of Visual Effect 17 (when it's sucked into Leviatan's whirlpool), so unless you plan on running this effect eventually, or finding some other way, the ship will never disappear. 

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Event Flag log
« Reply #9 on: April 13, 2014, 11:23:07 AM »
Wha? Great sleuthing there Chillyfeez! I wasn't sure how that worked either, I thought it might have been an NPC activation. Well now I know that is clearly not the case.

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Event Flag log
« Reply #10 on: April 13, 2014, 01:00:01 PM »
Yeah, I was trying to figure out how to make it so the ship stays parked outside of the appropriate dock in my hack. I think I've got enough info for that now. I think I can place the ship at different ports using event flags, since I'm not planning for landscape changes (as yet...), but VE13 will have its use too (I won't say more... Spoilers).

I probably will, somewhere down the road, explore in-depth the landscape changes, but I got what I need here for now, so it'll be a while.

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Event Flag log - "Together, We Can Move Mountains!"
« Reply #11 on: April 21, 2014, 04:19:41 PM »
Not a lot of activity here lately. Well, in case anybody's still reading...

My original plan was to take what I learned and get back to my hack, but as is my usual MO, my curiosity got the better of me.

I decided to investigate the flag-triggered landscape changes. From what I can tell, there are three:
-closing of the passage past Mist (flag 14)
-Damcyan turning from normal castle into broken castle (flag 20)
-opening the hole to the Underworld (flag 48)

Here's a disassembly of the Underworld hole routine (which is actually the routine to close the hole when the flag is set - it's open by default):
Code: [Select]
$15/C78B AD 86 12    LDA $1286  [$00:1286]   
$15/C78E 29 01       AND #$01                ;Check if flag 48 is set
$15/C790 D0 58       BNE $58    [$C7EA]      ;If it is, end routine
$15/C792 A5 93       LDA $93    [$00:0693]    ;If it is clear, load 0693 in RAM
$15/C794 C9 D2       CMP #$D2                ;Check if it is D2 (Will be discussed but not necessarily explained later)
$15/C796 D0 07       BNE $07    [$C79F]      ;If not, skip to next check
$15/C798 A9 13       LDA #$13                ;If it is, load 13 (center mountain tile) into A
$15/C79A 9F DB 5C 7F STA $7F5CDB,x ;Store A in 7F:5CDB,x (under these circumstances, this will be the place in RAM where the top tile of the hole to the Underworld is stored)
$15/C79E 6B          RTL                      ;End
$15/C79F C9 D3       CMP #$D3                ;Check if 0693 is D3
$15/C7A1 D0 0F       BNE $0F    [$C7B2]      ;If not, skip to next check
$15/C7A3 A9 13       LDA #$13                ;If it is, load 13 (center mountain tile) into A
$15/C7A5 9F DA 5C 7F STA $7F5CDA,x
$15/C7A9 9F DB 5C 7F STA $7F5CDB,x
$15/C7AD 9F DC 5C 7F STA $7F5CDC,x ;Store A in 7F:5CDA,x through 7F:5CDC,x (second row of the hole to the Underworld)
$15/C7B1 6B          RTL                      ;End
$15/C7B2 C9 D4       CMP #$D4                ;Check if 0693 is D4
$15/C7B4 D0 17       BNE $17    [$C7CD]      ;If not, skip to next check
$15/C7B6 A9 13       LDA #$13                ;If it is, load 13 (center mountain tile) into A
$15/C7B8 9F D9 5C 7F STA $7F5CD9,x
$15/C7BC 9F DA 5C 7F STA $7F5CDA,x
$15/C7C0 9F DB 5C 7F STA $7F5CDB,x
$15/C7C4 9F DC 5C 7F STA $7F5CDC,x
$15/C7C8 9F DD 5C 7F STA $7F5CDD,x ;Store A in 7F:5CD9,x through 7F:5CDD,x (center row of hole)
$15/C7CC 6B          RTL                      ;End
$15/C7CD C9 D5       CMP #$D5                ;Check if 0693 is D5
$15/C7CF D0 0F       BNE $0F    [$C7E0]      ;If not, skip to next check
$15/C7D1 A9 13       LDA #$13                ;If it is, load 13 (center mountain tile) into A
$15/C7D3 9F DA 5C 7F STA $7F5CDA,x
$15/C7D7 9F DB 5C 7F STA $7F5CDB,x
$15/C7DB 9F DC 5C 7F STA $7F5CDC,x ;Store A in 7F:5CDA,x through 7F:5CDC (penultimate row of hole)
$15/C7DF 6B          RTL                      ;End
$15/C7E0 C9 D6       CMP #$D6                ;Check if 0693 is D6
$15/C7E2 D0 06       BNE $06    [$C7EA]      ;If not, end routine
$15/C7E4 A9 13       LDA #$13                ;If it is, load 13 (center mountain tile) into A
$15/C7E6 9F DB 5C 7F STA $7F5CDB,x ;Store A in 7F:5CDB (bottom tile of the hole)
$15/C7EA 6B          RTL            ;End       

Now then, this is all pretty straightforward, except that there is some info that I don't fully understand.
The first is 0693 in RAM.
Here's what I know about it:
-It changes with every step (or one tile of movement) up or down, but stays the same when moving left or right
-it is the same if you are facing down as it is if you are facing right, and the same facing up as facing left, but different (seemingly by 0x40) between up/left and down/right. To hopefully better explain - if you are facing down and 0693 is D2, turning to facing up (without moving) would change 0693 to 92.

The implications of this knowledge - it is entirely possible to relocate where each row of mountains appears by any number of spaces up or down by increasing or decreasing the comparisons on 0693:


Seen here, intentionally spread out between Agart and Baron by changing the original D2, D3, D4, D5 and D6 values to B2, B4, B6, B8 and BA.

Now, it is possible to move the mountains left or right by changing the indexed RAM locations in this code (7F:5CD9, etc), but there are limits. you can't just increase one of these values by 0x80 and have the mountains move halfway across the world sideways. I don't know exactly what the limits are, but I know the mountains can't go as far as the Tower of Bab-il. I suppose this could be illuminated by learning exactly how much map data is loaded into RAM at a time, and how the game knows when to load a new set of data.
I don't know if I'll be examining this anytime soon. it seems like a lot of work for something I don't really need at the moment... which probably means I won't be able to resist looking into it anyway.
 :blush:

It's also possible, by the way, to change what kind of landscape tile the changed tiles become, by the way, by changing those LDA #$13 commands to a different value. You can use this graphic to help with that. Bear in mind, though, that given how this is coded, it'll be tough to make any different types of tile within the same row.

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Event Flag log
« Reply #12 on: April 21, 2014, 06:57:39 PM »
That's some neat information you gathered Chillyfeez! I think for the majority of us we're at the end-semester crunch. We're getting all of our assignments and all of that done so we don't have as much time as we'd like for FFIV. I am looking forward to see what else you find in regards to these changed tiles on the world maps though.

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Event Flag log
« Reply #13 on: April 25, 2014, 03:09:13 PM »
OK, I cracked it!

For proof of concept, I wrote some code that makes a (broken) castle appear just south of Fabul when flag 48 is clear:




So... how does it work?

Let's preface this by saying that there's no easy equation to make this work, and the size of what you can make appear/disappear is still limited by the fairly small amount of space available for code - and this block has no large amount of empty space to speak of, so to jump to a different spot for more code would require a JML or JSL.

So...
7F:5C71-7F:9C70 is the place in RAM where the game stores the current Overworld map data. Probably Underworld and Moon, too if that's where you are, and possibly even location map data, but these are all irrelevant to what we're doing now.
Each byte in this block of RAM represents one map tile. They will all have a value of 00-7F, so if the map data in ROM says 99 05 (5 bytes of ocean), the RAM will read 19 19 19 19 19 (5 single bytes of ocean).
You may notice that this is only 4000 (hex) bytes, which at 100 (hex) bytes per row means the game is only loading 40 (hex) rows of map into the game at any given time. You'd be right. with every movement up or down, the game is constantly changing 0x0100 byte blocks of RAM. Presumably, 0x40 rows is about as far as the game can display if the map is zoomed out as much as possible, so beyond that much is deemed not worth loading.
NOW, a given spot on the map will always occupy the same exact spot in RAM, as long as it is loaded at the time, so it is possible to specify exactly which tiles you want to change, but finding exactly where in RAM your tile is can be a bit of a complicated process. So I'll do my best to explain...

So, first thing to do is fly to the correct y-position of the tile(s) you want to change:


Next, change the first byte of map RAM from 19 (it will always be 19 - there is no part of the map at x-position 0 that is not ocean) to something visually distinct, like 43 (desert):


Now, being careful to stay in the same y-position, fly out to x-position 0 to see where that bit of desert appeared:

Note that we got lucky here - you might not see the bit of desert on the first try. If you don't, skip forward exactly 0x1000 bytes of RAM (0x10 rows) and try again at 7F:6C71. You'll have to fly left or right to get this spot out of view, then fly back after you change your byte of RAM.

Once you've seen where your bit of desert appears, you can begin to triangulate the right spot. If you need to change a more north portion of the map (lower y-position), then use a lower portion or RAM, higher to move more south. In this particular situation, we need a more north position, but we're already at the very beginning of the map block or RAM, so we'll cycle to the end (7F:9c70) and move backwards from there:



Almost there... two more spaces up should do.


Found it!
This block of 0x0100 bytes is the row containing the tiles we want to change.

Next, fly back to the tiles we want to change to observe the current landscape there.
We want to change two tiles that happen to be in the middle of a row of 6 "top edge of light green grass" tiles, which, referencing this chart, will have a value of 4C.
So we're looking for "4C 4C 4C 4C 4C 4C" in this block or RAM:

Found 'em!
Just to be sure, we'll turn these bytes into desert to be sure they're the right ones (remember to fly left and right so the game can change what the tiles look like):

OK, we're good. The Bytes of RAM we want to change are 7F:9A47-9A48.

Now, just to be sure we've triangulated the RAM bytes we want to change, let's manually make the changes. We'll turn these two bytes into 2D, 2E (top left and top right of broken castle), then we'll change the two bytes 0x0100 bytes later (7F:9B47-9B48, which will be the next row down) to 3D, 3E (bottom left and bottom right of broken castle):

Yep, that's what we want!

The next step is to find the outer limit of where this RAM will be loaded thusly... that is, how far north can I fly before these bytes are loaded with different values? I recommend slowing down emulation (press "-" on your keyboard) so as not to fly more than one tile at a time. We want to know exactly when the RAM changes:

There we are.

Now, fly back down one space at a time until it changes back:


Once you've arrived at the right place, observe the current value of 7E:0693:

That'd be it - 3D (and 3E for the next row down).

OK, the last thing to do is figure out what your register X value will be when 7E:0693 turns to 3D. For that, use this chart:
Code: [Select]
7E:0693 X
------- -----------------------
C0 OR HIGHER (7E:0693 - C0) * 0x0100
80 THROUGH BF (7E:0693 - 80) * 0x0100
40 THROUGH 7F (7E:0693 - 40) * 0x0100
UNDER 40 7E:0693 * 0x0100

So, using what we just figured out, we can write the code:
Code: [Select]
$15/C78B AD 86 12    LDA $1286  [$00:1286]   A:0000 X:3D00
$15/C78E 29 01       AND #$01                A:0000 X:3D00 ;Check if flag 48 is set
$15/C790 D0 58       BNE $58    [$C7EA]      A:0000 X:3D00 ;If so, skip the rest
$15/C792 A5 93       LDA $93    [$00:0693]   A:0000 X:3D00
$15/C794 C9 3D       CMP #$3D                A:003D X:3D00 ;If clear, then check if 7E:0693 is 3D
$15/C796 D0 0C       BNE $0C    [$C7A4]      A:003D X:3D00 ;If not, skip to next check
$15/C798 A9 2D       LDA #$2D                A:003D X:3D00
$15/C79A 9F 47 5D 7F STA $7F5D47,x[$7F:9A47] A:002D X:3D00 ;If so, load 2D (top left of broken castle) into 7F:9A47
$15/C79E 1A          INC A                   A:002D X:3D00
$15/C79F 9F 48 5D 7F STA $7F5D48,x[$7F:9A48] A:002E X:3D00 ;And 2E (top right of broken castle) into 7F:9A48
$15/C7A3 6B          RTL                     A:002E X:3D00 ;End
$15/C7A4 C9 3E       CMP #$3E                A:003E X:3E00 ;Check if 7E:0693 is 3E
$15/C7A6 D0 0B       BNE $0B    [$C7B3]      A:003E X:3E00 ;If not, end
$15/C7A8 A9 3D       LDA #$3D                A:003E X:3E00
$15/C7AA 9F 47 5D 7F STA $7F5D47,x[$7F:9B47] A:003D X:3E00 ;If so, load 3D (bottom left of broken castle) into 7F:9B47
$15/C7AE 1A          INC A                   A:003D X:3E00
$15/C7AF 9F 48 5D 7F STA $7F5D48,x[$7F:9B48] A:003E X:3E00 ;And 3E (bottom right of broken castle) into 7F:9B48
$15/C7B3 6B          RTL       ;End

And there you have it!

This method can be used to make any type of tile appear anywhere on the Overworld map, using any given flag as the trigger.
It's not the quickest process in the world. It'll never make it into any editor. But at least now the knowledge is out there. One more mystery solved.


Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Event Flag log
« Reply #14 on: April 26, 2014, 10:31:25 AM »
Haha! That is amazing work and very comprehensive as well. Though just a bit of curiosity... is this why Yousei's old World Map Editor shows the world carved into many, many blocks of (what I assume) 32x32? Could that also be used as a reference for the RAM Changing?