Cybershot v8.01 BestPicColor

download
Date: 17.06.2010.
Author: BrAzzUkA's TEAM
Nationality: Sweden

//##############################################################################################
//#  ____                      _____      _                                                    #
//# / ___|  ___  _ __  _   _  | ____|_ __(_) ___ ___ ___  ___  _ __                            # 
//# \___ \ / _ \| '_ \| | | | |  _| | '__| |/ __/ __/ __|/ _ \| '_ \                           # 
//#  ___) | (_) | | | | |_| | | |___| |  | | (__\__ \__ \ (_) | | | |                          # 
//# |____/ \___/|_| |_|\__, | |_____|_|  |_|\___|___/___/\___/|_| |_|                          # 
//#                    |___/                                                                   # 
//#                                                                                            #      
//# Version Cybershot™_v8.00_BestPicColorÖ_Final BrAzzUkA's BZK«                               #
//# Optimized for the Sony Ericsson k850                                                       # 
//##############################################################################################
//# Copyright« 2009 Sony Ericsson Mobile Communications.                                       #
//# All rights, including trade secret rights, reserved.                                       #
//# BrAzzUkA's BZK« Camera Drivers respects the intellectual property of others,               #
//# and we ask our modders and users to do the same.                                           #
//##############################################################################################
// Visit the website: http://www.esato.com/board/viewtopic.php?topic=169423

//Information section
//=========================================================

info_name=MCB991;
info_vendor=Brazzuka's;
info_major_ver=8;
info_minor_ver=0;

// Macros for camera
//================================================

SET_REG =
  05 02 00 !0 !1 $f  
  $r2 1 1 $d0002;

READ_REG = 
  05 01 00 !0 01 $f
  $r2 4 4 $d0002;

CLEAR_EVENT = 
  05 01 00 03 03 $f 
  $r4 1 123 $d0002 
  $c3 00  
    $"CAMDRIVER0: Queue_was_empty"
  $cl
    $"CAMDRIVER0: Cleared_Int_Source_%1_Event_Info_%2_Event_ID_%3"   
  $cx
  #SET_REG(06,03);

CLEAR_EVENT_FIFO = 
  $s0 01 
  [ 0 ff 
    #CLEAR_EVENT 
    $c3 00 
      $s0 00 
    $cx
  ];

SEND_COMMAND = 
  06 02 00 01 !1 !0 $f 
  $r3 111 $d0002; 

WAIT_FOR_TRIG = 
  $h 0 02 5 1000  
  $c0 00                
    $"CAMDRIVER0: TRIG_Timeout"   // No event occured
  $cl
    $"CAMDRIVER0: TRIG_Recieved"  // Event occured
  $cx;
                      
POLL_EVENT_ID =                  
  !0    
  $s0 01    
  [ 0 ff         
    #CLEAR_EVENT   
                      
    $-3 r4            
                      
    $c3 00            
      $"CAMDRIVER0: Successfully_acknowledged_Event_ID_%4"
      $s0 00          
    $cx               
  ];

CAPTURE_EVENT = 
  #WAIT_FOR_TRIG
  #CLEAR_EVENT
  ;

CHANGE_MODE =
  #CLEAR_EVENT_FIFO
  #SEND_COMMAND(!0,!1)
  #POLL_EVENT_ID($s4 ea)
  #SET_REG(06,03);

COM_EVENT =
  #CLEAR_EVENT_FIFO
  #SEND_COMMAND(!0,!1)
  #WAIT_FOR_TRIG
  #CLEAR_EVENT;

UPDATE_WB =
  $p5 01
  $c5 00 $cl
  $u01 $cx;

UPDATE_PHOTO = 
  $p5 16
  $c5 00 $cl
  $u16 $cx;

WB_ISO100 = #SET_REG(98,24) #SET_REG(99,73);
WB_ISO200 = #SET_REG(98,27) #SET_REG(99,6D);
WB_ISO400 = #SET_REG(98,28) #SET_REG(99,6A);

POWER_FLASH =
  $p5 10
  $c5 07 #SET_REG(AD,F0) $cl
  #SET_REG(AD,00) $cx;
  
FLASH_LIMIT_ISO100 = 
  #SET_REG(A2,C8) #SET_REG(A3,25)
  #SET_REG(A4,D0) #SET_REG(A5,25)
  #POWER_FLASH;

FLASH_LIMIT_ISO200 =
  #SET_REG(A2,C7) #SET_REG(A3,21) 
  #SET_REG(A4,D0) #SET_REG(A5,21)
  #POWER_FLASH;

FLASH_LIMIT_ISO400 = 
  #SET_REG(A2,C6) #SET_REG(A3,1D) 
  #SET_REG(A4,D0) #SET_REG(A5,1D)
  #POWER_FLASH;

UPDATE_ISO =
  $p5 11
  $c5 00 $cl
  $u11 $cx;

DOC_MODE = 
 #SET_REG(95,01)
 #WB_ISO200   
 #FLASH_LIMIT_ISO100; 

UPDATE_MIN_FRMRATE = 
  $p5 10
  $c5 03 #SET_REG(22,04) $cl
  #SET_REG(22,0A) $cx;

FLASH_SETTINGS =
  #SET_REG(92,00)
  #SET_REG(A0,03)
  #SET_REG(A1,02)
  #SET_REG(96,00) 
  #SET_REG(97,04)
  #SET_REG(9A,F0)
  #SET_REG(9B,A0)
  #SET_REG(9C,0D)
  #SET_REG(9D,2B);

TO_DRAFT =                  
  $cf.02 0      
    #CHANGE_MODE(33,00)  
    $sf.02 1  
  $cl
  $cx;

// Funš§es para Cyber-shot BestPicColor 8.0 Final
//================================================  

INIT_SAT_CC =
 $p5 10
 $c5 00
  #COM_EVENT(58,0A)
 $cl
  $c5 07
   #COM_EVENT(58,00)
  $cl
   #COM_EVENT(58,08)
  $cx
 $cx;
 
WB_CC =
 $ph 09
 $ch 01
  #COM_EVENT(58,04)
  #SET_REG(65,00)
  #SET_REG(66,10)
  #COM_EVENT(13,01)
 $cl
  #SET_REG(65,00)
  #SET_REG(66,07)
  #INIT_SAT_CC
  $p7 01
  $c7 00
   #COM_EVENT(13,01)
  $cl
   #COM_EVENT(13,00)
  $cx
 $cx;

SHUTTER_FORCE_FLASH =   
 $ca 03 #SET_REG(9E,01) #SET_REG(91,03)$cx       
    $ca 04 #SET_REG(9E,03) #SET_REG(91,03)$cx       
    $ca 05 #SET_REG(9E,05) #SET_REG(91,03)$cx  
    $ca 06 #SET_REG(9E,07) #SET_REG(91,03)$cx  
 $ca 07 #SET_REG(9E,09) #SET_REG(91,03)$cx 
 $ca 08 #SET_REG(9E,0B) #SET_REG(91,03)$cx 
 $ca 09 #SET_REG(9E,0D) #SET_REG(91,03)$cx  
 $ca 0a #SET_REG(9E,0F) #SET_REG(91,03)$cx 
 $ca 0b #SET_REG(9E,12) #SET_REG(91,03)$cx 
 $ca 0c #SET_REG(9E,14) #SET_REG(91,03)$cx  
 $ca 0d #SET_REG(9E,16) #SET_REG(91,23)$cx  
 $ca 0e #SET_REG(9E,18) #SET_REG(91,23)$cx 
 $ca 0f #SET_REG(9E,1A) #SET_REG(91,23)$cx;

SHUTTER_RER = 
 $ca 03 #SET_REG(9E,05) $cx   
    $ca 04 #SET_REG(9E,07) $cx    
    $ca 05 #SET_REG(9E,09) $cx
    $ca 06 #SET_REG(9E,0B) $cx
 $ca 07 #SET_REG(9E,0D) $cx
 $ca 08 #SET_REG(9E,0E) $cx
 $ca 09 #SET_REG(9E,12) $cx 
 $ca 0a #SET_REG(9E,14) $cx
 $ca 0b #SET_REG(9E,16) $cx
 $ca 0c #SET_REG(9E,18) $cx 
 $ca 0d #SET_REG(9E,1A) $cx
 $ca 0e #SET_REG(9E,1C) $cx
 $ca 0f #SET_REG(9E,1E) $cx;    

 
RET =
   #COM_EVENT(13,00)
      $p5 10 $c5 00 #COM_EVENT(58,0A) #COM_EVENT(55,00) $cl $cx
   $p5 10 $c5 01 #COM_EVENT(58,05) #COM_EVENT(55,00) $cl $cx
   $p5 10 $c5 02 #COM_EVENT(58,06) #COM_EVENT(55,00) $cl $cx
   $p5 10 $c5 03 #COM_EVENT(58,02) #COM_EVENT(55,00) $cl $cx
   $p5 10 $c5 04 #COM_EVENT(58,02) #COM_EVENT(55,00) $cl $cx
   $p5 10 $c5 05 #COM_EVENT(58,08) #COM_EVENT(55,00) $cl $cx
   $p5 10 $c5 06 #COM_EVENT(58,09) #COM_EVENT(55,00) $cl $cx
   $p5 10 $c5 07 #COM_EVENT(58,04) #COM_EVENT(55,00) $cl $cx;

FL_R = 
 #COM_EVENT(58,01)   
 #COM_EVENT(55,00) 
 #COM_EVENT(13,00); 

FL_A = 
 #COM_EVENT(58,01) 
 #COM_EVENT(55,00)
 #COM_EVENT(13,00);

EV =
  #TO_DRAFT 
  $s5 %0 $ma 5 $-5 09 
  #COM_EVENT(06,$w5);

ISO =
  $s5 %0 $ma 5 $-5 03 
  #SET_REG(61,$w5)
  #COM_EVENT(02,02);

CC_OFF =
 #COM_EVENT(13,00)
 #COM_EVENT(53,00);

CC_GRE = 
 #SET_REG(66,16)
 #SET_REG(65,0A)
 $cd 00 #COM_EVENT(13,01) $cl
 $cd 02 #COM_EVENT(53,01) #COM_EVENT(13,00) $cl
 $cd 03 #COM_EVENT(53,01) #COM_EVENT(13,00) $cx
 $cx $cx;

CC_RED =
 #SET_REG(66,00)
 #SET_REG(65,F5)
 $cd 00 #COM_EVENT(13,01) $cl
 $cd 02 #COM_EVENT(53,02) #COM_EVENT(13,00) $cl
 $cd 03 #COM_EVENT(53,02) #COM_EVENT(13,00) $cx
 $cx $cx;
 
CC_YEL =
 #SET_REG(66,2D)
 #SET_REG(65,00)
 $cd 00 #COM_EVENT(13,01) $cl
 $cd 02 #COM_EVENT(53,03) #COM_EVENT(13,00) $cl
 $cd 03 #COM_EVENT(53,03) #COM_EVENT(13,00) $cx
 $cx $cx;

CC_BLU =
 #SET_REG(66,D0)
 #SET_REG(65,0C)
 $cd 00 #COM_EVENT(13,01) $cl
 $cd 02 #COM_EVENT(53,04) #COM_EVENT(13,00) $cl
 $cd 03 #COM_EVENT(53,04) #COM_EVENT(13,00) $cx
 $cx $cx;

MEM =
 #COM_EVENT(53,00)
 $p6 08
 $c6 00 #CC_OFF $cl
 $c6 01 #CC_GRE $cl
 $c6 02 #CC_RED $cl
 $c6 03 #CC_YEL $cl
 $c6 04 #CC_BLU $cx
 $cx $cx $cx $cx;

MEM2 =
 #COM_EVENT(13,00)
 $p6 08
 $c6 00 #COM_EVENT(53,00) $cl
 $c6 01 #COM_EVENT(53,01) $cl
 $c6 02 #COM_EVENT(53,02) $cl
 $c6 03 #COM_EVENT(53,03) $cl
 $c6 04 #COM_EVENT(53,04) $cx
 $cx $cx $cx $cx;
 

//Camera characteristics section
//=========================================================

cam_power_on_0 = 5, 2, 31, 0, 05;  
cam_power_on_1 = 5, 2, 20, 1, 00;   
cam_power_on_2 = 5, 2, 33, 1, 05;  
cam_power_on_3 = 5, 2, 30, 1, 05;   
cam_power_on_4 = 5, 3,  9, 7530,5; 
cam_power_on_5 = 5, 2, 31, 1, 01;   

cam_power_off_0 = 5, 2, 31, 0, 05; 
cam_power_off_1 = 5, 3,  9, 0, 05;  
cam_power_off_2 = 5, 2, 30, 0, 20; 
cam_power_off_3 = 5, 2, 33, 0, 05; 
cam_power_off_4 = 5, 2, 20, 0, 05; 

cam_i2c_address = 1F;
cam_i2c_clock   = ;
cam_vf_clock_freq = 9, 7530;  
cam_ss_clock_freq = 9, 7530; 

cam_vf_format    = B100;
cam_ss_format    = 0001;    
cam_ss_format_10 = B100;     
cam_ss_format_11 = B100;    

cam_data_offset    = 2;       
cam_data_offset_10 = 0;   
cam_data_offset_11 = 0;     

cam_vf_sync = 5;
cam_ss_sync = 5;

cam_post_processing_20 = 1; 
cam_post_processing_25 = 1;  
cam_post_processing_26 = 1; 
cam_post_processing_29 = 1;  

cam_ss_jpeg_buf_size_1 = 25800;  
cam_ss_jpeg_buf_size_2 = 64000;  
cam_ss_jpeg_buf_size_4 = 96000;  
cam_ss_jpeg_buf_size_5 = E1000;  
cam_ss_jpeg_buf_size_6 = 271000; 


// Supported sizes
//================================================

sup_sizes = 

  1[280,1E0,0],   
  2[500,3C0,0],      
  
  4[660,4C8,0],    
  5[800,600,0],      
  6[A20,798,0],   

  10[140,F0,0],   
  11[280,1E0,0],   
   
  20[140,F0,BB8],    
  21[140,F0,5DC],    
  
  25[60,80,4B0],     
  26[90,B0,4B0],    

  29[90,B0,3E8],        
  2a[160,120,BB8],    
  2b[160,120,5DC],     
  2c[160,120,2EE],      
  2f[140,F0,BB8];

// I2C sequences
//================================================

seq_init =                      
  $sf 00                 
  $sf.05 1               
  $sf.02 1              
  $s8 00                
  $sa 09                   
  $sc 00                   
  $se 00                        
  $sd 00                   
  #CAPTURE_EVENT               
  #CAPTURE_EVENT           
  #SET_REG(29,01)            

  #SET_REG(3B,02) #SET_REG(3A,BC) 
  
  #SET_REG(6B,06)                 
  #SET_REG(6C,00)                
  #SET_REG(6F,3C)                 
  #SET_REG(70,1E)              
  
  #COM_EVENT(54,00)               
  #COM_EVENT(55,00)             
  #COM_EVENT(56,02)          
  #SET_REG(64,1D)
  #SET_REG(22,0A)
  #SET_REG(95,04)                
  #WB_ISO200                  
  #FLASH_LIMIT_ISO200
  #COM_EVENT(5A,01);

seq_ping = ;


// Supported properties
//===================================================================

