Ah okay. I didn't knew, that there's not enough memory, to display every single step of the snake, while rewinding. In that case, your undo-method obviously has to work in discrete steps, I understand. Makes sense, of course. Nevertheless, it might be worth considering, how the firebutton handles the function and whether the squares, when the undo-routine runs, go back automatically, while the firebutton is held down, rather than requiring the user, to press the button repeatedly, for every single square. But go ahead and do everything the way you think is best. You know more about programming than I do, I am sure. The finer details of the function can always be tweaked later on, once the structure of the function is in place.
In fact, such an undo (or rewind) function like this, is interesting for C64 games in general, since, as far as I know, no C64 game features anything like that so far. This makes it a point of general interest for C64 games as a whole.