You want to move the background up by a fixed amount instead of moving it to a fixed position.
In event 12 when y >= 0 you set it to (0, -512). y might be 0 or 0.05 or 0.1 - so you're moving it up 512px or 512.05px or 512.1px - it varies every time.
Instead of 'set position to (0, -512)' change it to 'set Y to BG1.Y - 512' so it will always move up by 512px and you won't get the stutter.