[Dashboard\Peugeot\307\BSI 307 95160 Var1]

Size(280,300); 

Form 
{
    Group("Пробег",15,10,120,50)
    {
        Digit(Distance," ",5,18,70);
        Label(lbkm,"КМ",90,20);
    }
    Group("Идентификация",5,70,270,45)
    {
        Label(pn," ",0,18);
    }
    Group("Информация",5,115,270,45) 
    {
        Label(msg," ",0,18);
    }    
    Group("Описание",5,160,270,90) 
    {
        Label(lb1,"Калькулятор пробега для Peugeot 307.",0,20);
        Label(lb2,"EEPROM 95160.",0,35);
        Label(lb3,"Введите нужное значение в окне <Пробег>.",0,50);
        Label(lb4,"Нажмите кнопку <Применить>.",0,65);
    }
    Picture(Logo,"Peugeot.bmp",180,8,0,0);
}



OnShow 
{
	Var0 = 0;
        Var1 = ((@0x6cf ^ 0xFF) << 16) |((@0x6cc ^0xFF) << 8)| (@0x6cd ^0xFF);
        Var2 = ((@0x6d5 ^ 0xFF) << 16) |((@0x6d2 ^0xFF) << 8)| (@0x6d3 ^0xFF);
        Var3 = ((@0x6db ^ 0xFF) << 16) |((@0x6d8 ^0xFF) << 8)| (@0x6d9 ^0xFF);
        
        
        if(Var2 > Var1) {Var0 = Var2;} if(Var2 = Var1) {Var0 = Var2;}
        if(Var3 > Var0) {Var0 = Var3;} if(Var3 = Var0) {Var0 = Var3;}
        if(Var1 > Var0) {Var0 = Var1;} if(Var1 = Var0) {Var0 = Var1;}
        Var0 = Var0 /10;
        Var5 = 0;
	if(Var0 > 999000) {Var5 = 1;}
        
        if(Var5 = 0)
        {
         Var1 = @0x6a4^0xFF; Var2 = @0x6a7^0xFF; Var3 = @0x6a6^0xFF; Var4 = @0x6a9^0xFF; Var5 = @0x6a8^0xFF; Var6 = @0x6ab^0xFF; Var7 = @0x6aa^0xFF;
         Var8 = @0x6ad^0xFF; Var9 = @0x6ac^0xFF; Var10 = @0x6af^0xFF; Var11 = @0x6ae^0xFF; Var12 = @0x6b1^0xFF; Var13 = @0x6b0^0xFF; Var14 = @0x6b3^0xFF;
         Var15 = @0x6b2^0xFF; Var16 = @0x6b5^0xFF; Var17 = @0x6b4^0xFF; Var18 = @0x645^0xFF; Var19 = @0x644^0xFF; Var20 = @0x647^0xFF; Var21 = @0x646^0xFF;
         pn ="VIN: "+#c.var1+#c.var2+#c.var3+#c.var4+#c.var5+#c.var6+#c.var7+#c.var8+#c.var9+#c.var10+#c.var11+#c.var12+#c.var13+#c.var14+#c.var15+#c.var16+#c.var17+"   LOGIN: "+#c.var18+#c.var19+#c.var20+#c.var21; 
                msg.Color = 0xFF0000;
                msg.Bold = 1;
                Distance = Var0;
                msg = "Дамп ОК. Введите новый пробег.";
                
        }
	else
	{
		msg.Color = 0x0000FF;
		msg.Bold = 1;
		msg = "Неверный дамп!";
		Distance = 0;
	}
}

OnApply 
{
    Var1 = Distance;
    Var5 = 0;
    if(Var1 > 999900) {Var5 = 1;}
    if(Var1 < 100)   {Var5 = 1;}
    if(Var5 != 0)
    {
        msg.Color = 0x0000FF;
        msg.Bold = 1;
        msg = "Пробег должен быть от 100 до 999900 км";
    }
    else
    { 
       Var1 = Var1 * 10;  
       Var2 = (Var1 >> 24)^0xFF; Var3 = (Var1 >> 16)^0xFF; Var4 = (Var1 >> 8)^0xFF; Var5 = (Var1 & 255)^0xFF; Var6 = ((Var3 + Var4) + Var5) & 255;
       Var9 = 0x6cc;
          @Var9 = Var4; Var9 = Var9 + 1;
          @Var9 = Var5; Var9 = Var9 + 2;
          @Var9 = Var3; Var9 = Var9 + 2;
          @Var9 = ((Var6 + @0x6ce) + @0x6d0) & 255;
       Var9 = 0x6d2;
          @Var9 = Var4; Var9 = Var9 + 1;
          @Var9 = Var5; Var9 = Var9 + 2;
          @Var9 = Var3; Var9 = Var9 + 2;
          @Var9 = ((Var6 + @0x6d4) + @0x6d6) & 255;
      Var9 = 0x6d8;
          @Var9 = Var4; Var9 = Var9 + 1;
          @Var9 = Var5; Var9 = Var9 + 2;
          @Var9 = Var3; Var9 = Var9 + 2;
          @Var9 = ((Var6 + @0x6da) + @0x6dc) & 255;
          
        msg.Color = 0xFF0000;
        msg.Bold = 1;
        msg = "Дамп OK. Новый пробег записан.";
        
    }
}
