Index: /branches/release-1_0/platform/a420/kbd.c
===================================================================
--- /branches/release-1_0/platform/a420/kbd.c	(revision 1734)
+++ /branches/release-1_0/platform/a420/kbd.c	(revision 1734)
@@ -0,0 +1,33 @@
+#include "../generic/kbd.c"
+
+
+
+static KeyMap keymap[] = {
+    /* tiny bug: key order matters. see kbd_get_pressed_key()
+     * for example
+     */
+    { KEY_UP        , 0x00000001 }, // KEY_UP/KEY_ZOOM_IN 
+    { KEY_DOWN      , 0x00000002 }, // KEY_DOWN/KEY_ZOOM_OUT/KEY_ERASE
+    { KEY_LEFT      , 0x00000008 },
+    { KEY_RIGHT     , 0x00000004 },
+    { KEY_SET       , 0x00000100 },
+    { KEY_SHOOT_FULL, 0x00000030 }, // note 3 here!
+    { KEY_SHOOT_FULL_ONLY , 0x00000020 },
+    { KEY_SHOOT_HALF, 0x00000010 },
+    { KEY_MENU      , 0x00000400 },
+    { KEY_DISPLAY   , 0x00000200 },
+    { KEY_PRINT     , 0x00001000 }, // KEY_DOWN/KEY_ZOOM_OUT/KEY_ERASE
+    { 0, 0 }
+};
+
+void kbd_fetch_data(long *dst)
+{
+    volatile long *mmio0 = (void*)0xc0220200;
+    volatile long *mmio1 = (void*)0xc0220204;
+    volatile long *mmio2 = (void*)0xc0220208;
+
+    dst[0] = *mmio0;
+    dst[1] = *mmio1;
+    dst[2] = *mmio2 & 0xffff;
+}
+
Index: /branches/release-1_0/platform/a420/platform_camera.h
===================================================================
--- /branches/release-1_0/platform/a420/platform_camera.h	(revision 1734)
+++ /branches/release-1_0/platform/a420/platform_camera.h	(revision 1734)
@@ -0,0 +1,61 @@
+// Camera - A420 - platform_camera.h
+
+// This file contains the various settings values specific to the A420 camera.
+// This file is referenced via the 'include/camera.h' file and should not be loaded directly.
+
+// If adding a new settings value put a suitable default in 'include/camera.h',
+// along with documentation on what the setting does and how to determine the correct value.
+// If the setting should not have a default value then add it in 'include/camera.h'
+// using the '#undef' directive along with appropriate documentation.
+
+// Override any default values with your camera specific values in this file. Try and avoid
+// having override values that are the same as the default value.
+
+// When overriding a setting value there are two cases:
+// 1. If removing the value, because it does not apply to your camera, use the '#undef' directive.
+// 2. If changing the value it is best to use an '#undef' directive to remove the default value
+//    followed by a '#define' to set the new value.
+
+// When porting CHDK to a new camera, check the documentation in 'include/camera.h'
+// for information on each setting. If the default values are correct for your camera then
+// don't override them again in here.
+
+	#define CAM_PROPSET					1
+
+	#define CAM_RAW_ROWPIX					2392  // for 4 MP 1/3" sensor size
+	#define CAM_RAW_ROWS					1752  // for 4 MP 1/3" sensor size
+
+	#undef  CAM_USE_ZOOM_FOR_MF
+	#undef  CAM_HAS_ZOOM_LEVER
+	#define CAM_DRAW_EXPOSITION				1
+	#undef  CAM_HAS_ERASE_BUTTON
+	#undef  CAM_HAS_IRIS_DIAPHRAGM
+	#define CAM_HAS_ND_FILTER				1
+	#undef  CAM_HAS_MANUAL_FOCUS
+	#undef  CAM_HAS_USER_TV_MODES
+	#define CAM_SHOW_OSD_IN_SHOOT_MENU		1
+	#undef  CAM_HAS_IS
+	#define CAM_AF_SCAN_DURING_VIDEO_RECORD		1
+	#define CAM_EV_IN_VIDEO				1
+	#define CAM_DNG_LENS_INFO	{ 54,10, 173,10, 28,10, 51,10 } // See comments in camera.h
+	// pattern
+	#define cam_CFAPattern 0x01000201  // Green Blue Red Green
+	// color
+	#define CAM_COLORMATRIX1                                \
+      479627,  1000000, -156240, 1000000,  -84926, 1000000, \
+     -215238,  1000000,  534902, 1000000,   60219, 1000000, \
+      -96906,  1000000,  148194, 1000000,  191583, 1000000
+
+	#define cam_CalibrationIlluminant1		1 // Daylight
+	// cropping
+	#define CAM_JPEG_WIDTH			2272
+	#define CAM_JPEG_HEIGHT			1704
+	#define CAM_ACTIVE_AREA_X1		0
+	#define CAM_ACTIVE_AREA_Y1		8
+	#define CAM_ACTIVE_AREA_X2		2336
+	#define CAM_ACTIVE_AREA_Y2		1748
+	// camera name
+	#define PARAM_CAMERA_NAME		3 // parameter number for GetParameterData
+	#define CAM_EXT_TV_RANGE		1
+//----------------------------------------------------------
+
Index: /branches/release-1_0/platform/a420/wrappers.c
===================================================================
--- /branches/release-1_0/platform/a420/wrappers.c	(revision 1734)
+++ /branches/release-1_0/platform/a420/wrappers.c	(revision 1734)
@@ -0,0 +1,16 @@
+#include "../generic/wrappers.c"
+
+long lens_get_focus_pos()
+{
+    return _GetFocusLensSubjectDistance();
+}
+
+long lens_get_focus_pos_from_lens()
+{
+    return _GetFocusLensSubjectDistanceFromLens();
+}
+
+long lens_get_target_distance()
+{
+    return _GetCurrentTargetDistance();
+}
Index: /branches/release-1_0/platform/a420/main.c
===================================================================
--- /branches/release-1_0/platform/a420/main.c	(revision 1734)
+++ /branches/release-1_0/platform/a420/main.c	(revision 1734)
@@ -0,0 +1,36 @@
+#include "../generic/main.c"
+
+long get_vbatt_min()
+{
+    return 2300;
+}
+
+long get_vbatt_max()
+{
+    return 2550;
+}
+
+static const int fl_tbl[] = {5400, 6800, 8100, 9800, 11800, 14400, 17300};
+#define NUM_FL (sizeof(fl_tbl)/sizeof(fl_tbl[0]))
+#define CF_EFL 70371
+
+const int zoom_points = NUM_FL;
+
+int get_effective_focal_length(int zp) {
+    return (CF_EFL*get_focal_length(zp))/10000;
+}
+
+int get_focal_length(int zp) {
+    if (zp<0) return fl_tbl[0];
+    else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1];
+    else return fl_tbl[zp];
+}
+
+int get_zoom_x(int zp) {
+    if (zp<1) return 10;
+    else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]*10/fl_tbl[0];
+    else return fl_tbl[zp]*10/fl_tbl[0];
+}
+
+
+#define MODESCNT (sizeof(modemap)/sizeof(modemap[0]))
Index: /branches/release-1_0/platform/a420/notes.txt
===================================================================
--- /branches/release-1_0/platform/a420/notes.txt	(revision 1734)
+++ /branches/release-1_0/platform/a420/notes.txt	(revision 1734)
@@ -0,0 +1,57 @@
+****************************************
+
+Camera depending notes: 
+
+- A420 uses Propset 1 of Properties (see http://tinyurl.com/6zbv9b)
+- The A420 does not have an iris diaphragm, it has a smaller snap-in aperture (not an ND filter)
+  Seen this in a dismantled A430 optics, suspect the same in at least the A410 - A430 models.
+  The CHDK controls this the same as an ND-filter.
+
+
+Changelog
+
+Beta 2, 2011-08-22
+- modemap is now correct
+- movie mode is now supported (quality override, zoom, af-scan, exposure override works, filesize can grow over 1GB)
+  crashes, when af-scan is attempted during 640x480 movie recording (no such problem in 320x240, 160x120 mode)
+  A430 also exhibits this problem
+- aperture table corrected
+- movie time limit lifted to 1 hour / recording in 320x240 and 640x480 modes
+- USB remote should work
+
+Beta 1, 2011-06-25
+
+- based on A430, thanks to the authors of that port
+- the loader part almost identical (changed one led address in an inactive function)
+- USB completely untested, don't know if it works or not, A430 stuff without change
+
+- sensor data the same as in A430 (probably the same sensor in the two models)
+- RAW/DNG works, RAW is only recognized by DNG4PS2
+- RAW/DNG file numbers work as expected (using hack from A530)
+- extra long exposures work (tested with 80sec), shutter speed override works
+- flash adjustment seems to work
+- zebra works
+- grids work
+- histogram works
+- manual focusing works, but barely usable (small display resolution)
+
+As the mechanical shutter and the "ND-filter" (see above) is broken in my camera, can't test their functionality.
+
+Bugs
+- AF-scan causes crash during 640x480 movie recording, works fine otherwise
+
+
+Camera specific CHDK behaviour:
+
+- enabling both "video quality control" and "enable optical zoom" in the "video parameters" submenu is not recommended
+  pressing the up/down buttons would zoom AND change compression quality at the same time
+
+
+LED ADDRESSES
+
+AF_LED		0xC0220080
+BLUE_LED	0xC0220084
+RED_LED		0xC0220088
+GREEN_LED	0xC022008C
+ORANGE_LED	0xC0220090
+
Index: /branches/release-1_0/platform/a420/lib.c
===================================================================
--- /branches/release-1_0/platform/a420/lib.c	(revision 1734)
+++ /branches/release-1_0/platform/a420/lib.c	(revision 1734)
@@ -0,0 +1,42 @@
+
+int get_flash_params_count(void){
+ return 108;
+}
+
+void shutdown()
+{
+    volatile long *p = (void*)0xc02200a0;
+        
+    asm(
+         "MRS     R1, CPSR\n"
+         "AND     R0, R1, #0x80\n"
+         "ORR     R1, R1, #0x80\n"
+         "MSR     CPSR_cf, R1\n"
+         :::"r1","r0");
+        
+    *p = 0x44;
+
+    while(1);
+}
+
+#define LED_PR 0xc0220084
+void debug_led(int state)
+{
+    volatile long *p=(void*)LED_PR;
+    if (state)
+        p[0]=0x46;
+    else
+        p[0]=0x44;
+}
+
+#define LED_AF 0xc0220080
+void __attribute__((weak)) camera_set_led(int led, int state, int bright)
+{
+  int leds[] = {12,16,4,8,4,0,4};
+  if(led < 4 || led > 10 || led == 6) return;
+  volatile long *p=(void*)LED_AF + leds[led-4];
+    if (state)
+        p[0]=0x46;
+    else
+        p[0]=0x44;
+}
Index: /branches/release-1_0/platform/a420/sub/100b/capt_seq.c
===================================================================
--- /branches/release-1_0/platform/a420/sub/100b/capt_seq.c	(revision 1734)
+++ /branches/release-1_0/platform/a420/sub/100b/capt_seq.c	(revision 1734)
@@ -0,0 +1,617 @@
+#include "lolevel.h"
+#include "platform.h"
+#include "core.h"
+
+static long *nrflag = (long*)0x5E64; //a420 @ffd29118
+
+#include "../../../generic/capt_seq.c"
+
+void __attribute__((naked,noinline)) sub_FFD290DC_my(long p)
+{
+  asm volatile (
+              "STMFD   SP!, {R4-R6,LR}\n"
+              "LDR     R3, =0x726D4\n"
+              "LDR     R5, =0x5E60\n"
+              "SUB     SP, SP, #4\n"
+              "LDR     R1, =0xFFFFFFFF\n"
+              "STR     R0, [R5]\n"
+              "LDR     R0, [R3]\n"
+              "BL      sub_FFC0FB48\n"
+              "LDR     R3, =0x9C780\n"
+              "LDR     R0, [R3,#0x74]\n"
+              "BL      sub_FFC87868\n"
+              "BL      sub_FFD2905C\n"
+             
+              "LDR     R3, =0x5E68\n"
+              "LDR     R0, [R3]\n"
+              "BL      sub_FFC87D14\n"
+            "BL      wait_until_remote_button_is_released\n" //+
+              "BL      capt_seq_hook_set_nr\n" //+
+              "B       sub_FFD29118\n"
+  );
+} // a420, ok
+
+void __attribute__((naked,noinline)) sub_FFD25ECC_my(long p)
+{
+  asm volatile (
+              "STMFD   SP!, {R4,LR}\n"
+              "LDR     R4, [R0,#0xC]\n"
+              "BL      sub_FFD2EC88\n"
+              "CMP     R0, #0\n"
+              "BNE     loc_FFD25EE4\n"
+              "BL      sub_FFD2EC94\n"
+    "loc_FFD25EE4:\n"
+              "MOV     R0, #0xC\n"
+              "BL      sub_FFD2ECA8\n"
+              "TST     R0, #1\n"
+              "MOV     R2, R4\n"
+              "MOV     R0, R4\n"
+              "BEQ     loc_FFD25F0C\n"
+              "MOV     R0, #1\n"
+              "MOV     R1, R0\n"
+              "LDMFD   SP!, {R4,LR}\n"
+              "B       sub_FFD24448\n"
+    "loc_FFD25F0C:\n"
+              "BL      sub_FFD27F30\n"
+              "TST     R0, #1\n"
+              "MOV     R2, R4\n"
+              "MOV     R1, #1\n"
+              "BEQ     loc_FFD25F28\n"
+              "LDMFD   SP!, {R4,LR}\n"
+              "B       sub_FFD24448\n"
+    "loc_FFD25F28:\n"
+              "BL      sub_FFC14714\n"
+              "LDR     R2, =0x9C6C4\n"
+              "ADD     R3, R4, R4,LSL#1\n"
+              "STR     R0, [R2,R3,LSL#5]\n"
+              "MOV     R0, R4\n"
+              "BL      sub_FFD29844\n"
+              "BL      sub_FFD28434\n"
+              "BL      sub_FFD283D0\n"
+              "MOV     R0, R4\n"
+
+              "BL      sub_FFD290DC_my\n"
+              "BL      capt_seq_hook_raw_here\n" //+
+
+              "MOV     R2, R4\n"
+              "MOV     R1, #1\n"
+              "BL      sub_FFD24448\n"
+              "LDMFD   SP!, {R4,LR}\n"
+              "B       sub_FFD292D0\n"
+  );
+} // a420, ok
+
+void __attribute__((naked,noinline)) capt_seq_task()    //IDA task_CaptSeqTask
+{
+  asm volatile (//copy from orig fw @ffd262b0
+          "STMFD   SP!, {R4,LR}\n"
+          "SUB     SP, SP, #4\n"
+          "MOV     R4, SP\n"
+          "B       loc_FFD26408\n"
+    "loc_FFD262C0:\n"
+          "LDR     R2, [SP]\n"
+          "LDR     R3, [R2]\n"
+          "MOV     R0, R2\n"
+          "CMP     R3, #0x14\n"
+          "LDRLS   PC, [PC,R3,LSL#2]\n"
+          "B       loc_FFD263DC\n"
+          ".long loc_FFD2632C\n" //0, still pict mode: half-shoot, ...
+          ".long loc_FFD26338\n" //1, shoot
+          ".long loc_FFD26340\n"
+          ".long loc_FFD26350\n" //3, when idle
+          ".long loc_FFD26348\n" //4, after expo
+          ".long loc_FFD26358\n"
+          ".long loc_FFD26360\n"
+          ".long loc_FFD2636C\n"
+          ".long loc_FFD26374\n" //movie mode: just before record
+          ".long loc_FFD26380\n"
+          ".long loc_FFD26388\n"
+          ".long loc_FFD26390\n"
+          ".long loc_FFD26398\n"
+          ".long loc_FFD263A0\n"
+          ".long loc_FFD263A8\n"
+          ".long loc_FFD263B4\n"
+          ".long loc_FFD263BC\n"
+          ".long loc_FFD263C4\n" //0x11, 2nd at change of rec. format
+          ".long loc_FFD263CC\n"
+          ".long loc_FFD263D4\n"
+          ".long loc_FFD263F0\n" //0x14, 1st at change of rec. format
+    "loc_FFD2632C:\n"
+          "BL      sub_FFD27BA0\n"
+          "BL      shooting_expo_param_override\n"   // +
+          "BL      sub_FFD23FF8\n"
+          "B       loc_FFD263EC\n"
+    "loc_FFD26338:\n"
+          "BL	sub_FFD25ECC_my\n"
+          "B	loc_FFD263EC\n"
+    "loc_FFD26340:\n"
+          "BL	sub_FFD27F20\n"
+          "B	loc_FFD263EC\n"
+    "loc_FFD26348:\n"
+          "BL	sub_FFD26E18\n"
+          "B	loc_FFD263EC\n"
+    "loc_FFD26350:\n"
+          "BL	sub_FFD27234\n"
+          "B	loc_FFD263EC\n"
+    "loc_FFD26358:\n"
+          "BL	sub_FFD27244\n"
+          "B	loc_FFD263EC\n"
+    "loc_FFD26360:\n"
+          "BL	sub_FFD27C6C\n"
+          "BL	sub_FFD23FF8\n"
+          "B	loc_FFD263EC\n"
+    "loc_FFD2636C:\n"
+          "BL	sub_FFD25FD4\n"
+          "B	loc_FFD263EC\n"
+    "loc_FFD26374:\n"
+          "BL	sub_FFD27CD4\n"
+          "BL	sub_FFD23FF8\n"
+          "B	loc_FFD263EC\n"
+    "loc_FFD26380:\n"
+          "BL	sub_FFD27234\n"
+          "B	loc_FFD263EC\n"
+    "loc_FFD26388:\n"
+          "BL	sub_FFD28474\n"
+          "B	loc_FFD263EC\n"
+    "loc_FFD26390:\n"
+          "BL	sub_FFD28790\n"
+          "B	loc_FFD263EC\n"
+    "loc_FFD26398:\n"
+          "BL	sub_FFD28818\n"
+          "B	loc_FFD263EC\n"
+    "loc_FFD263A0:\n"
+          "BL	sub_FFD288E0\n"
+          "B	loc_FFD263EC\n"
+    "loc_FFD263A8:\n"
+          "MOV	R0, #0\n"
+          "BL	sub_FFD28998\n"
+          "B	loc_FFD263EC\n"
+    "loc_FFD263B4:\n"
+          "BL	sub_FFD28AF0\n"
+          "B	loc_FFD263EC\n"
+    "loc_FFD263BC:\n"
+          "BL	sub_FFD28B88\n"
+          "B	loc_FFD263EC\n"
+    "loc_FFD263C4:\n"
+          "BL	sub_FFD28C44\n"
+          "B	loc_FFD263EC\n"
+    "loc_FFD263CC:\n"
+          "BL	sub_FFD28D2C\n"
+          "B	loc_FFD263EC\n"
+    "loc_FFD263D4:\n"
+          "BL	sub_FFD28D80\n"
+          "B	loc_FFD263EC\n"
+    "loc_FFD263DC:\n"
+          "MOV	R1, #0x330\n"
+          "LDR	R0, =0xFFD25C58\n"
+          "ADD	R1, R1, #1\n"
+          "BL	sub_FFC03AEC\n"
+    "loc_FFD263EC:\n"
+          "LDR	R2, [SP]\n"
+    "loc_FFD263F0:\n"
+          "LDR	R3, =0x7265C\n"
+          "LDR	R1, [R2, #4]\n"
+          "LDR	R0, [R3]\n"
+          "BL	sub_FFC0F9AC\n"
+          "LDR	R0, [SP]\n"
+          "BL	sub_FFD25CD4\n"
+    "loc_FFD26408:\n"
+          "LDR	R3, =0x72660\n"
+          "MOV	R1, R4\n"
+          "LDR	R0, [R3]\n"
+          "MOV	R2, #0\n"
+          "BL	sub_FFC100C4\n"
+          "TST	R0, #1\n"
+          "BEQ	loc_FFD262C0\n"
+          "MOV	R1, #0x28C\n"
+          "LDR	R0, =0xFFD25C58\n"
+          "ADD	R1, R1, #2\n"
+          "BL	sub_FFC03AEC\n"
+          "BL	sub_FFC11620\n"
+          "ADD	SP, SP, #4\n"
+          "LDMFD	SP!, {R4, PC}\n"
+  );
+} // a420, ok
+
+void __attribute__((naked,noinline)) exp_drv_task(){
+ asm volatile(// a420 @ffcdb3a4
+"                 STMFD   SP!, {R4-R8,LR}\n"
+"                 SUB     SP, SP, #0x14\n"
+"                 MOV     R7, SP\n"
+"                 B       loc_FFCDB798\n"
+" loc_FFCDB3B4:\n"
+"                 CMP     R2, #0x1E\n"
+"                 BNE     loc_FFCDB3CC\n"
+"                 LDR     R0, [R12,#0x34]\n"
+"                 MOV     LR, PC\n"
+"                 LDR     PC, [R12,#0x30]\n"
+"                 B       loc_FFCDB42C\n"
+" loc_FFCDB3CC:\n"
+"                 CMP     R2, #0x19\n"
+"                 BNE     loc_FFCDB3E0\n"
+"                 MOV     R0, R12\n"
+"                 BL      sub_FFCDB2D4\n"
+"                 B       loc_FFCDB41C\n"
+" loc_FFCDB3E0:\n"
+"                 CMP     R2, #0x1A\n"
+"                 BNE     loc_FFCDB3F4\n"
+"                 MOV     R0, R12\n"
+"                 BL      sub_FFCDB310\n"
+"                 B       loc_FFCDB41C\n"
+" loc_FFCDB3F4:\n"
+"                 SUB     R3, R2, #0x1B\n"
+"                 CMP     R3, #1\n"
+"                 BHI     loc_FFCDB40C\n"
+"                 MOV     R0, R12\n"
+"                 BL      sub_FFCDB34C\n"
+"                 B       loc_FFCDB41C\n"
+" loc_FFCDB40C:\n"
+"                 CMP     R2, #0x1D\n"
+"                 BNE     loc_FFCDB438\n"
+"                 BL      sub_FFC92DC8\n"
+"                 BL      sub_FFC94BB8\n"
+" loc_FFCDB41C:\n"
+"                 LDR     R3, [SP]\n"
+"                 LDR     R0, [R3,#0x34]\n"
+"                 MOV     LR, PC\n"
+"                 LDR     PC, [R3,#0x30]\n"
+" loc_FFCDB42C:\n"
+"                 LDR     R0, [SP]\n"
+"                 BL      sub_FFCD90D0\n"
+"                 B       loc_FFCDB798\n"
+" loc_FFCDB438:\n"
+"                 CMP     R2, #0xD\n"
+"                 MOV     R8, #1\n"
+"                 BNE     loc_FFCDB4A8\n"
+"                 LDR     R1, [R12,#0x24]\n"
+"                 ADD     R1, R1, R1,LSL#1\n"
+"                 ADD     R1, R12, R1,LSL#1\n"
+"                 ADD     R6, SP, #0x0C\n"
+"                 SUB     R1, R1, #2\n"
+"                 MOV     R2, #6\n"
+"                 MOV     R0, R6\n"
+"                 BL      sub_FFE9AAC8\n"
+"                 LDR     R0, [SP]\n"
+"                 BL      sub_FFCDA564\n"
+"                 LDR     R3, [SP]\n"
+"                 LDR     R1, [R3,#0x24]\n"
+"                 LDR     R2, [R3,#0x34]\n"
+"                 ADD     R0, R3, #4\n"
+"                 MOV     LR, PC\n"
+"                 LDR     PC, [R3,#0x30]\n"
+"                 LDR     R0, [SP]\n"
+"                 BL      sub_FFCDA6E8\n"
+"                 LDR     R3, [SP]\n"
+"                 ADD     R0, R3, #4\n"
+"                 LDR     R1, [R3,#0x24]\n"
+"                 LDR     R2, [R3,#0x3C]\n"
+"                 MOV     LR, PC\n"
+"                 LDR     PC, [R3,#0x38]\n"
+"                 B       loc_FFCDB748\n"
+" loc_FFCDB4A8:\n"
+"                 SUB     R3, R2, #0xE\n"
+"                 CMP     R3, #1\n"
+"                 BHI     loc_FFCDB564\n"
+"                 ADD     R6, SP, #0x0C\n"
+"                 ADD     R5, SP, #0x04\n"
+"                 MOV     R0, R12\n"
+"                 MOV     R1, R6\n"
+"                 MOV     R2, R5\n"
+"                 BL      sub_FFCDA764\n"
+"                 MOV     R4, R0\n"
+"                 CMP     R4, #5\n"
+"                 CMPNE   R4, #1\n"
+"                 BNE     loc_FFCDB4FC\n"
+"                 LDR     R12, [SP]\n"
+"                 MOV     R0, R5\n"
+"                 LDR     R1, [R12,#0x24]\n"
+"                 MOV     R2, R4\n"
+"                 LDR     R3, [R12,#0x34]\n"
+"                 MOV     LR, PC\n"
+"                 LDR     PC, [R12,#0x30]\n"
+"                 B       loc_FFCDB534\n"
+" loc_FFCDB4FC:\n"
+"                 CMP     R4, #6\n"
+"                 CMPNE   R4, #2\n"
+"                 BNE     loc_FFCDB544\n"
+"                 LDR     R12, [SP]\n"
+"                 MOV     R0, R5\n"
+"                 MOV     R1, R8\n"
+"                 MOV     R2, R4\n"
+"                 LDR     R3, [R12,#0x34]\n"
+"                 MOV     LR, PC\n"
+"                 LDR     PC, [R12,#0x30]\n"
+"                 MOV     R1, R6\n"
+"                 LDR     R0, [SP]\n"
+"                 MOV     R2, R5\n"
+"                 BL      sub_FFCDB110\n"
+" loc_FFCDB534:\n"
+"                 MOV     R1, R4\n"
+"                 LDR     R0, [SP]\n"
+"                 BL      sub_FFCDB2B4\n"
+"                 B       loc_FFCDB748\n"
+" loc_FFCDB544:\n"
+"                 LDR     R12, [SP]\n"
+"                 MOV     R2, R4\n"
+"                 ADD     R0, R12, #4\n"
+"                 LDR     R1, [R12,#0x24]\n"
+"                 LDR     R3, [R12,#0x34]\n"
+"                 MOV     LR, PC\n"
+"                 LDR     PC, [R12,#0x30]\n"
+"                 B       loc_FFCDB748\n"
+" loc_FFCDB564:\n"
+"                 CMP     R2, #0x17\n"
+"                 BNE     loc_FFCDB5B8\n"
+"                 LDR     R1, [R12,#0x24]\n"
+"                 ADD     R1, R1, R1,LSL#1\n"
+"                 ADD     R1, R12, R1,LSL#1\n"
+"                 ADD     R6, SP, #0x0C\n"
+"                 SUB     R1, R1, #2\n"
+"                 MOV     R2, #6\n"
+"                 MOV     R0, R6\n"
+"                 BL      sub_FFE9AAC8\n"
+"                 LDR     R0, [SP]\n"
+"                 BL      sub_FFCDA098\n"
+"                 LDR     R3, [SP]\n"
+"                 ADD     R0, R3, #4\n"
+"                 LDR     R1, [R3,#0x24]\n"
+"                 LDR     R2, [R3,#0x34]\n"
+"                 MOV     LR, PC\n"
+"                 LDR     PC, [R3,#0x30]\n"
+"                 LDR     R0, [SP]\n"
+"                 BL      sub_FFCDA268\n"
+"                 B       loc_FFCDB748\n"
+" loc_FFCDB5B8:\n"
+"                 ADD     R6, SP, #0x0C\n"
+"                 ADD     R1, R12, #4\n"
+"                 MOV     R2, #6\n"
+"                 MOV     R0, R6\n"
+"                 BL      sub_FFE9AAC8\n"
+"                 LDR     R12, [SP]\n"
+"                 LDR     R3, [R12]\n"
+"                 MOV     R2, R12\n"
+"                 CMP     R3, #0x18\n"
+"                 LDRLS   PC, [PC,R3,LSL#2]\n"
+"                 B       loc_FFCDB734\n"
+"                 .long loc_FFCDB648\n"
+"                 .long loc_FFCDB654\n"
+"                 .long loc_FFCDB660\n"
+"                 .long loc_FFCDB660\n"
+"                 .long loc_FFCDB648\n"
+"                 .long loc_FFCDB654\n"
+"                 .long loc_FFCDB660\n"
+"                 .long loc_FFCDB660\n"
+"                 .long loc_FFCDB684\n"
+"                 .long loc_FFCDB684\n"
+"                 .long loc_FFCDB708\n"
+"                 .long loc_FFCDB714\n"
+"                 .long loc_FFCDB724\n"
+"                 .long loc_FFCDB734\n"
+"                 .long loc_FFCDB734\n"
+"                 .long loc_FFCDB734\n"
+"                 .long loc_FFCDB66C\n"
+"                 .long loc_FFCDB678\n"
+"                 .long loc_FFCDB694\n"
+"                 .long loc_FFCDB6A0\n"
+"                 .long loc_FFCDB6C8\n"
+"                 .long loc_FFCDB6F0\n"
+"                 .long loc_FFCDB6F0\n"
+"                 .long loc_FFCDB734\n"
+"                 .long loc_FFCDB6FC\n"
+" loc_FFCDB648:\n"
+"                 MOV     R0, R2\n"
+"                 BL      sub_FFCD9638\n"
+"                 B       loc_FFCDB730\n"
+" loc_FFCDB654:\n"
+"                 MOV     R0, R2\n"
+"                 BL      sub_FFCD9774\n"
+"                 B       loc_FFCDB730\n"
+" loc_FFCDB660:\n"
+"                 MOV     R0, R2\n"
+"                 BL      sub_FFCD98A4\n"
+"                 B       loc_FFCDB730\n"
+" loc_FFCDB66C:\n"
+"                 MOV     R0, R2\n"
+"                 BL      sub_FFCD9A78\n"
+"                 B       loc_FFCDB730\n"
+" loc_FFCDB678:\n"
+"                 MOV     R0, R2\n"
+"                 BL      sub_FFCD9B80\n"
+"                 B       loc_FFCDB730\n"
+" loc_FFCDB684:\n"
+"                 MOV     R0, R2\n"
+"                 BL      sub_FFCD9C44_my\n" //
+"                 MOV     R8, #0\n"
+"                 B       loc_FFCDB730\n"
+" loc_FFCDB694:\n"
+"                 MOV     R0, R2\n"
+"                 BL      sub_FFCD9D04\n"
+"                 B       loc_FFCDB730\n"
+" loc_FFCDB6A0:\n"
+"                 MOV     R0, R2\n"
+"                 LDRH    R2, [R2,#4]\n"
+"                 LDR     R3, =0x4DD38\n"
+"                 STRH    R2, [SP,#0x0C]\n"
+"                 LDRH    R1, [R3,#4]\n"
+"                 STRH    R1, [SP,#0x10]\n"
+"                 LDRH    R3, [R3,#2]\n"
+"                 STRH    R3, [SP,#0x0E]\n"
+"                 BL      sub_FFCD9E8C\n"
+"                 B       loc_FFCDB730\n"
+" loc_FFCDB6C8:\n"
+"                 LDR     R3, =0x4DD38\n"
+"                 LDRH    R1, [R3]\n"
+"                 STRH    R1, [SP,#0x0C]\n"
+"                 MOV     R0, R2\n"
+"                 LDRH    R2, [R2,#6]\n"
+"                 STRH    R2, [SP,#0x0E]\n"
+"                 LDRH    R3, [R3,#4]\n"
+"                 STRH    R3, [SP,#0x10]\n"
+"                 BL      sub_FFCD9F20\n"
+"                 B       loc_FFCDB730\n"
+" loc_FFCDB6F0:\n"
+"                 MOV     R0, R2\n"
+"                 BL      sub_FFCD9FA0\n"
+"                 B       loc_FFCDB730\n"
+" loc_FFCDB6FC:\n"
+"                 MOV     R0, R2\n"
+"                 BL      sub_FFCDA2F8\n"
+"                 B       loc_FFCDB730\n"
+" loc_FFCDB708:\n"
+"                 MOV     R0, R2\n"
+"                 BL      sub_FFCDA3CC\n"
+"                 B       loc_FFCDB730\n"
+" loc_FFCDB714:\n"
+"                 MOV     R0, R2\n"
+"                 MOV     R1, #0\n"
+"                 BL      sub_FFCDA4B8\n"
+"                 B       loc_FFCDB730\n"
+" loc_FFCDB724:\n"
+"                 MOV     R0, R2\n"
+"                 MOV     R1, #1\n"
+"                 BL      sub_FFCDA4B8\n"
+" loc_FFCDB730:\n"
+"                 LDR     R12, [SP]\n"
+" loc_FFCDB734:\n"
+"                 ADD     R0, R12, #4\n"
+"                 LDR     R1, [R12,#0x24]\n"
+"                 LDR     R2, [R12,#0x34]\n"
+"                 MOV     LR, PC\n"
+"                 LDR     PC, [R12,#0x30]\n"
+" loc_FFCDB748:\n"
+"                 CMP     R8, #1\n"
+"                 BNE     loc_FFCDB770\n"
+"                 LDR     R1, [SP]\n"
+"                 LDR     R3, [R1,#0x24]\n"
+"                 ADD     R3, R3, R3,LSL#1\n"
+"                 ADD     R1, R1, R3,LSL#1\n"
+"                 MOV     R0, R6\n"
+"                 SUB     R1, R1, #2\n"
+"                 BL      sub_FFCD94A0\n"
+"                 B       loc_FFCDB790\n"
+" loc_FFCDB770:\n"
+"                 MOV     R0, #1\n"
+"                 MOV     R1, R0\n"
+"                 MOV     R2, R0\n"
+"                 BL      sub_FFCD9444\n"
+"                 MOV     R0, #1\n"
+"                 MOV     R1, R0\n"
+"                 MOV     R2, R0\n"
+"                 BL      sub_FFCD9560\n"
+" loc_FFCDB790:\n"
+"                 LDR     R0, [SP]\n"
+"                 BL      sub_FFCD90D0\n"
+" loc_FFCDB798:\n"
+"                 LDR     R3, =0x4DD30\n"
+"                 MOV     R2, #0\n"
+"                 LDR     R0, [R3]\n"
+"                 MOV     R1, R7\n"
+"                 BL      sub_FFC100C4\n"
+"                 LDR     R12, [SP]\n"
+"                 LDR     R2, [R12]\n"
+"                 CMP     R2, #0x1F\n"
+"                 BNE     loc_FFCDB3B4\n"
+"                 MOV     R0, R12\n"
+"                 BL      sub_FFCD90D0\n"
+"                 LDR     R3, =0x4DD2C\n"
+"                 MOV     R1, #1\n"
+"                 LDR     R0, [R3]\n"
+"                 BL      sub_FFC0F9AC\n"
+"                 BL      sub_FFC11620\n"
+"                 ADD     SP, SP, #0x14\n"
+"                 LDMFD   SP!, {R4-R8,PC}\n"
+ );
+} // a420
+
+void __attribute__((naked,noinline)) sub_FFCD9C44_my(){//
+ asm volatile(
+"                 STMFD   SP!, {R4,R5,LR}\n"
+"                 LDR     R3, =0x4DD2C\n"
+"                 MOV     R4, R0\n"
+"                 MOV     R1, #0xE\n"
+"                 LDR     R0, [R3]\n"
+"                 BL      sub_FFC0FB48\n"
+"                 MOV     R1, #0\n"
+"                 LDRSH   R0, [R4,#4]\n"
+"                 BL      sub_FFCD91AC\n"
+"                 MOV     R5, R0\n"
+"                 LDRSH   R0, [R4,#6]\n"
+"                 BL      sub_FFCD92DC\n"
+"                 LDRSH   R0, [R4,#8]\n"
+"                 BL      sub_FFCD9378\n"
+"                 LDR     R3, [R4]\n"
+"                 CMP     R3, #9\n"
+"                 MOVEQ   R5, #0\n"
+"                 CMP     R5, #1\n"
+"                 LDR     R1, =0xFFCD9104\n"
+"                 MOV     R2, #2\n"
+"                 BNE     loc_FFCD9CB0\n"
+"                 LDRSH   R0, [R4,#4]\n"
+"                 BL      sub_FFE47B78\n"
+"                 LDR     R2, =0x4DD58\n"
+"                 MOV     R3, #0\n"
+"                 STR     R3, [R2]\n"
+"                 B       loc_FFCD9CB4\n"
+" loc_FFCD9CB0:\n"
+"                 BL      sub_FFCD9414\n"
+" loc_FFCD9CB4:\n"
+"                 STRH    R0, [R4,#4]\n"
+"                 LDRSH   R0, [R4,#6]\n"
+"                 BL      sub_FFC92A50_my\n" //
+"                 LDRSH   R0, [R4,#8]\n"
+"                 MOV     R1, #1\n"
+"                 BL      sub_FFC94778\n"
+"                 MOV     R1, #0\n"
+"                 ADD     R0, R4, #8\n"
+"                 BL      sub_FFC94838\n"
+"                 CMP     R5, #1\n"
+"                 MOV     R1, #2\n"
+"                 MOV     R2, #0\n"
+"                 LDMNEFD SP!, {R4,R5,PC}\n"
+"                 LDR     R3, =0x4DD2C\n"
+"                 LDR     R0, [R3]\n"
+"                 LDMFD   SP!, {R4,R5,LR}\n"
+"                 B       sub_FFC0F99C\n"
+ );
+}// a420
+
+void __attribute__((naked,noinline)) sub_FFC92A50_my() {
+ asm volatile(
+"                 STMFD   SP!, {R4,LR}\n"
+"                 LDR     R3, =0x5078\n"
+"                 LDR     R2, [R3]\n"
+"                 MOV     R1, #0x114\n"
+"                 MOV     R3, R0,LSL#16\n"
+"                 CMP     R2, #1\n"
+"                 ADD     R1, R1, #1\n"
+"                 LDR     R0, =0xFFC924CC\n"
+"                 MOV     R4, R3,ASR#16\n"
+"                 BEQ     loc_FFC92A7C\n"
+"                 BL      sub_FFC03AEC\n"
+" loc_FFC92A7C:\n"
+"                 MOV     R1, #0x118\n"
+"                 CMN     R4, #0xC00\n"
+"                 LDR     R3, =0x34276\n"
+"                 LDR     R0, =0xFFC924CC\n"
+"                 ADD     R1, R1, #3\n"
+"                 LDREQSH R4, [R3]\n"
+"                 LDRNE   R3, =0x34276\n"
+"                 CMN     R4, #0xC00\n"
+"                 STRH    R4, [R3]\n"
+"                 BNE     loc_FFC92AA8\n"
+"                 BL      sub_FFC03AEC\n"
+" loc_FFC92AA8:\n"
+"                 MOV     R0, R4\n"
+"                 BL      apex2us\n" //previously sub_FFC93B4C
+"                 MOV     R4, R0\n"
+"                 BL      sub_FFCB8664\n"
+"                 MOV     R0, R4\n"
+"                 BL      sub_FFC920C0\n"
+"                 TST     R0, #1\n"
+"                 MOV     R1, #0x120\n"
+"                 LDR     R0, =0xFFC924CC\n"
+"                 LDMEQFD SP!, {R4,PC}\n"
+"                 LDMFD   SP!, {R4,LR}\n"
+"                 B       sub_FFC03AEC\n"
+ );
+}// a420
Index: /branches/release-1_0/platform/a420/sub/100b/stubs_entry.S
===================================================================
--- /branches/release-1_0/platform/a420/sub/100b/stubs_entry.S	(revision 1734)
+++ /branches/release-1_0/platform/a420/sub/100b/stubs_entry.S	(revision 1734)
@@ -0,0 +1,234 @@
+// !!! THIS FILE IS GENERATED. DO NOT EDIT. !!!
+#include "stubs_asm.h"
+
+NSTUB(AllocateMemory, 0xffc01ab4)
+NSTUB(AllocateUncacheableMemory, 0xffc048f4)
+NSTUB(Close, 0xffc5a42c)
+NSTUB(CreatePhysicalVram, 0xffd092f0)
+NSTUB(CreateTask, 0xffc11260)
+NSTUB(CreateTaskStrict, 0xffc12300)
+NSTUB(DeleteFile_Fut, 0xffc535c8)
+NSTUB(DisableDispatch, 0xffc11084)
+// Best match: 96%
+NSTUB(DisplayImagePhysicalScreen, 0xffd0859c)
+// Best match: 56%
+NSTUB(DoAFLock, 0xffd22b98)
+NSTUB(EnableDispatch, 0xffc11110)
+// ERROR: EnterToCompensationEVF is not found!
+NSTUB(ExecuteEventProcedure, 0xffc0680c)
+// Best match: 76%
+NSTUB(ExitFromCompensationEVF, 0xffd24a54)
+NSTUB(ExitTask, 0xffc11620)
+NSTUB(Fclose_Fut, 0xffc53708)
+NSTUB(Feof_Fut, 0xffc5391c)
+NSTUB(Fflush_Fut, 0xffc53954)
+NSTUB(Fgets_Fut, 0xffc5388c)
+NSTUB(Fopen_Fut, 0xffc536cc)
+NSTUB(Fread_Fut, 0xffc537ec)
+NSTUB(FreeMemory, 0xffc01ac0)
+NSTUB(FreeUncacheableMemory, 0xffc04928)
+NSTUB(Fseek_Fut, 0xffc538d4)
+NSTUB(Fwrite_Fut, 0xffc5383c)
+// Best match: 82%
+NSTUB(GetBatteryTemperature, 0xffc1c044)
+// Best match: 82%
+NSTUB(GetCCDTemperature, 0xffc1c030)
+NSTUB(GetCurrentAvValue, 0xffe5e0ac)
+NSTUB(GetCurrentTargetDistance, 0xffe5e054)
+// Best match: 80%
+NSTUB(GetDrive_ClusterSize, 0xffc59c7c)
+// Best match: 80%
+NSTUB(GetDrive_FreeClusters, 0xffc59c7c)
+// Best match: 80%
+NSTUB(GetDrive_TotalClusters, 0xffc59c04)
+// ALT: NSTUB(GetDrive_TotalClusters, 0xffc59c40) // 20/5
+// Best match: 96%
+NSTUB(GetFocusLensSubjectDistance, 0xffe5089c)
+// Best match: 52%
+NSTUB(GetFocusLensSubjectDistanceFromLens, 0xffe50e3c)
+// Best match: 82%
+NSTUB(GetOpticalTemperature, 0xffc1c01c)
+// Best match: 86%
+NSTUB(GetParameterData, 0xffd3d590)
+NSTUB(GetPropertyCase, 0xffc14518)
+// Best match: 96%
+NSTUB(GetSystemTime, 0xffc04b2c)
+// ALT: NSTUB(GetSystemTime, 0xffc04b2c) // 26/1
+// Best match: 93%
+NSTUB(GetZoomLensCurrentPoint, 0xffe41344)
+// ALT: NSTUB(GetZoomLensCurrentPoint, 0xffe41344) // 27/2
+// Best match: 93%
+NSTUB(GetZoomLensCurrentPosition, 0xffe41358)
+// ALT: NSTUB(GetZoomLensCurrentPosition, 0xffe41358) // 27/2
+NSTUB(IsStrobeChargeCompleted, 0xffce4958)
+NSTUB(LockMainPower, 0xffd38918)
+// ERROR: MakeAFScan is not found!
+NSTUB(MakeDirectory, 0xffc5a6d0)
+NSTUB(MakeDirectory_Fut, 0xffc53654)
+// Best match: 90%
+NSTUB(Mount_FileSystem, 0xffc596cc)
+// ALT: NSTUB(Mount_FileSystem, 0xffc596cc) // 27/3
+// Best match: 96%
+NSTUB(MoveFocusLensToDistance, 0xffe5e2f4)
+NSTUB(MoveZoomLensWithPoint, 0xffe41224)
+// ALT: NSTUB(MoveZoomLensWithPoint, 0xffe41224) // 25/0
+NSTUB(Open, 0xffc5a404)
+NSTUB(PT_PlaySound, 0xffd300ac)
+// Best match: 96%
+NSTUB(PhySw_testgpio, 0xffc17b68)
+NSTUB(PostLogicalEventForNotPowerType, 0xffd34a10)
+NSTUB(PostLogicalEventToUI, 0xffd34a8c)
+// ALT: NSTUB(PostLogicalEventToUI, 0xffd34b14) // 21/0
+NSTUB(ProtectFile, 0xffc52d34)
+// Best match: 92%
+NSTUB(PutInNdFilter, 0xffe5c0c8)
+// ALT: NSTUB(PutInNdFilter, 0xffe5c0c8) // 25/2
+// ALT: NSTUB(PutInNdFilter, 0xffe5dc58) // 25/2
+// ALT: NSTUB(PutInNdFilter, 0xffe5dc58) // 25/2
+// ALT: NSTUB(PutInNdFilter, 0xffe5dca0) // 25/2
+// ALT: NSTUB(PutInNdFilter, 0xffe5dca0) // 25/2
+// Best match: 94%
+NSTUB(PutOutNdFilter, 0xffe5c110)
+// ALT: NSTUB(PutOutNdFilter, 0xffe5c110) // 16/1
+NSTUB(Read, 0xffc5a4c0)
+NSTUB(RefreshPhysicalScreen, 0xffd4eae0)
+NSTUB(Remove, 0xffc5a44c)
+NSTUB(RenameFile_Fut, 0xffc53548)
+NSTUB(Restart, 0xffc1277c)
+// Best match: 95%
+NSTUB(SetAE_ShutterSpeed, 0xffe617a8)
+NSTUB(SetAutoShutdownTime, 0xffd38810)
+NSTUB(SetCurrentCaptureModeType, 0xffd6750c)
+NSTUB(SetFileAttributes, 0xffc5a5e4)
+// Best match: 88%
+NSTUB(SetLogicalEventActive, 0xffd367e8)
+// Best match: 86%
+NSTUB(SetParameterData, 0xffd3d4b0)
+NSTUB(SetPropertyCase, 0xffc143ec)
+NSTUB(SleepTask, 0xffc11174)
+NSTUB(TakeSemaphore, 0xffc10c70)
+NSTUB(TurnOffBackLight, 0xffd7e1f0)
+NSTUB(TurnOnBackLight, 0xffd7e1c0)
+// Best match: 78%
+NSTUB(UnlockAF, 0xffcd89d0)
+// ALT: NSTUB(UnlockAF, 0xffd22be8) // 11/3
+NSTUB(UnlockMainPower, 0xffd389cc)
+NSTUB(Unmount_FileSystem, 0xffc597e4)
+// Best match: 89%
+NSTUB(UnsetZoomForMovie, 0xffd72590)
+NSTUB(UpdateMBROnFlash, 0xffc59938)
+// ERROR: VbattGet is not found!
+NSTUB(Write, 0xffc5a4cc)
+// Best match: 64%
+NSTUB(WriteSDCard, 0xffc68eb8)
+NSTUB(_log, 0xffe9381c)
+// ALT: NSTUB(_log, 0xffe9381c) // 27/0
+NSTUB(_log10, 0xffe8fcf4)
+// ALT: NSTUB(_log10, 0xffe8fcf4) // 27/0
+NSTUB(_pow, 0xffe8fe7c)
+// ALT: NSTUB(_pow, 0xffe8fe7c) // 25/0
+NSTUB(_sqrt, 0xffe91c18)
+// ALT: NSTUB(_sqrt, 0xffe91c18) // 24/0
+// Best match: 96%
+NSTUB(add_ptp_handler, 0xffe10fb4)
+NSTUB(apex2us, 0xffc93b4c)
+NSTUB(chdir, 0xffea00f0)
+// ALT: NSTUB(chdir, 0xffea00f0) // 27/0
+NSTUB(close, 0xffe9fa30)
+NSTUB(closedir, 0xffe9ceb8)
+NSTUB(errnoOfTaskGet, 0xffe9d684)
+// Best match: 93%
+NSTUB(exmem_alloc, 0xffc0281c)
+// ERROR: free is not found!
+NSTUB(ints_disable, 0xffc0d6e0)
+NSTUB(ints_enable, 0xffc0d6ec)
+NSTUB(ioctl, 0xffe9fb70)
+NSTUB(iosDevAdd, 0xffea0c50)
+NSTUB(iosDevDelete, 0xffea0c28)
+NSTUB(iosDevFind, 0xffea0bdc)
+NSTUB(iosDrvInstall, 0xffea0f14)
+NSTUB(isalpha, 0xffe96f5c)
+NSTUB(isdigit, 0xffe96f8c)
+NSTUB(islower, 0xffe96fbc)
+NSTUB(ispunct, 0xffe96fec)
+NSTUB(isspace, 0xffe97004)
+NSTUB(isupper, 0xffe9701c)
+NSTUB(isxdigit, 0xffe97034)
+NSTUB(kbd_p1_f, 0xffc16910)
+NSTUB(kbd_p1_f_cont, 0xffc1691c)
+NSTUB(kbd_p2_f, 0xffc16cec)
+// Best match: 83%
+NSTUB(kbd_pwr_off, 0xffc17ebc)
+// ALT: NSTUB(kbd_pwr_off, 0xffc17ed8) // 5/1
+// ALT: NSTUB(kbd_pwr_off, 0xffc17fc4) // 5/1
+// ALT: NSTUB(kbd_pwr_off, 0xffc17fe0) // 5/1
+// ALT: NSTUB(kbd_pwr_off, 0xffc180b0) // 5/1
+// ALT: NSTUB(kbd_pwr_off, 0xffc180cc) // 5/1
+// ALT: NSTUB(kbd_pwr_off, 0xffc18214) // 5/1
+// ALT: NSTUB(kbd_pwr_off, 0xffc18230) // 5/1
+// ERROR: kbd_pwr_on is not found!
+NSTUB(kbd_read_keys_r2, 0xffc17618)
+// Best match: 93%
+NSTUB(localtime, 0xffe9b6ac)
+NSTUB(lseek, 0xffe9fb74)
+// Best match: 53%
+NSTUB(malloc, 0xffea2a70)
+// ALT: NSTUB(malloc, 0xffea2a70) // 15/13
+NSTUB(memPartInfoGet, 0xffea2e90)
+NSTUB(memchr, 0xffe9aa58)
+NSTUB(memcmp, 0xffe9aa8c)
+// ALT: NSTUB(memcmp, 0xffea6c30) // 9/0
+NSTUB(memcpy, 0xffe9aac8)
+NSTUB(memset, 0xffe9ab40)
+NSTUB(mkdir, 0xffc5a614)
+NSTUB(mktime, 0xffe9b874)
+NSTUB(open, 0xffea0074)
+NSTUB(opendir, 0xffe9ceec)
+NSTUB(qsort, 0xffe9a2ec)
+NSTUB(rand, 0xffe9a310)
+// ALT: NSTUB(rand, 0xffe9a310) // 8/0
+NSTUB(read, 0xffe9fa90)
+NSTUB(readdir, 0xffe9ce84)
+NSTUB(rename, 0xffea007c)
+// ALT: NSTUB(rename, 0xffea007c) // 26/0
+NSTUB(rewinddir, 0xffe9ceac)
+NSTUB(srand, 0xffe9a334)
+// ALT: NSTUB(srand, 0xffe9a334) // 4/0
+NSTUB(stat, 0xffe9cf80)
+NSTUB(strcat, 0xffe9ab60)
+NSTUB(strchr, 0xffe9ab8c)
+NSTUB(strcmp, 0xffe9abb0)
+NSTUB(strcpy, 0xffe9ad44)
+NSTUB(strftime, 0xffe9c3cc)
+NSTUB(strlen, 0xffe9aea8)
+NSTUB(strncmp, 0xffe9af0c)
+NSTUB(strncpy, 0xffe9af50)
+// ALT: NSTUB(strncpy, 0xffe9af50) // 24/0
+NSTUB(strpbrk, 0xffe9af98)
+NSTUB(strrchr, 0xffe9afd4)
+// ALT: NSTUB(strrchr, 0xffe9afd4) // 8/0
+NSTUB(strtol, 0xffe9a728)
+NSTUB(strtoul, 0xffe9a8d0)
+NSTUB(taskCreateHookAdd, 0xffea56d0)
+NSTUB(taskDeleteHookAdd, 0xffea560c)
+// Best match: 82%
+NSTUB(taskIdListGet, 0xffeaf698)
+// ALT: NSTUB(taskIdListGet, 0xffed347c) // 24/5
+NSTUB(taskLock, 0xffeafd54)
+// ALT: NSTUB(taskLock, 0xffed3b38) // 31/0
+NSTUB(taskName, 0xffeaf590)
+// ALT: NSTUB(taskName, 0xffed3374) // 25/0
+NSTUB(taskResume, 0xffeaf974)
+// ALT: NSTUB(taskResume, 0xffed3758) // 31/0
+NSTUB(taskSuspend, 0xffeaf7a0)
+// ALT: NSTUB(taskSuspend, 0xffed3584) // 31/0
+NSTUB(taskUnlock, 0xffeafdfc)
+// ALT: NSTUB(taskUnlock, 0xffed3be0) // 31/0
+NSTUB(time, 0xffe9c3f8)
+// ALT: NSTUB(time, 0xffe9c3f8) // 25/0
+NSTUB(tolower, 0xffe9704c)
+NSTUB(toupper, 0xffe9705c)
+NSTUB(utime, 0xffe9d014)
+// ALT: NSTUB(utime, 0xffe9d014) // 26/0
+NSTUB(vsprintf, 0xffe9e7d8)
+NSTUB(write, 0xffe9fb00)
Index: /branches/release-1_0/platform/a420/sub/100b/stubs_entry_2.S
===================================================================
--- /branches/release-1_0/platform/a420/sub/100b/stubs_entry_2.S	(revision 1734)
+++ /branches/release-1_0/platform/a420/sub/100b/stubs_entry_2.S	(revision 1734)
@@ -0,0 +1,29 @@
+#include "stubs_asm.h"
+#define NULL_SUB 0xFFC017E8
+
+// Override stubs_entry.S
+NHSTUB(free,                        0xFFEA2A7C)//ok a420
+NHSTUB(VbattGet,                    0xFFC1B014)//ok a420
+NHSTUB(MakeAFScan,                  0xFFD2737C) //ok a420 i guess
+NHSTUB(EnterToCompensationEVF,      0xFFD24990) //ok a420
+NHSTUB(ExitFromCompensationEVF,     0xFFD249EC) //ok a420
+NHSTUB(DoAFLock,                    0xFFD22BA0) //ok a420
+NHSTUB(UnlockAF,                    0xFFD22BE4) //ok a420
+NHSTUB(GetDrive_ClusterSize,        0xFFC59C04) //may be ok a420
+NHSTUB(GetDrive_TotalClusters,      0xFFC59C40) //may be ok a420
+NHSTUB(GetDrive_FreeClusters,       0xFFC59C7C) // may be ok a420
+NHSTUB(WriteSDCard,                 0xFFC69060) //ok i guess a420
+NHSTUB(kbd_pwr_on,                  NULL_SUB) //wrong, null stub
+NHSTUB(kbd_pwr_off,                 NULL_SUB) //wrong, null stub
+
+// These don't exist
+NHSTUB(TurnOffMic,                  NULL_SUB) //useless on a420, null stub
+NHSTUB(TurnOnMic,                   NULL_SUB) //useless on a420, null stub
+NHSTUB(SetZoomActuatorSpeedPercent, NULL_SUB)//ok, null stub, a420 also
+
+// Additional
+NHSTUB(ExpCtrlTool_StopContiAE,     0xFFCD84C8) //ok a420
+NHSTUB(ExpCtrlTool_StartContiAE,    0xFFCD8498) //ok a420
+NHSTUB(SetScriptMode,               0xFFD36850) // ok a420
+NHSTUB(MFOn,                        0xffd2366c)
+NHSTUB(MFOff,                       0xffd2369c)
Index: /branches/release-1_0/platform/a420/sub/100b/boot.c
===================================================================
--- /branches/release-1_0/platform/a420/sub/100b/boot.c	(revision 1734)
+++ /branches/release-1_0/platform/a420/sub/100b/boot.c	(revision 1734)
@@ -0,0 +1,190 @@
+#include "lolevel.h"
+#include "platform.h"
+#include "core.h"
+
+const char * const new_sa = &_end;
+
+/* Ours stuff */
+extern long wrs_kernel_bss_start;
+extern long wrs_kernel_bss_end;
+extern void createHook (void *pNewTcb);
+extern void deleteHook (void *pTcb);
+
+
+void boot();
+
+/* "relocated" functions */
+void __attribute__((naked,noinline)) h_usrInit();
+void __attribute__((naked,noinline)) h_usrKernelInit();
+void __attribute__((naked,noinline)) h_usrRoot();
+
+
+#if 0
+void blink_blue(int duration)
+{
+  int i;
+
+  *((volatile long *) 0xc0220084) = 0x46; // Turn on LED   
+  for (i=0; i<duration; i++) // Wait a while   
+  {   
+    asm volatile ( "nop\n" );   
+  }   
+   
+  *((volatile long *) 0xc0220084) = 0x44; // Turn off LED   
+  for (i=0; i<duration; i++) // Wait a while   
+  {   
+    asm volatile ( "nop\n" );   
+  }
+}
+
+void blink_orange(int duration) //a420
+{
+  int i;
+
+  *((volatile long *) 0xc0220090) = 0x46; // Turn on LED   
+  for (i=0; i<duration; i++) // Wait a while   
+  {   
+    asm volatile ( "nop\n" );   
+  }   
+   
+  *((volatile long *) 0xc0220090) = 0x44; // Turn off LED   
+  for (i=0; i<duration; i++) // Wait a while   
+  {   
+    asm volatile ( "nop\n" );   
+  }
+}
+
+void blink()
+{
+    blink_blue(10000000);
+    blink_orange(10000000);
+    blink_blue(10000000);
+}
+#endif
+
+void boot()
+{
+    long *canon_data_src = (void*)0xFFEB60C0; //a420
+    long *canon_data_dst = (void*)0x1900;
+    long canon_data_len = 0xE7B0 - 0x1900; //a420
+    long *canon_bss_start = (void*)0xE7B0; // a420 just after data
+    long canon_bss_len = 0x9EF70 - 0xE7B0; // a420
+    long i;
+
+    asm volatile (//seems like no change required for a420
+	"MRC     p15, 0, R0,c1,c0\n"
+	"ORR     R0, R0, #0x1000\n"
+	"ORR     R0, R0, #4\n"
+	"ORR     R0, R0, #1\n"
+	"MCR     p15, 0, R0,c1,c0\n"
+    :::"r0");
+
+    for(i=0;i<canon_data_len/4;i++)
+	canon_data_dst[i]=canon_data_src[i];
+
+    for(i=0;i<canon_bss_len/4;i++)
+	canon_bss_start[i]=0;
+
+    asm volatile (
+	"MRC     p15, 0, R0,c1,c0\n"
+	"ORR     R0, R0, #0x1000\n"
+	"BIC     R0, R0, #4\n"
+	"ORR     R0, R0, #1\n"
+	"MCR     p15, 0, R0,c1,c0\n"
+    :::"r0");
+
+    h_usrInit();
+}
+
+
+void h_usrInit()
+{
+    asm volatile (
+	"STR     LR, [SP,#-4]!\n"
+	"BL      sub_FFC01968\n"
+	"MOV     R0, #2\n"
+	"MOV     R1, R0\n"
+	"BL      sub_FFE9C438\n"     //unknown_libname_773 ; "Canon A-Series Firmware"
+	"BL      sub_FFE8DAA8\n"     //excVecInit
+	"BL      sub_FFC011C4\n"
+	"BL      sub_FFC01728\n"
+	"LDR     LR, [SP],#4\n"
+	"B       h_usrKernelInit\n"
+    );
+}//a420 ok (copied from ffc0198c, orig. fw)
+
+void  h_usrKernelInit()
+{
+//    blink();
+    asm volatile (
+	"STMFD   SP!, {R4,LR}\n"
+	"SUB     SP, SP, #8\n"
+	"BL      sub_FFE9C938\n"    //classLibInit
+	"BL      sub_FFEAF720\n"    //taskLibInit
+	"LDR     R3, =0xD7C0\n"
+	"LDR     R2, =0x9BC00\n"
+	"LDR     R1, [R3]\n"
+	"LDR     R0, =0x9E930\n"
+	"MOV     R3, #0x100\n"
+	"BL      sub_FFEA8830\n"   //qInit
+	"LDR     R3, =0xD780\n"
+	"LDR     R0, =0xDFC8\n"
+	"LDR     R1, [R3]\n"
+	"BL      sub_FFEA8830\n"   //qInit
+	"LDR     R3, =0xD83C\n"
+	"LDR     R0, =0x9E904\n"
+	"LDR     R1, [R3]\n"
+	"BL      sub_FFEA8830\n"   //qInit
+	"BL      sub_FFEB42A0\n"   //workQInit
+	"BL      sub_FFC012B0\n"
+	"MOV     R4, #0\n"
+	"MOV     R3, R0\n"
+	"MOV     R12, #0x800\n"
+	"LDR     R0, =h_usrRoot\n"
+	"MOV     R1, #0x4000\n"
+    );
+    asm volatile (
+        "LDR     R2, =new_sa\n"
+        "LDR     R2, [R2]\n"
+    );
+    asm volatile (
+	"STR     R12, [SP]\n"
+	"STR     R4, [SP,#4]\n"
+	"BL      sub_FFEAC960\n"  //kernelInit
+	"ADD     SP, SP, #8\n"
+	"LDMFD   SP!, {R4,PC}\n"
+    );
+}// a420 ok
+
+
+void  h_usrRoot()
+{
+    asm volatile (
+	"STMFD   SP!, {R4,R5,LR}\n"
+	"MOV     R5, R0\n"
+	"MOV     R4, R1\n"
+	"BL      sub_FFC019D0\n"
+	"MOV     R1, R4\n"
+	"MOV     R0, R5\n"
+	"BL      sub_FFEA15CC\n"     //memInit
+	"MOV     R1, R4\n"
+	"MOV     R0, R5\n"
+	"BL      sub_FFEA2044\n"     //memPartLibInit
+	"BL      sub_FFC017E8\n"     //SetZoomActuatorSpeedPercent
+	"BL      sub_FFC01704\n"
+	"BL      sub_FFC01A10\n"
+	"BL      sub_FFC019F4\n"
+	"BL      sub_FFC01A3C\n"
+	"BL      sub_FFC019C4\n"
+    );
+
+    _taskCreateHookAdd(createHook);
+    _taskDeleteHookAdd(deleteHook);
+
+    drv_self_hide();
+    
+    asm volatile (
+	"LDMFD   SP!, {R4,R5,LR}\n"
+	"B       sub_FFC0136C\n"
+    );
+}// a420 ok
Index: /branches/release-1_0/platform/a420/sub/100b/stubs_min.S
===================================================================
--- /branches/release-1_0/platform/a420/sub/100b/stubs_min.S	(revision 1734)
+++ /branches/release-1_0/platform/a420/sub/100b/stubs_min.S	(revision 1734)
@@ -0,0 +1,19 @@
+#include "stubs_asm.h"
+
+DEF(physw_status, 0xF838) //a420 ok
+DEF(physw_run,  0x1FAC) //a420 i think ok
+DEF(zoom_busy, 0x7CAA8) //a420 ok
+DEF(focus_busy, 0x7CDC0) //a420 ok
+DEF(FlashParamsTable,0xFFD3ADB0) //a420
+DEF(canon_menu_active,0x7D54) //a420 ok
+DEF(canon_ev_corr_menu_active, 0xD1C0) //a420 unsure... a430: 0xd5d8 @ffeb0cd0, a420 @ffea189c
+DEF(canon_shoot_menu_active,0x7375) // a420, may be wrong (0x7374+1)
+DEF(recreview_hold, 0x7A148) // a420 @FFD6DEC4
+DEF(movie_status, 0x7207C) // a420 0xFFD1BE54, has to be ok
+DEF(zoom_status, 0x7228) // a420 ok (in moveopticaltotele)
+DEF(some_f_for_dng, 0x8884) // a420 found @ffe06f0c
+DEF(some_flag_for_af_scan, 0x726C8) // a420 @FFD269B8
+DEF(levent_table, 0xFFD31BA0) // a420 @ffd346d4
+DEF(playrec_mode, 0x6108) // a420 @ffd2ed68, has to be ok
+DEF(sys_mempart_id, 0xD230) // a420 @ffe9c88c, has to be ok
+
Index: /branches/release-1_0/platform/a420/sub/100b/makefile.inc
===================================================================
--- /branches/release-1_0/platform/a420/sub/100b/makefile.inc	(revision 1734)
+++ /branches/release-1_0/platform/a420/sub/100b/makefile.inc	(revision 1734)
@@ -0,0 +1,14 @@
+#310F
+PLATFORMID=12559
+
+PLATFORMOS=vxworks
+
+MAXRAMADDR=0xffffff
+MEMBASEADDR=0x1900
+RESTARTSTART=0x50000
+MEMISOSTART=0x9EF70
+ROMBASEADDR=0xffc00000
+
+
+PLFLAGS=-DMEMBASEADDR=$(MEMBASEADDR) -DMEMISOSTART=$(MEMISOSTART) -DMEMISOSIZE=$(MEMISOSIZE)
+PLFLAGS+=-DRESTARTSTART=$(RESTARTSTART)
Index: /branches/release-1_0/platform/a420/sub/100b/stubs_asm.h
===================================================================
--- /branches/release-1_0/platform/a420/sub/100b/stubs_asm.h	(revision 1734)
+++ /branches/release-1_0/platform/a420/sub/100b/stubs_asm.h	(revision 1734)
@@ -0,0 +1,20 @@
+    .text
+
+#define DEF(n,a) \
+    .globl n; n = a
+
+#define NSTUB(name, addr)\
+    .globl _##name ;\
+    .weak _##name ;\
+    _##name: ;\
+	ldr  pc, = ## addr
+
+#define NHSTUB(name, addr)\
+    .globl _##name ;\
+    _##name: ;\
+	ldr  pc, = ## addr
+
+#define STUB(addr)\
+    .globl sub_ ## addr ;\
+    sub_ ## addr: ;\
+	ldr  pc, =0x ## addr
Index: /branches/release-1_0/platform/a420/sub/100b/lib.c
===================================================================
--- /branches/release-1_0/platform/a420/sub/100b/lib.c	(revision 1734)
+++ /branches/release-1_0/platform/a420/sub/100b/lib.c	(revision 1734)
@@ -0,0 +1,86 @@
+#include "platform.h"
+#include "keyboard.h"
+
+void *hook_raw_fptr()
+{
+    return (void*)0x349CC; // a420 found in taskcreate_ImageSensorTask
+}
+
+void *hook_raw_ret_addr()
+{
+    return (void*)0xFFCAFCB0; // a420 ok
+}
+
+char *hook_raw_image_addr()
+{
+    return (char*)0x10577E28;  // same in a420 ok
+}
+
+long hook_raw_size()
+{
+    return 0x4FEED0;   //same in a420 @0xffe68a38    // ?? "CRAW BUF","WBIntegPrm.c" -  1/3" 4 MPix -  (2272*1704*10/8=0x49D7C0)
+}
+
+/*
+void *vid_get_viewport_live_fb()
+{
+    return (void*)0;
+}
+*/
+
+void *vid_get_viewport_live_fb() // from a540
+{
+       void **fb=(void **)0x4FE0; // a420 @0xFFC8BE74
+       unsigned char buff = *((unsigned char*)0x4FF0); //a420 @0xFFC8BE70
+       if (buff == 0) {
+           buff = 2;
+       }
+       else {
+           buff--;
+       }
+       return fb[buff];
+}
+
+void *vid_get_bitmap_fb()
+{
+    return (void*)0x103C79A0; // i guess OK in a420 (@ffd0791c), same as in a430
+}
+
+void *vid_get_viewport_fb()
+{
+    return (void*)0x105F2830; // also OK in a420, same as in a430 (find on "VRAM Address  : %p")
+}
+
+void *vid_get_viewport_fb_d()
+{
+    return (void*)(*(int*)0x715C8); // a420 @ffd0bb14
+}
+
+long vid_get_bitmap_screen_width()
+{
+    return 360;
+}
+
+long vid_get_bitmap_screen_height()
+{
+    return 240;
+}
+
+long vid_get_viewport_height()
+{
+    // return ((mode_get()&MODE_MASK) == MODE_PLAY) ? 240 : 230;
+    return 240;
+}
+
+char *camera_jpeg_count_str()
+{
+    return (char*)0x7C060; //a420 @ffdfe088
+} 
+
+long vid_get_bitmap_buffer_width() { return 360; }
+
+long vid_get_bitmap_buffer_height() { return 240; }
+/*
+int vid_get_viewport_width_proper()             { return ((mode_get()&MODE_MASK) == MODE_PLAY)?720:*(int*)0x34100;} //sub_ffc8e690
+int vid_get_viewport_height_proper()            { return vid_get_viewport_height(); }
+*/
Index: /branches/release-1_0/platform/a420/sub/100b/movie_rec.c
===================================================================
--- /branches/release-1_0/platform/a420/sub/100b/movie_rec.c	(revision 1734)
+++ /branches/release-1_0/platform/a420/sub/100b/movie_rec.c	(revision 1734)
@@ -0,0 +1,1121 @@
+#include "conf.h"
+
+#undef LIFTEDMLIMIT_A420 //movie time limit in hours (1, 2, 3), the limit is one hour when this is undefined
+#ifdef LIFTEDMLIMIT_A420
+int liftedmlimit_a420 = LIFTEDMLIMIT_A420;
+#if (LIFTEDMLIMIT_A420 !=  1) && (LIFTEDMLIMIT_A420 != 2) && (LIFTEDMLIMIT_A420 != 3)
+#error movie time limit is incorrect
+#endif
+#endif
+
+//adapted from A530
+int *video_quality = &conf.video_quality;
+int *video_mode    = &conf.video_mode;
+
+long def_table1[9]={0x2000,0x38D,0x788,0x5800,0x9C5,0x14B8,0x10000,0x1C6A,0x3C45};
+long def_table2[9]={0x1CCD,-0x2E1,-0x579,0x4F33,-0x7EB,-0xF0C,0xE666,-0x170A,-0x2BC6};
+
+long table1[9], table2[9];
+
+void change_video_tables(int a, int b){
+ int i;
+ for (i=0;i<9;i++) {table1[i]=(def_table1[i]*a)/b; table2[i]=(def_table2[i]*a)/b;}
+}
+
+long CompressionRateTable[]={0x60, 0x5D, 0x5A, 0x57, 0x54, 0x51, 0x4D, 0x48, 0x42, 0x3B, 0x32, 0x29, 0x22, 0x1D, 0x17, 0x14, 0x10, 0xE, 0xB, 9, 7, 6, 5, 4, 3, 2, 1};
+
+
+void __attribute__((naked,noinline)) movie_record_task(){
+	asm volatile(
+"                 STMFD   SP!, {R4,LR}\n"
+"                 SUB     SP, SP, #4\n"
+"                 MOV     R4, SP\n"
+"                 B       loc_FFD1BD84\n"
+" loc_FFD1BCE0:\n"
+"                 LDR     R3, =0x72060\n"
+"                 LDR     R2, [R3]\n"
+"                 CMP     R2, #0\n"
+"                 BNE     loc_FFD1BD70\n"
+"                 SUB     R3, R12, #2\n"
+"                 CMP     R3, #9\n"
+"                 LDRLS   PC, [PC,R3,LSL#2]\n"
+"                 B       loc_FFD1BD70\n"
+"                 .long loc_FFD1BD30\n"
+"                 .long loc_FFD1BD48\n"
+"                 .long loc_FFD1BD50\n"
+"                 .long loc_FFD1BD58\n"
+"                 .long loc_FFD1BD38\n"
+"                 .long loc_FFD1BD60\n"
+"                 .long loc_FFD1BD40\n"
+"                 .long loc_FFD1BD70\n"
+"                 .long loc_FFD1BD68\n"
+"                 .long loc_FFD1BD28\n"
+" loc_FFD1BD28:\n"
+"                 BL      sub_FFD1BE20\n"
+"                 B       loc_FFD1BD6C\n"
+" loc_FFD1BD30:\n"
+"                 BL      unlock_optical_zoom\n"
+"                 BL      sub_FFD1BFD4_my\n" //to movie time limit mod
+"                 B       loc_FFD1BD6C\n"
+" loc_FFD1BD38:\n"
+"                 BL      sub_FFD1C3E4_my\n"
+"                 B       loc_FFD1BD6C\n"
+" loc_FFD1BD40:\n"
+"                 BL      sub_FFD1C8C4\n"
+"                 B       loc_FFD1BD6C\n"
+" loc_FFD1BD48:\n"
+"                 BL      sub_FFD1C6E0\n"
+"                 B       loc_FFD1BD6C\n"
+" loc_FFD1BD50:\n"
+"                 BL      sub_FFD1CA30\n"
+"                 B       loc_FFD1BD6C\n"
+" loc_FFD1BD58:\n"
+"                 BL      sub_FFD1CBF4\n"
+"                 B       loc_FFD1BD6C\n"
+" loc_FFD1BD60:\n"
+"                 BL      sub_FFD1C94C\n"
+"                 B       loc_FFD1BD6C\n"
+" loc_FFD1BD68:\n"
+"                 BL      sub_FFD1C730\n"
+" loc_FFD1BD6C:\n"
+"                 LDR     R1, [SP]\n"
+" loc_FFD1BD70:\n"
+"                 LDR     R3, =0x71F94\n"
+"                 MOV     R2, #0\n"
+"                 STR     R2, [R1]\n"
+"                 LDR     R0, [R3]\n"
+"                 BL      sub_FFC104DC\n"
+" loc_FFD1BD84:\n"
+"                 LDR     R3, =0x71F90\n"
+"                 MOV     R1, R4\n"
+"                 LDR     R0, [R3]\n"
+"                 MOV     R2, #0\n"
+"                 BL      sub_FFC100C4\n"
+"                 LDR     R0, [SP]\n"
+"                 LDR     R12, [R0]\n"
+"                 CMP     R12, #0xC\n"
+"                 MOV     R1, R0\n"
+"                 BNE     loc_FFD1BCE0\n"
+"                 LDR     R3, =0x71F8C\n"
+"                 LDR     R0, [R3]\n"
+"                 BL      sub_FFC10E58\n"
+"                 BL      sub_FFC11620\n"
+"                 ADD     SP, SP, #4\n"
+"                 LDMFD   SP!, {R4,PC}\n"
+	);
+}
+
+void __attribute__((naked,noinline)) sub_FFD1C3E4_my(){
+	asm volatile(
+"                 STMFD   SP!, {R4-R11,LR}\n"
+"                 LDR     R5, =0x7207C\n"
+"                 SUB     SP, SP, #0x34\n"
+"                 LDR     R3, [R5]\n"
+"                 CMP     R3, #3\n"
+"                 MOV     R4, R0\n"
+"                 MOVEQ   R3, #4\n"
+"                 STREQ   R3, [R5]\n"
+"                 LDR     R3, =0x7212C\n"
+"                 MOV     LR, PC\n"
+"                 LDR     PC, [R3]\n"
+"                 LDR     R2, [R5]\n"
+"                 CMP     R2, #4\n"
+"                 BNE     loc_FFD1C5FC\n"
+"                 ADD     R0, SP, #0x58-0x28\n"
+"                 ADD     R1, SP, #0x58-0x2C\n"
+"                 ADD     R2, SP, #0x58-0x30\n"
+"                 ADD     R3, SP, #0x58-0x34\n"
+"                 BL      sub_FFD1DB90_my\n"
+"                 CMP     R0, #0\n"
+"                 BNE     loc_FFD1C460\n"
+"                 LDR     R3, =0x72068\n"
+"                 LDR     R2, [R3]\n"
+"                 CMP     R2, #1\n"
+"                 BNE     loc_FFD1C474\n"
+"                 LDR     R2, =0x720C0\n"
+"                 LDR     R1, =0x72094\n"
+"                 LDR     R12, [R2]\n"
+"                 LDR     R3, [R1]\n"
+"                 CMP     R12, R3\n"
+"                 BCC     loc_FFD1C474\n"
+" loc_FFD1C460:\n"
+"                 BL      sub_FFD1C658\n"
+"                 BL      sub_FFD1C858\n"
+"                 MOV     R3, #5\n"
+"                 STR     R3, [R5]\n"
+"                 B       loc_FFD1C5FC\n"
+" loc_FFD1C474:\n"
+"                 LDR     R12, =0x720C8\n"
+"                 LDR     R11, =0x720D4\n"
+"                 LDMIB   R4, {R0-R2}\n"
+"                 LDR     R10, [R12]\n"
+"                 LDR     R7, [R11]\n"
+"                 LDR     R4, [SP,#0x58-0x2C]\n"
+"                 LDR     R5, [SP,#0x58-0x30]\n"
+"                 LDR     R6, [SP,#0x58-0x34]\n"
+"                 LDR     R8, =0x7206C\n"
+"                 LDR     R3, [SP,#0x58-0x28]\n"
+"                 ADD     R12, SP, #0x58-0x38\n"
+"                 ADD     LR, SP, #0x58-0x3C\n"
+"                 MOV     R9, #1\n"
+"                 STMEA   SP, {R4-R6,R12}\n"
+"                 STR     R10, [SP,#0x58-0x48]\n"
+"                 STR     R7, [SP,#0x58-0x44]\n"
+"                 STR     LR, [SP,#0x58-0x40]\n"
+"                 STR     R9, [R8]\n"
+"                 BL      sub_FFC80EE4\n" //encode video frame!
+"                 LDR     R3, =0x71F84\n"
+"                 MOV     R1, #0x3E8\n"
+"                 LDR     R0, [R3]\n"
+"                 BL      sub_FFC10C70\n"
+"                 CMP     R0, #9\n"
+"                 BNE     loc_FFD1C4E8\n"
+"                 BL      sub_FFD1E3A0\n"
+"                 LDR     R3, =0x7207C\n"
+"                 LDR     R0, =0xffd1c3cc\n" //jpegtimeout
+"                 B       loc_FFD1C500\n"
+" loc_FFD1C4E8:\n"
+"                 LDR     R6, [SP,#0x58-0x3C]\n"
+"                 CMP     R6, #0\n"
+"                 BEQ     loc_FFD1C50C\n"
+"                 BL      sub_FFD1E3A0\n"
+"                 LDR     R3, =0x7207C\n"
+"                 LDR     R0, =0xffd1c3d8\n" //jpegiceerror
+" loc_FFD1C500:\n"
+"                 STR     R9, [R3]\n"
+"                 BL      sub_FFD306E8\n"
+"                 B       loc_FFD1C5FC\n"
+" loc_FFD1C50C:\n"
+"                 BL      sub_FFC81050\n"
+"                 LDR     R7, =0x720C0\n"
+"                 LDR     R0, [SP,#0x58-0x28]\n"
+"                 LDR     R1, [SP,#0x58-0x38]\n"
+"                 BL      sub_FFD1E0C4\n"
+"                 LDR     R3, [R7]\n"
+"                 LDR     R2, =0x720A8\n"
+"                 ADD     R3, R3, #1\n"
+"                 LDR     R1, [R2]\n"
+"                 MOV     R0, R3\n"
+"                 STR     R3, [R7]\n"
+"                 BL      sub_FFE96D9C\n"
+"                 CMP     R0, #0\n"
+"                 BNE     loc_FFD1C580\n"
+"                 LDR     R4, =0x72140\n"
+"                 LDR     R3, [R4]\n"
+"                 LDR     R2, =0x7208C\n"
+"                 LDR     R5, =0x72138\n"
+"                 AND     R3, R3, #1\n"
+"                 LDR     R0, [R5,R3,LSL#2]\n"
+"                 LDR     R1, [R2]\n"
+"                 BL      sub_FFD1DAD8\n"
+"                 LDR     R0, [R4]\n"
+"                 AND     R0, R0, #1\n"
+"                 ADD     R0, R5, R0,LSL#2\n"
+"                 BL      sub_FFD1DA84\n"
+"                 LDR     R3, [R4]\n"
+"                 ADD     R3, R3, #1\n"
+"                 STR     R3, [R4]\n"
+" loc_FFD1C580:\n"
+"                 LDR     R0, [SP,#0x58-0x38]\n"
+"                 MOV     R1, R11\n"
+"                 MOV     R2, R6\n"
+"                 BL      sub_FFD1CF50_my\n"
+"                 LDR     R3, =0x720E0\n"
+"                 LDR     R1, [R7]\n"
+"                 LDR     R2, [R3]\n"
+"                 LDR     R12, =0x720DC\n"
+"                 MUL     R0, R2, R1\n"
+"                 LDR     R1, [R12]\n"
+"                 BL      sub_FFE9670C\n"
+"                 LDR     R7, =0x720D8\n"
+"                 LDR     R3, [R7]\n"
+"                 MOV     R4, R0\n"
+"                 CMP     R3, R4\n"
+"                 BNE     loc_FFD1C5D4\n"
+"                 LDR     R5, =0x72070\n"
+"                 LDR     R3, [R5]\n"
+"                 CMP     R3, #1\n"
+"                 BNE     loc_FFD1C5F0\n"
+"                 B       loc_FFD1C5D8\n"
+" loc_FFD1C5D4:\n"
+"                 LDR     R5, =0x72070\n"
+" loc_FFD1C5D8:\n"
+"                 LDR     R3, =0x72110\n"
+"                 MOV     R0, R4\n"
+"                 MOV     LR, PC\n"
+"                 LDR     PC, [R3]\n"
+"                 STR     R6, [R5]\n"
+"                 STR     R4, [R7]\n"
+" loc_FFD1C5F0:\n"
+"                 LDR     R2, =0x7206C\n"
+"                 MOV     R3, #0\n"
+"                 STR     R3, [R2]\n"
+" loc_FFD1C5FC:\n"
+"                 ADD     SP, SP, #0x34\n"
+"                 LDMFD   SP!, {R4-R11,PC}\n"
+	);
+}
+
+void __attribute__((naked,noinline)) sub_FFD1DB90_my(){
+	asm volatile(
+"                 STMFD   SP!, {R4-R11,LR}\n"
+"                 LDR     R5, =0x723E4\n"
+"                 SUB     SP, SP, #0x14\n"
+"                 LDR     LR, [R5]\n"
+"                 LDR     R12, =0x723FC\n" //frame num limit
+"                 ADD     LR, LR, #1\n"
+"                 LDR     R4, [R12]\n"
+"                 STR     LR, [R5]\n"
+"                 LDR     R12, =0x7247C\n"
+"                 STR     R0, [SP,#0x38-0x28]\n"
+"                 STR     R1, [SP,#0x38-0x2C]\n"
+"                 STR     R2, [SP,#0x38-0x30]\n"
+"                 STR     R3, [SP,#0x38-0x34]\n"
+"                 CMP     LR, R4\n"
+"                 LDR     R11, [R12]\n"
+"                 MOVHI   R0, #0x80000001\n"
+"                 BHI     loc_FFD1E078\n"
+"                 LDR     R3, =0x72460\n"
+"                 MOV     R0, LR\n"
+"                 LDR     R1, [R3]\n"
+"                 BL      sub_FFE96D9C\n"
+"                 CMP     R0, #1\n"
+"                 BNE     loc_FFD1DDB0\n"
+"                 LDR     R0, =0x72484\n"
+"                 LDR     R1, =0x723D0\n"
+"                 LDR     R3, [R0]\n"
+"                 LDR     R2, [R1]\n"
+"                 CMP     R3, R2\n"
+"                 LDREQ   R3, =0x72480\n"
+"                 LDREQ   R5, [R3]\n"
+"                 MOVNE   R5, R2\n"
+"                 LDR     R3, =0x723E4\n"
+"                 LDR     R2, =0x72460\n"
+"                 LDR     R0, [R3]\n"
+"                 LDR     R1, [R2]\n"
+"                 BL      sub_FFE9670C\n"
+"                 LDR     R3, =0x723D8\n"
+"                 ADD     R0, R0, #1\n"
+"                 AND     R0, R0, #1\n"
+"                 STR     R5, [R3,R0,LSL#2]\n"
+"                 LDR     R3, =0x723CC\n"
+"                 LDR     R2, [R3]\n"
+"                 CMP     R5, R2\n"
+"                 BHI     loc_FFD1DC60\n"
+"                 LDR     R4, =0x7241C\n"
+"                 LDR     R3, [R4]\n"
+"                 ADD     R3, R5, R3\n"
+"                 ADD     R3, R3, #8\n"
+"                 CMP     R2, R3\n"
+"                 BCS     loc_FFD1DC64\n"
+" loc_FFD1DC58:\n"
+"                 MOV     R0, #0x80000003\n"
+"                 B       loc_FFD1E078\n"
+" loc_FFD1DC60:\n"
+"                 LDR     R4, =0x7241C\n"
+" loc_FFD1DC64:\n"
+"                 LDR     R3, [R4]\n"
+"                 LDR     R2, =0x72484\n"
+"                 ADD     R1, R5, R3\n"
+"                 LDR     R3, [R2]\n"
+"                 ADD     R2, R1, #8\n"
+"                 CMP     R2, R3\n"
+"                 BLS     loc_FFD1DCB0\n"
+"                 LDR     R2, =0x72480\n"
+"                 LDR     R0, =0x723CC\n"
+"                 RSB     R3, R3, R1\n"
+"                 LDR     R1, [R2]\n"
+"                 ADD     R3, R3, #8\n"
+"                 LDR     R2, [R0]\n"
+"                 ADD     R1, R1, R3\n"
+"                 CMP     R2, R1\n"
+"                 BCC     loc_FFD1DC58\n"
+"                 LDR     R3, =0x723D0\n"
+"                 STR     R1, [R3]\n"
+"                 B       loc_FFD1DCB8\n"
+" loc_FFD1DCB0:\n"
+"                 LDR     R3, =0x723D0\n"
+"                 STR     R2, [R3]\n"
+" loc_FFD1DCB8:\n"
+"                 LDR     R3, [R4]\n"
+"                 LDR     R12, =0x72430\n"
+"                 ADD     R3, R3, #0x18\n"
+"                 LDR     R2, [R12,#4]\n"
+"                 MOV     R0, R3\n"
+"                 MOV     R1, #0\n"
+"                 CMP     R1, R2\n"
+"                 BHI     loc_FFD1DEFC\n"
+"                 BNE     loc_FFD1DCE8\n"
+"                 LDR     R3, [R12]\n"
+"                 CMP     R0, R3\n"
+"                 BHI     loc_FFD1DEFC\n"
+" loc_FFD1DCE8:\n"
+"                 LDR     R4, [R4]\n"
+"                 LDR     LR, =0x72438\n"
+"                 STR     R4, [SP,#0x38-0x38]\n"
+"                 LDR     R12, =0x72430\n"
+"                 LDR     R3, =0x723E4\n"
+"                 LDMIA   LR, {R7,R8}\n"
+"                 LDMIA   R12, {R5,R6}\n"
+"                 LDR     R10, [R3]\n"
+"                 LDR     R2, =0x72460\n"
+"                 MOV     R3, R4\n"
+"                 MOV     R4, #0\n"
+"                 ADDS    R7, R7, R3\n"
+"                 ADC     R8, R8, R4\n"
+"                 LDR     R9, [R2]\n"
+"                 SUBS    R5, R5, R3\n"
+"                 SBC     R6, R6, R4\n"
+"                 MOV     R2, #0xFFFFFFFF\n"
+"                 MOV     R1, #0xFFFFFFE8\n"
+"                 ADDS    R5, R5, R1\n"
+"                 MOV     R4, #0\n"
+"                 MOV     R3, #0x18\n"
+"                 ADC     R6, R6, R2\n"
+"                 ADDS    R7, R7, R3\n"
+"                 ADC     R8, R8, R4\n"
+"                 STMIA   R12, {R5,R6}\n"
+"                 SUB     R0, R10, #1\n"
+"                 MOV     R1, R9\n"
+"                 STMIA   LR, {R7,R8}\n"
+"                 BL      sub_FFE9670C\n"
+"                 CMP     R10, #1\n"
+"                 MLA     R0, R9, R0, R0\n"
+"                 BEQ     loc_FFD1DDB0\n"
+"                 SUB     R3, R0, #1\n"
+"                 MOV     R3, R3,LSL#4\n"
+"                 ADD     R4, R11, #0x10\n"
+"                 ADD     R5, R11, #0x14\n"
+"                 LDR     R1, [R5,R3]\n"
+"                 LDR     R2, [R4,R3]\n"
+"                 LDR     LR, =0x62773130\n"
+"                 ADD     R2, R2, R1\n"
+"                 MOV     R3, R0,LSL#4\n"
+"                 ADD     R2, R2, #8\n"
+"                 MOV     R0, #0\n"
+"                 ADD     R12, R11, #0xC\n"
+"                 ADD     R1, R11, #8\n"
+"                 STR     LR, [R1,R3]\n"
+"                 STR     R0, [R12,R3]\n"
+"                 STR     R2, [R4,R3]\n"
+"                 LDR     R0, [SP,#0x38-0x38]\n"
+"                 STR     R0, [R5,R3]\n"
+" loc_FFD1DDB0:\n"
+"                 LDR     R2, =0x723D0\n"
+"                 LDR     R3, =0x72484\n"
+"                 LDR     R1, [R2]\n"
+"                 LDR     R0, [R3]\n"
+"                 ADD     R3, R1, #9\n"
+"                 CMP     R3, R0\n"
+"                 BLS     loc_FFD1DDEC\n"
+"                 LDR     R2, =0x72480\n"
+"                 LDR     R3, [R2]\n"
+"                 ADD     R3, R3, R1\n"
+"                 RSB     R3, R0, R3\n"
+"                 LDR     R0, [SP,#0x38-0x28]\n"
+"                 ADD     R3, R3, #8\n"
+"                 STR     R3, [R0]\n"
+"                 B       loc_FFD1DDF8\n"
+" loc_FFD1DDEC:\n"
+"                 ADD     R3, R1, #8\n"
+"                 LDR     R1, [SP,#0x38-0x28]\n"
+"                 STR     R3, [R1]\n"
+" loc_FFD1DDF8:\n"
+"                 LDR     R2, [SP,#0x38-0x28]\n"
+"                 LDR     R1, =0x7242C\n"
+"                 LDR     R3, =0x72484\n"
+"                 LDR     R12, [R2]\n"
+"                 LDR     R2, [R1]\n"
+"                 LDR     R0, [R3]\n"
+"                 ADD     R3, R12, R2\n"
+"                 CMP     R3, R0\n"
+"                 BLS     loc_FFD1DE4C\n"
+"                 LDR     R2, [SP,#0x38-0x2C]\n"
+"                 RSB     R0, R12, R0\n"
+"                 STR     R0, [R2]\n"
+"                 LDR     R2, =0x72480\n"
+"                 LDR     R3, [R1]\n"
+"                 LDR     R1, [R2]\n"
+"                 RSB     R3, R0, R3\n"
+"                 LDR     R0, [SP,#0x38-0x30]\n"
+"                 STR     R1, [R0]\n"
+"                 LDR     R1, [SP,#0x38-0x34]\n"
+"                 STR     R3, [R1]\n"
+"                 B       loc_FFD1DE68\n"
+" loc_FFD1DE4C:\n"
+"                 LDR     R0, [SP,#0x38-0x2C]\n"
+"                 STR     R2, [R0]\n"
+"                 LDR     R1, [SP,#0x38-0x34]\n"
+"                 MOV     R3, #0\n"
+"                 STR     R3, [R1]\n"
+"                 LDR     R2, [SP,#0x38-0x30]\n"
+"                 STR     R3, [R2]\n"
+" loc_FFD1DE68:\n"
+"                 LDR     R0, =0x723D0\n"
+"                 LDR     R1, =0x723CC\n"
+"                 LDR     R3, [R0]\n"
+"                 LDR     R2, [R1]\n"
+"                 CMP     R3, R2\n"
+"                 BHI     loc_FFD1DE94\n"
+"                 LDR     R0, [SP,#0x38-0x2C]\n"
+"                 LDR     R3, [R0]\n"
+"                 ADD     R3, R12, R3\n"
+"                 CMP     R2, R3\n"
+"                 BCC     loc_FFD1DC58\n"
+" loc_FFD1DE94:\n"
+"                 LDR     R1, [SP,#0x38-0x30]\n"
+"                 LDR     R2, [R1]\n"
+"                 CMP     R2, #0\n"
+"                 BEQ     loc_FFD1DEC8\n"
+"                 LDR     R3, =0x723CC\n"
+"                 LDR     R1, [R3]\n"
+"                 CMP     R2, R1\n"
+"                 BHI     loc_FFD1DEC8\n"
+"                 LDR     R0, [SP,#0x38-0x34]\n"
+"                 LDR     R3, [R0]\n"
+"                 ADD     R3, R2, R3\n"
+"                 CMP     R1, R3\n"
+"                 BCC     loc_FFD1DC58\n"
+" loc_FFD1DEC8:\n"
+"                 LDR     R3, =0x7242C\n"
+"                 LDR     R0, =0x72430\n"
+"                 LDR     R2, [R3]\n"
+"                 LDR     R3, [R0,#4]\n"
+"                 ADD     R2, R2, #0x18\n"
+"                 MOV     R1, R2\n"
+"                 MOV     R2, #0\n"
+"                 CMP     R2, R3\n"
+"                 BHI     loc_FFD1DEFC\n"
+"                 BNE     loc_FFD1DF04\n"
+"                 LDR     R3, [R0]\n"
+"                 CMP     R1, R3\n"
+"                 BLS     loc_FFD1DF04\n"
+" loc_FFD1DEFC:\n"
+"                 MOV     R0, #0x80000005\n"
+"                 B       loc_FFD1E078\n"
+" loc_FFD1DF04:\n"
+"                 LDR     R1, =0x72414\n"
+"                 LDR     R0, =0x72460\n"
+"                 LDR     R3, [R1]\n"
+"                 LDR     R2, [R0]\n"
+"                 ADD     R3, R3, R2,LSL#4\n"
+"                 ADD     R3, R3, R3,LSL#2\n"
+"                 LDR     R12, =0x72430\n"
+"                 MOV     R3, R3,LSL#1\n"
+"                 ADD     R3, R3, #0xA0\n"
+"                 LDR     R2, [R12,#4]\n"
+"                 MOV     R0, R3\n"
+"                 MOV     R1, #0\n"
+"                 CMP     R1, R2\n"
+"                 BHI     loc_FFD1DF4C\n"
+"                 BNE     loc_FFD1DF70\n"
+"                 LDR     R3, [R12]\n"
+"                 CMP     R0, R3\n"
+"                 BLS     loc_FFD1DF70\n"
+" loc_FFD1DF4C:\n"
+"                 LDR     R4, =0x72448\n"
+"                 LDR     R1, [R4]\n"
+"                 CMP     R1, #0\n"
+"                 BNE     loc_FFD1DF70\n"
+"                 MOV     R0, #0x3140\n" //3148
+"                 ADD     R0, R0, #0x8\n"
+"                 BL      sub_FFD34A8C\n"
+"                 MOV     R3, #1\n"
+"                 STR     R3, [R4]\n"
+" loc_FFD1DF70:\n"
+"                 LDR     R1, =0x72414\n"
+"                 LDR     R0, =0x72460\n"
+"                 LDR     R2, [R1]\n"
+"                 LDR     R3, [R0]\n"
+"                 LDR     R0, =0x72438\n"
+"                 ADD     R2, R2, R3,LSL#4\n"
+"                 MOV     R3, #0xFFFFFF60\n"
+"                 ADD     R2, R2, R2,LSL#2\n"
+"                 ADD     R3, R3, #0x40000000\n"
+"                 SUB     R3, R3, R2,LSL#1\n"
+"                 LDR     R1, [R0,#4]\n"
+"                 MOV     R4, R3\n"
+"                 MOV     R5, #0\n"
+"                 CMP     R1, R5\n"
+"                 BHI     loc_FFD1DFBC\n"
+"                 BNE     loc_FFD1DFE0\n"
+"                 LDR     R3, [R0]\n"
+"                 CMP     R3, R4\n"
+"                 BLS     loc_FFD1DFE0\n"
+" loc_FFD1DFBC:\n"
+"                 LDR     R4, =0x72448\n"
+"                 LDR     R1, [R4]\n"
+"                 CMP     R1, #0\n"
+"                 BNE     loc_FFD1DFE0\n"
+"                 MOV     R0, #0x3140\n" //3148
+"                 ADD     R0, R0, #0x8\n"
+"                 BL      sub_FFD34A8C\n"
+"                 MOV     R3, #1\n"
+"                 STR     R3, [R4]\n"
+" loc_FFD1DFE0:\n"
+"                 LDR     R3, =0x72460\n"
+"                 LDR     R0, =0x723FC\n"
+"                 LDR     R2, [R3]\n"
+"                 LDR     R12, =0x723E4\n"
+"                 LDR     R1, [R0]\n"
+"                 ADD     R3, R2, R2,LSL#2\n"
+"                 ADD     R2, R2, R3,LSL#1\n"
+"                 LDR     R0, [R12]\n"
+"                 RSB     R1, R2, R1\n"
+"                 CMP     R0, R1\n"
+"                 BLS     loc_FFD1E030\n"
+"                 LDR     R4, =0x72448\n"
+"                 LDR     R1, [R4]\n"
+"                 CMP     R1, #0\n"
+"                 BNE     loc_FFD1E030\n"
+"                 MOV     R0, #0x3140\n" //3148
+"                 ADD     R0, R0, #0x8\n"
+"                 BL      sub_FFD34A8C\n"
+"                 MOV     R3, #1\n"
+"                 STR     R3, [R4]\n"
+" loc_FFD1E030:\n"
+"                 LDR     R3, =0x72438\n"
+"                 LDR     R12, =0x7242C\n"
+"                 LDMIA   R3, {R1,R2}\n"
+"                 LDR     R0, [R12]\n"
+"                 MOV     R4, #0\n"
+"                 MOV     R3, #0x18\n"
+"                 ADDS    R1, R1, R0\n"
+"                 ADC     R2, R2, #0\n"
+"                 ADDS    R1, R1, R3\n"
+"                 ADC     R2, R2, R4\n"
+"                 CMP     R2, #0\n"
+"                 BHI     loc_FFD1E06C\n"
+"                 BNE     loc_FFD1E074\n"
+"                 CMP     R1, #0x40000000\n"
+"                 B       loc_FFD1E074\n" //previously BLS
+" loc_FFD1E06C:\n"
+"                 MOV     R0, #0x80000007\n"
+"                 B       loc_FFD1E078\n"
+" loc_FFD1E074:\n"
+"                 MOV     R0, #0\n"
+" loc_FFD1E078:\n"
+"                 ADD     SP, SP, #0x14\n"
+"                 LDMFD   SP!, {R4-R11,PC}\n"
+	);
+}
+
+void __attribute__((naked,noinline)) sub_FFD1CF50_my(){
+	asm volatile(
+"                 CMP     R2, #1\n"
+"                 STMFD   SP!, {R4-R7,LR}\n"
+"                 MOV     R7, R0\n"
+"                 MOV     R6, R1\n"
+"                 MOVEQ   R3, #0x79\n"
+"                 STREQ   R3, [R6]\n"
+"                 LDMEQFD SP!, {R4-R7,PC}\n"
+"                 LDR     R12, =0x72144\n"
+"                 LDR     R0, [R12]\n"
+"                 LDR     R3, =0x7214C\n"
+"                 CMP     R0, #0\n"
+"                 LDR     R1, [R3]\n"
+"                 BEQ     loc_FFD1CF98\n"
+"                 LDR     R2, =0x72150\n"
+"                 LDR     R3, [R2]\n"
+"                 CMP     R3, #1\n"
+"                 BNE     loc_FFD1CFAC\n"
+"                 B       loc_FFD1CF9C\n"
+" loc_FFD1CF98:\n"
+"                 LDR     R2, =0x72150\n"
+" loc_FFD1CF9C:\n"
+"                 MOV     R3, #0\n"
+"                 STR     R3, [R2]\n"
+"                 STR     R7, [R12]\n"
+"                 B       loc_FFD1D064\n"
+" loc_FFD1CFAC:\n"
+"                 LDR     R2, =0x72148\n"
+"                 LDR     R3, [R2]\n"
+"                 LDR     R5, =table1\n"
+"                 ADD     R3, R3, R3,LSL#1\n"
+"                 MOV     LR, R3,LSL#2\n"
+"                 LDR     R2, [R5,LR]\n"
+"                 LDR     R4, =table2\n"
+"                 RSB     R12, R2, R0\n"
+"                 LDR     R3, [R4,LR]\n"
+"                 CMP     R12, #0\n"
+"                 RSB     R0, R3, R0\n"
+"                 BLE     loc_FFD1D010\n"
+"                 ADD     R3, R5, #4\n"
+"                 LDR     R2, [R3,LR]\n"
+"                 CMP     R2, R12\n"
+"                 ADDGE   R1, R1, #1\n"
+"                 BGE     loc_FFD1D004\n"
+"                 ADD     R3, R5, #8\n"
+"                 LDR     R2, [R3,LR]\n"
+"                 CMP     R2, R12\n"
+"                 ADDGE   R1, R1, #2\n"
+"                 ADDLT   R1, R1, #3\n"
+" loc_FFD1D004:\n"
+"                 CMP     R1, #0x1a\n" //0xe
+"                 MOVGE   R1, #0x1a\n" //0xe
+"                 B       loc_FFD1D048\n"
+" loc_FFD1D010:\n"
+"                 CMP     R0, #0\n"
+"                 BGE     loc_FFD1D048\n"
+"                 ADD     R3, R4, #4\n"
+"                 LDR     R2, [R3,LR]\n"
+"                 CMP     R2, R0\n"
+"                 SUBLE   R1, R1, #1\n"
+"                 BLE     loc_FFD1D040\n"
+"                 ADD     R3, R4, #8\n"
+"                 LDR     R2, [R3,LR]\n"
+"                 CMP     R2, R0\n"
+"                 SUBLE   R1, R1, #2\n"
+"                 SUBGT   R1, R1, #3\n"
+" loc_FFD1D040:\n"
+"                 CMP     R1, #0\n"
+"                 MOVLT   R1, #0\n"
+" loc_FFD1D048:\n"
+"                 LDR     R0, =0x7214C\n"
+"                 LDR     R3, [R0]\n"
+"                 CMP     R1, R3\n"
+"                 LDRNE   R2, =0x72150\n"
+"                 MOVNE   R3, #1\n"
+"                 STRNE   R1, [R0]\n"
+"                 STRNE   R3, [R2]\n"
+" loc_FFD1D064:\n"
+"                 LDR     R3, =0x7214C\n"
+"                 LDR     R1, =video_mode\n" //0x5DE4
+"                 LDR     R0, [R3]\n"
+"                 LDR     R2, =CompressionRateTable\n" //0xFFD1CD84
+"                 LDR     R12, [R1]\n"
+"                 LDR     R12, [R12]\n" //+
+"                 LDR     LR, [R2,R0,LSL#2]\n"
+"                 LDR     R3, =0x72144\n"
+"                 CMP     R12, #1\n"
+"                 STR     R7, [R3]\n"
+"                 STR     LR, [R6]\n"
+//"                 MOVEQ   R3, #0xB\n" //-
+"                 LDREQ   R3, =video_quality\n" //+
+"                 LDREQ   R3, [R3]\n" //+
+"                 LDREQ   R3, [R3]\n" //+
+"                 STREQ   R3, [R6]\n"
+"                 LDMFD   SP!, {R4-R7,PC}\n"
+	);
+}
+
+//experimental stuff follows
+
+void __attribute__((naked,noinline)) sub_FFD1BFD4_my(){
+	asm volatile(
+"                 STMFD   SP!, {R4-R11,LR}\n"
+"                 LDR     R3, =0x720A8\n"
+"                 SUB     SP, SP, #0x34\n"
+"                 LDR     R12, [R3]\n"
+"                 LDR     R2, =0x72068\n"
+"                 LDR     R1, =0x7206C\n"
+"                 LDR     R0, =0x72094\n"
+"                 MOV     R11, #0\n"
+"                 STR     R11, [R2]\n"
+"                 STR     R12, [R0]\n"
+"                 STR     R11, [R1]\n"
+"                 SUB     R3, R12, #0xA\n"
+"                 CMP     R3, #0x32\n"
+"                 LDRLS   PC, [PC,R3,LSL#2]\n"
+"                 B       loc_FFD1C0F4\n"
+"                 .long loc_FFD1C0DC, loc_FFD1C0F4, loc_FFD1C0F4, loc_FFD1C0F4\n"
+"                 .long loc_FFD1C0F4, loc_FFD1C0DC, loc_FFD1C0F4, loc_FFD1C0F4\n"
+"                 .long loc_FFD1C0F4, loc_FFD1C0F4, loc_FFD1C0E4, loc_FFD1C0F4\n"
+"                 .long loc_FFD1C0F4, loc_FFD1C0F4, loc_FFD1C0F4, loc_FFD1C0F4\n"
+"                 .long loc_FFD1C0F4, loc_FFD1C0F4, loc_FFD1C0F4, loc_FFD1C0F4\n"
+"                 .long loc_FFD1C0E4, loc_FFD1C0F4, loc_FFD1C0F4, loc_FFD1C0F4\n"
+"                 .long loc_FFD1C0F4, loc_FFD1C0F4, loc_FFD1C0F4, loc_FFD1C0F4\n"
+"                 .long loc_FFD1C0F4, loc_FFD1C0F4, loc_FFD1C0F4, loc_FFD1C0F4\n"
+"                 .long loc_FFD1C0F4, loc_FFD1C0F4, loc_FFD1C0F4, loc_FFD1C0F4\n"
+"                 .long loc_FFD1C0F4, loc_FFD1C0F4, loc_FFD1C0F4, loc_FFD1C0F4\n"
+"                 .long loc_FFD1C0F4, loc_FFD1C0F4, loc_FFD1C0F4, loc_FFD1C0F4\n"
+"                 .long loc_FFD1C0F4, loc_FFD1C0F4, loc_FFD1C0F4, loc_FFD1C0F4\n"
+"                 .long loc_FFD1C0F4, loc_FFD1C0F4, loc_FFD1C0EC\n"
+" loc_FFD1C0DC:\n"
+"                 MOV     R11, #2\n"
+"                 B       loc_FFD1C104\n"
+" loc_FFD1C0E4:\n"
+"                 MOV     R11, #4\n"
+"                 B       loc_FFD1C104\n"
+" loc_FFD1C0EC:\n"
+"                 MOV     R11, #8\n"
+"                 B       loc_FFD1C104\n"
+" loc_FFD1C0F4:\n"
+"                 MOV     R1, #0x3AC\n"
+"                 LDR     R0, =0xFFD1B5A8\n"
+"                 ADD     R1, R1, #1\n"
+"                 BL      sub_FFC03AEC\n"
+" loc_FFD1C104:\n"
+"                 LDR     R4, =0x72130\n"
+"                 MOV     R1, #0\n"
+"                 MOV     R2, R4\n"
+"                 MOV     R0, #8\n"
+"                 BL      sub_FFC0281C\n"
+"                 LDR     R5, =0x72088\n"
+"                 LDR     R1, =0x72090\n"
+"                 LDR     R3, [R5]\n"
+"                 LDR     R2, [R1]\n"
+"                 MUL     R12, R3, R2\n"
+"                 LDR     R2, =0x720A4\n"
+"                 LDR     R2, [R2]\n"
+"                 LDR     R1, [R4,#4]\n"
+"                 LDR     R5, =0x720A8\n"
+"                 STR     R2, [SP,#0x58-0x2C]\n"
+"                 LDR     LR, =0x72080\n"
+"                 LDR     R7, =0x720A0\n" //movie picture width in pixels
+"                 LDR     R3, =0x72074\n"
+"                 LDR     R2, [R7]\n"
+"                 LDR     R6, [R5]\n"
+"                 LDR     R9, [LR]\n"
+"                 LDR     R5, =0x72084\n"
+"                 LDR     LR, [R3]\n"
+"                 LDR     R7, =0x72088\n"
+"                 LDR     R3, =0x72090\n"
+"                 LDR     R0, [R4]\n"
+"                 LDR     R4, [R5]\n"
+"                 LDRH    R5, [R7]\n"
+"                 LDRH    R7, [R3]\n"
+"                 LDR     R3, =0x7208C\n"
+"                 MOV     R12, R12,LSL#13\n"
+"                 LDR     R8, [R3]\n"
+"                 LDR     R10, =0xFFD1C704\n" //sub
+"                 STR     R4, [SP,#0x58-0x50]\n"
+"                 LDR     R4, =0x72098\n"
+"                 LDR     R3, [SP,#0x58-0x2C]\n"
+"                 MOV     R12, R12,LSR#16\n"
+"                 STR     R12, [SP,#0x58-0x48]\n"
+"                 STR     R5, [SP,#0x58-0x44]\n"
+"                 STR     R7, [SP,#0x58-0x40]\n"
+"                 STR     R4, [SP,#0x58-0x30]\n"
+"                 STMEA   SP, {R6,LR}\n"
+"                 STR     R9, [SP,#0x58-0x4C]\n"
+"                 STR     R11, [SP,#0x58-0x3C]\n"
+"                 STR     R8, [SP,#0x58-0x38]\n"
+"                 STR     R10, [SP,#0x58-0x34]\n"
+"                 LDR     R4, =0x720E4\n"
+"                 BL      sub_FFD1D24C_my\n" //!!!
+"                 LDR     R12, =0x720E8\n"
+"                 LDR     R3, =0x72108\n"
+"                 LDR     R0, [R4]\n"
+"                 LDMIA   R3, {R1,R2}\n"
+"                 LDR     R3, [R12]\n"
+"                 BL      sub_FFD1D550\n"
+"                 LDR     R7, =0x72074\n"
+"                 LDR     R5, =0x720A0\n" //movie picture width in pixels
+"                 LDR     R12, [R7]\n"
+"                 LDR     R0, [R5]\n"
+"                 LDR     R2, =0x720D4\n"
+"                 MOV     R3, #0\n"
+"                 LDR     R1, =0x720C8\n"
+"                 STR     R12, [SP]\n"
+"                 BL      sub_FFD1CE60\n"
+"                 LDR     R2, =0x7209C\n"
+"                 LDR     R1, =0x720EC\n"
+"                 LDR     R3, [R2]\n"
+"                 LDR     R0, [R1]\n"
+"                 LDR     R2, =0xFFD1B568\n"
+"                 ADD     R3, R3, R3,LSL#1\n"
+"                 ADD     R3, R3, R0\n"
+"                 LDR     R0, [R2,R3,LSL#2]\n"
+"                 MOV     R1, #1\n"
+"                 BL      sub_FFC80EA0\n"
+"                 LDR     R0, =0xFFD1C3B4\n" //sub
+"                 MOV     R1, #0\n"
+"                 BL      sub_FFC810C8\n"
+"                 MOV     R0, #0\n"
+"                 BL      sub_FFC1D0C8\n"
+"                 TST     R0, #1\n"
+"                 BEQ     loc_FFD1C250\n"
+"                 LDR     R0, =0xFFD1B5A8\n"
+"                 MOV     R1, #0x3E0\n"
+"                 BL      sub_FFC03AEC\n"
+" loc_FFD1C250:\n"
+"                 LDR     R3, =0x5DE0\n"
+"                 MOV     R7, #1\n"
+"                 LDR     R0, =0xFFD1C8AC\n" //sub
+"                 MOV     R1, #0\n"
+"                 STR     R7, [R3]\n"
+"                 BL      sub_FFC1D0D8\n"
+"                 LDR     R3, =0x71F84\n"
+"                 MOV     R1, #0x1E\n"
+"                 LDR     R0, [R3]\n"
+"                 BL      sub_FFC10C70\n"
+"                 CMP     R0, #9\n"
+"                 BNE     loc_FFD1C290\n"
+"                 MOV     R1, #0x3E4\n"
+"                 LDR     R0, =0xFFD1B5A8\n"
+"                 ADD     R1, R1, R7\n"
+"                 BL      sub_FFC03AEC\n"
+" loc_FFD1C290:\n"
+"                 LDR     R3, =0x72088\n"
+"                 LDR     R1, =0x72090\n"
+"                 LDR     R4, =0x72084\n"
+"                 LDR     R2, [R1]\n"
+"                 LDR     R0, [R4]\n"
+"                 LDR     R1, [R3]\n"
+"                 BL      nullsub\n"
+"                 ADD     R5, SP, #0x30\n"
+"                 MOV     R0, R5\n"
+"                 BL      sub_FFD1DA84\n"
+"                 LDR     R3, =0x7208C\n"
+"                 LDR     R0, [SP,#0x30]\n"
+"                 LDR     R1, [R3]\n"
+"                 BL      nullsub\n"
+"                 LDR     R4, =0x72140\n"
+"                 LDR     R3, [SP,#0x30]\n"
+"                 LDR     R6, =0x72138\n"
+"                 MOV     R0, R5\n"
+"                 STR     R3, [R6]\n"
+"                 STR     R7, [R4]\n"
+"                 BL      sub_FFD1DA84\n"
+"                 LDR     R5, =0x7208C\n"
+"                 LDR     R0, [SP,#0x30]\n"
+"                 LDR     R1, [R5]\n"
+"                 BL      nullsub\n"
+"                 LDR     R3, [R4]\n"
+"                 LDR     R0, [SP,#0x30]\n"
+"                 LDR     R5, =0x7212C\n"
+"                 LDR     R12, =0xFFD1C80C\n" //loc
+"                 LDR     LR, =0x7207C\n"
+"                 ADD     R2, R3, #1\n"
+"                 MOV     R1, #2\n"
+"                 AND     R3, R3, #1\n"
+"                 STR     R0, [R6,R3,LSL#2]\n"
+"                 STR     R2, [R4]\n"
+"                 STR     R12, [R5]\n"
+"                 STR     R1, [LR]\n"
+"                 ADD     SP, SP, #0x34\n"
+"                 LDMFD   SP!, {R4-R11,PC}\n"
+" nullsub:        MOV PC, LR\n"
+	);
+}
+
+void __attribute__((naked,noinline)) sub_FFD1D24C_my(){ //ffd20b58 in a430
+	asm volatile( //patched to remove 3 minute limit for 320x240 and 640x480 videos (changes based on a430 fw)
+"                 STMFD   SP!, {R4-R11,LR}\n"
+"                 MOV     R9, R2\n"
+"                 LDR     R2, =0x7245C\n"
+"                 SUB     SP, SP, #8\n"
+"                 LDRSH   R12, [SP,#0x3C]\n"
+"                 LDRSH   LR, [SP,#0x2C+0x1C]\n"
+"                 LDR     R11, [SP,#0x2C]\n"
+"                 LDRSH   R8, [SP,#0x2C+0x14]\n"
+"                 LDRSH   R7, [SP,#0x2C+0x18]\n"
+"                 STR     R3, [R2]\n"
+"                 LDR     R2, [SP,#0x2C+0x8]\n"
+"                 LDR     R3, =0x72464\n"
+"                 STR     R2, [R3]\n"
+"                 LDR     R3, [SP,#0x2C+0xC]\n"
+"                 LDR     R4, =0x72468\n"
+"                 LDR     R6, =0x72470\n"
+"                 STR     R3, [R4]\n"
+"                 LDR     R2, =0x72472\n"
+"                 LDR     R3, =0x72474\n"
+"                 MOV     R12, R12,LSL#16\n"
+"                 MOV     LR, LR,LSL#16\n"
+"                 LDR     R5, =0x7246C\n"
+"                 MOV     R12, R12,LSR#16\n"
+"                 MOV     LR, LR,LSR#16\n"
+"                 STR     R12, [R5]\n"
+"                 STRH    R8, [R6]\n" //R8 is free to use from here
+"                 STR     LR, [R3]\n"
+"                 STRH    R7, [R2]\n"
+"                 LDR     R12, [SP,#0x2C+0x24]\n"
+"                 LDR     R10, =0x72498\n"
+"                 LDR     R2, =0x72458\n"
+"                 LDR     R3, =0x72460\n"
+"                 CMP     R9, #0x400\n" //this would mean 1024x768 video :)
+"                 STR     R9, [R2]\n"
+"                 STR     R12, [R10]\n"
+"                 STR     R11, [R3]\n"
+"                 MOV     R4, R0\n"
+"                 MOV     R6, R1\n"
+"                 BNE     loc_FFD1D320\n"
+"                 ADD     R2, R11, R11,LSL#1\n"
+"                 RSB     R2, R2, R2,LSL#4\n"
+"                 LDR     R12, =0x723FC\n"
+"                 LDR     R7, =0x7242C\n"
+"                 MOV     R0, R2,LSL#2\n"
+"                 MOV     R3, #0xb40\n" //dead code, no need to change
+"                 MOV     R1, #0x80000\n"
+"                 STR     R1, [R7]\n"
+"                 ADD     R3, R3, #8\n"
+"                 STR     R0, [R12]\n"
+"                 MOV     R12, #3\n"
+"                 ADD     R2, R3, R2,LSL#6\n"
+"                 STR     R12, [SP,#0x2C-0x28]\n"
+"                 B       loc_FFD1D3F0\n"
+" loc_FFD1D320:\n"
+"                 CMP     R9, #0x280\n" //640x480
+"                 BNE     loc_FFD1D360\n"
+//"                 ADD     R2, R11, R11,LSL#1\n"
+//"                 MOV     R3, #0xb40\n"
+//"                 RSB     R2, R2, R2,LSL#4\n"
+/*
+AVI index size calculation:
+- every video and audio frame needs an index entry
+- there is exactly one audio frame for every second of the recording
+- an index entry occupies 16 bytes
+- extra overhead: 8 bytes
+
+The indexes occupy RAM during recording, the A420 has 16MB of RAM
+3 hours recordings seem to be possible, but (according to my tests):
+- with movie time limit set to 3 hours: in 320x240 mode the exclamation mark was constantly displayed (it means too high bitrate originally, which was not the case here)
+- with movie time limit set to 2 hours: the warning for "this recording will end soon" (i.e. time display turns red) kicked in around an hour before the actual end
+- the camera refuses to recognize movies longer than one hour (they play fine on a computer)
+*/
+#ifdef LIFTEDMLIMIT_A420
+"LDR R7, =liftedmlimit_a420\n"
+"LDR R3, =0xE100\n" //size for audio indexes, for 1 hour
+"MUL R3, R7, R3\n" //multiplied
+"RSB R8, R11, R11, LSL#4\n"
+"RSB R2, R8, R8, LSL#4\n" //size for video indexes, for 1 hour
+"MUL R2, R7, R2\n" //multiplied
+#else
+"RSB R8, R11, R11, LSL#4\n"
+"MOV R3, #0xE100\n" //1 hour
+"RSB R2, R8, R8, LSL#4\n" //1 hour
+#endif
+"                 ADD     R3, R3, #8\n" //index overhead
+"                 LDR     R7, =0x7242C\n"
+"                 LDR     R12, =0x723FC\n"
+//"                 MOV     R0, R2,LSL#2\n"
+"MOV R0, R2, LSL#4\n"
+"                 MOV     R1, #0x40000\n"
+//"                 ADD     R2, R3, R2,LSL#6\n"
+"ADD R2, R3, R2, LSL#8\n"
+"                 MOV     R3, #2\n"
+"                 STR     R1, [R7]\n"
+"                 STR     R0, [R12]\n"
+"                 STR     R3, [SP,#0x2C-0x28]\n"
+"                 B       loc_FFD1D3F0\n"
+" loc_FFD1D360:\n"
+"                 CMP     R9, #0x140\n" //320x240
+"                 BNE     loc_FFD1D3BC\n"
+//"                 ADD     R2, R11, R11,LSL#1\n"
+//"                 MOV     R3, #0xb40\n"
+//"                 RSB     R2, R2, R2,LSL#4\n"
+#ifdef LIFTEDMLIMIT_A420
+"LDR R7, =liftedmlimit_a420\n"
+"LDR R3, =0xE100\n" //size for audio indexes, for 1 hour
+"MUL R3, R7, R3\n" //multiplied
+"RSB R8, R11, R11, LSL#4\n"
+"RSB R2, R8, R8, LSL#4\n" //size for video indexes, for 1 hour
+"MUL R2, R7, R2\n" //multiplied
+#else
+"RSB R8, R11, R11, LSL#4\n"
+"MOV R3, #0xE100\n" //1 hour
+"RSB R2, R8, R8, LSL#4\n" //1 hour
+#endif
+"                 ADD     R3, R3, #8\n"
+"                 LDR     R7, =0x7242C\n"
+"                 LDR     R12, =0x723FC\n"
+//"                 MOV     R0, R2,LSL#2\n"
+"MOV R0, R2, LSL#4\n"
+"                 MOV     R1, #0x20000\n"
+//"                 ADD     R2, R3, R2,LSL#6\n"
+"ADD R2, R3, R2, LSL#8\n"
+"                 CMP     R11, #0x3C\n"
+"                 MOV     R3, #1\n"
+"                 STR     R1, [R7]\n"
+"                 STR     R0, [R12]\n"
+"                 STR     R3, [SP,#0x2C-0x28]\n"
+"                 BNE     loc_FFD1D3F0\n"
+//"                 RSB     R3, R11, R11,LSL#4\n"
+//"                 MOV     R2, R3,LSL#6\n"
+//"                 MOV     R3, R3,LSL#2\n"
+//"                 STR     R3, [R12]\n"
+//"                 ADD     R2, R2, #0x3C8\n"
+/*
+the following is a 60 sec limit for the hi-speed video (which is not available here)
+*/
+"MOV  R3, R8,LSL#2\n"
+"MOV  R2, #0xE400\n"
+"STR  R3, [R12]\n"
+"ADD  R2, R2, #0xC8\n"
+"                 B       loc_FFD1D3F0\n"
+" loc_FFD1D3BC:\n" //160x120
+"                 ADD     R2, R11, R11,LSL#1\n"
+"                 RSB     R2, R2, R2,LSL#4\n"
+"                 LDR     R12, =0x723FC\n"
+"                 LDR     R7, =0x7242C\n"
+"                 MOV     R0, R2,LSL#2\n"
+"                 MOV     R1, #0x10000\n"
+"                 STR     R1, [R7]\n"
+"                 MOV     R3, #0xb40\n" //resolution too low, 3 minutes are more than enough...
+"                 STR     R0, [R12]\n"
+"                 MOV     R12, #0\n"
+"                 ADD     R3, R3, #8\n"
+"                 STR     R12, [SP,#0x2C-0x28]\n"
+"                 ADD     R2, R3, R2,LSL#6\n"
+" loc_FFD1D3F0:\n"
+"                 ADD     LR, R4, #0xF\n"
+"                 LDR     R3, [SP,#0x4C]\n"
+"                 BIC     LR, LR, #0xF\n"
+"                 ADD     LR, LR, #8\n"
+"                 ADD     R5, LR, R2\n"
+"                 LDR     R1, [R7]\n"
+"                 MOV     R2, R3,LSL#1\n"
+"                 LDR     R3, [SP,#0x2C+0x28]\n"
+"                 ADD     R12, R4, R6\n"
+"                 STR     R1, [R3]\n"
+"                 LDR     R3, [SP,#0x2C+0x4]\n"
+"                 RSB     R12, R5, R12\n"
+"                 RSB     R12, R2, R12\n"
+"                 SUBS    R3, R3, #0\n"
+"                 MOVNE   R3, #1\n"
+"                 SUB     R12, R12, #0x10\n"
+"                 STR     R3, [SP]\n"
+"                 BIC     R12, R12, #0x7F00\n"
+"                 LDR     R3, =0x7248C\n"
+"                 BIC     R12, R12, #0xFF\n"
+"                 STR     R12, [R3]\n"
+"                 LDR     R6, =0x7247C\n"
+"                 LDR     R3, =0x72484\n"
+"                 ADD     R4, R5, R12\n"
+"                 STR     LR, [R6]\n"
+"                 STR     R4, [R3]\n"
+"                 LDR     R12, [SP,#0x4C]\n"
+"                 LDR     R11, =0x72480\n"
+"                 LDR     R10, =0x72488\n"
+"                 LDR     R3, =0x7241C\n"
+"                 MOV     R0, R4\n"
+"                 MOV     R1, #0x80\n"
+"                 STR     R12, [R3]\n"
+"                 STR     R5, [R11]\n"
+"                 ADD     R2, R2, #0x10\n"
+"                 STR     R4, [R10]\n"
+"                 BL      sub_FFC7FE44\n"//equivalent sub in a430: FFC831C0, but not called at this place
+"                 LDR     R10, [R10]\n"
+"                 LDR     R9, [R11]\n"
+"                 LDR     LR, =0x62773130\n"
+"                 LDR     R12, =0x723D8\n"
+"                 LDR     R0, =0x7241C\n"
+"                 MOV     R1, #0\n"
+" loc_FFD1D49C:\n"
+"                 LDR     R3, [R0]\n"
+"                 ADD     R3, R3, #8\n"
+"                 MUL     R2, R3, R1\n"
+"                 STR     LR, [R10,R2]\n"
+"                 STR     R9, [R12,R1,LSL#2]\n"
+"                 LDR     R3, [R0]\n"
+"                 ADD     R1, R1, #1\n"
+"                 ADD     R2, R10, R2\n"
+"                 CMP     R1, #1\n"
+"                 STR     R3, [R2,#4]\n"
+"                 BLE     loc_FFD1D49C\n"
+"                 LDR     R3, =0x72460\n"
+"                 LDR     R1, [SP]\n"
+"                 LDR     R2, [R3]\n"
+"                 LDR     R0, [SP,#0x2C-0x28]\n"
+"                 BL      sub_FFCFBE50\n"
+"                 LDR     R3, =0x7241C\n"
+"                 LDR     R2, [R3]\n"
+"                 LDR     R1, =0x72414\n"
+"                 ADD     R0, R0, R2\n"
+"                 STR     R0, [R1]\n"
+"                 ADD     SP, SP, #8\n"
+"                 LDMFD   SP!, {R4-R11,PC}\n"
+	);
+}
+
Index: /branches/release-1_0/platform/a420/sub/100b/stubs_auto.S
===================================================================
--- /branches/release-1_0/platform/a420/sub/100b/stubs_auto.S	(revision 1734)
+++ /branches/release-1_0/platform/a420/sub/100b/stubs_auto.S	(revision 1734)
@@ -0,0 +1,144 @@
+/* THIS FILE IS GENERATED */
+/* DO NOT EDIT THIS FILE! */
+
+#include "stubs_asm.h"
+
+STUB(FFC011C4)
+STUB(FFC012B0)
+STUB(FFC0136C)
+STUB(FFC01704)
+STUB(FFC01728)
+STUB(FFC017E8)
+STUB(FFC01968)
+STUB(FFC019C4)
+STUB(FFC019D0)
+STUB(FFC019F4)
+STUB(FFC01A10)
+STUB(FFC01A3C)
+STUB(FFC0281C)
+STUB(FFC03AEC)
+STUB(FFC0F99C)
+STUB(FFC0F9AC)
+STUB(FFC0FB48)
+STUB(FFC100C4)
+STUB(FFC104DC)
+STUB(FFC10C70)
+STUB(FFC10E58)
+STUB(FFC11620)
+STUB(FFC14714)
+STUB(FFC1D0C8)
+STUB(FFC1D0D8)
+STUB(FFC7FE44)
+STUB(FFC80EA0)
+STUB(FFC80EE4)
+STUB(FFC81050)
+STUB(FFC810C8)
+STUB(FFC87868)
+STUB(FFC87D14)
+STUB(FFC920C0)
+STUB(FFC92A50)
+STUB(FFC92DC8)
+STUB(FFC94778)
+STUB(FFC94838)
+STUB(FFC94BB8)
+STUB(FFCB8664)
+STUB(FFCD90D0)
+STUB(FFCD91AC)
+STUB(FFCD92DC)
+STUB(FFCD9378)
+STUB(FFCD9414)
+STUB(FFCD9444)
+STUB(FFCD94A0)
+STUB(FFCD9560)
+STUB(FFCD9638)
+STUB(FFCD9774)
+STUB(FFCD98A4)
+STUB(FFCD9A78)
+STUB(FFCD9B80)
+STUB(FFCD9C44)
+STUB(FFCD9D04)
+STUB(FFCD9E8C)
+STUB(FFCD9F20)
+STUB(FFCD9FA0)
+STUB(FFCDA098)
+STUB(FFCDA268)
+STUB(FFCDA2F8)
+STUB(FFCDA3CC)
+STUB(FFCDA4B8)
+STUB(FFCDA564)
+STUB(FFCDA6E8)
+STUB(FFCDA764)
+STUB(FFCDB110)
+STUB(FFCDB2B4)
+STUB(FFCDB2D4)
+STUB(FFCDB310)
+STUB(FFCDB34C)
+STUB(FFCFBE50)
+STUB(FFD1BE20)
+STUB(FFD1BFD4)
+STUB(FFD1C3E4)
+STUB(FFD1C658)
+STUB(FFD1C6E0)
+STUB(FFD1C730)
+STUB(FFD1C858)
+STUB(FFD1C8C4)
+STUB(FFD1C94C)
+STUB(FFD1CA30)
+STUB(FFD1CBF4)
+STUB(FFD1CE60)
+STUB(FFD1CF50)
+STUB(FFD1D24C)
+STUB(FFD1D550)
+STUB(FFD1DA84)
+STUB(FFD1DAD8)
+STUB(FFD1DB90)
+STUB(FFD1E0C4)
+STUB(FFD1E3A0)
+STUB(FFD23FF8)
+STUB(FFD24448)
+STUB(FFD25CD4)
+STUB(FFD25ECC)
+STUB(FFD25FD4)
+STUB(FFD26E18)
+STUB(FFD27234)
+STUB(FFD27244)
+STUB(FFD27BA0)
+STUB(FFD27C6C)
+STUB(FFD27CD4)
+STUB(FFD27F20)
+STUB(FFD27F30)
+STUB(FFD283D0)
+STUB(FFD28434)
+STUB(FFD28474)
+STUB(FFD28790)
+STUB(FFD28818)
+STUB(FFD288E0)
+STUB(FFD28998)
+STUB(FFD28AF0)
+STUB(FFD28B88)
+STUB(FFD28C44)
+STUB(FFD28D2C)
+STUB(FFD28D80)
+STUB(FFD2905C)
+STUB(FFD290DC)
+STUB(FFD29118)
+STUB(FFD292D0)
+STUB(FFD29844)
+STUB(FFD2EC88)
+STUB(FFD2EC94)
+STUB(FFD2ECA8)
+STUB(FFD306E8)
+STUB(FFD34A8C)
+STUB(FFE47B78)
+STUB(FFE8DAA8)
+STUB(FFE9670C)
+STUB(FFE96D9C)
+STUB(FFE9AAC8)
+STUB(FFE9C438)
+STUB(FFE9C938)
+STUB(FFEA15CC)
+STUB(FFEA2044)
+STUB(FFEA8830)
+STUB(FFEAC960)
+STUB(FFEAF720)
+STUB(FFEB42A0)
Index: /branches/release-1_0/platform/a420/sub/100b/Makefile
===================================================================
--- /branches/release-1_0/platform/a420/sub/100b/Makefile	(revision 1734)
+++ /branches/release-1_0/platform/a420/sub/100b/Makefile	(revision 1734)
@@ -0,0 +1,6 @@
+topdir=../../../../
+
+OBJS=boot.o stubs_min.o stubs_auto.o stubs_entry.o lib.o stubs_entry_2.o capt_seq.o movie_rec.o
+STUBS_AUTO_DEPS=boot.c capt_seq.c movie_rec.c
+
+include  $(topdir)platform/makefile_sub.inc
Index: /branches/release-1_0/platform/a420/sub/Makefile
===================================================================
--- /branches/release-1_0/platform/a420/sub/Makefile	(revision 1734)
+++ /branches/release-1_0/platform/a420/sub/Makefile	(revision 1734)
@@ -0,0 +1,8 @@
+topdir=../../../
+include $(topdir)makefile.inc
+
+SUBDIRS=$(PLATFORMSUB)
+
+all: all-recursive
+
+clean: clean-recursive
Index: /branches/release-1_0/platform/a420/shooting.c
===================================================================
--- /branches/release-1_0/platform/a420/shooting.c	(revision 1734)
+++ /branches/release-1_0/platform/a420/shooting.c	(revision 1734)
@@ -0,0 +1,143 @@
+#define PARAM_FILE_COUNTER      0x34 //correct, according to the debug display
+#define PARAM_EXPOSURE_COUNTER  0x01 //params start at 0, this is the second one
+
+#include "platform.h"
+
+const ApertureSize aperture_sizes_table[] = {
+    {  9, 288, "2.8" },
+    { 10, 302, "3.2" },
+    { 11, 318, "3.5" },
+    { 12, 339, "3.5" },
+    { 13, 363, "4.0" },
+    { 14, 390, "4.5" },
+    { 15, 420, "5.1" },
+    { 16, 453, "8.0 ND" },
+    { 17, 470, "9.0 ND" },
+    { 18, 489, "10.0 ND" },
+    { 19, 514, "10.0 ND" },
+    { 20, 540, "11.0 ND" },
+    { 21, 569, "13.0 ND" },
+    { 22, 601, "16.0 ND" },
+};
+
+const ShutterSpeed shutter_speeds_table[] = {
+    { -12, -384, "15", 15000000 },
+    { -11, -352, "13", 13000000 },
+    { -10, -320, "10", 10000000 },
+    {  -9, -288, "8",   8000000 },
+    {  -8, -256, "6",   6000000 },
+    {  -7, -224, "5",   5000000 },
+    {  -6, -192, "4",   4000000 },
+    {  -5, -160, "3.2", 3200000 },
+    {  -4, -128, "2.5", 2500000 },
+    {  -3,  -96, "2",   2000000 },
+    {  -2,  -64, "1.6", 1600000 },
+    {  -1,  -32, "1.3", 1300000 },
+    {   0,    0, "1",   1000000 },
+    {   1,   32, "0.8",  800000 },
+    {   2,   64, "0.6",  600000 },
+    {   3,   96, "0.5",  500000 },
+    {   4,  128, "0.4",  400000 },
+    {   5,  160, "0.3",  300000 },
+    {   6,  192, "1/4",  250000 },
+    {   7,  224, "1/5",  200000 },
+    {   8,  256, "1/6",  166667 },
+    {   9,  288, "1/8",  125000 },
+    {  10,  320, "1/10", 100000 },
+    {  11,  352, "1/13",  76923 },
+    {  12,  384, "1/15",  66667 },
+    {  13,  416, "1/20",  50000 },
+    {  14,  448, "1/25",  40000 },
+    {  15,  480, "1/30",  33333 },
+    {  16,  512, "1/40",  25000 },
+    {  17,  544, "1/50",  20000 },
+    {  18,  576, "1/60",  16667 },
+    {  19,  608, "1/80",  12500 },
+    {  20,  640, "1/100", 10000 },
+    {  21,  672, "1/125",  8000 },
+    {  22,  704, "1/160",  6250 },
+    {  23,  736, "1/200",  5000 },
+    {  24,  768, "1/250",  4000 },
+    {  25,  800, "1/320",  3125 },
+    {  26,  832, "1/400",  2500 },
+    {  27,  864, "1/500",  2000 },
+    {  28,  896, "1/640",  1563 },
+    {  29,  928, "1/800",  1250 },
+    {  30,  960, "1/1000", 1000 },
+    {  31,  992, "1/1250",  800 },
+    {  32, 1021, "1/1600",  625 },
+    {  33, 1053, "1/2000",  500 },
+};
+
+const ISOTable iso_table[] = {
+    {  0,    0, "Auto", -1},
+    {  1,   64,   "64", -1},
+    {  2,  100,  "100", -1},
+    {  3,  200,  "200", -1},
+    {  4,  400,  "400", -1},
+};
+
+/*
+canon mode list ffd38ba0 in a420 100b
+*/          
+static const CapturemodeMap modemap[] = {
+//    { MODE_M,                  32769 },
+    { MODE_P,                  0x8004 },
+    { MODE_AUTO,               0x8000 },
+    { MODE_PORTRAIT,           0x400c },
+    { MODE_STITCH,             0x8209 },
+    { MODE_SCN_NIGHT_SNAPSHOT, 0x400a }, // "night snapshot"
+    { MODE_SCN_KIDS_PETS,      0x400e }, // "kids and pets"
+    { MODE_SCN_INDOOR,         0x400f }, // "indoor"
+    { MODE_SCN_FOLIAGE,        0x4010 }, // "foliage"
+    { MODE_SCN_SNOW,           0x4011 }, // "snow"
+    { MODE_SCN_BEACH,          0x4012 }, // "beach"
+    { MODE_SCN_FIREWORK,       0x4013 }, // "fireworks"
+    { MODE_SCN_COLOR_ACCENT,   0x8217 }, // "color accent"
+    { MODE_SCN_COLOR_SWAP,     0x8218 }, // "color swap"
+    { MODE_VIDEO_STD,          0xe1d  }, // from propcase 0, no distinction of movie modes here
+    { MODE_SUPER_MACRO,        0x8208 }  // "super macro"
+//    { MODE_VIDEO_SPEED,        2594  }, // "fast frame rate"
+//    { MODE_VIDEO_COMPACT,      3613  }, // "compact"
+//    { MODE_VIDEO_COLOR_ACCENT, 3613  }, // "color accent"
+//    { MODE_VIDEO_COLOR_SWAP,   3613  }, // "color swap"
+/*
+other values from the modemap that cause crash when trying to set
+0x0e1f //crashes...
+0x0e1e //crashes...
+0x0e22 //crashes...
+0x0e20 //crashes...
+0x0000 //crashes, may not be a mode
+0xffff //crashes, may not be a mode
+
+0xe1d is not in the modemap table...
+
+*/
+};
+#include "../generic/shooting.c"
+
+/*long get_file_next_counter() {
+    return get_file_counter();
+}*/
+
+long get_file_next_counter() { //looks like this hack is needed for old vxworks
+    return ((get_file_counter()>>4)+1)<<4;
+}
+
+long get_target_file_num() {
+    long n;
+    
+    n = get_file_next_counter();
+    n = (n>>4)&0x3FFF;
+    return n;
+}
+
+long get_target_dir_num() {
+    long n;
+    
+    n = get_file_next_counter();
+    n = (n>>18)&0x3FF;
+    return n;
+}
+
+int circle_of_confusion = 5;
Index: /branches/release-1_0/platform/a420/Makefile
===================================================================
--- /branches/release-1_0/platform/a420/Makefile	(revision 1734)
+++ /branches/release-1_0/platform/a420/Makefile	(revision 1734)
@@ -0,0 +1,25 @@
+curdir=./
+topdir=../../
+
+include $(topdir)makefile.inc
+
+CFLAGS+=-DLOW_LEVEL
+
+SUBDIRS=sub
+
+all: all-recursive libplatform.a
+
+OBJS=main.o lib.o wrappers.o kbd.o shooting.o
+# stubs_init.o
+
+kbd.o: kbd.c ../generic/kbd.c
+lib.o: lib.c ../generic/lib.c
+main.o: main.c ../generic/main.c
+shooting.o: shooting.c ../generic/shooting.c
+wrappers.o: wrappers.c ../generic/wrappers.c
+
+libplatform.a: $(OBJS)
+
+clean: clean-recursive
+	rm -f $(OBJS) libplatform.a
+
Index: /branches/release-1_0/platform/generic/kbd.c
===================================================================
--- /branches/release-1_0/platform/generic/kbd.c	(revision 1733)
+++ /branches/release-1_0/platform/generic/kbd.c	(revision 1734)
@@ -34,5 +34,5 @@
 #endif
 
-#if defined(CAMERA_a630) || defined(CAMERA_a640) || defined(CAMERA_a610) || defined(CAMERA_a620) || defined(CAMERA_ixus800_sd700) || defined(CAMERA_ixus65_sd630) || defined(CAMERA_ixus850_sd800) || defined(CAMERA_ixus900_sd900) || defined (CAMERA_ixus70_sd1000) || defined (CAMERA_ixus950_sd850) || defined(CAMERA_a410) || defined(CAMERA_a430)
+#if defined(CAMERA_a630) || defined(CAMERA_a640) || defined(CAMERA_a610) || defined(CAMERA_a620) || defined(CAMERA_ixus800_sd700) || defined(CAMERA_ixus65_sd630) || defined(CAMERA_ixus850_sd800) || defined(CAMERA_ixus900_sd900) || defined (CAMERA_ixus70_sd1000) || defined (CAMERA_ixus950_sd850) || defined(CAMERA_a410) || defined(CAMERA_a430) || defined(CAMERA_a420)
 #define USB_MASK 0x8000000
 #define USB_REG 1
@@ -62,5 +62,5 @@
 #endif
 	
-#if defined(CAMERA_a610) || defined(CAMERA_a620) || defined(CAMERA_a630) || defined(CAMERA_a640) || defined(CAMERA_ixus800_sd700) || defined(CAMERA_a410) || defined(CAMERA_a430)
+#if defined(CAMERA_a610) || defined(CAMERA_a620) || defined(CAMERA_a630) || defined(CAMERA_a640) || defined(CAMERA_ixus800_sd700) || defined(CAMERA_a410) || defined(CAMERA_a430) || defined(CAMERA_a420)
         x = (long)*mmio1;
 #endif
@@ -73,5 +73,5 @@
 }
 
