[Carradio\VW\ALPHA CC VWZ1Z1]

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 CC VWZ1Z1",32,30);
    	Label(lb3,"Sec. Type:  CODE 0000-1999",32,45);
	Label(lb4,"Manufacturen:  BLAUPUNKT.",32,60);
	Label(lb5,"Partnumer: 7 644 840 060  1H0 035 156A ",32,75);
    	Label(lb6,"MCU: TMP47C446AFP831 (8925901578) ",32,90);
	Label(lb7,"EEPROM: 4C016 smd = 24C01",32,105);
	Label(lb8,"Sec.loc.: EEPROM",32,120);
    	Label(lb9,"Autor:  telik@ukrwest.net   2008",0,200);
    	Label(lb10,"Enter code:   TP + ТА, ввести код, ТР + ТА",32,135);
    }
	Picture(Logo,"vw.bmp",210,10,0,0);
    {
        Label(msg," ",0,395);				 
    } 
}

OnShow {
	msg.Color=0x0000FF;				 
        msg.Bold=1;					 
	msg="http://www.eeprom.lg.ua";		  
        
	var1 = ((@0x37 & 0x0F) << 12) ;
	var2 = ((@0x37 & 0xF0) << 4) ;
	var3 = ((@0x36 & 0x0F) << 4) ;
	var4 = ((@0x36 & 0xF0) >> 4) ;
	code = var1 | var2 | var3 | var4 ;

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

OnApply {
	Var0 = Code;
	@0x37 = @0x37 & 0xF0 | (Var0 >> 12 & 0x0f);
	@0x37 = @0x37 & 0x0F | (Var0 >> 4 & 0xF0);
	@0x36 = @0x36 & 0xF0 | (Var0 >> 4 & 0x0f);
	@0x36 = @0x36 & 0x0F | (Var0 << 4 & 0xF0);
	if(ResetCounter = 1) { @0x40 = 0 ;}
	if(CodeRequest = 1) { @0x35 = 0x77; }
	if(CodeRequest = 0) { @0x35 = 0x00; }
	message.Color = 0xFF0000;
        message.Bold = 1;
       	message = "Попытки и запрос кода успешно изменёны.";
}
