[Carradio\BENTLEY\BYZ2Z3]

Size(310,425);  

Form {
    	Digit(Code,"Code ",70,15,100);
    	//CheckBox(ResetCounter,"Обнулить счётчик попыток",82,45);
	//ComboBox(CodeRequest,"Запрос кода",32,80,100,"Off","On");
	
	Group("Идентификация",5,40,300,60)	  
    {
        Label(part," ",45,20); 			  
	Label(sn," ",45,35); 			 
    }
    	Group("Информация",5,105,300,40)	 
    {
        Label(message," ",30,17);		 
    }
    	Group("Описание",5,150,300,200) 	 
    {
        Label(lb1,"Code calculator for BENTLEY :",0,15);
    	Label(lb2,"Model:  BYZ2Z3",32,30);
    	Label(lb3,"Sec. Type:  CODE 0000-9999",32,45);
	Label(lb4,"Manufacturen: GRUNDIG.",32,60);
	Label(lb5,"Partnumer: 9.18445-8151 ",32,75);
    	Label(lb6,"MCU: M306N0FGTFP (413С101)",32,90);
	Label(lb7,"EEPROM: 24LC16 smd",32,105);
	Label(lb8,"Sec.loc.: EEPROM",32,120);
    	Label(lb9,"Autor:  telik@ukrwest.net   2008",0,180);
    	Label(lb10,"Enter code: ",32,135);
    }
	Picture(Logo,"bentley.bmp",210,10,0,0);
    {
        Label(msg," ",0,360);				
    } 
}

OnShow {
	msg.Color=0x0000FF;				 
        msg.Bold=1;					 
	msg="http://www.eeprom.lg.ua";		  
        
	var9 = 0;
	var0 = @0x10;
	var1 = @0x11;
	var2 = @0x14;
	var3 = @0x15;

// перевірка дампа на правельність.
	var8 = var0 ^ var2;
	var5 = var1 ^ var3;
	var5 = var5 << 8;
	var8 = var8 | var5;
	var23 = var8;
	if (var8 = 0x1234) { var21 = 1; var22 = 0;}
	else {var22 = 1; var21 = 0;} 			// перевірка дампа на правельність. (0-OK)(1-ERROR)
	if (var22 = 1) {message.Color = 0x0000FF; message.Bold = 1; message = "                 Неверный дамп ! "; Code = 0;}  
	else
    {  
//Визначення кода.
	var4 = var0;
	var4 = var4 >> 4;
	var5 = var1 >> 4;
	var4 = var4 ^ var5;
	var4 = var4 ^ 0x0f;
	var4 = var4 & 7;

	var5 = var0;
	var5 = var5 >> 4;
	var6 = var0;
	var6 = var6 & 0x0f;
	var5 = var5 ^ var6;

	var6 = var1;
	var6 = var6 >> 4;
	var6 = var6 ^ var5;

	var9 = var6;
	var5 = var5 << 4;
	var9 = var9 | var5;
	var4 = var4 << 8;
	var9 = var9 | var4; 	
	
	Code = Var9;		

	sn = "Serial No.: "+#c.@0x570+#c.@0x571+#c.@0x572+#c.@0x573+#c.@0x574+#c.@0x575+#c.@0x576+#c.@0x577+#c.@0x578+#c.@0x579+#c.@0x57A+#c.@0x57B+#c.@0x57C+#c.@0x57D;
    	part = "PART No.: "+#c.@0x4D0+#c.@0x4D1+#c.@0x4D2+" "+#c.@0x4D3+#c.@0x4D4+#c.@0x4D5+" "+#c.@0x4D6+#c.@0x4D7+#c.@0x4D8;
	message.Color = 0xFF0000;
	message.Bold = 1;
	message = "                      Дамп OK."; 
    }
}

