There is a code called control mode, which is required before activating this code.
To activate control mode, press UP, C, DOWN, C, LEFT, C, RIGHT, C at the title screen, but before pressing start to begin the game, press and hold A as you hit start. Now, rather than just being in control mode, you can enable config mode by pressing button B.
Sonic will morph into a ring, and the arrows can move him anywhere, even in the air, or through obstacles such as walls, floors, or even ceilings {GREAT FOR TELEPORTING!}.
You can change the item Sonic appears as by hitting A while in config mode. Button B makes Sonic normal again, and button C will place the sprite that you have selected for Sonic to appear as. For example, you press B, and Sonic becomes a ring, press C to make a ring appear exactly where the ring icon is.
WARNING!: This will distort several different things, such as the score, time, and other various icons throughout the game such as the finish sign at the end of the first two acts of each zone that spins when Sonic shoots past them, and the small score icons that appear whenever Sonic jumps high enough after finishing a level. That is all I have noticed in my time playing the game, but there could be more out there yet. The game is still quite playable this way, so it should not hurt you.
Config Mode (Japanese Version)
Note: This code is for the Japanese version. At the title screen, press Up, C, Down, C, Down, C, Down, C, Left, C, Right. You'll hear a ring sound. Start the game when holding A to be in Config mode that the Score and Time are distorted. Press B to enable Config mode, that Sonic morphs into a ring. Press A to switch through different items, Press C to place the sprite, hold A and press C to go backwards on selecting items, move around with the D-Pad, or Press B to morph back to Sonic.
Drunk Sonic
During the demo, hold C. Sonic will crash into walls and get hit by enemies.
Frame By Frame Motion
It doesn't matter when or where you use the code. While the game is paused, (I used a Virtual Console Controller) you can do three things:
The game must be paused for this to work. I am not sure if the Wii Mote will do the same effects. On the Virtual Console Controller:
Y Button = A Button on Sega
A Button = B Button on Sega
B Button = C Button on Sega
Code - Effect
Press and Hold A - Play In Slow-Motion
Press Y -This will reset the game to the title screen
Press B (Can Only Press Each Time) - Will move onto the next frame
Level Select
This code is for the Japanese version. At the title screen, press Up, Down, Down, Down, Left, Right. You'll hear a ring sound. Hold A and Press Start for the level select.
Level Select
At the title screen, press Up, Down, Left, Right. You should hear a noise like a ring being collected. Then, hold A and press Start for a level select!
Secret Game Message
At the title screen, press C,C,C,C,C,C,Up, Down, Left, Right. When the demo starts, hold A, B, C, Down then press Start. Instead of the Sonic Team logo, you will see a list of the game's developers in Japanese. When the title screen appears, a flashing "Press Start Button" will be there under Sonic's head.
Slow Motion and other commands
Note: This code is for the Japanese version. At the title screen, press C, C, Up, Down, Down, Down, Left, Right. You'll hear a ring sound. Pause the game when playing, and hold B to play in Slow Motion, press C to skip a frame, or press A to go back to the Title Screen.
Unlock Different ending
Beat game with all chaos emeralds.
Walk through walls in Marble Zone
When you ride the green block accross a sea of lave, there are a couple of big blocks in front of you with rings on. If you hold the D-PAD DOWN button, Sonic will crouch. The green block will go underneath the blocks, but sonic will remain on it, and pass through the walls. Note that this ONLY WORKS WHILE CROUCHING.