Arduino LCD Helicopter Game

Well, my "driver" is very simple, as I said.

// frame buffer must be capable to store the contents of one screen
const uint16_t c_frame_buffer_size = 128*8;

const uint8_t c_frame_buffer_guard = 0xee;
typedef uint8_t frame_buffer[c_frame_buffer_size+1];

void frame_flush(frame_buffer buffer) {
      
      for (uint8_t row = 0; row < 8; ++row) {
            ks0108_GotoXY(0, row<<3);
            for (uint8_t col = 0; col < 128; ++col) {
                  ks0108_WriteData(*buffer);
                  ++buffer;
            }
      }
}

void frame_flush_dirty(int8_t min, int8_t max, frame_buffer buffer) {

      buffer += min * 128;
      for (uint8_t row = min; row <= max; ++row) {
            ks0108_GotoXY(0, row<<3);
            for (uint8_t col = 0; col < 128; ++col) {
                  ks0108_WriteData(*buffer);
                  ++buffer;
            }
      }
}

The rest of the stuff is from some existing ks0108 driver. I plan to replace this driver eventually. But right now I did not find the time.

With regard of the other parts of the driver: I do not understand the license terms. I think it is free but I am not sure --> I will not publish it. In fact I will reimplement the "render one byte" part and dump the rest eventually. I started to implement some features that I need on top of this buffer approach. However this is not even close as complete as other drivers. So I think this it is not yet worth to be published.

Just a comment though: the buffer is one byte larger than one would expect. I store some "guard" byte there in order to figure out if my code overwrites what it should not overwrite. This costs 1 byte of memory and some CPU cycles but gives me peace of mind :wink:

Cheers, Udo