sup_properties = 

  0[3,f,9],   
  1[0,4,0],    
  2[0,3,0],     
  3[0,1,0],     
  4[0,1,0],     
  5[0,1,0],  
  6[A,A0,A],   
  7[0,1,0],    
  8[0,4,0],   
  9[0,1,0],    
  A[0,2,0],   
  B[0,0,0],   
  C[0,0,0], 
  E[0,4,0],   
  10[0,7,0],   
  11[0,4,0],  
  12[0,1,0], 
  16[0,1,0],
  17[0,0,0],    
  18[0,1,0],    
  19[0,2,0],   
  1A[0,0,0],   
  1B[0,9,0],  
  1C[0,3,0],   
  1D[0,4,0],  
  1E[0,1,0];

// Property 0, Exposure
//---------------------------------------------------

seq_set_prop_0 = 
 $p5 10
 $c5 03
  #ISO
 $cl
  #EV
 $cx;

seq_get_prop_0 =
  $s3 00 $s2 00 $s1 00
  $m0 a;

// Property 1, White balance
//---------------------------------------------------

seq_set_prop_1_0 = 
  #TO_DRAFT
  #COM_EVENT(11,00);
seq_set_prop_1_1 = 
  #TO_DRAFT
  #COM_EVENT(11,03); 
seq_set_prop_1_2 = 
  #TO_DRAFT
  #COM_EVENT(11,04);  
seq_set_prop_1_3 = 
  #TO_DRAFT
  #COM_EVENT(11,05);  
seq_set_prop_1_4 = 
  #TO_DRAFT
  #COM_EVENT(11,06); 


// Property 2, Flicker mode
//---------------------------------------------------

seq_set_prop_2_0 = #COM_EVENT(21,01); 
seq_set_prop_2_1 = #COM_EVENT(21,02);
seq_set_prop_2_2 = #COM_EVENT(21,03); 
seq_set_prop_2_3 = #COM_EVENT(21,00);


// Property 3, Vertical mirroring
//---------------------------------------------------

seq_set_prop_3_0 = #COM_EVENT(52,00); 
seq_set_prop_3_1 = #COM_EVENT(52,0A); 


// Property 4, Horizontal mirroring
//---------------------------------------------------

seq_set_prop_4_0 = #COM_EVENT(52,00); 
seq_set_prop_4_1 = #COM_EVENT(52,05); 


// Property 5, JPEG compression
//---------------------------------------------------

seq_set_prop_5_0 = $sf.05 1; 
seq_set_prop_5_1 = $sf.05 0; 


// Property 6, Zoom
//---------------------------------------------------

seq_set_prop_6 =     
  #TO_DRAFT
  $s4 %0  $ma 4 
  $*4 3C  $/4 96  
  $s5 44  $-5 r4  
  #SET_REG(67,3C)
  #COM_EVENT(61,$w5);

seq_get_prop_6 = 
  #TO_DRAFT
  #READ_REG(69) 
  $*4 96  $/4 3C  $s0 AA
  $-0 r4  $s1 00  $s2 00  $s3 00;


// Property 7, Night mode 
//---------------------------------------------------

seq_set_prop_7_0 = ;       

seq_set_prop_7_1 = ;    

// Property 8, Effects
//---------------------------------------------------

seq_set_prop_8_0 = #CC_OFF;
seq_set_prop_8_1 = $c8 01 #COM_EVENT(53,01) $cl #CC_GRE $cx;
seq_set_prop_8_2 = $c8 01 #COM_EVENT(53,02) $cl #CC_RED $cx;
seq_set_prop_8_3 = $c8 01 #COM_EVENT(53,03) $cl #CC_YEL $cx;
seq_set_prop_8_4 = $c8 01 #COM_EVENT(53,04) $cl #CC_BLU $cx;


// Property 9, Focus mode  
//---------------------------------------------------

seq_set_prop_9_0 = 
  #TO_DRAFT
  #SET_REG(6A,00); 
seq_set_prop_9_1 = 
  #TO_DRAFT
  #SET_REG(6A,01);


// Property 10, Focus operation    
//----------------------------------------------------

seq_set_prop_a_0 =     
  $cf.02 0      
    #CHANGE_MODE(33,00)   
    $sf.02 1  
    #COM_EVENT(43,00) 
    #COM_EVENT(5A,01) 
  $cx;

seq_set_prop_a_1 =  
  $sf.02 0  
  #CHANGE_MODE(31,06);

seq_set_prop_a_2 =  
  $sf.02 0  
  #CHANGE_MODE(31,02);

seq_get_prop_a =
  05 01 00 03 03 $f  
  $r4 1 123 $d0005  
  $c3 e9             
    $b2 00 4 1    
    $c2 00
      $"CAMDRIVER0: Focus_operation_succeded"
      $s0 04 
   $p5 10
   $c5 04     
   $cf.06 1 
    #SEND_COMMAND(72,00)
    #READ_REG(71) 
    $"CAMDRIVER0: Lens_position_=_%4"
    $cs4 1C   
     #SET_REG(95,04)   
     #WB_ISO200  
     #FLASH_LIMIT_ISO200   
    $cl 
     #SET_REG(95,01) 
     #WB_ISO100 
     #FLASH_LIMIT_ISO100  
    $cx  
   $cl
      $cx
  $cl
  $cx
    $cl
      $"CAMDRIVER0: Focus_operation_failed"
      $s0 05
   $p5 10
   $c5 04
         #SET_REG(95,06)
   #WB_ISO400
         #FLASH_LIMIT_ISO400   
        $cl
  $cx
 $cx
    $"CAMDRIVER0: Received_and_cleared_Int_Source_%0_Event_Info_%2_Event_ID_%3"
    #SET_REG(06,03)                
  $cl
    $"CAMDRIVER0: Focus_operation_not_finnished"
    $s0 03         
  $cx         
  $s1 00  $s2 00  $s3 00;

// Property 11, EXIF 1    
//----------------------------------------------------

seq_get_prop_b = 
  #COM_EVENT(72,00)  
  05 01 00 B0 04 $f      
 $r5 0 0 1 2 3 $d0002  
 ;

// Property 12, EXIF 2
//----------------------------------------------------

seq_get_prop_c =
  #COM_EVENT(72,00) 
  05 01 00 B4 02 $f 
 $r3 0 0 1 $d0002 
  $cf.06 1 
    $ce 00
      $s2 01
    $cl
      $s2 00 
    $cx 
  $cl
    $s2 00
  $cx
  #READ_REG(4A) $m3 4;

// Property 14, Xenon flash support    
//----------------------------------------------------

seq_set_prop_e_0 = 
  $sd 00  
  #SET_REG(91,00)
  #RET
  #MEM;

seq_set_prop_e_1 = $sd 01;

seq_set_prop_e_2 = 
  $sd 02  
  #FLASH_SETTINGS
  #MEM2;

seq_set_prop_e_3 = 
  $sd 03
  #FLASH_SETTINGS
  #MEM2;

seq_set_prop_e_4 = ;

// Property 16, Scenes    
//----------------------------------------------------

seq_set_prop_10_0 =     
  $sa 09   
  #TO_DRAFT
  #SET_REG(64,1D)
  #SET_REG(22,0A)
  #COM_EVENT(54,00) 
  #COM_EVENT(55,00)
  #COM_EVENT(56,01) 
  #COM_EVENT(51,00) 
  #UPDATE_WB
  #UPDATE_PHOTO
  #SET_REG(95,04)   
  #WB_ISO200  
  #COM_EVENT(02,00)
  #UPDATE_ISO  
  #CHANGE_MODE(34,00)
  #COM_EVENT(5A,01)
  $cf.00 1  
    #CHANGE_MODE(35,00) 
  $cl 
  $cx;   

seq_set_prop_10_1 = 
  $sa 09 
  #TO_DRAFT
  #SET_REG(64,1D) 
  #SET_REG(22,0A)   
  #COM_EVENT(54,00)
  #COM_EVENT(55,00) 
  #COM_EVENT(56,00) 
  #COM_EVENT(51,01)   
  #UPDATE_WB
  #SET_REG(95,01)
  #WB_ISO100       
  #COM_EVENT(02,00)  
  #CHANGE_MODE(34,00)
  #COM_EVENT(5A,01)  
  $cf.00 1  
    #CHANGE_MODE(35,00) 
  $cl  
  $cx;   
 
seq_set_prop_10_2 =
  $sa 09
  #TO_DRAFT
  #SET_REG(64,23)
  #SET_REG(22,04)
  #COM_EVENT(54,00)    
  #COM_EVENT(55,00) 
  #COM_EVENT(56,FF)  
  #COM_EVENT(51,06)   
  #UPDATE_WB
  #COM_EVENT(02,00)   
  #CHANGE_MODE(34,00)
  #COM_EVENT(5A,01)     
  $cf.00 1             
    #CHANGE_MODE(35,00)  
  $cl           
  $cx;

seq_set_prop_10_3 = 
  $sa 09
  #TO_DRAFT
  #SET_REG(22,04)  
  #SET_REG(61,06)
  #SET_REG(60,29)
  #COM_EVENT(02,02)
  #COM_EVENT(54,00)
  #COM_EVENT(55,00)
  #COM_EVENT(56,00)
  #COM_EVENT(51,04)
  #UPDATE_WB
  #CHANGE_MODE(34,00)
  #COM_EVENT(5A,01)
  $cf.00 1  
    #CHANGE_MODE(35,00) 
  $cl 
  $cx;

seq_set_prop_10_4 =
  $sa 09
  #TO_DRAFT
  #SET_REG(64,20)    
  #SET_REG(22,05)  
  #COM_EVENT(02,00)  
  #COM_EVENT(54,00) 
  #COM_EVENT(55,03)   
  #COM_EVENT(56,00) 
  #SET_REG(77,20)       
  #SET_REG(78,1A)  
  #SET_REG(79,46)  
  #SET_REG(7A,3C)   
  #SET_REG(7B,1A)     
  #SET_REG(7C,3C)        
  #COM_EVENT(51,08) 
  #UPDATE_WB
  #CHANGE_MODE(34,00)
  #COM_EVENT(5A,01)
  $cf.00 1   
    #CHANGE_MODE(35,00)   
  $cl                
  $cx;

seq_set_prop_10_5 =   
  $sa 09
  #TO_DRAFT
  #SET_REG(64,1D)      
  #SET_REG(22,0A)        
  #COM_EVENT(02,00)    
  #COM_EVENT(54,00)     
  #COM_EVENT(55,02)  
  #COM_EVENT(56,00)   
  #COM_EVENT(51,02)      
  #UPDATE_WB
  #CHANGE_MODE(34,00)
  #COM_EVENT(5A,01)      
  $cf.00 1              
    #CHANGE_MODE(35,00)   
  $cl                    
  $cx;
       
seq_set_prop_10_6 = 
  $sa 09
  #TO_DRAFT
  #SET_REG(64,0C)   
  #SET_REG(22,3C) 
  #COM_EVENT(02,00)
  #COM_EVENT(54,00) 
  #COM_EVENT(55,00) 
  #COM_EVENT(56,00) 
  #COM_EVENT(51,05) 
  #UPDATE_WB
  #CHANGE_MODE(34,00)
  #COM_EVENT(5A,01)
  $cf.00 1         
    #CHANGE_MODE(35,00)  
  $cl      
  $cx;   
   
seq_set_prop_10_7 =  
  $sa 09                   
  #TO_DRAFT
  #SET_REG(64,1D)     
  #SET_REG(22,0A)   
  #COM_EVENT(02,00) 
  #COM_EVENT(54,00) 
  #COM_EVENT(55,00) 
  #COM_EVENT(56,03)
  #COM_EVENT(51,08)  
  #UPDATE_WB
  #DOC_MODE
  #CHANGE_MODE(34,00)
  #COM_EVENT(5A,01)
  $cf.00 1 
    #CHANGE_MODE(35,00) 
  $cl 
  $cx;


// Property 17, ISO    
//----------------------------------------------------

seq_set_prop_11_0 =
  #TO_DRAFT
  $sc 00     
  #SET_REG(95,04)  
  #COM_EVENT(02,00)  
  #WB_ISO200
  #FLASH_LIMIT_ISO200
  #COM_EVENT(5A,01);
  
seq_set_prop_11_1 = 
  #TO_DRAFT
  $sc 01 
  #SET_REG(61,01)
  #SET_REG(95,01) 
  #COM_EVENT(02,04)
  #WB_ISO100
  #FLASH_LIMIT_ISO100  
  #COM_EVENT(5A,01);
  
seq_set_prop_11_2 = 
  #TO_DRAFT
  $sc 04 
  #SET_REG(61,04)
  #SET_REG(95,04) 
  #COM_EVENT(02,04)
  #WB_ISO200
  #FLASH_LIMIT_ISO200
  #COM_EVENT(5A,01);
  
seq_set_prop_11_3 =
  #TO_DRAFT
  $sc 07  
  #SET_REG(61,07) 
  #SET_REG(95,07)
  #COM_EVENT(02,04)
  #WB_ISO400
  #FLASH_LIMIT_ISO400
  #COM_EVENT(5A,01);


// Property 18, Framerate reduction/restoration for GUI speed
//------------------------------------------------------------

seq_set_prop_12_0 = 
  $"CAMDRIVER0: Restore framerate" 
  $sf.07 0              
  $z5              
  $c5 20              
    $p6 10         
    $c6 03     
      #SET_REG(22,04)  
    $cl
      #SET_REG(22,0A)    
      #SET_REG(25,0A)    
    $cx
    #SET_REG(21,3C)       
    #SET_REG(24,3C)         
  $cx
  $c5 2f                
    $p6 10              
    $c6 03      
      #SET_REG(22,02)     
    $cl
      #SET_REG(22,0A) 
      #SET_REG(25,0A) 
    $cx
    #SET_REG(21,3C)   
    #SET_REG(24,3C)    
  $cx
  $c5 21     
    #SET_REG(22,0A) 
    #SET_REG(25,0A) 
    #SET_REG(21,3C) 
    #SET_REG(24,3C)    
  $cx
  $c5 25   
    #SET_REG(22,18) 
    #SET_REG(25,18)
    #SET_REG(21,18)  
    #SET_REG(24,18)
  $cx
  $c5 26    
    #SET_REG(22,18) 
    #SET_REG(25,18)   
    #SET_REG(21,18)  
    #SET_REG(24,18)   
  $cx
  $c5 29    
    #SET_REG(22,14)   
    #SET_REG(25,14)  
    #SET_REG(21,14)    
    #SET_REG(24,14)      
  $cx
  $c5 2a      
    #SET_REG(22,3B)      
    #SET_REG(25,3B)  
    #SET_REG(21,3C)   
    #SET_REG(24,3C)  
  $cx
  $c5 2b                
    #SET_REG(22,1E)      
    #SET_REG(25,1E)      
    #SET_REG(21,1E)    
    #SET_REG(24,1E)    
  $cx
  $c5 2c              
    #SET_REG(22,0F)     
    #SET_REG(25,0F)    
    #SET_REG(21,0F)     
    #SET_REG(24,0F)     
  $cl $cx

  #CHANGE_MODE(34,00)
  #COM_EVENT(5A,01)        
  $cf.00 1             
    #CHANGE_MODE(35,00)  
    $cf.01 1              
      #CHANGE_MODE(38,00)  
    $cl 
    $cx 
  $cl             
    $cf.01 1              
      #CHANGE_MODE(37,00)
    $cl 
    $cx  
  $cx;

seq_set_prop_12_1 =       
  $"CAMDRIVER0: Decrease framerate"
  $sf.07 1             
  #SET_REG(22,36)        
  #SET_REG(25,36)      
  #SET_REG(21,36)         
  #SET_REG(24,36)      
  #CHANGE_MODE(34,00);

