Yoshi is a minor character that appears on top of the castle after you have collected all 120 stars. After you talk to him, he will give you 100 lives and the special triple jump, then jump off of the roof and disappear.
Yoshi has four possible homes with x,z coordinates of (0, -5625) (-1364, -5912) (-1403, -4609) (-1004, -5308). These homes do not have a y value as Yoshi is not intended to go off the flat part of the castle roof. Yoshi is initialized with a gravity value of 2.0, a friction value of 0.9 and Buoyancy of 1.3. Yoshi walks with a forward velocity of 10 units/frame. Yoshi’s angle while walking approaches his target angle at 7.03125 degrees/frame. If Yoshi comes within 200 units of his home, Yoshi stops walking and idles. If Yoshi’s Y-position is below 2100, Yoshi is deactivated and set to respawn. When Yoshi idles, after 91 frames Yoshi will randomly choose a new home. Yoshi’s target angle is set to the inverse tangent of the difference between Yoshi’s current position and his new home and Yoshi begins walking again. When Mario talks to Yoshi, Yoshi turns toward Mario at 7.03125 degrees/frame if he is not facing him, Yoshi’s home is set to (-1364, -5912), and Yoshi is set to give Mario his present. When Yoshi gives Mario the present, Mario’s life counter increases until it hits 100, Mario gets his special triple jump and Mario is set to jump off the roof. When Yoshi jumps off the roof, Yoshi walks toward the point (-1364, -5912). When Yoshi gets close to that point, his angle is set to face away from the roof, his forward velocity is set to 50 units/frame and his Y-velocity is 40 units/frame. Then, Yoshi’s Y-velocity is decreased by 2 units/frame per frame and when his position is below 2100, the cutscene ends and Yoshi is deactivated.
On the Japanese version of the game only, there is a mistake in the code that will set Mario's lives to -25 if he reaches 1,000 coins. When you talk to Yoshi and he gives you 100 lives, he keeps increasing your life counter until it reaches 100. But if you have 1,000 or more coins while talking to Yoshi, then your lives will continually be reset to -25, which prevents them from ever reaching 100 and thus causing a softlock.
This softlock was first documented by pannenkoek in a video uploaded on July 27th, 2016.
Yoshi Walks off the Roof
Yoshi is only intended to walk on the flat part of the castle roof. However, under some circumstances it is possible for Yoshi to accidentally walk onto the slanted part of the castle, which messes up his movement and causes him to walk off the edge of the castle. The programmers seemed to anticipate this, so they made Yoshi despawn the moment he falls off the roof and create a special "Yoshi Respawner" to respawn him if you go back to where he normally is. If you talk to Yoshi while he is starting to fall, then he will fall off the castle without unloading and try to walk to a specific location to jump and finish his cutscene. But he can never reach this location since he has fallen off, resulting in a softlock as Yoshi walks endlessly.
The first known mention of Yoshi falling off the castle was in a 2003 SM64 FAQ written by king kid, and the first video of the softlock was a 2007 video by Myles Bukrim.