Phew, the credits routine is longer than I expected. Well actually the part that prepares for the routine is long.
My full notes can be seen
here.
Some important things we skipped:
4F26 -> rating (of course)
4F4A -> upload text graphics (doesn't matter because we don't display normal text :P)
4F63 -> sound stuff (which probably everyone has noticed)
50B6 -> set DE to 0x5171 (which I explain later)
So what is the credits routine? The game has a place ($5171) where pointers for the text in the credits are stored (eg. 0x1C for
POKéMON; 0x00 for
YELLOW VERSION<linebreak>STAFF). So 0x5171 is normally stored into registers DE so that it can be accessed quickly. After the game reads one value from that place it checks if it is a "special case". If it isn't it will get the lines from that pointer value. If that value is 0xFA or higher it is considered a "special case". The screen will only display loaded lines when there is a special case. The different values for the special case are the different ways of showing the lines (eg. scrolling, text without scrolling, text without scrolling with palette change, copyright, THE END). At the end it increases DE and goes back to get the next value.
Our code directly jumps into special case 0xFF which is "display, then scrolling" (that explains that garbage screen after leaving the menu). Then it reads the next value from DE... wait, DE? We skipped setting it to the right value. The last time it was set was just before the jump into case 0xFF. It was set to 0x0D5D, so the game reads values from there. Of course it waits for a special case to be read, and what is the first value that is a special case starting from $0D5D? It is 0xFA, the THE END case!
After that case is executed it will return, but the code eventually reaches $0D4C, which sets DE to 0x0D5D again and since the values we manipulated are still there, the code jumps to $50F1
again!
An infinite loop was created.
tl;dr:
I can't say whether this counts as the correct ending. However, what I can say is that the game executes a code specifically made for THE END. And to clarify it to everyone, it does that infinite times.