[Engine\VW\EDC15 24C04]

Size(280,290);
Form
{
  Group("Пробег",5,5,110,50)
    {
        Digit(Distance," ",5,18,50);
        Label(lb1,"KM",80,20);
    }
    Group("Идентификация",5,62,270,50)
    {
        label(vin," ",0,20);
    } 
    Group("Информация",5,113,270,45)
    {
        Label(msg," ",0,18);
    }
    Group("Описание",5,158,270,80) 
    {

        Label(lb4,"Калькулятор пробега для Disel ECU.",0,15);
        Label(lb5,"EDC15 EEPROM 24C04",0,30);
        Label(lb2,"Введите нужное значение в окне <Пробег>.",0,45);
        Label(lb3,"и нажмите кнопку <Применить>.",0,60);
    }
    Picture(Logo,"vw.bmp",175,5,0,0);
}



OnShow 
{
      Var0=0;
    Var1=(@0x120);
    Var2=(@0x121);
    if(Var1 = 0xff) { Var0 = 1;}
    if(Var2 = 0xff) { Var0 =Var0 + 1;}
    if(Var0 = 2)
    {
     var1 = (@0x1b1 << 24) | (@0x1b0 << 16) |(@0x1af << 8) | @0x1ae;
     Distance = var1 / 100;
    
      vin = "VIN: "+#c.@0x140+#c.@0x141+#c.@0x142+#c.@0x143+#c.@0x144+#c.@0x145+#c.@0x146+#c.@0x147
       +#c.@0x148+#c.@0x149+#c.@0x14a+#c.@0x14b+#c.@0x14c+#c.@0x14d+#c.@0x14e+#c.@0x14f+#c.@0x150;
        
     msg.Color = 0xFF0000;
     msg.Bold = 1;
     msg = "Дамп ОК. Введите пробег.";
    }
    else
    {
     msg.Color = 0x0000FF;
     msg.Bold = 1;
     msg = "Неверный дамп!";
     Distance = 0;
    }

}
OnApply 
{
    Var0=0;
    Var1=(@0x120);
    Var2=(@0x121);
    if(Var1 = 0x00) { Var0 = 1;}
    if(Var2 = 0x00) { Var0 =Var0 + 1;}
    if(Var0 = 2)
    {
        msg.Color = 0x0000FF;
        msg.Bold = 1;
       msg = "Неверный дамп! Запись отменена!";
    }
    else
    {
   Var3 = Distance * 100;
      var8 = (var3 >> 24) & 0xFF; Var4 = (var3 >> 16) & 0xFF; Var5 = (var3 >> 8) & 0xFF; Var6 = var3 & 0xFF; 
      Var7 = 0x1ae;
      while(Var7 <= 0x1b1)
       {  
        @Var7 = Var6; Var7 = Var7 + 1;
        @Var7 = Var5; Var7 = Var7 + 1;
        @Var7 = Var4; Var7 = Var7 + 1;
        @Var7 = Var8; Var7 = Var7 + 1;
        }
     Var3 = Distance * 100;
      var8 = (var3 >> 24) & 0xFF; Var4 = (var3 >> 16) & 0xFF; Var5 = (var3 >> 8) & 0xFF; Var6 = var3 & 0xFF; 
      Var7 = 0x1dc;
      while(Var7 <= 0x1df)
       {  
        @Var7 = Var6; Var7 = Var7 + 1;
        @Var7 = Var5; Var7 = Var7 + 1;
        @Var7 = Var4; Var7 = Var7 + 1;
        @Var7 = Var8; Var7 = Var7 + 1;
        }
        msg.Color = 0xFF0000;
        msg.Bold = 1;
        msg = "Новый пробег записан.";
      
    }
}
