Here is a disassembly of PoP2 IR.
(I already mentioned that I started this, here: viewtopic.php?p=14176#p14176 )
Note that this EXE is overlaid, that is, different parts are loaded at the same place at different times.
Since IDA can't handle this, there is a huge empty area in the middle of the disassembly. (Between non-overlaid code and data.)

So, the 0011 file is the overlay? How did you extract it manually? I'm also wondering how you managed to get output with things like "cmp level_type, caverns". Was that altered/added by hand? I am a (dis)assembly noob and used ndisasm, but didn't get any of that information. I also tried using various unpackers first, but got nothing better.

On a somewhat related note. I'm trying to figure out for which rooms the EXE overrides what happens when you leave the room, for a future document about PoP2 events. Sometimes leaving to the bottom will have the prince falling/screaming down a pit; sometimes leaving to a side will have the prince end up in another room than the room links specify. Figuring this out by hand is a lot of work, so I'm looking at the disassembly.

In level 6, room 27 always has room 3 to its left. I found mentions of "room_left" but nothing interesting nearby, and searched for 1Bh (27) and then 3 nearby but didn't find anything.

Down in room 13 of level 13 is a pit. So, I searched for 13 and eventually found "seg003:019B cmp shown_room, 13; level 13, room 13: chasm". Then I searched for "chasm" and found several other hits...

Yes, it is *an* overlay, though it's not in a separate file (originally).
This overlay is different from the others in this exe, because it is always loaded.

The other overlays contain code that is loaded only in some cases, for example, depending on the type of the level.

Norbert wrote:How did you extract it manually?

There is a part in the file that stores where the overlays are in the file, and where are they loaded. In the disassembly I marked it with the label "ovl_segments".
Note that sizes and addresses have to be multiplied by 16.

Norbert wrote:I'm also wondering how you managed to get output with things like "cmp level_type, caverns". Was that altered/added by hand? I am a (dis)assembly noob and used ndisasm, but didn't get any of that information.

Yes, all names (and comments) were added by me. (Of course this means that some of them may be wrong or misleading.)

Norbert wrote:I also tried using various unpackers first, but got nothing better.

PRINCE.EXE of PoP2 is not compressed.

Norbert wrote:Sometimes leaving to the bottom will have the prince falling/screaming down a pit;

Norbert wrote:Several are still missing, like the flame room (level 13, room 4) and several rooms of level 1 (rooftops).

Level 13, room 4 has no room linked at the bottom, so it does not need any special events. Same is the case with level 1, except with room 11.
Some other rooms, however, have another room linked at their bottom, but treated as having nothing below.
Examples are: level 13 room 13, level 5 room 10, level 14 room 5.

Norbert wrote:In level 6, room 27 always has room 3 to its left. I found mentions of "room_left" but nothing interesting nearby, and searched for 1Bh (27) and then 3 nearby but didn't find anything.

I tried something: I changed the level type of level 6 to temple. After that, this special event did not work anymore.
But I can't find where is this event specified.
I tried these: (after restoring the level type, of course!)
* To zero out all the modifiers so that the custom background is not loaded.
* To delete the CUST resource for this room.
* Scan the exe for all instances of "cmp <something>,27" (and 28) and replaced 27/28 with 0.
Next step would be using the DOSBox debugger... (To catch the moment when the kid is moved to room 3.)

David wrote:
I tried these: (after restoring the level type, of course!)
* To zero out all the modifiers so that the custom background is not loaded.
* To delete the CUST resource for this room.
* Scan the exe for all instances of "cmp <something>,27" (and 28) and replaced 27/28 with 0.
Next step would be using the DOSBox debugger... (To catch the moment when the kid is moved to room 3.)

Interesting. I think I will check one level a day by hand. Then I should be done in 14 days (or, inc. gameplay, 28), which is totally doable.

salvadorc17 wrote:This means, that will be more easy to create a prince of persia 2 editor and mods??

The latest apoplexy (ZIP for Windows) should be fairly usable for that.
Levels 1, 2 and 14 are difficult for PoP2, so if you're new to level editing, I suggest you start with level 3 through 13.
If you haven't used apoplexy before, it may be best to first watch the old instructional video (here) and then its supplement (here).[Edit: Or maybe you mean for the SNES version?]

Meanwhile I found where is the level 6 event checked. (Entering the ruins.)
It is not in the current disassembly, but in overlay 0x0003. (It is loaded only when in-game, and not loaded when in the intro. In the intro, overlay 0x0002 is loaded instead.)

So I also added that overlay to the disassembly.
I tried to find and mark every place where something is done depending on the current level or room.
Though I am not always sure what happens.

I removed some things:
* The overlays folder: It's the same as before.
* PRINCE_ingame.asm: It's not really needed, it's the same as PRINCE_ingame.lst but without the offsets and hex codes.
* An area in PRINCE_ingame.lst that contained only uninitialized bytes.

It's 5 MB. People have uploaded >2 MB things recently.
I'm going to ignore the forum error, just because phpBB is already causing me enough discomfort.
(Unless someone has very specific instructions to make the thing that is already 5 MB really 5 MB for everyone everywhere.)
PS: I already checked if the "Prince Of Persia 2: The Shadow And The Flame" board has any settings that override the global setting and as far as I can tell there are no such settings.