The FE8 research topic

Since there’s apparently suddenly more interest in hacking FE8 (ie venno and alfred), I figured I’d make a thread where we can pool our resources and see if we can’t make FE8 somewhere near as well documented as FE7.

I’ll go first. This is all the stuff I’ve been able to figure out from randomly corrupting data in WRAM (the best way to figure stuff out is clearly to change random potentially important data for no reason other than “because it’s close to other random important data”). Of note is the “mode modifier”, which I’ve done… slightly more research into.

[1:07:14 AM] Cam: >swaps eir to eph mode mid-chapter 17/19
>after defeating boss (or exhausting turn limit), chapter becomes “defeat enemy” in which routing does nothing

“damn this sucks”
“wait what happens if i do something other than ephraim mode”

>swaps eir to — mode mid-chapter
>chapter ends normally and plays eph mode ending


Some more experiments with that mode byte:

In Chapter 15 Ephraim, switching the byte to 0x2 or 0x1 let me Retreat. This ended the chapter instantly and put me next to 16 Eirika.

In fact, putting the mode byte to 0x3 in Eirika’s chapter or 0x1/0x2 in Ephraim’s chapters at any point after Chapter 15 starts makes the game assume you’re in a Skirmish - this is probably because you can visit the other twins’ chapters as skirmishes after Chapter 16, so a mode byte/chapter mismatch leads to the Retreat command being allowed.

Starting Chapter 16 in Eirika mode, then switching to Ephraim’s, then retreating, doesn’t unlock the Eirika mode locales but does allow skirmishes to spawn on them - you just can’t reach them.

With the FE8 sequel project becoming a distinct possibility, I thought this might be of interest to people: my personal doc of FE8’s event codes and the associated ASM code.

It’s obviously not comprehensive; I’ll add to it now and then. Highlights include commands for harming/healing units, arithmetic between memory slots, FOR loops, difficulty checking and a very robust conditional command.

I’m not on the wizard level enough to tinker with this, but I’d happily contribute to trying to make FE8 hacking more reasonable…I dunno, if you needed drudgework.

Can Rogues pick up mines?

Rogues can’t pick up Mines, or at least not their own. The Mine itself still works, except the flames are purple instead of red.

And here is some freshly made documentation on FE8’s world map codes. This stuff was documented based solely off of the Prologue prologue map scene, so many of the codes here are missing or incomplete. That’ll change eventually, but for now I also have a Nightmare module for reading the pointers to every chapter’s map scene prologue. You can find it here.

And for those who’re interested, this file is a script for use with the Event Assembler that will disassemble all of these world map prologues for you. I’ve left out the prologues for Valni 2-8 and Lagdou 2-10 since it’s obvious what those are.

Wizard level

The thing Cam did to uncover the info in the first post, memory corruption, is the most beginner level tool there is. It’s the most crass, brute-force, haphazard research technique and it’s the most available as well.

So yeah if you want to contribute then try it out. Remember to keep a notepad ready to write everything down.

I personally think it’s too crude to be worth it and that more magnificent results will…result…if you pick a goal you want to achieve and…achieve it (my vocabulary aches) through more apt means (e.g. a cheat search for finding a variable in RAM, debugging to locate code that modifies or reads a variable, a graphics decompressor for finding and editing large images, a hex editor for searching for likely hex strings to locate and modify known attributes, etc.)

There’s actually two prologue scenes for the world map, for the other chapters. One of the pointers points to stuff that happens when you’re done with a chapter and loads the world map (so stuff like “load where Ide is, put a waving flag, and make it so you can access Ide”) and the other tells you the stuff that happens when you actually make your character go there (stuff like “display Hayden’s portrait, talk about how he can’t spare many soldiers, and put flashy dots on Grado’s capital”).
some miscellaneous documentation

Yeah, the post-chapter world map scenes are already included in Event Assembler’s script folder; it’s just the pre-chapter scenes that weren’t documented before. Not to mention 99% of the names for these commands are misleading or nonexistent.

Your notes on the world map locations will be a nice time-saver, so thanks for those!


I’ve managed to make the game automatically move you to the next chapter. You don’t even have to see the world map if you don’t want to. It’s very hackily implemented at the moment, but I expect I’ll get it to be more natural as I progress.

Moving the world map locations to different coordinates causes weird bug where character will travel all the way across the map and then all the way back to where they’re supposed to go to.
2064C0 data for these things
change the coordinates there (it’s the corners of the lines on the map) (i.e. 78 00 68 00 is the corner of the line leading from frelia to ide) and it’s fixed
hmm testing on fresh fe8 rom now
yep it works. the graphical lines are hardcoded to be drawn in the same place though so if you’re changing the locations, take those out

Nice work! Looks like for scripted movements to locations, you don’t need the lines to be present.