// Property 22, Photo metering    
//----------------------------------------------------

seq_set_prop_16_0 = 
  #TO_DRAFT
  #COM_EVENT(08,00); 
seq_set_prop_16_1 = 
  #TO_DRAFT
  #COM_EVENT(08,01);  


// Property 23, Xenon flash required   
//----------------------------------------------------

seq_get_prop_17 =      
  #READ_REG(93)        
  $-4 02 $m0 4 
  $sf.06 0              
  $cd 02                
    #SET_REG(9E,0E)     
    $c0 01             
      $sf.06 1      
   #FL_A
      $p5 10             
      $c5 04 
        #SET_REG(9E,1D) 
        #SET_REG(91,23)
     $cl
        #SET_REG(91,03) 
      $cx    
    $cl 
      #SET_REG(91,00) 
   #WB_CC
    $cx
  $cl 
  $cx
  $cd 03                 
    #SET_REG(9E,0E)
    $c0 01
   #FL_R
      $sf.06 1                  
   #SHUTTER_RER
   #SET_REG(91,13)
    $cl
   #FL_A
      #SHUTTER_FORCE_FLASH
    $cx
  $cl
  $cx
  $s1 00 $s2 00 $s3 00;                             

// Property 24, Image stabilization 
//----------------------------------------------------

seq_set_prop_18_0 = 
  #TO_DRAFT
  #CHANGE_MODE(34,00) 
  $sf.00 0  
  $cc 00       
    #COM_EVENT(02,00) 
  $cl
    #COM_EVENT(02,04) 
    #SET_REG(61,$wc)   
  $cx
  #COM_EVENT(5A,01)  
  $c8 01               
    #CHANGE_MODE(37,00)  
  $cl $cx;
                 
seq_set_prop_18_1 =  
  #TO_DRAFT
  $sf.00 1     
  #COM_EVENT(02,00)  
  #CHANGE_MODE(35,00) 
  $c8 01    
    #CHANGE_MODE(38,00)
  $cl $cx;

// Property 25, Continuous zoom 
//----------------------------------------------------

seq_set_prop_19_0 =   
  #TO_DRAFT
  #COM_EVENT(61,84);
seq_set_prop_19_1 = 
  #TO_DRAFT
  #SET_REG(67,01)    
  #COM_EVENT(61,04);      
seq_set_prop_19_2 =  
  #TO_DRAFT
  #SET_REG(67,01)   
  #COM_EVENT(61,40);     


// Property 26, Get continuous zoom 
//----------------------------------------------------

seq_get_prop_1a = 
  #TO_DRAFT
  #READ_REG(69) 
  $s0 63  $*0 40  $/0 r4  $-0 54
  $/0 0F  $s3 00  $s2 00 $s1 00;

// Property 27, Snapshot operation 
//----------------------------------------------------

seq_set_prop_1b = $se %0;    


// Property 28, BestPic image size
//----------------------------------------------------

seq_set_prop_1c_0 = 
  #SET_REG(2D,01)   
  #SET_REG(42,46)  
  $cf.05 1          
    #SET_REG(45,5A) 
  $cl              
    #SET_REG(45,5F)   
  $cx;

seq_set_prop_1c_1 =    
  #SET_REG(2D,03)        
  #SET_REG(42,40)     
  $cf.05 1         
    #SET_REG(45,40)  
  $cl                  
    #SET_REG(45,46) 
  $cx;

seq_set_prop_1c_2 =  
  #SET_REG(2D,06)     
  #SET_REG(42,32)   
  $cf.05 1            
    #SET_REG(45,14)  
  $cl                
    #SET_REG(45,1E)    
  $cx;

seq_set_prop_1c_3 =     
  #SET_REG(2D,08)    
  #SET_REG(42,20)      
  $cf.05 1            
    #SET_REG(45,05)       
  $cl                
    #SET_REG(45,0A)    
  $cx;


// Property 29, BestPic operation, 
//----------------------------------------------------

seq_set_prop_1d_0 = $sb 00;

seq_set_prop_1d_1 = $sb 01;
   
seq_set_prop_1d_2 = $sb 02;

seq_set_prop_1d_3 =    
  #CHANGE_MODE(31,02) 
  #CHANGE_MODE(39,04);

seq_set_prop_1d_4 =     
  #COM_EVENT(3A,00);

// Reset and test pattern,  property 30
//---------------------------------------------------------------

seq_set_prop_1e_0 = 
  $go 31 0     
  $d0020
  $go 31 1         
  #CAPTURE_EVENT   
  #CAPTURE_EVENT    
  #SET_REG(29,01)   
  #SET_REG(2B,01);

seq_set_prop_1e_1 = 
  #SET_REG(81,01) 
  03 55 AA $f $r2 01 $d0003   
  08 04 70 30 00 05 01 00 $f $r3 001 $d0003;

// Viewfinder and snapshot sequences
//=================================================================

seq_ss_config_1 =
  $sf.03 1         
  #SET_REG(26,08)   
  $cf.05 1    
     $"CAMDRIVER0: VGA NORMAL COMPRESSION"
     0D 02 00 3C         
     96 00      
     0A 00         
     37 00     
     46        
     3C         
     32              
     $f $ra 1111111111 $d0002
  $cl           
     $"CAMDRIVER0: VGA LOW COMPRESSION"
     0D 02 00 3C          
     96 00               
     32 00                
     50 00            
     50                  
     46               
     3C                  
     $f $ra 1111111111 $d0002
  $cx;

seq_ss_config_2 =
  $sf.03 1            
  #SET_REG(26,06)      
  $cf.05 1              
    $"CAMDRIVER0: 1M NORMAL COMPRESSION"
    0D 02 00 3C          
    90 01              
    3C 00              
    C8 00           
    46                  
    3C                  
    32                   
    $f $ra 1111111111 $d0002
  $cl                 
    $"CAMDRIVER0: 1M LOW COMPRESSION"
    0D 02 00 3C         
    90 01            
    64 00             
    2C 01         
    50                 
    46                
    3C                  
    $f $ra 1111111111 $d0002 
  $cx;

seq_ss_config_4 =
  $sf.03 1       
  #SET_REG(26,05)      
  $cf.05 1            
    $"CAMDRIVER0: 2M NORMAL COMPRESSION"
    0D 02 00 3C         
    58 02           
    96 00             
    90 01           
    46                
    3C             
    32                  
    $f $ra 1111111111 $d0002
  $cl                  
    $"CAMDRIVER0: 2M LOW COMPRESSION"
    0D 02 00 3C         
    58 02              
    90 01              
    F4 01             
    50                  
    46             
    3C                  
    $f $ra 1111111111 $d0002
  $cx;

seq_ss_config_5 =
  $sf.03 1            
  #SET_REG(26,03)   
  $cf.05 1           
     $"CAMDRIVER0: 3M NORMAL COMPRESSION"
     0D 02 00 3C          
     20 03              
     90 01               
     58 02              
     46                 
     3C                 
     32                  
     $f $ra 1111111111 $d0002
  $cl                   
     $"CAMDRIVER0: 3M LOW COMPRESSION"
     0D 02 00 3C     
     84 03              
     58 02             
     52 03          
     50               
     46              
     3C                 
     $f $ra 1111111111 $d0002
  $cx;

seq_ss_config_6 =
  $sf.03 1     
  #SET_REG(26,01)    
  $cf.05 1           
    $"CAMDRIVER0: 5M NORMAL COMPRESSION" 
    0D 02 00 3C   
    46 05        
    9E 02       
    E8 03         
    46          
    3C          
    32         
    $f $ra 1111111111 $d0002
  $cl          
    $"CAMDRIVER0: 5M LOW COMPRESSION"
    0D 02 00 3C    
    DC 05          
    B0 04        
    78 05      
    50          
    46       
    3C         
    $f $ra 1111111111 $d0002
  $cx;

seq_ss_config_10 =
  $sf.03 0           
  #SET_REG(26,0C);

seq_ss_config_11 =
  $sf.03 0         
  #SET_REG(26,08);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              

seq_vf_config_20 =
  #SET_REG(20,0C) 
  $cf.07 1
                      
  $cl
    #SET_REG(21,3C) 
  $cx
  #UPDATE_MIN_FRMRATE
  $s8 00;

seq_vf_config_21 = 
  #SET_REG(20,0C)
  $cf.07 1 
                      
  $cl
   #SET_REG(21,1E)
  $cx
  #UPDATE_MIN_FRMRATE
  $s8 00;

seq_vf_config_25 = 
  #SET_REG(20,14)
  #SET_REG(23,14)
  $cf.07 1
                      
  $cl
    #SET_REG(22,14)
    #SET_REG(25,14) 
    #SET_REG(21,14)
    #SET_REG(24,14)
  $cx
  $s8 00;

seq_vf_config_26 =
  #SET_REG(20,12)
  #SET_REG(23,12)
  $cf.07 1 
                      
  $cl
    #SET_REG(22,18) 
    #SET_REG(25,18)   
    #SET_REG(21,18)  
    #SET_REG(24,18) 
  $cx
  $s8 00;

seq_vf_config_29 =
  #SET_REG(20,12)
  #SET_REG(23,12)
  $cf.07 1 
                      
  $cl
    #SET_REG(22,14)
    #SET_REG(25,14)
    #SET_REG(21,14)
    #SET_REG(24,14)
  $cx
  $s8 01;

seq_vf_config_2a =
  #SET_REG(20,0B)
  #SET_REG(23,0B)
  $cf.07 1
                      
  $cl
    #SET_REG(22,3B)
    #SET_REG(25,3B)  
    #SET_REG(24,3C)
    #SET_REG(21,3C)
 $cx
  $s8 01;

seq_vf_config_2b =
  #SET_REG(20,0B)
  #SET_REG(23,0B)
  $cf.07 1
                      
  $cl
    #SET_REG(22,1E)
    #SET_REG(25,1E)
    #SET_REG(21,1E)
    #SET_REG(24,1E)
  $cx
  $s8 01;

seq_vf_config_2c =
  #SET_REG(20,0B)
  #SET_REG(23,0B)
  $cf.07 1
                      
  $cl
    #SET_REG(22,0F)
    #SET_REG(25,0F)
    #SET_REG(21,0F)
   #SET_REG(24,0F) 
  $cx 
  $s8 01;

seq_vf_config_2f = 
  #SET_REG(20,0C)
  $cf.07 1 
                      
  $cl
    #SET_REG(21,3C)
  $cx
  #UPDATE_MIN_FRMRATE
  $s8 00;


//-----------------------------------------------

seq_vf_start = 
  $cf.02 0 
    #CHANGE_MODE(33,00)
    #COM_EVENT(43,00)  
    #COM_EVENT(5A,01) 
    $sf.02 1
    $se 00      
  $cl
    #CHANGE_MODE(34,00)
    #COM_EVENT(5A,01) 
    $cf.00 1  
      #CHANGE_MODE(35,00)
      $c8 01 
        #CHANGE_MODE(38,00) 
  #MEM2
      $cl $cx 
    $cl 
      $c8 01  
        #CHANGE_MODE(37,00)
  #MEM2
      $cl $cx  
    $cx       
  $cx;

seq_vf_stop = ; 

seq_ss_start =
  $cf.02 1               
    #CHANGE_MODE(31,02)   
    $sf.02 0              
  $cl
  $cx;

seq_ss_take = 
  $ce 00 
    $cf.03 1  
      #CHANGE_MODE(36,80)
      #CAPTURE_EVENT
    $cl     
      #CHANGE_MODE(36,00)
    $cx 
  $cl  
    #CHANGE_MODE(3A,$we)
  $cx  
  #CAPTURE_EVENT;     

seq_ss_verify = #CAPTURE_EVENT 
  $c2 01
    $s0 01
    $"CAMDRVIER0: Image_verified"
  $cl            
    $"CAMDRIVER0: Image_not_verified"
  $cx;

seq_ss_stop = ;

// Functions for synchronized viewfinder images in burst mode. 

seq_pv_start =
  $cf.02 1                     
    #CHANGE_MODE(31,02)       
    $sf.02 0                   
  $cl
  $cx  
  $"CAMDRIVER0: seq_pv_start"
  $s9 00                     
  $cb 00                         
    #CHANGE_MODE(39,04)      
  $cl                          
    #CHANGE_MODE(39,14)     
  $cx;

seq_pv_stop =
  $c9 01
    $"CAMDRIVER0: seq_pv_stop"
    $s9 03                     
    #COM_EVENT(3A,00)  
  $cl
    $"CAMDRIVER0: seq_pv_stop is waiting for EV_RECORD_STATUS"
    $s9 02                   
  $cx;

seq_pv_verify = 
  $h0 02 5 0000               
  05 01 00 03 03 $f $r4 0 012  
  05 02 00 06 03 $f            
  $cb 02                   
    $s0 ff                   
  $cl 
    $s0 00
    $c2 e3
      $b1 00 4 4
      $c1 00
        $s0 01                 
        $"CAMDRIVER0: Rotate, synch vf"
      $cl
        $"CAMDRIVER0: Compr_failed_%0_%1_%2"
      $cx
    $cl 
    $cx
    $c2 ea                  
      $c1 50  
        $s0 ff                  
      $cl
      $cx
    $cl
    $cx
    $c2 ee                
      $c9 02
        $"CAMDRIVER0: EV_RECORD_STATUS(completed)"
        $"CAMDRIVER0: Change the mode to BurstOutput"
        $s9 03             
        #COM_EVENT(3A,00)    
        $s0 00               
      $cl
        $"CAMDRIVER0: EV_RECORD_STATUS(completed)"
        $s9 01             
      $cx
    $cl
    $cx
  $cx;

// JPEG section
//================================================

jpeg_qtable_selector_0 = 
      $s2 00 #READ_REG(4A)    
      $m0 4 $s1 00
   $"CAMDRIVER0: qtable0=%0"
      ;   

jpeg_qtable_selector_1 = 
      $s2 01 #READ_REG(4A)  
      $m0 4 $s1 00
      $"CAMDRIVER0: qtable1=%0"
      ;

jpeg_qtable_0 =
      10 0B 0C 0E 0C 0A 10 0E 
      0D 0E 12 11 10 13 18 28 
      1A 18 16 16 18 31 23 25 
      1D 28 3A 33 3D 3C 39 33 
      38 37 40 48 5C 4E 40 44 
      57 45 37 38 50 6D 51 57 
      5F 62 67 68 67 3E 4D 71
      79 70 64 78 5C 65 67 63
      ;

jpeg_qtable_1 = 
      11 12 12 18 15 18 2F 1A 
      1A 2F 63 42 38 42 63 63 
      63 63 63 63 63 63 63 63 
      63 63 63 63 63 63 63 63 
      63 63 63 63 63 63 63 63 
      63 63 63 63 63 63 63 63 
      63 63 63 63 63 63 63 63 
      63 63 63 63 63 63 63 63
      ; 
                        
jpeg_qtable_factors = 
      0,320100,190000,10AB00,C8000,A0000,85500,72500,64000,58E00,50000,
      48C00,42B00,3D900,39200,35500,32000,2F100,2C700,2A200,28000,
      26200,24600,22D00,21500,20000,1EC00,1DA00,1C900,1B900,1AB00,
      19D00,19000,18400,17800,16E00,16400,15A00,15100,14800,14000,
      13800,13100,12A00,12300,11C00,11600,11000,10B00,10500,10000,
       FB00, F600, F100, EC00, E600, E100, DC00,D700,D200,CD00,
       C800, C300, BD00, B800, B300, AE00, A900,A400,9F00,9A00,
       9400, 8F00, 8A00, 8500, 8000, 7B00, 7600,7100,6C00,6600,
       6100, 5C00, 5700, 5200, 4D00, 4800, 4300,3D00,3800,3300,
       2E00, 2900, 2400, 1F00, 1A00, 1400,  F00, A00, 500, 100
      ;

