Hii I hope this is what you were looking for, moreorless... The code is in the top-left of Sonic's display sprite. If you need some adjustments made to it and don't know how, let me know!
Footstep code is adapted from @piggeh's Modern Sonic Engine. The final code has a number of differences, but it's worth noting that I studied it and copied the base structure. Footstep sound effects are also taken straight from there. The rest should just be the unmodified Christmas 2019 build of Neo-Genesis Sonic engine.