[Dashboard\Motobikes\Honda\VFR 800 93C56]

Size(280,280); 

Form
{
    Group("Пробег",5,5,120,80)
    {
        Digit(Distance," ",5,18,60);
        Label(lb1,"KM",90,20);
        Digit(Miles," ",5,48,60);
        Label(lb6,"MILES",80,50);
    }
        
     Group("Информация",5,88,270,45)
    {
        Label(message," ",0,18);
    }
    Group("Описание",5,135,270,100) 
    {
        Label(lb4,"Калькулятор для Honda VFR 800.",0,20);
        Label(lb5,"EEPROM 93C56",0,35);
        Label(lb2,"Введите нужное значение в окне ПРОБЕГ",0,55);
        Label(lb3,"и нажмите кнопку <Применить>.",0,70);
    }
Picture(Picture1,"Honda.bmp",175,20,0,0);
}

OnShow 
{
    Message.Bold = 1;
    
   Var0 = 0;
    Var1 = (@0x61 << 8) | @0x60;
    Var2 = (@0x63 << 8) | @0x62;
    Var3 = (@0x65 << 8) | @0x64;
    Var4 = (@0x69 << 8) | @0x68;
    Var5 = (@0x6d << 8) | @0x6c;
    Var6 = (@0x71 << 8) | @0x70;
    Var7 = (@0x75 << 8) | @0x74;
    Var8 = (@0x79 << 8) | @0x78;
    Var9 = (@0x7d << 8) | @0x7c;
    Var11 = (@0x81 << 8) | @0x80;
    Var12 = (@0x83 << 8) | @0x82;
    Var13 = (@0x85 << 8) | @0x84;
    Var14 = (@0x89 << 8) | @0x88;
    Var15 = (@0x8d << 8) | @0x8c;
    Var16 = (@0x91 << 8) | @0x90;
    Var17 = (@0x95 << 8) | @0x94;
    Var18 = (@0x99 << 8) | @0x98;
    Var19 = (@0x9d << 8) | @0x9c;

    Var12 = Var12 ^ 0xFFFF;
    Var2 = Var2 ^ 0xFFFF;
    if(Var1 != Var2) { Var0 = Var0 + 1; }
    if(Var11 != Var12) { Var0 = Var0 + 1; }
     if(Var0 != 0)
    {
        message.Color = 0x0000FF; 	
        Message = "Неверный дамп!";     
        Distance = 0;
        Miles = 0;                   
    }
    else
    {
        Var10 = (((((((Var1 + Var3) + Var4) + Var5) + Var6) + Var7) + Var8) + Var9) * 2;
        Var20 = (((((((Var11 + Var13) + Var14) + Var15) + Var16) + Var17) + Var18) + Var19) * 2;
        message.Color = 0xFF0000;                    
        message = "Дамп ОК. Введите новый пробег.";  
        Distance =  Var10;
        Miles = Var20;  
    }                          
}


OnApply
{
    Var0 = 0;
    Var10 = Distance;
    Var20 = Miles;
    if(Var10 < 15)      { Var0 = Var0 + 1; }
    if(Var10 > 999900)   { Var0 = Var0 + 1; }
    
    if(Var0 != 0)
    {
        message.Color = 0x0000FF; 
        Message = "Пробег должен быть от 15 до 999900 км.";
    }
    else
    {
        Var10 = Var10 / 16;
                
        Var2 = 0x60;
        Var3 = 0x61;
        Var4 = Var10 ^ 0xFFFF;
        while(Var2 != 0x80)
        {                
		@Var2 = Var10;
		@Var3 = Var10 >> 8;
		Var2 = Var2 + 2;
		Var3 = Var3 + 2;
		@Var2 = Var4;
		@Var3 = Var4 >> 8;
		Var2 = Var2 + 2;
		Var3 = Var3 + 2;
        }

        
        message.Color = 0xFF0000;
        message.Bold = 1;
        message = "Дамп OK. Новый пробег записан.";
        Distance = Distance;

    }
       Var0 = 0;
       Var5 = Miles; 
       if(Var5 < 15)      { Var0 = Var0 + 1; }
       if(Var5 > 999900)   { Var0 = Var0 + 1; } 
       if(Var0 != 0)
    {
        message.Color = 0x0000FF; 
        Message = "Пробег должен быть от 15 до 999900 км.";
    }
    else
    {
        Var20 = Var20 / 16;
                
        Var2 = 0x80;
        Var3 = 0x81;
        Var4 = Var20 ^ 0xFFFF;
        while(Var2 != 0xa0)
        {                
		@Var2 = Var20;
		@Var3 = Var20 >> 8;
		Var2 = Var2 + 2;
		Var3 = Var3 + 2;
		@Var2 = Var4;
		@Var3 = Var4 >> 8;
		Var2 = Var2 + 2;
		Var3 = Var3 + 2;
        }
        Message.Color = 0xFF0000;
        Message.Bold = 1;
        Message = "Дамп OK. Новый пробег записан.";
        Distance = Distance;


       
    }
}





















