         }
         return;
     }
+    if (!s_vga_command)
+    {
+        s_vga_command = data;
+    }
     // command mode
 }
 
+void vga_interface_send_byte1(uint8_t data)
+{
+    if (s_vga_command == 0xFF)
+    {
+        s_vga_command = data;
+        return;
+    }
+    if (s_vga_command == 0x40)
+    {
+        uint8_t mask = (0x1 << (s_cursor_x & 0x7));
+        uint16_t addr = (s_cursor_x + s_cursor_y*ssd1306_lcd.width)/8;
+        for(uint8_t i=8; i>0; i++)
+        {
+            if (data & 0x01)
+            {
+                s_vga_buffer[addr] |= mask;
+            }
+            else
+            {
+                s_vga_buffer[addr] &= ~mask;
+            }
+            data>>=1;
+            addr+=ssd1306_lcd.width/8;
+        }
+        s_cursor_x++;
+        return;
+    }
+    // command mode
+}
+
 void vga_interface_send_bytes(const uint8_t *buffer, uint16_t len)
 {
     while (len--)
     {
-        vga_interface_send_byte(*buffer);
+        ssd1306_intf.send(*buffer);
         buffer++;
     }
 }

        for(int x = 0; x < ssd1306_lcd.width; x++)
        {
            uint8_t color = (s_vga_buffer[(y*ssd1306_lcd.width + x)/2] >> ((x&1)<<2)) & 0x0F;
            if (color) Serial.print("##");
            else       Serial.print("  ");
        }
        Serial.println();
    }
    Serial.println();
}
#endif

NanoEngine8 engine;

bool drawAll()
{
    engine.canvas.clear();
    engine.canvas.setMode(CANVAS_MODE_TRANSPARENT);

    engine.canvas.setColor(RGB_COLOR8(255,0,0));
    engine.canvas.printFixed(16, 15, "This is example");
    return true;
}*/

void setup()
{
    init_vga_interface();
    init_vga_lcd();
    #ifdef DEBUG
        uart_init();
//        Serial.begin(115200);
    #endif

    ssd1306_setFixedFont(ssd1306xled_font6x8);
    ssd1306_clearScreen();
    ssd1306_printFixed(10,8,"SSD1306",STYLE_BOLD);
    ssd1306_printFixed(24,16,"by",STYLE_BOLD);
    ssd1306_printFixed(4,24,"Alexey D.",STYLE_BOLD);

/*    engine.begin();
    engine.drawCallback( drawAll );
    engine.refresh();
    engine.display(); */
    
    #ifdef DEBUG
        debug_print_vga_buffer();
