[Dashboard\Opel\Astra\Astra VDO 93C56]

Size(280,300); 

Form 
{
    Group("Пробег",35,13,120,50)
    {
        Digit(Distance," ",5,18,70);
        Label(lbkm,"КМ",90,20);
    }
    Group("Идентификация",5,70,270,45)
    {
        Label(iden," ",0,12);
        Label(iden1," ",0,27);
    }
    Group("Информация",5,120,270,45) 
    {
        Label(msg," ",0,18);
    }    
    Group("Описание",5,170,270,85) 
    {
        Label(lb1,"Калькулятор пробега для Opel Astra.",0,20);
        Label(lb2,"EEPROM 93C56",0,35);
        Label(lb3,"Введите нужное значение в окне <Пробег>.",0,50);
        Label(lb4,"Нажмите кнопку <Применить>.",0,65);
    }
    Picture(Logo,"Opel.bmp",190,17,0,0);
}


OnShow 
{
	// проверяем правильность дампа
	Var0 = 0;
	Var1 = 0xF0; 
	while(Var1 != 0x100)
	{
		Var2 = @Var1;
		if(Var2 != 0xFF) { Var0 = 1;}
		Var1 = Var1 + 1;
	}
	if(Var0 = 0)
	{
		msg.Color = 0x0000FF;
		msg.Bold = 1;
		msg = "Неверный дамп!";
		Distance = 0;
	}
	else
	{
		iden = "OPEL P/N: "+#c.@0x02+#c.@0x03+#c.@0x04+#c.@0x05+#c.@0x06+#c.@0x07+#c.@0x08+#c.@0x09+" "+#c.@0x00+#c.@0x01;
                iden1 = "VDO P/N: "+#c.@0xba+#c.@0xbb+#c.@0xbc+"/"+#c.@0xbd+#c.@0xbe+#c.@0xbf+"/"+#c.@0xc0+#c.@0xc1+#c.@0xc2+"/"+#c.@0xc3+#c.@0xc4+#c.@0xc5;
                Var2 = (@0xF0 | (@0xF1 << 8)) ^ 0xFFFF;
                Var2 = Var2 + ((@0xF2 | (@0xF3 << 8)) ^ 0xFFFF);
                Var2 = Var2 + ((@0xF4 | (@0xF5 << 8)) ^ 0xFFFF);
                Var2 = Var2 + ((@0xF6 | (@0xF7 << 8)) ^ 0xFFFF);
                Var2 = Var2 + ((@0xF8 | (@0xF9 << 8)) ^ 0xFFFF);
                Var2 = Var2 + ((@0xFa | (@0xFb << 8)) ^ 0xFFFF);
                Var2 = Var2 + ((@0xFc | (@0xFd << 8)) ^ 0xFFFF);
                Var2 = Var2 + ((@0xFe | (@0xFf << 8)) ^ 0xFFFF);
        	msg.Color = 0xFF0000;
        	msg.Bold = 1;
        	msg = "Дамп ОК. Введите новый пробег.";
        	Distance = Var2 * 2;
	}
}

OnApply 
{
    Var5 = 0;
    Var2 = Distance >> 4;
    if(Var2 > 0xFFFF) {Var5 = 1;}
    if(Var2 < 0x06)   {Var5 = 1;}
    if(Var5 != 0)
    {
        msg.Color = 0x0000FF;
        msg.Bold = 1;
        msg = "Пробег должен быть от 100 до 999900 км";
    }
    else
    {
        Var3 = 0xF0;
        while(Var3 != 0x100)
        {
            @Var3 = Var2 & 255 ^ 0xFF;		Var3 = Var3 + 1;
            @Var3 = (Var2 >> 8 & 255) ^ 0xFF;	Var3 = Var3 + 1;
        }
        msg.Color = 0xFF0000;
        msg.Bold = 1;
        msg = "Дамп OK. Новый пробег записан.";
        Var2 = Var2 << 4;
	Distance = Var2;
    }
}

