on the levels that are closest to it on them you have to complete the level in a sneaky shortcut kind of way to get a red flag instead of black
Get all the stars in the game, then the cannon outside the castle opens. Blast on top of the castle and Yoshi will give you 100 lives.
Collect 120 stars
not
You gotta get all of the stars, then the cannon outside will open up.
You open the cannon by getting 120 stars. After you've gotten 120 stars, you can go outside and fire the cannon. You do not need to find a Bob-omb buddy.
You must collect all 150 stars, then it will automatically open.
To get on the castle roof of the castle
You will need to collect all 150 stars and the cannon in front of the castle should open and then all you have to do is go in the cannon and blast off.
If you mean the outside cannon you have to collect 120 stars. If you're talking about the ones in the courses you have to talk to a bob-bob buddy (pink bob-bob).
Collect all 120 stars and go to the cannon outside. If you are playing super Mario 64 ds get all 150 stars and go to the cannon outside.
You can use the cannon to shoot up to the top of the castle. Yoshi is there in the Nintendo 64 version. After you talk to him, you will have 100 lives.
Sadly (I do know how you feel, you know) the only way open the cannon outside the castle is to collect all 150 stars. When you have done this, just walk up to it and it should be open. If you have an Action Replay card, however, there is almost certainly a cheat you can use to get the cannon before this.
Get all 150 stars