[Dashboard\Volkswagen\Sharan\Sharan 93C86 V2]

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,25);
    } 
    Group("Информация",5,113,270,45)
    {
        Label(msg," ",0,18);
    }
    Group("Описание",5,158,270,80) 
    {
        Label(lb4,"Калькулятор пробега для Volkswagen Sharan.",0,15);
        Label(lb5,"VDO. EEPROM 93C86",0,30);
        Label(lb2,"Введите нужное значение в окне <Пробег>.",0,45);
        Label(lb3,"и нажмите кнопку <Применить>.",0,60);
    }

   Picture(Logo,"vw.bmp",185,5,0,0);
}
OnShow 
{
 Var0=0;
 Var1=(@0x11c);
 Var2=(@0x11d);
 if(Var1 = 0x37) { Var0 = 1;}
 if(Var2 = 0x4d) { Var0 =Var0 + 1;}
 if(Var0 = 2)
  {
   pn = "VAG P/N:  "+#c.@0x11c+#c.@0x11d+#c.@0x11e+" "+#c.@0x11f+#c.@0x120+#c.@0x121+" "+#c.@0x122+#c.@0x123+#c.@0x124+#c.@0x125+"   "+#c.@0x12a+#c.@0x12b+"."+#c.@0x12c;
   Var4 = ((@0xeb << 8) | @0xea)^0xffff; Var5 = ((@0xed << 8) | @0xec)^0xffff; Var6 = ((@0xef << 8) | @0xee)^0xffff; Var7 = ((@0xf1 << 8) | @0xf0)^0xffff;
   Var8 = ((@0xf3 << 8) | @0xf2)^0xffff; Var9 = ((@0xf5 << 8) | @0xf4)^0xffff; Var10 = ((@0xf7 << 8) | @0xf6)^0xffff; Var11 = ((@0xf9 << 8) | @0xf8)^0xffff;         
   Var12 = Var4+Var5+Var6+Var7+Var8+Var9+Var10+Var11;         
       	msg.Color = 0xFF0000;
       	msg.Bold = 1;
       	msg = "Дамп ОК. Введите новый пробег.";
       	Distance = Var12 * 2;
  }
  else
  {
        msg.Color = 0x0000FF;
	msg.Bold = 1;
	msg = "Неверный дамп!";
	Distance = 0;     
  }
}
OnApply 
{
    Var5 = 0;
    Var2 = Distance;
    if(Var2 > 999900) {Var5 = 1;}
    if(Var2 < 100)   {Var5 = 1;}
    if(Var5 != 0)
    {
        msg.Color = 0x0000FF;
        msg.Bold = 1;
        msg = "Пробег должен быть от 100 до 999900 км";
    }
    else
    {
        Var3 = 0xea;
        while(Var3 != 0xfa)
        {
            @Var3 = Var2 >> 4 & 255 ^ 0xFF;
            @Var3.mismatch = 1;
            Var3 = Var3 + 1;
            @Var3 = (Var2 >> 12 & 255) ^ 0xFF;
            @Var3.mismatch = 1;
            Var3 = Var3 + 1;
        }   
    }
}
