6502 Assembly Language #17: Pointers to Pointers

While working on the Worm program in #16, I realized we need to use pointers to pointers, which is kind of a complicated concept. I didn’t think my impromptu explanation there was very clear, so I thought it’d work better to draw it out visually and walk through what happens.

This method will allow us to keep track of the parts that make up the worm, in order from head to tail, so we can drop the tail characters as the worm moves along. And it doesn’t take much work, because we only need to adjust two pointers and add one other to a list each time we move. That’s quite a bit faster than a couple other methods I was thinking of.

Next time, back to the code.