Hey everyone!

This is more of a question for highly advanced users,
I'm new to working with emulations and am currently in the process of building a unique type of emulator, I may give more details about this later. But for now, I have a few questions that I'm hoping some of you may be able to answer relating to the structure of a ROM file.
I'm not really sure where to post this, but this seemed like the best section for this.

First off, I'm working in Gameboy roms.
So, I understand a ROM is a ripped copy of a cartridge's memory. The memory addresses are even p much exact throughout the header. When a ROM file is ripped, if an MBC is present, In what order does the memory from each ROM Bank go into the file? Are there any flags created to mark the end of these banks?

So is it like
HEADER < Bank0 < Bank1 < Bank2 < Bank3 < Bank 4...
or maybe,
HEADER < Bank0 < Bank1 < EndOfBankFlag < Bank2 < EndOfBankFlag...
Next does anything from the RAM on the cartridge get ripped?

I understand these are some pretty complicated question that a lot of members might not be able to answer. I'm just praying someone can help me out.

Thanks in advanced!