[Carradio\VW\ALPHA IV VWZ6Z1 v1]

Size(310,460);  

Form {
    	HexDigit(Code,"Code ",70,15,100,4);
	ComboBox(CodeRequest,"Запрос кода",72,45,50,"Off","On");
    	CheckBox(ResetCounter,"Обнулить счётчик попыток",82,80);
	
	Group("Информация",5,110,300,50)		 
    {
        Label(message," ",0,22);			 
    }
    	Group("Описание",5,165,300,220) 		 
    {
        Label(lb1,"Code calculator for VW :",0,15);
    	Label(lb2,"Model:  ALPHA IV VWZ6Z1    DC587",32,30);
    	Label(lb3,"Sec. Type:  CODE 4dig",32,45);
	Label(lb4,"Manufacturen: PHILIPS.",32,60);
	Label(lb5,"Partnumer:  1H0 035 156",32,75);
    	Label(lb6,"MCU:  RC2 DC587",32,90);
	Label(lb7,"EEPROM: 24C02 smd",32,105);
	Label(lb8,"Sec.loc.: EEPROM",32,120);
    	Label(lb9,"Autor:  telik@ukrwest.net   2008",0,200);
    	Label(lb10,"Enter code: TA+TP, код, TA+TP",32,135);
    }
	Picture(Logo,"vw.bmp",230,15,0,0);
    {
        Label(msg," ",0,395);				 
    } 
}

OnShow {
	msg.Color=0x0000FF; msg.Bold=1;	msg="http://www.eeprom.lg.ua";		
          
	var0=1;
    	if(@0x00!=0x56){var0=0;}
	if(@0x01!=0x57){var0=0;}
	if(@0x02!=0x5A){var0=0;}
	if(@0x03!=0x36){var0=0;}
	if(@0x04!=0x5A){var0=0;}
	if(@0x05!=0x31){var0=0;}	
    	if(var0=0){ message.Bold=1; message.Color=0x0000FF; message="Неверный дамп !"; Code=0; }
    else
    {
	var1=(@0x0E & 0xF0)>>4;
	var2=@0x0E & 0x0F;
	var3=(@0x0F & 0xF0)>>4;
	var4=@0x0F & 0x0F;	
	if(var1=0x07){var11=0;} if(var1=0x06){var11=1;}
	if(var1=0x05){var11=2;} if(var1=0x04){var11=3;}
	if(var1=0x03){var11=4;}	if(var1=0x02){var11=5;}
	if(var1=0x01){var11=6;}	if(var1=0x00){var11=7;}
	if(var1=0x0F){var11=8;}	if(var1=0x0E){var11=9;}
	if(var2=0x0E){var12=0;}	if(var2=0x0F){var12=1;}
	if(var2=0x0C){var12=2;}	if(var2=0x0D){var12=3;}
	if(var2=0x0A){var12=4;}	if(var2=0x0B){var12=5;}
	if(var2=0x08){var12=6;}	if(var2=0x09){var12=7;}
	if(var2=0x06){var12=8;}	if(var2=0x07){var12=9;}
	if(var3=0x09){var13=0;}	if(var3=0x08){var13=1;}
	if(var3=0x0B){var13=2;}	if(var3=0x0A){var13=3;}
	if(var3=0x0D){var13=4;}	if(var3=0x0C){var13=5;}
	if(var3=0x0F){var13=6;}	if(var3=0x0E){var13=7;}
	if(var3=0x0F){var13=8;}	if(var3=0x01){var13=9;}
	if(var4=0x0C){var14=0;}	if(var4=0x0D){var14=1;}
	if(var4=0x0E){var14=2;}	if(var4=0x0F){var14=3;}
	if(var4=0x08){var14=4;}	if(var4=0x09){var14=5;}
	if(var4=0x0A){var14=6;}	if(var4=0x0B){var14=7;}
	if(var4=0x04){var14=8;}	if(var4=0x05){var14=9;}

	var11=var11<<12;
        var12=var12<<8;
        var13=var13<<4;
        Code=var11|var12|var13|var14;

	Var5=0;
	CodeRequest=1;
    	if(@0x010=0xFC) {var5=1;}		 
    	if(@0x010=0xFF) {var5=0;} 		 
    	CodeRequest=var5;  
	
	ResetCounter=1;
	if(@0x11!=0x00) { ResetCounter=0;}
	if(ResetCounter=0) { message.Bold=1; message.Color=0x0000FF; message="Обнулите счётчик попыток !!!"; ResetCounter=1; }
    else
	{ message.Bold=1; message.Color=0xFF0000; message="Дамп OK.  Счётчик попыток OK."; ResetCounter=0; }
    }
}

OnApply {
	var0=1;
    	if(@0x00!=0x56){var0=0;}
	if(@0x01!=0x57){var0=0;}
	if(@0x02!=0x5A){var0=0;}
	if(@0x03!=0x36){var0=0;}
	if(@0x04!=0x5A){var0=0;}
	if(@0x05!=0x31){var0=0;}	
    	if(var0=0){ message.Bold = 1; message.Color=0x0000FF; message="Неверный дамп ! Запись прекращена !"; Code = 0; }
    else
	{ message.Bold=1; message.Color=0xFF0000; message="Попытки и запрос кода успешно изменёны.";
	if(ResetCounter=1) {@0x11=0x00;}
	if(CodeRequest=0) {@0x10=0xFF;}
	if(CodeRequest=1) {@0x10=0xFC;}
	}
}