You do need to have executed the _0x9720 command, which unlocks the location, first, or else the game will lock up after the pre-chapter world map cutscene.

Edit: After some further investigation, I’ve determined that the coordinates for actual locations on the map (Mulan, Ide, Za’ha Woods, etc) are located at $2060C8. They’re stored as coordinate pairs every 0x20 bytes, and I’m sure the other bytes in that region are useful too. Changing these coordinates is reflected graphically, making the sprites for these locations move around on the map!

I’ve got (it’s an .nmm file, so no preview) for that area of memory. It contains the icons for the locations, shop pointers (armory, shop, secret), the text for the location, the coords, and some more unknown stuff.
Keep in mind that to move the sprites of the locations around without causing very weird movement when the character travels there will require you to change the corner things in my previous post as well.

…I can’t believe I overlooked that. Didn’t mean to ignore your work, sorry.

I took a look at the values with the help of your module, and I think that the "Unknown 1’ parameter controls which path and path graphic that world map location uses (or rather, which ones that chapter unlocks); “Unknown 2” seems to control what world map events that chapter uses - setting Ide’s to Renvall’s values takes you directly to chapter 8, for instance.

For instance, Castle Frelia’s Unknown 1 parameter is 0088 3838. Changing it to 0089 3838 unlocks the Tower of Valni and port Kiris instead of Ide; probably because you’re still in Eirika mode. I imagine Ephraim mode would unlock Fort Rigwald instead of Kiris.

Hmm, this seems very useful. I wonder if I can go to Rigwald as Eirika…

I’ve found the data that determines which paths connect to what; with this data, now you can make any path connect to any two locations on the world map and customize the path’s speed, number of corners and whether or not ship travel is enabled by pointing to whatever path data you want.

I’ve also updated the world map location editor to provide some clarity on more of the values; three locations (Castle Frelia, Serafew and Border Mulan) will execute new events depending on the state of a permanent Event ID, for instance; and each chapter has two bytes denoting its chapter ID on Eirika and Ephraim mode, used for things such as skirmishes.

Nightmare modules for both of these things are here.

1 Like

So, I’ve figured out how FE8 draws its paths on the world map; it’s really a neat system. The paths graphics aren’t stored as whole graphics, but as little pieces which you can put together to draw any of the paths on the world map.
The path graphics data, which is pointed to by the path connections data at $8206674, starts at $8A97FC4 - that’s the graphics data for the Border Mulan - Castle Frelia path.

Each path is drawn in horizontal strips; for each strip, you can define their X and Y coordinates and how many tiles will be in that strip. For instance, let’s look at the Border Mulan data:

0C 08 03 01 

These four bytes start off a horizontal strip for any path. The first two bytes are the X and Y coordinates of the top-left edge of the strip. The next byte indicates how many tiles this strip will contain. I’m not certain what the fourth byte is, but it appears to always be 0x1, and changing it causes crashing or garbage tiles to be drawn.

After this comes defining the tiles this strip will use, with two bytes per tile. Here are the three tiles the top strip of this path uses:

01 00  01 00  07 00 

The first byte of the tile indicates what graphic to use. 0x1 gives a horizontal section of path at the bottom of the tile, ad 0x7 gives a tiny bit of corner rounding at the bottom-left of the tile.

The second byte is a sort of modifier to the tile graphic; it can affect the graphic’s position and orientation, and is used by corners and diagonal lines. For instance, while 0x7 0x0 gives a corner at the bottom left, 0x7 0xC gives a corner at the top-right of the tile.

Here’s the rest of the graphical data for the Mulan-Frelia path:

0C 09 04 01 02 00 02 00 06 00 07 00

0E 0A 05 01 07 0C 06 00 01 00 01 00 01 00

0F 0B 04 01 07 0C 02 00 02 00 02 00 FF 00 00 00

So, this first path has four horizontal strips; to end the list of strips, write out 0xFF000000 at the end of the last strip.

Lastly, this graphics data must be word-aligned, so don’t put the start of any lists at an offset that isn’t a multiple of 4.

1 Like

I’ve encountered a serious problem with expanding the maximum number of paths for the world map.

The game stores the IDs of all the paths you’ve unlocked, one after the other, at $03005324; and there’s only space there for 31 entries, equal to the number of path IDs used in vanilla. After that, it gets bit-packed into a region near the start of the stack; and there there’s only 4 bytes = 32 bits allocated for the path IDs. From there, the data gets stored to the SRAM along with a couple dozen other bytes.

I’m…not sure how to work around this issue, and I’d rather be able to straight-up expand the number of IDs available than make up some hacky solution. If anybody has advice on this, I’d be glad to hear it.

This is really interesting. It seems we’ll be able to hack the world map finally!
While I was away these few weeks, I tried to figure out what most of the codes do. But it seems that everything I discovered has already been documented by you, Venno, lol.
Hit me on skype, I’ll do my best to help