[Dashboard\Skoda\Oktavia\Oktavia 24C32]

Size(280,290);
Form
{
  Group("Пробег",5,5,140,50)
    {
        Digit(Distance," ",5,18,90);
        Label(lb1,"KM",110,20);
    }
    Group("Идентификация",5,62,270,50)
    {
        Label(pn," ",0,15);
        label(login," ",0,30);
    } 
    Group("Информация",5,113,270,45)
    {
        Label(msg," ",0,18);
    }
    Group("Описание",5,158,270,80) 
    {
        Label(lb4,"Калькулятор пробега для Skoda Oktavia A5.",0,15);
        Label(lb5,"VDO. EEPROM 24C32",0,30);
        Label(lb2,"Введите нужное значение в окне <Пробег>.",0,45);
        Label(lb3,"и нажмите кнопку <Применить>.",0,60);
    }

   Picture(Logo,"Skoda.bmp",185,3,0,0);
}
OnShow 
{
 Var0=0;
 Var1=(@0x6E0);
 Var2=(@0x6E1);
 if(Var1 = 0x31) { Var0 = 1;}
 if(Var2 = 0x5A) { Var0 = Var0 + 1;}
 if(Var0 = 2)
  {
   pn = "VAG P/N:  "+#c.@0x6e0+#c.@0x6e1+#c.@0x6e2+#c.@0x6e3+#c.@0x6e4+#c.@0x6e5+#c.@0x6e6+#c.@0x6e7+#c.@0x6e8+#c.@0x6e9+#c.@0x6ea+"  "+#c.@0x660+#c.@0x661+#c.@0x662;
   login = "DATE: "+#c.@0x668+#c.@0x669+#c.@0x66a+#c.@0x66b+#c.@0x66c+#c.@0x66d+#c.@0x66e+#c.@0x66f;
   Var5 = (((@0x80d << 8)+@0x80c) ^ 0xFFFF) << 5;    
       	msg.Color = 0xFF0000;
       	msg.Bold = 1;
       	msg = "Дамп ОК. Введите новый пробег.";
       	Distance = Var5;
  }
  else
  {
        msg.Color = 0x0000FF;
	msg.Bold = 1;
	msg = "Неверный дамп!";
	Distance = 0;     
  }
}
OnApply 
{
    Var5 = 0;
    Var2 = Distance;
    Var7 = Var2 >> 5 & 65535 ^ 0xFFFF;
    if(Var2 > 999900) {Var5 = 1;}
    if(Var2 < 100)   {Var5 = 1;}
    if(Var5 != 0)
    {
        msg.Color = 0x0000FF;
        msg.Bold = 1;
        msg = "Пробег должен быть от 100 до 999900 км";
    }
    else
    {
        Var3 = 0x80C;
        while(Var3 != 0x82C)
        {   
            @Var3 = Var7 & 255;
            @Var3.mismatch = 1;
            Var3 = Var3 + 1;
            @Var3 = Var7 >> 8 & 255;
            @Var3.mismatch = 1;
            Var3 = Var3 + 1;
            Var6 = Var7 * 2;
            Var7 = (Var6 >> 16 + Var6) & 65535;
            msg.Color = 0xFF0000;
            msg.Bold = 1;
            msg = "Новый пробег записан.";
        }      
    }
}