jpeg_header= FF D8
             FF E0 00 10 4A 46 49 46 00 01 01 00 00 01 00 01 00 00
             FF DB 00 84 00 $qt0  01 $qt1                             
             FF C4 01 A2 00 00 01 05 01 01 01 01 01 01 00 00 00 00 00 00 00 
                            00 01 02 03 04 05 06 07 08 09 0A 0B
                         01 00 03 01 01 01 01 01 01 01 01 01 00 00 00 00 00 
                            00 01 02 03 04 05 06 07 08 09 0A 0B
                         10 00 02 01 03 03 02 04 03 05 05 04 04 00 00 01 7D
                            01 02 03 00 04 11 05 12 21 31 41 06 13 51 61 07 
                            22 71 14 32 81 91 a1 08 23 42 b1 c1 15 52 d1 f0 
                            24 33 62 72 82 09 0a 16 17 18 19 1a 25 26 27 28 
                            29 2a 34 35 36 37 38 39 3a 43 44 45 46 47 48 49 
                            4a 53 54 55 56 57 58 59 5a 63 64 65 66 67 68 69 
                            6a 73 74 75 76 77 78 79 7a 83 84 85 86 87 88 89 
                            8a 92 93 94 95 96 97 98 99 9a a2 a3 a4 a5 a6 a7 
                            a8 a9 aa b2 b3 b4 b5 b6 b7 b8 b9 ba c2 c3 c4 c5 
                            c6 c7 c8 c9 ca d2 d3 d4 d5 d6 d7 d8 d9 da e1 e2
                            e3 e4 e5 e6 e7 e8 e9 ea f1 f2 f3 f4 f5 f6 f7 f8 
                            f9 fa
                         11 00 02 01 02 04 04 03 04 07 05 04 04 00 01 02 77
                            00 01 02 03 11 04 05 21 31 06 12 41 51 07 61 71 
                            13 22 32 81 08 14 42 91 a1 b1 c1 09 23 33 52 f0 
                            15 62 72 d1 0a 16 24 34 e1 25 f1 17 18 19 1a 26 
                            27 28 29 2a 35 36 37 38 39 3a 43 44 45 46 47 48 
                            49 4a 53 54 55 56 57 58 59 5a 63 64 65 66 67 68 
                            69 6a 73 74 75 76 77 78 79 7a 82 83 84 85 86 87 
                            88 89 8a 92 93 94 95 96 97 98 99 9a a2 a3 a4 a5 
                            a6 a7 a8 a9 aa b2 b3 b4 b5 b6 b7 b8 b9 ba c2 c3 
                            c4 c5 c6 c7 c8 c9 ca d2 d3 d4 d5 d6 d7 d8 d9 da
                            e2 e3 e4 e5 e6 e7 e8 e9 ea f2 f3 f4 f5 f6 f7 f8 
                            f9 fa             
             FF DD 00 04 00 00 
             FF C0 00 11 08 $h $w 03 01 21 00 02 11 01 03 11 01
             FF DA 00 0C 03 01 00 02 11 03 11 00 3F 00;


//
//   ########                    #####
//  ###########              ####     ##
//   ###########           ###        # 
//   #############        ##            
//   ##############     ##              
//   ###############   ##               
//    ############### ##                
//     ################                 
//         #        ############        
//      #           ###############     
//     #           #################    
//     #          ##################    
//     ##         ##  ##############    
//      #  ę2009 ##    ###BZK«™#####    
//       ##  #  ##      ##########      
//         #####          ######
// Sony Ericsson CameraDrivers BrAzzUkA's BZK«

//The information and codes published in camdrivers are available to any modders and user, 
//but may not necessarily be copied, downloaded or reused without credit to the developers.
//Thanks

Camera Manager Settings v2.0

download
Date: 05.06.2010.
Author: BrAzzUkA's TEAM
Nationality: Sweden

//##############################################################################################
//#  ____                      _____      _                                                    #
//# / ___|  ___  _ __  _   _  | ____|_ __(_) ___ ___ ___  ___  _ __                            # 
//# \___ \ / _ \| '_ \| | | | |  _| | '__| |/ __/ __/ __|/ _ \| '_ \                           # 
//#  ___) | (_) | | | | |_| | | |___| |  | | (__\__ \__ \ (_) | | | |                          # 
//# |____/ \___/|_| |_|\__, | |_____|_|  |_|\___|___/___/\___/|_| |_|                          # 
//#                    |___/                                                                   # 
//#                                                                                            #      
//# Version v2.0 Camera Manager Settings™ for K850/C905                                        #
//# Optimized for the Sony Ericsson k850/C905                                                  # 
//##############################################################################################
//# Copyright« 2010 Sony Ericsson Mobile Communications.                                       #
//# All rights, including trade secret rights, reserved.                                       #
//# BrAzzUkA's TEAM BZK« Camera Drivers respects the intellectual property of others,          #
//# and we ask our modders and users to do the same.                                           #
//##############################################################################################
//Dear user and modder, your changes in this code will be useless so
//don't touch anything and don't edit anything below.
//Visit the website: http://www.esato.com/board/viewtopic.php?topic=189996
//
//Information section
//=========================================================

info_name=MCB991;
info_vendor=BrAzzUkA's TEAM BZK«;
info_major_ver=2;
info_minor_ver=0; //Camera Manager Settings™

// Macros for camera
//================================================
SET_REG =             
  05 02 00 !0 !1 $f $r2 1 1 $d0002;      

READ_REG =            
  05 01 00 !0 01 $f $r2 4 4 $d0002;     

CLEAR_EVENT =         
  05 01 00 03 03 $f $r4 1 123 $d0002 $c3 00              
  $"CAMDRIVER0: Queue_was_empty"
  $cl
  $"CAMDRIVER0: Cleared_Int_Source_%1_Event_Info_%2_Event_ID_%3"   
  $cx
  #SET_REG(06,03);       

