Open the ROM in a hex editor and go to the offset $19344. There will be four "screen IDs" listed there. These are the locations the warp caves will bring you to. The values specify a map location, where the first digit is the Y coordinate and the second digit is the X coordinate (0, 0 being the top-left corner of the map). For example, $49 would be the fifth screen down, tenth to the right.
The reason the game freezes is that when you step on a stairway, it looks through the list until it finds the screen you're in. If it doesn't find your screen, it keeps scanning forever.