[Carradio\VOLVO\CT-503  small panel]

Size(310,460);  

Form {
    	HexDigit(Code,"Code ",70,15,100,4);
    	CheckBox(ResetCounter,"Обнулить счётчик попыток",82,45);
		
	Group("Информация",5,110,300,50)		 
    {
        Label(message," ",0,22);			 
    }
    	Group("Описание",5,165,300,220) 		 
    {
        Label(lb1,"Code calculator for VOLVO :",0,15);
    	Label(lb2,"Model:  CT-503  small panel",32,30);
    	Label(lb3,"Sec. Type:  CODE 1111-6666",32,45);
	Label(lb4,"Manufacturen: MITSUBISHI.",32,60);
	Label(lb5,"Partnumer:  VO1840 ",32,75);
    	Label(lb6,"MCU:  D178016A510 or 519 ",32,90);
	Label(lb7,"EEPROM:  93LC46 smd   !!! ROTATED !!!",32,105);
	Label(lb8,"Sec.loc.: EEPROM",32,120);
    	Label(lb9,"Autor:  telik@ukrwest.net   2008",0,200);
    	Label(lb10,"Enter code:   ",32,135);
    }
	Picture(Logo,"volvo.bmp",210,10,0,0);
    {
        Label(msg," ",0,395);				 
    } 
}

OnShow {
	msg.Color=0x0000FF;				 
        msg.Bold=1;					 
	msg="http://www.eeprom.lg.ua";		
        
	message.Bold = 1;  
    	Var10 = 1;
    	if(@0x7A != 0xA5) { Var10 = 0;}	
    	if (Var10 = 0)
    {
        message.Color = 0x0000FF;
        message = "Неверный дамп ! ";
        Code = 0;
    }
    else
    {  
	var1 = ((@0x72 & 0x0F) << 12) ;
	var2 = ((@0x72 & 0xF0) << 4) ;
	var3 = ((@0x73 & 0x0F) << 4) ;
	var4 = ((@0x73 & 0xF0) >> 4) ;
	code = var1 | var2 | var3 | var4 ;

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

OnApply {
	Var0 = 1;
    	if (@0x7A != 0xA5) { Var0 = 0;}	
    	if (Var0 = 0) { message.Color = 0x0000FF; message = "Неверный дамп !  Запись прекращена !"; Code = 0; }
    else
    	{
	var0 = Code;
	@0x72 = @0x72 & 0xF0 | (var0 >> 12 & 0x0F);
    	@0x72 = @0x72 & 0x0F | (var0 >> 4 & 0xF0);
    	@0x73 = @0x73 & 0xF0 | (var0 >> 4 & 0x0F);
    	@0x73 = @0x73 & 0x0F | (var0 << 4 & 0xF0);
	if(ResetCounter = 1) { @0x74 = 0x00;}
	message.Color = 0xFF0000;
        message.Bold = 1;
       	message = "Счётчик попыток успешно изменён.";
    }
}
