[Dashboard\Nissan\Almera\Almera classic 93c66 JC]

Size(280,250); 

Form
{
    Group("Пробег",5,5,140,50)
    {
        Digit(Distance," ",5,18,90);
        Label(lb1,"KM",110,20);
    }
    Group("Информация",5,65,270,45)
    {
        Label(message," ",0,18);
    }
    Group("Описание",5,110,270,95) 
    {
        Label(lb4,"Калькулятор для Nissan Almera.",0,20);
        Label(lb5,"Jonson Control. EEPROM 93C66",0,35);
        Label(lb2,"Введите нужное значение в окне ПРОБЕГ",0,55);
        Label(lb3,"и нажмите кнопку <Применить>.",0,70);
    }
    Picture(Picture1,"Nissan.bmp",200,5,0,0);
}

OnShow 
{
    Message.Bold = 1;
    Var0 = 0;
    Var1 = (@0x17 << 24) | (@0x16 << 16) | (@0x15 << 8) | @0x14;
    Var2 = (@0x1d << 24) | (@0x1c << 16) | (@0x1b << 8) | @0x1a;
    Var3 = (@0x23 << 24) | (@0x22 << 16) | (@0x21 << 8) | @0x20;
    Var4 = (@0x29 << 24) | (@0x28 << 16) | (@0x27 << 8) | @0x26;
    Var7 = ((@0x17 << 8) | @0x16) + ((@0x15 << 8) | @0x14);
    Var5 = ((@0x13 << 8) | @0x12) ^ 0xFFFF;
    if (Var7 != Var5) {Var0 = Var0 +1;}
 
    if(Var0 != 0)
    {
        message.Color = 0x0000FF; 	
        Message = "Неверный дамп!";     
        Distance = 0;                   
    }
    else
    {
      var6 = 0;
        if(Var2 > Var1) {Var6 = Var2;} if(Var2 = Var1) {Var6 = Var2;}
        if(Var3 > Var6) {Var6 = Var3;} if(Var3 = Var6) {Var6 = Var3;}
        if(Var4 > Var6) {Var6 = Var4;} if(Var4 = Var6) {Var6 = Var4;}
        if(Var1 > Var6) {Var6 = Var1;} if(Var1 = Var6) {Var6 = Var1;}
        message.Color = 0xFF0000;                    
        message = "Дамп ОК. Введите новый пробег.";  
        Distance =  Var6;
        
    }                          
}

OnApply
{
    Var0 = 0;
    Var1 = Distance; 
    if(Var1 > 999900)   { Var0 = Var0 + 1; }
    if(Var0 != 0)
    {
        message.Color = 0x0000FF; 
        Message = "Пробег должен быть до 999900 км.";
    }
    else
    {
      Var0 = Distance;
      Var1 = Var0 >> 24; Var2 = Var0 >> 16; Var3 = Var0 >> 8; Var4 = Var0 & 255;
      Var5 = Var1 + Var3; Var6 = Var2 + Var4;
      Var8 = 0x12;      
      while (Var8 !=0x2a)
      {
       @Var8 = Var6 ^0xff; Var8 = Var8 + 1;
       @Var8 = Var5 ^0xff; Var8 = Var8 + 1; 
       @Var8 = Var4; Var8 = Var8 + 1;
       @Var8 = Var3; Var8 = Var8 + 1;
       @Var8 = Var2; Var8 = Var8 + 1;
       @Var8 = Var1; Var8 = Var8 + 1;
      }
        message.Color = 0xFF0000;  
        message = "Новый пробег записан. Дамп ОК.";
    }
}





















