Best way to draw to screen?
I'm working on a project with a pretty limited tool set, mostly have to build my own. The only included function for drawing to the screen is a drawPixel(x,y) type. I need to animate a 16×16 sprite by one pixel in any cardinal direction per frame. At first I thought to set each sprite as a 2d array and iterate over it to match some starting pixel, but that would be 256 iterations with about 35ish machine instructions. Then I thought to write a series of functions to poke the right memory addresses and update the word directly, and use an animate function to coordinate them. This would be 16-32 calls to poke() with 4 machine instructions each, so way more efficient, but I needed 16 functions to handle the sprite being split between 2 bytewords. Then another function to coordinate caning these. My problem is this method was animating smoother, but I also had new issues and it is so much harder to read than my first version that finding the bugs is a huge chore. Is there a better way?