CLEAR_EVENT_FIFO = $s0 01 [ 0 ff #CLEAR_EVENT $c3 00 $s0 00 $cx];

SEND_COMMAND =          
  06 02 00 01 !1 !0 $f $r3 111 $d0002;       

WAIT_FOR_TRIG =       
  $h 0 02 5 1000 $c0 00                
  $"CAMDRIVER0: TRIG_Timeout"   
  $cl
  $"CAMDRIVER0: TRIG_Recieved"  
  $cx;
                     
POLL_EVENT_ID =                  
  !0 $s0 01 [ 0 ff #CLEAR_EVENT $-3 r4 $c3 00            
  $"CAMDRIVER0: Successfully_acknowledged_Event_ID_%4"
  $s0 00         
  $cx];

CAPTURE_EVENT = 
  #WAIT_FOR_TRIG
  #CLEAR_EVENT;

CHANGE_MODE =               
  #CLEAR_EVENT_FIFO        
  #SEND_COMMAND(!0,!1)      
  #POLL_EVENT_ID($s4 ea)    
  #SET_REG(06,03);

COM_EVENT =                 
  #CLEAR_EVENT_FIFO
  #SEND_COMMAND(!0,!1)
  #WAIT_FOR_TRIG
  #CLEAR_EVENT;

UPDATE_WB =          
  $c7 00   
  $cl
    $u01    
  $cx;

UPDATE_PHOTO =        
  $p5 16
  $c5 00     
  $cl
    $u16    
  $cx;

WB_ISO100 =              
  #SET_REG(98,24)   
  #SET_REG(99,73);      

WB_ISO200 =             
  #SET_REG(98,27)   
  #SET_REG(99,6D);      
  
WB_ISO400 =             
  #SET_REG(98,28)    
  #SET_REG(99,6A);      

POWER_FLASH =
  $p5 10
  $c5 07     
  #SET_REG(AD,F0)        
  $cl      
    #SET_REG(AD,00)        
  $cx;
  
FLASH_LIMIT_ISO100 =       
  #SET_REG(A2,C8) #SET_REG(A3,25)  
  #SET_REG(A4,D0) #SET_REG(A5,25)
  #POWER_FLASH;

FLASH_LIMIT_ISO200 =      
  #SET_REG(A2,C7) #SET_REG(A3,21) 
  #SET_REG(A4,D0) #SET_REG(A5,21)
  #POWER_FLASH;

FLASH_LIMIT_ISO400 =      
  #SET_REG(A2,C6) #SET_REG(A3,1D) 
  #SET_REG(A4,D0) #SET_REG(A5,1D)
  #POWER_FLASH;

UPDATE_ISO = $u11;   

DOC_MODE =                  
 #SET_REG(95,01)         
 #WB_ISO200             
 #FLASH_LIMIT_ISO100;    

UPDATE_MIN_FRMRATE =  
  $p5 10
  $c5 03               
    #SET_REG(22,04)   
  $cl                 
    #SET_REG(22,0A)   
  $cx;                

FLASH_SETTINGS =
  #SET_REG(92,00)       
  #SET_REG(A0,03)      
  #SET_REG(A1,02)      
  #SET_REG(96,00)      
  #SET_REG(97,04)      
  #SET_REG(9A,F0)     
  #SET_REG(9B,A0)     
  #SET_REG(9C,0D)     
  #SET_REG(9D,2B);     

TO_DRAFT =                  
  $cf.02 0                    
    #CHANGE_MODE(33,00)      
    $sf.02 1                   
  $cx;

//Functions for Camera Manager SettingsÖ v2.0 Initial Sequence
//=============================================================  

INIT_SAT_CC = //----->initial sequence colors saturation
 $p5 10
 $c5 00 #COM_EVENT(58,09) $cl
 $c5 07 #COM_EVENT(58,05) $cx
 $cx;
 
WB_CC = //----->initial sequence colors corrections
 $cf.08 1
  #SET_REG(65,00)
  #SET_REG(66,10)
 $cl
  #SET_REG(65,00)
  #SET_REG(66,07)
 $cx
 #INIT_SAT_CC
 $c7 00
  #COM_EVENT(13,01)
 $cl
  #COM_EVENT(13,00)
 $cx;
 
EV =
 #TO_DRAFT
 $s5 %0 $ma 5 $-5 09 
 #COM_EVENT(06,$w5); 

SHUTTER_FLASH =   //---------->shutter speed xenon flash only when flash turn on!
 $ca 03 #SET_REG(9E,01) $cx
        $ca 04 #SET_REG(9E,03) $cx
        $ca 05 #SET_REG(9E,05) $cx
        $ca 06 #SET_REG(9E,07) $cx
 $ca 07 #SET_REG(9E,09) $cx
 $ca 08 #SET_REG(9E,0B) $cx
 $ca 09 #SET_REG(9E,0E) $cx
 $ca 0a #SET_REG(9E,11) $cx
 $ca 0b #SET_REG(9E,13) $cx
 $ca 0c #SET_REG(9E,15) $cx
 $ca 0d #SET_REG(9E,17) $cx
 $ca 0e #SET_REG(9E,19) $cx
 $ca 0f #SET_REG(9E,1C) $cx;

RET = 
   #COM_EVENT(13,00)
          $p5 10 $c5 00 #COM_EVENT(58,0A) #COM_EVENT(55,00) #COM_EVENT(54,00) #COM_EVENT(56,00) $cx
   $p5 10 $c5 01 #COM_EVENT(58,05) #COM_EVENT(55,00) #COM_EVENT(54,00) #COM_EVENT(56,02) $cx
   $p5 10 $c5 02 #COM_EVENT(58,08) #COM_EVENT(55,00) #COM_EVENT(54,00) #COM_EVENT(56,01) $cx
   $p5 10 $c5 03 #COM_EVENT(58,05) #COM_EVENT(55,00) #COM_EVENT(54,00) #COM_EVENT(56,00) $cx
   $p5 10 $c5 04 #COM_EVENT(58,04) #COM_EVENT(55,00) #COM_EVENT(54,00) #COM_EVENT(56,00) $cx
   $p5 10 $c5 05 #COM_EVENT(58,09) #COM_EVENT(55,00) #COM_EVENT(54,00) #COM_EVENT(56,00) $cx
   $p5 10 $c5 06 #COM_EVENT(58,09) #COM_EVENT(55,00) #COM_EVENT(54,00) #COM_EVENT(56,03) $cx
   $p5 10 $c5 07 #COM_EVENT(58,04) #COM_EVENT(55,00) #COM_EVENT(54,00) #COM_EVENT(56,04) $cx;

FL_R =                     
 #COM_EVENT(58,01)       
 #COM_EVENT(55,00)      
 #COM_EVENT(13,00);      

FL_A =                     
 #COM_EVENT(58,01) 
 #COM_EVENT(55,00)
 #COM_EVENT(13,00);

//Functions for Camera Manager Settings v2.0 Initial Sequence
//============================================================
//Dear user and modder, your changes in this code will be useless so
//don't touch anything and don't edit anything below.

MISO =
  $sm %0 $-m 03
  #SET_REG(95,$wm)   
  #SET_REG(61,$wm)   
  $cf.0a 1     
  #COM_EVENT(02,02)  
  $cl      
  #COM_EVENT(02,04)  
  $cx;

MSHUTTER =
  $si %0 $-i 03 
  $*i 07 $/i 02
 $cd 02
  #COM_EVENT(02,00)
  $sf.0a 0     
 $cl
  $cd 03
   #COM_EVENT(02,00)
   #SET_REG(9E,$wi)
   $sf.0a 0    
  $cl
   $cd 00
    #COM_EVENT(02,02)
    #SET_REG(60,$wi) 
    $sf.0a 1   
   $cx
  $cx
 $cx;
  
MFOCUS =
 $sn %0 $-n 03 $*n 09
 #COM_EVENT(43,$wn);  

MSATURATION =
 $so %0 $-o 09 $*o 03
 #COM_EVENT(58,$wo);  

MHUE =
 $sp %0 $-p 09 
 $+p 06 $*p 0A 
 #COM_EVENT(57,$wp);  

MSHARPNESS =
 $sq %0 $-q 09 
 #COM_EVENT(56,$wq);  

MCONTRAST =
 $sr %0 $-r 09 
 #COM_EVENT(55,$wr);  

MBRIGHTNESS =
 $sh %0 $-h 03   
 #COM_EVENT(54,$wh);

  
FUNCTIONS = //------->Functions for Camera Manager
 $p5 10
 $c5 00 #MISO     $cl     
 $c5 01 #MSHUTTER    $cl    
 $c5 02 #MFOCUS      $cl    
 $c5 03 #MSATURATION $cl   
 $c5 04 #MSHARPNESS  $cl    
 $c5 05 #MCONTRAST   $cl   
 $c5 06 #MBRIGHTNESS $cl    
 $c5 07 #MHUE        $cx     
 $cx $cx $cx $cx
 $cx $cx $cx;

RESET_F =       
 #COM_EVENT(57,00)    
 #RET       
 $u10       
 $u11;       
 
RESET_V =       
 #COM_EVENT(54,00)    
 #COM_EVENT(55,00)    
 #COM_EVENT(56,00)    
 #COM_EVENT(57,00)    
 #COM_EVENT(58,04);    

MEFFECTS = //---->Special Effects for Photo Mode and Video Mode      
 $p5 00
 $c5 03 #SET_REG(65,00) #SET_REG(66,2D) #COM_EVENT(06,00) #COM_EVENT(53,00) #COM_EVENT(54,00) #COM_EVENT(55,1E) #COM_EVENT(57,64) #COM_EVENT(58,14) $cl
 $c5 04 #SET_REG(65,0C) #SET_REG(66,D0) #COM_EVENT(06,00) #COM_EVENT(53,00) #COM_EVENT(54,00) #COM_EVENT(55,1E) #COM_EVENT(57,78) #COM_EVENT(58,14) $cl
 $c5 05 #SET_REG(65,0A) #SET_REG(66,42) #COM_EVENT(06,00) #COM_EVENT(53,00) #COM_EVENT(54,00) #COM_EVENT(55,1E) #COM_EVENT(57,8C) #COM_EVENT(58,14) $cl
 $c5 06 #SET_REG(65,F5) #SET_REG(66,00) #COM_EVENT(06,00) #COM_EVENT(53,00) #COM_EVENT(54,00) #COM_EVENT(55,1E) #COM_EVENT(57,F4) #COM_EVENT(58,14) $cl
 $c5 07 #SET_REG(65,3C) #SET_REG(66,DC) #COM_EVENT(06,00) #COM_EVENT(53,00) #COM_EVENT(54,00) #COM_EVENT(55,09) #COM_EVENT(57,C8) #COM_EVENT(58,14) $cl
 $c5 08 #SET_REG(65,B4) #SET_REG(66,50) #COM_EVENT(06,00) #COM_EVENT(53,00) #COM_EVENT(54,00) #COM_EVENT(55,06) #COM_EVENT(57,DC) #COM_EVENT(58,14) $cl
 $c5 09 #SET_REG(65,00) #SET_REG(66,00) #COM_EVENT(06,00) #COM_EVENT(53,00) #COM_EVENT(54,00) #COM_EVENT(55,00) #COM_EVENT(57,00) #COM_EVENT(58,00) $cl
 $c5 0a #SET_REG(66,00) #SET_REG(65,00) #COM_EVENT(06,00) #COM_EVENT(53,01) #COM_EVENT(54,00) #COM_EVENT(55,00) #COM_EVENT(57,00) #COM_EVENT(58,00) $cl
 $c5 0b #SET_REG(66,00) #SET_REG(65,00) #COM_EVENT(06,00) #COM_EVENT(53,02) #COM_EVENT(54,00) #COM_EVENT(55,00) #COM_EVENT(57,00) #COM_EVENT(58,00) $cl
 $c5 0c #SET_REG(66,00) #SET_REG(65,00) #COM_EVENT(06,00) #COM_EVENT(53,03) #COM_EVENT(54,00) #COM_EVENT(55,00) #COM_EVENT(57,00) #COM_EVENT(58,00) $cl
 $c5 0d #SET_REG(66,00) #SET_REG(65,00) #COM_EVENT(06,00) #COM_EVENT(53,04) #COM_EVENT(54,00) #COM_EVENT(55,00) #COM_EVENT(57,00) #COM_EVENT(58,00) $cl
 $c5 0e #SET_REG(66,00) #SET_REG(65,00) #COM_EVENT(06,00) #COM_EVENT(53,05) #COM_EVENT(54,00) #COM_EVENT(55,00) #COM_EVENT(57,00) #COM_EVENT(58,00) $cl
 $c5 0f #SET_REG(66,00) #SET_REG(65,00) #COM_EVENT(06,00) #COM_EVENT(53,00) #COM_EVENT(54,00) #COM_EVENT(55,00) #COM_EVENT(57,00) #COM_EVENT(58,14) $cx
 $cx $cx $cx $cx $cx $cx $cx 
 $cx $cx $cx $cx $cx
        #COM_EVENT(13,01);


FILTERS1 = //---->Color Filters1 = Colors Correction     
 $pj 00
 $cj 03 #SET_REG(65,90) #SET_REG(66,00) $cl
 $cj 04 #SET_REG(65,A0) #SET_REG(66,00) $cl
 $cj 05 #SET_REG(65,B0) #SET_REG(66,00) $cl
 $cj 06 #SET_REG(65,C0) #SET_REG(66,00) $cl
 $cj 07 #SET_REG(65,D0) #SET_REG(66,00) $cl
 $cj 08 #SET_REG(65,F0) #SET_REG(66,00) $cl
 $cj 09 #SET_REG(65,00) #SET_REG(66,00) $cl
 $cj 0a #SET_REG(66,10) #SET_REG(65,00) $cl
 $cj 0b #SET_REG(66,20) #SET_REG(65,00) $cl
 $cj 0c #SET_REG(66,30) #SET_REG(65,00) $cl
 $cj 0d #SET_REG(66,40) #SET_REG(65,00) $cl
 $cj 0e #SET_REG(66,50) #SET_REG(65,00) $cl
 $cj 0f #SET_REG(66,60) #SET_REG(65,00) $cx
 $cx $cx $cx $cx $cx $cx $cx 
 $cx $cx $cx $cx $cx
 #COM_EVENT(13,01);
 
FILTERS2 = //---->Color Filters2 = Colors Correction        
 $pj 00
 $cj 03 #SET_REG(65,68) #SET_REG(66,60) $cl
 $cj 04 #SET_REG(65,50) #SET_REG(66,50) $cl
 $cj 05 #SET_REG(65,45) #SET_REG(66,40) $cl
 $cj 06 #SET_REG(65,3A) #SET_REG(66,30) $cl
 $cj 07 #SET_REG(65,29) #SET_REG(66,20) $cl
 $cj 08 #SET_REG(65,1A) #SET_REG(66,10) $cl
 $cj 09 #SET_REG(65,00) #SET_REG(66,00) $cl
 $cj 0a #SET_REG(65,1A) #SET_REG(66,D0) $cl
 $cj 0b #SET_REG(65,29) #SET_REG(66,C0) $cl
 $cj 0c #SET_REG(65,3A) #SET_REG(66,B0) $cl
 $cj 0d #SET_REG(65,45) #SET_REG(66,A0) $cl
 $cj 0e #SET_REG(65,50) #SET_REG(66,90) $cl
 $cj 0f #SET_REG(65,68) #SET_REG(66,80) $cx
 $cx $cx $cx $cx $cx $cx $cx 
 $cx $cx $cx $cx $cx
 #COM_EVENT(13,01);
 
CAMERA_MANAGER =    
 $c8 00       
 $ck 00
  #EV  
 $cl
  $ck 04 #FUNCTIONS $cl
  $ck 01 #FILTERS1 $cl
  $ck 03 #FILTERS2 $cl
  $ck 02 #MEFFECTS $cx
  $cx $cx $cx $cx
 $cl       
  $ck 01 #FILTERS1 $cl
  $ck 03 #FILTERS2 $cl
  $ck 02 #MEFFECTS $cl
  $ck 04 #MFOCUS $cl
  $ck 00 #EV $cx
 $cx $cx $cx $cx
 $cx;

//Dear user and modder, your changes in this code will be useless so
//don't touch anything and don't edit anything below.


//Camera characteristics section
//=========================================================

cam_power_on_0 = 5, 2, 31, 0, 05;   
cam_power_on_1 = 5, 2, 20, 1, 00;   
cam_power_on_2 = 5, 2, 33, 1, 05;     
cam_power_on_3 = 5, 2, 30, 1, 05;   
cam_power_on_4 = 5, 3,  9, 6590,5;  
cam_power_on_5 = 5, 2, 31, 1, 01;   

cam_power_off_0 = 5, 2, 31, 0, 05; 
cam_power_off_1 = 5, 3,  9, 0, 05;  
cam_power_off_2 = 5, 2, 30, 0, 20; 
cam_power_off_3 = 5, 2, 33, 0, 05;  
cam_power_off_4 = 5, 2, 20, 0, 05;  

cam_i2c_address = 1F;
cam_i2c_clock   = ;
cam_vf_clock_freq = 9, 7530;  
cam_ss_clock_freq = 9, 7530;  

cam_vf_format    = B100;
cam_ss_format    = 0001;     
cam_ss_format_10 = B100;      
cam_ss_format_11 = B100;   

cam_data_offset    = 2;      
cam_data_offset_10 = 0;     
cam_data_offset_11 = 0;       

cam_vf_sync = 5;
cam_ss_sync = 5;

cam_post_processing_20 = 1;   
cam_post_processing_25 = 1;   
cam_post_processing_26 = 1;   
cam_post_processing_29 = 1;  

cam_ss_jpeg_buf_size_1 = 25800;  
cam_ss_jpeg_buf_size_2 = 64000;  
cam_ss_jpeg_buf_size_4 = 96000;  
cam_ss_jpeg_buf_size_5 = E1000;  
cam_ss_jpeg_buf_size_6 = 271000; 


// Supported sizes
//================================================

sup_sizes = 1[280,1E0,0],2[500,3C0,0],4[660,4C8,0],5[800,600,0],         
  6[A20,798,0],10[140,F0,0],11[280,1E0,0],20[140,F0,BB8],       
  21[140,F0,5DC],25[60,80,4B0],26[90,B0,4B0],29[90,B0,3E8],       
  2a[140,F0,BB8],2b[160,120,5DC],2c[160,120,5DC],2f[140,F0,BB8];  

// Supported properties
//===================================================================

sup_properties = 
  0[3,f,9],1[0,4,0],2[0,3,0],3[0,1,0],4[0,1,0],5[0,1,0],6[A,A0,A],7[0,1,0],     
  8[0,4,0],9[0,1,0],A[0,2,0],B[0,0,0],C[0,0,0],E[0,4,0],10[0,7,0],       
  11[0,4,0],12[0,1,0],16[0,1,0],17[0,0,0],18[0,1,0],    
  19[0,2,0],1A[0,0,0],1B[0,9,0],1C[0,3,0],    
  1D[0,4,0],1E[0,1,0];      

// I2C sequences
//================================================

seq_init =                      
  $sf 00                        
  $sf.05 1                        
  $sf.02 1                           
  $s8 00                         
  $sa 09                          
  $sc 00                          
  $se 00                        
  $sd 00                          
  $s7 00
  $sk 00
  #CAPTURE_EVENT                  
  #CAPTURE_EVENT                  
  #SET_REG(29,01)                 
  #SET_REG(3B,02) #SET_REG(3A,BC)  
  #SET_REG(6B,06)                 
  #SET_REG(6C,00)               
  #SET_REG(6F,3C)                
  #SET_REG(70,1E)                  
  #COM_EVENT(54,00)              
  #COM_EVENT(55,00)               
  #COM_EVENT(56,00)               
  #SET_REG(64,1D)
  #SET_REG(22,0A)
  #SET_REG(95,04)                 
  #WB_ISO200                     
  #FLASH_LIMIT_ISO200
  #COM_EVENT(5A,01)               
  ;

seq_ping = ;

//-------------------------------------------------->
seq_set_prop_0 = 
  #CAMERA_MANAGER;

seq_get_prop_0 =
  $s3 00 $s2 00 $s1 00
  $m0 a;

seq_set_prop_1 =
  #TO_DRAFT
  $s5 %0 $m7 5 
  $-5 00 $+5 02
  #COM_EVENT(11,$w5);

seq_get_prop_1 =
  $s3 00 $s2 00 $s1 00
  $m0 7;

seq_set_prop_2_0 = #COM_EVENT(21,01);   
seq_set_prop_2_1 = #COM_EVENT(21,02);  
seq_set_prop_2_2 = #COM_EVENT(21,03);  
seq_set_prop_2_3 = #COM_EVENT(21,00);   
seq_set_prop_3_0 = #COM_EVENT(52,00);   
seq_set_prop_3_1 = #COM_EVENT(52,0A);   
seq_set_prop_4_0 = #COM_EVENT(52,00);  
seq_set_prop_4_1 = #COM_EVENT(52,05);   
seq_set_prop_5_0 = $sf.05 1;    
seq_set_prop_5_1 = $sf.05 0;     

seq_set_prop_6 =                
  #TO_DRAFT
  $s4 %0  $ma 4 
  $*4 3C  $/4 96  
  $s5 44  $-5 r4  
  #SET_REG(67,3C)                
  #COM_EVENT(61,$w5);            

seq_get_prop_6 = 
  #TO_DRAFT
  #READ_REG(69)   
  $*4 96  $/4 3C  $s0 AA
  $-0 r4  $s1 00  $s2 00  $s3 00;


seq_set_prop_7 = ;
seq_set_prop_8_0 = $sk 00 #RESET_F;
seq_set_prop_8_1 = $sk 01; 
seq_set_prop_8_2 = $sk 02; 
seq_set_prop_8_3 = $sk 03; 
seq_set_prop_8_4 = $sk 04; 



seq_set_prop_9_0 =
  $sf.08 0
  #TO_DRAFT
  #SET_REG(6A,00);

seq_set_prop_9_1 = 
  $sf.08 1 
  #TO_DRAFT
  #SET_REG(6A,01); 
//-------------------------------------------------->
seq_set_prop_a_0 =             
  $cf.02 0                     
    #CHANGE_MODE(33,00)        
    $sf.02 1                   
    #COM_EVENT(43,00)         
    #COM_EVENT(5A,01)          
  $cx;

seq_set_prop_a_1 =            
  $sf.02 0                     
  #CHANGE_MODE(31,06);         

seq_set_prop_a_2 =             
  $sf.02 0                     
  #CHANGE_MODE(31,02);         

//-------------------------------------------------->
seq_get_prop_a =     
  05 01 00 03 03 $f   
  $r4 1 123 $d0005    
  $c3 e9              
    $b2 00 4 1        
    $c2 00
      $"CAMDRIVER0: Focus_operation_succeded"
      $s0 04 
   $ck 00
   $p5 10
   $c5 04                                              
   $cf.06 1                                         
    #SEND_COMMAND(72,00)
    #READ_REG(71)                                
    $"CAMDRIVER0: Lens_position_=_%4"
    $cs4 1C                                      
     #SET_REG(95,04)                         
     #WB_ISO200                              
     #FLASH_LIMIT_ISO200                     
    $cl                                      
     #SET_REG(95,01)                          
     #WB_ISO100                              
     #FLASH_LIMIT_ISO100                      
    $cx                                     
      $cx
  $cx
  $cx
    $cl
      $"CAMDRIVER0: Focus_operation_failed"
      $s0 05
   $ck 00
    $p5 10
    $c5 04
         #SET_REG(95,06)
   #WB_ISO400
         #FLASH_LIMIT_ISO400   
    $cx
   $cx
 $cx
    $"CAMDRIVER0: Received_and_cleared_Int_Source_%0_Event_Info_%2_Event_ID_%3"
    #SET_REG(06,03)                
  $cl
    $"CAMDRIVER0: Focus_operation_not_finnished"
    $s0 03         
  $cx         
  $s1 00  $s2 00  $s3 00;
//-------------------------------------------------->


seq_get_prop_b = 
  #COM_EVENT(72,00)        
  05 01 00 B0 04 $f        
  $r5 0 0 1 2 3 $d0002     
  ;

seq_get_prop_c =
  #COM_EVENT(72,00)        
  05 01 00 B4 02 $f       
 $r3 0 0 1 $d0002       
  $cf.06 1                
    $ce 00                 
      $s2 01               
    $cl                   
      $s2 00               
    $cx                    
  $cl                      
    $s2 00                 
  $cx                      
  #READ_REG(4A) $m3 4;      



seq_set_prop_e_0 =         
  $ck 04 
   $p5 10
   $c5 01
 #COM_EVENT(02,02)
   $cx
  $cx
  $sd 00                  
  #SET_REG(91,00)          
  $ck 00
 #RET
  $cx;

seq_set_prop_e_1 = $sd 01;

seq_set_prop_e_2 =         
  $ck 04
   $p5 10
   $c5 01
 #COM_EVENT(02,00)
   $cx
  $cx
  $sd 02                  
  #FLASH_SETTINGS;

seq_set_prop_e_3 =         
  $ck 04 
   $p5 10
   $c5 01
 #COM_EVENT(02,00)
   $cx
  $cx
  $sd 03                  
  #FLASH_SETTINGS;

seq_set_prop_e_4 = ;

//------------------------------------------>Customize Scenes:
//Now you "user" or "modder" can customize each scene as your taste, each scene is pre configured with all of the functions available for you to modify and adjust as desired.
//User if necessary change the values for each scene below:
seq_set_prop_10_0 =        //Normal
  $sa 09                  
  $ck 00
 #TO_DRAFT
 #SET_REG(64,1D)    // if necessary change the values shutter speed (64,XX), Reset default value =>(00)
 #SET_REG(22,0A)    // if necessary change the values fps DRAFT_MIN_FRMRATE 5 fps
 #COM_EVENT(54,00)  // if necessary change the values brigthness(54,XX), Reset default value =>(00)       
 #COM_EVENT(55,00)  // if necessary change the values contrast (55,XX), Reset default value =>(00)      
 #COM_EVENT(56,04)  // if necessary change the values sharpness (56,XX), Reset default value =>(00)
      //#COM_EVENT(57,00)  // if necessary change the values hue (57,XX), Reset default value =>(00)
      //#COM_EVENT(58,00)  // if necessary change the values colors saturation (58,XX), Reset default value =>(00)      
 #COM_EVENT(51,00)        
 #UPDATE_WB
 #UPDATE_PHOTO
 #SET_REG(95,04)  // if necessary change the values ISO Xenon Flash (95,xx) Set flash ISO to default 200 Reset default value =>(00)        
 #WB_ISO200       // if necessary change the values Colors Correction Xenon Flash #SET_REG(98,xx)#SET_REG(99,xx) Set Colors Correction Xenon Flash to default WB_ISO200=>#SET_REG(98,25) #SET_REG(99,73) Reset default value =>(00)        
 #COM_EVENT(02,00)        
 #UPDATE_ISO  
  $cl
 $ck 04
 
 $cx
  $cx
  #CHANGE_MODE(34,00)
  #COM_EVENT(5A,01)       
  $cf.00 1                 
    #CHANGE_MODE(35,00)    
  $cl                      
  $cx;   

seq_set_prop_10_1 =       //Portrait
  $sa 09                  
  $ck 00
 #TO_DRAFT
 #SET_REG(64,1D)          
 #SET_REG(22,0A)          
 #COM_EVENT(54,00)        
 #COM_EVENT(55,00)       
 #COM_EVENT(56,02)        
      //#COM_EVENT(57,00)
      //#COM_EVENT(58,00)
 #COM_EVENT(51,01)       
 #UPDATE_WB
 #SET_REG(95,01)         
 #WB_ISO100               
 #COM_EVENT(02,00)       
  $cl
 $ck 04
   
 $cx
  $cx  
  #CHANGE_MODE(34,00)
  #COM_EVENT(5A,01)        
  $cf.00 1                 
    #CHANGE_MODE(35,00)    
  $cl                      
  $cx;   
 
seq_set_prop_10_2 =    //Landscape    
  $sa 09
  $ck 00  
 #TO_DRAFT
 #SET_REG(64,23)
 #SET_REG(22,04)
 #COM_EVENT(54,00)        
 #COM_EVENT(55,00)        
 #COM_EVENT(56,01)
      //#COM_EVENT(57,00)
      //#COM_EVENT(58,00)        
 #COM_EVENT(51,06)        
 #UPDATE_WB
 #COM_EVENT(02,00)        
  $cl
 $ck 04
    
 $cx
  $cx   
  #CHANGE_MODE(34,00)
  #COM_EVENT(5A,01)        
  $cf.00 1                
    #CHANGE_MODE(35,00)   
  $cl                     
  $cx;

seq_set_prop_10_3 =       //Night
  $sa 09
  $ck 00
 #TO_DRAFT
    //#SET_REG(64,29)           
    #SET_REG(22,04)           
    #SET_REG(77,29)           
    #SET_REG(78,29)           
    #SET_REG(79,0F)           
    #SET_REG(7A,01)           
    #SET_REG(7B,29)           
    #SET_REG(7C,09)           
    #COM_EVENT(54,00)       
    #COM_EVENT(55,00)       
    #COM_EVENT(56,04)
  //#COM_EVENT(57,00)
  //#COM_EVENT(58,00)        
    #COM_EVENT(51,08)
    #SET_REG(61,04)    //ISO200
    #SET_REG(60,29)   // Shutter speed slow/fast 1s manual shutter speed 
    #COM_EVENT(02,02) // Shutter On (00 -> AE)        
    #UPDATE_WB
  $cl
 $ck 04
        $cx
$cx  
  #CHANGE_MODE(34,00)
  #COM_EVENT(5A,01)        
  $cf.00 1                 
    #CHANGE_MODE(35,00)    
  $cl                      
  $cx;

seq_set_prop_10_4 =        //Night portrait
  $sa 09
  $ck 00
 #TO_DRAFT
 #SET_REG(64,20)          
 #SET_REG(22,05)          
 #COM_EVENT(02,00)        
 #COM_EVENT(54,00)       
 #COM_EVENT(55,00)        
 #COM_EVENT(56,04)
      //#COM_EVENT(57,00)
      //#COM_EVENT(58,00)        
 #SET_REG(77,20)          
 #SET_REG(78,1A)          
 #SET_REG(79,46)          
 #SET_REG(7A,3C)          
 #SET_REG(7B,1A)          
 #SET_REG(7C,3C)          
 #COM_EVENT(51,08)       
    #UPDATE_WB
  $cl
 $ck 04
    
 $cx
  $cx     
  #CHANGE_MODE(34,00)
  #COM_EVENT(5A,01)       
  $cf.00 1                 
    #CHANGE_MODE(35,00)    
  $cl                      
  $cx;

seq_set_prop_10_5 =        //Beach & snow
  $sa 09
  $ck 00
 #TO_DRAFT
 #SET_REG(64,2C)          
 #SET_REG(22,01)         
 #COM_EVENT(02,00)       
 #COM_EVENT(54,00)        
 #COM_EVENT(55,00)        
 #COM_EVENT(56,04)
      //#COM_EVENT(57,00)
      //#COM_EVENT(58,00)        
 #COM_EVENT(51,02)        
 #UPDATE_WB
  $cl
 $ck 04
   
 $cx
  $cx   
  #CHANGE_MODE(34,00)
  #COM_EVENT(5A,01)        
  $cf.00 1                 
    #CHANGE_MODE(35,00)    
  $cl                      
  $cx;
       
seq_set_prop_10_6 =        // Sports
  $sa 09
  $ck 00
 #TO_DRAFT
 #SET_REG(64,0C)          
 #SET_REG(22,3C)         
 #COM_EVENT(02,00)        
 #COM_EVENT(54,00)        
 #COM_EVENT(55,00)        
 #COM_EVENT(56,06)
      //#COM_EVENT(57,00)
      //#COM_EVENT(58,00)        
 #COM_EVENT(51,05)        
 #UPDATE_WB
  $cl
 $ck 04
   
 $cx
  $cx  
  #CHANGE_MODE(34,00)
  #COM_EVENT(5A,01)        
  $cf.00 1                
    #CHANGE_MODE(35,00)    
  $cl                      
  $cx;   
   
seq_set_prop_10_7 =        //Document
  $sa 09                   
  $ck 00
 #TO_DRAFT
 #SET_REG(64,1D)          
 #SET_REG(22,0A)          
 #COM_EVENT(02,00)        
 #COM_EVENT(54,00)        
 #COM_EVENT(55,00)        
 #COM_EVENT(56,06)
      //#COM_EVENT(57,00)
      //#COM_EVENT(58,00)       
 #COM_EVENT(51,08)        
 #UPDATE_WB
 #DOC_MODE
  $cl
 $ck 04
    
 $cx
  $cx 
  #CHANGE_MODE(34,00)
  #COM_EVENT(5A,01)        
  $cf.00 1                 
    #CHANGE_MODE(35,00)   
  $cl                      
  $cx;

//------------------------------------------>Customize Scenes:


seq_set_prop_11_0 =     
  #TO_DRAFT
  $sc 00              
  $ck 00
 #SET_REG(95,04)       
 #COM_EVENT(02,00)     
  $cl
 $ck 04
      
    $cx
  $cx
  #FLASH_LIMIT_ISO200
  #COM_EVENT(5A,01)     
  #WB_ISO200;
  
seq_set_prop_11_1 =     
  #TO_DRAFT
  $sc 01                
  $ck 00 
 #SET_REG(61,01)      
 #SET_REG(95,01)       
 #COM_EVENT(02,04)     
  $cl
 $ck 04
      
    $cx
  $cx
  #FLASH_LIMIT_ISO100  
  #COM_EVENT(5A,01)     
  #WB_ISO100;
  
seq_set_prop_11_2 =     
  #TO_DRAFT
  $sc 04 
  $ck 00  
 #SET_REG(61,04)
 #SET_REG(95,04) 
 #COM_EVENT(02,04)
  $cl
 $ck 04
      
    $cx
  $cx
  #FLASH_LIMIT_ISO200
  #COM_EVENT(5A,01)     
  #WB_ISO200;
  
seq_set_prop_11_3 =    
  #TO_DRAFT
  $sc 07  
  $ck 00
 #SET_REG(61,07) 
 #SET_REG(95,07)
 #COM_EVENT(02,04)
  $cl
 $ck 04
      
    $cx
  $cx
  #FLASH_LIMIT_ISO400
  #COM_EVENT(5A,01)     
  #WB_ISO400;


seq_set_prop_12_0 =        // Restore framerate
  $"CAMDRIVER0: Restore framerate" 
  $sf.07 0                 // Set flag to "not in menu"
  $z5                      // Put res id in reg 5
  $c5 20                   // If res id 0x20
    $p6 10                 // Put scene value in reg 6
    $c6 03          
      #SET_REG(22,04)      // DRAFT_MIN_FRMRATE 2 fps
    $cl
      #SET_REG(22,0A)      // DRAFT_MIN_FRMRATE 5 fps
      #SET_REG(25,0A)      // HS_DRAFT_MIN_FRMRATE 5 fps
    $cx
    #SET_REG(21,3C)        // DRAFT_MAX_FRMRATE 30 fps
    #SET_REG(24,3C)        // HS_DRAFT_MAX_FRMRATE 30 fps      
  $cx
  $c5 2f                   // If res id 0x2f
    $p6 10                 // Put scene value in reg 6
    $c6 03          
      #SET_REG(22,02)      // DRAFT_MIN_FRMRATE 2 fps
    $cl
      #SET_REG(22,0A)      // DRAFT_MIN_FRMRATE 5 fps
      #SET_REG(25,0A)      // HS_DRAFT_MIN_FRMRATE 5 fps
    $cx
    #SET_REG(21,3C)        // DRAFT_MAX_FRMRATE 30 fps
    #SET_REG(24,3C)        // HS_DRAFT_MAX_FRMRATE 30 fps      
  $cx
  $c5 21                   // If res id 0x21
    #SET_REG(22,0A)        // DRAFT_MIN_FRMRATE 5 fps
    #SET_REG(25,0A)        // HS_DRAFT_MIN_FRMRATE 5 fps
    #SET_REG(21,3C)        // DRAFT_MAX_FRMRATE 30 fps
    #SET_REG(24,3C)        // HS_DRAFT_MAX_FRMRATE 30 fps      
  $cx
  $c5 25                   // If res id 0x25
    #SET_REG(22,18)        // DRAFT_MIN_FRMRATE 12 fps
    #SET_REG(25,18)        // HS_DRAFT_MIN_FRMRATE 12 fps
    #SET_REG(21,18)        // DRAFT_MAX_FRMRATE 12 fps
    #SET_REG(24,18)        // HS_DRAFT_MAX_FRMRATE 12 fps      
  $cx
  $c5 26                   // If res id 0x26
    #SET_REG(22,18)        // DRAFT_MIN_FRMRATE 12 fps
    #SET_REG(25,18)        // HS_DRAFT_MIN_FRMRATE 12 fps
    #SET_REG(21,18)        // DRAFT_MAX_FRMRATE 12 fps
    #SET_REG(24,18)        // HS_DRAFT_MAX_FRMRATE 12 fps      
  $cx
  $c5 29                   // If res id 0x29
    #SET_REG(22,14)        // DRAFT_MIN_FRMRATE 10 fps
    #SET_REG(25,14)        // HS_DRAFT_MIN_FRMRATE 10 fps
    #SET_REG(21,14)        // DRAFT_MAX_FRMRATE 10 fps
    #SET_REG(24,14)        // HS_DRAFT_MAX_FRMRATE 10 fps      
  $cx
  $c5 2a                   // If res id 0x2a
    #SET_REG(22,3B)        // DRAFT_MIN_FRMRATE 29.5 fps
    #SET_REG(25,3B)        // HS_DRAFT_MIN_FRMRATE 29.5 fps
    #SET_REG(21,3C)        // DRAFT_MAX_FRMRATE 30 fps
    #SET_REG(24,3C)        // HS_DRAFT_MAX_FRMRATE 30 fps      
  $cx
  $c5 2b                   // If res id 0x2b
    #SET_REG(22,1E)        // DRAFT_MIN_FRMRATE 15 fps
    #SET_REG(25,1E)        // HS_DRAFT_MIN_FRMRATE 15 fps
    #SET_REG(21,1E)        // DRAFT_MAX_FRMRATE 15 fps
    #SET_REG(24,1E)        // HS_DRAFT_MAX_FRMRATE 15 fps      
  $cx
  $c5 2c                   // If res id 0x2c
    #SET_REG(22,0F)        // DRAFT_MIN_FRMRATE 7,5 fps
    #SET_REG(25,0F)        // HS_DRAFT_MIN_FRMRATE 7,5 fps
    #SET_REG(21,0F)        // DRAFT_MAX_FRMRATE 7,5 fps
    #SET_REG(24,0F)        // HS_DRAFT_MAX_FRMRATE 7,5 fps      
  $cl $cx

  #CHANGE_MODE(34,00)
  #COM_EVENT(5A,01)          // FLASH_INFO = 1
  $cf.00 1                   // If imst mode
    #CHANGE_MODE(35,00)      // IS_DRAFT mode
    $cf.01 1                 // If (IS) HS mode 
      #CHANGE_MODE(38,00)    // Mode IS HS draft
    $cl 
    $cx 
  $cl                        // Not in IS
    $cf.01 1                 // If HS mode
      #CHANGE_MODE(37,00)    // Mode HS draft
    $cl 
    $cx  
  $cx;

seq_set_prop_12_1 =        // Decrease framerate
  $"CAMDRIVER0: Decrease framerate"
  $sf.07 1                 // Set flag to "menu" mode
  #SET_REG(22,36)          // DRAFT_MIN_FRMRATE 24 fps
  #SET_REG(25,36)          // HS_DRAFT_MIN_FRMRATE 24 fps
  #SET_REG(21,36)          // DRAFT_MAX_FRMRATE 24 fps
  #SET_REG(24,36)          // HS_DRAFT_MAX_FRMRATE 24 fps  
  #CHANGE_MODE(34,00);


seq_set_prop_16_0 = 
  $sf.09 0
  #TO_DRAFT
  #COM_EVENT(08,00);   // Multimode
seq_set_prop_16_1 = 
  $sf.09 1
  #TO_DRAFT
  #COM_EVENT(08,01);   // Spot



seq_get_prop_17 =        
  #READ_REG(93)          
  $-4 02 $m0 4     
  $cd 02                 
    $c0 01    
      $sf.06 1          
   $ck 00
  #FL_A
  $p5 10
  $c5 04
   #SET_REG(9E,16)
   #SET_REG(91,23) 
     $cl
   #SET_REG(9E,0E)
   #SET_REG(91,03)  
        $cx
   $cl
     $ck 04
   #SET_REG(9E,0E)
   #SET_REG(91,03)
  $cx
      $cx    
    $cl                 
   $ck 00
  #WB_CC
  $sf.06 0
     #SET_REG(91,00)
   $cl
   $sf.06 0
   #SET_REG(91,00)
   $cx
    $cx
  $cx

  $cd 03                
    $c0 01               
      $sf.06 1           
   $ck 04 
   #SET_REG(91,13)
   $cl
   #FL_R
   #SHUTTER_FLASH
   #SET_REG(91,13)
   $cx
    $cl                  
   $ck 04 
   #SET_REG(91,03)
   $cl
   #FL_A
   #SHUTTER_FLASH
   #SET_REG(91,03)
   $cx
    $cx
  $cx
  $s1 00 $s2 00 $s3 00;                             



seq_set_prop_18_0 =      
  #TO_DRAFT
  #CHANGE_MODE(34,00)    
  $sf.00 0  
  $cc 00                 
    #COM_EVENT(02,00)    
  $cl
    #COM_EVENT(02,04)   
    #SET_REG(61,$wc)     
  $cx
  #COM_EVENT(5A,01)     
  $c8 01                 
    #CHANGE_MODE(37,00)  
  $cl $cx
  ;
                 
seq_set_prop_18_1 =     
  #TO_DRAFT
  $sf.00 1     
  #COM_EVENT(02,00)      
  #CHANGE_MODE(35,00)    
  $c8 01              
    #CHANGE_MODE(38,00)  
  $cl $cx
  ;

seq_set_prop_19_0 =      
  #TO_DRAFT
  #COM_EVENT(61,84);
seq_set_prop_19_1 =     
  #TO_DRAFT
  #SET_REG(67,01)       
  #COM_EVENT(61,04);      
seq_set_prop_19_2 =     
  #TO_DRAFT
  #SET_REG(67,01)        
  #COM_EVENT(61,40);     

seq_get_prop_1a = 
  #TO_DRAFT
  #READ_REG(69)   // Get zoom level in percent 1-100
  $s0 63  $*0 40  $/0 r4  $-0 54
  $/0 0F  $s3 00  $s2 00 $s1 00;


seq_set_prop_1b = $se %0;        // 0 => Normal, Read out pict 1-9 in BestPic

seq_set_prop_1c_0 =     // 5M
  #SET_REG(2D,01)       // BURST_JPEG_IMAGE_SIZE = 5M
  #SET_REG(42,46)       // JPEG_INIT_QUALITY = 70d, 0x46
  $cf.05 1              // If normal
    #SET_REG(45,5A)     // JPEG_BURST_TARGET_RATE = 90d  850KB
  $cl                   // Else low compr
    #SET_REG(45,5F)     // JPEG_BURST_TARGET_RATE = 95d = 897KB
  $cx;

seq_set_prop_1c_1 =     // 3M
  #SET_REG(2D,03)       // BURST_JPEG_IMAGE_SIZE = 3M   
  #SET_REG(42,40)       // JPEG_INIT_QUALITY = 64d, 0x40
  $cf.05 1              // If normal
    #SET_REG(45,40)     // JPEG_BURST_TARGET_RATE = 64d 605 KB
  $cl                   // Else low compr
    #SET_REG(45,46)     // JPEG_BURST_TARGET_RATE = 70d 662 KB
  $cx;

seq_set_prop_1c_2 =     // 1M
  #SET_REG(2D,06)       // BURST_JPEG_IMAGE_SIZE = SXGA  
  #SET_REG(42,32)       // JPEG_INIT_QUALITY = 50d, 0x32
  $cf.05 1              // If normal
    #SET_REG(45,14)     // JPEG_BURST_TARGET_RATE = 20d 189KB
  $cl                   // Else low compr
    #SET_REG(45,1E)     // JPEG_BURST_TARGET_RATE = 30d 283KB   
  $cx;

seq_set_prop_1c_3 =     // VGA
  #SET_REG(2D,08)       // BURST_JPEG_IMAGE_SIZE = VGA 
  #SET_REG(42,20)       // JPEG_INIT_QUALITY = 32d, 0x20
  $cf.05 1              // If normal
    #SET_REG(45,05)     // JPEG_BURST_TARGET_RATE = 5d 43KB      
  $cl                   // Else low compr
    #SET_REG(45,0A)     // JPEG_BURST_TARGET_RATE = 10d 95KB 
  $cx;


seq_set_prop_1d_0 =     
  $sb 00;

seq_set_prop_1d_1 =    
  $sb 01;
   
seq_set_prop_1d_2 =     n      
  $sb 02;

seq_set_prop_1d_3 =     // Start Burst (only for ITP)
  #CHANGE_MODE(31,02)   // Half-release with focus set to inf
  #CHANGE_MODE(39,04)
  ;

seq_set_prop_1d_4 =     
  #COM_EVENT(3A,00)     
  ;



seq_set_prop_1e_0 = 
  $go 31 0             
  $d0020
  $go 31 1           
  #CAPTURE_EVENT       
  #CAPTURE_EVENT       
  #SET_REG(29,01)      
  #SET_REG(2B,01)        
  ;

seq_set_prop_1e_1 =    
  #SET_REG(81,01) 
  03 55 AA $f $r2 01 $d0003   
  08 04 70 30 00 05 01 00 $f $r3 001 $d0003
  ;



seq_ss_config_1 =
  $sf.03 1             // JPEG flag to 1
  #SET_REG(26,08)      // 640 x 480 JPEG and JPEG IMST
  $cf.05 1                // If normal compression
     $"CAMDRIVER0: VGA NORMAL COMPRESSION"
     0D 02 00 3C          // Start sending 13 bytes at adress 3C
     96 00                // JPEG_MAX_CODE_SIZE    = 150d   
     0A 00                // JPEG_MIN_CODE_SIZE    =  10d
     37 00                // JPEG_TARGET_CODE_SIZE =  55d
     46                   // JPEG_INIT_QUALITY     =  70d
     3C                   // JPEG_FIRST_QUALITY    =  60d
     32                   // JPEG_LAST_QUALITY     =  50d
     $f $ra 1111111111 $d0002
  $cl                     // Else low compression
     $"CAMDRIVER0: VGA LOW COMPRESSION"
     0D 02 00 3C          // Start sending 13 bytes at adress 3C
     96 00                // JPEG_MAX_CODE_SIZE    = 150d   
     32 00                // JPEG_MIN_CODE_SIZE    =  50d
     50 00                // JPEG_TARGET_CODE_SIZE =  80d
     50                   // JPEG_INIT_QUALITY     =  80d
     46                   // JPEG_FIRST_QUALITY    =  70d
     3C                   // JPEG_LAST_QUALITY     =  60d    
     $f $ra 1111111111 $d0002
  $cx;

seq_ss_config_2 =
  $sf.03 1             // JPEG flag to 1
  #SET_REG(26,06)      // 1280 x 960 JPEG and JPEG IMST
  $cf.05 1               // If normal compression
    $"CAMDRIVER0: 1M NORMAL COMPRESSION"
    0D 02 00 3C          // Start sending 13 bytes at adress 3C
    90 01               // JPEG_MAX_CODE_SIZE    = 400d   
    3C 00               // JPEG_MIN_CODE_SIZE    =  60d
    C8 00                // JPEG_TARGET_CODE_SIZE = 200d
    46                   // JPEG_INIT_QUALITY     =  70d
    3C                   // JPEG_FIRST_QUALITY    =  60d
    32                   // JPEG_LAST_QUALITY     =  50d
    $f $ra 1111111111 $d0002
  $cl                    // Else low compression
    $"CAMDRIVER0: 1M LOW COMPRESSION"
    0D 02 00 3C          // Start sending 13 bytes at adress 3C
    90 01               // JPEG_MAX_CODE_SIZE    = 400d   
    64 00               // JPEG_MIN_CODE_SIZE    = 100d
    2C 01                // JPEG_TARGET_CODE_SIZE = 300d
    50                   // JPEG_INIT_QUALITY     =  80d
    46                   // JPEG_FIRST_QUALITY    =  70d
    3C                   // JPEG_LAST_QUALITY     =  60d    
    $f $ra 1111111111 $d0002 
  $cx;

seq_ss_config_4 =
  $sf.03 1             // JPEG flag to 1
  #SET_REG(26,05)      // 1632 x 1224 JPEG and JPEG IMST 
  $cf.05 1               // If normal compression
    $"CAMDRIVER0: 2M NORMAL COMPRESSION"
    0D 02 00 3C          // Start sending 13 bytes at adress 3C
    58 02               // JPEG_MAX_CODE_SIZE    = 600d   
    96 00               // JPEG_MIN_CODE_SIZE    = 150d
    90 01                // JPEG_TARGET_CODE_SIZE = 400d
    46                   // JPEG_INIT_QUALITY     =  70d
    3C                   // JPEG_FIRST_QUALITY    =  60d
    32                   // JPEG_LAST_QUALITY     =  50d
    $f $ra 1111111111 $d0002
  $cl                    // Else low compression
    $"CAMDRIVER0: 2M LOW COMPRESSION"
    0D 02 00 3C          // Start sending 13 bytes at adress 3C
    58 02               // JPEG_MAX_CODE_SIZE    = 600d   
    90 01               // JPEG_MIN_CODE_SIZE    = 400d
    F4 01                // JPEG_TARGET_CODE_SIZE = 500d
    50                   // JPEG_INIT_QUALITY     =  80d
    46                   // JPEG_FIRST_QUALITY    =  70d
    3C                   // JPEG_LAST_QUALITY     =  60d    
    $f $ra 1111111111 $d0002
  $cx;

seq_ss_config_5 =
  $sf.03 1             // JPEG output
  #SET_REG(26,03)      // 2048 x 1536 JPEG and JPEG IMST 
  $cf.05 1                // If normal compression
     $"CAMDRIVER0: 3M NORMAL COMPRESSION"
     0D 02 00 3C          // Start sending 13 bytes at adress 3C
     20 03                // JPEG_MAX_CODE_SIZE    = 800d   
     90 01                // JPEG_MIN_CODE_SIZE    = 400d
     58 02                // JPEG_TARGET_CODE_SIZE = 600d
     46                   // JPEG_INIT_QUALITY     =  70d
     3C                   // JPEG_FIRST_QUALITY    =  60d
     32                   // JPEG_LAST_QUALITY     =  50d
     $f $ra 1111111111 $d0002
  $cl                     // Else low compression
     $"CAMDRIVER0: 3M LOW COMPRESSION"
     0D 02 00 3C          // Start sending 13 bytes at adress 3C
     84 03                // JPEG_MAX_CODE_SIZE    = 900d   
     58 02                // JPEG_MIN_CODE_SIZE    = 600d
     52 03                // JPEG_TARGET_CODE_SIZE = 850d
     50                   // JPEG_INIT_QUALITY     =  80d
     46                   // JPEG_FIRST_QUALITY    =  70d
     3C                   // JPEG_LAST_QUALITY     =  60d    
     $f $ra 1111111111 $d0002
  $cx;

seq_ss_config_6 =
  $sf.03 1             // JPEG output
  #SET_REG(26,01)      // 2592 x 1944 JPEG and JPEG IMST 
  $cf.05 1             // If normal compression
    $"CAMDRIVER0: 5M NORMAL COMPRESSION" 
    0D 02 00 3C        // Start sending 13 bytes at adress 3C
    46 05              // JPEG_MAX_CODE_SIZE    = 1350d   
    9E 02              // JPEG_MIN_CODE_SIZE    =  670d
    E8 03              // JPEG_TARGET_CODE_SIZE = 1000d
    46                 // JPEG_INIT_QUALITY     =  70d
    3C                 // JPEG_FIRST_QUALITY    =  60d
    32                 // JPEG_LAST_QUALITY     =  50d
    $f $ra 1111111111 $d0002
  $cl                  // Else low compression
    $"CAMDRIVER0: 5M LOW COMPRESSION"
    0D 02 00 3C        // Start sending 13 bytes at adress 3C
    DC 05              // JPEG_MAX_CODE_SIZE    = 1500d   
    B0 04              // JPEG_MIN_CODE_SIZE    = 1200d
    78 05              // JPEG_TARGET_CODE_SIZE = 1400d
    50                 // JPEG_INIT_QUALITY     =  80d
    46                 // JPEG_FIRST_QUALITY    =  70d
    3C                 // JPEG_LAST_QUALITY     =  60d    
    $f $ra 1111111111 $d0002
  $cx;

seq_ss_config_10 =
  $sf.03 0             
  #SET_REG(26,0C)      
  ;

seq_ss_config_11 =
  $sf.03 0             
  #SET_REG(26,08)      
  ;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              

seq_vf_config_20 =     
  #SET_REG(20,0C)      
  $cf.07 1             
                      
  $cl
    #SET_REG(21,3C)    
  $cx
  #UPDATE_MIN_FRMRATE
  $s8 00              
  ;

seq_vf_config_21 =     
  #SET_REG(20,0C)      
  $cf.07 1             
                      
  $cl
   #SET_REG(21,1E)    
  $cx
  #UPDATE_MIN_FRMRATE
  $s8 00                 
  ;

seq_vf_config_25 =    
  #SET_REG(20,14)      
  #SET_REG(23,14)      
  $cf.07 1             
                      
  $cl
    #SET_REG(22,14)    
    #SET_REG(25,14)      
    #SET_REG(21,14)   
    #SET_REG(24,14)    
  $cx
  $s8 00               
  ;

seq_vf_config_26 =     
  #SET_REG(20,12)      
  #SET_REG(23,12)      
  $cf.07 1             
                      
  $cl
    #SET_REG(22,18)   
    #SET_REG(25,18)       
    #SET_REG(21,18)    
    #SET_REG(24,18)      
  $cx
  $s8 00               
  ;

seq_vf_config_29 =    
  #SET_REG(20,12)      
  #SET_REG(23,12)      
  $cf.07 1             
                     
  $cl
    #SET_REG(22,14)    
    #SET_REG(25,14)        
    #SET_REG(21,14)    
    #SET_REG(24,14)     
  $cx
  $s8 01               
$c3 e9              
  #CHANGE_MODE(31,06)          
  $cf.02 0                     
$cx
   $cl
  $cf.02 1                     
  #COM_EVENT(43,00)          
  #COM_EVENT(5A,01)          
  #RESET_V $cx$cx;

seq_vf_config_2a =     
  #SET_REG(20,0C)     
  #SET_REG(23,0C)      
  $cf.07 1             
                     
  $cl
    #SET_REG(22,3B)    
    #SET_REG(25,3B)        
    #SET_REG(24,3C)      
    #SET_REG(21,3C)    
 $cx
  $s8 01
$c3 e9              
  #CHANGE_MODE(31,06)          
  $cf.02 0                     
$cx
   $cl
  $cf.02 1                     
  #COM_EVENT(43,00)          
  #COM_EVENT(5A,01)          
  #RESET_V $cx$cx;

seq_vf_config_2b =     
  #SET_REG(20,0B)      
  #SET_REG(23,0B)      
  $cf.07 1             
                      
  $cl
    #SET_REG(22,3C)    
    #SET_REG(25,3C)        
    #SET_REG(21,3C)    
    #SET_REG(24,3C)     
  $cx
  $s8 01
$c3 e9              
  #CHANGE_MODE(31,06)          
  $cf.02 0                     
$cx
   $cl
  $cf.02 1                     
  #COM_EVENT(43,00)          
  #COM_EVENT(5A,01)          
  #RESET_V $cx$cx;

seq_vf_config_2c =    
  #SET_REG(20,0B)      
  #SET_REG(23,0B)     
  $cf.07 1            
                    
  $cl
    #SET_REG(22,3C)   
    #SET_REG(25,3C)   
    #SET_REG(21,3C)    
    #SET_REG(24,3C)     
  $cx 
  $s8 01
$c3 e9              
  #CHANGE_MODE(31,06)          
  $cf.02 0                     
$cx
   $cl
  $cf.02 1                     
  #COM_EVENT(43,00)          
  #COM_EVENT(5A,01)          
  #RESET_V $cx$cx;

seq_vf_config_2f =     
  #SET_REG(20,0C)      
  $cf.07 1            
                      
  $cl
    #SET_REG(21,3C)    
  $cx
  #UPDATE_MIN_FRMRATE
  $s8 00;              


//-----------------------------------------------

seq_vf_start = 
  $cf.02 0                    // If not in any draft mode 
    #CHANGE_MODE(33,00)        // MODE_MAIN
    #COM_EVENT(43,00)          // MANUAL_FOCUS = 00, Infinity    
    #COM_EVENT(5A,01)          // FLASH_INFO = 1
    $sf.02 1                   // Set draft flag to 1
    $se 00                     // Set snapshot operation to normal     
  $cl
    #CHANGE_MODE(34,00)
    #COM_EVENT(5A,01)          // FLASH_INFO = 1
    $cf.00 1                   // If imst mode
      #CHANGE_MODE(35,00)      // IS_DRAFT mode
      $c8 01                   // If (IS) HS video mode 
        #CHANGE_MODE(38,00)    // Mode IS HS draft
      $cl $cx 
    $cl                        // Not in IS
      $c8 01                   // If HS video mode
        #CHANGE_MODE(37,00)    // Mode HS draft
      $cl $cx  
    $cx       
  $cx     
  ;

seq_vf_stop = ; 

seq_ss_start =
  $cf.02 1                       // If draft mode?
    #CHANGE_MODE(31,02)          // Half-release with focus set to inf
    $sf.02 0                     // Not in draft mode
  $cl
  $cx   
  ;

seq_ss_take = 
  $ce 00                         // If not BestPic
    $cf.03 1                     // IF JPEG 
      #CHANGE_MODE(36,80)        // MODE_IMST_STILL_CAPT, JPEG
      #CAPTURE_EVENT             // EV_CAPTURE_STATUS, 02 e4
    $cl                          // Else IMST OFF       
      #CHANGE_MODE(36,00)        // MODE_STILL_CAPT, YCbCr
    $cx 
  $cl                            // Else BestPic mode
    #CHANGE_MODE(3A,$we)         // Read out pict # stored in reg e
  $cx  
  #CAPTURE_EVENT                 // Capture EV_CAPTURE_STATUS, 00 E4
  ;     

seq_ss_verify = #CAPTURE_EVENT   // Capture EV_CAPTURE_STATUS, 01 E4
  $c2 01
    $s0 01
    $"CAMDRVIER0: Image_verified"
  $cl            
    $"CAMDRIVER0: Image_not_verified"
  $cx
  ;

seq_ss_stop = ;

// Functions for synchronized viewfinder images in burst mode. 

seq_pv_start =
  $cf.02 1                       // If draft mode?
    #CHANGE_MODE(31,02)          // Half-release with focus set to inf
    $sf.02 0                     // Not in draft mode
  $cl
  $cx  
  $"CAMDRIVER0: seq_pv_start"
  $s9 00                        // BurstStatus -> Init
  $cb 00                        // If normal interval    
    #CHANGE_MODE(39,04)         // Mode burst start, BURST_INTERVAL = 0, BURST_REMAIN = 4
  $cl                           // Else half speed, every 2nd frame 
    #CHANGE_MODE(39,14)         // Mode burst start, BURST_INTERVAL = 1, BURST_REMAIN = 4
  $cx;

seq_pv_stop =
  $c9 01
    $"CAMDRIVER0: seq_pv_stop"
    $s9 03                      // BurstStatus -> BurstOutput
    #COM_EVENT(3A,00)           // Take picture
  $cl
    $"CAMDRIVER0: seq_pv_stop is waiting for EV_RECORD_STATUS"
    $s9 02                      // BurstStatus -> WaitForEV_RECORD_STATUS
  $cx;

seq_pv_verify = 
  $h0 02 5 0000                 // Wait for TRIG  
  05 01 00 03 03 $f $r4 0 012   // [source, info, id]
  05 02 00 06 03 $f             // Release interrupt
  $cb 02                        // If Burst operation  = abort? 
    $s0 ff                      // Abort!
  $cl 
    $s0 00
    $c2 e3
      $b1 00 4 4
      $c1 00
        $s0 01                  // Rotate, i.e synch vf-image
        $"CAMDRIVER0: Rotate, synch vf"
      $cl
        $"CAMDRIVER0: Compr_failed_%0_%1_%2"
      $cx
    $cl 
    $cx
    $c2 ea                      // If EVENT_MODE_CHANGED
      $c1 50  
        $s0 ff                  // Done (Burst output)
      $cl
      $cx
    $cl
    $cx
    $c2 ee                      // EV_RECORD_STATUS
      $c9 02
        $"CAMDRIVER0: EV_RECORD_STATUS(completed)"
        $"CAMDRIVER0: Change the mode to BurstOutput"
        $s9 03                  // BurstStatus -> BurstOutput
        #COM_EVENT(3A,00)       // Take picture
        $s0 00                  // Reset register 0 to 0
      $cl
        $"CAMDRIVER0: EV_RECORD_STATUS(completed)"
        $s9 01                  // BurstStatus -> ReadyForBurstOutput
      $cx
    $cl
    $cx
  $cx;



jpeg_qtable_selector_0 = 
      $s2 00 #READ_REG(4A)    // JPEG_HOST_QUALITY
      $m0 4 $s1 00
   $"CAMDRIVER0: qtable0=%0"
      ;   

jpeg_qtable_selector_1 = 
      $s2 01 #READ_REG(4A)    // JPEG_HOST_QUALITY 
      $m0 4 $s1 00
      $"CAMDRIVER0: qtable1=%0"
      ;

jpeg_qtable_0 =
      10 0B 0C 0E 0C 0A 10 0E 
      0D 0E 12 11 10 13 18 28 
      1A 18 16 16 18 31 23 25 
      1D 28 3A 33 3D 3C 39 33 
      38 37 40 48 5C 4E 40 44 
      57 45 37 38 50 6D 51 57 
      5F 62 67 68 67 3E 4D 71
      79 70 64 78 5C 65 67 63
      ;

jpeg_qtable_1 = 
      11 12 12 18 15 18 2F 1A 
      1A 2F 63 42 38 42 63 63 
      63 63 63 63 63 63 63 63 
      63 63 63 63 63 63 63 63 
      63 63 63 63 63 63 63 63 
      63 63 63 63 63 63 63 63 
      63 63 63 63 63 63 63 63 
      63 63 63 63 63 63 63 63
      ; 
                        
jpeg_qtable_factors = 
      0,320100,190000,10AB00,C8000,A0000,85500,72500,64000,58E00,50000,
      48C00,42B00,3D900,39200,35500,32000,2F100,2C700,2A200,28000,
      26200,24600,22D00,21500,20000,1EC00,1DA00,1C900,1B900,1AB00,
      19D00,19000,18400,17800,16E00,16400,15A00,15100,14800,14000,
      13800,13100,12A00,12300,11C00,11600,11000,10B00,10500,10000,
       FB00, F600, F100, EC00, E600, E100, DC00,D700,D200,CD00,
       C800, C300, BD00, B800, B300, AE00, A900,A400,9F00,9A00,
       9400, 8F00, 8A00, 8500, 8000, 7B00, 7600,7100,6C00,6600,
       6100, 5C00, 5700, 5200, 4D00, 4800, 4300,3D00,3800,3300,
       2E00, 2900, 2400, 1F00, 1A00, 1400,  F00, A00, 500, 100
      ;

jpeg_header= FF D8
             FF E0 00 10 4A 46 49 46 00 01 01 00 00 01 00 01 00 00
             FF DB 00 84 00 $qt0  01 $qt1                             
             FF C4 01 A2 00 00 01 05 01 01 01 01 01 01 00 00 00 00 00 00 00 
                            00 01 02 03 04 05 06 07 08 09 0A 0B
                         01 00 03 01 01 01 01 01 01 01 01 01 00 00 00 00 00 
                            00 01 02 03 04 05 06 07 08 09 0A 0B
                         10 00 02 01 03 03 02 04 03 05 05 04 04 00 00 01 7D
                            01 02 03 00 04 11 05 12 21 31 41 06 13 51 61 07 
                            22 71 14 32 81 91 a1 08 23 42 b1 c1 15 52 d1 f0 
                            24 33 62 72 82 09 0a 16 17 18 19 1a 25 26 27 28 
                            29 2a 34 35 36 37 38 39 3a 43 44 45 46 47 48 49 
                            4a 53 54 55 56 57 58 59 5a 63 64 65 66 67 68 69 
                            6a 73 74 75 76 77 78 79 7a 83 84 85 86 87 88 89 
                            8a 92 93 94 95 96 97 98 99 9a a2 a3 a4 a5 a6 a7 
                            a8 a9 aa b2 b3 b4 b5 b6 b7 b8 b9 ba c2 c3 c4 c5 
                            c6 c7 c8 c9 ca d2 d3 d4 d5 d6 d7 d8 d9 da e1 e2
                            e3 e4 e5 e6 e7 e8 e9 ea f1 f2 f3 f4 f5 f6 f7 f8 
                            f9 fa
                         11 00 02 01 02 04 04 03 04 07 05 04 04 00 01 02 77
                            00 01 02 03 11 04 05 21 31 06 12 41 51 07 61 71 
                            13 22 32 81 08 14 42 91 a1 b1 c1 09 23 33 52 f0 
                            15 62 72 d1 0a 16 24 34 e1 25 f1 17 18 19 1a 26 
                            27 28 29 2a 35 36 37 38 39 3a 43 44 45 46 47 48 
                            49 4a 53 54 55 56 57 58 59 5a 63 64 65 66 67 68 
                            69 6a 73 74 75 76 77 78 79 7a 82 83 84 85 86 87 
                            88 89 8a 92 93 94 95 96 97 98 99 9a a2 a3 a4 a5 
                            a6 a7 a8 a9 aa b2 b3 b4 b5 b6 b7 b8 b9 ba c2 c3 
                            c4 c5 c6 c7 c8 c9 ca d2 d3 d4 d5 d6 d7 d8 d9 da
                            e2 e3 e4 e5 e6 e7 e8 e9 ea f2 f3 f4 f5 f6 f7 f8 
                            f9 fa             
             FF DD 00 04 00 00 
             FF C0 00 11 08 $h $w 03 01 21 00 02 11 01 03 11 01
             FF DA 00 0C 03 01 00 02 11 03 11 00 3F 00;


//Dear user and modder, your changes in this code will be useless so
//don't touch anything and don't edit anything below.
//
//   ########                    #####
//  ###########              ####     ##
//   ###########           ###        # 
//   #############        ##            
//   ##############     ##              
//   ###############   ##               
//    ############### ##                
//     ################                 
//         #        ############        
//      #           ###############     
//     #           #################    
//     #          ##################    
//     ##         ##  ##############    
//      #  ©2010 ##    ###BZK«™#####    
//       ##  #  ##      ##########      
//         #####          ######
// Sony Ericsson CameraDrivers BrAzzUkA's BZK«
//
//The information and codes published in camdrivers are available to any modders and user, 
//but may not necessarily be copied, downloaded or reused without credit to the developers.
//Thanks

// Platform registers Camera Manager Settings™
//========================================================= 
// r0, Used in CLEAR_EVENT_FIFO, POLL_EVENT_ID,jpeg_qtable_selector WAIT_FOR_TRIG
// r1, Used in SET_REG,CLEAR_EVENT SEND_COMMAND,jpeg_qtable_selector
// r2, Used in CLEAR_EVENT (Event info stored),CLEAR_EVENT_FIFO, POLL_EVENT_ID,jpeg_qtable_selector
// r3, Used in CLEAR_EVENT (Event id stored),CLEAR_EVENT_FIFO,POLL_EVENT_ID, 
// r4, Used in READ_REG (value stored)Property 6 
// r5, Used in Property 6 Property 23UPDATE_MIN_FRMRATE UPDATE_ISOUPDATE_PHOTO UPDATE_WB Property 10
// r6, Used to Camera Manager SettingsÖ
// r7, Used to remember WB
// r8, Used as a flag for HS video
// r9, 0:Init  1:ReadyForBurstOutput  2:WaitForEV_RECORD_STATUS  3:BurstOutput
// ra, Used to remember EV value
// rb, Used in Property 29, BestPic operation seq_pv_verify
// rc, Used to remember ISO setting since one has to change AE_MODE to "auto" for IS.
// rd, Used to remember Xenon flash mode (property 14)
// re, Used for picture readout, 0 => normal, burst 1 => read out pict 1 ...
// rf, Used as 32 flags:
//                  b0, Image stabilization, 1 = ON,     0 = OFF
//                  b1, High sensitivity,       1 = ON,     0 = OFF
//                  b2, Any draft mode,         1 = YES,    0 = NO  
//                  b3, Snapshot format,        1 = JPEG,   0 = YCbCr
//                  b4, Xenon flash needed,     1 = Yes,    0 = NO (Not Implemented)
//                  b5, JPEG compression        1 = Normal, 0 = Low compression
//                  b6, Flash was used          1 = True,   0 = False
//                  b7, Menu mode(low frrate)   1 = True,   0 = False
//      b8, Focus   1 = Macro,  0 = Normal
//      b9, Photometry  1 = Spot,   0 = Normal
//      ba, Manual Shutter  1 = Used,   0 = Not Used
//  rg, Not functional don't work for k850 model
//  rh, Used to remember Manual Brightness for Camera Manager Settings™
//  ri, Used to remember Manual Shutter Speed for Camera Manager Settings™
//  rj, Used to remember Manual Filters for Camera Manager Settings™
//  rk, Used to remember Manual Effects for Camera Manager Settings™
//  rl, Not functional don't work for k850 model
//  rm, Used to remember Manual ISO for Camera Manager Settings™
//  rn, Used to remember Manual Focus for Camera Manager Settings™
//  ro, Used to remember Manual Saturation for Camera Manager Settings™
//  rp, Used to remember Manual Hue for Camera Manager Settings™
//  rq, Used to remember Manual Sharpness for Camera Manager Settings™
//  rr, Used to remember Manual Contrast for Camera Manager Settings™
//  s, Not functional don't work for k850 model

//Visit the website: http://www.esato.com/board/viewtopic.php?topic=189996