-#if defined(CAMERA_a530) || defined(CAMERA_a540) || defined(CAMERA_a610) || defined(CAMERA_a620) || defined(CAMERA_a630) || defined(CAMERA_a640) || defined(CAMERA_a700)|| defined(CAMERA_a710) || defined (CAMERA_ixus800_sd700) || defined(CAMERA_a410) || defined(CAMERA_a430)
+#if defined(CAMERA_a530) || defined(CAMERA_a540) || defined(CAMERA_a610) || defined(CAMERA_a620) || defined(CAMERA_a630) || defined(CAMERA_a640) || defined(CAMERA_a700)|| defined(CAMERA_a710) || defined (CAMERA_ixus800_sd700) || defined(CAMERA_a410) || defined(CAMERA_a430) || defined(CAMERA_a420)
 void wait_until_remote_button_is_released(void)
 {
Index: /branches/release-1_0/core/kbd.c
===================================================================
--- /branches/release-1_0/core/kbd.c	(revision 1733)
+++ /branches/release-1_0/core/kbd.c	(revision 1734)
@@ -66,4 +66,5 @@
     defined(CAMERA_ixus300_sd4000) || \
     defined(CAMERA_a410) || \
+    defined(CAMERA_a420) || \
     defined(CAMERA_ixus1000_sd4500)|| \
     defined(CAMERA_a800)
Index: /branches/release-1_0/loader/a420/blobs.S
===================================================================
--- /branches/release-1_0/loader/a420/blobs.S	(revision 1734)
+++ /branches/release-1_0/loader/a420/blobs.S	(revision 1734)
@@ -0,0 +1,28 @@
+    .globl blob_copy_and_reset, blob_copy_and_reset_size
+    .globl blob_chdk_core, blob_chdk_core_size
+
+
+    .section .blob_copy_and_reset
+blob_copy_and_reset_start:
+    .incbin RESET_FILE
+blob_copy_and_reset_end:
+
+
+
+    .section .blob_chdk_core
+blob_chdk_core_start:
+    .incbin CORE_FILE
+blob_chdk_core_end:
+
+
+    .text
+blob_chdk_core_size:
+    .long blob_chdk_core_end - blob_chdk_core_start
+blob_chdk_core:
+    .long blob_chdk_core_start
+
+
+blob_copy_and_reset_size:
+    .long blob_copy_and_reset_end - blob_copy_and_reset_start
+blob_copy_and_reset:
+    .long blob_copy_and_reset_start
Index: /branches/release-1_0/loader/a420/entry.S
===================================================================
--- /branches/release-1_0/loader/a420/entry.S	(revision 1734)
+++ /branches/release-1_0/loader/a420/entry.S	(revision 1734)
@@ -0,0 +1,20 @@
+    .section .entry
+
+// Turn OFF SD Card power
+// to support autostart
+	LDR     R3, =0xC02200BC 
+	MOV     R2, #0x44
+	STR     R2, [R3]
+
+// looks like idle cycle is required for proper shutdown
+	MOV     R3, #0x8000
+1:
+	SUB	R3, R3, #1
+	CMP	R3, #0
+	BNE	1b
+
+// ordinary startup...
+
+	MOV     SP, #0x1900
+	MOV     R11, #0
+	B	my_restart
Index: /branches/release-1_0/loader/a420/main.c
===================================================================
--- /branches/release-1_0/loader/a420/main.c	(revision 1734)
+++ /branches/release-1_0/loader/a420/main.c	(revision 1734)
@@ -0,0 +1,62 @@
+static void __attribute__((noreturn)) shutdown();
+static void __attribute__((noreturn)) panic(int cnt);
+
+extern long *blob_chdk_core;
+extern long *blob_copy_and_reset;
+extern long blob_chdk_core_size;
+extern long blob_copy_and_reset_size;
+
+
+
+void __attribute__((noreturn)) my_restart() 
+{
+    void __attribute__((noreturn)) (*copy_and_restart)(char *dst, char *src, long length);
+    int i;
+
+    for (i=0;i<(blob_copy_and_reset_size/sizeof(long));i++){
+	((long*)(RESTARTSTART))[i] = blob_copy_and_reset[i];
+    }
+
+    copy_and_restart = (void*)RESTARTSTART;
+    copy_and_restart((void*)MEMISOSTART, (char*)blob_chdk_core, blob_chdk_core_size);
+}
+
+#define LED_PR 0xc0220084
+
+static void __attribute__((noreturn)) shutdown()
+{
+    volatile long *p = (void*)0xc02200a0;
+        
+    asm(
+         "MRS     R1, CPSR\n"
+         "AND     R0, R1, #0x80\n"
+         "ORR     R1, R1, #0x80\n"
+         "MSR     CPSR_cf, R1\n"
+         :::"r1","r0");
+        
+    *p = 0x44;
+
+    while(1);
+}
+
+
+static void __attribute__((noreturn)) panic(int cnt)
+{
+	volatile long *p=(void*)LED_PR;
+	int i;
+
+	for(;cnt>0;cnt--){
+		p[0]=0x46;
+
+		for(i=0;i<0x200000;i++){
+			asm ("nop\n");
+			asm ("nop\n");
+		}
+		p[0]=0x44;
+		for(i=0;i<0x200000;i++){
+			asm ("nop\n");
+			asm ("nop\n");
+		}
+	}
+	shutdown();
+}
Index: /branches/release-1_0/loader/a420/Makefile
===================================================================
--- /branches/release-1_0/loader/a420/Makefile	(revision 1734)
+++ /branches/release-1_0/loader/a420/Makefile	(revision 1734)
@@ -0,0 +1,42 @@
+curdir=./
+topdir=../../
+
+include $(topdir)makefile.inc
+SUBDIRS=resetcode
+
+LDLIBS=
+LDOPTS=-nostdlib -Wl,--allow-shlib-undefined -Wl,--no-define-common,-EL,-T,$(topdir)tools/link-boot.ld
+LDOPTS+=-Wl,-N,-Ttext,$(MEMBASEADDR)
+
+CPPFLAGS+=-I.
+
+CORE_FILE=$(topdir)core/main.bin
+RESET_FILE=$(curdir)resetcode/main.bin
+
+CPPFLAGS+=-DCORE_FILE=\"$(CORE_FILE)\"
+CPPFLAGS+=-DRESET_FILE=\"$(RESET_FILE)\"
+
+all: all-recursive main.bin
+
+OBJS=entry.o main.o blobs.o
+
+main.bin: main.elf
+	@echo $< \-\> $@
+	$(OBJDUMP) -z -d main.elf > main.dump
+	$(OBJCOPY) -O binary main.elf main.bin
+
+main.elf: $(OBJS)
+	@echo \-\> $@
+	$(CC) $(CFLAGS) -o $@ $^   $(LDLIBS) $(LDFLAGS) $(LDOPTS)
+	( $(NM) $@ | grep ' U ' > $@.syms ) && exit 1 || exit 0
+
+clean: clean-recursive
+	rm -f $(OBJS) main.bin main.elf main.dump main.elf.syms
+
+distclean: distclean-recursive
+	rm -f $(OBJS) main.bin main.elf main.dump main.elf.syms
+	rm -f reboot_core.h copy_and_reset.h
+
+blobs.o: $(RESET_FILE) $(CORE_FILE)
+
+include $(topdir)bottom.inc
Index: /branches/release-1_0/loader/a420/resetcode/entry.S
===================================================================
--- /branches/release-1_0/loader/a420/resetcode/entry.S	(revision 1734)
+++ /branches/release-1_0/loader/a420/resetcode/entry.S	(revision 1734)
@@ -0,0 +1,6 @@
+	.section .entry
+
+	MOV     SP, #0x1900
+	MOV     R11, #0
+	B	copy_and_restart
+
Index: /branches/release-1_0/loader/a420/resetcode/main.c
===================================================================
--- /branches/release-1_0/loader/a420/resetcode/main.c	(revision 1734)
+++ /branches/release-1_0/loader/a420/resetcode/main.c	(revision 1734)
@@ -0,0 +1,127 @@
+void blink_blue(int duration)
+{
+  int i;
+
+  *((volatile long *) 0xc0220084) = 0x46; // Turn on LED   
+  for (i=0; i<duration; i++) // Wait a while   
+  {   
+    asm volatile ( "nop\n" );   
+  }   
+   
+  *((volatile long *) 0xc0220084) = 0x44; // Turn off LED   
+  for (i=0; i<duration; i++) // Wait a while   
+  {   
+    asm volatile ( "nop\n" );   
+  }
+}
+
+void blink_orange(int duration)
+{
+  int i;
+
+  *((volatile long *) 0xc0220090) = 0x46; // Turn on LED   
+  for (i=0; i<duration; i++) // Wait a while   
+  {   
+    asm volatile ( "nop\n" );   
+  }   
+   
+  *((volatile long *) 0xc0220090) = 0x44; // Turn off LED   
+  for (i=0; i<duration; i++) // Wait a while   
+  {   
+    asm volatile ( "nop\n" );   
+  }
+}
+
+void blink()
+{
+    blink_blue(1000000);
+    blink_orange(1000000);
+    blink_blue(1000000);
+}
+
+/*
+ * Operating system has died. Known functions will be killed
+ * after memmove.
+ *
+ * Make sure stack is not used.
+ */
+
+void __attribute__((noreturn)) copy_and_restart(void *dst_void, const void *src_void, long length)
+{
+{
+//    blink(); //    "BL      blink\n"
+  char *dst = dst_void;
+  const char *src = src_void;
+
+  if (src < dst && dst < src + length)
+    {
+      /* Have to copy backwards */
+      src += length;
+      dst += length;
+      while (length--)
+	{
+	  *--dst = *--src;
+	}
+    }
+  else
+    {
+      while (length--)
+	{
+	  *dst++ = *src++;
+	}
+    }
+}
+
+    asm volatile(
+	"MRS     R1, CPSR\n"
+	"BIC     R1, R1, #0x3F\n"
+	"ORR     R1, R1, #0xD3\n"
+	"MSR     CPSR_cf, R1\n"
+
+	"LDR     R2, =0xC0200000\n"
+	"MOV     R1, #0xFFFFFFFF\n"
+	"STR     R1, [R2,#0x10C]\n"
+	"STR     R1, [R2,#0xC]\n"
+	"STR     R1, [R2,#0x1C]\n"
+	"STR     R1, [R2,#0x2C]\n"
+	"STR     R1, [R2,#0x3C]\n"
+	"STR     R1, [R2,#0x4C]\n"
+	"STR     R1, [R2,#0x5C]\n"
+	"STR     R1, [R2,#0x6C]\n"
+	"STR     R1, [R2,#0x7C]\n"
+	"STR     R1, [R2,#0x8C]\n"
+	"STR     R1, [R2,#0x9C]\n"
+	"STR     R1, [R2,#0xAC]\n"
+	"STR     R1, [R2,#0xBC]\n"
+	"STR     R1, [R2,#0xCC]\n"
+	"STR     R1, [R2,#0xDC]\n"
+	"STR     R1, [R2,#0xEC]\n"
+	"STR     R1, [R2,#0xFC]\n"
+
+	"MOV     R1, #0x78\n"
+	"MCR     p15, 0, R1,c1,c0\n"
+	"MOV     R1, #0\n"
+	"MCR     p15, 0, R1,c7,c10, 4\n"
+	"MCR     p15, 0, R1,c7,c5\n"
+	"MCR     p15, 0, R1,c7,c6\n"
+	"MOV     R2, #0x40000000\n"
+	"ORR     R1, R2, #6\n"
+	"MCR     p15, 0, R1,c9,c1\n"
+	"ORR     R1, R1, #6\n"
+	"MCR     p15, 0, R1,c9,c1, 1\n"
+	"MRC     p15, 0, R1,c1,c0\n"
+	"ORR     R1, R1, #0x50000\n"
+	"MCR     p15, 0, R1,c1,c0\n"
+
+	"MOV     R3, #0xFF0\n"
+	"LDR     R1, =0x12345678\n"
+	"ADD     R3, R3, #0x4000000C\n"
+	"STR     R1, [R3]\n"
+
+	"MOV     SP, #0x1900\n"
+	"MOV     LR, PC\n"
+	"MOV     PC, %0\n"
+    : : "r"(dst_void) : "memory","r1","r2","r3");
+
+    while(1);
+}
Index: /branches/release-1_0/loader/a420/resetcode/Makefile
===================================================================
--- /branches/release-1_0/loader/a420/resetcode/Makefile	(revision 1734)
+++ /branches/release-1_0/loader/a420/resetcode/Makefile	(revision 1734)
@@ -0,0 +1,30 @@
+topdir=../../../
+
+include $(topdir)makefile.inc
+
+# warning: library order matters!
+LDLIBS=
+LDOPTS=-nostdlib -Wl,--allow-shlib-undefined -Wl,--no-define-common,-EL,-T,$(topdir)tools/link-boot.ld
+LDOPTS+=-Wl,-N,-Ttext,$(RESTARTSTART)
+
+all: main.bin
+
+OBJS=entry.o main.o
+
+main.bin: main.elf
+	@echo $< \-\> $@
+	$(OBJDUMP) -z -d main.elf > main.dump
+	$(OBJCOPY) -O binary main.elf main.bin
+
+main.elf: $(OBJS)
+	@echo \-\> $@
+	$(CC) $(CFLAGS) -o $@ $^   $(LDLIBS) $(LDFLAGS) $(LDOPTS)
+	( $(NM) $@ | grep ' U ' > $@.syms ) && exit 1 || exit 0
+
+clean:
+	rm -f $(OBJS) main.bin main.elf main.dump main.elf.syms
+
+distclean: distclean-recursive
+	rm -f $(OBJS) main.bin main.elf main.dump main.elf.syms
+
+include $(topdir)bottom.inc
Index: /branches/release-1_0/camera_list.csv
===================================================================
--- /branches/release-1_0/camera_list.csv	(revision 1733)
+++ /branches/release-1_0/camera_list.csv	(revision 1734)
@@ -12,4 +12,5 @@
 a3300,100d,BETA,,
 a410,100f,BETA,100e,
+a420,100b,ALPHA,,
 a430,100b,BETA,,
 a450,100d,,,
