Index: /branches/reyalp-ptp-live/include/shot_histogram.h
===================================================================
--- /branches/reyalp-ptp-live/include/shot_histogram.h	(revision 1668)
+++ /branches/reyalp-ptp-live/include/shot_histogram.h	(revision 1668)
@@ -0,0 +1,13 @@
+#ifndef SHOT_HISTOGRAM_H
+#define SHOT_HISTOGRAM_H
+
+int shot_histogram_set(int enable);
+int shot_histogram_isenabled();
+void build_shot_histogram();
+
+int shot_histogram_get_range(int histo_from, int histo_to);
+
+#define SHOT_HISTOGRAM_STEP 31
+#define SHOT_HISTOGRAM_MARGIN 100
+
+#endif
Index: /branches/reyalp-ptp-live/include/histogram.h
===================================================================
--- /branches/reyalp-ptp-live/include/histogram.h	(revision 1668)
+++ /branches/reyalp-ptp-live/include/histogram.h	(revision 1668)
@@ -0,0 +1,10 @@
+#ifndef HISTOGRAM_H
+#define HISTOGRAM_H
+
+#define HISTO_WIDTH                 128 // Note code is optimised for this value, it should not be changed!
+#define HISTO_HEIGHT                50
+
+extern void histogram_process();
+extern void gui_osd_draw_histo();
+
+#endif
Index: /branches/reyalp-ptp-live/include/keyboard.h
===================================================================
--- /branches/reyalp-ptp-live/include/keyboard.h	(revision 1668)
+++ /branches/reyalp-ptp-live/include/keyboard.h	(revision 1668)
@@ -0,0 +1,64 @@
+#ifndef KEYBOARD_H
+#define KEYBOARD_H
+
+#define KEY_UP          1
+#define KEY_DOWN        2
+#define KEY_LEFT        3
+#define KEY_RIGHT       4
+#define KEY_SET         5
+#define KEY_SHOOT_HALF  6
+#define KEY_SHOOT_FULL  7       // includes KEY_SHOOT_HALF press/release. See also KEY_SHOOT_FULL_ONLY.
+#define KEY_ZOOM_IN     8
+#define KEY_ZOOM_OUT    9
+#define KEY_MENU        10
+#define KEY_DISPLAY     11
+#define KEY_PRINT       12      //S-series: Shortcut
+#define KEY_ERASE       13      //S-series: Func
+#define KEY_ISO         14      //S-series
+#define KEY_FLASH       15      //S-series
+#define KEY_MF          16      //S-series
+#define KEY_MACRO       17      //S-series
+#define KEY_VIDEO       18      //S-series
+#define KEY_TIMER       19      //S-series
+#define KEY_EXPO_CORR   20      //G-series
+#define KEY_MICROPHONE  21
+#define KEY_FACE        22      //SX100IS
+#define KEY_DUMMY       23      //dummy key for pressing to disable energy saving in alt mode
+
+// SX30
+#define KEY_ZOOM_IN1	24	// SX30 has three zoom speeds each way
+#define KEY_ZOOM_IN2	25
+#define KEY_ZOOM_IN3	26
+#define KEY_ZOOM_OUT1	27
+#define KEY_ZOOM_OUT2	28
+#define KEY_ZOOM_OUT3	29
+#define	KEY_ZOOM_ASSIST	30	// SX30 new button
+
+// G12
+#define	KEY_AE_LOCK		31	// G12 AE/FE Lock button
+#define	KEY_METERING	32	// G12 metering mode button
+
+//SX220 
+#define KEY_PLAYBACK    33 
+#define KEY_LEFT_SOFT   34    // jogdial keys have two steps 
+#define KEY_RIGHT_SOFT  35 
+#define KEY_UP_SOFT     36 
+#define KEY_DOWN_SOFT   37  
+
+#define KEY_SHOOT_FULL_ONLY 38  // As KEY_SHOOT_FULL but press/release KEY_SHOOT_HALF is not included
+
+#define JOGDIAL_LEFT    100
+#define JOGDIAL_RIGHT   101
+#define FRONTDIAL_LEFT    102
+#define FRONTDIAL_RIGHT   103
+
+extern void gui_kbd_process();
+extern void gui_kbd_enter();
+extern void gui_kbd_leave();
+extern void other_kbd_process();
+
+#ifdef CAM_TOUCHSCREEN_UI
+extern int redraw_buttons;
+#endif
+
+#endif
Index: /branches/reyalp-ptp-live/include/lauxlib.h
===================================================================
--- /branches/reyalp-ptp-live/include/lauxlib.h	(revision 1668)
+++ /branches/reyalp-ptp-live/include/lauxlib.h	(revision 1668)
@@ -0,0 +1,161 @@
+/*
+** $Id: lauxlib.h,v 1.88.1.1 2007/12/27 13:02:25 roberto Exp $
+** Auxiliary functions for building Lua libraries
+** See Copyright Notice in lua.h
+*/
+
+
+#ifndef lauxlib_h
+#define lauxlib_h
+
+
+#include <stddef.h>
+#include <stdio.h>
+
+#include "lua.h"
+
+
+#if defined(LUA_COMPAT_GETN)
+LUALIB_API int (luaL_getn) (lua_State *L, int t);
+LUALIB_API void (luaL_setn) (lua_State *L, int t, int n);
+#else
+#define luaL_getn(L,i)          ((int)lua_objlen(L, i))
+#define luaL_setn(L,i,j)        ((void)0)  /* no op! */
+#endif
+
+#if defined(LUA_COMPAT_OPENLIB)
+#define luaI_openlib	luaL_openlib
+#endif
+
+/* extra error code for `luaL_load' */
+#define LUA_ERRFILE     (LUA_ERRERR+1)
+
+typedef struct luaL_Reg {
+  const char *name;
+  lua_CFunction func;
+} luaL_Reg;
+
+LUALIB_API void (luaI_openlib) (lua_State *L, const char *libname,
+                                const luaL_Reg *l, int nup);
+LUALIB_API void (luaL_register) (lua_State *L, const char *libname,
+                                const luaL_Reg *l);
+LUALIB_API int (luaL_getmetafield) (lua_State *L, int obj, const char *e);
+LUALIB_API int (luaL_callmeta) (lua_State *L, int obj, const char *e);
+LUALIB_API int (luaL_typerror) (lua_State *L, int narg, const char *tname);
+LUALIB_API int (luaL_argerror) (lua_State *L, int numarg, const char *extramsg);
+LUALIB_API const char *(luaL_checklstring) (lua_State *L, int numArg,
+                                                          size_t *l);
+LUALIB_API const char *(luaL_optlstring) (lua_State *L, int numArg,
+                                          const char *def, size_t *l);
+LUALIB_API lua_Number (luaL_checknumber) (lua_State *L, int numArg);
+LUALIB_API lua_Number (luaL_optnumber) (lua_State *L, int nArg, lua_Number def);
+
+LUALIB_API lua_Integer (luaL_checkinteger) (lua_State *L, int numArg);
+LUALIB_API lua_Integer (luaL_optinteger) (lua_State *L, int nArg,
+                                          lua_Integer def);
+
+LUALIB_API void (luaL_checkstack) (lua_State *L, int sz, const char *msg);
+LUALIB_API void (luaL_checktype) (lua_State *L, int narg, int t);
+LUALIB_API void (luaL_checkany) (lua_State *L, int narg);
+
+LUALIB_API int   (luaL_newmetatable) (lua_State *L, const char *tname);
+LUALIB_API void *(luaL_checkudata) (lua_State *L, int ud, const char *tname);
+
+LUALIB_API void (luaL_where) (lua_State *L, int lvl);
+LUALIB_API int (luaL_error) (lua_State *L, const char *fmt, ...);
+
+LUALIB_API int (luaL_checkoption) (lua_State *L, int narg, const char *def,
+                                   const char *const lst[]);
+
+LUALIB_API int (luaL_ref) (lua_State *L, int t);
+LUALIB_API void (luaL_unref) (lua_State *L, int t, int ref);
+
+LUALIB_API int (luaL_loadfile) (lua_State *L, const char *filename);
+LUALIB_API int (luaL_loadbuffer) (lua_State *L, const char *buff, size_t sz,
+                                  const char *name);
+LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s);
+
+LUALIB_API lua_State *(luaL_newstate) (void);
+
+
+LUALIB_API const char *(luaL_gsub) (lua_State *L, const char *s, const char *p,
+                                                  const char *r);
+
+LUALIB_API const char *(luaL_findtable) (lua_State *L, int idx,
+                                         const char *fname, int szhint);
+
+/*
+** ===============================================================
+** some useful macros
+** ===============================================================
+*/
+
+#define luaL_argcheck(L, cond,numarg,extramsg)  \
+        ((void)((cond) || luaL_argerror(L, (numarg), (extramsg))))
+#define luaL_checkstring(L,n)   (luaL_checklstring(L, (n), NULL))
+#define luaL_optstring(L,n,d)   (luaL_optlstring(L, (n), (d), NULL))
+#define luaL_checkint(L,n)      ((int)luaL_checkinteger(L, (n)))
+#define luaL_optint(L,n,d)      ((int)luaL_optinteger(L, (n), (d)))
+#define luaL_checklong(L,n)     ((long)luaL_checkinteger(L, (n)))
+#define luaL_optlong(L,n,d)     ((long)luaL_optinteger(L, (n), (d)))
+
+#define luaL_typename(L,i)  lua_typename(L, lua_type(L,(i)))
+
+#define luaL_dofile(L, fn) \
+    (luaL_loadfile(L, fn) || lua_pcall(L, 0, LUA_MULTRET, 0))
+
+#define luaL_dostring(L, s) \
+    (luaL_loadstring(L, s) || lua_pcall(L, 0, LUA_MULTRET, 0))
+
+#define luaL_getmetatable(L,n)	(lua_getfield(L, LUA_REGISTRYINDEX, (n)))
+
+#define luaL_opt(L,f,n,d)	(lua_isnoneornil(L,(n)) ? (d) : f(L,(n)))
+
+/*
+** {======================================================
+** Generic Buffer manipulation
+** =======================================================
+*/
+
+typedef struct luaL_Buffer {
+  char *p;      /* current position in buffer */
+  int lvl;      /* number of strings in the stack (level) */
+  lua_State *L;
+  char buffer[LUAL_BUFFERSIZE];
+} luaL_Buffer;
+
+#define luaL_addchar(B,c) \
+  ((void)((B)->p < ((B)->buffer+LUAL_BUFFERSIZE) || luaL_prepbuffer(B)), \
+   (*(B)->p++ = (char)(c)))
+
+/* compatibility only */
+#define luaL_putchar(B,c)   luaL_addchar(B,c)
+
+#define luaL_addsize(B,n)   ((B)->p += (n))
+
+LUALIB_API void (luaL_buffinit) (lua_State *L, luaL_Buffer *B);
+LUALIB_API char *(luaL_prepbuffer) (luaL_Buffer *B);
+LUALIB_API void (luaL_addlstring) (luaL_Buffer *B, const char *s, size_t l);
+LUALIB_API void (luaL_addstring) (luaL_Buffer *B, const char *s);
+LUALIB_API void (luaL_addvalue) (luaL_Buffer *B);
+LUALIB_API void (luaL_pushresult) (luaL_Buffer *B);
+
+/* }====================================================== */
+
+/* compatibility with ref system */
+
+/* pre-defined references */
+#define LUA_NOREF       (-2)
+#define LUA_REFNIL      (-1)
+
+#define lua_ref(L,lock) ((lock) ? luaL_ref(L, LUA_REGISTRYINDEX) : \
+      (lua_pushstring(L, "unlocked references are obsolete"), lua_error(L), 0))
+
+#define lua_unref(L,ref)        luaL_unref(L, LUA_REGISTRYINDEX, (ref))
+
+#define lua_getref(L,ref)       lua_rawgeti(L, LUA_REGISTRYINDEX, (ref))
+
+
+#define luaL_reg    luaL_Reg
+
+#endif
Index: /branches/reyalp-ptp-live/include/limits.h
===================================================================
--- /branches/reyalp-ptp-live/include/limits.h	(revision 1668)
+++ /branches/reyalp-ptp-live/include/limits.h	(revision 1668)
@@ -0,0 +1,9 @@
+#ifndef LIMITS_H
+#define LIMITS_H
+
+#define INT_MAX 2147483647
+#define SHRT_MAX 32767
+
+#define UCHAR_MAX 255
+
+#endif
Index: /branches/reyalp-ptp-live/include/console.h
===================================================================
--- /branches/reyalp-ptp-live/include/console.h	(revision 1668)
+++ /branches/reyalp-ptp-live/include/console.h	(revision 1668)
@@ -0,0 +1,18 @@
+#ifndef _CONSOLE_H
+#define _CONSOLE_H
+
+#define MAX_CONSOLE_LINES        14
+#define MAX_CONSOLE_LINE_LENGTH  45
+#define CONSOLE_HIDE_TIMEOUT     3000
+
+void console_close();
+void console_init(int num_lines, int line_length, int x_pos, int y_pos);
+void console_clear();
+void console_add_line(const char *str);
+void console_draw();
+void console_set_layout(int x1, int y1, int x2, int y2);
+void console_redraw();
+void console_set_autoredraw(int val);
+
+#endif // _CONSOLE_H
+
Index: /branches/reyalp-ptp-live/include/script.h
===================================================================
--- /branches/reyalp-ptp-live/include/script.h	(revision 1668)
+++ /branches/reyalp-ptp-live/include/script.h	(revision 1668)
@@ -0,0 +1,46 @@
+#ifndef SCRIPT_H
+#define SCRIPT_H
+
+//-------------------------------------------------------------------
+#define SCRIPT_DEFAULT_FILENAME     "A/SCRIPT.BAS"
+#define SCRIPT_NUM_PARAMS           26
+#define SCRIPT_DATA_PATH            "A/CHDK/DATA/"
+
+#ifdef OPT_UBASIC
+#include "ubasic.h"
+#endif
+
+#ifdef OPT_LUA
+#include "../core/luascript.h"
+#endif
+
+//-------------------------------------------------------------------
+
+extern char script_title[36];
+extern char script_params[SCRIPT_NUM_PARAMS][28];
+extern int script_param_order[SCRIPT_NUM_PARAMS];
+
+//-------------------------------------------------------------------
+extern void script_load(const char *fn, int saved_params);
+extern void script_console_add_line(const char *str);
+extern void script_print_screen_init();
+extern void script_print_screen_end();
+extern void script_print_screen_statement(int val);
+extern int load_params_values(const char *fn, int update_vars, int read_param_set);
+extern void save_params_values(int unconditional);
+//-------------------------------------------------------------------
+
+long script_stack_start();
+int script_is_running();
+void script_end();
+long script_start_gui( int autostart );
+
+int script_key_is_pressed( int keyid );
+int script_key_is_clicked( int keyid );
+int script_keyid_by_name( const char *name );
+#ifdef OPT_LUA
+long script_start_ptp( char *script );
+#endif
+void script_wait_and_end();
+
+#endif
Index: /branches/reyalp-ptp-live/include/dryos23.h
===================================================================
--- /branches/reyalp-ptp-live/include/dryos23.h	(revision 1668)
+++ /branches/reyalp-ptp-live/include/dryos23.h	(revision 1668)
@@ -0,0 +1,41 @@
+#ifndef _DRYOS_R23_
+#define _DRYOS_R23_
+/******************************************************************************/
+/**              DRYOS version 2.3, release #0023                            **/
+/**              Internal DryOS kernel data types and constants              **/
+/******************************************************************************/
+#define TASK_STATE_READY    0
+#define TASK_STATE_WAIT     1
+#define TASK_STATE_SUSPEND  2
+/******************************************************************************/
+// Task context
+struct context_t
+{
+    unsigned int cpsr;
+    unsigned int r[13];
+    unsigned int lr;
+    unsigned int pc;
+};
+typedef struct context_t context_t;
+/******************************************************************************/
+// Task control block
+struct task_t
+{
+    unsigned int unknown1[2];
+    unsigned int priority;
+    void *entry;
+    unsigned int argument;
+    unsigned int unknown2[2];
+    void *stack_addr;
+    unsigned int stack_size;
+    char *name;
+    unsigned int unknown3[6];
+    unsigned int task_id;
+    unsigned char unknown4;
+    unsigned char state;
+    unsigned char unknown5[6];
+    context_t *context;         // SP value, context stored on the stack
+};
+typedef struct task_t task_t;
+/******************************************************************************/
+#endif
Index: /branches/reyalp-ptp-live/include/font.h
===================================================================
--- /branches/reyalp-ptp-live/include/font.h	(revision 1668)
+++ /branches/reyalp-ptp-live/include/font.h	(revision 1668)
@@ -0,0 +1,50 @@
+#ifndef FONT_H
+#define FONT_H
+
+#include "gui.h"
+
+//-------------------------------------------------------------------
+#define FONT_CP_WIN     0
+#define FONT_CP_DOS     1
+
+#define  FONT_CP_WIN_1250       0
+#define  FONT_CP_WIN_1251       1
+#define  FONT_CP_WIN_1252       2
+#define  FONT_CP_WIN_1254       3
+#define  FONT_CP_WIN_1257       4
+/* 1253 (Greek) */
+#define  FONT_CP_WIN_1253       5
+
+//-------------------------------------------------------------------
+// Format of header block for each character in the 'font_data' array
+// This is immediately followed by 'size' bytes of character data.
+typedef struct {
+	unsigned char charcode[2];      // Don't change this to a short as the data is not aligned in memory
+	unsigned char offset;
+	unsigned char size;
+} FontData;
+
+//-------------------------------------------------------------------
+extern void font_init();
+extern void font_set(int codepage);
+extern unsigned char *get_current_font_data(char ch);
+
+extern int rbf_load_symbol(char *file);
+extern void rbf_load_from_file(char *file, int codepage);
+extern int rbf_font_height();
+extern int rbf_symbol_height();
+extern int rbf_char_width(int ch);
+extern int rbf_symbol_width(int ch);
+extern int rbf_str_width(const char *str);
+extern void rbf_set_codepage(int codepage);
+extern int rbf_draw_char(int x, int y, int ch, color cl);
+extern int rbf_draw_symbol(int x, int y, int ch, color cl);
+extern int rbf_draw_string(int x, int y, const char *str, color cl);
+extern int rbf_draw_clipped_string(int x, int y, const char *str, color cl, int l, int maxlen);
+extern int rbf_draw_string_len(int x, int y, int len, const char *str, color cl);
+extern int rbf_draw_string_right_len(int x, int y, int len, const char *str, color cl);
+extern int rbf_draw_menu_header(int x, int y, int len, char symbol, const char *str, color cl);
+
+//-------------------------------------------------------------------
+#endif
+
Index: /branches/reyalp-ptp-live/include/string.h
===================================================================
--- /branches/reyalp-ptp-live/include/string.h	(revision 1668)
+++ /branches/reyalp-ptp-live/include/string.h	(revision 1668)
@@ -0,0 +1,7 @@
+#ifndef STRING_H
+#define STRING_H
+
+#include <stdlib.h>
+#define strcoll strcmp
+
+#endif
Index: /branches/reyalp-ptp-live/include/lualib.h
===================================================================
--- /branches/reyalp-ptp-live/include/lualib.h	(revision 1668)
+++ /branches/reyalp-ptp-live/include/lualib.h	(revision 1668)
@@ -0,0 +1,46 @@
+/*
+** $Id: lualib.h,v 1.36.1.1 2007/12/27 13:02:25 roberto Exp $
+** Lua standard libraries
+** See Copyright Notice in lua.h
+*/
+
+#ifndef lualib_h
+#define lualib_h
+
+#include "lua.h"
+
+/* Key to file-handle type */
+#define LUA_FILEHANDLE  "FILE*"
+
+#define LUA_COLIBNAME   "coroutine"
+LUALIB_API int (luaopen_base) (lua_State *L);
+
+#define LUA_TABLIBNAME  "table"
+LUALIB_API int (luaopen_table) (lua_State *L);
+
+#define LUA_IOLIBNAME   "io"
+LUALIB_API int (luaopen_io) (lua_State *L);
+
+#define LUA_OSLIBNAME   "os"
+LUALIB_API int (luaopen_os) (lua_State *L);
+
+#define LUA_STRLIBNAME  "string"
+LUALIB_API int (luaopen_string) (lua_State *L);
+
+#define LUA_MATHLIBNAME "math"
+LUALIB_API int (luaopen_math) (lua_State *L);
+
+#define LUA_DBLIBNAME   "debug"
+LUALIB_API int (luaopen_debug) (lua_State *L);
+
+#define LUA_LOADLIBNAME "package"
+LUALIB_API int (luaopen_package) (lua_State *L);
+
+/* open all previous libraries */
+LUALIB_API void (luaL_openlibs) (lua_State *L); 
+
+#ifndef lua_assert
+#define lua_assert(x)   ((void)0)
+#endif
+
+#endif
Index: /branches/reyalp-ptp-live/include/stddef.h
===================================================================
--- /branches/reyalp-ptp-live/include/stddef.h	(revision 1668)
+++ /branches/reyalp-ptp-live/include/stddef.h	(revision 1668)
@@ -0,0 +1,9 @@
+#ifndef STDDEF_H
+#define STDDEF_H
+
+typedef unsigned int size_t;
+typedef int ssize_t;
+typedef int ptrdiff_t;
+#define NULL ((void*)0)
+
+#endif
Index: /branches/reyalp-ptp-live/include/propset1.h
===================================================================
--- /branches/reyalp-ptp-live/include/propset1.h	(revision 1668)
+++ /branches/reyalp-ptp-live/include/propset1.h	(revision 1668)
@@ -0,0 +1,50 @@
+#ifndef PROPSET1_H
+#define PROPSET1_H
+
+/*
+constants for propset 1, most digic2 camera
+WARNING:
+The build uses tools/gen_propset_lua.sed to generate propset1.lua from this file
+*/
+
+#define PROPCASE_DRIVE_MODE                      6
+#define PROPCASE_FOCUS_MODE                      12
+#define PROPCASE_FLASH_MODE                      16
+#define PROPCASE_FLASH_FIRE                      79
+// need corresponding values for propset2!!!
+#define PROPCASE_FLASH_ADJUST_MODE               15
+//#define PROPCASE_FLASH_CORRECTION              28
+#define PROPCASE_FLASH_MANUAL_OUTPUT             29
+//#define PROPCASE_FOCUS_OK                      67
+#define PROPCASE_USER_TV                         40
+#define PROPCASE_TV                              69
+#define PROPCASE_USER_AV                         39
+#define PROPCASE_AV                              68
+#define PROPCASE_MIN_AV                          77
+#define PROPCASE_SV                              73
+#define PROPCASE_DELTA_SV                        70
+#define PROPCASE_SV_MARKET                       72
+#define PROPCASE_BV                              71
+#define PROPCASE_ISO_MODE                        21
+#define PROPCASE_SUBJECT_DIST1                   65
+#define PROPCASE_SUBJECT_DIST2                   66
+#define PROPCASE_SHOOTING                        205
+#define PROPCASE_IS_FLASH_READY                  221
+#define PROPCASE_OVEREXPOSURE                    76
+#define PROPCASE_SHOOTING_MODE                   0
+#define PROPCASE_IS_MODE                         229
+#define PROPCASE_QUALITY                         23
+#define PROPCASE_RESOLUTION                      24
+#define PROPCASE_EV_CORRECTION_1                 25
+#define PROPCASE_EV_CORRECTION_2                 26
+#define PROPCASE_ORIENTATION_SENSOR              37
+#define PROPCASE_DIGITAL_ZOOM_STATE              58
+#define PROPCASE_DIGITAL_ZOOM_POSITION           57
+#define PROPCASE_DISPLAY_MODE                    181
+#define PROPCASE_BRACKET_MODE                    36    //missing for dryos!
+#define PROPCASE_FLASH_SYNC_CURTAIN              20
+#define PROPCASE_METERING_MODE                   9
+#define PROPCASE_WB_ADJ                          100
+#define PROPCASE_OPTICAL_ZOOM_POSITION           99    // tested a540, sd400
+
+#endif
Index: /branches/reyalp-ptp-live/include/propset2.h
===================================================================
--- /branches/reyalp-ptp-live/include/propset2.h	(revision 1668)
+++ /branches/reyalp-ptp-live/include/propset2.h	(revision 1668)
@@ -0,0 +1,53 @@
+#ifndef PROPSET2_H
+#define PROPSET2_H
+
+/*
+constants for propset 2, most digic3 camera
+WARNING:
+The build uses tools/gen_propset_lua.sed to generate propset2.lua from this file
+*/
+
+#define PROPCASE_DRIVE_MODE                      102
+#define PROPCASE_FOCUS_MODE                      133
+#define PROPCASE_FLASH_MODE                      143
+#define PROPCASE_FLASH_FIRE                      122
+#define PROPCASE_FLASH_MANUAL_OUTPUT             141
+#define PROPCASE_FLASH_ADJUST_MODE               121
+#define PROPCASE_USER_TV                         264
+#define PROPCASE_TV                              262
+#define PROPCASE_USER_AV                         26
+#define PROPCASE_AV                              23
+#define PROPCASE_MIN_AV                          25
+#define PROPCASE_SV                              247
+#define PROPCASE_DELTA_SV                        79
+#define PROPCASE_SV_MARKET                       246
+#define PROPCASE_BV                              34
+#define PROPCASE_SUBJECT_DIST1                   245
+#define PROPCASE_SUBJECT_DIST2                   65
+#define PROPCASE_ISO_MODE                        149
+#define PROPCASE_SHOOTING                        206
+#define PROPCASE_IS_FLASH_READY                  208
+#define PROPCASE_OVEREXPOSURE                    103
+#define PROPCASE_SHOOTING_MODE                   49
+#define PROPCASE_IS_MODE                         145
+#define PROPCASE_QUALITY                         57
+#define PROPCASE_RESOLUTION                      218
+#define PROPCASE_EV_CORRECTION_1                 107
+#define PROPCASE_EV_CORRECTION_2                 207
+#define PROPCASE_ORIENTATION_SENSOR              219
+#define PROPCASE_DIGITAL_ZOOM_STATE              94 //G10 Digital Zoom Mode/State 0 = Digital Zoom off, 1 = Digital Zoom on
+#define PROPCASE_DIGITAL_ZOOM_POSITION           95	//G10 Digital Zoom position 0 to 6 where 0=off,  6= full digital zoom
+#define PROPCASE_DISPLAY_MODE                    105
+#define PROPCASE_BRACKET_MODE                    29
+#define PROPCASE_FLASH_SYNC_CURTAIN              64
+#define PROPCASE_METERING_MODE                   155
+#define PROPCASE_WB_ADJ                          269
+#define PROPCASE_ASPECT_RATIO                    294
+#define PROPCASE_TIMER_MODE                      223
+#define PROPCASE_OPTICAL_ZOOM_POSITION           195
+//#define PROPCASE_OPTICAL_ZOOM_POSITION         251    // not working sx200is
+#define	PROPCASE_AE_LOCK						 3		//G10 0 = AE not locked, 1 = AE locked
+#define	PROPCASE_AF_FRAME						 8		//G10 1 = FlexiZone, 2 = Face AiAF / Tracking AF
+#define	PROPCASE_CONTINUOUS_AF					 12		//G10 0 = Continuous AF off, 1 = Continuous AF on
+#define PROPCASE_DIGITAL_ZOOM_MODE               91		//G10 Digital Zoom Mode/State 0 = off/standard, 2 = 1.7x, 3 = 2.1x
+#endif
Index: /branches/reyalp-ptp-live/include/propset3.h
===================================================================
--- /branches/reyalp-ptp-live/include/propset3.h	(revision 1668)
+++ /branches/reyalp-ptp-live/include/propset3.h	(revision 1668)
@@ -0,0 +1,49 @@
+#ifndef PROPSET3_H
+#define PROPSET3_H
+
+/*
+constants for propset 3
+WARNING:
+The build uses tools/gen_propset_lua.sed to generate propset3.lua from this file
+*/
+
+#define PROPCASE_DRIVE_MODE                      102
+#define PROPCASE_FOCUS_MODE                      133
+#define PROPCASE_FLASH_MODE                      143
+#define PROPCASE_FLASH_FIRE                      122
+#define PROPCASE_FLASH_MANUAL_OUTPUT             141
+#define PROPCASE_FLASH_ADJUST_MODE               121
+#define PROPCASE_USER_TV                         266
+#define PROPCASE_TV                              264
+#define PROPCASE_USER_AV                         26
+#define PROPCASE_AV                              23
+#define PROPCASE_MIN_AV                          25
+#define PROPCASE_SV                              249
+#define PROPCASE_DELTA_SV                        79
+#define PROPCASE_SV_MARKET                       248
+#define PROPCASE_BV                              34
+#define PROPCASE_SUBJECT_DIST1                   247
+#define PROPCASE_SUBJECT_DIST2                   65
+#define PROPCASE_ISO_MODE                        149
+#define PROPCASE_SHOOTING                        208
+#define PROPCASE_IS_FLASH_READY                  210
+#define PROPCASE_OVEREXPOSURE                    103
+#define PROPCASE_SHOOTING_MODE                   49
+#define PROPCASE_IS_MODE                         145
+#define PROPCASE_QUALITY                         57
+#define PROPCASE_RESOLUTION                      220
+#define PROPCASE_EV_CORRECTION_1                 107
+#define PROPCASE_EV_CORRECTION_2                 209
+#define PROPCASE_ORIENTATION_SENSOR              221
+#define PROPCASE_DIGITAL_ZOOM_STATE              94
+#define PROPCASE_DIGITAL_ZOOM_POSITION           95
+#define PROPCASE_DISPLAY_MODE                    105
+#define PROPCASE_BRACKET_MODE                    29
+#define PROPCASE_FLASH_SYNC_CURTAIN              64
+#define PROPCASE_METERING_MODE                   155
+#define PROPCASE_WB_ADJ                          271
+#define PROPCASE_ASPECT_RATIO                    294
+#define PROPCASE_TIMER_MODE                      225
+#define PROPCASE_OPTICAL_ZOOM_POSITION           197
+
+#endif
Index: /branches/reyalp-ptp-live/include/propset4.h
===================================================================
--- /branches/reyalp-ptp-live/include/propset4.h	(revision 1668)
+++ /branches/reyalp-ptp-live/include/propset4.h	(revision 1668)
@@ -0,0 +1,62 @@
+#ifndef PROPSET4_H
+#define PROPSET4_H
+
+/*
+constants for propset 4
+WARNING:
+The build uses tools/gen_propset_lua.sed to generate propset4.lua from this file
+*/
+
+#define PROPCASE_AF_LOCK                         11     // 0 = AF not locked, 1 = AF locked
+#define PROPCASE_FLASH_SYNC_CURTAIN              64
+#define PROPCASE_SUBJECT_DIST2                   65
+#define PROPCASE_AV2                             22     // (philmoz, May 2011) - this value causes overrides to be saved in JPEG and shown on Canon OSD
+#define PROPCASE_AV                              23     // This values causes the actual aperture value to be overriden
+#define PROPCASE_MIN_AV                          25
+#define PROPCASE_USER_AV                         26
+#define PROPCASE_BRACKET_MODE                    29
+#define PROPCASE_SHOOTING_MODE                   49
+#define PROPCASE_QUALITY                         57
+#define PROPCASE_DIGITAL_ZOOM_MODE               91     // Digital Zoom Mode/State 0 = off/standard, 2 = 1.7x, 3 = 2.1x
+#define PROPCASE_DIGITAL_ZOOM_STATE              94     // Digital Zoom Mode/State 0 = Digital Zoom off, 1 = Digital Zoom on
+#define PROPCASE_DIGITAL_ZOOM_POSITION           95
+#define PROPCASE_DRIVE_MODE                      102
+#define PROPCASE_OVEREXPOSURE                    103
+#define PROPCASE_DISPLAY_MODE                    105
+#define PROPCASE_EV_CORRECTION_1                 107
+
+#define PROPCASE_BV                              34
+#define PROPCASE_DELTA_SV                        79
+#define PROPCASE_FLASH_ADJUST_MODE               121
+#define PROPCASE_FLASH_FIRE                      122
+#define PROPCASE_FOCUS_MODE                      133
+#define PROPCASE_FLASH_MANUAL_OUTPUT             141
+#define PROPCASE_FLASH_MODE                      143
+#define PROPCASE_IS_MODE                         145
+#define PROPCASE_ISO_MODE                        149
+
+// SX30 & G12 values
+#define PROPCASE_AE_LOCK                         3       // 0 = AE not locked, 1 = AE locked
+#define PROPCASE_AF_FRAME                        8       // 1 = FlexiZone, 2 = Face AiAF / Tracking AF
+#define PROPCASE_CONTINUOUS_AF                   12      // 0 = Continuous AF off, 1 = Continuous AF on
+#define PROPCASE_SERVO_AF                        299     // 0 = Servo AF off, 1 = Servo AF on
+#define PROPCASE_METERING_MODE                   157
+#define PROPCASE_OPTICAL_ZOOM_POSITION           199
+#define PROPCASE_SHOOTING                        210
+#define PROPCASE_EV_CORRECTION_2                 211
+#define PROPCASE_IS_FLASH_READY                  212
+#define PROPCASE_RESOLUTION                      222     // 0 = L, 1 = M1, 2 = M2, 4 = S, 7 = Low Light (G12)
+#define PROPCASE_ORIENTATION_SENSOR              223
+#define PROPCASE_TIMER_MODE                      227
+#define PROPCASE_SUBJECT_DIST1                   249
+#define PROPCASE_SV_MARKET                       250
+#define PROPCASE_SV                              347     // (philmoz, May 2011) - this value causes overrides to be saved in JPEG and shown on Canon OSD
+#define PROPCASE_TV2                             265     // (philmoz, May 2011) - this value causes overrides to be saved in JPEG and shown on Canon OSD
+#define PROPCASE_TV                              266     // Need to set this value for overrides to work correctly
+#define PROPCASE_USER_TV                         268
+#define PROPCASE_WB_ADJ                          273
+#define PROPCASE_ASPECT_RATIO                    300
+
+#define PROPCASE_GPS							 359	//for sx230hs
+
+#endif
Index: /branches/reyalp-ptp-live/include/stdlib.h
===================================================================
--- /branches/reyalp-ptp-live/include/stdlib.h	(revision 1668)
+++ /branches/reyalp-ptp-live/include/stdlib.h	(revision 1668)
@@ -0,0 +1,287 @@
+#include "camera.h"
+
+#ifndef STDLIB_H
+#define STDLIB_H
+
+#define NULL		((void*)0)
+
+#define SEEK_SET        0
+#define SEEK_CUR        1
+#define SEEK_END        2
+
+#define O_RDONLY        0
+#define O_WRONLY        1
+#define O_RDWR          2
+
+#ifndef THIS_IS_CHDK_CORE
+#include "stdlib_unified.h"
+#endif
+
+
+#if !CAM_DRYOS
+
+#define O_TRUNC         0x400
+#define O_CREAT         0x200
+
+struct	stat
+    {
+    unsigned long	st_dev;		/* device ID number */
+    unsigned long	st_ino;		/* file serial number */
+    unsigned short	st_mode;	/* file mode (see below) */
+    short		st_nlink;	/* number of links to file */
+    short		st_uid;		/* user ID of file's owner */
+    short		st_gid;		/* group ID of file's group */
+    unsigned long	st_rdev;	/* device ID, only if special file */
+    unsigned long	st_size;	/* size of file, in bytes */
+    unsigned long	st_atime;	/* time of last access */
+    unsigned long	st_mtime;	/* time of last modification */
+    unsigned long	st_ctime;	/* time of last change of file status */
+    long		st_blksize;
+    long		st_blocks;
+    unsigned char	st_attrib;	/* file attribute byte (dosFs only) */
+    int			reserved1;	/* reserved for future use */
+    int			reserved2;	/* reserved for future use */
+    int			reserved3;	/* reserved for future use */
+    int			reserved4;	/* reserved for future use */
+    int			reserved5;	/* reserved for future use */
+    int			reserved6;	/* reserved for future use */
+};
+
+#else
+
+#define O_APPEND        0x8 // ok for dryos, vx?
+#define O_TRUNC         0x200
+#define O_CREAT         0x100
+
+#ifndef CAM_DRYOS_2_3_R39
+struct	stat
+    {
+    unsigned long	st_dev;		//?
+    unsigned long	st_ino;		//?
+    unsigned short	st_mode;	//?
+    short		st_nlink;	//?
+    short		st_uid;		//?
+    short		st_gid;		//?
+    unsigned long	st_atime;	//?
+    unsigned long	st_mtime;	//?
+    unsigned long	st_ctime;	//?
+    unsigned long	st_size;
+    long		st_blksize;	//?
+    long		st_blocks;	//?
+    unsigned char	st_attrib;
+    int			reserved1;	//
+    int			reserved2;	//
+    int			reserved3;	//
+    int			reserved4;	//
+    int			reserved5;	//
+    int			reserved6;	//
+};
+
+#else
+struct	stat
+    {
+    unsigned long	st_unknown_1;
+    unsigned long	st_attrib;
+    unsigned long	st_size;
+    unsigned long	st_ctime;
+    unsigned long	st_mtime;
+    unsigned long	st_unknown_2;
+};
+#endif//CAM_DRYOS_2_3_R39
+
+#endif //CAM_DRYOS
+
+extern int rand(void);
+extern void* srand(unsigned int seed);
+
+extern void qsort (void *__base, int __nelem, int __size, int (*__cmp)(const void *__e1, const void *__e2));
+
+extern int isdigit(int c);
+extern int isspace(int c);
+extern int isalpha(int c);
+extern int isupper(int c);
+extern int islower(int c);
+extern int ispunct(int c);
+extern int isxdigit(int c);
+extern int iscntrl(int c);
+extern int isalnum(int c);
+
+extern long sprintf(char *s, const char *st, ...);
+
+extern long strlen(const char *s);
+extern int strcmp(const char *s1, const char *s2);
+extern int strncmp(const char *s1, const char *s2, long n);
+extern char *strchr(const char *s, int c);
+extern char *strcpy(char *dest, const char *src);
+extern char *strncpy(char *dest, const char *src, long n);
+extern char *strcat(char *dest, const char *app);
+extern char *strrchr(const char *s, int c);
+extern char *strpbrk(const char *s, const char *accept);
+
+extern long strtol(const char *nptr, char **endptr, int base);
+extern unsigned long strtoul(const char *nptr, char **endptr, int base);
+#define atoi(n) strtol((n),NULL,0)
+
+extern int tolower(int c);
+extern int toupper(int c);
+
+extern void *malloc(long size);
+extern void free(void *p);
+extern void *umalloc(long size);
+extern void ufree(void *p);
+
+extern void *memcpy(void *dest, const void *src, long n);
+extern void *memset(void *s, int c, int n);
+extern int memcmp(const void *s1, const void *s2, long n);
+extern void *memchr(const void *s, int c, int n);
+
+
+extern void SleepTask(long msec);
+extern long taskLock();
+extern long taskUnlock();
+
+extern int creat (const char *name, int flags);
+extern int open (const char *name, int flags, int mode );
+extern int close (int fd);
+extern int write (int fd, const void *buffer, long nbytes);
+extern int read (int fd, void *buffer, long nbytes);
+extern int lseek (int fd, long offset, int whence);
+extern long mkdir(const char *dirname);
+extern long mkdir_if_not_exist(const char *dirname);
+extern int rename(const char *oldname, const char *newname);
+extern int chdir(char *pathname);
+extern int remove(const char *name);
+
+// reverse engineered file struct. Appears to be valid for both vxworks and dryos
+// don't use this directly unless you absolutely need to
+// don't EVER try to create one yourself, as this isn't the full structure.
+typedef struct FILE_S {
+    int fd;         // used by Read/Write
+    unsigned len;   // +4 verfied in Fseek_FileStream
+    int unk0;       // +8
+    unsigned pos;   // +0xC verified in Fseek_FileStream
+    // unk1;        // +0x10 
+    // unk2;        // +0x14
+    // io_buf;      // +0x18 32k uncached allocated in Fopen_FileStream
+    // unk3;        // +0x20 related to StartFileAccess_Sem
+    // ...name
+} FILE;
+
+extern FILE *fopen(const char *filename, const char *mode);
+extern long fclose(FILE *f);
+extern long fread(void *buf, long elsize, long count, FILE *f);
+extern long fwrite(const void *buf, long elsize, long count, FILE *f);
+extern long fseek(FILE *file, long offset, long whence);
+extern long fflush(FILE *file);
+extern long feof(FILE *file);
+extern long ftell(FILE *file);
+extern char *fgets(char *buf, int n, FILE *f);
+
+/**
+ * No STUBS!
+ * You can't use these two directly from THUMB code (core), only from platform.
+ */
+extern int fprintf(FILE *fd, char*buf, ...);
+extern int printf(char *buf, ...);
+
+extern void msleep(long msec);
+extern long task_lock();
+extern long task_unlock();
+extern const char *task_name(int id);
+int task_id_list_get(int *idlist,int size);
+extern const char *strerror(int num);
+// on vxworks we could find the actual errno, but this is easier to automate sig
+// doesn't exist on dryos, but we stub it
+extern int errnoOfTaskGet(int tid);
+#define errno (errnoOfTaskGet(0))
+
+#define DOS_ATTR_RDONLY         0x01            /* read-only file */
+#define DOS_ATTR_HIDDEN         0x02            /* hidden file */
+#define DOS_ATTR_SYSTEM         0x04            /* system file */
+#define DOS_ATTR_VOL_LABEL      0x08            /* volume label (not a file) */
+#define DOS_ATTR_DIRECTORY      0x10            /* entry is a sub-directory */
+#define DOS_ATTR_ARCHIVE        0x20            /* file subject to archiving */
+
+#if !CAM_DRYOS
+struct dirent {
+    char                d_name[100];
+};
+#else
+// NOTE this is not complete and may not be accurate for all versions
+struct dirent {
+    char                d_name[13];
+    unsigned long	unk1;
+    unsigned char 	attrib;
+    unsigned long 	size;
+    unsigned long	time1;
+    unsigned long	time2;
+    unsigned long	time3;
+};
+#endif
+
+#if !CAM_DRYOS
+typedef struct {
+    unsigned int        fd;
+    unsigned int        loc;
+    struct dirent       dir;
+} DIR;
+#else
+// structure returned by dryos
+// actual size may vary depending on version
+typedef struct {
+    int fh;
+    int unk[4];
+} DIR_dryos;
+
+// struct returned by our wrappers around opendir
+typedef struct {
+    DIR_dryos *dh;
+    union {
+        struct dirent de;
+#ifdef CAM_DRYOS_2_3_R39
+        char de_buf[64];
+#else
+        char de_buf[40];
+#endif
+    };
+} DIR;
+#endif
+
+extern DIR*           opendir (const char* name);
+extern struct dirent* readdir (DIR*);
+extern int            closedir (DIR*);
+extern void           rewinddir (DIR*);
+extern int            stat (const char *name, struct stat *pStat);
+
+
+struct tm
+	{
+	int tm_sec;	/* seconds after the minute	- [0, 59] */
+	int tm_min;	/* minutes after the hour	- [0, 59] */
+	int tm_hour;	/* hours after midnight		- [0, 23] */
+	int tm_mday;	/* day of the month		- [1, 31] */
+	int tm_mon;	/* months since January		- [0, 11] */
+	int tm_year;	/* years since 1900	*/
+	int tm_wday;	/* days since Sunday		- [0, 6] */
+	int tm_yday;	/* days since January 1		- [0, 365] */
+	int tm_isdst;	/* Daylight Saving Time flag */
+	};
+
+typedef unsigned long time_t;
+
+extern struct tm * localtime(const time_t *_tod);
+extern struct tm * get_localtime();
+
+struct utimbuf {
+    unsigned long actime;       /* set the access time */
+    unsigned long modtime;      /* set the modification time */
+};
+
+extern int utime(const char *file, struct utimbuf *newTimes);
+extern unsigned long time(unsigned long *timer);
+extern long strftime(char *s, unsigned long maxsize, const char *format, const struct tm *timp);
+extern time_t mktime(struct tm *timp);
+
+extern int abs( int v );
+
+#endif
Index: /branches/reyalp-ptp-live/include/stdio.h
===================================================================
--- /branches/reyalp-ptp-live/include/stdio.h	(revision 1668)
+++ /branches/reyalp-ptp-live/include/stdio.h	(revision 1668)
@@ -0,0 +1,1 @@
+
Index: /branches/reyalp-ptp-live/include/stdlib_unified.h
===================================================================
--- /branches/reyalp-ptp-live/include/stdlib_unified.h	(revision 1668)
+++ /branches/reyalp-ptp-live/include/stdlib_unified.h	(revision 1668)
@@ -0,0 +1,60 @@
+#ifndef STDLIB_UNIFIED_H
+#define STDLIB_UNIFIEDH
+
+// This is header of unified wrapper platform-dependend io functions
+
+// Stopwords.
+
+
+// Common values
+#define STD_O_TRUNC         0x400
+#define STD_O_CREAT         0x200
+
+
+// Readonly structure. 
+// So get simpliest structure
+struct	STD_stat
+    {
+    unsigned long	st_unknown_1;
+    unsigned long	st_attrib;
+    unsigned long	st_size;
+    unsigned long	st_ctime;
+    unsigned long	st_mtime;
+    unsigned long	st_unknown_2;
+};
+
+
+// Universal struct of directory entry
+struct STD_dirent {
+    char            d_name[100];
+    unsigned long	unk1;
+    unsigned char 	attrib;
+    unsigned long 	size;
+    unsigned long	time1;
+    unsigned long	time2;
+    unsigned long	time3;
+};
+
+
+// This is directory handler.
+typedef struct {
+	int magicnum;		// to safe second try to close
+	void* dh;
+    struct STD_dirent de;
+} STD_DIR;
+
+
+
+
+// Unified wrapper for platform-dependent IO functions
+
+extern int 			  				safe_open (const char *name, int flags, int mode );
+extern int            				safe_stat (const char *name, struct STD_stat *pStat);
+
+extern STD_DIR*           	safe_opendir (const char* name);
+extern struct STD_dirent*	safe_readdir (STD_DIR*);
+extern int            		safe_closedir (STD_DIR*);
+extern void           		safe_rewinddir (STD_DIR*);
+
+
+#endif
Index: /branches/reyalp-ptp-live/include/platform.h
===================================================================
--- /branches/reyalp-ptp-live/include/platform.h	(revision 1668)
+++ /branches/reyalp-ptp-live/include/platform.h	(revision 1668)
@@ -0,0 +1,635 @@
+#ifndef PLATFORM_H
+#define PLATFORM_H
+
+#include "camera.h"
+
+#define SSID_INVALID (-32767)
+#define ASID_INVALID (-32767)
+
+#define MODE_MASK               0x0300
+#define MODE_REC                0x0100
+#define MODE_PLAY               0x0200
+
+#define MODE_SHOOTING_MASK      0x00FF
+
+/* capture mode constants. These are in their own header for easier sed processing*/
+#include "modelist.h"
+
+// converted large macro to function in platform/generic/shooting.c (philmoz July 2011)
+extern int mode_is_video(int);
+#define MODE_IS_VIDEO(m)    mode_is_video(m)
+
+/* propcase ID constants. These are in their own header files for easier sed processing */
+#if CAM_PROPSET == 4
+    #include "propset4.h"
+#elif CAM_PROPSET == 3
+    #include "propset3.h"
+#elif CAM_PROPSET == 2      // most digic3 cameras
+    #include "propset2.h"
+#elif CAM_PROPSET == 1      // most digic2 cameras
+    #include "propset1.h"
+#else
+    #error unknown camera processor
+#endif
+
+#define MIN_DIST                    CAMERA_MIN_DIST     // Defined in camera.h (can be overridden in platform_camera.h)
+#define MAX_DIST                    CAMERA_MAX_DIST     // Defined in camera.h (can be overridden in platform_camera.h)
+#define INFINITY_DIST               0xFFFFFFFF          // Value to send to firmware to select 'infinity' focus
+#define MAX_DIST_HYPER_FOCAL        999999
+
+//********************
+//char * get_debug();
+//********************
+
+#define MODE_SCREEN_MASK            0x0C00
+#define MODE_SCREEN_OPENED          0x0400
+#define MODE_SCREEN_ROTATED         0x0800
+
+/* Keyboard repeat and initial delays */
+#define KBD_REPEAT_DELAY  140
+#define KBD_INITIAL_DELAY 300
+
+// Video recording current status constants, see movie_status variable 
+#define VIDEO_RECORD_NEVER_STARTED  0  
+#define VIDEO_RECORD_STOPPED        1  
+#define VIDEO_RECORD_IN_PROGRESS    4
+
+//Optical & digital zoom status constants, see zoom_status variable 
+#define ZOOM_OPTICAL_MIN            1
+#define ZOOM_OPTICAL_MAX            2
+#define ZOOM_OPTICAL_MEDIUM         3
+#define ZOOM_OPTICAL_IN             4
+#define ZOOM_OPTICAL_OUT            5
+#define ZOOM_OPTICAL_REACHED_MIN    7
+
+#define ZOOM_DIGITAL_MAX            9
+#define ZOOM_DIGITAL_MEDIUM         10
+#define ZOOM_DIGITAL_IN             11
+#define ZOOM_DIGITAL_OUT            12
+#define ZOOM_DIGITAL_REACHED_MAX    13
+
+typedef struct {
+    unsigned short hackmode;   // platform independent mode values from MODE_xxx enum
+    unsigned short canonmode;  // PROPCASE_SHOOTING_MODE value
+} CapturemodeMap;
+
+typedef struct {
+    short id;       // hacks id
+    short prop_id;  // Canons id
+    char name[8];
+    short shutter_dfs_value; // shutter speed to use dark frame substraction
+} ISOTable;
+
+typedef struct {
+    short id;       // hacks id
+    short prop_id;  // Canons id
+    char name[8];
+    long usec;
+} ShutterSpeed;
+
+typedef struct {
+    short id;       // hacks id
+    short prop_id;  // Canons id
+    char name[8];
+} ApertureSize;
+
+typedef struct {
+    short av96;
+    short dav96;
+    short av96_step;
+    short tv96;
+    short dtv96;
+    short tv96_step;
+    short sv96;
+    short dsv96;
+    short sv96_step;
+    short iso;
+    short diso;
+    short iso_step;
+    short subj_dist;
+    short dsubj_dist;
+    short subj_dist_step;
+    short shoot_counter;
+    short type;
+} EXPO_BRACKETING_VALUES;
+
+#define SET_NOW      1
+#define SET_LATER    0
+
+#define SHOW_ALWAYS    1
+#define SHOW_HALF      2
+
+
+typedef struct {
+    short av96;
+    short tv96;
+    short sv96;
+    short subj_dist;
+    short nd_filter;
+} PHOTO_PARAM;
+
+typedef struct {
+    int    subject_distance;
+    int     near_limit;
+    int     far_limit;
+    int     hyperfocal_distance;
+    int     depth_of_field;
+    int     lens_to_focal_plane_width;
+} DOF_TYPE;
+
+typedef struct {
+    short av96;
+    short tv96;
+    short sv96;
+    short iso;
+    short sv96_market;
+    short iso_market;
+    short bv96_measured;
+    short bv96_seted;       //Ev96_internal-Sv96
+    short ev96_seted;       //Tv96+Av96
+    short ev96_measured;    //Bv96+Sv96
+    short dev96;            // Ev96_external-Ev96_internal
+    short dev96_canon;      // Canon OverExposure
+    int b;                  //average scene luminance 
+} EXPO_TYPE;
+
+typedef struct {
+    float value;
+    char fraction[10];
+} shutter_speed;
+
+
+/******************************************************************/
+
+int get_focal_length(int zp);
+int get_effective_focal_length(int zp);
+int get_zoom_x(int zp);
+
+/******************************************************************/
+
+long get_tick_count();
+
+void remount_filesystem();
+void mark_filesystem_bootable();
+
+/******************************************************************/
+
+long get_parameter_data(long id, void *buf, long bufsize);
+long set_parameter_data(long id, void *buf, long bufsize);
+
+long get_property_case(long id, void *buf, long bufsize);
+long set_property_case(long id, void *buf, long bufsize);
+
+long get_file_counter();
+long get_exposure_counter();
+long get_file_next_counter();
+#if defined(CAM_DATE_FOLDER_NAMING) 
+    void get_target_dir_name(char*);
+#else
+    long get_target_dir_num();
+#endif
+long get_target_file_num();
+
+/******************************************************************/
+
+void kbd_key_press(long key);
+void kbd_key_release(long key);
+void kbd_key_release_all();
+long kbd_is_key_pressed(long key);
+long kbd_is_key_clicked(long key);
+long kbd_get_pressed_key();
+long kbd_get_clicked_key();
+long kbd_get_autoclicked_key();
+void kbd_reset_autoclicked_key();
+long kbd_use_zoom_as_mf();
+long kbd_use_up_down_left_right_as_fast_switch();
+void kbd_set_alt_mode_key_mask(long key);
+int get_usb_power(int edge);
+long get_jogdial_direction(void);
+/******************************************************************/
+
+long vid_is_bitmap_shown();
+void *vid_get_bitmap_fb();
+
+void *vid_get_viewport_fb();
+void *vid_get_viewport_fb_d();
+void *vid_get_viewport_live_fb();
+
+void vid_bitmap_refresh();
+void vid_turn_off_updates();
+void vid_turn_on_updates();
+
+// These define the viewport dimensions both physically and in terms of the CHDK co-ordinate system
+// CHDK works in a 360x240 screen dimension / co-ordinate system
+extern long vid_get_viewport_height();          // Viewport height in CHDK screen pixels 
+extern int vid_get_viewport_width();            // Viewport width in CHDK screen pixels
+extern int vid_get_viewport_xoffset();          // X offset of viewport edge relative to LCD screen (in CHDK screen pixels)
+extern int vid_get_viewport_yoffset();          // Y offset of viewport top relative to LCD screen (in CHDK screen pixels)
+extern int vid_get_viewport_byte_width();       // Physical width of viewport row in bytes
+extern int vid_get_viewport_yscale();           // Y multiplier for cameras with 480 pixel high viewports (CHDK code assumes 240)
+extern int vid_get_viewport_image_offset();     // Byte offset from start of viewport memory to first displayed pixel
+extern int vid_get_viewport_row_offset();       // Difference between physical width of viewport and displayed width (in bytes)
+
+
+// PTP Live View functions
+// These functions return actual size/offset in pixels of the viewport and bitmap buffers
+extern int vid_get_viewport_xoffset_proper();           // X Offset (for variable image size)
+extern int vid_get_viewport_yoffset_proper();           // Y Offset (for variable image size)
+extern int vid_get_viewport_width_proper();             // Visible viewport width (for variable image size)
+extern int vid_get_viewport_height_proper();            // Visible viewport height (for variable image size)
+extern int vid_get_viewport_max_width();                // Max visible viewport width in pixels
+extern int vid_get_viewport_max_height();               // Max visible viewport height in pixels
+extern int vid_get_viewport_buffer_width_proper();      // Physical viewport buffer width in pixels
+extern int vid_get_palette_type();                      // Palette type (0 - 3)
+extern int vid_get_palette_size();                      // Palette size (in bytes)
+extern int vid_get_aspect_ratio();                      // LCD aspect ratio (0 = 4:3 or 1 = 16:9)
+
+extern void *vid_get_viewport_active_buffer();          // Return active live viewport memory address
+extern void *vid_get_bitmap_active_buffer();            // Return current active bitmap memory address
+extern void *vid_get_bitmap_active_palette();           // Return current palette memory address
+
+#ifdef CAM_LOAD_CUSTOM_COLORS
+// Color palette function
+extern void load_chdk_palette();
+#endif
+/******************************************************************/
+
+void *hook_raw_fptr();
+void *hook_raw_ret_addr();
+char *hook_raw_image_addr();
+char *hook_alt_raw_image_addr();
+long hook_raw_size();
+void hook_raw_install();
+void hook_raw_save_complete();
+
+/******************************************************************/
+
+long lens_get_zoom_pos();
+void lens_set_zoom_pos(long newpos);
+long lens_get_zoom_point();
+void lens_set_zoom_point(long newpt);
+void lens_set_zoom_speed(long newspd); //for S-series
+long lens_get_focus_pos();
+long lens_get_focus_pos_from_lens();
+void lens_set_focus_pos(long newpos);
+long lens_get_target_distance();
+
+/******************************************************************/
+
+int shooting_in_progress();
+int shooting_is_flash();
+int shooting_is_flash_ready();
+short shooting_get_flash_mode();
+
+
+/******************************************************************/
+int shooting_get_user_tv_id();
+#if defined(CAM_DRAW_EXPOSITION)
+    char* shooting_get_tv_str();
+#endif
+short shooting_get_tv96_from_shutter_speed(float t);
+short shooting_get_tv96();
+void shooting_set_tv96(short v, short is_now);
+void shooting_set_tv96_direct(short v, short is_now);
+void shooting_set_shutter_speed_ubasic(int t, short is_now);
+short shooting_get_user_tv96();
+void shooting_set_user_tv96(short v);
+float shooting_get_shutter_speed_from_tv96(short tv);
+float shooting_get_shutter_speed_override_value();
+const char * shooting_get_tv_override_value();
+const char * shooting_get_tv_bracket_value();
+const char * shooting_get_bracket_type();
+void shooting_set_user_tv_by_id(int v);
+void shooting_set_user_tv_by_id_rel(int v);
+const ShutterSpeed *shooting_get_tv_line();
+/******************************************************************/
+short shooting_get_aperture_sizes_table_size();
+short shooting_get_max_aperture_sizes_table_prop_id();
+short shooting_get_aperture_from_av96(short av96);
+int shooting_get_user_av_id();
+#if defined(CAM_DRAW_EXPOSITION)
+    char* shooting_get_av_str();
+#endif
+void shooting_set_user_av_by_id(int v);
+short shooting_get_av96();
+void shooting_set_av96(short v,short is_now);
+void shooting_set_av96_direct(short v, short is_now);
+short shooting_get_user_av96();
+void shooting_set_user_av96(short v);
+void shooting_set_user_av_by_id_rel(int v);
+short shooting_get_real_aperture();
+short shooting_get_min_real_aperture();
+short shooting_get_av96_override_value();
+const char * shooting_get_av_bracket_value();
+void shooting_set_nd_filter_state(short v, short is_now);
+/******************************************************************/
+int shooting_get_day_seconds();
+int shooting_get_tick_count();
+/******************************************************************/
+void shooting_set_prop(int id, int v);
+int shooting_get_prop(int id);
+/******************************************************************/
+extern int circle_of_confusion;
+/******************************************************************/
+extern short shooting_get_is_mode();
+extern short shooting_get_resolution();
+extern short shooting_get_display_mode();
+/******************************************************************/
+extern const int zoom_points;
+int shooting_get_zoom();
+void shooting_set_zoom(int v);
+void shooting_set_zoom_rel(int v);
+void shooting_set_zoom_speed(int v);
+/******************************************************************/
+void shooting_set_focus(int v, short is_now);
+short shooting_get_focus_mode();
+int shooting_get_hyperfocal_distance();
+int shooting_get_hyperfocal_distance_f(int av, int fl);
+int shooting_get_near_limit_of_acceptable_sharpness();
+int shooting_get_far_limit_of_acceptable_sharpness();
+int shooting_get_depth_of_field();
+int shooting_get_subject_distance();
+int shooting_get_subject_distance_override_value();
+int shooting_get_subject_distance_bracket_value();
+int shooting_get_subject_distance_override_koef();
+int shooting_get_lens_to_focal_plane_width();
+short shooting_get_drive_mode();
+short shooting_can_focus();
+short shooting_get_common_focus_mode();
+/******************************************************************/
+int shooting_get_iso_mode();
+void shooting_set_iso_mode(int v);
+short shooting_get_sv96();
+short shooting_get_svm96();
+short shooting_get_iso_market();
+short shooting_get_iso_real();
+void shooting_set_iso_real(short iso, short is_now);
+//void shooting_set_iso_market(short isom);
+//void shooting_set_iso_real_delta_from_base(short diso);
+void shooting_set_sv96(short sv96, short is_now);
+short shooting_get_iso_override_value();
+short shooting_get_iso_bracket_value();
+/******************************************************************/
+short shooting_get_canon_overexposure_value();
+short shooting_get_bv96();
+int shooting_get_luminance();
+//const char* shooting_get_flash_light_value();
+/******************************************************************/
+int shooting_get_canon_subject_distance();
+int shooting_get_exif_subject_dist();
+/******************************************************************/
+void shooting_expo_param_override();
+void shooting_bracketing(void);
+
+void shooting_video_bitrate_change(int v);
+extern int auto_started;
+void shooting_tv_bracketing();
+void shooting_av_bracketing();
+void shooting_iso_bracketing();
+/******************************************************************/
+// capture mode functions
+// return a CHDK mode enum for a PROPCASE_SHOOTING_MODE value, or 0 if not found
+int shooting_mode_canon2chdk(int canonmode);
+// return a PROPCASE_SHOOTING_MODE value for a CHDK mode enum value, or -1 if not found. 0 is a valid mode on some cameras.
+int shooting_mode_chdk2canon(int hackmode);
+// set capture mode from CHDK mode, returns 0 if mode not found or not in rec, otherwise 1
+int shooting_set_mode_chdk(int mode);
+// set capture mode from PROPCASE_SHOOTING_MODE value. return 0 if not in rec or mode is -1, otherwise 1
+int shooting_set_mode_canon(int mode);
+
+// returns 0 if in play, nonzero if rec
+int rec_mode_active(void); 
+
+// not used. Right now this is just to preserve code from earlier version of mode_get()
+// in case we want to check play/rec switch state in the future.
+// WARNING: it isn't known if all variants of this check the switch state or some other bit.
+// should return 0 is switch is in play position, non-zero otherwise
+//int rec_switch_state(void);
+
+// swivel screen state.
+#ifdef CAM_SWIVEL_SCREEN
+// 0 not open, non-zero open
+int screen_opened(void);
+// 0 not rotated, non-zero rotated
+int screen_rotated(void);
+#endif
+
+/******************************************************************/
+void clear_values();
+/******************************************************************/
+
+int mode_get();
+
+/******************************************************************/
+
+long stat_get_vbatt();
+int get_ccd_temp();
+int get_optical_temp();
+int get_battery_temp();
+long get_vbatt_min();
+long get_vbatt_max();
+void play_sound(unsigned sound);
+void camera_set_raw(int mode);
+void camera_set_nr(int mode);
+int camera_get_nr();
+int camera_get_script_autostart();
+void camera_set_script_autostart();
+void exit_alt();
+void camera_shutdown_in_a_second(void);
+
+void disable_shutdown();
+void enable_shutdown();
+
+void JogDial_CW(void);
+void JogDial_CCW(void);
+void change_video_tables(int a, int b);
+int get_flash_params_count(void);
+
+/******************************************************************/
+void __attribute__((noreturn)) shutdown();
+void camera_set_led(int led, int state, int bright);
+void debug_led(int state);
+/****************************************/
+extern int canon_menu_active;
+extern char canon_shoot_menu_active;
+extern int recreview_hold;
+
+extern int movie_status;
+unsigned int movie_reset;
+unsigned int GetFreeCardSpaceKb(void);
+unsigned int GetTotalCardSpaceKb(void);
+
+void swap_partitions(void);
+int get_part_count(void);
+void create_partitions(void);
+extern char * camera_jpeg_count_str();
+
+unsigned int GetJpgCount(void);
+unsigned int GetRawCount(void);
+
+void MakeAFScan(void);
+extern int movie_status;
+extern int zoom_status;
+void EnterToCompensationEVF(void);
+void ExitFromCompensationEVF(void);
+
+extern void PutInNdFilter();
+extern void PutOutNdFilter();
+extern long GetCurrentAvValue();
+extern long IsStrobeChargeCompleted();
+extern void SetCurrentCaptureModeType();
+#if CAM_CAN_UNLOCK_OPTICAL_ZOOM_IN_VIDEO
+extern void UnsetZoomForMovie();
+#endif
+#ifdef CAM_AV_OVERRIDE_IRIS_FIX
+extern int MoveIrisWithAv(short*);
+#endif
+#if CAM_EV_IN_VIDEO
+extern void ExpCtrlTool_StartContiAE(int, int);
+extern void ExpCtrlTool_StopContiAE(int, int);
+extern short SetAE_ShutterSpeed(short* tv);
+#endif
+
+void TurnOnBackLight(void);
+void TurnOffBackLight(void);
+
+void wait_until_remote_button_is_released(void);
+short shooting_get_ev_correction1();
+short shooting_get_ev_correction2();
+
+//image_quality_override
+void shooting_set_image_quality(int imq);
+
+int get_ev_video_avail(void);
+void set_ev_video_avail(int);
+int get_ev_video(void);
+void set_ev_video(int);
+//dng related
+// new version to support DNG double buffer
+void reverse_bytes_order2(char* from, char* to, int count);
+// convert old version calls to new version (to minimise code changes)
+#define reverse_bytes_order(start, count)   reverse_bytes_order2(start,start,count)
+void save_ext_for_dng(void);
+void change_ext_to_dng(void);
+void change_ext_to_default(void);
+
+void DoAFLock(void);
+void UnlockAF(void);
+
+void drv_self_hide(void);
+void drv_self_unhide(void);
+
+void  PostLogicalEventForNotPowerType(unsigned event, unsigned unk);
+void  PostLogicalEventToUI(unsigned event, unsigned unk);
+void  SetLogicalEventActive(unsigned event, unsigned state);
+void SetScriptMode(unsigned mode);
+/*
+ call C function with argument list created at runtime.
+ See lib/armutil/callfunc.S for documentation
+*/
+unsigned call_func_ptr(void *func, const unsigned *args, unsigned n_args);
+
+/*
+ reboot, optionally loading a different binary
+ see lib/armutil/reboot.c for documentation
+*/
+int reboot(const char *bootfile);
+
+#define started() debug_led(1)
+#define finished() debug_led(0)
+
+#ifdef CAM_CHDK_PTP
+
+typedef struct {
+    int code;
+    int sess_id;
+    int trans_id;
+    int num_param;
+    int param1;
+    int param2;
+    int param3;
+    int param4;
+    int param5;
+} PTPContainer;
+
+typedef struct {
+    int handle;
+    int (*send_data)(int handle, const char *buf, int part_size, int total_size, int, int, int); // (0xFF9F525C), total_size should be 0 except for the first call
+    int (*recv_data)(int handle, char *buf, int size, int, int); // (0xFF9F5500)
+    int (*send_resp)(int handle, PTPContainer *resp); // (0xFF9F5688)
+    int (*get_data_size)(int handle); // (0xFF9F5830)
+    int (*send_err_resp)(int handle, PTPContainer *resp); // (0xFF9F5784)
+    int unknown1; // ???
+    int (*f2)(); // ??? (0xFF8D5B24)
+    int (*f3)(); // ??? (0xFF8D5B5C)
+    // more??
+} ptp_data;
+
+typedef int (*ptp_handler)(int, ptp_data*, int, int, int, int, int, int, int, int);
+
+int add_ptp_handler(int opcode, ptp_handler handler, int unknown);
+
+void init_chdk_ptp();
+void init_chdk_ptp_task();
+
+typedef struct {
+    unsigned size;
+    unsigned script_id; // id of script message is to/from 
+    unsigned type;
+    unsigned subtype;
+    char data[];
+} ptp_script_msg;
+int ptp_script_write_msg(ptp_script_msg *msg);
+ptp_script_msg* ptp_script_read_msg(void);
+ptp_script_msg* ptp_script_create_msg(unsigned type, unsigned subtype, unsigned datasize, const void *data);
+int ptp_script_write_error_msg(unsigned errtype, const char *err);
+
+#endif // CAM_CHDK_PTP
+
+int switch_mode_usb(int mode); // 0 = playback, 1 = record; return indicates success
+                               // N.B.: switch_mode only supported when USB is connected
+
+void ExitTask();
+
+// Data returned from GetMemInfo & GetExMemInfo functions stored in this data structure
+typedef struct {
+    int start_address;
+    int end_address;
+    int total_size;
+    int allocated_size;
+    int allocated_peak;
+    int allocated_count;
+    int free_size;
+    int free_block_max_size;
+    int free_block_count;
+} cam_meminfo;
+
+// Always included for module_inspector
+extern void GetMemInfo(cam_meminfo*);
+extern int GetExMemInfo(cam_meminfo*);
+
+#ifdef OPT_EXMEM_MALLOC
+    extern void exmem_malloc_init(void);
+#endif
+
+#ifdef CAM_TOUCHSCREEN_UI
+extern unsigned short  touch_screen_x, touch_screen_y;
+extern int touch_screen_active;
+#endif
+
+unsigned char SetFileAttributes(const char* fn, unsigned char attr);
+
+#endif
+
+// debug logging function - see generic wrappers.c to adjust destination
+// WARNING fixed length buffer
+extern void dbg_printf(char *fmt,...);
+
+//#define DEBUG_LOGGING
+// debug with timestamp
+#ifdef DEBUG_LOGGING
+#define DBGPRINTF(fmt,args...) dbg_printf("%08d DBG:" fmt,get_tick_count(), ##args)
+#else
+#define DBGPRINTF(...)
+#endif
+
Index: /branches/reyalp-ptp-live/include/conf.h
===================================================================
--- /branches/reyalp-ptp-live/include/conf.h	(revision 1668)
+++ /branches/reyalp-ptp-live/include/conf.h	(revision 1668)
@@ -0,0 +1,394 @@
+#ifndef CONF_H
+#define CONF_H
+
+#include "gui.h"
+#include "script.h"
+
+#define USER_MENU_ITEMS     14
+#define CONF_STR_LEN        100
+
+#define CONF_EMPTY          0
+// regular char-int-short value
+#define CONF_VALUE			1
+#define CONF_DEF_VALUE      1
+// pointer to value
+#define CONF_VALUE_PTR      2
+// pointer to array of int
+#define CONF_INT_PTR        3
+// pointer to the string
+#define CONF_CHAR_PTR       4
+// OSD_pos
+#define CONF_OSD_POS        5
+
+// Name of default symbol file (for reset)
+#define DEFAULT_SYMBOL_FILE "A/CHDK/SYMBOLS/icon_10.rbf"
+
+typedef struct {
+    unsigned short  x, y;
+} OSD_pos;
+
+typedef struct {
+    int isNumb, isStr, isPInt, isPos;
+    int numb;
+    char* str;
+    int* pInt;
+    OSD_pos pos;
+} tConfigVal;
+
+// Please try do not change existed structure, because this will broke modules compatibility
+// If add field to the end of structure minor api version should be increased.
+// If any other change (remove something, change order, add not to the end, change meaning), major api version should be increased
+typedef struct {
+	int api_version;			// version of this structure
+
+    int save_raw;
+    int save_raw_in_video;
+    int save_raw_in_sports;
+    int save_raw_in_burst;
+    int save_raw_in_edgeoverlay;
+    int save_raw_in_auto;
+    int save_raw_in_ev_bracketing;
+    int save_raw_in_timer;
+    int raw_exceptions_warn;
+    int raw_in_dir;
+    int raw_prefix;
+    int raw_ext;
+    int raw_save_first_only; //for series shooting
+    int raw_nr;
+    int sub_batch_prefix; // output of batch subtracts
+    int sub_batch_ext;
+    int sub_in_dark_value;    // values <= to this are not subtracted, i.e. the dark value of your darkframe
+    int sub_out_dark_value;    // minimum value to output from subtract, i.e. dark value of your final image
+    int raw_cache;
+    int dng_raw;
+    int raw_timer;
+    int raw_dng_ext;
+    int dng_usb_ext;
+
+    int show_osd;
+    int hide_osd;
+    int show_osd_in_review;
+    int script_shoot_delay;
+    int show_histo;
+    int script_vars[SCRIPT_NUM_PARAMS];
+    char script_file[100];
+
+    int show_dof;
+    int batt_volts_max;
+    int batt_volts_min;
+    int batt_step_25;
+    int batt_perc_show;
+    int batt_volts_show;
+    int batt_icon_show;
+    int space_bar_show;
+    int space_bar_size;
+    int space_bar_width;
+    int space_icon_show;
+    int show_clock;
+    int show_temp;
+    int temperature_unit;
+    int clock_format;
+    int clock_indicator;
+    int clock_halfpress;
+    int space_perc_show;
+    int space_mb_show;
+    int space_perc_warn;
+    int space_mb_warn;
+    int space_warn_type;
+    int show_movie_time;
+    int show_movie_refresh;
+
+    int zoom_value;
+
+    int show_state;
+    int show_remaining_raw;
+    int remaining_raw_treshold;
+    int show_raw_state;
+    int show_values;
+    int show_values_in_video;
+    int show_overexp;
+
+    int histo_mode;
+    int histo_auto_ajust;
+    int histo_ignore_boundary;
+    int histo_layout;
+    int histo_show_ev_grid;
+
+    int zebra_draw;
+    //int zebra_mode;
+    //int zebra_restore_screen;
+    //int zebra_restore_osd;
+    //int zebra_over;
+    //int zebra_under;
+    //int zebra_draw_osd;
+    //int zebra_multichannel;
+
+    OSD_pos histo_pos;
+    OSD_pos dof_pos;
+    OSD_pos batt_icon_pos;
+    OSD_pos space_icon_pos;
+    OSD_pos space_hor_pos;
+    OSD_pos space_ver_pos;
+    OSD_pos batt_txt_pos;
+    OSD_pos space_txt_pos;
+    OSD_pos mode_state_pos;
+    OSD_pos mode_raw_pos;
+    OSD_pos values_pos;
+    OSD_pos clock_pos;
+    OSD_pos mode_video_pos;
+    OSD_pos mode_ev_pos;
+    OSD_pos temp_pos;
+    OSD_pos ev_video_pos;
+    OSD_pos usb_info_pos;
+
+    color histo_color;
+    color histo_color2; // markers/border
+    color osd_color;
+    color osd_color_warn;
+    color batt_icon_color;
+    color space_color;
+    color menu_color;
+    color menu_title_color;
+    color menu_cursor_color;
+    color menu_symbol_color;
+    int menu_center;
+    int menu_select_first_entry;
+    int menu_symbol_enable;
+    //color reader_color;
+    //color zebra_color;    // under/over
+    //color grid_color;
+    color osd_color_override;
+
+    int font_cp;
+    char menu_rbf_file[100];
+    char menu_symbol_rbf_file[100];
+
+    char lang_file[100];
+
+    //char reader_file[100];
+    //int  reader_pos;
+    //int  reader_autoscroll;
+    //int  reader_autoscroll_delay;
+    //char reader_rbf_file[100];
+    //int  reader_codepage;
+    //int  reader_wrap_by_words;
+
+    //int sokoban_level;
+
+    int flashlight;
+    int fast_ev;
+    int fast_ev_step;
+    int fast_image_quality;
+    int fast_movie_control;
+    int fast_movie_quality_control;
+    int splash_show;
+    int start_sound;
+    int platformid;
+
+    int use_zoom_mf;
+    long alt_mode_button; //for S-series
+    int alt_prevent_shutdown;
+
+    int show_grid_lines;
+    //char grid_lines_file[100];
+    //int grid_force_color;
+
+    int video_mode;
+    int video_quality;
+    int video_bitrate;
+      
+    int tv_bracket_value;
+    int av_bracket_value;
+    int iso_bracket_value;
+    int iso_bracket_koef;
+    int subj_dist_bracket_value;
+    int subj_dist_bracket_koef;
+    int bracket_type;
+    int bracketing_add_raw_suffix;
+    int clear_bracket;
+    int clear_video;
+    int override_disable;
+    int override_disable_all;
+
+    int tv_override_value;
+    int tv_override_koef;
+    int tv_enum_type;
+    int av_override_value;
+    
+    int nd_filter_state;
+    
+    int iso_override_value;
+    int iso_override_koef;
+    int zoom_override_value;
+    int zoom_override;
+    int subj_dist_override_value;
+    int subj_dist_override_koef;
+    int clear_override;
+    int clear_zoom_override;
+
+    int autoiso_enable;
+    int autoiso_shutter;
+    int autoiso_user_factor;
+    int autoiso_is_factor;
+    int autoiso_max_iso_hi;
+    int autoiso_max_iso_auto;
+    int autoiso_min_iso;
+
+    int recalc_exposure;
+    int tv_exposure_order;
+    int av_exposure_order;
+    int iso_exposure_order;
+
+    int dof_subj_dist_as_near_limit;
+    int dof_use_exif_subj_dist;
+    int dof_subj_dist_in_misc;
+    int dof_near_limit_in_misc;
+    int dof_far_limit_in_misc;
+    int dof_hyperfocal_in_misc;
+    int dof_depth_in_misc;
+    int dof_dist_from_lens;
+
+    int values_show_in_review;
+    int values_show_zoom;
+    int values_show_real_aperture;
+    int values_show_real_iso;
+    int values_show_market_iso;
+    int values_show_iso_only_in_autoiso_mode;
+    int values_show_ev_seted;
+    int values_show_ev_measured;
+    int values_show_bv_measured;
+    int values_show_bv_seted;
+    int values_show_overexposure;
+    int values_show_canon_overexposure;
+    int values_show_luminance;
+
+    int debug_shortcut_action;   // 0=none, 1=dump, 2=page display
+    int debug_display;           // 0=none, 1=props, 2=flash param, 3=tasks
+    int debug_propcase_page;     // save propcase page
+    int debug_lua_restart_on_error; // 0=no, 1=yes
+    int debug_misc_vals_show;    // 0=no, 1=yes
+
+    int script_startup;          // remote autostart
+    int remote_enable;           // remote enable
+    int user_menu_enable;
+    int user_menu_vars[USER_MENU_ITEMS];
+    int user_menu_as_root;
+    int zoom_scale;
+    int unlock_optical_zoom_for_video;
+    int mute_on_zoom;
+    int bad_pixel_removal;
+    int video_af_key;
+
+    char curve_file[100];
+    int curve_enable;
+
+    int edge_overlay_enable;
+    //int edge_overlay_filter;
+    int edge_overlay_thresh;
+    //int edge_overlay_zoom;    // shall zoom be set when *edg file is loaded?
+    //int edge_overlay_pano;    // whether a full press changes back to live mode
+    //int edge_overlay_pano_overlap;    // overlap in % in pano mode
+    //int edge_overlay_show;    // whether to show overlay even when no button is pressed
+    //int edge_overlay_play;    // whether edge overlay is switched on also for play mode
+    //color edge_overlay_color;
+
+    int synch_enable;
+    int ricoh_ca1_mode;
+    int synch_delay_enable;
+    int synch_delay_value;
+    int synch_delay_coarse_value;		// obsolete - no longer used
+    int remote_zoom_enable;
+    int zoom_timeout;
+
+    int script_param_set;
+    int script_param_save;
+
+    long mem_view_addr_init;
+    int flash_sync_curtain;
+    int flash_video_override;
+    int flash_manual_override;
+    int flash_video_override_power;
+
+    // Overrides to disable touchscreen U/I components (IXUS 310)
+    int touchscreen_disable_video_controls;
+    int touchscreen_disable_shortcut_controls;
+
+	// Enable USB icon
+    int usb_info_enable; 
+
+	// gen 2 USB remote
+	int remote_switch_type ;
+	int remote_control_mode ;
+
+} Conf;
+
+extern Conf conf;
+
+#define ALT_PREVENT_SHUTDOWN_NO         0
+#define ALT_PREVENT_SHUTDOWN_ALT        1
+#define ALT_PREVENT_SHUTDOWN_ALT_SCRIPT 2
+#define ALT_PREVENT_SHUTDOWN_ALWAYS     3
+
+#define SHOOTING_PROGRESS_NONE          0
+#define SHOOTING_PROGRESS_STARTED       1
+#define SHOOTING_PROGRESS_PROCESSING    2
+#define SHOOTING_PROGRESS_DONE          3
+
+
+// video quality defaults. Ideally, these should match the camera default settings
+#define VIDEO_DEFAULT_QUALITY   84  // ? where does 84 come from
+#define VIDEO_MAX_QUALITY       99
+#define VIDEO_DEFAULT_BITRATE   3   // should be 1 for all cams
+
+extern void user_menu_restore();
+
+extern int state_kbd_script_run;
+extern int state_shooting_progress;
+extern int state_save_raw_nth_only;
+
+extern void script_autostart();     // remote autostart
+extern void conf_save();
+extern void conf_restore();
+extern void conf_load_defaults();
+extern int shutter_int;
+extern void conf_change_dng(void);
+extern void conf_update_prevent_shutdown(void);
+extern int conf_getValue(unsigned short id, tConfigVal* configVal);
+extern int conf_setValue(unsigned short id, tConfigVal configVal);
+
+// reyalp: putting these in conf, since the conf values are lookups for them
+// prefixes and extentions available for raw images (index with conf.raw_prefix etc)
+#define NUM_IMG_PREFIXES 3  // IMG_ CRW_ SND_ (could add ETC_ SDR_ AUT_ MVI_ MRK_)
+#define NUM_IMG_EXTS 5      // .JPG .CRW .CR2 .THM .WAV (could add .AVI .MRK)
+extern const char* img_prefixes[NUM_IMG_PREFIXES];
+extern const char* img_exts[NUM_IMG_EXTS];
+
+extern int is_raw_enabled();
+
+//-------------------------------------------------------------------
+
+typedef struct {
+    unsigned short      id;
+    unsigned char       size;
+    char                type;
+    void                *var;
+    union {
+        void            *ptr;
+        int             i;
+        color           cl;
+        OSD_pos         pos;
+    };
+    // Since only a few of the ConfInfo entries have a 'func' it saves space to not store the function addresses in the ConfInfo struct
+    // handled in conf_info_func code
+    //void                (*func)();
+} ConfInfo;
+
+#define CONF_INFO(id, param, type, def, func) { id, sizeof( param ), type, &param, {def}/*, func*/ }
+#define CONF_INFO2(id, param, type, px, py)   { id, sizeof( param ), type, &param, {pos:{px,py}} }
+
+extern void config_save(const ConfInfo *conf_info, char *filename, int conf_num);
+extern void config_restore(const ConfInfo *confinfo, char *filename, int conf_num, void (*info_func)(unsigned short id));
+
+//-------------------------------------------------------------------
+
+#endif
Index: /branches/reyalp-ptp-live/include/core.h
===================================================================
--- /branches/reyalp-ptp-live/include/core.h	(revision 1668)
+++ /branches/reyalp-ptp-live/include/core.h	(revision 1668)
@@ -0,0 +1,25 @@
+#ifndef CORE_H
+#define CORE_H
+
+void core_spytask();
+
+void core_hook_task_create(void *tcb);
+void core_hook_task_delete(void *tcb);
+
+long kbd_process();
+
+void gui_init();
+
+void core_rawdata_available();
+void core_spytask_can_start();
+
+#define NOISE_REDUCTION_AUTO_CANON      (0)
+#define NOISE_REDUCTION_OFF             (1)
+#define NOISE_REDUCTION_ON              (2)
+
+long core_get_noise_reduction_value();
+
+int core_get_free_memory();
+
+#endif
+
Index: /branches/reyalp-ptp-live/include/math.h
===================================================================
--- /branches/reyalp-ptp-live/include/math.h	(revision 1668)
+++ /branches/reyalp-ptp-live/include/math.h	(revision 1668)
@@ -0,0 +1,23 @@
+#ifndef MATH_H
+#define MATH_H
+
+#ifndef __VFP_FP__
+extern double d2d(double value);
+#else
+#define d2d(v) (v)
+#endif
+/*
+extern float logf(float v);
+extern float sqrtf(float v);
+extern float powf(float x, float y);
+extern float fabsf(float x);
+extern float scalbnf(float x, int n);
+extern float copysignf(float x, float y);
+*/
+extern double log(double x);
+extern double log2(double x);
+extern double log10(double x);
+extern double pow(double x, double y);
+extern double sqrt(double x);
+
+#endif
Index: /branches/reyalp-ptp-live/include/levent.h
===================================================================
--- /branches/reyalp-ptp-live/include/levent.h	(revision 1668)
+++ /branches/reyalp-ptp-live/include/levent.h	(revision 1668)
@@ -0,0 +1,40 @@
+#ifndef LEVENT_H
+#define LEVENT_H
+
+#define LEVENT_INVALID_INDEX 0xFFFFFFFF
+
+/* logical event definition*/
+typedef struct {
+    char *name; /* name of event, may point to empty string */
+    unsigned id; /* event id number used with canon event fuctions (post etc) */
+    unsigned param; /* unknown 0-3 */
+} levent_def;
+/*
+ table of event definitions in ROM,
+ address can be found with tools/find_levent
+ terminated by an event with a NULL (not empty string) name pointer.
+*/
+extern levent_def levent_table[];
+
+/* return index of named event, or LEVENT_INVALID_INDEX */
+unsigned levent_index_for_name(const char *name);
+
+/* return index of event with given id, or LEVENT_INVALID_INDEX */
+unsigned levent_index_for_id(unsigned id);
+
+/* number of events in table, including final id 0 and id -1*/
+unsigned levent_count(void);
+
+/* return id of named event, or 0 */
+unsigned levent_id_for_name(const char *name);
+
+/* return name of event with given id, or NULL */
+const char * levent_name_for_id(unsigned id);
+
+/* post the named event with PostLogicalEventToUI */
+int levent_post_to_ui_by_name(const char *name);
+
+/* post press/unpress events for RecButton and PBButton */
+void levent_set_record(void);
+void levent_set_play(void);
+#endif
Index: /branches/reyalp-ptp-live/include/locale.h
===================================================================
--- /branches/reyalp-ptp-live/include/locale.h	(revision 1668)
+++ /branches/reyalp-ptp-live/include/locale.h	(revision 1668)
@@ -0,0 +1,1 @@
+
Index: /branches/reyalp-ptp-live/include/assert.h
===================================================================
--- /branches/reyalp-ptp-live/include/assert.h	(revision 1668)
+++ /branches/reyalp-ptp-live/include/assert.h	(revision 1668)
@@ -0,0 +1,6 @@
+#ifndef ASSERT_H
+#define ASSERT_H
+
+#define assert (void)0
+
+#endif
Index: /branches/reyalp-ptp-live/include/lolevel.h
===================================================================
--- /branches/reyalp-ptp-live/include/lolevel.h	(revision 1668)
+++ /branches/reyalp-ptp-live/include/lolevel.h	(revision 1668)
@@ -0,0 +1,318 @@
+#ifndef LOLEVEL_H
+#define LOLEVEL_H
+
+#ifndef LOW_LEVEL
+#error File can be included when platform is built only!
+#endif
+
+#ifndef __arm__
+#error File can be included in ARM mode only!
+#endif
+
+/* Canon stuff */
+extern long *_GetSystemTime(long *t);
+extern long _GetZoomLensCurrentPosition();
+extern long _GetZoomLensCurrentPoint();
+extern long _MoveZoomLensWithPoint(short *pos);
+extern long _SetZoomActuatorSpeedPercent(short *perc);
+extern volatile long zoom_busy;
+extern long _GetFocusLensCurrentPosition();
+extern long _GetFocusLensSubjectDistance();
+extern long _GetFocusLensSubjectDistanceFromLens();
+extern void _MoveFocusLensToDistance(short *dist);
+#ifdef CAM_AV_OVERRIDE_IRIS_FIX
+extern int _MoveIrisWithAv(short*);
+#endif
+extern void _PutInNdFilter();
+extern void _PutOutNdFilter();
+extern volatile long focus_busy;
+extern long _GetCurrentAvValue();
+extern long _GetCurrentTargetDistance();
+extern long _GetPropertyCase(long opt_id, void *buf, long bufsize);
+extern long _SetPropertyCase(long opt_id, void *buf, long bufsize);
+extern long _IsStrobeChargeCompleted();
+extern long _VbattGet();
+extern int _GetBatteryTemperature();
+extern int _GetCCDTemperature();
+extern int _GetOpticalTemperature();
+extern void _PT_PlaySound(short , void*);
+extern void _RefreshPhysicalScreen(long f);
+extern void _Unmount_FileSystem();
+extern void _Mount_FileSystem();
+extern void _SleepTask(long msec);
+extern int _CreateTask (const char *name, int prio, int stack_size /*?*/,
+                        void *entry, long parm /*?*/);
+extern void _SleepTask(long msec);
+extern void __attribute__((noreturn)) _ExitTask();
+extern int _taskNameToId(char* taskName); // VxWorks only, task's name first letter must be 't', maximum 10 chars total 
+extern const char *_taskName(int taskID); // VxWorks only for now
+extern int _taskIdListGet(int *idlist,int max); // VxWorks only for now
+extern void _taskSuspend(int taskId);
+extern void _taskResume(int taskId);
+extern int _errnoOfTaskGet(int tid);
+
+extern long _SetEventFlag(void *flag, long what);
+extern long _CheckAnyEventFlag(void *flag, long mask, long *res);
+extern long _GetEventFlagValue(void *flag, long *res);
+
+extern long _ReceiveMessageQueue(void *msgq, long *dst, long unk1 /* maybe size? */);
+
+/* Canon stuff with nonoriginal naming */
+extern long _GetParameterData(long id, void *buf, long size);
+extern long _SetParameterData(long id, void *buf, long size);
+#ifdef  CAM_DRYOS_2_3_R47
+extern void _MakeSDCardBootable(int driveno);
+#else
+extern void _UpdateMBROnFlash(int driveno, long offset, char *str);
+#endif
+
+/* standart C library */
+//extern int _creat (const char *name, int flags);
+extern int _open (const char *name, int flags, int mode );
+extern int _close (int fd);
+extern int _write (int fd, void *buffer, long nbytes);
+extern int _read (int fd, void *buffer, long nbytes);
+extern int _lseek (int fd, long offset, int whence);
+extern long _mkdir(const char *dirname);
+
+extern int _Open (const char *name, int flags, int mode );
+extern int _Close (int fd);
+extern int _Write (int fd, const void *buffer, long nbytes);
+extern int _Read (int fd, void *buffer, long nbytes);
+extern int _Lseek (int fd, long offset, int whence);
+extern int _Remove(const char *name);
+
+extern long _Fopen_Fut(const char *filename, const char *mode);
+extern long _Fclose_Fut(long file);
+extern long _Fread_Fut(void *buf, long elsize, long count, long f);
+extern long _Fwrite_Fut(const void *buf, long elsize, long count, long f);
+extern long _Fseek_Fut(long file, long offset, long whence);
+extern long _Fflush_Fut(long file);
+extern long _Feof_Fut(long file);
+extern long _Fflush_Fut(long file);
+extern char *_Fgets_Fut(char *buf, int n, long f);
+extern long _RenameFile_Fut(const char *oldname, const char *newname);
+extern long _DeleteFile_Fut(const char *name);
+extern long _MakeDirectory_Fut(const char *name,int unk);
+extern long _DeleteDirectory_Fut(const char *name);
+
+extern int _rename(const char *oldname, const char *newname);
+
+extern int _isdigit(int c);
+extern int _isspace(int c);
+extern int _isalpha(int c);
+extern int _isupper(int c);
+extern int _islower(int c);
+extern int _ispunct(int c);
+extern int _isxdigit(int c);
+
+extern long _strlen(const char *s);
+extern int _strcmp(const char *s1, const char *s2);
+extern int _strncmp(const char *s1, const char *s2, long n);
+extern char *_strchr(const char *s, int c);
+extern char *_strcpy(char *dest, const char *src);
+extern char *_strncpy(char *dest, const char *src, long n);
+extern char *_strcat(char *dest, const char *app);
+extern char *_strrchr(const char *s, int c);
+extern char *_strpbrk(const char *s, const char *accept);
+
+extern long _strtol(const char *nptr, char **endptr, int base);
+extern unsigned long _strtoul(const char *nptr, char **endptr, int base);
+// DRYOS: this function is called by strtol (mode=1) and strtoul (mode=0)
+// easier to match with sig finder
+extern long _strtolx(const char *nptr, char **endptr, int base, int mode);
+
+extern int _tolower(int c);
+extern int _toupper(int c);
+
+extern int _vsprintf(char *buf, const char *fmt, __builtin_va_list va_list);
+
+extern void *_malloc(long size);
+extern void _free(void *p);
+extern void *_AllocateUncacheableMemory(long size);
+extern void _FreeUncacheableMemory(void *p);
+
+extern void *_memchr(const void *s, int c, int n);
+extern void *_memcpy(void *dest, const void *src, long n);
+extern void *_memset(void *s, int c, int n);
+extern int _memcmp(const void *s1, const void *s2, long n);
+
+extern void _qsort (void *__base, int __nelem, int __size, int (*__cmp)(const void *__e1, const void *__e2));
+
+/* VxWorks */
+extern long _taskLock();
+extern long _taskUnlock();
+extern int _taskCreateHookAdd (void *createHook);
+extern int _taskDeleteHookAdd (void *deleteHook);
+extern long _iosDevAdd(void*,void*,int);
+extern long _iosDevDelete(void*);
+extern long _iosDrvInstall(void*,void*,void*,void*,void*,void*,void*);
+extern void _GiveSemaphore(int sem);
+
+/* misc */
+extern const char aPhysw;
+extern long physw_run;
+extern long _kbd_p1_f();
+extern void _kbd_p2_f();
+extern void _kbd_pwr_on();
+extern void _kbd_pwr_off();
+extern void _kbd_read_keys_r2(void*p);
+extern long physw_status[3], physw_copy[3];
+
+extern void __attribute__((naked,noinline)) mykbd_task();
+extern void capt_seq_task();
+extern void movie_record_task();
+extern void init_file_modules_task();
+extern void exp_drv_task();
+
+void kbd_fetch_data(long *dst);
+
+/*used to detect play or record mode without relying on physical switch positions
+ values on most cameras:
+  0 = startup in play
+  1 = unknown, appears to happen in first play<->rec transition
+  2 = record mode
+  4 = canon menu in record mode
+  3 = play after being in record mode at least once
+  5 = transitioning between some record modes, such as movie
+ values on very old vxworks cameras (ixus50_sd400, ixus700_sd500, s2is)
+  0 = startup in play
+  1 = rec
+  2 = play
+  3 = maybe transition ?
+ address in all cases can be found with strings "MenuIn", "MenuOut"
+*/
+extern long playrec_mode;
+
+extern void *led_table;
+extern void _UniqueLedOn(void *addr, long brightness);
+extern void _UniqueLedOff(void *addr);
+struct led_control {int led_num; int action; int brightness; int blink_count;};
+extern int _PostLEDMessage(struct led_control *);
+extern int _LEDDrive(int led, int action);
+
+
+extern long _LockMainPower();
+extern long _UnlockMainPower();
+extern void _SetAutoShutdownTime(int t);
+
+/*
+The following two functions post an event such as button press, switch change, cable connection change.
+event:
+  A number identifying the event. This number may vary between camera models. 
+  See levent.c and levent.h for methods to identify events by name.
+unk: 
+  Unknown value, usually 0 in canon code. For jogdial messages, this is number of clicks.
+return value:
+  Unknown, possibly void.
+*/
+extern int  _PostLogicalEventForNotPowerType(int event, int unk);
+extern int  _PostLogicalEventToUI(int event, int unk);
+/*
+Used in the canon code to modify the generation or delivery of events. For example, Canon 
+mode override code sets 1 on the desired dial position, and zero on all others.
+event: as described above for PostLogicalEvent*
+state: if 1, the event will be generated/delivered as normal. If 0, the event is disabled/blocked.
+*/
+extern void _SetLogicalEventActive(unsigned event, unsigned state);
+/* Somehow related to the above. Normally 0, set to 1 for script mode */
+extern void _SetScriptMode(unsigned mode);
+
+/* math */
+extern int _rand(void);
+extern void* _srand(unsigned int seed);
+
+extern double __log(double x);
+extern double __log10(double x);
+extern double __pow(double x, double y);
+extern double __sqrt(double x);
+
+/* time */
+extern int _utime(const char *file, void *newTimes);
+extern unsigned long _time(/*time_t*/ unsigned long *timer);
+extern void *_localtime(const /*time_t*/ unsigned long *_tod);
+extern void *_LocalTime(const /*time_t*/ unsigned long *_tod, void * t_m); // DRYOS
+extern long _strftime(char *s, unsigned long maxsize, const char *format, const /*struct tm*/ void *timp);
+extern /*time_t*/ long _mktime(/*struct tm*/ void *timp); // VXWORKS
+extern /*time_t*/ long _mktime_ext(void *tim_extp); // DRYOS, doesn't take a struct tm *
+
+#ifdef CAM_DRYOS_2_3_R39
+extern int _SetFileTimeStamp(const char *file_path, int time1, int time2);
+extern int _SetFileAttributes(const char *fn, int attr);
+#else
+extern int _SetFileTimeStamp(int fd, int time1, int time2);
+extern void _SetFileAttributes(int fd, int attr);
+#endif
+
+/* file */
+extern void *_opendir(const char* name);
+extern void *_readdir(void *d);
+extern int _ReadFastDir(void *d, void* dd); // DRYOS
+extern int   _closedir(void *d);
+extern void  _rewinddir(void *d);
+extern int   _stat(const char *name, void *pStat);
+extern unsigned long _GetDrive_ClusterSize(int drive);
+extern unsigned long _GetDrive_TotalClusters(int drive);
+extern unsigned long _GetDrive_FreeClusters(int drive);
+extern int _WriteSDCard(unsigned int drive, unsigned int start_sect, unsigned int num_sect, void *buf);
+
+extern void _UnsetZoomForMovie(void);
+extern void _TurnOffMic(void);
+extern void _TurnOnMic(void);
+
+extern void _MakeAFScan(int*, int);
+extern void _ExpCtrlTool_StartContiAE(int, int);
+extern void _ExpCtrlTool_StopContiAE(int, int);
+
+extern int some_flag_for_af_scan;
+extern int parameter_for_af_scan;
+extern short _SetAE_ShutterSpeed(short* tv);
+
+extern void _EnterToCompensationEVF(void);
+extern void _ExitFromCompensationEVF(void);
+
+extern void _TurnOnBackLight(void);
+extern void _TurnOffBackLight(void);
+
+// reyalp used to calculate size of loaded CHDK
+// these are linker symbols, with no actual data attached!
+extern const char _start,_end;
+
+extern void _DoAFLock(void);
+extern void _UnlockAF(void);
+
+extern int _apex2us(int);
+
+extern void _ScreenLock();
+extern void _SetCurrentCaptureModeType();
+extern unsigned _ExecuteEventProcedure(const char *name, ...);
+// known in CHDK as _RefreshPhysicalScreen
+//extern void _ScreenUnLock();
+
+// 7 calls functions and sets some MMIOs, but doesn't disable caches and actually restart
+// 3 skips one function call on some cameras, but does restart
+extern void _Restart(unsigned option);
+
+// boot an fir/fi2 file
+extern void _reboot_fw_update(const char* bootfile);
+#ifdef CAM_CHDK_PTP
+extern int _add_ptp_handler(int, void*, int);
+extern void _set_control_event(int);
+extern void _PB2Rec();
+extern void _Rec2PB();
+#endif
+
+#ifdef OPT_EXMEM_MALLOC
+// dryos + some vxworks only takes 3 params in reality
+// on some vxworks the function that is easy to match with sig finder takes an additional param,
+// set to zero in the real AllocateExMem
+// versions that don't expect a 4th param will just ignore it
+extern void *_exmem_alloc(int pool_id,int size,int unk,int unk2); 
+#endif
+
+// vxworks only
+// used on a few cameras that don't have memPartInfoGet, see CAM_NO_MEMPARTINFO
+extern int _memPartFindMax(int mempart_id); 
+extern int _memPartInfoGet(int mempart_id,int *info);
+
+#endif
Index: /branches/reyalp-ptp-live/include/setjmp.h
===================================================================
--- /branches/reyalp-ptp-live/include/setjmp.h	(revision 1668)
+++ /branches/reyalp-ptp-live/include/setjmp.h	(revision 1668)
@@ -0,0 +1,305 @@
+#if defined(__arm__) || defined(__thumb__)
+/*
+ * All callee preserved registers:
+ * v1 - v7, fp, ip, sp, lr, f4, f5, f6, f7
+ */
+#define _JBLEN 23
+#endif
+
+#if defined(__AVR__)
+#define _JBLEN 24
+#endif
+
+#ifdef __sparc__
+/*
+ * onsstack,sigmask,sp,pc,npc,psr,g1,o0,wbcnt (sigcontext).
+ * All else recovered by under/over(flow) handling.
+ */
+#define _JBLEN  13
+#endif
+
+#ifdef __BFIN__
+#define _JBLEN  40
+#endif
+
+/* necv70 was 9 as well. */
+
+#ifdef __mc68000__
+/*
+ * onsstack,sigmask,sp,pc,psl,d2-d7,a2-a6,
+ * fp2-fp7  for 68881.
+ * All else recovered by under/over(flow) handling.
+ */
+#define _JBLEN  34
+#endif
+
+#if defined(__mc68hc11__) || defined(__mc68hc12__) || defined(__mc68hc1x__)
+/*
+ * D, X, Y are not saved.
+ * Only take into account the pseudo soft registers (max 32).
+ */
+#define _JBLEN  32
+#endif
+
+#if defined(__Z8001__) || defined(__Z8002__)
+/* 16 regs + pc */
+#define _JBLEN 20
+#endif
+
+#ifdef _AM29K
+/*
+ * onsstack,sigmask,sp,pc,npc,psr,g1,o0,wbcnt (sigcontext).
+ * All else recovered by under/over(flow) handling.
+ */
+#define _JBLEN  9
+#endif
+
+#if defined(__CYGWIN__) && !defined (_JBLEN)
+#define _JBLEN (13 * 4)
+#elif defined (__i386__)
+#if defined(__unix__) || defined(__rtems__)
+# define _JBLEN	9
+#else
+#include "setjmp-dj.h"
+#endif
+#endif
+
+#ifdef __x86_64__
+#define _JBTYPE long long
+#define _JBLEN  8
+#endif
+
+#ifdef __i960__
+#define _JBLEN 35
+#endif
+
+#ifdef __M32R__
+/* Only 8 words are currently needed.  10 gives us some slop if we need
+   to expand.  */
+#define _JBLEN 10
+#endif
+
+#ifdef __mips__
+#ifdef __mips64
+#define _JBTYPE long long
+#endif
+#ifdef __mips_soft_float
+#define _JBLEN 11
+#else
+#define _JBLEN 23
+#endif
+#endif
+
+#ifdef __m88000__
+#define _JBLEN 21
+#endif
+
+#ifdef __H8300__
+#define _JBLEN 5
+#define _JBTYPE int
+#endif
+
+#ifdef __H8300H__
+/* same as H8/300 but registers are twice as big */
+#define _JBLEN 5
+#define _JBTYPE long
+#endif
+
+#if defined (__H8300S__) || defined (__H8300SX__)
+/* same as H8/300 but registers are twice as big */
+#define _JBLEN 5
+#define _JBTYPE long
+#endif
+
+#ifdef __H8500__
+#define _JBLEN 4
+#endif
+
+#ifdef  __sh__
+#if __SH5__
+#define _JBLEN 50
+#define _JBTYPE long long
+#else
+#define _JBLEN 20
+#endif /* __SH5__ */
+#endif
+
+#ifdef  __v800
+#define _JBLEN 28
+#endif
+
+#ifdef __PPC__
+#ifdef __ALTIVEC__
+#define _JBLEN 64
+#else
+#define _JBLEN 32
+#endif
+#define _JBTYPE double
+#endif
+
+#ifdef __hppa__
+/* %r30, %r2-%r18, %r27, pad, %fr12-%fr15.
+   Note space exists for the FP registers, but they are not
+   saved.  */
+#define _JBLEN 28
+#endif
+
+#if defined(__mn10300__) || defined(__mn10200__)
+#ifdef __AM33_2__
+#define _JBLEN 26
+#else
+/* A guess */
+#define _JBLEN 10
+#endif
+#endif
+
+#ifdef __v850
+/* I think our setjmp is saving 15 regs at the moment.  Gives us one word
+   slop if we need to expand.  */
+#define _JBLEN 16
+#endif
+
+#if defined(_C4x)
+#define _JBLEN 10
+#endif
+#if defined(_C3x)
+#define _JBLEN 9
+#endif
+
+#ifdef __TIC80__
+#define _JBLEN 13
+#endif
+
+#ifdef __D10V__
+#define _JBLEN 8
+#endif
+
+#ifdef __D30V__
+#define _JBLEN ((64 /* GPR */ + (2*2) /* ACs */ + 18 /* CRs */) / 2)
+#define _JBTYPE double
+#endif
+
+#ifdef __frv__
+#define _JBLEN (68/2)  /* room for 68 32-bit regs */
+#define _JBTYPE double
+#endif
+
+#ifdef __CRX__
+#define _JBLEN 9
+#endif
+
+#ifdef __fr30__
+#define _JBLEN 10
+#endif
+
+#ifdef __iq2000__
+#define _JBLEN 32
+#endif
+
+#ifdef __mcore__
+#define _JBLEN 16
+#endif
+
+#ifdef __MMIX__
+/* Using a layout compatible with GCC's built-in.  */
+#define _JBLEN 5
+#define _JBTYPE unsigned long
+#endif
+
+#ifdef __mt__
+#define _JBLEN 16
+#endif
+
+#ifdef __SPU__
+#define _JBLEN 50 
+#define _JBTYPE __vector signed int
+#endif
+
+#ifdef __xstormy16__
+/* 4 GPRs plus SP plus PC. */
+#define _JBLEN 8
+#endif
+
+#ifdef __mep__
+/* 16 GPRs, pc, hi, lo */
+#define _JBLEN 19
+#endif
+
+#ifdef __CRIS__
+#define _JBLEN 18
+#endif
+
+#ifdef __m32c__
+#if defined(__r8c_cpu__) || defined(__m16c_cpu__)
+#define _JBLEN (22/2)
+#else
+#define _JBLEN (34/2)
+#endif
+#define _JBTYPE unsigned short
+#endif /* __m32c__ */
+
+#ifdef _JBLEN
+#ifdef _JBTYPE
+typedef	_JBTYPE jmp_buf[_JBLEN];
+#else
+typedef	int jmp_buf[_JBLEN];
+#endif
+#endif
+
+void longjmp(jmp_buf __jmpb, int __retval);
+int setjmp(jmp_buf __jmpb);
+
+#if defined(__CYGWIN__) || defined(__rtems__)
+#include <signal.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* POSIX sigsetjmp/siglongjmp macros */
+typedef int sigjmp_buf[_JBLEN+2];
+
+#define _SAVEMASK	_JBLEN
+#define _SIGMASK	(_JBLEN+1)
+
+#ifdef __CYGWIN__
+# define _CYGWIN_WORKING_SIGSETJMP
+#endif
+
+#if defined(__GNUC__)
+
+#define sigsetjmp(env, savemask) \
+            __extension__ \
+            ({ \
+              sigjmp_buf *_sjbuf = &(env); \
+              ((*_sjbuf)[_SAVEMASK] = savemask,\
+              sigprocmask (SIG_SETMASK, 0, (sigset_t *)((*_sjbuf) + _SIGMASK)),\
+              setjmp (*_sjbuf)); \
+            })
+
+#define siglongjmp(env, val) \
+            __extension__ \
+            ({ \
+              sigjmp_buf *_sjbuf = &(env); \
+              ((((*_sjbuf)[_SAVEMASK]) ? \
+               sigprocmask (SIG_SETMASK, (sigset_t *)((*_sjbuf) + _SIGMASK), 0)\
+               : 0), \
+               longjmp (*_sjbuf, val)); \
+            })
+
+#else /* !__GNUC__ */
+
+#define sigsetjmp(env, savemask) ((env)[_SAVEMASK] = savemask,\
+               sigprocmask (SIG_SETMASK, 0, (sigset_t *) ((env) + _SIGMASK)),\
+               setjmp (env))
+
+#define siglongjmp(env, val) ((((env)[_SAVEMASK])?\
+               sigprocmask (SIG_SETMASK, (sigset_t *) ((env) + _SIGMASK), 0):0),\
+               longjmp (env, val))
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* __CYGWIN__ or __rtems__ */
Index: /branches/reyalp-ptp-live/include/dryos31.h
===================================================================
--- /branches/reyalp-ptp-live/include/dryos31.h	(revision 1668)
+++ /branches/reyalp-ptp-live/include/dryos31.h	(revision 1668)
@@ -0,0 +1,42 @@
+#ifndef _DRYOS_R31_
+#define _DRYOS_R31_
+/******************************************************************************/
+/**              DRYOS version 2.3, release #0031                            **/
+/**              DRYOS version 2.3, release #0039                            **/
+/**              Internal DryOS kernel data types and constants              **/
+/******************************************************************************/
+#define TASK_STATE_READY    0
+#define TASK_STATE_WAIT     1
+#define TASK_STATE_SUSPEND  2
+/******************************************************************************/
+// Task context
+struct context_t
+{
+    unsigned int cpsr;
+    unsigned int r[13];
+    unsigned int lr;
+    unsigned int pc;
+};
+typedef struct context_t context_t;
+/******************************************************************************/
+// Task control block
+struct task_t
+{
+    unsigned int unknown1[2];
+    unsigned int priority;
+    void *entry;
+    unsigned int argument;
+    unsigned int unknown2[2];
+    void *stack_addr;
+    unsigned int stack_size;
+    char *name;
+    unsigned int unknown3[6];
+    unsigned int task_id;
+    unsigned char unknown4[5];
+    unsigned char state;
+    unsigned char unknown5[6];
+    context_t *context;         // SP value, context stored on the stack
+};
+typedef struct task_t task_t;
+/******************************************************************************/
+#endif
Index: /branches/reyalp-ptp-live/include/ubasic.h
===================================================================
--- /branches/reyalp-ptp-live/include/ubasic.h	(revision 1668)
+++ /branches/reyalp-ptp-live/include/ubasic.h	(revision 1668)
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2006, Adam Dunkels
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the author nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+#ifndef __UBASIC_H__
+#define __UBASIC_H__
+
+enum ubasic_errors
+{
+    UBASIC_E_NONE = 0,
+    UBASIC_E_PARSE,
+    UBASIC_E_UNK_STATEMENT,
+    UBASIC_E_UNK_KEY,
+    UBASIC_E_UNK_LABEL,
+    UBASIC_E_GOSUB_STACK_EXHAUSTED,
+    UBASIC_E_UNMATCHED_RETURN,
+    UBASIC_E_IF_STACK_EXHAUSTED,
+    UBASIC_E_UNMATCHED_IF,
+    UBASIC_E_SELECT_STACK_EXHAUSTED,
+    UBASIC_E_UNMATCHED_END_SELECT,
+    UBASIC_E_FOR_STACK_EXHAUSTED,
+    UBASIC_E_UNMATCHED_NEXT,
+    UBASIC_E_DO_STACK_EXHAUSTED,
+    UBASIC_E_UNMATCHED_UNTIL,
+    UBASIC_E_WHILE_STACK_EXHAUSTED,
+    UBASIC_E_UNMATCHED_WEND,
+    UBASIC_E_UNKNOWN_ERROR,
+    UBASIC_E_ENDMARK
+};
+
+/** holds short error messages for all known ubasic_errors */
+extern const char *ubasic_errstrings[UBASIC_E_ENDMARK];
+
+extern int ubasic_error;
+
+void ubasic_init(const char *program);
+void ubasic_run(void);
+int ubasic_finished(void);
+void ubasic_end();
+int ubasic_linenumber();
+int jump_label(char * label);
+
+int ubasic_get_variable(int varnum);
+void ubasic_set_variable(int varum, int value);
+void ubasic_set_md_ret(int md_ret);
+
+#endif /* __UBASIC_H__ */
Index: /branches/reyalp-ptp-live/include/asmsafe.h
===================================================================
--- /branches/reyalp-ptp-live/include/asmsafe.h	(revision 1668)
+++ /branches/reyalp-ptp-live/include/asmsafe.h	(revision 1668)
@@ -0,0 +1,44 @@
+#ifndef ASMSAFE_H
+#define ASMSAFE_H
+/*
+macros to safely call C functions from most inline ASM
+these should replace the use of __attribute__((naked)) functions for C code,
+because C code is not actually legal in naked functions and can break in obscure ways.
+see http://chdk.wikia.com/wiki/CHDK_Coding_Guidelines#Naked_functions
+usage
+    asm volatile (
+...
+    ASM_SAFE("BL my_func\n")
+    ...
+    )
+
+you can set up arguments for the function inside the ASM_SAFE without worrying about preserving values
+e.g
+    ASM_SAFE(
+        "MOV R0,#1\n"
+        "BL my_func\n"
+    )
+*/
+
+// push all regs except SP and PC
+// push CSPR via R0
+// restore value for R0 from stack
+#define ASM_SAFE_ENTER \
+    "STMFD SP!, {R0-R12,LR}\n" \
+    "MRS R0, CPSR\n" \
+    "STR R0,[SP,#-4]!\n" \
+    "LDR R0,[SP,#4]\n"
+
+// pop CSPR via R0
+// pop all regs except SP and PC
+#define ASM_SAFE_LEAVE \
+    "LDR R0,[SP],#4\n" \
+    "MSR CPSR_cxsf,R0\n" \
+    "LDMFD SP!, {R0-R12,LR}\n" 
+
+#define ASM_SAFE(asmcode) \
+    ASM_SAFE_ENTER \
+    asmcode \
+    ASM_SAFE_LEAVE
+
+#endif // ASMSAFE_H
Index: /branches/reyalp-ptp-live/include/modelist.h
===================================================================
--- /branches/reyalp-ptp-live/include/modelist.h	(revision 1668)
+++ /branches/reyalp-ptp-live/include/modelist.h	(revision 1668)
@@ -0,0 +1,131 @@
+#ifndef MODELIST_H
+#define MODELIST_H
+/*
+CHDK capture mode constants.
+WARNING: This file is used with gen_modelist_lua.sed to generate modelist.lua
+WARNING: These are used for platform independent script values. 
+Changing order or inserting new values will break script compatibility.
+ADD NEW VALUES AT THE END!
+
+0 is used as an invalid value
+not every value is valid on every camera
+
+Single line comments on the enum values will be carried over to lua
+
+modemap notes:
+- On cameras where the "manual" mode only allows +/- ev, rather than direct shutter
+control, it should be mapped to P, not M
+- Modes should be mapped to an enum value that matches their canon name. This is
+displayed as a string when the mode is set, and can also be found in canon
+manuals and spec lists. If in doubt refer to the canon manuals for description of
+the modes function, and compare with existing cameras. Add a new enum value at the
+end of the list if it doesn't closely match any existing function.
+- Currently, modes under the SCN menu are given the SCN prefix, even if an equivalent
+non-scene constant already exists.
+- Some cameras have C, or C1 and C2 modes. These are not actual shooting modes, but
+are used to load saved settings for other modes like M, P etc. These modes can be
+set using _SetCurrrentCaptureMode, but are not currently supported by the modemap
+system. If a C mode is set this way, the propcase used for PROPCASE_SHOOTING_MODE
+on propset 2 cameras (49) reflects the actual mode. Propcase 50 appears to show the
+set mode. Propset 1 behavior is unknown.
+- Although canon mode values are similar between many cameras, they are not always the same!
+- a list of valid canon modes can be found in the firmware, see existing cameras
+for examples. This can be found several function calls after a reference to the
+string AC:PTM_Init or similar
+*/
+enum {
+    MODE_AUTO               =1,
+    MODE_P                  , // Called "camera manual" on many cameras without a true manual mode, only allows +/- Ev adjustment
+    MODE_TV                 ,
+    MODE_AV                 ,
+    MODE_M                  , // note, use only for true manual modes that allow direct control of Tv/Av
+    MODE_PORTRAIT           , 
+    MODE_NIGHT_SCENE        , // "night scene" mode. Note, this can be a dail position, or under the scene menu (SCN_NIGHT_SCENE).
+    MODE_LANDSCAPE          ,
+    MODE_VIDEO_STD          ,
+    MODE_VIDEO_SPEED        ,
+    MODE_VIDEO_COMPACT      ,
+    MODE_VIDEO_MY_COLORS    ,
+    MODE_VIDEO_COLOR_ACCENT ,
+    MODE_VIDEO_COLOR_SWAP   ,
+    MODE_STITCH             ,
+    MODE_MY_COLORS          ,
+    MODE_SCN_UNDERWATER     ,
+    MODE_SCN_NIGHT_SNAPSHOT ,
+    MODE_LONG_SHUTTER       , // "long shutter" mode on cameras without true manual mode. Allows manual shutter >= 1 second, uses manual shutter value propcase. Usually found under func menu in "manual" mode.
+    MODE_SCN_LANDSCAPE      ,
+    MODE_COLOR_SWAP         ,
+    MODE_SCN_SNOW           ,
+    MODE_SCN_BEACH          ,
+    MODE_SCN_FIREWORK       ,
+    MODE_SCN_COLOR_ACCENT   ,
+    MODE_SCN_COLOR_SWAP     ,
+    MODE_VIDEO_HIRES        ,
+    MODE_SCN_AQUARIUM       ,
+    MODE_COLOR_ACCENT       ,
+    MODE_SCN_NIGHT_SCENE    ,
+    MODE_SCN_ISO_3200       ,
+    MODE_SCN_SPORT          ,
+    MODE_SCN_KIDS_PETS      ,
+    MODE_INDOOR             ,
+    MODE_KIDS_PETS          ,
+    MODE_NIGHT_SNAPSHOT     ,
+    MODE_DIGITAL_MACRO      ,
+    MODE_SCN_FOLIAGE        ,
+    MODE_VIDEO_TIME_LAPSE   ,
+    MODE_SCN_INDOOR         ,
+    MODE_SCN_PORTRAIT       ,
+    MODE_SUPER_MACRO        ,
+    MODE_VIDEO_PORTRAIT     , // tx1 junk
+    MODE_VIDEO_NIGHT        , // tx1 junk
+    MODE_VIDEO_INDOOR       , // tx1 junk
+    MODE_VIDEO_FOLIAGE      , // tx1 junk
+    MODE_VIDEO_SNOW         , // tx1 junk
+    MODE_VIDEO_BEACH        , // tx1 junk
+    MODE_VIDEO_AQUARIUM     , // tx1 junk
+    MODE_VIDEO_SUPER_MACRO  , // tx1 junk
+    MODE_VIDEO_STITCH       , // tx1 junk
+    MODE_VIDEO_MANUAL       , // tx1 junk
+    MODE_SPORTS             ,
+    MODE_QUICK              ,
+    MODE_SCN_SUNSET         ,
+    MODE_SCN_CREATIVE_EFFECT, // "creative light effect", only known on ixus950_sd850
+    MODE_EASY               ,
+    MODE_SCN_DIGITAL_MACRO  ,
+    MODE_SCN_STITCH         ,
+    MODE_SCN_LONG_SHUTTER   , // only known on sx1, d10
+    MODE_LOWLIGHT           , // g11
+    MODE_SCN_NOSTALGIC      , // s90
+    MODE_SCN_SMART_SHUTTER  , // sx30/g12 (Smart Shutter, Smile detection mode)
+    MODE_SCN_LOWLIGHT       , // sx30
+    MODE_SCN_SUPER_VIVID    , // sx30
+    MODE_SCN_POSTER_EFFECT  , // sx30
+    MODE_SCN_FISHEYE        , // sx30
+    MODE_SCN_MINIATURE      , // sx30
+    MODE_SCN_HDR            , // g12 (HDR scene mode)
+    MODE_VIDEO_MINIATURE    , // g12 (miniature effect video mode)
+    MODE_VIDEO_IFRAME_MOVIE , // sx220
+    MODE_VIDEO_MOVIE_DIGEST , // sx220 (the camera automatically record a short video clip (up to approximately 4 seconds) every time you shoot 
+    MODE_SCN_HIGHSPEED_BURST, // sx220
+    MODE_SCN_BEST_IMAGE     , // sx220
+    MODE_SCN_TOY_CAMERA     , // sx220
+    MODE_SCN_MONOCHROME     , // sx220
+    MODE_SCN_WINK_SELF_TIMER, // sx30/g12 (Smart Shutter, Wink Self Timer mode)
+    MODE_SCN_FACE_SELF_TIMER, // sx30/g12 (Smart Shutter, Face Self Timer mode)
+    MODE_VIDEO_SUPER_SLOW   , // IXUS 310 HS Super Slow Motion Movie
+    MODE_SMART_SHUTTER      , // ixus1000_sd4500 - the following are not under SCN
+    MODE_HIGHSPEED_BURST    ,
+    MODE_BEST_IMAGE         ,
+    MODE_SUPER_VIVID        ,
+    MODE_POSTER_EFFECT      ,
+    MODE_FISHEYE            ,
+    MODE_MINIATURE          ,
+    MODE_BEACH              ,
+    MODE_FOLIAGE            ,
+    MODE_SNOW               ,
+    MODE_FIREWORK           , // ixus1000 end
+    MODE_LIVE               , // A3300is
+    MODE_DISCREET           , // A3300is
+};
+
+#endif
Index: /branches/reyalp-ptp-live/include/lua.h
===================================================================
--- /branches/reyalp-ptp-live/include/lua.h	(revision 1668)
+++ /branches/reyalp-ptp-live/include/lua.h	(revision 1668)
@@ -0,0 +1,350 @@
+/*
+** $Id: lua.h,v 1.218.1.4 2008/01/03 15:41:15 roberto Exp $
+** Lua - An Extensible Extension Language
+** Lua.org, PUC-Rio, Brazil (http://www.lua.org)
+** See Copyright Notice at the end of this file
+*/
+
+#ifndef lua_h
+#define lua_h
+
+#include <stdarg.h>
+#include <stddef.h>
+
+#include "luaconf.h"
+
+#define LUA_VERSION     "Lua 5.1"
+#define LUA_RELEASE     "Lua 5.1.3"
+#define LUA_VERSION_NUM 501
+#define LUA_COPYRIGHT   "Copyright (C) 1994-2008 Lua.org, PUC-Rio"
+#define LUA_AUTHORS     "R. Ierusalimschy, L. H. de Figueiredo & W. Celes"
+
+/* mark for precompiled code (`<esc>Lua') */
+#define LUA_SIGNATURE   "\033Lua"
+
+/* option for multiple returns in `lua_pcall' and `lua_call' */
+#define LUA_MULTRET (-1)
+
+/*
+** pseudo-indices
+*/
+#define LUA_REGISTRYINDEX   (-10000)
+#define LUA_ENVIRONINDEX    (-10001)
+#define LUA_GLOBALSINDEX    (-10002)
+#define lua_upvalueindex(i) (LUA_GLOBALSINDEX-(i))
+
+/* thread status; 0 is OK */
+#define LUA_YIELD       1
+#define LUA_ERRRUN      2
+#define LUA_ERRSYNTAX   3
+#define LUA_ERRMEM      4
+#define LUA_ERRERR      5
+
+typedef struct lua_State lua_State;
+
+typedef int (*lua_CFunction) (lua_State *L);
+
+/*
+** functions that read/write blocks when loading/dumping Lua chunks
+*/
+typedef const char * (*lua_Reader) (lua_State *L, void *ud, size_t *sz);
+
+typedef int (*lua_Writer) (lua_State *L, const void* p, size_t sz, void* ud);
+
+/*
+** prototype for memory-allocation functions
+*/
+typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize);
+
+/*
+** basic types
+*/
+#define LUA_TNONE           (-1)
+
+#define LUA_TNIL            0
+#define LUA_TBOOLEAN        1
+#define LUA_TLIGHTUSERDATA  2
+#define LUA_TNUMBER         3
+#define LUA_TSTRING         4
+#define LUA_TTABLE          5
+#define LUA_TFUNCTION       6
+#define LUA_TUSERDATA       7
+#define LUA_TTHREAD         8
+
+/* minimum Lua stack available to a C function */
+#define LUA_MINSTACK        20
+
+/*
+** generic extra include file
+*/
+#if defined(LUA_USER_H)
+#include LUA_USER_H
+#endif
+
+/* type of numbers in Lua */
+typedef LUA_NUMBER lua_Number;
+
+/* type for integer functions */
+typedef LUA_INTEGER lua_Integer;
+
+/*
+** state manipulation
+*/
+LUA_API lua_State *(lua_newstate) (lua_Alloc f, void *ud);
+LUA_API void       (lua_close) (lua_State *L);
+LUA_API lua_State *(lua_newthread) (lua_State *L);
+
+LUA_API lua_CFunction (lua_atpanic) (lua_State *L, lua_CFunction panicf);
+
+/*
+** basic stack manipulation
+*/
+LUA_API int   (lua_gettop) (lua_State *L);
+LUA_API void  (lua_settop) (lua_State *L, int idx);
+LUA_API void  (lua_pushvalue) (lua_State *L, int idx);
+LUA_API void  (lua_remove) (lua_State *L, int idx);
+LUA_API void  (lua_insert) (lua_State *L, int idx);
+LUA_API void  (lua_replace) (lua_State *L, int idx);
+LUA_API int   (lua_checkstack) (lua_State *L, int sz);
+
+LUA_API void  (lua_xmove) (lua_State *from, lua_State *to, int n);
+
+/*
+** access functions (stack -> C)
+*/
+
+LUA_API int             (lua_isnumber) (lua_State *L, int idx);
+LUA_API int             (lua_isstring) (lua_State *L, int idx);
+LUA_API int             (lua_iscfunction) (lua_State *L, int idx);
+LUA_API int             (lua_isuserdata) (lua_State *L, int idx);
+LUA_API int             (lua_type) (lua_State *L, int idx);
+LUA_API const char     *(lua_typename) (lua_State *L, int tp);
+
+LUA_API int             (lua_equal) (lua_State *L, int idx1, int idx2);
+LUA_API int             (lua_rawequal) (lua_State *L, int idx1, int idx2);
+LUA_API int             (lua_lessthan) (lua_State *L, int idx1, int idx2);
+
+LUA_API lua_Number      (lua_tonumber) (lua_State *L, int idx);
+LUA_API lua_Integer     (lua_tointeger) (lua_State *L, int idx);
+LUA_API int             (lua_toboolean) (lua_State *L, int idx);
+LUA_API const char     *(lua_tolstring) (lua_State *L, int idx, size_t *len);
+LUA_API size_t          (lua_objlen) (lua_State *L, int idx);
+LUA_API lua_CFunction   (lua_tocfunction) (lua_State *L, int idx);
+LUA_API void           *(lua_touserdata) (lua_State *L, int idx);
+LUA_API lua_State      *(lua_tothread) (lua_State *L, int idx);
+LUA_API const void     *(lua_topointer) (lua_State *L, int idx);
+
+/*
+** push functions (C -> stack)
+*/
+LUA_API void  (lua_pushnil) (lua_State *L);
+LUA_API void  (lua_pushnumber) (lua_State *L, lua_Number n);
+LUA_API void  (lua_pushinteger) (lua_State *L, lua_Integer n);
+LUA_API void  (lua_pushlstring) (lua_State *L, const char *s, size_t l);
+LUA_API void  (lua_pushstring) (lua_State *L, const char *s);
+LUA_API const char *(lua_pushvfstring) (lua_State *L, const char *fmt,
+                                                      va_list argp);
+LUA_API const char *(lua_pushfstring) (lua_State *L, const char *fmt, ...);
+LUA_API void  (lua_pushcclosure) (lua_State *L, lua_CFunction fn, int n);
+LUA_API void  (lua_pushboolean) (lua_State *L, int b);
+LUA_API void  (lua_pushlightuserdata) (lua_State *L, void *p);
+LUA_API int   (lua_pushthread) (lua_State *L);
+
+/*
+** get functions (Lua -> stack)
+*/
+LUA_API void  (lua_gettable) (lua_State *L, int idx);
+LUA_API void  (lua_getfield) (lua_State *L, int idx, const char *k);
+LUA_API void  (lua_rawget) (lua_State *L, int idx);
+LUA_API void  (lua_rawgeti) (lua_State *L, int idx, int n);
+LUA_API void  (lua_createtable) (lua_State *L, int narr, int nrec);
+LUA_API void *(lua_newuserdata) (lua_State *L, size_t sz);
+LUA_API int   (lua_getmetatable) (lua_State *L, int objindex);
+LUA_API void  (lua_getfenv) (lua_State *L, int idx);
+
+/*
+** set functions (stack -> Lua)
+*/
+LUA_API void  (lua_settable) (lua_State *L, int idx);
+LUA_API void  (lua_setfield) (lua_State *L, int idx, const char *k);
+LUA_API void  (lua_rawset) (lua_State *L, int idx);
+LUA_API void  (lua_rawseti) (lua_State *L, int idx, int n);
+LUA_API int   (lua_setmetatable) (lua_State *L, int objindex);
+LUA_API int   (lua_setfenv) (lua_State *L, int idx);
+
+/*
+** `load' and `call' functions (load and run Lua code)
+*/
+LUA_API void  (lua_call) (lua_State *L, int nargs, int nresults);
+LUA_API int   (lua_pcall) (lua_State *L, int nargs, int nresults, int errfunc);
+LUA_API int   (lua_cpcall) (lua_State *L, lua_CFunction func, void *ud);
+LUA_API int   (lua_load) (lua_State *L, lua_Reader reader, void *dt,
+                                        const char *chunkname);
+
+LUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data);
+
+/*
+** coroutine functions
+*/
+LUA_API int  (lua_yield) (lua_State *L, int nresults);
+LUA_API int  (lua_resume) (lua_State *L, int narg);
+LUA_API int  (lua_status) (lua_State *L);
+
+/*
+** garbage-collection function and options
+*/
+
+#define LUA_GCSTOP          0
+#define LUA_GCRESTART       1
+#define LUA_GCCOLLECT       2
+#define LUA_GCCOUNT         3
+#define LUA_GCCOUNTB        4
+#define LUA_GCSTEP          5
+#define LUA_GCSETPAUSE      6
+#define LUA_GCSETSTEPMUL    7
+
+LUA_API int (lua_gc) (lua_State *L, int what, int data);
+
+/*
+** miscellaneous functions
+*/
+
+LUA_API int   (lua_error) (lua_State *L);
+
+LUA_API int   (lua_next) (lua_State *L, int idx);
+
+LUA_API void  (lua_concat) (lua_State *L, int n);
+
+LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud);
+LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud);
+
+/* 
+** ===============================================================
+** some useful macros
+** ===============================================================
+*/
+
+#define lua_pop(L,n)            lua_settop(L, -(n)-1)
+
+#define lua_newtable(L)         lua_createtable(L, 0, 0)
+
+#define lua_register(L,n,f)     (lua_pushcfunction(L, (f)), lua_setglobal(L, (n)))
+
+#define lua_pushcfunction(L,f)  lua_pushcclosure(L, (f), 0)
+
+#define lua_strlen(L,i)         lua_objlen(L, (i))
+
+#define lua_isfunction(L,n)     (lua_type(L, (n)) == LUA_TFUNCTION)
+#define lua_istable(L,n)        (lua_type(L, (n)) == LUA_TTABLE)
+#define lua_islightuserdata(L,n)    (lua_type(L, (n)) == LUA_TLIGHTUSERDATA)
+#define lua_isnil(L,n)          (lua_type(L, (n)) == LUA_TNIL)
+#define lua_isboolean(L,n)      (lua_type(L, (n)) == LUA_TBOOLEAN)
+#define lua_isthread(L,n)       (lua_type(L, (n)) == LUA_TTHREAD)
+#define lua_isnone(L,n)         (lua_type(L, (n)) == LUA_TNONE)
+#define lua_isnoneornil(L, n)   (lua_type(L, (n)) <= 0)
+
+#define lua_pushliteral(L, s)   \
+    lua_pushlstring(L, "" s, (sizeof(s)/sizeof(char))-1)
+
+#define lua_setglobal(L,s)      lua_setfield(L, LUA_GLOBALSINDEX, (s))
+#define lua_getglobal(L,s)      lua_getfield(L, LUA_GLOBALSINDEX, (s))
+
+#define lua_tostring(L,i)       lua_tolstring(L, (i), NULL)
+
+/*
+** compatibility macros and functions
+*/
+
+#define lua_open()          luaL_newstate()
+
+#define lua_getregistry(L)  lua_pushvalue(L, LUA_REGISTRYINDEX)
+
+#define lua_getgccount(L)   lua_gc(L, LUA_GCCOUNT, 0)
+
+#define lua_Chunkreader     lua_Reader
+#define lua_Chunkwriter     lua_Writer
+
+/* hack */
+LUA_API void lua_setlevel   (lua_State *from, lua_State *to);
+
+/*
+** {======================================================================
+** Debug API
+** =======================================================================
+*/
+
+/*
+** Event codes
+*/
+#define LUA_HOOKCALL    0
+#define LUA_HOOKRET     1
+#define LUA_HOOKLINE    2
+#define LUA_HOOKCOUNT   3
+#define LUA_HOOKTAILRET 4
+
+/*
+** Event masks
+*/
+#define LUA_MASKCALL    (1 << LUA_HOOKCALL)
+#define LUA_MASKRET     (1 << LUA_HOOKRET)
+#define LUA_MASKLINE    (1 << LUA_HOOKLINE)
+#define LUA_MASKCOUNT   (1 << LUA_HOOKCOUNT)
+
+typedef struct lua_Debug lua_Debug;  /* activation record */
+
+/* Functions to be called by the debuger in specific events */
+typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar);
+
+LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar);
+LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar);
+LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n);
+LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n);
+LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n);
+LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n);
+
+LUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask, int count);
+LUA_API lua_Hook lua_gethook (lua_State *L);
+LUA_API int lua_gethookmask (lua_State *L);
+LUA_API int lua_gethookcount (lua_State *L);
+
+struct lua_Debug {
+    int event;
+    const char *name;           /* (n) */
+    const char *namewhat;       /* (n) `global', `local', `field', `method' */
+    const char *what;           /* (S) `Lua', `C', `main', `tail' */
+    const char *source;         /* (S) */
+    int currentline;            /* (l) */
+    int nups;                   /* (u) number of upvalues */
+    int linedefined;            /* (S) */
+    int lastlinedefined;        /* (S) */
+    char short_src[LUA_IDSIZE]; /* (S) */
+    /* private part */
+    int i_ci;                   /* active function */
+};
+
+/* }====================================================================== */
+
+/******************************************************************************
+* Copyright (C) 1994-2008 Lua.org, PUC-Rio.  All rights reserved.
+*
+* Permission is hereby granted, free of charge, to any person obtaining
+* a copy of this software and associated documentation files (the
+* "Software"), to deal in the Software without restriction, including
+* without limitation the rights to use, copy, modify, merge, publish,
+* distribute, sublicense, and/or sell copies of the Software, and to
+* permit persons to whom the Software is furnished to do so, subject to
+* the following conditions:
+*
+* The above copyright notice and this permission notice shall be
+* included in all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+******************************************************************************/
+
+#endif
Index: /branches/reyalp-ptp-live/include/lang.h
===================================================================
--- /branches/reyalp-ptp-live/include/lang.h	(revision 1668)
+++ /branches/reyalp-ptp-live/include/lang.h	(revision 1668)
@@ -0,0 +1,18 @@
+#ifndef LANG_H
+#define LANG_H
+
+//-------------------------------------------------------------------
+extern void lang_init(int num);
+
+extern void lang_load_from_file(const char *filename);
+extern void lang_map_preparsed_from_mem( char* gui_lang_default, int num );
+
+typedef int (*callback_process_file)(char* buf, int size);
+extern int load_from_file(const char *filename, callback_process_file callback) ;
+extern char* load_file( const char* name, int* rv_size );
+
+extern char* lang_str(int str);
+extern unsigned lang_strhash31(int langid);
+
+//-------------------------------------------------------------------
+#endif
Index: /branches/reyalp-ptp-live/include/vxworks.h
===================================================================
--- /branches/reyalp-ptp-live/include/vxworks.h	(revision 1668)
+++ /branches/reyalp-ptp-live/include/vxworks.h	(revision 1668)
@@ -0,0 +1,48 @@
+#ifndef _VXWORKS_
+#define _VXWORKS_
+/******************************************************************************/
+/**             VxWorks 5.5, kernel WIND version 2.6                         **/
+/**             Internal VxWorks kernel data types and constants             **/
+/******************************************************************************/
+#define TASK_STATE_READY    0
+#define TASK_STATE_SUSPEND  1
+#define TASK_STATE_PENDING  2
+#define TASK_STATE_DELAY    4
+#define TASK_STATE_DEAD     8
+/******************************************************************************/
+// Task context
+struct context_t
+{
+    unsigned int r[13];
+    unsigned int sp;
+    unsigned int lr;
+    unsigned int pc;
+    unsigned int cpsr;
+};
+typedef struct context_t context_t;
+/******************************************************************************/
+// Task control block
+struct task_t {
+    unsigned int    unknown1[13];
+    char            *name;
+    unsigned int    options;
+    unsigned int    state;
+    unsigned int    priority;
+    unsigned int    unknown2[12];
+    void            *entry;
+    void            *stack_base;
+    void            *stack_limit;
+    void            *stack_end;
+    unsigned int    error_num;
+    unsigned int    exit_code;
+    unsigned int    unknown3[7];
+    void            *task_std_fp[3];    // pointers to FILE structures
+    unsigned int    task_std_fd[3];     // std file descriptors
+    unsigned int    unknown4[24];
+    context_t context;
+    unsigned int    unknown5[11];
+};
+typedef struct task_t task_t;
+/******************************************************************************/
+
+#endif
Index: /branches/reyalp-ptp-live/include/ctype.h
===================================================================
--- /branches/reyalp-ptp-live/include/ctype.h	(revision 1668)
+++ /branches/reyalp-ptp-live/include/ctype.h	(revision 1668)
@@ -0,0 +1,5 @@
+#ifndef CTYPE_H
+#define CTYPE_H
+// dummy for lua code
+#include <stdlib.h>
+#endif
Index: /branches/reyalp-ptp-live/include/gui.h
===================================================================
--- /branches/reyalp-ptp-live/include/gui.h	(revision 1668)
+++ /branches/reyalp-ptp-live/include/gui.h	(revision 1668)
@@ -0,0 +1,96 @@
+#ifndef GUI_H
+#define GUI_H
+
+typedef unsigned int    coord;
+typedef unsigned short  color;
+
+#define MAKE_COLOR(bg, fg)  ((color)((((char)(bg))<<8)|((char)(fg))))
+#define FG_COLOR(color)     ((unsigned char)(color & 0xFF))
+#define BG_COLOR(color)     ((unsigned char)(color >> 8))
+
+// Module ID's for specific modules that we need to be able to detect
+// use GUI_MODE_MODULE for generic module modes (e.g.games)
+enum Gui_Mode_ {
+    GUI_MODE_NONE = 0,
+    GUI_MODE_ALT,
+    GUI_MODE_MENU,
+    GUI_MODE_MBOX,
+    GUI_MODE_OSD,
+    GUI_MODE_PALETTE,
+    GUI_MODE_FSELECT,
+    GUI_MODE_MPOPUP,
+    GUI_MODE_MODULE,    // generic module
+};
+
+
+typedef unsigned int gui_mode_t;
+
+#define GUI_MODE_MAGICNUM	0xd36c1559
+
+// Specific behaviour of gui mode
+#define GUI_MODE_FLAG_NODRAWRESTORE       1
+#define GUI_MODE_FLAG_NORESTORE_ON_SWITCH 2
+// Binded to module gui mode
+#define GUI_MODE_FLAG_ALIAS				  4
+
+
+// Values (bit-flag) for gui_draw argument
+#define GUI_REDRAWFLAG_ERASEGUARD       1
+#define GUI_REDRAWFLAG_MODE_WAS_CHANGED 2
+#define GUI_REDRAWFLAG_DRAW_RESTORED    4
+
+// Structure to store gui redraw and kbd process handlers for each mode
+typedef struct
+{
+    // Gui_Mode enum value
+    int mode;
+
+	// Called to redraw screen. Argument is GUI_REDRAWFLAG_* set
+    void (*redraw)(int);
+
+	// Main button handler for mode
+    void (*kbd_process)(void);
+
+	// Menu button handler for mode
+    void (*kbd_process_menu_btn)(void);
+
+	int flags;
+
+	// Safety check for modules
+	unsigned int magicnum;
+} gui_handler;
+
+extern gui_handler defaultGuiHandler;
+extern gui_handler altGuiHandler;
+extern gui_handler menuGuiHandler;
+
+void gui_default_kbd_process_menu_btn();
+
+extern void gui_redraw();
+extern void gui_force_restore();
+
+extern gui_mode_t gui_get_mode();
+extern gui_handler* gui_set_mode(gui_handler *mode);
+
+extern void gui_enum_value_change(int *value, int change, unsigned num_items);
+
+#if !CAM_VIDEO_QUALITY_ONLY
+extern const char* gui_video_bitrate_enum(int change, int arg);
+#endif
+
+#ifdef OPT_SCRIPTING
+extern void gui_update_script_submenu();
+#endif
+
+extern void gui_menu_run_fltmodule(int arg);
+
+//----------------------------
+struct gui_common_api_ver {
+		unsigned int common_api;		// common gui version: gui_mode handling, mbox, this structure
+		unsigned int menu_api;		// cmenu structure version
+	};
+
+// Defined in gui.c
+extern struct gui_common_api_ver gui_version;
+
+#endif
Index: /branches/reyalp-ptp-live/include/stdarg.h
===================================================================
--- /branches/reyalp-ptp-live/include/stdarg.h	(revision 1668)
+++ /branches/reyalp-ptp-live/include/stdarg.h	(revision 1668)
@@ -0,0 +1,9 @@
+#ifndef STDARG_H
+#define STDARG_H
+
+#define va_list __builtin_va_list
+#define va_start __builtin_va_start
+#define va_arg __builtin_va_arg
+#define va_end __builtin_va_end
+
+#endif
Index: /branches/reyalp-ptp-live/include/errno.h
===================================================================
--- /branches/reyalp-ptp-live/include/errno.h	(revision 1668)
+++ /branches/reyalp-ptp-live/include/errno.h	(revision 1668)
@@ -0,0 +1,1 @@
+
Index: /branches/reyalp-ptp-live/include/luaconf.h
===================================================================
--- /branches/reyalp-ptp-live/include/luaconf.h	(revision 1668)
+++ /branches/reyalp-ptp-live/include/luaconf.h	(revision 1668)
@@ -0,0 +1,720 @@
+/*
+** $Id: luaconf.h,v 1.82.1.6 2008/01/18 17:07:48 roberto Exp $
+** Configuration file for Lua
+** See Copyright Notice in lua.h
+*/
+
+#ifndef lconfig_h
+#define lconfig_h
+
+#include <limits.h>
+#include <stddef.h>
+
+/*
+** ==================================================================
+** Search for "@@" to find all configurable definitions.
+** ===================================================================
+*/
+
+/*
+@@ LUA_ANSI controls the use of non-ansi features.
+** CHANGE it (define it) if you want Lua to avoid the use of any
+** non-ansi feature or library.
+*/
+#if defined(__STRICT_ANSI__)
+#define LUA_ANSI
+#endif
+
+#if !defined(LUA_ANSI) && defined(_WIN32)
+#define LUA_WIN
+#endif
+
+#if defined(LUA_USE_LINUX)
+#define LUA_USE_POSIX
+#define LUA_USE_DLOPEN      /* needs an extra library: -ldl */
+#define LUA_USE_READLINE    /* needs some extra libraries */
+#endif
+
+#if defined(LUA_USE_MACOSX)
+#define LUA_USE_POSIX
+#define LUA_DL_DYLD         /* does not need extra library */
+#endif
+
+/*
+@@ LUA_USE_POSIX includes all functionallity listed as X/Open System
+@* Interfaces Extension (XSI).
+** CHANGE it (define it) if your system is XSI compatible.
+*/
+#if defined(LUA_USE_POSIX)
+#define LUA_USE_MKSTEMP
+#define LUA_USE_ISATTY
+#define LUA_USE_POPEN
+#define LUA_USE_ULONGJMP
+#endif
+
+/*
+@@ LUA_PATH and LUA_CPATH are the names of the environment variables that
+@* Lua check to set its paths.
+@@ LUA_INIT is the name of the environment variable that Lua
+@* checks for initialization code.
+** CHANGE them if you want different names.
+*/
+#define LUA_PATH        "LUA_PATH"
+#define LUA_CPATH       "LUA_CPATH"
+#define LUA_INIT        "LUA_INIT"
+
+/*
+@@ LUA_PATH_DEFAULT is the default path that Lua uses to look for
+@* Lua libraries.
+@@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for
+@* C libraries.
+** CHANGE them if your machine has a non-conventional directory
+** hierarchy or if you want to install your libraries in
+** non-conventional directories.
+*/
+#if defined(_WIN32)
+/*
+** In Windows, any exclamation mark ('!') in the path is replaced by the
+** path of the directory of the executable file of the current process.
+*/
+#define LUA_LDIR    "!\\lua\\"
+#define LUA_CDIR    "!\\"
+#define LUA_PATH_DEFAULT  \
+        ".\\?.lua;"  LUA_LDIR"?.lua;"  LUA_LDIR"?\\init.lua;" \
+                    LUA_CDIR"?.lua;"  LUA_CDIR"?\\init.lua"
+#define LUA_CPATH_DEFAULT \
+    ".\\?.dll;"  LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll"
+
+#else
+#define LUA_ROOT    "/usr/local/"
+#define LUA_LDIR    LUA_ROOT "share/lua/5.1/"
+#define LUA_CDIR    LUA_ROOT "lib/lua/5.1/"
+#define LUA_PATH_DEFAULT  \
+        "./?.lua;"  LUA_LDIR"?.lua;"  LUA_LDIR"?/init.lua;" \
+                    LUA_CDIR"?.lua;"  LUA_CDIR"?/init.lua"
+#define LUA_CPATH_DEFAULT \
+    "./?.so;"  LUA_CDIR"?.so;" LUA_CDIR"loadall.so"
+#endif
+
+/*
+@@ LUA_DIRSEP is the directory separator (for submodules).
+** CHANGE it if your machine does not use "/" as the directory separator
+** and is not Windows. (On Windows Lua automatically uses "\".)
+*/
+#if defined(_WIN32)
+#define LUA_DIRSEP  "\\"
+#else
+#define LUA_DIRSEP  "/"
+#endif
+
+/*
+@@ LUA_PATHSEP is the character that separates templates in a path.
+@@ LUA_PATH_MARK is the string that marks the substitution points in a
+@* template.
+@@ LUA_EXECDIR in a Windows path is replaced by the executable's
+@* directory.
+@@ LUA_IGMARK is a mark to ignore all before it when bulding the
+@* luaopen_ function name.
+** CHANGE them if for some reason your system cannot use those
+** characters. (E.g., if one of those characters is a common character
+** in file/directory names.) Probably you do not need to change them.
+*/
+#define LUA_PATHSEP     ";"
+#define LUA_PATH_MARK   "?"
+#define LUA_EXECDIR     "!"
+#define LUA_IGMARK      "-"
+
+/*
+@@ LUA_INTEGER is the integral type used by lua_pushinteger/lua_tointeger.
+** CHANGE that if ptrdiff_t is not adequate on your machine. (On most
+** machines, ptrdiff_t gives a good choice between int or long.)
+*/
+#define LUA_INTEGER     int
+
+/*
+@@ LUA_API is a mark for all core API functions.
+@@ LUALIB_API is a mark for all standard library functions.
+** CHANGE them if you need to define those functions in some special way.
+** For instance, if you want to create one Windows DLL with the core and
+** the libraries, you may want to use the following definition (define
+** LUA_BUILD_AS_DLL to get it).
+*/
+#if defined(LUA_BUILD_AS_DLL)
+
+#if defined(LUA_CORE) || defined(LUA_LIB)
+#define LUA_API __declspec(dllexport)
+#else
+#define LUA_API __declspec(dllimport)
+#endif
+
+#else
+
+#define LUA_API     extern
+
+#endif
+
+/* more often than not the libs go together with the core */
+#define LUALIB_API  LUA_API
+
+/*
+@@ LUAI_FUNC is a mark for all extern functions that are not to be
+@* exported to outside modules.
+@@ LUAI_DATA is a mark for all extern (const) variables that are not to
+@* be exported to outside modules.
+** CHANGE them if you need to mark them in some special way. Elf/gcc
+** (versions 3.2 and later) mark them as "hidden" to optimize access
+** when Lua is compiled as a shared library.
+*/
+#if defined(luaall_c)
+#define LUAI_FUNC   static
+#define LUAI_DATA   /* empty */
+
+#elif defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \
+      defined(__ELF__)
+/* reyalp: hidden is irrelevant if not dynamically linked*/
+#if defined(HDK_VERSION)
+#define LUAI_FUNC   extern
+#else
+#define LUAI_FUNC   __attribute__((visibility("hidden"))) extern
+#endif
+#define LUAI_DATA   LUAI_FUNC
+
+#else
+#define LUAI_FUNC   extern
+#define LUAI_DATA   extern
+#endif
+
+/*
+@@ LUA_QL describes how error messages quote program elements.
+** CHANGE it if you want a different appearance.
+*/
+#define LUA_QL(x)   "'" x "'"
+#define LUA_QS      LUA_QL("%s")
+
+/*
+@@ LUA_IDSIZE gives the maximum size for the description of the source
+@* of a function in debug information.
+** CHANGE it if you want a different size.
+*/
+#define LUA_IDSIZE	60
+
+/*
+** {==================================================================
+** Stand-alone configuration
+** ===================================================================
+*/
+
+#if defined(lua_c) || defined(luaall_c)
+
+/*
+@@ lua_stdin_is_tty detects whether the standard input is a 'tty' (that
+@* is, whether we're running lua interactively).
+** CHANGE it if you have a better definition for non-POSIX/non-Windows
+** systems.
+*/
+#if defined(LUA_USE_ISATTY)
+#include <unistd.h>
+#define lua_stdin_is_tty()  isatty(0)
+#elif defined(LUA_WIN)
+#include <io.h>
+#include <stdio.h>
+#define lua_stdin_is_tty()  _isatty(_fileno(stdin))
+#else
+#define lua_stdin_is_tty()  1  /* assume stdin is a tty */
+#endif
+
+/*
+@@ LUA_PROMPT is the default prompt used by stand-alone Lua.
+@@ LUA_PROMPT2 is the default continuation prompt used by stand-alone Lua.
+** CHANGE them if you want different prompts. (You can also change the
+** prompts dynamically, assigning to globals _PROMPT/_PROMPT2.)
+*/
+#define LUA_PROMPT      "> "
+#define LUA_PROMPT2     ">> "
+
+/*
+@@ LUA_PROGNAME is the default name for the stand-alone Lua program.
+** CHANGE it if your stand-alone interpreter has a different name and
+** your system is not able to detect that name automatically.
+*/
+#define LUA_PROGNAME    "lua"
+
+/*
+@@ LUA_MAXINPUT is the maximum length for an input line in the
+@* stand-alone interpreter.
+** CHANGE it if you need longer lines.
+*/
+#define LUA_MAXINPUT    512
+
+/*
+@@ lua_readline defines how to show a prompt and then read a line from
+@* the standard input.
+@@ lua_saveline defines how to "save" a read line in a "history".
+@@ lua_freeline defines how to free a line read by lua_readline.
+** CHANGE them if you want to improve this functionality (e.g., by using
+** GNU readline and history facilities).
+*/
+#if defined(LUA_USE_READLINE)
+#include <stdio.h>
+#include <readline/readline.h>
+#include <readline/history.h>
+#define lua_readline(L,b,p)	((void)L, ((b)=readline(p)) != NULL)
+#define lua_saveline(L,idx) \
+    if (lua_strlen(L,idx) > 0)  /* non-empty line? */ \
+    add_history(lua_tostring(L, idx));  /* add it to history */
+#define lua_freeline(L,b)	((void)L, free(b))
+#else
+#define lua_readline(L,b,p)	\
+    ((void)L, fputs(p, stdout), fflush(stdout),  /* show prompt */ \
+    fgets(b, LUA_MAXINPUT, stdin) != NULL)  /* get line */
+#define lua_saveline(L,idx)	{ (void)L; (void)idx; }
+#define lua_freeline(L,b)	{ (void)L; (void)b; }
+#endif
+
+#endif
+
+/* }================================================================== */
+
+/*
+@@ LUAI_GCPAUSE defines the default pause between garbage-collector cycles
+@* as a percentage.
+** CHANGE it if you want the GC to run faster or slower (higher values
+** mean larger pauses which mean slower collection.) You can also change
+** this value dynamically.
+*/
+#define LUAI_GCPAUSE    200  /* 200% (wait memory to double before next GC) */
+
+/*
+@@ LUAI_GCMUL defines the default speed of garbage collection relative to
+@* memory allocation as a percentage.
+** CHANGE it if you want to change the granularity of the garbage
+** collection. (Higher values mean coarser collections. 0 represents
+** infinity, where each step performs a full collection.) You can also
+** change this value dynamically.
+*/
+#define LUAI_GCMUL	200 /* GC runs 'twice the speed' of memory allocation */
+
+/*
+@@ LUA_COMPAT_GETN controls compatibility with old getn behavior.
+** CHANGE it (define it) if you want exact compatibility with the
+** behavior of setn/getn in Lua 5.0.
+*/
+#undef LUA_COMPAT_GETN
+
+/*
+@@ LUA_COMPAT_LOADLIB controls compatibility about global loadlib.
+** CHANGE it to undefined as soon as you do not need a global 'loadlib'
+** function (the function is still available as 'package.loadlib').
+*/
+#undef LUA_COMPAT_LOADLIB
+
+/*
+@@ LUA_COMPAT_VARARG controls compatibility with old vararg feature.
+** CHANGE it to undefined as soon as your programs use only '...' to
+** access vararg parameters (instead of the old 'arg' table).
+*/
+#undef LUA_COMPAT_VARARG
+
+/*
+@@ LUA_COMPAT_MOD controls compatibility with old math.mod function.
+** CHANGE it to undefined as soon as your programs use 'math.fmod' or
+** the new '%' operator instead of 'math.mod'.
+*/
+#undef LUA_COMPAT_MOD
+
+/*
+@@ LUA_COMPAT_LSTR controls compatibility with old long string nesting
+@* facility.
+** CHANGE it to 2 if you want the old behaviour, or undefine it to turn
+** off the advisory error when nesting [[...]].
+*/
+#undef LUA_COMPAT_LSTR
+
+/*
+@@ LUA_COMPAT_GFIND controls compatibility with old 'string.gfind' name.
+** CHANGE it to undefined as soon as you rename 'string.gfind' to
+** 'string.gmatch'.
+*/
+#undef LUA_COMPAT_GFIND
+
+/*
+@@ LUA_COMPAT_OPENLIB controls compatibility with old 'luaL_openlib'
+@* behavior.
+** CHANGE it to undefined as soon as you replace to 'luaL_register'
+** your uses of 'luaL_openlib'
+*/
+#undef LUA_COMPAT_OPENLIB
+
+/*
+@@ luai_apicheck is the assert macro used by the Lua-C API.
+** CHANGE luai_apicheck if you want Lua to perform some checks in the
+** parameters it gets from API calls. This may slow down the interpreter
+** a bit, but may be quite useful when debugging C code that interfaces
+** with Lua. A useful redefinition is to use assert.h.
+*/
+#if defined(LUA_USE_APICHECK)
+#include <assert.h>
+#define luai_apicheck(L,o)  { (void)L; assert(o); }
+#else
+#define luai_apicheck(L,o)  { (void)L; }
+#endif
+
+/*
+@@ LUAI_BITSINT defines the number of bits in an int.
+** CHANGE here if Lua cannot automatically detect the number of bits of
+** your machine. Probably you do not need to change this.
+*/
+/* avoid overflows in comparison */
+#if INT_MAX-20 < 32760
+#define LUAI_BITSINT    16
+#elif INT_MAX > 2147483640L
+/* int has at least 32 bits */
+#define LUAI_BITSINT    32
+#else
+#error "you must define LUA_BITSINT with number of bits in an integer"
+#endif
+
+/*
+@@ LUAI_UINT32 is an unsigned integer with at least 32 bits.
+@@ LUAI_INT32 is an signed integer with at least 32 bits.
+@@ LUAI_UMEM is an unsigned integer big enough to count the total
+@* memory used by Lua.
+@@ LUAI_MEM is a signed integer big enough to count the total memory
+@* used by Lua.
+** CHANGE here if for some weird reason the default definitions are not
+** good enough for your machine. (The definitions in the 'else'
+** part always works, but may waste space on machines with 64-bit
+** longs.) Probably you do not need to change this.
+*/
+#if LUAI_BITSINT >= 32
+#define LUAI_UINT32     unsigned int
+#define LUAI_INT32      int
+#define LUAI_MAXINT32   INT_MAX
+#define LUAI_UMEM       size_t
+#define LUAI_MEM        ptrdiff_t
+#else
+/* 16-bit ints */
+#define LUAI_UINT32     unsigned long
+#define LUAI_INT32      long
+#define LUAI_MAXINT32   LONG_MAX
+#define LUAI_UMEM       unsigned long
+#define LUAI_MEM        long
+#endif
+
+/*
+@@ LUAI_MAXCALLS limits the number of nested calls.
+** CHANGE it if you need really deep recursive calls. This limit is
+** arbitrary; its only purpose is to stop infinite recursion before
+** exhausting memory.
+*/
+#define LUAI_MAXCALLS   20000
+
+/*
+@@ LUAI_MAXCSTACK limits the number of Lua stack slots that a C function
+@* can use.
+** CHANGE it if you need lots of (Lua) stack space for your C
+** functions. This limit is arbitrary; its only purpose is to stop C
+** functions to consume unlimited stack space.
+*/
+#define LUAI_MCS_AUX    ((int)(INT_MAX / (4*sizeof(LUA_NUMBER))))
+#define LUAI_MAXCSTACK  (LUAI_MCS_AUX > SHRT_MAX ? SHRT_MAX : LUAI_MCS_AUX)
+
+/*
+** {==================================================================
+** CHANGE (to smaller values) the following definitions if your system
+** has a small C stack. (Or you may want to change them to larger
+** values if your system has a large C stack and these limits are
+** too rigid for you.) Some of these constants control the size of
+** stack-allocated arrays used by the compiler or the interpreter, while
+** others limit the maximum number of recursive calls that the compiler
+** or the interpreter can perform. Values too large may cause a C stack
+** overflow for some forms of deep constructs.
+** ===================================================================
+*/
+
+/*
+@@ LUAI_MAXCCALLS is the maximum depth for nested C calls (short) and
+@* syntactical nested non-terminals in a program.
+*/
+#define LUAI_MAXCCALLS      200
+
+/*
+@@ LUAI_MAXVARS is the maximum number of local variables per function
+@* (must be smaller than 250).
+*/
+#define LUAI_MAXVARS        200
+
+/*
+@@ LUAI_MAXUPVALUES is the maximum number of upvalues per function
+@* (must be smaller than 250).
+*/
+#define LUAI_MAXUPVALUES    60
+
+/*
+@@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system.
+*/
+#define LUAL_BUFFERSIZE     512 /*BUFSIZ*/
+
+/* }================================================================== */
+
+/*
+** {==================================================================
+@@ LUA_NUMBER is the type of numbers in Lua.
+** CHANGE the following definitions only if you want to build Lua
+** with a number type different from double. You may also need to
+** change lua_number2int & lua_number2integer.
+** ===================================================================
+*/
+
+//#define LUA_NUMBER_DOUBLE
+#define LUA_NUMBER      int
+
+/*
+@@ LUAI_UACNUMBER is the result of an 'usual argument conversion'
+@* over a number.
+*/
+#define LUAI_UACNUMBER  int
+
+/*
+@@ LUA_NUMBER_SCAN is the format for reading numbers.
+@@ LUA_NUMBER_FMT is the format for writing numbers.
+@@ lua_number2str converts a number to a string.
+@@ LUAI_MAXNUMBER2STR is maximum size of previous conversion.
+@@ lua_str2number converts a string to a number.
+*/
+#define LUA_NUMBER_SCAN     "%d"
+#define LUA_NUMBER_FMT      "%d"
+#define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n))
+#define LUAI_MAXNUMBER2STR  15
+#define lua_str2number(s,p) strtol((s), (p), 10)
+
+/*
+@@ The luai_num* macros define the primitive operations over numbers.
+*/
+#if defined(LUA_CORE)
+//#include <math.h>
+#define luai_numadd(a,b)    ((a)+(b))
+#define luai_numsub(a,b)    ((a)-(b))
+#define luai_nummul(a,b)    ((a)*(b))
+#define luai_numdiv(a,b)    ((a)/(b))
+#define luai_nummod(a,b)    ((a)%(b))
+#define luai_numpow(a,b)    (luai_ipow(a,b))
+#define luai_numunm(a)      (-(a))
+#define luai_numeq(a,b)     ((a)==(b))
+#define luai_numlt(a,b)     ((a)<(b))
+#define luai_numle(a,b)     ((a)<=(b))
+#define luai_numisnan(a)    (!luai_numeq((a), (a)))
+#endif
+
+// reyalp - used in lib too
+#if defined(LUA_CORE) || defined(LUA_LIB)
+LUA_NUMBER luai_ipow(LUA_NUMBER, LUA_NUMBER);
+#endif
+
+/*
+@@ lua_number2int is a macro to convert lua_Number to int.
+@@ lua_number2integer is a macro to convert lua_Number to lua_Integer.
+** CHANGE them if you know a faster way to convert a lua_Number to
+** int (with any rounding method and without throwing errors) in your
+** system. In Pentium machines, a naive typecast from double to int
+** in C is extremely slow, so any alternative is worth trying.
+*/
+
+/* On a Pentium, resort to a trick */
+#if defined(LUA_NUMBER_DOUBLE) && !defined(LUA_ANSI) && !defined(__SSE2__) && \
+    (defined(__i386) || defined (_M_IX86) || defined(__i386__))
+
+/* On a Microsoft compiler, use assembler */
+#if defined(_MSC_VER)
+
+#define lua_number2int(i,d)   __asm fld d   __asm fistp i
+#define lua_number2integer(i,n)     lua_number2int(i, n)
+
+/* the next trick should work on any Pentium, but sometimes clashes
+   with a DirectX idiosyncrasy */
+#else
+
+union luai_Cast { double l_d; long l_l; };
+#define lua_number2int(i,d) \
+  { volatile union luai_Cast u; u.l_d = (d) + 6755399441055744.0; (i) = u.l_l; }
+#define lua_number2integer(i,n)     lua_number2int(i, n)
+
+#endif
+
+/* this option always works, but may be slow */
+#else
+#define lua_number2int(i,d)	((i)=(int)(d))
+#define lua_number2integer(i,d)	((i)=(lua_Integer)(d))
+
+#endif
+
+/* }================================================================== */
+
+
+/*
+@@ LUAI_USER_ALIGNMENT_T is a type that requires maximum alignment.
+** CHANGE it if your system requires alignments larger than double. (For
+** instance, if your system supports long doubles and they must be
+** aligned in 16-byte boundaries, then you should add long double in the
+** union.) Probably you do not need to change this.
+*/
+#define LUAI_USER_ALIGNMENT_T   union { double u; void *s; long l; }
+
+/*
+@@ LUAI_THROW/LUAI_TRY define how Lua does exception handling.
+** CHANGE them if you prefer to use longjmp/setjmp even with C++
+** or if want/don't to use _longjmp/_setjmp instead of regular
+** longjmp/setjmp. By default, Lua handles errors with exceptions when
+** compiling as C++ code, with _longjmp/_setjmp when asked to use them,
+** and with longjmp/setjmp otherwise.
+*/
+#if defined(__cplusplus)
+/* C++ exceptions */
+#define LUAI_THROW(L,c) throw(c)
+#define LUAI_TRY(L,c,a) try { a } catch(...) \
+    { if ((c)->status == 0) (c)->status = -1; }
+#define luai_jmpbuf int  /* dummy variable */
+
+#elif defined(LUA_USE_ULONGJMP)
+/* in Unix, try _longjmp/_setjmp (more efficient) */
+#define LUAI_THROW(L,c) _longjmp((c)->b, 1)
+#define LUAI_TRY(L,c,a) if (_setjmp((c)->b) == 0) { a }
+#define luai_jmpbuf     jmp_buf
+
+#else
+/* default handling with long jumps */
+#define LUAI_THROW(L,c) longjmp((c)->b, 1)
+#define LUAI_TRY(L,c,a) if (setjmp((c)->b) == 0) { a }
+#define luai_jmpbuf     jmp_buf
+
+#endif
+
+/*
+@@ LUA_MAXCAPTURES is the maximum number of captures that a pattern
+@* can do during pattern-matching.
+** CHANGE it if you need more captures. This limit is arbitrary.
+*/
+#define LUA_MAXCAPTURES     32
+
+/*
+@@ lua_tmpnam is the function that the OS library uses to create a
+@* temporary name.
+@@ LUA_TMPNAMBUFSIZE is the maximum size of a name created by lua_tmpnam.
+** CHANGE them if you have an alternative to tmpnam (which is considered
+** insecure) or if you want the original tmpnam anyway.  By default, Lua
+** uses tmpnam except when POSIX is available, where it uses mkstemp.
+*/
+#if defined(loslib_c) || defined(luaall_c)
+
+#if defined(LUA_USE_MKSTEMP)
+#include <unistd.h>
+#define LUA_TMPNAMBUFSIZE   32
+#define lua_tmpnam(b,e) { \
+    strcpy(b, "/tmp/lua_XXXXXX"); \
+    e = mkstemp(b); \
+    if (e != -1) close(e); \
+    e = (e == -1); }
+
+#else
+#define LUA_TMPNAMBUFSIZE   L_tmpnam
+#define lua_tmpnam(b,e)     { e = (tmpnam(b) == NULL); }
+#endif
+
+#endif
+
+/*
+@@ lua_popen spawns a new process connected to the current one through
+@* the file streams.
+** CHANGE it if you have a way to implement it in your system.
+*/
+#if defined(LUA_USE_POPEN)
+
+#define lua_popen(L,c,m)    ((void)L, fflush(NULL), popen(c,m))
+#define lua_pclose(L,file)  ((void)L, (pclose(file) != -1))
+
+#elif defined(LUA_WIN)
+
+#define lua_popen(L,c,m)    ((void)L, _popen(c,m))
+#define lua_pclose(L,file)  ((void)L, (_pclose(file) != -1))
+
+#else
+
+#define lua_popen(L,c,m)    ((void)((void)c, m),  \
+        luaL_error(L, LUA_QL("popen") " not supported"), (FILE*)0)
+#define lua_pclose(L,file)  ((void)((void)L, file), 0)
+
+#endif
+
+/*
+@@ LUA_DL_* define which dynamic-library system Lua should use.
+** CHANGE here if Lua has problems choosing the appropriate
+** dynamic-library system for your platform (either Windows' DLL, Mac's
+** dyld, or Unix's dlopen). If your system is some kind of Unix, there
+** is a good chance that it has dlopen, so LUA_DL_DLOPEN will work for
+** it.  To use dlopen you also need to adapt the src/Makefile (probably
+** adding -ldl to the linker options), so Lua does not select it
+** automatically.  (When you change the makefile to add -ldl, you must
+** also add -DLUA_USE_DLOPEN.)
+** If you do not want any kind of dynamic library, undefine all these
+** options.
+** By default, _WIN32 gets LUA_DL_DLL and MAC OS X gets LUA_DL_DYLD.
+*/
+#if defined(LUA_USE_DLOPEN)
+#define LUA_DL_DLOPEN
+#endif
+
+#if defined(LUA_WIN)
+#define LUA_DL_DLL
+#endif
+
+
+/*
+@@ LUAI_EXTRASPACE allows you to add user-specific data in a lua_State
+@* (the data goes just *before* the lua_State pointer).
+** CHANGE (define) this if you really need that. This value must be
+** a multiple of the maximum alignment required for your machine.
+*/
+#define LUAI_EXTRASPACE     0
+
+/*
+@@ luai_userstate* allow user-specific actions on threads.
+** CHANGE them if you defined LUAI_EXTRASPACE and need to do something
+** extra when a thread is created/deleted/resumed/yielded.
+*/
+#define luai_userstateopen(L)       ((void)L)
+#define luai_userstateclose(L)      ((void)L)
+#define luai_userstatethread(L,L1)  ((void)L)
+#define luai_userstatefree(L)       ((void)L)
+#define luai_userstateresume(L,n)   ((void)L)
+#define luai_userstateyield(L,n)    ((void)L)
+
+/*
+@@ LUA_INTFRMLEN is the length modifier for integer conversions
+@* in 'string.format'.
+@@ LUA_INTFRM_T is the integer type correspoding to the previous length
+@* modifier.
+** CHANGE them if your system supports long long or does not support long.
+*/
+
+#if defined(LUA_USELONGLONG)
+
+#define LUA_INTFRMLEN       "ll"
+#define LUA_INTFRM_T        long long
+
+#else
+
+#define LUA_INTFRMLEN       "l"
+#define LUA_INTFRM_T        long
+
+#endif
+
+/* =================================================================== */
+
+/*
+** Local configuration. You can use this space to add your redefinitions
+** without modifying the main part of the file.
+*/
+
+#endif
+
+
Index: /branches/reyalp-ptp-live/include/camera.h
===================================================================
--- /branches/reyalp-ptp-live/include/camera.h	(revision 1668)
+++ /branches/reyalp-ptp-live/include/camera.h	(revision 1668)
@@ -0,0 +1,307 @@
+// camera.h
+
+// This file contains the default values for various settings that may change across camera models.
+// Setting values specific to each camera model can be found in the platform/XXX/platform_camera.h file for camera.
+
+// If adding a new settings value put a suitable default value in here, 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 here using the '#undef' directive
+// along with appropriate documentation.
+
+#ifndef CAMERA_H
+#define CAMERA_H
+
+//==========================================================
+// Camera-dependent settings
+//==========================================================
+
+//----------------------------------------------------------
+// Default values
+//----------------------------------------------------------
+
+    #undef  CAM_DRYOS                           // Camera is DryOS-based
+    #undef  CAM_PROPSET                         // Camera's properties group (the generation)
+    #undef  CAM_DRYOS_2_3_R31                   // Define for cameras with DryOS release R31 or greater -> G10
+    #undef  CAM_DRYOS_2_3_R39                   // Define for cameras with DryOS release R39 or greater
+    #undef  CAM_DRYOS_2_3_R47                   // Define for cameras with DryOS release R47 or greater -> Cameras can boot from FAT32
+
+    #undef  CAM_HAS_CMOS                        // Camera has CMOS sensor
+    #undef  CAM_SWIVEL_SCREEN                   // Camera has rotated LCD screen
+    #define CAM_USE_ZOOM_FOR_MF             1   // Zoom lever can be used for manual focus adjustments
+    #undef  CAM_ADJUSTABLE_ALT_BUTTON           // ALT-button can be set from menu
+    #define CAM_REMOTE                      1   // Camera supports USB-remote
+    #undef  SYNCHABLE_REMOTE_NOT_ENABLED        // Disable support for synchable remote switch (in kbd.c) TODO only used by one camera ???
+    #define CAM_SYNCH                       1   // Camera supports SDM precision synch
+    #undef  CAM_MULTIPART                       // Camera supports SD-card multipartitioning
+    #define CAM_HAS_ZOOM_LEVER              1   // Camera has dedicated zoom buttons
+    #undef  CAM_DRAW_EXPOSITION                 // Output expo-pair on screen (for cameras which (sometimes) don't do that)
+    #define CAM_HAS_ERASE_BUTTON            1   // Camera has dedicated erase button
+    #define CAM_HAS_IRIS_DIAPHRAGM          1   // Camera has real diaphragm mechanism (http://en.wikipedia.org/wiki/Diaphragm_%28optics%29)
+    #undef  CAM_HAS_ND_FILTER                   // Camera has build-in ND filter
+    #define CAM_CAN_SD_OVER_NOT_IN_MF       1   // Camera allows subject distance (focus) override when not in manual focus mode
+    #undef  CAM_CAN_SD_OVER_IN_AF_LOCK          // Camera allows subject distance (focus) override when in AF Lock mode
+    #define CAM_CAN_SD_OVERRIDE             1   // Camera allows to do subject distance override
+    #define CAM_HAS_MANUAL_FOCUS            1   // Camera has manual focus mode
+    #define CAM_HAS_USER_TV_MODES           1   // Camera has tv-priority or manual modes with ability to set tv value
+    #undef  CAM_SHOW_OSD_IN_SHOOT_MENU          // On some cameras Canon shoot menu has additional functionality and useful in this case to see CHDK OSD in this mode
+    #define CAM_CAN_UNLOCK_OPTICAL_ZOOM_IN_VIDEO 1 // Camera can unlock optical zoom in video (if it is locked)
+    #undef  CAM_FEATURE_FEATHER                 // Cameras with "feather" or touch wheel.
+    #define CAM_HAS_IS                      1   // Camera has image stabilizer
+    #undef  CAM_HAS_JOGDIAL                     // Camera has a "jog dial"
+
+    #undef  CAM_CONSOLE_LOG_ENABLED             // Development: internal camera stdout -> A/stdout.txt
+    #define CAM_CHDK_HAS_EXT_VIDEO_MENU     1   // In CHDK for this camera realized adjustable video compression
+    #undef  CAM_CAN_MUTE_MICROPHONE             // Camera has function to mute microphone
+
+    #define CAM_EMUL_KEYPRESS_DELAY         40  // Delay to interpret <alt>-button press as longpress
+    #define CAM_EMUL_KEYPRESS_DURATION      5   // Length of keypress emulation
+
+    #define CAM_MENU_BORDERWIDTH            30  // Defines the width of the border on each side of the CHDK menu. The CHDK menu will have this
+                                                // many pixels left blank to the on each side. Should not be less than 10 to allow room for the
+                                                // scroll bar on the right.
+    #define CAM_DETECT_SCREEN_ERASE         1   // Define this to add 'guard' pixel to the screen bitmap to help detect if the firmware has erase the screen
+                                                // If the guard pixel changes the CHDK ALT menu is forced to redraw.
+                                                // Take care not to place CHDK OSD elements over the guard pixel.
+                                                // The guard pixel is the first pixel of the top row in the screen bitmap.
+
+    #undef  CAM_TOUCHSCREEN_UI                  // Define to enable touch screen U/I (e.g. IXUS 310 HS)
+    #define CAM_TS_BUTTON_BORDER            0   // Define this to leave a border on each side of the OSD display for touch screen buttons.
+                                                // Used on the IXUS 310 to stop the OSD from overlapping the on screen buttons on each side
+    #define CAM_DISP_ALT_TEXT               1   // Display the '<ALT>' message at the bottom of the screen in ALT mode (IXUS 310 changes button color instead)
+
+    #undef  CAM_AF_SCAN_DURING_VIDEO_RECORD     // CHDK can make single AF scan during video record
+    #undef  CAM_HAS_VIDEO_BUTTON                // Camera can take stills in video mode, and vice versa
+    #undef  CAM_EV_IN_VIDEO                     // CHDK can change exposure in video mode
+    #define CAM_VIDEO_CONTROL               1   // pause / unpause video recordings
+    #undef  CAM_VIDEO_QUALITY_ONLY              // Override Video Bitrate is not supported
+    #undef  CAM_CHDK_HAS_EXT_VIDEO_TIME         // Camera can override time limit of video record -> sx220/230
+
+    #define ZOOM_OVERRIDE                   0   // Shall zoom-override be used? default 0 becoz not implemented right now
+
+    #undef  CAM_REAR_CURTAIN                    // Camera do not have front/rear curtain flash sync in menu
+    #undef  CAM_BRACKETING                      // Cameras that have bracketing (focus & ev) in original firmware already, most likely s- & g-series (propcase for digic III not found yet!)
+    #undef  CAM_EXT_TV_RANGE                    // CHDK can make exposure time longer than 64s
+    #define CAM_CHDK_PTP                    1   // include CHDK PTP support
+
+    #define CAM_UNCACHED_BIT                0x10000000 // bit indicating the uncached memory
+
+    #define CAM_MAKE                        "Canon"
+    #define CAM_SENSOR_BITS_PER_PIXEL       10  // Bits per pixel. 10 is standard, 12 is supported except for curves
+    #define CAM_WHITE_LEVEL                 ((1<<CAM_SENSOR_BITS_PER_PIXEL)-1)      // 10bpp = 1023 ((1<<10)-1), 12bpp = 4095 ((1<<12)-1)
+    #define CAM_BLACK_LEVEL                 ((1<<(CAM_SENSOR_BITS_PER_PIXEL-5))-1)  // 10bpp = 31 ((1<<5)-1),    12bpp = 127 ((1<<7)-1)
+
+    #define CAM_BITMAP_PALETTE              1   // which color set is used for this camera
+
+    #undef  CAM_HAS_VARIABLE_ASPECT             // can switch between 16:9 and 4:3
+
+    // Older cameras had a screen/bitmap buffer that was 360 pixels wide (or 480 for wide screen models)
+    // CHDK was built around this 360 pixel wide display model
+    // Newer cameras have a 720 pixel wide bitmap (960 for wide screen cameras)
+    // To accomadate this the CHDK co-ordinate system assumes a 360/480 wide buffer and the
+    // pixel drawing routines draw every pixel twice to scale the image up to the actual buffer size
+    // Define CAM_USES_ASPECT_CORRECTION with a value of 1 to enable this scaled display
+    #define CAM_USES_ASPECT_CORRECTION      0
+    #define CAM_SCREEN_WIDTH                360 // Width of bitmap screen in CHDK co-ordinates (360 or 480)
+    #define CAM_SCREEN_HEIGHT               240 // Height of bitmap screen in CHDK co-ordinates (always 240 on all cameras so far)
+    #define CAM_BITMAP_WIDTH                360 // Actual width of bitmap screen in bytes (may be larger than displayed area)
+    #define CAM_BITMAP_HEIGHT               240 // Actual height of bitmap screen in rows (240 or 270)
+
+    #define EDGE_HMARGIN                    0   // define sup and inf screen margins on edge overlay without overlay.  Necessary to save memory buffer space. sx200is needs values other than 0
+
+    #undef CAM_QUALITY_OVERRIDE                 // define this in platform_camera.h to enable 'Super Fine' JPEG compression mode
+                                                // used to allow super fine JPEG option on cameras where this has been removed
+                                                // from the Canon menu. Note: may not actually work on all cameras.
+
+    #undef  CAM_ZEBRA_ASPECT_ADJUST             // zebra needs to account for real bitmap size being different from what lib.c reports
+                                                // also used by some cameras with normal bitmap layouts for memory saving ?
+    #undef  CAM_ZEBRA_NOBUF                     // zebra draws directly on bitmap buffer. Requires above as well
+    
+    #undef  CAM_DATE_FOLDER_NAMING              // set if camera uses date based folder naming (Option "Create Folder" in Canon Menu) and get_target_dir_name is implemented
+    
+    #undef  CAM_KEY_CLICK_DELAY                 // additional delay between press and release for scripted click
+    #define CAM_KEY_PRESS_DELAY             20  // delay after a press - TODO can we combine this with above ?
+    #define CAM_KEY_RELEASE_DELAY           20  // delay after a release - TODO do we really need to wait after release ?
+
+    #undef  CAM_STARTUP_CRASH_FILE_OPEN_FIX     // enable fix for camera intermittently crash at startup when opening the conf / font files
+                                                // Some cameras throw "ASSERT!! FsIoNotify.c Line xxx    Task name: SpyTask" in ROMLOG
+    
+    // RAW & DNG related values
+    #define DNG_SUPPORT                     1   // Camera supports DNG format for saving of RAW images
+    #define DEFAULT_RAW_EXT                 1   // extension to use for raw (see raw_exts in conf.c)
+    #undef  CAM_RAW_ROWPIX                      // Number of pixels in RAW row (physical size of the sensor Note : as of July 2011, this value can be found in stub_entry.S for dryos cameras)
+    #undef  CAM_RAW_ROWS                        // Number of rows in RAW (physical size of the sensor       Note : as of July 2011, this value can be found in stub_entry.S for dryos cameras)
+    #undef  CAM_JPEG_WIDTH                      // Default crop size (width) stored in DNG (to match camera JPEG size. From dimensions of the largest size jpeg your camera produces)
+    #undef  CAM_JPEG_HEIGHT                     // Default crop size (height) stored in DNG (to match camera JPEG size. From dimensions of the largest size jpeg your camera produces)
+    #undef  CAM_ACTIVE_AREA_X1                  // Define usable area of the sensor - needs to be divisible by 4 - calibrate using a CHDK RAW image converted with rawconvert.exe (eg :rawconvert -12to8 -pgm -w=4480 -h=3348 photo.crw photo.pgm)
+    #undef  CAM_ACTIVE_AREA_Y1                  // Define usable area of the sensor - needs to be divisible by 2 - "
+    #undef  CAM_ACTIVE_AREA_X2                  // Define usable area of the sensor - needs to be divisible by 4 - "
+    #undef  CAM_ACTIVE_AREA_Y2                  // Define usable area of the sensor - needs to be divisible by 2 = "
+    #undef  cam_CFAPattern                      // Camera Bayer sensor data layout (DNG colors are messed up if not correct - should be either 0x01000201 = [Green Blue Red Green]  or 0x02010100 = [Red  Green  Green  Blue]
+    #undef  CAM_COLORMATRIX1                    // DNG color profile matrix
+    #undef  cam_CalibrationIlluminant1          // DNG color profile illuminant - set it to 17 for standard light A
+    #undef  CAM_DNG_EXPOSURE_BIAS               // Specify DNG exposure bias value (to override default of -0.5 in the dng.c code)
+    #undef  DNG_EXT_FROM                        // Extension in the cameras known extensions to replace with .DNG to allow DNG
+                                                // files to be transfered over standard PTP. Only applicable to older cameras
+
+    #undef  CAM_DNG_LENS_INFO                   // Define this to include camera lens information in DNG files
+                                                // Value should be an array of 4 DNG 'RATIONAL' values specifying
+                                                //   - min focal length in mm
+                                                //   - max focal length in mm
+                                                //   - max aperture at min focal length
+                                                //   - max aperture at max focal length
+                                                // E.G - SX30 = { 43,10, 1505,10, 27,10, 58,10 }
+                                                //            = 4.3 - 150.5mm, f/2.7 - f.5.8
+                                                // Each pair of integers is one 'RATIONAL' value (numerator,denominator)
+
+    #undef  PARAM_CAMERA_NAME                   // parameter number for GetParameterData to get camera name
+    #undef  PARAM_DISPLAY_MODE1                 // param number for LCD display mode when camera in playback
+    #undef  PARAM_DISPLAY_MODE2                 // param number for LCD display mode when camera in record view hold mode
+    #undef  CAM_FIRMWARE_MEMINFO                // Use 'GetMemInfo' (dryos) or 'memPartInfoGet'/'memPartFindMax' (vxworks)
+                                                // function in firmware to get free memory details
+                                                // GetMemInfo should be found correctly by the gensig/finsig signature
+                                                // finder for all dryos based cameras.
+
+    #undef  CAM_NO_MEMPARTINFO                  // VXWORKS camera does not have memPartInfoGet, fall back to memPartFindMax
+
+    #undef  CAM_DRIVE_MODE_FROM_TIMER_MODE      // use PROPCASE_TIMER_MODE to check for multiple shot custom timer.
+                                                // Used to enabled bracketing in custom timer, required on many recent cameras
+                                                // see http://chdk.setepontos.com/index.php/topic,3994.405.html
+
+    #undef CAM_AV_OVERRIDE_IRIS_FIX             // for cameras that require _MoveIrisWithAv function to override Av (for bracketing).
+
+    #undef CAM_DISABLE_RAW_IN_LOW_LIGHT_MODE    // For cameras with 'low light' mode that does not work with raw define this
+    #undef CAM_DISABLE_RAW_IN_HQ_BURST          // For cameras with 'HQ Burst' mode that does not work with raw define this
+    #undef CAM_DISABLE_RAW_IN_HANDHELD_NIGHT_SCN // For cameras with 'HandHeld Night Scene' mode that does not work with raw define this
+    
+    #undef  CAM_HAS_GPS                         // for cameras with GPS reseiver: includes the GPS coordinates in in DNG file
+
+    #undef  CHDK_COLOR_BASE                     // Start color index for CHDK colors loaded into camera palette.
+
+    #undef  CAM_LOAD_CUSTOM_COLORS              // Define to enable loading CHDK custom colors into the camera color palette
+                                                // requires load_chdk_palette() and vid_get_bitmap_active_palette() to be defined
+                                                // correctly for the camera along with
+    #undef  CAM_USE_COLORED_ICONS               // If the color palette contains enough shades of red, green, yellow and grey
+                                                // defined then enable this use the better icons (from CHDK-DE). See gui_batt.c
+                                                // and gui_space.c.
+
+    #define CAM_USB_EVENTID         0x902       // Levent ID for USB control. Changed to 0x202 in DryOS R49 so needs to be overridable.
+
+    #undef  CAM_NEED_SET_ZOOM_DELAY             // Define to add a delay after setting the zoom position before resetting the focus position in shooting_set_zoom 
+
+    #undef  USE_REAL_AUTOISO                    // Define this to use real-iso instead of marketing-iso as values of autoiso mechanizm
+    #undef  OVEREXP_COMPENSATE_OVERALL          // Define this to make overexposure_compensation work for all scenes, instead of day-light only
+
+    #define CAMERA_MIN_DIST         0           // Define min distance that can be set in _MoveFocusLensToDistance (allow override - e.g. G12 min dist = 1)
+    #define CAMERA_MAX_DIST         65535       // Define max distance that can be set in _MoveFocusLensToDistance (allow override for superzooms - SX30/SX40)
+
+//----------------------------------------------------------
+// Overridden values for each camera
+//----------------------------------------------------------
+
+// Include the settings file for the camera model currently being compiled.
+#include "platform_camera.h"
+
+//==========================================================
+// END of Camera-dependent settings
+//==========================================================
+
+// For newer cameras where the screen bitmap is double the width we need to scale
+// the CHDK horizontal (X) co-ordinates
+#if CAM_USES_ASPECT_CORRECTION
+    #define ASPECT_XCORRECTION(x)   ((x)<<1)    // See comments for CAM_USES_ASPECT_CORRECTION above
+#else
+    #define ASPECT_XCORRECTION(x)   (x)         // See comments for CAM_USES_ASPECT_CORRECTION above
+#endif
+
+// curves only work in 10bpp for now
+#if CAM_SENSOR_BITS_PER_PIXEL != 10
+    #undef OPT_CURVES
+#endif
+
+#ifndef OPT_PTP
+    #undef CAM_CHDK_PTP
+#endif
+
+//==========================================================
+// Data Structure to store camera specific information
+// Used by modules to ensure module code is platform independent
+
+typedef struct {
+	int api_version;			// version of this structure
+
+    int bits_per_pixel;
+    int black_level;
+    int white_level;
+    int raw_rows, raw_rowpix, raw_rowlen, raw_size;
+    union                       // DNG JPEG info
+    {
+        struct
+        {
+            int x, y;           // DNG JPEG top left corner
+            int width, height;  // DNG JPEG size
+        } jpeg;
+        struct
+        {
+            int origin[2];
+            int size[2];
+        } crop;
+    };
+    union                       // DNG active sensor area (Y1, X1, Y2, X2)
+    {
+        struct
+        {
+            int y1, x1, y2, x2;
+        } active_area;
+        int dng_active_area[4];
+    };
+    int lens_info[8];           // DNG Lens Info
+    int exposure_bias[2];       // DNG Exposure Bias
+    int color_matrix1[18];      // DNG Color Matrix
+    int cfa_pattern, calibration_illuminant1;
+} _cam_sensor;
+
+extern _cam_sensor camera_sensor;
+
+// if this struct changed, please change gui_version.common_api 
+typedef struct 
+{
+    unsigned int    width, height, size;                        // Size of bitmap screen in CHDK co-ordinates
+    unsigned int    buffer_width, buffer_height, buffer_size;   // Physical size of bitmap screen
+    int             edge_hmargin, ts_button_border;             // margin and touch-screen adjustment values
+    int             zebra_nobuf, zebra_aspect_adjust;           // zebra feature settings
+    int             has_variable_aspect;                        // zebra feature settings
+} _cam_screen;
+
+extern _cam_screen camera_screen;
+
+typedef struct
+{
+	int api_version;			// version of this structure
+
+    struct
+    {
+        int camera_name;
+    } params;
+    struct
+    {
+        int gps;
+        int orientation_sensor;
+        int tv;
+        int av;
+        int min_av;
+        int ev_correction_2;
+        int flash_mode;
+        int flash_fire;
+        int metering_mode;
+        int wb_adj;
+        int aspect_ratio;
+        int shooting;
+    } props;
+    int rombaseaddr, maxramaddr;
+} _cam_info;
+
+extern _cam_info camera_info;
+
+//==========================================================
+
+#endif /* CAMERA_H */
Index: /branches/reyalp-ptp-live/platform/ixus970_sd890/kbd.c
===================================================================
--- /branches/reyalp-ptp-live/platform/ixus970_sd890/kbd.c	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/ixus970_sd890/kbd.c	(revision 1668)
@@ -0,0 +1,357 @@
+#include "lolevel.h"
+#include "platform.h"
+#include "core.h"
+#include "conf.h"
+#include "keyboard.h"
+
+typedef struct {
+	short grp;
+	short hackkey;
+	long canonkey;
+} KeyMap;
+
+long kbd_new_state[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF };
+static long kbd_prev_state[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF };
+static long kbd_mod_state[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF };
+
+static KeyMap keymap[];
+static long last_kbd_key = 0;
+
+#define KEYS_MASK0 (0x00000000)
+#define KEYS_MASK1 (0x00000000)
+#define KEYS_MASK2 (0x0FFF)
+
+#define NEW_SS (0x2000)
+#define SD_READONLY_FLAG (0x20000)
+
+#define USB_MASK (0x40000)
+#define USB_IDX 2
+
+extern void usb_remote_key( int ) ;
+int get_usb_bit() 
+{
+	long usb_physw[3];
+	usb_physw[USB_IDX] = 0;
+	_kbd_read_keys_r2(usb_physw);
+	return(( usb_physw[USB_IDX] & USB_MASK)==USB_MASK) ; 
+}
+
+
+#ifndef MALLOCD_STACK
+static char kbd_stack[NEW_SS];
+#endif
+
+static KeyMap keymap[] = {
+	/* tiny bug: key order matters. see kbd_get_pressed_key()
+	* for example
+	*/
+	{ 2, KEY_UP		    , 0x00000080 }, 
+	{ 2, KEY_DOWN		, 0x00000040 },
+	{ 2, KEY_LEFT		, 0x00000010 },
+	{ 2, KEY_RIGHT		, 0x00000020 },
+	{ 2, KEY_SET		, 0x00000100 },
+	{ 2, KEY_SHOOT_FULL	, 0x00000003 },
+    { 2, KEY_SHOOT_FULL_ONLY, 0x00000002 },
+	{ 2, KEY_SHOOT_HALF	, 0x00000001 }, 
+	{ 2, KEY_ZOOM_IN	, 0x00000004 },
+	{ 2, KEY_ZOOM_OUT	, 0x00000008 },
+	{ 2, KEY_MENU		, 0x00000400 },
+	{ 2, KEY_DISPLAY	, 0x00000200 },
+	{ 2, KEY_PRINT		, 0x00000800 },
+	{ 0, 0, 0 }
+};
+
+void kbd_fetch_data(long*);
+
+long __attribute__((naked)) wrap_kbd_p1_f() ;
+
+static void __attribute__((noinline)) mykbd_task_proceed()
+{
+	while (physw_run) {
+		_SleepTask(10);
+
+		if (wrap_kbd_p1_f() == 1) { // autorepeat ?
+			_kbd_p2_f();
+		}
+	}
+}
+
+void __attribute__((naked,noinline)) mykbd_task(long ua, long ub, long uc, long ud, long ue, long uf)
+{
+	/* WARNING
+	* Stack pointer manipulation performed here!
+	* This means (but not limited to):
+	*	function arguments destroyed;
+	*	function CAN NOT return properly;
+	*	MUST NOT call or use stack variables before stack
+	*	is setup properly;
+	*
+	*/
+
+	register int i;
+	register long *newstack;
+
+#ifndef MALLOCD_STACK
+	newstack = (void*)kbd_stack;
+#else
+	newstack = malloc(NEW_SS);
+#endif
+
+	for (i=0;i<NEW_SS/4;i++) {
+		newstack[i]=0xdededede;
+	}
+
+	asm volatile (
+		"MOV	SP, %0"
+		:: "r"(((char*)newstack)+NEW_SS)
+		: "memory"
+		);
+
+	mykbd_task_proceed();
+
+	// function can be modified to restore SP here...
+
+	_ExitTask();
+}
+
+
+long __attribute__((naked,noinline)) wrap_kbd_p1_f()
+{
+	asm volatile (
+		"STMFD   SP!, {R1-R5,LR}\n"
+		"MOV     R4, #0\n"
+		"BL      my_kbd_read_keys\n"
+		"B	 _kbd_p1_f_cont\n"
+		);
+	return 0; // shut up the compiler
+}
+
+volatile int jogdial_stopped=0;
+
+void my_kbd_read_keys()
+{
+	kbd_prev_state[0] = kbd_new_state[0];
+	kbd_prev_state[1] = kbd_new_state[1];
+	kbd_prev_state[2] = kbd_new_state[2];
+
+	_kbd_pwr_on();
+
+	kbd_fetch_data(kbd_new_state);
+
+	if (kbd_process() == 0) {
+		// leave it alone...
+		physw_status[0] = kbd_new_state[0];
+		physw_status[1] = kbd_new_state[1];
+		physw_status[2] = kbd_new_state[2];
+		jogdial_stopped=0;
+	} else {
+		// override keys
+		physw_status[0] = (kbd_new_state[0] & (~KEYS_MASK0)) |
+			(kbd_mod_state[0] & KEYS_MASK0);
+
+		physw_status[1] = (kbd_new_state[1] & (~KEYS_MASK1)) |
+			(kbd_mod_state[1] & KEYS_MASK1);
+
+		physw_status[2] = (kbd_new_state[2] & (~KEYS_MASK2)) |
+			(kbd_mod_state[2] & KEYS_MASK2);
+
+		if ((jogdial_stopped==0) && !state_kbd_script_run) {
+			jogdial_stopped=1; get_jogdial_direction();
+		} else if (jogdial_stopped && state_kbd_script_run) {
+			jogdial_stopped=0;
+		}
+	}
+
+	_kbd_read_keys_r2(physw_status);
+
+	usb_remote_key(physw_status[USB_IDX]) ;
+
+	if (conf.remote_enable) {
+		physw_status[USB_IDX] = physw_status[USB_IDX] & ~(SD_READONLY_FLAG | USB_MASK);
+	} else {
+		physw_status[USB_IDX] = physw_status[USB_IDX] & ~SD_READONLY_FLAG;
+	}
+	_kbd_pwr_off();
+}
+
+void kbd_key_press(long key)
+{
+	int i;
+	for (i=0;keymap[i].hackkey;i++) {
+		if (keymap[i].hackkey == key) {
+			kbd_mod_state[keymap[i].grp] &= ~keymap[i].canonkey;
+			return;
+		}
+	}
+}
+
+void kbd_key_release(long key)
+{
+	int i;
+	for (i=0;keymap[i].hackkey;i++) {
+		if (keymap[i].hackkey == key) {
+			kbd_mod_state[keymap[i].grp] |= keymap[i].canonkey;
+			return;
+		}
+	}
+}
+
+void kbd_key_release_all()
+{
+	kbd_mod_state[0] |= KEYS_MASK0;
+	kbd_mod_state[1] |= KEYS_MASK1;
+	kbd_mod_state[2] |= KEYS_MASK2;
+}
+
+long kbd_is_key_pressed(long key)
+{
+	int i;
+	for (i=0;keymap[i].hackkey;i++) {
+		if (keymap[i].hackkey == key) {
+			return ((kbd_new_state[keymap[i].grp] & keymap[i].canonkey) == 0) ? 1:0;
+		}
+	}
+	return 0;
+}
+
+long kbd_is_key_clicked(long key)
+{
+	int i;
+	for (i=0;keymap[i].hackkey;i++) {
+		if (keymap[i].hackkey == key) {
+			return ((kbd_prev_state[keymap[i].grp] & keymap[i].canonkey) != 0) &&
+				((kbd_new_state[keymap[i].grp] & keymap[i].canonkey) == 0);
+		}
+	}
+	return 0;
+}
+
+long kbd_get_pressed_key()
+{
+	int i;
+	for (i=0;keymap[i].hackkey;i++) {
+		if ((kbd_new_state[keymap[i].grp] & keymap[i].canonkey) == 0) {
+			return keymap[i].hackkey;
+		}
+	}
+	return 0;
+}
+
+long kbd_get_clicked_key()
+{
+	int i;
+	for (i=0;keymap[i].hackkey;i++) {
+		if (((kbd_prev_state[keymap[i].grp] & keymap[i].canonkey) != 0) &&
+			((kbd_new_state[keymap[i].grp] & keymap[i].canonkey) == 0)) {
+				return keymap[i].hackkey;
+		}
+	}
+	return 0;
+}
+
+void kbd_reset_autoclicked_key()
+{
+	last_kbd_key = 0;
+}
+
+long kbd_get_autoclicked_key()
+{
+	static long last_kbd_time = 0, press_count = 0;
+	register long key, t;
+
+	key=kbd_get_clicked_key();
+	if (key) {
+		last_kbd_key = key;
+		press_count = 0;
+		last_kbd_time = get_tick_count();
+		return key;
+	} else {
+		if (last_kbd_key && kbd_is_key_pressed(last_kbd_key)) {
+			t = get_tick_count();
+			if (t-last_kbd_time>((press_count)?175:500)) {
+				++press_count;
+				last_kbd_time = t;
+				return last_kbd_key;
+			} else {
+				return 0;
+			}
+		} else {
+			last_kbd_key = 0;
+			return 0;
+		}
+	}	
+}
+
+long kbd_use_zoom_as_mf()
+{
+	static long v;
+	static long zoom_key_pressed = 0;
+
+	if (kbd_is_key_pressed(KEY_ZOOM_IN) && (mode_get()&MODE_MASK) == MODE_REC) {
+		get_property_case(PROPCASE_FOCUS_MODE, &v, 4);
+		if (v) {
+			kbd_key_release_all();
+			kbd_key_press(KEY_RIGHT);
+			zoom_key_pressed = KEY_ZOOM_IN;
+			return 1;
+		}
+	} else {
+		if (zoom_key_pressed==KEY_ZOOM_IN) {
+			kbd_key_release(KEY_RIGHT);
+			zoom_key_pressed = 0;
+			return 1;
+		}
+	}
+
+	if (kbd_is_key_pressed(KEY_ZOOM_OUT) && (mode_get()&MODE_MASK) == MODE_REC) {
+		get_property_case(PROPCASE_FOCUS_MODE, &v, 4);
+		if (v) {
+			kbd_key_release_all();
+			kbd_key_press(KEY_LEFT);
+			zoom_key_pressed = KEY_ZOOM_OUT;
+			return 1;
+		}
+	} else {
+		if (zoom_key_pressed==KEY_ZOOM_OUT) {
+			kbd_key_release(KEY_LEFT);
+			zoom_key_pressed = 0;
+			return 1;
+		}
+	}
+
+	return 0;
+}
+
+static int new_jogdial=0, old_jogdial=0;
+
+int Get_JogDial(void)
+{
+	// 0xC0240000+0x104 @ FF842A44
+	return (*(int*)0xC0240104)>>16;
+}
+
+long get_jogdial_direction(void)
+{
+	old_jogdial=new_jogdial;
+	new_jogdial=Get_JogDial();
+
+	if (old_jogdial<new_jogdial) {
+		return JOGDIAL_LEFT;
+	} else if (old_jogdial>new_jogdial) {
+		return JOGDIAL_RIGHT;
+	} else {
+		return 0;
+	}
+}
+
+void kbd_fetch_data(long *dst)
+{
+	// 0xC0220000+0x200, 0xC0220000+0x204, 0xC0220000+0x208 @ FF8428E8
+	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/reyalp-ptp-live/platform/ixus970_sd890/platform_camera.h
===================================================================
--- /branches/reyalp-ptp-live/platform/ixus970_sd890/platform_camera.h	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/ixus970_sd890/platform_camera.h	(revision 1668)
@@ -0,0 +1,68 @@
+// Camera - ixus970_sd890 - platform_camera.h
+
+// This file contains the various settings values specific to the ixus970_sd890 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                     2
+    #define CAM_DRYOS                       1
+
+    #define CAM_RAW_ROWPIX                  3720
+    #define CAM_RAW_ROWS                    2772
+
+    #undef  CAM_USE_ZOOM_FOR_MF
+    #undef  CAM_HAS_ERASE_BUTTON
+    #undef  CAM_HAS_IRIS_DIAPHRAGM
+    #define CAM_HAS_ND_FILTER               1
+    #undef  CAM_HAS_MANUAL_FOCUS
+    #define CAM_MULTIPART                   1
+    #define CAM_HAS_JOGDIAL                 1
+    #define CAM_SHOW_OSD_IN_SHOOT_MENU      1
+    #define CAM_EXT_TV_RANGE                1
+
+    #define CAM_DNG_LENS_INFO               { 66,10, 330,10, 32,10, 57,10 } // See comments in camera.h
+    // pattern
+    #define cam_CFAPattern                  0x02010100 // Red  Green  Green  Blue
+
+    // color
+    #define CAM_COLORMATRIX1                              \
+     827547, 1000000, -290458, 1000000, -126086, 1000000, \
+     -12829, 1000000,  530507, 1000000,   50537, 1000000, \
+       5181, 1000000,   48183, 1000000,  245014, 1000000
+    #define cam_CalibrationIlluminant1      1       // Daylight
+
+    // cropping
+    #define CAM_JPEG_WIDTH                  3648
+    #define CAM_JPEG_HEIGHT                 2736
+    #define CAM_ACTIVE_AREA_X1              6
+    #define CAM_ACTIVE_AREA_Y1              12
+    #define CAM_ACTIVE_AREA_X2              3690
+    #define CAM_ACTIVE_AREA_Y2              2772
+
+    // camera name
+    #define PARAM_CAMERA_NAME               4       // parameter number for GetParameterData
+
+    // 12 bit support
+    #undef  CAM_SENSOR_BITS_PER_PIXEL
+    #define CAM_SENSOR_BITS_PER_PIXEL       12
+
+	#define REMOTE_SYNC_STATUS_LED 	0xc02200D4		// specifies an LED that turns on while camera waits for USB remote to sync
+	
+//----------------------------------------------------------
+
Index: /branches/reyalp-ptp-live/platform/ixus970_sd890/wrappers.c
===================================================================
--- /branches/reyalp-ptp-live/platform/ixus970_sd890/wrappers.c	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/ixus970_sd890/wrappers.c	(revision 1668)
@@ -0,0 +1,17 @@
+#include "../generic/wrappers.c"
+
+long lens_get_focus_pos()
+{
+    return _GetFocusLensSubjectDistance();
+}
+
+long lens_get_focus_pos_from_lens()
+{
+	return _GetCurrentTargetDistance(); 
+	//return _GetFocusLensSubjectDistanceFromLens(); 
+}
+
+long lens_get_target_distance()
+{
+	return _GetCurrentTargetDistance();
+}
Index: /branches/reyalp-ptp-live/platform/ixus970_sd890/main.c
===================================================================
--- /branches/reyalp-ptp-live/platform/ixus970_sd890/main.c	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/ixus970_sd890/main.c	(revision 1668)
@@ -0,0 +1,78 @@
+#include "lolevel.h"
+#include "platform.h"
+#include "core.h"
+#include "keyboard.h"
+
+extern long link_bss_start;
+extern long link_bss_end;
+extern void boot();
+
+void startup()
+{
+	long *bss = &link_bss_start;
+	long *ptr;
+
+	// sanity check
+	if ((long)&link_bss_end > (MEMISOSTART + MEMISOSIZE)) {
+		started();
+		shutdown();
+	}
+
+	// initialize .bss senment
+	while (bss<&link_bss_end)
+		*bss++ = 0;
+
+	boot();
+}
+
+
+static const int fl_tbl[] = {6600, 7800, 9000, 10300, 11900,13500, 15400, 17700, 20400, 23700, 28000, 33000};
+#define NUM_FL (sizeof(fl_tbl)/sizeof(fl_tbl[0]))
+#define CF_EFL 56060
+
+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];
+	}
+}
+
+#if 0
+int rec_switch_state(void) {
+// play/rec without override ? This camera has play button, so not clear
+//	mode  = (physw_status[1] & 0x00010000) ? MODE_REC : MODE_PLAY;
+	return (physw_status[1] & 0x00010000);
+}
+#endif
+
+long get_vbatt_min()
+{
+	return 3500;
+}
+
+long get_vbatt_max()
+{
+	return 4100;
+}
Index: /branches/reyalp-ptp-live/platform/ixus970_sd890/notes.txt
===================================================================
--- /branches/reyalp-ptp-live/platform/ixus970_sd890/notes.txt	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/ixus970_sd890/notes.txt	(revision 1668)
@@ -0,0 +1,24 @@
+General info:
+Digic III, dryos, propset 2
+10mp raw 3720*2772 12 bits/pixel
+ND filter only, NO iris
+
+Booting:
+Encoded diskboot required, FI2 "firm update" supported.
+With diskboot camera will always boot in play mode. Press halfshoot to switch to record.
+With FI2, you must boot in play mode in order to access the firm update menu.
+
+Display:
+Live view is 360x240 
+
+Buttons:
+Direct print button is the ALT button. This can be assigned a function in the
+original canon firmware. Hold it down to access the canon firmware function
+Other keys use the standard mapping for cameras without an erase button.
+
+
+
+
+IMPORTANT NOTICE:
+Firmware version 100d is as good as identical to 100c, which is copied for 100d.
+Development is done in the 100c tree!
Index: /branches/reyalp-ptp-live/platform/ixus970_sd890/lib.c
===================================================================
--- /branches/reyalp-ptp-live/platform/ixus970_sd890/lib.c	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/ixus970_sd890/lib.c	(revision 1668)
@@ -0,0 +1,44 @@
+#include "platform.h"
+#include "lolevel.h"
+#include "leds.h"
+
+void shutdown()
+{
+	// 0xC0220000+0x1C @ FF829C28
+	volatile long *p = (void*)0xC022001C;
+
+	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);
+}
+
+// 0x73 @ FF95D974
+int get_flash_params_count(void) { return 115; }
+
+void debug_led(int state)
+{
+	*(int*)LED_PR = state ? 0x46 : 0x44;
+}
+
+void camera_set_led(int led, int state, int bright)
+{
+	static char led_table[5]={4,5,7,8,9};
+	_LEDDrive(led_table[led%sizeof(led_table)], state<=1 ? !state : state);
+}
+
+void JogDial_CW(void)
+{
+	_PostLogicalEventForNotPowerType(0x874, 1);  // RotateJogDialRight
+}
+
+void JogDial_CCW(void)
+{
+	_PostLogicalEventForNotPowerType(0x875, 1);  // RotateJogDialLeft
+}
Index: /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100b/capt_seq.c
===================================================================
--- /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100b/capt_seq.c	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100b/capt_seq.c	(revision 1668)
@@ -0,0 +1,1109 @@
+#include "lolevel.h"
+#include "platform.h"
+#include "core.h"
+
+// @ FF93DBA8
+static long *nrflag = (long*)0x91A4;
+
+#include "../../../generic/capt_seq.c"
+
+// Extracted method: task_CaptSeqTask (FF85E03C)
+void __attribute__((naked,noinline)) capt_seq_task()
+{
+	asm volatile (
+		"STMFD   SP!, {R3-R9,LR}\n"
+		"LDR     R6, =0x19EBC\n"
+		"LDR     R5, =0x54E0\n"
+		"MOV     R9, #1\n"
+		"MOV     R7, #0\n"
+
+		"loc_FF85E050:\n"
+		"LDR     R0, [R5,#0xC]\n"
+		"MOV     R2, #0\n"
+		"MOV     R1, SP\n"
+		"BL      sub_FF827D90\n" // LOCATION: KerQueue.c:0
+		"TST     R0, #1\n"
+		"BEQ     loc_FF85E07C\n"
+		"LDR     R1, =0x48E\n"
+		"LDR     R0, =0xFF85DD14\n" // "SsShootTask.c"
+		"BL      _DebugAssert\n"
+		"BL      sub_FF81BAA8\n" // ExitTask\n"
+		"LDMFD   SP!, {R3-R9,PC}\n"
+
+		"loc_FF85E07C:\n"
+		"LDR     R0, [SP,#0x20-0x20]\n"
+		"LDR     R1, [R0]\n"
+		"CMP     R1, #0x1B\n"
+		"ADDLS   PC, PC, R1,LSL#2\n"
+		"B       loc_FF85E29C\n"
+
+		"loc_FF85E090:\n"
+		"B       loc_FF85E100\n"
+
+		"loc_FF85E094:\n"
+		"B       loc_FF85E168\n"
+
+		"loc_FF85E098:\n"
+		"B       loc_FF85E170\n"
+
+		"loc_FF85E09C:\n"
+		"B       loc_FF85E188\n"
+
+		"loc_FF85E0A0:\n"
+		"B       loc_FF85E17C\n"
+
+		"loc_FF85E0A4:\n"
+		"B       loc_FF85E190\n"
+
+		"loc_FF85E0A8:\n"
+		"B       loc_FF85E198\n"
+
+		"loc_FF85E0AC:\n"
+		"B       loc_FF85E1A0\n"
+
+		"loc_FF85E0B0:\n"
+		"B       loc_FF85E1F8\n"
+
+		"loc_FF85E0B4:\n"
+		"B       loc_FF85E204\n"
+
+		"loc_FF85E0B8:\n"
+		"B       loc_FF85E20C\n"
+
+		"loc_FF85E0BC:\n"
+		"B       loc_FF85E214\n"
+
+		"loc_FF85E0C0:\n"
+		"B       loc_FF85E21C\n"
+
+		"loc_FF85E0C4:\n"
+		"B       loc_FF85E224\n"
+
+		"loc_FF85E0C8:\n"
+		"B       loc_FF85E22C\n"
+
+		"loc_FF85E0CC:\n"
+		"B       loc_FF85E234\n"
+
+		"loc_FF85E0D0:\n"
+		"B       loc_FF85E23C\n"
+
+		"loc_FF85E0D4:\n"
+		"B       loc_FF85E248\n"
+
+		"loc_FF85E0D8:\n"
+		"B       loc_FF85E250\n"
+
+		"loc_FF85E0DC:\n"
+		"B       loc_FF85E258\n"
+
+		"loc_FF85E0E0:\n"
+		"B       loc_FF85E260\n"
+
+		"loc_FF85E0E4:\n"
+		"B       loc_FF85E26C\n"
+
+		"loc_FF85E0E8:\n"
+		"B       loc_FF85E274\n"
+
+		"loc_FF85E0EC:\n"
+		"B       loc_FF85E27C\n"
+
+		"loc_FF85E0F0:\n"
+		"B       loc_FF85E284\n"
+
+		"loc_FF85E0F4:\n"
+		"B       loc_FF85E28C\n"
+
+		"loc_FF85E0F8:\n"
+		"B       loc_FF85E294\n"
+
+		"loc_FF85E0FC:\n"
+		"B       loc_FF85E2A8\n"
+
+		"loc_FF85E100:\n"
+		// jumptable FF85E088 entry 0
+		"BL      sub_FF93C448\n" // LOCATION: SsPrepareSeq.c:0
+		"BL      shooting_expo_param_override\n" // +
+		"BL      sub_FF85C1C4\n"
+		"LDR     R0, [R6,#0x24]\n"
+		"CMP     R0, #0\n"
+		"BEQ     loc_FF85E2A8\n"
+		"BL      sub_FF85D9E4\n"
+		"MOV     R4, R0\n"
+		"LDR     R0, [R6,#0x24]\n"
+		"CMP     R0, #0\n"
+		"BEQ     loc_FF85E148\n"
+		"MOV     R0, #0xC\n"
+		"BL      sub_FF8610AC\n"
+		"TST     R0, #1\n"
+		"STRNE   R9, [R5,#4]\n"
+		"LDRNE   R0, [R4,#8]\n"
+		"ORRNE   R0, R0, #0x40000000\n"
+		"STRNE   R0, [R4,#8]\n"
+		"BNE     loc_FF85E2A8\n"
+
+		"loc_FF85E148:\n"
+		"BL      sub_FF95DE08\n"
+		"BL      sub_FF86D198\n" // LOCATION: PropertyCase.c:0
+		"STR     R0, [R4,#0x14]\n"
+		"MOV     R0, R4\n"
+		//"BL      sub_FF93DB30\n" // LOCATION: SsCaptureSeq.c:536
+		"BL      sub_FF93DB30_my\n" // +
+		"BL      capt_seq_hook_raw_here\n" // +
+		"TST     R0, #1\n"
+		"STRNE   R9, [R5,#4]\n"
+		"B       loc_FF85E2A8\n"
+
+		"loc_FF85E168:\n"
+		// jumptable FF85E088 entry 1
+		//"BL      sub_FF85E3C0\n"
+		"BL      sub_FF85E3C0_my\n" // +
+		"B       loc_FF85E180\n"
+
+		"loc_FF85E170:\n"
+		// jumptable FF85E088 entry 2
+		"MOV     R0, #1\n"
+		"BL      sub_FF93C5F0\n" // LOCATION: SsPrepareSeq.c:0
+		"B       loc_FF85E2A8\n"
+
+		"loc_FF85E17C:\n"
+		// jumptable FF85E088 entry 4
+		"BL      sub_FF93C0E0\n"
+
+		"loc_FF85E180:\n"
+		"STR     R7, [R6,#0x24]\n"
+		"B       loc_FF85E2A8\n"
+
+		"loc_FF85E188:\n"
+		// jumptable FF85E088 entry 3
+		"BL      sub_FF93C414\n"
+		"B       loc_FF85E180\n"
+
+		"loc_FF85E190:\n"
+		// jumptable FF85E088 entry 5
+		"BL      sub_FF93C41C\n"
+		"B       loc_FF85E2A8\n"
+
+		"loc_FF85E198:\n"
+		// jumptable FF85E088 entry 6
+		"BL      sub_FF93C510\n" // LOCATION: SsPrepareSeq.c:0
+		"B       loc_FF85E1FC\n"
+
+		"loc_FF85E1A0:\n"
+		// jumptable FF85E088 entry 7
+		"LDR     R4, [R0,#0xC]\n"
+		"BL      sub_FF93C424\n"
+		"MOV     R0, R4\n"
+		"BL      sub_FF93CC38\n" // LOCATION: SsPrePreSeq.c:2097152
+		"TST     R0, #1\n"
+		"MOV     R8, R0\n"
+		"BNE     loc_FF85E1E0\n"
+		"BL      sub_FF86D198\n" // LOCATION: PropertyCase.c:0
+		"STR     R0, [R4,#0x14]\n"
+		"MOV     R0, R4\n"
+		"BL      sub_FF93DA48\n" // LOCATION: SsCaptureSeq.c:1
+		"MOV     R0, R4\n"
+		"BL      sub_FF93DF9C\n" // LOCATION: SsCaptureSeq.c:4
+		"MOV     R8, R0\n"
+		"LDR     R0, [R4,#0x14]\n"
+		"BL      sub_FF86D3A4\n" // LOCATION: PropertyCase.c:0
+
+		"loc_FF85E1E0:\n"
+		"BL      sub_FF93C414\n"
+		"MOV     R2, R4\n"
+		"MOV     R1, #9\n"
+		"MOV     R0, R8\n"
+		"BL      sub_FF85C718\n" // LOCATION: SsShootCtrl.c:0
+		"B       loc_FF85E2A8\n"
+
+		"loc_FF85E1F8:\n"
+		// jumptable FF85E088 entry 8
+		"BL      sub_FF93C570\n" // LOCATION: SsPrepareSeq.c:960
+
+		"loc_FF85E1FC:\n"
+		"BL      sub_FF85C1C4\n"
+		"B       loc_FF85E2A8\n"
+
+		"loc_FF85E204:\n"
+		// jumptable FF85E088 entry 9
+		"BL      sub_FF93C414\n"
+		"B       loc_FF85E2A8\n"
+
+		"loc_FF85E20C:\n"
+		// jumptable FF85E088 entry 10
+		"BL      sub_FF93CEA4\n"
+		"B       loc_FF85E2A8\n"
+
+		"loc_FF85E214:\n"
+		// jumptable FF85E088 entry 11
+		"BL      sub_FF93D08C\n"
+		"B       loc_FF85E2A8\n"
+
+		"loc_FF85E21C:\n"
+		// jumptable FF85E088 entry 12
+		"BL      sub_FF93D11C\n" // LOCATION: SsExpCompSeq.c:94
+		"B       loc_FF85E2A8\n"
+
+		"loc_FF85E224:\n"
+		// jumptable FF85E088 entry 13
+		"BL      sub_FF93D1D0\n"
+		"B       loc_FF85E2A8\n"
+
+		"loc_FF85E22C:\n"
+		// jumptable FF85E088 entry 14
+		"BL      sub_FF93D3C8\n" // LOCATION: SsChgExpSeq.c:32
+		"B       loc_FF85E2A8\n"
+
+		"loc_FF85E234:\n"
+		// jumptable FF85E088 entry 15
+		"BL      sub_FF93D418\n" // LOCATION: SsChgExpSeq.c:32
+		"B       loc_FF85E2A8\n"
+
+		"loc_FF85E23C:\n"
+		// jumptable FF85E088 entry 16
+		"MOV     R0, #0\n"
+		"BL      sub_FF93D49C\n"
+		"B       loc_FF85E2A8\n"
+
+		"loc_FF85E248:\n"
+		// jumptable FF85E088 entry 17
+		"BL      sub_FF93D5EC\n"
+		"B       loc_FF85E2A8\n"
+
+		"loc_FF85E250:\n"
+		// jumptable FF85E088 entry 18
+		"BL      sub_FF93D680\n" // LOCATION: SsMFSeq.c:109
+		"B       loc_FF85E2A8\n"
+
+		"loc_FF85E258:\n"
+		// jumptable FF85E088 entry 19
+		"BL      sub_FF93D748\n" // LOCATION: SsMFSeq.c:181
+		"B       loc_FF85E2A8\n"
+
+		"loc_FF85E260:\n"
+		// jumptable FF85E088 entry 20
+		"BL      sub_FF93C714\n"
+		"BL      sub_FF824C38\n"
+		"B       loc_FF85E2A8\n"
+
+		"loc_FF85E26C:\n"
+		// jumptable FF85E088 entry 21
+		"BL      sub_FF93D28C\n"
+		"B       loc_FF85E2A8\n"
+
+		"loc_FF85E274:\n"
+		// jumptable FF85E088 entry 22
+		"BL      sub_FF93D2F8\n" // LOCATION: SsChgExpSeq.c:0
+		"B       loc_FF85E2A8\n"
+
+		"loc_FF85E27C:\n"
+		// jumptable FF85E088 entry 23
+		"BL      sub_FF93F558\n"
+		"B       loc_FF85E2A8\n"
+
+		"loc_FF85E284:\n"
+		// jumptable FF85E088 entry 24
+		"BL      sub_FF93F574\n"
+		"B       loc_FF85E2A8\n"
+
+		"loc_FF85E28C:\n"
+		// jumptable FF85E088 entry 25
+		"BL      sub_FF93F584\n"
+		"B       loc_FF85E2A8\n"
+
+		"loc_FF85E294:\n"
+		// jumptable FF85E088 entry 26
+		"BL      sub_FF93F5B0\n"
+		"B       loc_FF85E2A8\n"
+
+		"loc_FF85E29C:\n"
+		// jumptable FF85E088 default entry
+		"LDR     R1, =0x58E\n"
+		"LDR     R0, =0xFF85DD14\n" // aSsshoottask_c
+		"BL      _DebugAssert\n"
+
+		"loc_FF85E2A8:\n"
+		// jumptable FF85E088 entry 27
+		"LDR     R0, [SP,#0x20-0x20]\n"
+		"LDR     R1, [R0,#4]\n"
+		"LDR     R0, [R5,#8]\n"
+		"BL      sub_FF827B0C\n"
+		"LDR     R4, [SP,#0x20-0x20]\n"
+		"LDR     R0, [R4,#8]\n"
+		"CMP     R0, #0\n"
+		"LDREQ   R1, =0x10D\n"
+		"LDREQ   R0, =0xFF85DD14\n" // aSsshoottask_c
+		"BLEQ    _DebugAssert\n"
+		"STR     R7, [R4,#8]\n"
+		"B       loc_FF85E050\n"
+		);
+}
+
+void __attribute__((naked,noinline)) sub_FF85E3C0_my()
+{
+	asm volatile (
+		"STMFD   SP!, {R4-R6,LR}\n"
+		"LDR     R4, [R0,#0xC]\n"
+		"LDR     R6, =0x19EBC\n"
+		"LDR     R0, [R4,#8]\n"
+		"MOV     R5, #0\n"
+		"ORR     R0, R0, #1\n"
+		"STR     R0, [R4,#8]\n"
+		"LDR     R0, [R6,#0x24]\n"
+		"CMP     R0, #0\n"
+		"MOVEQ   R0, #2\n"
+		"BLEQ    sub_FF858330\n"
+		"BL      sub_FF93C424\n"
+		"LDR     R0, [R6,#0x24]\n"
+		"CMP     R0, #0\n"
+		"BNE     loc_FF85E440\n"
+		"MOV     R0, R4\n"
+		"BL      sub_FF93C8B8\n" // LOCATION: SsPrePreSeq.c:242
+		"TST     R0, #1\n"
+		"MOVNE   R2, R4\n"
+		"LDMNEFD SP!, {R4-R6,LR}\n"
+		"MOVNE   R1, #1\n"
+		"BNE     sub_FF85C718\n" // LOCATION: SsShootCtrl.c:0
+		"BL      sub_FF95DE08\n"
+		"BL      sub_FF86D198\n" // LOCATION: PropertyCase.c:0
+		"STR     R0, [R4,#0x14]\n"
+		"MOV     R0, R4\n"
+		"BL      sub_FF93DA48\n" // LOCATION: SsCaptureSeq.c:1
+		"BL      sub_FF93E520\n" // LOCATION: SsShootLib.c:32768
+		"MOV     R0, R4\n"
+		//"BL      sub_FF93DB30\n" // LOCATION: SsCaptureSeq.c:536
+		"BL      sub_FF93DB30_my\n" // +
+		"MOV     R5, R0\n"
+		"BL      capt_seq_hook_raw_here\n" // +
+		"B       loc_FF85E450\n"
+
+		"loc_FF85E440:\n"
+		"LDR     R0, =0x54E0\n"
+		"LDR     R0, [R0,#4]\n"
+		"CMP     R0, #0\n"
+		"MOVNE   R5, #0x1D\n"
+
+		"loc_FF85E450:\n"
+		"BL      sub_FF93F574\n"
+		"BL      sub_FF93F5B0\n"
+		"MOV     R2, R4\n"
+		"MOV     R1, #1\n"
+		"MOV     R0, R5\n"
+		"BL      sub_FF85C718\n" // LOCATION: SsShootCtrl.c:0
+		"BL      sub_FF93DF3C\n"
+		"CMP     R0, #0\n"
+		"LDRNE   R0, [R4,#8]\n"
+		"ORRNE   R0, R0, #0x2000\n"
+		"STRNE   R0, [R4,#8]\n"
+		"LDMFD   SP!, {R4-R6,PC}\n"
+		);
+}
+
+void __attribute__((naked,noinline)) sub_FF93DB30_my()
+{
+	asm volatile (
+		"STMFD   SP!, {R0-R10,LR}\n"
+		"MOV     R6, #0\n"
+		"MOV     R4, R0\n"
+		"BL      sub_FF93E698\n" // LOCATION: SsShootEvent.c:60
+		"MVN     R1, #0\n"
+		"BL      sub_FF827B40\n"
+		"MOV     R2, #4\n"
+		"ADD     R1, SP, #0x30-0x28\n"
+		"MOV     R0, #0x8A\n"
+		"BL      sub_FF86D008\n" // PT_GetPropertyCaseString_0
+		"TST     R0, #1\n"
+		"MOVNE   R1, #0x218\n"
+		"LDRNE   R0, =0xFF93DD04\n" // "SsCaptureSeq.c"
+		"BLNE    _DebugAssert\n"
+		"LDR     R8, =0x19F70\n"
+		"LDR     R5, =0x19EBC\n"
+		"LDRSH   R1, [R8,#0xE]\n"
+		"LDR     R0, [R5,#0x7C]\n"
+		"BL      sub_FF8F3B40\n"
+		"BL      sub_FF845330\n" // GetCCDTemperature
+		"LDR     R2, =0x91A8\n"
+		"ADD     R3, R4, #0x8C\n"
+		"STRH    R0, [R4,#0x88]\n"
+		"STRD    R2, [SP,#0x30-0x30]\n"
+		"MOV     R1, R0\n"
+		"LDRH    R0, [R5,#0x54]\n"
+		"LDRSH   R2, [R8,#0xC]\n"
+		"LDR     R3, =0x91A4\n"
+		"BL      sub_FF93EB8C\n" // LOCATION: NRTable.c:202
+		"BL      wait_until_remote_button_is_released\n" // +
+		"BL      capt_seq_hook_set_nr\n" // +
+		"BL      sub_FF93DBA4\n" // Continue in the original FW
+		);
+}
+
+// Extracted method: task_ExpDrvTask (FF8B6864)
+void __attribute__((naked,noinline)) exp_drv_task()
+{
+	asm volatile (
+		"STMFD   SP!, {R4-R8,LR}\n"
+		"SUB     SP, SP, #0x20\n"
+		"LDR     R8, =0xBB8\n"
+		"LDR     R7, =0x6E30\n"
+		"LDR     R5, =0x3E198\n"
+		"MOV     R0, #0\n"
+		"ADD     R6, SP, #0x38-0x28\n"
+		"STR     R0, [SP,#0x38-0x2C]\n"
+
+		"loc_FF8B6884:\n"
+		"LDR     R0, [R7,#0x20]\n"
+		"MOV     R2, #0\n"
+		"ADD     R1, SP, #0x38-0x1C\n"
+		"BL      sub_FF827D90\n" // LOCATION: KerQueue.c:0
+		"LDR     R0, [SP,#0x38-0x2C]\n"
+		"CMP     R0, #1\n"
+		"BNE     loc_FF8B68CC\n"
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"LDR     R0, [R0]\n"
+		"CMP     R0, #0x13\n"
+		"CMPNE   R0, #0x14\n"
+		"CMPNE   R0, #0x15\n"
+		"BEQ     loc_FF8B69E8\n"
+		"CMP     R0, #0x27\n"
+		"BEQ     loc_FF8B69C0\n"
+		"ADD     R1, SP, #0x38-0x2C\n"
+		"MOV     R0, #0\n"
+		"BL      sub_FF8B6814\n" // LOCATION: ExpDrv.c:512
+
+		"loc_FF8B68CC:\n"
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"LDR     R1, [R0]\n"
+		"CMP     R1, #0x2C\n"
+		"BNE     loc_FF8B68FC\n"
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"BL      sub_FF8B7AD0\n" // LOCATION: ExpDrv.c:268
+		"LDR     R0, [R7,#0x1C]\n"
+		"MOV     R1, #1\n"
+		"BL      sub_FF827B0C\n"
+		"BL      sub_FF81BAA8\n" // eventproc_export_ExitTask
+		"ADD     SP, SP, #0x20\n"
+		"LDMFD   SP!, {R4-R8,PC}\n"
+
+		"loc_FF8B68FC:\n"
+		"CMP     R1, #0x2B\n"
+		"BNE     loc_FF8B6918\n"
+		"LDR     R2, [R0,#0x88]!\n"
+		"LDR     R1, [R0,#4]\n"
+		"MOV     R0, R1\n"
+		"BLX     R2\n"
+		"B       loc_FF8B6E50\n"
+
+		"loc_FF8B6918:\n"
+		"CMP     R1, #0x25\n"
+		"BNE     loc_FF8B6968\n"
+		"LDR     R0, [R7,#0x1C]\n"
+		"MOV     R1, #0x80\n"
+		"BL      sub_FF827B40\n"
+		"LDR     R0, =0xFF8B329C\n"
+		"MOV     R1, #0x80\n"
+		"BL      sub_FF92F844\n" // LOCATION: IrisController.c:74
+		"LDR     R0, [R7,#0x1C]\n"
+		"MOV     R2, R8\n"
+		"MOV     R1, #0x80\n"
+		"BL      sub_FF827A44\n" // LOCATION: KerFlag.c:0
+		"TST     R0, #1\n"
+		"LDRNE   R1, =0xD1B\n"
+		"BNE     loc_FF8B69AC\n"
+
+		"loc_FF8B6954:\n"
+		"LDR     R1, [SP,#0x38-0x1C]\n"
+		"LDR     R0, [R1,#0x8C]\n"
+		"LDR     R1, [R1,#0x88]\n"
+		"BLX     R1\n"
+		"B       loc_FF8B6E50\n"
+
+		"loc_FF8B6968:\n"
+		"CMP     R1, #0x26\n"
+		"BNE     loc_FF8B69B8\n"
+		"ADD     R1, SP, #0x38-0x2C\n"
+		"BL      sub_FF8B6814\n" // LOCATION: ExpDrv.c:512
+		"LDR     R0, [R7,#0x1C]\n"
+		"MOV     R1, #0x100\n"
+		"BL      sub_FF827B40\n"
+		"LDR     R0, =0xFF8B32AC\n"
+		"MOV     R1, #0x100\n"
+		"BL      sub_FF92FACC\n" // LOCATION: IrisController.c:160
+		"LDR     R0, [R7,#0x1C]\n"
+		"MOV     R2, R8\n"
+		"MOV     R1, #0x100\n"
+		"BL      sub_FF827A44\n" // LOCATION: KerFlag.c:0
+		"TST     R0, #1\n"
+		"BEQ     loc_FF8B6954\n"
+		"LDR     R1, =0xD25\n"
+
+		"loc_FF8B69AC:\n"
+		"LDR     R0, =0xFF8B399C\n" // "ExpDrv.c"
+		"BL      _DebugAssert\n"
+		"B       loc_FF8B6954\n"
+
+		"loc_FF8B69B8:\n"
+		"CMP     R1, #0x27\n"
+		"BNE     loc_FF8B69D0\n"
+
+		"loc_FF8B69C0:\n"
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"ADD     R1, SP, #0x38-0x2C\n"
+		"BL      sub_FF8B6814\n" // LOCATION: ExpDrv.c:512
+		"B       loc_FF8B6954\n"
+
+		"loc_FF8B69D0:\n"
+		"CMP     R1, #0x2A\n"
+		"BNE     loc_FF8B69E8\n"
+		"BL      sub_FF895C1C\n" // LOCATION: Shutter.c:2
+		"BL      sub_FF8969E8\n" // LOCATION: ImgPixel.c:0
+		"BL      sub_FF89646C\n" // LOCATION: ImgGain.c:0
+		"B       loc_FF8B6954\n"
+
+		"loc_FF8B69E8:\n"
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"MOV     R4, #1\n"
+		"LDR     R1, [R0]\n"
+		"CMP     R1, #0x11\n"
+		"CMPNE   R1, #0x12\n"
+		"BNE     loc_FF8B6A58\n"
+		"LDR     R1, [R0,#0x7C]\n"
+		"ADD     R1, R1, R1,LSL#1\n"
+		"ADD     R1, R0, R1,LSL#2\n"
+		"SUB     R1, R1, #8\n"
+		"LDMIA   R1, {R2-R4}\n"
+		"STMIA   R6, {R2-R4}\n"
+		"BL      sub_FF8B5328\n" // LOCATION: ExpDrv.c:2
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"LDR     R1, [R0,#0x7C]\n"
+		"LDR     R3, [R0,#0x88]\n"
+		"LDR     R2, [R0,#0x8C]\n"
+		"ADD     R0, R0, #4\n"
+		"BLX     R3\n"
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"BL      sub_FF8B7EA4\n" // LOCATION: ExpDrv.c:0
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"LDR     R1, [R0,#0x7C]\n"
+		"LDR     R3, [R0,#0x90]\n"
+		"LDR     R2, [R0,#0x94]\n"
+		"ADD     R0, R0, #4\n"
+		"BLX     R3\n"
+		"B       loc_FF8B6D90\n"
+
+		"loc_FF8B6A58:\n"
+		"CMP     R1, #0x13\n"
+		"CMPNE   R1, #0x14\n"
+		"CMPNE   R1, #0x15\n"
+		"BNE     loc_FF8B6B0C\n"
+		"ADD     R3, SP, #0x38-0x2C\n"
+		"MOV     R2, SP\n"
+		"ADD     R1, SP, #0x38-0x28\n"
+		"BL      sub_FF8B5570\n" // LOCATION: ExpDrv.c:0
+		"CMP     R0, #1\n"
+		"MOV     R4, R0\n"
+		"CMPNE   R4, #5\n"
+		"BNE     loc_FF8B6AA8\n"
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"MOV     R2, R4\n"
+		"LDR     R1, [R0,#0x7C]!\n"
+		"LDR     R12, [R0,#0xC]!\n"
+		"LDR     R3, [R0,#4]\n"
+		"MOV     R0, SP\n"
+		"BLX     R12\n"
+		"B       loc_FF8B6AE0\n"
+
+		"loc_FF8B6AA8:\n"
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"CMP     R4, #2\n"
+		"LDR     R3, [R0,#0x8C]\n"
+		"CMPNE   R4, #6\n"
+		"BNE     loc_FF8B6AF4\n"
+		"LDR     R12, [R0,#0x88]\n"
+		"MOV     R0, SP\n"
+		"MOV     R2, R4\n"
+		"MOV     R1, #1\n"
+		"BLX     R12\n"
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"MOV     R2, SP\n"
+		"ADD     R1, SP, #0x38-0x28\n"
+		"BL      sub_FF8B6528\n" // LOCATION: ExpDrv.c:0
+
+		"loc_FF8B6AE0:\n"
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"LDR     R2, [SP,#0x38-0x2C]\n"
+		"MOV     R1, R4\n"
+		"BL      sub_FF8B67B4\n" // LOCATION: ExpDrv.c:2
+		"B       loc_FF8B6D90\n"
+
+		"loc_FF8B6AF4:\n"
+		"LDR     R1, [R0,#0x7C]\n"
+		"LDR     R12, [R0,#0x88]\n"
+		"ADD     R0, R0, #4\n"
+		"MOV     R2, R4\n"
+		"BLX     R12\n"
+		"B       loc_FF8B6D90\n"
+
+		"loc_FF8B6B0C:\n"
+		"CMP     R1, #0x21\n"
+		"CMPNE   R1, #0x22\n"
+		"BNE     loc_FF8B6B58\n"
+		"LDR     R1, [R0,#0x7C]\n"
+		"ADD     R1, R1, R1,LSL#1\n"
+		"ADD     R1, R0, R1,LSL#2\n"
+		"SUB     R1, R1, #8\n"
+		"LDMIA   R1, {R2-R4}\n"
+		"STMIA   R6, {R2-R4}\n"
+		"BL      sub_FF8B48B4\n" // LOCATION: ExpDrv.c:0
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"LDR     R1, [R0,#0x7C]\n"
+		"LDR     R3, [R0,#0x88]\n"
+		"LDR     R2, [R0,#0x8C]\n"
+		"ADD     R0, R0, #4\n"
+		"BLX     R3\n"
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"BL      sub_FF8B4BA4\n" // LOCATION: ExpDrv.c:0
+		"B       loc_FF8B6D90\n"
+
+		"loc_FF8B6B58:\n"
+		"ADD     R1, R0, #4\n"
+		"LDMIA   R1, {R2,R3,R12}\n"
+		"STMIA   R6, {R2,R3,R12}\n"
+		"LDR     R1, [R0]\n"
+		"CMP     R1, #0x24\n"
+		"ADDLS   PC, PC, R1,LSL#2\n"
+		"B       loc_FF8B6D70\n"
+
+		"loc_FF8B6B74:\n"
+		"B       loc_FF8B6C08\n"
+
+		"loc_FF8B6B78:\n"
+		"B       loc_FF8B6C08\n"
+
+		"loc_FF8B6B7C:\n"
+		"B       loc_FF8B6C58\n"
+
+		"loc_FF8B6B80:\n"
+		"B       loc_FF8B6C60\n"
+
+		"loc_FF8B6B84:\n"
+		"B       loc_FF8B6C60\n"
+
+		"loc_FF8B6B88:\n"
+		"B       loc_FF8B6C60\n"
+
+		"loc_FF8B6B8C:\n"
+		"B       loc_FF8B6C08\n"
+
+		"loc_FF8B6B90:\n"
+		"B       loc_FF8B6C58\n"
+
+		"loc_FF8B6B94:\n"
+		"B       loc_FF8B6C60\n"
+
+		"loc_FF8B6B98:\n"
+		"B       loc_FF8B6C60\n"
+
+		"loc_FF8B6B9C:\n"
+		"B       loc_FF8B6C78\n"
+
+		"loc_FF8B6BA0:\n"
+		"B       loc_FF8B6C78\n"
+
+		"loc_FF8B6BA4:\n"
+		"B       loc_FF8B6D64\n"
+
+		"loc_FF8B6BA8:\n"
+		"B       loc_FF8B6D6C\n"
+
+		"loc_FF8B6BAC:\n"
+		"B       loc_FF8B6D6C\n"
+
+		"loc_FF8B6BB0:\n"
+		"B       loc_FF8B6D6C\n"
+
+		"loc_FF8B6BB4:\n"
+		"B       loc_FF8B6D6C\n"
+
+		"loc_FF8B6BB8:\n"
+		"B       loc_FF8B6D70\n"
+
+		"loc_FF8B6BBC:\n"
+		"B       loc_FF8B6D70\n"
+
+		"loc_FF8B6BC0:\n"
+		"B       loc_FF8B6D70\n"
+
+		"loc_FF8B6BC4:\n"
+		"B       loc_FF8B6D70\n"
+
+		"loc_FF8B6BC8:\n"
+		"B       loc_FF8B6D70\n"
+
+		"loc_FF8B6BCC:\n"
+		"B       loc_FF8B6C68\n"
+
+		"loc_FF8B6BD0:\n"
+		"B       loc_FF8B6C70\n"
+
+		"loc_FF8B6BD4:\n"
+		"B       loc_FF8B6C70\n"
+
+		"loc_FF8B6BD8:\n"
+		"B       loc_FF8B6C84\n"
+
+		"loc_FF8B6BDC:\n"
+		"B       loc_FF8B6C84\n"
+
+		"loc_FF8B6BE0:\n"
+		"B       loc_FF8B6C8C\n"
+
+		"loc_FF8B6BE4:\n"
+		"B       loc_FF8B6CBC\n"
+
+		"loc_FF8B6BE8:\n"
+		"B       loc_FF8B6CEC\n"
+
+		"loc_FF8B6BEC:\n"
+		"B       loc_FF8B6D1C\n"
+
+		"loc_FF8B6BF0:\n"
+		"B       loc_FF8B6D4C\n"
+
+		"loc_FF8B6BF4:\n"
+		"B       loc_FF8B6D4C\n"
+
+		"loc_FF8B6BF8:\n"
+		"B       loc_FF8B6D70\n"
+
+		"loc_FF8B6BFC:\n"
+		"B       loc_FF8B6D70\n"
+
+		"loc_FF8B6C00:\n"
+		"B       loc_FF8B6D54\n"
+
+		"loc_FF8B6C04:\n"
+		"B       loc_FF8B6D5C\n"
+
+		"loc_FF8B6C08:\n"
+		// jumptable FF8B6B6C entries 0,1,6
+		"BL      sub_FF8B3784\n" // LOCATION: ExpDrv.c:800
+		"B       loc_FF8B6D70\n"
+
+		"loc_FF8B6C58:\n"
+		// jumptable FF8B6B6C entries 2,7
+		"BL      sub_FF8B3A14\n" // LOCATION: ExpDrv.c:0
+		"B       loc_FF8B6D70\n"
+
+		"loc_FF8B6C60:\n"
+		// jumptable FF8B6B6C entries 3-5,8,9
+		"BL      sub_FF8B3C18\n" // LOCATION: ExpDrv.c:0
+		"B       loc_FF8B6D70\n"
+
+		"loc_FF8B6C68:\n"
+		// jumptable FF8B6B6C entry 22
+		"BL      sub_FF8B3E80\n" // LOCATION: ExpDrv.c:2
+		"B       loc_FF8B6D70\n"
+
+		"loc_FF8B6C70:\n"
+		// jumptable FF8B6B6C entries 23,24
+		"BL      sub_FF8B4074\n" // LOCATION: ExpDrv.c:11
+		"B       loc_FF8B6D70\n"
+
+		"loc_FF8B6C78:\n"
+		// jumptable FF8B6B6C entries 10,11
+		//"BL      sub_FF8B42DC\n" // LOCATION: ExpDrv.c:2
+		"BL      sub_FF8B42DC_my\n" //------------>
+		"MOV     R4, #0\n"
+		"B       loc_FF8B6D70\n"
+
+		"loc_FF8B6C84:\n"
+		// jumptable FF8B6B6C entries 25,26
+		"BL      sub_FF8B4418\n"
+		"B       loc_FF8B6D70\n"
+
+		"loc_FF8B6C8C:\n"
+		// jumptable FF8B6B6C entry 27
+		"LDRH    R1, [R0,#4]\n"
+		"STRH    R1, [SP,#0x38-0x28]\n"
+		"LDRH    R1, [R5,#2]\n"
+		"STRH    R1, [SP,#0x38-0x26]\n"
+		"LDRH    R1, [R5,#4]\n"
+		"STRH    R1, [SP,#0x38-0x24]\n"
+		"LDRH    R1, [R5,#6]\n"
+		"STRH    R1, [SP,#0x38-0x22]\n"
+		"LDRH    R1, [R0,#0xC]\n"
+		"STRH    R1, [SP,#0x38-0x20]\n"
+		"BL      sub_FF8B7B44\n" // LOCATION: ExpDrv.c:2
+		"B       loc_FF8B6D70\n"
+
+		"loc_FF8B6CBC:\n"
+		// jumptable FF8B6B6C entry 28
+		"LDRH    R1, [R0,#4]\n"
+		"STRH    R1, [SP,#0x38-0x28]\n"
+		"LDRH    R1, [R5,#2]\n"
+		"STRH    R1, [SP,#0x38-0x26]\n"
+		"LDRH    R1, [R5,#4]\n"
+		"STRH    R1, [SP,#0x38-0x24]\n"
+		"LDRH    R1, [R5,#6]\n"
+		"STRH    R1, [SP,#0x38-0x22]\n"
+		"LDRH    R1, [R5,#8]\n"
+		"STRH    R1, [SP,#0x38-0x20]\n"
+		"BL      sub_FF8B7CC0\n" // LOCATION: ExpDrv.c:2
+		"B       loc_FF8B6D70\n"
+
+		"loc_FF8B6CEC:\n"
+		// jumptable FF8B6B6C entry 29
+		"LDRH    R1, [R5]\n"
+		"STRH    R1, [SP,#0x38-0x28]\n"
+		"LDRH    R1, [R0,#6]\n"
+		"STRH    R1, [SP,#0x38-0x26]\n"
+		"LDRH    R1, [R5,#4]\n"
+		"STRH    R1, [SP,#0x38-0x24]\n"
+		"LDRH    R1, [R5,#6]\n"
+		"STRH    R1, [SP,#0x38-0x22]\n"
+		"LDRH    R1, [R5,#8]\n"
+		"STRH    R1, [SP,#0x38-0x20]\n"
+		"BL      sub_FF8B7D6C\n" // LOCATION: ExpDrv.c:0
+		"B       loc_FF8B6D70\n"
+
+		"loc_FF8B6D1C:\n"
+		// jumptable FF8B6B6C entry 30
+		"LDRH    R1, [R5]\n"
+		"STRH    R1, [SP,#0x38-0x28]\n"
+		"LDRH    R1, [R5,#2]\n"
+		"STRH    R1, [SP,#0x38-0x26]\n"
+		"LDRH    R1, [R5,#4]\n"
+		"STRH    R1, [SP,#0x38-0x24]\n"
+		"LDRH    R1, [R5,#6]\n"
+		"STRH    R1, [SP,#0x38-0x22]\n"
+		"LDRH    R1, [R0,#0xC]\n"
+		"STRH    R1, [SP,#0x38-0x20]\n"
+		"BL      sub_FF8B7E0C\n" // LOCATION: ExpDrv.c:32
+		"B       loc_FF8B6D70\n"
+
+		"loc_FF8B6D4C:\n"
+		// jumptable FF8B6B6C entries 31,32
+		"BL      sub_FF8B468C\n" // LOCATION: ExpDrv.c:0
+		"B       loc_FF8B6D70\n"
+
+		"loc_FF8B6D54:\n"
+		// jumptable FF8B6B6C entry 35
+		"BL      sub_FF8B4CA8\n" // LOCATION: ExpDrv.c:10
+		"B       loc_FF8B6D70\n"
+
+		"loc_FF8B6D5C:\n"
+		// jumptable FF8B6B6C entry 36
+		"BL      sub_FF8B4EE0\n" // LOCATION: ExpDrv.c:0
+		"B       loc_FF8B6D70\n"
+
+		"loc_FF8B6D64:\n"
+		// jumptable FF8B6B6C entry 12
+		"BL      sub_FF8B5058\n" // LOCATION: ExpDrv.c:2
+		"B       loc_FF8B6D70\n"
+
+		"loc_FF8B6D6C:\n"
+		// jumptable FF8B6B6C entries 13-16
+		"BL      sub_FF8B51F0\n" // LOCATION: ExpDrv.c:128
+
+		"loc_FF8B6D70:\n"
+		// jumptable FF8B6B6C default entry
+		// jumptable FF8B6B6C entries 17-21,33,34
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"LDR     R1, [R0,#0x7C]\n"
+		"LDR     R3, [R0,#0x88]\n"
+		"LDR     R2, [R0,#0x8C]\n"
+		"ADD     R0, R0, #4\n"
+		"BLX     R3\n"
+		"CMP     R4, #1\n"
+		"BNE     loc_FF8B6DD8\n"
+
+		"loc_FF8B6D90:\n"
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"MOV     R2, #0xC\n"
+		"LDR     R1, [R0,#0x7C]\n"
+		"ADD     R1, R1, R1,LSL#1\n"
+		"ADD     R0, R0, R1,LSL#2\n"
+		"SUB     R4, R0, #8\n"
+		"LDR     R0, =0x3E198\n"
+		"ADD     R1, SP, #0x38-0x28\n"
+		"BL      sub_FFAAD774\n"
+		"LDR     R0, =0x3E1A4\n"
+		"MOV     R2, #0xC\n"
+		"ADD     R1, SP, #0x38-0x28\n"
+		"BL      sub_FFAAD774\n"
+		"LDR     R0, =0x3E1B0\n"
+		"MOV     R2, #0xC\n"
+		"MOV     R1, R4\n"
+		"BL      sub_FFAAD774\n"
+		"B       loc_FF8B6E50\n"
+
+		"loc_FF8B6DD8:\n"
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"LDR     R0, [R0]\n"
+		"CMP     R0, #0xB\n"
+		"BNE     loc_FF8B6E20\n"
+		"MOV     R3, #0\n"
+		"STR     R3, [SP,#0x38-0x38]\n"
+		"MOV     R3, #1\n"
+		"MOV     R2, #1\n"
+		"MOV     R1, #1\n"
+		"MOV     R0, #0\n"
+		"BL      sub_FF8B358C\n"
+		"MOV     R3, #0\n"
+		"STR     R3, [SP,#0x38-0x38]\n"
+		"MOV     R3, #1\n"
+		"MOV     R2, #1\n"
+		"MOV     R1, #1\n"
+		"MOV     R0, #0\n"
+		"B       loc_FF8B6E4C\n"
+
+		"loc_FF8B6E20:\n"
+		"MOV     R3, #1\n"
+		"MOV     R2, #1\n"
+		"MOV     R1, #1\n"
+		"MOV     R0, #1\n"
+		"STR     R3, [SP,#0x38-0x38]\n"
+		"BL      sub_FF8B358C\n"
+		"MOV     R3, #1\n"
+		"MOV     R2, #1\n"
+		"MOV     R1, #1\n"
+		"MOV     R0, #1\n"
+		"STR     R3, [SP,#0x38-0x38]\n"
+
+		"loc_FF8B6E4C:\n"
+		"BL      sub_FF8B36CC\n"
+
+		"loc_FF8B6E50:\n"
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"BL      sub_FF8B7AD0\n" // LOCATION: ExpDrv.c:268
+		"B       loc_FF8B6884\n"
+		);
+}
+
+void __attribute__((naked,noinline)) sub_FF8B42DC_my()
+{
+	asm volatile (
+		"STMFD   SP!, {R4-R8,LR}\n"
+		"LDR     R7, =0x6E30\n"
+		"MOV     R4, R0\n"
+		"LDR     R0, [R7,#0x1C]\n"
+		"MOV     R1, #0x3E\n"
+		"BL      sub_FF827B40\n"
+		"LDRSH   R0, [R4,#4]\n"
+		"MOV     R2, #0\n"
+		"MOV     R1, #0\n"
+		"BL      sub_FF8B3320\n"
+		"MOV     R6, R0\n"
+		"LDRSH   R0, [R4,#6]\n"
+		"BL      sub_FF8B342C\n"
+		"LDRSH   R0, [R4,#8]\n"
+		"BL      sub_FF8B3484\n"
+		"LDRSH   R0, [R4,#0xA]\n"
+		"BL      sub_FF8B34DC\n"
+		"LDRSH   R0, [R4,#0xC]\n"
+		"BL      sub_FF8B3534\n"
+		"MOV     R5, R0\n"
+		"LDR     R0, [R4]\n"
+		"LDR     R8, =0x3E1B0\n"
+		"CMP     R0, #0xB\n"
+		"MOVEQ   R6, #0\n"
+		"MOVEQ   R5, #0\n"
+		"BEQ     loc_FF8B436C\n"
+		"CMP     R6, #1\n"
+		"BNE     loc_FF8B436C\n"
+		"LDRSH   R0, [R4,#4]\n"
+		"LDR     R1, =0xFF8B328C\n"
+		"MOV     R2, #2\n"
+		"BL      sub_FF92F998\n" // LOCATION: IrisController.c:117
+		"STRH    R0, [R4,#4]\n"
+		"MOV     R0, #0\n"
+		"STR     R0, [R7,#0x28]\n"
+		"B       loc_FF8B4374\n"
+
+		"loc_FF8B436C:\n"
+		"LDRH    R0, [R8]\n"
+		"STRH    R0, [R4,#4]\n"
+
+		"loc_FF8B4374:\n"
+		"CMP     R5, #1\n"
+		"LDRNEH  R0, [R8,#8]\n"
+		"BNE     loc_FF8B4390\n"
+		"LDRSH   R0, [R4,#0xC]\n"
+		"MOV     R2, #0x20\n"
+		"LDR     R1, =0xFF8B3310\n"
+		"BL      sub_FF8B7B00\n"
+
+		"loc_FF8B4390:\n"
+		"STRH    R0, [R4,#0xC]\n"
+		"LDRSH   R0, [R4,#6]\n"
+		//"BL      sub_FF895968\n" // LOCATION: Shutter.c:0
+		"BL      sub_FF895968_my\n" //------------>
+		"LDRSH   R0, [R4,#8]\n"
+		"MOV     R1, #1\n"
+		"BL      sub_FF896164\n" // LOCATION: ImgGain.c:0
+		"MOV     R1, #0\n"
+		"ADD     R0, R4, #8\n"
+		"BL      sub_FF8961EC\n" // LOCATION: ImgGain.c:0
+		"LDRSH   R0, [R4,#0xE]\n"
+		"BL      sub_FF8AA25C\n" // LOCATION: BrtCrct.c:552
+		"LDR     R4, =0xBB8\n"
+		"CMP     R6, #1\n"
+		"BNE     loc_FF8B43E8\n"
+		"LDR     R0, [R7,#0x1C]\n"
+		"MOV     R2, R4\n"
+		"MOV     R1, #2\n"
+		"BL      sub_FF827A44\n" // LOCATION: KerFlag.c:0
+		"TST     R0, #1\n"
+		"LDRNE   R1, =0x532\n"
+		"LDRNE   R0, =0xFF8B399C\n" // "ExpDrv.c"
+		"BLNE    _DebugAssert\n"
+
+		"loc_FF8B43E8:\n"
+		"CMP     R5, #1\n"
+		"LDMNEFD SP!, {R4-R8,PC}\n"
+		"LDR     R0, [R7,#0x1C]\n"
+		"MOV     R2, R4\n"
+		"MOV     R1, #0x20\n"
+		"BL      sub_FF827A44\n" // LOCATION: KerFlag.c:0
+		"TST     R0, #1\n"
+		"LDRNE   R1, =0x537\n"
+		"LDRNE   R0, =0xFF8B399C\n" // "ExpDrv.c"
+		"LDMNEFD SP!, {R4-R8,LR}\n"
+		"BNE     _DebugAssert\n"
+		"LDMFD   SP!, {R4-R8,PC}\n"
+		);
+}
+
+void __attribute__((naked,noinline)) sub_FF895968_my()
+{
+	asm volatile (
+		"STMFD   SP!, {R4-R6,LR}\n"
+		"LDR     R5, =0x68EC\n"
+		"MOV     R4, R0\n"
+		"LDR     R0, [R5,#4]\n"
+		"CMP     R0, #1\n"
+		"LDRNE   R1, =0x16D\n"
+		"LDRNE   R0, =0xFF895700\n" // "Shutter.c"
+		"BLNE    _DebugAssert\n"
+		"CMN     R4, #0xC00\n"
+		"LDREQSH R4, [R5,#2]\n"
+		"CMN     R4, #0xC00\n"
+		"LDREQ   R1, =0x173\n"
+		"LDREQ   R0, =0xFF895700\n" // "Shutter.c"
+		"STRH    R4, [R5,#2]\n"
+		"BLEQ    _DebugAssert\n"
+		"MOV     R0, R4\n"
+		//"BL      sub_FF9B2824\n"
+		"BL      apex2us\n" // +
+		"MOV     R4, R0\n"
+		"BL      sub_FF8C53CC\n" // nullsub_67
+		"MOV     R0, R4\n"
+		"BL      sub_FF8C98BC\n"
+		"TST     R0, #1\n"
+		"LDMNEFD SP!, {R4-R6,LR}\n"
+		"MOVNE   R1, #0x178\n"
+		"LDRNE   R0, =0xFF895700\n" // "Shutter.c"
+		"BNE     _DebugAssert\n"
+		"LDMFD   SP!, {R4-R6,PC}\n"
+		);
+}
Index: /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100b/stubs_entry.S
===================================================================
--- /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100b/stubs_entry.S	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100b/stubs_entry.S	(revision 1668)
@@ -0,0 +1,230 @@
+// !!! THIS FILE IS GENERATED. DO NOT EDIT. !!!
+#include "stubs_asm.h"
+
+// Camera info:
+//   DRYOS R23 (DRYOS version 2.3, release #0023)
+//   Firmware Ver GM1.00B
+//   Canon DIGITAL IXUS 970 IS
+
+// Values for makefile.inc
+//   PLATFORMID = 12659 (0x3173) // Found @ 0xfffe0130
+//   MAXRAMADDR = 0x03ffffff
+//   KEYSYS = d3enc              // Found @ 0xffff33e0
+//   NEED_ENCODED_DISKBOOT = 1   // Found @ 0xffff33c0
+
+// Stubs below should be checked. Stub not matched 100%, or difference found to current 'stubs_entry_2.S'
+//    Name                                     Address      Rule  %  Comp to stubs_entry_2.S
+//NSTUB(DebugAssert                           ,0xff81bcf0) //111        *** != 0xff81bcf8
+//NSTUB(PutInNdFilter                         ,0xffa2ac20) //102        *** != 0xffa838f8
+//NSTUB(PutOutNdFilter                        ,0xffa2ac44) //102        *** != 0xffa8392c
+
+// Check of modemap from 'platform/CAMERA/shooting.c':
+// Firmware modemap table found @ff8790f8 -> ff87589c -> ff95c8b8 -> ffa3eec8 -> ffaf9460
+// No problems found with modemap table.
+
+// Values below can be overridden in 'stubs_min.S':
+DEF(physw_status                            ,0x00010650) // Found @0xff821e38
+DEF(physw_run                               ,0x00001c00) // Found @0xff821ad0
+DEF(levent_table                            ,0xffad3fcc) // Found @0xffad3fcc
+DEF(FlashParamsTable                        ,0xffaf9620) // Found @0xffaf9620
+DEF(movie_status                            ,0x000053cc) // Found @0xff859d78
+DEF(canon_menu_active                       ,0x000099e0) // Found @0xff950198
+DEF(canon_shoot_menu_active                 ,0x00009fd9) // Found @0xff96cd70
+DEF(playrec_mode                            ,0x0000555c) // Found @0xff861170
+DEF(zoom_status                             ,0x0000d4a4) // Found @0xffa406c8
+DEF(some_flag_for_af_scan                   ,0x0000d228) // Found @0xffa2b598
+// focus_len_table contains zoom focus lengths for use in 'get_focal_length' (main.c).
+// each entry contains 3 int value(s), the first is the zoom focus length.
+// there are 12 entries in the table - set NUM_FL to 12
+DEF(focus_len_table                         ,0xfffe297c) // Found @0xfffe297c
+DEF(zoom_busy                               ,0x00008aa0) // Found @0xff932a88
+DEF(focus_busy                              ,0x0000898c) // Found @0xff92e134
+//DEF(recreview_hold                          ,0x00006188) // Found @0xff87eb90, ** != ** stubs_min = 0x00009d98 (0x9CEC+0xAC)
+
+// Values below go in 'lib.c':
+//void *vid_get_bitmap_fb()        { return (void*)0x10361000; }             // Found @0xff83e8a0
+//void *vid_get_viewport_fb()      { return (void*)0x1065adc0; }             // Found @0xffa88afc
+//void *vid_get_viewport_fb_d()    { return (void*)(*(int*)(0x51fc+0x50)); } // Found @0xff853078 & 0xff8530b0
+//char *camera_jpeg_count_str()    { return (char*)0x0004ca80; }             // Found @0xff9a6fdc
+//long hook_raw_size()             { return 0x00ec04f0; }                    // Found @0xffa8ad80
+//int get_flash_params_count(void) { return 0x73; }                          // Found @0xff95d974
+
+// Bitmap masks and physw_status index values for SD_READONLY and USB power flags (for kbd.c).
+//#define SD_READONLY_FLAG    0x00020000 // Found @0xffab1630, levent 0x90a
+//#define SD_READONLY_IDX     2
+//#define USB_MASK            0x00040000 // Found @0xffab163c, levent 0x902
+//#define USB_IDX             2
+
+// Keymap values for kbd.c. Additional keys may be present, only common values included here.
+//static KeyMap keymap[] = {
+//    { 2, KEY_ZOOM_IN         ,0x00000004 }, // Found @0xffab15a0, levent 0x02
+//    { 2, KEY_ZOOM_OUT        ,0x00000008 }, // Found @0xffab15ac, levent 0x03
+//    { 2, KEY_LEFT            ,0x00000010 }, // Found @0xffab15b8, levent 0x06
+//    { 2, KEY_RIGHT           ,0x00000020 }, // Found @0xffab15c4, levent 0x07
+//    { 2, KEY_DOWN            ,0x00000040 }, // Found @0xffab15d0, levent 0x05
+//    { 2, KEY_UP              ,0x00000080 }, // Found @0xffab15dc, levent 0x04
+//    { 2, KEY_SET             ,0x00000100 }, // Found @0xffab15e8, levent 0x08
+//    { 2, KEY_DISPLAY         ,0x00000200 }, // Found @0xffab15f4, levent 0x0a
+//    { 2, KEY_SHOOT_FULL      ,0x00000003 }, // Found @0xffab1594, levent 0x01
+//    { 2, KEY_SHOOT_FULL_ONLY ,0x00000002 }, // Found @0xffab1594, levent 0x01
+//    { 2, KEY_MENU            ,0x00000400 }, // Found @0xffab1600, levent 0x09
+//    { 2, KEY_SHOOT_HALF      ,0x00000001 }, // Found @0xffab1588, levent 0x00
+//    { 0, 0, 0 }
+//};
+
+// Values below go in 'platform_camera.h':
+//#define CAM_DRYOS         1
+//#define CAM_RAW_ROWPIX    3720 // Found @0xffa8251c
+//#define CAM_RAW_ROWS      2772 // Found @0xffa82524
+//#undef  CAM_UNCACHED_BIT
+//#define CAM_UNCACHED_BIT  0x10000000 // Found @0xff8285a8
+
+// Misc stuff
+DEF(ctypes, 0xffab10fe)
+
+// For capt_seq.c
+//static long *nrflag = (long*)(0x91a4);       // Found @ ff93db9c
+
+// Stubs below matched 100%.
+//    Name                                     Address                Comp to stubs_entry_2.S
+NSTUB(AllocateMemory                          ,0xffa2e430) //101
+NSTUB(AllocateUncacheableMemory               ,0xff82856c) //112
+NSTUB(Close                                   ,0xff823d90) //101
+NSTUB(CreateTask                              ,0xff81b818) //101
+NSTUB(DeleteDirectory_Fut                     ,0xff823720) //  1
+NSTUB(DeleteFile_Fut                          ,0xff82363c) //112
+NSTUB(DoAFLock                                ,0xff825b88) //102
+NSTUB(EnterToCompensationEVF                  ,0xff825e84) //104
+NSTUB(ExecuteEventProcedure                   ,0xff869408) //  1
+NSTUB(ExitFromCompensationEVF                 ,0xff825ed4) //104
+NSTUB(ExitTask                                ,0xff81baa8) //101
+NSTUB(ExpCtrlTool_StartContiAE                ,0xff832b04) //104
+NSTUB(ExpCtrlTool_StopContiAE                 ,0xff832c48) //104
+NSTUB(Fclose_Fut                              ,0xff8237b8) //101
+NSTUB(Feof_Fut                                ,0xff8239a4) //  1
+NSTUB(Fflush_Fut                              ,0xff8239e0) //  1
+NSTUB(Fgets_Fut                               ,0xff82390c) //  1
+NSTUB(Fopen_Fut                               ,0xff823778) //101
+NSTUB(Fread_Fut                               ,0xff823864) //101
+NSTUB(FreeMemory                              ,0xffa2e428) //101
+NSTUB(FreeUncacheableMemory                   ,0xff8285a0) //112
+NSTUB(Fseek_Fut                               ,0xff823958) //101
+NSTUB(Fwrite_Fut                              ,0xff8238b8) //101
+NSTUB(GetBatteryTemperature                   ,0xff8453a0) //102
+NSTUB(GetCCDTemperature                       ,0xff845330) //102
+NSTUB(GetCurrentAvValue                       ,0xff92fb48) //102
+NSTUB(GetDrive_ClusterSize                    ,0xff84f2c0) //  1
+NSTUB(GetDrive_FreeClusters                   ,0xff84f328) //  1
+NSTUB(GetDrive_TotalClusters                  ,0xff84f2f4) //  1
+NSTUB(GetFocusLensSubjectDistance             ,0xff92ec40) //102
+NSTUB(GetFocusLensSubjectDistanceFromLens     ,0xff92ef4c) //  1
+NSTUB(GetKbdState                             ,0xff8428e8) //109
+NSTUB(GetMemInfo                              ,0xff813c40) //  1
+NSTUB(GetOpticalTemperature                   ,0xff845410) //102
+NSTUB(GetParameterData                        ,0xff95d934) //101
+NSTUB(GetPropertyCase                         ,0xff86d008) //102
+NSTUB(GetSystemTime                           ,0xffa2e488) //101
+NSTUB(GetZoomLensCurrentPoint                 ,0xff932dec) //102
+NSTUB(GetZoomLensCurrentPosition              ,0xffa244d8) //102
+NSTUB(GiveSemaphore                           ,0xff81b77c) //112
+NSTUB(IsStrobeChargeCompleted                 ,0xff8bda04) //102
+NSTUB(LEDDrive                                ,0xff84206c) //103
+NSTUB(LocalTime                               ,0xff866acc) //  1
+NSTUB(LockMainPower                           ,0xff8754b4) //103
+NSTUB(Lseek                                   ,0xff823ed0) //101
+NSTUB(MakeDirectory_Fut                       ,0xff8236b0) //  1
+NSTUB(MoveFocusLensToDistance                 ,0xffa85638) //102
+NSTUB(MoveIrisWithAv                          ,0xffa2a838) //102
+NSTUB(MoveZoomLensWithPoint                   ,0xffa2adbc) //102
+NSTUB(NewTaskShell                            ,0xff86cacc) //103
+NSTUB(Open                                    ,0xff823d68) //101
+NSTUB(PB2Rec                                  ,0xff8784d0) //104
+NSTUB(PT_MoveDigitalZoomToWide                ,0xff85bbe4) //102
+NSTUB(PT_MoveOpticalZoomAt                    ,0xff85bbbc) //102
+NSTUB(PT_PlaySound                            ,0xff85b240) //102
+NSTUB(PostLogicalEventForNotPowerType         ,0xff873274) //103
+NSTUB(PostLogicalEventToUI                    ,0xff8732c0) //103
+NSTUB(Read                                    ,0xff81a094) //101
+NSTUB(ReadFastDir                             ,0xffa13500) //  1
+NSTUB(Rec2PB                                  ,0xff876ed4) //104
+NSTUB(RefreshPhysicalScreen                   ,0xff9b12e8) //104
+NSTUB(Remove                                  ,0xff823dd8) //  1
+NSTUB(RenameFile_Fut                          ,0xff8235e8) //  1
+NSTUB(Restart                                 ,0xff829de4) //106
+NSTUB(SetAE_ShutterSpeed                      ,0xffa87d0c) //102
+NSTUB(SetAutoShutdownTime                     ,0xff875528) //103
+NSTUB(SetCurrentCaptureModeType               ,0xff87c334) //101
+NSTUB(SetFileAttributes                       ,0xff8240bc) //  1
+NSTUB(SetFileTimeStamp                        ,0xff82406c) //  1
+NSTUB(SetLogicalEventActive                   ,0xff875194) //  1
+NSTUB(SetParameterData                        ,0xff95d8a4) //101
+NSTUB(SetPropertyCase                         ,0xff86cf08) //102
+NSTUB(SetScriptMode                           ,0xff8751e4) //101
+NSTUB(SleepTask                               ,0xff8283f0) //101
+NSTUB(TakeSemaphore                           ,0xff81b6ac) //101
+NSTUB(TurnOffBackLight                        ,0xff881d28) //104
+NSTUB(TurnOnBackLight                         ,0xff881d10) //104
+NSTUB(UIFS_WriteFirmInfoToFile                ,0xff9510f4) //103
+NSTUB(UnlockAF                                ,0xff825bcc) //102
+NSTUB(UnlockMainPower                         ,0xff875408) //103
+NSTUB(UnsetZoomForMovie                       ,0xff962ed0) //104
+NSTUB(UpdateMBROnFlash                        ,0xff84f100) //105
+NSTUB(VbattGet                                ,0xff82071c) //103
+NSTUB(Write                                   ,0xff823e3c) //101
+NSTUB(WriteSDCard                             ,0xff9227e0) //108
+NSTUB(_log                                    ,0xffaaebb8) //111
+NSTUB(_log10                                  ,0xffaadafc) //112
+NSTUB(_pow                                    ,0xffaadc6c) //114
+NSTUB(_sqrt                                   ,0xffaaffd8) //  1
+NSTUB(add_ptp_handler                         ,0xff9e1b24) //  1
+NSTUB(apex2us                                 ,0xff9b2824) //  4
+NSTUB(close                                   ,0xff819eac) //  1
+NSTUB(closedir                                ,0xffa135d0) //  1
+NSTUB(err_init_task                           ,0xff814e98) //  4
+NSTUB(exmem_alloc                             ,0xff867bf0) //103
+NSTUB(free                                    ,0xff813a98) //112
+NSTUB(kbd_p1_f                                ,0xff821f3c) //109
+NSTUB(kbd_p1_f_cont                           ,0xff821f48) //109
+NSTUB(kbd_p2_f                                ,0xff821770) //109
+NSTUB(kbd_pwr_off                             ,0xff84296c) //  2
+NSTUB(kbd_pwr_on                              ,0xff84291c) //  2
+NSTUB(kbd_read_keys                           ,0xff821e38) //109
+NSTUB(kbd_read_keys_r2                        ,0xff842494) //109
+NSTUB(lseek                                   ,0xff823ed0) //101
+NSTUB(malloc                                  ,0xff8139c4) //112
+NSTUB(memcmp                                  ,0xff81d844) //101
+NSTUB(memcpy                                  ,0xff8943a4) //101
+NSTUB(memset                                  ,0xff9b169c) //101
+NSTUB(mkdir                                   ,0xff824134) //  1
+// ALT: NSTUB(mkdir, 0xff8241d4) // 1 32/0
+NSTUB(mktime_ext                              ,0xff894c10) //  1
+NSTUB(open                                    ,0xff819dfc) //  1
+NSTUB(opendir                                 ,0xffa1346c) //  1
+NSTUB(openfastdir                             ,0xffa1346c) //  1
+NSTUB(qsort                                   ,0xff9b1ba4) //  1
+NSTUB(rand                                    ,0xff81d94c) //  1
+NSTUB(read                                    ,0xff81a094) //101
+NSTUB(reboot_fw_update                        ,0xffa1af00) //  5
+NSTUB(rename                                  ,0xff8235e8) //  1
+NSTUB(set_control_event                       ,0xff874e10) //  1
+NSTUB(srand                                   ,0xff81d940) //  1
+NSTUB(stat                                    ,0xff823f9c) //  1
+NSTUB(strcat                                  ,0xff894190) //  1
+NSTUB(strchr                                  ,0xff894218) //  1
+NSTUB(strcmp                                  ,0xff81d7dc) //101
+NSTUB(strcpy                                  ,0xff81d7c4) //101
+NSTUB(strftime                                ,0xff894618) //  1
+NSTUB(strlen                                  ,0xff81d820) //101
+NSTUB(strncmp                                 ,0xff8941cc) //  1
+NSTUB(strncpy                                 ,0xff82e200) //  1
+NSTUB(strrchr                                 ,0xff89423c) //  1
+NSTUB(strtol                                  ,0xff82e438) //101
+NSTUB(strtolx                                 ,0xff82e23c) //109
+  DEF(task_CaptSeq                            ,0xff85e03c) //107
+  DEF(task_ExpDrv                             ,0xff8b6864) //110
+  DEF(task_InitFileModules                    ,0xff878f84) //107
+  DEF(task_MovieRecord                        ,0xff85a004) //107
+  DEF(task_PhySw                              ,0xff821acc) //107
+NSTUB(time                                    ,0xff866fd0) //  2
+NSTUB(vsprintf                                ,0xff81d744) //  1
+NSTUB(write                                   ,0xff823e3c) //101
Index: /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100b/stubs_entry_2.S
===================================================================
--- /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100b/stubs_entry_2.S	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100b/stubs_entry_2.S	(revision 1668)
@@ -0,0 +1,33 @@
+#include "stubs_asm.h"
+#define NULL_SUB 0xFF810948
+
+// Override stubs_entry.S
+NHSTUB(DebugAssert,                 0xFF81BCF8)
+NHSTUB(PutInNdFilter,               0xFFA838F8)
+NHSTUB(PutOutNdFilter,              0xFFA8392C)
+
+// These don't exist
+NHSTUB(SetZoomActuatorSpeedPercent, NULL_SUB)
+
+// Additional
+NHSTUB(CreateController,            0xFF872AB8)
+NHSTUB(GetAEIntegralServiceMode_0,  0xFF82ADA4)
+NHSTUB(GetVRAMHPixelsSize_0,        0xFF85CF50)
+NHSTUB(GetVRAMHPixelsSize_1,        0xFF87AC5C)
+NHSTUB(IsControlEventActive,        0xFF875124)
+NHSTUB(IsFactoryMode,               0xFF84630C)
+NHSTUB(KernelCreateTask,            0xFF81BAF0)
+NHSTUB(PT_GetPropertyCaseString,    0xFF86CF08)
+NHSTUB(PT_SetPropertyCaseString,    0xFF86D008)
+NHSTUB(PTM_GetCurrentItem,          0xFF875DE8)
+NHSTUB(PTM_SetCurrentCaptureMode,   0xFF875CC0)
+NHSTUB(RestartDevice,               0xFF829DE4)
+NHSTUB(StartDiskboot,               0xFF829FA8)
+NHSTUB(StartFactoryModeController,  0xFF84637C)
+NHSTUB(StartGUISystem,              0xFF894044)
+NHSTUB(j_PTM_SetCurrentItem,        0xFF95CEF4)
+NHSTUB(taskcreate_CommonDrivers,    0xFF879010)
+NHSTUB(taskcreate_DSITask,          0xFF880B18)
+NHSTUB(taskcreate_FaceFrame,        0xFF8808BC)
+NHSTUB(taskcreate_StartupImage,     0xFF82A4EC)
+NHSTUB(taskcreate_TempCheck,        0xFF820EAC)
Index: /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100b/boot.c
===================================================================
--- /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100b/boot.c	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100b/boot.c	(revision 1668)
@@ -0,0 +1,646 @@
+#include "lolevel.h"
+#include "platform.h"
+#include "core.h"
+
+const char * const new_sa = &_end;
+
+void __attribute__((naked,noinline)) jogdial_task_my();
+
+void taskCreateHook(int *p)
+{
+	p-=16;
+	if (p[0]==0xFF821ACC)  p[0]=(int)mykbd_task;
+	if (p[0]==0xFF842A44)  p[0]=(int)jogdial_task_my; 
+	if (p[0]==0xFF85A004)  p[0]=(int)movie_record_task;
+	if (p[0]==0xFF85E03C)  p[0]=(int)capt_seq_task;
+	if (p[0]==0xFF878F84)  p[0]=(int)init_file_modules_task;
+	if (p[0]==0xFF8B6864)  p[0]=(int)exp_drv_task;
+}
+
+void CreateTask_spytask()
+{
+	_CreateTask("SpyTask", 0x19, 0x2000, core_spytask, 0);
+}
+
+void boot()
+{
+	long *canon_data_src = (void*)0xFFB1E3B0;
+	long *canon_data_dst = (void*)0x1900;
+	long canon_data_len = 0xF160 - 0x1900; // data_end - data_start
+	long *canon_bss_start = (void*)0xF160; // just after data
+	long canon_bss_len = 0xCBD40 - 0xF160;
+
+	long i;
+
+	// enable caches and write buffer
+	asm volatile (
+		"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;
+
+	// Captain Hook
+	*(int*)0x1930 = (int)taskCreateHook;
+
+	// jump to init-sequence that follows the data-copy-routine
+	asm volatile ("B  sub_FF8101A4_my\n");
+}
+
+void __attribute__((naked,noinline)) sub_FF8101A4_my()
+{
+	asm volatile (
+		"LDR     R0, =0xFF81021C\n" // exception handler code
+		"MOV     R1, #0\n"
+		"LDR     R3, =0xFF810254\n"
+
+		"loc_FF8101B0:\n"
+		"CMP     R0, R3\n" // load exception vector
+		"LDRCC   R2, [R0],#4\n"
+		"STRCC   R2, [R1],#4\n"
+		"BCC     loc_FF8101B0\n"
+		"LDR     R0, =0xFF810254\n"
+		"MOV     R1, #0x4B0\n"
+		"LDR     R3, =0xFF810468\n"
+
+		"loc_FF8101CC:\n"
+		"CMP     R0, R3\n" // copy IRQ handler to ITCM starting at 0x4b0, 532 bytes up to 0x6C4
+		"LDRCC   R2, [R0],#4\n"
+		"STRCC   R2, [R1],#4\n"
+		"BCC     loc_FF8101CC\n"
+		"MOV     R0, #0xD2\n"
+		"MSR     CPSR_cxsf, R0\n" // set CPSR mode = IRQ, ints disabled
+		"MOV     SP, #0x1000\n" // irq mode SP
+		"MOV     R0, #0xD3\n"
+		"MSR     CPSR_cxsf, R0\n" // set CPSR mode = Super, ints disabled
+		"MOV     SP, #0x1000\n" // super mode SP
+		//"LDR     R0, loc_FF810210\n"
+		"LDR     R0, =0x6C4\n" // +
+		"LDR     R2, =0xEEEEEEEE\n"
+		"MOV     R3, #0x1000\n"
+
+		"loc_FF810200:\n"
+		"CMP     R0, R3\n" // clear ITCM 0x6C4-end with EEEEEEEE
+		"STRCC   R2, [R0],#4\n"
+		"BCC     loc_FF810200\n"
+		"BL      sub_FF810FA0_my\n" //------------->
+		);
+}
+
+void __attribute__((naked,noinline)) sub_FF810FA0_my()
+{
+	asm volatile (
+		"STR     LR, [SP,#-4]!\n"
+		"SUB     SP, SP, #0x74\n"
+		"MOV     R0, SP\n"
+		"MOV     R1, #0x74\n"
+		"BL      sub_FFAAD8FC\n"
+		"MOV     R0, #0x53000\n"
+		"STR     R0, [SP,#0x74-0x70]\n"
+		//"LDR     R0, =0xCBD40\n"
+		"LDR     R0, =new_sa\n" // +
+		"LDR     R0, [R0]\n" // +
+		"LDR     R2, =0x279C00\n"
+		"LDR     R1, =0x272968\n"
+		"STR     R0, [SP,#0x74-0x6C]\n"
+		"SUB     R0, R1, R0\n"
+		"ADD     R3, SP, #0x74-0x68\n"
+		"STR     R2, [SP,#0x74-0x74]\n"
+		"STMIA   R3, {R0-R2}\n"
+		"MOV     R0, #0x22\n"
+		"STR     R0, [SP,#0x74-0x5C]\n"
+		"MOV     R0, #0x68\n"
+		"STR     R0, [SP,#0x74-0x58]\n"
+		"LDR     R0, =0x19B\n"
+		"MOV     R1, #0x64\n"
+		"STRD    R0, [SP,#0x74-0x54]\n"
+		"MOV     R0, #0x78\n"
+		"STRD    R0, [SP,#0x74-0x4C]\n"
+		"MOV     R0, #0\n"
+		"STR     R0, [SP,#0x74-0x44]\n"
+		"STR     R0, [SP,#0x74-0x40]\n"
+		"MOV     R0, #0x10\n"
+		"STR     R0, [SP,#0x74-0x18]\n"
+		"MOV     R0, #0x800\n"
+		"STR     R0, [SP,#0x74-0x14]\n"
+		"MOV     R0, #0xA0\n"
+		"STR     R0, [SP,#0x74-0x10]\n"
+		"MOV     R0, #0x280\n"
+		"STR     R0, [SP,#0x74-0xC]\n"
+		//"LDR     R1, =0xFF814DA4\n"
+		"LDR     R1, =uHwSetup_my\n" //------------->
+		"MOV     R0, SP\n"
+		"MOV     R2, #0\n"
+		"BL      sub_FF812D58\n"
+		"ADD     SP, SP, #0x74\n"
+		"LDR     PC, [SP],#4\n"
+		);
+}
+
+// Extracted method: uHwSetup (FF814DA4)
+void __attribute__((naked,noinline)) uHwSetup_my()
+{
+	asm volatile (
+		"STMFD   SP!, {R4,LR}\n"
+		"BL      sub_FF81094C\n"
+		"BL      sub_FF819664\n"
+		"CMP     R0, #0\n"
+		"LDRLT   R0, =0xFF814EB8\n" // "dmSetup"
+		"BLLT    sub_FF814E98\n"
+		"BL      sub_FF8149C8\n"
+		"CMP     R0, #0\n"
+		"LDRLT   R0, =0xFF814EC0\n" // "termDriverInit"
+		"BLLT    sub_FF814E98\n"
+		"LDR     R0, =0xFF814ED0\n" // "/_term"
+		"BL      sub_FF814AB4\n"
+		"CMP     R0, #0\n"
+		"LDRLT   R0, =0xFF814ED8\n" // "termDeviceCreate"
+		"BLLT    sub_FF814E98\n"
+		"LDR     R0, =0xFF814ED0\n" // "/_term"
+		"BL      sub_FF813564\n"
+		"CMP     R0, #0\n"
+		"LDRLT   R0, =0xFF814EEC\n" // "stdioSetup"
+		"BLLT    sub_FF814E98\n"
+		"BL      sub_FF8191EC\n"
+		"CMP     R0, #0\n"
+		"LDRLT   R0, =0xFF814EF8\n" // "stdlibSetup"
+		"BLLT    sub_FF814E98\n"
+		"BL      sub_FF8114B8\n"
+		"CMP     R0, #0\n"
+		"LDRLT   R0, =0xFF814F04\n" // "armlib_setup"
+		"BLLT    sub_FF814E98\n"
+		"LDMFD   SP!, {R4,LR}\n"
+		"B       taskcreate_Startup_my\n" //------------->
+		);
+}
+
+// Extracted method: taskcreate_Startup (FF81CCBC)
+void __attribute__((naked,noinline)) taskcreate_Startup_my()
+{
+	asm volatile (
+		"STMFD   SP!, {R3,LR}\n"
+		"BL      sub_FF821BF0\n" // j_nullsub_214
+		"BL      sub_FF829EE0\n"
+		"CMP     R0, #0\n"
+		"BNE     loc_FF81CCEC\n"
+		"BL      sub_FF821BEC\n"
+		"CMP     R0, #0\n"
+		"BNE     loc_FF81CCEC\n"
+		"LDR     R1, =0xC0220000\n"
+		"MOV     R0, #0x44\n"
+		"STR     R0, [R4,#0x4C]\n"
+
+		"loc_FF81CCE8:\n"
+		"B       loc_FF81CCE8\n"
+
+		"loc_FF81CCEC:\n"
+		"BL      sub_FF821BF8\n"
+		"BL      sub_FF821BF4\n"
+		"BL      sub_FF828268\n"
+		"LDR     R1, =0x2CE000\n"
+		"MOV     R0, #0\n"
+		"BL      sub_FF8284B0\n"
+		"BL      sub_FF82845C\n" // LOCATION: KerSys.c:548
+		"MOV     R3, #0\n"
+		"STR     R3, [SP,#0x8-0x8]\n"
+		//"ADR     R3, 0xFF81CC60\n" // task_Startup
+		"LDR     R3, =task_Startup_my\n" //------------->
+		"MOV     R2, #0\n"
+		"MOV     R1, #0x19\n"
+		"LDR     R0, =0xFF81CD34\n" // "Startup"
+		"BL      sub_FF81B818\n" // eventproc_export_CreateTask
+		"MOV     R0, #0\n"
+		"LDMFD   SP!, {R12,PC}\n"
+		);
+}
+
+// Extracted method: task_Startup (FF81CC60)
+void __attribute__((naked,noinline)) task_Startup_my()
+{
+	asm volatile (
+		"STMFD   SP!, {R4,LR}\n"
+		"BL      sub_FF81516C\n" // taskcreate_ClockSave
+		"BL      sub_FF822D50\n"
+		"BL      sub_FF81FDF0\n"
+		"BL      sub_FF829F20\n"
+		"BL      sub_FF82A0E8\n"
+		//"BL      sub_FF829FA8\n" // StartDiskBoot
+		"BL      CreateTask_spytask\n" // +
+		"BL      sub_FF82A29C\n"
+		"BL      sub_FF82A138\n"
+		"BL      sub_FF8277A8\n"
+		"BL      sub_FF82A2A0\n"
+		"BL      sub_FF821B00\n" // taskcreate_PhySw
+		"BL      sub_FF824CB8\n" // task_ShootSeqTask
+		"BL      sub_FF82A2B8\n"
+		"BL      sub_FF81FB10\n" // nullsub_2
+		"BL      sub_FF820FBC\n"
+		"BL      sub_FF829CA8\n" // taskcreate_Bye
+		"BL      sub_FF821630\n"
+		"BL      sub_FF820EAC\n" // taskcreate_TempCheck
+		"BL      sub_FF82AD5C\n"
+		"BL      sub_FF820E68\n"
+		"LDMFD   SP!, {R4,PC}\n"
+		"BL      sub_FF815070\n" // LOCATION: ClkEnabler.c:144
+		);
+}
+
+//Extracted method: task_InitFileModules (FF878F84)
+void __attribute__((naked,noinline)) init_file_modules_task()
+{
+	asm volatile (
+		"STMFD   SP!, {R4-R6,LR}\n"
+		"BL      sub_FF86D894\n"
+		"LDR     R5, =0x5006\n"
+		"MOVS    R4, R0\n"
+		"MOVNE   R1, #0\n"
+		"MOVNE   R0, R5\n"
+		"BLNE    sub_FF8732C0\n" // PostLogicalEventToUI
+		//"BL      sub_FF86D8C0\n"
+		"BL      sub_FF86D8C0_my\n" //------------->
+		"BL      core_spytask_can_start\n" // + safe to start spytask
+		"CMP     R4, #0\n"
+		"MOVEQ   R0, R5\n"
+		"LDMEQFD SP!, {R4-R6,LR}\n"
+		"MOVEQ   R1, #0\n"
+		"BEQ     sub_FF8732C0\n" // PostLogicalEventToUI
+		"LDMFD   SP!, {R4-R6,PC}\n"
+		);
+} 
+
+void __attribute__((naked,noinline)) sub_FF86D8C0_my()
+{
+	asm volatile (
+		"STMFD   SP!, {R4,LR}\n"
+		//"BL      sub_FF84EF34\n"
+		"BL      sub_FF84EF34_my\n" //------------->
+		"LDR     R4, =0x57D0\n"
+		"LDR     R0, [R4,#4]\n"
+		"CMP     R0, #0\n"
+		"BNE     loc_FF86D8F0\n"
+		"BL      sub_FF881B00\n"
+		"BL      sub_FF905374\n"
+		"BL      sub_FF881B00\n"
+		"BL      sub_FF84C924\n"
+		"BL      sub_FF881B10\n"
+		"BL      sub_FF905440\n"
+
+		"loc_FF86D8F0:\n"
+		"MOV     R0, #1\n"
+		"STR     R0, [R4]\n"
+		"LDMFD   SP!, {R4,PC}\n"
+		);
+} 
+
+void __attribute__((naked,noinline)) sub_FF84EF34_my()
+{
+	asm volatile (
+		"STMFD   SP!, {R4-R6,LR}\n"
+		"MOV     R6, #0\n"
+		"MOV     R0, R6\n"
+		"BL      sub_FF84E9F4\n"
+		"LDR     R4, =0x118C0\n"
+		"MOV     R5, #0\n"
+		"LDR     R0, [R4,#0x38]\n"
+		"BL      sub_FF84F428\n"
+		"CMP     R0, #0\n"
+		"LDREQ   R0, =0x29D4\n"
+		"STREQ   R5, [R0,#0x10]\n"
+		"STREQ   R5, [R0,#0x14]\n"
+		"STREQ   R5, [R0,#0x18]\n"
+		"MOV     R0, R6\n"
+		"BL      sub_FF84EA34\n" // LOCATION: Mounter.c:0
+		"MOV     R0, R6\n"
+		//"BL      sub_FF84ED70"
+		"BL      sub_FF84ED70_my\n" //------------->
+		"MOV     R5, R0\n"
+		"MOV     R0, R6\n"
+		"BL      sub_FF84EDDC\n" // LOCATION: Mounter.c:8
+		"LDR     R1, [R4,#0x3C]\n"
+		"AND     R2, R5, R0\n"
+		"CMP     R1, #0\n"
+		"MOV     R0, #0\n"
+		"MOVEQ   R0, #0x80000001\n"
+		"BEQ     loc_FF84EFC8\n"
+		"LDR     R3, [R4,#0x2C]\n"
+		"CMP     R3, #2\n"
+		"MOVEQ   R0, #4\n"
+		"CMP     R1, #5\n"
+		"ORRNE   R0, R0, #1\n"
+		"BICEQ   R0, R0, #1\n"
+		"CMP     R2, #0\n"
+		"BICEQ   R0, R0, #2\n"
+		"ORREQ   R0, R0, #0x80000000\n"
+		"BICNE   R0, R0, #0x80000000\n"
+		"ORRNE   R0, R0, #2\n"
+
+		"loc_FF84EFC8:\n"
+		"STR     R0, [R4,#0x40]\n"
+		"LDMFD   SP!, {R4-R6,PC}\n"
+		);
+}
+
+void __attribute__((naked,noinline)) sub_FF84ED70_my()
+{
+	asm volatile (
+		"STMFD   SP!, {R4-R6,LR}\n"
+		"LDR     R5, =0x29D4\n"
+		"MOV     R6, R0\n"
+		"LDR     R0, [R5,#0x14]\n"
+		"CMP     R0, #0\n"
+		"MOVNE   R0, #1\n"
+		"LDMNEFD SP!, {R4-R6,PC}\n"
+		"MOV     R0, #0x17\n"
+		"MUL     R1, R0, R6\n"
+		"LDR     R0, =0x118C0\n"
+		"ADD     R4, R0, R1,LSL#2\n"
+		"LDR     R0, [R4,#0x38]\n"
+		"MOV     R1, R6\n"
+		//"BL      sub_FF84EB00\n" // LOCATION: Mounter.c:884
+		"BL      sub_FF84EB00_my\n" //------------->
+		"CMP     R0, #0\n"
+		"LDMEQFD SP!, {R4-R6,PC}\n"
+		"LDR     R0, [R4,#0x38]\n"
+		"MOV     R1, R6\n"
+		"BL      sub_FF84EC68\n" // LOCATION: Mounter.c:0
+		"CMP     R0, #0\n"
+		"LDMEQFD SP!, {R4-R6,PC}\n"
+		"MOV     R0, R6\n"
+		"BL      sub_FF84E5FC\n"
+		"CMP     R0, #0\n"
+		"MOVNE   R1, #1\n"
+		"STRNE   R1, [R5,#0x14]\n"
+		"LDMFD   SP!, {R4-R6,PC}\n"
+		);
+}
+
+void __attribute__((naked,noinline)) sub_FF84EB00_my()
+{
+	asm volatile (
+		"STMFD   SP!, {R4-R8,LR}\n"
+		"MOV     R8, R0\n"
+		"MOV     R0, #0x17\n"
+		"MUL     R1, R0, R1\n"
+		"LDR     R0, =0x118C0\n"
+		"MOV     R6, #0\n"
+		"ADD     R7, R0, R1,LSL#2\n"
+		"LDR     R0, [R7,#0x3C]\n"
+		"MOV     R5, #0\n"
+		"CMP     R0, #6\n"
+		"ADDLS   PC, PC, R0,LSL#2\n"
+		"B       loc_FF84EC4C\n"
+
+		"loc_FF84EB30:\n"
+		"B       loc_FF84EB64\n"
+
+		"loc_FF84EB34:\n"
+		"B       loc_FF84EB4C\n"
+
+		"loc_FF84EB38:\n"
+		"B       loc_FF84EB4C\n"
+
+		"loc_FF84EB3C:\n"
+		"B       loc_FF84EB4C\n"
+
+		"loc_FF84EB40:\n"
+		"B       loc_FF84EB4C\n"
+
+		"loc_FF84EB44:\n"
+		"B       loc_FF84EC44\n"
+
+		"loc_FF84EB48:\n"
+		"B       loc_FF84EB4C\n"
+
+		"loc_FF84EB4C:\n"
+		// jumptable FF858EAC entries 1-4,6
+		"MOV     R2, #0\n"
+		"MOV     R1, #0x200\n"
+		"MOV     R0, #3\n"
+		"BL      sub_FF867A40\n"
+		"MOVS    R4, R0\n"
+		"BNE     loc_FF84EB6C\n"
+
+		"loc_FF84EB64:\n"
+		// jumptable FF858EAC entry 0
+		"MOV     R0, #0\n"
+		"LDMFD   SP!, {R4-R8,PC}\n"
+
+		"loc_FF84EB6C:\n"
+		"LDR     R12, [R7,#0x4C]\n"
+		"MOV     R3, R4\n"
+		"MOV     R2, #1\n"
+		"MOV     R1, #0\n"
+		"MOV     R0, R8\n"
+		"BLX     R12\n"
+		"CMP     R0, #1\n"
+		"BNE     loc_FF84EB98\n"
+		"MOV     R0, #3\n"
+		"BL      sub_FF867B80\n" // LOCATION: ExMemMan.c:0
+		"B       loc_FF84EB64\n"
+
+		"loc_FF84EB98:\n"
+		"MOV     R0, R8\n"
+		"BL      sub_FF922B9C\n"
+
+		"MOV   R1, R4\n"           //  pointer to MBR in R1
+		"BL    mbr_read_dryos\n"   //  total sectors count in R0 before and after call
+
+		// Start of DataGhost's FAT32 autodetection code
+		// Policy: If there is a partition which has type W95 FAT32, use the first one of those for image storage
+		// According to the code below, we can use R1, R2, R3 and R12.
+		// LR wasn't really used anywhere but for storing a part of the partition signature. This is the only thing
+		// that won't work with an offset, but since we can load from LR+offset into LR, we can use this to do that :)
+		"MOV     R12, R4\n"                    // Copy the MBR start address so we have something to work with
+		"MOV     LR, R4\n"                     // Save old offset for MBR signature
+		"MOV     R1, #1\n"                     // Note the current partition number
+		"B       dg_sd_fat32_enter\n"          // We actually need to check the first partition as well, no increments yet!
+
+		"dg_sd_fat32:\n"
+		"CMP     R1, #4\n"                     // Did we already see the 4th partition?
+		"BEQ     dg_sd_fat32_end\n"            // Yes, break. We didn't find anything, so don't change anything.
+		"ADD     R12, R12, #0x10\n"            // Second partition
+		"ADD     R1, R1, #1\n"                 // Second partition for the loop
+
+		"dg_sd_fat32_enter:\n"
+		"LDRB    R2, [R12, #0x1BE]\n"          // Partition status
+		"LDRB    R3, [R12, #0x1C2]\n"          // Partition type (FAT32 = 0xB)
+		"CMP     R3, #0xB\n"                   // Is this a FAT32 partition?
+		"CMPNE   R3, #0xC\n"                   // Not 0xB, is it 0xC (FAT32 LBA) then?
+		"BNE     dg_sd_fat32\n"                // No, it isn't. Loop again.
+		"CMP     R2, #0x00\n"                  // It is, check the validity of the partition type
+		"CMPNE   R2, #0x80\n"
+		"BNE     dg_sd_fat32\n"                // Invalid, go to next partition
+		// This partition is valid, it's the first one, bingo!
+		"MOV     R4, R12\n"                    // Move the new MBR offset for the partition detection.
+
+		"dg_sd_fat32_end:\n"
+		// End of DataGhost's FAT32 autodetection code
+
+		"LDRB    R1, [R4,#0x1C9]\n"
+		"LDRB    R3, [R4,#0x1C8]\n"
+		"LDRB    R12, [R4,#0x1CC]\n"
+		"MOV     R1, R1,LSL#24\n"
+		"ORR     R1, R1, R3,LSL#16\n"
+		"LDRB    R3, [R4,#0x1C7]\n"
+		"LDRB    R2, [R4,#0x1BE]\n"
+		//"LDRB    LR, [R4,#0x1FF]\n" // -
+		"ORR     R1, R1, R3,LSL#8\n"
+		"LDRB    R3, [R4,#0x1C6]\n"
+		"CMP     R2, #0\n"
+		"CMPNE   R2, #0x80\n"
+		"ORR     R1, R1, R3\n"
+		"LDRB    R3, [R4,#0x1CD]\n"
+		"MOV     R3, R3,LSL#24\n"
+		"ORR     R3, R3, R12,LSL#16\n"
+		"LDRB    R12, [R4,#0x1CB]\n"
+		"ORR     R3, R3, R12,LSL#8\n"
+		"LDRB    R12, [R4,#0x1CA]\n"
+		"ORR     R3, R3, R12\n"
+		//"LDRB    R12, [R4,#0x1FE]\n" // -
+		"LDRB    R12, [LR,#0x1FE]\n" // +
+		"LDRB    LR, [LR,#0x1FF]\n" // +
+		"MOV     R4, #0\n"
+		"BNE     loc_FF84EC20\n"
+		"CMP     R0, R1\n"
+		"BCC     loc_FF84EC20\n"
+		"ADD     R2, R1, R3\n"
+		"CMP     R2, R0\n"
+		"CMPLS   R12, #0x55\n"
+		"CMPEQ   LR, #0xAA\n"
+		"MOVEQ   R6, R1\n"
+		"MOVEQ   R5, R3\n"
+		"MOVEQ   R4, #1\n"
+
+		"loc_FF84EC20:\n"
+		"MOV     R0, #3\n"
+		"BL      sub_FF867B80\n" // LOCATION: ExMemMan.c:0
+		"CMP     R4, #0\n"
+		"BNE     loc_FF84EC58\n"
+		"MOV     R6, #0\n"
+		"MOV     R0, R8\n"
+		"BL      sub_FF922B9C\n"
+		"MOV     R5, R0\n"
+		"B       loc_FF84EC58\n"
+
+		"loc_FF84EC44:\n"
+		// jumptable FF858EAC entry 5
+		"MOV     R5, #0x40\n"
+		"B       loc_FF84EC58\n"
+
+		"loc_FF84EC4C:\n"
+		// jumptable FF858EAC default entry
+		"LDR     R1, =0x374\n"
+		"LDR     R0, =0xFF858E78\n" // "Mounter.c"
+		"BL      _DebugAssert\n"
+
+		"loc_FF84EC58:\n"
+		"STR     R6, [R7,#0x44]!\n"
+		"MOV     R0, #1\n"
+		"STR     R5, [R7,#4]\n"
+		"LDMFD   SP!, {R4-R8,PC}\n"
+		);
+}
+
+// Extracted method: sub_FF842A44
+void __attribute__((naked,noinline)) jogdial_task_my()
+{
+	asm volatile (
+		"STMFD   SP!, {R3-R11,LR}\n"
+		"BL      sub_FF842BF4\n" // LOCATION: JogDial.c:14
+		"LDR     R11, =0x80000B01\n"
+		"LDR     R8, =0xFFAB168C\n"
+		"LDR     R7, =0xC0240000\n"
+		"LDR     R6, =0x22A0\n"
+		"MOV     R9, #1\n"
+		"MOV     R10, #0\n"
+
+		"loc_FF842A64:\n"
+		"LDR     R3, =0x1A1\n"
+		"LDR     R0, [R6,#0xC]\n"
+		"LDR     R2, =0xFF842C9C\n" // "JogDial.c"
+		"MOV     R1, #0\n"
+		"BL      sub_FF81BBD8\n"
+		//"MOV     R0, #40\n"
+		"MOV     R0, #40\n" // +
+		"BL      _SleepTask\n" // LOCATION: KerSys.c:0
+
+		//------------------  added code ---------------------
+		"labelA:\n"
+		"LDR     R0, =jogdial_stopped\n"
+		"LDR     R0, [R0]\n"
+		"CMP     R0, #1\n"
+		"BNE     labelB\n"
+		"MOV     R0, #40\n"
+		"BL      _SleepTask\n"
+		"B       labelA\n"
+		"labelB:\n"
+		//------------------  original code ------------------
+
+		"LDR     R0, [R7,#0x104]\n"
+		"MOV     R0, R0,ASR#16\n"
+		"STRH    R0, [R6]\n"
+		"LDRSH   R2, [R6,#2]\n"
+		"SUB     R1, R0, R2\n"
+		"CMP     R1, #0\n"
+		"BEQ     loc_FF842B28\n"
+		"MOV     R5, R1\n"
+		"RSBLT   R5, R5, #0\n"
+		"MOVLE   R4, #0\n"
+		"MOVGT   R4, #1\n"
+		"CMP     R5, #0xFF\n"
+		"BLS     loc_FF842ADC\n"
+		"CMP     R1, #0\n"
+		"RSBLE   R1, R2, #0xFF\n"
+		"ADDLE   R1, R1, #0x7F00\n"
+		"ADDLE   R0, R1, R0\n"
+		"RSBGT   R0, R0, #0xFF\n"
+		"ADDGT   R0, R0, #0x7F00\n"
+		"ADDGT   R0, R0, R2\n"
+		"ADD     R5, R0, #0x8000\n"
+		"ADD     R5, R5, #1\n"
+		"EOR     R4, R4, #1\n"
+
+		"loc_FF842ADC:\n"
+		"LDR     R0, [R6,#0x14]\n"
+		"CMP     R0, #0\n"
+		"BEQ     loc_FF842B20\n"
+		"LDR     R0, [R6,#0x1C]\n"
+		"CMP     R0, #0\n"
+		"BEQ     loc_FF842B08\n"
+		"LDR     R1, [R8,R4,LSL#2]\n"
+		"CMP     R1, R0\n"
+		"BEQ     loc_FF842B10\n"
+		"LDR     R0, =0xB01\n"
+		"BL      sub_FF87511C\n"
+
+		"loc_FF842B08:\n"
+		"MOV     R0, R11\n"
+		"BL      sub_FF87511C\n"
+
+		"loc_FF842B10:\n"
+		"LDR     R0, [R8,R4,LSL#2]\n"
+		"MOV     R1, R5\n"
+		"STR     R0, [R6,#0x1C]\n"
+		"BL      sub_FF875064\n"
+
+		"loc_FF842B20:\n"
+		"LDRH    R0, [R6]\n"
+		"STRH    R0, [R6,#2]\n"
+
+		"loc_FF842B28:\n"
+		"STR     R10, [R7,#0x100]\n"
+		"STR     R9, [R7,#0x108]\n"
+		"LDR     R0, [R6,#0x10]\n"
+		"CMP     R0, #0\n"
+		"BLNE    _SleepTask\n" // LOCATION: KerSys.c:0
+		"B       loc_FF842A64\n"
+		);
+}
Index: /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100b/stubs_min.S
===================================================================
--- /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100b/stubs_min.S	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100b/stubs_min.S	(revision 1668)
@@ -0,0 +1,6 @@
+#include "stubs_asm.h"
+
+DEF(recreview_hold,                     0x9CEC + 0xAC)  // @ FF960408
+
+DEF(some_f_for_dng,                     0xDEAD)         // ??? TODO NOT FOUND!
+DEF(second_ext_for_dng,                 0xDEAD)         // ??? TODO NOT FOUND!
Index: /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100b/makefile.inc
===================================================================
--- /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100b/makefile.inc	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100b/makefile.inc	(revision 1668)
@@ -0,0 +1,17 @@
+#0x3173
+PLATFORMID=12659
+
+PLATFORMOS=dryos
+
+MEMBASEADDR=0x1900
+RESTARTSTART=0x50000
+MEMISOSTART=0xCBD40
+ROMBASEADDR=0xFF810000
+
+
+PLFLAGS=-DMEMBASEADDR=$(MEMBASEADDR) -DMEMISOSTART=$(MEMISOSTART) -DMEMISOSIZE=$(MEMISOSIZE)
+PLFLAGS+=-DRESTARTSTART=$(RESTARTSTART)
+
+NEED_ENCODED_DISKBOOT=1
+
+KEYSYS=d3enc
Index: /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100b/stubs_asm.h
===================================================================
--- /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100b/stubs_asm.h	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100b/stubs_asm.h	(revision 1668)
@@ -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/reyalp-ptp-live/platform/ixus970_sd890/sub/100b/lib.c
===================================================================
--- /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100b/lib.c	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100b/lib.c	(revision 1668)
@@ -0,0 +1,73 @@
+#include "platform.h"
+
+// obsolete
+void *hook_raw_fptr() { return (void*)0; }
+void *hook_raw_ret_addr() { return (void*)0; }
+
+char *hook_raw_image_addr()
+{
+	// 0x54F4 + 0x18 @ FF85E534
+	// @ FFAB1C48
+	// @ FFAB1C54
+	return (char*) (*(int*)(0x550C) ? 0x11B97B60 : 0x107D68C0);
+}
+
+long hook_raw_size()
+{
+	// (3720 x 2772 * 12bit) / 8bit
+	// @ FFA8AD80
+	return 0xEC04F0;
+}
+
+// Live picture buffer (shoot not pressed)
+void *vid_get_viewport_live_fb()
+{
+	// @ FF8C5AB0
+	void **fb=(void **)0x7420;
+	unsigned char buff = *((unsigned char*)0x729C);
+	if (buff == 0) {
+		buff = 2;
+	} else {
+		buff--;
+	}
+	return fb[buff];
+}
+
+// Live picture buffer (shoot half-pressed)
+void *vid_get_viewport_fb()
+{
+	// @ FFA88AFC
+	return (void*)0x1065ADC0;
+}
+
+// Picture buffer (play mode)
+void *vid_get_viewport_fb_d()
+{
+	// 0x51FC + 0x4C @ FF853E50
+	return (void*)(*(int*)0x5248);
+}
+
+// OSD buffer
+void *vid_get_bitmap_fb()
+{
+	// @ FF8EA9F8
+	return (void*)0x10361000;
+}
+
+// possible future use
+/*
+char *vid_get_bitmap_fb_d() 
+{
+	// 0xAEF0+0x4 @ FF9AE274
+	int *p =(int *)(*(int*)(0xAEF4));
+	return ((char *)(*(p+2)));
+}
+*/
+
+char *camera_jpeg_count_str()
+{
+	// @ FF9A6FDC
+	return (char*)0x4CA80;
+}
+
+long vid_get_viewport_height() { return 240; }
Index: /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100b/movie_rec.c
===================================================================
--- /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100b/movie_rec.c	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100b/movie_rec.c	(revision 1668)
@@ -0,0 +1,416 @@
+#include "conf.h"
+
+int *video_quality = &conf.video_quality;
+int *video_mode    = &conf.video_mode;
+
+long def_table[68] = {
+	0x2000,  0x38D,   0x788,   0xBE1,   0x10CB,  0x1642,  0x1C48,  0x22F9,  0x2A79,  0x32AA, 0x3C01, 0x4637,
+	0x5190,  0x5E0E,  0x5800,  0x9C5,   0x14B8,  0x20C9,  0x2E31,  0x3D39,  0x4DC9,  0x6030, 0x74D1, 0x8B8D,
+	0xA509,  0xC160,  0xE054,  0x102AF, 0x10000, 0x1C6A,  0x3C45,  0x5F60,  0x8661,  0xB21A, 0xE249, 0x117D2,
+	0x153D5, 0x195F8, 0x1E01C, 0x2328E, 0x28C99, 0x2F08B, 0x8000,  0xE35,   0x1E23,  0x2FB0, 0x4331, 0x590D, 
+	0x7125,  0x8BE9,  0xA9EB,  0xCAFC,  0xF00E,  0x11947, 0x1464D, 0x17846, 0x1CCD, -0x2E1,  -0x579, 0x4F33,
+	-0x7EB, -0xF0C,   0xE666,  -0x170A, -0x2BC6, 0x7333,  -0xB85, -0x15E3};
+
+long table[68];
+
+void change_video_tables(int a, int b) {
+	int i;
+
+	for (i=0;i<68;i++) {
+		table[i]=(def_table[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};
+
+// Extracted method: sub_FF85A004
+void __attribute__((naked,noinline)) movie_record_task()
+{
+	asm volatile (
+		"STMFD   SP!, {R2-R8,LR}\n"
+		"LDR     R8, =0x32B\n"
+		"LDR     R7, =0x2710\n"
+		"LDR     R4, =0x5390\n"
+		"MOV     R6, #0\n"
+		"MOV     R5, #1\n"
+
+		"loc_FF85A01C:\n"
+		"LDR     R0, [R4,#0x1C]\n"
+		"MOV     R2, #0\n"
+		"ADD     R1, SP, #0x20-0x1C\n"
+		"BL      sub_FF827D90\n" // LOCATION: KerQueue.c:0
+		"LDR     R0, [R4,#0x24]\n"
+		"CMP     R0, #0\n"
+		"BNE     loc_FF85A0EC\n"
+		"LDR     R0, [SP,#0x20-0x1C]\n"
+		"LDR     R1, [R0]\n"
+		"SUB     R1, R1, #2\n"
+		"CMP     R1, #9\n"
+		"ADDLS   PC, PC, R1,LSL#2\n"
+		"B       loc_FF85A0EC\n"
+
+		"loc_FF85A050:\n"
+		"B       loc_FF85A0A0\n"
+
+		"loc_FF85A054:\n"
+		"B       loc_FF85A0C0\n"
+
+		"loc_FF85A058:\n"
+		"B       loc_FF85A0D0\n"
+
+		"loc_FF85A05C:\n"
+		"B       loc_FF85A0D8\n"
+
+		"loc_FF85A060:\n"
+		"B       loc_FF85A0A8\n"
+
+		"loc_FF85A064:\n"
+		"B       loc_FF85A0E0\n"
+
+		"loc_FF85A068:\n"
+		"B       loc_FF85A0B0\n"
+
+		"loc_FF85A06C:\n"
+		"B       loc_FF85A0EC\n"
+
+		"loc_FF85A070:\n"
+		"B       loc_FF85A0E8\n"
+
+		"loc_FF85A074:\n"
+		"B       loc_FF85A078\n"
+
+		"loc_FF85A078:\n"
+		// jumptable FF85A048 entry 9
+		"STR     R6, [R4,#0x38]\n"
+		"LDR     R0, =0xFF859CD8\n" // nullsub_234
+		"LDR     R2, =0xFF859608\n"
+		"LDR     R1, =0x19B18\n"
+		"STR     R0, [R4,#0xA4]\n"
+		"LDR     R0, =0xFF8596EC\n"
+		"STR     R6, [R4,#0x28]\n"
+		"BL      sub_FF8C7F90\n"
+		"STR     R5, [R4,#0x3C]\n"
+		"B       loc_FF85A0EC\n"
+
+		"loc_FF85A0A0:\n"
+		// jumptable FF85A048 entry 0
+		"BL      unlock_optical_zoom\n" //------------->
+		"BL      sub_FF859DD0\n" // LOCATION: MovieRecorder.c:0
+		"B       loc_FF85A0EC\n"
+
+		"loc_FF85A0A8:\n"
+		// jumptable FF85A048 entry 4
+		"BL      sub_FF859A9C_my\n" //------------->
+		"B       loc_FF85A0EC\n"
+
+		"loc_FF85A0B0:\n"
+		// jumptable FF85A048 entry 6
+		"LDR     R1, [R0,#0x10]\n"
+		"LDR     R0, [R0,#4]\n"
+		"BL      sub_FF938D90\n" // LOCATION: AviWriter.c:0
+		"B       loc_FF85A0EC\n"
+
+		"loc_FF85A0C0:\n"
+		// jumptable FF85A048 entry 1
+		"LDR     R0, [R4,#0x3C]\n"
+		"CMP     R0, #5\n"
+		"STRNE   R5, [R4,#0x2C]\n"
+		"B       loc_FF85A0EC\n"
+
+		"loc_FF85A0D0:\n"
+		// jumptable FF85A048 entry 2
+		"BL      sub_FF8598A0\n" // LOCATION: MovieRecorder.c:1000
+		"B       loc_FF85A0EC\n"
+
+		"loc_FF85A0D8:\n"
+		// jumptable FF85A048 entry 3
+		"BL      sub_FF859738\n"
+		"B       loc_FF85A0EC\n"
+
+		"loc_FF85A0E0:\n"
+		// jumptable FF85A048 entry 5
+		"BL      sub_FF859594\n" // LOCATION: MovieRecorder.c:100
+		"B       loc_FF85A0EC\n"
+
+		"loc_FF85A0E8:\n"
+		// jumptable FF85A048 entry 8
+		"BL      sub_FF85A254\n" // LOCATION: MovieRecorder.c:100
+
+		"loc_FF85A0EC:\n"
+		// jumptable FF85A048 default entry
+		// jumptable FF85A048 entry 7
+		"LDR     R1, [SP,#0x20-0x1C]\n"
+		"LDR     R3, =0xFF859398\n" // aMovierecorder_  ; "MovieRecorder.c"
+		"STR     R6, [R1]\n"
+		"STR     R8, [SP,#0x20-0x20]\n"
+		"LDR     R0, [R4,#0x20]\n"
+		"MOV     R2, R7\n"
+		"BL      sub_FF81BC30\n"
+		"B       loc_FF85A01C\n"
+		);
+}
+
+void __attribute__((naked,noinline)) sub_FF859A9C_my()
+{
+	asm volatile (
+		"STMFD   SP!, {R4-R9,LR}\n"
+		"SUB     SP, SP, #0x3C\n"
+		"MOV     R7, #0\n"
+		"LDR     R5, =0x5390\n"
+		"MOV     R4, R0\n"
+		"STR     R7, [SP,#0x58-0x2C]\n"
+		"STR     R7, [SP,#0x58-0x34]\n"
+		"LDR     R0, [R5,#0x3C]\n"
+		"MOV     R8, #4\n"
+		"CMP     R0, #3\n"
+		"STREQ   R8, [R5,#0x3C]\n"
+		"LDR     R0, [R5,#0xA4]\n"
+		"MOV     R6, #0\n"
+		"BLX     R0\n"
+		"LDR     R0, [R5,#0x3C]\n"
+		"CMP     R0, #4\n"
+		"BNE     loc_FF859BAC\n"
+		"LDRH    R0, [R5,#2]\n"
+		"MOV     R9, #1\n"
+		"CMP     R0, #1\n"
+		"BNE     loc_FF859B18\n"
+		"LDRH    R1, [R5,#4]\n"
+		"LDR     R0, [R5,#0x4C]\n"
+		"MUL     R0, R1, R0\n"
+		"MOV     R1, #0x3E8\n"
+		"BL      sub_FFAAF1AC\n"
+		"MOV     R1, R0\n"
+		"LDR     R0, [R5,#0x54]\n"
+		"BL      sub_FFAAF1AC\n"
+		"CMP     R1, #0\n"
+		"BNE     loc_FF859B34\n"
+
+		"loc_FF859B18:\n"
+		"ADD     R3, SP, #0x58-0x34\n"
+		"ADD     R2, SP, #0x58-0x30\n"
+		"ADD     R1, SP, #0x58-0x2C\n"
+		"ADD     R0, SP, #0x58-0x28\n"
+		"BL      sub_FF938F24\n"
+		"MOVS    R6, R0\n"
+		"BNE     loc_FF859B50\n"
+
+		"loc_FF859B34:\n"
+		"LDR     R0, [R5,#0x2C]\n"
+		"CMP     R0, #1\n"
+		"BNE     loc_FF859BB4\n"
+		"LDR     R0, [R5,#0x54]\n"
+		"LDR     R1, [R5,#0x40]\n"
+		"CMP     R0, R1\n"
+		"BCC     loc_FF859BB4\n"
+
+		"loc_FF859B50:\n"
+		"CMP     R6, #0x80000001\n"
+		"STREQ   R8, [R5,#0x58]\n"
+		"BEQ     loc_FF859B88\n"
+		"CMP     R6, #0x80000003\n"
+		"STREQ   R9, [R5,#0x58]\n"
+		"BEQ     loc_FF859B88\n"
+		"CMP     R6, #0x80000005\n"
+		"MOVEQ   R0, #2\n"
+		"BEQ     loc_FF859B84\n"
+		"CMP     R6, #0x80000007\n"
+		"STRNE   R7, [R5,#0x58]\n"
+		"BNE     loc_FF859B88\n"
+		"MOV     R0, #3\n"
+
+		"loc_FF859B84:\n"
+		"STR     R0, [R5,#0x58]\n"
+
+		"loc_FF859B88:\n"
+		"LDR     R0, =0x19B48\n"
+		"LDR     R0, [R0,#8]\n"
+		"CMP     R0, #0\n"
+		"BEQ     loc_FF859BA0\n"
+		"BL      sub_FF84427C\n"
+		"B       loc_FF859BA4\n"
+
+		"loc_FF859BA0:\n"
+		"BL      sub_FF859594\n" // LOCATION: MovieRecorder.c:100
+
+		"loc_FF859BA4:\n"
+		"MOV     R0, #5\n"
+		"STR     R0, [R5,#0x3C]\n"
+
+		"loc_FF859BAC:\n"
+		"ADD     SP, SP, #0x3C\n"
+		"LDMFD   SP!, {R4-R9,PC}\n"
+
+		"loc_FF859BB4:\n"
+		"LDR     R12, [SP,#0x58-0x2C]\n"
+		"CMP     R12, #0\n"
+		"BEQ     loc_FF859C80\n"
+		"STR     R9, [R5,#0x30]\n"
+		"LDR     R0, [R5,#0x70]\n"
+		"LDR     R1, [R4,#0x14]\n"
+		"LDR     R2, [R4,#0x18]\n"
+		"LDR     LR, [R4,#0xC]\n"
+		"ADD     R3, SP, #0x58-0x24\n"
+		"ADD     R6, SP, #0x58-0x44\n"
+		"STMIA   R6, {R0-R3}\n"
+		"LDR     R0, [SP,#0x58-0x34]\n"
+		"LDR     R3, [R5,#0x5C]\n"
+		"LDR     R1, [SP,#0x58-0x30]\n"
+		"ADD     R2, SP, #0x58-0x20\n"
+		"ADD     R6, SP, #0x58-0x50\n"
+		"STMIA   R6, {R0,R2,R3}\n"
+		"STR     R1, [SP,#0x58-0x54]\n"
+		"STR     R12, [SP,#0x58-0x58]\n"
+		"LDMIB   R4, {R0,R1}\n"
+		"LDR     R3, [SP,#0x58-0x28]\n"
+		"MOV     R2, LR\n"
+		"BL      sub_FF8EFE60\n"
+		"LDR     R0, [R5,#0x14]\n"
+		"MOV     R1, #0x3E8\n"
+		"BL      sub_FF81B6AC\n" // eventproc_export_TakeSemaphore
+		"CMP     R0, #9\n"
+		"BNE     loc_FF859C34\n"
+		"BL      sub_FF939500\n"
+		"MOV     R0, #0x90000\n"
+		"STR     R9, [R5,#0x3C]\n"
+		"B       loc_FF859C4C\n"
+
+		"loc_FF859C34:\n"
+		"LDR     R0, [SP,#0x58-0x24]\n"
+		"CMP     R0, #0\n"
+		"BEQ     loc_FF859C54\n"
+		"BL      sub_FF939500\n"
+		"MOV     R0, #0xA0000\n"
+		"STR     R9, [R5,#0x3C]\n"
+
+		"loc_FF859C4C:\n"
+		"BL      sub_FF875750\n" // eventproc_export_HardwareDefect
+		"B       loc_FF859BAC\n"
+
+		"loc_FF859C54:\n"
+		"BL      sub_FF8EFF24\n"
+		"LDR     R0, [SP,#0x58-0x28]\n"
+		"LDR     R1, [SP,#0x58-0x20]\n"
+		"BL      sub_FF9392A8\n" // LOCATION: AviWriter.c:0
+		"LDR     R0, [R5,#0x50]\n"
+		"LDR     R1, =0x5400\n"
+		"ADD     R0, R0, #1\n"
+		"STR     R0, [R5,#0x50]\n"
+		"LDR     R0, [SP,#0x58-0x20]\n"
+		"MOV     R2, #0\n"
+		"BL      sub_FF937138_my\n" //------------->
+
+		"loc_FF859C80:\n"
+		"LDR     R0, [R5,#0x54]\n"
+		"ADD     R0, R0, #1\n"
+		"STR     R0, [R5,#0x54]\n"
+		"LDR     R1, [R5,#0x7C]\n"
+		"MUL     R0, R1, R0\n"
+		"LDR     R1, [R5,#0x78]\n"
+		"BL      sub_FFAAF1AC\n"
+		"MOV     R4, R0\n"
+		"BL      sub_FF939538\n"
+		"LDR     R1, [R5,#0x74]\n"
+		"CMP     R1, R4\n"
+		"BNE     loc_FF859CBC\n"
+		"LDR     R0, [R5,#0x34]\n"
+		"CMP     R0, #1\n"
+		"BNE     loc_FF859CD0\n"
+
+		"loc_FF859CBC:\n"
+		"LDR     R1, [R5,#0x88]\n"
+		"MOV     R0, R4\n"
+		"BLX     R1\n"
+		"STR     R4, [R5,#0x74]\n"
+		"STR     R7, [R5,#0x34]\n"
+
+		"loc_FF859CD0:\n"
+		"STR     R7, [R5,#0x30]\n"
+		"B       loc_FF859BAC\n"
+		);
+}
+
+void __attribute__((naked,noinline)) sub_FF937138_my()
+{
+	asm volatile (
+		"STMFD   SP!, {R4-R8,LR}\n"
+		"LDR     R4, =0x8C44\n"
+		"LDR     LR, [R4]\n"
+		"LDR     R2, [R4,#8]\n"
+		"CMP     LR, #0\n"
+		"LDRNE   R3, [R4,#0xC]\n"
+		"MOV     R5, R2\n"
+		"CMPNE   R3, #1\n"
+		"MOVEQ   R2, #0\n"
+		"STREQ   R0, [R4]\n"
+		"STREQ   R2, [R4,#0xC]\n"
+		"BEQ     loc_FF937204\n"
+		"LDR     R3, [R4,#4]\n"
+		//"LDR     R7, =0xFFACAD70\n"
+		"LDR     R7, =table\n" // +
+		"ADD     R12, R3, R3,LSL#1\n"
+		"LDR     R3, [R7,R12,LSL#2]\n"
+		"ADD     R6, R7, #0x30\n"
+		"LDR     R8, [R6,R12,LSL#2]\n"
+		"SUB     R3, LR, R3\n"
+		"CMP     R3, #0\n"
+		"SUB     LR, LR, R8\n"
+		"BLE     loc_FF9371C0\n"
+		"ADD     R12, R7, R12,LSL#2\n"
+		"LDR     LR, [R12,#4]\n"
+		"CMP     LR, R3\n"
+		"ADDGE   R2, R2, #1\n"
+		"BGE     loc_FF9371B4\n"
+		"LDR     R12, [R12,#8]\n"
+		"CMP     R12, R3\n"
+		"ADDLT   R2, R2, #3\n"
+		"ADDGE   R2, R2, #2\n"
+
+		"loc_FF9371B4:\n"
+		//"CMP     R2, #0x17\n"
+		//"MOVGE   R2, #0x16\n"
+		"CMP     R2, #0x1A\n" // +
+		"MOVGE   R2, #0x19\n" // +
+		"B       loc_FF9371F4\n"
+
+		"loc_FF9371C0:\n"
+		"CMP     LR, #0\n"
+		"BGE     loc_FF9371F4\n"
+		"ADD     R3, R6, R12,LSL#2\n"
+		"LDR     R12, [R3,#4]\n"
+		"CMP     R12, LR\n"
+		"SUBLE   R2, R2, #1\n"
+		"BLE     loc_FF9371EC\n"
+		"LDR     R3, [R3,#8]\n"
+		"CMP     R3, LR\n"
+		"SUBGT   R2, R2, #3\n"
+		"SUBLE   R2, R2, #2\n"
+
+		"loc_FF9371EC:\n"
+		"CMP     R2, #0\n"
+		"MOVLT   R2, #0\n"
+
+		"loc_FF9371F4:\n"
+		"CMP     R2, R5\n"
+		"STRNE   R2, [R4,#8]\n"
+		"MOVNE   R2, #1\n"
+		"STRNE   R2, [R4,#0xC]\n"
+
+		"loc_FF937204:\n"
+		//"LDR     R2, =0xFFACAD14\n"
+		"LDR     R2, =CompressionRateTable\n" // +
+		"LDR     R3, [R4,#8]\n"
+		"LDR     R2, [R2,R3,LSL#2]\n"
+
+		"LDR     R3, =video_mode\n" // +
+		"LDR     R3, [R3]\n" // +
+		"LDR     R3, [R3]\n" // +
+		"CMP     R3, #1\n" // +
+		"LDREQ   R3, =video_quality\n" // +
+		"LDREQ   R3, [R3]\n" // +
+		"LDREQ   R2, [R3]\n" // +
+
+		"STR     R2, [R1]\n"
+		"STR     R0, [R4]\n"
+		"LDMFD   SP!, {R4-R8,PC}\n"
+		);
+}
Index: /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100b/stubs_auto.S
===================================================================
--- /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100b/stubs_auto.S	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100b/stubs_auto.S	(revision 1668)
@@ -0,0 +1,191 @@
+/* THIS FILE IS GENERATED */
+/* DO NOT EDIT THIS FILE! */
+
+#include "stubs_asm.h"
+
+STUB(FF8101A4)
+STUB(FF81094C)
+STUB(FF810FA0)
+STUB(FF8114B8)
+STUB(FF812D58)
+STUB(FF813564)
+STUB(FF8149C8)
+STUB(FF814AB4)
+STUB(FF814E98)
+STUB(FF815070)
+STUB(FF81516C)
+STUB(FF8191EC)
+STUB(FF819664)
+STUB(FF81B6AC)
+STUB(FF81B818)
+STUB(FF81BAA8)
+STUB(FF81BBD8)
+STUB(FF81BC30)
+STUB(FF81FB10)
+STUB(FF81FDF0)
+STUB(FF820E68)
+STUB(FF820EAC)
+STUB(FF820FBC)
+STUB(FF821630)
+STUB(FF821B00)
+STUB(FF821BEC)
+STUB(FF821BF0)
+STUB(FF821BF4)
+STUB(FF821BF8)
+STUB(FF822D50)
+STUB(FF824C38)
+STUB(FF824CB8)
+STUB(FF8277A8)
+STUB(FF827A44)
+STUB(FF827B0C)
+STUB(FF827B40)
+STUB(FF827D90)
+STUB(FF828268)
+STUB(FF82845C)
+STUB(FF8284B0)
+STUB(FF829CA8)
+STUB(FF829EE0)
+STUB(FF829F20)
+STUB(FF829FA8)
+STUB(FF82A0E8)
+STUB(FF82A138)
+STUB(FF82A29C)
+STUB(FF82A2A0)
+STUB(FF82A2B8)
+STUB(FF82AD5C)
+STUB(FF842BF4)
+STUB(FF84427C)
+STUB(FF845330)
+STUB(FF84C924)
+STUB(FF84E5FC)
+STUB(FF84E9F4)
+STUB(FF84EA34)
+STUB(FF84EB00)
+STUB(FF84EC68)
+STUB(FF84ED70)
+STUB(FF84EDDC)
+STUB(FF84EF34)
+STUB(FF84F428)
+STUB(FF858330)
+STUB(FF859594)
+STUB(FF859738)
+STUB(FF8598A0)
+STUB(FF859A9C)
+STUB(FF859DD0)
+STUB(FF85A254)
+STUB(FF85C1C4)
+STUB(FF85C718)
+STUB(FF85D9E4)
+STUB(FF85E3C0)
+STUB(FF8610AC)
+STUB(FF867A40)
+STUB(FF867B80)
+STUB(FF86D008)
+STUB(FF86D198)
+STUB(FF86D3A4)
+STUB(FF86D894)
+STUB(FF86D8C0)
+STUB(FF8732C0)
+STUB(FF875064)
+STUB(FF87511C)
+STUB(FF875750)
+STUB(FF881B00)
+STUB(FF881B10)
+STUB(FF895968)
+STUB(FF895C1C)
+STUB(FF896164)
+STUB(FF8961EC)
+STUB(FF89646C)
+STUB(FF8969E8)
+STUB(FF8AA25C)
+STUB(FF8B3320)
+STUB(FF8B342C)
+STUB(FF8B3484)
+STUB(FF8B34DC)
+STUB(FF8B3534)
+STUB(FF8B358C)
+STUB(FF8B36CC)
+STUB(FF8B3784)
+STUB(FF8B3A14)
+STUB(FF8B3C18)
+STUB(FF8B3E80)
+STUB(FF8B4074)
+STUB(FF8B42DC)
+STUB(FF8B4418)
+STUB(FF8B468C)
+STUB(FF8B48B4)
+STUB(FF8B4BA4)
+STUB(FF8B4CA8)
+STUB(FF8B4EE0)
+STUB(FF8B5058)
+STUB(FF8B51F0)
+STUB(FF8B5328)
+STUB(FF8B5570)
+STUB(FF8B6528)
+STUB(FF8B67B4)
+STUB(FF8B6814)
+STUB(FF8B7AD0)
+STUB(FF8B7B00)
+STUB(FF8B7B44)
+STUB(FF8B7CC0)
+STUB(FF8B7D6C)
+STUB(FF8B7E0C)
+STUB(FF8B7EA4)
+STUB(FF8C53CC)
+STUB(FF8C7F90)
+STUB(FF8C98BC)
+STUB(FF8EFE60)
+STUB(FF8EFF24)
+STUB(FF8F3B40)
+STUB(FF905374)
+STUB(FF905440)
+STUB(FF922B9C)
+STUB(FF92F844)
+STUB(FF92F998)
+STUB(FF92FACC)
+STUB(FF937138)
+STUB(FF938D90)
+STUB(FF938F24)
+STUB(FF9392A8)
+STUB(FF939500)
+STUB(FF939538)
+STUB(FF93C0E0)
+STUB(FF93C414)
+STUB(FF93C41C)
+STUB(FF93C424)
+STUB(FF93C448)
+STUB(FF93C510)
+STUB(FF93C570)
+STUB(FF93C5F0)
+STUB(FF93C714)
+STUB(FF93C8B8)
+STUB(FF93CC38)
+STUB(FF93CEA4)
+STUB(FF93D08C)
+STUB(FF93D11C)
+STUB(FF93D1D0)
+STUB(FF93D28C)
+STUB(FF93D2F8)
+STUB(FF93D3C8)
+STUB(FF93D418)
+STUB(FF93D49C)
+STUB(FF93D5EC)
+STUB(FF93D680)
+STUB(FF93D748)
+STUB(FF93DA48)
+STUB(FF93DB30)
+STUB(FF93DBA4)
+STUB(FF93DF3C)
+STUB(FF93DF9C)
+STUB(FF93E520)
+STUB(FF93E698)
+STUB(FF93EB8C)
+STUB(FF93F558)
+STUB(FF93F574)
+STUB(FF93F584)
+STUB(FF93F5B0)
+STUB(FF95DE08)
+STUB(FF9B2824)
+STUB(FFAAD774)
+STUB(FFAAD8FC)
+STUB(FFAAF1AC)
Index: /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100b/Makefile
===================================================================
--- /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100b/Makefile	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100b/Makefile	(revision 1668)
@@ -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/reyalp-ptp-live/platform/ixus970_sd890/sub/100c/capt_seq.c
===================================================================
--- /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100c/capt_seq.c	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100c/capt_seq.c	(revision 1668)
@@ -0,0 +1,1109 @@
+#include "lolevel.h"
+#include "platform.h"
+#include "core.h"
+
+// @ FF93DBA8
+static long *nrflag = (long*)0x91A4;
+
+#include "../../../generic/capt_seq.c"
+
+// Extracted method: task_CaptSeqTask (FF85E03C)
+void __attribute__((naked,noinline)) capt_seq_task()
+{
+	asm volatile (
+		"STMFD   SP!, {R3-R9,LR}\n"
+		"LDR     R6, =0x19EBC\n"
+		"LDR     R5, =0x54E0\n"
+		"MOV     R9, #1\n"
+		"MOV     R7, #0\n"
+
+		"loc_FF85E050:\n"
+		"LDR     R0, [R5,#0xC]\n"
+		"MOV     R2, #0\n"
+		"MOV     R1, SP\n"
+		"BL      sub_FF827D90\n" // LOCATION: KerQueue.c:0
+		"TST     R0, #1\n"
+		"BEQ     loc_FF85E07C\n"
+		"LDR     R1, =0x48E\n"
+		"LDR     R0, =0xFF85DD14\n" // "SsShootTask.c"
+		"BL      _DebugAssert\n"
+		"BL      sub_FF81BAA8\n" // ExitTask\n"
+		"LDMFD   SP!, {R3-R9,PC}\n"
+
+		"loc_FF85E07C:\n"
+		"LDR     R0, [SP,#0x20-0x20]\n"
+		"LDR     R1, [R0]\n"
+		"CMP     R1, #0x1B\n"
+		"ADDLS   PC, PC, R1,LSL#2\n"
+		"B       loc_FF85E29C\n"
+
+		"loc_FF85E090:\n"
+		"B       loc_FF85E100\n"
+
+		"loc_FF85E094:\n"
+		"B       loc_FF85E168\n"
+
+		"loc_FF85E098:\n"
+		"B       loc_FF85E170\n"
+
+		"loc_FF85E09C:\n"
+		"B       loc_FF85E188\n"
+
+		"loc_FF85E0A0:\n"
+		"B       loc_FF85E17C\n"
+
+		"loc_FF85E0A4:\n"
+		"B       loc_FF85E190\n"
+
+		"loc_FF85E0A8:\n"
+		"B       loc_FF85E198\n"
+
+		"loc_FF85E0AC:\n"
+		"B       loc_FF85E1A0\n"
+
+		"loc_FF85E0B0:\n"
+		"B       loc_FF85E1F8\n"
+
+		"loc_FF85E0B4:\n"
+		"B       loc_FF85E204\n"
+
+		"loc_FF85E0B8:\n"
+		"B       loc_FF85E20C\n"
+
+		"loc_FF85E0BC:\n"
+		"B       loc_FF85E214\n"
+
+		"loc_FF85E0C0:\n"
+		"B       loc_FF85E21C\n"
+
+		"loc_FF85E0C4:\n"
+		"B       loc_FF85E224\n"
+
+		"loc_FF85E0C8:\n"
+		"B       loc_FF85E22C\n"
+
+		"loc_FF85E0CC:\n"
+		"B       loc_FF85E234\n"
+
+		"loc_FF85E0D0:\n"
+		"B       loc_FF85E23C\n"
+
+		"loc_FF85E0D4:\n"
+		"B       loc_FF85E248\n"
+
+		"loc_FF85E0D8:\n"
+		"B       loc_FF85E250\n"
+
+		"loc_FF85E0DC:\n"
+		"B       loc_FF85E258\n"
+
+		"loc_FF85E0E0:\n"
+		"B       loc_FF85E260\n"
+
+		"loc_FF85E0E4:\n"
+		"B       loc_FF85E26C\n"
+
+		"loc_FF85E0E8:\n"
+		"B       loc_FF85E274\n"
+
+		"loc_FF85E0EC:\n"
+		"B       loc_FF85E27C\n"
+
+		"loc_FF85E0F0:\n"
+		"B       loc_FF85E284\n"
+
+		"loc_FF85E0F4:\n"
+		"B       loc_FF85E28C\n"
+
+		"loc_FF85E0F8:\n"
+		"B       loc_FF85E294\n"
+
+		"loc_FF85E0FC:\n"
+		"B       loc_FF85E2A8\n"
+
+		"loc_FF85E100:\n"
+		// jumptable FF85E088 entry 0
+		"BL      sub_FF93C448\n" // LOCATION: SsPrepareSeq.c:0
+		"BL      shooting_expo_param_override\n" // +
+		"BL      sub_FF85C1C4\n"
+		"LDR     R0, [R6,#0x24]\n"
+		"CMP     R0, #0\n"
+		"BEQ     loc_FF85E2A8\n"
+		"BL      sub_FF85D9E4\n"
+		"MOV     R4, R0\n"
+		"LDR     R0, [R6,#0x24]\n"
+		"CMP     R0, #0\n"
+		"BEQ     loc_FF85E148\n"
+		"MOV     R0, #0xC\n"
+		"BL      sub_FF8610AC\n"
+		"TST     R0, #1\n"
+		"STRNE   R9, [R5,#4]\n"
+		"LDRNE   R0, [R4,#8]\n"
+		"ORRNE   R0, R0, #0x40000000\n"
+		"STRNE   R0, [R4,#8]\n"
+		"BNE     loc_FF85E2A8\n"
+
+		"loc_FF85E148:\n"
+		"BL      sub_FF95DE08\n"
+		"BL      sub_FF86D198\n" // LOCATION: PropertyCase.c:0
+		"STR     R0, [R4,#0x14]\n"
+		"MOV     R0, R4\n"
+		//"BL      sub_FF93DB30\n" // LOCATION: SsCaptureSeq.c:536
+		"BL      sub_FF93DB30_my\n" // +
+		"BL      capt_seq_hook_raw_here\n" // +
+		"TST     R0, #1\n"
+		"STRNE   R9, [R5,#4]\n"
+		"B       loc_FF85E2A8\n"
+
+		"loc_FF85E168:\n"
+		// jumptable FF85E088 entry 1
+		//"BL      sub_FF85E3C0\n"
+		"BL      sub_FF85E3C0_my\n" // +
+		"B       loc_FF85E180\n"
+
+		"loc_FF85E170:\n"
+		// jumptable FF85E088 entry 2
+		"MOV     R0, #1\n"
+		"BL      sub_FF93C5F0\n" // LOCATION: SsPrepareSeq.c:0
+		"B       loc_FF85E2A8\n"
+
+		"loc_FF85E17C:\n"
+		// jumptable FF85E088 entry 4
+		"BL      sub_FF93C0E0\n"
+
+		"loc_FF85E180:\n"
+		"STR     R7, [R6,#0x24]\n"
+		"B       loc_FF85E2A8\n"
+
+		"loc_FF85E188:\n"
+		// jumptable FF85E088 entry 3
+		"BL      sub_FF93C414\n"
+		"B       loc_FF85E180\n"
+
+		"loc_FF85E190:\n"
+		// jumptable FF85E088 entry 5
+		"BL      sub_FF93C41C\n"
+		"B       loc_FF85E2A8\n"
+
+		"loc_FF85E198:\n"
+		// jumptable FF85E088 entry 6
+		"BL      sub_FF93C510\n" // LOCATION: SsPrepareSeq.c:0
+		"B       loc_FF85E1FC\n"
+
+		"loc_FF85E1A0:\n"
+		// jumptable FF85E088 entry 7
+		"LDR     R4, [R0,#0xC]\n"
+		"BL      sub_FF93C424\n"
+		"MOV     R0, R4\n"
+		"BL      sub_FF93CC38\n" // LOCATION: SsPrePreSeq.c:2097152
+		"TST     R0, #1\n"
+		"MOV     R8, R0\n"
+		"BNE     loc_FF85E1E0\n"
+		"BL      sub_FF86D198\n" // LOCATION: PropertyCase.c:0
+		"STR     R0, [R4,#0x14]\n"
+		"MOV     R0, R4\n"
+		"BL      sub_FF93DA48\n" // LOCATION: SsCaptureSeq.c:1
+		"MOV     R0, R4\n"
+		"BL      sub_FF93DF9C\n" // LOCATION: SsCaptureSeq.c:4
+		"MOV     R8, R0\n"
+		"LDR     R0, [R4,#0x14]\n"
+		"BL      sub_FF86D3A4\n" // LOCATION: PropertyCase.c:0
+
+		"loc_FF85E1E0:\n"
+		"BL      sub_FF93C414\n"
+		"MOV     R2, R4\n"
+		"MOV     R1, #9\n"
+		"MOV     R0, R8\n"
+		"BL      sub_FF85C718\n" // LOCATION: SsShootCtrl.c:0
+		"B       loc_FF85E2A8\n"
+
+		"loc_FF85E1F8:\n"
+		// jumptable FF85E088 entry 8
+		"BL      sub_FF93C570\n" // LOCATION: SsPrepareSeq.c:960
+
+		"loc_FF85E1FC:\n"
+		"BL      sub_FF85C1C4\n"
+		"B       loc_FF85E2A8\n"
+
+		"loc_FF85E204:\n"
+		// jumptable FF85E088 entry 9
+		"BL      sub_FF93C414\n"
+		"B       loc_FF85E2A8\n"
+
+		"loc_FF85E20C:\n"
+		// jumptable FF85E088 entry 10
+		"BL      sub_FF93CEA4\n"
+		"B       loc_FF85E2A8\n"
+
+		"loc_FF85E214:\n"
+		// jumptable FF85E088 entry 11
+		"BL      sub_FF93D08C\n"
+		"B       loc_FF85E2A8\n"
+
+		"loc_FF85E21C:\n"
+		// jumptable FF85E088 entry 12
+		"BL      sub_FF93D11C\n" // LOCATION: SsExpCompSeq.c:94
+		"B       loc_FF85E2A8\n"
+
+		"loc_FF85E224:\n"
+		// jumptable FF85E088 entry 13
+		"BL      sub_FF93D1D0\n"
+		"B       loc_FF85E2A8\n"
+
+		"loc_FF85E22C:\n"
+		// jumptable FF85E088 entry 14
+		"BL      sub_FF93D3C8\n" // LOCATION: SsChgExpSeq.c:32
+		"B       loc_FF85E2A8\n"
+
+		"loc_FF85E234:\n"
+		// jumptable FF85E088 entry 15
+		"BL      sub_FF93D418\n" // LOCATION: SsChgExpSeq.c:32
+		"B       loc_FF85E2A8\n"
+
+		"loc_FF85E23C:\n"
+		// jumptable FF85E088 entry 16
+		"MOV     R0, #0\n"
+		"BL      sub_FF93D49C\n"
+		"B       loc_FF85E2A8\n"
+
+		"loc_FF85E248:\n"
+		// jumptable FF85E088 entry 17
+		"BL      sub_FF93D5EC\n"
+		"B       loc_FF85E2A8\n"
+
+		"loc_FF85E250:\n"
+		// jumptable FF85E088 entry 18
+		"BL      sub_FF93D680\n" // LOCATION: SsMFSeq.c:109
+		"B       loc_FF85E2A8\n"
+
+		"loc_FF85E258:\n"
+		// jumptable FF85E088 entry 19
+		"BL      sub_FF93D748\n" // LOCATION: SsMFSeq.c:181
+		"B       loc_FF85E2A8\n"
+
+		"loc_FF85E260:\n"
+		// jumptable FF85E088 entry 20
+		"BL      sub_FF93C714\n"
+		"BL      sub_FF824C38\n"
+		"B       loc_FF85E2A8\n"
+
+		"loc_FF85E26C:\n"
+		// jumptable FF85E088 entry 21
+		"BL      sub_FF93D28C\n"
+		"B       loc_FF85E2A8\n"
+
+		"loc_FF85E274:\n"
+		// jumptable FF85E088 entry 22
+		"BL      sub_FF93D2F8\n" // LOCATION: SsChgExpSeq.c:0
+		"B       loc_FF85E2A8\n"
+
+		"loc_FF85E27C:\n"
+		// jumptable FF85E088 entry 23
+		"BL      sub_FF93F558\n"
+		"B       loc_FF85E2A8\n"
+
+		"loc_FF85E284:\n"
+		// jumptable FF85E088 entry 24
+		"BL      sub_FF93F574\n"
+		"B       loc_FF85E2A8\n"
+
+		"loc_FF85E28C:\n"
+		// jumptable FF85E088 entry 25
+		"BL      sub_FF93F584\n"
+		"B       loc_FF85E2A8\n"
+
+		"loc_FF85E294:\n"
+		// jumptable FF85E088 entry 26
+		"BL      sub_FF93F5B0\n"
+		"B       loc_FF85E2A8\n"
+
+		"loc_FF85E29C:\n"
+		// jumptable FF85E088 default entry
+		"LDR     R1, =0x58E\n"
+		"LDR     R0, =0xFF85DD14\n" // aSsshoottask_c
+		"BL      _DebugAssert\n"
+
+		"loc_FF85E2A8:\n"
+		// jumptable FF85E088 entry 27
+		"LDR     R0, [SP,#0x20-0x20]\n"
+		"LDR     R1, [R0,#4]\n"
+		"LDR     R0, [R5,#8]\n"
+		"BL      sub_FF827B0C\n"
+		"LDR     R4, [SP,#0x20-0x20]\n"
+		"LDR     R0, [R4,#8]\n"
+		"CMP     R0, #0\n"
+		"LDREQ   R1, =0x10D\n"
+		"LDREQ   R0, =0xFF85DD14\n" // aSsshoottask_c
+		"BLEQ    _DebugAssert\n"
+		"STR     R7, [R4,#8]\n"
+		"B       loc_FF85E050\n"
+		);
+}
+
+void __attribute__((naked,noinline)) sub_FF85E3C0_my()
+{
+	asm volatile (
+		"STMFD   SP!, {R4-R6,LR}\n"
+		"LDR     R4, [R0,#0xC]\n"
+		"LDR     R6, =0x19EBC\n"
+		"LDR     R0, [R4,#8]\n"
+		"MOV     R5, #0\n"
+		"ORR     R0, R0, #1\n"
+		"STR     R0, [R4,#8]\n"
+		"LDR     R0, [R6,#0x24]\n"
+		"CMP     R0, #0\n"
+		"MOVEQ   R0, #2\n"
+		"BLEQ    sub_FF858330\n"
+		"BL      sub_FF93C424\n"
+		"LDR     R0, [R6,#0x24]\n"
+		"CMP     R0, #0\n"
+		"BNE     loc_FF85E440\n"
+		"MOV     R0, R4\n"
+		"BL      sub_FF93C8B8\n" // LOCATION: SsPrePreSeq.c:242
+		"TST     R0, #1\n"
+		"MOVNE   R2, R4\n"
+		"LDMNEFD SP!, {R4-R6,LR}\n"
+		"MOVNE   R1, #1\n"
+		"BNE     sub_FF85C718\n" // LOCATION: SsShootCtrl.c:0
+		"BL      sub_FF95DE08\n"
+		"BL      sub_FF86D198\n" // LOCATION: PropertyCase.c:0
+		"STR     R0, [R4,#0x14]\n"
+		"MOV     R0, R4\n"
+		"BL      sub_FF93DA48\n" // LOCATION: SsCaptureSeq.c:1
+		"BL      sub_FF93E520\n" // LOCATION: SsShootLib.c:32768
+		"MOV     R0, R4\n"
+		//"BL      sub_FF93DB30\n" // LOCATION: SsCaptureSeq.c:536
+		"BL      sub_FF93DB30_my\n" // +
+		"MOV     R5, R0\n"
+		"BL      capt_seq_hook_raw_here\n" // +
+		"B       loc_FF85E450\n"
+
+		"loc_FF85E440:\n"
+		"LDR     R0, =0x54E0\n"
+		"LDR     R0, [R0,#4]\n"
+		"CMP     R0, #0\n"
+		"MOVNE   R5, #0x1D\n"
+
+		"loc_FF85E450:\n"
+		"BL      sub_FF93F574\n"
+		"BL      sub_FF93F5B0\n"
+		"MOV     R2, R4\n"
+		"MOV     R1, #1\n"
+		"MOV     R0, R5\n"
+		"BL      sub_FF85C718\n" // LOCATION: SsShootCtrl.c:0
+		"BL      sub_FF93DF3C\n"
+		"CMP     R0, #0\n"
+		"LDRNE   R0, [R4,#8]\n"
+		"ORRNE   R0, R0, #0x2000\n"
+		"STRNE   R0, [R4,#8]\n"
+		"LDMFD   SP!, {R4-R6,PC}\n"
+		);
+}
+
+void __attribute__((naked,noinline)) sub_FF93DB30_my()
+{
+	asm volatile (
+		"STMFD   SP!, {R0-R10,LR}\n"
+		"MOV     R6, #0\n"
+		"MOV     R4, R0\n"
+		"BL      sub_FF93E698\n" // LOCATION: SsShootEvent.c:60
+		"MVN     R1, #0\n"
+		"BL      sub_FF827B40\n"
+		"MOV     R2, #4\n"
+		"ADD     R1, SP, #0x30-0x28\n"
+		"MOV     R0, #0x8A\n"
+		"BL      sub_FF86D008\n" // PT_GetPropertyCaseString_0
+		"TST     R0, #1\n"
+		"MOVNE   R1, #0x218\n"
+		"LDRNE   R0, =0xFF93DD04\n" // "SsCaptureSeq.c"
+		"BLNE    _DebugAssert\n"
+		"LDR     R8, =0x19F70\n"
+		"LDR     R5, =0x19EBC\n"
+		"LDRSH   R1, [R8,#0xE]\n"
+		"LDR     R0, [R5,#0x7C]\n"
+		"BL      sub_FF8F3B40\n"
+		"BL      sub_FF845330\n" // GetCCDTemperature
+		"LDR     R2, =0x91A8\n"
+		"ADD     R3, R4, #0x8C\n"
+		"STRH    R0, [R4,#0x88]\n"
+		"STRD    R2, [SP,#0x30-0x30]\n"
+		"MOV     R1, R0\n"
+		"LDRH    R0, [R5,#0x54]\n"
+		"LDRSH   R2, [R8,#0xC]\n"
+		"LDR     R3, =0x91A4\n"
+		"BL      sub_FF93EB8C\n" // LOCATION: NRTable.c:202
+		"BL      wait_until_remote_button_is_released\n" // +
+		"BL      capt_seq_hook_set_nr\n" // +
+		"BL      sub_FF93DBA4\n" // Continue in the original FW
+		);
+}
+
+// Extracted method: task_ExpDrvTask (FF8B6864)
+void __attribute__((naked,noinline)) exp_drv_task()
+{
+	asm volatile (
+		"STMFD   SP!, {R4-R8,LR}\n"
+		"SUB     SP, SP, #0x20\n"
+		"LDR     R8, =0xBB8\n"
+		"LDR     R7, =0x6E30\n"
+		"LDR     R5, =0x3E198\n"
+		"MOV     R0, #0\n"
+		"ADD     R6, SP, #0x38-0x28\n"
+		"STR     R0, [SP,#0x38-0x2C]\n"
+
+		"loc_FF8B6884:\n"
+		"LDR     R0, [R7,#0x20]\n"
+		"MOV     R2, #0\n"
+		"ADD     R1, SP, #0x38-0x1C\n"
+		"BL      sub_FF827D90\n" // LOCATION: KerQueue.c:0
+		"LDR     R0, [SP,#0x38-0x2C]\n"
+		"CMP     R0, #1\n"
+		"BNE     loc_FF8B68CC\n"
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"LDR     R0, [R0]\n"
+		"CMP     R0, #0x13\n"
+		"CMPNE   R0, #0x14\n"
+		"CMPNE   R0, #0x15\n"
+		"BEQ     loc_FF8B69E8\n"
+		"CMP     R0, #0x27\n"
+		"BEQ     loc_FF8B69C0\n"
+		"ADD     R1, SP, #0x38-0x2C\n"
+		"MOV     R0, #0\n"
+		"BL      sub_FF8B6814\n" // LOCATION: ExpDrv.c:512
+
+		"loc_FF8B68CC:\n"
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"LDR     R1, [R0]\n"
+		"CMP     R1, #0x2C\n"
+		"BNE     loc_FF8B68FC\n"
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"BL      sub_FF8B7AD0\n" // LOCATION: ExpDrv.c:268
+		"LDR     R0, [R7,#0x1C]\n"
+		"MOV     R1, #1\n"
+		"BL      sub_FF827B0C\n"
+		"BL      sub_FF81BAA8\n" // eventproc_export_ExitTask
+		"ADD     SP, SP, #0x20\n"
+		"LDMFD   SP!, {R4-R8,PC}\n"
+
+		"loc_FF8B68FC:\n"
+		"CMP     R1, #0x2B\n"
+		"BNE     loc_FF8B6918\n"
+		"LDR     R2, [R0,#0x88]!\n"
+		"LDR     R1, [R0,#4]\n"
+		"MOV     R0, R1\n"
+		"BLX     R2\n"
+		"B       loc_FF8B6E50\n"
+
+		"loc_FF8B6918:\n"
+		"CMP     R1, #0x25\n"
+		"BNE     loc_FF8B6968\n"
+		"LDR     R0, [R7,#0x1C]\n"
+		"MOV     R1, #0x80\n"
+		"BL      sub_FF827B40\n"
+		"LDR     R0, =0xFF8B329C\n"
+		"MOV     R1, #0x80\n"
+		"BL      sub_FF92F844\n" // LOCATION: IrisController.c:74
+		"LDR     R0, [R7,#0x1C]\n"
+		"MOV     R2, R8\n"
+		"MOV     R1, #0x80\n"
+		"BL      sub_FF827A44\n" // LOCATION: KerFlag.c:0
+		"TST     R0, #1\n"
+		"LDRNE   R1, =0xD1B\n"
+		"BNE     loc_FF8B69AC\n"
+
+		"loc_FF8B6954:\n"
+		"LDR     R1, [SP,#0x38-0x1C]\n"
+		"LDR     R0, [R1,#0x8C]\n"
+		"LDR     R1, [R1,#0x88]\n"
+		"BLX     R1\n"
+		"B       loc_FF8B6E50\n"
+
+		"loc_FF8B6968:\n"
+		"CMP     R1, #0x26\n"
+		"BNE     loc_FF8B69B8\n"
+		"ADD     R1, SP, #0x38-0x2C\n"
+		"BL      sub_FF8B6814\n" // LOCATION: ExpDrv.c:512
+		"LDR     R0, [R7,#0x1C]\n"
+		"MOV     R1, #0x100\n"
+		"BL      sub_FF827B40\n"
+		"LDR     R0, =0xFF8B32AC\n"
+		"MOV     R1, #0x100\n"
+		"BL      sub_FF92FACC\n" // LOCATION: IrisController.c:160
+		"LDR     R0, [R7,#0x1C]\n"
+		"MOV     R2, R8\n"
+		"MOV     R1, #0x100\n"
+		"BL      sub_FF827A44\n" // LOCATION: KerFlag.c:0
+		"TST     R0, #1\n"
+		"BEQ     loc_FF8B6954\n"
+		"LDR     R1, =0xD25\n"
+
+		"loc_FF8B69AC:\n"
+		"LDR     R0, =0xFF8B399C\n" // "ExpDrv.c"
+		"BL      _DebugAssert\n"
+		"B       loc_FF8B6954\n"
+
+		"loc_FF8B69B8:\n"
+		"CMP     R1, #0x27\n"
+		"BNE     loc_FF8B69D0\n"
+
+		"loc_FF8B69C0:\n"
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"ADD     R1, SP, #0x38-0x2C\n"
+		"BL      sub_FF8B6814\n" // LOCATION: ExpDrv.c:512
+		"B       loc_FF8B6954\n"
+
+		"loc_FF8B69D0:\n"
+		"CMP     R1, #0x2A\n"
+		"BNE     loc_FF8B69E8\n"
+		"BL      sub_FF895C1C\n" // LOCATION: Shutter.c:2
+		"BL      sub_FF8969E8\n" // LOCATION: ImgPixel.c:0
+		"BL      sub_FF89646C\n" // LOCATION: ImgGain.c:0
+		"B       loc_FF8B6954\n"
+
+		"loc_FF8B69E8:\n"
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"MOV     R4, #1\n"
+		"LDR     R1, [R0]\n"
+		"CMP     R1, #0x11\n"
+		"CMPNE   R1, #0x12\n"
+		"BNE     loc_FF8B6A58\n"
+		"LDR     R1, [R0,#0x7C]\n"
+		"ADD     R1, R1, R1,LSL#1\n"
+		"ADD     R1, R0, R1,LSL#2\n"
+		"SUB     R1, R1, #8\n"
+		"LDMIA   R1, {R2-R4}\n"
+		"STMIA   R6, {R2-R4}\n"
+		"BL      sub_FF8B5328\n" // LOCATION: ExpDrv.c:2
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"LDR     R1, [R0,#0x7C]\n"
+		"LDR     R3, [R0,#0x88]\n"
+		"LDR     R2, [R0,#0x8C]\n"
+		"ADD     R0, R0, #4\n"
+		"BLX     R3\n"
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"BL      sub_FF8B7EA4\n" // LOCATION: ExpDrv.c:0
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"LDR     R1, [R0,#0x7C]\n"
+		"LDR     R3, [R0,#0x90]\n"
+		"LDR     R2, [R0,#0x94]\n"
+		"ADD     R0, R0, #4\n"
+		"BLX     R3\n"
+		"B       loc_FF8B6D90\n"
+
+		"loc_FF8B6A58:\n"
+		"CMP     R1, #0x13\n"
+		"CMPNE   R1, #0x14\n"
+		"CMPNE   R1, #0x15\n"
+		"BNE     loc_FF8B6B0C\n"
+		"ADD     R3, SP, #0x38-0x2C\n"
+		"MOV     R2, SP\n"
+		"ADD     R1, SP, #0x38-0x28\n"
+		"BL      sub_FF8B5570\n" // LOCATION: ExpDrv.c:0
+		"CMP     R0, #1\n"
+		"MOV     R4, R0\n"
+		"CMPNE   R4, #5\n"
+		"BNE     loc_FF8B6AA8\n"
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"MOV     R2, R4\n"
+		"LDR     R1, [R0,#0x7C]!\n"
+		"LDR     R12, [R0,#0xC]!\n"
+		"LDR     R3, [R0,#4]\n"
+		"MOV     R0, SP\n"
+		"BLX     R12\n"
+		"B       loc_FF8B6AE0\n"
+
+		"loc_FF8B6AA8:\n"
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"CMP     R4, #2\n"
+		"LDR     R3, [R0,#0x8C]\n"
+		"CMPNE   R4, #6\n"
+		"BNE     loc_FF8B6AF4\n"
+		"LDR     R12, [R0,#0x88]\n"
+		"MOV     R0, SP\n"
+		"MOV     R2, R4\n"
+		"MOV     R1, #1\n"
+		"BLX     R12\n"
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"MOV     R2, SP\n"
+		"ADD     R1, SP, #0x38-0x28\n"
+		"BL      sub_FF8B6528\n" // LOCATION: ExpDrv.c:0
+
+		"loc_FF8B6AE0:\n"
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"LDR     R2, [SP,#0x38-0x2C]\n"
+		"MOV     R1, R4\n"
+		"BL      sub_FF8B67B4\n" // LOCATION: ExpDrv.c:2
+		"B       loc_FF8B6D90\n"
+
+		"loc_FF8B6AF4:\n"
+		"LDR     R1, [R0,#0x7C]\n"
+		"LDR     R12, [R0,#0x88]\n"
+		"ADD     R0, R0, #4\n"
+		"MOV     R2, R4\n"
+		"BLX     R12\n"
+		"B       loc_FF8B6D90\n"
+
+		"loc_FF8B6B0C:\n"
+		"CMP     R1, #0x21\n"
+		"CMPNE   R1, #0x22\n"
+		"BNE     loc_FF8B6B58\n"
+		"LDR     R1, [R0,#0x7C]\n"
+		"ADD     R1, R1, R1,LSL#1\n"
+		"ADD     R1, R0, R1,LSL#2\n"
+		"SUB     R1, R1, #8\n"
+		"LDMIA   R1, {R2-R4}\n"
+		"STMIA   R6, {R2-R4}\n"
+		"BL      sub_FF8B48B4\n" // LOCATION: ExpDrv.c:0
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"LDR     R1, [R0,#0x7C]\n"
+		"LDR     R3, [R0,#0x88]\n"
+		"LDR     R2, [R0,#0x8C]\n"
+		"ADD     R0, R0, #4\n"
+		"BLX     R3\n"
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"BL      sub_FF8B4BA4\n" // LOCATION: ExpDrv.c:0
+		"B       loc_FF8B6D90\n"
+
+		"loc_FF8B6B58:\n"
+		"ADD     R1, R0, #4\n"
+		"LDMIA   R1, {R2,R3,R12}\n"
+		"STMIA   R6, {R2,R3,R12}\n"
+		"LDR     R1, [R0]\n"
+		"CMP     R1, #0x24\n"
+		"ADDLS   PC, PC, R1,LSL#2\n"
+		"B       loc_FF8B6D70\n"
+
+		"loc_FF8B6B74:\n"
+		"B       loc_FF8B6C08\n"
+
+		"loc_FF8B6B78:\n"
+		"B       loc_FF8B6C08\n"
+
+		"loc_FF8B6B7C:\n"
+		"B       loc_FF8B6C58\n"
+
+		"loc_FF8B6B80:\n"
+		"B       loc_FF8B6C60\n"
+
+		"loc_FF8B6B84:\n"
+		"B       loc_FF8B6C60\n"
+
+		"loc_FF8B6B88:\n"
+		"B       loc_FF8B6C60\n"
+
+		"loc_FF8B6B8C:\n"
+		"B       loc_FF8B6C08\n"
+
+		"loc_FF8B6B90:\n"
+		"B       loc_FF8B6C58\n"
+
+		"loc_FF8B6B94:\n"
+		"B       loc_FF8B6C60\n"
+
+		"loc_FF8B6B98:\n"
+		"B       loc_FF8B6C60\n"
+
+		"loc_FF8B6B9C:\n"
+		"B       loc_FF8B6C78\n"
+
+		"loc_FF8B6BA0:\n"
+		"B       loc_FF8B6C78\n"
+
+		"loc_FF8B6BA4:\n"
+		"B       loc_FF8B6D64\n"
+
+		"loc_FF8B6BA8:\n"
+		"B       loc_FF8B6D6C\n"
+
+		"loc_FF8B6BAC:\n"
+		"B       loc_FF8B6D6C\n"
+
+		"loc_FF8B6BB0:\n"
+		"B       loc_FF8B6D6C\n"
+
+		"loc_FF8B6BB4:\n"
+		"B       loc_FF8B6D6C\n"
+
+		"loc_FF8B6BB8:\n"
+		"B       loc_FF8B6D70\n"
+
+		"loc_FF8B6BBC:\n"
+		"B       loc_FF8B6D70\n"
+
+		"loc_FF8B6BC0:\n"
+		"B       loc_FF8B6D70\n"
+
+		"loc_FF8B6BC4:\n"
+		"B       loc_FF8B6D70\n"
+
+		"loc_FF8B6BC8:\n"
+		"B       loc_FF8B6D70\n"
+
+		"loc_FF8B6BCC:\n"
+		"B       loc_FF8B6C68\n"
+
+		"loc_FF8B6BD0:\n"
+		"B       loc_FF8B6C70\n"
+
+		"loc_FF8B6BD4:\n"
+		"B       loc_FF8B6C70\n"
+
+		"loc_FF8B6BD8:\n"
+		"B       loc_FF8B6C84\n"
+
+		"loc_FF8B6BDC:\n"
+		"B       loc_FF8B6C84\n"
+
+		"loc_FF8B6BE0:\n"
+		"B       loc_FF8B6C8C\n"
+
+		"loc_FF8B6BE4:\n"
+		"B       loc_FF8B6CBC\n"
+
+		"loc_FF8B6BE8:\n"
+		"B       loc_FF8B6CEC\n"
+
+		"loc_FF8B6BEC:\n"
+		"B       loc_FF8B6D1C\n"
+
+		"loc_FF8B6BF0:\n"
+		"B       loc_FF8B6D4C\n"
+
+		"loc_FF8B6BF4:\n"
+		"B       loc_FF8B6D4C\n"
+
+		"loc_FF8B6BF8:\n"
+		"B       loc_FF8B6D70\n"
+
+		"loc_FF8B6BFC:\n"
+		"B       loc_FF8B6D70\n"
+
+		"loc_FF8B6C00:\n"
+		"B       loc_FF8B6D54\n"
+
+		"loc_FF8B6C04:\n"
+		"B       loc_FF8B6D5C\n"
+
+		"loc_FF8B6C08:\n"
+		// jumptable FF8B6B6C entries 0,1,6
+		"BL      sub_FF8B3784\n" // LOCATION: ExpDrv.c:800
+		"B       loc_FF8B6D70\n"
+
+		"loc_FF8B6C58:\n"
+		// jumptable FF8B6B6C entries 2,7
+		"BL      sub_FF8B3A14\n" // LOCATION: ExpDrv.c:0
+		"B       loc_FF8B6D70\n"
+
+		"loc_FF8B6C60:\n"
+		// jumptable FF8B6B6C entries 3-5,8,9
+		"BL      sub_FF8B3C18\n" // LOCATION: ExpDrv.c:0
+		"B       loc_FF8B6D70\n"
+
+		"loc_FF8B6C68:\n"
+		// jumptable FF8B6B6C entry 22
+		"BL      sub_FF8B3E80\n" // LOCATION: ExpDrv.c:2
+		"B       loc_FF8B6D70\n"
+
+		"loc_FF8B6C70:\n"
+		// jumptable FF8B6B6C entries 23,24
+		"BL      sub_FF8B4074\n" // LOCATION: ExpDrv.c:11
+		"B       loc_FF8B6D70\n"
+
+		"loc_FF8B6C78:\n"
+		// jumptable FF8B6B6C entries 10,11
+		//"BL      sub_FF8B42DC\n" // LOCATION: ExpDrv.c:2
+		"BL      sub_FF8B42DC_my\n" //------------>
+		"MOV     R4, #0\n"
+		"B       loc_FF8B6D70\n"
+
+		"loc_FF8B6C84:\n"
+		// jumptable FF8B6B6C entries 25,26
+		"BL      sub_FF8B4418\n"
+		"B       loc_FF8B6D70\n"
+
+		"loc_FF8B6C8C:\n"
+		// jumptable FF8B6B6C entry 27
+		"LDRH    R1, [R0,#4]\n"
+		"STRH    R1, [SP,#0x38-0x28]\n"
+		"LDRH    R1, [R5,#2]\n"
+		"STRH    R1, [SP,#0x38-0x26]\n"
+		"LDRH    R1, [R5,#4]\n"
+		"STRH    R1, [SP,#0x38-0x24]\n"
+		"LDRH    R1, [R5,#6]\n"
+		"STRH    R1, [SP,#0x38-0x22]\n"
+		"LDRH    R1, [R0,#0xC]\n"
+		"STRH    R1, [SP,#0x38-0x20]\n"
+		"BL      sub_FF8B7B44\n" // LOCATION: ExpDrv.c:2
+		"B       loc_FF8B6D70\n"
+
+		"loc_FF8B6CBC:\n"
+		// jumptable FF8B6B6C entry 28
+		"LDRH    R1, [R0,#4]\n"
+		"STRH    R1, [SP,#0x38-0x28]\n"
+		"LDRH    R1, [R5,#2]\n"
+		"STRH    R1, [SP,#0x38-0x26]\n"
+		"LDRH    R1, [R5,#4]\n"
+		"STRH    R1, [SP,#0x38-0x24]\n"
+		"LDRH    R1, [R5,#6]\n"
+		"STRH    R1, [SP,#0x38-0x22]\n"
+		"LDRH    R1, [R5,#8]\n"
+		"STRH    R1, [SP,#0x38-0x20]\n"
+		"BL      sub_FF8B7CC0\n" // LOCATION: ExpDrv.c:2
+		"B       loc_FF8B6D70\n"
+
+		"loc_FF8B6CEC:\n"
+		// jumptable FF8B6B6C entry 29
+		"LDRH    R1, [R5]\n"
+		"STRH    R1, [SP,#0x38-0x28]\n"
+		"LDRH    R1, [R0,#6]\n"
+		"STRH    R1, [SP,#0x38-0x26]\n"
+		"LDRH    R1, [R5,#4]\n"
+		"STRH    R1, [SP,#0x38-0x24]\n"
+		"LDRH    R1, [R5,#6]\n"
+		"STRH    R1, [SP,#0x38-0x22]\n"
+		"LDRH    R1, [R5,#8]\n"
+		"STRH    R1, [SP,#0x38-0x20]\n"
+		"BL      sub_FF8B7D6C\n" // LOCATION: ExpDrv.c:0
+		"B       loc_FF8B6D70\n"
+
+		"loc_FF8B6D1C:\n"
+		// jumptable FF8B6B6C entry 30
+		"LDRH    R1, [R5]\n"
+		"STRH    R1, [SP,#0x38-0x28]\n"
+		"LDRH    R1, [R5,#2]\n"
+		"STRH    R1, [SP,#0x38-0x26]\n"
+		"LDRH    R1, [R5,#4]\n"
+		"STRH    R1, [SP,#0x38-0x24]\n"
+		"LDRH    R1, [R5,#6]\n"
+		"STRH    R1, [SP,#0x38-0x22]\n"
+		"LDRH    R1, [R0,#0xC]\n"
+		"STRH    R1, [SP,#0x38-0x20]\n"
+		"BL      sub_FF8B7E0C\n" // LOCATION: ExpDrv.c:32
+		"B       loc_FF8B6D70\n"
+
+		"loc_FF8B6D4C:\n"
+		// jumptable FF8B6B6C entries 31,32
+		"BL      sub_FF8B468C\n" // LOCATION: ExpDrv.c:0
+		"B       loc_FF8B6D70\n"
+
+		"loc_FF8B6D54:\n"
+		// jumptable FF8B6B6C entry 35
+		"BL      sub_FF8B4CA8\n" // LOCATION: ExpDrv.c:10
+		"B       loc_FF8B6D70\n"
+
+		"loc_FF8B6D5C:\n"
+		// jumptable FF8B6B6C entry 36
+		"BL      sub_FF8B4EE0\n" // LOCATION: ExpDrv.c:0
+		"B       loc_FF8B6D70\n"
+
+		"loc_FF8B6D64:\n"
+		// jumptable FF8B6B6C entry 12
+		"BL      sub_FF8B5058\n" // LOCATION: ExpDrv.c:2
+		"B       loc_FF8B6D70\n"
+
+		"loc_FF8B6D6C:\n"
+		// jumptable FF8B6B6C entries 13-16
+		"BL      sub_FF8B51F0\n" // LOCATION: ExpDrv.c:128
+
+		"loc_FF8B6D70:\n"
+		// jumptable FF8B6B6C default entry
+		// jumptable FF8B6B6C entries 17-21,33,34
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"LDR     R1, [R0,#0x7C]\n"
+		"LDR     R3, [R0,#0x88]\n"
+		"LDR     R2, [R0,#0x8C]\n"
+		"ADD     R0, R0, #4\n"
+		"BLX     R3\n"
+		"CMP     R4, #1\n"
+		"BNE     loc_FF8B6DD8\n"
+
+		"loc_FF8B6D90:\n"
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"MOV     R2, #0xC\n"
+		"LDR     R1, [R0,#0x7C]\n"
+		"ADD     R1, R1, R1,LSL#1\n"
+		"ADD     R0, R0, R1,LSL#2\n"
+		"SUB     R4, R0, #8\n"
+		"LDR     R0, =0x3E198\n"
+		"ADD     R1, SP, #0x38-0x28\n"
+		"BL      sub_FFAAD774\n"
+		"LDR     R0, =0x3E1A4\n"
+		"MOV     R2, #0xC\n"
+		"ADD     R1, SP, #0x38-0x28\n"
+		"BL      sub_FFAAD774\n"
+		"LDR     R0, =0x3E1B0\n"
+		"MOV     R2, #0xC\n"
+		"MOV     R1, R4\n"
+		"BL      sub_FFAAD774\n"
+		"B       loc_FF8B6E50\n"
+
+		"loc_FF8B6DD8:\n"
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"LDR     R0, [R0]\n"
+		"CMP     R0, #0xB\n"
+		"BNE     loc_FF8B6E20\n"
+		"MOV     R3, #0\n"
+		"STR     R3, [SP,#0x38-0x38]\n"
+		"MOV     R3, #1\n"
+		"MOV     R2, #1\n"
+		"MOV     R1, #1\n"
+		"MOV     R0, #0\n"
+		"BL      sub_FF8B358C\n"
+		"MOV     R3, #0\n"
+		"STR     R3, [SP,#0x38-0x38]\n"
+		"MOV     R3, #1\n"
+		"MOV     R2, #1\n"
+		"MOV     R1, #1\n"
+		"MOV     R0, #0\n"
+		"B       loc_FF8B6E4C\n"
+
+		"loc_FF8B6E20:\n"
+		"MOV     R3, #1\n"
+		"MOV     R2, #1\n"
+		"MOV     R1, #1\n"
+		"MOV     R0, #1\n"
+		"STR     R3, [SP,#0x38-0x38]\n"
+		"BL      sub_FF8B358C\n"
+		"MOV     R3, #1\n"
+		"MOV     R2, #1\n"
+		"MOV     R1, #1\n"
+		"MOV     R0, #1\n"
+		"STR     R3, [SP,#0x38-0x38]\n"
+
+		"loc_FF8B6E4C:\n"
+		"BL      sub_FF8B36CC\n"
+
+		"loc_FF8B6E50:\n"
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"BL      sub_FF8B7AD0\n" // LOCATION: ExpDrv.c:268
+		"B       loc_FF8B6884\n"
+		);
+}
+
+void __attribute__((naked,noinline)) sub_FF8B42DC_my()
+{
+	asm volatile (
+		"STMFD   SP!, {R4-R8,LR}\n"
+		"LDR     R7, =0x6E30\n"
+		"MOV     R4, R0\n"
+		"LDR     R0, [R7,#0x1C]\n"
+		"MOV     R1, #0x3E\n"
+		"BL      sub_FF827B40\n"
+		"LDRSH   R0, [R4,#4]\n"
+		"MOV     R2, #0\n"
+		"MOV     R1, #0\n"
+		"BL      sub_FF8B3320\n"
+		"MOV     R6, R0\n"
+		"LDRSH   R0, [R4,#6]\n"
+		"BL      sub_FF8B342C\n"
+		"LDRSH   R0, [R4,#8]\n"
+		"BL      sub_FF8B3484\n"
+		"LDRSH   R0, [R4,#0xA]\n"
+		"BL      sub_FF8B34DC\n"
+		"LDRSH   R0, [R4,#0xC]\n"
+		"BL      sub_FF8B3534\n"
+		"MOV     R5, R0\n"
+		"LDR     R0, [R4]\n"
+		"LDR     R8, =0x3E1B0\n"
+		"CMP     R0, #0xB\n"
+		"MOVEQ   R6, #0\n"
+		"MOVEQ   R5, #0\n"
+		"BEQ     loc_FF8B436C\n"
+		"CMP     R6, #1\n"
+		"BNE     loc_FF8B436C\n"
+		"LDRSH   R0, [R4,#4]\n"
+		"LDR     R1, =0xFF8B328C\n"
+		"MOV     R2, #2\n"
+		"BL      sub_FF92F998\n" // LOCATION: IrisController.c:117
+		"STRH    R0, [R4,#4]\n"
+		"MOV     R0, #0\n"
+		"STR     R0, [R7,#0x28]\n"
+		"B       loc_FF8B4374\n"
+
+		"loc_FF8B436C:\n"
+		"LDRH    R0, [R8]\n"
+		"STRH    R0, [R4,#4]\n"
+
+		"loc_FF8B4374:\n"
+		"CMP     R5, #1\n"
+		"LDRNEH  R0, [R8,#8]\n"
+		"BNE     loc_FF8B4390\n"
+		"LDRSH   R0, [R4,#0xC]\n"
+		"MOV     R2, #0x20\n"
+		"LDR     R1, =0xFF8B3310\n"
+		"BL      sub_FF8B7B00\n"
+
+		"loc_FF8B4390:\n"
+		"STRH    R0, [R4,#0xC]\n"
+		"LDRSH   R0, [R4,#6]\n"
+		//"BL      sub_FF895968\n" // LOCATION: Shutter.c:0
+		"BL      sub_FF895968_my\n" //------------>
+		"LDRSH   R0, [R4,#8]\n"
+		"MOV     R1, #1\n"
+		"BL      sub_FF896164\n" // LOCATION: ImgGain.c:0
+		"MOV     R1, #0\n"
+		"ADD     R0, R4, #8\n"
+		"BL      sub_FF8961EC\n" // LOCATION: ImgGain.c:0
+		"LDRSH   R0, [R4,#0xE]\n"
+		"BL      sub_FF8AA25C\n" // LOCATION: BrtCrct.c:552
+		"LDR     R4, =0xBB8\n"
+		"CMP     R6, #1\n"
+		"BNE     loc_FF8B43E8\n"
+		"LDR     R0, [R7,#0x1C]\n"
+		"MOV     R2, R4\n"
+		"MOV     R1, #2\n"
+		"BL      sub_FF827A44\n" // LOCATION: KerFlag.c:0
+		"TST     R0, #1\n"
+		"LDRNE   R1, =0x532\n"
+		"LDRNE   R0, =0xFF8B399C\n" // "ExpDrv.c"
+		"BLNE    _DebugAssert\n"
+
+		"loc_FF8B43E8:\n"
+		"CMP     R5, #1\n"
+		"LDMNEFD SP!, {R4-R8,PC}\n"
+		"LDR     R0, [R7,#0x1C]\n"
+		"MOV     R2, R4\n"
+		"MOV     R1, #0x20\n"
+		"BL      sub_FF827A44\n" // LOCATION: KerFlag.c:0
+		"TST     R0, #1\n"
+		"LDRNE   R1, =0x537\n"
+		"LDRNE   R0, =0xFF8B399C\n" // "ExpDrv.c"
+		"LDMNEFD SP!, {R4-R8,LR}\n"
+		"BNE     _DebugAssert\n"
+		"LDMFD   SP!, {R4-R8,PC}\n"
+		);
+}
+
+void __attribute__((naked,noinline)) sub_FF895968_my()
+{
+	asm volatile (
+		"STMFD   SP!, {R4-R6,LR}\n"
+		"LDR     R5, =0x68EC\n"
+		"MOV     R4, R0\n"
+		"LDR     R0, [R5,#4]\n"
+		"CMP     R0, #1\n"
+		"LDRNE   R1, =0x16D\n"
+		"LDRNE   R0, =0xFF895700\n" // "Shutter.c"
+		"BLNE    _DebugAssert\n"
+		"CMN     R4, #0xC00\n"
+		"LDREQSH R4, [R5,#2]\n"
+		"CMN     R4, #0xC00\n"
+		"LDREQ   R1, =0x173\n"
+		"LDREQ   R0, =0xFF895700\n" // "Shutter.c"
+		"STRH    R4, [R5,#2]\n"
+		"BLEQ    _DebugAssert\n"
+		"MOV     R0, R4\n"
+		//"BL      sub_FF9B2824\n"
+		"BL      apex2us\n" // +
+		"MOV     R4, R0\n"
+		"BL      sub_FF8C53CC\n" // nullsub_67
+		"MOV     R0, R4\n"
+		"BL      sub_FF8C98BC\n"
+		"TST     R0, #1\n"
+		"LDMNEFD SP!, {R4-R6,LR}\n"
+		"MOVNE   R1, #0x178\n"
+		"LDRNE   R0, =0xFF895700\n" // "Shutter.c"
+		"BNE     _DebugAssert\n"
+		"LDMFD   SP!, {R4-R6,PC}\n"
+		);
+}
Index: /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100c/stubs_entry.S
===================================================================
--- /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100c/stubs_entry.S	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100c/stubs_entry.S	(revision 1668)
@@ -0,0 +1,230 @@
+// !!! THIS FILE IS GENERATED. DO NOT EDIT. !!!
+#include "stubs_asm.h"
+
+// Camera info:
+//   DRYOS R23 (DRYOS version 2.3, release #0023)
+//   Firmware Ver GM1.00C
+//   Canon DIGITAL IXUS 970 IS
+
+// Values for makefile.inc
+//   PLATFORMID = 12659 (0x3173) // Found @ 0xfffe0130
+//   MAXRAMADDR = 0x03ffffff
+//   KEYSYS = d3enc              // Found @ 0xffff33e0
+//   NEED_ENCODED_DISKBOOT = 1   // Found @ 0xffff33c0
+
+// Stubs below should be checked. Stub not matched 100%, or difference found to current 'stubs_entry_2.S'
+//    Name                                     Address      Rule  %  Comp to stubs_entry_2.S
+//NSTUB(DebugAssert                           ,0xff81bcf0) //111        *** != 0xff81bcf8
+//NSTUB(PutInNdFilter                         ,0xffa2ac20) //102        *** != 0xffa838f8
+//NSTUB(PutOutNdFilter                        ,0xffa2ac44) //102        *** != 0xffa8392c
+
+// Check of modemap from 'platform/CAMERA/shooting.c':
+// Firmware modemap table found @ff8790f8 -> ff87589c -> ff95c8b8 -> ffa3eec8 -> ffaf9530
+// No problems found with modemap table.
+
+// Values below can be overridden in 'stubs_min.S':
+DEF(physw_status                            ,0x00010650) // Found @0xff821e38
+DEF(physw_run                               ,0x00001c00) // Found @0xff821ad0
+DEF(levent_table                            ,0xffad40a0) // Found @0xffad40a0
+DEF(FlashParamsTable                        ,0xffaf96f0) // Found @0xffaf96f0
+DEF(movie_status                            ,0x000053cc) // Found @0xff859d78
+DEF(canon_menu_active                       ,0x000099e0) // Found @0xff950198
+DEF(canon_shoot_menu_active                 ,0x00009fd9) // Found @0xff96cd70
+DEF(playrec_mode                            ,0x0000555c) // Found @0xff861170
+DEF(zoom_status                             ,0x0000d4a4) // Found @0xffa406c8
+DEF(some_flag_for_af_scan                   ,0x0000d228) // Found @0xffa2b598
+// focus_len_table contains zoom focus lengths for use in 'get_focal_length' (main.c).
+// each entry contains 3 int value(s), the first is the zoom focus length.
+// there are 12 entries in the table - set NUM_FL to 12
+DEF(focus_len_table                         ,0xfffe297c) // Found @0xfffe297c
+DEF(zoom_busy                               ,0x00008aa0) // Found @0xff932a88
+DEF(focus_busy                              ,0x0000898c) // Found @0xff92e134
+//DEF(recreview_hold                          ,0x00006188) // Found @0xff87eb90, ** != ** stubs_min = 0x00009d98 (0x9CEC+0xAC)
+
+// Values below go in 'lib.c':
+//void *vid_get_bitmap_fb()        { return (void*)0x10361000; }             // Found @0xff83e8a0
+//void *vid_get_viewport_fb()      { return (void*)0x1065adc0; }             // Found @0xffa88afc
+//void *vid_get_viewport_fb_d()    { return (void*)(*(int*)(0x51fc+0x50)); } // Found @0xff853078 & 0xff8530b0
+//char *camera_jpeg_count_str()    { return (char*)0x0004ca80; }             // Found @0xff9a6fdc
+//long hook_raw_size()             { return 0x00ec04f0; }                    // Found @0xffa8ad80
+//int get_flash_params_count(void) { return 0x73; }                          // Found @0xff95d974
+
+// Bitmap masks and physw_status index values for SD_READONLY and USB power flags (for kbd.c).
+//#define SD_READONLY_FLAG    0x00020000 // Found @0xffab1704, levent 0x90a
+//#define SD_READONLY_IDX     2
+//#define USB_MASK            0x00040000 // Found @0xffab1710, levent 0x902
+//#define USB_IDX             2
+
+// Keymap values for kbd.c. Additional keys may be present, only common values included here.
+//static KeyMap keymap[] = {
+//    { 2, KEY_ZOOM_IN         ,0x00000004 }, // Found @0xffab1674, levent 0x02
+//    { 2, KEY_ZOOM_OUT        ,0x00000008 }, // Found @0xffab1680, levent 0x03
+//    { 2, KEY_LEFT            ,0x00000010 }, // Found @0xffab168c, levent 0x06
+//    { 2, KEY_RIGHT           ,0x00000020 }, // Found @0xffab1698, levent 0x07
+//    { 2, KEY_DOWN            ,0x00000040 }, // Found @0xffab16a4, levent 0x05
+//    { 2, KEY_UP              ,0x00000080 }, // Found @0xffab16b0, levent 0x04
+//    { 2, KEY_SET             ,0x00000100 }, // Found @0xffab16bc, levent 0x08
+//    { 2, KEY_DISPLAY         ,0x00000200 }, // Found @0xffab16c8, levent 0x0a
+//    { 2, KEY_SHOOT_FULL      ,0x00000003 }, // Found @0xffab1668, levent 0x01
+//    { 2, KEY_SHOOT_FULL_ONLY ,0x00000002 }, // Found @0xffab1668, levent 0x01
+//    { 2, KEY_MENU            ,0x00000400 }, // Found @0xffab16d4, levent 0x09
+//    { 2, KEY_SHOOT_HALF      ,0x00000001 }, // Found @0xffab165c, levent 0x00
+//    { 0, 0, 0 }
+//};
+
+// Values below go in 'platform_camera.h':
+//#define CAM_DRYOS         1
+//#define CAM_RAW_ROWPIX    3720 // Found @0xffa8251c
+//#define CAM_RAW_ROWS      2772 // Found @0xffa82524
+//#undef  CAM_UNCACHED_BIT
+//#define CAM_UNCACHED_BIT  0x10000000 // Found @0xff8285a8
+
+// Misc stuff
+DEF(ctypes, 0xffab11d2)
+
+// For capt_seq.c
+//static long *nrflag = (long*)(0x91a4);       // Found @ ff93db9c
+
+// Stubs below matched 100%.
+//    Name                                     Address                Comp to stubs_entry_2.S
+NSTUB(AllocateMemory                          ,0xffa2e430) //101
+NSTUB(AllocateUncacheableMemory               ,0xff82856c) //112
+NSTUB(Close                                   ,0xff823d90) //101
+NSTUB(CreateTask                              ,0xff81b818) //101
+NSTUB(DeleteDirectory_Fut                     ,0xff823720) //  1
+NSTUB(DeleteFile_Fut                          ,0xff82363c) //112
+NSTUB(DoAFLock                                ,0xff825b88) //102
+NSTUB(EnterToCompensationEVF                  ,0xff825e84) //104
+NSTUB(ExecuteEventProcedure                   ,0xff869408) //  1
+NSTUB(ExitFromCompensationEVF                 ,0xff825ed4) //104
+NSTUB(ExitTask                                ,0xff81baa8) //101
+NSTUB(ExpCtrlTool_StartContiAE                ,0xff832b04) //104
+NSTUB(ExpCtrlTool_StopContiAE                 ,0xff832c48) //104
+NSTUB(Fclose_Fut                              ,0xff8237b8) //101
+NSTUB(Feof_Fut                                ,0xff8239a4) //  1
+NSTUB(Fflush_Fut                              ,0xff8239e0) //  1
+NSTUB(Fgets_Fut                               ,0xff82390c) //  1
+NSTUB(Fopen_Fut                               ,0xff823778) //101
+NSTUB(Fread_Fut                               ,0xff823864) //101
+NSTUB(FreeMemory                              ,0xffa2e428) //101
+NSTUB(FreeUncacheableMemory                   ,0xff8285a0) //112
+NSTUB(Fseek_Fut                               ,0xff823958) //101
+NSTUB(Fwrite_Fut                              ,0xff8238b8) //101
+NSTUB(GetBatteryTemperature                   ,0xff8453a0) //102
+NSTUB(GetCCDTemperature                       ,0xff845330) //102
+NSTUB(GetCurrentAvValue                       ,0xff92fb48) //102
+NSTUB(GetDrive_ClusterSize                    ,0xff84f2c0) //  1
+NSTUB(GetDrive_FreeClusters                   ,0xff84f328) //  1
+NSTUB(GetDrive_TotalClusters                  ,0xff84f2f4) //  1
+NSTUB(GetFocusLensSubjectDistance             ,0xff92ec40) //102
+NSTUB(GetFocusLensSubjectDistanceFromLens     ,0xff92ef4c) //  1
+NSTUB(GetKbdState                             ,0xff8428e8) //109
+NSTUB(GetMemInfo                              ,0xff813c40) //  1
+NSTUB(GetOpticalTemperature                   ,0xff845410) //102
+NSTUB(GetParameterData                        ,0xff95d934) //101
+NSTUB(GetPropertyCase                         ,0xff86d008) //102
+NSTUB(GetSystemTime                           ,0xffa2e488) //101
+NSTUB(GetZoomLensCurrentPoint                 ,0xff932dec) //102
+NSTUB(GetZoomLensCurrentPosition              ,0xffa244d8) //102
+NSTUB(GiveSemaphore                           ,0xff81b77c) //112
+NSTUB(IsStrobeChargeCompleted                 ,0xff8bda04) //102
+NSTUB(LEDDrive                                ,0xff84206c) //103
+NSTUB(LocalTime                               ,0xff866acc) //  1
+NSTUB(LockMainPower                           ,0xff8754b4) //103
+NSTUB(Lseek                                   ,0xff823ed0) //101
+NSTUB(MakeDirectory_Fut                       ,0xff8236b0) //  1
+NSTUB(MoveFocusLensToDistance                 ,0xffa85638) //102
+NSTUB(MoveIrisWithAv                          ,0xffa2a838) //102
+NSTUB(MoveZoomLensWithPoint                   ,0xffa2adbc) //102
+NSTUB(NewTaskShell                            ,0xff86cacc) //103
+NSTUB(Open                                    ,0xff823d68) //101
+NSTUB(PB2Rec                                  ,0xff8784d0) //104
+NSTUB(PT_MoveDigitalZoomToWide                ,0xff85bbe4) //102
+NSTUB(PT_MoveOpticalZoomAt                    ,0xff85bbbc) //102
+NSTUB(PT_PlaySound                            ,0xff85b240) //102
+NSTUB(PostLogicalEventForNotPowerType         ,0xff873274) //103
+NSTUB(PostLogicalEventToUI                    ,0xff8732c0) //103
+NSTUB(Read                                    ,0xff81a094) //101
+NSTUB(ReadFastDir                             ,0xffa13500) //  1
+NSTUB(Rec2PB                                  ,0xff876ed4) //104
+NSTUB(RefreshPhysicalScreen                   ,0xff9b12e8) //104
+NSTUB(Remove                                  ,0xff823dd8) //  1
+NSTUB(RenameFile_Fut                          ,0xff8235e8) //  1
+NSTUB(Restart                                 ,0xff829de4) //106
+NSTUB(SetAE_ShutterSpeed                      ,0xffa87d0c) //102
+NSTUB(SetAutoShutdownTime                     ,0xff875528) //103
+NSTUB(SetCurrentCaptureModeType               ,0xff87c334) //101
+NSTUB(SetFileAttributes                       ,0xff8240bc) //  1
+NSTUB(SetFileTimeStamp                        ,0xff82406c) //  1
+NSTUB(SetLogicalEventActive                   ,0xff875194) //  1
+NSTUB(SetParameterData                        ,0xff95d8a4) //101
+NSTUB(SetPropertyCase                         ,0xff86cf08) //102
+NSTUB(SetScriptMode                           ,0xff8751e4) //101
+NSTUB(SleepTask                               ,0xff8283f0) //101
+NSTUB(TakeSemaphore                           ,0xff81b6ac) //101
+NSTUB(TurnOffBackLight                        ,0xff881d28) //104
+NSTUB(TurnOnBackLight                         ,0xff881d10) //104
+NSTUB(UIFS_WriteFirmInfoToFile                ,0xff9510f4) //103
+NSTUB(UnlockAF                                ,0xff825bcc) //102
+NSTUB(UnlockMainPower                         ,0xff875408) //103
+NSTUB(UnsetZoomForMovie                       ,0xff962ed0) //104
+NSTUB(UpdateMBROnFlash                        ,0xff84f100) //105
+NSTUB(VbattGet                                ,0xff82071c) //103
+NSTUB(Write                                   ,0xff823e3c) //101
+NSTUB(WriteSDCard                             ,0xff9227e0) //108
+NSTUB(_log                                    ,0xffaaec8c) //111
+NSTUB(_log10                                  ,0xffaadbd0) //112
+NSTUB(_pow                                    ,0xffaadd40) //114
+NSTUB(_sqrt                                   ,0xffab00ac) //  1
+NSTUB(add_ptp_handler                         ,0xff9e1b24) //  1
+NSTUB(apex2us                                 ,0xff9b2824) //  4
+NSTUB(close                                   ,0xff819eac) //  1
+NSTUB(closedir                                ,0xffa135d0) //  1
+NSTUB(err_init_task                           ,0xff814e98) //  4
+NSTUB(exmem_alloc                             ,0xff867bf0) //103
+NSTUB(free                                    ,0xff813a98) //112
+NSTUB(kbd_p1_f                                ,0xff821f3c) //109
+NSTUB(kbd_p1_f_cont                           ,0xff821f48) //109
+NSTUB(kbd_p2_f                                ,0xff821770) //109
+NSTUB(kbd_pwr_off                             ,0xff84296c) //  2
+NSTUB(kbd_pwr_on                              ,0xff84291c) //  2
+NSTUB(kbd_read_keys                           ,0xff821e38) //109
+NSTUB(kbd_read_keys_r2                        ,0xff842494) //109
+NSTUB(lseek                                   ,0xff823ed0) //101
+NSTUB(malloc                                  ,0xff8139c4) //112
+NSTUB(memcmp                                  ,0xff81d844) //101
+NSTUB(memcpy                                  ,0xff8943a4) //101
+NSTUB(memset                                  ,0xff9b169c) //101
+NSTUB(mkdir                                   ,0xff824134) //  1
+// ALT: NSTUB(mkdir, 0xff8241d4) // 1 32/0
+NSTUB(mktime_ext                              ,0xff894c10) //  1
+NSTUB(open                                    ,0xff819dfc) //  1
+NSTUB(opendir                                 ,0xffa1346c) //  1
+NSTUB(openfastdir                             ,0xffa1346c) //  1
+NSTUB(qsort                                   ,0xff9b1ba4) //  1
+NSTUB(rand                                    ,0xff81d94c) //  1
+NSTUB(read                                    ,0xff81a094) //101
+NSTUB(reboot_fw_update                        ,0xffa1af00) //  5
+NSTUB(rename                                  ,0xff8235e8) //  1
+NSTUB(set_control_event                       ,0xff874e10) //  1
+NSTUB(srand                                   ,0xff81d940) //  1
+NSTUB(stat                                    ,0xff823f9c) //  1
+NSTUB(strcat                                  ,0xff894190) //  1
+NSTUB(strchr                                  ,0xff894218) //  1
+NSTUB(strcmp                                  ,0xff81d7dc) //101
+NSTUB(strcpy                                  ,0xff81d7c4) //101
+NSTUB(strftime                                ,0xff894618) //  1
+NSTUB(strlen                                  ,0xff81d820) //101
+NSTUB(strncmp                                 ,0xff8941cc) //  1
+NSTUB(strncpy                                 ,0xff82e200) //  1
+NSTUB(strrchr                                 ,0xff89423c) //  1
+NSTUB(strtol                                  ,0xff82e438) //101
+NSTUB(strtolx                                 ,0xff82e23c) //109
+  DEF(task_CaptSeq                            ,0xff85e03c) //107
+  DEF(task_ExpDrv                             ,0xff8b6864) //110
+  DEF(task_InitFileModules                    ,0xff878f84) //107
+  DEF(task_MovieRecord                        ,0xff85a004) //107
+  DEF(task_PhySw                              ,0xff821acc) //107
+NSTUB(time                                    ,0xff866fd0) //  2
+NSTUB(vsprintf                                ,0xff81d744) //  1
+NSTUB(write                                   ,0xff823e3c) //101
Index: /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100c/stubs_entry_2.S
===================================================================
--- /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100c/stubs_entry_2.S	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100c/stubs_entry_2.S	(revision 1668)
@@ -0,0 +1,33 @@
+#include "stubs_asm.h"
+#define NULL_SUB 0xFF810948
+
+// Override stubs_entry.S
+NHSTUB(DebugAssert,                 0xFF81BCF8)
+NHSTUB(PutInNdFilter,               0xFFA838F8)
+NHSTUB(PutOutNdFilter,              0xFFA8392C)
+
+// These don't exist
+NHSTUB(SetZoomActuatorSpeedPercent, NULL_SUB)
+
+// Additional
+NHSTUB(CreateController,            0xFF872AB8)
+NHSTUB(GetAEIntegralServiceMode_0,  0xFF82ADA4)
+NHSTUB(GetVRAMHPixelsSize_0,        0xFF85CF50)
+NHSTUB(GetVRAMHPixelsSize_1,        0xFF87AC5C)
+NHSTUB(IsControlEventActive,        0xFF875124)
+NHSTUB(IsFactoryMode,               0xFF84630C)
+NHSTUB(KernelCreateTask,            0xFF81BAF0)
+NHSTUB(PT_GetPropertyCaseString,    0xFF86CF08)
+NHSTUB(PT_SetPropertyCaseString,    0xFF86D008)
+NHSTUB(PTM_GetCurrentItem,          0xFF875DE8)
+NHSTUB(PTM_SetCurrentCaptureMode,   0xFF875CC0)
+NHSTUB(RestartDevice,               0xFF829DE4)
+NHSTUB(StartDiskboot,               0xFF829FA8)
+NHSTUB(StartFactoryModeController,  0xFF84637C)
+NHSTUB(StartGUISystem,              0xFF894044)
+NHSTUB(j_PTM_SetCurrentItem,        0xFF95CEF4)
+NHSTUB(taskcreate_CommonDrivers,    0xFF879010)
+NHSTUB(taskcreate_DSITask,          0xFF880B18)
+NHSTUB(taskcreate_FaceFrame,        0xFF8808BC)
+NHSTUB(taskcreate_StartupImage,     0xFF82A4EC)
+NHSTUB(taskcreate_TempCheck,        0xFF820EAC)
Index: /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100c/boot.c
===================================================================
--- /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100c/boot.c	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100c/boot.c	(revision 1668)
@@ -0,0 +1,646 @@
+#include "lolevel.h"
+#include "platform.h"
+#include "core.h"
+
+const char * const new_sa = &_end;
+
+void __attribute__((naked,noinline)) jogdial_task_my();
+
+void taskCreateHook(int *p)
+{
+	p-=16;
+	if (p[0]==0xFF821ACC)  p[0]=(int)mykbd_task;
+	if (p[0]==0xFF842A44)  p[0]=(int)jogdial_task_my; 
+	if (p[0]==0xFF85A004)  p[0]=(int)movie_record_task;
+	if (p[0]==0xFF85E03C)  p[0]=(int)capt_seq_task;
+	if (p[0]==0xFF878F84)  p[0]=(int)init_file_modules_task;
+	if (p[0]==0xFF8B6864)  p[0]=(int)exp_drv_task;
+}
+
+void CreateTask_spytask()
+{
+	_CreateTask("SpyTask", 0x19, 0x2000, core_spytask, 0);
+}
+
+void boot()
+{
+	long *canon_data_src = (void*)0xFFB1E480;
+	long *canon_data_dst = (void*)0x1900;
+	long canon_data_len = 0xF164 - 0x1900; // data_end - data_start
+	long *canon_bss_start = (void*)0xF164; // just after data
+	long canon_bss_len = 0xCBD40 - 0xF164;
+
+	long i;
+
+	// enable caches and write buffer
+	asm volatile (
+		"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;
+
+	// Captain Hook
+	*(int*)0x1930 = (int)taskCreateHook;
+
+	// jump to init-sequence that follows the data-copy-routine
+	asm volatile ("B  sub_FF8101A4_my\n");
+}
+
+void __attribute__((naked,noinline)) sub_FF8101A4_my()
+{
+	asm volatile (
+		"LDR     R0, =0xFF81021C\n" // exception handler code
+		"MOV     R1, #0\n"
+		"LDR     R3, =0xFF810254\n"
+
+		"loc_FF8101B0:\n"
+		"CMP     R0, R3\n" // load exception vector
+		"LDRCC   R2, [R0],#4\n"
+		"STRCC   R2, [R1],#4\n"
+		"BCC     loc_FF8101B0\n"
+		"LDR     R0, =0xFF810254\n"
+		"MOV     R1, #0x4B0\n"
+		"LDR     R3, =0xFF810468\n"
+
+		"loc_FF8101CC:\n"
+		"CMP     R0, R3\n" // copy IRQ handler to ITCM starting at 0x4b0, 532 bytes up to 0x6C4
+		"LDRCC   R2, [R0],#4\n"
+		"STRCC   R2, [R1],#4\n"
+		"BCC     loc_FF8101CC\n"
+		"MOV     R0, #0xD2\n"
+		"MSR     CPSR_cxsf, R0\n" // set CPSR mode = IRQ, ints disabled
+		"MOV     SP, #0x1000\n" // irq mode SP
+		"MOV     R0, #0xD3\n"
+		"MSR     CPSR_cxsf, R0\n" // set CPSR mode = Super, ints disabled
+		"MOV     SP, #0x1000\n" // super mode SP
+		//"LDR     R0, loc_FF810210\n"
+		"LDR     R0, =0x6C4\n" // +
+		"LDR     R2, =0xEEEEEEEE\n"
+		"MOV     R3, #0x1000\n"
+
+		"loc_FF810200:\n"
+		"CMP     R0, R3\n" // clear ITCM 0x6C4-end with EEEEEEEE
+		"STRCC   R2, [R0],#4\n"
+		"BCC     loc_FF810200\n"
+		"BL      sub_FF810FA0_my\n" //------------->
+		);
+}
+
+void __attribute__((naked,noinline)) sub_FF810FA0_my()
+{
+	asm volatile (
+		"STR     LR, [SP,#-4]!\n"
+		"SUB     SP, SP, #0x74\n"
+		"MOV     R0, SP\n"
+		"MOV     R1, #0x74\n"
+		"BL      sub_FFAAD9D0\n"
+		"MOV     R0, #0x53000\n"
+		"STR     R0, [SP,#0x74-0x70]\n"
+		//"LDR     R0, =0xCBD40\n"
+		"LDR     R0, =new_sa\n" // +
+		"LDR     R0, [R0]\n" // +
+		"LDR     R2, =0x279C00\n"
+		"LDR     R1, =0x272968\n"
+		"STR     R0, [SP,#0x74-0x6C]\n"
+		"SUB     R0, R1, R0\n"
+		"ADD     R3, SP, #0x74-0x68\n"
+		"STR     R2, [SP,#0x74-0x74]\n"
+		"STMIA   R3, {R0-R2}\n"
+		"MOV     R0, #0x22\n"
+		"STR     R0, [SP,#0x74-0x5C]\n"
+		"MOV     R0, #0x68\n"
+		"STR     R0, [SP,#0x74-0x58]\n"
+		"LDR     R0, =0x19B\n"
+		"MOV     R1, #0x64\n"
+		"STRD    R0, [SP,#0x74-0x54]\n"
+		"MOV     R0, #0x78\n"
+		"STRD    R0, [SP,#0x74-0x4C]\n"
+		"MOV     R0, #0\n"
+		"STR     R0, [SP,#0x74-0x44]\n"
+		"STR     R0, [SP,#0x74-0x40]\n"
+		"MOV     R0, #0x10\n"
+		"STR     R0, [SP,#0x74-0x18]\n"
+		"MOV     R0, #0x800\n"
+		"STR     R0, [SP,#0x74-0x14]\n"
+		"MOV     R0, #0xA0\n"
+		"STR     R0, [SP,#0x74-0x10]\n"
+		"MOV     R0, #0x280\n"
+		"STR     R0, [SP,#0x74-0xC]\n"
+		//"LDR     R1, =0xFF814DA4\n"
+		"LDR     R1, =uHwSetup_my\n" //------------->
+		"MOV     R0, SP\n"
+		"MOV     R2, #0\n"
+		"BL      sub_FF812D58\n"
+		"ADD     SP, SP, #0x74\n"
+		"LDR     PC, [SP],#4\n"
+		);
+}
+
+// Extracted method: uHwSetup (FF814DA4)
+void __attribute__((naked,noinline)) uHwSetup_my()
+{
+	asm volatile (
+		"STMFD   SP!, {R4,LR}\n"
+		"BL      sub_FF81094C\n"
+		"BL      sub_FF819664\n"
+		"CMP     R0, #0\n"
+		"LDRLT   R0, =0xFF814EB8\n" // "dmSetup"
+		"BLLT    sub_FF814E98\n"
+		"BL      sub_FF8149C8\n"
+		"CMP     R0, #0\n"
+		"LDRLT   R0, =0xFF814EC0\n" // "termDriverInit"
+		"BLLT    sub_FF814E98\n"
+		"LDR     R0, =0xFF814ED0\n" // "/_term"
+		"BL      sub_FF814AB4\n"
+		"CMP     R0, #0\n"
+		"LDRLT   R0, =0xFF814ED8\n" // "termDeviceCreate"
+		"BLLT    sub_FF814E98\n"
+		"LDR     R0, =0xFF814ED0\n" // "/_term"
+		"BL      sub_FF813564\n"
+		"CMP     R0, #0\n"
+		"LDRLT   R0, =0xFF814EEC\n" // "stdioSetup"
+		"BLLT    sub_FF814E98\n"
+		"BL      sub_FF8191EC\n"
+		"CMP     R0, #0\n"
+		"LDRLT   R0, =0xFF814EF8\n" // "stdlibSetup"
+		"BLLT    sub_FF814E98\n"
+		"BL      sub_FF8114B8\n"
+		"CMP     R0, #0\n"
+		"LDRLT   R0, =0xFF814F04\n" // "armlib_setup"
+		"BLLT    sub_FF814E98\n"
+		"LDMFD   SP!, {R4,LR}\n"
+		"B       taskcreate_Startup_my\n" //------------->
+		);
+}
+
+// Extracted method: taskcreate_Startup (FF81CCBC)
+void __attribute__((naked,noinline)) taskcreate_Startup_my()
+{
+	asm volatile (
+		"STMFD   SP!, {R3,LR}\n"
+		"BL      sub_FF821BF0\n" // j_nullsub_214
+		"BL      sub_FF829EE0\n"
+		"CMP     R0, #0\n"
+		"BNE     loc_FF81CCEC\n"
+		"BL      sub_FF821BEC\n"
+		"CMP     R0, #0\n"
+		"BNE     loc_FF81CCEC\n"
+		"LDR     R1, =0xC0220000\n"
+		"MOV     R0, #0x44\n"
+		"STR     R0, [R4,#0x4C]\n"
+
+		"loc_FF81CCE8:\n"
+		"B       loc_FF81CCE8\n"
+
+		"loc_FF81CCEC:\n"
+		"BL      sub_FF821BF8\n"
+		"BL      sub_FF821BF4\n"
+		"BL      sub_FF828268\n"
+		"LDR     R1, =0x2CE000\n"
+		"MOV     R0, #0\n"
+		"BL      sub_FF8284B0\n"
+		"BL      sub_FF82845C\n" // LOCATION: KerSys.c:548
+		"MOV     R3, #0\n"
+		"STR     R3, [SP,#0x8-0x8]\n"
+		//"ADR     R3, 0xFF81CC60\n" // task_Startup
+		"LDR     R3, =task_Startup_my\n" //------------->
+		"MOV     R2, #0\n"
+		"MOV     R1, #0x19\n"
+		"LDR     R0, =0xFF81CD34\n" // "Startup"
+		"BL      sub_FF81B818\n" // eventproc_export_CreateTask
+		"MOV     R0, #0\n"
+		"LDMFD   SP!, {R12,PC}\n"
+		);
+}
+
+// Extracted method: task_Startup (FF81CC60)
+void __attribute__((naked,noinline)) task_Startup_my()
+{
+	asm volatile (
+		"STMFD   SP!, {R4,LR}\n"
+		"BL      sub_FF81516C\n" // taskcreate_ClockSave
+		"BL      sub_FF822D50\n"
+		"BL      sub_FF81FDF0\n"
+		"BL      sub_FF829F20\n"
+		"BL      sub_FF82A0E8\n"
+		//"BL      sub_FF829FA8\n" // StartDiskBoot
+		"BL      CreateTask_spytask\n" // +
+		"BL      sub_FF82A29C\n"
+		"BL      sub_FF82A138\n"
+		"BL      sub_FF8277A8\n"
+		"BL      sub_FF82A2A0\n"
+		"BL      sub_FF821B00\n" // taskcreate_PhySw
+		"BL      sub_FF824CB8\n" // task_ShootSeqTask
+		"BL      sub_FF82A2B8\n"
+		"BL      sub_FF81FB10\n" // nullsub_2
+		"BL      sub_FF820FBC\n"
+		"BL      sub_FF829CA8\n" // taskcreate_Bye
+		"BL      sub_FF821630\n"
+		"BL      sub_FF820EAC\n" // taskcreate_TempCheck
+		"BL      sub_FF82AD5C\n"
+		"BL      sub_FF820E68\n"
+		"LDMFD   SP!, {R4,PC}\n"
+		"BL      sub_FF815070\n" // LOCATION: ClkEnabler.c:144
+		);
+}
+
+//Extracted method: task_InitFileModules (FF878F84)
+void __attribute__((naked,noinline)) init_file_modules_task()
+{
+	asm volatile (
+		"STMFD   SP!, {R4-R6,LR}\n"
+		"BL      sub_FF86D894\n"
+		"LDR     R5, =0x5006\n"
+		"MOVS    R4, R0\n"
+		"MOVNE   R1, #0\n"
+		"MOVNE   R0, R5\n"
+		"BLNE    sub_FF8732C0\n" // PostLogicalEventToUI
+		//"BL      sub_FF86D8C0\n"
+		"BL      sub_FF86D8C0_my\n" //------------->
+		"BL      core_spytask_can_start\n" // + safe to start spytask
+		"CMP     R4, #0\n"
+		"MOVEQ   R0, R5\n"
+		"LDMEQFD SP!, {R4-R6,LR}\n"
+		"MOVEQ   R1, #0\n"
+		"BEQ     sub_FF8732C0\n" // PostLogicalEventToUI
+		"LDMFD   SP!, {R4-R6,PC}\n"
+		);
+} 
+
+void __attribute__((naked,noinline)) sub_FF86D8C0_my()
+{
+	asm volatile (
+		"STMFD   SP!, {R4,LR}\n"
+		//"BL      sub_FF84EF34\n"
+		"BL      sub_FF84EF34_my\n" //------------->
+		"LDR     R4, =0x57D0\n"
+		"LDR     R0, [R4,#4]\n"
+		"CMP     R0, #0\n"
+		"BNE     loc_FF86D8F0\n"
+		"BL      sub_FF881B00\n"
+		"BL      sub_FF905374\n"
+		"BL      sub_FF881B00\n"
+		"BL      sub_FF84C924\n"
+		"BL      sub_FF881B10\n"
+		"BL      sub_FF905440\n"
+
+		"loc_FF86D8F0:\n"
+		"MOV     R0, #1\n"
+		"STR     R0, [R4]\n"
+		"LDMFD   SP!, {R4,PC}\n"
+		);
+} 
+
+void __attribute__((naked,noinline)) sub_FF84EF34_my()
+{
+	asm volatile (
+		"STMFD   SP!, {R4-R6,LR}\n"
+		"MOV     R6, #0\n"
+		"MOV     R0, R6\n"
+		"BL      sub_FF84E9F4\n"
+		"LDR     R4, =0x118C0\n"
+		"MOV     R5, #0\n"
+		"LDR     R0, [R4,#0x38]\n"
+		"BL      sub_FF84F428\n"
+		"CMP     R0, #0\n"
+		"LDREQ   R0, =0x29D4\n"
+		"STREQ   R5, [R0,#0x10]\n"
+		"STREQ   R5, [R0,#0x14]\n"
+		"STREQ   R5, [R0,#0x18]\n"
+		"MOV     R0, R6\n"
+		"BL      sub_FF84EA34\n" // LOCATION: Mounter.c:0
+		"MOV     R0, R6\n"
+		//"BL      sub_FF84ED70"
+		"BL      sub_FF84ED70_my\n" //------------->
+		"MOV     R5, R0\n"
+		"MOV     R0, R6\n"
+		"BL      sub_FF84EDDC\n" // LOCATION: Mounter.c:8
+		"LDR     R1, [R4,#0x3C]\n"
+		"AND     R2, R5, R0\n"
+		"CMP     R1, #0\n"
+		"MOV     R0, #0\n"
+		"MOVEQ   R0, #0x80000001\n"
+		"BEQ     loc_FF84EFC8\n"
+		"LDR     R3, [R4,#0x2C]\n"
+		"CMP     R3, #2\n"
+		"MOVEQ   R0, #4\n"
+		"CMP     R1, #5\n"
+		"ORRNE   R0, R0, #1\n"
+		"BICEQ   R0, R0, #1\n"
+		"CMP     R2, #0\n"
+		"BICEQ   R0, R0, #2\n"
+		"ORREQ   R0, R0, #0x80000000\n"
+		"BICNE   R0, R0, #0x80000000\n"
+		"ORRNE   R0, R0, #2\n"
+
+		"loc_FF84EFC8:\n"
+		"STR     R0, [R4,#0x40]\n"
+		"LDMFD   SP!, {R4-R6,PC}\n"
+		);
+}
+
+void __attribute__((naked,noinline)) sub_FF84ED70_my()
+{
+	asm volatile (
+		"STMFD   SP!, {R4-R6,LR}\n"
+		"LDR     R5, =0x29D4\n"
+		"MOV     R6, R0\n"
+		"LDR     R0, [R5,#0x14]\n"
+		"CMP     R0, #0\n"
+		"MOVNE   R0, #1\n"
+		"LDMNEFD SP!, {R4-R6,PC}\n"
+		"MOV     R0, #0x17\n"
+		"MUL     R1, R0, R6\n"
+		"LDR     R0, =0x118C0\n"
+		"ADD     R4, R0, R1,LSL#2\n"
+		"LDR     R0, [R4,#0x38]\n"
+		"MOV     R1, R6\n"
+		//"BL      sub_FF84EB00\n" // LOCATION: Mounter.c:884
+		"BL      sub_FF84EB00_my\n" //------------->
+		"CMP     R0, #0\n"
+		"LDMEQFD SP!, {R4-R6,PC}\n"
+		"LDR     R0, [R4,#0x38]\n"
+		"MOV     R1, R6\n"
+		"BL      sub_FF84EC68\n" // LOCATION: Mounter.c:0
+		"CMP     R0, #0\n"
+		"LDMEQFD SP!, {R4-R6,PC}\n"
+		"MOV     R0, R6\n"
+		"BL      sub_FF84E5FC\n"
+		"CMP     R0, #0\n"
+		"MOVNE   R1, #1\n"
+		"STRNE   R1, [R5,#0x14]\n"
+		"LDMFD   SP!, {R4-R6,PC}\n"
+		);
+}
+
+void __attribute__((naked,noinline)) sub_FF84EB00_my()
+{
+	asm volatile (
+		"STMFD   SP!, {R4-R8,LR}\n"
+		"MOV     R8, R0\n"
+		"MOV     R0, #0x17\n"
+		"MUL     R1, R0, R1\n"
+		"LDR     R0, =0x118C0\n"
+		"MOV     R6, #0\n"
+		"ADD     R7, R0, R1,LSL#2\n"
+		"LDR     R0, [R7,#0x3C]\n"
+		"MOV     R5, #0\n"
+		"CMP     R0, #6\n"
+		"ADDLS   PC, PC, R0,LSL#2\n"
+		"B       loc_FF84EC4C\n"
+
+		"loc_FF84EB30:\n"
+		"B       loc_FF84EB64\n"
+
+		"loc_FF84EB34:\n"
+		"B       loc_FF84EB4C\n"
+
+		"loc_FF84EB38:\n"
+		"B       loc_FF84EB4C\n"
+
+		"loc_FF84EB3C:\n"
+		"B       loc_FF84EB4C\n"
+
+		"loc_FF84EB40:\n"
+		"B       loc_FF84EB4C\n"
+
+		"loc_FF84EB44:\n"
+		"B       loc_FF84EC44\n"
+
+		"loc_FF84EB48:\n"
+		"B       loc_FF84EB4C\n"
+
+		"loc_FF84EB4C:\n"
+		// jumptable FF858EAC entries 1-4,6
+		"MOV     R2, #0\n"
+		"MOV     R1, #0x200\n"
+		"MOV     R0, #3\n"
+		"BL      sub_FF867A40\n"
+		"MOVS    R4, R0\n"
+		"BNE     loc_FF84EB6C\n"
+
+		"loc_FF84EB64:\n"
+		// jumptable FF858EAC entry 0
+		"MOV     R0, #0\n"
+		"LDMFD   SP!, {R4-R8,PC}\n"
+
+		"loc_FF84EB6C:\n"
+		"LDR     R12, [R7,#0x4C]\n"
+		"MOV     R3, R4\n"
+		"MOV     R2, #1\n"
+		"MOV     R1, #0\n"
+		"MOV     R0, R8\n"
+		"BLX     R12\n"
+		"CMP     R0, #1\n"
+		"BNE     loc_FF84EB98\n"
+		"MOV     R0, #3\n"
+		"BL      sub_FF867B80\n" // LOCATION: ExMemMan.c:0
+		"B       loc_FF84EB64\n"
+
+		"loc_FF84EB98:\n"
+		"MOV     R0, R8\n"
+		"BL      sub_FF922B9C\n"
+
+		"MOV   R1, R4\n"           //  pointer to MBR in R1
+		"BL    mbr_read_dryos\n"   //  total sectors count in R0 before and after call
+
+		// Start of DataGhost's FAT32 autodetection code
+		// Policy: If there is a partition which has type W95 FAT32, use the first one of those for image storage
+		// According to the code below, we can use R1, R2, R3 and R12.
+		// LR wasn't really used anywhere but for storing a part of the partition signature. This is the only thing
+		// that won't work with an offset, but since we can load from LR+offset into LR, we can use this to do that :)
+		"MOV     R12, R4\n"                    // Copy the MBR start address so we have something to work with
+		"MOV     LR, R4\n"                     // Save old offset for MBR signature
+		"MOV     R1, #1\n"                     // Note the current partition number
+		"B       dg_sd_fat32_enter\n"          // We actually need to check the first partition as well, no increments yet!
+
+		"dg_sd_fat32:\n"
+		"CMP     R1, #4\n"                     // Did we already see the 4th partition?
+		"BEQ     dg_sd_fat32_end\n"            // Yes, break. We didn't find anything, so don't change anything.
+		"ADD     R12, R12, #0x10\n"            // Second partition
+		"ADD     R1, R1, #1\n"                 // Second partition for the loop
+
+		"dg_sd_fat32_enter:\n"
+		"LDRB    R2, [R12, #0x1BE]\n"          // Partition status
+		"LDRB    R3, [R12, #0x1C2]\n"          // Partition type (FAT32 = 0xB)
+		"CMP     R3, #0xB\n"                   // Is this a FAT32 partition?
+		"CMPNE   R3, #0xC\n"                   // Not 0xB, is it 0xC (FAT32 LBA) then?
+		"BNE     dg_sd_fat32\n"                // No, it isn't. Loop again.
+		"CMP     R2, #0x00\n"                  // It is, check the validity of the partition type
+		"CMPNE   R2, #0x80\n"
+		"BNE     dg_sd_fat32\n"                // Invalid, go to next partition
+		// This partition is valid, it's the first one, bingo!
+		"MOV     R4, R12\n"                    // Move the new MBR offset for the partition detection.
+
+		"dg_sd_fat32_end:\n"
+		// End of DataGhost's FAT32 autodetection code
+
+		"LDRB    R1, [R4,#0x1C9]\n"
+		"LDRB    R3, [R4,#0x1C8]\n"
+		"LDRB    R12, [R4,#0x1CC]\n"
+		"MOV     R1, R1,LSL#24\n"
+		"ORR     R1, R1, R3,LSL#16\n"
+		"LDRB    R3, [R4,#0x1C7]\n"
+		"LDRB    R2, [R4,#0x1BE]\n"
+		//"LDRB    LR, [R4,#0x1FF]\n" // -
+		"ORR     R1, R1, R3,LSL#8\n"
+		"LDRB    R3, [R4,#0x1C6]\n"
+		"CMP     R2, #0\n"
+		"CMPNE   R2, #0x80\n"
+		"ORR     R1, R1, R3\n"
+		"LDRB    R3, [R4,#0x1CD]\n"
+		"MOV     R3, R3,LSL#24\n"
+		"ORR     R3, R3, R12,LSL#16\n"
+		"LDRB    R12, [R4,#0x1CB]\n"
+		"ORR     R3, R3, R12,LSL#8\n"
+		"LDRB    R12, [R4,#0x1CA]\n"
+		"ORR     R3, R3, R12\n"
+		//"LDRB    R12, [R4,#0x1FE]\n" // -
+		"LDRB    R12, [LR,#0x1FE]\n" // +
+		"LDRB    LR, [LR,#0x1FF]\n" // +
+		"MOV     R4, #0\n"
+		"BNE     loc_FF84EC20\n"
+		"CMP     R0, R1\n"
+		"BCC     loc_FF84EC20\n"
+		"ADD     R2, R1, R3\n"
+		"CMP     R2, R0\n"
+		"CMPLS   R12, #0x55\n"
+		"CMPEQ   LR, #0xAA\n"
+		"MOVEQ   R6, R1\n"
+		"MOVEQ   R5, R3\n"
+		"MOVEQ   R4, #1\n"
+
+		"loc_FF84EC20:\n"
+		"MOV     R0, #3\n"
+		"BL      sub_FF867B80\n" // LOCATION: ExMemMan.c:0
+		"CMP     R4, #0\n"
+		"BNE     loc_FF84EC58\n"
+		"MOV     R6, #0\n"
+		"MOV     R0, R8\n"
+		"BL      sub_FF922B9C\n"
+		"MOV     R5, R0\n"
+		"B       loc_FF84EC58\n"
+
+		"loc_FF84EC44:\n"
+		// jumptable FF858EAC entry 5
+		"MOV     R5, #0x40\n"
+		"B       loc_FF84EC58\n"
+
+		"loc_FF84EC4C:\n"
+		// jumptable FF858EAC default entry
+		"LDR     R1, =0x374\n"
+		"LDR     R0, =0xFF858E78\n" // "Mounter.c"
+		"BL      _DebugAssert\n"
+
+		"loc_FF84EC58:\n"
+		"STR     R6, [R7,#0x44]!\n"
+		"MOV     R0, #1\n"
+		"STR     R5, [R7,#4]\n"
+		"LDMFD   SP!, {R4-R8,PC}\n"
+		);
+}
+
+// Extracted method: sub_FF842A44
+void __attribute__((naked,noinline)) jogdial_task_my()
+{
+	asm volatile (
+		"STMFD   SP!, {R3-R11,LR}\n"
+		"BL      sub_FF842BF4\n" // LOCATION: JogDial.c:14
+		"LDR     R11, =0x80000B01\n"
+		"LDR     R8, =0xFFAB1760\n"
+		"LDR     R7, =0xC0240000\n"
+		"LDR     R6, =0x22A0\n"
+		"MOV     R9, #1\n"
+		"MOV     R10, #0\n"
+
+		"loc_FF842A64:\n"
+		"LDR     R3, =0x1A1\n"
+		"LDR     R0, [R6,#0xC]\n"
+		"LDR     R2, =0xFF842C9C\n" // "JogDial.c"
+		"MOV     R1, #0\n"
+		"BL      sub_FF81BBD8\n"
+		//"MOV     R0, #40\n"
+		"MOV     R0, #40\n" // +
+		"BL      _SleepTask\n" // LOCATION: KerSys.c:0
+
+		//------------------  added code ---------------------
+		"labelA:\n"
+		"LDR     R0, =jogdial_stopped\n"
+		"LDR     R0, [R0]\n"
+		"CMP     R0, #1\n"
+		"BNE     labelB\n"
+		"MOV     R0, #40\n"
+		"BL      _SleepTask\n"
+		"B       labelA\n"
+		"labelB:\n"
+		//------------------  original code ------------------
+
+		"LDR     R0, [R7,#0x104]\n"
+		"MOV     R0, R0,ASR#16\n"
+		"STRH    R0, [R6]\n"
+		"LDRSH   R2, [R6,#2]\n"
+		"SUB     R1, R0, R2\n"
+		"CMP     R1, #0\n"
+		"BEQ     loc_FF842B28\n"
+		"MOV     R5, R1\n"
+		"RSBLT   R5, R5, #0\n"
+		"MOVLE   R4, #0\n"
+		"MOVGT   R4, #1\n"
+		"CMP     R5, #0xFF\n"
+		"BLS     loc_FF842ADC\n"
+		"CMP     R1, #0\n"
+		"RSBLE   R1, R2, #0xFF\n"
+		"ADDLE   R1, R1, #0x7F00\n"
+		"ADDLE   R0, R1, R0\n"
+		"RSBGT   R0, R0, #0xFF\n"
+		"ADDGT   R0, R0, #0x7F00\n"
+		"ADDGT   R0, R0, R2\n"
+		"ADD     R5, R0, #0x8000\n"
+		"ADD     R5, R5, #1\n"
+		"EOR     R4, R4, #1\n"
+
+		"loc_FF842ADC:\n"
+		"LDR     R0, [R6,#0x14]\n"
+		"CMP     R0, #0\n"
+		"BEQ     loc_FF842B20\n"
+		"LDR     R0, [R6,#0x1C]\n"
+		"CMP     R0, #0\n"
+		"BEQ     loc_FF842B08\n"
+		"LDR     R1, [R8,R4,LSL#2]\n"
+		"CMP     R1, R0\n"
+		"BEQ     loc_FF842B10\n"
+		"LDR     R0, =0xB01\n"
+		"BL      sub_FF87511C\n"
+
+		"loc_FF842B08:\n"
+		"MOV     R0, R11\n"
+		"BL      sub_FF87511C\n"
+
+		"loc_FF842B10:\n"
+		"LDR     R0, [R8,R4,LSL#2]\n"
+		"MOV     R1, R5\n"
+		"STR     R0, [R6,#0x1C]\n"
+		"BL      sub_FF875064\n"
+
+		"loc_FF842B20:\n"
+		"LDRH    R0, [R6]\n"
+		"STRH    R0, [R6,#2]\n"
+
+		"loc_FF842B28:\n"
+		"STR     R10, [R7,#0x100]\n"
+		"STR     R9, [R7,#0x108]\n"
+		"LDR     R0, [R6,#0x10]\n"
+		"CMP     R0, #0\n"
+		"BLNE    _SleepTask\n" // LOCATION: KerSys.c:0
+		"B       loc_FF842A64\n"
+		);
+}
Index: /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100c/stubs_min.S
===================================================================
--- /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100c/stubs_min.S	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100c/stubs_min.S	(revision 1668)
@@ -0,0 +1,6 @@
+#include "stubs_asm.h"
+
+DEF(recreview_hold,                     0x9CEC + 0xAC)  // @ FF960408
+
+DEF(some_f_for_dng,                     0xDEAD)         // ??? TODO NOT FOUND!
+DEF(second_ext_for_dng,                 0xDEAD)         // ??? TODO NOT FOUND!
Index: /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100c/makefile.inc
===================================================================
--- /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100c/makefile.inc	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100c/makefile.inc	(revision 1668)
@@ -0,0 +1,17 @@
+#0x3173
+PLATFORMID=12659
+
+PLATFORMOS=dryos
+
+MEMBASEADDR=0x1900
+RESTARTSTART=0x50000
+MEMISOSTART=0xCBD40
+ROMBASEADDR=0xFF810000
+
+
+PLFLAGS=-DMEMBASEADDR=$(MEMBASEADDR) -DMEMISOSTART=$(MEMISOSTART) -DMEMISOSIZE=$(MEMISOSIZE)
+PLFLAGS+=-DRESTARTSTART=$(RESTARTSTART)
+
+NEED_ENCODED_DISKBOOT=1
+
+KEYSYS=d3enc
Index: /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100c/stubs_asm.h
===================================================================
--- /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100c/stubs_asm.h	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100c/stubs_asm.h	(revision 1668)
@@ -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/reyalp-ptp-live/platform/ixus970_sd890/sub/100c/lib.c
===================================================================
--- /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100c/lib.c	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100c/lib.c	(revision 1668)
@@ -0,0 +1,73 @@
+#include "platform.h"
+
+// obsolete
+void *hook_raw_fptr() { return (void*)0; }
+void *hook_raw_ret_addr() { return (void*)0; }
+
+char *hook_raw_image_addr()
+{
+	// 0x54F4 + 0x18 @ FF85E534
+	// @ FFAB1C48
+	// @ FFAB1C54
+	return (char*) (*(int*)(0x550C) ? 0x11B97B60 : 0x107D68C0);
+}
+
+long hook_raw_size()
+{
+	// (3720 x 2772 * 12bit) / 8bit
+	// @ FFA8AD80
+	return 0xEC04F0;
+}
+
+// Live picture buffer (shoot not pressed)
+void *vid_get_viewport_live_fb()
+{
+	// @ FF8C5AB0
+	void **fb=(void **)0x7420;
+	unsigned char buff = *((unsigned char*)0x729C);
+	if (buff == 0) {
+		buff = 2;
+	} else {
+		buff--;
+	}
+	return fb[buff];
+}
+
+// Live picture buffer (shoot half-pressed)
+void *vid_get_viewport_fb()
+{
+	// @ FFA88AFC
+	return (void*)0x1065ADC0;
+}
+
+// Picture buffer (play mode)
+void *vid_get_viewport_fb_d()
+{
+	// 0x51FC + 0x4C @ FF853E50
+	return (void*)(*(int*)0x5248);
+}
+
+// OSD buffer
+void *vid_get_bitmap_fb()
+{
+	// @ FF8EA9F8
+	return (void*)0x10361000;
+}
+
+// possible future use
+/*
+char *vid_get_bitmap_fb_d() 
+{
+	// 0xAEF0+0x4 @ FF9AE274
+	int *p =(int *)(*(int*)(0xAEF4));
+	return ((char *)(*(p+2)));
+}
+*/
+
+char *camera_jpeg_count_str()
+{
+	// @ FF9A6FDC
+	return (char*)0x4CA80;
+}
+
+long vid_get_viewport_height() { return 240; }
Index: /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100c/movie_rec.c
===================================================================
--- /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100c/movie_rec.c	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100c/movie_rec.c	(revision 1668)
@@ -0,0 +1,416 @@
+#include "conf.h"
+
+int *video_quality = &conf.video_quality;
+int *video_mode    = &conf.video_mode;
+
+long def_table[68] = {
+	0x2000,  0x38D,   0x788,   0xBE1,   0x10CB,  0x1642,  0x1C48,  0x22F9,  0x2A79,  0x32AA, 0x3C01, 0x4637,
+	0x5190,  0x5E0E,  0x5800,  0x9C5,   0x14B8,  0x20C9,  0x2E31,  0x3D39,  0x4DC9,  0x6030, 0x74D1, 0x8B8D,
+	0xA509,  0xC160,  0xE054,  0x102AF, 0x10000, 0x1C6A,  0x3C45,  0x5F60,  0x8661,  0xB21A, 0xE249, 0x117D2,
+	0x153D5, 0x195F8, 0x1E01C, 0x2328E, 0x28C99, 0x2F08B, 0x8000,  0xE35,   0x1E23,  0x2FB0, 0x4331, 0x590D, 
+	0x7125,  0x8BE9,  0xA9EB,  0xCAFC,  0xF00E,  0x11947, 0x1464D, 0x17846, 0x1CCD, -0x2E1,  -0x579, 0x4F33,
+	-0x7EB, -0xF0C,   0xE666,  -0x170A, -0x2BC6, 0x7333,  -0xB85, -0x15E3};
+
+long table[68];
+
+void change_video_tables(int a, int b) {
+	int i;
+
+	for (i=0;i<68;i++) {
+		table[i]=(def_table[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};
+
+// Extracted method: sub_FF85A004
+void __attribute__((naked,noinline)) movie_record_task()
+{
+	asm volatile (
+		"STMFD   SP!, {R2-R8,LR}\n"
+		"LDR     R8, =0x32B\n"
+		"LDR     R7, =0x2710\n"
+		"LDR     R4, =0x5390\n"
+		"MOV     R6, #0\n"
+		"MOV     R5, #1\n"
+
+		"loc_FF85A01C:\n"
+		"LDR     R0, [R4,#0x1C]\n"
+		"MOV     R2, #0\n"
+		"ADD     R1, SP, #0x20-0x1C\n"
+		"BL      sub_FF827D90\n" // LOCATION: KerQueue.c:0
+		"LDR     R0, [R4,#0x24]\n"
+		"CMP     R0, #0\n"
+		"BNE     loc_FF85A0EC\n"
+		"LDR     R0, [SP,#0x20-0x1C]\n"
+		"LDR     R1, [R0]\n"
+		"SUB     R1, R1, #2\n"
+		"CMP     R1, #9\n"
+		"ADDLS   PC, PC, R1,LSL#2\n"
+		"B       loc_FF85A0EC\n"
+
+		"loc_FF85A050:\n"
+		"B       loc_FF85A0A0\n"
+
+		"loc_FF85A054:\n"
+		"B       loc_FF85A0C0\n"
+
+		"loc_FF85A058:\n"
+		"B       loc_FF85A0D0\n"
+
+		"loc_FF85A05C:\n"
+		"B       loc_FF85A0D8\n"
+
+		"loc_FF85A060:\n"
+		"B       loc_FF85A0A8\n"
+
+		"loc_FF85A064:\n"
+		"B       loc_FF85A0E0\n"
+
+		"loc_FF85A068:\n"
+		"B       loc_FF85A0B0\n"
+
+		"loc_FF85A06C:\n"
+		"B       loc_FF85A0EC\n"
+
+		"loc_FF85A070:\n"
+		"B       loc_FF85A0E8\n"
+
+		"loc_FF85A074:\n"
+		"B       loc_FF85A078\n"
+
+		"loc_FF85A078:\n"
+		// jumptable FF85A048 entry 9
+		"STR     R6, [R4,#0x38]\n"
+		"LDR     R0, =0xFF859CD8\n" // nullsub_234
+		"LDR     R2, =0xFF859608\n"
+		"LDR     R1, =0x19B18\n"
+		"STR     R0, [R4,#0xA4]\n"
+		"LDR     R0, =0xFF8596EC\n"
+		"STR     R6, [R4,#0x28]\n"
+		"BL      sub_FF8C7F90\n"
+		"STR     R5, [R4,#0x3C]\n"
+		"B       loc_FF85A0EC\n"
+
+		"loc_FF85A0A0:\n"
+		// jumptable FF85A048 entry 0
+		"BL      unlock_optical_zoom\n" //------------->
+		"BL      sub_FF859DD0\n" // LOCATION: MovieRecorder.c:0
+		"B       loc_FF85A0EC\n"
+
+		"loc_FF85A0A8:\n"
+		// jumptable FF85A048 entry 4
+		"BL      sub_FF859A9C_my\n" //------------->
+		"B       loc_FF85A0EC\n"
+
+		"loc_FF85A0B0:\n"
+		// jumptable FF85A048 entry 6
+		"LDR     R1, [R0,#0x10]\n"
+		"LDR     R0, [R0,#4]\n"
+		"BL      sub_FF938D90\n" // LOCATION: AviWriter.c:0
+		"B       loc_FF85A0EC\n"
+
+		"loc_FF85A0C0:\n"
+		// jumptable FF85A048 entry 1
+		"LDR     R0, [R4,#0x3C]\n"
+		"CMP     R0, #5\n"
+		"STRNE   R5, [R4,#0x2C]\n"
+		"B       loc_FF85A0EC\n"
+
+		"loc_FF85A0D0:\n"
+		// jumptable FF85A048 entry 2
+		"BL      sub_FF8598A0\n" // LOCATION: MovieRecorder.c:1000
+		"B       loc_FF85A0EC\n"
+
+		"loc_FF85A0D8:\n"
+		// jumptable FF85A048 entry 3
+		"BL      sub_FF859738\n"
+		"B       loc_FF85A0EC\n"
+
+		"loc_FF85A0E0:\n"
+		// jumptable FF85A048 entry 5
+		"BL      sub_FF859594\n" // LOCATION: MovieRecorder.c:100
+		"B       loc_FF85A0EC\n"
+
+		"loc_FF85A0E8:\n"
+		// jumptable FF85A048 entry 8
+		"BL      sub_FF85A254\n" // LOCATION: MovieRecorder.c:100
+
+		"loc_FF85A0EC:\n"
+		// jumptable FF85A048 default entry
+		// jumptable FF85A048 entry 7
+		"LDR     R1, [SP,#0x20-0x1C]\n"
+		"LDR     R3, =0xFF859398\n" // aMovierecorder_  ; "MovieRecorder.c"
+		"STR     R6, [R1]\n"
+		"STR     R8, [SP,#0x20-0x20]\n"
+		"LDR     R0, [R4,#0x20]\n"
+		"MOV     R2, R7\n"
+		"BL      sub_FF81BC30\n"
+		"B       loc_FF85A01C\n"
+		);
+}
+
+void __attribute__((naked,noinline)) sub_FF859A9C_my()
+{
+	asm volatile (
+		"STMFD   SP!, {R4-R9,LR}\n"
+		"SUB     SP, SP, #0x3C\n"
+		"MOV     R7, #0\n"
+		"LDR     R5, =0x5390\n"
+		"MOV     R4, R0\n"
+		"STR     R7, [SP,#0x58-0x2C]\n"
+		"STR     R7, [SP,#0x58-0x34]\n"
+		"LDR     R0, [R5,#0x3C]\n"
+		"MOV     R8, #4\n"
+		"CMP     R0, #3\n"
+		"STREQ   R8, [R5,#0x3C]\n"
+		"LDR     R0, [R5,#0xA4]\n"
+		"MOV     R6, #0\n"
+		"BLX     R0\n"
+		"LDR     R0, [R5,#0x3C]\n"
+		"CMP     R0, #4\n"
+		"BNE     loc_FF859BAC\n"
+		"LDRH    R0, [R5,#2]\n"
+		"MOV     R9, #1\n"
+		"CMP     R0, #1\n"
+		"BNE     loc_FF859B18\n"
+		"LDRH    R1, [R5,#4]\n"
+		"LDR     R0, [R5,#0x4C]\n"
+		"MUL     R0, R1, R0\n"
+		"MOV     R1, #0x3E8\n"
+		"BL      sub_FFAAF280\n"
+		"MOV     R1, R0\n"
+		"LDR     R0, [R5,#0x54]\n"
+		"BL      sub_FFAAF280\n"
+		"CMP     R1, #0\n"
+		"BNE     loc_FF859B34\n"
+
+		"loc_FF859B18:\n"
+		"ADD     R3, SP, #0x58-0x34\n"
+		"ADD     R2, SP, #0x58-0x30\n"
+		"ADD     R1, SP, #0x58-0x2C\n"
+		"ADD     R0, SP, #0x58-0x28\n"
+		"BL      sub_FF938F24\n"
+		"MOVS    R6, R0\n"
+		"BNE     loc_FF859B50\n"
+
+		"loc_FF859B34:\n"
+		"LDR     R0, [R5,#0x2C]\n"
+		"CMP     R0, #1\n"
+		"BNE     loc_FF859BB4\n"
+		"LDR     R0, [R5,#0x54]\n"
+		"LDR     R1, [R5,#0x40]\n"
+		"CMP     R0, R1\n"
+		"BCC     loc_FF859BB4\n"
+
+		"loc_FF859B50:\n"
+		"CMP     R6, #0x80000001\n"
+		"STREQ   R8, [R5,#0x58]\n"
+		"BEQ     loc_FF859B88\n"
+		"CMP     R6, #0x80000003\n"
+		"STREQ   R9, [R5,#0x58]\n"
+		"BEQ     loc_FF859B88\n"
+		"CMP     R6, #0x80000005\n"
+		"MOVEQ   R0, #2\n"
+		"BEQ     loc_FF859B84\n"
+		"CMP     R6, #0x80000007\n"
+		"STRNE   R7, [R5,#0x58]\n"
+		"BNE     loc_FF859B88\n"
+		"MOV     R0, #3\n"
+
+		"loc_FF859B84:\n"
+		"STR     R0, [R5,#0x58]\n"
+
+		"loc_FF859B88:\n"
+		"LDR     R0, =0x19B48\n"
+		"LDR     R0, [R0,#8]\n"
+		"CMP     R0, #0\n"
+		"BEQ     loc_FF859BA0\n"
+		"BL      sub_FF84427C\n"
+		"B       loc_FF859BA4\n"
+
+		"loc_FF859BA0:\n"
+		"BL      sub_FF859594\n" // LOCATION: MovieRecorder.c:100
+
+		"loc_FF859BA4:\n"
+		"MOV     R0, #5\n"
+		"STR     R0, [R5,#0x3C]\n"
+
+		"loc_FF859BAC:\n"
+		"ADD     SP, SP, #0x3C\n"
+		"LDMFD   SP!, {R4-R9,PC}\n"
+
+		"loc_FF859BB4:\n"
+		"LDR     R12, [SP,#0x58-0x2C]\n"
+		"CMP     R12, #0\n"
+		"BEQ     loc_FF859C80\n"
+		"STR     R9, [R5,#0x30]\n"
+		"LDR     R0, [R5,#0x70]\n"
+		"LDR     R1, [R4,#0x14]\n"
+		"LDR     R2, [R4,#0x18]\n"
+		"LDR     LR, [R4,#0xC]\n"
+		"ADD     R3, SP, #0x58-0x24\n"
+		"ADD     R6, SP, #0x58-0x44\n"
+		"STMIA   R6, {R0-R3}\n"
+		"LDR     R0, [SP,#0x58-0x34]\n"
+		"LDR     R3, [R5,#0x5C]\n"
+		"LDR     R1, [SP,#0x58-0x30]\n"
+		"ADD     R2, SP, #0x58-0x20\n"
+		"ADD     R6, SP, #0x58-0x50\n"
+		"STMIA   R6, {R0,R2,R3}\n"
+		"STR     R1, [SP,#0x58-0x54]\n"
+		"STR     R12, [SP,#0x58-0x58]\n"
+		"LDMIB   R4, {R0,R1}\n"
+		"LDR     R3, [SP,#0x58-0x28]\n"
+		"MOV     R2, LR\n"
+		"BL      sub_FF8EFE60\n"
+		"LDR     R0, [R5,#0x14]\n"
+		"MOV     R1, #0x3E8\n"
+		"BL      sub_FF81B6AC\n" // eventproc_export_TakeSemaphore
+		"CMP     R0, #9\n"
+		"BNE     loc_FF859C34\n"
+		"BL      sub_FF939500\n"
+		"MOV     R0, #0x90000\n"
+		"STR     R9, [R5,#0x3C]\n"
+		"B       loc_FF859C4C\n"
+
+		"loc_FF859C34:\n"
+		"LDR     R0, [SP,#0x58-0x24]\n"
+		"CMP     R0, #0\n"
+		"BEQ     loc_FF859C54\n"
+		"BL      sub_FF939500\n"
+		"MOV     R0, #0xA0000\n"
+		"STR     R9, [R5,#0x3C]\n"
+
+		"loc_FF859C4C:\n"
+		"BL      sub_FF875750\n" // eventproc_export_HardwareDefect
+		"B       loc_FF859BAC\n"
+
+		"loc_FF859C54:\n"
+		"BL      sub_FF8EFF24\n"
+		"LDR     R0, [SP,#0x58-0x28]\n"
+		"LDR     R1, [SP,#0x58-0x20]\n"
+		"BL      sub_FF9392A8\n" // LOCATION: AviWriter.c:0
+		"LDR     R0, [R5,#0x50]\n"
+		"LDR     R1, =0x5400\n"
+		"ADD     R0, R0, #1\n"
+		"STR     R0, [R5,#0x50]\n"
+		"LDR     R0, [SP,#0x58-0x20]\n"
+		"MOV     R2, #0\n"
+		"BL      sub_FF937138_my\n" //------------->
+
+		"loc_FF859C80:\n"
+		"LDR     R0, [R5,#0x54]\n"
+		"ADD     R0, R0, #1\n"
+		"STR     R0, [R5,#0x54]\n"
+		"LDR     R1, [R5,#0x7C]\n"
+		"MUL     R0, R1, R0\n"
+		"LDR     R1, [R5,#0x78]\n"
+		"BL      sub_FFAAF280\n"
+		"MOV     R4, R0\n"
+		"BL      sub_FF939538\n"
+		"LDR     R1, [R5,#0x74]\n"
+		"CMP     R1, R4\n"
+		"BNE     loc_FF859CBC\n"
+		"LDR     R0, [R5,#0x34]\n"
+		"CMP     R0, #1\n"
+		"BNE     loc_FF859CD0\n"
+
+		"loc_FF859CBC:\n"
+		"LDR     R1, [R5,#0x88]\n"
+		"MOV     R0, R4\n"
+		"BLX     R1\n"
+		"STR     R4, [R5,#0x74]\n"
+		"STR     R7, [R5,#0x34]\n"
+
+		"loc_FF859CD0:\n"
+		"STR     R7, [R5,#0x30]\n"
+		"B       loc_FF859BAC\n"
+		);
+}
+
+void __attribute__((naked,noinline)) sub_FF937138_my()
+{
+	asm volatile (
+		"STMFD   SP!, {R4-R8,LR}\n"
+		"LDR     R4, =0x8C44\n"
+		"LDR     LR, [R4]\n"
+		"LDR     R2, [R4,#8]\n"
+		"CMP     LR, #0\n"
+		"LDRNE   R3, [R4,#0xC]\n"
+		"MOV     R5, R2\n"
+		"CMPNE   R3, #1\n"
+		"MOVEQ   R2, #0\n"
+		"STREQ   R0, [R4]\n"
+		"STREQ   R2, [R4,#0xC]\n"
+		"BEQ     loc_FF937204\n"
+		"LDR     R3, [R4,#4]\n"
+		//"LDR     R7, =0xFFACAE44\n"
+		"LDR     R7, =table\n" // +
+		"ADD     R12, R3, R3,LSL#1\n"
+		"LDR     R3, [R7,R12,LSL#2]\n"
+		"ADD     R6, R7, #0x30\n"
+		"LDR     R8, [R6,R12,LSL#2]\n"
+		"SUB     R3, LR, R3\n"
+		"CMP     R3, #0\n"
+		"SUB     LR, LR, R8\n"
+		"BLE     loc_FF9371C0\n"
+		"ADD     R12, R7, R12,LSL#2\n"
+		"LDR     LR, [R12,#4]\n"
+		"CMP     LR, R3\n"
+		"ADDGE   R2, R2, #1\n"
+		"BGE     loc_FF9371B4\n"
+		"LDR     R12, [R12,#8]\n"
+		"CMP     R12, R3\n"
+		"ADDLT   R2, R2, #3\n"
+		"ADDGE   R2, R2, #2\n"
+
+		"loc_FF9371B4:\n"
+		//"CMP     R2, #0x17\n"
+		//"MOVGE   R2, #0x16\n"
+		"CMP     R2, #0x1A\n" // +
+		"MOVGE   R2, #0x19\n" // +
+		"B       loc_FF9371F4\n"
+
+		"loc_FF9371C0:\n"
+		"CMP     LR, #0\n"
+		"BGE     loc_FF9371F4\n"
+		"ADD     R3, R6, R12,LSL#2\n"
+		"LDR     R12, [R3,#4]\n"
+		"CMP     R12, LR\n"
+		"SUBLE   R2, R2, #1\n"
+		"BLE     loc_FF9371EC\n"
+		"LDR     R3, [R3,#8]\n"
+		"CMP     R3, LR\n"
+		"SUBGT   R2, R2, #3\n"
+		"SUBLE   R2, R2, #2\n"
+
+		"loc_FF9371EC:\n"
+		"CMP     R2, #0\n"
+		"MOVLT   R2, #0\n"
+
+		"loc_FF9371F4:\n"
+		"CMP     R2, R5\n"
+		"STRNE   R2, [R4,#8]\n"
+		"MOVNE   R2, #1\n"
+		"STRNE   R2, [R4,#0xC]\n"
+
+		"loc_FF937204:\n"
+		//"LDR     R2, =0xFFACADE8\n"
+		"LDR     R2, =CompressionRateTable\n" // +
+		"LDR     R3, [R4,#8]\n"
+		"LDR     R2, [R2,R3,LSL#2]\n"
+
+		"LDR     R3, =video_mode\n" // +
+		"LDR     R3, [R3]\n" // +
+		"LDR     R3, [R3]\n" // +
+		"CMP     R3, #1\n" // +
+		"LDREQ   R3, =video_quality\n" // +
+		"LDREQ   R3, [R3]\n" // +
+		"LDREQ   R2, [R3]\n" // +
+
+		"STR     R2, [R1]\n"
+		"STR     R0, [R4]\n"
+		"LDMFD   SP!, {R4-R8,PC}\n"
+		);
+}
Index: /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100c/stubs_auto.S
===================================================================
--- /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100c/stubs_auto.S	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100c/stubs_auto.S	(revision 1668)
@@ -0,0 +1,191 @@
+/* THIS FILE IS GENERATED */
+/* DO NOT EDIT THIS FILE! */
+
+#include "stubs_asm.h"
+
+STUB(FF8101A4)
+STUB(FF81094C)
+STUB(FF810FA0)
+STUB(FF8114B8)
+STUB(FF812D58)
+STUB(FF813564)
+STUB(FF8149C8)
+STUB(FF814AB4)
+STUB(FF814E98)
+STUB(FF815070)
+STUB(FF81516C)
+STUB(FF8191EC)
+STUB(FF819664)
+STUB(FF81B6AC)
+STUB(FF81B818)
+STUB(FF81BAA8)
+STUB(FF81BBD8)
+STUB(FF81BC30)
+STUB(FF81FB10)
+STUB(FF81FDF0)
+STUB(FF820E68)
+STUB(FF820EAC)
+STUB(FF820FBC)
+STUB(FF821630)
+STUB(FF821B00)
+STUB(FF821BEC)
+STUB(FF821BF0)
+STUB(FF821BF4)
+STUB(FF821BF8)
+STUB(FF822D50)
+STUB(FF824C38)
+STUB(FF824CB8)
+STUB(FF8277A8)
+STUB(FF827A44)
+STUB(FF827B0C)
+STUB(FF827B40)
+STUB(FF827D90)
+STUB(FF828268)
+STUB(FF82845C)
+STUB(FF8284B0)
+STUB(FF829CA8)
+STUB(FF829EE0)
+STUB(FF829F20)
+STUB(FF829FA8)
+STUB(FF82A0E8)
+STUB(FF82A138)
+STUB(FF82A29C)
+STUB(FF82A2A0)
+STUB(FF82A2B8)
+STUB(FF82AD5C)
+STUB(FF842BF4)
+STUB(FF84427C)
+STUB(FF845330)
+STUB(FF84C924)
+STUB(FF84E5FC)
+STUB(FF84E9F4)
+STUB(FF84EA34)
+STUB(FF84EB00)
+STUB(FF84EC68)
+STUB(FF84ED70)
+STUB(FF84EDDC)
+STUB(FF84EF34)
+STUB(FF84F428)
+STUB(FF858330)
+STUB(FF859594)
+STUB(FF859738)
+STUB(FF8598A0)
+STUB(FF859A9C)
+STUB(FF859DD0)
+STUB(FF85A254)
+STUB(FF85C1C4)
+STUB(FF85C718)
+STUB(FF85D9E4)
+STUB(FF85E3C0)
+STUB(FF8610AC)
+STUB(FF867A40)
+STUB(FF867B80)
+STUB(FF86D008)
+STUB(FF86D198)
+STUB(FF86D3A4)
+STUB(FF86D894)
+STUB(FF86D8C0)
+STUB(FF8732C0)
+STUB(FF875064)
+STUB(FF87511C)
+STUB(FF875750)
+STUB(FF881B00)
+STUB(FF881B10)
+STUB(FF895968)
+STUB(FF895C1C)
+STUB(FF896164)
+STUB(FF8961EC)
+STUB(FF89646C)
+STUB(FF8969E8)
+STUB(FF8AA25C)
+STUB(FF8B3320)
+STUB(FF8B342C)
+STUB(FF8B3484)
+STUB(FF8B34DC)
+STUB(FF8B3534)
+STUB(FF8B358C)
+STUB(FF8B36CC)
+STUB(FF8B3784)
+STUB(FF8B3A14)
+STUB(FF8B3C18)
+STUB(FF8B3E80)
+STUB(FF8B4074)
+STUB(FF8B42DC)
+STUB(FF8B4418)
+STUB(FF8B468C)
+STUB(FF8B48B4)
+STUB(FF8B4BA4)
+STUB(FF8B4CA8)
+STUB(FF8B4EE0)
+STUB(FF8B5058)
+STUB(FF8B51F0)
+STUB(FF8B5328)
+STUB(FF8B5570)
+STUB(FF8B6528)
+STUB(FF8B67B4)
+STUB(FF8B6814)
+STUB(FF8B7AD0)
+STUB(FF8B7B00)
+STUB(FF8B7B44)
+STUB(FF8B7CC0)
+STUB(FF8B7D6C)
+STUB(FF8B7E0C)
+STUB(FF8B7EA4)
+STUB(FF8C53CC)
+STUB(FF8C7F90)
+STUB(FF8C98BC)
+STUB(FF8EFE60)
+STUB(FF8EFF24)
+STUB(FF8F3B40)
+STUB(FF905374)
+STUB(FF905440)
+STUB(FF922B9C)
+STUB(FF92F844)
+STUB(FF92F998)
+STUB(FF92FACC)
+STUB(FF937138)
+STUB(FF938D90)
+STUB(FF938F24)
+STUB(FF9392A8)
+STUB(FF939500)
+STUB(FF939538)
+STUB(FF93C0E0)
+STUB(FF93C414)
+STUB(FF93C41C)
+STUB(FF93C424)
+STUB(FF93C448)
+STUB(FF93C510)
+STUB(FF93C570)
+STUB(FF93C5F0)
+STUB(FF93C714)
+STUB(FF93C8B8)
+STUB(FF93CC38)
+STUB(FF93CEA4)
+STUB(FF93D08C)
+STUB(FF93D11C)
+STUB(FF93D1D0)
+STUB(FF93D28C)
+STUB(FF93D2F8)
+STUB(FF93D3C8)
+STUB(FF93D418)
+STUB(FF93D49C)
+STUB(FF93D5EC)
+STUB(FF93D680)
+STUB(FF93D748)
+STUB(FF93DA48)
+STUB(FF93DB30)
+STUB(FF93DBA4)
+STUB(FF93DF3C)
+STUB(FF93DF9C)
+STUB(FF93E520)
+STUB(FF93E698)
+STUB(FF93EB8C)
+STUB(FF93F558)
+STUB(FF93F574)
+STUB(FF93F584)
+STUB(FF93F5B0)
+STUB(FF95DE08)
+STUB(FF9B2824)
+STUB(FFAAD774)
+STUB(FFAAD9D0)
+STUB(FFAAF280)
Index: /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100c/Makefile
===================================================================
--- /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100c/Makefile	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100c/Makefile	(revision 1668)
@@ -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/reyalp-ptp-live/platform/ixus970_sd890/sub/100f/capt_seq.c
===================================================================
--- /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100f/capt_seq.c	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100f/capt_seq.c	(revision 1668)
@@ -0,0 +1,1109 @@
+#include "lolevel.h"
+#include "platform.h"
+#include "core.h"
+
+// @ FF93DB18
+static long *nrflag = (long*)0x91A4;
+
+#include "../../../generic/capt_seq.c"
+
+// Extracted method: task_CaptSeqTask (FF85DFC0)
+void __attribute__((naked,noinline)) capt_seq_task()
+{
+	asm volatile (
+		"STMFD   SP!, {R3-R9,LR}\n"
+		"LDR     R6, =0x19EBC\n"
+		"LDR     R5, =0x54E0\n"
+		"MOV     R9, #1\n"
+		"MOV     R7, #0\n"
+
+		"loc_FF85DFD4:\n"
+		"LDR     R0, [R5,#0xC]\n"
+		"MOV     R2, #0\n"
+		"MOV     R1, SP\n"
+		"BL      sub_FF827D8C\n" // LOCATION: KerQueue.c:0
+		"TST     R0, #1\n"
+		"BEQ     loc_FF85E000\n"
+		"LDR     R1, =0x48E\n"
+		"LDR     R0, =0xFF85DC98\n" // "SsShootTask.c"
+		"BL      _DebugAssert\n"
+		"BL      sub_FF81BAA8\n" // ExitTask\n"
+		"LDMFD   SP!, {R3-R9,PC}\n"
+
+		"loc_FF85E000:\n"
+		"LDR     R0, [SP,#0x20-0x20]\n"
+		"LDR     R1, [R0]\n"
+		"CMP     R1, #0x1B\n"
+		"ADDLS   PC, PC, R1,LSL#2\n"
+		"B       loc_FF85E220\n"
+
+		"loc_FF85E014:\n"
+		"B       loc_FF85E084\n"
+
+		"loc_FF85E018:\n"
+		"B       loc_FF85E0EC\n"
+
+		"loc_FF85E01C:\n"
+		"B       loc_FF85E0F4\n"
+
+		"loc_FF85E020:\n"
+		"B       loc_FF85E10C\n"
+
+		"loc_FF85E024:\n"
+		"B       loc_FF85E100\n"
+
+		"loc_FF85E028:\n"
+		"B       loc_FF85E114\n"
+
+		"loc_FF85E02C:\n"
+		"B       loc_FF85E11C\n"
+
+		"loc_FF85E030:\n"
+		"B       loc_FF85E124\n"
+
+		"loc_FF85E034:\n"
+		"B       loc_FF85E17C\n"
+
+		"loc_FF85E038:\n"
+		"B       loc_FF85E188\n"
+
+		"loc_FF85E03C:\n"
+		"B       loc_FF85E190\n"
+
+		"loc_FF85E040:\n"
+		"B       loc_FF85E198\n"
+
+		"loc_FF85E044:\n"
+		"B       loc_FF85E1A0\n"
+
+		"loc_FF85E048:\n"
+		"B       loc_FF85E1A8\n"
+
+		"loc_FF85E04C:\n"
+		"B       loc_FF85E1B0\n"
+
+		"loc_FF85E050:\n"
+		"B       loc_FF85E1B8\n"
+
+		"loc_FF85E054:\n"
+		"B       loc_FF85E1C0\n"
+
+		"loc_FF85E058:\n"
+		"B       loc_FF85E1CC\n"
+
+		"loc_FF85E05C:\n"
+		"B       loc_FF85E1D4\n"
+
+		"loc_FF85E060:\n"
+		"B       loc_FF85E1DC\n"
+
+		"loc_FF85E064:\n"
+		"B       loc_FF85E1E4\n"
+
+		"loc_FF85E068:\n"
+		"B       loc_FF85E1F0\n"
+
+		"loc_FF85E06C:\n"
+		"B       loc_FF85E1F8\n"
+
+		"loc_FF85E070:\n"
+		"B       loc_FF85E200\n"
+
+		"loc_FF85E074:\n"
+		"B       loc_FF85E208\n"
+
+		"loc_FF85E078:\n"
+		"B       loc_FF85E210\n"
+
+		"loc_FF85E07C:\n"
+		"B       loc_FF85E218\n"
+
+		"loc_FF85E080:\n"
+		"B       loc_FF85E22C\n"
+
+		"loc_FF85E084:\n"
+		// jumptable FF85E00C entry 0
+		"BL      sub_FF93C3B8\n" // LOCATION: SsPrepareSeq.c:0
+		"BL      shooting_expo_param_override\n" // +
+		"BL      sub_FF85C148\n"
+		"LDR     R0, [R6,#0x24]\n"
+		"CMP     R0, #0\n"
+		"BEQ     loc_FF85E22C\n"
+		"BL      sub_FF85D968\n"
+		"MOV     R4, R0\n"
+		"LDR     R0, [R6,#0x24]\n"
+		"CMP     R0, #0\n"
+		"BEQ     loc_FF85E0CC\n"
+		"MOV     R0, #0xC\n"
+		"BL      sub_FF861030\n"
+		"TST     R0, #1\n"
+		"STRNE   R9, [R5,#4]\n"
+		"LDRNE   R0, [R4,#8]\n"
+		"ORRNE   R0, R0, #0x40000000\n"
+		"STRNE   R0, [R4,#8]\n"
+		"BNE     loc_FF85E22C\n"
+
+		"loc_FF85E0CC:\n"
+		"BL      sub_FF95DD78\n"
+		"BL      sub_FF86D11C\n" // LOCATION: PropertyCase.c:0
+		"STR     R0, [R4,#0x14]\n"
+		"MOV     R0, R4\n"
+		//"BL      sub_FF93DAA0\n" // LOCATION: SsCaptureSeq.c:536
+		"BL      sub_FF93DAA0_my\n" // +
+		"BL      capt_seq_hook_raw_here\n" // +
+		"TST     R0, #1\n"
+		"STRNE   R9, [R5,#4]\n"
+		"B       loc_FF85E22C\n"
+
+		"loc_FF85E0EC:\n"
+		// jumptable FF85E00C entry 1
+		//"BL      sub_FF85E344\n"
+		"BL      sub_FF85E344_my\n" // +
+		"B       loc_FF85E104\n"
+
+		"loc_FF85E0F4:\n"
+		// jumptable FF85E00C entry 2
+		"MOV     R0, #1\n"
+		"BL      sub_FF93C560\n" // LOCATION: SsPrepareSeq.c:0
+		"B       loc_FF85E22C\n"
+
+		"loc_FF85E100:\n"
+		// jumptable FF85E00C entry 4
+		"BL      sub_FF93C050\n"
+
+		"loc_FF85E104:\n"
+		"STR     R7, [R6,#0x24]\n"
+		"B       loc_FF85E22C\n"
+
+		"loc_FF85E10C:\n"
+		// jumptable FF85E00C entry 3
+		"BL      sub_FF93C384\n"
+		"B       loc_FF85E104\n"
+
+		"loc_FF85E114:\n"
+		// jumptable FF85E00C entry 5
+		"BL      sub_FF93C38C\n"
+		"B       loc_FF85E22C\n"
+
+		"loc_FF85E11C:\n"
+		// jumptable FF85E00C entry 6
+		"BL      sub_FF93C480\n" // LOCATION: SsPrepareSeq.c:0
+		"B       loc_FF85E180\n"
+
+		"loc_FF85E124:\n"
+		// jumptable FF85E00C entry 7
+		"LDR     R4, [R0,#0xC]\n"
+		"BL      sub_FF93C394\n"
+		"MOV     R0, R4\n"
+		"BL      sub_FF93CBA8\n" // LOCATION: SsPrePreSeq.c:2097152
+		"TST     R0, #1\n"
+		"MOV     R8, R0\n"
+		"BNE     loc_FF85E164\n"
+		"BL      sub_FF86D11C\n" // LOCATION: PropertyCase.c:0
+		"STR     R0, [R4,#0x14]\n"
+		"MOV     R0, R4\n"
+		"BL      sub_FF93D9B8\n" // LOCATION: SsCaptureSeq.c:1
+		"MOV     R0, R4\n"
+		"BL      sub_FF93DF0C\n" // LOCATION: SsCaptureSeq.c:4
+		"MOV     R8, R0\n"
+		"LDR     R0, [R4,#0x14]\n"
+		"BL      sub_FF86D328\n" // LOCATION: PropertyCase.c:0
+
+		"loc_FF85E164:\n"
+		"BL      sub_FF93C384\n"
+		"MOV     R2, R4\n"
+		"MOV     R1, #9\n"
+		"MOV     R0, R8\n"
+		"BL      sub_FF85C69C\n" // LOCATION: SsShootCtrl.c:0
+		"B       loc_FF85E22C\n"
+
+		"loc_FF85E17C:\n"
+		// jumptable FF85E00C entry 8
+		"BL      sub_FF93C4E0\n" // LOCATION: SsPrepareSeq.c:960
+
+		"loc_FF85E180:\n"
+		"BL      sub_FF85C148\n"
+		"B       loc_FF85E22C\n"
+
+		"loc_FF85E188:\n"
+		// jumptable FF85E00C entry 9
+		"BL      sub_FF93C384\n"
+		"B       loc_FF85E22C\n"
+
+		"loc_FF85E190:\n"
+		// jumptable FF85E00C entry 10
+		"BL      sub_FF93CE14\n"
+		"B       loc_FF85E22C\n"
+
+		"loc_FF85E198:\n"
+		// jumptable FF85E00C entry 11
+		"BL      sub_FF93CFFC\n"
+		"B       loc_FF85E22C\n"
+
+		"loc_FF85E1A0:\n"
+		// jumptable FF85E00C entry 12
+		"BL      sub_FF93D08C\n" // LOCATION: SsExpCompSeq.c:94
+		"B       loc_FF85E22C\n"
+
+		"loc_FF85E1A8:\n"
+		// jumptable FF85E00C entry 13
+		"BL      sub_FF93D140\n"
+		"B       loc_FF85E22C\n"
+
+		"loc_FF85E1B0:\n"
+		// jumptable FF85E00C entry 14
+		"BL      sub_FF93D338\n" // LOCATION: SsChgExpSeq.c:32
+		"B       loc_FF85E22C\n"
+
+		"loc_FF85E1B8:\n"
+		// jumptable FF85E00C entry 15
+		"BL      sub_FF93D388\n" // LOCATION: SsChgExpSeq.c:32
+		"B       loc_FF85E22C\n"
+
+		"loc_FF85E1C0:\n"
+		// jumptable FF85E00C entry 16
+		"MOV     R0, #0\n"
+		"BL      sub_FF93D40C\n"
+		"B       loc_FF85E22C\n"
+
+		"loc_FF85E1CC:\n"
+		// jumptable FF85E00C entry 17
+		"BL      sub_FF93D55C\n"
+		"B       loc_FF85E22C\n"
+
+		"loc_FF85E1D4:\n"
+		// jumptable FF85E00C entry 18
+		"BL      sub_FF93D5F0\n" // LOCATION: SsMFSeq.c:109
+		"B       loc_FF85E22C\n"
+
+		"loc_FF85E1DC:\n"
+		// jumptable FF85E00C entry 19
+		"BL      sub_FF93D6B8\n" // LOCATION: SsMFSeq.c:181
+		"B       loc_FF85E22C\n"
+
+		"loc_FF85E1E4:\n"
+		// jumptable FF85E00C entry 20
+		"BL      sub_FF93C684\n"
+		"BL      sub_FF824C38\n"
+		"B       loc_FF85E22C\n"
+
+		"loc_FF85E1F0:\n"
+		// jumptable FF85E00C entry 21
+		"BL      sub_FF93D1FC\n"
+		"B       loc_FF85E22C\n"
+
+		"loc_FF85E1F8:\n"
+		// jumptable FF85E00C entry 22
+		"BL      sub_FF93D268\n" // LOCATION: SsChgExpSeq.c:0
+		"B       loc_FF85E22C\n"
+
+		"loc_FF85E200:\n"
+		// jumptable FF85E00C entry 23
+		"BL      sub_FF93F4C8\n"
+		"B       loc_FF85E22C\n"
+
+		"loc_FF85E208:\n"
+		// jumptable FF85E00C entry 24
+		"BL      sub_FF93F4E4\n"
+		"B       loc_FF85E22C\n"
+
+		"loc_FF85E210:\n"
+		// jumptable FF85E00C entry 25
+		"BL      sub_FF93F4F4\n"
+		"B       loc_FF85E22C\n"
+
+		"loc_FF85E218:\n"
+		// jumptable FF85E00C entry 26
+		"BL      sub_FF93F520\n"
+		"B       loc_FF85E22C\n"
+
+		"loc_FF85E220:\n"
+		// jumptable FF85E00C default entry
+		"LDR     R1, =0x58E\n"
+		"LDR     R0, =0xFF85DC98\n" // aSsshoottask_c
+		"BL      _DebugAssert\n"
+
+		"loc_FF85E22C:\n"
+		// jumptable FF85E00C entry 27
+		"LDR     R0, [SP,#0x20-0x20]\n"
+		"LDR     R1, [R0,#4]\n"
+		"LDR     R0, [R5,#8]\n"
+		"BL      sub_FF827B08\n"
+		"LDR     R4, [SP,#0x20-0x20]\n"
+		"LDR     R0, [R4,#8]\n"
+		"CMP     R0, #0\n"
+		"LDREQ   R1, =0x10D\n"
+		"LDREQ   R0, =0xFF85DC98\n" // aSsshoottask_c
+		"BLEQ    _DebugAssert\n"
+		"STR     R7, [R4,#8]\n"
+		"B       loc_FF85DFD4\n"
+		);
+}
+
+void __attribute__((naked,noinline)) sub_FF85E344_my()
+{
+	asm volatile (
+		"STMFD   SP!, {R4-R6,LR}\n"
+		"LDR     R4, [R0,#0xC]\n"
+		"LDR     R6, =0x19EBC\n"
+		"LDR     R0, [R4,#8]\n"
+		"MOV     R5, #0\n"
+		"ORR     R0, R0, #1\n"
+		"STR     R0, [R4,#8]\n"
+		"LDR     R0, [R6,#0x24]\n"
+		"CMP     R0, #0\n"
+		"MOVEQ   R0, #2\n"
+		"BLEQ    sub_FF8582B4\n"
+		"BL      sub_FF93C394\n"
+		"LDR     R0, [R6,#0x24]\n"
+		"CMP     R0, #0\n"
+		"BNE     loc_FF85E3C4\n"
+		"MOV     R0, R4\n"
+		"BL      sub_FF93C828\n" // LOCATION: SsPrePreSeq.c:242
+		"TST     R0, #1\n"
+		"MOVNE   R2, R4\n"
+		"LDMNEFD SP!, {R4-R6,LR}\n"
+		"MOVNE   R1, #1\n"
+		"BNE     sub_FF85C69C\n" // LOCATION: SsShootCtrl.c:0
+		"BL      sub_FF95DD78\n"
+		"BL      sub_FF86D11C\n" // LOCATION: PropertyCase.c:0
+		"STR     R0, [R4,#0x14]\n"
+		"MOV     R0, R4\n"
+		"BL      sub_FF93D9B8\n" // LOCATION: SsCaptureSeq.c:1
+		"BL      sub_FF93E490\n" // LOCATION: SsShootLib.c:32768
+		"MOV     R0, R4\n"
+		//"BL      sub_FF93DAA0\n" // LOCATION: SsCaptureSeq.c:536
+		"BL      sub_FF93DAA0_my\n" // +
+		"MOV     R5, R0\n"
+		"BL      capt_seq_hook_raw_here\n" // +
+		"B       loc_FF85E3D4\n"
+
+		"loc_FF85E3C4:\n"
+		"LDR     R0, =0x54E0\n"
+		"LDR     R0, [R0,#4]\n"
+		"CMP     R0, #0\n"
+		"MOVNE   R5, #0x1D\n"
+
+		"loc_FF85E3D4:\n"
+		"BL      sub_FF93F4E4\n"
+		"BL      sub_FF93F520\n"
+		"MOV     R2, R4\n"
+		"MOV     R1, #1\n"
+		"MOV     R0, R5\n"
+		"BL      sub_FF85C69C\n" // LOCATION: SsShootCtrl.c:0
+		"BL      sub_FF93DEAC\n"
+		"CMP     R0, #0\n"
+		"LDRNE   R0, [R4,#8]\n"
+		"ORRNE   R0, R0, #0x2000\n"
+		"STRNE   R0, [R4,#8]\n"
+		"LDMFD   SP!, {R4-R6,PC}\n"
+		);
+}
+
+void __attribute__((naked,noinline)) sub_FF93DAA0_my()
+{
+	asm volatile (
+		"STMFD   SP!, {R0-R10,LR}\n"
+		"MOV     R6, #0\n"
+		"MOV     R4, R0\n"
+		"BL      sub_FF93E608\n" // LOCATION: SsShootEvent.c:60
+		"MVN     R1, #0\n"
+		"BL      sub_FF827B3C\n"
+		"MOV     R2, #4\n"
+		"ADD     R1, SP, #0x30-0x28\n"
+		"MOV     R0, #0x8A\n"
+		"BL      sub_FF86CF8C\n" // PT_GetPropertyCaseString_0
+		"TST     R0, #1\n"
+		"MOVNE   R1, #0x218\n"
+		"LDRNE   R0, =0xFF93DC74\n" // "SsCaptureSeq.c"
+		"BLNE    _DebugAssert\n"
+		"LDR     R8, =0x19F70\n"
+		"LDR     R5, =0x19EBC\n"
+		"LDRSH   R1, [R8,#0xE]\n"
+		"LDR     R0, [R5,#0x7C]\n"
+		"BL      sub_FF8F3AC4\n"
+		"BL      sub_FF84532C\n" // GetCCDTemperature
+		"LDR     R2, =0x91A8\n"
+		"ADD     R3, R4, #0x8C\n"
+		"STRH    R0, [R4,#0x88]\n"
+		"STRD    R2, [SP,#0x30-0x30]\n"
+		"MOV     R1, R0\n"
+		"LDRH    R0, [R5,#0x54]\n"
+		"LDRSH   R2, [R8,#0xC]\n"
+		"LDR     R3, =0x91A4\n"
+		"BL      sub_FF93EAFC\n" // LOCATION: NRTable.c:202
+		"BL      wait_until_remote_button_is_released\n" // +
+		"BL      capt_seq_hook_set_nr\n" // +
+		"BL      sub_FF93DB14\n" // Continue in the original FW
+		);
+}
+
+// Extracted method: task_ExpDrvTask (FF8B67E8)
+void __attribute__((naked,noinline)) exp_drv_task()
+{
+	asm volatile (
+		"STMFD   SP!, {R4-R8,LR}\n"
+		"SUB     SP, SP, #0x20\n"
+		"LDR     R8, =0xBB8\n"
+		"LDR     R7, =0x6E30\n"
+		"LDR     R5, =0x3E198\n"
+		"MOV     R0, #0\n"
+		"ADD     R6, SP, #0x38-0x28\n"
+		"STR     R0, [SP,#0x38-0x2C]\n"
+
+		"loc_FF8B6808:\n"
+		"LDR     R0, [R7,#0x20]\n"
+		"MOV     R2, #0\n"
+		"ADD     R1, SP, #0x38-0x1C\n"
+		"BL      sub_FF827D8C\n" // LOCATION: KerQueue.c:0
+		"LDR     R0, [SP,#0x38-0x2C]\n"
+		"CMP     R0, #1\n"
+		"BNE     loc_FF8B6850\n"
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"LDR     R0, [R0]\n"
+		"CMP     R0, #0x13\n"
+		"CMPNE   R0, #0x14\n"
+		"CMPNE   R0, #0x15\n"
+		"BEQ     loc_FF8B696C\n"
+		"CMP     R0, #0x27\n"
+		"BEQ     loc_FF8B6944\n"
+		"ADD     R1, SP, #0x38-0x2C\n"
+		"MOV     R0, #0\n"
+		"BL      sub_FF8B6798\n" // LOCATION: ExpDrv.c:512
+
+		"loc_FF8B6850:\n"
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"LDR     R1, [R0]\n"
+		"CMP     R1, #0x2C\n"
+		"BNE     loc_FF8B6880\n"
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"BL      sub_FF8B7A54\n" // LOCATION: ExpDrv.c:268
+		"LDR     R0, [R7,#0x1C]\n"
+		"MOV     R1, #1\n"
+		"BL      sub_FF827B08\n"
+		"BL      sub_FF81BAA8\n" // eventproc_export_ExitTask
+		"ADD     SP, SP, #0x20\n"
+		"LDMFD   SP!, {R4-R8,PC}\n"
+
+		"loc_FF8B6880:\n"
+		"CMP     R1, #0x2B\n"
+		"BNE     loc_FF8B689C\n"
+		"LDR     R2, [R0,#0x88]!\n"
+		"LDR     R1, [R0,#4]\n"
+		"MOV     R0, R1\n"
+		"BLX     R2\n"
+		"B       loc_FF8B6DD4\n"
+
+		"loc_FF8B689C:\n"
+		"CMP     R1, #0x25\n"
+		"BNE     loc_FF8B68EC\n"
+		"LDR     R0, [R7,#0x1C]\n"
+		"MOV     R1, #0x80\n"
+		"BL      sub_FF827B3C\n"
+		"LDR     R0, =0xFF8B3220\n"
+		"MOV     R1, #0x80\n"
+		"BL      sub_FF92F7C8\n" // LOCATION: IrisController.c:74
+		"LDR     R0, [R7,#0x1C]\n"
+		"MOV     R2, R8\n"
+		"MOV     R1, #0x80\n"
+		"BL      sub_FF827A40\n" // LOCATION: KerFlag.c:0
+		"TST     R0, #1\n"
+		"LDRNE   R1, =0xD1B\n"
+		"BNE     loc_FF8B6930\n"
+
+		"loc_FF8B68D8:\n"
+		"LDR     R1, [SP,#0x38-0x1C]\n"
+		"LDR     R0, [R1,#0x8C]\n"
+		"LDR     R1, [R1,#0x88]\n"
+		"BLX     R1\n"
+		"B       loc_FF8B6DD4\n"
+
+		"loc_FF8B68EC:\n"
+		"CMP     R1, #0x26\n"
+		"BNE     loc_FF8B693C\n"
+		"ADD     R1, SP, #0x38-0x2C\n"
+		"BL      sub_FF8B6798\n" // LOCATION: ExpDrv.c:512
+		"LDR     R0, [R7,#0x1C]\n"
+		"MOV     R1, #0x100\n"
+		"BL      sub_FF827B3C\n"
+		"LDR     R0, =0xFF8B3230\n"
+		"MOV     R1, #0x100\n"
+		"BL      sub_FF92FA50\n" // LOCATION: IrisController.c:160
+		"LDR     R0, [R7,#0x1C]\n"
+		"MOV     R2, R8\n"
+		"MOV     R1, #0x100\n"
+		"BL      sub_FF827A40\n" // LOCATION: KerFlag.c:0
+		"TST     R0, #1\n"
+		"BEQ     loc_FF8B68D8\n"
+		"LDR     R1, =0xD25\n"
+
+		"loc_FF8B6930:\n"
+		"LDR     R0, =0xFF8B3920\n" // "ExpDrv.c"
+		"BL      _DebugAssert\n"
+		"B       loc_FF8B68D8\n"
+
+		"loc_FF8B693C:\n"
+		"CMP     R1, #0x27\n"
+		"BNE     loc_FF8B6954\n"
+
+		"loc_FF8B6944:\n"
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"ADD     R1, SP, #0x38-0x2C\n"
+		"BL      sub_FF8B6798\n" // LOCATION: ExpDrv.c:512
+		"B       loc_FF8B68D8\n"
+
+		"loc_FF8B6954:\n"
+		"CMP     R1, #0x2A\n"
+		"BNE     loc_FF8B696C\n"
+		"BL      sub_FF895BA0\n" // LOCATION: Shutter.c:2
+		"BL      sub_FF89696C\n" // LOCATION: ImgPixel.c:0
+		"BL      sub_FF8963F0\n" // LOCATION: ImgGain.c:0
+		"B       loc_FF8B68D8\n"
+
+		"loc_FF8B696C:\n"
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"MOV     R4, #1\n"
+		"LDR     R1, [R0]\n"
+		"CMP     R1, #0x11\n"
+		"CMPNE   R1, #0x12\n"
+		"BNE     loc_FF8B69DC\n"
+		"LDR     R1, [R0,#0x7C]\n"
+		"ADD     R1, R1, R1,LSL#1\n"
+		"ADD     R1, R0, R1,LSL#2\n"
+		"SUB     R1, R1, #8\n"
+		"LDMIA   R1, {R2-R4}\n"
+		"STMIA   R6, {R2-R4}\n"
+		"BL      sub_FF8B52AC\n" // LOCATION: ExpDrv.c:2
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"LDR     R1, [R0,#0x7C]\n"
+		"LDR     R3, [R0,#0x88]\n"
+		"LDR     R2, [R0,#0x8C]\n"
+		"ADD     R0, R0, #4\n"
+		"BLX     R3\n"
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"BL      sub_FF8B7E28\n" // LOCATION: ExpDrv.c:0
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"LDR     R1, [R0,#0x7C]\n"
+		"LDR     R3, [R0,#0x90]\n"
+		"LDR     R2, [R0,#0x94]\n"
+		"ADD     R0, R0, #4\n"
+		"BLX     R3\n"
+		"B       loc_FF8B6D14\n"
+
+		"loc_FF8B69DC:\n"
+		"CMP     R1, #0x13\n"
+		"CMPNE   R1, #0x14\n"
+		"CMPNE   R1, #0x15\n"
+		"BNE     loc_FF8B6A90\n"
+		"ADD     R3, SP, #0x38-0x2C\n"
+		"MOV     R2, SP\n"
+		"ADD     R1, SP, #0x38-0x28\n"
+		"BL      sub_FF8B54F4\n" // LOCATION: ExpDrv.c:0
+		"CMP     R0, #1\n"
+		"MOV     R4, R0\n"
+		"CMPNE   R4, #5\n"
+		"BNE     loc_FF8B6A2C\n"
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"MOV     R2, R4\n"
+		"LDR     R1, [R0,#0x7C]!\n"
+		"LDR     R12, [R0,#0xC]!\n"
+		"LDR     R3, [R0,#4]\n"
+		"MOV     R0, SP\n"
+		"BLX     R12\n"
+		"B       loc_FF8B6A64\n"
+
+		"loc_FF8B6A2C:\n"
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"CMP     R4, #2\n"
+		"LDR     R3, [R0,#0x8C]\n"
+		"CMPNE   R4, #6\n"
+		"BNE     loc_FF8B6A78\n"
+		"LDR     R12, [R0,#0x88]\n"
+		"MOV     R0, SP\n"
+		"MOV     R2, R4\n"
+		"MOV     R1, #1\n"
+		"BLX     R12\n"
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"MOV     R2, SP\n"
+		"ADD     R1, SP, #0x38-0x28\n"
+		"BL      sub_FF8B64AC\n" // LOCATION: ExpDrv.c:0
+
+		"loc_FF8B6A64:\n"
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"LDR     R2, [SP,#0x38-0x2C]\n"
+		"MOV     R1, R4\n"
+		"BL      sub_FF8B6738\n" // LOCATION: ExpDrv.c:2
+		"B       loc_FF8B6D14\n"
+
+		"loc_FF8B6A78:\n"
+		"LDR     R1, [R0,#0x7C]\n"
+		"LDR     R12, [R0,#0x88]\n"
+		"ADD     R0, R0, #4\n"
+		"MOV     R2, R4\n"
+		"BLX     R12\n"
+		"B       loc_FF8B6D14\n"
+
+		"loc_FF8B6A90:\n"
+		"CMP     R1, #0x21\n"
+		"CMPNE   R1, #0x22\n"
+		"BNE     loc_FF8B6ADC\n"
+		"LDR     R1, [R0,#0x7C]\n"
+		"ADD     R1, R1, R1,LSL#1\n"
+		"ADD     R1, R0, R1,LSL#2\n"
+		"SUB     R1, R1, #8\n"
+		"LDMIA   R1, {R2-R4}\n"
+		"STMIA   R6, {R2-R4}\n"
+		"BL      sub_FF8B4838\n" // LOCATION: ExpDrv.c:0
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"LDR     R1, [R0,#0x7C]\n"
+		"LDR     R3, [R0,#0x88]\n"
+		"LDR     R2, [R0,#0x8C]\n"
+		"ADD     R0, R0, #4\n"
+		"BLX     R3\n"
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"BL      sub_FF8B4B28\n" // LOCATION: ExpDrv.c:0
+		"B       loc_FF8B6D14\n"
+
+		"loc_FF8B6ADC:\n"
+		"ADD     R1, R0, #4\n"
+		"LDMIA   R1, {R2,R3,R12}\n"
+		"STMIA   R6, {R2,R3,R12}\n"
+		"LDR     R1, [R0]\n"
+		"CMP     R1, #0x24\n"
+		"ADDLS   PC, PC, R1,LSL#2\n"
+		"B       loc_FF8B6CF4\n"
+
+		"loc_FF8B6AF8:\n"
+		"B       loc_FF8B6B8C\n"
+
+		"loc_FF8B6AFC:\n"
+		"B       loc_FF8B6B8C\n"
+
+		"loc_FF8B6B00:\n"
+		"B       loc_FF8B6BDC\n"
+
+		"loc_FF8B6B04:\n"
+		"B       loc_FF8B6BE4\n"
+
+		"loc_FF8B6B08:\n"
+		"B       loc_FF8B6BE4\n"
+
+		"loc_FF8B6B0C:\n"
+		"B       loc_FF8B6BE4\n"
+
+		"loc_FF8B6B10:\n"
+		"B       loc_FF8B6B8C\n"
+
+		"loc_FF8B6B14:\n"
+		"B       loc_FF8B6BDC\n"
+
+		"loc_FF8B6B18:\n"
+		"B       loc_FF8B6BE4\n"
+
+		"loc_FF8B6B1C:\n"
+		"B       loc_FF8B6BE4\n"
+
+		"loc_FF8B6B20:\n"
+		"B       loc_FF8B6BFC\n"
+
+		"loc_FF8B6B24:\n"
+		"B       loc_FF8B6BFC\n"
+
+		"loc_FF8B6B28:\n"
+		"B       loc_FF8B6CE8\n"
+
+		"loc_FF8B6B2C:\n"
+		"B       loc_FF8B6CF0\n"
+
+		"loc_FF8B6B30:\n"
+		"B       loc_FF8B6CF0\n"
+
+		"loc_FF8B6B34:\n"
+		"B       loc_FF8B6CF0\n"
+
+		"loc_FF8B6B38:\n"
+		"B       loc_FF8B6CF0\n"
+
+		"loc_FF8B6B3C:\n"
+		"B       loc_FF8B6CF4\n"
+
+		"loc_FF8B6B40:\n"
+		"B       loc_FF8B6CF4\n"
+
+		"loc_FF8B6B44:\n"
+		"B       loc_FF8B6CF4\n"
+
+		"loc_FF8B6B48:\n"
+		"B       loc_FF8B6CF4\n"
+
+		"loc_FF8B6B4C:\n"
+		"B       loc_FF8B6CF4\n"
+
+		"loc_FF8B6B50:\n"
+		"B       loc_FF8B6BEC\n"
+
+		"loc_FF8B6B54:\n"
+		"B       loc_FF8B6BF4\n"
+
+		"loc_FF8B6B58:\n"
+		"B       loc_FF8B6BF4\n"
+
+		"loc_FF8B6B5C:\n"
+		"B       loc_FF8B6C08\n"
+
+		"loc_FF8B6B60:\n"
+		"B       loc_FF8B6C08\n"
+
+		"loc_FF8B6B64:\n"
+		"B       loc_FF8B6C10\n"
+
+		"loc_FF8B6B68:\n"
+		"B       loc_FF8B6C40\n"
+
+		"loc_FF8B6B6C:\n"
+		"B       loc_FF8B6C70\n"
+
+		"loc_FF8B6B70:\n"
+		"B       loc_FF8B6CA0\n"
+
+		"loc_FF8B6B74:\n"
+		"B       loc_FF8B6CD0\n"
+
+		"loc_FF8B6B78:\n"
+		"B       loc_FF8B6CD0\n"
+
+		"loc_FF8B6B7C:\n"
+		"B       loc_FF8B6CF4\n"
+
+		"loc_FF8B6B80:\n"
+		"B       loc_FF8B6CF4\n"
+
+		"loc_FF8B6B84:\n"
+		"B       loc_FF8B6CD8\n"
+
+		"loc_FF8B6B88:\n"
+		"B       loc_FF8B6CE0\n"
+
+		"loc_FF8B6B8C:\n"
+		// jumptable FF8B6AF0 entries 0,1,6
+		"BL      sub_FF8B3708\n" // LOCATION: ExpDrv.c:800
+		"B       loc_FF8B6CF4\n"
+
+		"loc_FF8B6BDC:\n"
+		// jumptable FF8B6AF0 entries 2,7
+		"BL      sub_FF8B3998\n" // LOCATION: ExpDrv.c:0
+		"B       loc_FF8B6CF4\n"
+
+		"loc_FF8B6BE4:\n"
+		// jumptable FF8B6AF0 entries 3-5,8,9
+		"BL      sub_FF8B3B9C\n" // LOCATION: ExpDrv.c:0
+		"B       loc_FF8B6CF4\n"
+
+		"loc_FF8B6BEC:\n"
+		// jumptable FF8B6AF0 entry 22
+		"BL      sub_FF8B3E04\n" // LOCATION: ExpDrv.c:2
+		"B       loc_FF8B6CF4\n"
+
+		"loc_FF8B6BF4:\n"
+		// jumptable FF8B6AF0 entries 23,24
+		"BL      sub_FF8B3FF8\n" // LOCATION: ExpDrv.c:11
+		"B       loc_FF8B6CF4\n"
+
+		"loc_FF8B6BFC:\n"
+		// jumptable FF8B6AF0 entries 10,11
+		//"BL      sub_FF8B4260\n" // LOCATION: ExpDrv.c:2
+		"BL      sub_FF8B4260_my\n" //------------>
+		"MOV     R4, #0\n"
+		"B       loc_FF8B6CF4\n"
+
+		"loc_FF8B6C08:\n"
+		// jumptable FF8B6AF0 entries 25,26
+		"BL      sub_FF8B439C\n"
+		"B       loc_FF8B6CF4\n"
+
+		"loc_FF8B6C10:\n"
+		// jumptable FF8B6AF0 entry 27
+		"LDRH    R1, [R0,#4]\n"
+		"STRH    R1, [SP,#0x38-0x28]\n"
+		"LDRH    R1, [R5,#2]\n"
+		"STRH    R1, [SP,#0x38-0x26]\n"
+		"LDRH    R1, [R5,#4]\n"
+		"STRH    R1, [SP,#0x38-0x24]\n"
+		"LDRH    R1, [R5,#6]\n"
+		"STRH    R1, [SP,#0x38-0x22]\n"
+		"LDRH    R1, [R0,#0xC]\n"
+		"STRH    R1, [SP,#0x38-0x20]\n"
+		"BL      sub_FF8B7AC8\n" // LOCATION: ExpDrv.c:2
+		"B       loc_FF8B6CF4\n"
+
+		"loc_FF8B6C40:\n"
+		// jumptable FF8B6AF0 entry 28
+		"LDRH    R1, [R0,#4]\n"
+		"STRH    R1, [SP,#0x38-0x28]\n"
+		"LDRH    R1, [R5,#2]\n"
+		"STRH    R1, [SP,#0x38-0x26]\n"
+		"LDRH    R1, [R5,#4]\n"
+		"STRH    R1, [SP,#0x38-0x24]\n"
+		"LDRH    R1, [R5,#6]\n"
+		"STRH    R1, [SP,#0x38-0x22]\n"
+		"LDRH    R1, [R5,#8]\n"
+		"STRH    R1, [SP,#0x38-0x20]\n"
+		"BL      sub_FF8B7C44\n" // LOCATION: ExpDrv.c:2
+		"B       loc_FF8B6CF4\n"
+
+		"loc_FF8B6C70:\n"
+		// jumptable FF8B6AF0 entry 29
+		"LDRH    R1, [R5]\n"
+		"STRH    R1, [SP,#0x38-0x28]\n"
+		"LDRH    R1, [R0,#6]\n"
+		"STRH    R1, [SP,#0x38-0x26]\n"
+		"LDRH    R1, [R5,#4]\n"
+		"STRH    R1, [SP,#0x38-0x24]\n"
+		"LDRH    R1, [R5,#6]\n"
+		"STRH    R1, [SP,#0x38-0x22]\n"
+		"LDRH    R1, [R5,#8]\n"
+		"STRH    R1, [SP,#0x38-0x20]\n"
+		"BL      sub_FF8B7CF0\n" // LOCATION: ExpDrv.c:0
+		"B       loc_FF8B6CF4\n"
+
+		"loc_FF8B6CA0:\n"
+		// jumptable FF8B6AF0 entry 30
+		"LDRH    R1, [R5]\n"
+		"STRH    R1, [SP,#0x38-0x28]\n"
+		"LDRH    R1, [R5,#2]\n"
+		"STRH    R1, [SP,#0x38-0x26]\n"
+		"LDRH    R1, [R5,#4]\n"
+		"STRH    R1, [SP,#0x38-0x24]\n"
+		"LDRH    R1, [R5,#6]\n"
+		"STRH    R1, [SP,#0x38-0x22]\n"
+		"LDRH    R1, [R0,#0xC]\n"
+		"STRH    R1, [SP,#0x38-0x20]\n"
+		"BL      sub_FF8B7D90\n" // LOCATION: ExpDrv.c:32
+		"B       loc_FF8B6CF4\n"
+
+		"loc_FF8B6CD0:\n"
+		// jumptable FF8B6AF0 entries 31,32
+		"BL      sub_FF8B4610\n" // LOCATION: ExpDrv.c:0
+		"B       loc_FF8B6CF4\n"
+
+		"loc_FF8B6CD8:\n"
+		// jumptable FF8B6AF0 entry 35
+		"BL      sub_FF8B4C2C\n" // LOCATION: ExpDrv.c:10
+		"B       loc_FF8B6CF4\n"
+
+		"loc_FF8B6CE0:\n"
+		// jumptable FF8B6AF0 entry 36
+		"BL      sub_FF8B4E64\n" // LOCATION: ExpDrv.c:0
+		"B       loc_FF8B6CF4\n"
+
+		"loc_FF8B6CE8:\n"
+		// jumptable FF8B6AF0 entry 12
+		"BL      sub_FF8B4FDC\n" // LOCATION: ExpDrv.c:2
+		"B       loc_FF8B6CF4\n"
+
+		"loc_FF8B6CF0:\n"
+		// jumptable FF8B6AF0 entries 13-16
+		"BL      sub_FF8B5174\n" // LOCATION: ExpDrv.c:128
+
+		"loc_FF8B6CF4:\n"
+		// jumptable FF8B6AF0 default entry
+		// jumptable FF8B6AF0 entries 17-21,33,34
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"LDR     R1, [R0,#0x7C]\n"
+		"LDR     R3, [R0,#0x88]\n"
+		"LDR     R2, [R0,#0x8C]\n"
+		"ADD     R0, R0, #4\n"
+		"BLX     R3\n"
+		"CMP     R4, #1\n"
+		"BNE     loc_FF8B6D5C\n"
+
+		"loc_FF8B6D14:\n"
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"MOV     R2, #0xC\n"
+		"LDR     R1, [R0,#0x7C]\n"
+		"ADD     R1, R1, R1,LSL#1\n"
+		"ADD     R0, R0, R1,LSL#2\n"
+		"SUB     R4, R0, #8\n"
+		"LDR     R0, =0x3E198\n"
+		"ADD     R1, SP, #0x38-0x28\n"
+		"BL      sub_FFAAD758\n"
+		"LDR     R0, =0x3E1A4\n"
+		"MOV     R2, #0xC\n"
+		"ADD     R1, SP, #0x38-0x28\n"
+		"BL      sub_FFAAD758\n"
+		"LDR     R0, =0x3E1B0\n"
+		"MOV     R2, #0xC\n"
+		"MOV     R1, R4\n"
+		"BL      sub_FFAAD758\n"
+		"B       loc_FF8B6DD4\n"
+
+		"loc_FF8B6D5C:\n"
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"LDR     R0, [R0]\n"
+		"CMP     R0, #0xB\n"
+		"BNE     loc_FF8B6DA4\n"
+		"MOV     R3, #0\n"
+		"STR     R3, [SP,#0x38-0x38]\n"
+		"MOV     R3, #1\n"
+		"MOV     R2, #1\n"
+		"MOV     R1, #1\n"
+		"MOV     R0, #0\n"
+		"BL      sub_FF8B3510\n"
+		"MOV     R3, #0\n"
+		"STR     R3, [SP,#0x38-0x38]\n"
+		"MOV     R3, #1\n"
+		"MOV     R2, #1\n"
+		"MOV     R1, #1\n"
+		"MOV     R0, #0\n"
+		"B       loc_FF8B6DD0\n"
+
+		"loc_FF8B6DA4:\n"
+		"MOV     R3, #1\n"
+		"MOV     R2, #1\n"
+		"MOV     R1, #1\n"
+		"MOV     R0, #1\n"
+		"STR     R3, [SP,#0x38-0x38]\n"
+		"BL      sub_FF8B3510\n"
+		"MOV     R3, #1\n"
+		"MOV     R2, #1\n"
+		"MOV     R1, #1\n"
+		"MOV     R0, #1\n"
+		"STR     R3, [SP,#0x38-0x38]\n"
+
+		"loc_FF8B6DD0:\n"
+		"BL      sub_FF8B3650\n"
+
+		"loc_FF8B6DD4:\n"
+		"LDR     R0, [SP,#0x38-0x1C]\n"
+		"BL      sub_FF8B7A54\n" // LOCATION: ExpDrv.c:268
+		"B       loc_FF8B6808\n"
+		);
+}
+
+void __attribute__((naked,noinline)) sub_FF8B4260_my()
+{
+	asm volatile (
+		"STMFD   SP!, {R4-R8,LR}\n"
+		"LDR     R7, =0x6E30\n"
+		"MOV     R4, R0\n"
+		"LDR     R0, [R7,#0x1C]\n"
+		"MOV     R1, #0x3E\n"
+		"BL      sub_FF827B3C\n"
+		"LDRSH   R0, [R4,#4]\n"
+		"MOV     R2, #0\n"
+		"MOV     R1, #0\n"
+		"BL      sub_FF8B32A4\n"
+		"MOV     R6, R0\n"
+		"LDRSH   R0, [R4,#6]\n"
+		"BL      sub_FF8B33B0\n"
+		"LDRSH   R0, [R4,#8]\n"
+		"BL      sub_FF8B3408\n"
+		"LDRSH   R0, [R4,#0xA]\n"
+		"BL      sub_FF8B3460\n"
+		"LDRSH   R0, [R4,#0xC]\n"
+		"BL      sub_FF8B34B8\n"
+		"MOV     R5, R0\n"
+		"LDR     R0, [R4]\n"
+		"LDR     R8, =0x3E1B0\n"
+		"CMP     R0, #0xB\n"
+		"MOVEQ   R6, #0\n"
+		"MOVEQ   R5, #0\n"
+		"BEQ     loc_FF8B42F0\n"
+		"CMP     R6, #1\n"
+		"BNE     loc_FF8B42F0\n"
+		"LDRSH   R0, [R4,#4]\n"
+		"LDR     R1, =0xFF8B3210\n"
+		"MOV     R2, #2\n"
+		"BL      sub_FF92F91C\n" // LOCATION: IrisController.c:117
+		"STRH    R0, [R4,#4]\n"
+		"MOV     R0, #0\n"
+		"STR     R0, [R7,#0x28]\n"
+		"B       loc_FF8B42F8\n"
+
+		"loc_FF8B42F0:\n"
+		"LDRH    R0, [R8]\n"
+		"STRH    R0, [R4,#4]\n"
+
+		"loc_FF8B42F8:\n"
+		"CMP     R5, #1\n"
+		"LDRNEH  R0, [R8,#8]\n"
+		"BNE     loc_FF8B4314\n"
+		"LDRSH   R0, [R4,#0xC]\n"
+		"MOV     R2, #0x20\n"
+		"LDR     R1, =0xFF8B3294\n"
+		"BL      sub_FF8B7A84\n"
+
+		"loc_FF8B4314:\n"
+		"STRH    R0, [R4,#0xC]\n"
+		"LDRSH   R0, [R4,#6]\n"
+		//"BL      sub_FF8958EC\n" // LOCATION: Shutter.c:0
+		"BL      sub_FF8958EC_my\n" //------------>
+		"LDRSH   R0, [R4,#8]\n"
+		"MOV     R1, #1\n"
+		"BL      sub_FF8960E8\n" // LOCATION: ImgGain.c:0
+		"MOV     R1, #0\n"
+		"ADD     R0, R4, #8\n"
+		"BL      sub_FF896170\n" // LOCATION: ImgGain.c:0
+		"LDRSH   R0, [R4,#0xE]\n"
+		"BL      sub_FF8AA1E0\n" // LOCATION: BrtCrct.c:552
+		"LDR     R4, =0xBB8\n"
+		"CMP     R6, #1\n"
+		"BNE     loc_FF8B436C\n"
+		"LDR     R0, [R7,#0x1C]\n"
+		"MOV     R2, R4\n"
+		"MOV     R1, #2\n"
+		"BL      sub_FF827A40\n" // LOCATION: KerFlag.c:0
+		"TST     R0, #1\n"
+		"LDRNE   R1, =0x532\n"
+		"LDRNE   R0, =0xFF8B3920\n" // "ExpDrv.c"
+		"BLNE    _DebugAssert\n"
+
+		"loc_FF8B436C:\n"
+		"CMP     R5, #1\n"
+		"LDMNEFD SP!, {R4-R8,PC}\n"
+		"LDR     R0, [R7,#0x1C]\n"
+		"MOV     R2, R4\n"
+		"MOV     R1, #0x20\n"
+		"BL      sub_FF827A40\n" // LOCATION: KerFlag.c:0
+		"TST     R0, #1\n"
+		"LDRNE   R1, =0x537\n"
+		"LDRNE   R0, =0xFF8B3920\n" // "ExpDrv.c"
+		"LDMNEFD SP!, {R4-R8,LR}\n"
+		"BNE     _DebugAssert\n"
+		"LDMFD   SP!, {R4-R8,PC}\n"
+		);
+}
+
+void __attribute__((naked,noinline)) sub_FF8958EC_my()
+{
+	asm volatile (
+		"STMFD   SP!, {R4-R6,LR}\n"
+		"LDR     R5, =0x68EC\n"
+		"MOV     R4, R0\n"
+		"LDR     R0, [R5,#4]\n"
+		"CMP     R0, #1\n"
+		"LDRNE   R1, =0x16D\n"
+		"LDRNE   R0, =0xFF895684\n" // "Shutter.c"
+		"BLNE    _DebugAssert\n"
+		"CMN     R4, #0xC00\n"
+		"LDREQSH R4, [R5,#2]\n"
+		"CMN     R4, #0xC00\n"
+		"LDREQ   R1, =0x173\n"
+		"LDREQ   R0, =0xFF895684\n" // "Shutter.c"
+		"STRH    R4, [R5,#2]\n"
+		"BLEQ    _DebugAssert\n"
+		"MOV     R0, R4\n"
+		//"BL      sub_FF9B2794\n"
+		"BL      apex2us\n" // +
+		"MOV     R4, R0\n"
+		"BL      sub_FF8C5350\n" // nullsub_67
+		"MOV     R0, R4\n"
+		"BL      sub_FF8C9840\n"
+		"TST     R0, #1\n"
+		"LDMNEFD SP!, {R4-R6,LR}\n"
+		"MOVNE   R1, #0x178\n"
+		"LDRNE   R0, =0xFF895684\n" // "Shutter.c"
+		"BNE     _DebugAssert\n"
+		"LDMFD   SP!, {R4-R6,PC}\n"
+		);
+}
Index: /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100f/stubs_entry.S
===================================================================
--- /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100f/stubs_entry.S	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100f/stubs_entry.S	(revision 1668)
@@ -0,0 +1,230 @@
+// !!! THIS FILE IS GENERATED. DO NOT EDIT. !!!
+#include "stubs_asm.h"
+
+// Camera info:
+//   DRYOS R23 (DRYOS version 2.3, release #0023)
+//   Firmware Ver GM1.00F
+//   Canon PowerShot SD890 IS
+
+// Values for makefile.inc
+//   PLATFORMID = 12659 (0x3173) // Found @ 0xfffe0130
+//   MAXRAMADDR = 0x03ffffff
+//   KEYSYS = d3enc              // Found @ 0xffff33e0
+//   NEED_ENCODED_DISKBOOT = 1   // Found @ 0xffff33c0
+
+// Stubs below should be checked. Stub not matched 100%, or difference found to current 'stubs_entry_2.S'
+//    Name                                     Address      Rule  %  Comp to stubs_entry_2.S
+//NSTUB(PutInNdFilter                         ,0xffa2ab90) //102        *** != 0xffa83868
+//NSTUB(PutOutNdFilter                        ,0xffa2abb4) //102        *** != 0xffa8389c
+
+// Check of modemap from 'platform/CAMERA/shooting.c':
+// Firmware modemap table found @ff87907c -> ff875820 -> ff95c828 -> ffa3ee38 -> ffaf9518
+// No problems found with modemap table.
+
+// Values below can be overridden in 'stubs_min.S':
+DEF(physw_status                            ,0x00010650) // Found @0xff821e38
+DEF(physw_run                               ,0x00001c00) // Found @0xff821ad0
+DEF(levent_table                            ,0xffad4084) // Found @0xffad4084
+DEF(FlashParamsTable                        ,0xffaf96d8) // Found @0xffaf96d8
+DEF(movie_status                            ,0x000053cc) // Found @0xff859cfc
+DEF(canon_menu_active                       ,0x000099e0) // Found @0xff950108
+DEF(canon_shoot_menu_active                 ,0x00009fd9) // Found @0xff96cce0
+DEF(playrec_mode                            ,0x0000555c) // Found @0xff8610f4
+DEF(zoom_status                             ,0x0000d4a4) // Found @0xffa40638
+DEF(some_flag_for_af_scan                   ,0x0000d228) // Found @0xffa2b508
+// focus_len_table contains zoom focus lengths for use in 'get_focal_length' (main.c).
+// each entry contains 3 int value(s), the first is the zoom focus length.
+// there are 12 entries in the table - set NUM_FL to 12
+DEF(focus_len_table                         ,0xfffe297c) // Found @0xfffe297c
+DEF(zoom_busy                               ,0x00008aa0) // Found @0xff932a0c
+DEF(focus_busy                              ,0x0000898c) // Found @0xff92e0b8
+//DEF(recreview_hold                          ,0x00006188) // Found @0xff87eb14, ** != ** stubs_min = 0x00009d98 (0x9CEC+0xAC)
+
+// Values below go in 'lib.c':
+//void *vid_get_bitmap_fb()        { return (void*)0x10361000; }             // Found @0xff83e89c
+//void *vid_get_viewport_fb()      { return (void*)0x1065adc0; }             // Found @0xffa88a6c
+//void *vid_get_viewport_fb_d()    { return (void*)(*(int*)(0x51fc+0x50)); } // Found @0xff853074 & 0xff8530ac
+//char *camera_jpeg_count_str()    { return (char*)0x0004ca80; }             // Found @0xff9a6f4c
+//long hook_raw_size()             { return 0x00ec04f0; }                    // Found @0xffa8acf0
+//int get_flash_params_count(void) { return 0x73; }                          // Found @0xff95d8e4
+
+// Bitmap masks and physw_status index values for SD_READONLY and USB power flags (for kbd.c).
+//#define SD_READONLY_FLAG    0x00020000 // Found @0xffab16e8, levent 0x90a
+//#define SD_READONLY_IDX     2
+//#define USB_MASK            0x00040000 // Found @0xffab16f4, levent 0x902
+//#define USB_IDX             2
+
+// Keymap values for kbd.c. Additional keys may be present, only common values included here.
+//static KeyMap keymap[] = {
+//    { 2, KEY_ZOOM_IN         ,0x00000004 }, // Found @0xffab1658, levent 0x02
+//    { 2, KEY_ZOOM_OUT        ,0x00000008 }, // Found @0xffab1664, levent 0x03
+//    { 2, KEY_LEFT            ,0x00000010 }, // Found @0xffab1670, levent 0x06
+//    { 2, KEY_RIGHT           ,0x00000020 }, // Found @0xffab167c, levent 0x07
+//    { 2, KEY_DOWN            ,0x00000040 }, // Found @0xffab1688, levent 0x05
+//    { 2, KEY_UP              ,0x00000080 }, // Found @0xffab1694, levent 0x04
+//    { 2, KEY_SET             ,0x00000100 }, // Found @0xffab16a0, levent 0x08
+//    { 2, KEY_DISPLAY         ,0x00000200 }, // Found @0xffab16ac, levent 0x0a
+//    { 2, KEY_SHOOT_FULL      ,0x00000003 }, // Found @0xffab164c, levent 0x01
+//    { 2, KEY_SHOOT_FULL_ONLY ,0x00000002 }, // Found @0xffab164c, levent 0x01
+//    { 2, KEY_MENU            ,0x00000400 }, // Found @0xffab16b8, levent 0x09
+//    { 2, KEY_SHOOT_HALF      ,0x00000001 }, // Found @0xffab1640, levent 0x00
+//    { 0, 0, 0 }
+//};
+
+// Values below go in 'platform_camera.h':
+//#define CAM_DRYOS         1
+//#define CAM_RAW_ROWPIX    3720 // Found @0xffa8248c
+//#define CAM_RAW_ROWS      2772 // Found @0xffa82494
+//#undef  CAM_UNCACHED_BIT
+//#define CAM_UNCACHED_BIT  0x10000000 // Found @0xff8285a4
+
+// Misc stuff
+DEF(ctypes, 0xffab11b6)
+
+// For capt_seq.c
+//static long *nrflag = (long*)(0x91a4);       // Found @ ff93db0c
+
+// Stubs below matched 100%.
+//    Name                                     Address                Comp to stubs_entry_2.S
+NSTUB(AllocateMemory                          ,0xffa2e3a0) //101
+NSTUB(AllocateUncacheableMemory               ,0xff828568) //112
+NSTUB(Close                                   ,0xff823d90) //101
+NSTUB(CreateTask                              ,0xff81b818) //101
+NSTUB(DebugAssert                             ,0xff81bcf0) //111
+NSTUB(DeleteDirectory_Fut                     ,0xff823720) //  1
+NSTUB(DeleteFile_Fut                          ,0xff82363c) //112
+NSTUB(DoAFLock                                ,0xff825b84) //102
+NSTUB(EnterToCompensationEVF                  ,0xff825e80) //104
+NSTUB(ExecuteEventProcedure                   ,0xff86938c) //  1
+NSTUB(ExitFromCompensationEVF                 ,0xff825ed0) //104
+NSTUB(ExitTask                                ,0xff81baa8) //101
+NSTUB(ExpCtrlTool_StartContiAE                ,0xff832b00) //104
+NSTUB(ExpCtrlTool_StopContiAE                 ,0xff832c44) //104
+NSTUB(Fclose_Fut                              ,0xff8237b8) //101
+NSTUB(Feof_Fut                                ,0xff8239a4) //  1
+NSTUB(Fflush_Fut                              ,0xff8239e0) //  1
+NSTUB(Fgets_Fut                               ,0xff82390c) //  1
+NSTUB(Fopen_Fut                               ,0xff823778) //101
+NSTUB(Fread_Fut                               ,0xff823864) //101
+NSTUB(FreeMemory                              ,0xffa2e398) //101
+NSTUB(FreeUncacheableMemory                   ,0xff82859c) //112
+NSTUB(Fseek_Fut                               ,0xff823958) //101
+NSTUB(Fwrite_Fut                              ,0xff8238b8) //101
+NSTUB(GetBatteryTemperature                   ,0xff84539c) //102
+NSTUB(GetCCDTemperature                       ,0xff84532c) //102
+NSTUB(GetCurrentAvValue                       ,0xff92facc) //102
+NSTUB(GetDrive_ClusterSize                    ,0xff84f2bc) //  1
+NSTUB(GetDrive_FreeClusters                   ,0xff84f324) //  1
+NSTUB(GetDrive_TotalClusters                  ,0xff84f2f0) //  1
+NSTUB(GetFocusLensSubjectDistance             ,0xff92ebc4) //102
+NSTUB(GetFocusLensSubjectDistanceFromLens     ,0xff92eed0) //  1
+NSTUB(GetKbdState                             ,0xff8428e4) //109
+NSTUB(GetMemInfo                              ,0xff813c40) //  1
+NSTUB(GetOpticalTemperature                   ,0xff84540c) //102
+NSTUB(GetParameterData                        ,0xff95d8a4) //101
+NSTUB(GetPropertyCase                         ,0xff86cf8c) //102
+NSTUB(GetSystemTime                           ,0xffa2e3f8) //101
+NSTUB(GetZoomLensCurrentPoint                 ,0xff932d74) //102
+NSTUB(GetZoomLensCurrentPosition              ,0xffa24448) //102
+NSTUB(GiveSemaphore                           ,0xff81b77c) //112
+NSTUB(IsStrobeChargeCompleted                 ,0xff8bd988) //102
+NSTUB(LEDDrive                                ,0xff842068) //103
+NSTUB(LocalTime                               ,0xff866a50) //  1
+NSTUB(LockMainPower                           ,0xff875438) //103
+NSTUB(Lseek                                   ,0xff823ed0) //101
+NSTUB(MakeDirectory_Fut                       ,0xff8236b0) //  1
+NSTUB(MoveFocusLensToDistance                 ,0xffa855a8) //102
+NSTUB(MoveIrisWithAv                          ,0xffa2a7a8) //102
+NSTUB(MoveZoomLensWithPoint                   ,0xffa2ad2c) //102
+NSTUB(NewTaskShell                            ,0xff86ca50) //103
+NSTUB(Open                                    ,0xff823d68) //101
+NSTUB(PB2Rec                                  ,0xff878454) //104
+NSTUB(PT_MoveDigitalZoomToWide                ,0xff85bb68) //102
+NSTUB(PT_MoveOpticalZoomAt                    ,0xff85bb40) //102
+NSTUB(PT_PlaySound                            ,0xff85b1c4) //102
+NSTUB(PostLogicalEventForNotPowerType         ,0xff8731f8) //103
+NSTUB(PostLogicalEventToUI                    ,0xff873244) //103
+NSTUB(Read                                    ,0xff81a094) //101
+NSTUB(ReadFastDir                             ,0xffa13470) //  1
+NSTUB(Rec2PB                                  ,0xff876e58) //104
+NSTUB(RefreshPhysicalScreen                   ,0xff9b1258) //104
+NSTUB(Remove                                  ,0xff823dd8) //  1
+NSTUB(RenameFile_Fut                          ,0xff8235e8) //  1
+NSTUB(Restart                                 ,0xff829de0) //106
+NSTUB(SetAE_ShutterSpeed                      ,0xffa87c7c) //102
+NSTUB(SetAutoShutdownTime                     ,0xff8754ac) //103
+NSTUB(SetCurrentCaptureModeType               ,0xff87c2b8) //101
+NSTUB(SetFileAttributes                       ,0xff8240bc) //  1
+NSTUB(SetFileTimeStamp                        ,0xff82406c) //  1
+NSTUB(SetLogicalEventActive                   ,0xff875118) //  1
+NSTUB(SetParameterData                        ,0xff95d814) //101
+NSTUB(SetPropertyCase                         ,0xff86ce8c) //102
+NSTUB(SetScriptMode                           ,0xff875168) //101
+NSTUB(SleepTask                               ,0xff8283ec) //101
+NSTUB(TakeSemaphore                           ,0xff81b6ac) //101
+NSTUB(TurnOffBackLight                        ,0xff881cac) //104
+NSTUB(TurnOnBackLight                         ,0xff881c94) //104
+NSTUB(UIFS_WriteFirmInfoToFile                ,0xff951064) //103
+NSTUB(UnlockAF                                ,0xff825bc8) //102
+NSTUB(UnlockMainPower                         ,0xff87538c) //103
+NSTUB(UnsetZoomForMovie                       ,0xff962e40) //104
+NSTUB(UpdateMBROnFlash                        ,0xff84f0fc) //105
+NSTUB(VbattGet                                ,0xff82071c) //103
+NSTUB(Write                                   ,0xff823e3c) //101
+NSTUB(WriteSDCard                             ,0xff922764) //108
+NSTUB(_log                                    ,0xffaaec70) //111
+NSTUB(_log10                                  ,0xffaadbb4) //112
+NSTUB(_pow                                    ,0xffaadd24) //114
+NSTUB(_sqrt                                   ,0xffab0090) //  1
+NSTUB(add_ptp_handler                         ,0xff9e1a94) //  1
+NSTUB(apex2us                                 ,0xff9b2794) //  4
+NSTUB(close                                   ,0xff819eac) //  1
+NSTUB(closedir                                ,0xffa13540) //  1
+NSTUB(err_init_task                           ,0xff814e98) //  4
+NSTUB(exmem_alloc                             ,0xff867b74) //103
+NSTUB(free                                    ,0xff813a98) //112
+NSTUB(kbd_p1_f                                ,0xff821f3c) //109
+NSTUB(kbd_p1_f_cont                           ,0xff821f48) //109
+NSTUB(kbd_p2_f                                ,0xff821770) //109
+NSTUB(kbd_pwr_off                             ,0xff842968) //  2
+NSTUB(kbd_pwr_on                              ,0xff842918) //  2
+NSTUB(kbd_read_keys                           ,0xff821e38) //109
+NSTUB(kbd_read_keys_r2                        ,0xff842490) //109
+NSTUB(lseek                                   ,0xff823ed0) //101
+NSTUB(malloc                                  ,0xff8139c4) //112
+NSTUB(memcmp                                  ,0xff81d844) //101
+NSTUB(memcpy                                  ,0xff894328) //101
+NSTUB(memset                                  ,0xff9b160c) //101
+NSTUB(mkdir                                   ,0xff824134) //  1
+// ALT: NSTUB(mkdir, 0xff8241d4) // 1 32/0
+NSTUB(mktime_ext                              ,0xff894b94) //  1
+NSTUB(open                                    ,0xff819dfc) //  1
+NSTUB(opendir                                 ,0xffa133dc) //  1
+NSTUB(openfastdir                             ,0xffa133dc) //  1
+NSTUB(qsort                                   ,0xff9b1b14) //  1
+NSTUB(rand                                    ,0xff81d94c) //  1
+NSTUB(read                                    ,0xff81a094) //101
+NSTUB(reboot_fw_update                        ,0xffa1ae70) //  5
+NSTUB(rename                                  ,0xff8235e8) //  1
+NSTUB(set_control_event                       ,0xff874d94) //  1
+NSTUB(srand                                   ,0xff81d940) //  1
+NSTUB(stat                                    ,0xff823f9c) //  1
+NSTUB(strcat                                  ,0xff894114) //  1
+NSTUB(strchr                                  ,0xff89419c) //  1
+NSTUB(strcmp                                  ,0xff81d7dc) //101
+NSTUB(strcpy                                  ,0xff81d7c4) //101
+NSTUB(strftime                                ,0xff89459c) //  1
+NSTUB(strlen                                  ,0xff81d820) //101
+NSTUB(strncmp                                 ,0xff894150) //  1
+NSTUB(strncpy                                 ,0xff82e1fc) //  1
+NSTUB(strrchr                                 ,0xff8941c0) //  1
+NSTUB(strtol                                  ,0xff82e434) //101
+NSTUB(strtolx                                 ,0xff82e238) //109
+  DEF(task_CaptSeq                            ,0xff85dfc0) //107
+  DEF(task_ExpDrv                             ,0xff8b67e8) //110
+  DEF(task_InitFileModules                    ,0xff878f08) //107
+  DEF(task_MovieRecord                        ,0xff859f88) //107
+  DEF(task_PhySw                              ,0xff821acc) //107
+NSTUB(time                                    ,0xff866f54) //  2
+NSTUB(vsprintf                                ,0xff81d744) //  1
+NSTUB(write                                   ,0xff823e3c) //101
Index: /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100f/stubs_entry_2.S
===================================================================
--- /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100f/stubs_entry_2.S	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100f/stubs_entry_2.S	(revision 1668)
@@ -0,0 +1,32 @@
+#include "stubs_asm.h"
+#define NULL_SUB 0xFF810948
+
+// Override stubs_entry.S
+NHSTUB(PutInNdFilter,               0xFFA83868)
+NHSTUB(PutOutNdFilter,              0xFFA8389C)
+
+// These don't exist/aren't found in dryos
+NHSTUB(SetZoomActuatorSpeedPercent, NULL_SUB)
+
+// Additional
+NHSTUB(CreateController,            0xFF872A3C)
+NHSTUB(GetAEIntegralServiceMode_0,  0xFF82ADA0)
+NHSTUB(GetVRAMHPixelsSize_0,        0xFF85CED4)
+NHSTUB(GetVRAMHPixelsSize_1,        0xFF87ABE0)
+NHSTUB(IsControlEventActive,        0xFF8750A8)
+NHSTUB(IsFactoryMode,               0xFF846308)
+NHSTUB(KernelCreateTask,            0xFF81BAF0)
+NHSTUB(PT_GetPropertyCaseString,    0xFF86CE8C)
+NHSTUB(PT_SetPropertyCaseString,    0xFF86CF8C)
+NHSTUB(PTM_GetCurrentItem,          0xFF875D6C)
+NHSTUB(PTM_SetCurrentCaptureMode,   0xFF875C44)
+NHSTUB(RestartDevice,               0xFF829DE0)
+NHSTUB(StartDiskboot,               0xFF829FA4)
+NHSTUB(StartFactoryModeController,  0xFF846378)
+NHSTUB(StartGUISystem,              0xFF893FC8)
+NHSTUB(j_PTM_SetCurrentItem,        0xFF95CE64)
+NHSTUB(taskcreate_CommonDrivers,    0xFF878F94)
+NHSTUB(taskcreate_DSITask,          0xFF880A9C)
+NHSTUB(taskcreate_FaceFrame,        0xFF880840)
+NHSTUB(taskcreate_StartupImage,     0xFF82A4E8)
+NHSTUB(taskcreate_TempCheck,        0xFF820EAC)
Index: /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100f/boot.c
===================================================================
--- /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100f/boot.c	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100f/boot.c	(revision 1668)
@@ -0,0 +1,646 @@
+#include "lolevel.h"
+#include "platform.h"
+#include "core.h"
+
+const char * const new_sa = &_end;
+
+void __attribute__((naked,noinline)) jogdial_task_my();
+
+void taskCreateHook(int *p)
+{
+	p-=16;
+	if (p[0]==0xFF821ACC)  p[0]=(int)mykbd_task;
+	if (p[0]==0xFF842A40)  p[0]=(int)jogdial_task_my; 
+	if (p[0]==0xFF859F88)  p[0]=(int)movie_record_task;
+	if (p[0]==0xFF85DFC0)  p[0]=(int)capt_seq_task;
+	if (p[0]==0xFF878F08)  p[0]=(int)init_file_modules_task;
+	if (p[0]==0xFF8B67E8)  p[0]=(int)exp_drv_task;
+}
+
+void CreateTask_spytask()
+{
+	_CreateTask("SpyTask", 0x19, 0x2000, core_spytask, 0);
+}
+
+void boot()
+{
+	long *canon_data_src = (void*)0xFFB1E468;
+	long *canon_data_dst = (void*)0x1900;
+	long canon_data_len = 0xF164 - 0x1900; // data_end - data_start
+	long *canon_bss_start = (void*)0xF164; // just after data
+	long canon_bss_len = 0xCBD40 - 0xF164;
+
+	long i;
+
+	// enable caches and write buffer
+	asm volatile (
+		"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;
+
+	// Captain Hook
+	*(int*)0x1930 = (int)taskCreateHook;
+
+	// jump to init-sequence that follows the data-copy-routine
+	asm volatile ("B  sub_FF8101A4_my\n");
+}
+
+void __attribute__((naked,noinline)) sub_FF8101A4_my()
+{
+	asm volatile (
+		"LDR     R0, =0xFF81021C\n" // exception handler code
+		"MOV     R1, #0\n"
+		"LDR     R3, =0xFF810254\n"
+
+		"loc_FF8101B0:\n"
+		"CMP     R0, R3\n" // load exception vector
+		"LDRCC   R2, [R0],#4\n"
+		"STRCC   R2, [R1],#4\n"
+		"BCC     loc_FF8101B0\n"
+		"LDR     R0, =0xFF810254\n"
+		"MOV     R1, #0x4B0\n"
+		"LDR     R3, =0xFF810468\n"
+
+		"loc_FF8101CC:\n"
+		"CMP     R0, R3\n" // copy IRQ handler to ITCM starting at 0x4b0, 532 bytes up to 0x6C4
+		"LDRCC   R2, [R0],#4\n"
+		"STRCC   R2, [R1],#4\n"
+		"BCC     loc_FF8101CC\n"
+		"MOV     R0, #0xD2\n"
+		"MSR     CPSR_cxsf, R0\n" // set CPSR mode = IRQ, ints disabled
+		"MOV     SP, #0x1000\n" // irq mode SP
+		"MOV     R0, #0xD3\n"
+		"MSR     CPSR_cxsf, R0\n" // set CPSR mode = Super, ints disabled
+		"MOV     SP, #0x1000\n" // super mode SP
+		//"LDR     R0, loc_FF810210\n"
+		"LDR     R0, =0x6C4\n" // +
+		"LDR     R2, =0xEEEEEEEE\n"
+		"MOV     R3, #0x1000\n"
+
+		"loc_FF810200:\n"
+		"CMP     R0, R3\n" // clear ITCM 0x6C4-end with EEEEEEEE
+		"STRCC   R2, [R0],#4\n"
+		"BCC     loc_FF810200\n"
+		"BL      sub_FF810FA0_my\n" //------------->
+		);
+}
+
+void __attribute__((naked,noinline)) sub_FF810FA0_my()
+{
+	asm volatile (
+		"STR     LR, [SP,#-4]!\n"
+		"SUB     SP, SP, #0x74\n"
+		"MOV     R0, SP\n"
+		"MOV     R1, #0x74\n"
+		"BL      sub_FFAAD9B4\n"
+		"MOV     R0, #0x53000\n"
+		"STR     R0, [SP,#0x74-0x70]\n"
+		//"LDR     R0, =0xCBD40\n"
+		"LDR     R0, =new_sa\n" // +
+		"LDR     R0, [R0]\n" // +
+		"LDR     R2, =0x279C00\n"
+		"LDR     R1, =0x272968\n"
+		"STR     R0, [SP,#0x74-0x6C]\n"
+		"SUB     R0, R1, R0\n"
+		"ADD     R3, SP, #0x74-0x68\n"
+		"STR     R2, [SP,#0x74-0x74]\n"
+		"STMIA   R3, {R0-R2}\n"
+		"MOV     R0, #0x22\n"
+		"STR     R0, [SP,#0x74-0x5C]\n"
+		"MOV     R0, #0x68\n"
+		"STR     R0, [SP,#0x74-0x58]\n"
+		"LDR     R0, =0x19B\n"
+		"MOV     R1, #0x64\n"
+		"STRD    R0, [SP,#0x74-0x54]\n"
+		"MOV     R0, #0x78\n"
+		"STRD    R0, [SP,#0x74-0x4C]\n"
+		"MOV     R0, #0\n"
+		"STR     R0, [SP,#0x74-0x44]\n"
+		"STR     R0, [SP,#0x74-0x40]\n"
+		"MOV     R0, #0x10\n"
+		"STR     R0, [SP,#0x74-0x18]\n"
+		"MOV     R0, #0x800\n"
+		"STR     R0, [SP,#0x74-0x14]\n"
+		"MOV     R0, #0xA0\n"
+		"STR     R0, [SP,#0x74-0x10]\n"
+		"MOV     R0, #0x280\n"
+		"STR     R0, [SP,#0x74-0xC]\n"
+		//"LDR     R1, =0xFF814DA4\n"
+		"LDR     R1, =uHwSetup_my\n" //------------->
+		"MOV     R0, SP\n"
+		"MOV     R2, #0\n"
+		"BL      sub_FF812D58\n"
+		"ADD     SP, SP, #0x74\n"
+		"LDR     PC, [SP],#4\n"
+		);
+}
+
+// Extracted method: uHwSetup (FF814DA4)
+void __attribute__((naked,noinline)) uHwSetup_my()
+{
+	asm volatile (
+		"STMFD   SP!, {R4,LR}\n"
+		"BL      sub_FF81094C\n"
+		"BL      sub_FF819664\n"
+		"CMP     R0, #0\n"
+		"LDRLT   R0, =0xFF814EB8\n" // "dmSetup"
+		"BLLT    sub_FF814E98\n"
+		"BL      sub_FF8149C8\n"
+		"CMP     R0, #0\n"
+		"LDRLT   R0, =0xFF814EC0\n" // "termDriverInit"
+		"BLLT    sub_FF814E98\n"
+		"LDR     R0, =0xFF814ED0\n" // "/_term"
+		"BL      sub_FF814AB4\n"
+		"CMP     R0, #0\n"
+		"LDRLT   R0, =0xFF814ED8\n" // "termDeviceCreate"
+		"BLLT    sub_FF814E98\n"
+		"LDR     R0, =0xFF814ED0\n" // "/_term"
+		"BL      sub_FF813564\n"
+		"CMP     R0, #0\n"
+		"LDRLT   R0, =0xFF814EEC\n" // "stdioSetup"
+		"BLLT    sub_FF814E98\n"
+		"BL      sub_FF8191EC\n"
+		"CMP     R0, #0\n"
+		"LDRLT   R0, =0xFF814EF8\n" // "stdlibSetup"
+		"BLLT    sub_FF814E98\n"
+		"BL      sub_FF8114B8\n"
+		"CMP     R0, #0\n"
+		"LDRLT   R0, =0xFF814F04\n" // "armlib_setup"
+		"BLLT    sub_FF814E98\n"
+		"LDMFD   SP!, {R4,LR}\n"
+		"B       taskcreate_Startup_my\n" //------------->
+		);
+}
+
+// Extracted method: taskcreate_Startup (FF81CCBC)
+void __attribute__((naked,noinline)) taskcreate_Startup_my()
+{
+	asm volatile (
+		"STMFD   SP!, {R3,LR}\n"
+		"BL      sub_FF821BF0\n" // j_nullsub_214
+		"BL      sub_FF829EDC\n"
+		"CMP     R0, #0\n"
+		"BNE     loc_FF81CCEC\n"
+		"BL      sub_FF821BEC\n"
+		"CMP     R0, #0\n"
+		"BNE     loc_FF81CCEC\n"
+		"LDR     R1, =0xC0220000\n"
+		"MOV     R0, #0x44\n"
+		"STR     R0, [R4,#0x4C]\n"
+
+		"loc_FF81CCE8:\n"
+		"B       loc_FF81CCE8\n"
+
+		"loc_FF81CCEC:\n"
+		"BL      sub_FF821BF8\n"
+		"BL      sub_FF821BF4\n"
+		"BL      sub_FF828264\n"
+		"LDR     R1, =0x2CE000\n"
+		"MOV     R0, #0\n"
+		"BL      sub_FF8284AC\n"
+		"BL      sub_FF828458\n" // LOCATION: KerSys.c:548
+		"MOV     R3, #0\n"
+		"STR     R3, [SP,#0x8-0x8]\n"
+		//"ADR     R3, 0xFF81CC60\n" // task_Startup
+		"LDR     R3, =task_Startup_my\n" //------------->
+		"MOV     R2, #0\n"
+		"MOV     R1, #0x19\n"
+		"LDR     R0, =0xFF81CD34\n" // "Startup"
+		"BL      sub_FF81B818\n" // eventproc_export_CreateTask
+		"MOV     R0, #0\n"
+		"LDMFD   SP!, {R12,PC}\n"
+		);
+}
+
+// Extracted method: task_Startup (FF81CC60)
+void __attribute__((naked,noinline)) task_Startup_my()
+{
+	asm volatile (
+		"STMFD   SP!, {R4,LR}\n"
+		"BL      sub_FF81516C\n" // taskcreate_ClockSave
+		"BL      sub_FF822D50\n"
+		"BL      sub_FF81FDF0\n"
+		"BL      sub_FF829F1C\n"
+		"BL      sub_FF82A0E4\n"
+		//"BL      sub_FF829FA4\n" // StartDiskBoot
+		"BL      CreateTask_spytask\n" // +
+		"BL      sub_FF82A298\n"
+		"BL      sub_FF82A134\n"
+		"BL      sub_FF8277A4\n"
+		"BL      sub_FF82A29C\n"
+		"BL      sub_FF821B00\n" // taskcreate_PhySw
+		"BL      sub_FF824CB8\n" // task_ShootSeqTask
+		"BL      sub_FF82A2B4\n"
+		"BL      sub_FF81FB10\n" // nullsub_2
+		"BL      sub_FF820FBC\n"
+		"BL      sub_FF829CA4\n" // taskcreate_Bye
+		"BL      sub_FF821630\n"
+		"BL      sub_FF820EAC\n" // taskcreate_TempCheck
+		"BL      sub_FF82AD58\n"
+		"BL      sub_FF820E68\n"
+		"LDMFD   SP!, {R4,PC}\n"
+		"BL      sub_FF815070\n" // LOCATION: ClkEnabler.c:144
+		);
+}
+
+//Extracted method: task_InitFileModules (FF878F08)
+void __attribute__((naked,noinline)) init_file_modules_task()
+{
+	asm volatile (
+		"STMFD   SP!, {R4-R6,LR}\n"
+		"BL      sub_FF86D818\n"
+		"LDR     R5, =0x5006\n"
+		"MOVS    R4, R0\n"
+		"MOVNE   R1, #0\n"
+		"MOVNE   R0, R5\n"
+		"BLNE    sub_FF873244\n" // PostLogicalEventToUI
+		//"BL      sub_FF86D844\n"
+		"BL      sub_FF86D844_my\n" //------------->
+		"BL      core_spytask_can_start\n" // + safe to start spytask
+		"CMP     R4, #0\n"
+		"MOVEQ   R0, R5\n"
+		"LDMEQFD SP!, {R4-R6,LR}\n"
+		"MOVEQ   R1, #0\n"
+		"BEQ     sub_FF873244\n" // PostLogicalEventToUI
+		"LDMFD   SP!, {R4-R6,PC}\n"
+		);
+} 
+
+void __attribute__((naked,noinline)) sub_FF86D844_my()
+{
+	asm volatile (
+		"STMFD   SP!, {R4,LR}\n"
+		//"BL      sub_FF84EF30\n"
+		"BL      sub_FF84EF30_my\n" //------------->
+		"LDR     R4, =0x57D0\n"
+		"LDR     R0, [R4,#4]\n"
+		"CMP     R0, #0\n"
+		"BNE     loc_FF86D874\n"
+		"BL      sub_FF881A84\n"
+		"BL      sub_FF9052F8\n"
+		"BL      sub_FF881A84\n"
+		"BL      sub_FF84C920\n"
+		"BL      sub_FF881A94\n"
+		"BL      sub_FF9053C4\n"
+
+		"loc_FF86D874:\n"
+		"MOV     R0, #1\n"
+		"STR     R0, [R4]\n"
+		"LDMFD   SP!, {R4,PC}\n"
+		);
+} 
+
+void __attribute__((naked,noinline)) sub_FF84EF30_my()
+{
+	asm volatile (
+		"STMFD   SP!, {R4-R6,LR}\n"
+		"MOV     R6, #0\n"
+		"MOV     R0, R6\n"
+		"BL      sub_FF84E9F0\n"
+		"LDR     R4, =0x118C0\n"
+		"MOV     R5, #0\n"
+		"LDR     R0, [R4,#0x38]\n"
+		"BL      sub_FF84F424\n"
+		"CMP     R0, #0\n"
+		"LDREQ   R0, =0x29D4\n"
+		"STREQ   R5, [R0,#0x10]\n"
+		"STREQ   R5, [R0,#0x14]\n"
+		"STREQ   R5, [R0,#0x18]\n"
+		"MOV     R0, R6\n"
+		"BL      sub_FF84EA30\n" // LOCATION: Mounter.c:0
+		"MOV     R0, R6\n"
+		//"BL      sub_FF84ED6C"
+		"BL      sub_FF84ED6C_my\n" //------------->
+		"MOV     R5, R0\n"
+		"MOV     R0, R6\n"
+		"BL      sub_FF84EDD8\n" // LOCATION: Mounter.c:8
+		"LDR     R1, [R4,#0x3C]\n"
+		"AND     R2, R5, R0\n"
+		"CMP     R1, #0\n"
+		"MOV     R0, #0\n"
+		"MOVEQ   R0, #0x80000001\n"
+		"BEQ     loc_FF84EFC4\n"
+		"LDR     R3, [R4,#0x2C]\n"
+		"CMP     R3, #2\n"
+		"MOVEQ   R0, #4\n"
+		"CMP     R1, #5\n"
+		"ORRNE   R0, R0, #1\n"
+		"BICEQ   R0, R0, #1\n"
+		"CMP     R2, #0\n"
+		"BICEQ   R0, R0, #2\n"
+		"ORREQ   R0, R0, #0x80000000\n"
+		"BICNE   R0, R0, #0x80000000\n"
+		"ORRNE   R0, R0, #2\n"
+
+		"loc_FF84EFC4:\n"
+		"STR     R0, [R4,#0x40]\n"
+		"LDMFD   SP!, {R4-R6,PC}\n"
+		);
+}
+
+void __attribute__((naked,noinline)) sub_FF84ED6C_my()
+{
+	asm volatile (
+		"STMFD   SP!, {R4-R6,LR}\n"
+		"LDR     R5, =0x29D4\n"
+		"MOV     R6, R0\n"
+		"LDR     R0, [R5,#0x14]\n"
+		"CMP     R0, #0\n"
+		"MOVNE   R0, #1\n"
+		"LDMNEFD SP!, {R4-R6,PC}\n"
+		"MOV     R0, #0x17\n"
+		"MUL     R1, R0, R6\n"
+		"LDR     R0, =0x118C0\n"
+		"ADD     R4, R0, R1,LSL#2\n"
+		"LDR     R0, [R4,#0x38]\n"
+		"MOV     R1, R6\n"
+		//"BL      sub_FF84EAFC\n" // LOCATION: Mounter.c:884
+		"BL      sub_FF84EAFC_my\n" //------------->
+		"CMP     R0, #0\n"
+		"LDMEQFD SP!, {R4-R6,PC}\n"
+		"LDR     R0, [R4,#0x38]\n"
+		"MOV     R1, R6\n"
+		"BL      sub_FF84EC64\n" // LOCATION: Mounter.c:0
+		"CMP     R0, #0\n"
+		"LDMEQFD SP!, {R4-R6,PC}\n"
+		"MOV     R0, R6\n"
+		"BL      sub_FF84E5F8\n"
+		"CMP     R0, #0\n"
+		"MOVNE   R1, #1\n"
+		"STRNE   R1, [R5,#0x14]\n"
+		"LDMFD   SP!, {R4-R6,PC}\n"
+		);
+}
+
+void __attribute__((naked,noinline)) sub_FF84EAFC_my()
+{
+	asm volatile (
+		"STMFD   SP!, {R4-R8,LR}\n"
+		"MOV     R8, R0\n"
+		"MOV     R0, #0x17\n"
+		"MUL     R1, R0, R1\n"
+		"LDR     R0, =0x118C0\n"
+		"MOV     R6, #0\n"
+		"ADD     R7, R0, R1,LSL#2\n"
+		"LDR     R0, [R7,#0x3C]\n"
+		"MOV     R5, #0\n"
+		"CMP     R0, #6\n"
+		"ADDLS   PC, PC, R0,LSL#2\n"
+		"B       loc_FF84EC48\n"
+
+		"loc_FF84EB2C:\n"
+		"B       loc_FF84EB60\n"
+
+		"loc_FF84EB30:\n"
+		"B       loc_FF84EB48\n"
+
+		"loc_FF84EB34:\n"
+		"B       loc_FF84EB48\n"
+
+		"loc_FF84EB38:\n"
+		"B       loc_FF84EB48\n"
+
+		"loc_FF84EB3C:\n"
+		"B       loc_FF84EB48\n"
+
+		"loc_FF84EB40:\n"
+		"B       loc_FF84EC40\n"
+
+		"loc_FF84EB44:\n"
+		"B       loc_FF84EB48\n"
+
+		"loc_FF84EB48:\n"
+		// jumptable FF84EB24 entries 1-4,6
+		"MOV     R2, #0\n"
+		"MOV     R1, #0x200\n"
+		"MOV     R0, #3\n"
+		"BL      sub_FF8679C4\n"
+		"MOVS    R4, R0\n"
+		"BNE     loc_FF84EB68\n"
+
+		"loc_FF84EB60:\n"
+		// jumptable FF84EB24 entry 0
+		"MOV     R0, #0\n"
+		"LDMFD   SP!, {R4-R8,PC}\n"
+
+		"loc_FF84EB68:\n"
+		"LDR     R12, [R7,#0x4C]\n"
+		"MOV     R3, R4\n"
+		"MOV     R2, #1\n"
+		"MOV     R1, #0\n"
+		"MOV     R0, R8\n"
+		"BLX     R12\n"
+		"CMP     R0, #1\n"
+		"BNE     loc_FF84EB94\n"
+		"MOV     R0, #3\n"
+		"BL      sub_FF867B04\n" // LOCATION: ExMemMan.c:0
+		"B       loc_FF84EB60\n"
+
+		"loc_FF84EB94:\n"
+		"MOV     R0, R8\n"
+		"BL      sub_FF922B20\n"
+
+		"MOV   R1, R4\n"           //  pointer to MBR in R1
+		"BL    mbr_read_dryos\n"   //  total sectors count in R0 before and after call
+
+		// Start of DataGhost's FAT32 autodetection code
+		// Policy: If there is a partition which has type W95 FAT32, use the first one of those for image storage
+		// According to the code below, we can use R1, R2, R3 and R12.
+		// LR wasn't really used anywhere but for storing a part of the partition signature. This is the only thing
+		// that won't work with an offset, but since we can load from LR+offset into LR, we can use this to do that :)
+		"MOV     R12, R4\n"                    // Copy the MBR start address so we have something to work with
+		"MOV     LR, R4\n"                     // Save old offset for MBR signature
+		"MOV     R1, #1\n"                     // Note the current partition number
+		"B       dg_sd_fat32_enter\n"          // We actually need to check the first partition as well, no increments yet!
+
+		"dg_sd_fat32:\n"
+		"CMP     R1, #4\n"                     // Did we already see the 4th partition?
+		"BEQ     dg_sd_fat32_end\n"            // Yes, break. We didn't find anything, so don't change anything.
+		"ADD     R12, R12, #0x10\n"            // Second partition
+		"ADD     R1, R1, #1\n"                 // Second partition for the loop
+
+		"dg_sd_fat32_enter:\n"
+		"LDRB    R2, [R12, #0x1BE]\n"          // Partition status
+		"LDRB    R3, [R12, #0x1C2]\n"          // Partition type (FAT32 = 0xB)
+		"CMP     R3, #0xB\n"                   // Is this a FAT32 partition?
+		"CMPNE   R3, #0xC\n"                   // Not 0xB, is it 0xC (FAT32 LBA) then?
+		"BNE     dg_sd_fat32\n"                // No, it isn't. Loop again.
+		"CMP     R2, #0x00\n"                  // It is, check the validity of the partition type
+		"CMPNE   R2, #0x80\n"
+		"BNE     dg_sd_fat32\n"                // Invalid, go to next partition
+		// This partition is valid, it's the first one, bingo!
+		"MOV     R4, R12\n"                    // Move the new MBR offset for the partition detection.
+
+		"dg_sd_fat32_end:\n"
+		// End of DataGhost's FAT32 autodetection code
+
+		"LDRB    R1, [R4,#0x1C9]\n"
+		"LDRB    R3, [R4,#0x1C8]\n"
+		"LDRB    R12, [R4,#0x1CC]\n"
+		"MOV     R1, R1,LSL#24\n"
+		"ORR     R1, R1, R3,LSL#16\n"
+		"LDRB    R3, [R4,#0x1C7]\n"
+		"LDRB    R2, [R4,#0x1BE]\n"
+		//"LDRB    LR, [R4,#0x1FF]\n" // -
+		"ORR     R1, R1, R3,LSL#8\n"
+		"LDRB    R3, [R4,#0x1C6]\n"
+		"CMP     R2, #0\n"
+		"CMPNE   R2, #0x80\n"
+		"ORR     R1, R1, R3\n"
+		"LDRB    R3, [R4,#0x1CD]\n"
+		"MOV     R3, R3,LSL#24\n"
+		"ORR     R3, R3, R12,LSL#16\n"
+		"LDRB    R12, [R4,#0x1CB]\n"
+		"ORR     R3, R3, R12,LSL#8\n"
+		"LDRB    R12, [R4,#0x1CA]\n"
+		"ORR     R3, R3, R12\n"
+		//"LDRB    R12, [R4,#0x1FE]\n" // -
+		"LDRB    R12, [LR,#0x1FE]\n" // +
+		"LDRB    LR, [LR,#0x1FF]\n" // +
+		"MOV     R4, #0\n"
+		"BNE     loc_FF84EC1C\n"
+		"CMP     R0, R1\n"
+		"BCC     loc_FF84EC1C\n"
+		"ADD     R2, R1, R3\n"
+		"CMP     R2, R0\n"
+		"CMPLS   R12, #0x55\n"
+		"CMPEQ   LR, #0xAA\n"
+		"MOVEQ   R6, R1\n"
+		"MOVEQ   R5, R3\n"
+		"MOVEQ   R4, #1\n"
+
+		"loc_FF84EC1C:\n"
+		"MOV     R0, #3\n"
+		"BL      sub_FF867B04\n" // LOCATION: ExMemMan.c:0
+		"CMP     R4, #0\n"
+		"BNE     loc_FF84EC54\n"
+		"MOV     R6, #0\n"
+		"MOV     R0, R8\n"
+		"BL      sub_FF922B20\n"
+		"MOV     R5, R0\n"
+		"B       loc_FF84EC54\n"
+
+		"loc_FF84EC40:\n"
+		// jumptable FF84EB24 entry 5
+		"MOV     R5, #0x40\n"
+		"B       loc_FF84EC54\n"
+
+		"loc_FF84EC48:\n"
+		// jumptable FF84EB24 default entry
+		"LDR     R1, =0x374\n"
+		"LDR     R0, =0xFF84EAF0\n" // "Mounter.c"
+		"BL      _DebugAssert\n"
+
+		"loc_FF84EC54:\n"
+		"STR     R6, [R7,#0x44]!\n"
+		"MOV     R0, #1\n"
+		"STR     R5, [R7,#4]\n"
+		"LDMFD   SP!, {R4-R8,PC}\n"
+		);
+}
+
+// Extracted method: sub_FF842A40
+void __attribute__((naked,noinline)) jogdial_task_my()
+{
+	asm volatile (
+		"STMFD   SP!, {R3-R11,LR}\n"
+		"BL      sub_FF842BF0\n" // LOCATION: JogDial.c:14
+		"LDR     R11, =0x80000B01\n"
+		"LDR     R8, =0xFFAB1744\n"
+		"LDR     R7, =0xC0240000\n"
+		"LDR     R6, =0x22A0\n"
+		"MOV     R9, #1\n"
+		"MOV     R10, #0\n"
+
+		"loc_FF842A60:\n"
+		"LDR     R3, =0x1A1\n"
+		"LDR     R0, [R6,#0xC]\n"
+		"LDR     R2, =0xFF842C98\n" // "JogDial.c"
+		"MOV     R1, #0\n"
+		"BL      sub_FF81BBD8\n"
+		//"MOV     R0, #40\n"
+		"MOV     R0, #40\n" // +
+		"BL      _SleepTask\n" // LOCATION: KerSys.c:0
+
+		//------------------  added code ---------------------
+		"labelA:\n"
+		"LDR     R0, =jogdial_stopped\n"
+		"LDR     R0, [R0]\n"
+		"CMP     R0, #1\n"
+		"BNE     labelB\n"
+		"MOV     R0, #40\n"
+		"BL      _SleepTask\n"
+		"B       labelA\n"
+		"labelB:\n"
+		//------------------  original code ------------------
+
+		"LDR     R0, [R7,#0x104]\n"
+		"MOV     R0, R0,ASR#16\n"
+		"STRH    R0, [R6]\n"
+		"LDRSH   R2, [R6,#2]\n"
+		"SUB     R1, R0, R2\n"
+		"CMP     R1, #0\n"
+		"BEQ     loc_FF842B24\n"
+		"MOV     R5, R1\n"
+		"RSBLT   R5, R5, #0\n"
+		"MOVLE   R4, #0\n"
+		"MOVGT   R4, #1\n"
+		"CMP     R5, #0xFF\n"
+		"BLS     loc_FF842AD8\n"
+		"CMP     R1, #0\n"
+		"RSBLE   R1, R2, #0xFF\n"
+		"ADDLE   R1, R1, #0x7F00\n"
+		"ADDLE   R0, R1, R0\n"
+		"RSBGT   R0, R0, #0xFF\n"
+		"ADDGT   R0, R0, #0x7F00\n"
+		"ADDGT   R0, R0, R2\n"
+		"ADD     R5, R0, #0x8000\n"
+		"ADD     R5, R5, #1\n"
+		"EOR     R4, R4, #1\n"
+
+		"loc_FF842AD8:\n"
+		"LDR     R0, [R6,#0x14]\n"
+		"CMP     R0, #0\n"
+		"BEQ     loc_FF842B1C\n"
+		"LDR     R0, [R6,#0x1C]\n"
+		"CMP     R0, #0\n"
+		"BEQ     loc_FF842B04\n"
+		"LDR     R1, [R8,R4,LSL#2]\n"
+		"CMP     R1, R0\n"
+		"BEQ     loc_FF842B0C\n"
+		"LDR     R0, =0xB01\n"
+		"BL      sub_FF8750A0\n"
+
+		"loc_FF842B04:\n"
+		"MOV     R0, R11\n"
+		"BL      sub_FF8750A0\n"
+
+		"loc_FF842B0C:\n"
+		"LDR     R0, [R8,R4,LSL#2]\n"
+		"MOV     R1, R5\n"
+		"STR     R0, [R6,#0x1C]\n"
+		"BL      sub_FF874FE8\n"
+
+		"loc_FF842B1C:\n"
+		"LDRH    R0, [R6]\n"
+		"STRH    R0, [R6,#2]\n"
+
+		"loc_FF842B24:\n"
+		"STR     R10, [R7,#0x100]\n"
+		"STR     R9, [R7,#0x108]\n"
+		"LDR     R0, [R6,#0x10]\n"
+		"CMP     R0, #0\n"
+		"BLNE    _SleepTask\n" // LOCATION: KerSys.c:0
+		"B       loc_FF842A60\n"
+		);
+}
Index: /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100f/stubs_min.S
===================================================================
--- /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100f/stubs_min.S	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100f/stubs_min.S	(revision 1668)
@@ -0,0 +1,6 @@
+#include "stubs_asm.h"
+
+DEF(recreview_hold,                     0x9CEC + 0xAC)  // @ FF960378
+
+DEF(some_f_for_dng,                     0xDEAD)         // ??? TODO NOT FOUND!
+DEF(second_ext_for_dng,                 0xDEAD)         // ??? TODO NOT FOUND!
Index: /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100f/makefile.inc
===================================================================
--- /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100f/makefile.inc	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100f/makefile.inc	(revision 1668)
@@ -0,0 +1,17 @@
+#0x3173
+PLATFORMID=12659
+
+PLATFORMOS=dryos
+
+MEMBASEADDR=0x1900
+RESTARTSTART=0x50000
+MEMISOSTART=0xCBD40
+ROMBASEADDR=0xFF810000
+
+
+PLFLAGS=-DMEMBASEADDR=$(MEMBASEADDR) -DMEMISOSTART=$(MEMISOSTART) -DMEMISOSIZE=$(MEMISOSIZE)
+PLFLAGS+=-DRESTARTSTART=$(RESTARTSTART)
+
+NEED_ENCODED_DISKBOOT=1
+
+KEYSYS=d3enc
Index: /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100f/stubs_asm.h
===================================================================
--- /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100f/stubs_asm.h	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100f/stubs_asm.h	(revision 1668)
@@ -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/reyalp-ptp-live/platform/ixus970_sd890/sub/100f/lib.c
===================================================================
--- /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100f/lib.c	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100f/lib.c	(revision 1668)
@@ -0,0 +1,73 @@
+#include "platform.h"
+
+// obsolete
+void *hook_raw_fptr() { return (void*)0; }
+void *hook_raw_ret_addr() { return (void*)0; }
+
+char *hook_raw_image_addr()
+{
+	// 0x54F4 + 0x18 @ FF85E4B8
+	// @ FFAB1C48
+	// @ FFAB1C38
+	return (char*) (*(int*)(0x550C) ? 0x11B97B60 : 0x107D68C0);
+}
+
+long hook_raw_size()
+{
+	// (3720 x 2772 * 12bit) / 8bit
+	// @ FFA8ACF0
+	return 0xEC04F0;
+}
+
+// Live picture buffer (shoot not pressed)
+void *vid_get_viewport_live_fb()
+{
+	// @ FF8C5A34
+	void **fb=(void **)0x7420;
+	unsigned char buff = *((unsigned char*)0x729C);
+	if (buff == 0) {
+		buff = 2;
+	} else {
+		buff--;
+	}
+	return fb[buff];
+}
+
+// Live picture buffer (shoot half-pressed)
+void *vid_get_viewport_fb()
+{
+	// @ FFA88A6C
+	return (void*)0x1065ADC0;
+}
+
+// Picture buffer (play mode)
+void *vid_get_viewport_fb_d()
+{
+	// 0x51FC + 0x4C @ FF853E4C
+	return (void*)(*(int*)0x5248);
+}
+
+// OSD buffer
+void *vid_get_bitmap_fb()
+{
+	// @ FF8EA97C
+	return (void*)0x10361000;
+}
+
+// possible future use
+/*
+char *vid_get_bitmap_fb_d() 
+{
+	// 0xAEF0+0x4 @ FF9AE1E4
+	int *p =(int *)(*(int*)(0xAEF4));
+	return ((char *)(*(p+2)));
+}
+*/
+
+char *camera_jpeg_count_str()
+{
+	// @ FF9A6F4C
+	return (char*)0x4CA80;
+}
+
+long vid_get_viewport_height() { return 240; }
Index: /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100f/movie_rec.c
===================================================================
--- /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100f/movie_rec.c	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100f/movie_rec.c	(revision 1668)
@@ -0,0 +1,416 @@
+#include "conf.h"
+
+int *video_quality = &conf.video_quality;
+int *video_mode    = &conf.video_mode;
+
+long def_table[68] = {
+	0x2000,  0x38D,   0x788,   0xBE1,   0x10CB,  0x1642,  0x1C48,  0x22F9,  0x2A79,  0x32AA, 0x3C01, 0x4637,
+	0x5190,  0x5E0E,  0x5800,  0x9C5,   0x14B8,  0x20C9,  0x2E31,  0x3D39,  0x4DC9,  0x6030, 0x74D1, 0x8B8D,
+	0xA509,  0xC160,  0xE054,  0x102AF, 0x10000, 0x1C6A,  0x3C45,  0x5F60,  0x8661,  0xB21A, 0xE249, 0x117D2,
+	0x153D5, 0x195F8, 0x1E01C, 0x2328E, 0x28C99, 0x2F08B, 0x8000,  0xE35,   0x1E23,  0x2FB0, 0x4331, 0x590D, 
+	0x7125,  0x8BE9,  0xA9EB,  0xCAFC,  0xF00E,  0x11947, 0x1464D, 0x17846, 0x1CCD, -0x2E1,  -0x579, 0x4F33,
+	-0x7EB, -0xF0C,   0xE666,  -0x170A, -0x2BC6, 0x7333,  -0xB85, -0x15E3};
+
+long table[68];
+
+void change_video_tables(int a, int b) {
+	int i;
+
+	for (i=0;i<68;i++) {
+		table[i]=(def_table[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};
+
+// Extracted method: sub_FF859F88
+void __attribute__((naked,noinline)) movie_record_task()
+{
+	asm volatile (
+		"STMFD   SP!, {R2-R8,LR}\n"
+		"LDR     R8, =0x32B\n"
+		"LDR     R7, =0x2710\n"
+		"LDR     R4, =0x5390\n"
+		"MOV     R6, #0\n"
+		"MOV     R5, #1\n"
+
+		"loc_FF859FA0:\n"
+		"LDR     R0, [R4,#0x1C]\n"
+		"MOV     R2, #0\n"
+		"ADD     R1, SP, #0x20-0x1C\n"
+		"BL      sub_FF827D8C\n" // LOCATION: KerQueue.c:0
+		"LDR     R0, [R4,#0x24]\n"
+		"CMP     R0, #0\n"
+		"BNE     loc_FF85A070\n"
+		"LDR     R0, [SP,#0x20-0x1C]\n"
+		"LDR     R1, [R0]\n"
+		"SUB     R1, R1, #2\n"
+		"CMP     R1, #9\n"
+		"ADDLS   PC, PC, R1,LSL#2\n"
+		"B       loc_FF85A070\n"
+
+		"loc_FF859FD4:\n"
+		"B       loc_FF85A024\n"
+
+		"loc_FF859FD8:\n"
+		"B       loc_FF85A044\n"
+
+		"loc_FF859FDC:\n"
+		"B       loc_FF85A054\n"
+
+		"loc_FF859FE0:\n"
+		"B       loc_FF85A05C\n"
+
+		"loc_FF859FE4:\n"
+		"B       loc_FF85A02C\n"
+
+		"loc_FF859FE8:\n"
+		"B       loc_FF85A064\n"
+
+		"loc_FF859FEC:\n"
+		"B       loc_FF85A034\n"
+
+		"loc_FF859FF0:\n"
+		"B       loc_FF85A070\n"
+
+		"loc_FF859FF4:\n"
+		"B       loc_FF85A06C\n"
+
+		"loc_FF859FF8:\n"
+		"B       loc_FF859FFC\n"
+
+		"loc_FF859FFC:\n"
+		// jumptable FF859FCC entry 9
+		"STR     R6, [R4,#0x38]\n"
+		"LDR     R0, =0xFF859C5C\n" // nullsub_234
+		"LDR     R2, =0xFF85958C\n"
+		"LDR     R1, =0x19B18\n"
+		"STR     R0, [R4,#0xA4]\n"
+		"LDR     R0, =0xFF859670\n"
+		"STR     R6, [R4,#0x28]\n"
+		"BL      sub_FF8C7F14\n"
+		"STR     R5, [R4,#0x3C]\n"
+		"B       loc_FF85A070\n"
+
+		"loc_FF85A024:\n"
+		// jumptable FF859FCC entry 0
+		"BL      unlock_optical_zoom\n" //------------->
+		"BL      sub_FF859D54\n" // LOCATION: MovieRecorder.c:0
+		"B       loc_FF85A070\n"
+
+		"loc_FF85A02C:\n"
+		// jumptable FF859FCC entry 4
+		"BL      sub_FF859A20_my\n" //------------->
+		"B       loc_FF85A070\n"
+
+		"loc_FF85A034:\n"
+		// jumptable FF859FCC entry 6
+		"LDR     R1, [R0,#0x10]\n"
+		"LDR     R0, [R0,#4]\n"
+		"BL      sub_FF938D00\n" // LOCATION: AviWriter.c:0
+		"B       loc_FF85A070\n"
+
+		"loc_FF85A044:\n"
+		// jumptable FF859FCC entry 1
+		"LDR     R0, [R4,#0x3C]\n"
+		"CMP     R0, #5\n"
+		"STRNE   R5, [R4,#0x2C]\n"
+		"B       loc_FF85A070\n"
+
+		"loc_FF85A054:\n"
+		// jumptable FF859FCC entry 2
+		"BL      sub_FF859824\n" // LOCATION: MovieRecorder.c:1000
+		"B       loc_FF85A070\n"
+
+		"loc_FF85A05C:\n"
+		// jumptable FF859FCC entry 3
+		"BL      sub_FF8596BC\n"
+		"B       loc_FF85A070\n"
+
+		"loc_FF85A064:\n"
+		// jumptable FF859FCC entry 5
+		"BL      sub_FF859518\n" // LOCATION: MovieRecorder.c:100
+		"B       loc_FF85A070\n"
+
+		"loc_FF85A06C:\n"
+		// jumptable FF859FCC entry 8
+		"BL      sub_FF85A1D8\n" // LOCATION: MovieRecorder.c:100
+
+		"loc_FF85A070:\n"
+		// jumptable FF859FCC default entry
+		// jumptable FF859FCC entry 7
+		"LDR     R1, [SP,#0x20-0x1C]\n"
+		"LDR     R3, =0xFF85931C\n" // aMovierecorder_  ; "MovieRecorder.c"
+		"STR     R6, [R1]\n"
+		"STR     R8, [SP,#0x20-0x20]\n"
+		"LDR     R0, [R4,#0x20]\n"
+		"MOV     R2, R7\n"
+		"BL      sub_FF81BC30\n"
+		"B       loc_FF859FA0\n"
+		);
+}
+
+void __attribute__((naked,noinline)) sub_FF859A20_my()
+{
+	asm volatile (
+		"STMFD   SP!, {R4-R9,LR}\n"
+		"SUB     SP, SP, #0x3C\n"
+		"MOV     R7, #0\n"
+		"LDR     R5, =0x5390\n"
+		"MOV     R4, R0\n"
+		"STR     R7, [SP,#0x58-0x2C]\n"
+		"STR     R7, [SP,#0x58-0x34]\n"
+		"LDR     R0, [R5,#0x3C]\n"
+		"MOV     R8, #4\n"
+		"CMP     R0, #3\n"
+		"STREQ   R8, [R5,#0x3C]\n"
+		"LDR     R0, [R5,#0xA4]\n"
+		"MOV     R6, #0\n"
+		"BLX     R0\n"
+		"LDR     R0, [R5,#0x3C]\n"
+		"CMP     R0, #4\n"
+		"BNE     loc_FF859B30\n"
+		"LDRH    R0, [R5,#2]\n"
+		"MOV     R9, #1\n"
+		"CMP     R0, #1\n"
+		"BNE     loc_FF859A9C\n"
+		"LDRH    R1, [R5,#4]\n"
+		"LDR     R0, [R5,#0x4C]\n"
+		"MUL     R0, R1, R0\n"
+		"MOV     R1, #0x3E8\n"
+		"BL      sub_FFAAF264\n"
+		"MOV     R1, R0\n"
+		"LDR     R0, [R5,#0x54]\n"
+		"BL      sub_FFAAF264\n"
+		"CMP     R1, #0\n"
+		"BNE     loc_FF859AB8\n"
+
+		"loc_FF859A9C:\n"
+		"ADD     R3, SP, #0x58-0x34\n"
+		"ADD     R2, SP, #0x58-0x30\n"
+		"ADD     R1, SP, #0x58-0x2C\n"
+		"ADD     R0, SP, #0x58-0x28\n"
+		"BL      sub_FF938E94\n"
+		"MOVS    R6, R0\n"
+		"BNE     loc_FF859AD4\n"
+
+		"loc_FF859AB8:\n"
+		"LDR     R0, [R5,#0x2C]\n"
+		"CMP     R0, #1\n"
+		"BNE     loc_FF859B38\n"
+		"LDR     R0, [R5,#0x54]\n"
+		"LDR     R1, [R5,#0x40]\n"
+		"CMP     R0, R1\n"
+		"BCC     loc_FF859B38\n"
+
+		"loc_FF859AD4:\n"
+		"CMP     R6, #0x80000001\n"
+		"STREQ   R8, [R5,#0x58]\n"
+		"BEQ     loc_FF859B0C\n"
+		"CMP     R6, #0x80000003\n"
+		"STREQ   R9, [R5,#0x58]\n"
+		"BEQ     loc_FF859B0C\n"
+		"CMP     R6, #0x80000005\n"
+		"MOVEQ   R0, #2\n"
+		"BEQ     loc_FF859B08\n"
+		"CMP     R6, #0x80000007\n"
+		"STRNE   R7, [R5,#0x58]\n"
+		"BNE     loc_FF859B0C\n"
+		"MOV     R0, #3\n"
+
+		"loc_FF859B08:\n"
+		"STR     R0, [R5,#0x58]\n"
+
+		"loc_FF859B0C:\n"
+		"LDR     R0, =0x19B48\n"
+		"LDR     R0, [R0,#8]\n"
+		"CMP     R0, #0\n"
+		"BEQ     loc_FF859B24\n"
+		"BL      sub_FF844278\n"
+		"B       loc_FF859B28\n"
+
+		"loc_FF859B24:\n"
+		"BL      sub_FF859518\n" // LOCATION: MovieRecorder.c:100
+
+		"loc_FF859B28:\n"
+		"MOV     R0, #5\n"
+		"STR     R0, [R5,#0x3C]\n"
+
+		"loc_FF859B30:\n"
+		"ADD     SP, SP, #0x3C\n"
+		"LDMFD   SP!, {R4-R9,PC}\n"
+
+		"loc_FF859B38:\n"
+		"LDR     R12, [SP,#0x58-0x2C]\n"
+		"CMP     R12, #0\n"
+		"BEQ     loc_FF859C04\n"
+		"STR     R9, [R5,#0x30]\n"
+		"LDR     R0, [R5,#0x70]\n"
+		"LDR     R1, [R4,#0x14]\n"
+		"LDR     R2, [R4,#0x18]\n"
+		"LDR     LR, [R4,#0xC]\n"
+		"ADD     R3, SP, #0x58-0x24\n"
+		"ADD     R6, SP, #0x58-0x44\n"
+		"STMIA   R6, {R0-R3}\n"
+		"LDR     R0, [SP,#0x58-0x34]\n"
+		"LDR     R3, [R5,#0x5C]\n"
+		"LDR     R1, [SP,#0x58-0x30]\n"
+		"ADD     R2, SP, #0x58-0x20\n"
+		"ADD     R6, SP, #0x58-0x50\n"
+		"STMIA   R6, {R0,R2,R3}\n"
+		"STR     R1, [SP,#0x58-0x54]\n"
+		"STR     R12, [SP,#0x58-0x58]\n"
+		"LDMIB   R4, {R0,R1}\n"
+		"LDR     R3, [SP,#0x58-0x28]\n"
+		"MOV     R2, LR\n"
+		"BL      sub_FF8EFDE4\n"
+		"LDR     R0, [R5,#0x14]\n"
+		"MOV     R1, #0x3E8\n"
+		"BL      sub_FF81B6AC\n" // eventproc_export_TakeSemaphore
+		"CMP     R0, #9\n"
+		"BNE     loc_FF859BB8\n"
+		"BL      sub_FF939470\n"
+		"MOV     R0, #0x90000\n"
+		"STR     R9, [R5,#0x3C]\n"
+		"B       loc_FF859BD0\n"
+
+		"loc_FF859BB8:\n"
+		"LDR     R0, [SP,#0x58-0x24]\n"
+		"CMP     R0, #0\n"
+		"BEQ     loc_FF859BD8\n"
+		"BL      sub_FF939470\n"
+		"MOV     R0, #0xA0000\n"
+		"STR     R9, [R5,#0x3C]\n"
+
+		"loc_FF859BD0:\n"
+		"BL      sub_FF8756D4\n" // eventproc_export_HardwareDefect
+		"B       loc_FF859B30\n"
+
+		"loc_FF859BD8:\n"
+		"BL      sub_FF8EFEA8\n"
+		"LDR     R0, [SP,#0x58-0x28]\n"
+		"LDR     R1, [SP,#0x58-0x20]\n"
+		"BL      sub_FF939218\n" // LOCATION: AviWriter.c:0
+		"LDR     R0, [R5,#0x50]\n"
+		"LDR     R1, =0x5400\n"
+		"ADD     R0, R0, #1\n"
+		"STR     R0, [R5,#0x50]\n"
+		"LDR     R0, [SP,#0x58-0x20]\n"
+		"MOV     R2, #0\n"
+		"BL      sub_FF9370A8_my\n" //------------->
+
+		"loc_FF859C04:\n"
+		"LDR     R0, [R5,#0x54]\n"
+		"ADD     R0, R0, #1\n"
+		"STR     R0, [R5,#0x54]\n"
+		"LDR     R1, [R5,#0x7C]\n"
+		"MUL     R0, R1, R0\n"
+		"LDR     R1, [R5,#0x78]\n"
+		"BL      sub_FFAAF264\n"
+		"MOV     R4, R0\n"
+		"BL      sub_FF9394A8\n"
+		"LDR     R1, [R5,#0x74]\n"
+		"CMP     R1, R4\n"
+		"BNE     loc_FF859C40\n"
+		"LDR     R0, [R5,#0x34]\n"
+		"CMP     R0, #1\n"
+		"BNE     loc_FF859C54\n"
+
+		"loc_FF859C40:\n"
+		"LDR     R1, [R5,#0x88]\n"
+		"MOV     R0, R4\n"
+		"BLX     R1\n"
+		"STR     R4, [R5,#0x74]\n"
+		"STR     R7, [R5,#0x34]\n"
+
+		"loc_FF859C54:\n"
+		"STR     R7, [R5,#0x30]\n"
+		"B       loc_FF859B30\n"
+		);
+}
+
+void __attribute__((naked,noinline)) sub_FF9370A8_my()
+{
+	asm volatile (
+		"STMFD   SP!, {R4-R8,LR}\n"
+		"LDR     R4, =0x8C44\n"
+		"LDR     LR, [R4]\n"
+		"LDR     R2, [R4,#8]\n"
+		"CMP     LR, #0\n"
+		"LDRNE   R3, [R4,#0xC]\n"
+		"MOV     R5, R2\n"
+		"CMPNE   R3, #1\n"
+		"MOVEQ   R2, #0\n"
+		"STREQ   R0, [R4]\n"
+		"STREQ   R2, [R4,#0xC]\n"
+		"BEQ     loc_FF937174\n"
+		"LDR     R3, [R4,#4]\n"
+		//"LDR     R7, =0xFFACAE28\n"
+		"LDR     R7, =table\n" // +
+		"ADD     R12, R3, R3,LSL#1\n"
+		"LDR     R3, [R7,R12,LSL#2]\n"
+		"ADD     R6, R7, #0x30\n"
+		"LDR     R8, [R6,R12,LSL#2]\n"
+		"SUB     R3, LR, R3\n"
+		"CMP     R3, #0\n"
+		"SUB     LR, LR, R8\n"
+		"BLE     loc_FF937130\n"
+		"ADD     R12, R7, R12,LSL#2\n"
+		"LDR     LR, [R12,#4]\n"
+		"CMP     LR, R3\n"
+		"ADDGE   R2, R2, #1\n"
+		"BGE     loc_FF937124\n"
+		"LDR     R12, [R12,#8]\n"
+		"CMP     R12, R3\n"
+		"ADDLT   R2, R2, #3\n"
+		"ADDGE   R2, R2, #2\n"
+
+		"loc_FF937124:\n"
+		//"CMP     R2, #0x17\n"
+		//"MOVGE   R2, #0x16\n"
+		"CMP     R2, #0x1A\n" // +
+		"MOVGE   R2, #0x19\n" // +
+		"B       loc_FF937164\n"
+
+		"loc_FF937130:\n"
+		"CMP     LR, #0\n"
+		"BGE     loc_FF937164\n"
+		"ADD     R3, R6, R12,LSL#2\n"
+		"LDR     R12, [R3,#4]\n"
+		"CMP     R12, LR\n"
+		"SUBLE   R2, R2, #1\n"
+		"BLE     loc_FF93715C\n"
+		"LDR     R3, [R3,#8]\n"
+		"CMP     R3, LR\n"
+		"SUBGT   R2, R2, #3\n"
+		"SUBLE   R2, R2, #2\n"
+
+		"loc_FF93715C:\n"
+		"CMP     R2, #0\n"
+		"MOVLT   R2, #0\n"
+
+		"loc_FF937164:\n"
+		"CMP     R2, R5\n"
+		"STRNE   R2, [R4,#8]\n"
+		"MOVNE   R2, #1\n"
+		"STRNE   R2, [R4,#0xC]\n"
+
+		"loc_FF937174:\n"
+		//"LDR     R2, =0xFFACADCC\n"
+		"LDR     R2, =CompressionRateTable\n" // +
+		"LDR     R3, [R4,#8]\n"
+		"LDR     R2, [R2,R3,LSL#2]\n"
+
+		"LDR     R3, =video_mode\n" // +
+		"LDR     R3, [R3]\n" // +
+		"LDR     R3, [R3]\n" // +
+		"CMP     R3, #1\n" // +
+		"LDREQ   R3, =video_quality\n" // +
+		"LDREQ   R3, [R3]\n" // +
+		"LDREQ   R2, [R3]\n" // +
+
+		"STR     R2, [R1]\n"
+		"STR     R0, [R4]\n"
+		"LDMFD   SP!, {R4-R8,PC}\n"
+		);
+}
Index: /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100f/stubs_auto.S
===================================================================
--- /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100f/stubs_auto.S	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100f/stubs_auto.S	(revision 1668)
@@ -0,0 +1,191 @@
+/* THIS FILE IS GENERATED */
+/* DO NOT EDIT THIS FILE! */
+
+#include "stubs_asm.h"
+
+STUB(FF8101A4)
+STUB(FF81094C)
+STUB(FF810FA0)
+STUB(FF8114B8)
+STUB(FF812D58)
+STUB(FF813564)
+STUB(FF8149C8)
+STUB(FF814AB4)
+STUB(FF814E98)
+STUB(FF815070)
+STUB(FF81516C)
+STUB(FF8191EC)
+STUB(FF819664)
+STUB(FF81B6AC)
+STUB(FF81B818)
+STUB(FF81BAA8)
+STUB(FF81BBD8)
+STUB(FF81BC30)
+STUB(FF81FB10)
+STUB(FF81FDF0)
+STUB(FF820E68)
+STUB(FF820EAC)
+STUB(FF820FBC)
+STUB(FF821630)
+STUB(FF821B00)
+STUB(FF821BEC)
+STUB(FF821BF0)
+STUB(FF821BF4)
+STUB(FF821BF8)
+STUB(FF822D50)
+STUB(FF824C38)
+STUB(FF824CB8)
+STUB(FF8277A4)
+STUB(FF827A40)
+STUB(FF827B08)
+STUB(FF827B3C)
+STUB(FF827D8C)
+STUB(FF828264)
+STUB(FF828458)
+STUB(FF8284AC)
+STUB(FF829CA4)
+STUB(FF829EDC)
+STUB(FF829F1C)
+STUB(FF829FA4)
+STUB(FF82A0E4)
+STUB(FF82A134)
+STUB(FF82A298)
+STUB(FF82A29C)
+STUB(FF82A2B4)
+STUB(FF82AD58)
+STUB(FF842BF0)
+STUB(FF844278)
+STUB(FF84532C)
+STUB(FF84C920)
+STUB(FF84E5F8)
+STUB(FF84E9F0)
+STUB(FF84EA30)
+STUB(FF84EAFC)
+STUB(FF84EC64)
+STUB(FF84ED6C)
+STUB(FF84EDD8)
+STUB(FF84EF30)
+STUB(FF84F424)
+STUB(FF8582B4)
+STUB(FF859518)
+STUB(FF8596BC)
+STUB(FF859824)
+STUB(FF859A20)
+STUB(FF859D54)
+STUB(FF85A1D8)
+STUB(FF85C148)
+STUB(FF85C69C)
+STUB(FF85D968)
+STUB(FF85E344)
+STUB(FF861030)
+STUB(FF8679C4)
+STUB(FF867B04)
+STUB(FF86CF8C)
+STUB(FF86D11C)
+STUB(FF86D328)
+STUB(FF86D818)
+STUB(FF86D844)
+STUB(FF873244)
+STUB(FF874FE8)
+STUB(FF8750A0)
+STUB(FF8756D4)
+STUB(FF881A84)
+STUB(FF881A94)
+STUB(FF8958EC)
+STUB(FF895BA0)
+STUB(FF8960E8)
+STUB(FF896170)
+STUB(FF8963F0)
+STUB(FF89696C)
+STUB(FF8AA1E0)
+STUB(FF8B32A4)
+STUB(FF8B33B0)
+STUB(FF8B3408)
+STUB(FF8B3460)
+STUB(FF8B34B8)
+STUB(FF8B3510)
+STUB(FF8B3650)
+STUB(FF8B3708)
+STUB(FF8B3998)
+STUB(FF8B3B9C)
+STUB(FF8B3E04)
+STUB(FF8B3FF8)
+STUB(FF8B4260)
+STUB(FF8B439C)
+STUB(FF8B4610)
+STUB(FF8B4838)
+STUB(FF8B4B28)
+STUB(FF8B4C2C)
+STUB(FF8B4E64)
+STUB(FF8B4FDC)
+STUB(FF8B5174)
+STUB(FF8B52AC)
+STUB(FF8B54F4)
+STUB(FF8B64AC)
+STUB(FF8B6738)
+STUB(FF8B6798)
+STUB(FF8B7A54)
+STUB(FF8B7A84)
+STUB(FF8B7AC8)
+STUB(FF8B7C44)
+STUB(FF8B7CF0)
+STUB(FF8B7D90)
+STUB(FF8B7E28)
+STUB(FF8C5350)
+STUB(FF8C7F14)
+STUB(FF8C9840)
+STUB(FF8EFDE4)
+STUB(FF8EFEA8)
+STUB(FF8F3AC4)
+STUB(FF9052F8)
+STUB(FF9053C4)
+STUB(FF922B20)
+STUB(FF92F7C8)
+STUB(FF92F91C)
+STUB(FF92FA50)
+STUB(FF9370A8)
+STUB(FF938D00)
+STUB(FF938E94)
+STUB(FF939218)
+STUB(FF939470)
+STUB(FF9394A8)
+STUB(FF93C050)
+STUB(FF93C384)
+STUB(FF93C38C)
+STUB(FF93C394)
+STUB(FF93C3B8)
+STUB(FF93C480)
+STUB(FF93C4E0)
+STUB(FF93C560)
+STUB(FF93C684)
+STUB(FF93C828)
+STUB(FF93CBA8)
+STUB(FF93CE14)
+STUB(FF93CFFC)
+STUB(FF93D08C)
+STUB(FF93D140)
+STUB(FF93D1FC)
+STUB(FF93D268)
+STUB(FF93D338)
+STUB(FF93D388)
+STUB(FF93D40C)
+STUB(FF93D55C)
+STUB(FF93D5F0)
+STUB(FF93D6B8)
+STUB(FF93D9B8)
+STUB(FF93DAA0)
+STUB(FF93DB14)
+STUB(FF93DEAC)
+STUB(FF93DF0C)
+STUB(FF93E490)
+STUB(FF93E608)
+STUB(FF93EAFC)
+STUB(FF93F4C8)
+STUB(FF93F4E4)
+STUB(FF93F4F4)
+STUB(FF93F520)
+STUB(FF95DD78)
+STUB(FF9B2794)
+STUB(FFAAD758)
+STUB(FFAAD9B4)
+STUB(FFAAF264)
Index: /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100f/Makefile
===================================================================
--- /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100f/Makefile	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/100f/Makefile	(revision 1668)
@@ -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/reyalp-ptp-live/platform/ixus970_sd890/sub/Makefile
===================================================================
--- /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/Makefile	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/ixus970_sd890/sub/Makefile	(revision 1668)
@@ -0,0 +1,8 @@
+topdir=../../../
+include $(topdir)makefile.inc
+
+SUBDIRS=$(PLATFORMSUB)
+
+all: all-recursive
+
+clean: clean-recursive
Index: /branches/reyalp-ptp-live/platform/ixus970_sd890/shooting.c
===================================================================
--- /branches/reyalp-ptp-live/platform/ixus970_sd890/shooting.c	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/ixus970_sd890/shooting.c	(revision 1668)
@@ -0,0 +1,198 @@
+#define PARAM_FILE_COUNTER      0x38
+#define PARAM_EXPOSURE_COUNTER  0x02
+
+#include "platform.h"
+
+// These F-numbers are the "mock" values shown by the cam.
+// They're linked to FL (zoom) and ND8 filter.
+//id (hack id), prop_id (canon id), name
+const ApertureSize aperture_sizes_table[] = {
+	/*first row: zoom position using propertycase #195
+	second row: zoom value in x (100=1x) using misc values
+	third row: real aperture using misc values
+	fourth row: aperture using 'standard' Canon on-screen display
+	fifth row: Av using propertycase #23
+	0    1.0    3.24    3.2    326
+	1    1.3    3.41    3.5    340
+	2    1.6    3.60    3.5    355
+	3    1.9    3.78    4.0    369
+	4    2.3    3.98    4.0    383
+	5    2.7    4.17    4.0    396
+	6    3.1    4.36    4.5    408
+	7    3.7    4.58    4.5    422
+	8    3.7    4.82    5.0    436
+	9    3.7    5.11    5.0    452
+	10    3.7    5.47    5.6    471
+	11    3.7    5.86    5.7    490*/
+	{  0, 326,  "3.2" },
+	{  1, 340,  "3.5" },  
+	{  2, 355,  "3.5" },
+	{  3, 369,  "4.0" },
+	{  4, 383,  "4.0" },
+	{  5, 396,  "4.0" },
+	{  6, 408,  "4.5" },
+	{  7, 422,  "4.5" },
+	{  8, 436,  "5.0" },
+	{  9, 452,  "5.0" },
+	{ 10, 471,  "5.6" },
+	{ 11, 490,  "5.7" },
+	/*And the same physical apertures for the firework mode in SCN position
+	0    1.0    3.24    9.0    601
+	1    1.3    3.41   10.0    615
+	2    1.6    3.60   10.0    630
+	3    1.9    3.78   11.0    644
+	4    2.3    3.98   11.0    658
+	5    2.7    4.17   11.0    671
+	6    3.1    4.36   13.0    683
+	7    3.7    4.58   13.0    697
+	8    3.7    4.82   14.0    711
+	9    3.7    5.11   14.0    727
+	10    3.7    5.47   16.0    746
+	11    3.7    5.86   16.0    765*/
+	{ 12, 601,  "9.0" },
+	{ 13, 615, "10.0" },
+	{ 14, 630, "10.0" },
+	{ 15, 644, "11.0" },
+	{ 16, 658, "11.0" },
+	{ 17, 671, "11.0" },
+	{ 18, 683, "13.0" },
+	{ 19, 697, "13.0" },
+	{ 20, 711, "14.0" },
+	{ 21, 727, "14.0" },
+	{ 22, 746, "16.0" },
+	{ 23, 765, "16.0" }
+};
+
+// Another set of "mock" values
+// hacks id, prop_id, name[8], usec
+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, 1024, "1/1600",  625 },
+	{  33, 1056, "1/2000",  500 },
+	{  34, 1088, "1/2500",  400 },
+	{  35, 1120, "1/3200",  313 }
+};
+
+const ISOTable iso_table[] = {
+	{ -1,    1,   "HI", -1},
+	{  0,    0, "Auto", -1},
+	{  1,   80,   "80", -1},
+	{  2,  100,  "100", -1},
+	{  3,  200,  "200", -1},
+	{  4,  400,  "400", -1},
+	{  5,  800,  "800", -1},
+	{  6, 1600, "1600", -1},
+	{  7, 3200, "3200", -1}
+};
+
+/*
+http://www.usa.canon.com/consumer/controller?act=ModelInfoAct&tabact=ModelTechSpecsTabAct&fcategoryid=224&modelid=16719
+
+Shooting Modes
+	Auto, Camera M,
+    Special Scene
+        (Portrait, Foliage, Snow, Beach, Sunset, Fireworks, Aquarium, ISO 3200,
+        Indoor, Kids & Pets, Night Snapshot),
+    Color Accent, Color Swap, Digital Macro, Stitch Assist, Movie
+Movie: 640 x 480 (30 fps/30 fps LP), 320 x 240 (30 fps) available up to 4GB or 60 minutes,
+    640 x 480 (up to 2 hours at 0.5 fps/1 fps), 160 x 120 (up to 3 min. at 15 fps)
+
+canon mode list FFAF9460 in 100b
+*/
+const CapturemodeMap modemap[] = {
+	{ MODE_LONG_SHUTTER,       32774 }, // guessed
+	{ MODE_AUTO,               32768 },
+	{ MODE_P,                  32772 },
+	{ MODE_DIGITAL_MACRO,      33288 },
+	{ MODE_COLOR_ACCENT,       33307 },
+	{ MODE_COLOR_SWAP,         33308 },
+	{ MODE_STITCH,             33290 },
+	//
+	{ MODE_SCN_NIGHT_SNAPSHOT, 16395 },
+	{ MODE_SCN_KIDS_PETS,      16400 },
+	{ MODE_SCN_INDOOR,         16401 },
+	{ MODE_SCN_SUNSET,         16402 },
+	{ MODE_SCN_FOLIAGE,        16403 },
+	{ MODE_SCN_SNOW,           16404 },
+	{ MODE_SCN_BEACH,          16405 },
+	{ MODE_SCN_FIREWORK,       16406 },
+	{ MODE_SCN_AQUARIUM,       16408 },
+	{ MODE_SCN_ISO_3200,       16413 },
+	{ MODE_SCN_PORTRAIT,       16397 },
+	//
+	{ MODE_VIDEO_STD,          2599  },
+	{ MODE_VIDEO_COMPACT,      2601  },
+	{ MODE_VIDEO_COLOR_ACCENT, 2597  },
+	{ MODE_VIDEO_COLOR_SWAP,   2598  },
+	{ MODE_VIDEO_TIME_LAPSE,   2603  },
+};
+
+#include "../generic/shooting.c"
+
+long get_file_next_counter()
+{
+	return get_file_counter();
+}
+
+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/reyalp-ptp-live/platform/ixus970_sd890/Makefile
===================================================================
--- /branches/reyalp-ptp-live/platform/ixus970_sd890/Makefile	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/ixus970_sd890/Makefile	(revision 1668)
@@ -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
+lib.o: lib.c
+main.o: main.c
+shooting.o: shooting.c
+wrappers.o: wrappers.c ../generic/wrappers.c
+
+libplatform.a: $(OBJS)
+
+clean: clean-recursive
+	rm -f $(OBJS) libplatform.a
+
Index: /branches/reyalp-ptp-live/platform/ixus970_sd890/leds.h
===================================================================
--- /branches/reyalp-ptp-live/platform/ixus970_sd890/leds.h	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/ixus970_sd890/leds.h	(revision 1668)
@@ -0,0 +1,15 @@
+#ifndef LEDS_H
+#define LEDS_H
+
+#define LED_PWR    0xc02200D0
+#define LED_PR     0xc02200D4
+#define LED_ORANGE 0xc0220130
+#define LED_GREEN  0xc0220134
+#define LED_YELLOW 0xc0220138
+#define LED_AF     0xC0223030
+
+#define DELAY 5000000
+
+void led_blink(volatile long *p);
+
+#endif
Index: /branches/reyalp-ptp-live/platform/g9/kbd.c
===================================================================
--- /branches/reyalp-ptp-live/platform/g9/kbd.c	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/g9/kbd.c	(revision 1668)
@@ -0,0 +1,318 @@
+#include "lolevel.h"
+#include "platform.h"
+#include "core.h"
+#include "keyboard.h"
+#include "conf.h"
+extern void _GetKbdState(long* buffer);
+
+typedef struct {
+	short grp;
+	short hackkey;
+	long canonkey;
+} KeyMap;
+
+
+long kbd_new_state[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF };
+static long kbd_prev_state[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF };
+static long kbd_mod_state[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF };
+
+static KeyMap keymap[];
+static long last_kbd_key = 0;
+static long alt_mode_key_mask = 0x00001000;  
+static long alt_mode_key_reg  = 1;     
+
+#define KEYS_MASK0 (0xC0000000)
+#define KEYS_MASK1 (0x1F1F1018)
+#define KEYS_MASK2 (0x00000000)
+ 
+#define NEW_SS (0x2000)
+#define SD_READONLY_FLAG (0x20000)
+
+#define USB_MASK (0x40000)
+#define USB_IDX  2
+
+extern void usb_remote_key( int ) ;
+int get_usb_bit() 
+{
+	long usb_physw[3];
+	usb_physw[USB_IDX] = 0;
+	_kbd_read_keys_r2(usb_physw);
+	return(( usb_physw[USB_IDX] & USB_MASK)==USB_MASK) ; 
+}
+
+
+#ifndef MALLOCD_STACK
+static char kbd_stack[NEW_SS];
+#endif
+
+void kbd_fetch_data(long*);
+
+long __attribute__((naked)) wrap_kbd_p1_f() ;
+
+static void __attribute__((noinline)) mykbd_task_proceed()
+{
+    while (physw_run){ 
+	_SleepTask(10);
+	
+	if (wrap_kbd_p1_f() == 1){ // autorepeat ?
+	    _kbd_p2_f();
+	}
+    }
+}
+
+void __attribute__((naked,noinline))
+mykbd_task(long ua, long ub, long uc, long ud, long ue, long uf)
+{
+    /* WARNING
+     * Stack pointer manipulation performed here!
+     * This means (but not limited to):
+     *	function arguments destroyed;
+     *	function CAN NOT return properly;
+     *	MUST NOT call or use stack variables before stack
+     *	is setup properly;
+     *
+     */
+
+    register int i;
+    register long *newstack;
+
+#ifndef MALLOCD_STACK
+    newstack = (void*)kbd_stack;
+#else
+    newstack = malloc(NEW_SS);
+#endif
+
+    for (i=0;i<NEW_SS/4;i++)
+	newstack[i]=0xdededede;
+
+    asm volatile (
+	"MOV	SP, %0"
+	:: "r"(((char*)newstack)+NEW_SS)
+	: "memory"
+    );
+	
+    mykbd_task_proceed();
+
+    /* function can be modified to restore SP here...
+     */
+
+    _ExitTask();
+}
+
+
+long __attribute__((naked,noinline)) wrap_kbd_p1_f()
+{
+
+    asm volatile(
+                "STMFD   SP!, {R1-R5,LR}\n"
+                "MOV     R4, #0\n"
+                "BL      my_kbd_read_keys\n"
+               	"B	 _kbd_p1_f_cont\n"		
+    );
+    return 0; // shut up the compiler
+}
+
+
+void my_kbd_read_keys()
+{  
+    kbd_prev_state[0] = kbd_new_state[0];
+    kbd_prev_state[1] = kbd_new_state[1];
+    kbd_prev_state[2] = kbd_new_state[2];
+
+    _kbd_pwr_on();
+
+//    kbd_fetch_data(kbd_new_state);
+	_GetKbdState(kbd_new_state); //FF849300 
+
+    if (kbd_process() == 0){
+	// leave it alone...
+	physw_status[0] = kbd_new_state[0];
+	physw_status[1] = kbd_new_state[1];
+	physw_status[2] = kbd_new_state[2];
+    } else {
+	// override keys
+	physw_status[0] = (kbd_new_state[0] & (~KEYS_MASK0)) |
+			  (kbd_mod_state[0] & KEYS_MASK0);
+
+	physw_status[1] = (kbd_new_state[1] & (~KEYS_MASK1)) |
+			  (kbd_mod_state[1] & KEYS_MASK1);
+
+	physw_status[2] = (kbd_new_state[2] & (~KEYS_MASK2)) |
+			  (kbd_mod_state[2] & KEYS_MASK2);
+    }
+
+    _kbd_read_keys_r2(physw_status);
+
+	usb_remote_key(physw_status[USB_IDX]) ;
+
+	if (conf.remote_enable) {
+		physw_status[USB_IDX] = physw_status[USB_IDX] & ~(SD_READONLY_FLAG | USB_MASK);
+	} else {
+		physw_status[USB_IDX] = physw_status[USB_IDX] & ~SD_READONLY_FLAG;
+	}
+	
+    _kbd_pwr_off();
+	
+}
+
+void kbd_set_alt_mode_key_mask(long key)
+{
+    int i;
+    for (i=0; keymap[i].hackkey; ++i) {
+	if (keymap[i].hackkey == key) {
+	    alt_mode_key_mask = keymap[i].canonkey;
+	    alt_mode_key_reg  = keymap[i].grp;
+	    return;
+	}
+    }
+} 
+
+void kbd_key_press(long key)
+{
+    int i;
+    for (i=0;keymap[i].hackkey;i++){
+	if (keymap[i].hackkey == key){
+	    kbd_mod_state[keymap[i].grp] &= ~keymap[i].canonkey;
+	    return;
+	}
+    }
+}
+
+void kbd_key_release(long key)
+{
+    int i;
+    for (i=0;keymap[i].hackkey;i++){
+	if (keymap[i].hackkey == key){
+	    kbd_mod_state[keymap[i].grp] |= keymap[i].canonkey;
+	    return;
+	}
+    }
+}
+
+void kbd_key_release_all()
+{
+  kbd_mod_state[0] |= KEYS_MASK0;
+  kbd_mod_state[1] |= KEYS_MASK1;
+  kbd_mod_state[2] |= KEYS_MASK2;
+}
+
+long kbd_is_key_pressed(long key)
+{
+    int i;
+    for (i=0;keymap[i].hackkey;i++){
+	if (keymap[i].hackkey == key){
+	    return ((kbd_new_state[keymap[i].grp] & keymap[i].canonkey) == 0) ? 1:0;
+	}
+    }
+    return 0;
+}
+
+long kbd_is_key_clicked(long key)
+{
+    int i;
+    for (i=0;keymap[i].hackkey;i++){
+	if (keymap[i].hackkey == key){
+	    return ((kbd_prev_state[keymap[i].grp] & keymap[i].canonkey) != 0) &&
+		    ((kbd_new_state[keymap[i].grp] & keymap[i].canonkey) == 0);
+	}
+    }
+    return 0;
+}
+
+long kbd_get_pressed_key()
+{
+    int i;
+    for (i=0;keymap[i].hackkey;i++){
+	if ((kbd_new_state[keymap[i].grp] & keymap[i].canonkey) == 0){
+	    return keymap[i].hackkey;
+	}
+    }
+    return 0;
+}
+
+long kbd_get_clicked_key()
+{
+    int i;
+    for (i=0;keymap[i].hackkey;i++){
+	if (((kbd_prev_state[keymap[i].grp] & keymap[i].canonkey) != 0) &&
+	    ((kbd_new_state[keymap[i].grp] & keymap[i].canonkey) == 0)){
+	    return keymap[i].hackkey;
+	}
+    }
+    return 0;
+}
+
+void kbd_reset_autoclicked_key() {
+    last_kbd_key = 0;
+}
+
+long kbd_get_autoclicked_key() {
+    static long last_kbd_time = 0, press_count = 0;
+    register long key, t;
+
+    key=kbd_get_clicked_key();
+    if (key) {
+        last_kbd_key = key;
+        press_count = 0;
+        last_kbd_time = get_tick_count();
+        return key;
+    } else {
+        if (last_kbd_key && kbd_is_key_pressed(last_kbd_key)) {
+            t = get_tick_count();
+            if (t-last_kbd_time>((press_count)?175:500)) {
+                ++press_count;
+                last_kbd_time = t;
+                return last_kbd_key;
+            } else {
+                return 0;
+            }
+        } else {
+            last_kbd_key = 0;
+            return 0;
+        }
+    }
+	
+	
+}
+
+long kbd_use_zoom_as_mf() {
+    return 0;
+}
+
+
+static KeyMap keymap[] = {
+    /* tiny bug: key order matters. see kbd_get_pressed_key()
+     * for example
+     */
+	{ 1, KEY_UP			, 0x00100000 }, // g7
+	{ 1, KEY_DOWN		, 0x00080000 }, // g7
+	{ 1, KEY_LEFT		, 0x00010000 }, // g7
+	{ 1, KEY_RIGHT		, 0x00040000 }, // g7
+	{ 1, KEY_SET		, 0x00020000 }, // g7
+	{ 0, KEY_SHOOT_FULL	, 0xC0000000 }, // g7
+    { 0, KEY_SHOOT_FULL_ONLY, 0x80000000 },
+	{ 0, KEY_SHOOT_HALF	, 0x40000000 }, // g7
+	{ 1, KEY_ZOOM_IN	, 0x00000010 }, // g7
+	{ 1, KEY_ZOOM_OUT	, 0x00000008 }, // g7
+	{ 1, KEY_MENU		, 0x08000000 }, // g7
+	{ 1, KEY_DISPLAY	, 0x04000000 }, // g7
+	{ 1, KEY_PRINT		, 0x00001000 }, // g7
+	{ 1, KEY_ERASE		, 0x01000000 }, // g7
+	{ 1, KEY_EXPO_CORR  , 0x02000000 }, // g7
+	{ 1, KEY_MICROPHONE , 0x10000000 }, // g7
+//	{ 0, KEY_PLAY	    , 0x00020000 }, // g9
+//        { 1, KEY_DUMMY   	, 0x00000000 },//
+	{ 0, 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/reyalp-ptp-live/platform/g9/platform_camera.h
===================================================================
--- /branches/reyalp-ptp-live/platform/g9/platform_camera.h	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/g9/platform_camera.h	(revision 1668)
@@ -0,0 +1,63 @@
+// Camera - g9 - platform_camera.h
+
+// This file contains the various settings values specific to the g9 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                     2
+    #define CAM_DRYOS                       1
+
+    #define CAM_RAW_ROWPIX                  4104   // for 12 MP
+    #define CAM_RAW_ROWS                    3048   // for 12 MP
+    #define CAM_HAS_ND_FILTER               1
+    #define CAM_ADJUSTABLE_ALT_BUTTON       1
+    #undef  CAM_EMUL_KEYPRESS_DURATION
+    #define CAM_EMUL_KEYPRESS_DURATION  10
+    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 1
+    #define CAM_HAS_JOGDIAL                 1
+    #define CAM_BRACKETING                  1
+    #define CAM_MULTIPART                   1
+    #define CAM_EXT_TV_RANGE                1
+
+    // camera name
+    #define PARAM_CAMERA_NAME               4       // parameter number for GetParameterData
+
+    #define CAM_DNG_LENS_INFO               { 74,10, 444,10, 28,10, 48,10 } // See comments in camera.h
+    // pattern
+    #define cam_CFAPattern                  0x02010100 // Red  Green  Green  Blue
+    // color (alternativ: http://lclevy.free.fr/cr2/)
+    #define CAM_COLORMATRIX1                              \
+    1679727, 1000000,  422803, 1000000,  803343, 1000000, \
+     220204, 1000000, 1784845, 1000000,  -63290, 1000000, \
+    -282882, 1000000, -475034, 1000000, 4502592, 1000000
+
+    #define cam_CalibrationIlluminant1      1  // Daylight
+
+    // cropping
+    #define CAM_JPEG_WIDTH                  4000
+    #define CAM_JPEG_HEIGHT                 3000
+    #define CAM_ACTIVE_AREA_X1              52
+    #define CAM_ACTIVE_AREA_Y1              14
+    #define CAM_ACTIVE_AREA_X2              4076
+    #define CAM_ACTIVE_AREA_Y2              3030
+	
+	#define REMOTE_SYNC_STATUS_LED 	0xC022006C		// specifies an LED that turns on while camera waits for USB remote to sync
+	
+//----------------------------------------------------------
+
Index: /branches/reyalp-ptp-live/platform/g9/wrappers.c
===================================================================
--- /branches/reyalp-ptp-live/platform/g9/wrappers.c	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/g9/wrappers.c	(revision 1668)
@@ -0,0 +1,40 @@
+#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();
+}
+
+
+void camera_set_led(int led, int state, int bright)
+{ 
+        struct led_control led_c; 
+        char convert_table[11]={0,1,2,3,0,2,3,1,8,10,10};  // s3 to a710 (and a720) convert table
+
+        //char convert_table[6]={0,1,2,3,8,10};  // Test a720, values 0-5 are valid
+
+        // 0 gr  
+        // 1 red 
+        // 2 yel 
+        // 3 pw  
+        // 8 dp  
+        // 9 af  
+
+        led_c.led_num=convert_table[led%11]; 
+        led_c.action=state<=1 ? !state : state; 
+        led_c.brightness=bright; 
+        led_c.blink_count=255; 
+        _PostLEDMessage(&led_c); 
+} 
+
+
Index: /branches/reyalp-ptp-live/platform/g9/main.c
===================================================================
--- /branches/reyalp-ptp-live/platform/g9/main.c	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/g9/main.c	(revision 1668)
@@ -0,0 +1,65 @@
+#include "lolevel.h"
+#include "platform.h"
+#include "core.h"
+#include "keyboard.h"
+
+ 
+
+extern long link_bss_start;
+extern long link_bss_end;
+extern void boot();
+
+
+void startup()
+{
+    long *bss = &link_bss_start;
+    long *ptr;
+
+    // sanity check
+    if ((long)&link_bss_end > (MEMISOSTART + MEMISOSIZE)){
+	started();
+	shutdown();
+    }
+
+    // initialize .bss senment
+    while (bss<&link_bss_end)
+	*bss++ = 0;
+
+    boot();
+}
+
+
+static const int fl_tbl[] = {7400, 8210, 9040, 9860, 10670, 12730, 14780, 16820, 18890, 21970, 25030, 29170, 36780, 44400};
+#define NUM_FL (sizeof(fl_tbl)/sizeof(fl_tbl[0]))
+#define CF_EFL 47297
+
+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];
+}
+
+
+long get_vbatt_min()
+{
+    return 7000;
+}
+
+long get_vbatt_max()
+{
+    return 8300;
+}
+
+
Index: /branches/reyalp-ptp-live/platform/g9/notes.txt
===================================================================
--- /branches/reyalp-ptp-live/platform/g9/notes.txt	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/g9/notes.txt	(revision 1668)
@@ -0,0 +1,11 @@
+****************************************
+
+Camera depending notes: 
+
+- G9 uses Propset 2 of Properties (see http://tinyurl.com/6zbv9b)
+- dryos camera
+- G9 has adjustable alt-button
+- G9 supports Multipartition
+- G9 has an ND Filter AND real iris diaphragm (which can be set via photo overrides)
+- 100g and 100f are the same, development is done in the 100g tree
+- 100i and 100h basically are the same, development is done in the 100i tree
Index: /branches/reyalp-ptp-live/platform/g9/lib.c
===================================================================
--- /branches/reyalp-ptp-live/platform/g9/lib.c	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/g9/lib.c	(revision 1668)
@@ -0,0 +1,53 @@
+#include "platform.h"
+
+void shutdown()
+{
+    volatile long *p = (void*)0xc022006C;
+        
+    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 0xC022006C //used iso blue, was 0xc02200C4  //a650- 0xc02200C4
+
+
+void debug_led(int state)
+{
+    volatile long *p=(void*)LED_PR;
+    if (state)
+	p[0]=0x46;
+    else
+	p[0]=0x44;
+}
+
+#define LED_BASE 0xc0220080
+#define LED_AF 0xC0220094//was 0xc0220080 //a650- 0xc0220080//from g7
+
+void camera_set_led1(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_BASE + leds[led-4];
+    if (state)
+	p[0]=0x46;
+    else
+	p[0]=0x44;
+}
+
+
+int get_flash_params_count(void){
+ return 114;	//++  FF956AEC
+}
+
+int Get_JogDial(void){
+ return (*(int*)0xC0220304)>>16;
+}
Index: /branches/reyalp-ptp-live/platform/g9/sub/100d/capt_seq.c
===================================================================
--- /branches/reyalp-ptp-live/platform/g9/sub/100d/capt_seq.c	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/g9/sub/100d/capt_seq.c	(revision 1668)
@@ -0,0 +1,1027 @@
+#include "lolevel.h"
+#include "platform.h"
+#include "core.h"
+
+static long *nrflag = (long*)0xE618;
+
+#include "../../../generic/capt_seq.c"
+
+
+
+
+//ok
+void __attribute__((naked,noinline)) task_CaptSeqTask_my() //#fs  //FF861210
+{
+	asm volatile (
+                "STMFD   SP!, {R3-R9,LR}\n"
+                "LDR     R6, =0x1E454\n"
+                "LDR     R5, =0x583C\n"
+                "MOV     R9, #1\n"
+                "MOV     R7, #0\n"
+"loc_FF861224:\n"
+                "LDR     R0, [R5,#0x14]\n"
+                "MOV     R2, #0\n"
+                "MOV     R1, SP\n"
+                "BL      sub_FF829FB0\n"
+                "TST     R0, #1\n"
+                "BEQ     loc_FF861250\n"
+                "LDR     R1, =0x43F\n"
+                "LDR     R0, =0xFF860C6C\n" 	// aSsshoottask_c 
+                "BL      sub_FF81BFC8\n"    	// DebugAssert
+                "BL      sub_FF81BD80\n"    	// ExitTask 
+                "LDMFD   SP!, {R3-R9,PC}\n"
+"loc_FF861250:\n"
+                "LDR     R0, [SP]\n"
+                "LDR     R1, [R0]\n"
+
+                "LDR     R2, =0x1850\n"         //NOT  IN  G9...!!! Save jumptable-target ...
+                "STR     R1, [R2]\n"            //NOT  IN  G9...!!! ...to some unused space. Read and displayed in GUI in core/gui.c
+
+                "CMP     R1, #0x1C\n"
+                "ADDLS   PC, PC, R1,LSL#2\n"
+                "B       loc_FF8614AC\n"        // 0: error handler (invalid jump offset) (also when shutter half-pressed?) was FFC4CD80
+                "B       loc_FF8612D8\n"        // 1: immediately after shutter release, !modify this one!
+                "B       loc_FF861348\n"		// 2:
+                "B       loc_FF861350\n"        // 3: default if shutter not pressed
+                "B       loc_FF861368\n"        // 4: after shutter release, when timed image preview active
+                "B       loc_FF86135C\n"        // 5: after shutter release, in detailed image review
+                "B       loc_FF861370\n"		// 6:
+                "B       loc_FF861378\n"		// 7:
+                "B       loc_FF861380\n"		// 8:
+                "B       loc_FF8613D8\n"        // 9: also ends with continuation of #1
+                "B       loc_FF8613E4\n"        // 10:
+                "B       loc_FF8613EC\n"        // 11:
+                "B       loc_FF8613F4\n"        // 12:
+                "B       loc_FF8613FC\n"        // 13:
+                "B       loc_FF861404\n"        // 14:
+                "B       loc_FF86140C\n"        // 15: in image-viewer
+                "B       loc_FF861414\n"        // 16:
+                "B       loc_FF86141C\n"        // 17:
+                "B       loc_FF861424\n"        // 18:
+                "B       loc_FF86142C\n"        // 19:
+                "B       loc_FF861434\n"        // 20:
+                "B       loc_FF86143C\n"        // 21:
+                "B       loc_FF861444\n"        // 22:               
+				"B       loc_FF861450\n"        // 23:
+				"B       loc_FF86145C\n"        // 24:
+				"B       loc_FF861464\n"        // 25:
+				"B       loc_FF861494\n"        // 26:
+				"B       loc_FF86149C\n"        // 27:
+				"B       loc_FF8614A4\n"        // 28:
+				"B       loc_FF8614B8\n"        // 29:				
+"loc_FF8612D8:\n"
+                "BL      sub_FF942414\n"
+                "BL      shooting_expo_param_override\n"  // chdk  + add NEW str   !!!  ------------------
+                "BL      sub_FF85F050\n"
+                "LDR     R0, [R6,#0x24]\n"
+                "CMP     R0, #0\n"
+                "BEQ     loc_FF8614B8\n"
+                "BL      sub_FF860938\n"
+                "MOV     R4, R0\n"
+                "LDR     R0, [R6,#0x24]\n"
+                "CMP     R0, #0\n"
+                "BEQ     loc_FF861320\n"
+                "MOV     R0, #0xC\n"
+                "BL      sub_FF86499C\n"
+                "TST     R0, #1\n"
+                "STRNE   R9, [R5,#4]\n"
+                "LDRNE   R0, [R4,#8]\n"
+                "ORRNE   R0, R0, #0x40000000\n"
+                "STRNE   R0, [R4,#8]\n"
+                "BNE     loc_FF8614B8\n"
+"loc_FF861320:\n"
+                "MOV     R0, R4\n"
+                "BL      sub_FF943EB0\n"
+                "BL      sub_FF957BD8\n"
+                "BL      sub_FF86F8F8\n"
+                "STR     R0, [R4,#0x14]\n"
+                "MOV     R0, R4\n"
+                //"BL      sub_FF944478\n"
+                "BL      sub_FF944408_my\n"		// ----------->
+                "BL      capt_seq_hook_raw_here\n"      // ++
+                "TST     R0, #1\n"
+                "STRNE   R9, [R5,#4]\n"
+                "B       loc_FF8614B8\n"
+				
+				
+				
+"loc_FF861348:\n"
+                //"BL      sub_FF860CEC\n"
+                "BL      sub_FF860CEC_my\n"
+                "B       loc_FF861360\n"
+				
+				
+"loc_FF861350:\n"
+                "MOV     R0, #1\n"
+                "BL      sub_FF942614\n" 	  //"BL      sub_FF942614_my\n" ????????	//---------->
+                "B       loc_FF8614B8\n"
+				
+				
+"loc_FF86135C:\n"
+                "BL      sub_FF942110\n"
+"loc_FF861360:\n"
+                "STR     R7, [R6,#0x24]\n"
+                "B       loc_FF8614B8\n"
+				
+				
+"loc_FF861368:\n"
+                "BL      sub_FF9423A8\n"
+                "B       loc_FF861360\n"
+				
+"loc_FF861370:\n"
+                "BL      sub_FF9423B0\n"
+                "B       loc_FF8614B8\n"
+				
+				
+"loc_FF861378:\n"
+                "BL      sub_FF942504\n"
+                "B       loc_FF8613DC\n"
+"loc_FF861380:\n"
+                "LDR     R4, [R0,#0xC]\n"
+                "BL      sub_FF9423B8\n" 	//UiEvnt_StartDisguiseCradleStatus_4
+                "MOV     R0, R4\n"
+                "BL      sub_FF942F48\n"
+                "TST     R0, #1\n"
+                "MOV     R8, R0\n"
+                "BNE     loc_FF8613C0\n"
+                "BL      sub_FF86F8F8\n"
+                "STR     R0, [R4,#0x14]\n"
+                "MOV     R0, R4\n"
+                "BL      sub_FF944320\n"
+                "MOV     R0, R4\n"
+                "BL      sub_FF944914\n"
+                "MOV     R8, R0\n"
+                "LDR     R0, [R4,#0x14]\n"
+                "BL      sub_FF86FB0C\n"
+"loc_FF8613C0:\n"
+                "BL      sub_FF9423A8\n"
+                "MOV     R2, R4\n"
+                "MOV     R1, #8\n"
+                "MOV     R0, R8\n"
+                "BL      sub_FF85F620\n"
+                "B       loc_FF8614B8\n"
+"loc_FF8613D8:\n"
+                "BL      sub_FF942590\n"
+"loc_FF8613DC:\n"
+                "BL      sub_FF85F050\n"
+                "B       loc_FF8614B8\n"
+"loc_FF8613E4:\n"
+                "BL      sub_FF9423A8\n"
+                "B       loc_FF8614B8\n"
+"loc_FF8613EC:\n"
+                "BL      sub_FF9431C0\n"
+                "B       loc_FF8614B8\n"
+"loc_FF8613F4:\n"
+                "BL      sub_FF9433BC\n"
+                "B       loc_FF8614B8\n"
+"loc_FF8613FC:\n"
+                "BL      sub_FF943450\n"
+                "B       loc_FF8614B8\n"
+"loc_FF861404:\n"
+                "BL      sub_FF943578\n"
+                "B       loc_FF8614B8\n"
+"loc_FF86140C:\n"
+                "BL      sub_FF94362C\n"
+                "B       loc_FF8614B8\n"
+"loc_FF861414:\n"
+                "BL      sub_FF943A00\n"
+                "B       loc_FF8614B8\n"
+"loc_FF86141C:\n"
+                "BL      sub_FF943A50\n"
+                "B       loc_FF8614B8\n"
+"loc_FF861424:\n"
+                "MOV     R0, #0\n"
+                "B       loc_FF861448\n"
+"loc_FF86142C:\n"
+                "BL      sub_FF943BF4\n"
+                "B       loc_FF8614B8\n"
+"loc_FF861434:\n"
+                "BL      sub_FF943C88\n"
+                "B       loc_FF8614B8\n"
+"loc_FF86143C:\n"
+                "BL      sub_FF943D48\n"
+                "B       loc_FF8614B8\n"
+"loc_FF861444:\n"
+                "MOV     R0, #1\n"
+"loc_FF861448:\n"
+                "BL      sub_FF943AB4\n"
+                "B       loc_FF8614B8\n"
+"loc_FF861450:\n"
+                "BL      sub_FF9427B0\n"
+                "BL      sub_FF8615D0\n"
+                "B       loc_FF8614B8\n"
+"loc_FF86145C:\n"
+                "BL      sub_FF9438A4\n"
+                "B       loc_FF8614B8\n"
+"loc_FF861464:\n"
+                "MOV     R2, #2\n"
+                "ADD     R1, R6, #0x58\n"
+                "MOV     R0, #0x6F\n"
+                "BL      sub_FF86F768\n" 	//PT_GetPropertyCaseString
+                "TST     R0, #1\n"
+                "LDRNE   R1, =0x502\n"
+                "LDRNE   R0, =0xFF860C6C\n" 	// aSsshoottask_c
+                "BLNE    sub_FF81BFC8\n" 		// DebugAssert
+                "LDRH    R0, [R6,#0x58]\n"
+                "CMP     R0, #1\n"
+                "BLEQ    sub_FF943898\n"
+                "B       loc_FF8614B8\n"
+"loc_FF861494:\n"
+                "BL      sub_FF943968\n"
+                "B       loc_FF8614B8\n"
+"loc_FF86149C:\n"
+                "BL      sub_FF860BD0\n"
+                "B       loc_FF8614B8\n"
+"loc_FF8614A4:\n"
+                "BL      sub_FF826210\n"
+                "B       loc_FF8614B8\n"
+"loc_FF8614AC:\n"
+                "LDR     R1, =0x523\n"
+                "LDR     R0, =0xFF860C6C\n" 	// aSsshoottask_c
+                "BL      sub_FF81BFC8\n" 		// DebugAssert       
+"loc_FF8614B8:\n"
+                "LDR     R0, [SP]\n"
+                "LDR     R1, [R0,#4]\n"
+                "LDR     R0, [R5,#0x10]\n"
+                "BL      sub_FF829D2C\n"
+                "LDR     R4, [SP]\n"
+                "LDR     R0, [R4,#8]\n"
+                "CMP     R0, #0\n"
+                "LDREQ   R0, =0xFF860C6C\n" 	// aSsshoottask
+                "MOVEQ   R1, #0xFC\n"
+                "BLEQ    sub_FF81BFC8\n" 		// DebugAssert
+                "STR     R7, [R4,#8]\n"
+                "B       loc_FF861224\n"
+    );
+} //#fe
+
+
+//ok
+void __attribute__((naked,noinline)) sub_FF860CEC_my(){ // 
+ asm volatile(
+                "STMFD   SP!, {R3-R9,LR}\n"
+                "LDR     R4, [R0,#0xC]\n"
+                "LDR     R5, =0x1E454\n"
+                "LDR     R0, [R4,#8]\n"
+                "LDR     R6, =0x820A\n"
+                "ORR     R0, R0, #1\n"
+                "STR     R0, [R4,#8]\n"
+                "LDRH    R0, [R5]\n"
+                "LDR     R8, =0x583C\n"
+                "MOV     R7, #0\n"
+                "CMP     R0, R6\n"
+                "BEQ     loc_FF860D90\n"
+                "LDRH    R0, [R5,#0x86]\n"
+                "CMP     R0, #3\n"
+                "BEQ     loc_FF860DF0\n"
+                "LDR     R0, [R4,#0xC]\n"
+                "CMP     R0, #1\n"
+                "BLS     loc_FF860D9C\n"
+                "LDRH    R0, [R5,#0x84]\n"
+                "CMP     R0, #0\n"
+                "BNE     loc_FF860DF0\n"
+                "LDRH    R0, [R5,#0x80]\n"
+                "CMP     R0, #2\n"
+                "BNE     loc_FF860DA8\n"
+                "BL      sub_FF942864\n"
+                "LDRH    R0, [R5]\n"
+                "CMP     R0, R6\n"
+                "BEQ     loc_FF860D90\n"
+                "LDRH    R0, [R5,#0x86]\n"
+                "CMP     R0, #3\n"
+                "BEQ     loc_FF860DF0\n"
+                "LDR     R0, [R4,#0xC]\n"
+                "CMP     R0, #1\n"
+                "BLS     loc_FF860D9C\n"
+                "LDRH    R0, [R5,#0x84]\n"
+                "CMP     R0, #0\n"
+                "BNE     loc_FF860DF0\n"
+                "LDRH    R0, [R5,#0x80]\n"
+                "CMP     R0, #2\n"
+                "BEQ     loc_FF860DD4\n"
+                "B       loc_FF860DA8\n"
+"loc_FF860D90:\n"
+                "LDRH    R0, [R5,#0x86]\n"
+                "CMP     R0, #3\n"
+                "BEQ     loc_FF860DF0\n"
+"loc_FF860D9C:\n"
+                "LDRH    R0, [R5,#0x84]\n"
+                "CMP     R0, #0\n"
+                "BNE     loc_FF860DF0\n"
+"loc_FF860DA8:\n"
+                "LDRH    R0, [R5,#0x80]\n"
+                "CMP     R0, #1\n"
+                "BNE     loc_FF860DF0\n"
+                "LDRH    R0, [R5]\n"
+                "CMP     R0, R6\n"
+                "LDRNE   R0, [R4,#0xC]\n"
+                "CMPNE   R0, #1\n"
+                "BLS     loc_FF860DF0\n"
+                "LDR     R0, [R4,#0x10]\n"
+                "CMP     R0, #1\n"
+                "BNE     loc_FF860DF0\n"
+"loc_FF860DD4:\n"
+                "LDR     R3, =0x20D\n"
+                "LDR     R2, =0xEA60\n"
+                "STR     R3, [SP]\n"
+                "LDR     R0, [R8,#0x10]\n"
+                "LDR     R3, =0xFF860C6C\n"		//aSsshoottask_c 
+                "MOV     R1, #0x40000000\n"
+                "BL      sub_FF864D24\n"
+"loc_FF860DF0:\n"
+                "BL      sub_FF860BD0\n"
+                "LDR     R0, [R5,#0x24]\n"
+                "CMP     R0, #0\n"
+                "MOVEQ   R0, #2\n"
+                "BLEQ    sub_FF85B94C\n"
+                "BL      sub_FF9423B8\n"		//UiEvnt_StartDisguiseCradleStatus_4
+                "LDR     R0, [R5,#0x24]\n"
+                "CMP     R0, #0\n"
+                "BNE     loc_FF860E60\n"
+                "MOV     R0, R4\n"
+                "BL      sub_FF943EB0\n"
+                "MOV     R0, R4\n"
+                "BL      sub_FF942B20\n"
+                "TST     R0, #1\n"
+                "MOVNE   R2, R4\n"
+                "LDMNEFD SP!, {R3-R9,LR}\n"
+                "MOVNE   R1, #1\n"
+                "BNE     sub_FF85F620\n"
+                "BL      sub_FF957BD8\n"
+
+//				"BL      shooting_expo_param_override\n"  // +-----------> Override Canon stuff :)
+
+                "BL      sub_FF86F8F8\n"
+                "STR     R0, [R4,#0x14]\n"
+                "MOV     R0, R4\n"
+                "BL      sub_FF944320\n"
+                "BL      sub_FF944E60\n"
+                "MOV     R0, R4\n"
+                //"BL      sub_FF944478\n"	// This is where shooting AND darkframe sub is done
+                "BL      sub_FF944408_my\n"	// so hook it
+                "MOV     R7, R0\n"
+
+                "BL      capt_seq_hook_raw_here\n" // +-----------> Capture RAW, camera already did badpixel-sub (always) though some pixels are still there
+
+				"B       loc_FF860E6C\n"
+"loc_FF860E60:\n"
+                "LDR     R0, [R8,#4]\n"
+                "CMP     R0, #0\n"
+                "MOVNE   R7, #0x1D\n"
+"loc_FF860E6C:\n"
+                "MOV     R2, R4\n"
+                "MOV     R1, #1\n"
+                "MOV     R0, R7\n"
+                "BL      sub_FF85F620\n"
+                "BL      sub_FF9448B4\n"
+                "CMP     R0, #0\n"
+                "LDRNE   R0, [R4,#8]\n"
+                "ORRNE   R0, R0, #0x2000\n"
+                "STRNE   R0, [R4,#8]\n"
+                "LDRH    R0, [R5,#0x86]\n"
+                "CMP     R0, #3\n"
+                "BEQ     locret_FF860EB8\n"
+                "LDRH    R0, [R5,#0x84]\n"
+                "CMP     R0, #0\n"
+                "LDREQH  R0, [R5,#0x80]\n"
+                "CMPEQ   R0, #2\n"
+                "MOVEQ   R0, R4\n"
+                "LDMEQFD SP!, {R3-R9,LR}\n"
+                "BEQ     sub_FF9428B8\n"
+"locret_FF860EB8:\n"
+                "LDMFD   SP!, {R3-R9,PC}\n"
+
+ 
+ );
+}
+
+
+//ok
+void __attribute__((naked,noinline)) sub_FF944408_my(){ // 
+ asm volatile(
+                "STMFD   SP!, {R0-R10,LR}\n"
+                "MOV     R6, #0\n"
+                "MOV     R4, R0\n"
+                "BL      sub_FF944FCC\n"
+                //"MOVL    R1, 0xFFFFFFFF\n"
+				"MVN     R1, #0\n"		//chdk
+                 "BL      sub_FF829D60\n"
+                "MOV     R2, #4\n"
+                "ADD     R1, SP, #0x30-0x28\n"
+                "MOV     R0, #0x8A\n"
+                "BL      sub_FF86F768\n"		//PT_GetPropertyCaseString
+                "TST     R0, #1\n"
+                "LDRNE   R1, =0x20A\n"
+                "LDRNE   R0, =0xFF944610\n"	//aSscaptureseq_c 
+                "BLNE    sub_FF81BFC8\n"		//DebugAssert
+                "LDR     R8, =0x1E508\n"
+                "LDR     R5, =0x1E454\n"
+                "LDRSH   R1, [R8,#0xE]\n"
+                "LDR     R0, [R5,#0x7C]\n"
+                //"BL      nullsub_78\n"
+                "BL      sub_FF84BE78\n"		//GetCCDTemperature
+                "LDR     R2, =0xE61C\n"
+                "ADD     R3, R4, #0x8C\n"
+                "STRH    R0, [R4,#0x88]\n"
+//          	"STRD    R2, [SP,#0x28-0x28]\n"  // WORKSFORME, configure gcc WITHOUT --with-cpu=arm9
+				"STR    R2, [SP,#0x28-0x28]\n"     // Though use the old, 2-line version
+				"STR    R3, [SP,#0x28-0x24]\n"     // for the final until everyone uses 'new' gcc
+                "MOV     R1, R0\n"
+                "LDRH    R0, [R5,#0x54]\n"
+                "LDRSH   R2, [R8,#0xC]\n"
+                "LDR     R3, =0xE618\n"
+                "BL      sub_FF9454C0\n"	// 2 (NR) is set into 0xE618 in this sub! Still before shooting				
+               
+                "BL      wait_until_remote_button_is_released\n"
+                "BL      capt_seq_hook_set_nr\n" // +-----------> so immediately override NR               
+				
+                "LDR     R0, [R4,#0x18]\n"
+                "LDR     R7, =0xE618\n"
+                "CMP     R0, #0\n"
+                "MOV     R9, #1\n"
+                "BEQ     loc_FF94449C\n"
+                "LDR     R0, [R7]\n"
+                "CMP     R0, #2\n"
+                "STREQ   R9, [R7]\n"
+               
+"loc_FF94449C:\n"
+				"B		sub_FF94449C\n"
+	
+ );
+}
+
+
+void __attribute__((naked,noinline)) exp_drv_task(){
+ asm volatile(
+"                STMFD   SP!, {R4-R8,LR}\n"
+"                SUB     SP, SP, #0x20\n"
+"                LDR     R8, =0xBB8\n"
+"                LDR     R7, =0x7270\n"
+"                LDR     R5, =0x462E8\n"
+"                MOV     R0, #0\n"
+"                ADD     R6, SP, #0x10\n"
+"                STR     R0, [SP,#0xC]\n"
+"loc_FF8B8BB0:\n"
+"                LDR     R0, [R7,#0x20]\n"
+"                MOV     R2, #0\n"
+"                ADD     R1, SP, #0x1C\n"
+"                BL      sub_FF829FB0\n" // KerQueue.c 0
+"                LDR     R0, [SP,#0xC]\n"
+"                CMP     R0, #1\n"
+"                BNE     loc_FF8B8BF8\n"
+"                LDR     R0, [SP,#0x1C]\n"
+"                LDR     R0, [R0]\n"
+"                CMP     R0, #0x13\n"
+"                CMPNE   R0, #0x14\n"
+"                CMPNE   R0, #0x15\n"
+"                BEQ     loc_FF8B8D78\n"
+"                CMP     R0, #0x26\n"
+"                BEQ     loc_FF8B8CE4\n"
+"                ADD     R1, SP, #0xC\n"
+"                MOV     R0, #0\n"
+"                BL      sub_FF8B8B40\n" // ExpDrv.c 512
+"loc_FF8B8BF8:\n"
+"                LDR     R0, [SP,#0x1C]\n"
+"                LDR     R1, [R0]\n"
+"                CMP     R1, #0x2B\n"
+"                BNE     loc_FF8B8C28\n"
+"                LDR     R0, [SP,#0x1C]\n"
+"                BL      sub_FF8B9E70\n" // ExpDrv.c 0
+"                LDR     R0, [R7,#0x1C]\n"
+"                MOV     R1, #1\n"
+"                BL      sub_FF829D2C\n"
+"                BL      sub_FF81BD80\n"
+"                ADD     SP, SP, #0x20\n"
+"                LDMFD   SP!, {R4-R8,PC}\n"
+"loc_FF8B8C28:\n"
+"                CMP     R1, #0x2A\n"
+"                BNE     loc_FF8B8C44\n"
+"                LDR     R2, [R0,#0x88]!\n"
+"                LDR     R1, [R0,#4]\n"
+"                MOV     R0, R1\n"
+"                BLX     R2\n"
+"                B       loc_FF8B91DC\n"
+"loc_FF8B8C44:\n"
+"                CMP     R1, #0x24\n"
+"                BNE     loc_FF8B8C94\n"
+"                LDR     R0, [R7,#0x1C]\n"
+"                MOV     R1, #0x80\n"
+"                BL      sub_FF829D60\n"
+"                LDR     R0, =0xFF8B562C\n"
+"                MOV     R1, #0x80\n"
+"                BL      sub_FF93626C\n" // IrisController.c 104 done
+"                LDR     R0, [R7,#0x1C]\n"
+"                MOV     R2, R8\n"
+"                MOV     R1, #0x80\n"
+"                BL      sub_FF829C64\n" // KerFlag.c 0
+"                TST     R0, #1\n"
+"                LDRNE   R1, =0xD07\n"
+"                BNE     loc_FF8B8D54\n"
+"loc_FF8B8C80:\n"
+"                LDR     R1, [SP,#0x1C]\n"
+"                LDR     R0, [R1,#0x8C]\n"
+"                LDR     R1, [R1,#0x88]\n"
+"                BLX     R1\n"
+"                B       loc_FF8B91DC\n"
+"loc_FF8B8C94:\n"
+"                CMP     R1, #0x25\n"
+"                BNE     loc_FF8B8CDC\n"
+"                ADD     R1, SP, #0xC\n"
+"                BL      sub_FF8B8B40\n" // ExpDrv.c 512
+"                LDR     R0, [R7,#0x1C]\n"
+"                MOV     R1, #0x100\n"
+"                BL      sub_FF829D60\n"
+"                MOV     R1, #0x100\n"
+"                LDR     R0, =0xFF8B563C\n"
+"                BL      sub_FF936A2C\n" // IrisController.c 0 done
+"                LDR     R0, [R7,#0x1C]\n"
+"                MOV     R2, R8\n"
+"                MOV     R1, #0x100\n"
+"                BL      sub_FF829C64\n" // KerFlag.c 0
+"                TST     R0, #1\n"
+"                BEQ     loc_FF8B8C80\n"
+"                LDR     R1, =0xD11\n"
+"                B       loc_FF8B8D54\n"
+"loc_FF8B8CDC:\n"
+"                CMP     R1, #0x26\n"
+"                BNE     loc_FF8B8CF4\n"
+"loc_FF8B8CE4:\n"
+"                LDR     R0, [SP,#0x1C]\n"
+"                ADD     R1, SP, #0xC\n"
+"                BL      sub_FF8B8B40\n" // ExpDrv.c 512
+"                B       loc_FF8B8C80\n"
+"loc_FF8B8CF4:\n"
+"                CMP     R1, #0x27\n"
+"                CMPNE   R1, #0x28\n"
+"                BNE     loc_FF8B8D60\n"
+"                ADD     R1, SP, #0xC\n"
+"                BL      sub_FF8B8B40\n" // ExpDrv.c 512
+"                LDR     R4, [SP,#0x1C]\n"
+"                LDR     R0, [R7,#0x1C]\n"
+"                MOV     R1, #0x40\n"
+"                BL      sub_FF829D60\n"
+"                LDR     R0, [R4]\n"
+"                MOV     R1, #0x40\n"
+"                CMP     R0, #0x27\n"
+"                LDR     R0, =0xFF8B56A0\n"
+"                BNE     loc_FF8B8D34\n"
+"                BL      sub_FF93630C\n" // IrisController.c 125 done
+"                B       loc_FF8B8D38\n"
+"loc_FF8B8D34:\n"
+"                BL      sub_FF936398\n" // IrisController.c 143 done
+"loc_FF8B8D38:\n"
+"                LDR     R0, [R7,#0x1C]\n"
+"                MOV     R2, R8\n"
+"                MOV     R1, #0x40\n"
+"                BL      sub_FF829C64\n" // KerFlag.c 0
+"                TST     R0, #1\n"
+"                BEQ     loc_FF8B8C80\n"
+"                LDR     R1, =0xD1F\n"
+"loc_FF8B8D54:\n"
+"                LDR     R0, =0xFF8B5D3C\n"
+"                BL      sub_FF81BFC8\n"
+"                B       loc_FF8B8C80\n"
+"loc_FF8B8D60:\n"
+"                CMP     R1, #0x29\n"
+"                BNE     loc_FF8B8D78\n"
+"                BL      sub_FF897664\n" // Shutter.c 2
+"                BL      sub_FF8983E4\n" // ImgPixel.c 292
+"                BL      sub_FF897EA4\n" // ImgGain.c 0
+"                B       loc_FF8B8C80\n"
+"loc_FF8B8D78:\n"
+"                LDR     R0, [SP,#0x1C]\n"
+"                MOV     R4, #1\n"
+"                LDR     R1, [R0]\n"
+"                CMP     R1, #0x11\n"
+"                CMPNE   R1, #0x12\n"
+"                BNE     loc_FF8B8DE8\n"
+"                LDR     R1, [R0,#0x7C]\n"
+"                ADD     R1, R1, R1,LSL#1\n"
+"                ADD     R1, R0, R1,LSL#2\n"
+"                SUB     R1, R1, #8\n"
+"                LDMIA   R1, {R2-R4}\n"
+"                STMIA   R6, {R2-R4}\n"
+"                BL      sub_FF8B76BC\n" // ExpDrv.c 2
+"                LDR     R0, [SP,#0x1C]\n"
+"                LDR     R1, [R0,#0x7C]\n"
+"                LDR     R3, [R0,#0x88]\n"
+"                LDR     R2, [R0,#0x8C]\n"
+"                ADD     R0, R0, #4\n"
+"                BLX     R3\n"
+"                LDR     R0, [SP,#0x1C]\n"
+"                BL      sub_FF8BA244\n" // ExpDrv.c 4
+"                LDR     R0, [SP,#0x1C]\n"
+"                LDR     R1, [R0,#0x7C]\n"
+"                LDR     R3, [R0,#0x90]\n"
+"                LDR     R2, [R0,#0x94]\n"
+"                ADD     R0, R0, #4\n"
+"                BLX     R3\n"
+"                B       loc_FF8B911C\n"
+"loc_FF8B8DE8:\n"
+"                CMP     R1, #0x13\n"
+"                CMPNE   R1, #0x14\n"
+"                CMPNE   R1, #0x15\n"
+"                BNE     loc_FF8B8E9C\n"
+"                ADD     R3, SP, #0xC\n"
+"                MOV     R2, SP\n"
+"                ADD     R1, SP, #0x10\n"
+"                BL      sub_FF8B7904\n" // ExpDrv.c 4
+"                CMP     R0, #1\n"
+"                MOV     R4, R0\n"
+"                CMPNE   R4, #5\n"
+"                BNE     loc_FF8B8E38\n"
+"                LDR     R0, [SP,#0x1C]\n"
+"                MOV     R2, R4\n"
+"                LDR     R1, [R0,#0x7C]!\n"
+"                LDR     R12, [R0,#0xC]!\n"
+"                LDR     R3, [R0,#4]\n"
+"                MOV     R0, SP\n"
+"                BLX     R12\n"
+"                B       loc_FF8B8E70\n"
+"loc_FF8B8E38:\n"
+"                LDR     R0, [SP,#0x1C]\n"
+"                CMP     R4, #2\n"
+"                LDR     R3, [R0,#0x8C]\n"
+"                CMPNE   R4, #6\n"
+"                BNE     loc_FF8B8E84\n"
+"                LDR     R12, [R0,#0x88]\n"
+"                MOV     R0, SP\n"
+"                MOV     R2, R4\n"
+"                MOV     R1, #1\n"
+"                BLX     R12\n"
+"                LDR     R0, [SP,#0x1C]\n"
+"                MOV     R2, SP\n"
+"                ADD     R1, SP, #0x10\n"
+"                BL      sub_FF8B888C\n" // ExpDrv.c 4
+"loc_FF8B8E70:\n"
+"                LDR     R0, [SP,#0x1C]\n"
+"                LDR     R2, [SP,#0xC]\n"
+"                MOV     R1, R4\n"
+"                BL      sub_FF8B8AE0\n" // ExpDrv.c 2
+"                B       loc_FF8B911C\n"
+"loc_FF8B8E84:\n"
+"                LDR     R1, [R0,#0x7C]\n"
+"                LDR     R12, [R0,#0x88]\n"
+"                ADD     R0, R0, #4\n"
+"                MOV     R2, R4\n"
+"                BLX     R12\n"
+"                B       loc_FF8B911C\n"
+"loc_FF8B8E9C:\n"
+"                CMP     R1, #0x20\n"
+"                CMPNE   R1, #0x21\n"
+"                BNE     loc_FF8B8EE8\n"
+"                LDR     R1, [R0,#0x7C]\n"
+"                ADD     R1, R1, R1,LSL#1\n"
+"                ADD     R1, R0, R1,LSL#2\n"
+"                SUB     R1, R1, #8\n"
+"                LDMIA   R1, {R2-R4}\n"
+"                STMIA   R6, {R2-R4}\n"
+"                BL      sub_FF8B6C40\n" // ExpDrv.c 4
+"                LDR     R0, [SP,#0x1C]\n"
+"                LDR     R1, [R0,#0x7C]\n"
+"                LDR     R3, [R0,#0x88]\n"
+"                LDR     R2, [R0,#0x8C]\n"
+"                ADD     R0, R0, #4\n"
+"                BLX     R3\n"
+"                LDR     R0, [SP,#0x1C]\n"
+"                BL      sub_FF8B6F3C\n" // ExpDrv.c 4
+"                B       loc_FF8B911C\n"
+"loc_FF8B8EE8:\n"
+"                ADD     R1, R0, #4\n"
+"                LDMIA   R1, {R2,R3,R12}\n"
+"                STMIA   R6, {R2,R3,R12}\n"
+"                LDR     R1, [R0]\n"
+"                CMP     R1, #0x23\n"
+"                ADDLS   PC, PC, R1,LSL#2\n"
+"                B       loc_FF8B90FC\n"
+"                B       loc_FF8B8F94\n"
+"                B       loc_FF8B8F94\n"
+"                B       loc_FF8B8FE4\n"
+"                B       loc_FF8B8FEC\n"
+"                B       loc_FF8B8FEC\n"
+"                B       loc_FF8B8FEC\n"
+"                B       loc_FF8B8F94\n"
+"                B       loc_FF8B8FE4\n"
+"                B       loc_FF8B8FEC\n"
+"                B       loc_FF8B8FEC\n"
+"                B       loc_FF8B9004\n"
+"                B       loc_FF8B9004\n"
+"                B       loc_FF8B90F0\n"
+"                B       loc_FF8B90F8\n"
+"                B       loc_FF8B90F8\n"
+"                B       loc_FF8B90F8\n"
+"                B       loc_FF8B90F8\n"
+"                B       loc_FF8B90FC\n"
+"                B       loc_FF8B90FC\n"
+"                B       loc_FF8B90FC\n"
+"                B       loc_FF8B90FC\n"
+"                B       loc_FF8B90FC\n"
+"                B       loc_FF8B8FF4\n"
+"                B       loc_FF8B8FFC\n"
+"                B       loc_FF8B8FFC\n"
+"                B       loc_FF8B9010\n"
+"                B       loc_FF8B9018\n"
+"                B       loc_FF8B9048\n"
+"                B       loc_FF8B9078\n"
+"                B       loc_FF8B90A8\n"
+"                B       loc_FF8B90D8\n"
+"                B       loc_FF8B90D8\n"
+"                B       loc_FF8B90FC\n"
+"                B       loc_FF8B90FC\n"
+"                B       loc_FF8B90E0\n"
+"                B       loc_FF8B90E8\n"
+"loc_FF8B8F94:\n"
+// jumptable FF8B8EFC entries 0,1,6
+"                BL      sub_FF8B5B24\n" // ExpDrv.c 2
+"                B       loc_FF8B90FC\n"
+"loc_FF8B8FE4:\n"
+// jumptable FF8B8EFC entries 2,7
+"                BL      sub_FF8B5DAC\n" // ExpDrv.c 4
+"                B       loc_FF8B90FC\n"
+"loc_FF8B8FEC:\n"
+// jumptable FF8B8EFC entries 3-5,8,9
+"                BL      sub_FF8B5FB0\n" // ExpDrv.c 940
+"                B       loc_FF8B90FC\n"
+"loc_FF8B8FF4:\n"
+// jumptable FF8B8EFC entry 22
+"                BL      sub_FF8B6218\n" // ExpDrv.c 1072
+"                B       loc_FF8B90FC\n"
+"loc_FF8B8FFC:\n"
+// jumptable FF8B8EFC entries 23,24
+"                BL      sub_FF8B640C\n" // ExpDrv.c 4
+"                B       loc_FF8B90FC\n"
+"loc_FF8B9004:\n"
+// jumptable FF8B8EFC entries 10,11
+"                BL      sub_FF8B6670_my\n" // ExpDrv.c 2 ->
+"                MOV     R4, #0\n"
+"                B       loc_FF8B90FC\n"
+"loc_FF8B9010:\n"
+// jumptable FF8B8EFC entry 25
+"                BL      sub_FF8B67AC\n" // ExpDrv.c 4
+"                B       loc_FF8B90FC\n"
+"loc_FF8B9018:\n"
+// jumptable FF8B8EFC entry 26
+"                LDRH    R1, [R0,#4]\n"
+"                STRH    R1, [SP,#0x10]\n"
+"                LDRH    R1, [R5,#2]\n"
+"                STRH    R1, [SP,#0x12]\n"
+"                LDRH    R1, [R5,#4]\n"
+"                STRH    R1, [SP,#0x14]\n"
+"                LDRH    R1, [R5,#6]\n"
+"                STRH    R1, [SP,#0x16]\n"
+"                LDRH    R1, [R0,#0xC]\n"
+"                STRH    R1, [SP,#0x18]\n"
+"                BL      sub_FF8B9EE4\n" // ExpDrv.c 2
+"                B       loc_FF8B90FC\n"
+"loc_FF8B9048:\n"
+// jumptable FF8B8EFC entry 27
+"                LDRH    R1, [R0,#4]\n"
+"                STRH    R1, [SP,#0x10]\n"
+"                LDRH    R1, [R5,#2]\n"
+"                STRH    R1, [SP,#0x12]\n"
+"                LDRH    R1, [R5,#4]\n"
+"                STRH    R1, [SP,#0x14]\n"
+"                LDRH    R1, [R5,#6]\n"
+"                STRH    R1, [SP,#0x16]\n"
+"                LDRH    R1, [R5,#8]\n"
+"                STRH    R1, [SP,#0x18]\n"
+"                BL      sub_FF8BA060\n" // ExpDrv.c 2
+"                B       loc_FF8B90FC\n"
+"loc_FF8B9078:\n"
+// jumptable FF8B8EFC entry 28
+"                LDRH    R1, [R5]\n"
+"                STRH    R1, [SP,#0x10]\n"
+"                LDRH    R1, [R0,#6]\n"
+"                STRH    R1, [SP,#0x12]\n"
+"                LDRH    R1, [R5,#4]\n"
+"                STRH    R1, [SP,#0x14]\n"
+"                LDRH    R1, [R5,#6]\n"
+"                STRH    R1, [SP,#0x16]\n"
+"                LDRH    R1, [R5,#8]\n"
+"                STRH    R1, [SP,#0x18]\n"
+"                BL      sub_FF8BA10C\n" // ExpDrv.c 1552
+"                B       loc_FF8B90FC\n"
+"loc_FF8B90A8:\n"
+// jumptable FF8B8EFC entry 29
+"                LDRH    R1, [R5]\n"
+"                STRH    R1, [SP,#0x10]\n"
+"                LDRH    R1, [R5,#2]\n"
+"                STRH    R1, [SP,#0x12]\n"
+"                LDRH    R1, [R5,#4]\n"
+"                STRH    R1, [SP,#0x14]\n"
+"                LDRH    R1, [R5,#6]\n"
+"                STRH    R1, [SP,#0x16]\n"
+"                LDRH    R1, [R0,#0xC]\n"
+"                STRH    R1, [SP,#0x18]\n"
+"                BL      sub_FF8BA1AC\n" // ExpDrv.c 32
+"                B       loc_FF8B90FC\n"
+"loc_FF8B90D8:\n"
+// jumptable FF8B8EFC entries 30,31
+"                BL      sub_FF8B6A04\n" // ExpDrv.c 4
+"                B       loc_FF8B90FC\n"
+"loc_FF8B90E0:\n"
+// jumptable FF8B8EFC entry 34
+"                BL      sub_FF8B7040\n" // ExpDrv.c 4
+"                B       loc_FF8B90FC\n"
+"loc_FF8B90E8:\n"
+// jumptable FF8B8EFC entry 35
+"                BL      sub_FF8B7274\n" // ExpDrv.c 4
+"                B       loc_FF8B90FC\n"
+"loc_FF8B90F0:\n"
+// jumptable FF8B8EFC entry 12
+"                BL      sub_FF8B73EC\n" // ExpDrv.c 2
+"                B       loc_FF8B90FC\n"
+"loc_FF8B90F8:\n"
+// jumptable FF8B8EFC entries 13-16
+"                BL      sub_FF8B7584\n" // ExpDrv.c 128
+"loc_FF8B90FC:\n"
+// jumptable FF8B8EFC default entry
+// jumptable FF8B8EFC entries 17-21,32,33
+"                LDR     R0, [SP,#0x1C]\n"
+"                LDR     R1, [R0,#0x7C]\n"
+"                LDR     R3, [R0,#0x88]\n"
+"                LDR     R2, [R0,#0x8C]\n"
+"                ADD     R0, R0, #4\n"
+"                BLX     R3\n"
+"                CMP     R4, #1\n"
+"                BNE     loc_FF8B9164\n"
+"loc_FF8B911C:\n"
+"                LDR     R0, [SP,#0x1C]\n"
+"                MOV     R2, #0xC\n"
+"                LDR     R1, [R0,#0x7C]\n"
+"                ADD     R1, R1, R1,LSL#1\n"
+"                ADD     R0, R0, R1,LSL#2\n"
+"                SUB     R4, R0, #8\n"
+"                LDR     R0, =0x462E8\n"
+"                ADD     R1, SP, #0x10\n"
+"                BL      sub_FFABD12C\n" // done
+"                LDR     R0, =0x462F4\n"
+"                MOV     R2, #0xC\n"
+"                ADD     R1, SP, #0x10\n"
+"                BL      sub_FFABD12C\n" // done
+"                LDR     R0, =0x46300\n"
+"                MOV     R2, #0xC\n"
+"                MOV     R1, R4\n"
+"                BL      sub_FFABD12C\n" // done
+"                B       loc_FF8B91DC\n"
+"loc_FF8B9164:\n"
+"                LDR     R0, [SP,#0x1C]\n"
+"                LDR     R0, [R0]\n"
+"                CMP     R0, #0xB\n"
+"                BNE     loc_FF8B91AC\n"
+"                MOV     R3, #0\n"
+"                STR     R3, [SP]\n"
+"                MOV     R3, #1\n"
+"                MOV     R2, #1\n"
+"                MOV     R1, #1\n"
+"                MOV     R0, #0\n"
+"                BL      sub_FF8B592C\n"
+"                MOV     R3, #0\n"
+"                STR     R3, [SP]\n"
+"                MOV     R3, #1\n"
+"                MOV     R2, #1\n"
+"                MOV     R1, #1\n"
+"                MOV     R0, #0\n"
+"                B       loc_FF8B91D8\n"
+"loc_FF8B91AC:\n"
+"                MOV     R3, #1\n"
+"                MOV     R2, #1\n"
+"                MOV     R1, #1\n"
+"                MOV     R0, #1\n"
+"                STR     R3, [SP]\n"
+"                BL      sub_FF8B592C\n"
+"                MOV     R3, #1\n"
+"                MOV     R2, #1\n"
+"                MOV     R1, #1\n"
+"                MOV     R0, #1\n"
+"                STR     R3, [SP]\n"
+"loc_FF8B91D8:\n"
+"                BL      sub_FF8B5A6C\n"
+"loc_FF8B91DC:\n"
+"                LDR     R0, [SP,#0x1C]\n"
+"                BL      sub_FF8B9E70\n" // ExpDrv.c 0
+"                B       loc_FF8B8BB0\n"
+ );
+}
+
+void __attribute__((naked,noinline)) sub_FF8B6670_my(){ // 
+ asm volatile(
+"                STMFD   SP!, {R4-R8,LR}\n"
+"                LDR     R7, =0x7270\n"
+"                MOV     R4, R0\n"
+"                LDR     R0, [R7,#0x1C]\n"
+"                MOV     R1, #0x3E\n"
+"                BL      sub_FF829D60\n"
+"                LDRSH   R0, [R4,#4]\n"
+"                MOV     R2, #0\n"
+"                MOV     R1, #0\n"
+"                BL      sub_FF8B56C0\n"
+"                MOV     R6, R0\n"
+"                LDRSH   R0, [R4,#6]\n"
+"                BL      sub_FF8B57CC\n"
+"                LDRSH   R0, [R4,#8]\n"
+"                BL      sub_FF8B5824\n"
+"                LDRSH   R0, [R4,#0xA]\n"
+"                BL      sub_FF8B587C\n"
+"                LDRSH   R0, [R4,#0xC]\n"
+"                BL      sub_FF8B58D4\n"
+"                MOV     R5, R0\n"
+"                LDR     R0, [R4]\n"
+"                LDR     R8, =0x46300\n"
+"                CMP     R0, #0xB\n"
+"                MOVEQ   R6, #0\n"
+"                MOVEQ   R5, #0\n"
+"                BEQ     loc_FF8B6700\n"
+"                CMP     R6, #1\n"
+"                BNE     loc_FF8B6700\n"
+"                LDRSH   R0, [R4,#4]\n"
+"                LDR     R1, =0xFF8B561C\n"
+"                MOV     R2, #2\n"
+"                BL      sub_FF9364E0\n" // IrisController.c 168 done
+"                STRH    R0, [R4,#4]\n"
+"                MOV     R0, #0\n"
+"                STR     R0, [R7,#0x28]\n"
+"                B       loc_FF8B6708\n"
+"loc_FF8B6700:\n"
+"                LDRH    R0, [R8]\n"
+"                STRH    R0, [R4,#4]\n"
+"loc_FF8B6708:\n"
+"                CMP     R5, #1\n"
+"                LDRNEH  R0, [R8,#8]\n"
+"                BNE     loc_FF8B6724\n"
+"                LDRSH   R0, [R4,#0xC]\n"
+"                LDR     R1, =0xFF8B56B0\n"
+"                MOV     R2, #0x20\n"
+"                BL      sub_FF8B9EA0\n"
+"loc_FF8B6724:\n"
+"                STRH    R0, [R4,#0xC]\n"
+"                LDRSH   R0, [R4,#6]\n"
+"                BL      sub_FF897408_my\n" // Shutter.c 364 ->
+"                LDRSH   R0, [R4,#8]\n"
+"                MOV     R1, #1\n"
+"                BL      sub_FF897B9C\n" // ImgGain.c 0
+"                MOV     R1, #0\n"
+"                ADD     R0, R4, #8\n"
+"                BL      sub_FF897C24\n" // ImgGain.c 0
+"                LDRSH   R0, [R4,#0xE]\n"
+"                BL      sub_FF8ACA40\n" // BrtCrct.c 552
+"                LDR     R4, =0xBB8\n"
+"                CMP     R6, #1\n"
+"                BNE     loc_FF8B677C\n"
+"                LDR     R0, [R7,#0x1C]\n"
+"                MOV     R2, R4\n"
+"                MOV     R1, #2\n"
+"                BL      sub_FF829C64\n" // KerFlag.c 0
+"                TST     R0, #1\n"
+"                LDRNE   R1, =0x527\n"
+"                LDRNE   R0, =0xFF8B5D3C\n" // "expdrv.c"
+"                BLNE    sub_FF81BFC8\n"
+"loc_FF8B677C:\n"
+"                CMP     R5, #1\n"
+"                LDMNEFD SP!, {R4-R8,PC}\n"
+"                LDR     R0, [R7,#0x1C]\n"
+"                MOV     R2, R4\n"
+"                MOV     R1, #0x20\n"
+"                BL      sub_FF829C64\n" // KerFlag.c 0
+"                TST     R0, #1\n"
+"                LDRNE   R1, =0x52C\n"
+"                LDRNE   R0, =0xFF8B5D3C\n"
+"                LDMNEFD SP!, {R4-R8,LR}\n"
+"                BNE     sub_FF81BFC8\n"
+"                LDMFD   SP!, {R4-R8,PC}\n"
+
+ );
+}
+
+void __attribute__((naked,noinline)) sub_FF897408_my(){ // Shutter.c 364
+ asm volatile(
+"                STMFD   SP!, {R4-R6,LR}\n"
+"                LDR     R5, =0x6C38\n"
+"                MOV     R4, R0\n"
+"                LDR     R0, [R5,#4]\n"
+"                CMP     R0, #1\n"
+"                MOVNE   R1, #0x16C\n"
+"                LDRNE   R0, =0xFF8971A0\n" // "shutter.c"
+"                BLNE    sub_FF81BFC8\n"
+"                CMN     R4, #0xC00\n"
+"                LDREQSH R4, [R5,#2]\n"
+"                CMN     R4, #0xC00\n"
+"                LDREQ   R1, =0x172\n"
+"                LDREQ   R0, =0xFF8971A0\n" // "shutter.c"
+"                STRH    R4, [R5,#2]\n"
+"                BLEQ    sub_FF81BFC8\n"
+"                MOV     R0, R4\n"
+//"                BL      sub_FF9BF02C\n" // -
+"                BL      apex2us\n" // +
+"                MOV     R4, R0\n"
+//"                BL      nullsub_143\n"
+"                MOV     R0, R4\n"
+"                BL      sub_FF8CF8C0\n"
+"                TST     R0, #1\n"
+"                LDRNE   R1, =0x177\n"
+"                LDMNEFD SP!, {R4-R6,LR}\n"
+"                LDRNE   R0, =0xFF8971A0\n" // "shutter.c"
+"                BNE     sub_FF81BFC8\n"
+"                LDMFD   SP!, {R4-R6,PC}\n"
+ );
+}
Index: /branches/reyalp-ptp-live/platform/g9/sub/100d/stubs_entry.S
===================================================================
--- /branches/reyalp-ptp-live/platform/g9/sub/100d/stubs_entry.S	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/g9/sub/100d/stubs_entry.S	(revision 1668)
@@ -0,0 +1,230 @@
+// !!! THIS FILE IS GENERATED. DO NOT EDIT. !!!
+#include "stubs_asm.h"
+
+// Camera info:
+//   DRYOS R23 (DRYOS version 2.3, release #0023)
+//   Firmware Ver GM1.00D
+//   Canon PowerShot G9
+
+// Values for makefile.inc
+//   PLATFORMID = 12634 (0x315a) // Found @ 0xfffe0130
+//   MAXRAMADDR = 0x03ffffff
+//   KEYSYS = d3                 // Found @ 0xffff31f0
+//   NEED_ENCODED_DISKBOOT = 1   // Found @ 0xffff31d0
+
+// Stubs below should be checked. Stub not matched 100%, or difference found to current 'stubs_entry_2.S'
+//    Name                                     Address      Rule  %  Comp to stubs_entry_2.S
+//NSTUB(PutInNdFilter                         ,0xff938468) //102        *** != 0xffa0c4e0
+//NSTUB(PutOutNdFilter                        ,0xff93848c) //102        *** != 0xffa0c518
+//NSTUB(kbd_pwr_off                           ,0xff84944c) //  2 67%    *** != 0x00000000
+// ERROR: kbd_pwr_on is not found.                         //--- ---    *** != 0x00000000
+//NSTUB(rename                                ,0xff824d40) //  1        *** != 0xff825600
+//NSTUB(strcmp                                ,0xff81e7cc) //101        *** != 0xff81e7f4
+//NSTUB(write                                 ,0xff8255d8) //101        *** != 0xff81a3d8
+
+// Check of modemap from 'platform/CAMERA/shooting.c':
+// Firmware modemap table found @ff8773f8 -> ff8735c4 -> ff95532c -> ffa4c6c8 -> ffb0807c
+// No problems found with modemap table.
+
+// Values below can be overridden in 'stubs_min.S':
+DEF(physw_status                            ,0x0001563c) // Found @0xff8230cc
+DEF(physw_run                               ,0x00001ca4) // Found @0xff822d78
+DEF(levent_table                            ,0xffae013c) // Found @0xffae013c
+DEF(FlashParamsTable                        ,0xffb08248) // Found @0xffb08248
+DEF(movie_status                            ,0x00005714) // Found @0xff85d220
+DEF(canon_menu_active                       ,0x0000fdc8) // Found @0xff99b4d4
+DEF(canon_shoot_menu_active                 ,0x0000f33d) // Found @0xff96aba8
+DEF(playrec_mode                            ,0x000058cc) // Found @0xff864a60
+DEF(zoom_status                             ,0x0001264c) // Found @0xffa4e38c
+DEF(some_flag_for_af_scan                   ,0x0001253c) // Found @0xffa44730
+// focus_len_table contains zoom focus lengths for use in 'get_focal_length' (main.c).
+// each entry contains 3 int value(s), the first is the zoom focus length.
+// there are 14 entries in the table - set NUM_FL to 14
+DEF(focus_len_table                         ,0xfffe299c) // Found @0xfffe299c
+DEF(zoom_busy                               ,0x0000e260) // Found @0xff939ebc
+DEF(focus_busy                              ,0x0000e150) // Found @0xff9340ac
+//DEF(recreview_hold                          ,0x00006400) // Found @0xff87cb64, ** != ** stubs_min = 0x0000f050 (0xF050)
+
+// Values below go in 'lib.c':
+//void *vid_get_bitmap_fb()        { return (void*)0x10361000; }             // Found @0xff8451d0
+//void *vid_get_viewport_fb()      { return (void*)0x1067b540; }             // Found @0xffa1126c
+//void *vid_get_viewport_fb_d()    { return (void*)(*(int*)(0x5558+0x50)); } // Found @0xff856268 & 0xff8562a0
+//char *camera_jpeg_count_str()    { return (char*)0x00060354; }             // Found @0xff9afae4
+//long hook_raw_size()             { return 0x00ee9710; }                    // Found @0xffa13130
+//int get_flash_params_count(void) { return 0x72; }                          // Found @0xff95692c
+
+// Bitmap masks and physw_status index values for SD_READONLY and USB power flags (for kbd.c).
+//#define SD_READONLY_FLAG    0x00020000 // Found @0xffac62e0, levent 0x90a
+//#define SD_READONLY_IDX     2
+//#define USB_MASK            0x00040000 // Found @0xffac62e8, levent 0x902
+//#define USB_IDX             2
+
+// Keymap values for kbd.c. Additional keys may be present, only common values included here.
+//static KeyMap keymap[] = {
+//    { 0, KEY_SHOOT_FULL      ,0xc0000000 }, // Found @0xffac6218, levent 0x01
+//    { 0, KEY_SHOOT_FULL_ONLY ,0x80000000 }, // Found @0xffac6218, levent 0x01
+//    { 0, KEY_SHOOT_HALF      ,0x40000000 }, // Found @0xffac6210, levent 0x00
+//    { 1, KEY_ZOOM_OUT        ,0x00000008 }, // Found @0xffac6238, levent 0x03
+//    { 1, KEY_ZOOM_IN         ,0x00000010 }, // Found @0xffac6240, levent 0x02
+//    { 1, KEY_LEFT            ,0x00010000 }, // Found @0xffac6270, levent 0x06
+//    { 1, KEY_SET             ,0x00020000 }, // Found @0xffac6278, levent 0x08
+//    { 1, KEY_RIGHT           ,0x00040000 }, // Found @0xffac6280, levent 0x07
+//    { 1, KEY_DOWN            ,0x00080000 }, // Found @0xffac6288, levent 0x05
+//    { 1, KEY_UP              ,0x00100000 }, // Found @0xffac6290, levent 0x04
+//    { 1, KEY_DISPLAY         ,0x04000000 }, // Found @0xffac62a8, levent 0x0a
+//    { 1, KEY_MENU            ,0x08000000 }, // Found @0xffac62b0, levent 0x09
+//    { 0, 0, 0 }
+//};
+
+// Values below go in 'platform_camera.h':
+//#define CAM_DRYOS         1
+//#define CAM_RAW_ROWPIX    4104 // Found @0xffa0b1f8
+//#define CAM_RAW_ROWS      3048 // Found @0xffa0b200
+//#undef  CAM_UNCACHED_BIT
+//#define CAM_UNCACHED_BIT  0x10000000 // Found @0xff82a7c4
+
+// Misc stuff
+DEF(ctypes, 0xffac0ad2)
+
+// For capt_seq.c
+//static long *nrflag = (long*)(0xe618);       // Found @ ff944474
+
+// Stubs below matched 100%.
+//    Name                                     Address                Comp to stubs_entry_2.S
+NSTUB(AllocateMemory                          ,0xffa47c58) //103
+NSTUB(AllocateUncacheableMemory               ,0xff82a788) //112
+NSTUB(Close                                   ,0xff82552c) //101
+NSTUB(CreateTask                              ,0xff81baf0) //101
+NSTUB(DebugAssert                             ,0xff81bfc8) //111
+NSTUB(DeleteDirectory_Fut                     ,0xff824e78) //  1
+NSTUB(DeleteFile_Fut                          ,0xff824d94) //112
+NSTUB(DoAFLock                                ,0xff8275cc) //103
+NSTUB(EnterToCompensationEVF                  ,0xff8279a8) //104
+NSTUB(ExecuteEventProcedure                   ,0xff81c1a8) //  1
+NSTUB(ExitFromCompensationEVF                 ,0xff8279f8) //104
+NSTUB(ExitTask                                ,0xff81bd80) //101
+NSTUB(ExpCtrlTool_StartContiAE                ,0xff835600) //104
+NSTUB(ExpCtrlTool_StopContiAE                 ,0xff8357c0) //104
+NSTUB(Fclose_Fut                              ,0xff824f10) //101
+NSTUB(Feof_Fut                                ,0xff8250fc) //  1
+NSTUB(Fflush_Fut                              ,0xff825138) //  1
+NSTUB(Fgets_Fut                               ,0xff825064) //  1
+NSTUB(Fopen_Fut                               ,0xff824ed0) //101
+NSTUB(Fread_Fut                               ,0xff824fbc) //101
+NSTUB(FreeMemory                              ,0xffa47c44) //103
+NSTUB(FreeUncacheableMemory                   ,0xff82a7bc) //112
+NSTUB(Fseek_Fut                               ,0xff8250b0) //101
+NSTUB(Fwrite_Fut                              ,0xff825010) //101
+NSTUB(GetBatteryTemperature                   ,0xff84bee8) //102
+NSTUB(GetCCDTemperature                       ,0xff84be78) //102
+NSTUB(GetCurrentAvValue                       ,0xff936d58) //102
+NSTUB(GetDrive_ClusterSize                    ,0xff852754) //  1
+NSTUB(GetDrive_FreeClusters                   ,0xff8527f4) //  1
+NSTUB(GetDrive_TotalClusters                  ,0xff852788) //  1
+NSTUB(GetFocusLensSubjectDistance             ,0xff934bec) //102
+NSTUB(GetFocusLensSubjectDistanceFromLens     ,0xff934ef8) //  1
+NSTUB(GetKbdState                             ,0xff849300) //109
+NSTUB(GetMemInfo                              ,0xff813c58) //  1
+NSTUB(GetOpticalTemperature                   ,0xff84bf58) //102
+NSTUB(GetParameterData                        ,0xff9568ec) //  1
+NSTUB(GetPropertyCase                         ,0xff86f768) //101
+NSTUB(GetSystemTime                           ,0xffa47d60) //  1
+NSTUB(GetZoomLensCurrentPoint                 ,0xff93a220) //102
+NSTUB(GetZoomLensCurrentPosition              ,0xffa3e5e8) //102
+NSTUB(GiveSemaphore                           ,0xff81ba5c) //112
+NSTUB(IsStrobeChargeCompleted                 ,0xff8c1344) //102
+NSTUB(LEDDrive                                ,0xff848890) //103
+NSTUB(LocalTime                               ,0xff86b538) //  1
+NSTUB(LockMainPower                           ,0xff8731f0) //103
+NSTUB(Lseek                                   ,0xff82566c) //101
+NSTUB(MakeDirectory_Fut                       ,0xff824e08) //  1
+NSTUB(MoveFocusLensToDistance                 ,0xffa0e0c4) //102
+NSTUB(MoveIrisWithAv                          ,0xff937138) //102
+NSTUB(MoveZoomLensWithPoint                   ,0xff93accc) //102
+NSTUB(NewTaskShell                            ,0xff86f1ec) //103
+NSTUB(Open                                    ,0xff825504) //101
+NSTUB(PB2Rec                                  ,0xff876664) //104
+NSTUB(PT_MoveDigitalZoomToWide                ,0xff8668e0) //103
+NSTUB(PT_MoveOpticalZoomAt                    ,0xff8668a8) //103
+NSTUB(PT_PlaySound                            ,0xff866454) //103
+NSTUB(PostLogicalEventForNotPowerType         ,0xff87118c) //103
+NSTUB(PostLogicalEventToUI                    ,0xff8711d8) //103
+NSTUB(Read                                    ,0xff81a378) //101
+NSTUB(ReadFastDir                             ,0xffa2cb3c) //  1
+NSTUB(Rec2PB                                  ,0xff875024) //104
+NSTUB(RefreshPhysicalScreen                   ,0xff9bdb74) //104
+NSTUB(Remove                                  ,0xff825574) //  1
+NSTUB(RenameFile_Fut                          ,0xff824d40) //  1
+NSTUB(Restart                                 ,0xff82c7e4) //106
+NSTUB(SetAE_ShutterSpeed                      ,0xffa10420) //102
+NSTUB(SetAutoShutdownTime                     ,0xff873264) //103
+NSTUB(SetCurrentCaptureModeType               ,0xff879f7c) //101
+NSTUB(SetFileAttributes                       ,0xff825858) //  1
+NSTUB(SetFileTimeStamp                        ,0xff825808) //  1
+NSTUB(SetLogicalEventActive                   ,0xff872f28) //  1
+NSTUB(SetParameterData                        ,0xff9567c8) //101
+NSTUB(SetPropertyCase                         ,0xff86f660) //103
+NSTUB(SetScriptMode                           ,0xff872f78) //101
+NSTUB(SleepTask                               ,0xff82a610) //101
+NSTUB(TakeSemaphore                           ,0xff81b98c) //101
+NSTUB(TurnOffBackLight                        ,0xff87ff88) //104
+NSTUB(TurnOnBackLight                         ,0xff87ff70) //104
+NSTUB(UIFS_WriteFirmInfoToFile                ,0xff99c320) //103
+NSTUB(UnlockAF                                ,0xff827638) //103
+NSTUB(UnlockMainPower                         ,0xff873144) //103
+NSTUB(UnsetZoomForMovie                       ,0xff95cfcc) //104
+NSTUB(UpdateMBROnFlash                        ,0xff85251c) //105
+NSTUB(VbattGet                                ,0xff82199c) //101
+NSTUB(Write                                   ,0xff8255d8) //101
+NSTUB(WriteSDCard                             ,0xff928c84) //108
+NSTUB(_log                                    ,0xffabe644) //111
+NSTUB(_log10                                  ,0xffabd588) //112
+NSTUB(_pow                                    ,0xffabd6f8) //114
+NSTUB(_sqrt                                   ,0xffabf9ac) //  1
+NSTUB(add_ptp_handler                         ,0xff8d897c) //  1
+NSTUB(apex2us                                 ,0xff9bf02c) //  4
+NSTUB(close                                   ,0xff81a190) //  1
+NSTUB(closedir                                ,0xffa2cc0c) //  1
+NSTUB(err_init_task                           ,0xff814eb0) //  4
+NSTUB(exmem_alloc                             ,0xff86c680) //  1
+NSTUB(free                                    ,0xff813ab0) //112
+NSTUB(kbd_p1_f                                ,0xff8231c8) //109
+NSTUB(kbd_p1_f_cont                           ,0xff8231d4) //109
+NSTUB(kbd_p2_f                                ,0xff822a18) //109
+NSTUB(kbd_read_keys                           ,0xff8230cc) //109
+NSTUB(kbd_read_keys_r2                        ,0xff848dc8) //109
+NSTUB(lseek                                   ,0xff82566c) //101
+NSTUB(malloc                                  ,0xff8139dc) //112
+NSTUB(memcmp                                  ,0xff81e834) //101
+NSTUB(memcpy                                  ,0xff895cf0) //101
+NSTUB(memset                                  ,0xffa8d394) //101
+NSTUB(mkdir                                   ,0xff8258d0) //  1
+// ALT: NSTUB(mkdir, 0xff825970) // 1 32/0
+NSTUB(mktime_ext                              ,0xff89655c) //  1
+NSTUB(open                                    ,0xff81a0e0) //  1
+NSTUB(opendir                                 ,0xffa2caa8) //  1
+NSTUB(openfastdir                             ,0xffa2caa8) //  1
+NSTUB(qsort                                   ,0xff9be404) //  1
+NSTUB(rand                                    ,0xff81e93c) //  1
+NSTUB(read                                    ,0xff81a378) //101
+NSTUB(reboot_fw_update                        ,0xffa34500) //  1
+NSTUB(set_control_event                       ,0xff872c2c) //  1
+NSTUB(srand                                   ,0xff81e930) //  1
+NSTUB(stat                                    ,0xff825738) //  1
+NSTUB(strcat                                  ,0xff895c1c) //  1
+NSTUB(strchr                                  ,0xff895ca4) //  1
+NSTUB(strcpy                                  ,0xff81e778) //101
+NSTUB(strftime                                ,0xff895f64) //  1
+NSTUB(strlen                                  ,0xff81e810) //101
+NSTUB(strncmp                                 ,0xff895c58) //  1
+NSTUB(strncpy                                 ,0xff81e790) //  1
+NSTUB(strrchr                                 ,0xff895cc8) //  1
+NSTUB(strtol                                  ,0xff830d90) //101
+NSTUB(strtolx                                 ,0xff830b94) //109
+  DEF(task_CaptSeq                            ,0xff861210) //107
+  DEF(task_ExpDrv                             ,0xff8b8b90) //110
+  DEF(task_InitFileModules                    ,0xff877284) //107
+  DEF(task_MovieRecord                        ,0xff85d4c0) //107
+  DEF(task_PhySw                              ,0xff822d74) //107
+NSTUB(time                                    ,0xff86ba3c) //  2
+NSTUB(vsprintf                                ,0xff81e6f8) //  1
Index: /branches/reyalp-ptp-live/platform/g9/sub/100d/stubs_entry_2.S
===================================================================
--- /branches/reyalp-ptp-live/platform/g9/sub/100d/stubs_entry_2.S	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/g9/sub/100d/stubs_entry_2.S	(revision 1668)
@@ -0,0 +1,23 @@
+#include "stubs_asm.h"
+#define NULL_SUB 0xFF810958
+
+// Override stubs_entry.S
+NSTUB(PutInNdFilter,                0xFFA0C4E0)
+NSTUB(PutOutNdFilter,               0xFFA0C518)
+NHSTUB(kbd_pwr_off,                 NULL_SUB)
+NHSTUB(kbd_pwr_on,                  NULL_SUB)
+NHSTUB(rename,                      0xFF825600)
+NHSTUB(strcmp,                      0xFF81E7F4)
+NHSTUB(write,                       0xff81a3d8)
+
+// These don't exist
+NHSTUB(SetZoomActuatorSpeedPercent, NULL_SUB)
+NHSTUB(TurnOffMic,                  NULL_SUB)
+NHSTUB(TurnOnMic,                   NULL_SUB)
+
+// Additional
+NHSTUB(MakeAFScan,                  0xFFA44960)
+NHSTUB(PostLEDMessage,              0xFF848910)
+NHSTUB(closefastdir,                0xffa2cc0c)
+NHSTUB(ints_disable,                0xFF810578)
+NHSTUB(ints_enable,                 0xFF8105A0)
Index: /branches/reyalp-ptp-live/platform/g9/sub/100d/boot.c
===================================================================
--- /branches/reyalp-ptp-live/platform/g9/sub/100d/boot.c	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/g9/sub/100d/boot.c	(revision 1668)
@@ -0,0 +1,1819 @@
+#include "lolevel.h"
+#include "platform.h"
+#include "core.h"
+#include "stdlib.h"
+
+//extern void draw_txt_string(int col, int row, const char *str, color cl); 
+
+const char * const new_sa = &_end;
+
+/* Ours stuff */
+extern long wrs_kernel_bss_start;
+extern long wrs_kernel_bss_end;
+
+// Forward declarations
+void CreateTask_PhySw();
+void CreateTask_spytask();
+
+void taskCreateHook(int *p) { 
+ p-=16;
+// TODO can save some memory by hooking other tasks this way
+// if (p[0]==0x)  p[0]=(int)capt_seq_task;
+// if (p[0]==0x)  p[0]=(int)movie_record_task;
+// if (p[0]==0x)  p[0]=(int)init_file_modules_task;
+ if (p[0]==0xFF8B8B90)  p[0]=(int)exp_drv_task;
+}
+
+void taskCreateHook2(int *p) { 
+ p-=16;
+// if (p[0]==0x)  p[0]=(int)init_file_modules_task;
+ if (p[0]==0xFF8B8B90)  p[0]=(int)exp_drv_task;
+}
+
+/*
+void CreateTask_blinker(); 
+void task_blinker();
+void dump_chdk();
+
+
+void boot();
+
+
+#define DPs (void*)0xC022006C					// direct-print (blue)
+#define LED_AF (void*)0xC0220094	//LED_AF
+#define LED_ISO (void*)0xC02200B0	//LED_ISO   
+#define LED_PWR (void*)0xC0220068	//LED_PWR   
+#define LED_BLUE (void*)0xC022006C	//LED_BLUE
+#define DELAYs 3000000
+
+void debug_my_blink_green()
+{
+	volatile long *p = (void*)LED_AF;       		// turned off later, so assumed to be power
+	int counter;
+
+	// DEBUG: blink led
+	counter = DELAYs; *p = 0x46;
+	while (counter--) { asm("nop\n nop\n"); };
+	counter = DELAYs; *p = 0x44;
+	while (counter--) { asm("nop\n nop\n"); };
+}
+
+void debug_my_pause()
+{
+	int counter;
+
+	// DEBUG: blink led
+	counter = DELAYs; 
+	while (counter--) { asm("nop\n nop\n"); };
+	counter = DELAYs; 
+	while (counter--) { asm("nop\n nop\n"); };
+}
+
+void debug_my_blink_blue()
+{
+	volatile long *p = (void*)LED_BLUE;       		// turned off later, so assumed to be power
+	int counter;
+
+	// DEBUG: blink led
+	counter = DELAYs; *p = 0x46;
+	while (counter--) { asm("nop\n nop\n"); };
+	counter = DELAYs; *p = 0x44;
+	while (counter--) { asm("nop\n nop\n"); };
+}
+
+
+
+
+#define DP (void*)0xC0220068	// led_pwr DEBUG
+
+#define DEBUG_LED 0xC022006C //ok //used iso blue, was 0xc02200C4  +++
+
+
+#define DELAY 5000000			// DEBUG
+
+*/
+
+void boot() { //#fs
+
+
+    long *canon_data_src = (void*)0xFFB2E384; // OK	//canon_data_src!!!  @FF810130
+    long *canon_data_dst = (void*)0x1900;	// OK  //MEMBASEADDR   @FF810134
+    long canon_data_len = 0x140E4- 0x1900; // data_end - data_start     
+    long *canon_bss_start = (void*)0x140e4; // just after data 	// OK	//@FF810138
+    long canon_bss_len = 0xb0b68 - 0x140e4; //  MEMISOSTART - 
+
+    long i;
+
+
+    // Code taken from VxWorks CHDK. turns caches on
+    asm volatile (
+	"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;
+
+    *(int*)(0x261C+8)= (*(int*)0xC02200C0)&1 ? 1 : 2;  // replacement of sub_FF822E10
+
+/*
+    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");
+*/
+
+    *(int*)0x1930=(int)taskCreateHook; 
+    *(int*)0x1934=(int)taskCreateHook2; 
+
+    // jump to init-sequence that follows the data-copy-routine 
+
+  
+	asm volatile ("B      sub_FF8101a4_my\n");
+	//asm volatile ("B      sub_FF8101a4\n");
+	
+}; //#fe
+
+
+// init //OK
+void __attribute__((naked,noinline)) sub_FF8101a4_my() { //#fs  OK
+
+				
+		asm volatile (		  
+                "LDR     R0, =0xFF81021C\n"
+                "MOV     R1, #0\n"
+                "LDR     R3, =0xFF810254\n"
+"loc_FF8101B0:\n"
+                "CMP     R0, R3\n"
+                "LDRCC   R2, [R0],#4\n"
+                "STRCC   R2, [R1],#4\n"
+                "BCC     loc_FF8101B0\n"
+                "LDR     R0, =0xFF810254\n"
+                "MOV     R1, #0x4B0\n"
+                "LDR     R3, =0xFF810468\n"
+"loc_FF8101CC:\n"
+                "CMP     R0, R3\n"
+                "LDRCC   R2, [R0],#4\n"
+                "STRCC   R2, [R1],#4\n"
+                "BCC     loc_FF8101CC\n"
+                "MOV     R0, #0xD2\n"
+                "MSR     CPSR_cxsf, R0\n"
+                "MOV     SP, #0x1000\n"
+                "MOV     R0, #0xD3\n"
+                "MSR     CPSR_cxsf, R0\n"
+                "MOV     SP, #0x1000\n"
+                "LDR     R0, =0x6C4\n"
+                "LDR     R2, =0xEEEEEEEE\n"
+                "MOV     R3, #0x1000\n"
+"loc_FF810200:\n"
+                "CMP     R0, R3\n"
+                "STRCC   R2, [R0],#4\n"
+                "BCC     loc_FF810200\n"
+                "BL      sub_FF810FB8_my\n"
+      );
+				
+}; //#fe
+
+
+//OK
+void __attribute__((naked,noinline)) sub_FF810FB8_my() { //#fs  OK  h_usrKernelInit
+
+
+        asm volatile ( 
+                "STR     LR, [SP,#-4]!\n"
+                "SUB     SP, SP, #0x74\n"
+                "MOV     R0, SP\n"
+                "MOV     R1, #0x74\n"
+                "BL      sub_FFABD388\n"
+                "MOV     R0, #0x53000\n"
+                "STR     R0, [SP,#0x74-0x70]\n"
+				
+	);
+				//"LDR     R0, =0xB0B68"
+        asm volatile (
+              "LDR     R0, =new_sa\n"
+              "LDR     R0, [R0]\n"
+        );
+        asm volatile (				
+                "LDR     R2, =0x2ABC00\n"
+                "LDR     R1, =0x2A4968\n"
+                "STR     R0, [SP,#0x74-0x6C]\n"
+                "SUB     R0, R1, R0\n"
+                "ADD     R3, SP, #0x74-0x68\n"
+                "STR     R2, [SP,#0x74-0x74]\n"
+                "STMIA   R3, {R0-R2}\n"
+                "MOV     R0, #0x22\n"
+                "STR     R0, [SP,#0x74-0x5C]\n"
+                "MOV     R0, #0x68\n"
+                "STR     R0, [SP,#0x74-0x58]\n"
+                "LDR     R0, =0x19B\n"
+                "MOV     R1, #0x64\n"
+                //"STRD    R0, [SP,#0x74-0x54]\n"		  // "strd not supported by cpu" claims gcc
+				"STR      R0, [SP,#0x74-0x54]\n"          // split in two single-word STRs
+				"STR      R1, [SP,#0x74-0x50]\n"
+                "MOV     R0, #0x78\n"
+                //"STRD    R0, [SP,#0x74-0x4C]\n"		  // "strd not supported by cpu" claims gcc
+				"STR      R0, [SP,#0x74-0x4C]\n"          // split in two single-word STRs
+				"STR      R1, [SP,#0x74-0x48]\n"
+                "MOV     R0, #0\n"
+                "STR     R0, [SP,#0x74-0x44]\n"
+                "STR     R0, [SP,#0x74-0x40]\n"
+                "MOV     R0, #0x10\n"
+                "STR     R0, [SP,#0x74-0x18]\n"
+                "MOV     R0, #0x800\n"
+                "STR     R0, [SP,#0x74-0x14]\n"
+                "MOV     R0, #0xA0\n"
+                "STR     R0, [SP,#0x74-0x10]\n"
+                "MOV     R0, #0x280\n"
+                "STR     R0, [SP,#0x74-0xC]\n"
+				//"LDR     R1, =0xFF814DBC\n"         
+                "LDR     R1, =uHwSetup_my\n"	//<---------------------------------------chdk
+                "MOV     R0, SP\n"
+                "MOV     R2, #0\n"
+                "BL      sub_FF812D70\n"
+                "ADD     SP, SP, #0x74\n"
+                "LDR     PC, [SP],#4\n"
+			);
+	
+}; //#fe
+
+
+//OK
+void __attribute__((naked,noinline)) uHwSetup_my() { //#fs FF814DBC
+
+	asm volatile (		
+			//debug ok
+		
+              "STMFD   SP!, {R4,LR}\n"
+			  "BL      sub_FF81095C\n"
+			  "BL      sub_FF819948\n"          
+			  "CMP     R0, #0\n"
+			  "LDRLT   R0, =0xFF814ED0\n"       
+              "BLLT    sub_FF814EB0\n"          
+		      "BL      sub_FF8149E0\n"          // _termDriverInit
+			  "CMP     R0, #0\n"
+			  "LDRLT   R0, =0xFF814ED8\n"       // aTermdriverinit
+	          "BLLT    sub_FF814EB0\n"          
+			  "LDR     R0, =0xFF814EE8\n"       // a_term
+			  			  
+              "BL      sub_FF814ACC\n"          // _termDeviceCreate
+			  "CMP     R0, #0\n"
+              "LDRLT   R0, =0xFF814EF0\n"       // aTermdevicecrea
+              "BLLT    sub_FF814EB0\n"          
+              "LDR     R0, =0xFF814EE8\n"       // a_term
+              "BL      sub_FF81357C\n"          // _stdioSetup
+              "CMP     R0, #0\n"
+              "LDRLT   R0, =0xFF814F04\n"       // aStdiosetup
+              "BLLT    sub_FF814EB0\n"          
+              "BL      sub_FF8194D0\n"          // _stdlibSetup
+              "CMP     R0, #0\n"
+              "LDRLT   R0, =0xFF814F10\n"       // aStdlibsetup
+              "BLLT    sub_FF814EB0\n"          
+              "BL      sub_FF8114D0\n"          // _armlib_setup
+              "CMP     R0, #0\n"
+              "LDRLT   R0, =0xFF814F1C\n"       // aArmlib_setup
+              "BLLT    sub_FF814EB0\n"          //   _err_init_task
+              "LDMFD   SP!, {R4,LR}\n"
+              "B       CreateTask_Startup_my\n" //<---------------------------------------chdk
+
+        );
+}; //#fe
+
+
+//OK 
+void __attribute__((naked,noinline)) CreateTask_Startup_my() { //#fs FF81DC0C	
+
+		asm volatile (		
+        "STMFD   SP!, {R3,LR}\n"
+                //"BL      nullsub_3\n"
+                "BL      sub_FF82C8FC\n"
+                "CMP     R0, #0\n"
+                "BNE     loc_FF81DC4C\n"
+                "BL      sub_FF824568\n"
+                "CMP     R0, #0\n"
+                "LDREQ   R2, =0xC0220000\n"
+                "LDREQ   R0, [R2,#0xC0]\n"
+                "LDREQ   R1, [R2,#0xC4]\n"
+                "ORREQ   R0, R0, R1\n"
+                "TSTEQ   R0, #1\n"
+                "BNE     loc_FF81DC4C\n"
+                "MOV     R0, #0x44\n"
+                "STR     R0, [R2,#0x4C]\n"
+"loc_FF81DC48:\n"
+                "B       loc_FF81DC48\n"
+"loc_FF81DC4C:\n"
+             //   "BL      sub_FF822E10\n"  // removed, see boot() function
+                //"BL      nullsub_4\n"
+                "BL      sub_FF82A488\n"
+                "MOV     R1, #0x300000\n"
+                "MOV     R0, #0\n"
+                "BL      sub_FF82A6D0\n"
+                "BL      sub_FF82A67C\n"
+                "MOV     R3, #0\n"
+                "STR     R3, [SP,#8-0x08]\n"
+                "LDR     R3, =task_Startup_my\n"		// originally FF81DBB0 <---------------------------------------chdk
+                "MOV     R2, #0\n"
+                "MOV     R1, #0x19\n"
+                "LDR     R0, =0xFF81DC90\n"			//"Startup"
+                "BL      sub_FF81BAF0\n"
+                "MOV     R0, #0\n"
+                "LDMFD   SP!, {R12,PC}\n"
+				);
+		
+ //OK
+}; //#fe
+
+
+
+			
+
+//OK
+void __attribute__((naked,noinline)) task_Startup_my() { //#fs originally FF81DBB0
+       
+       	asm volatile (
+                "STMFD   SP!, {R4,LR}\n"
+				"BL      sub_FF81517C\n"  
+				"BL      sub_FF823FA0\n"
+                "BL      sub_FF820E60\n"
+                //"BL      j_nullsub_177\n"
+				"BL      sub_FF82CADC\n"
+				//"BL      sub_FF82C9C4\n"	// skip diskboot 
+		);
+        CreateTask_spytask();  // <------------
+        asm volatile (
+			   "BL      sub_FF82CCA4\n"
+               "BL      sub_FF82CB2C\n"		
+               "BL      sub_FF8299CC\n"
+               "BL      sub_FF82CCA8\n"
+        );
+         CreateTask_PhySw(); //<---------------
+        asm volatile (
+				//"BL      sub_FF822DA8\n"  // (taskcreate_PhySw) 
+				//"BL      sub_FF82629C\n"
+				"BL      sub_FF82629C_my\n"		// divert to intercept task_ShootSeqTask------------------------------>
+				"BL      sub_FF82CCC0\n"
+                //"BL      nullsub_2\n"
+                "BL      sub_FF822130\n"
+                "BL      sub_FF82C6A8\n"  // taskcreate_Bye\n"
+                "BL      sub_FF8228D4\n"
+                "BL      sub_FF82203C\n"  // taskcreate_TempCheck\n"
+				//"BL      sub_FF82D720\n"
+				"BL      sub_FF82D720_my\n" 		// divert for SDHC-bootdisk-support<--------------------------------- 
+				"BL      sub_FF821FF8\n"
+                "LDMFD   SP!, {R4,LR}\n" 
+                "B       sub_FF815088\n"
+             );
+
+}; //#fe
+
+
+void CreateTask_spytask() { //#fs 
+        _CreateTask("SpyTask", 0x19, 0x2000, core_spytask, 0);
+
+}; //#fe
+
+void CreateTask_PhySw() { //#fs 
+        _CreateTask("PhySw", 0x18, 0x800, mykbd_task, 0);
+        asm volatile (
+				"BL      sub_FF84962C\n"	//taskcreate_JogDial
+        ); 
+}; //#fe
+
+
+//OK
+void __attribute__((naked,noinline)) sub_FF82629C_my() { //#fs  
+
+		 asm volatile (
+                "STMFD   SP!, {R4,LR}\n"
+                "LDR     R4, =0x1D38\n" 
+                "MOV     R0, #0\n"
+                "MOV     R1, #4\n"
+                "STR     R0, [R4,#0xC]\n" 
+                "BL      sub_FF81BE20\n" 
+                "STR     R0, [R4,#4]\n"	
+                "MOV     R0, #0\n"
+                "MOV     R1, #1\n"
+                "BL      sub_FF81BE44\n" 
+                "STR     R0, [R4,#8]\n" 
+                "BL      sub_FF864A14\n"
+                "BL      sub_FF86383C\n"				
+				"BL      sub_FF8601A0_my\n"     // divert this for ShootSeqTask 	<------------------
+				"BL      sub_FF864CFC\n" 
+                "LDR     R0, [R4,#4]\n" 
+                "LDMFD   SP!, {R4,LR}\n"
+                "MOV     R1, #0x1000\n"
+                "B       sub_FF829D2C\n"
+        );
+}; //#fe
+//OK
+void __attribute__((naked,noinline)) sub_FF8601A0_my() { //#fs 
+
+	      asm volatile (
+                "STMFD   SP!, {R4,LR}\n"
+                "LDR     R4, =0x57EC\n" 
+                "LDR     R0, [R4,#8]\n"
+                "CMP     R0, #0\n"
+                "BNE     loc_FF86020C\n" 
+                //"BL      nullsub_30\n"
+                "MOV     R1, #1\n"
+                "MOV     R0, #0\n"
+                "BL      sub_FF81BE44\n" 
+                "STR     R0, [R4,#0x20]\n" 
+                "MOV     R0, #0\n"
+                "MOV     R1, #0\n"
+                "BL      sub_FF81BE20\n" 
+                "STR     R0,[R4,#0x24]\n"
+                "BL      sub_FF860584\n" 
+                "BL      sub_FF860370\n"   
+                "MOV     R0, #0\n"
+                "STR     R0, [R4,#0x1C]\n" 
+                "ADD     R0, R4, #0x28\n" 
+                "MOV     R1, #0\n"
+                "STR     R1, [R0],#4\n"
+                "STR     R1, [R0]\n"
+                "BL      sub_FF86089C\n" 
+                "BL      sub_FF864EA8\n" 
+                "BL      sub_FF8631AC\n"		
+                "BL      sub_FF8614E8_my\n"     // continue here for task_CaptSeqTask  <----------------------------
+				
+                "BL      sub_FF862CA8\n"		
+        "loc_FF86020C:\n"
+                "MOV     R0, #1\n"
+                "STR     R0, [R4,#8]\n"
+                "LDMFD   SP!, {R4,PC}\n"
+        );
+}; //#fe
+
+//OK ****
+void __attribute__((naked,noinline)) sub_FF8614E8_my() { //#fs  
+        asm volatile (
+                "STMFD   SP!, {R3-R5,LR}\n"
+                "LDR     R2, =0x1E3C0\n" 
+                "MOV     R0, #0\n"
+                "MOV     R1, #0\n"
+        "loc_FF8614F8:\n"
+                "ADD     R3, R2, R0,LSL#4\n"
+                "ADD     R0, R0, #1\n"
+                "CMP     R0, #5\n"
+                "STR     R1, [R3,#8]\n"
+                "BCC     loc_FF8614F8\n" 
+				"LDR     R0, =0x1E410\n" 
+				"STR     R1, [R0,#8]\n" 
+				"ADD     R0, R0, #0x10\n" 
+				"STR     R1, [R0,#8]\n" 
+                "BL      sub_FF942928\n" 
+                "BL      sub_FF944F7C\n" 
+                "MOV     R1, #5\n"
+                "MOV     R0, #0\n"
+                "BL      sub_FF81BDFC\n"
+                "LDR     R4, =0x583C\n" 
+                "LDR     R1, =0x1001FF\n"
+                "STR     R0, [R4,#0x14]\n"
+                "MOV     R0, #0\n"
+                "BL      sub_FF81BE20\n" 
+				"STR     R0, [R4,#0x10]\n" 
+                "MOV     R3, #0\n"				
+                // "STR     R3, [SP,#0x10+var_10]\n"
+				"STR     R3, [SP]\n"
+//                "LDR     R3, =0xFF861210\n" 
+				"LDR     R3, =task_CaptSeqTask_my\n" //  task_CaptSeqTask  <-------------------------
+				"LDR     R0, =0xFF861710\n"             // aCaptseqtask ; "CaptSeqTask" 
+                "MOV     R2, #0x1000\n"
+                "MOV     R1, #0x17\n"
+                "BL      sub_FF81BDC8\n"                
+                "LDMFD   SP!, {R3-R5,PC}\n"
+        ".ltorg\n"
+        );
+}; //#fe
+
+
+
+// -----------------
+// SDHC-Boot-Support
+// -----------------
+// Required subs:
+//   Startup -> FFC1C6C4 -> FFC1C294 ->           FFC5E6C0 -> uAC_Boot -> CreateTask_InitFileModules -> task_InitFileModules -> FFC5A4E8 -> FFC3F0CC -> FFC3EF08 -> FFC3EDA0
+//                           \->FFC5F474 -> FFC5F410 ->/|
+//                   -> StartFactoryModeController =>||
+//
+// uAC_Boot:                   FFC5E06C
+// CreateTask_InitFileModules: FFC5F7A4 
+// task_InitFileModules:       FFC5F754 
+
+//OK
+void __attribute__((naked,noinline)) sub_FF82D720_my() { //#fs  
+        asm volatile (
+                "STMFD   SP!, {R4,LR}\n"
+                "BL      sub_FF873F90\n"   
+                "BL      sub_FF824504\n"    // IsFactoryMode"  
+                "CMP     R0, #1\n"
+                "BNE     loc_FF82D740\n"  
+                "BL      sub_FF8773E0\n" 
+                "LDMFD   SP!, {R4,LR}\n"
+                "B       sub_FF82457C\n"    // StartFactoryModeController" 
+         "loc_FF82D740:\n" 
+                "BL      sub_FF876264\n" 
+                "LDR     R4, =0x1E50\n" 
+                "LDR     R0, [R4,#4]\n"
+                "CMP     R0, #0\n"
+                "LDMNEFD SP!, {R4,PC}\n"
+                "MOV     R1, #0\n"
+                //"LDR     R0, =0xFF82D250\n"        
+                "LDR     R0, =sub_FF82D250_my\n"        // continue here for SDHC-boot-support   <------------------
+                "BL      sub_FF8709DC\n"    
+                "STR     R0, [R4,#4]\n"
+                "LDMFD   SP!, {R4,PC}\n"
+        );
+}; //#fe
+
+//OK
+void __attribute__((naked,noinline)) sub_FF82D250_my() { //#fs    
+        asm volatile (
+                
+                 "STMFD   SP!, {R3-R11,LR}\n"
+                 "LDR     R6, =0x1E50\n"
+                 "MOV     R5, R1\n"
+                 "LDR     R0, [R6,#0x14]\n"
+                 "MOV     R4, R3\n"
+                 "CMP     R0, #1\n"
+                 "BNE     loc_FF82D274\n"
+                 "BL      sub_FF87486C\n"
+                 "B       loc_FF82D65C\n"
+        "loc_FF82D274:\n" 
+                "LDR     R12, =0x1162\n" 
+                "LDR     R10, =0x1005\n"  
+                "CMP     R5, R12\n"  
+                "MOV     R7, #0\n"  
+                "MOV     R8, #1\n"  
+                "BEQ     loc_FF82D67C\n"  
+                "BGT     loc_FF82D3C8\n"  
+                "LDR     R12, =0x1062\n"  
+                "CMP     R5, R12\n"  
+                "BEQ     loc_FF82D718\n"  
+                "BGT     loc_FF82D33C\n"  
+                "CMP     R5, R10\n"  
+                "BEQ     loc_FF82D6A8\n" 
+                "BGT     loc_FF82D314\n"  
+                "LDR     R9, =0x9A3\n"  
+                "CMP     R5, R9\n"  
+                "BEQ     loc_FF82D63C\n"
+				"BGT     loc_FF82D2F0\n"  
+                "SUB     R12, R5, #0x800\n"  
+                "SUBS    R12, R12, #3\n" 
+                "BEQ     loc_FF82D4D8\n" 
+                "SUB     R12, R5, #0x800\n"  
+                "SUBS    R12, R12, #0x158\n"  
+                "BNE     loc_FF82D66C\n"  
+                "TST     R4, #0x80000000\n"  
+                "MOVNE   R0, #1\n"  
+                "BNE     locret_FF82D534\n"  
+                "BL      sub_FF87DA3C\n" 
+				"CMP     R0, #0\n"
+                "BLEQ    sub_FF829828\n"  
+				"B       loc_FF82D65C\n"  
+"loc_FF82D2F0:\n"       
+				"SUB     R12, R5, #0x900\n"
+				"SUBS    R12, R12, #0xA5\n"
+				"BEQ     loc_FF82D63C\n"
+				"SUB     R12, R5, #0x1000\n"
+				"SUBS    R12, R12, #3\n"
+				"BNE     loc_FF82D66C\n"
+				"BL      sub_FF82D1B4\n"
+				"MOV     R1, R4\n"
+				"B       loc_FF82D674\n"
+"loc_FF82D314:\n"       
+                "SUB     R12, R5, #0x1000\n"
+                "SUBS    R12, R12, #0x56\n"
+                "SUBNE   R12, R5, #0x1000\n"
+                "SUBNES  R12, R12, #0x5B\n"
+                "SUBNE   R12, R5, #0x1000\n"
+                "SUBNES  R12, R12, #0x5E\n"
+                "SUBNE   R12, R5, #0x1000\n"
+                "SUBNES  R12, R12, #0x61\n"
+                "BNE     loc_FF82D66C\n"
+                "B       loc_FF82D718\n"
+"loc_FF82D33C:\n"       
+                "LDR     R12, =0x10AD\n"
+                "CMP     R5, R12\n"
+                "BEQ     loc_FF82D698\n"
+                "BGT     loc_FF82D38C\n"
+                "SUB     R12, R5, #0x1000\n"
+                "SUBS    R12, R12, #0x63\n"
+                "SUBNE   R12, R5, #0x1000\n"
+                "SUBNES  R12, R12, #0x65\n"
+                "BEQ     loc_FF82D718\n"
+                "SUB     R12, R5, #0x1000\n"
+                "LDR     R0, =0x10A3\n"
+                "SUBS    R12, R12, #0xA9\n"
+                "BEQ     loc_FF82D68C\n"
+                "SUB     R12, R5, #0x1000\n"
+                "SUBS    R12, R12, #0xAA\n"
+                "BNE     loc_FF82D66C\n"
+                "BL      sub_FF872EB8\n" 
+                "CMP     R0, #0\n"
+                "BEQ     loc_FF82D6A4\n"
+                "B       loc_FF82D65C\n"
+"loc_FF82D38C:\n"  
+                "SUB     R12, R5, #0x1000\n"  
+                "SUBS    R12, R12, #0xAE\n"  
+                "BEQ     loc_FF82D6A4\n"  
+                "SUB     R12, R5, #0x1000\n"  
+                "SUBS    R12, R12, #0xAF\n" 
+                "BEQ     loc_FF82D698\n"  
+                "SUB     R12, R5, #0x1000\n"  
+                "SUBS    R12, R12, #0xB0\n"  
+                "BEQ     loc_FF82D6A4\n"  
+                "SUB     R12, R5, #0x1000\n"  
+                "SUBS    R12, R12, #0xB2\n"  
+                "BNE     loc_FF82D66C\n"  
+				"LDR     R0, =0x1008\n"  
+				"MOV     R1, R4\n"  
+				"B       loc_FF82D674\n"  
+"loc_FF82D3C8:\n"
+                 "LDR     R11, =0x201B\n"
+                 "LDR     R0, =0x1E50\n"
+                 "CMP     R5, R11\n"
+                 "LDR     R2, [R0,#0x10]!\n"
+                 "LDR     R1, [R0,#0x10]\n"
+                 "SUB     R9, R11, #0x17\n"
+                 "BEQ     loc_FF82D610\n"
+                 "BGT     loc_FF82D460\n"
+                 "LDR     R11, =0x116A\n"
+                 "CMP     R5, R11\n"
+                 "BEQ     loc_FF82D5FC\n"
+                 "BGT     loc_FF82D424\n"
+                 "SUB     R0, R5, #0x1100\n"
+                 "SUB     R0, R0, #0x63\n"
+                 "CMP     R0, #5\n"
+                 "ADDLS   PC, PC, R0,LSL#2\n"
+                 "B       loc_FF82D66C\n"
+"loc_FF82D40C:\n"      
+                 "B       loc_FF82D634\n"
+"loc_FF82D410:\n"      
+                "B       loc_FF82D628\n"
+"loc_FF82D414:\n"      
+                "B       loc_FF82D620\n"
+"loc_FF82D418:\n"      
+                "B       loc_FF82D66C\n"
+"loc_FF82D41C:\n"   
+                 "B       loc_FF82D5BC\n"
+"loc_FF82D420:\n"      
+                "B       loc_FF82D5BC\n"
+"loc_FF82D424:\n"       
+                "SUB     R12, R5, #0x2000\n"
+                "SUBS    R12, R12, #2\n"
+                 "BEQ     loc_FF82D6E4\n"
+                "CMP     R5, R9\n"
+                "MOV     R0, R9\n"
+                "BEQ     loc_FF82D6F0\n"
+                 "SUB     R12, R5, #0x2000\n"
+                "SUBS    R12, R12, #5\n"
+                "BEQ     loc_FF82D6E4\n"
+                "SUB     R12, R5, #0x2000\n"
+                 "SUBS    R12, R12, #0x19\n"
+                "BNE     loc_FF82D66C\n"
+                "CMP     R1, #0\n"
+                "BNE     loc_FF82D6D0\n"
+                 "B       loc_FF82D65C\n"
+"loc_FF82D460:\n"      
+                "LDR     R12, =0x3110\n"
+                "CMP     R5, R12\n"
+                "BEQ     loc_FF82D6A8\n"
+                 "BGT     loc_FF82D4A8\n"
+                "SUB     R12, R5, #0x2000\n"
+                "SUBS    R12, R12, #0x1D\n"
+                "BEQ     loc_FF82D6E4\n"
+                 "LDR     R0, =0x2027\n"
+                "CMP     R5, R0\n"
+                "BEQ     loc_FF82D6B0\n"
+                "SUB     R12, R5, #0x3000\n"
+                 "SUBS    R12, R12, #6\n"
+                "BEQ     loc_FF82D6A8\n"
+                "SUB     R12, R5, #0x3000\n"
+                "SUBS    R12, R12, #0x10\n"
+                 "BNE     loc_FF82D66C\n"
+                 "BL      sub_FF893354\n"
+                 "B       loc_FF82D65C\n"
+"loc_FF82D4A8:\n"      
+                 "SUB     R12, R5, #0x3100\n"
+                 "SUBS    R12, R12, #0x11\n"
+                 "BEQ     loc_FF82D6A8\n"
+                 "CMP     R5, #0x3140\n"
+                 "BEQ     loc_FF82D70C\n"
+                 "SUB     R12, R5, #0x3200\n"
+                 "SUBS    R12, R12, #1\n"
+                 "BEQ     loc_FF82D66C\n"
+                 "SUB     R12, R5, #0x3200\n"
+                 "SUBS    R12, R12, #2\n"
+                 "BNE     loc_FF82D66C\n"
+                 "B       loc_FF82D6A8\n"
+"loc_FF82D4D8:\n"       
+                 "MOV     R4, #1\n"
+                 "MOV     R0, #2\n"
+                 "BL      sub_FF874024\n"
+                 "CMP     R0, #1\n"
+                 "MOVEQ   R4, #2\n"
+                 "MOV     R0, R4\n"
+                 "BL      sub_FF8224B0\n" 
+                 "CMP     R0, #0\n"
+                 "STRNE   R8, [R6,#0x14]\n"
+                 "BNE     loc_FF82D530\n"
+                "BL      sub_FF879F0C\n"
+                "BL      sub_FF877D84\n"
+                "BL      sub_FF8789D8\n"
+				"BL      sub_FF877670\n"	
+                 "BL      sub_FF878F88\n"
+                "CMP     R0, #0\n"
+                "BEQ     loc_FF82D59C\n"
+                 "BL      sub_FF82CF20\n"
+                "BL      sub_FF878EEC\n"
+                "MOV     R1, R0\n"
+                "LDR     R0, =0x1167\n"
+                 "BL      sub_FF8711D8\n"
+"loc_FF82D530:\n"       
+                "MOV     R0, R7\n"
+
+"locret_FF82D534:\n"   
+                "LDMFD   SP!, {R3-R11,PC}\n"
+"loc_FF82D59C:\n"       
+                 "BL      sub_FF8268E8\n"
+                 "CMP     R0, #1\n"
+                 "LDRNE   R0, =0x310B\n"
+                 "LDREQ   R0, =0x310C\n"
+                 "MOV     R1, #0\n"
+                 "BL      sub_FF8711D8\n" 
+                 "BL      sub_FF8770A8_my\n"  // Continue here (possibility 1) for SDHC-boot  //<------------------------------------------
+                 "B       loc_FF82D530\n"
+ "loc_FF82D5BC:\n"      
+                 "STR     R8, [R6,#0x10]\n"
+                 "LDR     R6, =0x4508\n"
+                 "LDR     R4, =0x1168\n"
+                 "CMP     R1, #0\n"
+                 "BEQ     loc_FF82D5E4\n"
+                 "BL      sub_FF8748A0\n"
+                 "B       loc_FF82D5F0\n"
+ "loc_FF82D5D8:\n"      
+                 "MOV     R0, R6\n"
+                 "BL      sub_FF85E5B0\n"
+                 "B       loc_FF82D65C\n"
+ 
+ "loc_FF82D5E4:\n"      
+                 "BL      sub_FF8781CC\n"
+                 "BL      sub_FF877F94\n"
+                 "BL      sub_FF826590\n"
+ "loc_FF82D5F0:\n"      
+                 "CMP     R5, R4\n"
+                 "BEQ     loc_FF82D5D8\n"
+                 "B       loc_FF82D65C\n"
+ "loc_FF82D5FC:\n"       
+                 "MOV     R0, #1\n"
+                "BL      sub_FF8749CC\n"
+                "MOV     R1, R11\n"
+                "MOV     R0, R10\n"
+                 "B       loc_FF82D674\n"
+"loc_FF82D610:\n"   
+                "CMP     R2, #1\n"
+                "BNE     loc_FF82D6A8\n"
+                "BL      sub_FF8748A0\n"
+                 "B       loc_FF82D65C\n"
+"loc_FF82D620:\n"       
+                "MOV     R0, #2\n"
+                "B       loc_FF82D62C\n"
+ "loc_FF82D628:\n"     
+                "MOV     R0, #1\n"
+ "loc_FF82D62C:\n"      
+                 "BL      sub_FF82DC30\n"
+                "B       loc_FF82D65C\n"
+"loc_FF82D634:\n"       
+                "MOV     R0, #0\n"
+                "B       loc_FF82D62C\n"  
+ "loc_FF82D63C:\n"                       
+                 "LDR     R0, [R6,#0xC]\n"
+                "SUB     R12, R0, #0x8000\n"
+                "SUBS    R12, R12, #2\n"
+                "BEQ     loc_FF82D65C\n"
+                 "LDR     R0, =0x10A5\n"
+                "BL      sub_FF872EB8\n" // eventproc_export_IsControlEventActive     
+
+                "CMP     R0, #0\n"
+                "BEQ     loc_FF82D664\n"
+ "loc_FF82D65C:\n"      
+                 "MOV     R0, #0\n"
+                "LDMFD   SP!, {R3-R11,PC}\n"
+ "loc_FF82D664:\n"       
+                "CMP     R5, R9\n"
+                "STREQ   R8, [R6,#0x30]\n"
+
+ "loc_FF82D66C:\n"       
+                 "MOV     R1, #0\n"
+"loc_FF82D670:\n"       
+                "MOV     R0, R5\n"
+
+"loc_FF82D674:\n"       
+                "BL      sub_FF875F98_My\n" // Continue here (possibility 2) for SDHC-boot //<-----------------------------
+
+                "LDMFD   SP!, {R3-R11,PC}\n"
+ "loc_FF82D67C:\n"       
+                 "BL      sub_FF87C4A0\n"
+                "CMP     R0, #0\n"
+                "BLNE    sub_FF87B1FC\n"
+                "B       loc_FF82D6A8\n"
+ "loc_FF82D68C:\n"       
+                 "BL      sub_FF872EB8\n" //eventproc_export_IsControlEventActive
+                "CMP     R0, #0\n"
+                "BNE     loc_FF82D65C\n"
+
+"loc_FF82D698:\n"      
+                "MOV     R0, R5\n"
+                 "BL      sub_FF82D040\n"
+                 "LDMFD   SP!, {R3-R11,PC}\n"
+ "loc_FF82D6A4:\n"     
+                 "BL      sub_FF82DC00\n"
+ "loc_FF82D6A8:\n"      
+                 "MOV     R1, R4\n"
+                 "B       loc_FF82D670\n"
+ "loc_FF82D6B0:\n"       
+                 "MOV     R1, #0\n"
+                 "BL      sub_FF875F98_My\n"  //Continue here (possibility 2) for SDHC-boot // <-------------------------------- 
+                "MOV     R1, #0\n"
+                "MOV     R0, R11\n"
+                "BL      sub_FF875F98_My\n"  // Continue here (possibility 2) for SDHC-boot // <----------------------------------
+                "MOV     R1, #0\n"
+                "MOV     R0, R9\n"
+                "B       loc_FF82D6DC\n"
+ "loc_FF82D6D0:\n"       
+                 "CMP     R2, #0\n"
+                 "BNE     loc_FF82D65C\n"
+ "loc_FF82D6D8:\n"      
+                 "MOV     R1, #0\n"	
+"loc_FF82D6DC:\n"     
+                 "BL      sub_FF875F98_My\n"  //Continue here (possibility 2) for SDHC-boot  // <------------------------------------
+                 "B       loc_FF82D65C\n"
+ "loc_FF82D6E4:\n"      
+                 "STR     R7, [R6,#0x20]\n"
+                 "BL      sub_FF82D900\n"
+                 "B       loc_FF82D6A8\n"
+ "loc_FF82D6F0:\n"       
+                 "STR     R7, [R6,#0x20]\n"
+                 "BL      sub_FF82D900\n"
+                 "LDR     R0, [R6,#0x10]\n"
+                 "CMP     R0, #1\n"
+                 "BNE     loc_FF82D6A8\n"
+                 "BL      sub_FF8748E4\n"
+                 "B       loc_FF82D65C\n"
+"loc_FF82D70C:\n"       
+                 "CMP     R1, #0\n"
+                "BLEQ    sub_FF82D900\n"
+                "B       loc_FF82D65C\n"
+"loc_FF82D718:\n"      
+                "LDR   R0, =0xFFFFFFFF\n" // was MOVL tryed MVN provare pure LDR
+                 "B       loc_FF82D6D8\n"				 
+	);
+}; //#fe
+
+
+// Continue here (possibility 1) for SDHC-boot  //OK
+void __attribute__((naked,noinline)) sub_FF8770A8_my() { //#fs  
+        asm volatile (
+                "STMFD   SP!, {R4,LR}\n"				
+				"BL      sub_FF82D8CC\n" 
+                "MOV     R4, R0\n" 
+                "BL      sub_FF8771C4\n" 
+                "MOV     R0, R4\n" 
+                "BL      sub_FF876F5C\n" 
+                "BL      sub_FF82D8CC\n" 
+                "MOV     R4, R0\n" 
+                "LDR     R0, =0x60D8\n" 
+				"LDR     R0, [R0]\n" 
+				"TST     R0, #1\n" 
+				"BEQ     loc_FF8770E4\n" 
+        "loc_FF8770D8:\n" 
+                "MOV     R1, R4\n" 
+                "MOV     R0, #2\n" 
+                "B       loc_FF87714C\n" 
+         "loc_FF8770E4:\n" 
+                "TST     R0, #0x2000\n" 
+                "BEQ     loc_FF877100\n" 
+                "TST     R0, #0x200\n" 
+				"LDREQ   R1, =0x4004\n" 
+				"LDRNE   R1, =0x8002\n" 
+				"MOV     R0, #3\n"
+				"B       loc_FF87714C\n" 
+        "loc_FF877100:\n" 
+                "TST     R0, #0x10\n" 
+                "BNE     loc_FF8770D8\n" 
+				"TST     R0, #0x40\n" 
+				"BEQ     loc_FF87711C\n" 
+        "loc_FF877110:\n"
+                "MOV     R1, R4\n"
+                "MOV     R0, #1\n"
+                "B       loc_FF87714C\n" 
+        "loc_FF87711C:\n" 
+                "TST     R0, #0x20\n"
+                "BEQ     loc_FF877138\n" 
+                "TST     R0, #0x4000\n"
+                "BNE     loc_FF877138\n"
+        "loc_FF87712C:\n"
+                "MOV     R1, R4\n"
+                "MOV     R0, #0\n"
+                "B       loc_FF87714C\n" 
+        "loc_FF877138:\n" 
+                "LDR     R1, =0x102\n"
+                "BICS    R1, R1, R0\n"
+                "BNE     loc_FF877154\n" 
+                "MOV     R1, R4\n"
+                "MOV     R0, #6\n"
+        "loc_FF87714C:\n" 
+                "LDMFD   SP!, {R4,LR}\n"
+                "B       sub_FF876EF8_my\n"        // cont. for SDHC-boot <------------------------------------
+        "loc_FF877154:\n" 
+                "TST     R0, #0x100\n"
+                "BNE     loc_FF8770D8\n" 
+                "TST     R0, #0x4000\n" 
+                "TSTEQ   R0, #0x400\n" 
+				"BNE     loc_FF877110\n" 
+                "TST     R0, #0x200\n"
+                "TSTEQ   R0, #2\n"
+                "BNE     loc_FF87712C\n" 
+                "TST     R0, #0x40000\n"
+                "BEQ     loc_FF8770D8\n" 
+                "TST     R0, #0x200000\n"
+                "MOVEQ   R1, R4\n"
+                "MOVEQ   R0, #1\n"
+                "BLEQ    sub_FF876EF8_my\n"        // cont. for SDHC-boot <------------------------------------
+                "B       loc_FF8770D8\n" 
+        );
+}; //#fe
+//OK
+void __attribute__((naked,noinline)) sub_FF876EF8_my() { //#fs  
+        asm volatile (
+                "STMFD   SP!, {R4-R6,LR}\n"
+                "MOVS    R4, R0\n"
+                "MOV     R0, #1\n"
+                "MOV     R5, R1\n"
+                "BNE     loc_FF876F38\n" 
+                "MOV     R1, #0\n"
+                "MOV     R0, #0\n"
+                "BL      sub_FF873FB4\n" 
+                "BL      sub_FF82D8CC\n" 
+                "SUB     R12, R0, #0x1000\n"
+                "SUBS    R12, R12, #0x5B\n"
+                "BNE     loc_FF876F30\n" 
+        "loc_FF876F28:\n" 
+                "BL      sub_FF876E4C\n" 
+                "B       loc_FF876F40\n" 
+        "loc_FF876F30:\n" 
+                "BL      sub_FF876E8C\n" 
+                "B       loc_FF876F40\n" 
+        "loc_FF876F38:\n" 
+                "CMP     R4, #5\n"
+                "BEQ     loc_FF876F28\n" 
+        "loc_FF876F40:\n" 
+                "CMP     R0, #0\n"
+                "LDREQ   R5, =0x1162\n"
+                "MOVEQ   R4, #2\n"
+                "MOV     R0, R4\n"
+                "MOV     R1, R5\n"
+                "LDMFD   SP!, {R4-R6,LR}\n"
+                "B       sub_FF875F98_My\n" //  Continue here (possibility 2) for SDHC-boot   <-------------------------
+        );
+}; //#fe
+
+
+//NEW  OK
+void __attribute__((naked,noinline)) sub_FF875F98_My() { //#fs 
+        asm volatile (
+                 "STMFD   SP!, {R4-R8,LR}\n"
+                 "MOV     R8, R1\n"
+                 "MOV     R4, R0\n"
+                 "BL      sub_FF878F88\n"
+                 "CMP     R0, #0\n"
+                 "BNE     loc_FF87625C\n"
+                 "MOV     R1, R8\n"
+                 "MOV     R0, R4\n"
+                 "BL      sub_FF874B90\n"
+                 "LDR     R5, =0x6008\n"
+                 "MOV     R7, #1\n"
+                 "LDR     R0, [R5,#0x10]\n"
+                 "MOV     R6, #0\n"
+                 "CMP     R0, #0x16\n"
+                 "ADDLS   PC, PC, R0,LSL#2\n"
+                 "B       loc_FF87625C\n"
+ "loc_FF875FD8:\n"
+                 "B       loc_FF876034\n"
+ "loc_FF875FDC:\n"
+                 "B       loc_FF87605C\n"
+ "loc_FF875FE0:\n"
+                 "B       loc_FF8760A0\n"
+ "loc_FF875FE4:\n"  
+                 "B       loc_FF87611C\n"
+ "loc_FF875FE8:\n"  
+                 "B       loc_FF87612C\n"
+ "loc_FF875FEC:\n"  
+                 "B       loc_FF87625C\n"
+ "loc_FF875FF0:\n"  
+                 "B       loc_FF8761A8\n"
+ "loc_FF875FF4:\n"  
+                 "B       loc_FF8761B8\n"
+ "loc_FF875FF8:\n"  
+                 "B       loc_FF876044\n"
+ "loc_FF875FFC:\n"  
+                 "B       loc_FF876050\n"
+ "loc_FF876000:\n"
+                 "B       loc_FF8761B8\n"
+ "loc_FF876004:\n"  
+                 "B       loc_FF876094\n"
+ "loc_FF876008:\n"  
+                 "B       loc_FF87625C\n"
+ "loc_FF87600C:\n"
+                 "B       loc_FF87625C\n"
+ "loc_FF876010:\n"  
+                 "B       loc_FF8760AC\n"
+ "loc_FF876014:\n"  
+                 "B       loc_FF8760B8\n"
+ "loc_FF876018:\n"  
+                 "B       loc_FF8760F0\n"
+ "loc_FF87601C:\n"  
+                 "B       loc_FF876068\n"
+ "loc_FF876020:\n"  
+                 "B       loc_FF876244\n"
+ "loc_FF876024:\n"  
+                 "B       loc_FF8761C4\n"
+ "loc_FF876028:\n"  
+                 "B       loc_FF8761F4\n"
+ "loc_FF87602C:\n"  
+                 "B       loc_FF8761F4\n"
+ "loc_FF876030:\n"
+                 "B       loc_FF876138\n"
+ "loc_FF876034:\n"  
+                 "MOV     R1, R8\n"
+                 "MOV     R0, R4\n"
+                 "LDMFD   SP!, {R4-R8,LR}\n"
+                 "B       sub_FF875648_my\n"		// uAC_Boot // divert for   <-------------------------
+ "loc_FF876044:\n"  
+                 "MOV     R0, R4\n"
+                 "LDMFD   SP!, {R4-R8,LR}\n"
+                 "B       sub_FF8769B0\n"
+ "loc_FF876050:\n"  
+                 "MOV     R0, R4\n"
+                 "LDMFD   SP!, {R4-R8,LR}\n"
+                 "B       sub_FF875B14\n"
+ "loc_FF87605C:\n"  
+                 "MOV     R0, R4\n"
+                 "LDMFD   SP!, {R4-R8,LR}\n"
+                 "B       sub_FF87522C\n"
+ "loc_FF876068:\n"  
+                 "SUB     R12, R4, #0x1000\n"
+                 "SUBS    R12, R12, #0xA5\n"
+                 "STREQ   R7, [R5,#0x88]\n"
+                 "BEQ     loc_FF876254\n"
+                 "SUB     R12, R4, #0x3000\n"
+                 "SUBS    R12, R12, #6\n"
+                 "BNE     loc_FF87625C\n"
+                 "MOV     R0, #0\n"
+                 "BL      sub_FF82CDA8\n"
+                 "BL      sub_FF876890\n"		// uAC_InitPB
+                 "B       loc_FF876254\n"
+ "loc_FF876094:\n"  
+                 "MOV     R0, R4\n"
+                 "LDMFD   SP!, {R4-R8,LR}\n"
+                 "B       sub_FF8768C8\n"
+ "loc_FF8760A0:\n"  
+                 "MOV     R0, R4\n"
+                 "LDMFD   SP!, {R4-R8,LR}\n"
+                 "B       sub_FF875404\n"
+ "loc_FF8760AC:\n"  
+                 "MOV     R0, R4\n"
+                 "LDMFD   SP!, {R4-R8,LR}\n"
+                 "B       sub_FF875CC0\n"
+ "loc_FF8760B8:\n"  
+                 "SUB     R12, R4, #0x3200\n"
+                 "SUBS    R12, R12, #2\n"
+                 "BNE     loc_FF87625C\n"
+                 "MOV     R0, #3\n"
+                 "BL      sub_FF874A74\n"		// uCameraConState
+                 "MOV     R0, #8\n"
+                 "BL      sub_FF82CD04\n"
+                 "MOV     R1, #0\n"
+                 "MOV     R0, #0x19\n"
+                 "BL      sub_FF83EEE0\n"
+                 "BL      sub_FF8781CC\n"
+                 "BL      sub_FF878018\n"
+                 "BL      sub_FF8776E0\n"
+                 "B       loc_FF876254\n"
+ "loc_FF8760F0:\n"  
+                 "SUB     R12, R4, #0x3300\n"
+                 "SUBS    R12, R12, #1\n"
+                 "BNE     loc_FF87625C\n"
+                 "LDR     R0, =0x4010\n"
+                 "STR     R6, [R5,#0x80]\n"
+                 "BL      sub_FF82CD04\n"
+                 "BL      sub_FF9A90CC\n"
+                 "BL      sub_FF8776E0\n"
+                 "MOV     R0, #4\n"
+                 "BL      sub_FF874A74\n"		// uCameraConState
+                 "B       loc_FF876254\n"
+ "loc_FF87611C:\n"  
+                 "MOV     R1, R8\n"
+                 "MOV     R0, R4\n"
+                 "LDMFD   SP!, {R4-R8,LR}\n"
+                 "B       sub_FF875E1C\n"
+ "loc_FF87612C:\n"  
+                 "MOV     R0, R4\n"
+                 "LDMFD   SP!, {R4-R8,LR}\n"
+                 "B       sub_FF876AF8\n"
+ "loc_FF876138:\n"  
+                 "LDR     R8, =0x1182\n"
+                 "CMP     R4, R8\n"
+                 "STREQ   R7, [R5,#0xB8]\n"
+                 "BEQ     loc_FF876254\n"
+                 "SUB     R12, R4, #0x1000\n"
+                 "SUBS    R12, R12, #0x1AC\n"
+                 "BEQ     loc_FF876190\n"
+                 "SUB     R12, R4, #0x3000\n"
+                 "SUBS    R12, R12, #0x224\n"
+                 "BNE     loc_FF87625C\n"
+                 "MOV     R0, #8\n"
+                 "BL      sub_FF82CD04\n"
+                 "MOV     R0, #3\n"
+                 "BL      sub_FF874A74\n"		// uCameraConState
+                 "STR     R6, [R5,#0xBC]\n"
+                 "LDR     R0, [R5,#0xB8]\n"
+                 "CMP     R0, #0\n"
+                 "MOVNE   R1, #0\n"
+                 "MOVNE   R0, R8\n"
+                 "STRNE   R6, [R5,#0xB8]\n"
+                 "BLNE    sub_FF875E1C\n"
+                 "B       loc_FF876254\n"
+ "loc_FF876190:\n"  
+                 "LDR     R0, [R5,#0xBC]\n"
+                 "CMP     R0, #0\n"
+                 "BNE     loc_FF876254\n"
+                 "BL      sub_FF9A71E4\n"
+                 "STR     R7, [R5,#0xBC]\n"
+                 "B       loc_FF876254\n"
+ "loc_FF8761A8:\n"  
+                 "MOV     R1, R8\n"
+                 "MOV     R0, R4\n"
+                 "LDMFD   SP!, {R4-R8,LR}\n"
+                 "B       sub_FF876BD8\n"
+ "loc_FF8761B8:\n"  
+                 "MOV     R0, R4\n"
+                 "LDMFD   SP!, {R4-R8,LR}\n"
+                 //"B       sub_FF875A0C\n"		
+                 "B       sub_FF875A0C_my\n"		//---------->   movies_rec.c
+ "loc_FF8761C4:\n"  
+                 "LDR     R12, =0x10B0\n"
+                 "CMP     R4, R12\n"
+                 "BEQ     loc_FF8761F0\n"
+                 "BGT     loc_FF8761FC\n"
+                 "CMP     R4, #4\n"
+                 "BEQ     loc_FF876224\n"
+                 "SUB     R12, R4, #0x1000\n"
+                 "SUBS    R12, R12, #0xAA\n"
+                 "SUBNE   R12, R4, #0x1000\n"
+                 "SUBNES  R12, R12, #0xAE\n"
+                 "BNE     loc_FF87625C\n"
+ "loc_FF8761F0:\n"  
+                 "BL      sub_FF874770\n"
+ "loc_FF8761F4:\n"  
+                 "MOV     R0, R6\n"
+                 "LDMFD   SP!, {R4-R8,PC}\n"
+ "loc_FF8761FC:  \n"
+                 "SUB     R12, R4, #0x2000\n"
+                 "SUBS    R12, R12, #4\n"
+                 "BEQ     loc_FF87623C\n"
+                 "SUB     R12, R4, #0x5000\n"
+                 "SUBS    R12, R12, #1\n"
+                 "SUBNE   R12, R4, #0x5000\n"
+                 "SUBNES  R12, R12, #6\n"
+                 "BNE     loc_FF87625C\n"
+                 "BL      sub_FF8751CC\n"
+                 "B       loc_FF876254\n"
+ "loc_FF876224:\n"  
+                 "LDR     R0, [R5,#0x2C]\n"
+                 "CMP     R0, #0\n"
+                 "BNE     loc_FF87623C\n"
+                 "BL      sub_FF87643C\n"
+                 "BL      sub_FF826548\n"
+                 "B       loc_FF876254\n"
+ "loc_FF87623C:\n"
+                 "BL      sub_FF8747AC\n"
+                 "B       loc_FF876254\n"
+ "loc_FF876244:\n"  
+                 "SUB     R12, R4, #0x3000\n"
+                 "SUBS    R12, R12, #0x130\n"
+                 "BNE     loc_FF87625C\n"
+                 "BL      sub_FF87486C\n"
+ "loc_FF876254:\n"
+                 "MOV     R0, #0\n"
+                 "LDMFD   SP!, {R4-R8,PC}\n"
+ "loc_FF87625C:\n"
+                 "MOV     R0, #1\n"
+                 "LDMFD   SP!, {R4-R8,PC}\n"
+        );
+}; //#fe
+
+
+//OK 
+void __attribute__((naked,noinline)) sub_FF875648_my() { //#fs  uAC_Boot  
+    asm volatile (
+			"STMFD   SP!, {R4-R8,LR}\n"
+            "LDR     R7, =0x8002\n"
+            "LDR     R4, =0x6008\n"
+            "CMP     R0, #3\n"
+            "MOV     R6, R1\n"
+            "MOV     R5, #1\n"
+            "BEQ     loc_FF8757BC\n"
+            "BGT     loc_FF875684\n"
+            "CMP     R0, #0\n"
+            "BEQ     loc_FF8756C8\n"
+            "CMP     R0, #1\n"
+            "BEQ     loc_FF87574C\n"
+            "CMP     R0, #2\n"
+            "BNE     loc_FF875844\n"
+            "B       loc_FF87569C\n"
+"loc_FF875684:\n"  
+               "CMP     R0, #6\n" 
+               "STREQ   R5, [R4,#0x28]\n" 
+               "BEQ     loc_FF8757B4\n" 
+               "SUB     R12, R0, #0x2000\n" 
+               "SUBS    R12, R12, #4\n" 
+               "BNE     loc_FF875844\n" 
+
+"loc_FF87569C:\n"  
+                "SUB     R12, R6, #0x1100\n" 
+                "SUBS    R12, R12, #0x62\n" 
+                "BNE     loc_FF8756B8\n" 
+                "MOV     R1, R7\n" 
+                "MOV     R0, #0\n" 
+                "BL      sub_FF878AB0\n" 
+                "STR     R5, [R4,#0x60]\n" 
+
+"loc_FF8756B8:\n"  
+                "BL      sub_FF8781CC\n" 
+                "BL      sub_FF878018\n" 
+                "BL      sub_FF875130\n" 
+                "B       loc_FF87583C\n" 
+"loc_FF8756C8:\n"  
+                 "MOV     R0, #7\n"  
+                 "BL      sub_FF874A74\n"  
+                 "MOV     R0, R7\n"  
+                 "BL      sub_FF82CD04\n"  
+                 "BL      sub_FF877310\n"  // taskcreate_CommonDrivers
+                 "BL      sub_FF877E68\n"  
+                 "MOV     R1, R7\n"  
+                 "MOV     R0, #0\n"  
+                 "BL      sub_FF878AB0\n"  
+                 "LDR     R1, =0xFF87587C\n"  
+                 "MOV     R0, #0x20\n"  
+                 "STR     R6, [R4,#0x18]\n"  
+                 "BL      sub_FF86DA00\n"  
+                 "LDR     R1, =0xFF875888\n" 
+                 "MOV     R0, #0x20\n"  
+                 "BL      sub_FF86DA00\n" 
+                 "STR     R5, [R4,#0x28]\n"  
+                 "BL      sub_FF82CE8C\n"  
+                 "BL      sub_FF82CDD0\n"  
+                 "LDR     R0, [R4,#0x1C]\n"  
+                 "LDR     R1, [R4,#0x20]\n"  
+                 "ORRS    R0, R0, R1\n"  
+                 "BLNE    sub_FF876418\n"  
+                 "LDR     R0, [R4,#0x68]\n"  
+                 "CMP     R0, #0\n"  
+                 "BNE     loc_FF875738\n"  
+                 "BL      sub_FF82CEFC\n"  // taskcreate_StartupImage
+                 "B       loc_FF875740\n"  
+"loc_FF875738:\n"  
+                "BL      sub_FF8262FC\n"
+                "BL      sub_FF82D864\n"
+
+"loc_FF875740:\n"  
+                "BL      sub_FF8772D4_my\n" // taskcreate_InitFileModules<----------------------
+                "BL      sub_FF87734C\n"
+                "B       loc_FF87583C\n"
+"loc_FF87574C:\n"  
+                "MOV     R0, #8\n"
+                "BL      sub_FF874A74\n" 
+                "BL      sub_FF877310\n" 
+                "BL      sub_FF877E68\n"
+                "LDR     R5, =0x4004\n"
+                "MOV     R0, #0\n"
+                "MOV     R1, R5\n"
+                "BL      sub_FF878AB0\n"
+                "LDR     R1, =0xFF875898\n" 
+                "MOV     R0, #0x20\n"
+                "BL      sub_FF86DA00\n" 
+				
+                "BL      sub_FF8772D4_my\n" // taskcreate_InitFileModules  ----------------------------->
+				
+                "BL      sub_FF8773E0\n"
+                "BL      sub_FF82D828\n"
+                "MOV     R0, R5\n"
+                "BL      sub_FF82CD04\n"
+                "LDR     R0, [R4,#0x68]\n"
+                "CMP     R0, #0\n"
+                "BNE     loc_FF8757A0\n"
+                "BL      sub_FF82CEFC\n" // taskcreate_StartupImage
+                "B       loc_FF8757A4\n"
+"loc_FF8757A0:\n"  
+                "BL      sub_FF8262FC\n"
+
+"loc_FF8757A4:\n"  
+                 "BL      sub_FF87737C\n"
+                 "LDR     R0, [R4,#0x30]\n"
+                 "CMP     R0, #0\n"
+                 "BEQ     loc_FF87583C\n"
+
+"loc_FF8757B4:\n"  
+                "BL      sub_FF876460\n"
+                "B       loc_FF87583C\n"
+"loc_FF8757BC:\n"  
+                 "MOV     R1, R6\n"
+                 "MOV     R0, #0\n"
+                 "BL      sub_FF878AB0\n"
+                 "LDR     R1, =0xFF8758A4\n" 
+                 "MOV     R0, #0x20\n"
+                 "BL      sub_FF86DA00\n" 
+                 "STR     R5, [R4,#0x68]\n"
+                 "BL      sub_FF8773E0\n"
+                 "BL      sub_FF82D828\n"
+                 "BL      sub_FF8763F4\n"
+                 "BL      sub_FF82D8C0\n"
+                 "CMP     R0, #0\n"
+                 "LDRNE   R0, =0x804B\n"
+                 "MOVNE   R1, #0\n"
+                 "BLNE    sub_FF873C90\n" // eventproc_export_PTM_SetCurrentItem
+                 "BL      sub_FF8788CC\n"
+                 "MOV     R0, #0x80\n"
+                 "BL      sub_FF82CD04\n"
+                 "BL      sub_FF878310\n"
+                 "BL      sub_FF895AD0\n" // eventproc_export_StartGUISystem
+                 "BL      sub_FF957B60\n"
+                 "BL      sub_FF9ABF4C\n"
+                 "BL      sub_FF877B4C\n"
+                 "BL      sub_FF878204\n"
+                 "MOV     R0, #9\n"
+                 "BL      sub_FF874A74\n" 
+                 "LDR     R0, =0x300E\n"
+                 "MOV     R1, R6\n"
+                 "BL      sub_FF8711D8\n" 
+                 "MOV     R1, #0\n"
+                 "MOV     R0, #1\n"
+                 "BL      sub_FF878AB0\n"
+
+"loc_FF87583C:\n" 
+                "MOV     R0, #0\n"
+                "LDMFD   SP!, {R4-R8,PC}\n"
+"loc_FF875844:\n"  
+               "MOV     R0, #1\n"
+               "LDMFD   SP!, {R4-R8,PC}\n"
+    );
+}; //#fe
+
+//OK
+void __attribute__((naked,noinline)) sub_FF8772D4_my() { //#fs  CreateTask_InitFileModules 
+        asm volatile (
+                "LDR     R0, =0x60E4\n" 
+                "STMFD   SP!, {R3,LR}\n"
+                "LDR     R1, [R0,#4]\n"
+                "CMP     R1, #0\n"
+                "BNE     locret_FF87730C\n" 
+                "MOV     R1, #1\n"
+				"STR     R1, [R0,#4]\n"
+                "MOV     R3, #0\n"
+                "STR     R3, [SP]\n"
+				
+                "LDR     R3, =task_InitFileModules_my\n" // continue for SDHC-boot (orig: FFC5F754)-g9 = FF877284  "LDR     R3, =task_InitFileModules_my\n"
+                
+				"MOV     R1, #0x19\n"
+                "LDR     R0, =0xFF877438\n"     // aInitfilemodule 
+                "MOV     R2, #0x1000\n"
+                "BL      sub_FF81BAF0\n"         // CreateTask
+        "locret_FF87730C:\n" 
+                "LDMFD   SP!, {R12,PC}\n"
+        );
+}; //#fe
+
+//OK
+void __attribute__((naked,noinline)) task_InitFileModules_my() { //#fs   task_InitFileModules_my
+        asm volatile (
+                "STMFD   SP!, {R4-R6,LR}\n"
+                "BL      sub_FF86FFF8\n" 
+                "LDR     R5, =0x5006\n"
+                "MOVS    R4, R0\n"
+                "MOVNE   R1, #0\n"
+                "MOVNE   R0, R5\n"
+                "BLNE    sub_FF8711D8\n" 
+                "BL      sub_FF870024_my\n"    // continue to SDHC-hook here! was FFC5A4E8
+				
+                "BL      core_spytask_can_start\n"      // CHDK: Set "it's-save-to-start"-Flag for spytask
+				
+                "CMP     R4, #0\n"
+                "MOVEQ   R0, R5\n"
+                "LDMEQFD SP!, {R4-R6,LR}\n"
+                "MOVEQ   R1, #0\n"
+                "BEQ     sub_FF8711D8\n"        
+                "LDMFD   SP!, {R4-R6,PC}\n"
+        );
+}; //#fe
+
+//OK
+void __attribute__((naked,noinline)) sub_FF870024_my() { //#fs  
+
+	        asm volatile (
+                "STMFD   SP!, {R4,LR}\n"
+                
+				"BL      sub_FF85235C_my\n"    // continue to SDHC-hook here! was FFC3F0CC --------------------------------------->
+                
+				"LDR     R4, =0x5AC4\n"	
+                "LDR     R0, [R4,#4]\n"
+                "CMP     R0, #0\n"
+                "BNE     loc_FF870054\n" 
+                "BL      sub_FF87FD60\n" 
+                "BL      sub_FF90B938\n" 
+                "BL      sub_FF87FD60\n" 
+                "BL      sub_FF91848C\n" 
+                "BL      sub_FF87FD70\n" 
+                "BL      sub_FF90B9E0\n" 
+        "loc_FF870054:\n" 
+                "MOV     R0, #1\n"
+                "STR     R0, [R4]\n"
+                "LDMFD   SP!, {R4,PC}\n"
+        );
+}; //#fe
+//OK
+void __attribute__((naked,noinline)) sub_FF85235C_my() { //#fs  
+
+        asm volatile (
+                "STMFD   SP!, {R4-R6,LR}\n"
+                "MOV     R6, #0\n"
+                "MOV     R0, R6\n"
+                "BL      sub_FF851F2C\n" 
+                "LDR     R4, =0x168D0\n" 
+                "MOV     R5, #0\n"
+                "LDR     R0, [R4,#0x38]\n"
+                "BL      sub_FF8528F4\n" 
+                "CMP     R0, #0\n"
+                "LDREQ   R0, =0x2D34\n" 
+                "STREQ   R5, [R0,#0xC]\n"
+                "STREQ   R5, [R0,#0x10]\n"
+                "STREQ   R5, [R0,#0x14]\n"
+                "MOV     R0, R6\n"
+                "BL      sub_FF851F6C\n"        // uMounter (u=unknown, just to prevent misunderstandings)
+                "MOV     R0, R6\n"
+				
+				"BL      sub_FF852198_my\n"    // continue to SDHC-hook here! <---------------------
+                
+				"MOV     R5, R0\n"
+                "MOV     R0, R6\n"
+                "BL      sub_FF852204\n" 
+                "LDR     R1, [R4,#0x3C]\n"
+                "AND     R2, R5, R0\n"
+                "CMP     R1, #0\n"
+                "MOV     R0, #0\n"
+                "MOVEQ   R0, #0x80000001\n"
+                "BEQ     loc_FF8523F0\n" 
+                "LDR     R3, [R4,#0x2C]\n"
+                "CMP     R3, #2\n"
+                "MOVEQ   R0, #4\n"
+                "CMP     R1, #5\n"
+                "ORRNE   R0, R0, #1\n"
+                "BICEQ   R0, R0, #1\n"
+                "CMP     R2, #0\n"
+                "BICEQ   R0, R0, #2\n"
+                "ORREQ   R0, R0, #0x80000000\n"
+                "BICNE   R0, R0, #0x80000000\n"
+                "ORRNE   R0, R0, #2\n"
+        "loc_FF8523F0:\n" 
+                "STR     R0, [R4,#0x40]\n"
+                "LDMFD   SP!, {R4-R6,PC}\n"
+        );
+}; //#fe
+//OK
+void __attribute__((naked,noinline)) sub_FF852198_my() { //#fs  
+        asm volatile (
+                "STMFD   SP!, {R4-R6,LR}\n"
+                "LDR     R5, =0x2D34\n" 
+                "MOV     R6, R0\n"
+                "LDR     R0, [R5,#0x10]\n"
+                "CMP     R0, #0\n"
+                "MOVNE   R0, #1\n"
+                "LDMNEFD SP!, {R4-R6,PC}\n"
+                "MOV     R0, #0x17\n"
+                "MUL     R1, R0, R6\n"
+                "LDR     R0, =0x168D0\n" 
+                "ADD     R4, R0, R1,LSL#2\n"
+                "LDR     R0, [R4,#0x38]\n"
+                "MOV     R1, R6\n"
+									
+				"BL      sub_FF852030_my\n"        //    continue to SDHC-hook here! --------------------------------------------------->
+               
+			   "CMP     R0, #0\n"
+                "LDMEQFD SP!, {R4-R6,PC}\n"
+                "LDR     R0, [R4,#0x38]\n"
+                "MOV     R1, R6\n"
+                "BL      sub_FF852A0C\n" 
+                "CMP     R0, #0\n"
+                "LDMEQFD SP!, {R4-R6,PC}\n"
+                "MOV     R0, R6\n"
+                "BL      sub_FF851B4C\n" 
+                "CMP     R0, #0\n"
+                "MOVNE   R1, #1\n"
+                "STRNE   R1, [R5,#0x10]\n"
+                "LDMFD   SP!, {R4-R6,PC}\n"
+        );
+}; //#fe
+
+//OK
+void __attribute__((naked,noinline)) sub_FF852030_my() { //#fs  ; Partition table parse takes place here. => SDHC-boot 
+       asm volatile (	
+	   
+                "STMFD   SP!, {R4-R8,LR} \n"
+                "MOV     R8, R0\n"
+                "MOV     R0, #0x17\n"
+                "MUL     R1, R0, R1\n"
+                "LDR     R0, =0x168D0\n"
+                "MOV     R6, #0\n"
+                "ADD     R7, R0, R1,LSL#2\n"
+                "LDR     R0, [R7,#0x3C]\n"
+                "MOV     R5, #0\n"
+                "CMP     R0, #6\n"
+                "ADDLS   PC, PC, R0,LSL#2\n"
+                "B       loc_FF85217C\n"		
+"loc_FF852060:\n"
+                "B       loc_FF852094\n"
+"loc_FF852064:\n"
+                "B       loc_FF85207C\n"
+"loc_FF852068:\n"
+                "B       loc_FF85207C\n"
+"loc_FF85206C:\n"
+                "B       loc_FF85207C\n"
+"loc_FF852070:\n"
+                "B       loc_FF85207C\n"
+"loc_FF852074:\n"
+                "B       loc_FF852174\n"	
+"loc_FF852078:\n"
+                "B       loc_FF85207C\n"
+"loc_FF85207C:\n"
+                "MOV     R2, #0\n"
+                "MOV     R1, #0x200\n"
+                "MOV     R0, #3\n"
+                "BL      sub_FF86C4D0\n"
+                "MOVS    R4, R0\n"
+                "BNE     loc_FF85209C\n"				
+"loc_FF852094:\n"
+                "MOV     R0, #0\n"
+                "LDMFD   SP!, {R4-R8,PC}\n"
+"loc_FF85209C:\n"
+                "LDR     R12, [R7,#0x4C]\n"
+                "MOV     R3, R4\n"
+                "MOV     R2, #1\n"
+                "MOV     R1, #0\n"
+                "MOV     R0, R8\n"
+				
+                //"BLX     R12\n"       // !! Workaround !! attenzione
+                //".long   0xE12FFF3C\n" 				
+                "MOV     LR, PC\n"      // gcc won't compile "BLX R12" nor "BL R12".
+                "MOV     PC, R12\n"     // workaround: make your own "BL" and hope we don't need the change to thumb-mode
+				
+                "CMP     R0, #1\n"
+                "BNE     loc_FF8520C8\n"
+                "MOV     R0, #3\n"
+                "BL      sub_FF86C610\n"
+                "B       loc_FF852094\n"
+"loc_FF8520C8:\n"
+                "MOV     R0, R8\n"
+                "BL      sub_FF929040\n" // Add FAT32 autodetect-code after this line\n"
+
+                "MOV   R1, R4\n"           //  pointer to MBR in R1
+                "BL    mbr_read_dryos\n"   //  total sectors count in R0 before and after call
+
+
+                // Start of DataGhost's FAT32 autodetection code
+                // Policy: If there is a partition which has type W95 FAT32, use the first one of those for image storage
+                // According to the code below, we can use R1, R2, R3 and R12.
+                // LR wasn't really used anywhere but for storing a part of the partition signature. This is the only thing
+                // that won't work with an offset, but since we can load from LR+offset into LR, we can use this to do that :)
+                "MOV     R12, R4\n"                    // Copy the MBR start address so we have something to work with
+                "MOV     LR, R4\n"                     // Save old offset for MBR signature
+                "MOV     R1, #1\n"                     // Note the current partition number
+                "B       dg_sd_fat32_enter\n"          // We actually need to check the first partition as well, no increments yet!
+           "dg_sd_fat32:\n"
+                "CMP     R1, #4\n"                     // Did we already see the 4th partition?
+                "BEQ     dg_sd_fat32_end\n"            // Yes, break. We didn't find anything, so don't change anything.
+                "ADD     R12, R12, #0x10\n"            // Second partition
+                "ADD     R1, R1, #1\n"                 // Second partition for the loop
+           "dg_sd_fat32_enter:\n"
+                "LDRB    R2, [R12, #0x1BE]\n"          // Partition status
+                "LDRB    R3, [R12, #0x1C2]\n"          // Partition type (FAT32 = 0xB)
+                "CMP     R3, #0xB\n"                   // Is this a FAT32 partition?
+                "CMPNE   R3, #0xC\n"                   // Not 0xB, is it 0xC (FAT32 LBA) then?
+                "BNE     dg_sd_fat32\n"                // No, it isn't.
+                "CMP     R2, #0x00\n"                  // It is, check the validity of the partition type
+                "CMPNE   R2, #0x80\n"
+                "BNE     dg_sd_fat32\n"                // Invalid, go to next partition
+                                                       // This partition is valid, it's the first one, bingo!
+                "MOV     R4, R12\n"                    // Move the new MBR offset for the partition detection.
+                
+           "dg_sd_fat32_end:\n"
+                // End of DataGhost's FAT32 autodetection code                
+                "LDRB    R1, [R4,#0x1C9]\n"			// Continue with firmware
+                "LDRB    R3, [R4,#0x1C8]\n"
+                "LDRB    R12, [R4,#0x1CC]\n"
+                "MOV     R1, R1,LSL#24\n"
+                "ORR     R1, R1, R3,LSL#16\n"
+                "LDRB    R3, [R4,#0x1C7]\n"
+                "LDRB    R2, [R4,#0x1BE]\n"
+                  //"LDRB    LR, [R4,#0x1FF]\n"		// replaced, see below
+                "ORR     R1, R1, R3,LSL#8\n"
+                "LDRB    R3, [R4,#0x1C6]\n"
+                "CMP     R2, #0\n"
+                "CMPNE   R2, #0x80\n"
+                "ORR     R1, R1, R3\n"
+                "LDRB    R3, [R4,#0x1CD]\n"
+                "MOV     R3, R3,LSL#24\n"
+                "ORR     R3, R3, R12,LSL#16\n"
+                "LDRB    R12, [R4,#0x1CB]\n"
+                "ORR     R3, R3, R12,LSL#8\n"
+                "LDRB    R12, [R4,#0x1CA]\n"
+                "ORR     R3, R3, R12\n"
+                  //"LDRB    R12, [R4,#0x1FE]\n"		// replaced, see below
+				
+                "LDRB    R12, [LR,#0x1FE]\n"        // New! First MBR signature byte (0x55)
+                "LDRB    LR, [LR,#0x1FF]\n"         //      Last MBR signature byte (0xAA)				
+				
+                "MOV     R4, #0\n"
+                "BNE     loc_FF852150\n"
+                "CMP     R0, R1\n"
+                "BCC     loc_FF852150\n"
+                "ADD     R2, R1, R3\n"
+                "CMP     R2, R0\n"
+                "CMPLS   R12, #0x55\n"
+                "CMPEQ   LR, #0xAA\n"
+                "MOVEQ   R6, R1\n"
+                "MOVEQ   R5, R3\n"
+                "MOVEQ   R4, #1\n"
+"loc_FF852150:\n"
+                "MOV     R0, #3\n"
+                "BL      sub_FF86C610\n"
+                "CMP     R4, #0\n"
+                "BNE     loc_FF852188\n"
+                "MOV     R6, #0\n"
+                "MOV     R0, R8\n"
+                "BL      sub_FF929040\n"
+                "MOV     R5, R0\n"
+                "B       loc_FF852188\n"
+"loc_FF852174:\n"
+                "MOV     R5, #0x40\n"
+                "B       loc_FF852188\n"
+"loc_FF85217C:\n"
+                "LDR     R1, =0x365\n"
+                "LDR     R0, =0XFF852024\n"		//aMounter_c  ; "Mounter.c"
+                "BL      sub_FF81BFC8\n"			//DebugAssert
+"loc_FF852188:\n"
+                "STR     R6, [R7,#0x44]!\n"
+                "MOV     R0, #1\n"
+                "STR     R5, [R7,#4]\n"
+                "LDMFD   SP!, {R4-R8,PC}\n"  
+        );
+}; //#fe
+
+
+//*********************************************
+
+// I could not manually find this function in the S5IS firmware, possibly signatures
+// might find it. Until that moment, I hooked it here (copied from another camera)
+unsigned long __attribute__((naked,noinline)) _time(unsigned long *timer) {
+     asm volatile (
+          "STMFD   SP!, {R3-R5,LR}\n"
+          "MOV     R4, R0\n"
+          "MVN     R0, #0\n"
+          "STR     R0, [SP,#0x10-0x10]\n"
+          "MOV     R0, SP\n"
+          "BL      sub_FF86BAEC\n" // _GetTimeOfSystem\n"
+          "CMP     R0, #0\n"
+          "BNE     loc_FFC55EC8\n"
+          "CMP     R4, #0\n"
+          "LDRNE   R0, [SP,#0x10-0x10]\n"
+          "STRNE   R0, [R4]\n"
+
+     "loc_FFC55EC8:\n"
+          "LDR     R0, [SP,#0x10-0x10]\n"
+          "LDMFD   SP!, {R3-R5,PC}\n"
+     );
+   return 0;  // shut up the compiler
+}
+
+/*
+ 
+
+
+void CreateTask_blinker() {
+        _CreateTask("Blinker", 0x1, 0x200, task_blinker, 0);
+};
+
+
+void __attribute__((naked,noinline)) task_blinker() {
+        int ledstate;
+
+        int counter = 0;
+
+        long *led = (void*) 0xC022006C;   // AF led
+
+        long *anypointer;       // multi-purpose pointer to poke around in memory
+        long v1, v2, v3, v4;    // multi-purpose vars
+
+        ledstate = 0;   // init: led off
+        *led = 0x46;      // led on
+
+        while (1) {
+                counter++;
+
+                if (ledstate == 1) {    // toggle LED
+                        ledstate = 0;
+                        *led = 0x44;      // LED off
+                        //core_test(1);
+                } else {
+                        ledstate = 1;
+                        *led = 0x46;      // LED on
+                        //core_test(0);
+                }
+
+                if (counter == 2) {
+                        //dump_chdk();
+				//                      gui_init();
+                        //_ExecuteEventProcedure("UIFS_WriteFirmInfoToFile");
+                        //_UIFS_WriteFirmInfoToFile(0);
+                }
+
+                if (counter == 10) {
+//                        draw_txt_string(2, 2, "test");
+                }
+
+                msleep(500);
+        }
+};
+ 
+
+ //extern long _Fopen_Fut(const char *filename, const char *mode);
+//extern void _Fclose_Fut(long file);
+//extern long _Fwrite_Fut(const void *buf, long elsize, long count, long f);
+//extern long Fread_Fut(void *buf, long elsize, long count, long f);
+//extern long Fseek_Fut(long file, long offset, long whence);
+//extern long _qDump(char* filename, long unused, long write_p2, long write_p3);
+
+void dump_chdk() { //#fs
+    int fd;
+    long dirnum;
+        
+    volatile long *led = (void*) 0xC0220094;   // yellow led
+    volatile long *led_blue = (void*) 0xC022006c;   // yellow led
+
+    *led = 0x46; //on 
+
+  //  _qDump("A/qdump", 0, (void*) 0x01900, 0xb0000);
+    //_qDump("A/firmdump", 0, (void*) 0xFFC00000, 0x00400000);
+    //_qDump("A/firmlower", 0, (void*) 0xff800000, 0x00400000); // identical to 0xfc000000
+
+    //started();
+
+	//dirnum = get_target_dir_num();
+	//sprintf(fn, FN_RAWDIR, dirnum);
+	//mkdir(fn);
+
+	//sprintf(fn, FN_RAWDIR "/" "DMP_%04d.JPG", dirnum, ++ramdump_num);
+
+    *led_blue = 0x46; //on 
+    *led_blue = 0x44; //off
+                msleep(500);
+    *led_blue = 0x46; //on 
+	fd = _Fopen_Fut("A/dump", "w");
+    *led_blue = 0x44; //off
+	if (fd >= 0) {
+    *led_blue = 0x46; //on 
+	    write(fd, (void*)0, 0x1900);
+    *led_blue = 0x44; //off
+	    //write(fd, (void*)0x1900, 32*1024*1024-0x1900);
+            //_Fwrite_Fut((void*)0x9D000, 0x20000, 0x20000, fd);
+    *led_blue = 0x46; //on 
+	    _Fclose_Fut(fd);
+    *led_blue = 0x44; //off
+	}
+    *led = 0x44; //off
+    //finished();
+} //#fe 
+
+*/
+
+//*********************************************
+ 
Index: /branches/reyalp-ptp-live/platform/g9/sub/100d/stubs_min.S
===================================================================
--- /branches/reyalp-ptp-live/platform/g9/sub/100d/stubs_min.S	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/g9/sub/100d/stubs_min.S	(revision 1668)
@@ -0,0 +1,3 @@
+#include "stubs_asm.h"
+
+DEF(recreview_hold,                     0xF050) // 0xEFA0+0xB0		//OK
Index: /branches/reyalp-ptp-live/platform/g9/sub/100d/makefile.inc
===================================================================
--- /branches/reyalp-ptp-live/platform/g9/sub/100d/makefile.inc	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/g9/sub/100d/makefile.inc	(revision 1668)
@@ -0,0 +1,15 @@
+#315A
+PLATFORMID=12634
+
+PLATFORMOS=dryos
+
+MEMBASEADDR=0x1900
+RESTARTSTART=0x50000	
+MEMISOSTART=0xB0B68
+ROMBASEADDR=0xff810000
+
+
+PLFLAGS=-DMEMBASEADDR=$(MEMBASEADDR) -DMEMISOSTART=$(MEMISOSTART) -DMEMISOSIZE=$(MEMISOSIZE)
+PLFLAGS+=-DRESTARTSTART=$(RESTARTSTART)
+
+KEYSYS=d3
Index: /branches/reyalp-ptp-live/platform/g9/sub/100d/stubs_asm.h
===================================================================
--- /branches/reyalp-ptp-live/platform/g9/sub/100d/stubs_asm.h	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/g9/sub/100d/stubs_asm.h	(revision 1668)
@@ -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/reyalp-ptp-live/platform/g9/sub/100d/lib.c
===================================================================
--- /branches/reyalp-ptp-live/platform/g9/sub/100d/lib.c	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/g9/sub/100d/lib.c	(revision 1668)
@@ -0,0 +1,101 @@
+#include "platform.h"
+#include "stdlib.h"
+#include "lolevel.h"
+
+
+void *hook_raw_fptr()
+{
+    return (void*)0;
+}
+
+void *hook_raw_ret_addr()
+{
+    return (void*)0;
+}
+
+char *hook_raw_image_addr()
+{
+ return (char*) (*(int*)(0x5854+0x18) ? 0x11F8F740 : 0x108297C0);
+}
+
+long hook_raw_size()
+{
+    return 0xEE9710;//OK
+}
+
+void *vid_get_viewport_live_fb()
+{
+    return (void*)0;
+//    void **fb=(void **)0x21D0;
+//    unsigned char buff = *((unsigned char*)0x2084);
+//    if (buff == 0) {
+//        buff = 2;
+//    }
+//    else {
+//        buff--;
+//    }
+//    return fb[buff];
+}
+
+void *vid_get_bitmap_fb()       
+{
+    return (void*)0x10361000;//OK	
+	//THUM VRAM BUFF=0x103F2920 ;  IMG VRAM BUFF=0x108876B0 ; JPEG BUFF=0x11713000 ; MJVRAM Address=0x107F7040 ; MJVRAM Size=0x180000
+	//VRAM Address=0x1067B540 ; VRAM Size=0x7E900
+}
+
+void *vid_get_viewport_fb()
+{
+     return (void*)0x1067B540;//OK //0x1065A560;
+					
+}
+
+void *vid_get_viewport_fb_d()
+{
+    return (void*)(*(int*)0x55A0); //OK // 0x5558 + 0x48
+}
+
+long vid_get_viewport_height()
+{
+    return 240;
+}
+
+void JogDial_CW(void){
+  (*(short*)(0x263C+2))--;
+//  *(int*)(0x263C+0x18)=0x0;
+  *(int*)(0x263C+0x14)=0x32;
+  _GiveSemaphore(*(int*)(0x263C+0x0C));
+}
+
+void JogDial_CCW(void){
+  (*(short*)(0x263C+2))++;
+//  *(int*)(0x263C+0x18)=0x0;
+  *(int*)(0x263C+0x14)=0x32;
+  _GiveSemaphore(*(int*)(0x263C+0x0C));
+}
+
+//from sx100is
+//void JogDial_CW(void){
+//  (*(short*)(0x2590+2))--;
+//  *(int*)(0x2590+0x18)=0x32;
+//  _GiveSemaphore(*(int*)(0x2590+0x10));
+//}
+//
+//void JogDial_CCW(void){
+//  (*(short*)(0x2590+2))++;
+//  *(int*)(0x2590+0x18)=0x32;
+//  _GiveSemaphore(*(int*)(0x2590+0x10));
+//}
+//from sx100is
+
+int review_fullscreen_mode(){
+ char r;
+ get_parameter_data(53, &r, 1);
+ return  r==0;
+}
+//from g7
+
+char *camera_jpeg_count_str()
+{
+    return (char*)0x60354;//OK
+}
Index: /branches/reyalp-ptp-live/platform/g9/sub/100d/movie_rec.c
===================================================================
--- /branches/reyalp-ptp-live/platform/g9/sub/100d/movie_rec.c	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/g9/sub/100d/movie_rec.c	(revision 1668)
@@ -0,0 +1,2002 @@
+//Entry from boot !!!
+//ok
+void __attribute__((naked,noinline)) sub_FF875A0C_my() { 
+        asm volatile (                
+                "LDR     R12, =0x201E\n"
+                "STMFD   SP!, {R4,LR}\n"
+                "CMP     R0, R12\n"
+                "BEQ     loc_FF875ACC\n"
+                "BGT     loc_FF875A68\n"
+                "LDR     R12, =0x2004\n"
+                "CMP     R0, R12\n"
+                "BEQ     loc_FF875AD4\n"
+                "BGT     loc_FF875A50\n"
+                "SUB     R12, R0, #0x1000\n"
+                "SUBS    R12, R12, #0xA9\n"
+                "SUBNE   R12, R0, #0x1000\n"
+                "SUBNES  R12, R12, #0xAD\n"
+                "SUBNE   R12, R0, #0x1000\n"
+                "SUBNES  R12, R12, #0xAF\n"
+                "BNE     loc_FF875AE4\n"
+                "B       loc_FF875ACC\n"
+"loc_FF875A50:\n"
+                "SUB     R12, R0, #0x2000\n"
+                "SUBS    R12, R12, #5\n"
+                "SUBNE   R12, R0, #0x2000\n"
+                "SUBNES  R12, R12, #0x1D\n"
+                "BNE     loc_FF875AE4\n"
+                "B       loc_FF875ACC\n"
+"loc_FF875A68:\n"
+                "LDR     R12, =0x5004\n"
+                "CMP     R0, R12\n"
+                "BEQ     loc_FF875ACC\n"
+                "BGT     loc_FF875A94\n"
+                "SUB     R12, R0, #0x3000\n"
+                "SUBS    R12, R12, #0xA\n"
+                "BEQ     loc_FF875AC8\n"
+                "SUB     R12, R0, #0x5000\n"
+                "SUBS    R12, R12, #1\n"
+                "BNE     loc_FF875AE4\n"
+                "B       loc_FF875ACC\n"
+"loc_FF875A94:\n"
+                "SUB     R12, R0, #0x5000\n"
+                "SUBS    R12, R12, #6\n"
+                "BEQ     loc_FF875ACC\n"
+                "SUB     R12, R0, #0x5000\n"
+                "SUBS    R12, R12, #7\n"
+                "BNE     loc_FF875AE4\n"
+                "BL      sub_FF82D864\n"	//ActivateImageSystem
+                "LDR     R1, =0x6008\n"
+                "LDR     R0, [R1,#0x10]\n"
+                "CMP     R0, #7\n"
+                "LDREQ   R0, [R1,#0x18]\n"
+                "BLEQ    sub_FF8765BC\n"
+                "B       loc_FF875ADC\n"
+"loc_FF875AC8:\n"
+                "BL      sub_FF82CCF0\n"
+"loc_FF875ACC:\n"
+                "LDMFD   SP!, {R4,LR}\n"
+                "B       sub_FF8758BC_my\n" // AC.StartupShowInfo ------->
+"loc_FF875AD4:\n"
+                "BL      sub_FF8746F0\n"
+                "BL      sub_FF8751CC\n"	//AC.EntryNShtDwn
+"loc_FF875ADC:\n"
+                "MOV     R0, #0\n"
+                "LDMFD   SP!, {R4,PC}\n"
+"loc_FF875AE4:\n"
+                "MOV     R0, #1\n"
+                "LDMFD   SP!, {R4,PC}\n"
+ );
+}
+
+//ok
+void __attribute__((naked,noinline)) sub_FF8758BC_my(){ // AC.StartupShowInfo
+asm volatile(
+                "STMFD   SP!, {R4-R6,LR}\n"
+                "BL      sub_FF87670C\n"
+                "CMP     R0, #1\n"
+                "BLEQ    sub_FF87681C\n" 	//AC.ShowCaptInfo
+                "LDR     R4, =0x6008\n"
+                "MOV     R5, #1\n"
+                "LDR     R0, [R4,#0x24]\n"
+                "CMP     R0, #0\n"
+                "LDRNE   R0, [R4,#0x4C]\n"
+                "CMPNE   R0, #0\n"
+                "BEQ     loc_FF875928\n"
+                "BL      sub_FF87670C\n"
+                "CMP     R0, #1\n"
+                "BNE     loc_FF875928\n"
+                "BL      sub_FF87681C\n" 	//AC.ShowCaptInfo
+                "LDR     R0, [R4,#0x78]\n"
+                "CMP     R0, #0\n"
+                "BNE     loc_FF875928\n"
+                "LDR     R1, =0xFF875AEC\n"   // aAcStartupshowi
+                "MOV     R0, #0x20\n"
+                "BL      sub_FF86DA00\n"
+                "BL      sub_FF9BDBE8\n"
+                "BL      sub_FF9BDB74\n" 	//RefreshPhysicalScreen
+                "MOV     R1, #0\n"
+                "MOV     R0, #0x51\n"
+                "BL      sub_FF87E814\n"
+                "STR     R5, [R4,#0x78]\n"
+"loc_FF875928:\n"
+                "BL      sub_FF87670C\n"
+                "CMP     R0, #1\n"
+                "BNE     loc_FF875974\n"
+                "LDR     R0, [R4,#0x44]\n"
+                "CMP     R0, #0\n"
+                "BEQ     loc_FF875974\n"
+                "LDR     R0, [R4,#0x74]\n"
+                "CMP     R0, #0\n"
+                "BNE     loc_FF875974\n"
+                "LDR     R1, =0xFF875B00\n"  // aAcDispshot
+                "MOV     R0, #0x20\n"
+                "BL      sub_FF86DA00\n"
+                "MOV     R1, #0\n"
+                "MOV     R0, #0x8C\n"
+                "BL      sub_FF87E814\n"
+                "BL      sub_FF87C994\n"
+                "MOV     R0, #0x21\n"
+                "BL      sub_FF87E854\n"
+                "STR     R5, [R4,#0x74]\n"
+"loc_FF875974:\n"
+                "LDR     R0, [R4,#0x38]\n"
+                "CMP     R0, #0\n"
+                "LDRNE   R0, [R4,#0x3C]\n"
+                "CMPNE   R0, #0\n"
+                "LDRNE   R0, [R4,#0x44]\n"
+                "CMPNE   R0, #0\n"
+                "LDRNE   R0, [R4,#0x48]\n"
+                "CMPNE   R0, #0\n"
+                "LDRNE   R0, [R4,#0x1C]\n"
+                "LDRNE   R1, [R4,#0x20]\n"
+                "ORRNES  R0, R0, R1\n"
+                "BEQ     loc_FF8759B0\n"
+                "BL      sub_FF874FDC\n" 	//AC.OpCover
+                "BL      sub_FF8751CC\n"	//AC.EntryNShtDwn
+                "B       loc_FF8759D4\n"
+"loc_FF8759B0:\n"
+                "LDR     R0, [R4,#0x58]\n"
+                "CMP     R0, #0\n"
+                "BEQ     loc_FF8759DC\n"
+                "BL      sub_FF875078\n"
+                "CMP     R0, #1\n"
+                "BNE     loc_FF8759DC\n"
+                "BL      sub_FF8781CC\n" 	//DispSwCon_MuteOnPhysicalScreen
+                "BL      sub_FF877FEC\n"	//DispSwCon_TurnOffBackLight
+                "BL      sub_FF8765F8\n"	//AC.ShutdownRec
+"loc_FF8759D4:\n"
+                "MOV     R0, #0\n"
+                "LDMFD   SP!, {R4-R6,PC}\n"
+"loc_FF8759DC:\n"
+                "BL      sub_FF875078\n"
+                "CMP     R0, #1\n"
+                "BNE     loc_FF875A04\n"
+                "LDR     R0, [R4,#0x7C]\n"
+                "CMP     R0, #0\n"
+                "BLEQ    sub_FF876860_my\n" //AC.EntryRecBoot ------------->
+                "MOV     R0, #0\n"
+                "STR     R0, [R4,#0x70]\n"
+                "STR     R0, [R4,#0x74]\n"
+                "STR     R0, [R4,#0x78]\n"
+"loc_FF875A04:\n"
+                "MOV     R0, #1\n"
+                "LDMFD   SP!, {R4-R6,PC}\n"
+);
+}
+
+//ok
+void __attribute__((naked,noinline)) sub_FF876860_my(){ // AC.EntryRecBoot
+ asm volatile(
+                "STMFD   SP!, {R4,LR}\n"
+                "LDR     R1, =0xFF876A9C\n" // aAcEntryrecboot
+                "MOV     R0, #0x20\n"
+                "BL      sub_FF86DA00\n" 
+                "BL      sub_FF82CF20\n"
+                "BL      sub_FF8763F4\n"
+                "BL      sub_FF87A0A4_my\n" //StartRecMode ------------->
+                "MOV     R0, #1\n"
+                "BL      sub_FF874A74\n"
+                "BL      sub_FF874F60\n"
+                "LDMFD   SP!, {R4,LR}\n"
+                "B       sub_FF87522C\n"
+ );
+} 
+
+//ok
+void __attribute__((naked,noinline)) sub_FF87A0A4_my(){ // StartRecMode
+ asm volatile(
+                "STMFD   SP!, {R4-R6,LR}\n"
+                "LDR     R1, =0xFF87A2A0\n" // aStartrecmode
+                "MOV     R0, #0x20\n"
+                "BL      sub_FF86DA00\n" 
+                "LDR     R4, =0x62A8\n"
+                "MOV     R0, #6\n"
+                "MOV     R5, #1\n"
+                "STR     R0, [R4,#0x60]\n"
+                "STR     R5, [R4,#0x10]\n"
+                "BL      sub_FF958360\n"
+                "BL      sub_FF96F0B8\n"
+                "BL      sub_FF95FA68\n"
+                "BL      sub_FF95D088\n"		
+                "BL      sub_FF87A5E4_my\n"  //------------->
+                "BL      sub_FF96FD58\n"
+                "BL      sub_FF96C30C\n"
+				"BL      sub_FF96EFB0\n" 
+                "MOV     R0, #1\n"
+                "STR     R5, [R4,#0x1c]\n"
+                "BL      sub_FF87A6F4\n" 
+                "MOV     R0, #3\n"
+                "STR     R0, [R4,#0x6C]\n"
+                "LDR     R1, [R4,#0x70]\n"
+                "LDMFD   SP!, {R4-R6,LR}\n"
+                "MOV     R0, #0\n"
+                "BX      R1\n"
+ );
+} 
+
+//ok
+void __attribute__((naked,noinline)) sub_FF87A5E4_my(){ // 
+ asm volatile(
+                "STMFD   SP!, {R4,LR}\n"
+                "MOV     R0, #1\n"
+                "BL      sub_FF960524\n"
+                "LDR     R0, =0x855\n"
+                "BL      sub_FF872854\n"
+                "BL      sub_FF82CCF0\n"
+                //"BL      sub_FF879E74\n"  
+                "BL      sub_FF879E74_my\n"  //-------------->
+                "BL      sub_FF957B60\n"
+                "BL      sub_FF9528B0\n"  
+                "BL      sub_FF95E4C4\n" 
+                "BL      sub_FF961EF4\n"
+                "BL      sub_FF9625D8\n"
+                "BL      sub_FF96BB90\n"
+                "BL      sub_FF97125C\n" 
+                "BL      sub_FF963710\n" 
+                "BL      sub_FF96F534\n"
+                "BL      sub_FF96EC38\n"
+                "BL      sub_FF962120\n" 
+                "BL      sub_FF96E580\n"
+                "BL      sub_FF960388\n" 
+				"BL      sub_FF96B778\n" 
+				"BL      sub_FF96B27C\n"
+				"BL      sub_FF95DE14\n" 
+				"BL      sub_FF96DB9C\n"
+				"BL      sub_FF87E9A0\n" 
+                "LDMFD   SP!, {R4,LR}\n"
+                "B       sub_FF87E650\n" 
+ );
+} 
+
+// branches are together
+//OK
+void __attribute__((naked,noinline)) sub_FF879E74_my(){  // 
+ asm volatile(
+                "STMFD   SP!, {R4,LR}\n"
+                "LDR     R0, =0x631C\n"
+                //"LDR     R1, =0xFF879BEC\n" 
+                "LDR     R1, =sub_FF879BEC_my\n" // __PrepareCaptureModeChange__ ------------->
+                "BL      sub_FF88045C\n" 
+                "LDR     R1, =0x62A8\n"
+                //"LDR     R0, =0xFF879D28\n" 
+                "LDR     R0, =sub_FF879D28_my\n" //------------->
+                "STR     R0, [R1,#0x70]\n"
+                "LDMFD   SP!, {R4,PC}\n"
+ );
+} 
+
+//branch 1
+//ok
+void __attribute__((naked,noinline)) sub_FF879BEC_my(){ // __PrepareCaptureModeChange__
+ asm volatile(
+ 
+                "STMFD   SP!, {R3-R5,LR}\n"
+                "BL      sub_FF9515B8\n"
+                "BL      sub_FF970F18\n"
+                "LDR     R4, =0x62A8\n"
+                "LDR     R0, [R4,#0x34]\n"
+                "CMP     R0, #1\n"
+                "BNE     loc_FF879C28\n"
+                "LDR     R1, =0xFF879D08\n"			//a__preparecaptu 
+                "MOV     R0, #0x20\n"
+                "BL      sub_FF86DA00\n"
+                "MOV     R0, #0\n"
+                "STR     R0, [R4,#0x34]\n"
+                "STR     R0, [R4,#0x30]\n"
+                "BL      sub_FF879B00\n"		//ShutdownRecMode
+                "LDMFD   SP!, {R3-R5,PC}\n"
+"loc_FF879C28:\n"
+                "BL      sub_FF826E78\n"		//SSAPI.PrepareCaptureModeChange
+                "LDRH    R0, [R4,#4]\n"
+                "SUB     R12, R0, #0x8200\n"
+                "SUBS    R12, R12, #0xA\n"
+                "BNE     loc_FF879C4C\n"
+                "MOV     R0, #0x24\n"
+                "BL      sub_FF87E854\n"
+                "MOV     R0, #0x25\n"
+                "BL      sub_FF87E854\n"
+"loc_FF879C4C:\n"
+                "LDRH    R0, [R4,#4]\n"
+                "MOV     R1, SP\n"
+                "STRH    R0, [SP]\n"
+                "LDR     R0, [R4,#0x60]\n"
+                "STRH    R0, [SP,#2]\n"
+                "MOV     R0, #0x40\n"
+                "BL      sub_FF87E814\n"
+                "LDR     R0, [R4,#0x20]\n"
+                "CMP     R0, #0\n"
+                "LDREQH  R0, [R4,#4]\n"
+                "BLEQ    sub_FF873B38\n"		//PTM_SetCurrentCaptureMode
+                "LDRH    R0, [R4,#4]\n"
+                "MOV     R1, #1\n"
+                //"BL      sub_FF878FD4\n"		
+                "BL      sub_FF878FD4_my\n" //_DecideCaptureMode----------->
+                "LDR     R0, [R4,#0x6C]\n"
+                "BL      sub_FF87A6F4\n"
+                "MOV     R0, #3\n"
+                "STR     R0, [R4,#0x6C]\n"
+                "LDR     R1, [R4,#0x70]\n"
+                "ADD     SP, SP, #4\n"
+                "LDMFD   SP!, {R4,R5,LR}\n"
+                "MOV     R0, #0\n"
+                "BX      R1\n"
+ );
+} 
+
+//branch 2
+//OK
+void __attribute__((naked,noinline)) sub_FF879D28_my(){  // was FFC61F54
+ asm volatile(
+
+                "STMFD   SP!, {R4-R6,LR}\n"
+                "LDR     R5, =0x62A8\n"
+                "LDRH    R0, [R5,#4]\n"
+                "BL      sub_FF95FCA8\n"
+                "BL      sub_FF95D2C0\n"
+                "BL      sub_FF9621DC\n"
+                "BL      sub_FF963848\n"
+                "BL      sub_FF96BD5C\n"
+                "BL      sub_FF950DB8\n"
+                "BL      sub_FF96056C\n"
+                "MOV     R4, #0\n"
+                "MOV     R0, R4\n"
+                "STR     R4, [R5,#0x28]\n"
+                "BL      sub_FF826EB4\n"		//SSAPI.CaptureModeChange
+                "LDR     R0, [R5,#0x14]\n"
+                "LDR     R6, =0x313D\n"
+                "CMP     R0, #0\n"
+                "BEQ     loc_FF879DA0\n"
+                "BL      sub_FF870768\n"
+                "STR     R0, [R5,#0x5C]\n"
+                "STR     R4, [R5,#0x1C]\n"
+                "STR     R4, [R5,#0x14]\n"
+                "STR     R4, [R5,#0x30]\n"
+                "MOV     R0, #0xC\n"
+                "STR     R4, [R5,#0x24]\n"
+                "BL      sub_FF83EEE0\n"
+                "MOV     R0, R6\n"
+                "LDMFD   SP!, {R4-R6,LR}\n"
+                "MOV     R1, #0\n"
+                "B       sub_FF8711D8\n"		//PostLogicalEventToUI 
+"loc_FF879DA0:\n"
+                //"BL      nullsub_98\n"
+                "STR     R4, [R5,#0x40]\n"
+                "LDRH    R0, [R5,#4]\n"
+                "MOV     R1, #0\n"
+                //"BL      sub_FF878FD4\n" 	
+                "BL      sub_FF878FD4_my\n" 	//_DecideCaptureMode ----------->
+                "BL      sub_FF87C994\n"
+                "LDR     R0, [R5,#0x64]\n"
+                "CMP     R0, #0\n"
+                "STRNE   R4, [R5,#0x64]\n"
+                "BLNE    sub_FF87A334\n"		//_MuteOffStitch
+                "BL      sub_FF95DEE8\n"
+                "BL      sub_FF95E58C\n"
+                "LDR     R1, [R5,#0x60]\n"
+                "MOV     R0, #0x41\n"
+                "BL      sub_FF87E814\n"
+                "BL      sub_FF87A334\n"			//_MuteOffStitch
+                "BL      sub_FF95D280\n"
+                "BL      sub_FF9584D4\n"
+                "CMP     R0, #0\n"
+                "BLEQ    sub_FF95D2C4\n"		//j_UnpressZoomLever
+                "BL      sub_FF95FC30\n"
+                "BL      sub_FF951428\n"
+                "BL      sub_FF870768\n"
+                "STR     R0, [R5,#0x5C]\n"
+                "LDR     R0, [R5,#0x14]\n"
+                "CMP     R0, #0\n"
+                "MOVNE   R0, #0xC\n"
+                "STRNE   R4, [R5,#0x14]\n"
+                "BLNE    sub_FF83EEE0\n"
+                "LDR     R0, =0x8003\n"
+                "STR     R4, [R5,#0x30]\n"
+                "BL      sub_FF873C9C\n"		//PTM_GetCurrentItem
+                "STRH    R0, [R5]\n"
+                "MOV     R0, R6\n"
+                "MOV     R1, #0\n"
+                "BL      sub_FF8711D8\n"		//PostLogicalEventToUI 
+                "BL      sub_FF87A500\n"
+                "LDR     R0, [R5,#0x34]\n"
+                "CMP     R0, #1\n"
+                "STREQ   R4, [R5,#0x34]\n"
+                "LDMEQFD SP!, {R4-R6,LR}\n"
+                "BEQ     sub_FF879B00\n"		//ShutdownRecMode
+                "LDMFD   SP!, {R4-R6,PC}\n"
+				
+ );
+} 
+
+//branches are joining here
+//ok
+void __attribute__((naked,noinline)) sub_FF878FD4_my(){ // _DecideCaptureMode
+ asm volatile(
+                "STMFD   SP!, {R4-R6,LR}\n"
+                "MOV     R5, R0\n"
+                "MOV     R4, R1\n"
+                "LDR     R1, =0XFF8791CC\n"		//a_decidecapture 
+                "MOV     R0, #0x60\n"
+                "BL      sub_FF86DA00\n"
+                "LDR     R6, =0x62A8\n"
+                "LDR     R0, [R6,#0x10]\n"
+                "CMP     R0, #0\n"
+                "BEQ     loc_FF87918C\n"
+                "LDR     R0, [R6,#0x1C]\n"
+                "LDR     R1, =0x820A\n"
+                "LDR     R2, =0XFFFE0000\n"		// FF8791E8 ??? aVer_008_006
+                "CMP     R0, #1\n"
+                "BNE     loc_FF879054\n"
+                "CMP     R4, #1\n"
+                "LDMEQFD SP!, {R4-R6,PC}\n"
+                "CMP     R4, #0\n"
+                "BNE     loc_FF879054\n"
+                "CMP     R5, R1\n"
+                "BNE     loc_FF879034\n"
+                "BL      sub_FF87A5E0\n"
+                "BL      sub_FF87A378\n"		//_StartStitch
+                "B       loc_FF87918C\n"
+"loc_FF879034:\n"
+                "CMP     R2, R5,LSL#17\n"
+                "TSTNE   R5, #0xC00\n"
+                "BEQ     loc_FF879048\n"
+                //"BL      SUB_FF87A420\n"		
+                "BL      sub_FF87A420_my\n" // _StartMovie------------->
+                "B       loc_FF87904C\n"
+
+"loc_FF879048:\n"
+                "BL      sub_FF87A3D4\n"				//_StartStill
+"loc_FF87904C:\n"
+                "BL      sub_FF87A5E0\n"
+                "B       loc_FF87918C\n"
+"loc_FF879054:\n"
+                "CMP     R5, R1\n"
+                "BNE     loc_FF8790A8\n"
+                "LDRH    R0, [R6,#2]\n"
+                "CMP     R0, R1\n"
+                "BEQ     loc_FF879184\n"
+                "CMP     R2, R0,LSL#17\n"
+                "TSTNE   R0, #0xC00\n"
+                "BEQ     loc_FF87908C\n"
+                "LDR     R1, =0xFF8791EC\n"			//a_movietostitch 
+                "MOV     R0, #0x60\n"
+                "BL      sub_FF86DA00\n"
+                "CMP     R4, #1\n"
+                "BEQ     loc_FF87915C\n"
+                "B       loc_FF8790A0\n"
+"loc_FF87908C:\n"
+                "LDR     R1, =0xFF8791FC\n"		//a_stilltostitch 
+                "MOV     R0, #0x60\n"
+                "BL      sub_FF86DA00\n"
+                "CMP     R4, #1\n"
+                "BEQ     loc_FF879178\n"
+"loc_FF8790A0:\n"
+                "BL      sub_FF87A378\n"				//_StartStitch
+                "B       loc_FF879184\n"
+"loc_FF8790A8:\n"
+                "CMP     R2, R5,LSL#17\n"
+                "LDRH    R0, [R6,#2]\n"
+                "TSTNE   R5, #0xC00\n"
+                "BEQ     loc_FF879118\n"
+                "CMP     R0, R1\n"
+                "BNE     loc_FF8790D8\n"
+                "LDR     R1, =0xFF87920C\n"		//a_stitchtomovie 
+                "MOV     R0, #0x60\n"
+                "BL      sub_FF86DA00\n"
+                "CMP     R4, #1\n"
+                "BEQ     loc_FF879134\n"
+                "B       loc_FF879110\n"
+"loc_FF8790D8:\n"
+                "CMP     R2, R0,LSL#17\n"
+                "TSTNE   R0, #0xC00\n"
+                "BEQ     loc_FF8790FC\n"
+                "LDR     R1, =0xFF87921C\n"			//a_movietomovie 
+                "MOV     R0, #0x60\n"
+                "BL      sub_FF86DA00\n"
+                "CMP     R4, #1\n"
+                "BEQ     loc_FF87915C\n"
+                "B       loc_FF879110\n"
+"loc_FF8790FC:\n"
+                "LDR     R1, =0xFF87922C\n"		//a_stilltomovie 
+                "MOV     R0, #0x60\n"
+                "BL      sub_FF86DA00\n"
+                "CMP     R4, #1\n"
+                "BEQ     loc_FF879178\n"
+"loc_FF879110:\n"
+                //"BL      sub_FF87A420\n"				
+                "BL      sub_FF87A420_my\n" // _StartMovie------------->
+                "B       loc_FF879184\n"
+"loc_FF879118:\n"
+                "CMP     R0, R1\n"
+                "BNE     loc_FF87913C\n"
+                "LDR     R1, =0xFF87923C\n"			//a_stitchtostill
+                "MOV     R0, #0x60\n"
+                "BL      sub_FF86DA00\n"
+                "CMP     R4, #1\n"
+                "BNE     loc_FF879180\n"
+"loc_FF879134:\n"
+                "LDMFD   SP!, {R4-R6,LR}\n"
+                "B       sub_FF87A3A8\n"				//_StopStitch
+"loc_FF87913C:\n"
+                "CMP     R2, R0,LSL#17\n"
+                "TSTNE   R0, #0xC00\n"
+                "BEQ     loc_FF879164\n"
+                "LDR     R1, =0xFF87924C\n"			//a_movietostill 
+                "MOV     R0, #0x60\n"
+                "BL      sub_FF86DA00\n"
+                "CMP     R4, #1\n"
+                "BNE     loc_FF879180\n"
+"loc_FF87915C:\n"
+                "LDMFD   SP!, {R4-R6,LR}\n"
+                "B       sub_FF87A44C\n"			//_StopMovie
+"loc_FF879164:\n"
+                "LDR     R1, =0xFF87925C\n"			//a_stilltostill 
+                "MOV     R0, #0x60\n"
+                "BL      sub_FF86DA00\n"
+                "CMP     R4, #1\n"
+                "BNE     loc_FF879180\n"
+"loc_FF879178:\n"
+                "LDMFD   SP!, {R4-R6,LR}\n"
+                "B       sub_FF87A3FC\n"			//_StopStill
+"loc_FF879180:\n"
+                "BL      sub_FF87A3D4\n"			//_StartStill
+"loc_FF879184:\n"
+                "CMP     R4, #0\n"
+                "LDMNEFD SP!, {R4-R6,PC}\n"
+"loc_FF87918C:\n"
+                "STRH    R5, [R6,#2]\n"
+                "LDMFD   SP!, {R4-R6,PC}\n"
+ );
+} 
+
+
+//ok
+void __attribute__((naked,noinline)) sub_FF87A420_my(){  // _StartMovie
+ asm volatile(
+                "STMFD   SP!, {R4,LR}\n"
+                "LDR     R1, =0xFF87A56C\n" // a_startmovie
+                "MOV     R0, #0x20\n"
+                "BL      sub_FF86DA00\n" 
+                "LDR     R0, =0x62A8\n"
+                "LDR     R0, [R0,#0x2c]\n"
+                "CMP     R0, #0\n"
+                "BLNE    sub_FF87B1FC\n"
+                "LDMFD   SP!, {R4,LR}\n"
+                "MOV     R0, #0\n"
+                //"B       sub_FF87D9BC\n"  
+                "B       sub_FF87D9BC_my\n"  // ----------->
+ );
+} 
+
+//ok
+void __attribute__((naked,noinline)) sub_FF87D9BC_my(){  // 
+ asm volatile(
+                "STMFD   SP!, {R4,LR}\n"
+                "LDR     R4, =0x6470\n"
+                "MOV     R0, #0\n"
+                "STR     R0, [R4,#0x30]\n"
+                "LDR     R0, [R4,#8]\n"
+                "CMP     R0, #0\n"
+                "BNE     loc_FF87D9E8\n"
+                "LDR     R0, =sub_FF87D5A0_my\n" //----------->
+                "MOV     R1, #0\n"
+                "BL      sub_FF8709DC\n" 
+                "STR     R0, [R4,#8]\n"
+"loc_FF87D9E8:\n"
+                "LDR     R0, [R4,#0xC]\n"
+                "CMP     R0, #0\n"
+                "BNE     loc_FF87DA04\n"
+                "LDR     R0, =0xFF87D238\n"
+                "MOV     R1, #0\n"
+                "BL      sub_FF879FC4\n"
+                "STR     R0, [R4,#0xC]\n"
+"loc_FF87DA04:\n"
+                "BL      sub_FF87E1C0\n"
+                "BL      sub_FF87D29C\n"
+                "BL      sub_FF96C8E0\n"
+                "BL      sub_FF971D60\n"
+                "LDMFD   SP!, {R4,LR}\n"
+                "B       sub_FF95F1E8\n"
+ );
+} 
+
+//ok
+void __attribute__((naked,noinline)) sub_FF87D5A0_my(){  // 
+ asm volatile(
+                "STMFD   SP!, {R3-R11,LR}\n"
+                "LDR     R5, =0x6470\n"
+                "MOV     R4, R1\n"
+                "LDR     R2, [R5,#0x2C]\n"
+                "ADD     R0, R5, #0\n"
+                "LDR     R0, [R0,#0x14]\n"
+                "LDR     R9, =0x3007\n"
+                "CMP     R2, #0\n"
+                "MOV     R1, #0\n"
+                "MOV     R11, R3\n"
+                "MVN     R8, #0\n"			//                "MOVL    R8, 0xFFFFFFFF\n"
+                "BEQ     loc_FF87D618\n"
+                "CMP     R4, R9\n"
+                "BEQ     loc_FF87D830\n"
+                "CMP     R4, #0x800\n"
+                "LDREQ   R2, [R5,#0x38]\n"
+                "CMPEQ   R11, R2\n"
+                "BNE     loc_FF87D940\n"
+                "STR     R1, [R5,#0x2C]!\n"
+                "CMP     R0, #0\n"
+                "STR     R8, [R5,#0xC]\n"
+                "BNE     loc_FF87D9B4\n"
+                "BL      sub_FF82D7A0\n"
+                "CMP     R0, #1\n"
+                "BEQ     loc_FF87D610\n"
+                "BL      sub_FF82D7A8\n"
+                "CMP     R0, #1\n"
+                "BNE     loc_FF87D9B4\n"
+"loc_FF87D610:\n"
+                "BL      sub_FF87D3E8\n"
+                "B       loc_FF87D9B4\n"
+"loc_FF87D618:\n"
+                "CMP     R0, #1\n"
+                "SUBEQ   R12, R4, #0x2000\n"
+                "SUBEQS  R12, R12, #0x1C\n"
+                "BNE     loc_FF87D634\n"
+                "MOV     R0, #0\n"
+                "BL      sub_FF87DC70\n"		//MviCon_EmpBuf
+                "B       loc_FF87D9B4\n"
+"loc_FF87D634:\n"
+                "BL      sub_FF894488\n"
+                "LDR     R10, =0x9A5\n"
+                "CMP     R0, #1\n"
+                "SUB     R6, R10, #4\n"
+                "SUB     R7, R10, #2\n"
+                "BNE     loc_FF87D668\n"
+                "CMP     R4, R10\n"
+                "CMPNE   R4, R6\n"
+                "CMPNE   R4, R7\n"
+                "BNE     loc_FF87D668\n"
+                "BL      sub_FF893614\n"
+                "STR     R4, [R5,#0x3C]\n"
+                "B       loc_FF87D940\n"
+"loc_FF87D668:\n"
+                "BL      sub_FF95D098\n"		//GetAEIntegralServiceMode_7
+                "CMP     R0, #1\n"
+                "BNE     loc_FF87D688\n"		//           vas     "BNE     sub_FF87D688\n"
+                "MOV     R0, R4\n"
+                "BL      sub_FF870F18\n"
+                "CMP     R0, #1\n"
+                "CMPNE   R4, R10\n"
+                "BEQ     loc_FF87D940\n"
+"loc_FF87D688:\n"
+                "BL      sub_FF82D8A0\n"
+                "CMP     R0, #1\n"
+                "BNE     loc_FF87D6A0\n"
+                "CMP     R4, R6\n"
+                "CMPNE   R4, R7\n"
+                "BEQ     loc_FF87D9B4\n"
+"loc_FF87D6A0:\n"
+                "BL      sub_FF87A198\n"
+                "LDR     R1, =0x9A2\n"
+                "CMP     R0, #1\n"
+                "ADD     R2, R1, #2\n"
+                "BNE     loc_FF87D6C8\n"
+                "CMP     R4, R6\n"
+                "CMPNE   R4, R1\n"
+                "CMPNE   R4, R7\n"
+                "CMPNE   R4, R2\n"
+                "BEQ     loc_FF87D9B4\n"
+"loc_FF87D6C8:\n"
+                "SUB     R12, R4, #0x800\n"
+                "SUBS    R12, R12, #0x57\n"
+                "BNE     loc_FF87D6F0\n"
+                "LDR     R0, [R5,#0x10]\n"
+                "LDR     R1, [R5,#0x14]\n"
+                "ORR     R0, R0, R1\n"
+                "LDR     R1, [R5,#0x1C]\n"
+                "ORRS    R0, R0, R1\n"
+                "BLEQ    sub_FF9ABF2C\n"
+                "B       loc_FF87D9B4\n"
+"loc_FF87D6F0:\n"
+                "LDR     R12, =0x200A\n"
+                "CMP     R4, R12\n"
+                "BEQ     loc_FF87D9A4\n"
+                "BGT     loc_FF87D76C\n"
+                "LDR     R12, =0x907\n"
+                "CMP     R4, R12\n"
+                "MOVEQ   R1, #2\n"
+                "MOVEQ   R0, R10\n"
+                "BEQ     loc_FF87D8E0\n"
+                "BGT     loc_FF87D748\n"
+                "SUB     R12, R4, #0x800\n"
+                "LDR     R6, =0x2003\n"
+                "SUBS    R12, R12, #0x26\n"
+                "BEQ     loc_FF87D844\n"
+                "SUB     R12, R4, #0x800\n"
+                "SUBS    R12, R12, #0x29\n"
+                "BEQ     loc_FF87D888\n"
+                "CMP     R4, #0x860\n"
+                "SUBNE   R12, R4, #0x800\n"
+                "SUBNES  R12, R12, #0x61\n"
+                "BNE     loc_FF87D958\n"
+                "B       loc_FF87D940\n"
+"loc_FF87D748:\n"
+                "CMP     R4, R6\n"
+                "BEQ     loc_FF87D8D8\n"
+                "CMP     R4, R1\n"
+                "BEQ     loc_FF87D9A4\n"
+                "CMP     R4, R7\n"
+                "BEQ     loc_FF87D8D8\n"
+                "CMP     R4, R2\n"
+                "BEQ     loc_FF87D9A4\n"
+                "B       loc_FF87D958\n"
+"loc_FF87D76C:\n"
+                "LDR     R12, =0x3149\n"
+                "CMP     R4, R12\n"
+                "MOVEQ   R1, #0\n"
+                "MOVEQ   R0, #0x84\n"
+                "BEQ     loc_FF87D950\n"
+                "BGT     loc_FF87D7C4\n"
+                "SUB     R12, R4, #0x2000\n"
+                "SUBS    R12, R12, #0x20\n"
+                "MOVEQ   R1, R11\n"
+                "MOVEQ   R0, #0x83\n"
+                "BEQ     loc_FF87D950\n"
+                "CMP     R4, R9\n"
+                "BEQ     loc_FF87D81C\n"
+                "SUB     R12, R4, #0x3100\n"
+                "SUBS    R12, R12, #0x35\n"
+                "BEQ     loc_FF87D800\n"
+                "SUB     R12, R4, #0x3000\n"
+                "SUBS    R12, R12, #0x148\n"
+                "BNE     loc_FF87D958\n"
+                "MOV     R1, #0\n"
+                "MOV     R0, #0x86\n"
+                "B       loc_FF87D950\n"
+"loc_FF87D7C4:\n"
+                "SUB     R12, R4, #0x3100\n"
+                "SUBS    R12, R12, #0x4A\n"
+                "BEQ     loc_FF87D948\n"
+                "SUB     R12, R4, #0x4000\n"
+                "SUBS    R12, R12, #3\n"
+                "BEQ     loc_FF87D904\n"
+                "SUB     R12, R4, #0x4000\n"
+                "SUBS    R12, R12, #8\n"
+                "BEQ     loc_FF87D8E8\n"
+                "SUB     R12, R4, #0x4000\n"
+                "SUBS    R12, R12, #0xF\n"
+                "BNE     loc_FF87D958\n"
+                "MOV     R0, #0x82\n"
+                "BL      sub_FF87E854\n"
+                "B       loc_FF87D9B4\n"
+"loc_FF87D800:\n"
+                "BL      sub_FF87E1F4\n"	//GetVRAMHPixelsSize_1
+                "CMP     R0, #4\n"
+                "BEQ     loc_FF87D9A4\n"
+                "LDR     R0, [R5,#0x1C]\n"
+                "CMP     R0, #0\n"
+                "BLNE    sub_FF87D330\n"	//MviCon_ShtDwn
+                "B       loc_FF87D9B4\n"
+"loc_FF87D81C:\n"
+                "MOV     R0, #1\n"
+                "STR     R0, [R5,#0x1C]\n"
+                "LDR     R0, [R5,#0x18]\n"
+                "CMP     R0, #1\n"
+                "BNE     loc_FF87D838\n"
+"loc_FF87D830:\n"
+                "BL      sub_FF87D330\n"	//MviCon_ShtDwn
+                "LDMFD   SP!, {R3-R11,PC}\n"
+"loc_FF87D838:\n"
+                "MOV     R0, R4\n"
+                "BL      sub_FF87D508\n"
+                "B       loc_FF87D9B4\n"
+"loc_FF87D844:\n"
+                "BL      sub_FF87A198\n"
+                "CMP     R0, #0\n"
+                "BEQ     loc_FF87D85C\n"
+                "MOV     R0, R4\n"
+                "BL      sub_FF87A18C\n"
+                "B       loc_FF87D9B4\n"
+"loc_FF87D85C:\n"
+                "LDR     R0, [R5,#0x10]\n"
+                "LDR     R1, [R5,#0x14]\n"
+                "ORR     R0, R0, R1\n"
+                "LDR     R1, [R5,#0x1C]\n"
+                "ORRS    R0, R0, R1\n"
+                "BNE     loc_FF87D9B4\n"
+                "MOV     R1, #0\n"
+                "MOV     R0, R6\n"
+                "BL      sub_FF85E584\n"
+                "BL      sub_FF99B4D0\n" 		// StartRecModeMenu
+                "B       loc_FF87D9B4\n"
+"loc_FF87D888:\n"
+                "LDR     R0, [R5,#0x10]\n"
+                "LDR     R1, [R5,#0x14]\n"
+                "ORRS    R0, R0, R1\n"
+                "BNE     loc_FF87D9B4\n"
+                "BL      sub_FF87A1A4\n"
+                "CMP     R0, #0\n"
+                "LDREQ   R0, [R5,#0x1C]\n"
+                "CMPEQ   R0, #0\n"
+                "BNE     loc_FF87D9B4\n"
+                "BL      sub_FF87A198\n"
+                "CMP     R0, #0\n"
+                "BNE     loc_FF87D9B4\n"
+                "BL      sub_FF971E0C\n" // j_IsEvfDriveMode_17
+                "CMP     R0, #0\n"
+                "BNE     loc_FF87D9B4\n"
+                "MOV     R1, #0\n"
+                "MOV     R0, R6\n"
+                "BL      sub_FF85E584\n"
+                "BL      sub_FF952384\n"
+                "B       loc_FF87D9B4\n"
+"loc_FF87D8D8:\n"
+                "MOV     R1, #1\n"
+                "MOV     R0, R4\n"
+"loc_FF87D8E0:\n"
+                //"BL      sub_FF87D444\n"
+                "BL      sub_FF87D444_my\n" // MviCon_fShtDwn------------->
+                "LDMFD   SP!, {R3-R11,PC}\n"
+"loc_FF87D8E8:\n"
+                "MOV     R0, R11\n"
+                "BL      sub_FF878A18\n"
+                "CMP     R0, #0\n"
+                "MOVEQ   R1, R11\n"
+                "MOVEQ   R0, R4\n"
+                //"BLEQ    sub_FF87DE60\n"
+                "BLEQ    sub_FF87DE60_my\n"  //----------->
+                "B       loc_FF87D940\n"
+"loc_FF87D904:\n"
+                "LDR     R0, [R5,#0x3C]\n"
+                "CMN     R0, #1\n"
+                "BEQ     loc_FF87D940\n"
+                "MOV     R0, #0\n"
+                "BL      sub_FF890150\n"
+                "LDR     R0, [R5,#0x3C]\n"
+                "CMP     R0, R6\n"
+                "BNE     loc_FF87D930\n"
+                "BL      sub_FF82D7A0\n"
+                "CMP     R0, #0\n"
+                "BEQ     loc_FF87D93C\n"
+"loc_FF87D930:\n"
+                "LDR     R0, [R5,#0x3C]\n"
+                "MOV     R1, #0\n"
+                "BL      sub_FF87118C\n"		//PostLogicalEventForNotPowerType
+"loc_FF87D93C:\n"
+                "STR     R8, [R5,#0x3C]\n"
+"loc_FF87D940:\n"
+                "MOV     R0, #1\n"
+                "LDMFD   SP!, {R3-R11,PC}\n"
+"loc_FF87D948:\n"
+                "MOV     R1, #0\n"
+                "MOV     R0, #0x85\n"
+"loc_FF87D950:\n"
+                "BL      sub_FF87E814\n"
+                "B       loc_FF87D9B4\n"
+"loc_FF87D958:\n"
+                "LDR     R12, =0x855\n"
+                "CMP     R4, R12\n"
+                "BEQ     loc_FF87D994\n"
+                "BGT     loc_FF87D980\n"
+                "SUB     R12, R4, #0x800\n"
+                "SUBS    R12, R12, #0x38\n"
+                "SUBNE   R12, R4, #0x800\n"
+                "SUBNES  R12, R12, #0x39\n"
+                "BNE     loc_FF87D9A4\n"
+                "B       loc_FF87D994\n"
+"loc_FF87D980:\n"
+                "SUB     R12, R4, #0x800\n"
+                "SUBS    R12, R12, #0x56\n"
+                "SUBNE   R12, R4, #0x800\n"
+                "SUBNES  R12, R12, #0x5D\n"
+                "BNE     loc_FF87D9A4\n"
+"loc_FF87D994:\n"
+                "LDR     R0, [R5,#0x10]\n"
+                "LDR     R1, [R5,#0x14]\n"
+                "ORRS    R0, R0, R1\n"
+                "BNE     loc_FF87D9B4\n"
+"loc_FF87D9A4:\n"
+                "MOV     R1, R11\n"
+                "MOV     R0, R4\n"
+                //"BL      sub_FF87DE60\n"
+                "BL      sub_FF87DE60_my\n"  //----------------->
+                "LDMFD   SP!, {R3-R11,PC}\n"
+"loc_FF87D9B4:\n"
+                "MOV     R0, #0\n"
+                "LDMFD   SP!, {R3-R11,PC}\n"
+ );
+} 
+
+//ok
+void __attribute__((naked,noinline)) sub_FF87D444_my(){ // MviCon_fShtDwn
+asm volatile(
+                "STMFD   SP!, {R4-R6,LR}\n"
+                "MOV     R4, R0\n"
+                "LDR     R0, =0x6470\n"
+                "MOV     R5, R1\n"
+                "LDR     R0, [R0,#0x1C]\n"
+                "CMP     R0, #0\n"
+                "LDRNE   R1, =0xFF87D57C\n" // aMvicon_fshtdwn 
+                "BNE     loc_FF87D4F0\n"
+                "BL      sub_FF87E200\n"
+                "CMP     R0, #1\n"
+                "BNE     loc_FF87D480\n"
+"loc_FF87D470:\n"
+                "MOV     R0, R4\n"
+                "LDMFD   SP!, {R4-R6,LR}\n"
+                "MOV     R1, #0\n"
+                //"B       sub_FF87DE60\n"
+                "B       sub_FF87DE60_my\n" //------------->
+ "loc_FF87D480:\n"
+                "CMP     R5, #2\n"
+                "BNE     loc_FF87D498\n"
+                "BL      sub_FF87C994\n"
+                "CMP     R0, #0\n"
+                "BEQ     loc_FF87D4E0\n"
+                "B       loc_FF87D4AC\n"
+"loc_FF87D498:\n"
+                "CMP     R5, #1\n"
+                "BNE     loc_FF87D4E0\n"
+                "BL      sub_FF87C9AC\n"
+                "CMP     R0, #0\n"
+                "BNE     loc_FF87D4E0\n"
+"loc_FF87D4AC:\n"
+                "MOV     R0, #0\n"
+                "BL      sub_FF890150\n"
+                "SUB     R12, R4, #0x900\n"
+                "SUBS    R12, R12, #0xA1\n"
+                "SUBNE   R12, R4, #0x900\n"
+                "SUBNES  R12, R12, #0xA3\n"
+                "SUBNE   R12, R4, #0x900\n"
+                "SUBNES  R12, R12, #0xA5\n"
+                "LDREQ   R0, =0xC507\n"
+                "MOVEQ   R1, #0\n"
+                "BLEQ    sub_FF85E584\n"
+"loc_FF87D4D8:\n"
+                "MOV     R0, #0\n"
+                "LDMFD   SP!, {R4-R6,PC}\n"
+"loc_FF87D4E0:\n"
+                "BL      sub_FF87D3E8\n"
+                "CMP     R0, #0\n"
+                "BNE     loc_FF87D4FC\n"
+                "LDR     R1, =0xFF87D58C\n" //  aMvicon_initchk 
+"loc_FF87D4F0:\n"
+                "MOV     R0, #0x60\n"
+                "BL      sub_FF86DA00\n"
+                "B       loc_FF87D4D8\n"
+"loc_FF87D4FC:\n"
+                "MOV     R0, R5\n"
+                "BL      sub_FF95BE1C\n"
+                "B       loc_FF87D470\n"
+ );
+}
+
+//ok
+void __attribute__((naked,noinline)) sub_FF87DE60_my(){  //
+ asm volatile(
+                "STMFD   SP!, {R4-R8,LR}\n"				
+                "MOV     R7, R1\n"
+                "MOV     R4, R0\n"
+                "BL      sub_FF87E27C\n"
+                "LDR     R5, =0x64B4\n"
+                "LDR     R3, =0x200A\n"
+                "LDR     R12, [R5]\n"
+                "LDR     R2, =0x4008\n"
+                "LDR     R6, =0x9A3\n"
+                "LDR     R0, =0x3007\n"
+                "LDR     R1, =0x1051\n"
+                "CMP     R12, #9\n"
+                "ADD     LR, R3, #0x15\n"
+                "ADDLS   PC, PC, R12,LSL#2\n"
+                "B       loc_FF87E1B8\n"
+"loc_FF87DE9C:\n"
+                "B       loc_FF87DEC4\n"
+"loc_FF87DEA0:\n"
+                "B       loc_FF87DED4\n"
+"loc_FF87DEA4:\n"
+                "B       loc_FF87DEE4\n"
+"loc_FF87DEA8:\n"
+                "B       loc_FF87DF58\n"
+"loc_FF87DEAC:\n"
+                "B       loc_FF87DF98\n"
+"loc_FF87DEB0:\n"
+                "B       loc_FF87E020\n"
+"loc_FF87DEB4:\n"
+                "B       loc_FF87E050\n"
+"loc_FF87DEB8:\n"
+                "B       loc_FF87E100\n"
+"loc_FF87DEBC:\n"
+                "B       loc_FF87E060\n"
+"loc_FF87DEC0:\n"
+                "B       loc_FF87E128\n"
+"loc_FF87DEC4:\n"
+                "MOV     R1, R7\n"
+                "MOV     R0, R4\n"
+                "LDMFD   SP!, {R4-R8,LR}\n"
+                "B       sub_FF87DDE8\n"	//_ActionPrepareCapture
+"loc_FF87DED4:\n"
+                "MOV     R1, R7\n"
+                "MOV     R0, R4\n"
+                "LDMFD   SP!, {R4-R8,LR}\n"
+                //B       sub_FF87E3F8
+                "B       sub_FF87E3F8_my\n"  //    ------------>
+"loc_FF87DEE4:\n"
+                "CMP     R4, R1\n"
+                "BEQ     loc_FF87DF48\n"
+                "SUB     R12, R4, #0x2000\n"
+                "SUBS    R12, R12, #6\n"
+                "BEQ     loc_FF87DF0C\n"
+                "CMP     R4, R0\n"
+                "BEQ     loc_FF87DF50\n"
+                "SUB     R12, R4, #0x3100\n"
+                "SUBS    R12, R12, #0x4B\n"
+                "BNE     loc_FF87E1B8\n"
+"loc_FF87DF0C:\n"
+                "BL      sub_FF87D3C4\n"	//MviCon_ext
+                "MOV     R0, #0\n"
+                "BL      sub_FF87E264\n"	//MovieState
+                "LDR     R0, [R5,#8]\n"
+                "CMP     R0, #0\n"
+                "MOVNE   R1, #0\n"
+                "MOVNE   R0, R6\n"
+                "BNE     loc_FF87DF40\n"
+                "LDR     R0, [R5,#4]\n"
+                "CMP     R0, #0\n"
+                "BEQ     loc_FF87E168\n"
+                "LDR     R0, =0x9A1\n"
+                "MOV     R1, #0\n"
+"loc_FF87DF40:\n"
+                "BL      sub_FF87DDE8\n"	//_ActionPrepareCapture
+                "B       loc_FF87E168\n"
+"loc_FF87DF48:\n"
+                "BL      sub_FF87E36C\n"
+                "B       loc_FF87E168\n"
+"loc_FF87DF50:\n"
+                "BL      sub_FF87E384\n"
+                "B       loc_FF87E168\n"
+"loc_FF87DF58:\n"
+                "SUB     R12, R4, #0x900\n"
+                "SUBS    R12, R12, #0xA2\n"
+                "BEQ     loc_FF87DF88\n"
+                "CMP     R4, R6\n"
+                "BEQ     loc_FF87DF80\n"
+                "CMP     R4, R1\n"
+                "BEQ     loc_FF87DF90\n"
+                "CMP     R4, R0\n"
+                "BLEQ    sub_FF87E384\n"
+                "B       loc_FF87E1B8\n"
+"loc_FF87DF80:\n"
+                //BL      _EntryActionOnPreMoving
+                "BL      sub_FF87DD8C_my\n"  //_EntryActionOnPreMoving---------------->
+                "B       loc_FF87E1B8\n"
+"loc_FF87DF88:\n"
+                "BL      sub_FF87E34C\n"
+                "B       loc_FF87E1B8\n"
+"loc_FF87DF90:\n"
+                "BL      sub_FF87E36C\n"
+                "B       loc_FF87E1B8\n"
+"loc_FF87DF98:\n"
+                "CMP     R4, LR\n"
+                "BEQ     loc_FF87DFF4\n"
+                "BGT     loc_FF87DFC0\n"
+                "CMP     R4, R6\n"
+                "BEQ     loc_FF87DFDC\n"
+                "CMP     R4, R1\n"
+                "BEQ     loc_FF87E00C\n"
+"loc_FF87DFB4:\n"
+                "CMP     R4, R3\n"
+                "BNE     loc_FF87E1B8\n"
+                "B       loc_FF87DFD0\n"
+"loc_FF87DFC0:\n"
+                "CMP     R4, R0\n"
+                "BEQ     loc_FF87E000\n"
+"loc_FF87DFC8:\n"
+                "CMP     R4, R2\n"
+                "BNE     loc_FF87E1B8\n"
+"loc_FF87DFD0:\n"
+                "BL      sub_FF87E3D4\n"	//_ActionStopRecordMovie
+                "BL      sub_FF87E34C\n"
+                "B       loc_FF87E168\n"
+"loc_FF87DFDC:\n"
+                "BL      sub_FF829154\n"	//SSAPI.StopRecordMovie
+                "MOV     R0, #5\n"
+                "BL      sub_FF87E264\n"	//MovieState
+                "MOV     R0, #0\n"
+                "STR     R0, [R5,#0xC]\n"
+                "B       loc_FF87E168\n"
+"loc_FF87DFF4:\n"
+                "MOV     R0, #5\n"
+                "BL      sub_FF87E264\n"	//MovieState
+                "B       loc_FF87E044\n"
+"loc_FF87E000:\n"
+                "BL      sub_FF829154\n"	//SSAPI.StopRecordMovie
+                "BL      sub_FF87E3D4\n"	//_ActionStopRecordMovie
+                "B       loc_FF87E0F8\n"
+"loc_FF87E00C:\n"
+                "BL      sub_FF829154\n"	//SSAPI.StopRecordMovie
+                "BL      sub_FF87E3D4\n"	//_ActionStopRecordMovie
+                "B       loc_FF87E058\n"
+"loc_FF87E018:\n"
+                "BL      sub_FF87E264\n"	//MovieState
+                "B       loc_FF87E168\n"
+"loc_FF87E020:\n"
+                "CMP     R4, LR\n"
+                "BEQ     loc_FF87E044\n"
+                "BGT     loc_FF87E038\n"
+                "CMP     R4, R1\n"
+                "BNE     loc_FF87DFB4\n"
+                "B       loc_FF87E058\n"
+"loc_FF87E038:\n"
+                "CMP     R4, R0\n"
+                "BNE     loc_FF87DFC8\n"
+                "B       loc_FF87E0F8\n"
+"loc_FF87E044:\n"
+                "MOV     R0, R7\n"
+                "BL      sub_FF87E3A0\n"	//_dsi_StopRecordMovie
+                "B       loc_FF87E168\n"
+"loc_FF87E050:\n"
+                "CMP     R4, R1\n"
+                "BNE     loc_FF87E1B8\n"
+"loc_FF87E058:\n"
+                "MOV     R0, #8\n"
+                "B       loc_FF87E018\n"
+"loc_FF87E060:\n"
+                "CMP     R4, R0\n"
+                "BEQ     loc_FF87E0F8\n"
+                "BGT     loc_FF87E0E4\n"
+                "CMP     R4, R3\n"
+                "BEQ     loc_FF87DF48\n"
+                "CMP     R4, LR\n"
+                "BEQ     loc_FF87E044\n"
+                "B       loc_FF87E1B8\n"
+"loc_FF87E0E4:\n"
+                "CMP     R4, R2\n"
+                "SUBNE   R12, R4, #0x4000\n"
+                "SUBNES  R12, R12, #0xE\n"
+                "BEQ     loc_FF87DF48\n"
+                "B       loc_FF87E1B8\n"
+"loc_FF87E0F8:\n"
+                "MOV     R0, #7\n"
+                "B       loc_FF87E018\n"
+"loc_FF87E100:\n"
+                "CMP     R4, R3\n"
+                "BEQ     loc_FF87E118\n"
+                "CMP     R4, LR\n"
+                "BEQ     loc_FF87E044\n"
+                "CMP     R4, R2\n"
+                "BNE     loc_FF87E1B8\n"
+"loc_FF87E118:\n"
+                "BL      sub_FF87E34C\n"
+                "MOV     R0, #0\n"
+                "BL      sub_FF87D508\n"
+                "B       loc_FF87E168\n"
+"loc_FF87E128:\n"
+                "SUB     R12, R4, #0x800\n"
+                "SUBS    R12, R12, #0x4A\n"
+                "BEQ     loc_FF87E170\n"
+                "CMP     R4, R1\n"
+                "BEQ     loc_FF87E1A8\n"
+                "CMP     R4, R0\n"
+                "BEQ     loc_FF87E198\n"
+                "SUB     R12, R4, #0x3100\n"
+                "SUBS    R12, R12, #0x2A\n"
+                "BNE     loc_FF87E1B8\n"
+                "BL      sub_FF87E304\n"
+                "LDR     R0, [R5,#0x14]\n"
+                "CMP     R0, #0\n"
+                "BNE     loc_FF87E168\n"
+                //BL      _EntryActionOnMoving
+                "BL      sub_FF87E320_my\n"  //_EntryActionOnMoving---------------->
+                "BL      sub_FF95D0A4\n"
+"loc_FF87E168:\n"
+                "MOV     R0, #0\n"
+                "LDMFD   SP!, {R4-R8,PC}\n"
+"loc_FF87E170:\n"
+                "BL      sub_FF87E304\n"
+                "LDR     R0, =0x8007\n"
+                "MOV     R1, #0\n"
+                "BL      sub_FF873C90\n" 	//j_PTM_SetCurrentItem
+                "BL      sub_FF95BDBC\n"
+                "BL      sub_FF87E34C\n"
+                "BL      sub_FF95D0A4\n"
+                "BL      sub_FF87D3C4\n"	//MviCon_ext
+                "MOV     R0, #0\n"
+                "B       loc_FF87E018\n"
+"loc_FF87E198:\n"
+                "BL      sub_FF87E304\n"
+                "BL      sub_FF95BDBC\n"
+                "BL      sub_FF95D0A4\n"
+                "B       loc_FF87DF50\n"
+"loc_FF87E1A8:\n"
+                "BL      sub_FF87E304\n"
+                "BL      sub_FF95BDBC\n"
+                "BL      sub_FF95D0A4\n"
+                "B       loc_FF87DF48\n"
+"loc_FF87E1B8:\n"
+                "MOV     R0, #1\n"
+                "LDMFD   SP!, {R4-R8,PC}\n"
+                 ".ltorg\n"  
+);
+} 
+
+//ok
+void __attribute__((naked,noinline)) sub_FF87E3F8_my(){ // 
+ asm volatile(
+                "LDR     R3, =0x64B4\n" 
+                "LDR     R12, =0x2006\n" 
+                "STMFD   SP!, {R4,LR}\n" 
+                "LDR     R1, [R3,#0xC]\n" 
+                "LDR     R2, [R3,#0x14]\n" 
+                "CMP     R0, R12\n" 
+                "BEQ     loc_FF87E46C\n" 
+                "BGT     loc_FF87E438\n" 
+                "SUB     R12, R0, #0x900\n" 
+                "SUBS    R12, R12, #0xA2\n" 
+                "BEQ     loc_FF87E490\n" 
+                "SUB     R12, R0, #0x1000\n" 
+                "SUBS    R12, R12, #0x51\n" 
+                "BNE     loc_FF87E4B4\n" 
+                "BL      sub_FF87E36C\n" 
+                "B       loc_FF87E4AC\n" 
+"loc_FF87E438:\n" 
+                "SUB     R12, R0, #0x3000\n" 
+                "SUBS    R12, R12, #7\n" 
+                "BEQ     loc_FF87E4A8\n" 
+                "SUB     R12, R0, #0x3100\n" 
+                "SUBS    R12, R12, #0x4B\n" 
+                "BNE     loc_FF87E4B4\n" 
+                "CMP     R2, #0\n" 
+                "BNE     loc_FF87E4AC\n" 
+                "LDR     R0, [R3,#8]\n" 
+                "ORRS    R0, R0, R1\n" 
+                "BEQ     loc_FF87E478\n" 
+                "BL      sub_FF87DD8C_my\n" // _EntryActionOnPreMoving------------>
+                "B       loc_FF87E4AC\n" 
+"loc_FF87E46C:\n" 
+                "CMP     R2, #0\n" 
+                "BLEQ    sub_FF87C9E4\n" 
+                "B       loc_FF87E4AC\n" 
+"loc_FF87E478:\n" 
+                "LDR     R0, [R3,#4]\n" 
+                "CMP     R0, #0\n" 
+                "MOVNE   R0, #3\n" 
+                "BNE     loc_FF87E4A0\n" 
+                "BL      sub_FF87E34C\n" 
+                "B       loc_FF87E4AC\n" 
+"loc_FF87E490:\n" 
+                "CMP     R1, #0\n" 
+                "BNE     loc_FF87E4AC\n" 
+                "BL      sub_FF828D44\n"	//SSAPI.CancelPrepare
+                "MOV     R0, #2\n" 
+"loc_FF87E4A0:\n" 
+                "BL      sub_FF87E264\n" 	//MovieState
+                "B       loc_FF87E4AC\n" 
+"loc_FF87E4A8:\n" 
+                "BL      sub_FF87E384\n" 
+"loc_FF87E4AC:\n" 
+                "MOV     R0, #0\n" 
+                "LDMFD   SP!, {R4,PC}\n" 
+"loc_FF87E4B4:\n" 
+                "MOV     R0, #1\n" 
+                "LDMFD   SP!, {R4,PC}\n" 
+ );
+} 
+
+//ok
+void __attribute__((naked,noinline)) sub_FF87DD8C_my(){  // _EntryActionOnPreMoving
+ asm volatile(         
+                "STMFD   SP!, {R4,LR}\n"
+                "LDR     R1, =0xFF87E080\n" // a_entryaction_0 ; "_EntryActionOnPreMoving" 
+                "MOV     R0, #0x60\n"
+                "BL      sub_FF86DA00\n"
+                "LDR     R4, =0x64B4\n"
+                "LDR     R0, [R4,#0x10]\n"
+                "CMP     R0, #0\n"
+                "LDMEQFD SP!, {R4,LR}\n"
+                "BEQ     sub_FF87E320_my\n" // _EntryActionOnMoving -------->
+                "LDR     R1, =0xFF87E09C\n" // a_entryactionon 
+                "MOV     R0, #0x60\n"
+                "BL      sub_FF86DA00\n"
+                "BL      sub_FF95D0D0\n"
+                "LDR     R0, [R4,#0x18]\n"
+                "CMP     R0, #1\n"
+                "MOVNE   R0, #1\n"
+                "STRNE   R0, [R4,#0x18]\n"
+                "BLNE    sub_FF8731F0\n"	//LockMainPower
+                "MOV     R0, #9\n"
+                "BL      sub_FF87E264\n"	//MovieState
+                "LDMFD   SP!, {R4,LR}\n"
+                "B       sub_FF95BC78\n"
+	);
+} 
+
+//ok
+void __attribute__((naked,noinline)) sub_FF87E320_my(){  //_EntryActionOnMoving
+ asm volatile(
+                "STMFD   SP!, {R4,LR}\n"
+                "LDR     R1, =0xFF87E4D4\n" //a_entryaction_1  
+                "MOV     R0, #0x60\n"
+                "BL      sub_FF86DA00\n" 
+                "LDR     R1, =0x64B4\n" 
+                "MOV     R0, #0\n"
+                "STR     R0, [R1,#0xC]\n"
+                "MOV     R0, #4\n"
+                "BL      sub_FF87E264\n" 
+                "LDMFD   SP!, {R4,LR}\n"
+                "B       sub_FF87DA5C_my\n" // ------------->
+ );
+} 
+
+//ok
+void __attribute__((naked,noinline)) sub_FF87DA5C_my(){ // 
+ asm volatile(                                            
+                 "STMFD   SP!, {R3-R5,LR}\n"
+                 "LDR     R4, =0x6470\n"
+                 "LDR     R0, [R4,#0x40]\n"
+                 "CMP     R0, #1\n"
+                 "BEQ     loc_FF87DAA4\n"
+                 "BL      sub_FF873C88\n"
+                 "SUB     R12, R0, #0xA00\n"
+                 "SUBS    R12, R12, #0x29\n"
+                 "MOV     R5, #1\n"
+                 "BNE     loc_FF87DA9C\n"
+                 "LDR     R0, =0x804F\n"
+                 "MOV     R2, #1\n"
+                 "MOV     R1, #1\n"
+                 "BL      sub_FF955D24\n" 
+                 "STR     R5, [R4,#0x40]\n"
+                 "B       loc_FF87DAA4\n"
+
+ "loc_FF87DA9C:\n"     
+                 "STR     R5, [R4,#0x40]\n"
+                 "BL      sub_FF8731F0\n" 
+
+ "loc_FF87DAA4:\n"                            
+                 "MOV     R1, #0\n"
+                 "MOV     R0, #0x80\n"
+                 "BL      sub_FF87E814\n"
+                 "MOV     R2, #2\n"
+                 "MOV     R1, SP\n"
+                 "MOV     R0, #0x6B\n"
+                 "BL      sub_FF86F768\n" 
+                 "MOV     R2, #2\n"
+                 "MOV     R1, SP\n"
+                 "MOV     R0, #0xA3\n"
+                 "BL      sub_FF86F660\n" 
+                 "BL      sub_FF85E628\n"
+                 "BL      sub_FF87CC6C\n"
+                 "BL      sub_FF82911C_my\n" // SSAPI.RecordMovie------->
+                 "BL      sub_FF87D37C\n"
+                 "LDMFD   SP!, {R3-R5,PC}\n"
+ );
+} 
+
+//ok
+void __attribute__((naked,noinline)) sub_FF82911C_my(){  // SSAPI.RecordMovie
+ asm volatile(
+                "STMFD   SP!, {R4,LR}\n"
+                "MOV     R4, R0\n"
+                "MOV     R0, #0x20\n"
+                "LDR     R1, =0xFF829240\n" // aSsapiRecordmov 
+                "BL      sub_FF86DA00\n" 
+                "BL      sub_FF8298FC\n" 
+                "CMP     R0, #0\n"
+                "LDMNEFD SP!, {R4,PC}\n"
+                "MOV     R0, #4\n"
+                "BL      sub_FF85B94C\n" 
+                "BL      sub_FF85FE5C\n" 
+                "MOV     R0, R4\n"
+                "LDMFD   SP!, {R4,LR}\n"
+                "B       sub_FF86280C_my\n" //  ----------------->
+ );
+} 
+
+//ok
+void __attribute__((naked,noinline)) sub_FF86280C_my(){ // 
+ asm volatile( 
+                "STMFD   SP!, {R4-R8,LR}\n"
+                "MOV     R8, R0\n"
+                "MOV     R0, #0x41\n"
+                "SUB     SP, SP, #0x38\n"
+                "MOV     R5, #0\n"
+                "STR     R0, [SP,#0x34]\n"
+                "BL      sub_FF8627DC\n"
+                "CMP     R0, #0\n"
+                "LDRNE   R1, =0x13B\n"
+                "BNE     loc_FF8629B8\n"
+                "LDR     R4, =0x5880\n"
+                "MOV     R1, #0x1E\n"
+                "LDR     R0, [R4,#0xC]\n"
+                "BL      sub_FF829D60\n"
+                "BL      sub_FF86F8F8\n"
+                "STR     R0, [R4,#4]\n"
+                "MOV     R0, #0\n"
+                "BL      sub_FF86BA3C\n"		//GetTimeOfSystem_im1
+                "STR     R0, [SP,#0x28]\n"
+                "ADD     R0, SP, #0x28\n"
+                "MOV     R1, SP\n"
+                "BL      sub_FF86B538\n"
+                "MOV     R0, SP\n"
+                "BL      sub_FF86B420\n"
+                "STR     R0, [SP,#0x2C]\n"
+                "LDR     R0, [R4,#4]\n"
+                "MOV     R3, #4\n"
+                "ADD     R2, SP, #0x2C\n" 
+                "MOV     R1, #0x34\n"
+                "BL      sub_FF86FC18\n"
+                "LDR     R7, [SP,#0x2C]\n"
+                "BL      sub_FF862D34\n"
+                "MOV     R6, #0\n"
+                "ADD     R1, SP, #0x28\n"
+                "ADD     R0, SP, #0x2C\n"
+                "STR     R6, [SP,#0x2C]\n"
+                "STR     R6, [SP,#0x28]\n"
+                "BL      sub_FF8331F4\n"		//GetAvControlLimit
+                "LDR     R0, [R4,#4]\n"
+                "MOV     R3, #2\n"
+                "ADD     R2, SP, #0x2C\n"
+                "MOV     R1, #0x2F\n"
+                "BL      sub_FF86FC18\n"
+                "LDR     R0, [R4,#4]\n"
+                "MOV     R3, #2\n"
+                "ADD     R2, SP, #0x28\n"
+                "MOV     R1, #0x2D\n"
+                "BL      sub_FF86FC18\n"
+                "ADD     R1, SP, #0x28\n"
+                "ADD     R0, SP, #0x2C\n"
+                "BL      sub_FF836954\n"		//GetAvControlLimitWithoutTv
+                "LDR     R0, [R4,#4]\n"
+                "MOV     R3, #2\n"
+                "ADD     R2, SP, #0x2C\n"
+                "MOV     R1, #0x30\n"
+                "BL      sub_FF86FC18\n"
+                "ADD     R1, SP, #0x28\n"
+                "ADD     R0, SP, #0x2C\n"
+                "BL      sub_FF8339B8\n"		//GetTvControlLimit
+                "LDR     R0, [R4,#4]\n"
+                "MOV     R3, #2\n"
+                "ADD     R2, SP, #0x28\n"
+                "MOV     R1, #0x2E\n"
+                "BL      sub_FF86FC18\n"
+                "LDR     R0, [R4,#4]\n"
+                "MOV     R3, #2\n"
+                "ADD     R2, SP, #0x2C\n"
+                "MOV     R1, #0xB8\n"
+                "BL      sub_FF86FCC4\n"
+                "TST     R0, #1\n"
+                "LDRNE   R1, =0x11D\n"
+                "LDRNE   R0, =0xFF862C30\n" 	//aSsmovierec_c
+                "BLNE    sub_FF81BFC8\n" 		// DebugAssert
+                "LDRH    R0, [SP,#0x2C]\n"
+                "MOV     R3, #4\n"
+                "ADD     R2, SP, #0x28\n"
+                "CMP     R0, #0\n"
+                "MOVNE   R0, #1\n"
+                "STR     R0, [SP,#0x28]\n"
+                "LDR     R0, [R4,#4]\n"
+                "MOV     R1, #0x92\n"
+                "BL      sub_FF86FC18\n"
+                "MOV     R2, #1\n"
+                "ADD     R1, SP, #0x34\n"
+                "MOV     R0, #0xFA\n"
+                "BL      sub_FF86F768\n"		//PT_GetPropertyCaseString
+                "TST     R0, #1\n"
+                "LDRNE   R1, =0x152\n"
+                "LDRNE   R0, =0xFF862C30\n" 	// "SsMovieRec.c" 
+                "BLNE    sub_FF81BFC8\n" 		// DebugAssert ****
+                "LDRB    R0, [SP,#0x34]\n"
+                "MOV     R3, R8\n"
+                "MOV     R2, #0x14\n"
+                "AND     R1, R0, #0xFF\n"
+                "ADD     R0, SP, #0x30\n"
+                "STR     R7, [SP]\n"
+                "BL      sub_FF9188E4\n"
+                "TST     R0, #1\n"
+                "LDRNE   R1, =0x156\n"
+                "BNE     loc_FF8629B8\n"
+                "LDR     R0, =0x1E430\n"
+                "LDR     R1, [SP,#0x30]\n"
+                "MOV     R2, #0x10\n"
+                "BL      sub_FF90BD08\n"
+                "TST     R0, #1\n"
+                "BEQ     loc_FF8629C8\n"
+                "LDR     R1, =0x15E\n"
+"loc_FF8629B8:\n"
+                "LDR     R0, =0xFF862C30\n" // ; "SsMovieRec.c" 
+                "BL      sub_FF81BFC8\n" 	// DebugAssert
+"loc_FF8629C0:\n"
+                "ADD     SP, SP, #0x38\n"
+                "LDMFD   SP!, {R4-R8,PC}\n"
+"loc_FF8629C8:\n"
+                "LDR     R0, [R4,#4]\n"
+                "MOV     R3, #4\n"
+                "ADD     R2, SP, #0x30\n"
+                "MOV     R1, #0x2B\n"
+                "BL      sub_FF86FC18\n"
+                "BL      sub_FF87FD70\n"
+                "LDRSB   R1, [SP,#0x34]\n"
+                "CMP     R0, R1\n"
+                "MOVEQ   R7, #0\n"
+                "BEQ     loc_FF862A1C\n"
+                "LDR     R5, =0x1E430\n"
+                "MOV     R0, R5\n"
+                "BL      sub_FF87FEEC\n"
+                "MOV     R8, R0\n"
+                "BL      sub_FF8BD498\n"
+                "CMP     R8, R0\n"
+                "MOV     R7, R0\n"
+                "LDRLS   R1, =0x16B\n"
+                "LDRLS   R0, =0xFF862C30\n" // ; "SsMovieRec.c" 
+                "BLLS    sub_FF81BFC8\n"	// DebugAssert
+                "SUB     R7, R8, R7\n"
+"loc_FF862A1C:\n"
+                "BL      sub_FF85D5C8_my\n" // taskcreate_MovieRecord----------------------->
+                "LDR     R0, =0x1E454\n"
+                "LDRH    R3, [R0,#0x4E]\n"
+                "LDRH    R2, [R0,#0x4C]\n"
+                "LDR     R1, [R0,#0x48]\n"
+                "LDR     R0, [R0,#0x44]\n"
+                "BL      sub_FF85C44C\n"
+                "MOV     R3, #0\n"
+                "LDR     R2, =0xFF8627A4\n"
+                "MOV     R1, #0\n"
+                "LDR     R0, =0xFF8627B8\n"
+                "ADD     R8, SP, #0x0c\n"
+                "STMIA   R8, {R0-R3}\n"
+                "LDR     R2, =0xFF8627C8\n"
+                "LDR     R1, =0xFF8627B4\n"
+                "STMEA   SP, {R1-R3}\n"
+                "LDR     R1, [R4,#4]\n"
+                "MOV     R3, R6\n"
+                "MOV     R2, R7\n"
+                "MOV     R0, R5\n"
+                "BL      sub_FF85C7C8\n"
+                "LDR     R0, [R4,#0xC]\n"
+                "MOV     R1, #0x20\n"
+                "BL      sub_FF829D2C\n"
+                "B       loc_FF8629C0\n"
+ );
+} 
+
+//ok
+void __attribute__((naked,noinline)) sub_FF85D5C8_my(){   // taskcreate_MovieRecord 
+ asm volatile(
+                "STMFD   SP!, {R3-R9,LR}\n"
+                "LDR     R5, =0x56D8\n"			//**
+                "MOV     R6, #0\n"
+                "STR     R6, [R5,#0x24]\n"
+                "LDR     R0, [R5,#8]\n"
+                "LDR     R8, =0x2710\n"
+                "CMP     R0, #0\n"
+                "BNE     loc_FF85D680\n"
+                "MOV     R0, #1\n"
+                "STR     R0, [R5,#8]\n"
+                "MOV     R0, #0\n"
+                "MOV     R1, #0\n"
+                "BL      sub_FF81BE44\n"
+                "STR     R0, [R5,#0x14]\n"
+                "MOV     R0, #0\n"
+                "MOV     R1, #0\n"
+                "BL      sub_FF81BE44\n"
+                "STR     R0, [R5,#0x18]\n"
+                "MOV     R0, #0\n"
+                "MOV     R1, #0xA\n"
+                "BL      sub_FF81BDFC\n"
+                "STR     R0, [R5,#0x1C]\n"
+                "MOV     R0, #0\n"
+                "MOV     R1, #0xA\n"
+                "BL      sub_FF81BDFC\n"
+                "LDR     R7, =0x1DF58\n"
+                "MOV     R4, #9\n"
+                "ADD     R9, R4, #0x2D4\n"
+                "STR     R0, [R5,#0x20]\n"
+"loc_FF85D63C:\n"
+                "RSB     R0, R4, R4,LSL#3\n"
+                "STR     R6, [R7,R0,LSL#2]\n"
+                "ADD     R1, R7, R0,LSL#2\n"
+                "STR     R9, [SP]\n"
+                "LDR     R0, [R5,#0x20]\n"
+				"LDR     R3, =0xFF85D7D0\n" 	// =aMovierecorder_
+                "MOV     R2, R8\n"
+                "BL      sub_FF81BF08\n"
+                "SUBS    R4, R4, #1\n"
+                "BPL     loc_FF85D63C\n"
+                "MOV     R3, #0\n"
+                "STR     R3, [SP]\n"			//**
+				"LDR     R3, =MovieRecord_Task_my\n" // task_MovieRecord <--------
+                "MOV     R2, #0x1000\n"
+                "MOV     R1, #0x14\n"
+				"LDR     R0, =0xFF85D7D0\n" 	// =aMovierecorder_
+				"BL      sub_FF81BDC8\n" 		// KernelCreateTask
+"loc_FF85D680:\n"
+				"BL      sub_FF94005C\n" 		//taskcreate_AviWrite
+                "BL      sub_FF85D6E4\n"
+                "MOV     R1, R0\n"
+                "MOV     R0, #0xB\n"
+                "ADD     R3, R0, #0x2DC\n"
+                "STR     R0, [R1]\n"
+                "STR     R3, [SP]\n"
+                "LDR     R0, [R5,#0x1C]\n"
+				"LDR     R3, =0xFF85C768\n" // aMovierecorder_ 
+                "MOV     R2, R8\n"
+                "BL      sub_FF81BF08\n"
+                "LDMFD   SP!, {R3-R9,PC}\n"
+ );
+} 
+
+//ok
+void __attribute__((naked,noinline)) MovieRecord_Task_my(){ // FF85D4C0
+ asm volatile(
+ 
+                "STMFD   SP!, {R2-R8,LR}\n"
+                "LDR     R8, =0x32B\n"
+                "LDR     R7, =0x2710\n"
+                "LDR     R4, =0x56D8\n"		//***
+                "MOV     R6, #0\n"
+                "MOV     R5, #1\n"
+"loc_FF85D4D8:\n"
+                "LDR     R0, [R4,#0x1C]\n"
+                "MOV     R2, #0\n"
+                "ADD     R1, SP, #0x4\n"
+                "BL      sub_FF829FB0\n"
+                "LDR     R0, [R4,#0x24]\n"
+                "CMP     R0, #0\n"
+                "BNE     loc_FF85D5A8\n"
+                "LDR     R0, [SP,#4]\n"
+                "LDR     R1, [R0]\n"
+                "SUB     R1, R1, #2\n"
+                "CMP     R1, #9\n"
+                "ADDLS   PC, PC, R1,LSL#2\n"
+                "B       loc_FF85D5A8\n"
+"loc_FF85D50C:\n"
+                "B       loc_FF85D55C\n"
+"loc_FF85D510:\n"
+                "B       loc_FF85D57C\n"
+"loc_FF85D514:\n"
+                "B       loc_FF85D58C\n"
+"loc_FF85D518:\n"
+                "B       loc_FF85D594\n"
+"loc_FF85D51C:\n"
+                "B       loc_FF85D564\n"
+"loc_FF85D520:\n"
+                "B       loc_FF85D59C\n"
+"loc_FF85D524:\n"
+                "B       loc_FF85D56C\n"
+"loc_FF85D528:\n"
+                "B       loc_FF85D5A8\n"
+"loc_FF85D52C:\n"
+                "B       loc_FF85D5A4\n"
+"loc_FF85D530:\n"
+                "B       loc_FF85D534\n"
+"loc_FF85D534:\n"
+                "LDR     R0, =0xFF85D180\n" // nullsub_192
+                "STR     R6, [R4,#0x38]\n"
+                "STR     R0, [R4,#0xA4]\n"
+                "LDR     R0, =0xFF85CABC\n"
+                "LDR     R2, =0xFF85C9D8\n"
+                "LDR     R1, =0x1E080\n"
+                "STR     R6, [R4,#0x28]\n"
+                "BL      sub_FF83D8B4\n"
+                "STR     R5, [R4,#0x3C]\n"
+                "B       loc_FF85D5A8\n"
+"loc_FF85D55C:\n"
+                "BL      unlock_optical_zoom\n"		//--------------->
+                "BL      sub_FF85D278\n"
+                "B       loc_FF85D5A8\n"
+"loc_FF85D564:\n"
+                //"BL      sub_FF85CF18\n"
+                "BL      sub_FF85CF18_my\n"  	// --------------->
+                "B       loc_FF85D5A8\n"
+"loc_FF85D56C:\n"
+                "LDR     R1, [R0,#0x10]\n"
+                "LDR     R0, [R0,#4]\n"
+                "BL      sub_FF940C98\n"
+                "B       loc_FF85D5A8\n"
+"loc_FF85D57C:\n"
+                "LDR     R0, [R4,#0x3C]\n"
+                "CMP     R0, #5\n"
+                "STRNE   R5, [R4,#0x2C]\n"
+                "B       loc_FF85D5A8\n"
+"loc_FF85D58C:\n"
+                "BL      sub_FF85CCA8\n"
+                "B       loc_FF85D5A8\n"
+"loc_FF85D594:\n"
+                "BL      sub_FF85CB08\n"
+                "B       loc_FF85D5A8\n"
+"loc_FF85D59C:\n"
+                "BL      sub_FF85C964\n"
+                "B       loc_FF85D5A8\n"
+"loc_FF85D5A4:\n"
+                "BL      sub_FF85D710\n"
+"loc_FF85D5A8:\n"
+                "LDR     R1, [SP,#0x04]\n"
+                "STR     R6, [R1]\n"
+                "LDR     R3, =0xFF85C768\n"	//aMovierecorder_ 
+                "MOV     R2, R7\n"
+                "STR     R8, [SP]\n"
+                "LDR     R0, [R4,#0x20]\n"	//**
+                "BL      sub_FF81BF08\n"	//**
+                "B       loc_FF85D4D8\n"
+ );
+} 
+
+
+void __attribute__((naked,noinline)) sub_FF85CF18_my(){  // 
+ asm volatile(   
+                "STMFD   SP!, {R4-R9,LR}\n"
+                "SUB     SP, SP, #0x3C\n"
+                "MOV     R7, #0\n"			//**
+                "LDR     R5, =0x56D8\n"
+                "MOV     R4, R0\n"
+                "STR     R7, [SP,#0x2C]\n"
+                "STR     R7, [SP,#0x24]\n"
+                "LDR     R0, [R5,#0x3C]\n"
+                "MOV     R8, #4\n"
+                "CMP     R0, #3\n"
+                "STREQ   R8, [R5,#0x3C]\n"
+                "LDR     R0, [R5,#0xA4]\n"
+                "MOV     R6, #0\n"			//**
+                //"BLX     R0\n"
+                ".long   0xE12FFF30\n" 
+                "LDR     R0, [R5,#0x3C]\n"
+                "CMP     R0, #4\n"
+                "BNE     loc_FF85D028\n"
+                "LDRH    R0, [R5,#2]\n"
+                "MOV     R9, #1\n"
+                "CMP     R0, #1\n"
+                "BNE     loc_FF85CF94\n"
+                "LDRH    R1, [R5,#4]\n"
+                "LDR     R0, [R5,#0x4C]\n"
+                "MUL     R0, R1, R0\n"
+                "MOV     R1, #0x3E8\n"
+                "BL      sub_FFABEC38\n"
+                "MOV     R1, R0\n"
+                "LDR     R0, [R5,#0x54]\n"
+                "BL      sub_FFABEC38\n"
+                "CMP     R1, #0\n"
+                "BNE     loc_FF85CFB0\n"
+"loc_FF85CF94:\n"
+                "ADD     R3, SP, #0x24\n"
+                "ADD     R2, SP, #0x28\n"
+                "ADD     R1, SP, #0x2C\n"
+                "ADD     R0, SP, #0x30\n"
+                "BL      sub_FF940E2C\n"
+                "MOVS    R6, R0\n"
+                "BNE     loc_FF85CFCC\n"
+"loc_FF85CFB0:\n"
+                "LDR     R0, [R5,#0x2C]\n"
+                "CMP     R0, #1\n"
+                "BNE     loc_FF85D030\n"
+                "LDR     R0, [R5,#0x54]\n"
+                "LDR     R1, [R5,#0x40]\n"
+                "CMP     R0, R1\n"
+                "BCC     loc_FF85D030\n"
+"loc_FF85CFCC:\n"
+                "CMP     R6, #0x80000001\n"		//**
+                "STREQ   R8, [R5,#0x58]\n"
+                "BEQ     loc_FF85D004\n"
+                "CMP     R6, #0x80000003\n"		//**
+                "STREQ   R9, [R5,#0x58]\n"
+                "BEQ     loc_FF85D004\n"
+                "CMP     R6, #0x80000005\n"		
+                "MOVEQ   R0, #2\n"
+                "BEQ     loc_FF85D000\n"
+                "CMP     R6, #0x80000007\n"		//**
+                "STRNE   R7, [R5,#0x58]\n"
+                "BNE     loc_FF85D004\n"
+                "MOV     R0, #3\n"
+"loc_FF85D000:\n"
+                "STR     R0, [R5,#0x58]\n"
+"loc_FF85D004:\n"
+                "LDR     R0, =0x1E0B0\n"
+                "LDR     R0, [R0,#8]\n"
+                "CMP     R0, #0\n"
+                "BEQ     loc_FF85D01C\n"
+                "BL      sub_FF84ACE4\n"
+                "B       loc_FF85D020\n"
+"loc_FF85D01C:\n"
+                "BL      sub_FF85C964\n"
+"loc_FF85D020:\n"
+                "MOV     R0, #5\n"
+                "STR     R0, [R5,#0x3C]\n"
+"loc_FF85D028:\n"
+                "ADD     SP, SP, #0x3C\n"
+                "LDMFD   SP!, {R4-R9,PC}\n"
+"loc_FF85D030:\n"
+                "LDR     R12, [SP,#0x2C]\n"
+                "CMP     R12, #0\n"
+                "BEQ     loc_FF85D128\n"
+                "STR     R9, [R5,#0x30]\n"
+                "LDR     R0, [R5,#0x48]\n"
+                "CMP     R0, #4\n"
+                "LDRNE   LR, [R4,#0xC]\n"
+                "BNE     loc_FF85D070\n"
+                "LDR     R0, [R4,#0xC]\n"
+                "LDR     R1, [R4,#8]\n"
+                "MOV     R2, R0,LSR#3\n"
+                "MUL     R1, R2, R1\n"
+                "LDR     R2, [R4,#4]\n"
+                "SUB     LR, R0, R0,LSR#2\n"
+                "ADD     R1, R2, R1,LSL#1\n"
+                "STR     R1, [R4,#4]\n"
+"loc_FF85D070:\n"
+                "LDR     R0, [R5,#0x70]\n"
+                "LDR     R1, [R4,#0x14]\n"
+                "LDR     R2, [R4,#0x18]\n"
+                "ADD     R3, SP, #0x34\n"
+                "ADD     R6, SP, #0x14\n"
+                "STMIA   R6, {R0-R3}\n"
+                "LDR     R0, [SP,#0x24]\n"		//**
+                "LDR     R3, [R5,#0x5C]\n"
+                "LDR     R1, [SP,#0x28]\n"
+                "ADD     R2, SP, #0x38\n"
+                "ADD     R6, SP, #0x08\n"
+                "STMIA   R6, {R0,R2,R3}\n"
+                "STR     R1, [SP,#0x04]\n"
+                "STR     R12, [SP]\n"
+                "LDMIB   R4, {R0,R1}\n"
+                "LDR     R3, [SP,#0x30]\n"
+                "MOV     R2, LR\n"
+                "BL      sub_FF8FBD68\n"
+                "LDR     R0, [R5,#0x14]\n"
+                "MOV     R1, #0x3E8\n"
+				"BL      sub_FF81B98C\n"	//TakeSemaphore
+                "CMP     R0, #9\n"
+                "BNE     loc_FF85D0DC\n"
+                "BL      sub_FF941408\n"
+                "MOV     R0, #0x90000\n"
+                "STR     R9, [R5,#0x3C]\n"
+                "B       loc_FF85D0F4\n"
+"loc_FF85D0DC:\n"
+                "LDR     R0, [SP,#0x34]\n"
+                "CMP     R0, #0\n"
+                "BEQ     loc_FF85D0FC\n"
+                "BL      sub_FF941408\n"
+                "MOV     R0, #0xA0000\n"
+                "STR     R9, [R5,#0x3C]\n"
+"loc_FF85D0F4:\n"
+                "BL      sub_FF87347C\n" 	//HardwareDefect
+                "B       loc_FF85D028\n"
+"loc_FF85D0FC:\n"
+                "BL      sub_FF8FBE2C\n"
+                "LDR     R0, [SP,#0x30]\n"		//**
+                "LDR     R1, [SP,#0x38]\n"
+                "BL      sub_FF9411B0\n"
+                "LDR     R0, [R5,#0x50]\n"
+                "LDR     R1, =0x5748\n"
+                "ADD     R0, R0, #1\n"
+                "STR     R0, [R5,#0x50]\n"
+                "LDR     R0, [SP,#0x38]\n"
+                "MOV     R2, #0\n"
+                //BL      sub_FF93F040
+                "BL      sub_FF93EFD0_my\n"  // ----------------->
+"loc_FF85D128:\n"
+                "LDR     R0, [R5,#0x54]\n"
+                "ADD     R0, R0, #1\n"
+                "STR     R0, [R5,#0x54]\n"
+                "LDR     R1, [R5,#0x7C]\n"
+                "MUL     R0, R1, R0\n"
+                "LDR     R1, [R5,#0x78]\n"
+                "BL      sub_FFABEC38\n"
+                "MOV     R4, R0\n"
+                "BL      sub_FF941440\n"
+                "LDR     R1, [R5,#0x74]\n"
+                "CMP     R1, R4\n"
+                "BNE     loc_FF85D164\n"
+                "LDR     R0, [R5,#0x34]\n"
+                "CMP     R0, #1\n"
+                "BNE     loc_FF85D178\n"
+"loc_FF85D164:\n"
+                "LDR     R1, [R5,#0x88]\n"
+                "MOV     R0, R4\n"
+                //"BLX     R1\n"
+                ".long   0xE12FFF31\n"
+                "STR     R4, [R5,#0x74]\n"
+                "STR     R7, [R5,#0x34]\n"		//**
+"loc_FF85D178:\n"
+                "STR     R7, [R5,#0x30]\n"
+                "B       loc_FF85D028\n"
+ );
+} 
+
+//ok
+void __attribute__((naked,noinline)) sub_FF93EFD0_my(){   // 
+ asm volatile(
+                "STMFD   SP!, {R4-R8,LR}\n"
+                "LDR     R4, =0xE400\n"
+                "LDR     LR, [R4]\n"
+                "LDR     R2, [R4,#8]\n"
+                "CMP     LR, #0\n"
+                "LDRNE   R3, [R4,#0xC]\n"
+                "MOV     R5, R2\n"
+                "CMPNE   R3, #1\n"
+                "MOVEQ   R2, #0\n"
+                "STREQ   R0, [R4]\n"
+                "STREQ   R2, [R4,#0xC]\n"
+                "BEQ     loc_FF93F09C\n"
+                "LDR     R3, [R4,#4]\n"
+                "LDR     R7, =table\n"          // unk_FFADC8E8
+                "ADD     R12, R3, R3,LSL#1\n"
+                "LDR     R3, [R7,R12,LSL#2]\n"
+                "ADD     R6, R7, #0x60\n"
+                "LDR     R8, [R6,R12,LSL#2]\n"
+                "SUB     R3, LR, R3\n"
+                "CMP     R3, #0\n"
+                "SUB     LR, LR, R8\n"
+                "BLE     loc_FF93F058\n"
+                "ADD     R12, R7, R12,LSL#2\n"
+                "LDR     LR, [R12,#4]\n"
+                "CMP     LR, R3\n"
+                "ADDGE   R2, R2, #1\n"
+                "BGE     loc_FF93F04C\n"
+                "LDR     R12, [R12,#8]\n"
+                "CMP     R12, R3\n"
+                "ADDLT   R2, R2, #3\n"
+                "ADDGE   R2, R2, #2\n"
+"loc_FF93F04C:\n"
+    //          "CMP     R2, #0x17\n"   // -
+    //          "MOVGE   R2, #0x16\n"   // -
+                "CMP     R2, #0x1A\n"   // +
+                "MOVGE   R2, #0x19\n"   // +
+                "B       loc_FF93F08C\n"
+"loc_FF93F058:\n"
+                "CMP     LR, #0\n"
+                "BGE     loc_FF93F08C\n"
+                "ADD     R3, R6, R12,LSL#2\n"
+                "LDR     R12, [R3,#4]\n"
+                "CMP     R12, LR\n"
+                "SUBLE   R2, R2, #1\n"
+                "BLE     loc_FF93F084\n"
+                "LDR     R3, [R3,#8]\n"
+                "CMP     R3, LR\n"
+                "SUBGT   R2, R2, #3\n"
+                "SUBLE   R2, R2, #2\n"
+"loc_FF93F084:\n"
+                "CMP     R2, #0\n"
+                "MOVLT   R2, #0\n"
+"loc_FF93F08C:\n"
+                "CMP     R2, R5\n"
+                "STRNE   R2, [R4,#8]\n"
+                "MOVNE   R2, #1\n"
+                "STRNE   R2, [R4,#0xC]\n"
+"loc_FF93F09C:\n"
+                "LDR     R2, =CompressionRateTable\n"   // dword_FFADC878
+                "LDR     R3, [R4,#8]\n"
+                "LDR     R2, [R2,R3,LSL#2]\n"
+
+                "LDR     R3, =video_mode\n"      // +
+                "LDR     R3, [R3]\n"             // +
+                "LDR     R3, [R3]\n"             // +
+                "CMP     R3, #1\n"               // +
+                "LDREQ   R3, =video_quality\n"   // +     
+                "LDREQ   R3, [R3]\n"             // +     
+                "LDREQ   R2, [R3]\n"             // +     
+
+                "STR     R2, [R1]\n"
+                "STR     R0, [R4]\n"
+                "LDMFD   SP!, {R4-R8,PC}\n"
+ );
+} 
+
+
+//********
+
+
+#include "conf.h"
+
+int *video_quality = &conf.video_quality;
+int *video_mode    = &conf.video_mode;
+
+long def_table[48]={
+  0x2000,   0x38D,   0x788, 0x5800,  0x9C5,  0x14B8, 0x10000,  0x1C6A,  0x3C45, 0x20000,  0x387A,  0x7813,
+ 0x25800,  0x422F,  0x8CB6, 0x8000,  0xE35,  0x1E23, 0x10000,  0x1C6A,  0x3C45, 0x12C00,  0x2118,  0x465B,
+  0x1CCD,  -0x2E1,  -0x579, 0x4F33, -0x7EB,  -0xF0C,  0xE666, -0x170A, -0x2BC6, 0x1CC39, -0x2F5B, -0x59F0,
+ 0x21B53, -0x377F, -0x6965, 0x7333, -0xB85, -0x15E3,  0xE666, -0x170A, -0x2BC6, 0x10DAA, -0x1BC0, -0x34B3};
+
+
+
+long table[48];
+
+void change_video_tables(int a, int b){
+ int i;
+ for (i=0;i<48;i++) table[i]=(def_table[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};
Index: /branches/reyalp-ptp-live/platform/g9/sub/100d/stubs_auto.S
===================================================================
--- /branches/reyalp-ptp-live/platform/g9/sub/100d/stubs_auto.S	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/g9/sub/100d/stubs_auto.S	(revision 1668)
@@ -0,0 +1,473 @@
+/* THIS FILE IS GENERATED */
+/* DO NOT EDIT THIS FILE! */
+
+#include "stubs_asm.h"
+
+STUB(FF8101a4)
+STUB(FF81095C)
+STUB(FF810FB8)
+STUB(FF8114D0)
+STUB(FF812D70)
+STUB(FF81357C)
+STUB(FF8149E0)
+STUB(FF814ACC)
+STUB(FF814EB0)
+STUB(FF815088)
+STUB(FF81517C)
+STUB(FF8194D0)
+STUB(FF819948)
+STUB(FF81B98C)
+STUB(FF81BAF0)
+STUB(FF81BD80)
+STUB(FF81BDC8)
+STUB(FF81BDFC)
+STUB(FF81BE20)
+STUB(FF81BE44)
+STUB(FF81BF08)
+STUB(FF81BFC8)
+STUB(FF820E60)
+STUB(FF821FF8)
+STUB(FF82203C)
+STUB(FF822130)
+STUB(FF8224B0)
+STUB(FF8228D4)
+STUB(FF822DA8)
+STUB(FF822E10)
+STUB(FF823FA0)
+STUB(FF824504)
+STUB(FF824568)
+STUB(FF82457C)
+STUB(FF826210)
+STUB(FF82629C)
+STUB(FF8262FC)
+STUB(FF826548)
+STUB(FF826590)
+STUB(FF8268E8)
+STUB(FF826E78)
+STUB(FF826EB4)
+STUB(FF828D44)
+STUB(FF82911C)
+STUB(FF829154)
+STUB(FF829828)
+STUB(FF8298FC)
+STUB(FF8299CC)
+STUB(FF829C64)
+STUB(FF829D2C)
+STUB(FF829D60)
+STUB(FF829FB0)
+STUB(FF82A488)
+STUB(FF82A67C)
+STUB(FF82A6D0)
+STUB(FF82C6A8)
+STUB(FF82C8FC)
+STUB(FF82C9C4)
+STUB(FF82CADC)
+STUB(FF82CB2C)
+STUB(FF82CCA4)
+STUB(FF82CCA8)
+STUB(FF82CCC0)
+STUB(FF82CCF0)
+STUB(FF82CD04)
+STUB(FF82CDA8)
+STUB(FF82CDD0)
+STUB(FF82CE8C)
+STUB(FF82CEFC)
+STUB(FF82CF20)
+STUB(FF82D040)
+STUB(FF82D1B4)
+STUB(FF82D720)
+STUB(FF82D7A0)
+STUB(FF82D7A8)
+STUB(FF82D828)
+STUB(FF82D864)
+STUB(FF82D8A0)
+STUB(FF82D8C0)
+STUB(FF82D8CC)
+STUB(FF82D900)
+STUB(FF82DC00)
+STUB(FF82DC30)
+STUB(FF8331F4)
+STUB(FF8339B8)
+STUB(FF836954)
+STUB(FF83D8B4)
+STUB(FF83EEE0)
+STUB(FF84962C)
+STUB(FF84ACE4)
+STUB(FF84BE78)
+STUB(FF851B4C)
+STUB(FF851F2C)
+STUB(FF851F6C)
+STUB(FF852030)
+STUB(FF852198)
+STUB(FF852204)
+STUB(FF85235C)
+STUB(FF8528F4)
+STUB(FF852A0C)
+STUB(FF85B94C)
+STUB(FF85C44C)
+STUB(FF85C7C8)
+STUB(FF85C964)
+STUB(FF85CB08)
+STUB(FF85CCA8)
+STUB(FF85CF18)
+STUB(FF85D278)
+STUB(FF85D5C8)
+STUB(FF85D6E4)
+STUB(FF85D710)
+STUB(FF85E584)
+STUB(FF85E5B0)
+STUB(FF85E628)
+STUB(FF85F050)
+STUB(FF85F620)
+STUB(FF85FE5C)
+STUB(FF8601A0)
+STUB(FF860370)
+STUB(FF860584)
+STUB(FF86089C)
+STUB(FF860938)
+STUB(FF860BD0)
+STUB(FF860CEC)
+STUB(FF8614E8)
+STUB(FF8615D0)
+STUB(FF8627DC)
+STUB(FF86280C)
+STUB(FF862CA8)
+STUB(FF862D34)
+STUB(FF8631AC)
+STUB(FF86383C)
+STUB(FF86499C)
+STUB(FF864A14)
+STUB(FF864CFC)
+STUB(FF864D24)
+STUB(FF864EA8)
+STUB(FF86B420)
+STUB(FF86B538)
+STUB(FF86BA3C)
+STUB(FF86BAEC)
+STUB(FF86C4D0)
+STUB(FF86C610)
+STUB(FF86DA00)
+STUB(FF86F660)
+STUB(FF86F768)
+STUB(FF86F8F8)
+STUB(FF86FB0C)
+STUB(FF86FC18)
+STUB(FF86FCC4)
+STUB(FF86FFF8)
+STUB(FF870024)
+STUB(FF870768)
+STUB(FF8709DC)
+STUB(FF870F18)
+STUB(FF87118C)
+STUB(FF8711D8)
+STUB(FF872854)
+STUB(FF872EB8)
+STUB(FF8731F0)
+STUB(FF87347C)
+STUB(FF873B38)
+STUB(FF873C88)
+STUB(FF873C90)
+STUB(FF873C9C)
+STUB(FF873F90)
+STUB(FF873FB4)
+STUB(FF874024)
+STUB(FF8746F0)
+STUB(FF874770)
+STUB(FF8747AC)
+STUB(FF87486C)
+STUB(FF8748A0)
+STUB(FF8748E4)
+STUB(FF8749CC)
+STUB(FF874A74)
+STUB(FF874B90)
+STUB(FF874F60)
+STUB(FF874FDC)
+STUB(FF875078)
+STUB(FF875130)
+STUB(FF8751CC)
+STUB(FF87522C)
+STUB(FF875404)
+STUB(FF875648)
+STUB(FF8758BC)
+STUB(FF875A0C)
+STUB(FF875B14)
+STUB(FF875CC0)
+STUB(FF875E1C)
+STUB(FF875F98)
+STUB(FF876264)
+STUB(FF8763F4)
+STUB(FF876418)
+STUB(FF87643C)
+STUB(FF876460)
+STUB(FF8765BC)
+STUB(FF8765F8)
+STUB(FF87670C)
+STUB(FF87681C)
+STUB(FF876860)
+STUB(FF876890)
+STUB(FF8768C8)
+STUB(FF8769B0)
+STUB(FF876AF8)
+STUB(FF876BD8)
+STUB(FF876E4C)
+STUB(FF876E8C)
+STUB(FF876EF8)
+STUB(FF876F5C)
+STUB(FF8770A8)
+STUB(FF8771C4)
+STUB(FF8772D4)
+STUB(FF877310)
+STUB(FF87734C)
+STUB(FF87737C)
+STUB(FF8773E0)
+STUB(FF877670)
+STUB(FF8776E0)
+STUB(FF877B4C)
+STUB(FF877D84)
+STUB(FF877E68)
+STUB(FF877F94)
+STUB(FF877FEC)
+STUB(FF878018)
+STUB(FF8781CC)
+STUB(FF878204)
+STUB(FF878310)
+STUB(FF8788CC)
+STUB(FF8789D8)
+STUB(FF878A18)
+STUB(FF878AB0)
+STUB(FF878EEC)
+STUB(FF878F88)
+STUB(FF878FD4)
+STUB(FF879B00)
+STUB(FF879E74)
+STUB(FF879F0C)
+STUB(FF879FC4)
+STUB(FF87A0A4)
+STUB(FF87A18C)
+STUB(FF87A198)
+STUB(FF87A1A4)
+STUB(FF87A334)
+STUB(FF87A378)
+STUB(FF87A3A8)
+STUB(FF87A3D4)
+STUB(FF87A3FC)
+STUB(FF87A420)
+STUB(FF87A44C)
+STUB(FF87A500)
+STUB(FF87A5E0)
+STUB(FF87A5E4)
+STUB(FF87A6F4)
+STUB(FF87B1FC)
+STUB(FF87C4A0)
+STUB(FF87C994)
+STUB(FF87C9AC)
+STUB(FF87C9E4)
+STUB(FF87CC6C)
+STUB(FF87D29C)
+STUB(FF87D330)
+STUB(FF87D37C)
+STUB(FF87D3C4)
+STUB(FF87D3E8)
+STUB(FF87D444)
+STUB(FF87D508)
+STUB(FF87D688)
+STUB(FF87D9BC)
+STUB(FF87DA3C)
+STUB(FF87DA5C)
+STUB(FF87DC70)
+STUB(FF87DD8C)
+STUB(FF87DDE8)
+STUB(FF87DE60)
+STUB(FF87E1C0)
+STUB(FF87E1F4)
+STUB(FF87E200)
+STUB(FF87E264)
+STUB(FF87E27C)
+STUB(FF87E304)
+STUB(FF87E320)
+STUB(FF87E34C)
+STUB(FF87E36C)
+STUB(FF87E384)
+STUB(FF87E3A0)
+STUB(FF87E3D4)
+STUB(FF87E3F8)
+STUB(FF87E650)
+STUB(FF87E814)
+STUB(FF87E854)
+STUB(FF87E9A0)
+STUB(FF87FD60)
+STUB(FF87FD70)
+STUB(FF87FEEC)
+STUB(FF88045C)
+STUB(FF890150)
+STUB(FF893354)
+STUB(FF893614)
+STUB(FF894488)
+STUB(FF895AD0)
+STUB(FF897408)
+STUB(FF897664)
+STUB(FF897B9C)
+STUB(FF897C24)
+STUB(FF897EA4)
+STUB(FF8983E4)
+STUB(FF8ACA40)
+STUB(FF8B56C0)
+STUB(FF8B57CC)
+STUB(FF8B5824)
+STUB(FF8B587C)
+STUB(FF8B58D4)
+STUB(FF8B592C)
+STUB(FF8B5A6C)
+STUB(FF8B5B24)
+STUB(FF8B5DAC)
+STUB(FF8B5FB0)
+STUB(FF8B6218)
+STUB(FF8B640C)
+STUB(FF8B6670)
+STUB(FF8B67AC)
+STUB(FF8B6A04)
+STUB(FF8B6C40)
+STUB(FF8B6F3C)
+STUB(FF8B7040)
+STUB(FF8B7274)
+STUB(FF8B73EC)
+STUB(FF8B7584)
+STUB(FF8B76BC)
+STUB(FF8B7904)
+STUB(FF8B888C)
+STUB(FF8B8AE0)
+STUB(FF8B8B40)
+STUB(FF8B9E70)
+STUB(FF8B9EA0)
+STUB(FF8B9EE4)
+STUB(FF8BA060)
+STUB(FF8BA10C)
+STUB(FF8BA1AC)
+STUB(FF8BA244)
+STUB(FF8BD498)
+STUB(FF8CF8C0)
+STUB(FF8FBD68)
+STUB(FF8FBE2C)
+STUB(FF90B938)
+STUB(FF90B9E0)
+STUB(FF90BD08)
+STUB(FF91848C)
+STUB(FF9188E4)
+STUB(FF929040)
+STUB(FF93626C)
+STUB(FF93630C)
+STUB(FF936398)
+STUB(FF9364E0)
+STUB(FF936A2C)
+STUB(FF93EFD0)
+STUB(FF93F040)
+STUB(FF94005C)
+STUB(FF940C98)
+STUB(FF940E2C)
+STUB(FF9411B0)
+STUB(FF941408)
+STUB(FF941440)
+STUB(FF942110)
+STUB(FF9423A8)
+STUB(FF9423B0)
+STUB(FF9423B8)
+STUB(FF942414)
+STUB(FF942504)
+STUB(FF942590)
+STUB(FF942614)
+STUB(FF9427B0)
+STUB(FF942864)
+STUB(FF9428B8)
+STUB(FF942928)
+STUB(FF942B20)
+STUB(FF942F48)
+STUB(FF9431C0)
+STUB(FF9433BC)
+STUB(FF943450)
+STUB(FF943578)
+STUB(FF94362C)
+STUB(FF943898)
+STUB(FF9438A4)
+STUB(FF943968)
+STUB(FF943A00)
+STUB(FF943A50)
+STUB(FF943AB4)
+STUB(FF943BF4)
+STUB(FF943C88)
+STUB(FF943D48)
+STUB(FF943EB0)
+STUB(FF944320)
+STUB(FF944408)
+STUB(FF944478)
+STUB(FF94449C)
+STUB(FF9448B4)
+STUB(FF944914)
+STUB(FF944E60)
+STUB(FF944F7C)
+STUB(FF944FCC)
+STUB(FF9454C0)
+STUB(FF950DB8)
+STUB(FF951428)
+STUB(FF9515B8)
+STUB(FF952384)
+STUB(FF9528B0)
+STUB(FF955D24)
+STUB(FF957B60)
+STUB(FF957BD8)
+STUB(FF958360)
+STUB(FF9584D4)
+STUB(FF95BC78)
+STUB(FF95BDBC)
+STUB(FF95BE1C)
+STUB(FF95D088)
+STUB(FF95D098)
+STUB(FF95D0A4)
+STUB(FF95D0D0)
+STUB(FF95D280)
+STUB(FF95D2C0)
+STUB(FF95D2C4)
+STUB(FF95DE14)
+STUB(FF95DEE8)
+STUB(FF95E4C4)
+STUB(FF95E58C)
+STUB(FF95F1E8)
+STUB(FF95FA68)
+STUB(FF95FC30)
+STUB(FF95FCA8)
+STUB(FF960388)
+STUB(FF960524)
+STUB(FF96056C)
+STUB(FF961EF4)
+STUB(FF962120)
+STUB(FF9621DC)
+STUB(FF9625D8)
+STUB(FF963710)
+STUB(FF963848)
+STUB(FF96B27C)
+STUB(FF96B778)
+STUB(FF96BB90)
+STUB(FF96BD5C)
+STUB(FF96C30C)
+STUB(FF96C8E0)
+STUB(FF96DB9C)
+STUB(FF96E580)
+STUB(FF96EC38)
+STUB(FF96EFB0)
+STUB(FF96F0B8)
+STUB(FF96F534)
+STUB(FF96FD58)
+STUB(FF970F18)
+STUB(FF97125C)
+STUB(FF971D60)
+STUB(FF971E0C)
+STUB(FF99B4D0)
+STUB(FF9A71E4)
+STUB(FF9A90CC)
+STUB(FF9ABF2C)
+STUB(FF9ABF4C)
+STUB(FF9BDB74)
+STUB(FF9BDBE8)
+STUB(FF9BF02C)
+STUB(FFABD12C)
+STUB(FFABD388)
+STUB(FFABEC38)
Index: /branches/reyalp-ptp-live/platform/g9/sub/100d/Makefile
===================================================================
--- /branches/reyalp-ptp-live/platform/g9/sub/100d/Makefile	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/g9/sub/100d/Makefile	(revision 1668)
@@ -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/reyalp-ptp-live/platform/g9/sub/100g/capt_seq.c
===================================================================
--- /branches/reyalp-ptp-live/platform/g9/sub/100g/capt_seq.c	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/g9/sub/100g/capt_seq.c	(revision 1668)
@@ -0,0 +1,1026 @@
+#include "lolevel.h"
+#include "platform.h"
+#include "core.h"
+
+static long *nrflag = (long*)0xE618;
+
+#include "../../../generic/capt_seq.c"
+
+
+
+
+//ok
+void __attribute__((naked,noinline)) task_CaptSeqTask_my() //#fs  //FF861210
+{
+	asm volatile (
+                "STMFD   SP!, {R3-R9,LR}\n"
+                "LDR     R6, =0x1E454\n"
+                "LDR     R5, =0x583C\n"
+                "MOV     R9, #1\n"
+                "MOV     R7, #0\n"
+"loc_FF861224:\n"
+                "LDR     R0, [R5,#0x14]\n"
+                "MOV     R2, #0\n"
+                "MOV     R1, SP\n"
+                "BL      sub_FF829FB0\n"
+                "TST     R0, #1\n"
+                "BEQ     loc_FF861250\n"
+                "LDR     R1, =0x43F\n"
+                "LDR     R0, =0xFF860C6C\n" 	// aSsshoottask_c 
+                "BL      sub_FF81BFC8\n"    	// DebugAssert
+                "BL      sub_FF81BD80\n"    	// ExitTask 
+                "LDMFD   SP!, {R3-R9,PC}\n"
+"loc_FF861250:\n"
+                "LDR     R0, [SP]\n"
+                "LDR     R1, [R0]\n"
+
+                "LDR     R2, =0x1850\n"         //NOT  IN  G9...!!! Save jumptable-target ...
+                "STR     R1, [R2]\n"            //NOT  IN  G9...!!! ...to some unused space. Read and displayed in GUI in core/gui.c
+
+                "CMP     R1, #0x1C\n"
+                "ADDLS   PC, PC, R1,LSL#2\n"
+                "B       loc_FF8614AC\n"        // 0: error handler (invalid jump offset) (also when shutter half-pressed?) was FFC4CD80
+                "B       loc_FF8612D8\n"        // 1: immediately after shutter release, !modify this one!
+                "B       loc_FF861348\n"		// 2:
+                "B       loc_FF861350\n"        // 3: default if shutter not pressed
+                "B       loc_FF861368\n"        // 4: after shutter release, when timed image preview active
+                "B       loc_FF86135C\n"        // 5: after shutter release, in detailed image review
+                "B       loc_FF861370\n"		// 6:
+                "B       loc_FF861378\n"		// 7:
+                "B       loc_FF861380\n"		// 8:
+                "B       loc_FF8613D8\n"        // 9: also ends with continuation of #1
+                "B       loc_FF8613E4\n"        // 10:
+                "B       loc_FF8613EC\n"        // 11:
+                "B       loc_FF8613F4\n"        // 12:
+                "B       loc_FF8613FC\n"        // 13:
+                "B       loc_FF861404\n"        // 14:
+                "B       loc_FF86140C\n"        // 15: in image-viewer
+                "B       loc_FF861414\n"        // 16:
+                "B       loc_FF86141C\n"        // 17:
+                "B       loc_FF861424\n"        // 18:
+                "B       loc_FF86142C\n"        // 19:
+                "B       loc_FF861434\n"        // 20:
+                "B       loc_FF86143C\n"        // 21:
+                "B       loc_FF861444\n"        // 22:               
+				"B       loc_FF861450\n"        // 23:
+				"B       loc_FF86145C\n"        // 24:
+				"B       loc_FF861464\n"        // 25:
+				"B       loc_FF861494\n"        // 26:
+				"B       loc_FF86149C\n"        // 27:
+				"B       loc_FF8614A4\n"        // 28:
+				"B       loc_FF8614B8\n"        // 29:				
+"loc_FF8612D8:\n"
+                "BL      sub_FF942484\n"
+                "BL      shooting_expo_param_override\n"  // chdk  + add NEW str   !!!  ------------------
+                "BL      sub_FF85F050\n"
+                "LDR     R0, [R6,#0x24]\n"
+                "CMP     R0, #0\n"
+                "BEQ     loc_FF8614B8\n"
+                "BL      sub_FF860938\n"
+                "MOV     R4, R0\n"
+                "LDR     R0, [R6,#0x24]\n"
+                "CMP     R0, #0\n"
+                "BEQ     loc_FF861320\n"
+                "MOV     R0, #0xC\n"
+                "BL      sub_FF86499C\n"
+                "TST     R0, #1\n"
+                "STRNE   R9, [R5,#4]\n"
+                "LDRNE   R0, [R4,#8]\n"
+                "ORRNE   R0, R0, #0x40000000\n"
+                "STRNE   R0, [R4,#8]\n"
+                "BNE     loc_FF8614B8\n"
+"loc_FF861320:\n"
+                "MOV     R0, R4\n"
+                "BL      sub_FF943F20\n"
+                "BL      sub_FF957C48\n"
+                "BL      sub_FF86F8F8\n"
+                "STR     R0, [R4,#0x14]\n"
+                "MOV     R0, R4\n"
+                //"BL      sub_FF944478\n"
+                "BL      sub_FF944478_my\n"		// -------->
+                "BL      capt_seq_hook_raw_here\n"      // +
+                "TST     R0, #1\n"
+                "STRNE   R9, [R5,#4]\n"
+                "B       loc_FF8614B8\n"
+				
+				
+				
+"loc_FF861348:\n"
+                //"BL      sub_FF860CEC\n"
+                "BL      sub_FF860CEC_my\n"
+                "B       loc_FF861360\n"
+				
+				
+"loc_FF861350:\n"
+                "MOV     R0, #1\n"
+                "BL      sub_FF942684\n" 	  //"BL      sub_FF942684_my\n" ????????	//---------->
+                "B       loc_FF8614B8\n"
+				
+				
+"loc_FF86135C:\n"
+                "BL      sub_FF942180\n"
+"loc_FF861360:\n"
+                "STR     R7, [R6,#0x24]\n"
+                "B       loc_FF8614B8\n"
+				
+				
+"loc_FF861368:\n"
+                "BL      sub_FF942418\n"
+                "B       loc_FF861360\n"
+				
+"loc_FF861370:\n"
+                "BL      sub_FF942420\n"
+                "B       loc_FF8614B8\n"
+				
+				
+"loc_FF861378:\n"
+                "BL      sub_FF942574\n"
+                "B       loc_FF8613DC\n"
+"loc_FF861380:\n"
+                "LDR     R4, [R0,#0xC]\n"
+                "BL      sub_FF942428\n" 	//UiEvnt_StartDisguiseCradleStatus_4
+                "MOV     R0, R4\n"
+                "BL      sub_FF942FB8\n"
+                "TST     R0, #1\n"
+                "MOV     R8, R0\n"
+                "BNE     loc_FF8613C0\n"
+                "BL      sub_FF86F8F8\n"
+                "STR     R0, [R4,#0x14]\n"
+                "MOV     R0, R4\n"
+                "BL      sub_FF944390\n"
+                "MOV     R0, R4\n"
+                "BL      sub_FF944984\n"
+                "MOV     R8, R0\n"
+                "LDR     R0, [R4,#0x14]\n"
+                "BL      sub_FF86FB0C\n"
+"loc_FF8613C0:\n"
+                "BL      sub_FF942418\n"
+                "MOV     R2, R4\n"
+                "MOV     R1, #8\n"
+                "MOV     R0, R8\n"
+                "BL      sub_FF85F620\n"
+                "B       loc_FF8614B8\n"
+"loc_FF8613D8:\n"
+                "BL      sub_FF942600\n"
+"loc_FF8613DC:\n"
+                "BL      sub_FF85F050\n"
+                "B       loc_FF8614B8\n"
+"loc_FF8613E4:\n"
+                "BL      sub_FF942418\n"
+                "B       loc_FF8614B8\n"
+"loc_FF8613EC:\n"
+                "BL      sub_FF943230\n"
+                "B       loc_FF8614B8\n"
+"loc_FF8613F4:\n"
+                "BL      sub_FF94342C\n"
+                "B       loc_FF8614B8\n"
+"loc_FF8613FC:\n"
+                "BL      sub_FF9434C0\n"
+                "B       loc_FF8614B8\n"
+"loc_FF861404:\n"
+                "BL      sub_FF9435E8\n"
+                "B       loc_FF8614B8\n"
+"loc_FF86140C:\n"
+                "BL      sub_FF94369C\n"
+                "B       loc_FF8614B8\n"
+"loc_FF861414:\n"
+                "BL      sub_FF943A70\n"
+                "B       loc_FF8614B8\n"
+"loc_FF86141C:\n"
+                "BL      sub_FF943AC0\n"
+                "B       loc_FF8614B8\n"
+"loc_FF861424:\n"
+                "MOV     R0, #0\n"
+                "B       loc_FF861448\n"
+"loc_FF86142C:\n"
+                "BL      sub_FF943C64\n"
+                "B       loc_FF8614B8\n"
+"loc_FF861434:\n"
+                "BL      sub_FF943CF8\n"
+                "B       loc_FF8614B8\n"
+"loc_FF86143C:\n"
+                "BL      sub_FF943DB8\n"
+                "B       loc_FF8614B8\n"
+"loc_FF861444:\n"
+                "MOV     R0, #1\n"
+"loc_FF861448:\n"
+                "BL      sub_FF943B24\n"
+                "B       loc_FF8614B8\n"
+"loc_FF861450:\n"
+                "BL      sub_FF942820\n"
+                "BL      sub_FF8615D0\n"
+                "B       loc_FF8614B8\n"
+"loc_FF86145C:\n"
+                "BL      sub_FF943914\n"
+                "B       loc_FF8614B8\n"
+"loc_FF861464:\n"
+                "MOV     R2, #2\n"
+                "ADD     R1, R6, #0x58\n"
+                "MOV     R0, #0x6F\n"
+                "BL      sub_FF86F768\n" 	//PT_GetPropertyCaseString
+                "TST     R0, #1\n"
+                "LDRNE   R1, =0x502\n"
+                "LDRNE   R0, =0xFF860C6C\n" 	// aSsshoottask_c
+                "BLNE    sub_FF81BFC8\n" 		// DebugAssert
+                "LDRH    R0, [R6,#0x58]\n"
+                "CMP     R0, #1\n"
+                "BLEQ    sub_FF943908\n"
+                "B       loc_FF8614B8\n"
+"loc_FF861494:\n"
+                "BL      sub_FF9439D8\n"
+                "B       loc_FF8614B8\n"
+"loc_FF86149C:\n"
+                "BL      sub_FF860BD0\n"
+                "B       loc_FF8614B8\n"
+"loc_FF8614A4:\n"
+                "BL      sub_FF826210\n"
+                "B       loc_FF8614B8\n"
+"loc_FF8614AC:\n"
+                "LDR     R1, =0x523\n"
+                "LDR     R0, =0xFF860C6C\n" 	// aSsshoottask_c
+                "BL      sub_FF81BFC8\n" 		// DebugAssert       
+"loc_FF8614B8:\n"
+                "LDR     R0, [SP]\n"
+                "LDR     R1, [R0,#4]\n"
+                "LDR     R0, [R5,#0x10]\n"
+                "BL      sub_FF829D2C\n"
+                "LDR     R4, [SP]\n"
+                "LDR     R0, [R4,#8]\n"
+                "CMP     R0, #0\n"
+                "LDREQ   R0, =0xFF860C6C\n" 	// aSsshoottask
+                "MOVEQ   R1, #0xFC\n"
+                "BLEQ    sub_FF81BFC8\n" 		// DebugAssert
+                "STR     R7, [R4,#8]\n"
+                "B       loc_FF861224\n"
+    );
+} //#fe
+
+
+//ok
+void __attribute__((naked,noinline)) sub_FF860CEC_my(){ // 
+ asm volatile(
+                "STMFD   SP!, {R3-R9,LR}\n"
+                "LDR     R4, [R0,#0xC]\n"
+                "LDR     R5, =0x1E454\n"
+                "LDR     R0, [R4,#8]\n"
+                "LDR     R6, =0x820A\n"
+                "ORR     R0, R0, #1\n"
+                "STR     R0, [R4,#8]\n"
+                "LDRH    R0, [R5]\n"
+                "LDR     R8, =0x583C\n"
+                "MOV     R7, #0\n"
+                "CMP     R0, R6\n"
+                "BEQ     loc_FF860D90\n"
+                "LDRH    R0, [R5,#0x86]\n"
+                "CMP     R0, #3\n"
+                "BEQ     loc_FF860DF0\n"
+                "LDR     R0, [R4,#0xC]\n"
+                "CMP     R0, #1\n"
+                "BLS     loc_FF860D9C\n"
+                "LDRH    R0, [R5,#0x84]\n"
+                "CMP     R0, #0\n"
+                "BNE     loc_FF860DF0\n"
+                "LDRH    R0, [R5,#0x80]\n"
+                "CMP     R0, #2\n"
+                "BNE     loc_FF860DA8\n"
+                "BL      sub_FF9428D4\n"
+                "LDRH    R0, [R5]\n"
+                "CMP     R0, R6\n"
+                "BEQ     loc_FF860D90\n"
+                "LDRH    R0, [R5,#0x86]\n"
+                "CMP     R0, #3\n"
+                "BEQ     loc_FF860DF0\n"
+                "LDR     R0, [R4,#0xC]\n"
+                "CMP     R0, #1\n"
+                "BLS     loc_FF860D9C\n"
+                "LDRH    R0, [R5,#0x84]\n"
+                "CMP     R0, #0\n"
+                "BNE     loc_FF860DF0\n"
+                "LDRH    R0, [R5,#0x80]\n"
+                "CMP     R0, #2\n"
+                "BEQ     loc_FF860DD4\n"
+                "B       loc_FF860DA8\n"
+"loc_FF860D90:\n"
+                "LDRH    R0, [R5,#0x86]\n"
+                "CMP     R0, #3\n"
+                "BEQ     loc_FF860DF0\n"
+"loc_FF860D9C:\n"
+                "LDRH    R0, [R5,#0x84]\n"
+                "CMP     R0, #0\n"
+                "BNE     loc_FF860DF0\n"
+"loc_FF860DA8:\n"
+                "LDRH    R0, [R5,#0x80]\n"
+                "CMP     R0, #1\n"
+                "BNE     loc_FF860DF0\n"
+                "LDRH    R0, [R5]\n"
+                "CMP     R0, R6\n"
+                "LDRNE   R0, [R4,#0xC]\n"
+                "CMPNE   R0, #1\n"
+                "BLS     loc_FF860DF0\n"
+                "LDR     R0, [R4,#0x10]\n"
+                "CMP     R0, #1\n"
+                "BNE     loc_FF860DF0\n"
+"loc_FF860DD4:\n"
+                "LDR     R3, =0x20D\n"
+                "LDR     R2, =0xEA60\n"
+                "STR     R3, [SP]\n"
+                "LDR     R0, [R8,#0x10]\n"
+                "LDR     R3, =0xFF860C6C\n"		//aSsshoottask_c 
+                "MOV     R1, #0x40000000\n"
+                "BL      sub_FF864D24\n"
+"loc_FF860DF0:\n"
+                "BL      sub_FF860BD0\n"
+                "LDR     R0, [R5,#0x24]\n"
+                "CMP     R0, #0\n"
+                "MOVEQ   R0, #2\n"
+                "BLEQ    sub_FF85B94C\n"
+                "BL      sub_FF942428\n"		//UiEvnt_StartDisguiseCradleStatus_4
+                "LDR     R0, [R5,#0x24]\n"
+                "CMP     R0, #0\n"
+                "BNE     loc_FF860E60\n"
+                "MOV     R0, R4\n"
+                "BL      sub_FF943F20\n"
+                "MOV     R0, R4\n"
+                "BL      sub_FF942B90\n"
+                "TST     R0, #1\n"
+                "MOVNE   R2, R4\n"
+                "LDMNEFD SP!, {R3-R9,LR}\n"
+                "MOVNE   R1, #1\n"
+                "BNE     sub_FF85F620\n"
+                "BL      sub_FF957C48\n"
+
+//				"BL      shooting_expo_param_override\n"  // +-----------> Override Canon stuff :)
+
+                "BL      sub_FF86F8F8\n"
+                "STR     R0, [R4,#0x14]\n"
+                "MOV     R0, R4\n"
+                "BL      sub_FF944390\n"
+                "BL      sub_FF944ED0\n"
+                "MOV     R0, R4\n"
+                //"BL      sub_FF944478\n"	// This is where shooting AND darkframe sub is done
+                "BL      sub_FF944478_my\n"	// so hook it
+                "MOV     R7, R0\n"
+
+                "BL      capt_seq_hook_raw_here\n" // +-----------> Capture RAW, camera already did badpixel-sub (always) though some pixels are still there
+
+				"B       loc_FF860E6C\n"
+"loc_FF860E60:\n"
+                "LDR     R0, [R8,#4]\n"
+                "CMP     R0, #0\n"
+                "MOVNE   R7, #0x1D\n"
+"loc_FF860E6C:\n"
+                "MOV     R2, R4\n"
+                "MOV     R1, #1\n"
+                "MOV     R0, R7\n"
+                "BL      sub_FF85F620\n"
+                "BL      sub_FF944924\n"
+                "CMP     R0, #0\n"
+                "LDRNE   R0, [R4,#8]\n"
+                "ORRNE   R0, R0, #0x2000\n"
+                "STRNE   R0, [R4,#8]\n"
+                "LDRH    R0, [R5,#0x86]\n"
+                "CMP     R0, #3\n"
+                "BEQ     locret_FF860EB8\n"
+                "LDRH    R0, [R5,#0x84]\n"
+                "CMP     R0, #0\n"
+                "LDREQH  R0, [R5,#0x80]\n"
+                "CMPEQ   R0, #2\n"
+                "MOVEQ   R0, R4\n"
+                "LDMEQFD SP!, {R3-R9,LR}\n"
+                "BEQ     sub_FF942928\n"
+"locret_FF860EB8:\n"
+                "LDMFD   SP!, {R3-R9,PC}\n"
+
+ 
+ );
+}
+
+
+//ok
+void __attribute__((naked,noinline)) sub_FF944478_my(){ // 
+ asm volatile(
+                "STMFD   SP!, {R0-R10,LR}\n"
+                "MOV     R6, #0\n"
+                "MOV     R4, R0\n"
+                "BL      sub_FF94503C\n"
+                //"MOVL    R1, 0xFFFFFFFF\n"
+				"MVN     R1, #0\n"		//chdk
+                 "BL      sub_FF829D60\n"
+                "MOV     R2, #4\n"
+                "ADD     R1, SP, #0x30-0x28\n"
+                "MOV     R0, #0x8A\n"
+                "BL      sub_FF86F768\n"		//PT_GetPropertyCaseString
+                "TST     R0, #1\n"
+                "LDRNE   R1, =0x20A\n"
+                "LDRNE   R0, =0xFF944680\n"	//aSscaptureseq_c 
+                "BLNE    sub_FF81BFC8\n"		//DebugAssert
+                "LDR     R8, =0x1E508\n"
+                "LDR     R5, =0x1E454\n"
+                "LDRSH   R1, [R8,#0xE]\n"
+                "LDR     R0, [R5,#0x7C]\n"
+                //"BL      nullsub_78\n"
+                "BL      sub_FF84BE78\n"		//GetCCDTemperature
+                "LDR     R2, =0xE61C\n"
+                "ADD     R3, R4, #0x8C\n"
+                "STRH    R0, [R4,#0x88]\n"
+//          	"STRD    R2, [SP,#0x28-0x28]\n"  // WORKSFORME, configure gcc WITHOUT --with-cpu=arm9
+				"STR    R2, [SP,#0x28-0x28]\n"     // Though use the old, 2-line version
+				"STR    R3, [SP,#0x28-0x24]\n"     // for the final until everyone uses 'new' gcc
+                "MOV     R1, R0\n"
+                "LDRH    R0, [R5,#0x54]\n"
+                "LDRSH   R2, [R8,#0xC]\n"
+                "LDR     R3, =0xE618\n"
+                "BL      sub_FF945530\n"	// 2 (NR) is set into 0xE618 in this sub! Still before shooting				
+               
+                "BL      wait_until_remote_button_is_released\n"
+                "BL      capt_seq_hook_set_nr\n" // +-----------> so immediately override NR               
+				
+                "LDR     R0, [R4,#0x18]\n"
+                "LDR     R7, =0xE618\n"
+                "CMP     R0, #0\n"
+                "MOV     R9, #1\n"
+                "BEQ     loc_FF94450C\n"
+                "LDR     R0, [R7]\n"
+                "CMP     R0, #2\n"
+                "STREQ   R9, [R7]\n"
+               
+"loc_FF94450C:\n"
+				"B		sub_FF94450C\n"
+	
+ );
+}
+
+void __attribute__((naked,noinline)) exp_drv_task(){
+ asm volatile(
+"                STMFD   SP!, {R4-R8,LR}\n"
+"                SUB     SP, SP, #0x20\n"
+"                LDR     R8, =0xBB8\n"
+"                LDR     R7, =0x7270\n"
+"                LDR     R5, =0x462E8\n"
+"                MOV     R0, #0\n"
+"                ADD     R6, SP, #0x10\n"
+"                STR     R0, [SP,#0xC]\n"
+"loc_FF8B8BB0:\n"
+"                LDR     R0, [R7,#0x20]\n"
+"                MOV     R2, #0\n"
+"                ADD     R1, SP, #0x1C\n"
+"                BL      sub_FF829FB0\n" // KerQueue.c 0
+"                LDR     R0, [SP,#0xC]\n"
+"                CMP     R0, #1\n"
+"                BNE     loc_FF8B8BF8\n"
+"                LDR     R0, [SP,#0x1C]\n"
+"                LDR     R0, [R0]\n"
+"                CMP     R0, #0x13\n"
+"                CMPNE   R0, #0x14\n"
+"                CMPNE   R0, #0x15\n"
+"                BEQ     loc_FF8B8D78\n"
+"                CMP     R0, #0x26\n"
+"                BEQ     loc_FF8B8CE4\n"
+"                ADD     R1, SP, #0xC\n"
+"                MOV     R0, #0\n"
+"                BL      sub_FF8B8B40\n" // ExpDrv.c 512
+"loc_FF8B8BF8:\n"
+"                LDR     R0, [SP,#0x1C]\n"
+"                LDR     R1, [R0]\n"
+"                CMP     R1, #0x2B\n"
+"                BNE     loc_FF8B8C28\n"
+"                LDR     R0, [SP,#0x1C]\n"
+"                BL      sub_FF8B9E70\n" // ExpDrv.c 0
+"                LDR     R0, [R7,#0x1C]\n"
+"                MOV     R1, #1\n"
+"                BL      sub_FF829D2C\n"
+"                BL      sub_FF81BD80\n"
+"                ADD     SP, SP, #0x20\n"
+"                LDMFD   SP!, {R4-R8,PC}\n"
+"loc_FF8B8C28:\n"
+"                CMP     R1, #0x2A\n"
+"                BNE     loc_FF8B8C44\n"
+"                LDR     R2, [R0,#0x88]!\n"
+"                LDR     R1, [R0,#4]\n"
+"                MOV     R0, R1\n"
+"                BLX     R2\n"
+"                B       loc_FF8B91DC\n"
+"loc_FF8B8C44:\n"
+"                CMP     R1, #0x24\n"
+"                BNE     loc_FF8B8C94\n"
+"                LDR     R0, [R7,#0x1C]\n"
+"                MOV     R1, #0x80\n"
+"                BL      sub_FF829D60\n"
+"                LDR     R0, =0xFF8B562C\n"
+"                MOV     R1, #0x80\n"
+"                BL      sub_FF9362DC\n" // IrisController.c 104
+"                LDR     R0, [R7,#0x1C]\n"
+"                MOV     R2, R8\n"
+"                MOV     R1, #0x80\n"
+"                BL      sub_FF829C64\n" // KerFlag.c 0
+"                TST     R0, #1\n"
+"                LDRNE   R1, =0xD07\n"
+"                BNE     loc_FF8B8D54\n"
+"loc_FF8B8C80:\n"
+"                LDR     R1, [SP,#0x1C]\n"
+"                LDR     R0, [R1,#0x8C]\n"
+"                LDR     R1, [R1,#0x88]\n"
+"                BLX     R1\n"
+"                B       loc_FF8B91DC\n"
+"loc_FF8B8C94:\n"
+"                CMP     R1, #0x25\n"
+"                BNE     loc_FF8B8CDC\n"
+"                ADD     R1, SP, #0xC\n"
+"                BL      sub_FF8B8B40\n" // ExpDrv.c 512
+"                LDR     R0, [R7,#0x1C]\n"
+"                MOV     R1, #0x100\n"
+"                BL      sub_FF829D60\n"
+"                MOV     R1, #0x100\n"
+"                LDR     R0, =0xFF8B563C\n"
+"                BL      sub_FF936A9C\n" // IrisController.c 0
+"                LDR     R0, [R7,#0x1C]\n"
+"                MOV     R2, R8\n"
+"                MOV     R1, #0x100\n"
+"                BL      sub_FF829C64\n" // KerFlag.c 0
+"                TST     R0, #1\n"
+"                BEQ     loc_FF8B8C80\n"
+"                LDR     R1, =0xD11\n"
+"                B       loc_FF8B8D54\n"
+"loc_FF8B8CDC:\n"
+"                CMP     R1, #0x26\n"
+"                BNE     loc_FF8B8CF4\n"
+"loc_FF8B8CE4:\n"
+"                LDR     R0, [SP,#0x1C]\n"
+"                ADD     R1, SP, #0xC\n"
+"                BL      sub_FF8B8B40\n" // ExpDrv.c 512
+"                B       loc_FF8B8C80\n"
+"loc_FF8B8CF4:\n"
+"                CMP     R1, #0x27\n"
+"                CMPNE   R1, #0x28\n"
+"                BNE     loc_FF8B8D60\n"
+"                ADD     R1, SP, #0xC\n"
+"                BL      sub_FF8B8B40\n" // ExpDrv.c 512
+"                LDR     R4, [SP,#0x1C]\n"
+"                LDR     R0, [R7,#0x1C]\n"
+"                MOV     R1, #0x40\n"
+"                BL      sub_FF829D60\n"
+"                LDR     R0, [R4]\n"
+"                MOV     R1, #0x40\n"
+"                CMP     R0, #0x27\n"
+"                LDR     R0, =0xFF8B56A0\n"
+"                BNE     loc_FF8B8D34\n"
+"                BL      sub_FF93637C\n" // IrisController.c 125
+"                B       loc_FF8B8D38\n"
+"loc_FF8B8D34:\n"
+"                BL      sub_FF936408\n" // IrisController.c 143
+"loc_FF8B8D38:\n"
+"                LDR     R0, [R7,#0x1C]\n"
+"                MOV     R2, R8\n"
+"                MOV     R1, #0x40\n"
+"                BL      sub_FF829C64\n" // KerFlag.c 0
+"                TST     R0, #1\n"
+"                BEQ     loc_FF8B8C80\n"
+"                LDR     R1, =0xD1F\n"
+"loc_FF8B8D54:\n"
+"                LDR     R0, =0xFF8B5D3C\n"
+"                BL      sub_FF81BFC8\n"
+"                B       loc_FF8B8C80\n"
+"loc_FF8B8D60:\n"
+"                CMP     R1, #0x29\n"
+"                BNE     loc_FF8B8D78\n"
+"                BL      sub_FF897664\n" // Shutter.c 2
+"                BL      sub_FF8983E4\n" // ImgPixel.c 292
+"                BL      sub_FF897EA4\n" // ImgGain.c 0
+"                B       loc_FF8B8C80\n"
+"loc_FF8B8D78:\n"
+"                LDR     R0, [SP,#0x1C]\n"
+"                MOV     R4, #1\n"
+"                LDR     R1, [R0]\n"
+"                CMP     R1, #0x11\n"
+"                CMPNE   R1, #0x12\n"
+"                BNE     loc_FF8B8DE8\n"
+"                LDR     R1, [R0,#0x7C]\n"
+"                ADD     R1, R1, R1,LSL#1\n"
+"                ADD     R1, R0, R1,LSL#2\n"
+"                SUB     R1, R1, #8\n"
+"                LDMIA   R1, {R2-R4}\n"
+"                STMIA   R6, {R2-R4}\n"
+"                BL      sub_FF8B76BC\n" // ExpDrv.c 2
+"                LDR     R0, [SP,#0x1C]\n"
+"                LDR     R1, [R0,#0x7C]\n"
+"                LDR     R3, [R0,#0x88]\n"
+"                LDR     R2, [R0,#0x8C]\n"
+"                ADD     R0, R0, #4\n"
+"                BLX     R3\n"
+"                LDR     R0, [SP,#0x1C]\n"
+"                BL      sub_FF8BA244\n" // ExpDrv.c 4
+"                LDR     R0, [SP,#0x1C]\n"
+"                LDR     R1, [R0,#0x7C]\n"
+"                LDR     R3, [R0,#0x90]\n"
+"                LDR     R2, [R0,#0x94]\n"
+"                ADD     R0, R0, #4\n"
+"                BLX     R3\n"
+"                B       loc_FF8B911C\n"
+"loc_FF8B8DE8:\n"
+"                CMP     R1, #0x13\n"
+"                CMPNE   R1, #0x14\n"
+"                CMPNE   R1, #0x15\n"
+"                BNE     loc_FF8B8E9C\n"
+"                ADD     R3, SP, #0xC\n"
+"                MOV     R2, SP\n"
+"                ADD     R1, SP, #0x10\n"
+"                BL      sub_FF8B7904\n" // ExpDrv.c 4
+"                CMP     R0, #1\n"
+"                MOV     R4, R0\n"
+"                CMPNE   R4, #5\n"
+"                BNE     loc_FF8B8E38\n"
+"                LDR     R0, [SP,#0x1C]\n"
+"                MOV     R2, R4\n"
+"                LDR     R1, [R0,#0x7C]!\n"
+"                LDR     R12, [R0,#0xC]!\n"
+"                LDR     R3, [R0,#4]\n"
+"                MOV     R0, SP\n"
+"                BLX     R12\n"
+"                B       loc_FF8B8E70\n"
+"loc_FF8B8E38:\n"
+"                LDR     R0, [SP,#0x1C]\n"
+"                CMP     R4, #2\n"
+"                LDR     R3, [R0,#0x8C]\n"
+"                CMPNE   R4, #6\n"
+"                BNE     loc_FF8B8E84\n"
+"                LDR     R12, [R0,#0x88]\n"
+"                MOV     R0, SP\n"
+"                MOV     R2, R4\n"
+"                MOV     R1, #1\n"
+"                BLX     R12\n"
+"                LDR     R0, [SP,#0x1C]\n"
+"                MOV     R2, SP\n"
+"                ADD     R1, SP, #0x10\n"
+"                BL      sub_FF8B888C\n" // ExpDrv.c 4
+"loc_FF8B8E70:\n"
+"                LDR     R0, [SP,#0x1C]\n"
+"                LDR     R2, [SP,#0xC]\n"
+"                MOV     R1, R4\n"
+"                BL      sub_FF8B8AE0\n" // ExpDrv.c 2
+"                B       loc_FF8B911C\n"
+"loc_FF8B8E84:\n"
+"                LDR     R1, [R0,#0x7C]\n"
+"                LDR     R12, [R0,#0x88]\n"
+"                ADD     R0, R0, #4\n"
+"                MOV     R2, R4\n"
+"                BLX     R12\n"
+"                B       loc_FF8B911C\n"
+"loc_FF8B8E9C:\n"
+"                CMP     R1, #0x20\n"
+"                CMPNE   R1, #0x21\n"
+"                BNE     loc_FF8B8EE8\n"
+"                LDR     R1, [R0,#0x7C]\n"
+"                ADD     R1, R1, R1,LSL#1\n"
+"                ADD     R1, R0, R1,LSL#2\n"
+"                SUB     R1, R1, #8\n"
+"                LDMIA   R1, {R2-R4}\n"
+"                STMIA   R6, {R2-R4}\n"
+"                BL      sub_FF8B6C40\n" // ExpDrv.c 4
+"                LDR     R0, [SP,#0x1C]\n"
+"                LDR     R1, [R0,#0x7C]\n"
+"                LDR     R3, [R0,#0x88]\n"
+"                LDR     R2, [R0,#0x8C]\n"
+"                ADD     R0, R0, #4\n"
+"                BLX     R3\n"
+"                LDR     R0, [SP,#0x1C]\n"
+"                BL      sub_FF8B6F3C\n" // ExpDrv.c 4
+"                B       loc_FF8B911C\n"
+"loc_FF8B8EE8:\n"
+"                ADD     R1, R0, #4\n"
+"                LDMIA   R1, {R2,R3,R12}\n"
+"                STMIA   R6, {R2,R3,R12}\n"
+"                LDR     R1, [R0]\n"
+"                CMP     R1, #0x23\n"
+"                ADDLS   PC, PC, R1,LSL#2\n"
+"                B       loc_FF8B90FC\n"
+"                B       loc_FF8B8F94\n"
+"                B       loc_FF8B8F94\n"
+"                B       loc_FF8B8FE4\n"
+"                B       loc_FF8B8FEC\n"
+"                B       loc_FF8B8FEC\n"
+"                B       loc_FF8B8FEC\n"
+"                B       loc_FF8B8F94\n"
+"                B       loc_FF8B8FE4\n"
+"                B       loc_FF8B8FEC\n"
+"                B       loc_FF8B8FEC\n"
+"                B       loc_FF8B9004\n"
+"                B       loc_FF8B9004\n"
+"                B       loc_FF8B90F0\n"
+"                B       loc_FF8B90F8\n"
+"                B       loc_FF8B90F8\n"
+"                B       loc_FF8B90F8\n"
+"                B       loc_FF8B90F8\n"
+"                B       loc_FF8B90FC\n"
+"                B       loc_FF8B90FC\n"
+"                B       loc_FF8B90FC\n"
+"                B       loc_FF8B90FC\n"
+"                B       loc_FF8B90FC\n"
+"                B       loc_FF8B8FF4\n"
+"                B       loc_FF8B8FFC\n"
+"                B       loc_FF8B8FFC\n"
+"                B       loc_FF8B9010\n"
+"                B       loc_FF8B9018\n"
+"                B       loc_FF8B9048\n"
+"                B       loc_FF8B9078\n"
+"                B       loc_FF8B90A8\n"
+"                B       loc_FF8B90D8\n"
+"                B       loc_FF8B90D8\n"
+"                B       loc_FF8B90FC\n"
+"                B       loc_FF8B90FC\n"
+"                B       loc_FF8B90E0\n"
+"                B       loc_FF8B90E8\n"
+"loc_FF8B8F94:\n"
+// jumptable FF8B8EFC entries 0,1,6
+"                BL      sub_FF8B5B24\n" // ExpDrv.c 2
+"                B       loc_FF8B90FC\n"
+"loc_FF8B8FE4:\n"
+// jumptable FF8B8EFC entries 2,7
+"                BL      sub_FF8B5DAC\n" // ExpDrv.c 4
+"                B       loc_FF8B90FC\n"
+"loc_FF8B8FEC:\n"
+// jumptable FF8B8EFC entries 3-5,8,9
+"                BL      sub_FF8B5FB0\n" // ExpDrv.c 940
+"                B       loc_FF8B90FC\n"
+"loc_FF8B8FF4:\n"
+// jumptable FF8B8EFC entry 22
+"                BL      sub_FF8B6218\n" // ExpDrv.c 1072
+"                B       loc_FF8B90FC\n"
+"loc_FF8B8FFC:\n"
+// jumptable FF8B8EFC entries 23,24
+"                BL      sub_FF8B640C\n" // ExpDrv.c 4
+"                B       loc_FF8B90FC\n"
+"loc_FF8B9004:\n"
+// jumptable FF8B8EFC entries 10,11
+"                BL      sub_FF8B6670_my\n" // ExpDrv.c 2 ->
+"                MOV     R4, #0\n"
+"                B       loc_FF8B90FC\n"
+"loc_FF8B9010:\n"
+// jumptable FF8B8EFC entry 25
+"                BL      sub_FF8B67AC\n" // ExpDrv.c 4
+"                B       loc_FF8B90FC\n"
+"loc_FF8B9018:\n"
+// jumptable FF8B8EFC entry 26
+"                LDRH    R1, [R0,#4]\n"
+"                STRH    R1, [SP,#0x10]\n"
+"                LDRH    R1, [R5,#2]\n"
+"                STRH    R1, [SP,#0x12]\n"
+"                LDRH    R1, [R5,#4]\n"
+"                STRH    R1, [SP,#0x14]\n"
+"                LDRH    R1, [R5,#6]\n"
+"                STRH    R1, [SP,#0x16]\n"
+"                LDRH    R1, [R0,#0xC]\n"
+"                STRH    R1, [SP,#0x18]\n"
+"                BL      sub_FF8B9EE4\n" // ExpDrv.c 2
+"                B       loc_FF8B90FC\n"
+"loc_FF8B9048:\n"
+// jumptable FF8B8EFC entry 27
+"                LDRH    R1, [R0,#4]\n"
+"                STRH    R1, [SP,#0x10]\n"
+"                LDRH    R1, [R5,#2]\n"
+"                STRH    R1, [SP,#0x12]\n"
+"                LDRH    R1, [R5,#4]\n"
+"                STRH    R1, [SP,#0x14]\n"
+"                LDRH    R1, [R5,#6]\n"
+"                STRH    R1, [SP,#0x16]\n"
+"                LDRH    R1, [R5,#8]\n"
+"                STRH    R1, [SP,#0x18]\n"
+"                BL      sub_FF8BA060\n" // ExpDrv.c 2
+"                B       loc_FF8B90FC\n"
+"loc_FF8B9078:\n"
+// jumptable FF8B8EFC entry 28
+"                LDRH    R1, [R5]\n"
+"                STRH    R1, [SP,#0x10]\n"
+"                LDRH    R1, [R0,#6]\n"
+"                STRH    R1, [SP,#0x12]\n"
+"                LDRH    R1, [R5,#4]\n"
+"                STRH    R1, [SP,#0x14]\n"
+"                LDRH    R1, [R5,#6]\n"
+"                STRH    R1, [SP,#0x16]\n"
+"                LDRH    R1, [R5,#8]\n"
+"                STRH    R1, [SP,#0x18]\n"
+"                BL      sub_FF8BA10C\n" // ExpDrv.c 1552
+"                B       loc_FF8B90FC\n"
+"loc_FF8B90A8:\n"
+// jumptable FF8B8EFC entry 29
+"                LDRH    R1, [R5]\n"
+"                STRH    R1, [SP,#0x10]\n"
+"                LDRH    R1, [R5,#2]\n"
+"                STRH    R1, [SP,#0x12]\n"
+"                LDRH    R1, [R5,#4]\n"
+"                STRH    R1, [SP,#0x14]\n"
+"                LDRH    R1, [R5,#6]\n"
+"                STRH    R1, [SP,#0x16]\n"
+"                LDRH    R1, [R0,#0xC]\n"
+"                STRH    R1, [SP,#0x18]\n"
+"                BL      sub_FF8BA1AC\n" // ExpDrv.c 32
+"                B       loc_FF8B90FC\n"
+"loc_FF8B90D8:\n"
+// jumptable FF8B8EFC entries 30,31
+"                BL      sub_FF8B6A04\n" // ExpDrv.c 4
+"                B       loc_FF8B90FC\n"
+"loc_FF8B90E0:\n"
+// jumptable FF8B8EFC entry 34
+"                BL      sub_FF8B7040\n" // ExpDrv.c 4
+"                B       loc_FF8B90FC\n"
+"loc_FF8B90E8:\n"
+// jumptable FF8B8EFC entry 35
+"                BL      sub_FF8B7274\n" // ExpDrv.c 4
+"                B       loc_FF8B90FC\n"
+"loc_FF8B90F0:\n"
+// jumptable FF8B8EFC entry 12
+"                BL      sub_FF8B73EC\n" // ExpDrv.c 2
+"                B       loc_FF8B90FC\n"
+"loc_FF8B90F8:\n"
+// jumptable FF8B8EFC entries 13-16
+"                BL      sub_FF8B7584\n" // ExpDrv.c 128
+"loc_FF8B90FC:\n"
+// jumptable FF8B8EFC default entry
+// jumptable FF8B8EFC entries 17-21,32,33
+"                LDR     R0, [SP,#0x1C]\n"
+"                LDR     R1, [R0,#0x7C]\n"
+"                LDR     R3, [R0,#0x88]\n"
+"                LDR     R2, [R0,#0x8C]\n"
+"                ADD     R0, R0, #4\n"
+"                BLX     R3\n"
+"                CMP     R4, #1\n"
+"                BNE     loc_FF8B9164\n"
+"loc_FF8B911C:\n"
+"                LDR     R0, [SP,#0x1C]\n"
+"                MOV     R2, #0xC\n"
+"                LDR     R1, [R0,#0x7C]\n"
+"                ADD     R1, R1, R1,LSL#1\n"
+"                ADD     R0, R0, R1,LSL#2\n"
+"                SUB     R4, R0, #8\n"
+"                LDR     R0, =0x462E8\n"
+"                ADD     R1, SP, #0x10\n"
+"                BL      sub_FFABD19C\n"
+"                LDR     R0, =0x462F4\n"
+"                MOV     R2, #0xC\n"
+"                ADD     R1, SP, #0x10\n"
+"                BL      sub_FFABD19C\n"
+"                LDR     R0, =0x46300\n"
+"                MOV     R2, #0xC\n"
+"                MOV     R1, R4\n"
+"                BL      sub_FFABD19C\n"
+"                B       loc_FF8B91DC\n"
+"loc_FF8B9164:\n"
+"                LDR     R0, [SP,#0x1C]\n"
+"                LDR     R0, [R0]\n"
+"                CMP     R0, #0xB\n"
+"                BNE     loc_FF8B91AC\n"
+"                MOV     R3, #0\n"
+"                STR     R3, [SP]\n"
+"                MOV     R3, #1\n"
+"                MOV     R2, #1\n"
+"                MOV     R1, #1\n"
+"                MOV     R0, #0\n"
+"                BL      sub_FF8B592C\n"
+"                MOV     R3, #0\n"
+"                STR     R3, [SP]\n"
+"                MOV     R3, #1\n"
+"                MOV     R2, #1\n"
+"                MOV     R1, #1\n"
+"                MOV     R0, #0\n"
+"                B       loc_FF8B91D8\n"
+"loc_FF8B91AC:\n"
+"                MOV     R3, #1\n"
+"                MOV     R2, #1\n"
+"                MOV     R1, #1\n"
+"                MOV     R0, #1\n"
+"                STR     R3, [SP]\n"
+"                BL      sub_FF8B592C\n"
+"                MOV     R3, #1\n"
+"                MOV     R2, #1\n"
+"                MOV     R1, #1\n"
+"                MOV     R0, #1\n"
+"                STR     R3, [SP]\n"
+"loc_FF8B91D8:\n"
+"                BL      sub_FF8B5A6C\n"
+"loc_FF8B91DC:\n"
+"                LDR     R0, [SP,#0x1C]\n"
+"                BL      sub_FF8B9E70\n" // ExpDrv.c 0
+"                B       loc_FF8B8BB0\n"
+ );
+}
+
+void __attribute__((naked,noinline)) sub_FF8B6670_my(){ // 
+ asm volatile(
+"                STMFD   SP!, {R4-R8,LR}\n"
+"                LDR     R7, =0x7270\n"
+"                MOV     R4, R0\n"
+"                LDR     R0, [R7,#0x1C]\n"
+"                MOV     R1, #0x3E\n"
+"                BL      sub_FF829D60\n"
+"                LDRSH   R0, [R4,#4]\n"
+"                MOV     R2, #0\n"
+"                MOV     R1, #0\n"
+"                BL      sub_FF8B56C0\n"
+"                MOV     R6, R0\n"
+"                LDRSH   R0, [R4,#6]\n"
+"                BL      sub_FF8B57CC\n"
+"                LDRSH   R0, [R4,#8]\n"
+"                BL      sub_FF8B5824\n"
+"                LDRSH   R0, [R4,#0xA]\n"
+"                BL      sub_FF8B587C\n"
+"                LDRSH   R0, [R4,#0xC]\n"
+"                BL      sub_FF8B58D4\n"
+"                MOV     R5, R0\n"
+"                LDR     R0, [R4]\n"
+"                LDR     R8, =0x46300\n"
+"                CMP     R0, #0xB\n"
+"                MOVEQ   R6, #0\n"
+"                MOVEQ   R5, #0\n"
+"                BEQ     loc_FF8B6700\n"
+"                CMP     R6, #1\n"
+"                BNE     loc_FF8B6700\n"
+"                LDRSH   R0, [R4,#4]\n"
+"                LDR     R1, =0xFF8B561C\n"
+"                MOV     R2, #2\n"
+"                BL      sub_FF936550\n" // IrisController.c 168
+"                STRH    R0, [R4,#4]\n"
+"                MOV     R0, #0\n"
+"                STR     R0, [R7,#0x28]\n"
+"                B       loc_FF8B6708\n"
+"loc_FF8B6700:\n"
+"                LDRH    R0, [R8]\n"
+"                STRH    R0, [R4,#4]\n"
+"loc_FF8B6708:\n"
+"                CMP     R5, #1\n"
+"                LDRNEH  R0, [R8,#8]\n"
+"                BNE     loc_FF8B6724\n"
+"                LDRSH   R0, [R4,#0xC]\n"
+"                LDR     R1, =0xFF8B56B0\n"
+"                MOV     R2, #0x20\n"
+"                BL      sub_FF8B9EA0\n"
+"loc_FF8B6724:\n"
+"                STRH    R0, [R4,#0xC]\n"
+"                LDRSH   R0, [R4,#6]\n"
+"                BL      sub_FF897408_my\n" // Shutter.c 364 ->
+"                LDRSH   R0, [R4,#8]\n"
+"                MOV     R1, #1\n"
+"                BL      sub_FF897B9C\n" // ImgGain.c 0
+"                MOV     R1, #0\n"
+"                ADD     R0, R4, #8\n"
+"                BL      sub_FF897C24\n" // ImgGain.c 0
+"                LDRSH   R0, [R4,#0xE]\n"
+"                BL      sub_FF8ACA40\n" // BrtCrct.c 552
+"                LDR     R4, =0xBB8\n"
+"                CMP     R6, #1\n"
+"                BNE     loc_FF8B677C\n"
+"                LDR     R0, [R7,#0x1C]\n"
+"                MOV     R2, R4\n"
+"                MOV     R1, #2\n"
+"                BL      sub_FF829C64\n" // KerFlag.c 0
+"                TST     R0, #1\n"
+"                LDRNE   R1, =0x527\n"
+"                LDRNE   R0, =0xFF8B5D3C\n" // "expdrv.c"
+"                BLNE    sub_FF81BFC8\n"
+"loc_FF8B677C:\n"
+"                CMP     R5, #1\n"
+"                LDMNEFD SP!, {R4-R8,PC}\n"
+"                LDR     R0, [R7,#0x1C]\n"
+"                MOV     R2, R4\n"
+"                MOV     R1, #0x20\n"
+"                BL      sub_FF829C64\n" // KerFlag.c 0
+"                TST     R0, #1\n"
+"                LDRNE   R1, =0x52C\n"
+"                LDRNE   R0, =0xFF8B5D3C\n"
+"                LDMNEFD SP!, {R4-R8,LR}\n"
+"                BNE     sub_FF81BFC8\n"
+"                LDMFD   SP!, {R4-R8,PC}\n"
+
+ );
+}
+
+void __attribute__((naked,noinline)) sub_FF897408_my(){ // Shutter.c 364
+ asm volatile(
+"                STMFD   SP!, {R4-R6,LR}\n"
+"                LDR     R5, =0x6C38\n"
+"                MOV     R4, R0\n"
+"                LDR     R0, [R5,#4]\n"
+"                CMP     R0, #1\n"
+"                MOVNE   R1, #0x16C\n"
+"                LDRNE   R0, =0xFF8971A0\n" // "shutter.c"
+"                BLNE    sub_FF81BFC8\n"
+"                CMN     R4, #0xC00\n"
+"                LDREQSH R4, [R5,#2]\n"
+"                CMN     R4, #0xC00\n"
+"                LDREQ   R1, =0x172\n"
+"                LDREQ   R0, =0xFF8971A0\n" // "shutter.c"
+"                STRH    R4, [R5,#2]\n"
+"                BLEQ    sub_FF81BFC8\n"
+"                MOV     R0, R4\n"
+//"                BL      sub_FF9BF09C\n" // -
+"                BL      apex2us\n" // +
+"                MOV     R4, R0\n"
+//"                BL      nullsub_143\n"
+"                MOV     R0, R4\n"
+"                BL      sub_FF8CF8C0\n"
+"                TST     R0, #1\n"
+"                LDRNE   R1, =0x177\n"
+"                LDMNEFD SP!, {R4-R6,LR}\n"
+"                LDRNE   R0, =0xFF8971A0\n" // "shutter.c"
+"                BNE     sub_FF81BFC8\n"
+"                LDMFD   SP!, {R4-R6,PC}\n"
+ );
+}
Index: /branches/reyalp-ptp-live/platform/g9/sub/100g/stubs_entry.S
===================================================================
--- /branches/reyalp-ptp-live/platform/g9/sub/100g/stubs_entry.S	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/g9/sub/100g/stubs_entry.S	(revision 1668)
@@ -0,0 +1,230 @@
+// !!! THIS FILE IS GENERATED. DO NOT EDIT. !!!
+#include "stubs_asm.h"
+
+// Camera info:
+//   DRYOS R23 (DRYOS version 2.3, release #0023)
+//   Firmware Ver GM1.00G
+//   Canon PowerShot G9
+
+// Values for makefile.inc
+//   PLATFORMID = 12634 (0x315a) // Found @ 0xfffe0130
+//   MAXRAMADDR = 0x03ffffff
+//   KEYSYS = d3                 // Found @ 0xffff31f0
+//   NEED_ENCODED_DISKBOOT = 1   // Found @ 0xffff31d0
+
+// Stubs below should be checked. Stub not matched 100%, or difference found to current 'stubs_entry_2.S'
+//    Name                                     Address      Rule  %  Comp to stubs_entry_2.S
+//NSTUB(PutInNdFilter                         ,0xff9384d8) //102        *** != 0xffa0c550
+//NSTUB(PutOutNdFilter                        ,0xff9384fc) //102        *** != 0xffa0c588
+//NSTUB(kbd_pwr_off                           ,0xff84944c) //  2 67%    *** != 0x00000000
+// ERROR: kbd_pwr_on is not found.                         //--- ---    *** != 0x00000000
+//NSTUB(rename                                ,0xff824d40) //  1        *** != 0xff825600
+//NSTUB(strcmp                                ,0xff81e7cc) //101        *** != 0xff81e7f4
+//NSTUB(write                                 ,0xff8255d8) //101        *** != 0xff81a3d8
+
+// Check of modemap from 'platform/CAMERA/shooting.c':
+// Firmware modemap table found @ff8773f8 -> ff8735c4 -> ff95539c -> ffa4c738 -> ffb080ec
+// No problems found with modemap table.
+
+// Values below can be overridden in 'stubs_min.S':
+DEF(physw_status                            ,0x0001563c) // Found @0xff8230cc
+DEF(physw_run                               ,0x00001ca4) // Found @0xff822d78
+DEF(levent_table                            ,0xffae01ac) // Found @0xffae01ac
+DEF(FlashParamsTable                        ,0xffb082b8) // Found @0xffb082b8
+DEF(movie_status                            ,0x00005714) // Found @0xff85d220
+DEF(canon_menu_active                       ,0x0000fdc8) // Found @0xff99b544
+DEF(canon_shoot_menu_active                 ,0x0000f33d) // Found @0xff96ac18
+DEF(playrec_mode                            ,0x000058cc) // Found @0xff864a60
+DEF(zoom_status                             ,0x0001264c) // Found @0xffa4e3fc
+DEF(some_flag_for_af_scan                   ,0x0001253c) // Found @0xffa447a0
+// focus_len_table contains zoom focus lengths for use in 'get_focal_length' (main.c).
+// each entry contains 3 int value(s), the first is the zoom focus length.
+// there are 14 entries in the table - set NUM_FL to 14
+DEF(focus_len_table                         ,0xfffe299c) // Found @0xfffe299c
+DEF(zoom_busy                               ,0x0000e260) // Found @0xff939f2c
+DEF(focus_busy                              ,0x0000e150) // Found @0xff93411c
+//DEF(recreview_hold                          ,0x00006400) // Found @0xff87cb64, ** != ** stubs_min = 0x0000f050 (0xF050)
+
+// Values below go in 'lib.c':
+//void *vid_get_bitmap_fb()        { return (void*)0x10361000; }             // Found @0xff8451d0
+//void *vid_get_viewport_fb()      { return (void*)0x1067b540; }             // Found @0xffa112dc
+//void *vid_get_viewport_fb_d()    { return (void*)(*(int*)(0x5558+0x50)); } // Found @0xff856268 & 0xff8562a0
+//char *camera_jpeg_count_str()    { return (char*)0x00060354; }             // Found @0xff9afb54
+//long hook_raw_size()             { return 0x00ee9710; }                    // Found @0xffa131a0
+//int get_flash_params_count(void) { return 0x72; }                          // Found @0xff95699c
+
+// Bitmap masks and physw_status index values for SD_READONLY and USB power flags (for kbd.c).
+//#define SD_READONLY_FLAG    0x00020000 // Found @0xffac6350, levent 0x90a
+//#define SD_READONLY_IDX     2
+//#define USB_MASK            0x00040000 // Found @0xffac6358, levent 0x902
+//#define USB_IDX             2
+
+// Keymap values for kbd.c. Additional keys may be present, only common values included here.
+//static KeyMap keymap[] = {
+//    { 0, KEY_SHOOT_FULL      ,0xc0000000 }, // Found @0xffac6288, levent 0x01
+//    { 0, KEY_SHOOT_FULL_ONLY ,0x80000000 }, // Found @0xffac6288, levent 0x01
+//    { 0, KEY_SHOOT_HALF      ,0x40000000 }, // Found @0xffac6280, levent 0x00
+//    { 1, KEY_ZOOM_OUT        ,0x00000008 }, // Found @0xffac62a8, levent 0x03
+//    { 1, KEY_ZOOM_IN         ,0x00000010 }, // Found @0xffac62b0, levent 0x02
+//    { 1, KEY_LEFT            ,0x00010000 }, // Found @0xffac62e0, levent 0x06
+//    { 1, KEY_SET             ,0x00020000 }, // Found @0xffac62e8, levent 0x08
+//    { 1, KEY_RIGHT           ,0x00040000 }, // Found @0xffac62f0, levent 0x07
+//    { 1, KEY_DOWN            ,0x00080000 }, // Found @0xffac62f8, levent 0x05
+//    { 1, KEY_UP              ,0x00100000 }, // Found @0xffac6300, levent 0x04
+//    { 1, KEY_DISPLAY         ,0x04000000 }, // Found @0xffac6318, levent 0x0a
+//    { 1, KEY_MENU            ,0x08000000 }, // Found @0xffac6320, levent 0x09
+//    { 0, 0, 0 }
+//};
+
+// Values below go in 'platform_camera.h':
+//#define CAM_DRYOS         1
+//#define CAM_RAW_ROWPIX    4104 // Found @0xffa0b268
+//#define CAM_RAW_ROWS      3048 // Found @0xffa0b270
+//#undef  CAM_UNCACHED_BIT
+//#define CAM_UNCACHED_BIT  0x10000000 // Found @0xff82a7c4
+
+// Misc stuff
+DEF(ctypes, 0xffac0b42)
+
+// For capt_seq.c
+//static long *nrflag = (long*)(0xe618);       // Found @ ff9444e4
+
+// Stubs below matched 100%.
+//    Name                                     Address                Comp to stubs_entry_2.S
+NSTUB(AllocateMemory                          ,0xffa47cc8) //103
+NSTUB(AllocateUncacheableMemory               ,0xff82a788) //112
+NSTUB(Close                                   ,0xff82552c) //101
+NSTUB(CreateTask                              ,0xff81baf0) //101
+NSTUB(DebugAssert                             ,0xff81bfc8) //111
+NSTUB(DeleteDirectory_Fut                     ,0xff824e78) //  1
+NSTUB(DeleteFile_Fut                          ,0xff824d94) //112
+NSTUB(DoAFLock                                ,0xff8275cc) //103
+NSTUB(EnterToCompensationEVF                  ,0xff8279a8) //104
+NSTUB(ExecuteEventProcedure                   ,0xff81c1a8) //  1
+NSTUB(ExitFromCompensationEVF                 ,0xff8279f8) //104
+NSTUB(ExitTask                                ,0xff81bd80) //101
+NSTUB(ExpCtrlTool_StartContiAE                ,0xff835600) //104
+NSTUB(ExpCtrlTool_StopContiAE                 ,0xff8357c0) //104
+NSTUB(Fclose_Fut                              ,0xff824f10) //101
+NSTUB(Feof_Fut                                ,0xff8250fc) //  1
+NSTUB(Fflush_Fut                              ,0xff825138) //  1
+NSTUB(Fgets_Fut                               ,0xff825064) //  1
+NSTUB(Fopen_Fut                               ,0xff824ed0) //101
+NSTUB(Fread_Fut                               ,0xff824fbc) //101
+NSTUB(FreeMemory                              ,0xffa47cb4) //103
+NSTUB(FreeUncacheableMemory                   ,0xff82a7bc) //112
+NSTUB(Fseek_Fut                               ,0xff8250b0) //101
+NSTUB(Fwrite_Fut                              ,0xff825010) //101
+NSTUB(GetBatteryTemperature                   ,0xff84bee8) //102
+NSTUB(GetCCDTemperature                       ,0xff84be78) //102
+NSTUB(GetCurrentAvValue                       ,0xff936dc8) //102
+NSTUB(GetDrive_ClusterSize                    ,0xff852754) //  1
+NSTUB(GetDrive_FreeClusters                   ,0xff8527f4) //  1
+NSTUB(GetDrive_TotalClusters                  ,0xff852788) //  1
+NSTUB(GetFocusLensSubjectDistance             ,0xff934c5c) //102
+NSTUB(GetFocusLensSubjectDistanceFromLens     ,0xff934f68) //  1
+NSTUB(GetKbdState                             ,0xff849300) //109
+NSTUB(GetMemInfo                              ,0xff813c58) //  1
+NSTUB(GetOpticalTemperature                   ,0xff84bf58) //102
+NSTUB(GetParameterData                        ,0xff95695c) //  1
+NSTUB(GetPropertyCase                         ,0xff86f768) //101
+NSTUB(GetSystemTime                           ,0xffa47dd0) //  1
+NSTUB(GetZoomLensCurrentPoint                 ,0xff93a290) //102
+NSTUB(GetZoomLensCurrentPosition              ,0xffa3e658) //102
+NSTUB(GiveSemaphore                           ,0xff81ba5c) //112
+NSTUB(IsStrobeChargeCompleted                 ,0xff8c1344) //102
+NSTUB(LEDDrive                                ,0xff848890) //103
+NSTUB(LocalTime                               ,0xff86b538) //  1
+NSTUB(LockMainPower                           ,0xff8731f0) //103
+NSTUB(Lseek                                   ,0xff82566c) //101
+NSTUB(MakeDirectory_Fut                       ,0xff824e08) //  1
+NSTUB(MoveFocusLensToDistance                 ,0xffa0e134) //102
+NSTUB(MoveIrisWithAv                          ,0xff9371a8) //102
+NSTUB(MoveZoomLensWithPoint                   ,0xff93ad3c) //102
+NSTUB(NewTaskShell                            ,0xff86f1ec) //103
+NSTUB(Open                                    ,0xff825504) //101
+NSTUB(PB2Rec                                  ,0xff876664) //104
+NSTUB(PT_MoveDigitalZoomToWide                ,0xff8668e0) //103
+NSTUB(PT_MoveOpticalZoomAt                    ,0xff8668a8) //103
+NSTUB(PT_PlaySound                            ,0xff866454) //103
+NSTUB(PostLogicalEventForNotPowerType         ,0xff87118c) //103
+NSTUB(PostLogicalEventToUI                    ,0xff8711d8) //103
+NSTUB(Read                                    ,0xff81a378) //101
+NSTUB(ReadFastDir                             ,0xffa2cbac) //  1
+NSTUB(Rec2PB                                  ,0xff875024) //104
+NSTUB(RefreshPhysicalScreen                   ,0xff9bdbe4) //104
+NSTUB(Remove                                  ,0xff825574) //  1
+NSTUB(RenameFile_Fut                          ,0xff824d40) //  1
+NSTUB(Restart                                 ,0xff82c7e4) //106
+NSTUB(SetAE_ShutterSpeed                      ,0xffa10490) //102
+NSTUB(SetAutoShutdownTime                     ,0xff873264) //103
+NSTUB(SetCurrentCaptureModeType               ,0xff879f7c) //101
+NSTUB(SetFileAttributes                       ,0xff825858) //  1
+NSTUB(SetFileTimeStamp                        ,0xff825808) //  1
+NSTUB(SetLogicalEventActive                   ,0xff872f28) //  1
+NSTUB(SetParameterData                        ,0xff956838) //101
+NSTUB(SetPropertyCase                         ,0xff86f660) //103
+NSTUB(SetScriptMode                           ,0xff872f78) //101
+NSTUB(SleepTask                               ,0xff82a610) //101
+NSTUB(TakeSemaphore                           ,0xff81b98c) //101
+NSTUB(TurnOffBackLight                        ,0xff87ff88) //104
+NSTUB(TurnOnBackLight                         ,0xff87ff70) //104
+NSTUB(UIFS_WriteFirmInfoToFile                ,0xff99c390) //103
+NSTUB(UnlockAF                                ,0xff827638) //103
+NSTUB(UnlockMainPower                         ,0xff873144) //103
+NSTUB(UnsetZoomForMovie                       ,0xff95d03c) //104
+NSTUB(UpdateMBROnFlash                        ,0xff85251c) //105
+NSTUB(VbattGet                                ,0xff82199c) //101
+NSTUB(Write                                   ,0xff8255d8) //101
+NSTUB(WriteSDCard                             ,0xff928cf4) //108
+NSTUB(_log                                    ,0xffabe6b4) //111
+NSTUB(_log10                                  ,0xffabd5f8) //112
+NSTUB(_pow                                    ,0xffabd768) //114
+NSTUB(_sqrt                                   ,0xffabfa1c) //  1
+NSTUB(add_ptp_handler                         ,0xff8d897c) //  1
+NSTUB(apex2us                                 ,0xff9bf09c) //  4
+NSTUB(close                                   ,0xff81a190) //  1
+NSTUB(closedir                                ,0xffa2cc7c) //  1
+NSTUB(err_init_task                           ,0xff814eb0) //  4
+NSTUB(exmem_alloc                             ,0xff86c680) //  1
+NSTUB(free                                    ,0xff813ab0) //112
+NSTUB(kbd_p1_f                                ,0xff8231c8) //109
+NSTUB(kbd_p1_f_cont                           ,0xff8231d4) //109
+NSTUB(kbd_p2_f                                ,0xff822a18) //109
+NSTUB(kbd_read_keys                           ,0xff8230cc) //109
+NSTUB(kbd_read_keys_r2                        ,0xff848dc8) //109
+NSTUB(lseek                                   ,0xff82566c) //101
+NSTUB(malloc                                  ,0xff8139dc) //112
+NSTUB(memcmp                                  ,0xff81e834) //101
+NSTUB(memcpy                                  ,0xff895cf0) //101
+NSTUB(memset                                  ,0xffa8d404) //101
+NSTUB(mkdir                                   ,0xff8258d0) //  1
+// ALT: NSTUB(mkdir, 0xff825970) // 1 32/0
+NSTUB(mktime_ext                              ,0xff89655c) //  1
+NSTUB(open                                    ,0xff81a0e0) //  1
+NSTUB(opendir                                 ,0xffa2cb18) //  1
+NSTUB(openfastdir                             ,0xffa2cb18) //  1
+NSTUB(qsort                                   ,0xff9be474) //  1
+NSTUB(rand                                    ,0xff81e93c) //  1
+NSTUB(read                                    ,0xff81a378) //101
+NSTUB(reboot_fw_update                        ,0xffa34570) //  1
+NSTUB(set_control_event                       ,0xff872c2c) //  1
+NSTUB(srand                                   ,0xff81e930) //  1
+NSTUB(stat                                    ,0xff825738) //  1
+NSTUB(strcat                                  ,0xff895c1c) //  1
+NSTUB(strchr                                  ,0xff895ca4) //  1
+NSTUB(strcpy                                  ,0xff81e778) //101
+NSTUB(strftime                                ,0xff895f64) //  1
+NSTUB(strlen                                  ,0xff81e810) //101
+NSTUB(strncmp                                 ,0xff895c58) //  1
+NSTUB(strncpy                                 ,0xff81e790) //  1
+NSTUB(strrchr                                 ,0xff895cc8) //  1
+NSTUB(strtol                                  ,0xff830d90) //101
+NSTUB(strtolx                                 ,0xff830b94) //109
+  DEF(task_CaptSeq                            ,0xff861210) //107
+  DEF(task_ExpDrv                             ,0xff8b8b90) //110
+  DEF(task_InitFileModules                    ,0xff877284) //107
+  DEF(task_MovieRecord                        ,0xff85d4c0) //107
+  DEF(task_PhySw                              ,0xff822d74) //107
+NSTUB(time                                    ,0xff86ba3c) //  2
+NSTUB(vsprintf                                ,0xff81e6f8) //  1
Index: /branches/reyalp-ptp-live/platform/g9/sub/100g/stubs_entry_2.S
===================================================================
--- /branches/reyalp-ptp-live/platform/g9/sub/100g/stubs_entry_2.S	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/g9/sub/100g/stubs_entry_2.S	(revision 1668)
@@ -0,0 +1,23 @@
+#include "stubs_asm.h"
+#define NULL_SUB 0xFF810958
+
+// Override stubs_entry.S
+NSTUB(PutInNdFilter,                0xFFA0C550)
+NSTUB(PutOutNdFilter,               0xFFA0C588)
+NHSTUB(kbd_pwr_off,                 NULL_SUB)
+NHSTUB(kbd_pwr_on,                  NULL_SUB)
+NHSTUB(rename,                      0xFF825600)
+NHSTUB(strcmp,                      0xFF81E7F4)
+NHSTUB(write,                       0xff81a3d8)
+
+// These don't exist
+NHSTUB(SetZoomActuatorSpeedPercent, NULL_SUB)
+NHSTUB(TurnOffMic,                  NULL_SUB)
+NHSTUB(TurnOnMic,                   NULL_SUB)
+
+// Additional
+NHSTUB(MakeAFScan,                  0xFFA449D0)
+NHSTUB(PostLEDMessage,              0xFF848910)
+NHSTUB(closefastdir,                0xffa2cc7c)
+NHSTUB(ints_disable,                0xFF810578)
+NHSTUB(ints_enable,                 0xFF8105A0)
Index: /branches/reyalp-ptp-live/platform/g9/sub/100g/boot.c
===================================================================
--- /branches/reyalp-ptp-live/platform/g9/sub/100g/boot.c	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/g9/sub/100g/boot.c	(revision 1668)
@@ -0,0 +1,1816 @@
+#include "lolevel.h"
+#include "platform.h"
+#include "core.h"
+#include "stdlib.h"
+
+//extern void draw_txt_string(int col, int row, const char *str, color cl); 
+
+const char * const new_sa = &_end;
+
+/* Ours stuff */
+extern long wrs_kernel_bss_start;
+extern long wrs_kernel_bss_end;
+
+// Forward declarations
+void CreateTask_PhySw();
+void CreateTask_spytask();
+
+void taskCreateHook(int *p) { 
+ p-=16;
+// TODO can save some memory by hooking other tasks this way
+// if (p[0]==0x)  p[0]=(int)capt_seq_task;
+// if (p[0]==0x)  p[0]=(int)movie_record_task;
+// if (p[0]==0x)  p[0]=(int)init_file_modules_task;
+ if (p[0]==0xFF8B8B90)  p[0]=(int)exp_drv_task;
+}
+
+void taskCreateHook2(int *p) { 
+ p-=16;
+// if (p[0]==0x)  p[0]=(int)init_file_modules_task;
+ if (p[0]==0xFF8B8B90)  p[0]=(int)exp_drv_task;
+}
+
+/*
+void CreateTask_blinker(); 
+void task_blinker();
+void dump_chdk();
+
+
+void boot();
+
+
+#define DPs (void*)0xC022006C					// direct-print (blue)
+#define LED_AF (void*)0xC0220094	//LED_AF
+#define LED_ISO (void*)0xC02200B0	//LED_ISO   
+#define LED_PWR (void*)0xC0220068	//LED_PWR   
+#define LED_BLUE (void*)0xC022006C	//LED_BLUE
+#define DELAYs 3000000
+
+void debug_my_blink_green()
+{
+	volatile long *p = (void*)LED_AF;       		// turned off later, so assumed to be power
+	int counter;
+
+	// DEBUG: blink led
+	counter = DELAYs; *p = 0x46;
+	while (counter--) { asm("nop\n nop\n"); };
+	counter = DELAYs; *p = 0x44;
+	while (counter--) { asm("nop\n nop\n"); };
+}
+
+void debug_my_pause()
+{
+	int counter;
+
+	// DEBUG: blink led
+	counter = DELAYs; 
+	while (counter--) { asm("nop\n nop\n"); };
+	counter = DELAYs; 
+	while (counter--) { asm("nop\n nop\n"); };
+}
+
+void debug_my_blink_blue()
+{
+	volatile long *p = (void*)LED_BLUE;       		// turned off later, so assumed to be power
+	int counter;
+
+	// DEBUG: blink led
+	counter = DELAYs; *p = 0x46;
+	while (counter--) { asm("nop\n nop\n"); };
+	counter = DELAYs; *p = 0x44;
+	while (counter--) { asm("nop\n nop\n"); };
+}
+
+
+
+
+#define DP (void*)0xC0220068	// led_pwr DEBUG
+
+#define DEBUG_LED 0xC022006C //ok //used iso blue, was 0xc02200C4  +++
+
+
+#define DELAY 5000000			// DEBUG
+*/
+
+void boot() { //#fs
+
+
+    long *canon_data_src = (void*)0xFFB2E3F4; // OK	//canon_data_src!!!  @FF810130
+    long *canon_data_dst = (void*)0x1900;	// OK  //MEMBASEADDR   @FF810134
+    long canon_data_len = 0x140E4- 0x1900; // data_end - data_start     
+    long *canon_bss_start = (void*)0x140e4; // just after data 	// OK	//@FF810138
+    long canon_bss_len = 0xb0b68 - 0x140e4; //  MEMISOSTART - 
+
+    long i;
+
+
+    // Code taken from VxWorks CHDK. turns caches on
+    asm volatile (
+	"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;
+
+    *(int*)(0x261C+8)= (*(int*)0xC02200C0)&1 ? 1: 2;  // replacement of sub_FF822E10
+/*
+    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");
+*/
+
+    *(int*)0x1930=(int)taskCreateHook; 
+    *(int*)0x1934=(int)taskCreateHook2; 
+
+    // jump to init-sequence that follows the data-copy-routine 
+
+  
+	asm volatile ("B      sub_FF8101a4_my\n");
+	//asm volatile ("B      sub_FF8101a4\n");
+	
+}; //#fe
+
+
+// init //OK
+void __attribute__((naked,noinline)) sub_FF8101a4_my() { //#fs  OK
+
+				
+		asm volatile (		  
+                "LDR     R0, =0xFF81021C\n"
+                "MOV     R1, #0\n"
+                "LDR     R3, =0xFF810254\n"
+"loc_FF8101B0:\n"
+                "CMP     R0, R3\n"
+                "LDRCC   R2, [R0],#4\n"
+                "STRCC   R2, [R1],#4\n"
+                "BCC     loc_FF8101B0\n"
+                "LDR     R0, =0xFF810254\n"
+                "MOV     R1, #0x4B0\n"
+                "LDR     R3, =0xFF810468\n"
+"loc_FF8101CC:\n"
+                "CMP     R0, R3\n"
+                "LDRCC   R2, [R0],#4\n"
+                "STRCC   R2, [R1],#4\n"
+                "BCC     loc_FF8101CC\n"
+                "MOV     R0, #0xD2\n"
+                "MSR     CPSR_cxsf, R0\n"
+                "MOV     SP, #0x1000\n"
+                "MOV     R0, #0xD3\n"
+                "MSR     CPSR_cxsf, R0\n"
+                "MOV     SP, #0x1000\n"
+                "LDR     R0, =0x6C4\n"
+                "LDR     R2, =0xEEEEEEEE\n"
+                "MOV     R3, #0x1000\n"
+"loc_FF810200:\n"
+                "CMP     R0, R3\n"
+                "STRCC   R2, [R0],#4\n"
+                "BCC     loc_FF810200\n"
+                "BL      sub_FF810FB8_my\n"
+      );
+				
+}; //#fe
+
+
+//OK
+void __attribute__((naked,noinline)) sub_FF810FB8_my() { //#fs  OK  h_usrKernelInit
+
+
+        asm volatile ( 
+                "STR     LR, [SP,#-4]!\n"
+                "SUB     SP, SP, #0x74\n"
+                "MOV     R0, SP\n"
+                "MOV     R1, #0x74\n"
+                "BL      sub_FFABD3F8\n"
+                "MOV     R0, #0x53000\n"
+                "STR     R0, [SP,#0x74-0x70]\n"
+				
+	);
+				//"LDR     R0, =0xB0B68"
+        asm volatile (
+              "LDR     R0, =new_sa\n"
+              "LDR     R0, [R0]\n"
+        );
+        asm volatile (				
+                "LDR     R2, =0x2ABC00\n"
+                "LDR     R1, =0x2A4968\n"
+                "STR     R0, [SP,#0x74-0x6C]\n"
+                "SUB     R0, R1, R0\n"
+                "ADD     R3, SP, #0x74-0x68\n"
+                "STR     R2, [SP,#0x74-0x74]\n"
+                "STMIA   R3, {R0-R2}\n"
+                "MOV     R0, #0x22\n"
+                "STR     R0, [SP,#0x74-0x5C]\n"
+                "MOV     R0, #0x68\n"
+                "STR     R0, [SP,#0x74-0x58]\n"
+                "LDR     R0, =0x19B\n"
+                "MOV     R1, #0x64\n"
+                //"STRD    R0, [SP,#0x74-0x54]\n"		  // "strd not supported by cpu" claims gcc
+				"STR      R0, [SP,#0x74-0x54]\n"          // split in two single-word STRs
+				"STR      R1, [SP,#0x74-0x50]\n"
+                "MOV     R0, #0x78\n"
+                //"STRD    R0, [SP,#0x74-0x4C]\n"		  // "strd not supported by cpu" claims gcc
+				"STR      R0, [SP,#0x74-0x4C]\n"          // split in two single-word STRs
+				"STR      R1, [SP,#0x74-0x48]\n"
+                "MOV     R0, #0\n"
+                "STR     R0, [SP,#0x74-0x44]\n"
+                "STR     R0, [SP,#0x74-0x40]\n"
+                "MOV     R0, #0x10\n"
+                "STR     R0, [SP,#0x74-0x18]\n"
+                "MOV     R0, #0x800\n"
+                "STR     R0, [SP,#0x74-0x14]\n"
+                "MOV     R0, #0xA0\n"
+                "STR     R0, [SP,#0x74-0x10]\n"
+                "MOV     R0, #0x280\n"
+                "STR     R0, [SP,#0x74-0xC]\n"
+				//"LDR     R1, =0xFF814DBC\n"         
+                "LDR     R1, =uHwSetup_my\n"	//<---------------------------------------chdk
+                "MOV     R0, SP\n"
+                "MOV     R2, #0\n"
+                "BL      sub_FF812D70\n"
+                "ADD     SP, SP, #0x74\n"
+                "LDR     PC, [SP],#4\n"
+			);
+	
+}; //#fe
+
+
+//OK
+void __attribute__((naked,noinline)) uHwSetup_my() { //#fs FF814DBC
+
+	asm volatile (		
+			//debug ok
+		
+              "STMFD   SP!, {R4,LR}\n"
+			  "BL      sub_FF81095C\n"
+			  "BL      sub_FF819948\n"          
+			  "CMP     R0, #0\n"
+			  "LDRLT   R0, =0xFF814ED0\n"       
+              "BLLT    sub_FF814EB0\n"          
+		      "BL      sub_FF8149E0\n"          // _termDriverInit
+			  "CMP     R0, #0\n"
+			  "LDRLT   R0, =0xFF814ED8\n"       // aTermdriverinit
+	          "BLLT    sub_FF814EB0\n"          
+			  "LDR     R0, =0xFF814EE8\n"       // a_term
+			  			  
+              "BL      sub_FF814ACC\n"          // _termDeviceCreate
+			  "CMP     R0, #0\n"
+              "LDRLT   R0, =0xFF814EF0\n"       // aTermdevicecrea
+              "BLLT    sub_FF814EB0\n"          
+              "LDR     R0, =0xFF814EE8\n"       // a_term
+              "BL      sub_FF81357C\n"          // _stdioSetup
+              "CMP     R0, #0\n"
+              "LDRLT   R0, =0xFF814F04\n"       // aStdiosetup
+              "BLLT    sub_FF814EB0\n"          
+              "BL      sub_FF8194D0\n"          // _stdlibSetup
+              "CMP     R0, #0\n"
+              "LDRLT   R0, =0xFF814F10\n"       // aStdlibsetup
+              "BLLT    sub_FF814EB0\n"          
+              "BL      sub_FF8114D0\n"          // _armlib_setup
+              "CMP     R0, #0\n"
+              "LDRLT   R0, =0xFF814F1C\n"       // aArmlib_setup
+              "BLLT    sub_FF814EB0\n"          //   _err_init_task
+              "LDMFD   SP!, {R4,LR}\n"
+              "B       CreateTask_Startup_my\n" //<---------------------------------------chdk
+
+        );
+}; //#fe
+
+
+//OK 
+void __attribute__((naked,noinline)) CreateTask_Startup_my() { //#fs FF81DC0C	
+
+		asm volatile (		
+        "STMFD   SP!, {R3,LR}\n"
+                //"BL      nullsub_3\n"
+                "BL      sub_FF82C8FC\n"
+                "CMP     R0, #0\n"
+                "BNE     loc_FF81DC4C\n"
+                "BL      sub_FF824568\n"
+                "CMP     R0, #0\n"
+                "LDREQ   R2, =0xC0220000\n"
+                "LDREQ   R0, [R2,#0xC0]\n"
+                "LDREQ   R1, [R2,#0xC4]\n"
+                "ORREQ   R0, R0, R1\n"
+                "TSTEQ   R0, #1\n"
+                "BNE     loc_FF81DC4C\n"
+                "MOV     R0, #0x44\n"
+                "STR     R0, [R2,#0x4C]\n"
+"loc_FF81DC48:\n"
+                "B       loc_FF81DC48\n"
+"loc_FF81DC4C:\n"
+                //"BL      sub_FF822E10\n"   // removed, see boot() function
+                //"BL      nullsub_4\n"
+                "BL      sub_FF82A488\n"
+                "MOV     R1, #0x300000\n"
+                "MOV     R0, #0\n"
+                "BL      sub_FF82A6D0\n"
+                "BL      sub_FF82A67C\n"
+                "MOV     R3, #0\n"
+                "STR     R3, [SP,#8-0x08]\n"
+                "LDR     R3, =task_Startup_my\n"		// originally FF81DBB0 <---------------------------------------chdk
+                "MOV     R2, #0\n"
+                "MOV     R1, #0x19\n"
+                "LDR     R0, =0xFF81DC90\n"			//"Startup"
+                "BL      sub_FF81BAF0\n"
+                "MOV     R0, #0\n"
+                "LDMFD   SP!, {R12,PC}\n"
+				);
+		
+ //OK
+}; //#fe
+
+
+
+			
+
+//OK
+void __attribute__((naked,noinline)) task_Startup_my() { //#fs originally FF81DBB0
+       
+       	asm volatile (
+                "STMFD   SP!, {R4,LR}\n"
+				"BL      sub_FF81517C\n"  
+				"BL      sub_FF823FA0\n"
+                "BL      sub_FF820E60\n"
+                //"BL      j_nullsub_177\n"
+				"BL      sub_FF82CADC\n"
+				//"BL      sub_FF82C9C4\n"	// skip diskboot 
+		);
+        CreateTask_spytask();  // <------------
+        asm volatile (
+			   "BL      sub_FF82CCA4\n"
+               "BL      sub_FF82CB2C\n"		
+               "BL      sub_FF8299CC\n"
+               "BL      sub_FF82CCA8\n"
+        );
+         CreateTask_PhySw(); //<---------------
+        asm volatile (
+				//"BL      sub_FF822DA8\n"  // (taskcreate_PhySw) 
+				//"BL      sub_FF82629C\n"
+				"BL      sub_FF82629C_my\n"		// divert to intercept task_ShootSeqTask------------------------------>
+				"BL      sub_FF82CCC0\n"
+                //"BL      nullsub_2\n"
+                "BL      sub_FF822130\n"
+                "BL      sub_FF82C6A8\n"  // taskcreate_Bye\n"
+                "BL      sub_FF8228D4\n"
+                "BL      sub_FF82203C\n"  // taskcreate_TempCheck\n"
+				//"BL      sub_FF82D720\n"
+				"BL      sub_FF82D720_my\n" 		// divert for SDHC-bootdisk-support<--------------------------------- 
+				"BL      sub_FF821FF8\n"
+                "LDMFD   SP!, {R4,LR}\n" 
+                "B       sub_FF815088\n"
+             );
+
+}; //#fe
+
+
+void CreateTask_spytask() { //#fs 
+        _CreateTask("SpyTask", 0x19, 0x2000, core_spytask, 0);
+
+}; //#fe
+
+void CreateTask_PhySw() { //#fs 
+        _CreateTask("PhySw", 0x18, 0x800, mykbd_task, 0);
+        asm volatile (
+				"BL      sub_FF84962C\n"	//taskcreate_JogDial
+        ); 
+}; //#fe
+
+
+//OK
+void __attribute__((naked,noinline)) sub_FF82629C_my() { //#fs  
+
+		 asm volatile (
+                "STMFD   SP!, {R4,LR}\n"
+                "LDR     R4, =0x1D38\n" 
+                "MOV     R0, #0\n"
+                "MOV     R1, #4\n"
+                "STR     R0, [R4,#0xC]\n" 
+                "BL      sub_FF81BE20\n" 
+                "STR     R0, [R4,#4]\n"	
+                "MOV     R0, #0\n"
+                "MOV     R1, #1\n"
+                "BL      sub_FF81BE44\n" 
+                "STR     R0, [R4,#8]\n" 
+                "BL      sub_FF864A14\n"
+                "BL      sub_FF86383C\n"				
+				"BL      sub_FF8601A0_my\n"     // divert this for ShootSeqTask 	<------------------
+				"BL      sub_FF864CFC\n" 
+                "LDR     R0, [R4,#4]\n" 
+                "LDMFD   SP!, {R4,LR}\n"
+                "MOV     R1, #0x1000\n"
+                "B       sub_FF829D2C\n"
+        );
+}; //#fe
+//OK
+void __attribute__((naked,noinline)) sub_FF8601A0_my() { //#fs 
+
+	      asm volatile (
+                "STMFD   SP!, {R4,LR}\n"
+                "LDR     R4, =0x57EC\n" 
+                "LDR     R0, [R4,#8]\n"
+                "CMP     R0, #0\n"
+                "BNE     loc_FF86020C\n" 
+                //"BL      nullsub_30\n"
+                "MOV     R1, #1\n"
+                "MOV     R0, #0\n"
+                "BL      sub_FF81BE44\n" 
+                "STR     R0, [R4,#0x20]\n" 
+                "MOV     R0, #0\n"
+                "MOV     R1, #0\n"
+                "BL      sub_FF81BE20\n" 
+                "STR     R0,[R4,#0x24]\n"
+                "BL      sub_FF860584\n" 
+                "BL      sub_FF860370\n"   
+                "MOV     R0, #0\n"
+                "STR     R0, [R4,#0x1C]\n" 
+                "ADD     R0, R4, #0x28\n" 
+                "MOV     R1, #0\n"
+                "STR     R1, [R0],#4\n"
+                "STR     R1, [R0]\n"
+                "BL      sub_FF86089C\n" 
+                "BL      sub_FF864EA8\n" 
+                "BL      sub_FF8631AC\n"		
+                "BL      sub_FF8614E8_my\n"     // continue here for task_CaptSeqTask  <----------------------------
+				
+                "BL      sub_FF862CA8\n"		
+        "loc_FF86020C:\n"
+                "MOV     R0, #1\n"
+                "STR     R0, [R4,#8]\n"
+                "LDMFD   SP!, {R4,PC}\n"
+        );
+}; //#fe
+
+//OK ****
+void __attribute__((naked,noinline)) sub_FF8614E8_my() { //#fs  
+        asm volatile (
+                "STMFD   SP!, {R3-R5,LR}\n"
+                "LDR     R2, =0x1E3C0\n" 
+                "MOV     R0, #0\n"
+                "MOV     R1, #0\n"
+        "loc_FF8614F8:\n"
+                "ADD     R3, R2, R0,LSL#4\n"
+                "ADD     R0, R0, #1\n"
+                "CMP     R0, #5\n"
+                "STR     R1, [R3,#8]\n"
+                "BCC     loc_FF8614F8\n" 
+				"LDR     R0, =0x1E410\n" 
+				"STR     R1, [R0,#8]\n" 
+				"ADD     R0, R0, #0x10\n" 
+				"STR     R1, [R0,#8]\n" 
+                "BL      sub_FF942998\n" 
+                "BL      sub_FF944FEC\n" 
+                "MOV     R1, #5\n"
+                "MOV     R0, #0\n"
+                "BL      sub_FF81BDFC\n"
+                "LDR     R4, =0x583C\n" 
+                "LDR     R1, =0x1001FF\n"
+                "STR     R0, [R4,#0x14]\n"
+                "MOV     R0, #0\n"
+                "BL      sub_FF81BE20\n" 
+				"STR     R0, [R4,#0x10]\n" 
+                "MOV     R3, #0\n"				
+                // "STR     R3, [SP,#0x10+var_10]\n"
+				"STR     R3, [SP]\n"
+//                "LDR     R3, =0xFF861210\n" 
+				"LDR     R3, =task_CaptSeqTask_my\n" //  task_CaptSeqTask  <-------------------------
+				"LDR     R0, =0xFF861710\n"             // aCaptseqtask ; "CaptSeqTask" 
+                "MOV     R2, #0x1000\n"
+                "MOV     R1, #0x17\n"
+                "BL      sub_FF81BDC8\n"                
+                "LDMFD   SP!, {R3-R5,PC}\n"
+        ".ltorg\n"
+        );
+}; //#fe
+
+
+
+// -----------------
+// SDHC-Boot-Support
+// -----------------
+// Required subs:
+//   Startup -> FFC1C6C4 -> FFC1C294 ->           FFC5E6C0 -> uAC_Boot -> CreateTask_InitFileModules -> task_InitFileModules -> FFC5A4E8 -> FFC3F0CC -> FFC3EF08 -> FFC3EDA0
+//                           \->FFC5F474 -> FFC5F410 ->/|
+//                   -> StartFactoryModeController =>||
+//
+// uAC_Boot:                   FFC5E06C
+// CreateTask_InitFileModules: FFC5F7A4 
+// task_InitFileModules:       FFC5F754 
+
+//OK
+void __attribute__((naked,noinline)) sub_FF82D720_my() { //#fs  
+        asm volatile (
+                "STMFD   SP!, {R4,LR}\n"
+                "BL      sub_FF873F90\n"   
+                "BL      sub_FF824504\n"    // IsFactoryMode"  
+                "CMP     R0, #1\n"
+                "BNE     loc_FF82D740\n"  
+                "BL      sub_FF8773E0\n" 
+                "LDMFD   SP!, {R4,LR}\n"
+                "B       sub_FF82457C\n"    // StartFactoryModeController" 
+         "loc_FF82D740:\n" 
+                "BL      sub_FF876264\n" 
+                "LDR     R4, =0x1E50\n" 
+                "LDR     R0, [R4,#4]\n"
+                "CMP     R0, #0\n"
+                "LDMNEFD SP!, {R4,PC}\n"
+                "MOV     R1, #0\n"
+                //"LDR     R0, =0xFF82D250\n"        
+                "LDR     R0, =sub_FF82D250_my\n"        // continue here for SDHC-boot-support   <------------------
+                "BL      sub_FF8709DC\n"    
+                "STR     R0, [R4,#4]\n"
+                "LDMFD   SP!, {R4,PC}\n"
+        );
+}; //#fe
+
+//OK
+void __attribute__((naked,noinline)) sub_FF82D250_my() { //#fs    
+        asm volatile (
+                
+                 "STMFD   SP!, {R3-R11,LR}\n"
+                 "LDR     R6, =0x1E50\n"
+                 "MOV     R5, R1\n"
+                 "LDR     R0, [R6,#0x14]\n"
+                 "MOV     R4, R3\n"
+                 "CMP     R0, #1\n"
+                 "BNE     loc_FF82D274\n"
+                 "BL      sub_FF87486C\n"
+                 "B       loc_FF82D65C\n"
+        "loc_FF82D274:\n" 
+                "LDR     R12, =0x1162\n" 
+                "LDR     R10, =0x1005\n"  
+                "CMP     R5, R12\n"  
+                "MOV     R7, #0\n"  
+                "MOV     R8, #1\n"  
+                "BEQ     loc_FF82D67C\n"  
+                "BGT     loc_FF82D3C8\n"  
+                "LDR     R12, =0x1062\n"  
+                "CMP     R5, R12\n"  
+                "BEQ     loc_FF82D718\n"  
+                "BGT     loc_FF82D33C\n"  
+                "CMP     R5, R10\n"  
+                "BEQ     loc_FF82D6A8\n" 
+                "BGT     loc_FF82D314\n"  
+                "LDR     R9, =0x9A3\n"  
+                "CMP     R5, R9\n"  
+                "BEQ     loc_FF82D63C\n"
+				"BGT     loc_FF82D2F0\n"  
+                "SUB     R12, R5, #0x800\n"  
+                "SUBS    R12, R12, #3\n" 
+                "BEQ     loc_FF82D4D8\n" 
+                "SUB     R12, R5, #0x800\n"  
+                "SUBS    R12, R12, #0x158\n"  
+                "BNE     loc_FF82D66C\n"  
+                "TST     R4, #0x80000000\n"  
+                "MOVNE   R0, #1\n"  
+                "BNE     locret_FF82D534\n"  
+                "BL      sub_FF87DA3C\n" 
+				"CMP     R0, #0\n"
+                "BLEQ    sub_FF829828\n"  
+				"B       loc_FF82D65C\n"  
+"loc_FF82D2F0:\n"       
+				"SUB     R12, R5, #0x900\n"
+				"SUBS    R12, R12, #0xA5\n"
+				"BEQ     loc_FF82D63C\n"
+				"SUB     R12, R5, #0x1000\n"
+				"SUBS    R12, R12, #3\n"
+				"BNE     loc_FF82D66C\n"
+				"BL      sub_FF82D1B4\n"
+				"MOV     R1, R4\n"
+				"B       loc_FF82D674\n"
+"loc_FF82D314:\n"       
+                "SUB     R12, R5, #0x1000\n"
+                "SUBS    R12, R12, #0x56\n"
+                "SUBNE   R12, R5, #0x1000\n"
+                "SUBNES  R12, R12, #0x5B\n"
+                "SUBNE   R12, R5, #0x1000\n"
+                "SUBNES  R12, R12, #0x5E\n"
+                "SUBNE   R12, R5, #0x1000\n"
+                "SUBNES  R12, R12, #0x61\n"
+                "BNE     loc_FF82D66C\n"
+                "B       loc_FF82D718\n"
+"loc_FF82D33C:\n"       
+                "LDR     R12, =0x10AD\n"
+                "CMP     R5, R12\n"
+                "BEQ     loc_FF82D698\n"
+                "BGT     loc_FF82D38C\n"
+                "SUB     R12, R5, #0x1000\n"
+                "SUBS    R12, R12, #0x63\n"
+                "SUBNE   R12, R5, #0x1000\n"
+                "SUBNES  R12, R12, #0x65\n"
+                "BEQ     loc_FF82D718\n"
+                "SUB     R12, R5, #0x1000\n"
+                "LDR     R0, =0x10A3\n"
+                "SUBS    R12, R12, #0xA9\n"
+                "BEQ     loc_FF82D68C\n"
+                "SUB     R12, R5, #0x1000\n"
+                "SUBS    R12, R12, #0xAA\n"
+                "BNE     loc_FF82D66C\n"
+                "BL      sub_FF872EB8\n" 
+                "CMP     R0, #0\n"
+                "BEQ     loc_FF82D6A4\n"
+                "B       loc_FF82D65C\n"
+"loc_FF82D38C:\n"  
+                "SUB     R12, R5, #0x1000\n"  
+                "SUBS    R12, R12, #0xAE\n"  
+                "BEQ     loc_FF82D6A4\n"  
+                "SUB     R12, R5, #0x1000\n"  
+                "SUBS    R12, R12, #0xAF\n" 
+                "BEQ     loc_FF82D698\n"  
+                "SUB     R12, R5, #0x1000\n"  
+                "SUBS    R12, R12, #0xB0\n"  
+                "BEQ     loc_FF82D6A4\n"  
+                "SUB     R12, R5, #0x1000\n"  
+                "SUBS    R12, R12, #0xB2\n"  
+                "BNE     loc_FF82D66C\n"  
+				"LDR     R0, =0x1008\n"  
+				"MOV     R1, R4\n"  
+				"B       loc_FF82D674\n"  
+"loc_FF82D3C8:\n"
+                 "LDR     R11, =0x201B\n"
+                 "LDR     R0, =0x1E50\n"
+                 "CMP     R5, R11\n"
+                 "LDR     R2, [R0,#0x10]!\n"
+                 "LDR     R1, [R0,#0x10]\n"
+                 "SUB     R9, R11, #0x17\n"
+                 "BEQ     loc_FF82D610\n"
+                 "BGT     loc_FF82D460\n"
+                 "LDR     R11, =0x116A\n"
+                 "CMP     R5, R11\n"
+                 "BEQ     loc_FF82D5FC\n"
+                 "BGT     loc_FF82D424\n"
+                 "SUB     R0, R5, #0x1100\n"
+                 "SUB     R0, R0, #0x63\n"
+                 "CMP     R0, #5\n"
+                 "ADDLS   PC, PC, R0,LSL#2\n"
+                 "B       loc_FF82D66C\n"
+"loc_FF82D40C:\n"      
+                 "B       loc_FF82D634\n"
+"loc_FF82D410:\n"      
+                "B       loc_FF82D628\n"
+"loc_FF82D414:\n"      
+                "B       loc_FF82D620\n"
+"loc_FF82D418:\n"      
+                "B       loc_FF82D66C\n"
+"loc_FF82D41C:\n"   
+                 "B       loc_FF82D5BC\n"
+"loc_FF82D420:\n"      
+                "B       loc_FF82D5BC\n"
+"loc_FF82D424:\n"       
+                "SUB     R12, R5, #0x2000\n"
+                "SUBS    R12, R12, #2\n"
+                 "BEQ     loc_FF82D6E4\n"
+                "CMP     R5, R9\n"
+                "MOV     R0, R9\n"
+                "BEQ     loc_FF82D6F0\n"
+                 "SUB     R12, R5, #0x2000\n"
+                "SUBS    R12, R12, #5\n"
+                "BEQ     loc_FF82D6E4\n"
+                "SUB     R12, R5, #0x2000\n"
+                 "SUBS    R12, R12, #0x19\n"
+                "BNE     loc_FF82D66C\n"
+                "CMP     R1, #0\n"
+                "BNE     loc_FF82D6D0\n"
+                 "B       loc_FF82D65C\n"
+"loc_FF82D460:\n"      
+                "LDR     R12, =0x3110\n"
+                "CMP     R5, R12\n"
+                "BEQ     loc_FF82D6A8\n"
+                 "BGT     loc_FF82D4A8\n"
+                "SUB     R12, R5, #0x2000\n"
+                "SUBS    R12, R12, #0x1D\n"
+                "BEQ     loc_FF82D6E4\n"
+                 "LDR     R0, =0x2027\n"
+                "CMP     R5, R0\n"
+                "BEQ     loc_FF82D6B0\n"
+                "SUB     R12, R5, #0x3000\n"
+                 "SUBS    R12, R12, #6\n"
+                "BEQ     loc_FF82D6A8\n"
+                "SUB     R12, R5, #0x3000\n"
+                "SUBS    R12, R12, #0x10\n"
+                 "BNE     loc_FF82D66C\n"
+                 "BL      sub_FF893354\n"
+                 "B       loc_FF82D65C\n"
+"loc_FF82D4A8:\n"      
+                 "SUB     R12, R5, #0x3100\n"
+                 "SUBS    R12, R12, #0x11\n"
+                 "BEQ     loc_FF82D6A8\n"
+                 "CMP     R5, #0x3140\n"
+                 "BEQ     loc_FF82D70C\n"
+                 "SUB     R12, R5, #0x3200\n"
+                 "SUBS    R12, R12, #1\n"
+                 "BEQ     loc_FF82D66C\n"
+                 "SUB     R12, R5, #0x3200\n"
+                 "SUBS    R12, R12, #2\n"
+                 "BNE     loc_FF82D66C\n"
+                 "B       loc_FF82D6A8\n"
+"loc_FF82D4D8:\n"       
+                 "MOV     R4, #1\n"
+                 "MOV     R0, #2\n"
+                 "BL      sub_FF874024\n"
+                 "CMP     R0, #1\n"
+                 "MOVEQ   R4, #2\n"
+                 "MOV     R0, R4\n"
+                 "BL      sub_FF8224B0\n" 
+                 "CMP     R0, #0\n"
+                 "STRNE   R8, [R6,#0x14]\n"
+                 "BNE     loc_FF82D530\n"
+                "BL      sub_FF879F0C\n"
+                "BL      sub_FF877D84\n"
+                "BL      sub_FF8789D8\n"
+				"BL      sub_FF877670\n"	
+                 "BL      sub_FF878F88\n"
+                "CMP     R0, #0\n"
+                "BEQ     loc_FF82D59C\n"
+                 "BL      sub_FF82CF20\n"
+                "BL      sub_FF878EEC\n"
+                "MOV     R1, R0\n"
+                "LDR     R0, =0x1167\n"
+                 "BL      sub_FF8711D8\n"
+"loc_FF82D530:\n"       
+                "MOV     R0, R7\n"
+
+"locret_FF82D534:\n"   
+                "LDMFD   SP!, {R3-R11,PC}\n"
+"loc_FF82D59C:\n"       
+                 "BL      sub_FF8268E8\n"
+                 "CMP     R0, #1\n"
+                 "LDRNE   R0, =0x310B\n"
+                 "LDREQ   R0, =0x310C\n"
+                 "MOV     R1, #0\n"
+                 "BL      sub_FF8711D8\n" 
+                 "BL      sub_FF8770A8_my\n"  // Continue here (possibility 1) for SDHC-boot  //<------------------------------------------
+                 "B       loc_FF82D530\n"
+ "loc_FF82D5BC:\n"      
+                 "STR     R8, [R6,#0x10]\n"
+                 "LDR     R6, =0x4508\n"
+                 "LDR     R4, =0x1168\n"
+                 "CMP     R1, #0\n"
+                 "BEQ     loc_FF82D5E4\n"
+                 "BL      sub_FF8748A0\n"
+                 "B       loc_FF82D5F0\n"
+ "loc_FF82D5D8:\n"      
+                 "MOV     R0, R6\n"
+                 "BL      sub_FF85E5B0\n"
+                 "B       loc_FF82D65C\n"
+ 
+ "loc_FF82D5E4:\n"      
+                 "BL      sub_FF8781CC\n"
+                 "BL      sub_FF877F94\n"
+                 "BL      sub_FF826590\n"
+ "loc_FF82D5F0:\n"      
+                 "CMP     R5, R4\n"
+                 "BEQ     loc_FF82D5D8\n"
+                 "B       loc_FF82D65C\n"
+ "loc_FF82D5FC:\n"       
+                 "MOV     R0, #1\n"
+                "BL      sub_FF8749CC\n"
+                "MOV     R1, R11\n"
+                "MOV     R0, R10\n"
+                 "B       loc_FF82D674\n"
+"loc_FF82D610:\n"   
+                "CMP     R2, #1\n"
+                "BNE     loc_FF82D6A8\n"
+                "BL      sub_FF8748A0\n"
+                 "B       loc_FF82D65C\n"
+"loc_FF82D620:\n"       
+                "MOV     R0, #2\n"
+                "B       loc_FF82D62C\n"
+ "loc_FF82D628:\n"     
+                "MOV     R0, #1\n"
+ "loc_FF82D62C:\n"      
+                 "BL      sub_FF82DC30\n"
+                "B       loc_FF82D65C\n"
+"loc_FF82D634:\n"       
+                "MOV     R0, #0\n"
+                "B       loc_FF82D62C\n"  
+ "loc_FF82D63C:\n"                       
+                 "LDR     R0, [R6,#0xC]\n"
+                "SUB     R12, R0, #0x8000\n"
+                "SUBS    R12, R12, #2\n"
+                "BEQ     loc_FF82D65C\n"
+                 "LDR     R0, =0x10A5\n"
+                "BL      sub_FF872EB8\n" // eventproc_export_IsControlEventActive     
+
+                "CMP     R0, #0\n"
+                "BEQ     loc_FF82D664\n"
+ "loc_FF82D65C:\n"      
+                 "MOV     R0, #0\n"
+                "LDMFD   SP!, {R3-R11,PC}\n"
+ "loc_FF82D664:\n"       
+                "CMP     R5, R9\n"
+                "STREQ   R8, [R6,#0x30]\n"
+
+ "loc_FF82D66C:\n"       
+                 "MOV     R1, #0\n"
+"loc_FF82D670:\n"       
+                "MOV     R0, R5\n"
+
+"loc_FF82D674:\n"       
+                "BL      sub_FF875F98_My\n" // Continue here (possibility 2) for SDHC-boot //<-----------------------------
+
+                "LDMFD   SP!, {R3-R11,PC}\n"
+ "loc_FF82D67C:\n"       
+                 "BL      sub_FF87C4A0\n"
+                "CMP     R0, #0\n"
+                "BLNE    sub_FF87B1FC\n"
+                "B       loc_FF82D6A8\n"
+ "loc_FF82D68C:\n"       
+                 "BL      sub_FF872EB8\n" //eventproc_export_IsControlEventActive
+                "CMP     R0, #0\n"
+                "BNE     loc_FF82D65C\n"
+
+"loc_FF82D698:\n"      
+                "MOV     R0, R5\n"
+                 "BL      sub_FF82D040\n"
+                 "LDMFD   SP!, {R3-R11,PC}\n"
+ "loc_FF82D6A4:\n"     
+                 "BL      sub_FF82DC00\n"
+ "loc_FF82D6A8:\n"      
+                 "MOV     R1, R4\n"
+                 "B       loc_FF82D670\n"
+ "loc_FF82D6B0:\n"       
+                 "MOV     R1, #0\n"
+                 "BL      sub_FF875F98_My\n"  //Continue here (possibility 2) for SDHC-boot // <-------------------------------- 
+                "MOV     R1, #0\n"
+                "MOV     R0, R11\n"
+                "BL      sub_FF875F98_My\n"  // Continue here (possibility 2) for SDHC-boot // <----------------------------------
+                "MOV     R1, #0\n"
+                "MOV     R0, R9\n"
+                "B       loc_FF82D6DC\n"
+ "loc_FF82D6D0:\n"       
+                 "CMP     R2, #0\n"
+                 "BNE     loc_FF82D65C\n"
+ "loc_FF82D6D8:\n"      
+                 "MOV     R1, #0\n"	
+"loc_FF82D6DC:\n"     
+                 "BL      sub_FF875F98_My\n"  //Continue here (possibility 2) for SDHC-boot  // <------------------------------------
+                 "B       loc_FF82D65C\n"
+ "loc_FF82D6E4:\n"      
+                 "STR     R7, [R6,#0x20]\n"
+                 "BL      sub_FF82D900\n"
+                 "B       loc_FF82D6A8\n"
+ "loc_FF82D6F0:\n"       
+                 "STR     R7, [R6,#0x20]\n"
+                 "BL      sub_FF82D900\n"
+                 "LDR     R0, [R6,#0x10]\n"
+                 "CMP     R0, #1\n"
+                 "BNE     loc_FF82D6A8\n"
+                 "BL      sub_FF8748E4\n"
+                 "B       loc_FF82D65C\n"
+"loc_FF82D70C:\n"       
+                 "CMP     R1, #0\n"
+                "BLEQ    sub_FF82D900\n"
+                "B       loc_FF82D65C\n"
+"loc_FF82D718:\n"      
+                "LDR   R0, =0xFFFFFFFF\n" // was MOVL tryed MVN provare pure LDR
+                 "B       loc_FF82D6D8\n"				 
+	);
+}; //#fe
+
+
+// Continue here (possibility 1) for SDHC-boot  //OK
+void __attribute__((naked,noinline)) sub_FF8770A8_my() { //#fs  
+        asm volatile (
+                "STMFD   SP!, {R4,LR}\n"				
+				"BL      sub_FF82D8CC\n" 
+                "MOV     R4, R0\n" 
+                "BL      sub_FF8771C4\n" 
+                "MOV     R0, R4\n" 
+                "BL      sub_FF876F5C\n" 
+                "BL      sub_FF82D8CC\n" 
+                "MOV     R4, R0\n" 
+                "LDR     R0, =0x60D8\n" 
+				"LDR     R0, [R0]\n" 
+				"TST     R0, #1\n" 
+				"BEQ     loc_FF8770E4\n" 
+        "loc_FF8770D8:\n" 
+                "MOV     R1, R4\n" 
+                "MOV     R0, #2\n" 
+                "B       loc_FF87714C\n" 
+         "loc_FF8770E4:\n" 
+                "TST     R0, #0x2000\n" 
+                "BEQ     loc_FF877100\n" 
+                "TST     R0, #0x200\n" 
+				"LDREQ   R1, =0x4004\n" 
+				"LDRNE   R1, =0x8002\n" 
+				"MOV     R0, #3\n"
+				"B       loc_FF87714C\n" 
+        "loc_FF877100:\n" 
+                "TST     R0, #0x10\n" 
+                "BNE     loc_FF8770D8\n" 
+				"TST     R0, #0x40\n" 
+				"BEQ     loc_FF87711C\n" 
+        "loc_FF877110:\n"
+                "MOV     R1, R4\n"
+                "MOV     R0, #1\n"
+                "B       loc_FF87714C\n" 
+        "loc_FF87711C:\n" 
+                "TST     R0, #0x20\n"
+                "BEQ     loc_FF877138\n" 
+                "TST     R0, #0x4000\n"
+                "BNE     loc_FF877138\n"
+        "loc_FF87712C:\n"
+                "MOV     R1, R4\n"
+                "MOV     R0, #0\n"
+                "B       loc_FF87714C\n" 
+        "loc_FF877138:\n" 
+                "LDR     R1, =0x102\n"
+                "BICS    R1, R1, R0\n"
+                "BNE     loc_FF877154\n" 
+                "MOV     R1, R4\n"
+                "MOV     R0, #6\n"
+        "loc_FF87714C:\n" 
+                "LDMFD   SP!, {R4,LR}\n"
+                "B       sub_FF876EF8_my\n"        // cont. for SDHC-boot <------------------------------------
+        "loc_FF877154:\n" 
+                "TST     R0, #0x100\n"
+                "BNE     loc_FF8770D8\n" 
+                "TST     R0, #0x4000\n" 
+                "TSTEQ   R0, #0x400\n" 
+				"BNE     loc_FF877110\n" 
+                "TST     R0, #0x200\n"
+                "TSTEQ   R0, #2\n"
+                "BNE     loc_FF87712C\n" 
+                "TST     R0, #0x40000\n"
+                "BEQ     loc_FF8770D8\n" 
+                "TST     R0, #0x200000\n"
+                "MOVEQ   R1, R4\n"
+                "MOVEQ   R0, #1\n"
+                "BLEQ    sub_FF876EF8_my\n"        // cont. for SDHC-boot <------------------------------------
+                "B       loc_FF8770D8\n" 
+        );
+}; //#fe
+//OK
+void __attribute__((naked,noinline)) sub_FF876EF8_my() { //#fs  
+        asm volatile (
+                "STMFD   SP!, {R4-R6,LR}\n"
+                "MOVS    R4, R0\n"
+                "MOV     R0, #1\n"
+                "MOV     R5, R1\n"
+                "BNE     loc_FF876F38\n" 
+                "MOV     R1, #0\n"
+                "MOV     R0, #0\n"
+                "BL      sub_FF873FB4\n" 
+                "BL      sub_FF82D8CC\n" 
+                "SUB     R12, R0, #0x1000\n"
+                "SUBS    R12, R12, #0x5B\n"
+                "BNE     loc_FF876F30\n" 
+        "loc_FF876F28:\n" 
+                "BL      sub_FF876E4C\n" 
+                "B       loc_FF876F40\n" 
+        "loc_FF876F30:\n" 
+                "BL      sub_FF876E8C\n" 
+                "B       loc_FF876F40\n" 
+        "loc_FF876F38:\n" 
+                "CMP     R4, #5\n"
+                "BEQ     loc_FF876F28\n" 
+        "loc_FF876F40:\n" 
+                "CMP     R0, #0\n"
+                "LDREQ   R5, =0x1162\n"
+                "MOVEQ   R4, #2\n"
+                "MOV     R0, R4\n"
+                "MOV     R1, R5\n"
+                "LDMFD   SP!, {R4-R6,LR}\n"
+                "B       sub_FF875F98_My\n" //  Continue here (possibility 2) for SDHC-boot   <-------------------------
+        );
+}; //#fe
+
+
+//NEW  OK
+void __attribute__((naked,noinline)) sub_FF875F98_My() { //#fs 
+        asm volatile (
+                 "STMFD   SP!, {R4-R8,LR}\n"
+                 "MOV     R8, R1\n"
+                 "MOV     R4, R0\n"
+                 "BL      sub_FF878F88\n"
+                 "CMP     R0, #0\n"
+                 "BNE     loc_FF87625C\n"
+                 "MOV     R1, R8\n"
+                 "MOV     R0, R4\n"
+                 "BL      sub_FF874B90\n"
+                 "LDR     R5, =0x6008\n"
+                 "MOV     R7, #1\n"
+                 "LDR     R0, [R5,#0x10]\n"
+                 "MOV     R6, #0\n"
+                 "CMP     R0, #0x16\n"
+                 "ADDLS   PC, PC, R0,LSL#2\n"
+                 "B       loc_FF87625C\n"
+ "loc_FF875FD8:\n"
+                 "B       loc_FF876034\n"
+ "loc_FF875FDC:\n"
+                 "B       loc_FF87605C\n"
+ "loc_FF875FE0:\n"
+                 "B       loc_FF8760A0\n"
+ "loc_FF875FE4:\n"  
+                 "B       loc_FF87611C\n"
+ "loc_FF875FE8:\n"  
+                 "B       loc_FF87612C\n"
+ "loc_FF875FEC:\n"  
+                 "B       loc_FF87625C\n"
+ "loc_FF875FF0:\n"  
+                 "B       loc_FF8761A8\n"
+ "loc_FF875FF4:\n"  
+                 "B       loc_FF8761B8\n"
+ "loc_FF875FF8:\n"  
+                 "B       loc_FF876044\n"
+ "loc_FF875FFC:\n"  
+                 "B       loc_FF876050\n"
+ "loc_FF876000:\n"
+                 "B       loc_FF8761B8\n"
+ "loc_FF876004:\n"  
+                 "B       loc_FF876094\n"
+ "loc_FF876008:\n"  
+                 "B       loc_FF87625C\n"
+ "loc_FF87600C:\n"
+                 "B       loc_FF87625C\n"
+ "loc_FF876010:\n"  
+                 "B       loc_FF8760AC\n"
+ "loc_FF876014:\n"  
+                 "B       loc_FF8760B8\n"
+ "loc_FF876018:\n"  
+                 "B       loc_FF8760F0\n"
+ "loc_FF87601C:\n"  
+                 "B       loc_FF876068\n"
+ "loc_FF876020:\n"  
+                 "B       loc_FF876244\n"
+ "loc_FF876024:\n"  
+                 "B       loc_FF8761C4\n"
+ "loc_FF876028:\n"  
+                 "B       loc_FF8761F4\n"
+ "loc_FF87602C:\n"  
+                 "B       loc_FF8761F4\n"
+ "loc_FF876030:\n"
+                 "B       loc_FF876138\n"
+ "loc_FF876034:\n"  
+                 "MOV     R1, R8\n"
+                 "MOV     R0, R4\n"
+                 "LDMFD   SP!, {R4-R8,LR}\n"
+                 "B       sub_FF875648_my\n"		// uAC_Boot // divert for   <-------------------------
+ "loc_FF876044:\n"  
+                 "MOV     R0, R4\n"
+                 "LDMFD   SP!, {R4-R8,LR}\n"
+                 "B       sub_FF8769B0\n"
+ "loc_FF876050:\n"  
+                 "MOV     R0, R4\n"
+                 "LDMFD   SP!, {R4-R8,LR}\n"
+                 "B       sub_FF875B14\n"
+ "loc_FF87605C:\n"  
+                 "MOV     R0, R4\n"
+                 "LDMFD   SP!, {R4-R8,LR}\n"
+                 "B       sub_FF87522C\n"
+ "loc_FF876068:\n"  
+                 "SUB     R12, R4, #0x1000\n"
+                 "SUBS    R12, R12, #0xA5\n"
+                 "STREQ   R7, [R5,#0x88]\n"
+                 "BEQ     loc_FF876254\n"
+                 "SUB     R12, R4, #0x3000\n"
+                 "SUBS    R12, R12, #6\n"
+                 "BNE     loc_FF87625C\n"
+                 "MOV     R0, #0\n"
+                 "BL      sub_FF82CDA8\n"
+                 "BL      sub_FF876890\n"		// uAC_InitPB
+                 "B       loc_FF876254\n"
+ "loc_FF876094:\n"  
+                 "MOV     R0, R4\n"
+                 "LDMFD   SP!, {R4-R8,LR}\n"
+                 "B       sub_FF8768C8\n"
+ "loc_FF8760A0:\n"  
+                 "MOV     R0, R4\n"
+                 "LDMFD   SP!, {R4-R8,LR}\n"
+                 "B       sub_FF875404\n"
+ "loc_FF8760AC:\n"  
+                 "MOV     R0, R4\n"
+                 "LDMFD   SP!, {R4-R8,LR}\n"
+                 "B       sub_FF875CC0\n"
+ "loc_FF8760B8:\n"  
+                 "SUB     R12, R4, #0x3200\n"
+                 "SUBS    R12, R12, #2\n"
+                 "BNE     loc_FF87625C\n"
+                 "MOV     R0, #3\n"
+                 "BL      sub_FF874A74\n"		// uCameraConState
+                 "MOV     R0, #8\n"
+                 "BL      sub_FF82CD04\n"
+                 "MOV     R1, #0\n"
+                 "MOV     R0, #0x19\n"
+                 "BL      sub_FF83EEE0\n"
+                 "BL      sub_FF8781CC\n"
+                 "BL      sub_FF878018\n"
+                 "BL      sub_FF8776E0\n"
+                 "B       loc_FF876254\n"
+ "loc_FF8760F0:\n"  
+                 "SUB     R12, R4, #0x3300\n"
+                 "SUBS    R12, R12, #1\n"
+                 "BNE     loc_FF87625C\n"
+                 "LDR     R0, =0x4010\n"
+                 "STR     R6, [R5,#0x80]\n"
+                 "BL      sub_FF82CD04\n"
+                 "BL      sub_FF9A913C\n"
+                 "BL      sub_FF8776E0\n"
+                 "MOV     R0, #4\n"
+                 "BL      sub_FF874A74\n"		// uCameraConState
+                 "B       loc_FF876254\n"
+ "loc_FF87611C:\n"  
+                 "MOV     R1, R8\n"
+                 "MOV     R0, R4\n"
+                 "LDMFD   SP!, {R4-R8,LR}\n"
+                 "B       sub_FF875E1C\n"
+ "loc_FF87612C:\n"  
+                 "MOV     R0, R4\n"
+                 "LDMFD   SP!, {R4-R8,LR}\n"
+                 "B       sub_FF876AF8\n"
+ "loc_FF876138:\n"  
+                 "LDR     R8, =0x1182\n"
+                 "CMP     R4, R8\n"
+                 "STREQ   R7, [R5,#0xB8]\n"
+                 "BEQ     loc_FF876254\n"
+                 "SUB     R12, R4, #0x1000\n"
+                 "SUBS    R12, R12, #0x1AC\n"
+                 "BEQ     loc_FF876190\n"
+                 "SUB     R12, R4, #0x3000\n"
+                 "SUBS    R12, R12, #0x224\n"
+                 "BNE     loc_FF87625C\n"
+                 "MOV     R0, #8\n"
+                 "BL      sub_FF82CD04\n"
+                 "MOV     R0, #3\n"
+                 "BL      sub_FF874A74\n"		// uCameraConState
+                 "STR     R6, [R5,#0xBC]\n"
+                 "LDR     R0, [R5,#0xB8]\n"
+                 "CMP     R0, #0\n"
+                 "MOVNE   R1, #0\n"
+                 "MOVNE   R0, R8\n"
+                 "STRNE   R6, [R5,#0xB8]\n"
+                 "BLNE    sub_FF875E1C\n"
+                 "B       loc_FF876254\n"
+ "loc_FF876190:\n"  
+                 "LDR     R0, [R5,#0xBC]\n"
+                 "CMP     R0, #0\n"
+                 "BNE     loc_FF876254\n"
+                 "BL      sub_FF9A7254\n"
+                 "STR     R7, [R5,#0xBC]\n"
+                 "B       loc_FF876254\n"
+ "loc_FF8761A8:\n"  
+                 "MOV     R1, R8\n"
+                 "MOV     R0, R4\n"
+                 "LDMFD   SP!, {R4-R8,LR}\n"
+                 "B       sub_FF876BD8\n"
+ "loc_FF8761B8:\n"  
+                 "MOV     R0, R4\n"
+                 "LDMFD   SP!, {R4-R8,LR}\n"
+                 //"B       sub_FF875A0C\n"		
+                 "B       sub_FF875A0C_my\n"		//---------->   movies_rec.c
+ "loc_FF8761C4:\n"  
+                 "LDR     R12, =0x10B0\n"
+                 "CMP     R4, R12\n"
+                 "BEQ     loc_FF8761F0\n"
+                 "BGT     loc_FF8761FC\n"
+                 "CMP     R4, #4\n"
+                 "BEQ     loc_FF876224\n"
+                 "SUB     R12, R4, #0x1000\n"
+                 "SUBS    R12, R12, #0xAA\n"
+                 "SUBNE   R12, R4, #0x1000\n"
+                 "SUBNES  R12, R12, #0xAE\n"
+                 "BNE     loc_FF87625C\n"
+ "loc_FF8761F0:\n"  
+                 "BL      sub_FF874770\n"
+ "loc_FF8761F4:\n"  
+                 "MOV     R0, R6\n"
+                 "LDMFD   SP!, {R4-R8,PC}\n"
+ "loc_FF8761FC:  \n"
+                 "SUB     R12, R4, #0x2000\n"
+                 "SUBS    R12, R12, #4\n"
+                 "BEQ     loc_FF87623C\n"
+                 "SUB     R12, R4, #0x5000\n"
+                 "SUBS    R12, R12, #1\n"
+                 "SUBNE   R12, R4, #0x5000\n"
+                 "SUBNES  R12, R12, #6\n"
+                 "BNE     loc_FF87625C\n"
+                 "BL      sub_FF8751CC\n"
+                 "B       loc_FF876254\n"
+ "loc_FF876224:\n"  
+                 "LDR     R0, [R5,#0x2C]\n"
+                 "CMP     R0, #0\n"
+                 "BNE     loc_FF87623C\n"
+                 "BL      sub_FF87643C\n"
+                 "BL      sub_FF826548\n"
+                 "B       loc_FF876254\n"
+ "loc_FF87623C:\n"
+                 "BL      sub_FF8747AC\n"
+                 "B       loc_FF876254\n"
+ "loc_FF876244:\n"  
+                 "SUB     R12, R4, #0x3000\n"
+                 "SUBS    R12, R12, #0x130\n"
+                 "BNE     loc_FF87625C\n"
+                 "BL      sub_FF87486C\n"
+ "loc_FF876254:\n"
+                 "MOV     R0, #0\n"
+                 "LDMFD   SP!, {R4-R8,PC}\n"
+ "loc_FF87625C:\n"
+                 "MOV     R0, #1\n"
+                 "LDMFD   SP!, {R4-R8,PC}\n"
+        );
+}; //#fe
+
+
+//OK 
+void __attribute__((naked,noinline)) sub_FF875648_my() { //#fs  uAC_Boot  
+    asm volatile (
+			"STMFD   SP!, {R4-R8,LR}\n"
+            "LDR     R7, =0x8002\n"
+            "LDR     R4, =0x6008\n"
+            "CMP     R0, #3\n"
+            "MOV     R6, R1\n"
+            "MOV     R5, #1\n"
+            "BEQ     loc_FF8757BC\n"
+            "BGT     loc_FF875684\n"
+            "CMP     R0, #0\n"
+            "BEQ     loc_FF8756C8\n"
+            "CMP     R0, #1\n"
+            "BEQ     loc_FF87574C\n"
+            "CMP     R0, #2\n"
+            "BNE     loc_FF875844\n"
+            "B       loc_FF87569C\n"
+"loc_FF875684:\n"  
+               "CMP     R0, #6\n" 
+               "STREQ   R5, [R4,#0x28]\n" 
+               "BEQ     loc_FF8757B4\n" 
+               "SUB     R12, R0, #0x2000\n" 
+               "SUBS    R12, R12, #4\n" 
+               "BNE     loc_FF875844\n" 
+
+"loc_FF87569C:\n"  
+                "SUB     R12, R6, #0x1100\n" 
+                "SUBS    R12, R12, #0x62\n" 
+                "BNE     loc_FF8756B8\n" 
+                "MOV     R1, R7\n" 
+                "MOV     R0, #0\n" 
+                "BL      sub_FF878AB0\n" 
+                "STR     R5, [R4,#0x60]\n" 
+
+"loc_FF8756B8:\n"  
+                "BL      sub_FF8781CC\n" 
+                "BL      sub_FF878018\n" 
+                "BL      sub_FF875130\n" 
+                "B       loc_FF87583C\n" 
+"loc_FF8756C8:\n"  
+                 "MOV     R0, #7\n"  
+                 "BL      sub_FF874A74\n"  
+                 "MOV     R0, R7\n"  
+                 "BL      sub_FF82CD04\n"  
+                 "BL      sub_FF877310\n"  // taskcreate_CommonDrivers
+                 "BL      sub_FF877E68\n"  
+                 "MOV     R1, R7\n"  
+                 "MOV     R0, #0\n"  
+                 "BL      sub_FF878AB0\n"  
+                 "LDR     R1, =0xFF87587C\n"  
+                 "MOV     R0, #0x20\n"  
+                 "STR     R6, [R4,#0x18]\n"  
+                 "BL      sub_FF86DA00\n"  
+                 "LDR     R1, =0xFF875888\n" 
+                 "MOV     R0, #0x20\n"  
+                 "BL      sub_FF86DA00\n" 
+                 "STR     R5, [R4,#0x28]\n"  
+                 "BL      sub_FF82CE8C\n"  
+                 "BL      sub_FF82CDD0\n"  
+                 "LDR     R0, [R4,#0x1C]\n"  
+                 "LDR     R1, [R4,#0x20]\n"  
+                 "ORRS    R0, R0, R1\n"  
+                 "BLNE    sub_FF876418\n"  
+                 "LDR     R0, [R4,#0x68]\n"  
+                 "CMP     R0, #0\n"  
+                 "BNE     loc_FF875738\n"  
+                 "BL      sub_FF82CEFC\n"  // taskcreate_StartupImage
+                 "B       loc_FF875740\n"  
+"loc_FF875738:\n"  
+                "BL      sub_FF8262FC\n"
+                "BL      sub_FF82D864\n"
+
+"loc_FF875740:\n"  
+                "BL      sub_FF8772D4_my\n" // taskcreate_InitFileModules<----------------------
+                "BL      sub_FF87734C\n"
+                "B       loc_FF87583C\n"
+"loc_FF87574C:\n"  
+                "MOV     R0, #8\n"
+                "BL      sub_FF874A74\n" 
+                "BL      sub_FF877310\n" 
+                "BL      sub_FF877E68\n"
+                "LDR     R5, =0x4004\n"
+                "MOV     R0, #0\n"
+                "MOV     R1, R5\n"
+                "BL      sub_FF878AB0\n"
+                "LDR     R1, =0xFF875898\n" 
+                "MOV     R0, #0x20\n"
+                "BL      sub_FF86DA00\n" 
+				
+                "BL      sub_FF8772D4_my\n" // taskcreate_InitFileModules  ----------------------------->
+				
+                "BL      sub_FF8773E0\n"
+                "BL      sub_FF82D828\n"
+                "MOV     R0, R5\n"
+                "BL      sub_FF82CD04\n"
+                "LDR     R0, [R4,#0x68]\n"
+                "CMP     R0, #0\n"
+                "BNE     loc_FF8757A0\n"
+                "BL      sub_FF82CEFC\n" // taskcreate_StartupImage
+                "B       loc_FF8757A4\n"
+"loc_FF8757A0:\n"  
+                "BL      sub_FF8262FC\n"
+
+"loc_FF8757A4:\n"  
+                 "BL      sub_FF87737C\n"
+                 "LDR     R0, [R4,#0x30]\n"
+                 "CMP     R0, #0\n"
+                 "BEQ     loc_FF87583C\n"
+
+"loc_FF8757B4:\n"  
+                "BL      sub_FF876460\n"
+                "B       loc_FF87583C\n"
+"loc_FF8757BC:\n"  
+                 "MOV     R1, R6\n"
+                 "MOV     R0, #0\n"
+                 "BL      sub_FF878AB0\n"
+                 "LDR     R1, =0xFF8758A4\n" 
+                 "MOV     R0, #0x20\n"
+                 "BL      sub_FF86DA00\n" 
+                 "STR     R5, [R4,#0x68]\n"
+                 "BL      sub_FF8773E0\n"
+                 "BL      sub_FF82D828\n"
+                 "BL      sub_FF8763F4\n"
+                 "BL      sub_FF82D8C0\n"
+                 "CMP     R0, #0\n"
+                 "LDRNE   R0, =0x804B\n"
+                 "MOVNE   R1, #0\n"
+                 "BLNE    sub_FF873C90\n" // eventproc_export_PTM_SetCurrentItem
+                 "BL      sub_FF8788CC\n"
+                 "MOV     R0, #0x80\n"
+                 "BL      sub_FF82CD04\n"
+                 "BL      sub_FF878310\n"
+                 "BL      sub_FF895AD0\n" // eventproc_export_StartGUISystem
+                 "BL      sub_FF957BD0\n"
+                 "BL      sub_FF9ABFBC\n"
+                 "BL      sub_FF877B4C\n"
+                 "BL      sub_FF878204\n"
+                 "MOV     R0, #9\n"
+                 "BL      sub_FF874A74\n" 
+                 "LDR     R0, =0x300E\n"
+                 "MOV     R1, R6\n"
+                 "BL      sub_FF8711D8\n" 
+                 "MOV     R1, #0\n"
+                 "MOV     R0, #1\n"
+                 "BL      sub_FF878AB0\n"
+
+"loc_FF87583C:\n" 
+                "MOV     R0, #0\n"
+                "LDMFD   SP!, {R4-R8,PC}\n"
+"loc_FF875844:\n"  
+               "MOV     R0, #1\n"
+               "LDMFD   SP!, {R4-R8,PC}\n"
+    );
+}; //#fe
+
+//OK
+void __attribute__((naked,noinline)) sub_FF8772D4_my() { //#fs  CreateTask_InitFileModules 
+        asm volatile (
+                "LDR     R0, =0x60E4\n" 
+                "STMFD   SP!, {R3,LR}\n"
+                "LDR     R1, [R0,#4]\n"
+                "CMP     R1, #0\n"
+                "BNE     locret_FF87730C\n" 
+                "MOV     R1, #1\n"
+				"STR     R1, [R0,#4]\n"
+                "MOV     R3, #0\n"
+                "STR     R3, [SP]\n"
+				
+                "LDR     R3, =task_InitFileModules_my\n" // continue for SDHC-boot (orig: FFC5F754)-g9 = FF877284  "LDR     R3, =task_InitFileModules_my\n"
+                
+				"MOV     R1, #0x19\n"
+                "LDR     R0, =0xFF877438\n"     // aInitfilemodule 
+                "MOV     R2, #0x1000\n"
+                "BL      sub_FF81BAF0\n"         // CreateTask
+        "locret_FF87730C:\n" 
+                "LDMFD   SP!, {R12,PC}\n"
+        );
+}; //#fe
+
+//OK
+void __attribute__((naked,noinline)) task_InitFileModules_my() { //#fs   task_InitFileModules_my
+        asm volatile (
+                "STMFD   SP!, {R4-R6,LR}\n"
+                "BL      sub_FF86FFF8\n" 
+                "LDR     R5, =0x5006\n"
+                "MOVS    R4, R0\n"
+                "MOVNE   R1, #0\n"
+                "MOVNE   R0, R5\n"
+                "BLNE    sub_FF8711D8\n" 
+                "BL      sub_FF870024_my\n"    // continue to SDHC-hook here! was FFC5A4E8
+				
+                "BL      core_spytask_can_start\n"      // CHDK: Set "it's-save-to-start"-Flag for spytask
+				
+                "CMP     R4, #0\n"
+                "MOVEQ   R0, R5\n"
+                "LDMEQFD SP!, {R4-R6,LR}\n"
+                "MOVEQ   R1, #0\n"
+                "BEQ     sub_FF8711D8\n"        
+                "LDMFD   SP!, {R4-R6,PC}\n"
+        );
+}; //#fe
+
+//OK
+void __attribute__((naked,noinline)) sub_FF870024_my() { //#fs  
+
+	        asm volatile (
+                "STMFD   SP!, {R4,LR}\n"
+                
+				"BL      sub_FF85235C_my\n"    // continue to SDHC-hook here! was FFC3F0CC --------------------------------------->
+                
+				"LDR     R4, =0x5AC4\n"	
+                "LDR     R0, [R4,#4]\n"
+                "CMP     R0, #0\n"
+                "BNE     loc_FF870054\n" 
+                "BL      sub_FF87FD60\n" 
+                "BL      sub_FF90B9A8\n" 
+                "BL      sub_FF87FD60\n" 
+                "BL      sub_FF9184FC\n" 
+                "BL      sub_FF87FD70\n" 
+                "BL      sub_FF90BA50\n" 
+        "loc_FF870054:\n" 
+                "MOV     R0, #1\n"
+                "STR     R0, [R4]\n"
+                "LDMFD   SP!, {R4,PC}\n"
+        );
+}; //#fe
+//OK
+void __attribute__((naked,noinline)) sub_FF85235C_my() { //#fs  
+
+        asm volatile (
+                "STMFD   SP!, {R4-R6,LR}\n"
+                "MOV     R6, #0\n"
+                "MOV     R0, R6\n"
+                "BL      sub_FF851F2C\n" 
+                "LDR     R4, =0x168D0\n" 
+                "MOV     R5, #0\n"
+                "LDR     R0, [R4,#0x38]\n"
+                "BL      sub_FF8528F4\n" 
+                "CMP     R0, #0\n"
+                "LDREQ   R0, =0x2D34\n" 
+                "STREQ   R5, [R0,#0xC]\n"
+                "STREQ   R5, [R0,#0x10]\n"
+                "STREQ   R5, [R0,#0x14]\n"
+                "MOV     R0, R6\n"
+                "BL      sub_FF851F6C\n"        // uMounter (u=unknown, just to prevent misunderstandings)
+                "MOV     R0, R6\n"
+				
+				"BL      sub_FF852198_my\n"    // continue to SDHC-hook here! <---------------------
+                
+				"MOV     R5, R0\n"
+                "MOV     R0, R6\n"
+                "BL      sub_FF852204\n" 
+                "LDR     R1, [R4,#0x3C]\n"
+                "AND     R2, R5, R0\n"
+                "CMP     R1, #0\n"
+                "MOV     R0, #0\n"
+                "MOVEQ   R0, #0x80000001\n"
+                "BEQ     loc_FF8523F0\n" 
+                "LDR     R3, [R4,#0x2C]\n"
+                "CMP     R3, #2\n"
+                "MOVEQ   R0, #4\n"
+                "CMP     R1, #5\n"
+                "ORRNE   R0, R0, #1\n"
+                "BICEQ   R0, R0, #1\n"
+                "CMP     R2, #0\n"
+                "BICEQ   R0, R0, #2\n"
+                "ORREQ   R0, R0, #0x80000000\n"
+                "BICNE   R0, R0, #0x80000000\n"
+                "ORRNE   R0, R0, #2\n"
+        "loc_FF8523F0:\n" 
+                "STR     R0, [R4,#0x40]\n"
+                "LDMFD   SP!, {R4-R6,PC}\n"
+        );
+}; //#fe
+//OK
+void __attribute__((naked,noinline)) sub_FF852198_my() { //#fs  
+        asm volatile (
+                "STMFD   SP!, {R4-R6,LR}\n"
+                "LDR     R5, =0x2D34\n" 
+                "MOV     R6, R0\n"
+                "LDR     R0, [R5,#0x10]\n"
+                "CMP     R0, #0\n"
+                "MOVNE   R0, #1\n"
+                "LDMNEFD SP!, {R4-R6,PC}\n"
+                "MOV     R0, #0x17\n"
+                "MUL     R1, R0, R6\n"
+                "LDR     R0, =0x168D0\n" 
+                "ADD     R4, R0, R1,LSL#2\n"
+                "LDR     R0, [R4,#0x38]\n"
+                "MOV     R1, R6\n"
+									
+				"BL      sub_FF852030_my\n"        //    continue to SDHC-hook here! --------------------------------------------------->
+               
+			   "CMP     R0, #0\n"
+                "LDMEQFD SP!, {R4-R6,PC}\n"
+                "LDR     R0, [R4,#0x38]\n"
+                "MOV     R1, R6\n"
+                "BL      sub_FF852A0C\n" 
+                "CMP     R0, #0\n"
+                "LDMEQFD SP!, {R4-R6,PC}\n"
+                "MOV     R0, R6\n"
+                "BL      sub_FF851B4C\n" 
+                "CMP     R0, #0\n"
+                "MOVNE   R1, #1\n"
+                "STRNE   R1, [R5,#0x10]\n"
+                "LDMFD   SP!, {R4-R6,PC}\n"
+        );
+}; //#fe
+
+//OK
+void __attribute__((naked,noinline)) sub_FF852030_my() { //#fs  ; Partition table parse takes place here. => SDHC-boot 
+       asm volatile (	
+	   
+                "STMFD   SP!, {R4-R8,LR} \n"
+                "MOV     R8, R0\n"
+                "MOV     R0, #0x17\n"
+                "MUL     R1, R0, R1\n"
+                "LDR     R0, =0x168D0\n"
+                "MOV     R6, #0\n"
+                "ADD     R7, R0, R1,LSL#2\n"
+                "LDR     R0, [R7,#0x3C]\n"
+                "MOV     R5, #0\n"
+                "CMP     R0, #6\n"
+                "ADDLS   PC, PC, R0,LSL#2\n"
+                "B       loc_FF85217C\n"		
+"loc_FF852060:\n"
+                "B       loc_FF852094\n"
+"loc_FF852064:\n"
+                "B       loc_FF85207C\n"
+"loc_FF852068:\n"
+                "B       loc_FF85207C\n"
+"loc_FF85206C:\n"
+                "B       loc_FF85207C\n"
+"loc_FF852070:\n"
+                "B       loc_FF85207C\n"
+"loc_FF852074:\n"
+                "B       loc_FF852174\n"	
+"loc_FF852078:\n"
+                "B       loc_FF85207C\n"
+"loc_FF85207C:\n"
+                "MOV     R2, #0\n"
+                "MOV     R1, #0x200\n"
+                "MOV     R0, #3\n"
+                "BL      sub_FF86C4D0\n"
+                "MOVS    R4, R0\n"
+                "BNE     loc_FF85209C\n"				
+"loc_FF852094:\n"
+                "MOV     R0, #0\n"
+                "LDMFD   SP!, {R4-R8,PC}\n"
+"loc_FF85209C:\n"
+                "LDR     R12, [R7,#0x4C]\n"
+                "MOV     R3, R4\n"
+                "MOV     R2, #1\n"
+                "MOV     R1, #0\n"
+                "MOV     R0, R8\n"
+				
+                //"BLX     R12\n"       // !! Workaround !! attenzione
+                //".long   0xE12FFF3C\n" 				
+                "MOV     LR, PC\n"      // gcc won't compile "BLX R12" nor "BL R12".
+                "MOV     PC, R12\n"     // workaround: make your own "BL" and hope we don't need the change to thumb-mode
+				
+                "CMP     R0, #1\n"
+                "BNE     loc_FF8520C8\n"
+                "MOV     R0, #3\n"
+                "BL      sub_FF86C610\n"
+                "B       loc_FF852094\n"
+"loc_FF8520C8:\n"
+                "MOV     R0, R8\n"
+		"BL      sub_FF9290B0\n" // Add FAT32 autodetect-code after this line\n"
+
+                "MOV   R1, R4\n"           //  pointer to MBR in R1
+                "BL    mbr_read_dryos\n"   //  total sectors count in R0 before and after call
+
+
+                // Start of DataGhost's FAT32 autodetection code
+                // Policy: If there is a partition which has type W95 FAT32, use the first one of those for image storage
+                // According to the code below, we can use R1, R2, R3 and R12.
+                // LR wasn't really used anywhere but for storing a part of the partition signature. This is the only thing
+                // that won't work with an offset, but since we can load from LR+offset into LR, we can use this to do that :)
+                "MOV     R12, R4\n"                    // Copy the MBR start address so we have something to work with
+                "MOV     LR, R4\n"                     // Save old offset for MBR signature
+                "MOV     R1, #1\n"                     // Note the current partition number
+                "B       dg_sd_fat32_enter\n"          // We actually need to check the first partition as well, no increments yet!
+           "dg_sd_fat32:\n"
+                "CMP     R1, #4\n"                     // Did we already see the 4th partition?
+                "BEQ     dg_sd_fat32_end\n"            // Yes, break. We didn't find anything, so don't change anything.
+                "ADD     R12, R12, #0x10\n"            // Second partition
+                "ADD     R1, R1, #1\n"                 // Second partition for the loop
+           "dg_sd_fat32_enter:\n"
+                "LDRB    R2, [R12, #0x1BE]\n"          // Partition status
+                "LDRB    R3, [R12, #0x1C2]\n"          // Partition type (FAT32 = 0xB)
+                "CMP     R3, #0xB\n"                   // Is this a FAT32 partition?
+                "CMPNE   R3, #0xC\n"                   // Not 0xB, is it 0xC (FAT32 LBA) then?
+                "BNE     dg_sd_fat32\n"                // No, it isn't.
+                "CMP     R2, #0x00\n"                  // It is, check the validity of the partition type
+                "CMPNE   R2, #0x80\n"
+                "BNE     dg_sd_fat32\n"                // Invalid, go to next partition
+                                                       // This partition is valid, it's the first one, bingo!
+                "MOV     R4, R12\n"                    // Move the new MBR offset for the partition detection.
+                
+           "dg_sd_fat32_end:\n"
+                // End of DataGhost's FAT32 autodetection code                
+                "LDRB    R1, [R4,#0x1C9]\n"			// Continue with firmware
+                "LDRB    R3, [R4,#0x1C8]\n"
+                "LDRB    R12, [R4,#0x1CC]\n"
+                "MOV     R1, R1,LSL#24\n"
+                "ORR     R1, R1, R3,LSL#16\n"
+                "LDRB    R3, [R4,#0x1C7]\n"
+                "LDRB    R2, [R4,#0x1BE]\n"
+                  //"LDRB    LR, [R4,#0x1FF]\n"		// replaced, see below
+                "ORR     R1, R1, R3,LSL#8\n"
+                "LDRB    R3, [R4,#0x1C6]\n"
+                "CMP     R2, #0\n"
+                "CMPNE   R2, #0x80\n"
+                "ORR     R1, R1, R3\n"
+                "LDRB    R3, [R4,#0x1CD]\n"
+                "MOV     R3, R3,LSL#24\n"
+                "ORR     R3, R3, R12,LSL#16\n"
+                "LDRB    R12, [R4,#0x1CB]\n"
+                "ORR     R3, R3, R12,LSL#8\n"
+                "LDRB    R12, [R4,#0x1CA]\n"
+                "ORR     R3, R3, R12\n"
+                  //"LDRB    R12, [R4,#0x1FE]\n"		// replaced, see below
+				
+                "LDRB    R12, [LR,#0x1FE]\n"        // New! First MBR signature byte (0x55)
+                "LDRB    LR, [LR,#0x1FF]\n"         //      Last MBR signature byte (0xAA)				
+				
+                "MOV     R4, #0\n"
+                "BNE     loc_FF852150\n"
+                "CMP     R0, R1\n"
+                "BCC     loc_FF852150\n"
+                "ADD     R2, R1, R3\n"
+                "CMP     R2, R0\n"
+                "CMPLS   R12, #0x55\n"
+                "CMPEQ   LR, #0xAA\n"
+                "MOVEQ   R6, R1\n"
+                "MOVEQ   R5, R3\n"
+                "MOVEQ   R4, #1\n"
+"loc_FF852150:\n"
+                "MOV     R0, #3\n"
+                "BL      sub_FF86C610\n"
+                "CMP     R4, #0\n"
+                "BNE     loc_FF852188\n"
+                "MOV     R6, #0\n"
+                "MOV     R0, R8\n"
+                "BL      sub_FF9290B0\n"
+                "MOV     R5, R0\n"
+                "B       loc_FF852188\n"
+"loc_FF852174:\n"
+                "MOV     R5, #0x40\n"
+                "B       loc_FF852188\n"
+"loc_FF85217C:\n"
+                "LDR     R1, =0x365\n"
+                "LDR     R0, =0XFF852024\n"		//aMounter_c  ; "Mounter.c"
+                "BL      sub_FF81BFC8\n"			//DebugAssert
+"loc_FF852188:\n"
+                "STR     R6, [R7,#0x44]!\n"
+                "MOV     R0, #1\n"
+                "STR     R5, [R7,#4]\n"
+                "LDMFD   SP!, {R4-R8,PC}\n"  
+        );
+}; //#fe
+
+
+//*********************************************
+
+// I could not manually find this function in the S5IS firmware, possibly signatures
+// might find it. Until that moment, I hooked it here (copied from another camera)
+unsigned long __attribute__((naked,noinline)) _time(unsigned long *timer) {
+     asm volatile (
+          "STMFD   SP!, {R3-R5,LR}\n"
+          "MOV     R4, R0\n"
+          "MVN     R0, #0\n"
+          "STR     R0, [SP,#0x10-0x10]\n"
+          "MOV     R0, SP\n"
+          "BL      sub_FF86BAEC\n" // _GetTimeOfSystem\n"
+          "CMP     R0, #0\n"
+          "BNE     loc_FFC55F38\n"
+          "CMP     R4, #0\n"
+          "LDRNE   R0, [SP,#0x10-0x10]\n"
+          "STRNE   R0, [R4]\n"
+
+     "loc_FFC55F38:\n"
+          "LDR     R0, [SP,#0x10-0x10]\n"
+          "LDMFD   SP!, {R3-R5,PC}\n"
+     );
+   return 0;  // shut up the compiler
+}
+
+
+/* 
+
+
+void CreateTask_blinker() {
+        _CreateTask("Blinker", 0x1, 0x200, task_blinker, 0);
+};
+
+
+void __attribute__((naked,noinline)) task_blinker() {
+        int ledstate;
+
+        int counter = 0;
+
+        long *led = (void*) 0xC022006C;   // AF led
+
+        long *anypointer;       // multi-purpose pointer to poke around in memory
+        long v1, v2, v3, v4;    // multi-purpose vars
+
+        ledstate = 0;   // init: led off
+        *led = 0x46;      // led on
+
+        while (1) {
+                counter++;
+
+                if (ledstate == 1) {    // toggle LED
+                        ledstate = 0;
+                        *led = 0x44;      // LED off
+                        //core_test(1);
+                } else {
+                        ledstate = 1;
+                        *led = 0x46;      // LED on
+                        //core_test(0);
+                }
+
+                if (counter == 2) {
+                        //dump_chdk();
+				//                      gui_init();
+                        //_ExecuteEventProcedure("UIFS_WriteFirmInfoToFile");
+                        //_UIFS_WriteFirmInfoToFile(0);
+                }
+
+                if (counter == 10) {
+//                        draw_txt_string(2, 2, "test");
+                }
+
+                msleep(500);
+        }
+};
+ 
+
+ //extern long _Fopen_Fut(const char *filename, const char *mode);
+//extern void _Fclose_Fut(long file);
+//extern long _Fwrite_Fut(const void *buf, long elsize, long count, long f);
+//extern long Fread_Fut(void *buf, long elsize, long count, long f);
+//extern long Fseek_Fut(long file, long offset, long whence);
+//extern long _qDump(char* filename, long unused, long write_p2, long write_p3);
+void dump_chdk() { //#fs
+    int fd;
+    long dirnum;
+        
+    volatile long *led = (void*) 0xC0220094;   // yellow led
+    volatile long *led_blue = (void*) 0xC022006c;   // yellow led
+
+    *led = 0x46; //on 
+
+  //  _qDump("A/qdump", 0, (void*) 0x01900, 0xb0000);
+    //_qDump("A/firmdump", 0, (void*) 0xFFC00000, 0x00400000);
+    //_qDump("A/firmlower", 0, (void*) 0xff800000, 0x00400000); // identical to 0xfc000000
+
+    //started();
+
+	//dirnum = get_target_dir_num();
+	//sprintf(fn, FN_RAWDIR, dirnum);
+	//mkdir(fn);
+
+	//sprintf(fn, FN_RAWDIR "/" "DMP_%04d.JPG", dirnum, ++ramdump_num);
+
+    *led_blue = 0x46; //on 
+    *led_blue = 0x44; //off
+                msleep(500);
+    *led_blue = 0x46; //on 
+	fd = _Fopen_Fut("A/dump", "w");
+    *led_blue = 0x44; //off
+	if (fd >= 0) {
+    *led_blue = 0x46; //on 
+	    write(fd, (void*)0, 0x1900);
+    *led_blue = 0x44; //off
+	    //write(fd, (void*)0x1900, 32*1024*1024-0x1900);
+            //_Fwrite_Fut((void*)0x9D000, 0x20000, 0x20000, fd);
+    *led_blue = 0x46; //on 
+	    _Fclose_Fut(fd);
+    *led_blue = 0x44; //off
+	}
+    *led = 0x44; //off
+    //finished();
+} //#fe 
+
+*/
+
+//*********************************************
+ 
Index: /branches/reyalp-ptp-live/platform/g9/sub/100g/stubs_min.S
===================================================================
--- /branches/reyalp-ptp-live/platform/g9/sub/100g/stubs_min.S	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/g9/sub/100g/stubs_min.S	(revision 1668)
@@ -0,0 +1,3 @@
+#include "stubs_asm.h"
+
+DEF(recreview_hold,                     0xF050) // 0xEFA0+0xB0		//OK
Index: /branches/reyalp-ptp-live/platform/g9/sub/100g/makefile.inc
===================================================================
--- /branches/reyalp-ptp-live/platform/g9/sub/100g/makefile.inc	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/g9/sub/100g/makefile.inc	(revision 1668)
@@ -0,0 +1,15 @@
+#315A
+PLATFORMID=12634
+
+PLATFORMOS=dryos
+
+MEMBASEADDR=0x1900
+RESTARTSTART=0x50000	
+MEMISOSTART=0xB0B68
+ROMBASEADDR=0xff810000
+
+
+PLFLAGS=-DMEMBASEADDR=$(MEMBASEADDR) -DMEMISOSTART=$(MEMISOSTART) -DMEMISOSIZE=$(MEMISOSIZE)
+PLFLAGS+=-DRESTARTSTART=$(RESTARTSTART)
+
+KEYSYS=d3
Index: /branches/reyalp-ptp-live/platform/g9/sub/100g/stubs_asm.h
===================================================================
--- /branches/reyalp-ptp-live/platform/g9/sub/100g/stubs_asm.h	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/g9/sub/100g/stubs_asm.h	(revision 1668)
@@ -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/reyalp-ptp-live/platform/g9/sub/100g/lib.c
===================================================================
--- /branches/reyalp-ptp-live/platform/g9/sub/100g/lib.c	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/g9/sub/100g/lib.c	(revision 1668)
@@ -0,0 +1,101 @@
+#include "platform.h"
+#include "stdlib.h"
+#include "lolevel.h"
+
+
+void *hook_raw_fptr()
+{
+    return (void*)0;
+}
+
+void *hook_raw_ret_addr()
+{
+    return (void*)0;
+}
+
+char *hook_raw_image_addr()
+{
+ return (char*) (*(int*)(0x5854+0x18) ? 0x11F8F740 : 0x108297C0);
+}
+
+long hook_raw_size()
+{
+    return 0xEE9710;//OK
+}
+
+void *vid_get_viewport_live_fb()
+{
+    return (void*)0;
+//    void **fb=(void **)0x21D0;
+//    unsigned char buff = *((unsigned char*)0x2084);
+//    if (buff == 0) {
+//        buff = 2;
+//    }
+//    else {
+//        buff--;
+//    }
+//    return fb[buff];
+}
+
+void *vid_get_bitmap_fb()       
+{
+    return (void*)0x10361000;//OK	
+	//THUM VRAM BUFF=0x103F2920 ;  IMG VRAM BUFF=0x108876B0 ; JPEG BUFF=0x11713000 ; MJVRAM Address=0x107F7040 ; MJVRAM Size=0x180000
+	//VRAM Address=0x1067B540 ; VRAM Size=0x7E900
+}
+
+void *vid_get_viewport_fb()
+{
+     return (void*)0x1067B540;//OK //0x1065A560;
+					
+}
+
+void *vid_get_viewport_fb_d()
+{
+    return (void*)(*(int*)0x55A0); //OK // 0x5558 + 0x48
+}
+
+long vid_get_viewport_height()
+{
+    return 240;
+}
+
+void JogDial_CW(void){
+  (*(short*)(0x263C+2))--;
+//  *(int*)(0x263C+0x18)=0x0;
+  *(int*)(0x263C+0x14)=0x32;
+  _GiveSemaphore(*(int*)(0x263C+0x0C));
+}
+
+void JogDial_CCW(void){
+  (*(short*)(0x263C+2))++;
+//  *(int*)(0x263C+0x18)=0x0;
+  *(int*)(0x263C+0x14)=0x32;
+  _GiveSemaphore(*(int*)(0x263C+0x0C));
+}
+
+//from sx100is
+//void JogDial_CW(void){
+//  (*(short*)(0x2590+2))--;
+//  *(int*)(0x2590+0x18)=0x32;
+//  _GiveSemaphore(*(int*)(0x2590+0x10));
+//}
+//
+//void JogDial_CCW(void){
+//  (*(short*)(0x2590+2))++;
+//  *(int*)(0x2590+0x18)=0x32;
+//  _GiveSemaphore(*(int*)(0x2590+0x10));
+//}
+//from sx100is
+
+int review_fullscreen_mode(){
+ char r;
+ get_parameter_data(53, &r, 1);
+ return  r==0;
+}
+//from g7
+
+char *camera_jpeg_count_str()
+{
+    return (char*)0x60354;//OK
+}
Index: /branches/reyalp-ptp-live/platform/g9/sub/100g/movie_rec.c
===================================================================
--- /branches/reyalp-ptp-live/platform/g9/sub/100g/movie_rec.c	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/g9/sub/100g/movie_rec.c	(revision 1668)
@@ -0,0 +1,2000 @@
+//Entry from boot !!!
+//ok
+void __attribute__((naked,noinline)) sub_FF875A0C_my() { 
+        asm volatile (                
+                "LDR     R12, =0x201E\n"
+                "STMFD   SP!, {R4,LR}\n"
+                "CMP     R0, R12\n"
+                "BEQ     loc_FF875ACC\n"
+                "BGT     loc_FF875A68\n"
+                "LDR     R12, =0x2004\n"
+                "CMP     R0, R12\n"
+                "BEQ     loc_FF875AD4\n"
+                "BGT     loc_FF875A50\n"
+                "SUB     R12, R0, #0x1000\n"
+                "SUBS    R12, R12, #0xA9\n"
+                "SUBNE   R12, R0, #0x1000\n"
+                "SUBNES  R12, R12, #0xAD\n"
+                "SUBNE   R12, R0, #0x1000\n"
+                "SUBNES  R12, R12, #0xAF\n"
+                "BNE     loc_FF875AE4\n"
+                "B       loc_FF875ACC\n"
+"loc_FF875A50:\n"
+                "SUB     R12, R0, #0x2000\n"
+                "SUBS    R12, R12, #5\n"
+                "SUBNE   R12, R0, #0x2000\n"
+                "SUBNES  R12, R12, #0x1D\n"
+                "BNE     loc_FF875AE4\n"
+                "B       loc_FF875ACC\n"
+"loc_FF875A68:\n"
+                "LDR     R12, =0x5004\n"
+                "CMP     R0, R12\n"
+                "BEQ     loc_FF875ACC\n"
+                "BGT     loc_FF875A94\n"
+                "SUB     R12, R0, #0x3000\n"
+                "SUBS    R12, R12, #0xA\n"
+                "BEQ     loc_FF875AC8\n"
+                "SUB     R12, R0, #0x5000\n"
+                "SUBS    R12, R12, #1\n"
+                "BNE     loc_FF875AE4\n"
+                "B       loc_FF875ACC\n"
+"loc_FF875A94:\n"
+                "SUB     R12, R0, #0x5000\n"
+                "SUBS    R12, R12, #6\n"
+                "BEQ     loc_FF875ACC\n"
+                "SUB     R12, R0, #0x5000\n"
+                "SUBS    R12, R12, #7\n"
+                "BNE     loc_FF875AE4\n"
+                "BL      sub_FF82D864\n"	//ActivateImageSystem
+                "LDR     R1, =0x6008\n"
+                "LDR     R0, [R1,#0x10]\n"
+                "CMP     R0, #7\n"
+                "LDREQ   R0, [R1,#0x18]\n"
+                "BLEQ    sub_FF8765BC\n"
+                "B       loc_FF875ADC\n"
+"loc_FF875AC8:\n"
+                "BL      sub_FF82CCF0\n"
+"loc_FF875ACC:\n"
+                "LDMFD   SP!, {R4,LR}\n"
+                "B       sub_FF8758BC_my\n" // AC.StartupShowInfo ------->
+"loc_FF875AD4:\n"
+                "BL      sub_FF8746F0\n"
+                "BL      sub_FF8751CC\n"	//AC.EntryNShtDwn
+"loc_FF875ADC:\n"
+                "MOV     R0, #0\n"
+                "LDMFD   SP!, {R4,PC}\n"
+"loc_FF875AE4:\n"
+                "MOV     R0, #1\n"
+                "LDMFD   SP!, {R4,PC}\n"
+ );
+}
+
+//ok
+void __attribute__((naked,noinline)) sub_FF8758BC_my(){ // AC.StartupShowInfo
+asm volatile(
+                "STMFD   SP!, {R4-R6,LR}\n"
+                "BL      sub_FF87670C\n"
+                "CMP     R0, #1\n"
+                "BLEQ    sub_FF87681C\n" 	//AC.ShowCaptInfo
+                "LDR     R4, =0x6008\n"
+                "MOV     R5, #1\n"
+                "LDR     R0, [R4,#0x24]\n"
+                "CMP     R0, #0\n"
+                "LDRNE   R0, [R4,#0x4C]\n"
+                "CMPNE   R0, #0\n"
+                "BEQ     loc_FF875928\n"
+                "BL      sub_FF87670C\n"
+                "CMP     R0, #1\n"
+                "BNE     loc_FF875928\n"
+                "BL      sub_FF87681C\n" 	//AC.ShowCaptInfo
+                "LDR     R0, [R4,#0x78]\n"
+                "CMP     R0, #0\n"
+                "BNE     loc_FF875928\n"
+                "LDR     R1, =0xFF875AEC\n"   // aAcStartupshowi
+                "MOV     R0, #0x20\n"
+                "BL      sub_FF86DA00\n"
+                "BL      sub_FF9BDC58\n"
+                "BL      sub_FF9BDBE4\n" 	//RefreshPhysicalScreen
+                "MOV     R1, #0\n"
+                "MOV     R0, #0x51\n"
+                "BL      sub_FF87E814\n"
+                "STR     R5, [R4,#0x78]\n"
+"loc_FF875928:\n"
+                "BL      sub_FF87670C\n"
+                "CMP     R0, #1\n"
+                "BNE     loc_FF875974\n"
+                "LDR     R0, [R4,#0x44]\n"
+                "CMP     R0, #0\n"
+                "BEQ     loc_FF875974\n"
+                "LDR     R0, [R4,#0x74]\n"
+                "CMP     R0, #0\n"
+                "BNE     loc_FF875974\n"
+                "LDR     R1, =0xFF875B00\n"  // aAcDispshot
+                "MOV     R0, #0x20\n"
+                "BL      sub_FF86DA00\n"
+                "MOV     R1, #0\n"
+                "MOV     R0, #0x8C\n"
+                "BL      sub_FF87E814\n"
+                "BL      sub_FF87C994\n"
+                "MOV     R0, #0x21\n"
+                "BL      sub_FF87E854\n"
+                "STR     R5, [R4,#0x74]\n"
+"loc_FF875974:\n"
+                "LDR     R0, [R4,#0x38]\n"
+                "CMP     R0, #0\n"
+                "LDRNE   R0, [R4,#0x3C]\n"
+                "CMPNE   R0, #0\n"
+                "LDRNE   R0, [R4,#0x44]\n"
+                "CMPNE   R0, #0\n"
+                "LDRNE   R0, [R4,#0x48]\n"
+                "CMPNE   R0, #0\n"
+                "LDRNE   R0, [R4,#0x1C]\n"
+                "LDRNE   R1, [R4,#0x20]\n"
+                "ORRNES  R0, R0, R1\n"
+                "BEQ     loc_FF8759B0\n"
+                "BL      sub_FF874FDC\n" 	//AC.OpCover
+                "BL      sub_FF8751CC\n"	//AC.EntryNShtDwn
+                "B       loc_FF8759D4\n"
+"loc_FF8759B0:\n"
+                "LDR     R0, [R4,#0x58]\n"
+                "CMP     R0, #0\n"
+                "BEQ     loc_FF8759DC\n"
+                "BL      sub_FF875078\n"
+                "CMP     R0, #1\n"
+                "BNE     loc_FF8759DC\n"
+                "BL      sub_FF8781CC\n" 	//DispSwCon_MuteOnPhysicalScreen
+                "BL      sub_FF877FEC\n"	//DispSwCon_TurnOffBackLight
+                "BL      sub_FF8765F8\n"	//AC.ShutdownRec
+"loc_FF8759D4:\n"
+                "MOV     R0, #0\n"
+                "LDMFD   SP!, {R4-R6,PC}\n"
+"loc_FF8759DC:\n"
+                "BL      sub_FF875078\n"
+                "CMP     R0, #1\n"
+                "BNE     loc_FF875A04\n"
+                "LDR     R0, [R4,#0x7C]\n"
+                "CMP     R0, #0\n"
+                "BLEQ    sub_FF876860_my\n" //AC.EntryRecBoot ------------->
+                "MOV     R0, #0\n"
+                "STR     R0, [R4,#0x70]\n"
+                "STR     R0, [R4,#0x74]\n"
+                "STR     R0, [R4,#0x78]\n"
+"loc_FF875A04:\n"
+                "MOV     R0, #1\n"
+                "LDMFD   SP!, {R4-R6,PC}\n"
+);
+}
+
+//ok
+void __attribute__((naked,noinline)) sub_FF876860_my(){ // AC.EntryRecBoot
+ asm volatile(
+                "STMFD   SP!, {R4,LR}\n"
+                "LDR     R1, =0xFF876A9C\n" // aAcEntryrecboot
+                "MOV     R0, #0x20\n"
+                "BL      sub_FF86DA00\n" 
+                "BL      sub_FF82CF20\n"
+                "BL      sub_FF8763F4\n"
+                "BL      sub_FF87A0A4_my\n" //StartRecMode ------------->
+                "MOV     R0, #1\n"
+                "BL      sub_FF874A74\n"
+                "BL      sub_FF874F60\n"
+                "LDMFD   SP!, {R4,LR}\n"
+                "B       sub_FF87522C\n"
+ );
+} 
+
+//ok
+void __attribute__((naked,noinline)) sub_FF87A0A4_my(){ // StartRecMode
+ asm volatile(
+                "STMFD   SP!, {R4-R6,LR}\n"
+                "LDR     R1, =0xFF87A2A0\n" // aStartrecmode
+                "MOV     R0, #0x20\n"
+                "BL      sub_FF86DA00\n" 
+                "LDR     R4, =0x62A8\n"
+                "MOV     R0, #6\n"
+                "MOV     R5, #1\n"
+                "STR     R0, [R4,#0x60]\n"
+                "STR     R5, [R4,#0x10]\n"
+                "BL      sub_FF9583D0\n"
+                "BL      sub_FF96F128\n"
+                "BL      sub_FF95FAD8\n"
+                "BL      sub_FF95D0F8\n"		
+                "BL      sub_FF87A5E4_my\n"  //------------->
+                "BL      sub_FF96FDC8\n"
+                "BL      sub_FF96C37C\n"
+				"BL      sub_FF96F020\n" 
+                "MOV     R0, #1\n"
+                "STR     R5, [R4,#0x1c]\n"
+                "BL      sub_FF87A6F4\n" 
+                "MOV     R0, #3\n"
+                "STR     R0, [R4,#0x6C]\n"
+                "LDR     R1, [R4,#0x70]\n"
+                "LDMFD   SP!, {R4-R6,LR}\n"
+                "MOV     R0, #0\n"
+                "BX      R1\n"
+ );
+} 
+
+//ok
+void __attribute__((naked,noinline)) sub_FF87A5E4_my(){ // 
+ asm volatile(
+                "STMFD   SP!, {R4,LR}\n"
+                "MOV     R0, #1\n"
+                "BL      sub_FF960594\n"
+                "LDR     R0, =0x855\n"
+                "BL      sub_FF872854\n"
+                "BL      sub_FF82CCF0\n"
+                //"BL      sub_FF879E74\n"  
+                "BL      sub_FF879E74_my\n"  //-------------->
+                "BL      sub_FF957BD0\n"
+                "BL      sub_FF952920\n"  
+                "BL      sub_FF95E534\n" 
+                "BL      sub_FF961F64\n"
+                "BL      sub_FF962648\n"
+                "BL      sub_FF96BC00\n"
+                "BL      sub_FF9712CC\n" 
+                "BL      sub_FF963780\n" 
+                "BL      sub_FF96F5A4\n"
+                "BL      sub_FF96ECA8\n"
+                "BL      sub_FF962190\n" 
+                "BL      sub_FF96E5F0\n"
+                "BL      sub_FF9603F8\n" 
+				"BL      sub_FF96B7E8\n" 
+				"BL      sub_FF96B2EC\n"
+				"BL      sub_FF95DE84\n" 
+				"BL      sub_FF96DC0C\n"
+				"BL      sub_FF87E9A0\n" 
+                "LDMFD   SP!, {R4,LR}\n"
+                "B       sub_FF87E650\n" 
+ );
+} 
+
+// branches are together
+//OK
+void __attribute__((naked,noinline)) sub_FF879E74_my(){  // 
+ asm volatile(
+                "STMFD   SP!, {R4,LR}\n"
+                "LDR     R0, =0x631C\n"
+                //"LDR     R1, =0xFF879BEC\n" 
+                "LDR     R1, =sub_FF879BEC_my\n" // __PrepareCaptureModeChange__ ------------->
+                "BL      sub_FF88045C\n" 
+                "LDR     R1, =0x62A8\n"
+                //"LDR     R0, =0xFF879D28\n" 
+                "LDR     R0, =sub_FF879D28_my\n" //------------->
+                "STR     R0, [R1,#0x70]\n"
+                "LDMFD   SP!, {R4,PC}\n"
+ );
+} 
+
+//branch 1
+//ok
+void __attribute__((naked,noinline)) sub_FF879BEC_my(){ // __PrepareCaptureModeChange__
+ asm volatile(
+ 
+                "STMFD   SP!, {R3-R5,LR}\n"
+                "BL      sub_FF951628\n"
+                "BL      sub_FF970F88\n"
+                "LDR     R4, =0x62A8\n"
+                "LDR     R0, [R4,#0x34]\n"
+                "CMP     R0, #1\n"
+                "BNE     loc_FF879C28\n"
+                "LDR     R1, =0xFF879D08\n"			//a__preparecaptu 
+                "MOV     R0, #0x20\n"
+                "BL      sub_FF86DA00\n"
+                "MOV     R0, #0\n"
+                "STR     R0, [R4,#0x34]\n"
+                "STR     R0, [R4,#0x30]\n"
+                "BL      sub_FF879B00\n"		//ShutdownRecMode
+                "LDMFD   SP!, {R3-R5,PC}\n"
+"loc_FF879C28:\n"
+                "BL      sub_FF826E78\n"		//SSAPI.PrepareCaptureModeChange
+                "LDRH    R0, [R4,#4]\n"
+                "SUB     R12, R0, #0x8200\n"
+                "SUBS    R12, R12, #0xA\n"
+                "BNE     loc_FF879C4C\n"
+                "MOV     R0, #0x24\n"
+                "BL      sub_FF87E854\n"
+                "MOV     R0, #0x25\n"
+                "BL      sub_FF87E854\n"
+"loc_FF879C4C:\n"
+                "LDRH    R0, [R4,#4]\n"
+                "MOV     R1, SP\n"
+                "STRH    R0, [SP]\n"
+                "LDR     R0, [R4,#0x60]\n"
+                "STRH    R0, [SP,#2]\n"
+                "MOV     R0, #0x40\n"
+                "BL      sub_FF87E814\n"
+                "LDR     R0, [R4,#0x20]\n"
+                "CMP     R0, #0\n"
+                "LDREQH  R0, [R4,#4]\n"
+                "BLEQ    sub_FF873B38\n"		//PTM_SetCurrentCaptureMode
+                "LDRH    R0, [R4,#4]\n"
+                "MOV     R1, #1\n"
+                //"BL      sub_FF878FD4\n"		
+                "BL      sub_FF878FD4_my\n" //_DecideCaptureMode----------->
+                "LDR     R0, [R4,#0x6C]\n"
+                "BL      sub_FF87A6F4\n"
+                "MOV     R0, #3\n"
+                "STR     R0, [R4,#0x6C]\n"
+                "LDR     R1, [R4,#0x70]\n"
+                "ADD     SP, SP, #4\n"
+                "LDMFD   SP!, {R4,R5,LR}\n"
+                "MOV     R0, #0\n"
+                "BX      R1\n"
+ );
+} 
+
+//branch 2
+//OK
+void __attribute__((naked,noinline)) sub_FF879D28_my(){  // was FFC61F54
+ asm volatile(
+
+                "STMFD   SP!, {R4-R6,LR}\n"
+                "LDR     R5, =0x62A8\n"
+                "LDRH    R0, [R5,#4]\n"
+                "BL      sub_FF95FD18\n"
+                "BL      sub_FF95D330\n"
+                "BL      sub_FF96224C\n"
+                "BL      sub_FF9638B8\n"
+                "BL      sub_FF96BDCC\n"
+                "BL      sub_FF950E28\n"
+                "BL      sub_FF9605DC\n"
+                "MOV     R4, #0\n"
+                "MOV     R0, R4\n"
+                "STR     R4, [R5,#0x28]\n"
+                "BL      sub_FF826EB4\n"		//SSAPI.CaptureModeChange
+                "LDR     R0, [R5,#0x14]\n"
+                "LDR     R6, =0x313D\n"
+                "CMP     R0, #0\n"
+                "BEQ     loc_FF879DA0\n"
+                "BL      sub_FF870768\n"
+                "STR     R0, [R5,#0x5C]\n"
+                "STR     R4, [R5,#0x1C]\n"
+                "STR     R4, [R5,#0x14]\n"
+                "STR     R4, [R5,#0x30]\n"
+                "MOV     R0, #0xC\n"
+                "STR     R4, [R5,#0x24]\n"
+                "BL      sub_FF83EEE0\n"
+                "MOV     R0, R6\n"
+                "LDMFD   SP!, {R4-R6,LR}\n"
+                "MOV     R1, #0\n"
+                "B       sub_FF8711D8\n"		//PostLogicalEventToUI 
+"loc_FF879DA0:\n"
+                //"BL      nullsub_98\n"
+                "STR     R4, [R5,#0x40]\n"
+                "LDRH    R0, [R5,#4]\n"
+                "MOV     R1, #0\n"
+                //"BL      sub_FF878FD4\n" 	
+                "BL      sub_FF878FD4_my\n" 	//_DecideCaptureMode ----------->
+                "BL      sub_FF87C994\n"
+                "LDR     R0, [R5,#0x64]\n"
+                "CMP     R0, #0\n"
+                "STRNE   R4, [R5,#0x64]\n"
+                "BLNE    sub_FF87A334\n"		//_MuteOffStitch
+                "BL      sub_FF95DF58\n"
+                "BL      sub_FF95E5FC\n"
+                "LDR     R1, [R5,#0x60]\n"
+                "MOV     R0, #0x41\n"
+                "BL      sub_FF87E814\n"
+                "BL      sub_FF87A334\n"			//_MuteOffStitch
+                "BL      sub_FF95D2F0\n"
+                "BL      sub_FF958544\n"
+                "CMP     R0, #0\n"
+                "BLEQ    sub_FF95D334\n"		//j_UnpressZoomLever
+                "BL      sub_FF95FCA0\n"
+                "BL      sub_FF951498\n"
+                "BL      sub_FF870768\n"
+                "STR     R0, [R5,#0x5C]\n"
+                "LDR     R0, [R5,#0x14]\n"
+                "CMP     R0, #0\n"
+                "MOVNE   R0, #0xC\n"
+                "STRNE   R4, [R5,#0x14]\n"
+                "BLNE    sub_FF83EEE0\n"
+                "LDR     R0, =0x8003\n"
+                "STR     R4, [R5,#0x30]\n"
+                "BL      sub_FF873C9C\n"		//PTM_GetCurrentItem
+                "STRH    R0, [R5]\n"
+                "MOV     R0, R6\n"
+                "MOV     R1, #0\n"
+                "BL      sub_FF8711D8\n"		//PostLogicalEventToUI 
+                "BL      sub_FF87A500\n"
+                "LDR     R0, [R5,#0x34]\n"
+                "CMP     R0, #1\n"
+                "STREQ   R4, [R5,#0x34]\n"
+                "LDMEQFD SP!, {R4-R6,LR}\n"
+                "BEQ     sub_FF879B00\n"		//ShutdownRecMode
+                "LDMFD   SP!, {R4-R6,PC}\n"
+				
+ );
+} 
+
+//branches are joining here
+//ok
+void __attribute__((naked,noinline)) sub_FF878FD4_my(){ // _DecideCaptureMode
+ asm volatile(
+                "STMFD   SP!, {R4-R6,LR}\n"
+                "MOV     R5, R0\n"
+                "MOV     R4, R1\n"
+                "LDR     R1, =0XFF8791CC\n"		//a_decidecapture 
+                "MOV     R0, #0x60\n"
+                "BL      sub_FF86DA00\n"
+                "LDR     R6, =0x62A8\n"
+                "LDR     R0, [R6,#0x10]\n"
+                "CMP     R0, #0\n"
+                "BEQ     loc_FF87918C\n"
+                "LDR     R0, [R6,#0x1C]\n"
+                "LDR     R1, =0x820A\n"
+                "LDR     R2, =0XFFFE0000\n"		// FF8791E8 ??? aVer_008_006
+                "CMP     R0, #1\n"
+                "BNE     loc_FF879054\n"
+                "CMP     R4, #1\n"
+                "LDMEQFD SP!, {R4-R6,PC}\n"
+                "CMP     R4, #0\n"
+                "BNE     loc_FF879054\n"
+                "CMP     R5, R1\n"
+                "BNE     loc_FF879034\n"
+                "BL      sub_FF87A5E0\n"
+                "BL      sub_FF87A378\n"		//_StartStitch
+                "B       loc_FF87918C\n"
+"loc_FF879034:\n"
+                "CMP     R2, R5,LSL#17\n"
+                "TSTNE   R5, #0xC00\n"
+                "BEQ     loc_FF879048\n"
+                //"BL      SUB_FF87A420\n"		
+                "BL      sub_FF87A420_my\n" // _StartMovie------------->
+                "B       loc_FF87904C\n"
+
+"loc_FF879048:\n"
+                "BL      sub_FF87A3D4\n"				//_StartStill
+"loc_FF87904C:\n"
+                "BL      sub_FF87A5E0\n"
+                "B       loc_FF87918C\n"
+"loc_FF879054:\n"
+                "CMP     R5, R1\n"
+                "BNE     loc_FF8790A8\n"
+                "LDRH    R0, [R6,#2]\n"
+                "CMP     R0, R1\n"
+                "BEQ     loc_FF879184\n"
+                "CMP     R2, R0,LSL#17\n"
+                "TSTNE   R0, #0xC00\n"
+                "BEQ     loc_FF87908C\n"
+                "LDR     R1, =0xFF8791EC\n"			//a_movietostitch 
+                "MOV     R0, #0x60\n"
+                "BL      sub_FF86DA00\n"
+                "CMP     R4, #1\n"
+                "BEQ     loc_FF87915C\n"
+                "B       loc_FF8790A0\n"
+"loc_FF87908C:\n"
+                "LDR     R1, =0xFF8791FC\n"		//a_stilltostitch 
+                "MOV     R0, #0x60\n"
+                "BL      sub_FF86DA00\n"
+                "CMP     R4, #1\n"
+                "BEQ     loc_FF879178\n"
+"loc_FF8790A0:\n"
+                "BL      sub_FF87A378\n"				//_StartStitch
+                "B       loc_FF879184\n"
+"loc_FF8790A8:\n"
+                "CMP     R2, R5,LSL#17\n"
+                "LDRH    R0, [R6,#2]\n"
+                "TSTNE   R5, #0xC00\n"
+                "BEQ     loc_FF879118\n"
+                "CMP     R0, R1\n"
+                "BNE     loc_FF8790D8\n"
+                "LDR     R1, =0xFF87920C\n"		//a_stitchtomovie 
+                "MOV     R0, #0x60\n"
+                "BL      sub_FF86DA00\n"
+                "CMP     R4, #1\n"
+                "BEQ     loc_FF879134\n"
+                "B       loc_FF879110\n"
+"loc_FF8790D8:\n"
+                "CMP     R2, R0,LSL#17\n"
+                "TSTNE   R0, #0xC00\n"
+                "BEQ     loc_FF8790FC\n"
+                "LDR     R1, =0xFF87921C\n"			//a_movietomovie 
+                "MOV     R0, #0x60\n"
+                "BL      sub_FF86DA00\n"
+                "CMP     R4, #1\n"
+                "BEQ     loc_FF87915C\n"
+                "B       loc_FF879110\n"
+"loc_FF8790FC:\n"
+                "LDR     R1, =0xFF87922C\n"		//a_stilltomovie 
+                "MOV     R0, #0x60\n"
+                "BL      sub_FF86DA00\n"
+                "CMP     R4, #1\n"
+                "BEQ     loc_FF879178\n"
+"loc_FF879110:\n"
+                //"BL      sub_FF87A420\n"				
+                "BL      sub_FF87A420_my\n" // _StartMovie------------->
+                "B       loc_FF879184\n"
+"loc_FF879118:\n"
+                "CMP     R0, R1\n"
+                "BNE     loc_FF87913C\n"
+                "LDR     R1, =0xFF87923C\n"			//a_stitchtostill
+                "MOV     R0, #0x60\n"
+                "BL      sub_FF86DA00\n"
+                "CMP     R4, #1\n"
+                "BNE     loc_FF879180\n"
+"loc_FF879134:\n"
+                "LDMFD   SP!, {R4-R6,LR}\n"
+                "B       sub_FF87A3A8\n"				//_StopStitch
+"loc_FF87913C:\n"
+                "CMP     R2, R0,LSL#17\n"
+                "TSTNE   R0, #0xC00\n"
+                "BEQ     loc_FF879164\n"
+                "LDR     R1, =0xFF87924C\n"			//a_movietostill 
+                "MOV     R0, #0x60\n"
+                "BL      sub_FF86DA00\n"
+                "CMP     R4, #1\n"
+                "BNE     loc_FF879180\n"
+"loc_FF87915C:\n"
+                "LDMFD   SP!, {R4-R6,LR}\n"
+                "B       sub_FF87A44C\n"			//_StopMovie
+"loc_FF879164:\n"
+                "LDR     R1, =0xFF87925C\n"			//a_stilltostill 
+                "MOV     R0, #0x60\n"
+                "BL      sub_FF86DA00\n"
+                "CMP     R4, #1\n"
+                "BNE     loc_FF879180\n"
+"loc_FF879178:\n"
+                "LDMFD   SP!, {R4-R6,LR}\n"
+                "B       sub_FF87A3FC\n"			//_StopStill
+"loc_FF879180:\n"
+                "BL      sub_FF87A3D4\n"			//_StartStill
+"loc_FF879184:\n"
+                "CMP     R4, #0\n"
+                "LDMNEFD SP!, {R4-R6,PC}\n"
+"loc_FF87918C:\n"
+                "STRH    R5, [R6,#2]\n"
+                "LDMFD   SP!, {R4-R6,PC}\n"
+ );
+} 
+
+
+//ok
+void __attribute__((naked,noinline)) sub_FF87A420_my(){  // _StartMovie
+ asm volatile(
+                "STMFD   SP!, {R4,LR}\n"
+                "LDR     R1, =0xFF87A56C\n" // a_startmovie
+                "MOV     R0, #0x20\n"
+                "BL      sub_FF86DA00\n" 
+                "LDR     R0, =0x62A8\n"
+                "LDR     R0, [R0,#0x2c]\n"
+                "CMP     R0, #0\n"
+                "BLNE    sub_FF87B1FC\n"
+                "LDMFD   SP!, {R4,LR}\n"
+                "MOV     R0, #0\n"
+                //"B       sub_FF87D9BC\n"  
+                "B       sub_FF87D9BC_my\n"  // ----------->
+ );
+} 
+
+//ok
+void __attribute__((naked,noinline)) sub_FF87D9BC_my(){  // 
+ asm volatile(
+                "STMFD   SP!, {R4,LR}\n"
+                "LDR     R4, =0x6470\n"
+                "MOV     R0, #0\n"
+                "STR     R0, [R4,#0x30]\n"
+                "LDR     R0, [R4,#8]\n"
+                "CMP     R0, #0\n"
+                "BNE     loc_FF87D9E8\n"
+                "LDR     R0, =sub_FF87D5A0_my\n" //----------->
+                "MOV     R1, #0\n"
+                "BL      sub_FF8709DC\n" 
+                "STR     R0, [R4,#8]\n"
+"loc_FF87D9E8:\n"
+                "LDR     R0, [R4,#0xC]\n"
+                "CMP     R0, #0\n"
+                "BNE     loc_FF87DA04\n"
+                "LDR     R0, =0xFF87D238\n"
+                "MOV     R1, #0\n"
+                "BL      sub_FF879FC4\n"
+                "STR     R0, [R4,#0xC]\n"
+"loc_FF87DA04:\n"
+                "BL      sub_FF87E1C0\n"
+                "BL      sub_FF87D29C\n"
+                "BL      sub_FF96C950\n"
+                "BL      sub_FF971DD0\n"
+                "LDMFD   SP!, {R4,LR}\n"
+                "B       sub_FF95F258\n"
+ );
+} 
+
+//ok
+void __attribute__((naked,noinline)) sub_FF87D5A0_my(){  // 
+ asm volatile(
+                "STMFD   SP!, {R3-R11,LR}\n"
+                "LDR     R5, =0x6470\n"
+                "MOV     R4, R1\n"
+                "LDR     R2, [R5,#0x2C]\n"
+                "ADD     R0, R5, #0\n"
+                "LDR     R0, [R0,#0x14]\n"
+                "LDR     R9, =0x3007\n"
+                "CMP     R2, #0\n"
+                "MOV     R1, #0\n"
+                "MOV     R11, R3\n"
+                "MVN     R8, #0\n"			//                "MOVL    R8, 0xFFFFFFFF\n"
+                "BEQ     loc_FF87D618\n"
+                "CMP     R4, R9\n"
+                "BEQ     loc_FF87D830\n"
+                "CMP     R4, #0x800\n"
+                "LDREQ   R2, [R5,#0x38]\n"
+                "CMPEQ   R11, R2\n"
+                "BNE     loc_FF87D940\n"
+                "STR     R1, [R5,#0x2C]!\n"
+                "CMP     R0, #0\n"
+                "STR     R8, [R5,#0xC]\n"
+                "BNE     loc_FF87D9B4\n"
+                "BL      sub_FF82D7A0\n"
+                "CMP     R0, #1\n"
+                "BEQ     loc_FF87D610\n"
+                "BL      sub_FF82D7A8\n"
+                "CMP     R0, #1\n"
+                "BNE     loc_FF87D9B4\n"
+"loc_FF87D610:\n"
+                "BL      sub_FF87D3E8\n"
+                "B       loc_FF87D9B4\n"
+"loc_FF87D618:\n"
+                "CMP     R0, #1\n"
+                "SUBEQ   R12, R4, #0x2000\n"
+                "SUBEQS  R12, R12, #0x1C\n"
+                "BNE     loc_FF87D634\n"
+                "MOV     R0, #0\n"
+                "BL      sub_FF87DC70\n"		//MviCon_EmpBuf
+                "B       loc_FF87D9B4\n"
+"loc_FF87D634:\n"
+                "BL      sub_FF894488\n"
+                "LDR     R10, =0x9A5\n"
+                "CMP     R0, #1\n"
+                "SUB     R6, R10, #4\n"
+                "SUB     R7, R10, #2\n"
+                "BNE     loc_FF87D668\n"
+                "CMP     R4, R10\n"
+                "CMPNE   R4, R6\n"
+                "CMPNE   R4, R7\n"
+                "BNE     loc_FF87D668\n"
+                "BL      sub_FF893614\n"
+                "STR     R4, [R5,#0x3C]\n"
+                "B       loc_FF87D940\n"
+"loc_FF87D668:\n"
+                "BL      sub_FF95D108\n"		//GetAEIntegralServiceMode_7
+                "CMP     R0, #1\n"
+                "BNE     loc_FF87D688\n"		//           vas     "BNE     sub_FF87D688\n"
+                "MOV     R0, R4\n"
+                "BL      sub_FF870F18\n"
+                "CMP     R0, #1\n"
+                "CMPNE   R4, R10\n"
+                "BEQ     loc_FF87D940\n"
+"loc_FF87D688:\n"
+                "BL      sub_FF82D8A0\n"
+                "CMP     R0, #1\n"
+                "BNE     loc_FF87D6A0\n"
+                "CMP     R4, R6\n"
+                "CMPNE   R4, R7\n"
+                "BEQ     loc_FF87D9B4\n"
+"loc_FF87D6A0:\n"
+                "BL      sub_FF87A198\n"
+                "LDR     R1, =0x9A2\n"
+                "CMP     R0, #1\n"
+                "ADD     R2, R1, #2\n"
+                "BNE     loc_FF87D6C8\n"
+                "CMP     R4, R6\n"
+                "CMPNE   R4, R1\n"
+                "CMPNE   R4, R7\n"
+                "CMPNE   R4, R2\n"
+                "BEQ     loc_FF87D9B4\n"
+"loc_FF87D6C8:\n"
+                "SUB     R12, R4, #0x800\n"
+                "SUBS    R12, R12, #0x57\n"
+                "BNE     loc_FF87D6F0\n"
+                "LDR     R0, [R5,#0x10]\n"
+                "LDR     R1, [R5,#0x14]\n"
+                "ORR     R0, R0, R1\n"
+                "LDR     R1, [R5,#0x1C]\n"
+                "ORRS    R0, R0, R1\n"
+                "BLEQ    sub_FF9ABF9C\n"
+                "B       loc_FF87D9B4\n"
+"loc_FF87D6F0:\n"
+                "LDR     R12, =0x200A\n"
+                "CMP     R4, R12\n"
+                "BEQ     loc_FF87D9A4\n"
+                "BGT     loc_FF87D76C\n"
+                "LDR     R12, =0x907\n"
+                "CMP     R4, R12\n"
+                "MOVEQ   R1, #2\n"
+                "MOVEQ   R0, R10\n"
+                "BEQ     loc_FF87D8E0\n"
+                "BGT     loc_FF87D748\n"
+                "SUB     R12, R4, #0x800\n"
+                "LDR     R6, =0x2003\n"
+                "SUBS    R12, R12, #0x26\n"
+                "BEQ     loc_FF87D844\n"
+                "SUB     R12, R4, #0x800\n"
+                "SUBS    R12, R12, #0x29\n"
+                "BEQ     loc_FF87D888\n"
+                "CMP     R4, #0x860\n"
+                "SUBNE   R12, R4, #0x800\n"
+                "SUBNES  R12, R12, #0x61\n"
+                "BNE     loc_FF87D958\n"
+                "B       loc_FF87D940\n"
+"loc_FF87D748:\n"
+                "CMP     R4, R6\n"
+                "BEQ     loc_FF87D8D8\n"
+                "CMP     R4, R1\n"
+                "BEQ     loc_FF87D9A4\n"
+                "CMP     R4, R7\n"
+                "BEQ     loc_FF87D8D8\n"
+                "CMP     R4, R2\n"
+                "BEQ     loc_FF87D9A4\n"
+                "B       loc_FF87D958\n"
+"loc_FF87D76C:\n"
+                "LDR     R12, =0x3149\n"
+                "CMP     R4, R12\n"
+                "MOVEQ   R1, #0\n"
+                "MOVEQ   R0, #0x84\n"
+                "BEQ     loc_FF87D950\n"
+                "BGT     loc_FF87D7C4\n"
+                "SUB     R12, R4, #0x2000\n"
+                "SUBS    R12, R12, #0x20\n"
+                "MOVEQ   R1, R11\n"
+                "MOVEQ   R0, #0x83\n"
+                "BEQ     loc_FF87D950\n"
+                "CMP     R4, R9\n"
+                "BEQ     loc_FF87D81C\n"
+                "SUB     R12, R4, #0x3100\n"
+                "SUBS    R12, R12, #0x35\n"
+                "BEQ     loc_FF87D800\n"
+                "SUB     R12, R4, #0x3000\n"
+                "SUBS    R12, R12, #0x148\n"
+                "BNE     loc_FF87D958\n"
+                "MOV     R1, #0\n"
+                "MOV     R0, #0x86\n"
+                "B       loc_FF87D950\n"
+"loc_FF87D7C4:\n"
+                "SUB     R12, R4, #0x3100\n"
+                "SUBS    R12, R12, #0x4A\n"
+                "BEQ     loc_FF87D948\n"
+                "SUB     R12, R4, #0x4000\n"
+                "SUBS    R12, R12, #3\n"
+                "BEQ     loc_FF87D904\n"
+                "SUB     R12, R4, #0x4000\n"
+                "SUBS    R12, R12, #8\n"
+                "BEQ     loc_FF87D8E8\n"
+                "SUB     R12, R4, #0x4000\n"
+                "SUBS    R12, R12, #0xF\n"
+                "BNE     loc_FF87D958\n"
+                "MOV     R0, #0x82\n"
+                "BL      sub_FF87E854\n"
+                "B       loc_FF87D9B4\n"
+"loc_FF87D800:\n"
+                "BL      sub_FF87E1F4\n"	//GetVRAMHPixelsSize_1
+                "CMP     R0, #4\n"
+                "BEQ     loc_FF87D9A4\n"
+                "LDR     R0, [R5,#0x1C]\n"
+                "CMP     R0, #0\n"
+                "BLNE    sub_FF87D330\n"	//MviCon_ShtDwn
+                "B       loc_FF87D9B4\n"
+"loc_FF87D81C:\n"
+                "MOV     R0, #1\n"
+                "STR     R0, [R5,#0x1C]\n"
+                "LDR     R0, [R5,#0x18]\n"
+                "CMP     R0, #1\n"
+                "BNE     loc_FF87D838\n"
+"loc_FF87D830:\n"
+                "BL      sub_FF87D330\n"	//MviCon_ShtDwn
+                "LDMFD   SP!, {R3-R11,PC}\n"
+"loc_FF87D838:\n"
+                "MOV     R0, R4\n"
+                "BL      sub_FF87D508\n"
+                "B       loc_FF87D9B4\n"
+"loc_FF87D844:\n"
+                "BL      sub_FF87A198\n"
+                "CMP     R0, #0\n"
+                "BEQ     loc_FF87D85C\n"
+                "MOV     R0, R4\n"
+                "BL      sub_FF87A18C\n"
+                "B       loc_FF87D9B4\n"
+"loc_FF87D85C:\n"
+                "LDR     R0, [R5,#0x10]\n"
+                "LDR     R1, [R5,#0x14]\n"
+                "ORR     R0, R0, R1\n"
+                "LDR     R1, [R5,#0x1C]\n"
+                "ORRS    R0, R0, R1\n"
+                "BNE     loc_FF87D9B4\n"
+                "MOV     R1, #0\n"
+                "MOV     R0, R6\n"
+                "BL      sub_FF85E584\n"
+                "BL      sub_FF99B540\n" 		// StartRecModeMenu
+                "B       loc_FF87D9B4\n"
+"loc_FF87D888:\n"
+                "LDR     R0, [R5,#0x10]\n"
+                "LDR     R1, [R5,#0x14]\n"
+                "ORRS    R0, R0, R1\n"
+                "BNE     loc_FF87D9B4\n"
+                "BL      sub_FF87A1A4\n"
+                "CMP     R0, #0\n"
+                "LDREQ   R0, [R5,#0x1C]\n"
+                "CMPEQ   R0, #0\n"
+                "BNE     loc_FF87D9B4\n"
+                "BL      sub_FF87A198\n"
+                "CMP     R0, #0\n"
+                "BNE     loc_FF87D9B4\n"
+                "BL      sub_FF971E7C\n" // j_IsEvfDriveMode_17
+                "CMP     R0, #0\n"
+                "BNE     loc_FF87D9B4\n"
+                "MOV     R1, #0\n"
+                "MOV     R0, R6\n"
+                "BL      sub_FF85E584\n"
+                "BL      sub_FF9523F4\n"
+                "B       loc_FF87D9B4\n"
+"loc_FF87D8D8:\n"
+                "MOV     R1, #1\n"
+                "MOV     R0, R4\n"
+"loc_FF87D8E0:\n"
+                //"BL      sub_FF87D444\n"
+                "BL      sub_FF87D444_my\n" // MviCon_fShtDwn------------->
+                "LDMFD   SP!, {R3-R11,PC}\n"
+"loc_FF87D8E8:\n"
+                "MOV     R0, R11\n"
+                "BL      sub_FF878A18\n"
+                "CMP     R0, #0\n"
+                "MOVEQ   R1, R11\n"
+                "MOVEQ   R0, R4\n"
+                //"BLEQ    sub_FF87DE60\n"
+                "BLEQ    sub_FF87DE60_my\n"  //----------->
+                "B       loc_FF87D940\n"
+"loc_FF87D904:\n"
+                "LDR     R0, [R5,#0x3C]\n"
+                "CMN     R0, #1\n"
+                "BEQ     loc_FF87D940\n"
+                "MOV     R0, #0\n"
+                "BL      sub_FF890150\n"
+                "LDR     R0, [R5,#0x3C]\n"
+                "CMP     R0, R6\n"
+                "BNE     loc_FF87D930\n"
+                "BL      sub_FF82D7A0\n"
+                "CMP     R0, #0\n"
+                "BEQ     loc_FF87D93C\n"
+"loc_FF87D930:\n"
+                "LDR     R0, [R5,#0x3C]\n"
+                "MOV     R1, #0\n"
+                "BL      sub_FF87118C\n"		//PostLogicalEventForNotPowerType
+"loc_FF87D93C:\n"
+                "STR     R8, [R5,#0x3C]\n"
+"loc_FF87D940:\n"
+                "MOV     R0, #1\n"
+                "LDMFD   SP!, {R3-R11,PC}\n"
+"loc_FF87D948:\n"
+                "MOV     R1, #0\n"
+                "MOV     R0, #0x85\n"
+"loc_FF87D950:\n"
+                "BL      sub_FF87E814\n"
+                "B       loc_FF87D9B4\n"
+"loc_FF87D958:\n"
+                "LDR     R12, =0x855\n"
+                "CMP     R4, R12\n"
+                "BEQ     loc_FF87D994\n"
+                "BGT     loc_FF87D980\n"
+                "SUB     R12, R4, #0x800\n"
+                "SUBS    R12, R12, #0x38\n"
+                "SUBNE   R12, R4, #0x800\n"
+                "SUBNES  R12, R12, #0x39\n"
+                "BNE     loc_FF87D9A4\n"
+                "B       loc_FF87D994\n"
+"loc_FF87D980:\n"
+                "SUB     R12, R4, #0x800\n"
+                "SUBS    R12, R12, #0x56\n"
+                "SUBNE   R12, R4, #0x800\n"
+                "SUBNES  R12, R12, #0x5D\n"
+                "BNE     loc_FF87D9A4\n"
+"loc_FF87D994:\n"
+                "LDR     R0, [R5,#0x10]\n"
+                "LDR     R1, [R5,#0x14]\n"
+                "ORRS    R0, R0, R1\n"
+                "BNE     loc_FF87D9B4\n"
+"loc_FF87D9A4:\n"
+                "MOV     R1, R11\n"
+                "MOV     R0, R4\n"
+                //"BL      sub_FF87DE60\n"
+                "BL      sub_FF87DE60_my\n"  //----------------->
+                "LDMFD   SP!, {R3-R11,PC}\n"
+"loc_FF87D9B4:\n"
+                "MOV     R0, #0\n"
+                "LDMFD   SP!, {R3-R11,PC}\n"
+ );
+} 
+
+//ok
+void __attribute__((naked,noinline)) sub_FF87D444_my(){ // MviCon_fShtDwn
+asm volatile(
+                "STMFD   SP!, {R4-R6,LR}\n"
+                "MOV     R4, R0\n"
+                "LDR     R0, =0x6470\n"
+                "MOV     R5, R1\n"
+                "LDR     R0, [R0,#0x1C]\n"
+                "CMP     R0, #0\n"
+                "LDRNE   R1, =0xFF87D57C\n" // aMvicon_fshtdwn 
+                "BNE     loc_FF87D4F0\n"
+                "BL      sub_FF87E200\n"
+                "CMP     R0, #1\n"
+                "BNE     loc_FF87D480\n"
+"loc_FF87D470:\n"
+                "MOV     R0, R4\n"
+                "LDMFD   SP!, {R4-R6,LR}\n"
+                "MOV     R1, #0\n"
+                //"B       sub_FF87DE60\n"
+                "B       sub_FF87DE60_my\n" //------------->
+ "loc_FF87D480:\n"
+                "CMP     R5, #2\n"
+                "BNE     loc_FF87D498\n"
+                "BL      sub_FF87C994\n"
+                "CMP     R0, #0\n"
+                "BEQ     loc_FF87D4E0\n"
+                "B       loc_FF87D4AC\n"
+"loc_FF87D498:\n"
+                "CMP     R5, #1\n"
+                "BNE     loc_FF87D4E0\n"
+                "BL      sub_FF87C9AC\n"
+                "CMP     R0, #0\n"
+                "BNE     loc_FF87D4E0\n"
+"loc_FF87D4AC:\n"
+                "MOV     R0, #0\n"
+                "BL      sub_FF890150\n"
+                "SUB     R12, R4, #0x900\n"
+                "SUBS    R12, R12, #0xA1\n"
+                "SUBNE   R12, R4, #0x900\n"
+                "SUBNES  R12, R12, #0xA3\n"
+                "SUBNE   R12, R4, #0x900\n"
+                "SUBNES  R12, R12, #0xA5\n"
+                "LDREQ   R0, =0xC507\n"
+                "MOVEQ   R1, #0\n"
+                "BLEQ    sub_FF85E584\n"
+"loc_FF87D4D8:\n"
+                "MOV     R0, #0\n"
+                "LDMFD   SP!, {R4-R6,PC}\n"
+"loc_FF87D4E0:\n"
+                "BL      sub_FF87D3E8\n"
+                "CMP     R0, #0\n"
+                "BNE     loc_FF87D4FC\n"
+                "LDR     R1, =0xFF87D58C\n" //  aMvicon_initchk 
+"loc_FF87D4F0:\n"
+                "MOV     R0, #0x60\n"
+                "BL      sub_FF86DA00\n"
+                "B       loc_FF87D4D8\n"
+"loc_FF87D4FC:\n"
+                "MOV     R0, R5\n"
+                "BL      sub_FF95BE8C\n"
+                "B       loc_FF87D470\n"
+ );
+}
+
+//ok
+void __attribute__((naked,noinline)) sub_FF87DE60_my(){  //
+ asm volatile(
+                "STMFD   SP!, {R4-R8,LR}\n"				
+                "MOV     R7, R1\n"
+                "MOV     R4, R0\n"
+                "BL      sub_FF87E27C\n"
+                "LDR     R5, =0x64B4\n"
+                "LDR     R3, =0x200A\n"
+                "LDR     R12, [R5]\n"
+                "LDR     R2, =0x4008\n"
+                "LDR     R6, =0x9A3\n"
+                "LDR     R0, =0x3007\n"
+                "LDR     R1, =0x1051\n"
+                "CMP     R12, #9\n"
+                "ADD     LR, R3, #0x15\n"
+                "ADDLS   PC, PC, R12,LSL#2\n"
+                "B       loc_FF87E1B8\n"
+"loc_FF87DE9C:\n"
+                "B       loc_FF87DEC4\n"
+"loc_FF87DEA0:\n"
+                "B       loc_FF87DED4\n"
+"loc_FF87DEA4:\n"
+                "B       loc_FF87DEE4\n"
+"loc_FF87DEA8:\n"
+                "B       loc_FF87DF58\n"
+"loc_FF87DEAC:\n"
+                "B       loc_FF87DF98\n"
+"loc_FF87DEB0:\n"
+                "B       loc_FF87E020\n"
+"loc_FF87DEB4:\n"
+                "B       loc_FF87E050\n"
+"loc_FF87DEB8:\n"
+                "B       loc_FF87E100\n"
+"loc_FF87DEBC:\n"
+                "B       loc_FF87E060\n"
+"loc_FF87DEC0:\n"
+                "B       loc_FF87E128\n"
+"loc_FF87DEC4:\n"
+                "MOV     R1, R7\n"
+                "MOV     R0, R4\n"
+                "LDMFD   SP!, {R4-R8,LR}\n"
+                "B       sub_FF87DDE8\n"	//_ActionPrepareCapture
+"loc_FF87DED4:\n"
+                "MOV     R1, R7\n"
+                "MOV     R0, R4\n"
+                "LDMFD   SP!, {R4-R8,LR}\n"
+                //B       sub_FF87E3F8
+                "B       sub_FF87E3F8_my\n"  //    ------------>
+"loc_FF87DEE4:\n"
+                "CMP     R4, R1\n"
+                "BEQ     loc_FF87DF48\n"
+                "SUB     R12, R4, #0x2000\n"
+                "SUBS    R12, R12, #6\n"
+                "BEQ     loc_FF87DF0C\n"
+                "CMP     R4, R0\n"
+                "BEQ     loc_FF87DF50\n"
+                "SUB     R12, R4, #0x3100\n"
+                "SUBS    R12, R12, #0x4B\n"
+                "BNE     loc_FF87E1B8\n"
+"loc_FF87DF0C:\n"
+                "BL      sub_FF87D3C4\n"	//MviCon_ext
+                "MOV     R0, #0\n"
+                "BL      sub_FF87E264\n"	//MovieState
+                "LDR     R0, [R5,#8]\n"
+                "CMP     R0, #0\n"
+                "MOVNE   R1, #0\n"
+                "MOVNE   R0, R6\n"
+                "BNE     loc_FF87DF40\n"
+                "LDR     R0, [R5,#4]\n"
+                "CMP     R0, #0\n"
+                "BEQ     loc_FF87E168\n"
+                "LDR     R0, =0x9A1\n"
+                "MOV     R1, #0\n"
+"loc_FF87DF40:\n"
+                "BL      sub_FF87DDE8\n"	//_ActionPrepareCapture
+                "B       loc_FF87E168\n"
+"loc_FF87DF48:\n"
+                "BL      sub_FF87E36C\n"
+                "B       loc_FF87E168\n"
+"loc_FF87DF50:\n"
+                "BL      sub_FF87E384\n"
+                "B       loc_FF87E168\n"
+"loc_FF87DF58:\n"
+                "SUB     R12, R4, #0x900\n"
+                "SUBS    R12, R12, #0xA2\n"
+                "BEQ     loc_FF87DF88\n"
+                "CMP     R4, R6\n"
+                "BEQ     loc_FF87DF80\n"
+                "CMP     R4, R1\n"
+                "BEQ     loc_FF87DF90\n"
+                "CMP     R4, R0\n"
+                "BLEQ    sub_FF87E384\n"
+                "B       loc_FF87E1B8\n"
+"loc_FF87DF80:\n"
+                //BL      _EntryActionOnPreMoving
+                "BL      sub_FF87DD8C_my\n"  //_EntryActionOnPreMoving---------------->
+                "B       loc_FF87E1B8\n"
+"loc_FF87DF88:\n"
+                "BL      sub_FF87E34C\n"
+                "B       loc_FF87E1B8\n"
+"loc_FF87DF90:\n"
+                "BL      sub_FF87E36C\n"
+                "B       loc_FF87E1B8\n"
+"loc_FF87DF98:\n"
+                "CMP     R4, LR\n"
+                "BEQ     loc_FF87DFF4\n"
+                "BGT     loc_FF87DFC0\n"
+                "CMP     R4, R6\n"
+                "BEQ     loc_FF87DFDC\n"
+                "CMP     R4, R1\n"
+                "BEQ     loc_FF87E00C\n"
+"loc_FF87DFB4:\n"
+                "CMP     R4, R3\n"
+                "BNE     loc_FF87E1B8\n"
+                "B       loc_FF87DFD0\n"
+"loc_FF87DFC0:\n"
+                "CMP     R4, R0\n"
+                "BEQ     loc_FF87E000\n"
+"loc_FF87DFC8:\n"
+                "CMP     R4, R2\n"
+                "BNE     loc_FF87E1B8\n"
+"loc_FF87DFD0:\n"
+                "BL      sub_FF87E3D4\n"	//_ActionStopRecordMovie
+                "BL      sub_FF87E34C\n"
+                "B       loc_FF87E168\n"
+"loc_FF87DFDC:\n"
+                "BL      sub_FF829154\n"	//SSAPI.StopRecordMovie
+                "MOV     R0, #5\n"
+                "BL      sub_FF87E264\n"	//MovieState
+                "MOV     R0, #0\n"
+                "STR     R0, [R5,#0xC]\n"
+                "B       loc_FF87E168\n"
+"loc_FF87DFF4:\n"
+                "MOV     R0, #5\n"
+                "BL      sub_FF87E264\n"	//MovieState
+                "B       loc_FF87E044\n"
+"loc_FF87E000:\n"
+                "BL      sub_FF829154\n"	//SSAPI.StopRecordMovie
+                "BL      sub_FF87E3D4\n"	//_ActionStopRecordMovie
+                "B       loc_FF87E0F8\n"
+"loc_FF87E00C:\n"
+                "BL      sub_FF829154\n"	//SSAPI.StopRecordMovie
+                "BL      sub_FF87E3D4\n"	//_ActionStopRecordMovie
+                "B       loc_FF87E058\n"
+"loc_FF87E018:\n"
+                "BL      sub_FF87E264\n"	//MovieState
+                "B       loc_FF87E168\n"
+"loc_FF87E020:\n"
+                "CMP     R4, LR\n"
+                "BEQ     loc_FF87E044\n"
+                "BGT     loc_FF87E038\n"
+                "CMP     R4, R1\n"
+                "BNE     loc_FF87DFB4\n"
+                "B       loc_FF87E058\n"
+"loc_FF87E038:\n"
+                "CMP     R4, R0\n"
+                "BNE     loc_FF87DFC8\n"
+                "B       loc_FF87E0F8\n"
+"loc_FF87E044:\n"
+                "MOV     R0, R7\n"
+                "BL      sub_FF87E3A0\n"	//_dsi_StopRecordMovie
+                "B       loc_FF87E168\n"
+"loc_FF87E050:\n"
+                "CMP     R4, R1\n"
+                "BNE     loc_FF87E1B8\n"
+"loc_FF87E058:\n"
+                "MOV     R0, #8\n"
+                "B       loc_FF87E018\n"
+"loc_FF87E060:\n"
+                "CMP     R4, R0\n"
+                "BEQ     loc_FF87E0F8\n"
+                "BGT     loc_FF87E0E4\n"
+                "CMP     R4, R3\n"
+                "BEQ     loc_FF87DF48\n"
+                "CMP     R4, LR\n"
+                "BEQ     loc_FF87E044\n"
+                "B       loc_FF87E1B8\n"
+"loc_FF87E0E4:\n"
+                "CMP     R4, R2\n"
+                "SUBNE   R12, R4, #0x4000\n"
+                "SUBNES  R12, R12, #0xE\n"
+                "BEQ     loc_FF87DF48\n"
+                "B       loc_FF87E1B8\n"
+"loc_FF87E0F8:\n"
+                "MOV     R0, #7\n"
+                "B       loc_FF87E018\n"
+"loc_FF87E100:\n"
+                "CMP     R4, R3\n"
+                "BEQ     loc_FF87E118\n"
+                "CMP     R4, LR\n"
+                "BEQ     loc_FF87E044\n"
+                "CMP     R4, R2\n"
+                "BNE     loc_FF87E1B8\n"
+"loc_FF87E118:\n"
+                "BL      sub_FF87E34C\n"
+                "MOV     R0, #0\n"
+                "BL      sub_FF87D508\n"
+                "B       loc_FF87E168\n"
+"loc_FF87E128:\n"
+                "SUB     R12, R4, #0x800\n"
+                "SUBS    R12, R12, #0x4A\n"
+                "BEQ     loc_FF87E170\n"
+                "CMP     R4, R1\n"
+                "BEQ     loc_FF87E1A8\n"
+                "CMP     R4, R0\n"
+                "BEQ     loc_FF87E198\n"
+                "SUB     R12, R4, #0x3100\n"
+                "SUBS    R12, R12, #0x2A\n"
+                "BNE     loc_FF87E1B8\n"
+                "BL      sub_FF87E304\n"
+                "LDR     R0, [R5,#0x14]\n"
+                "CMP     R0, #0\n"
+                "BNE     loc_FF87E168\n"
+                //BL      _EntryActionOnMoving
+                "BL      sub_FF87E320_my\n"  //_EntryActionOnMoving---------------->
+                "BL      sub_FF95D114\n"
+"loc_FF87E168:\n"
+                "MOV     R0, #0\n"
+                "LDMFD   SP!, {R4-R8,PC}\n"
+"loc_FF87E170:\n"
+                "BL      sub_FF87E304\n"
+                "LDR     R0, =0x8007\n"
+                "MOV     R1, #0\n"
+                "BL      sub_FF873C90\n" 	//j_PTM_SetCurrentItem
+                "BL      sub_FF95BE2C\n"
+                "BL      sub_FF87E34C\n"
+                "BL      sub_FF95D114\n"
+                "BL      sub_FF87D3C4\n"	//MviCon_ext
+                "MOV     R0, #0\n"
+                "B       loc_FF87E018\n"
+"loc_FF87E198:\n"
+                "BL      sub_FF87E304\n"
+                "BL      sub_FF95BE2C\n"
+                "BL      sub_FF95D114\n"
+                "B       loc_FF87DF50\n"
+"loc_FF87E1A8:\n"
+                "BL      sub_FF87E304\n"
+                "BL      sub_FF95BE2C\n"
+                "BL      sub_FF95D114\n"
+                "B       loc_FF87DF48\n"
+"loc_FF87E1B8:\n"
+                "MOV     R0, #1\n"
+                "LDMFD   SP!, {R4-R8,PC}\n"
+                 ".ltorg\n"  
+);
+} 
+
+//ok
+void __attribute__((naked,noinline)) sub_FF87E3F8_my(){ // 
+ asm volatile(
+                "LDR     R3, =0x64B4\n" 
+                "LDR     R12, =0x2006\n" 
+                "STMFD   SP!, {R4,LR}\n" 
+                "LDR     R1, [R3,#0xC]\n" 
+                "LDR     R2, [R3,#0x14]\n" 
+                "CMP     R0, R12\n" 
+                "BEQ     loc_FF87E46C\n" 
+                "BGT     loc_FF87E438\n" 
+                "SUB     R12, R0, #0x900\n" 
+                "SUBS    R12, R12, #0xA2\n" 
+                "BEQ     loc_FF87E490\n" 
+                "SUB     R12, R0, #0x1000\n" 
+                "SUBS    R12, R12, #0x51\n" 
+                "BNE     loc_FF87E4B4\n" 
+                "BL      sub_FF87E36C\n" 
+                "B       loc_FF87E4AC\n" 
+"loc_FF87E438:\n" 
+                "SUB     R12, R0, #0x3000\n" 
+                "SUBS    R12, R12, #7\n" 
+                "BEQ     loc_FF87E4A8\n" 
+                "SUB     R12, R0, #0x3100\n" 
+                "SUBS    R12, R12, #0x4B\n" 
+                "BNE     loc_FF87E4B4\n" 
+                "CMP     R2, #0\n" 
+                "BNE     loc_FF87E4AC\n" 
+                "LDR     R0, [R3,#8]\n" 
+                "ORRS    R0, R0, R1\n" 
+                "BEQ     loc_FF87E478\n" 
+                "BL      sub_FF87DD8C_my\n" // _EntryActionOnPreMoving------------>
+                "B       loc_FF87E4AC\n" 
+"loc_FF87E46C:\n" 
+                "CMP     R2, #0\n" 
+                "BLEQ    sub_FF87C9E4\n" 
+                "B       loc_FF87E4AC\n" 
+"loc_FF87E478:\n" 
+                "LDR     R0, [R3,#4]\n" 
+                "CMP     R0, #0\n" 
+                "MOVNE   R0, #3\n" 
+                "BNE     loc_FF87E4A0\n" 
+                "BL      sub_FF87E34C\n" 
+                "B       loc_FF87E4AC\n" 
+"loc_FF87E490:\n" 
+                "CMP     R1, #0\n" 
+                "BNE     loc_FF87E4AC\n" 
+                "BL      sub_FF828D44\n"	//SSAPI.CancelPrepare
+                "MOV     R0, #2\n" 
+"loc_FF87E4A0:\n" 
+                "BL      sub_FF87E264\n" 	//MovieState
+                "B       loc_FF87E4AC\n" 
+"loc_FF87E4A8:\n" 
+                "BL      sub_FF87E384\n" 
+"loc_FF87E4AC:\n" 
+                "MOV     R0, #0\n" 
+                "LDMFD   SP!, {R4,PC}\n" 
+"loc_FF87E4B4:\n" 
+                "MOV     R0, #1\n" 
+                "LDMFD   SP!, {R4,PC}\n" 
+ );
+} 
+
+//ok
+void __attribute__((naked,noinline)) sub_FF87DD8C_my(){  // _EntryActionOnPreMoving
+ asm volatile(         
+                "STMFD   SP!, {R4,LR}\n"
+                "LDR     R1, =0xFF87E080\n" // a_entryaction_0 ; "_EntryActionOnPreMoving" 
+                "MOV     R0, #0x60\n"
+                "BL      sub_FF86DA00\n"
+                "LDR     R4, =0x64B4\n"
+                "LDR     R0, [R4,#0x10]\n"
+                "CMP     R0, #0\n"
+                "LDMEQFD SP!, {R4,LR}\n"
+                "BEQ     sub_FF87E320_my\n" // _EntryActionOnMoving -------->
+                "LDR     R1, =0xFF87E09C\n" // a_entryactionon 
+                "MOV     R0, #0x60\n"
+                "BL      sub_FF86DA00\n"
+                "BL      sub_FF95D140\n"
+                "LDR     R0, [R4,#0x18]\n"
+                "CMP     R0, #1\n"
+                "MOVNE   R0, #1\n"
+                "STRNE   R0, [R4,#0x18]\n"
+                "BLNE    sub_FF8731F0\n"	//LockMainPower
+                "MOV     R0, #9\n"
+                "BL      sub_FF87E264\n"	//MovieState
+                "LDMFD   SP!, {R4,LR}\n"
+                "B       sub_FF95BCE8\n"
+	);
+} 
+
+//ok
+void __attribute__((naked,noinline)) sub_FF87E320_my(){  //_EntryActionOnMoving
+ asm volatile(
+                "STMFD   SP!, {R4,LR}\n"
+                "LDR     R1, =0xFF87E4D4\n" //a_entryaction_1  
+                "MOV     R0, #0x60\n"
+                "BL      sub_FF86DA00\n" 
+                "LDR     R1, =0x64B4\n" 
+                "MOV     R0, #0\n"
+                "STR     R0, [R1,#0xC]\n"
+                "MOV     R0, #4\n"
+                "BL      sub_FF87E264\n" 
+                "LDMFD   SP!, {R4,LR}\n"
+                "B       sub_FF87DA5C_my\n" // ------------->
+ );
+} 
+
+//ok
+void __attribute__((naked,noinline)) sub_FF87DA5C_my(){ // 
+ asm volatile(                                            
+                 "STMFD   SP!, {R3-R5,LR}\n"
+                 "LDR     R4, =0x6470\n"
+                 "LDR     R0, [R4,#0x40]\n"
+                 "CMP     R0, #1\n"
+                 "BEQ     loc_FF87DAA4\n"
+                 "BL      sub_FF873C88\n"
+                 "SUB     R12, R0, #0xA00\n"
+                 "SUBS    R12, R12, #0x29\n"
+                 "MOV     R5, #1\n"
+                 "BNE     loc_FF87DA9C\n"
+                 "LDR     R0, =0x804F\n"
+                 "MOV     R2, #1\n"
+                 "MOV     R1, #1\n"
+                 "BL      sub_FF955D94\n" 
+                 "STR     R5, [R4,#0x40]\n"
+                 "B       loc_FF87DAA4\n"
+
+ "loc_FF87DA9C:\n"     
+                 "STR     R5, [R4,#0x40]\n"
+                 "BL      sub_FF8731F0\n" 
+
+ "loc_FF87DAA4:\n"                            
+                 "MOV     R1, #0\n"
+                 "MOV     R0, #0x80\n"
+                 "BL      sub_FF87E814\n"
+                 "MOV     R2, #2\n"
+                 "MOV     R1, SP\n"
+                 "MOV     R0, #0x6B\n"
+                 "BL      sub_FF86F768\n" 
+                 "MOV     R2, #2\n"
+                 "MOV     R1, SP\n"
+                 "MOV     R0, #0xA3\n"
+                 "BL      sub_FF86F660\n" 
+                 "BL      sub_FF85E628\n"
+                 "BL      sub_FF87CC6C\n"
+                 "BL      sub_FF82911C_my\n" // SSAPI.RecordMovie------->
+                 "BL      sub_FF87D37C\n"
+                 "LDMFD   SP!, {R3-R5,PC}\n"
+ );
+} 
+
+//ok
+void __attribute__((naked,noinline)) sub_FF82911C_my(){  // SSAPI.RecordMovie
+ asm volatile(
+                "STMFD   SP!, {R4,LR}\n"
+                "MOV     R4, R0\n"
+                "MOV     R0, #0x20\n"
+                "LDR     R1, =0xFF829240\n" // aSsapiRecordmov 
+                "BL      sub_FF86DA00\n" 
+                "BL      sub_FF8298FC\n" 
+                "CMP     R0, #0\n"
+                "LDMNEFD SP!, {R4,PC}\n"
+                "MOV     R0, #4\n"
+                "BL      sub_FF85B94C\n" 
+                "BL      sub_FF85FE5C\n" 
+                "MOV     R0, R4\n"
+                "LDMFD   SP!, {R4,LR}\n"
+                "B       sub_FF86280C_my\n" //  ----------------->
+ );
+} 
+
+//ok
+void __attribute__((naked,noinline)) sub_FF86280C_my(){ // 
+ asm volatile( 
+                "STMFD   SP!, {R4-R8,LR}\n"
+                "MOV     R8, R0\n"
+                "MOV     R0, #0x41\n"
+                "SUB     SP, SP, #0x38\n"
+                "MOV     R5, #0\n"
+                "STR     R0, [SP,#0x34]\n"
+                "BL      sub_FF8627DC\n"
+                "CMP     R0, #0\n"
+                "LDRNE   R1, =0x13B\n"
+                "BNE     loc_FF8629B8\n"
+                "LDR     R4, =0x5880\n"
+                "MOV     R1, #0x1E\n"
+                "LDR     R0, [R4,#0xC]\n"
+                "BL      sub_FF829D60\n"
+                "BL      sub_FF86F8F8\n"
+                "STR     R0, [R4,#4]\n"
+                "MOV     R0, #0\n"
+                "BL      sub_FF86BA3C\n"		//GetTimeOfSystem_im1
+                "STR     R0, [SP,#0x28]\n"
+                "ADD     R0, SP, #0x28\n"
+                "MOV     R1, SP\n"
+                "BL      sub_FF86B538\n"
+                "MOV     R0, SP\n"
+                "BL      sub_FF86B420\n"
+                "STR     R0, [SP,#0x2C]\n"
+                "LDR     R0, [R4,#4]\n"
+                "MOV     R3, #4\n"
+                "ADD     R2, SP, #0x2C\n" 
+                "MOV     R1, #0x34\n"
+                "BL      sub_FF86FC18\n"
+                "LDR     R7, [SP,#0x2C]\n"
+                "BL      sub_FF862D34\n"
+                "MOV     R6, #0\n"
+                "ADD     R1, SP, #0x28\n"
+                "ADD     R0, SP, #0x2C\n"
+                "STR     R6, [SP,#0x2C]\n"
+                "STR     R6, [SP,#0x28]\n"
+                "BL      sub_FF8331F4\n"		//GetAvControlLimit
+                "LDR     R0, [R4,#4]\n"
+                "MOV     R3, #2\n"
+                "ADD     R2, SP, #0x2C\n"
+                "MOV     R1, #0x2F\n"
+                "BL      sub_FF86FC18\n"
+                "LDR     R0, [R4,#4]\n"
+                "MOV     R3, #2\n"
+                "ADD     R2, SP, #0x28\n"
+                "MOV     R1, #0x2D\n"
+                "BL      sub_FF86FC18\n"
+                "ADD     R1, SP, #0x28\n"
+                "ADD     R0, SP, #0x2C\n"
+                "BL      sub_FF836954\n"		//GetAvControlLimitWithoutTv
+                "LDR     R0, [R4,#4]\n"
+                "MOV     R3, #2\n"
+                "ADD     R2, SP, #0x2C\n"
+                "MOV     R1, #0x30\n"
+                "BL      sub_FF86FC18\n"
+                "ADD     R1, SP, #0x28\n"
+                "ADD     R0, SP, #0x2C\n"
+                "BL      sub_FF8339B8\n"		//GetTvControlLimit
+                "LDR     R0, [R4,#4]\n"
+                "MOV     R3, #2\n"
+                "ADD     R2, SP, #0x28\n"
+                "MOV     R1, #0x2E\n"
+                "BL      sub_FF86FC18\n"
+                "LDR     R0, [R4,#4]\n"
+                "MOV     R3, #2\n"
+                "ADD     R2, SP, #0x2C\n"
+                "MOV     R1, #0xB8\n"
+                "BL      sub_FF86FCC4\n"
+                "TST     R0, #1\n"
+                "LDRNE   R1, =0x11D\n"
+                "LDRNE   R0, =0xFF862C30\n" 	//aSsmovierec_c
+                "BLNE    sub_FF81BFC8\n" 		// DebugAssert
+                "LDRH    R0, [SP,#0x2C]\n"
+                "MOV     R3, #4\n"
+                "ADD     R2, SP, #0x28\n"
+                "CMP     R0, #0\n"
+                "MOVNE   R0, #1\n"
+                "STR     R0, [SP,#0x28]\n"
+                "LDR     R0, [R4,#4]\n"
+                "MOV     R1, #0x92\n"
+                "BL      sub_FF86FC18\n"
+                "MOV     R2, #1\n"
+                "ADD     R1, SP, #0x34\n"
+                "MOV     R0, #0xFA\n"
+                "BL      sub_FF86F768\n"		//PT_GetPropertyCaseString
+                "TST     R0, #1\n"
+                "LDRNE   R1, =0x152\n"
+                "LDRNE   R0, =0xFF862C30\n" 	// "SsMovieRec.c" 
+                "BLNE    sub_FF81BFC8\n" 		// DebugAssert ****
+                "LDRB    R0, [SP,#0x34]\n"
+                "MOV     R3, R8\n"
+                "MOV     R2, #0x14\n"
+                "AND     R1, R0, #0xFF\n"
+                "ADD     R0, SP, #0x30\n"
+                "STR     R7, [SP]\n"
+                "BL      sub_FF918954\n"
+                "TST     R0, #1\n"
+                "LDRNE   R1, =0x156\n"
+                "BNE     loc_FF8629B8\n"
+                "LDR     R0, =0x1E430\n"
+                "LDR     R1, [SP,#0x30]\n"
+                "MOV     R2, #0x10\n"
+                "BL      sub_FF90BD78\n"
+                "TST     R0, #1\n"
+                "BEQ     loc_FF8629C8\n"
+                "LDR     R1, =0x15E\n"
+"loc_FF8629B8:\n"
+                "LDR     R0, =0xFF862C30\n" // ; "SsMovieRec.c" 
+                "BL      sub_FF81BFC8\n" 	// DebugAssert
+"loc_FF8629C0:\n"
+                "ADD     SP, SP, #0x38\n"
+                "LDMFD   SP!, {R4-R8,PC}\n"
+"loc_FF8629C8:\n"
+                "LDR     R0, [R4,#4]\n"
+                "MOV     R3, #4\n"
+                "ADD     R2, SP, #0x30\n"
+                "MOV     R1, #0x2B\n"
+                "BL      sub_FF86FC18\n"
+                "BL      sub_FF87FD70\n"
+                "LDRSB   R1, [SP,#0x34]\n"
+                "CMP     R0, R1\n"
+                "MOVEQ   R7, #0\n"
+                "BEQ     loc_FF862A1C\n"
+                "LDR     R5, =0x1E430\n"
+                "MOV     R0, R5\n"
+                "BL      sub_FF87FEEC\n"
+                "MOV     R8, R0\n"
+                "BL      sub_FF8BD498\n"
+                "CMP     R8, R0\n"
+                "MOV     R7, R0\n"
+                "LDRLS   R1, =0x16B\n"
+                "LDRLS   R0, =0xFF862C30\n" // ; "SsMovieRec.c" 
+                "BLLS    sub_FF81BFC8\n"	// DebugAssert
+                "SUB     R7, R8, R7\n"
+"loc_FF862A1C:\n"
+                "BL      sub_FF85D5C8_my\n" // taskcreate_MovieRecord----------------------->
+                "LDR     R0, =0x1E454\n"
+                "LDRH    R3, [R0,#0x4E]\n"
+                "LDRH    R2, [R0,#0x4C]\n"
+                "LDR     R1, [R0,#0x48]\n"
+                "LDR     R0, [R0,#0x44]\n"
+                "BL      sub_FF85C44C\n"
+                "MOV     R3, #0\n"
+                "LDR     R2, =0xFF8627A4\n"
+                "MOV     R1, #0\n"
+                "LDR     R0, =0xFF8627B8\n"
+                "ADD     R8, SP, #0x0c\n"
+                "STMIA   R8, {R0-R3}\n"
+                "LDR     R2, =0xFF8627C8\n"
+                "LDR     R1, =0xFF8627B4\n"
+                "STMEA   SP, {R1-R3}\n"
+                "LDR     R1, [R4,#4]\n"
+                "MOV     R3, R6\n"
+                "MOV     R2, R7\n"
+                "MOV     R0, R5\n"
+                "BL      sub_FF85C7C8\n"
+                "LDR     R0, [R4,#0xC]\n"
+                "MOV     R1, #0x20\n"
+                "BL      sub_FF829D2C\n"
+                "B       loc_FF8629C0\n"
+ );
+} 
+
+//ok
+void __attribute__((naked,noinline)) sub_FF85D5C8_my(){   // taskcreate_MovieRecord 
+ asm volatile(
+                "STMFD   SP!, {R3-R9,LR}\n"
+                "LDR     R5, =0x56D8\n"			//**
+                "MOV     R6, #0\n"
+                "STR     R6, [R5,#0x24]\n"
+                "LDR     R0, [R5,#8]\n"
+                "LDR     R8, =0x2710\n"
+                "CMP     R0, #0\n"
+                "BNE     loc_FF85D680\n"
+                "MOV     R0, #1\n"
+                "STR     R0, [R5,#8]\n"
+                "MOV     R0, #0\n"
+                "MOV     R1, #0\n"
+                "BL      sub_FF81BE44\n"
+                "STR     R0, [R5,#0x14]\n"
+                "MOV     R0, #0\n"
+                "MOV     R1, #0\n"
+                "BL      sub_FF81BE44\n"
+                "STR     R0, [R5,#0x18]\n"
+                "MOV     R0, #0\n"
+                "MOV     R1, #0xA\n"
+                "BL      sub_FF81BDFC\n"
+                "STR     R0, [R5,#0x1C]\n"
+                "MOV     R0, #0\n"
+                "MOV     R1, #0xA\n"
+                "BL      sub_FF81BDFC\n"
+                "LDR     R7, =0x1DF58\n"
+                "MOV     R4, #9\n"
+                "ADD     R9, R4, #0x2D4\n"
+                "STR     R0, [R5,#0x20]\n"
+"loc_FF85D63C:\n"
+                "RSB     R0, R4, R4,LSL#3\n"
+                "STR     R6, [R7,R0,LSL#2]\n"
+                "ADD     R1, R7, R0,LSL#2\n"
+                "STR     R9, [SP]\n"
+                "LDR     R0, [R5,#0x20]\n"
+				"LDR     R3, =0xFF85D7D0\n" 	// =aMovierecorder_
+                "MOV     R2, R8\n"
+                "BL      sub_FF81BF08\n"
+                "SUBS    R4, R4, #1\n"
+                "BPL     loc_FF85D63C\n"
+                "MOV     R3, #0\n"
+                "STR     R3, [SP]\n"			//**
+				"LDR     R3, =MovieRecord_Task_my\n" // task_MovieRecord <--------
+                "MOV     R2, #0x1000\n"
+                "MOV     R1, #0x14\n"
+				"LDR     R0, =0xFF85D7D0\n" 	// =aMovierecorder_
+				"BL      sub_FF81BDC8\n" 		// KernelCreateTask
+"loc_FF85D680:\n"
+				"BL      sub_FF9400CC\n" 		//taskcreate_AviWrite
+                "BL      sub_FF85D6E4\n"
+                "MOV     R1, R0\n"
+                "MOV     R0, #0xB\n"
+                "ADD     R3, R0, #0x2DC\n"
+                "STR     R0, [R1]\n"
+                "STR     R3, [SP]\n"
+                "LDR     R0, [R5,#0x1C]\n"
+				"LDR     R3, =0xFF85C768\n" // aMovierecorder_ 
+                "MOV     R2, R8\n"
+                "BL      sub_FF81BF08\n"
+                "LDMFD   SP!, {R3-R9,PC}\n"
+ );
+} 
+
+//ok
+void __attribute__((naked,noinline)) MovieRecord_Task_my(){ // FF85D4C0
+ asm volatile(
+ 
+                "STMFD   SP!, {R2-R8,LR}\n"
+                "LDR     R8, =0x32B\n"
+                "LDR     R7, =0x2710\n"
+                "LDR     R4, =0x56D8\n"		//***
+                "MOV     R6, #0\n"
+                "MOV     R5, #1\n"
+"loc_FF85D4D8:\n"
+                "LDR     R0, [R4,#0x1C]\n"
+                "MOV     R2, #0\n"
+                "ADD     R1, SP, #0x4\n"
+                "BL      sub_FF829FB0\n"
+                "LDR     R0, [R4,#0x24]\n"
+                "CMP     R0, #0\n"
+                "BNE     loc_FF85D5A8\n"
+                "LDR     R0, [SP,#4]\n"
+                "LDR     R1, [R0]\n"
+                "SUB     R1, R1, #2\n"
+                "CMP     R1, #9\n"
+                "ADDLS   PC, PC, R1,LSL#2\n"
+                "B       loc_FF85D5A8\n"
+"loc_FF85D50C:\n"
+                "B       loc_FF85D55C\n"
+"loc_FF85D510:\n"
+                "B       loc_FF85D57C\n"
+"loc_FF85D514:\n"
+                "B       loc_FF85D58C\n"
+"loc_FF85D518:\n"
+                "B       loc_FF85D594\n"
+"loc_FF85D51C:\n"
+                "B       loc_FF85D564\n"
+"loc_FF85D520:\n"
+                "B       loc_FF85D59C\n"
+"loc_FF85D524:\n"
+                "B       loc_FF85D56C\n"
+"loc_FF85D528:\n"
+                "B       loc_FF85D5A8\n"
+"loc_FF85D52C:\n"
+                "B       loc_FF85D5A4\n"
+"loc_FF85D530:\n"
+                "B       loc_FF85D534\n"
+"loc_FF85D534:\n"
+                "LDR     R0, =0xFF85D180\n" // nullsub_192
+                "STR     R6, [R4,#0x38]\n"
+                "STR     R0, [R4,#0xA4]\n"
+                "LDR     R0, =0xFF85CABC\n"
+                "LDR     R2, =0xFF85C9D8\n"
+                "LDR     R1, =0x1E080\n"
+                "STR     R6, [R4,#0x28]\n"
+                "BL      sub_FF83D8B4\n"
+                "STR     R5, [R4,#0x3C]\n"
+                "B       loc_FF85D5A8\n"
+"loc_FF85D55C:\n"
+                "BL      unlock_optical_zoom\n"		//--------------->
+                "BL      sub_FF85D278\n"
+                "B       loc_FF85D5A8\n"
+"loc_FF85D564:\n"
+                //"BL      sub_FF85CF18\n"
+                "BL      sub_FF85CF18_my\n"  	// --------------->
+                "B       loc_FF85D5A8\n"
+"loc_FF85D56C:\n"
+                "LDR     R1, [R0,#0x10]\n"
+                "LDR     R0, [R0,#4]\n"
+                "BL      sub_FF940D08\n"
+                "B       loc_FF85D5A8\n"
+"loc_FF85D57C:\n"
+                "LDR     R0, [R4,#0x3C]\n"
+                "CMP     R0, #5\n"
+                "STRNE   R5, [R4,#0x2C]\n"
+                "B       loc_FF85D5A8\n"
+"loc_FF85D58C:\n"
+                "BL      sub_FF85CCA8\n"
+                "B       loc_FF85D5A8\n"
+"loc_FF85D594:\n"
+                "BL      sub_FF85CB08\n"
+                "B       loc_FF85D5A8\n"
+"loc_FF85D59C:\n"
+                "BL      sub_FF85C964\n"
+                "B       loc_FF85D5A8\n"
+"loc_FF85D5A4:\n"
+                "BL      sub_FF85D710\n"
+"loc_FF85D5A8:\n"
+                "LDR     R1, [SP,#0x04]\n"
+                "STR     R6, [R1]\n"
+                "LDR     R3, =0xFF85C768\n"	//aMovierecorder_ 
+                "MOV     R2, R7\n"
+                "STR     R8, [SP]\n"
+                "LDR     R0, [R4,#0x20]\n"	//**
+                "BL      sub_FF81BF08\n"	//**
+                "B       loc_FF85D4D8\n"
+ );
+} 
+
+
+void __attribute__((naked,noinline)) sub_FF85CF18_my(){  // 
+ asm volatile(   
+                "STMFD   SP!, {R4-R9,LR}\n"
+                "SUB     SP, SP, #0x3C\n"
+                "MOV     R7, #0\n"			//**
+                "LDR     R5, =0x56D8\n"
+                "MOV     R4, R0\n"
+                "STR     R7, [SP,#0x2C]\n"
+                "STR     R7, [SP,#0x24]\n"
+                "LDR     R0, [R5,#0x3C]\n"
+                "MOV     R8, #4\n"
+                "CMP     R0, #3\n"
+                "STREQ   R8, [R5,#0x3C]\n"
+                "LDR     R0, [R5,#0xA4]\n"
+                "MOV     R6, #0\n"			//**
+                //"BLX     R0\n"
+                ".long   0xE12FFF30\n" 
+                "LDR     R0, [R5,#0x3C]\n"
+                "CMP     R0, #4\n"
+                "BNE     loc_FF85D028\n"
+                "LDRH    R0, [R5,#2]\n"
+                "MOV     R9, #1\n"
+                "CMP     R0, #1\n"
+                "BNE     loc_FF85CF94\n"
+                "LDRH    R1, [R5,#4]\n"
+                "LDR     R0, [R5,#0x4C]\n"
+                "MUL     R0, R1, R0\n"
+                "MOV     R1, #0x3E8\n"
+                "BL      sub_FFABECA8\n"
+                "MOV     R1, R0\n"
+                "LDR     R0, [R5,#0x54]\n"
+                "BL      sub_FFABECA8\n"
+                "CMP     R1, #0\n"
+                "BNE     loc_FF85CFB0\n"
+"loc_FF85CF94:\n"
+                "ADD     R3, SP, #0x24\n"
+                "ADD     R2, SP, #0x28\n"
+                "ADD     R1, SP, #0x2C\n"
+                "ADD     R0, SP, #0x30\n"
+                "BL      sub_FF940E9C\n"
+                "MOVS    R6, R0\n"
+                "BNE     loc_FF85CFCC\n"
+"loc_FF85CFB0:\n"
+                "LDR     R0, [R5,#0x2C]\n"
+                "CMP     R0, #1\n"
+                "BNE     loc_FF85D030\n"
+                "LDR     R0, [R5,#0x54]\n"
+                "LDR     R1, [R5,#0x40]\n"
+                "CMP     R0, R1\n"
+                "BCC     loc_FF85D030\n"
+"loc_FF85CFCC:\n"
+                "CMP     R6, #0x80000001\n"		//**
+                "STREQ   R8, [R5,#0x58]\n"
+                "BEQ     loc_FF85D004\n"
+                "CMP     R6, #0x80000003\n"		//**
+                "STREQ   R9, [R5,#0x58]\n"
+                "BEQ     loc_FF85D004\n"
+                "CMP     R6, #0x80000005\n"		
+                "MOVEQ   R0, #2\n"
+                "BEQ     loc_FF85D000\n"
+                "CMP     R6, #0x80000007\n"		//**
+                "STRNE   R7, [R5,#0x58]\n"
+                "BNE     loc_FF85D004\n"
+                "MOV     R0, #3\n"
+"loc_FF85D000:\n"
+                "STR     R0, [R5,#0x58]\n"
+"loc_FF85D004:\n"
+                "LDR     R0, =0x1E0B0\n"
+                "LDR     R0, [R0,#8]\n"
+                "CMP     R0, #0\n"
+                "BEQ     loc_FF85D01C\n"
+                "BL      sub_FF84ACE4\n"
+                "B       loc_FF85D020\n"
+"loc_FF85D01C:\n"
+                "BL      sub_FF85C964\n"
+"loc_FF85D020:\n"
+                "MOV     R0, #5\n"
+                "STR     R0, [R5,#0x3C]\n"
+"loc_FF85D028:\n"
+                "ADD     SP, SP, #0x3C\n"
+                "LDMFD   SP!, {R4-R9,PC}\n"
+"loc_FF85D030:\n"
+                "LDR     R12, [SP,#0x2C]\n"
+                "CMP     R12, #0\n"
+                "BEQ     loc_FF85D128\n"
+                "STR     R9, [R5,#0x30]\n"
+                "LDR     R0, [R5,#0x48]\n"
+                "CMP     R0, #4\n"
+                "LDRNE   LR, [R4,#0xC]\n"
+                "BNE     loc_FF85D070\n"
+                "LDR     R0, [R4,#0xC]\n"
+                "LDR     R1, [R4,#8]\n"
+                "MOV     R2, R0,LSR#3\n"
+                "MUL     R1, R2, R1\n"
+                "LDR     R2, [R4,#4]\n"
+                "SUB     LR, R0, R0,LSR#2\n"
+                "ADD     R1, R2, R1,LSL#1\n"
+                "STR     R1, [R4,#4]\n"
+"loc_FF85D070:\n"
+                "LDR     R0, [R5,#0x70]\n"
+                "LDR     R1, [R4,#0x14]\n"
+                "LDR     R2, [R4,#0x18]\n"
+                "ADD     R3, SP, #0x34\n"
+                "ADD     R6, SP, #0x14\n"
+                "STMIA   R6, {R0-R3}\n"
+                "LDR     R0, [SP,#0x24]\n"		//**
+                "LDR     R3, [R5,#0x5C]\n"
+                "LDR     R1, [SP,#0x28]\n"
+                "ADD     R2, SP, #0x38\n"
+                "ADD     R6, SP, #0x08\n"
+                "STMIA   R6, {R0,R2,R3}\n"
+                "STR     R1, [SP,#0x04]\n"
+                "STR     R12, [SP]\n"
+                "LDMIB   R4, {R0,R1}\n"
+                "LDR     R3, [SP,#0x30]\n"
+                "MOV     R2, LR\n"
+                "BL      sub_FF8FBD68\n"
+                "LDR     R0, [R5,#0x14]\n"
+                "MOV     R1, #0x3E8\n"
+				"BL      sub_FF81B98C\n"	//TakeSemaphore
+                "CMP     R0, #9\n"
+                "BNE     loc_FF85D0DC\n"
+                "BL      sub_FF941478\n"
+                "MOV     R0, #0x90000\n"
+                "STR     R9, [R5,#0x3C]\n"
+                "B       loc_FF85D0F4\n"
+"loc_FF85D0DC:\n"
+                "LDR     R0, [SP,#0x34]\n"
+                "CMP     R0, #0\n"
+                "BEQ     loc_FF85D0FC\n"
+                "BL      sub_FF941478\n"
+                "MOV     R0, #0xA0000\n"
+                "STR     R9, [R5,#0x3C]\n"
+"loc_FF85D0F4:\n"
+                "BL      sub_FF87347C\n" 	//HardwareDefect
+                "B       loc_FF85D028\n"
+"loc_FF85D0FC:\n"
+                "BL      sub_FF8FBE2C\n"
+                "LDR     R0, [SP,#0x30]\n"		//**
+                "LDR     R1, [SP,#0x38]\n"
+                "BL      sub_FF941220\n"
+                "LDR     R0, [R5,#0x50]\n"
+                "LDR     R1, =0x5748\n"
+                "ADD     R0, R0, #1\n"
+                "STR     R0, [R5,#0x50]\n"
+                "LDR     R0, [SP,#0x38]\n"
+                "MOV     R2, #0\n"
+                //BL      sub_FF93F040
+                "BL      sub_FF93F040_my\n"  // ----------------->
+"loc_FF85D128:\n"
+                "LDR     R0, [R5,#0x54]\n"
+                "ADD     R0, R0, #1\n"
+                "STR     R0, [R5,#0x54]\n"
+                "LDR     R1, [R5,#0x7C]\n"
+                "MUL     R0, R1, R0\n"
+                "LDR     R1, [R5,#0x78]\n"
+                "BL      sub_FFABECA8\n"
+                "MOV     R4, R0\n"
+                "BL      sub_FF9414B0\n"
+                "LDR     R1, [R5,#0x74]\n"
+                "CMP     R1, R4\n"
+                "BNE     loc_FF85D164\n"
+                "LDR     R0, [R5,#0x34]\n"
+                "CMP     R0, #1\n"
+                "BNE     loc_FF85D178\n"
+"loc_FF85D164:\n"
+                "LDR     R1, [R5,#0x88]\n"
+                "MOV     R0, R4\n"
+                //"BLX     R1\n"
+                ".long   0xE12FFF31\n"
+                "STR     R4, [R5,#0x74]\n"
+                "STR     R7, [R5,#0x34]\n"		//**
+"loc_FF85D178:\n"
+                "STR     R7, [R5,#0x30]\n"
+                "B       loc_FF85D028\n"
+ );
+} 
+
+//ok
+void __attribute__((naked,noinline)) sub_FF93F040_my(){   // 
+ asm volatile(
+                "STMFD   SP!, {R4-R8,LR}\n"
+                "LDR     R4, =0xE400\n"
+                "LDR     LR, [R4]\n"
+                "LDR     R2, [R4,#8]\n"
+                "CMP     LR, #0\n"
+                "LDRNE   R3, [R4,#0xC]\n"
+                "MOV     R5, R2\n"
+                "CMPNE   R3, #1\n"
+                "MOVEQ   R2, #0\n"
+                "STREQ   R0, [R4]\n"
+                "STREQ   R2, [R4,#0xC]\n"
+                "BEQ     loc_FF93F10C\n"
+                "LDR     R3, [R4,#4]\n"
+                "LDR     R7, =table\n"          // unk_FFADC8E8
+                "ADD     R12, R3, R3,LSL#1\n"
+                "LDR     R3, [R7,R12,LSL#2]\n"
+                "ADD     R6, R7, #0x60\n"
+                "LDR     R8, [R6,R12,LSL#2]\n"
+                "SUB     R3, LR, R3\n"
+                "CMP     R3, #0\n"
+                "SUB     LR, LR, R8\n"
+                "BLE     loc_FF93F0C8\n"
+                "ADD     R12, R7, R12,LSL#2\n"
+                "LDR     LR, [R12,#4]\n"
+                "CMP     LR, R3\n"
+                "ADDGE   R2, R2, #1\n"
+                "BGE     loc_FF93F0BC\n"
+                "LDR     R12, [R12,#8]\n"
+                "CMP     R12, R3\n"
+                "ADDLT   R2, R2, #3\n"
+                "ADDGE   R2, R2, #2\n"
+"loc_FF93F0BC:\n"
+    //          "CMP     R2, #0x17\n"   // -
+    //          "MOVGE   R2, #0x16\n"   // -
+                "CMP     R2, #0x1A\n"   // +
+                "MOVGE   R2, #0x19\n"   // +
+                "B       loc_FF93F0FC\n"
+"loc_FF93F0C8:\n"
+                "CMP     LR, #0\n"
+                "BGE     loc_FF93F0FC\n"
+                "ADD     R3, R6, R12,LSL#2\n"
+                "LDR     R12, [R3,#4]\n"
+                "CMP     R12, LR\n"
+                "SUBLE   R2, R2, #1\n"
+                "BLE     loc_FF93F0F4\n"
+                "LDR     R3, [R3,#8]\n"
+                "CMP     R3, LR\n"
+                "SUBGT   R2, R2, #3\n"
+                "SUBLE   R2, R2, #2\n"
+"loc_FF93F0F4:\n"
+                "CMP     R2, #0\n"
+                "MOVLT   R2, #0\n"
+"loc_FF93F0FC:\n"
+                "CMP     R2, R5\n"
+                "STRNE   R2, [R4,#8]\n"
+                "MOVNE   R2, #1\n"
+                "STRNE   R2, [R4,#0xC]\n"
+"loc_FF93F10C:\n"
+                "LDR     R2, =CompressionRateTable\n"  
+                "LDR     R3, [R4,#8]\n"
+                "LDR     R2, [R2,R3,LSL#2]\n"
+
+                "LDR     R3, =video_mode\n"      // +
+                "LDR     R3, [R3]\n"             // +
+                "LDR     R3, [R3]\n"             // +
+                "CMP     R3, #1\n"               // +
+                "LDREQ   R3, =video_quality\n"   // +     
+                "LDREQ   R3, [R3]\n"             // +     
+                "LDREQ   R2, [R3]\n"             // +     
+
+                "STR     R2, [R1]\n"
+                "STR     R0, [R4]\n"
+                "LDMFD   SP!, {R4-R8,PC}\n"
+ );
+} 
+
+
+//********
+
+
+#include "conf.h"
+
+int *video_quality = &conf.video_quality;
+int *video_mode    = &conf.video_mode;
+
+long def_table[48]={
+  0x2000,   0x38D,   0x788, 0x5800,  0x9C5,  0x14B8, 0x10000,  0x1C6A,  0x3C45, 0x20000,  0x387A,  0x7813,
+ 0x25800,  0x422F,  0x8CB6, 0x8000,  0xE35,  0x1E23, 0x10000,  0x1C6A,  0x3C45, 0x12C00,  0x2118,  0x465B,
+  0x1CCD,  -0x2E1,  -0x579, 0x4F33, -0x7EB,  -0xF0C,  0xE666, -0x170A, -0x2BC6, 0x1CC39, -0x2F5B, -0x59F0,
+ 0x21B53, -0x377F, -0x6965, 0x7333, -0xB85, -0x15E3,  0xE666, -0x170A, -0x2BC6, 0x10DAA, -0x1BC0, -0x34B3};
+
+long table[48];
+
+void change_video_tables(int a, int b){
+ int i;
+ for (i=0;i<48;i++) table[i]=(def_table[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};
Index: /branches/reyalp-ptp-live/platform/g9/sub/100g/stubs_auto.S
===================================================================
--- /branches/reyalp-ptp-live/platform/g9/sub/100g/stubs_auto.S	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/g9/sub/100g/stubs_auto.S	(revision 1668)
@@ -0,0 +1,471 @@
+/* THIS FILE IS GENERATED */
+/* DO NOT EDIT THIS FILE! */
+
+#include "stubs_asm.h"
+
+STUB(FF8101a4)
+STUB(FF81095C)
+STUB(FF810FB8)
+STUB(FF8114D0)
+STUB(FF812D70)
+STUB(FF81357C)
+STUB(FF8149E0)
+STUB(FF814ACC)
+STUB(FF814EB0)
+STUB(FF815088)
+STUB(FF81517C)
+STUB(FF8194D0)
+STUB(FF819948)
+STUB(FF81B98C)
+STUB(FF81BAF0)
+STUB(FF81BD80)
+STUB(FF81BDC8)
+STUB(FF81BDFC)
+STUB(FF81BE20)
+STUB(FF81BE44)
+STUB(FF81BF08)
+STUB(FF81BFC8)
+STUB(FF820E60)
+STUB(FF821FF8)
+STUB(FF82203C)
+STUB(FF822130)
+STUB(FF8224B0)
+STUB(FF8228D4)
+STUB(FF822DA8)
+STUB(FF822E10)
+STUB(FF823FA0)
+STUB(FF824504)
+STUB(FF824568)
+STUB(FF82457C)
+STUB(FF826210)
+STUB(FF82629C)
+STUB(FF8262FC)
+STUB(FF826548)
+STUB(FF826590)
+STUB(FF8268E8)
+STUB(FF826E78)
+STUB(FF826EB4)
+STUB(FF828D44)
+STUB(FF82911C)
+STUB(FF829154)
+STUB(FF829828)
+STUB(FF8298FC)
+STUB(FF8299CC)
+STUB(FF829C64)
+STUB(FF829D2C)
+STUB(FF829D60)
+STUB(FF829FB0)
+STUB(FF82A488)
+STUB(FF82A67C)
+STUB(FF82A6D0)
+STUB(FF82C6A8)
+STUB(FF82C8FC)
+STUB(FF82C9C4)
+STUB(FF82CADC)
+STUB(FF82CB2C)
+STUB(FF82CCA4)
+STUB(FF82CCA8)
+STUB(FF82CCC0)
+STUB(FF82CCF0)
+STUB(FF82CD04)
+STUB(FF82CDA8)
+STUB(FF82CDD0)
+STUB(FF82CE8C)
+STUB(FF82CEFC)
+STUB(FF82CF20)
+STUB(FF82D040)
+STUB(FF82D1B4)
+STUB(FF82D720)
+STUB(FF82D7A0)
+STUB(FF82D7A8)
+STUB(FF82D828)
+STUB(FF82D864)
+STUB(FF82D8A0)
+STUB(FF82D8C0)
+STUB(FF82D8CC)
+STUB(FF82D900)
+STUB(FF82DC00)
+STUB(FF82DC30)
+STUB(FF8331F4)
+STUB(FF8339B8)
+STUB(FF836954)
+STUB(FF83D8B4)
+STUB(FF83EEE0)
+STUB(FF84962C)
+STUB(FF84ACE4)
+STUB(FF84BE78)
+STUB(FF851B4C)
+STUB(FF851F2C)
+STUB(FF851F6C)
+STUB(FF852030)
+STUB(FF852198)
+STUB(FF852204)
+STUB(FF85235C)
+STUB(FF8528F4)
+STUB(FF852A0C)
+STUB(FF85B94C)
+STUB(FF85C44C)
+STUB(FF85C7C8)
+STUB(FF85C964)
+STUB(FF85CB08)
+STUB(FF85CCA8)
+STUB(FF85CF18)
+STUB(FF85D278)
+STUB(FF85D5C8)
+STUB(FF85D6E4)
+STUB(FF85D710)
+STUB(FF85E584)
+STUB(FF85E5B0)
+STUB(FF85E628)
+STUB(FF85F050)
+STUB(FF85F620)
+STUB(FF85FE5C)
+STUB(FF8601A0)
+STUB(FF860370)
+STUB(FF860584)
+STUB(FF86089C)
+STUB(FF860938)
+STUB(FF860BD0)
+STUB(FF860CEC)
+STUB(FF8614E8)
+STUB(FF8615D0)
+STUB(FF8627DC)
+STUB(FF86280C)
+STUB(FF862CA8)
+STUB(FF862D34)
+STUB(FF8631AC)
+STUB(FF86383C)
+STUB(FF86499C)
+STUB(FF864A14)
+STUB(FF864CFC)
+STUB(FF864D24)
+STUB(FF864EA8)
+STUB(FF86B420)
+STUB(FF86B538)
+STUB(FF86BA3C)
+STUB(FF86BAEC)
+STUB(FF86C4D0)
+STUB(FF86C610)
+STUB(FF86DA00)
+STUB(FF86F660)
+STUB(FF86F768)
+STUB(FF86F8F8)
+STUB(FF86FB0C)
+STUB(FF86FC18)
+STUB(FF86FCC4)
+STUB(FF86FFF8)
+STUB(FF870024)
+STUB(FF870768)
+STUB(FF8709DC)
+STUB(FF870F18)
+STUB(FF87118C)
+STUB(FF8711D8)
+STUB(FF872854)
+STUB(FF872EB8)
+STUB(FF8731F0)
+STUB(FF87347C)
+STUB(FF873B38)
+STUB(FF873C88)
+STUB(FF873C90)
+STUB(FF873C9C)
+STUB(FF873F90)
+STUB(FF873FB4)
+STUB(FF874024)
+STUB(FF8746F0)
+STUB(FF874770)
+STUB(FF8747AC)
+STUB(FF87486C)
+STUB(FF8748A0)
+STUB(FF8748E4)
+STUB(FF8749CC)
+STUB(FF874A74)
+STUB(FF874B90)
+STUB(FF874F60)
+STUB(FF874FDC)
+STUB(FF875078)
+STUB(FF875130)
+STUB(FF8751CC)
+STUB(FF87522C)
+STUB(FF875404)
+STUB(FF875648)
+STUB(FF8758BC)
+STUB(FF875A0C)
+STUB(FF875B14)
+STUB(FF875CC0)
+STUB(FF875E1C)
+STUB(FF875F98)
+STUB(FF876264)
+STUB(FF8763F4)
+STUB(FF876418)
+STUB(FF87643C)
+STUB(FF876460)
+STUB(FF8765BC)
+STUB(FF8765F8)
+STUB(FF87670C)
+STUB(FF87681C)
+STUB(FF876860)
+STUB(FF876890)
+STUB(FF8768C8)
+STUB(FF8769B0)
+STUB(FF876AF8)
+STUB(FF876BD8)
+STUB(FF876E4C)
+STUB(FF876E8C)
+STUB(FF876EF8)
+STUB(FF876F5C)
+STUB(FF8770A8)
+STUB(FF8771C4)
+STUB(FF8772D4)
+STUB(FF877310)
+STUB(FF87734C)
+STUB(FF87737C)
+STUB(FF8773E0)
+STUB(FF877670)
+STUB(FF8776E0)
+STUB(FF877B4C)
+STUB(FF877D84)
+STUB(FF877E68)
+STUB(FF877F94)
+STUB(FF877FEC)
+STUB(FF878018)
+STUB(FF8781CC)
+STUB(FF878204)
+STUB(FF878310)
+STUB(FF8788CC)
+STUB(FF8789D8)
+STUB(FF878A18)
+STUB(FF878AB0)
+STUB(FF878EEC)
+STUB(FF878F88)
+STUB(FF878FD4)
+STUB(FF879B00)
+STUB(FF879E74)
+STUB(FF879F0C)
+STUB(FF879FC4)
+STUB(FF87A0A4)
+STUB(FF87A18C)
+STUB(FF87A198)
+STUB(FF87A1A4)
+STUB(FF87A334)
+STUB(FF87A378)
+STUB(FF87A3A8)
+STUB(FF87A3D4)
+STUB(FF87A3FC)
+STUB(FF87A420)
+STUB(FF87A44C)
+STUB(FF87A500)
+STUB(FF87A5E0)
+STUB(FF87A5E4)
+STUB(FF87A6F4)
+STUB(FF87B1FC)
+STUB(FF87C4A0)
+STUB(FF87C994)
+STUB(FF87C9AC)
+STUB(FF87C9E4)
+STUB(FF87CC6C)
+STUB(FF87D29C)
+STUB(FF87D330)
+STUB(FF87D37C)
+STUB(FF87D3C4)
+STUB(FF87D3E8)
+STUB(FF87D444)
+STUB(FF87D508)
+STUB(FF87D688)
+STUB(FF87D9BC)
+STUB(FF87DA3C)
+STUB(FF87DA5C)
+STUB(FF87DC70)
+STUB(FF87DD8C)
+STUB(FF87DDE8)
+STUB(FF87DE60)
+STUB(FF87E1C0)
+STUB(FF87E1F4)
+STUB(FF87E200)
+STUB(FF87E264)
+STUB(FF87E27C)
+STUB(FF87E304)
+STUB(FF87E320)
+STUB(FF87E34C)
+STUB(FF87E36C)
+STUB(FF87E384)
+STUB(FF87E3A0)
+STUB(FF87E3D4)
+STUB(FF87E3F8)
+STUB(FF87E650)
+STUB(FF87E814)
+STUB(FF87E854)
+STUB(FF87E9A0)
+STUB(FF87FD60)
+STUB(FF87FD70)
+STUB(FF87FEEC)
+STUB(FF88045C)
+STUB(FF890150)
+STUB(FF893354)
+STUB(FF893614)
+STUB(FF894488)
+STUB(FF895AD0)
+STUB(FF897408)
+STUB(FF897664)
+STUB(FF897B9C)
+STUB(FF897C24)
+STUB(FF897EA4)
+STUB(FF8983E4)
+STUB(FF8ACA40)
+STUB(FF8B56C0)
+STUB(FF8B57CC)
+STUB(FF8B5824)
+STUB(FF8B587C)
+STUB(FF8B58D4)
+STUB(FF8B592C)
+STUB(FF8B5A6C)
+STUB(FF8B5B24)
+STUB(FF8B5DAC)
+STUB(FF8B5FB0)
+STUB(FF8B6218)
+STUB(FF8B640C)
+STUB(FF8B6670)
+STUB(FF8B67AC)
+STUB(FF8B6A04)
+STUB(FF8B6C40)
+STUB(FF8B6F3C)
+STUB(FF8B7040)
+STUB(FF8B7274)
+STUB(FF8B73EC)
+STUB(FF8B7584)
+STUB(FF8B76BC)
+STUB(FF8B7904)
+STUB(FF8B888C)
+STUB(FF8B8AE0)
+STUB(FF8B8B40)
+STUB(FF8B9E70)
+STUB(FF8B9EA0)
+STUB(FF8B9EE4)
+STUB(FF8BA060)
+STUB(FF8BA10C)
+STUB(FF8BA1AC)
+STUB(FF8BA244)
+STUB(FF8BD498)
+STUB(FF8CF8C0)
+STUB(FF8FBD68)
+STUB(FF8FBE2C)
+STUB(FF90B9A8)
+STUB(FF90BA50)
+STUB(FF90BD78)
+STUB(FF9184FC)
+STUB(FF918954)
+STUB(FF9290B0)
+STUB(FF9362DC)
+STUB(FF93637C)
+STUB(FF936408)
+STUB(FF936550)
+STUB(FF936A9C)
+STUB(FF93F040)
+STUB(FF9400CC)
+STUB(FF940D08)
+STUB(FF940E9C)
+STUB(FF941220)
+STUB(FF941478)
+STUB(FF9414B0)
+STUB(FF942180)
+STUB(FF942418)
+STUB(FF942420)
+STUB(FF942428)
+STUB(FF942484)
+STUB(FF942574)
+STUB(FF942600)
+STUB(FF942684)
+STUB(FF942820)
+STUB(FF9428D4)
+STUB(FF942928)
+STUB(FF942998)
+STUB(FF942B90)
+STUB(FF942FB8)
+STUB(FF943230)
+STUB(FF94342C)
+STUB(FF9434C0)
+STUB(FF9435E8)
+STUB(FF94369C)
+STUB(FF943908)
+STUB(FF943914)
+STUB(FF9439D8)
+STUB(FF943A70)
+STUB(FF943AC0)
+STUB(FF943B24)
+STUB(FF943C64)
+STUB(FF943CF8)
+STUB(FF943DB8)
+STUB(FF943F20)
+STUB(FF944390)
+STUB(FF944478)
+STUB(FF94450C)
+STUB(FF944924)
+STUB(FF944984)
+STUB(FF944ED0)
+STUB(FF944FEC)
+STUB(FF94503C)
+STUB(FF945530)
+STUB(FF950E28)
+STUB(FF951498)
+STUB(FF951628)
+STUB(FF9523F4)
+STUB(FF952920)
+STUB(FF955D94)
+STUB(FF957BD0)
+STUB(FF957C48)
+STUB(FF9583D0)
+STUB(FF958544)
+STUB(FF95BCE8)
+STUB(FF95BE2C)
+STUB(FF95BE8C)
+STUB(FF95D0F8)
+STUB(FF95D108)
+STUB(FF95D114)
+STUB(FF95D140)
+STUB(FF95D2F0)
+STUB(FF95D330)
+STUB(FF95D334)
+STUB(FF95DE84)
+STUB(FF95DF58)
+STUB(FF95E534)
+STUB(FF95E5FC)
+STUB(FF95F258)
+STUB(FF95FAD8)
+STUB(FF95FCA0)
+STUB(FF95FD18)
+STUB(FF9603F8)
+STUB(FF960594)
+STUB(FF9605DC)
+STUB(FF961F64)
+STUB(FF962190)
+STUB(FF96224C)
+STUB(FF962648)
+STUB(FF963780)
+STUB(FF9638B8)
+STUB(FF96B2EC)
+STUB(FF96B7E8)
+STUB(FF96BC00)
+STUB(FF96BDCC)
+STUB(FF96C37C)
+STUB(FF96C950)
+STUB(FF96DC0C)
+STUB(FF96E5F0)
+STUB(FF96ECA8)
+STUB(FF96F020)
+STUB(FF96F128)
+STUB(FF96F5A4)
+STUB(FF96FDC8)
+STUB(FF970F88)
+STUB(FF9712CC)
+STUB(FF971DD0)
+STUB(FF971E7C)
+STUB(FF99B540)
+STUB(FF9A7254)
+STUB(FF9A913C)
+STUB(FF9ABF9C)
+STUB(FF9ABFBC)
+STUB(FF9BDBE4)
+STUB(FF9BDC58)
+STUB(FF9BF09C)
+STUB(FFABD19C)
+STUB(FFABD3F8)
+STUB(FFABECA8)
Index: /branches/reyalp-ptp-live/platform/g9/sub/100g/Makefile
===================================================================
--- /branches/reyalp-ptp-live/platform/g9/sub/100g/Makefile	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/g9/sub/100g/Makefile	(revision 1668)
@@ -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/reyalp-ptp-live/platform/g9/sub/100i/capt_seq.c
===================================================================
--- /branches/reyalp-ptp-live/platform/g9/sub/100i/capt_seq.c	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/g9/sub/100i/capt_seq.c	(revision 1668)
@@ -0,0 +1,1009 @@
+#include "lolevel.h"
+#include "platform.h"
+#include "core.h"
+
+static long *nrflag = (long*)0xE618;
+
+#include "../../../generic/capt_seq.c"
+
+void __attribute__((naked,noinline)) capt_seq_task() {
+ asm volatile (
+                "STMFD   SP!, {R3-R9,LR}\n"
+                "LDR     R6, =0x1E454\n"
+                "LDR     R5, =0x583C\n"
+                "MOV     R9, #1\n"
+                "MOV     R7, #0\n"
+"loc_FF861224:\n"
+                "LDR     R0, [R5,#0x14]\n"
+                "MOV     R2, #0\n"
+                "MOV     R1, SP\n"
+                "BL      sub_FF829FB0\n"
+                "TST     R0, #1\n"
+                "BEQ     loc_FF861250\n"
+                "LDR     R1, =0x43F\n"
+                "LDR     R0, =0xFF860C6C\n"
+                "BL      sub_FF81BFC8\n"
+                "BL      sub_FF81BD80\n"
+                "LDMFD   SP!, {R3-R9,PC}\n"
+"loc_FF861250:\n"
+                "LDR     R0, [SP]\n"
+                "LDR     R1, [R0]\n"
+                "CMP     R1, #0x1C\n"
+                "ADDLS   PC, PC, R1,LSL#2\n"
+                "B       loc_FF8614AC\n"
+"loc_FF861264:\n"
+                "B       loc_FF8612D8\n"
+"loc_FF861268:\n"
+                "B       loc_FF861348\n"
+"loc_FF86126C:\n"
+                "B       loc_FF861350\n"
+"loc_FF861270:\n"
+                "B       loc_FF861368\n"
+"loc_FF861274:\n"
+                "B       loc_FF86135C\n"
+"loc_FF861278:\n"
+                "B       loc_FF861370\n"
+"loc_FF86127C:\n"
+                "B       loc_FF861378\n"
+"loc_FF861280:\n"
+                "B       loc_FF861380\n"
+"loc_FF861284:\n"
+                "B       loc_FF8613D8\n"
+"loc_FF861288:\n"
+                "B       loc_FF8613E4\n"
+"loc_FF86128C:\n"
+                "B       loc_FF8613EC\n"
+"loc_FF861290:\n"
+                "B       loc_FF8613F4\n"
+"loc_FF861294:\n"
+                "B       loc_FF8613FC\n"
+"loc_FF861298:\n"
+                "B       loc_FF861404\n"
+"loc_FF86129C:\n"
+                "B       loc_FF86140C\n"
+"loc_FF8612A0:\n"
+                "B       loc_FF861414\n"
+"loc_FF8612A4:\n"
+                "B       loc_FF86141C\n"
+"loc_FF8612A8:\n"
+                "B       loc_FF861424\n"
+"loc_FF8612AC:\n"
+                "B       loc_FF86142C\n"
+"loc_FF8612B0:\n"
+                "B       loc_FF861434\n"
+"loc_FF8612B4:\n"
+                "B       loc_FF86143C\n"
+"loc_FF8612B8:\n"
+                "B       loc_FF861444\n"
+"loc_FF8612BC:\n"
+                "B       loc_FF861450\n"
+"loc_FF8612C0:\n"
+                "B       loc_FF86145C\n"
+"loc_FF8612C4:\n"
+                "B       loc_FF861464\n"
+"loc_FF8612C8:\n"
+                "B       loc_FF861494\n"
+"loc_FF8612CC:\n"
+                "B       loc_FF86149C\n"
+"loc_FF8612D0:\n"
+                "B       loc_FF8614A4\n"
+"loc_FF8612D4:\n"
+                "B       loc_FF8614B8\n"
+"loc_FF8612D8:\n"
+                "BL      sub_FF942490\n"
+                "BL      shooting_expo_param_override\n"  // +
+                "BL      sub_FF85F050\n"
+                "LDR     R0, [R6,#0x24]\n"
+                "CMP     R0, #0\n"
+                "BEQ     loc_FF8614B8\n"
+                "BL      sub_FF860938\n"
+                "MOV     R4, R0\n"
+                "LDR     R0, [R6,#0x24]\n"
+                "CMP     R0, #0\n"
+                "BEQ     loc_FF861320\n"
+                "MOV     R0, #0xC\n"
+                "BL      sub_FF86499C\n"
+                "TST     R0, #1\n"
+                "STRNE   R9, [R5,#4]\n"
+                "LDRNE   R0, [R4,#8]\n"
+                "ORRNE   R0, R0, #0x40000000\n"
+                "STRNE   R0, [R4,#8]\n"
+                "BNE     loc_FF8614B8\n"
+"loc_FF861320:\n"
+                "MOV     R0, R4\n"
+                "BL      sub_FF943F2C\n"
+                "BL      sub_FF957C54\n"
+                "BL      sub_FF86F8F8\n"
+                "STR     R0, [R4,#0x14]\n"
+                "MOV     R0, R4\n"
+                "BL      sub_FF944484_my\n"             //-------->
+                "BL      capt_seq_hook_raw_here\n"      // +
+                "TST     R0, #1\n"
+                "STRNE   R9, [R5,#4]\n"
+                "B       loc_FF8614B8\n"
+"loc_FF861348:\n"
+                "BL      sub_FF860CEC_my\n"            //-------->
+                "B       loc_FF861360\n"
+"loc_FF861350:\n"
+                "MOV     R0, #1\n"
+                "BL      sub_FF942690\n"
+                "B       loc_FF8614B8\n"
+"loc_FF86135C:\n"
+                "BL      sub_FF94218C\n"
+"loc_FF861360:\n"
+                "STR     R7, [R6,#0x24]\n"
+                "B       loc_FF8614B8\n"
+"loc_FF861368:\n"
+                "BL      sub_FF942424\n"
+                "B       loc_FF861360\n"
+"loc_FF861370:\n"
+                "BL      sub_FF94242C\n"
+                "B       loc_FF8614B8\n"
+"loc_FF861378:\n"
+                "BL      sub_FF942580\n"
+                "B       loc_FF8613DC\n"
+"loc_FF861380:\n"
+                "LDR     R4, [R0,#0xC]\n"
+                "BL      sub_FF942434\n"
+                "MOV     R0, R4\n"
+                "BL      sub_FF942FC4\n"
+                "TST     R0, #1\n"
+                "MOV     R8, R0\n"
+                "BNE     loc_FF8613C0\n"
+                "BL      sub_FF86F8F8\n"
+                "STR     R0, [R4,#0x14]\n"
+                "MOV     R0, R4\n"
+                "BL      sub_FF94439C\n"
+                "MOV     R0, R4\n"
+                "BL      sub_FF944990\n"
+                "MOV     R8, R0\n"
+                "LDR     R0, [R4,#0x14]\n"
+                "BL      sub_FF86FB0C\n"
+"loc_FF8613C0:\n"
+                "BL      sub_FF942424\n"
+                "MOV     R2, R4\n"
+                "MOV     R1, #8\n"
+                "MOV     R0, R8\n"
+                "BL      sub_FF85F620\n"
+                "B       loc_FF8614B8\n"
+"loc_FF8613D8:\n"
+                "BL      sub_FF94260C\n"
+"loc_FF8613DC:\n"
+                "BL      sub_FF85F050\n"
+                "B       loc_FF8614B8\n"
+"loc_FF8613E4:\n"
+                "BL      sub_FF942424\n"
+                "B       loc_FF8614B8\n"
+"loc_FF8613EC:\n"
+                "BL      sub_FF94323C\n"
+                "B       loc_FF8614B8\n"
+"loc_FF8613F4:\n"
+                "BL      sub_FF943438\n"
+                "B       loc_FF8614B8\n"
+"loc_FF8613FC:\n"
+                "BL      sub_FF9434CC\n"
+                "B       loc_FF8614B8\n"
+"loc_FF861404:\n"
+                "BL      sub_FF9435F4\n"
+                "B       loc_FF8614B8\n"
+"loc_FF86140C:\n"
+                "BL      sub_FF9436A8\n"
+                "B       loc_FF8614B8\n"
+"loc_FF861414:\n"
+                "BL      sub_FF943A7C\n"
+                "B       loc_FF8614B8\n"
+"loc_FF86141C:\n"
+                "BL      sub_FF943ACC\n"
+                "B       loc_FF8614B8\n"
+"loc_FF861424:\n"
+                "MOV     R0, #0\n"
+                "B       loc_FF861448\n"
+"loc_FF86142C:\n"
+                "BL      sub_FF943C70\n"
+                "B       loc_FF8614B8\n"
+"loc_FF861434:\n"
+                "BL      sub_FF943D04\n"
+                "B       loc_FF8614B8\n"
+"loc_FF86143C:\n"
+                "BL      sub_FF943DC4\n"
+                "B       loc_FF8614B8\n"
+"loc_FF861444:\n"
+                "MOV     R0, #1\n"
+"loc_FF861448:\n"
+                "BL      sub_FF943B30\n"
+                "B       loc_FF8614B8\n"
+"loc_FF861450:\n"
+                "BL      sub_FF94282C\n"
+                "BL      sub_FF8615D0\n"
+                "B       loc_FF8614B8\n"
+"loc_FF86145C:\n"
+                "BL      sub_FF943920\n"
+                "B       loc_FF8614B8\n"
+"loc_FF861464:\n"
+                "MOV     R2, #2\n"
+                "ADD     R1, R6, #0x58\n"
+                "MOV     R0, #0x6F\n"
+                "BL      sub_FF86F768\n"
+                "TST     R0, #1\n"
+                "LDRNE   R1, =0x502\n"
+                "LDRNE   R0, =0xFF860C6C\n"
+                "BLNE    sub_FF81BFC8\n"
+                "LDRH    R0, [R6,#0x58]\n"
+                "CMP     R0, #1\n"
+                "BLEQ    sub_FF943914\n"
+                "B       loc_FF8614B8\n"
+"loc_FF861494:\n"
+                "BL      sub_FF9439E4\n"
+                "B       loc_FF8614B8\n"
+"loc_FF86149C:\n"
+                "BL      sub_FF860BD0\n"
+                "B       loc_FF8614B8\n"
+"loc_FF8614A4:\n"
+                "BL      sub_FF826210\n"
+                "B       loc_FF8614B8\n"
+"loc_FF8614AC:\n"
+                "LDR     R1, =0x523\n"
+                "LDR     R0, =0xFF860C6C\n"
+                "BL      sub_FF81BFC8\n"
+"loc_FF8614B8:\n"
+                "LDR     R0, [SP]\n"
+                "LDR     R1, [R0,#4]\n"
+                "LDR     R0, [R5,#0x10]\n"
+                "BL      sub_FF829D2C\n"
+                "LDR     R4, [SP]\n"
+                "LDR     R0, [R4,#8]\n"
+                "CMP     R0, #0\n"
+                "LDREQ   R0, =0xFF860C6C\n"
+                "MOVEQ   R1, #0xFC\n"
+                "BLEQ    sub_FF81BFC8\n"
+                "STR     R7, [R4,#8]\n"
+                "B       loc_FF861224\n"
+ );
+} 
+
+
+//ok
+void __attribute__((naked,noinline)) sub_FF860CEC_my(){ // 
+ asm volatile(
+                "STMFD   SP!, {R3-R9,LR}\n"
+                "LDR     R4, [R0,#0xC]\n"
+                "LDR     R5, =0x1E454\n"
+                "LDR     R0, [R4,#8]\n"
+                "LDR     R6, =0x820A\n"
+                "ORR     R0, R0, #1\n"
+                "STR     R0, [R4,#8]\n"
+                "LDRH    R0, [R5]\n"
+                "LDR     R8, =0x583C\n"
+                "MOV     R7, #0\n"
+                "CMP     R0, R6\n"
+                "BEQ     loc_FF860D90\n"
+                "LDRH    R0, [R5,#0x86]\n"
+                "CMP     R0, #3\n"
+                "BEQ     loc_FF860DF0\n"
+                "LDR     R0, [R4,#0xC]\n"
+                "CMP     R0, #1\n"
+                "BLS     loc_FF860D9C\n"
+                "LDRH    R0, [R5,#0x84]\n"
+                "CMP     R0, #0\n"
+                "BNE     loc_FF860DF0\n"
+                "LDRH    R0, [R5,#0x80]\n"
+                "CMP     R0, #2\n"
+                "BNE     loc_FF860DA8\n"
+                "BL      sub_FF9428E0\n"
+                "LDRH    R0, [R5]\n"
+                "CMP     R0, R6\n"
+                "BEQ     loc_FF860D90\n"
+                "LDRH    R0, [R5,#0x86]\n"
+                "CMP     R0, #3\n"
+                "BEQ     loc_FF860DF0\n"
+                "LDR     R0, [R4,#0xC]\n"
+                "CMP     R0, #1\n"
+                "BLS     loc_FF860D9C\n"
+                "LDRH    R0, [R5,#0x84]\n"
+                "CMP     R0, #0\n"
+                "BNE     loc_FF860DF0\n"
+                "LDRH    R0, [R5,#0x80]\n"
+                "CMP     R0, #2\n"
+                "BEQ     loc_FF860DD4\n"
+                "B       loc_FF860DA8\n"
+"loc_FF860D90:\n"
+                "LDRH    R0, [R5,#0x86]\n"
+                "CMP     R0, #3\n"
+                "BEQ     loc_FF860DF0\n"
+"loc_FF860D9C:\n"
+                "LDRH    R0, [R5,#0x84]\n"
+                "CMP     R0, #0\n"
+                "BNE     loc_FF860DF0\n"
+"loc_FF860DA8:\n"
+                "LDRH    R0, [R5,#0x80]\n"
+                "CMP     R0, #1\n"
+                "BNE     loc_FF860DF0\n"
+                "LDRH    R0, [R5]\n"
+                "CMP     R0, R6\n"
+                "LDRNE   R0, [R4,#0xC]\n"
+                "CMPNE   R0, #1\n"
+                "BLS     loc_FF860DF0\n"
+                "LDR     R0, [R4,#0x10]\n"
+                "CMP     R0, #1\n"
+                "BNE     loc_FF860DF0\n"
+"loc_FF860DD4:\n"
+                "LDR     R3, =0x20D\n"
+                "LDR     R2, =0xEA60\n"
+                "STR     R3, [SP]\n"
+                "LDR     R0, [R8,#0x10]\n"
+                "LDR     R3, =0xFF860C6C\n"
+                "MOV     R1, #0x40000000\n"
+                "BL      sub_FF864D24\n"
+"loc_FF860DF0:\n"
+                "BL      sub_FF860BD0\n"
+                "LDR     R0, [R5,#0x24]\n"
+                "CMP     R0, #0\n"
+                "MOVEQ   R0, #2\n"
+                "BLEQ    sub_FF85B94C\n"
+                "BL      sub_FF942434\n"
+                "LDR     R0, [R5,#0x24]\n"
+                "CMP     R0, #0\n"
+                "BNE     loc_FF860E60\n"
+                "MOV     R0, R4\n"
+                "BL      sub_FF943F2C\n"
+                "MOV     R0, R4\n"
+                "BL      sub_FF942B9C\n"
+                "TST     R0, #1\n"
+                "MOVNE   R2, R4\n"
+                "LDMNEFD SP!, {R3-R9,LR}\n"
+                "MOVNE   R1, #1\n"
+                "BNE     sub_FF85F620\n"
+                "BL      sub_FF957C54\n"
+                "BL      sub_FF86F8F8\n"
+                "STR     R0, [R4,#0x14]\n"
+                "MOV     R0, R4\n"
+                "BL      sub_FF94439C\n"
+                "BL      sub_FF944EDC\n"
+                "MOV     R0, R4\n"
+                "BL      sub_FF944484_my\n"         //------------->
+                "MOV     R7, R0\n"
+                "BL      capt_seq_hook_raw_here\n"  // +
+                "B       loc_FF860E6C\n"
+"loc_FF860E60:\n"
+                "LDR     R0, [R8,#4]\n"
+                "CMP     R0, #0\n"
+                "MOVNE   R7, #0x1D\n"
+"loc_FF860E6C:\n"
+                "MOV     R2, R4\n"
+                "MOV     R1, #1\n"
+                "MOV     R0, R7\n"
+                "BL      sub_FF85F620\n"
+                "BL      sub_FF944930\n"
+                "CMP     R0, #0\n"
+                "LDRNE   R0, [R4,#8]\n"
+                "ORRNE   R0, R0, #0x2000\n"
+                "STRNE   R0, [R4,#8]\n"
+                "LDRH    R0, [R5,#0x86]\n"
+                "CMP     R0, #3\n"
+                "BEQ     loc_FF860EB8\n"
+                "LDRH    R0, [R5,#0x84]\n"
+                "CMP     R0, #0\n"
+                "LDREQH  R0, [R5,#0x80]\n"
+                "CMPEQ   R0, #2\n"
+                "MOVEQ   R0, R4\n"
+                "LDMEQFD SP!, {R3-R9,LR}\n"
+                "BEQ     sub_FF942934\n"
+"loc_FF860EB8:\n"
+                "LDMFD   SP!, {R3-R9,PC}\n"
+ );
+}
+
+
+
+void __attribute__((naked,noinline)) sub_FF944484_my(){ // 
+ asm volatile(
+                 "STMFD   SP!, {R0-R10,LR}\n"
+                 "MOV     R6, #0\n"
+                 "MOV     R4, R0\n"
+                 "BL      sub_FF945048\n"
+                 "MVN     R1, #0\n"
+                 "BL      sub_FF829D60\n"
+                 "MOV     R2, #4\n"
+                 "ADD     R1, SP, #8\n"
+                 "MOV     R0, #0x8A\n"
+                 "BL      sub_FF86F768\n"
+                 "TST     R0, #1\n"
+                 "LDRNE   R1, =0x20A\n"
+                 "LDRNE   R0, =0xFF94468C\n"
+                 "BLNE    sub_FF81BFC8\n"
+                 "LDR     R8, =0x1E508\n"
+                 "LDR     R5, =0x1E454\n"
+                 "LDRSH   R1, [R8,#0xE]\n"
+                 "LDR     R0, [R5,#0x7C]\n"
+         //      "BL      nullsub_48\n"
+                 "BL      sub_FF84BE78\n"
+                 "LDR     R2, =0xE61C\n"
+                 "ADD     R3, R4, #0x8C\n"
+                 "STRH    R0, [R4,#0x88]\n"
+                 "STRD    R2, [SP]\n"
+                 "MOV     R1, R0\n"
+                 "LDRH    R0, [R5,#0x54]\n"
+                 "LDRSH   R2, [R8,#0xC]\n"
+                 "LDR     R3, =0xE618\n"
+                 "BL      sub_FF94553C\n"
+                 "BL      wait_until_remote_button_is_released\n"  // +
+                 "BL      capt_seq_hook_set_nr\n"                  // +              
+                 "B       sub_FF9444F8\n"
+ );
+}
+
+void __attribute__((naked,noinline)) exp_drv_task(){
+ asm volatile(
+"                STMFD   SP!, {R4-R8,LR}\n"
+"                SUB     SP, SP, #0x20\n"
+"                LDR     R8, =0xBB8\n"
+"                LDR     R7, =0x7270\n"
+"                LDR     R5, =0x462E8\n"
+"                MOV     R0, #0\n"
+"                ADD     R6, SP, #0x10\n"
+"                STR     R0, [SP,#0xC]\n"
+"loc_FF8B8BB0:\n"
+"                LDR     R0, [R7,#0x20]\n"
+"                MOV     R2, #0\n"
+"                ADD     R1, SP, #0x1C\n"
+"                BL      sub_FF829FB0\n" // KerQueue.c 0
+"                LDR     R0, [SP,#0xC]\n"
+"                CMP     R0, #1\n"
+"                BNE     loc_FF8B8BF8\n"
+"                LDR     R0, [SP,#0x1C]\n"
+"                LDR     R0, [R0]\n"
+"                CMP     R0, #0x13\n"
+"                CMPNE   R0, #0x14\n"
+"                CMPNE   R0, #0x15\n"
+"                BEQ     loc_FF8B8D78\n"
+"                CMP     R0, #0x26\n"
+"                BEQ     loc_FF8B8CE4\n"
+"                ADD     R1, SP, #0xC\n"
+"                MOV     R0, #0\n"
+"                BL      sub_FF8B8B40\n" // ExpDrv.c 512
+"loc_FF8B8BF8:\n"
+"                LDR     R0, [SP,#0x1C]\n"
+"                LDR     R1, [R0]\n"
+"                CMP     R1, #0x2B\n"
+"                BNE     loc_FF8B8C28\n"
+"                LDR     R0, [SP,#0x1C]\n"
+"                BL      sub_FF8B9E70\n" // ExpDrv.c 0
+"                LDR     R0, [R7,#0x1C]\n"
+"                MOV     R1, #1\n"
+"                BL      sub_FF829D2C\n"
+"                BL      sub_FF81BD80\n"
+"                ADD     SP, SP, #0x20\n"
+"                LDMFD   SP!, {R4-R8,PC}\n"
+"loc_FF8B8C28:\n"
+"                CMP     R1, #0x2A\n"
+"                BNE     loc_FF8B8C44\n"
+"                LDR     R2, [R0,#0x88]!\n"
+"                LDR     R1, [R0,#4]\n"
+"                MOV     R0, R1\n"
+"                BLX     R2\n"
+"                B       loc_FF8B91DC\n"
+"loc_FF8B8C44:\n"
+"                CMP     R1, #0x24\n"
+"                BNE     loc_FF8B8C94\n"
+"                LDR     R0, [R7,#0x1C]\n"
+"                MOV     R1, #0x80\n"
+"                BL      sub_FF829D60\n"
+"                LDR     R0, =0xFF8B562C\n"
+"                MOV     R1, #0x80\n"
+"                BL      sub_FF9362E8\n" // IrisController.c 104 done
+"                LDR     R0, [R7,#0x1C]\n"
+"                MOV     R2, R8\n"
+"                MOV     R1, #0x80\n"
+"                BL      sub_FF829C64\n" // KerFlag.c 0
+"                TST     R0, #1\n"
+"                LDRNE   R1, =0xD07\n"
+"                BNE     loc_FF8B8D54\n"
+"loc_FF8B8C80:\n"
+"                LDR     R1, [SP,#0x1C]\n"
+"                LDR     R0, [R1,#0x8C]\n"
+"                LDR     R1, [R1,#0x88]\n"
+"                BLX     R1\n"
+"                B       loc_FF8B91DC\n"
+"loc_FF8B8C94:\n"
+"                CMP     R1, #0x25\n"
+"                BNE     loc_FF8B8CDC\n"
+"                ADD     R1, SP, #0xC\n"
+"                BL      sub_FF8B8B40\n" // ExpDrv.c 512
+"                LDR     R0, [R7,#0x1C]\n"
+"                MOV     R1, #0x100\n"
+"                BL      sub_FF829D60\n"
+"                MOV     R1, #0x100\n"
+"                LDR     R0, =0xFF8B563C\n"
+"                BL      sub_FF936AA8\n" // IrisController.c 0 done
+"                LDR     R0, [R7,#0x1C]\n"
+"                MOV     R2, R8\n"
+"                MOV     R1, #0x100\n"
+"                BL      sub_FF829C64\n" // KerFlag.c 0
+"                TST     R0, #1\n"
+"                BEQ     loc_FF8B8C80\n"
+"                LDR     R1, =0xD11\n"
+"                B       loc_FF8B8D54\n"
+"loc_FF8B8CDC:\n"
+"                CMP     R1, #0x26\n"
+"                BNE     loc_FF8B8CF4\n"
+"loc_FF8B8CE4:\n"
+"                LDR     R0, [SP,#0x1C]\n"
+"                ADD     R1, SP, #0xC\n"
+"                BL      sub_FF8B8B40\n" // ExpDrv.c 512
+"                B       loc_FF8B8C80\n"
+"loc_FF8B8CF4:\n"
+"                CMP     R1, #0x27\n"
+"                CMPNE   R1, #0x28\n"
+"                BNE     loc_FF8B8D60\n"
+"                ADD     R1, SP, #0xC\n"
+"                BL      sub_FF8B8B40\n" // ExpDrv.c 512
+"                LDR     R4, [SP,#0x1C]\n"
+"                LDR     R0, [R7,#0x1C]\n"
+"                MOV     R1, #0x40\n"
+"                BL      sub_FF829D60\n"
+"                LDR     R0, [R4]\n"
+"                MOV     R1, #0x40\n"
+"                CMP     R0, #0x27\n"
+"                LDR     R0, =0xFF8B56A0\n"
+"                BNE     loc_FF8B8D34\n"
+"                BL      sub_FF936388\n" // IrisController.c 125 done
+"                B       loc_FF8B8D38\n"
+"loc_FF8B8D34:\n"
+"                BL      sub_FF936414\n" // IrisController.c 143 done
+"loc_FF8B8D38:\n"
+"                LDR     R0, [R7,#0x1C]\n"
+"                MOV     R2, R8\n"
+"                MOV     R1, #0x40\n"
+"                BL      sub_FF829C64\n" // KerFlag.c 0
+"                TST     R0, #1\n"
+"                BEQ     loc_FF8B8C80\n"
+"                LDR     R1, =0xD1F\n"
+"loc_FF8B8D54:\n"
+"                LDR     R0, =0xFF8B5D3C\n"
+"                BL      sub_FF81BFC8\n"
+"                B       loc_FF8B8C80\n"
+"loc_FF8B8D60:\n"
+"                CMP     R1, #0x29\n"
+"                BNE     loc_FF8B8D78\n"
+"                BL      sub_FF897664\n" // Shutter.c 2
+"                BL      sub_FF8983E4\n" // ImgPixel.c 292
+"                BL      sub_FF897EA4\n" // ImgGain.c 0
+"                B       loc_FF8B8C80\n"
+"loc_FF8B8D78:\n"
+"                LDR     R0, [SP,#0x1C]\n"
+"                MOV     R4, #1\n"
+"                LDR     R1, [R0]\n"
+"                CMP     R1, #0x11\n"
+"                CMPNE   R1, #0x12\n"
+"                BNE     loc_FF8B8DE8\n"
+"                LDR     R1, [R0,#0x7C]\n"
+"                ADD     R1, R1, R1,LSL#1\n"
+"                ADD     R1, R0, R1,LSL#2\n"
+"                SUB     R1, R1, #8\n"
+"                LDMIA   R1, {R2-R4}\n"
+"                STMIA   R6, {R2-R4}\n"
+"                BL      sub_FF8B76BC\n" // ExpDrv.c 2
+"                LDR     R0, [SP,#0x1C]\n"
+"                LDR     R1, [R0,#0x7C]\n"
+"                LDR     R3, [R0,#0x88]\n"
+"                LDR     R2, [R0,#0x8C]\n"
+"                ADD     R0, R0, #4\n"
+"                BLX     R3\n"
+"                LDR     R0, [SP,#0x1C]\n"
+"                BL      sub_FF8BA244\n" // ExpDrv.c 4
+"                LDR     R0, [SP,#0x1C]\n"
+"                LDR     R1, [R0,#0x7C]\n"
+"                LDR     R3, [R0,#0x90]\n"
+"                LDR     R2, [R0,#0x94]\n"
+"                ADD     R0, R0, #4\n"
+"                BLX     R3\n"
+"                B       loc_FF8B911C\n"
+"loc_FF8B8DE8:\n"
+"                CMP     R1, #0x13\n"
+"                CMPNE   R1, #0x14\n"
+"                CMPNE   R1, #0x15\n"
+"                BNE     loc_FF8B8E9C\n"
+"                ADD     R3, SP, #0xC\n"
+"                MOV     R2, SP\n"
+"                ADD     R1, SP, #0x10\n"
+"                BL      sub_FF8B7904\n" // ExpDrv.c 4
+"                CMP     R0, #1\n"
+"                MOV     R4, R0\n"
+"                CMPNE   R4, #5\n"
+"                BNE     loc_FF8B8E38\n"
+"                LDR     R0, [SP,#0x1C]\n"
+"                MOV     R2, R4\n"
+"                LDR     R1, [R0,#0x7C]!\n"
+"                LDR     R12, [R0,#0xC]!\n"
+"                LDR     R3, [R0,#4]\n"
+"                MOV     R0, SP\n"
+"                BLX     R12\n"
+"                B       loc_FF8B8E70\n"
+"loc_FF8B8E38:\n"
+"                LDR     R0, [SP,#0x1C]\n"
+"                CMP     R4, #2\n"
+"                LDR     R3, [R0,#0x8C]\n"
+"                CMPNE   R4, #6\n"
+"                BNE     loc_FF8B8E84\n"
+"                LDR     R12, [R0,#0x88]\n"
+"                MOV     R0, SP\n"
+"                MOV     R2, R4\n"
+"                MOV     R1, #1\n"
+"                BLX     R12\n"
+"                LDR     R0, [SP,#0x1C]\n"
+"                MOV     R2, SP\n"
+"                ADD     R1, SP, #0x10\n"
+"                BL      sub_FF8B888C\n" // ExpDrv.c 4
+"loc_FF8B8E70:\n"
+"                LDR     R0, [SP,#0x1C]\n"
+"                LDR     R2, [SP,#0xC]\n"
+"                MOV     R1, R4\n"
+"                BL      sub_FF8B8AE0\n" // ExpDrv.c 2
+"                B       loc_FF8B911C\n"
+"loc_FF8B8E84:\n"
+"                LDR     R1, [R0,#0x7C]\n"
+"                LDR     R12, [R0,#0x88]\n"
+"                ADD     R0, R0, #4\n"
+"                MOV     R2, R4\n"
+"                BLX     R12\n"
+"                B       loc_FF8B911C\n"
+"loc_FF8B8E9C:\n"
+"                CMP     R1, #0x20\n"
+"                CMPNE   R1, #0x21\n"
+"                BNE     loc_FF8B8EE8\n"
+"                LDR     R1, [R0,#0x7C]\n"
+"                ADD     R1, R1, R1,LSL#1\n"
+"                ADD     R1, R0, R1,LSL#2\n"
+"                SUB     R1, R1, #8\n"
+"                LDMIA   R1, {R2-R4}\n"
+"                STMIA   R6, {R2-R4}\n"
+"                BL      sub_FF8B6C40\n" // ExpDrv.c 4
+"                LDR     R0, [SP,#0x1C]\n"
+"                LDR     R1, [R0,#0x7C]\n"
+"                LDR     R3, [R0,#0x88]\n"
+"                LDR     R2, [R0,#0x8C]\n"
+"                ADD     R0, R0, #4\n"
+"                BLX     R3\n"
+"                LDR     R0, [SP,#0x1C]\n"
+"                BL      sub_FF8B6F3C\n" // ExpDrv.c 4
+"                B       loc_FF8B911C\n"
+"loc_FF8B8EE8:\n"
+"                ADD     R1, R0, #4\n"
+"                LDMIA   R1, {R2,R3,R12}\n"
+"                STMIA   R6, {R2,R3,R12}\n"
+"                LDR     R1, [R0]\n"
+"                CMP     R1, #0x23\n"
+"                ADDLS   PC, PC, R1,LSL#2\n"
+"                B       loc_FF8B90FC\n"
+"                B       loc_FF8B8F94\n"
+"                B       loc_FF8B8F94\n"
+"                B       loc_FF8B8FE4\n"
+"                B       loc_FF8B8FEC\n"
+"                B       loc_FF8B8FEC\n"
+"                B       loc_FF8B8FEC\n"
+"                B       loc_FF8B8F94\n"
+"                B       loc_FF8B8FE4\n"
+"                B       loc_FF8B8FEC\n"
+"                B       loc_FF8B8FEC\n"
+"                B       loc_FF8B9004\n"
+"                B       loc_FF8B9004\n"
+"                B       loc_FF8B90F0\n"
+"                B       loc_FF8B90F8\n"
+"                B       loc_FF8B90F8\n"
+"                B       loc_FF8B90F8\n"
+"                B       loc_FF8B90F8\n"
+"                B       loc_FF8B90FC\n"
+"                B       loc_FF8B90FC\n"
+"                B       loc_FF8B90FC\n"
+"                B       loc_FF8B90FC\n"
+"                B       loc_FF8B90FC\n"
+"                B       loc_FF8B8FF4\n"
+"                B       loc_FF8B8FFC\n"
+"                B       loc_FF8B8FFC\n"
+"                B       loc_FF8B9010\n"
+"                B       loc_FF8B9018\n"
+"                B       loc_FF8B9048\n"
+"                B       loc_FF8B9078\n"
+"                B       loc_FF8B90A8\n"
+"                B       loc_FF8B90D8\n"
+"                B       loc_FF8B90D8\n"
+"                B       loc_FF8B90FC\n"
+"                B       loc_FF8B90FC\n"
+"                B       loc_FF8B90E0\n"
+"                B       loc_FF8B90E8\n"
+"loc_FF8B8F94:\n"
+// jumptable FF8B8EFC entries 0,1,6
+"                BL      sub_FF8B5B24\n" // ExpDrv.c 2
+"                B       loc_FF8B90FC\n"
+"loc_FF8B8FE4:\n"
+// jumptable FF8B8EFC entries 2,7
+"                BL      sub_FF8B5DAC\n" // ExpDrv.c 4
+"                B       loc_FF8B90FC\n"
+"loc_FF8B8FEC:\n"
+// jumptable FF8B8EFC entries 3-5,8,9
+"                BL      sub_FF8B5FB0\n" // ExpDrv.c 940
+"                B       loc_FF8B90FC\n"
+"loc_FF8B8FF4:\n"
+// jumptable FF8B8EFC entry 22
+"                BL      sub_FF8B6218\n" // ExpDrv.c 1072
+"                B       loc_FF8B90FC\n"
+"loc_FF8B8FFC:\n"
+// jumptable FF8B8EFC entries 23,24
+"                BL      sub_FF8B640C\n" // ExpDrv.c 4
+"                B       loc_FF8B90FC\n"
+"loc_FF8B9004:\n"
+// jumptable FF8B8EFC entries 10,11
+"                BL      sub_FF8B6670_my\n" // ExpDrv.c 2 ->
+"                MOV     R4, #0\n"
+"                B       loc_FF8B90FC\n"
+"loc_FF8B9010:\n"
+// jumptable FF8B8EFC entry 25
+"                BL      sub_FF8B67AC\n" // ExpDrv.c 4
+"                B       loc_FF8B90FC\n"
+"loc_FF8B9018:\n"
+// jumptable FF8B8EFC entry 26
+"                LDRH    R1, [R0,#4]\n"
+"                STRH    R1, [SP,#0x10]\n"
+"                LDRH    R1, [R5,#2]\n"
+"                STRH    R1, [SP,#0x12]\n"
+"                LDRH    R1, [R5,#4]\n"
+"                STRH    R1, [SP,#0x14]\n"
+"                LDRH    R1, [R5,#6]\n"
+"                STRH    R1, [SP,#0x16]\n"
+"                LDRH    R1, [R0,#0xC]\n"
+"                STRH    R1, [SP,#0x18]\n"
+"                BL      sub_FF8B9EE4\n" // ExpDrv.c 2
+"                B       loc_FF8B90FC\n"
+"loc_FF8B9048:\n"
+// jumptable FF8B8EFC entry 27
+"                LDRH    R1, [R0,#4]\n"
+"                STRH    R1, [SP,#0x10]\n"
+"                LDRH    R1, [R5,#2]\n"
+"                STRH    R1, [SP,#0x12]\n"
+"                LDRH    R1, [R5,#4]\n"
+"                STRH    R1, [SP,#0x14]\n"
+"                LDRH    R1, [R5,#6]\n"
+"                STRH    R1, [SP,#0x16]\n"
+"                LDRH    R1, [R5,#8]\n"
+"                STRH    R1, [SP,#0x18]\n"
+"                BL      sub_FF8BA060\n" // ExpDrv.c 2
+"                B       loc_FF8B90FC\n"
+"loc_FF8B9078:\n"
+// jumptable FF8B8EFC entry 28
+"                LDRH    R1, [R5]\n"
+"                STRH    R1, [SP,#0x10]\n"
+"                LDRH    R1, [R0,#6]\n"
+"                STRH    R1, [SP,#0x12]\n"
+"                LDRH    R1, [R5,#4]\n"
+"                STRH    R1, [SP,#0x14]\n"
+"                LDRH    R1, [R5,#6]\n"
+"                STRH    R1, [SP,#0x16]\n"
+"                LDRH    R1, [R5,#8]\n"
+"                STRH    R1, [SP,#0x18]\n"
+"                BL      sub_FF8BA10C\n" // ExpDrv.c 1552
+"                B       loc_FF8B90FC\n"
+"loc_FF8B90A8:\n"
+// jumptable FF8B8EFC entry 29
+"                LDRH    R1, [R5]\n"
+"                STRH    R1, [SP,#0x10]\n"
+"                LDRH    R1, [R5,#2]\n"
+"                STRH    R1, [SP,#0x12]\n"
+"                LDRH    R1, [R5,#4]\n"
+"                STRH    R1, [SP,#0x14]\n"
+"                LDRH    R1, [R5,#6]\n"
+"                STRH    R1, [SP,#0x16]\n"
+"                LDRH    R1, [R0,#0xC]\n"
+"                STRH    R1, [SP,#0x18]\n"
+"                BL      sub_FF8BA1AC\n" // ExpDrv.c 32
+"                B       loc_FF8B90FC\n"
+"loc_FF8B90D8:\n"
+// jumptable FF8B8EFC entries 30,31
+"                BL      sub_FF8B6A04\n" // ExpDrv.c 4
+"                B       loc_FF8B90FC\n"
+"loc_FF8B90E0:\n"
+// jumptable FF8B8EFC entry 34
+"                BL      sub_FF8B7040\n" // ExpDrv.c 4
+"                B       loc_FF8B90FC\n"
+"loc_FF8B90E8:\n"
+// jumptable FF8B8EFC entry 35
+"                BL      sub_FF8B7274\n" // ExpDrv.c 4
+"                B       loc_FF8B90FC\n"
+"loc_FF8B90F0:\n"
+// jumptable FF8B8EFC entry 12
+"                BL      sub_FF8B73EC\n" // ExpDrv.c 2
+"                B       loc_FF8B90FC\n"
+"loc_FF8B90F8:\n"
+// jumptable FF8B8EFC entries 13-16
+"                BL      sub_FF8B7584\n" // ExpDrv.c 128
+"loc_FF8B90FC:\n"
+// jumptable FF8B8EFC default entry
+// jumptable FF8B8EFC entries 17-21,32,33
+"                LDR     R0, [SP,#0x1C]\n"
+"                LDR     R1, [R0,#0x7C]\n"
+"                LDR     R3, [R0,#0x88]\n"
+"                LDR     R2, [R0,#0x8C]\n"
+"                ADD     R0, R0, #4\n"
+"                BLX     R3\n"
+"                CMP     R4, #1\n"
+"                BNE     loc_FF8B9164\n"
+"loc_FF8B911C:\n"
+"                LDR     R0, [SP,#0x1C]\n"
+"                MOV     R2, #0xC\n"
+"                LDR     R1, [R0,#0x7C]\n"
+"                ADD     R1, R1, R1,LSL#1\n"
+"                ADD     R0, R0, R1,LSL#2\n"
+"                SUB     R4, R0, #8\n"
+"                LDR     R0, =0x462E8\n"
+"                ADD     R1, SP, #0x10\n"
+"                BL      sub_FFABD1C4\n" //done
+"                LDR     R0, =0x462F4\n"
+"                MOV     R2, #0xC\n"
+"                ADD     R1, SP, #0x10\n"
+"                BL      sub_FFABD1C4\n" //done
+"                LDR     R0, =0x46300\n"
+"                MOV     R2, #0xC\n"
+"                MOV     R1, R4\n"
+"                BL      sub_FFABD1C4\n" //done
+"                B       loc_FF8B91DC\n"
+"loc_FF8B9164:\n"
+"                LDR     R0, [SP,#0x1C]\n"
+"                LDR     R0, [R0]\n"
+"                CMP     R0, #0xB\n"
+"                BNE     loc_FF8B91AC\n"
+"                MOV     R3, #0\n"
+"                STR     R3, [SP]\n"
+"                MOV     R3, #1\n"
+"                MOV     R2, #1\n"
+"                MOV     R1, #1\n"
+"                MOV     R0, #0\n"
+"                BL      sub_FF8B592C\n"
+"                MOV     R3, #0\n"
+"                STR     R3, [SP]\n"
+"                MOV     R3, #1\n"
+"                MOV     R2, #1\n"
+"                MOV     R1, #1\n"
+"                MOV     R0, #0\n"
+"                B       loc_FF8B91D8\n"
+"loc_FF8B91AC:\n"
+"                MOV     R3, #1\n"
+"                MOV     R2, #1\n"
+"                MOV     R1, #1\n"
+"                MOV     R0, #1\n"
+"                STR     R3, [SP]\n"
+"                BL      sub_FF8B592C\n"
+"                MOV     R3, #1\n"
+"                MOV     R2, #1\n"
+"                MOV     R1, #1\n"
+"                MOV     R0, #1\n"
+"                STR     R3, [SP]\n"
+"loc_FF8B91D8:\n"
+"                BL      sub_FF8B5A6C\n"
+"loc_FF8B91DC:\n"
+"                LDR     R0, [SP,#0x1C]\n"
+"                BL      sub_FF8B9E70\n" // ExpDrv.c 0
+"                B       loc_FF8B8BB0\n"
+ );
+}
+
+void __attribute__((naked,noinline)) sub_FF8B6670_my(){ // 
+ asm volatile(
+"                STMFD   SP!, {R4-R8,LR}\n"
+"                LDR     R7, =0x7270\n"
+"                MOV     R4, R0\n"
+"                LDR     R0, [R7,#0x1C]\n"
+"                MOV     R1, #0x3E\n"
+"                BL      sub_FF829D60\n"
+"                LDRSH   R0, [R4,#4]\n"
+"                MOV     R2, #0\n"
+"                MOV     R1, #0\n"
+"                BL      sub_FF8B56C0\n"
+"                MOV     R6, R0\n"
+"                LDRSH   R0, [R4,#6]\n"
+"                BL      sub_FF8B57CC\n"
+"                LDRSH   R0, [R4,#8]\n"
+"                BL      sub_FF8B5824\n"
+"                LDRSH   R0, [R4,#0xA]\n"
+"                BL      sub_FF8B587C\n"
+"                LDRSH   R0, [R4,#0xC]\n"
+"                BL      sub_FF8B58D4\n"
+"                MOV     R5, R0\n"
+"                LDR     R0, [R4]\n"
+"                LDR     R8, =0x46300\n"
+"                CMP     R0, #0xB\n"
+"                MOVEQ   R6, #0\n"
+"                MOVEQ   R5, #0\n"
+"                BEQ     loc_FF8B6700\n"
+"                CMP     R6, #1\n"
+"                BNE     loc_FF8B6700\n"
+"                LDRSH   R0, [R4,#4]\n"
+"                LDR     R1, =0xFF8B561C\n"
+"                MOV     R2, #2\n"
+"                BL      sub_FF93655C\n" // IrisController.c 168 done
+"                STRH    R0, [R4,#4]\n"
+"                MOV     R0, #0\n"
+"                STR     R0, [R7,#0x28]\n"
+"                B       loc_FF8B6708\n"
+"loc_FF8B6700:\n"
+"                LDRH    R0, [R8]\n"
+"                STRH    R0, [R4,#4]\n"
+"loc_FF8B6708:\n"
+"                CMP     R5, #1\n"
+"                LDRNEH  R0, [R8,#8]\n"
+"                BNE     loc_FF8B6724\n"
+"                LDRSH   R0, [R4,#0xC]\n"
+"                LDR     R1, =0xFF8B56B0\n"
+"                MOV     R2, #0x20\n"
+"                BL      sub_FF8B9EA0\n"
+"loc_FF8B6724:\n"
+"                STRH    R0, [R4,#0xC]\n"
+"                LDRSH   R0, [R4,#6]\n"
+"                BL      sub_FF897408_my\n" // Shutter.c 364 ->
+"                LDRSH   R0, [R4,#8]\n"
+"                MOV     R1, #1\n"
+"                BL      sub_FF897B9C\n" // ImgGain.c 0
+"                MOV     R1, #0\n"
+"                ADD     R0, R4, #8\n"
+"                BL      sub_FF897C24\n" // ImgGain.c 0
+"                LDRSH   R0, [R4,#0xE]\n"
+"                BL      sub_FF8ACA40\n" // BrtCrct.c 552
+"                LDR     R4, =0xBB8\n"
+"                CMP     R6, #1\n"
+"                BNE     loc_FF8B677C\n"
+"                LDR     R0, [R7,#0x1C]\n"
+"                MOV     R2, R4\n"
+"                MOV     R1, #2\n"
+"                BL      sub_FF829C64\n" // KerFlag.c 0
+"                TST     R0, #1\n"
+"                LDRNE   R1, =0x527\n"
+"                LDRNE   R0, =0xFF8B5D3C\n" // "expdrv.c"
+"                BLNE    sub_FF81BFC8\n"
+"loc_FF8B677C:\n"
+"                CMP     R5, #1\n"
+"                LDMNEFD SP!, {R4-R8,PC}\n"
+"                LDR     R0, [R7,#0x1C]\n"
+"                MOV     R2, R4\n"
+"                MOV     R1, #0x20\n"
+"                BL      sub_FF829C64\n" // KerFlag.c 0
+"                TST     R0, #1\n"
+"                LDRNE   R1, =0x52C\n"
+"                LDRNE   R0, =0xFF8B5D3C\n"
+"                LDMNEFD SP!, {R4-R8,LR}\n"
+"                BNE     sub_FF81BFC8\n"
+"                LDMFD   SP!, {R4-R8,PC}\n"
+
+ );
+}
+
+void __attribute__((naked,noinline)) sub_FF897408_my(){ // Shutter.c 364
+ asm volatile(
+"                STMFD   SP!, {R4-R6,LR}\n"
+"                LDR     R5, =0x6C38\n"
+"                MOV     R4, R0\n"
+"                LDR     R0, [R5,#4]\n"
+"                CMP     R0, #1\n"
+"                MOVNE   R1, #0x16C\n"
+"                LDRNE   R0, =0xFF8971A0\n" // "shutter.c"
+"                BLNE    sub_FF81BFC8\n"
+"                CMN     R4, #0xC00\n"
+"                LDREQSH R4, [R5,#2]\n"
+"                CMN     R4, #0xC00\n"
+"                LDREQ   R1, =0x172\n"
+"                LDREQ   R0, =0xFF8971A0\n" // "shutter.c"
+"                STRH    R4, [R5,#2]\n"
+"                BLEQ    sub_FF81BFC8\n"
+"                MOV     R0, R4\n"
+//"                BL      sub_FF9BF0C4\n" // -
+"                BL      apex2us\n" // +
+"                MOV     R4, R0\n"
+//"                BL      nullsub_143\n"
+"                MOV     R0, R4\n"
+"                BL      sub_FF8CF8C0\n"
+"                TST     R0, #1\n"
+"                LDRNE   R1, =0x177\n"
+"                LDMNEFD SP!, {R4-R6,LR}\n"
+"                LDRNE   R0, =0xFF8971A0\n" // "shutter.c"
+"                BNE     sub_FF81BFC8\n"
+"                LDMFD   SP!, {R4-R6,PC}\n"
+ );
+}
+
Index: /branches/reyalp-ptp-live/platform/g9/sub/100i/stubs_entry.S
===================================================================
--- /branches/reyalp-ptp-live/platform/g9/sub/100i/stubs_entry.S	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/g9/sub/100i/stubs_entry.S	(revision 1668)
@@ -0,0 +1,225 @@
+// !!! THIS FILE IS GENERATED. DO NOT EDIT. !!!
+#include "stubs_asm.h"
+
+// Camera info:
+//   DRYOS R23 (DRYOS version 2.3, release #0023)
+//   Firmware Ver GM1.00I
+//   Possible corrupt firmware dump - file size to small for start address 0xff810000
+//     file size = 3.19MB, should be 7.94MB
+//   Could not find Camera name - possible corrupt firmware dump
+
+// Values for makefile.inc
+//   MAXRAMADDR = 0x03ffffff
+
+// Stubs below should be checked. Stub not matched 100%, or difference found to current 'stubs_entry_2.S'
+//    Name                                     Address      Rule  %  Comp to stubs_entry_2.S
+//NSTUB(PutInNdFilter                         ,0xff9384e4) //102        *** != 0xffa0c578
+//NSTUB(PutOutNdFilter                        ,0xff938508) //102        *** != 0xffa0c5b0
+//NSTUB(kbd_pwr_off                           ,0xff84944c) //  2 67%    *** != 0x00000000
+// ERROR: kbd_pwr_on is not found.                         //--- ---    *** != 0x00000000
+
+// Check of modemap from 'platform/CAMERA/shooting.c':
+// Firmware modemap table found @ff8773f8 -> ff8735c4 -> ff9553a8 -> ffa4c760 -> ffb08114
+// No problems found with modemap table.
+
+// Values below can be overridden in 'stubs_min.S':
+DEF(physw_status                            ,0x0001563c) // Found @0xff8230cc
+DEF(physw_run                               ,0x00001ca4) // Found @0xff822d78
+DEF(levent_table                            ,0xffae01d4) // Found @0xffae01d4
+//DEF(FlashParamsTable                        ,0xffb082e0) // Found @0xffb082e0, ** != ** stubs_min = 0xffb082b8 (0xFFB082B8)
+DEF(movie_status                            ,0x00005714) // Found @0xff85d220
+DEF(canon_menu_active                       ,0x0000fdc8) // Found @0xff99b56c
+DEF(canon_shoot_menu_active                 ,0x0000f33d) // Found @0xff96ac40
+DEF(playrec_mode                            ,0x000058cc) // Found @0xff864a60
+DEF(zoom_status                             ,0x0001264c) // Found @0xffa4e424
+DEF(some_flag_for_af_scan                   ,0x0001253c) // Found @0xffa447c8
+DEF(zoom_busy                               ,0x0000e260) // Found @0xff939f38
+DEF(focus_busy                              ,0x0000e150) // Found @0xff934128
+//DEF(recreview_hold                          ,0x00006400) // Found @0xff87cb64, ** != ** stubs_min = 0x0000f050 (0xF050)
+
+// Values below go in 'lib.c':
+//void *vid_get_bitmap_fb()        { return (void*)0x10361000; }             // Found @0xff8451d0
+//void *vid_get_viewport_fb()      { return (void*)0x1067b540; }             // Found @0xffa11304
+//void *vid_get_viewport_fb_d()    { return (void*)(*(int*)(0x5558+0x50)); } // Found @0xff856268 & 0xff8562a0
+//char *camera_jpeg_count_str()    { return (char*)0x00060354; }             // Found @0xff9afb7c
+//long hook_raw_size()             { return 0x00ee9710; }                    // Found @0xffa131c8
+//int get_flash_params_count(void) { return 0x72; }                          // Found @0xff9569a8
+
+// Bitmap masks and physw_status index values for SD_READONLY and USB power flags (for kbd.c).
+//#define SD_READONLY_FLAG    0x00020000 // Found @0xffac6378, levent 0x90a
+//#define SD_READONLY_IDX     2
+//#define USB_MASK            0x00040000 // Found @0xffac6380, levent 0x902
+//#define USB_IDX             2
+
+// Keymap values for kbd.c. Additional keys may be present, only common values included here.
+//static KeyMap keymap[] = {
+//    { 0, KEY_SHOOT_FULL      ,0xc0000000 }, // Found @0xffac62b0, levent 0x01
+//    { 0, KEY_SHOOT_FULL_ONLY ,0x80000000 }, // Found @0xffac62b0, levent 0x01
+//    { 0, KEY_SHOOT_HALF      ,0x40000000 }, // Found @0xffac62a8, levent 0x00
+//    { 1, KEY_ZOOM_OUT        ,0x00000008 }, // Found @0xffac62d0, levent 0x03
+//    { 1, KEY_ZOOM_IN         ,0x00000010 }, // Found @0xffac62d8, levent 0x02
+//    { 1, KEY_LEFT            ,0x00010000 }, // Found @0xffac6308, levent 0x06
+//    { 1, KEY_SET             ,0x00020000 }, // Found @0xffac6310, levent 0x08
+//    { 1, KEY_RIGHT           ,0x00040000 }, // Found @0xffac6318, levent 0x07
+//    { 1, KEY_DOWN            ,0x00080000 }, // Found @0xffac6320, levent 0x05
+//    { 1, KEY_UP              ,0x00100000 }, // Found @0xffac6328, levent 0x04
+//    { 1, KEY_DISPLAY         ,0x04000000 }, // Found @0xffac6340, levent 0x0a
+//    { 1, KEY_MENU            ,0x08000000 }, // Found @0xffac6348, levent 0x09
+//    { 0, 0, 0 }
+//};
+
+// Values below go in 'platform_camera.h':
+//#define CAM_DRYOS         1
+//#define CAM_RAW_ROWPIX    4104 // Found @0xffa0b290
+//#define CAM_RAW_ROWS      3048 // Found @0xffa0b298
+//#undef  CAM_UNCACHED_BIT
+//#define CAM_UNCACHED_BIT  0x10000000 // Found @0xff82a7c4
+
+// Misc stuff
+DEF(ctypes, 0xffac0b6a)
+
+// For capt_seq.c
+//static long *nrflag = (long*)(0xe618);       // Found @ ff9444f0
+
+// Stubs below matched 100%.
+//    Name                                     Address                Comp to stubs_entry_2.S
+NSTUB(AllocateMemory                          ,0xffa47cf0) //103
+NSTUB(AllocateUncacheableMemory               ,0xff82a788) //112
+NSTUB(Close                                   ,0xff82552c) //101
+NSTUB(CreateTask                              ,0xff81baf0) //101
+NSTUB(DebugAssert                             ,0xff81bfc8) //111
+NSTUB(DeleteDirectory_Fut                     ,0xff824e78) //  1
+NSTUB(DeleteFile_Fut                          ,0xff824d94) //112
+NSTUB(DoAFLock                                ,0xff8275cc) //103
+NSTUB(EnterToCompensationEVF                  ,0xff8279a8) //104
+NSTUB(ExecuteEventProcedure                   ,0xff81c1a8) //  1
+NSTUB(ExitFromCompensationEVF                 ,0xff8279f8) //104
+NSTUB(ExitTask                                ,0xff81bd80) //101
+NSTUB(ExpCtrlTool_StartContiAE                ,0xff835600) //104
+NSTUB(ExpCtrlTool_StopContiAE                 ,0xff8357c0) //104
+NSTUB(Fclose_Fut                              ,0xff824f10) //101
+NSTUB(Feof_Fut                                ,0xff8250fc) //  1
+NSTUB(Fflush_Fut                              ,0xff825138) //  1
+NSTUB(Fgets_Fut                               ,0xff825064) //  1
+NSTUB(Fopen_Fut                               ,0xff824ed0) //101
+NSTUB(Fread_Fut                               ,0xff824fbc) //101
+NSTUB(FreeMemory                              ,0xffa47cdc) //103
+NSTUB(FreeUncacheableMemory                   ,0xff82a7bc) //112
+NSTUB(Fseek_Fut                               ,0xff8250b0) //101
+NSTUB(Fwrite_Fut                              ,0xff825010) //101
+NSTUB(GetBatteryTemperature                   ,0xff84bee8) //102
+NSTUB(GetCCDTemperature                       ,0xff84be78) //102
+NSTUB(GetCurrentAvValue                       ,0xff936dd4) //102
+NSTUB(GetDrive_ClusterSize                    ,0xff852754) //  1
+NSTUB(GetDrive_FreeClusters                   ,0xff8527f4) //  1
+NSTUB(GetDrive_TotalClusters                  ,0xff852788) //  1
+NSTUB(GetFocusLensSubjectDistance             ,0xff934c68) //102
+NSTUB(GetFocusLensSubjectDistanceFromLens     ,0xff934f74) //  1
+NSTUB(GetKbdState                             ,0xff849300) //109
+NSTUB(GetMemInfo                              ,0xff813c58) //  1
+NSTUB(GetOpticalTemperature                   ,0xff84bf58) //102
+NSTUB(GetParameterData                        ,0xff956968) //  1
+NSTUB(GetPropertyCase                         ,0xff86f768) //101
+NSTUB(GetSystemTime                           ,0xffa47df8) //  1
+NSTUB(GetZoomLensCurrentPoint                 ,0xff93a29c) //102
+NSTUB(GetZoomLensCurrentPosition              ,0xffa3e680) //102
+NSTUB(GiveSemaphore                           ,0xff81ba5c) //112
+NSTUB(IsStrobeChargeCompleted                 ,0xff8c1344) //102
+NSTUB(LEDDrive                                ,0xff848890) //103
+NSTUB(LocalTime                               ,0xff86b538) //  1
+NSTUB(LockMainPower                           ,0xff8731f0) //103
+NSTUB(Lseek                                   ,0xff82566c) //101
+NSTUB(MakeDirectory_Fut                       ,0xff824e08) //  1
+NSTUB(MoveFocusLensToDistance                 ,0xffa0e15c) //102
+NSTUB(MoveIrisWithAv                          ,0xff9371b4) //102
+NSTUB(MoveZoomLensWithPoint                   ,0xff93ad48) //102
+NSTUB(NewTaskShell                            ,0xff86f1ec) //103
+NSTUB(Open                                    ,0xff825504) //101
+NSTUB(PB2Rec                                  ,0xff876664) //104
+NSTUB(PT_MoveDigitalZoomToWide                ,0xff8668e0) //103
+NSTUB(PT_MoveOpticalZoomAt                    ,0xff8668a8) //103
+NSTUB(PT_PlaySound                            ,0xff866454) //103
+NSTUB(PostLogicalEventForNotPowerType         ,0xff87118c) //103
+NSTUB(PostLogicalEventToUI                    ,0xff8711d8) //103
+NSTUB(Read                                    ,0xff81a378) //101
+NSTUB(ReadFastDir                             ,0xffa2cbd4) //  1
+NSTUB(Rec2PB                                  ,0xff875024) //104
+NSTUB(RefreshPhysicalScreen                   ,0xff9bdc0c) //104
+NSTUB(Remove                                  ,0xff825574) //  1
+NSTUB(RenameFile_Fut                          ,0xff824d40) //  1
+NSTUB(Restart                                 ,0xff82c7e4) //106
+NSTUB(SetAE_ShutterSpeed                      ,0xffa104b8) //102
+NSTUB(SetAutoShutdownTime                     ,0xff873264) //103
+NSTUB(SetCurrentCaptureModeType               ,0xff879f7c) //101
+NSTUB(SetFileAttributes                       ,0xff825858) //  1
+NSTUB(SetFileTimeStamp                        ,0xff825808) //  1
+NSTUB(SetLogicalEventActive                   ,0xff872f28) //  1
+NSTUB(SetParameterData                        ,0xff956844) //101
+NSTUB(SetPropertyCase                         ,0xff86f660) //103
+NSTUB(SetScriptMode                           ,0xff872f78) //101
+NSTUB(SleepTask                               ,0xff82a610) //101
+NSTUB(TakeSemaphore                           ,0xff81b98c) //101
+NSTUB(TurnOffBackLight                        ,0xff87ff88) //104
+NSTUB(TurnOnBackLight                         ,0xff87ff70) //104
+NSTUB(UIFS_WriteFirmInfoToFile                ,0xff99c3b8) //103
+NSTUB(UnlockAF                                ,0xff827638) //103
+NSTUB(UnlockMainPower                         ,0xff873144) //103
+NSTUB(UnsetZoomForMovie                       ,0xff95d048) //104
+NSTUB(UpdateMBROnFlash                        ,0xff85251c) //105
+NSTUB(VbattGet                                ,0xff82199c) //101
+NSTUB(Write                                   ,0xff8255d8) //101
+NSTUB(WriteSDCard                             ,0xff928d00) //108
+NSTUB(_log                                    ,0xffabe6dc) //111
+NSTUB(_log10                                  ,0xffabd620) //112
+NSTUB(_pow                                    ,0xffabd790) //114
+NSTUB(_sqrt                                   ,0xffabfa44) //  1
+NSTUB(add_ptp_handler                         ,0xff8d897c) //  1
+NSTUB(apex2us                                 ,0xff9bf0c4) //  4
+NSTUB(close                                   ,0xff81a190) //  1
+NSTUB(closedir                                ,0xffa2cca4) //  1
+NSTUB(err_init_task                           ,0xff814eb0) //  4
+NSTUB(exmem_alloc                             ,0xff86c680) //  1
+NSTUB(free                                    ,0xff813ab0) //112
+NSTUB(kbd_p1_f                                ,0xff8231c8) //109
+NSTUB(kbd_p1_f_cont                           ,0xff8231d4) //109
+NSTUB(kbd_p2_f                                ,0xff822a18) //109
+NSTUB(kbd_read_keys                           ,0xff8230cc) //109
+NSTUB(kbd_read_keys_r2                        ,0xff848dc8) //109
+NSTUB(lseek                                   ,0xff82566c) //101
+NSTUB(malloc                                  ,0xff8139dc) //112
+NSTUB(memcmp                                  ,0xff81e834) //101
+NSTUB(memcpy                                  ,0xff895cf0) //101
+NSTUB(memset                                  ,0xffa8d42c) //101
+NSTUB(mkdir                                   ,0xff8258d0) //  1
+// ALT: NSTUB(mkdir, 0xff825970) // 1 32/0
+NSTUB(mktime_ext                              ,0xff89655c) //  1
+NSTUB(open                                    ,0xff81a0e0) //  1
+NSTUB(opendir                                 ,0xffa2cb40) //  1
+NSTUB(openfastdir                             ,0xffa2cb40) //  1
+NSTUB(qsort                                   ,0xff9be49c) //  1
+NSTUB(rand                                    ,0xff81e93c) //  1
+NSTUB(read                                    ,0xff81a378) //101
+NSTUB(reboot_fw_update                        ,0xffa34598) //  1
+NSTUB(rename                                  ,0xff824d40) //  1
+NSTUB(set_control_event                       ,0xff872c2c) //  1
+NSTUB(srand                                   ,0xff81e930) //  1
+NSTUB(stat                                    ,0xff825738) //  1
+NSTUB(strcat                                  ,0xff895c1c) //  1
+NSTUB(strchr                                  ,0xff895ca4) //  1
+NSTUB(strcmp                                  ,0xff81e7cc) //101
+NSTUB(strcpy                                  ,0xff81e778) //101
+NSTUB(strftime                                ,0xff895f64) //  1
+NSTUB(strlen                                  ,0xff81e810) //101
+NSTUB(strncmp                                 ,0xff895c58) //  1
+NSTUB(strncpy                                 ,0xff81e790) //  1
+NSTUB(strrchr                                 ,0xff895cc8) //  1
+NSTUB(strtol                                  ,0xff830d90) //101
+NSTUB(strtolx                                 ,0xff830b94) //109
+  DEF(task_CaptSeq                            ,0xff861210) //107
+  DEF(task_ExpDrv                             ,0xff8b8b90) //110
+  DEF(task_InitFileModules                    ,0xff877284) //107
+  DEF(task_MovieRecord                        ,0xff85d4c0) //107
+  DEF(task_PhySw                              ,0xff822d74) //107
+NSTUB(time                                    ,0xff86ba3c) //  2
+NSTUB(vsprintf                                ,0xff81e6f8) //  1
+NSTUB(write                                   ,0xff8255d8) //101
Index: /branches/reyalp-ptp-live/platform/g9/sub/100i/stubs_entry_2.S
===================================================================
--- /branches/reyalp-ptp-live/platform/g9/sub/100i/stubs_entry_2.S	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/g9/sub/100i/stubs_entry_2.S	(revision 1668)
@@ -0,0 +1,15 @@
+#include "stubs_asm.h"
+#define NULL_SUB 0xFF810958
+
+// Override stubs_entry.S
+NHSTUB(PutInNdFilter,               0xFFA0C578)
+NHSTUB(PutOutNdFilter,              0xFFA0C5B0)
+NHSTUB(kbd_pwr_off,                 NULL_SUB)
+NHSTUB(kbd_pwr_on,                  NULL_SUB)
+
+// These don't exist
+NHSTUB(SetZoomActuatorSpeedPercent, NULL_SUB)
+
+// Additional
+NHSTUB(MakeAFScan,                  0xFFA449F8)
+NHSTUB(PostLEDMessage,              0xFF848910)
Index: /branches/reyalp-ptp-live/platform/g9/sub/100i/boot.c
===================================================================
--- /branches/reyalp-ptp-live/platform/g9/sub/100i/boot.c	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/g9/sub/100i/boot.c	(revision 1668)
@@ -0,0 +1,578 @@
+#include "lolevel.h"
+#include "platform.h"
+#include "core.h"
+#include "stdlib.h"
+
+
+const char * const new_sa = &_end;
+
+/* Ours stuff */
+extern long wrs_kernel_bss_start;
+extern long wrs_kernel_bss_end;
+
+// Forward declarations
+void CreateTask_PhySw();
+void CreateTask_spytask();
+
+void taskCreateHook(int *p) { 
+ p-=16;
+ if (p[0]==0xFF861210)  p[0]=(int)capt_seq_task;
+ if (p[0]==0xFF85D4C0)  p[0]=(int)movie_record_task;
+ if (p[0]==0xFF877284)  p[0]=(int)init_file_modules_task;
+ if (p[0]==0xFF8B8B90)  p[0]=(int)exp_drv_task;
+}
+
+void taskCreateHook2(int *p) { 
+ p-=16;
+ if (p[0]==0xFF877284)  p[0]=(int)init_file_modules_task;
+ if (p[0]==0xFF8B8B90)  p[0]=(int)exp_drv_task;
+}
+
+void boot() { 
+
+    long *canon_data_src = (void*)0xFFB2E41C; // OK	//canon_data_src!!!  @FF810130
+    long *canon_data_dst = (void*)0x1900;	// OK  //MEMBASEADDR   @FF810134
+    long canon_data_len = 0x140E4- 0x1900; // data_end - data_start     
+    long *canon_bss_start = (void*)0x140e4; // just after data 	// OK	//@FF810138
+    long canon_bss_len = 0xb0b68 - 0x140e4; //  MEMISOSTART - 
+
+    long i;
+
+    asm volatile (
+	"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;
+
+    *(int*)(0x261C+8)= (*(int*)0xC02200C0)&1 ? 1: 2;  // replacement of sub_FF822E10
+
+    *(int*)0x1930=(int)taskCreateHook; 
+    *(int*)0x1934=(int)taskCreateHook2; 
+/*
+    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");
+*/
+
+    // jump to init-sequence that follows the data-copy-routine 
+  
+	asm volatile ("B      sub_FF8101a4_my\n");  //---------->
+	
+}; 
+
+
+void __attribute__((naked,noinline)) sub_FF8101a4_my() {
+		asm volatile (	
+                "LDR     R0, =0xFF81021C\n"
+                "MOV     R1, #0\n"
+                "LDR     R3, =0xFF810254\n"
+"loc_FF8101B0:\n"
+                "CMP     R0, R3\n"
+                "LDRCC   R2, [R0],#4\n"
+                "STRCC   R2, [R1],#4\n"
+                "BCC     loc_FF8101B0\n"
+                "LDR     R0, =0xFF810254\n"
+                "MOV     R1, #0x4B0\n"
+                "LDR     R3, =0xFF810468\n"
+"loc_FF8101CC:\n"
+                "CMP     R0, R3\n"
+                "LDRCC   R2, [R0],#4\n"
+                "STRCC   R2, [R1],#4\n"
+                "BCC     loc_FF8101CC\n"
+                "MOV     R0, #0xD2\n"
+                "MSR     CPSR_cxsf, R0\n"
+                "MOV     SP, #0x1000\n"
+                "MOV     R0, #0xD3\n"
+                "MSR     CPSR_cxsf, R0\n"
+                "MOV     SP, #0x1000\n"
+                "LDR     R0, =0x6C4\n"
+                "LDR     R2, =0xEEEEEEEE\n"
+                "MOV     R3, #0x1000\n"
+"loc_FF810200:\n"
+                "CMP     R0, R3\n"
+                "STRCC   R2, [R0],#4\n"
+                "BCC     loc_FF810200\n"
+                "BL      sub_FF810FB8_my\n" //----------->
+      );
+				
+}; //#fe
+
+
+//OK
+void __attribute__((naked,noinline)) sub_FF810FB8_my() { 
+        asm volatile ( 
+                 "STR     LR, [SP,#-4]!\n"
+                 "SUB     SP, SP, #0x74\n"
+                 "MOV     R0, SP\n"
+                 "MOV     R1, #0x74\n"
+                 "BL      sub_FFABD420\n"
+                 "MOV     R0, #0x53000\n"
+                 "STR     R0, [SP,#4]\n"
+          //       "LDR     R0, =0xB0B68\n"     // -
+                 "LDR     R0, =new_sa\n"        // +
+                 "LDR     R0, [R0]\n"           // +
+                 "LDR     R2, =0x2ABC00\n"
+                 "LDR     R1, =0x2A4968\n"
+                 "STR     R0, [SP,#8]\n"
+                 "SUB     R0, R1, R0\n"
+                 "ADD     R3, SP, #0xC\n"
+                 "STR     R2, [SP]\n"
+                 "STMIA   R3, {R0-R2}\n"
+                 "MOV     R0, #0x22\n"
+                 "STR     R0, [SP,#0x18]\n"
+                 "MOV     R0, #0x68\n"
+                 "STR     R0, [SP,#0x1C]\n"
+                 "LDR     R0, =0x19B\n"
+                 "MOV     R1, #0x64\n"
+                 "STRD    R0, [SP,#0x20]\n"
+                 "MOV     R0, #0x78\n"
+                 "STRD    R0, [SP,#0x28]\n"
+                 "MOV     R0, #0\n"
+                 "STR     R0, [SP,#0x30]\n"
+                 "STR     R0, [SP,#0x34]\n"
+                 "MOV     R0, #0x10\n"
+                 "STR     R0, [SP,#0x5C]\n"
+                 "MOV     R0, #0x800\n"
+                 "STR     R0, [SP,#0x60]\n"
+                 "MOV     R0, #0xA0\n"
+                 "STR     R0, [SP,#0x64]\n"
+                 "MOV     R0, #0x280\n"
+                 "STR     R0, [SP,#0x68]\n"
+                 "LDR     R1, =sub_FF814DBC_my\n"       //---------->
+                 "MOV     R0, SP\n"
+                 "MOV     R2, #0\n"
+                 "BL      sub_FF812D70\n"
+                 "ADD     SP, SP, #0x74\n"
+                 "LDR     PC, [SP],#4\n"
+	);
+}; 
+
+
+void __attribute__((naked,noinline)) sub_FF814DBC_my() {
+	asm volatile (		
+                 "STMFD   SP!, {R4,LR}\n"
+                 "BL      sub_FF81095C\n"
+                 "BL      sub_FF819948\n"
+                 "CMP     R0, #0\n"
+                 "LDRLT   R0, =0xFF814ED0\n"
+                 "BLLT    sub_FF814EB0\n"
+                 "BL      sub_FF8149E0\n"
+                 "CMP     R0, #0\n"
+                 "LDRLT   R0, =0xFF814ED8\n"
+                 "BLLT    sub_FF814EB0\n"
+                 "LDR     R0, =0xFF814EE8\n"
+                 "BL      sub_FF814ACC\n"
+                 "CMP     R0, #0\n"
+                 "LDRLT   R0, =0xFF814EF0\n"
+                 "BLLT    sub_FF814EB0\n"
+                 "LDR     R0, =0xFF814EE8\n"
+                 "BL      sub_FF81357C\n"
+                 "CMP     R0, #0\n"
+                 "LDRLT   R0, =0xFF814F04\n"
+                 "BLLT    sub_FF814EB0\n"
+                 "BL      sub_FF8194D0\n"
+                 "CMP     R0, #0\n"
+                 "LDRLT   R0, =0xFF814F10\n"
+                 "BLLT    sub_FF814EB0\n"
+                 "BL      sub_FF8114D0\n"
+                 "CMP     R0, #0\n"
+                 "LDRLT   R0, =0xFF814F1C\n"
+                 "BLLT    sub_FF814EB0\n"
+                 "LDMFD   SP!, {R4,LR}\n"
+                 "B       taskcreate_Startup_my\n" //---------->
+        );
+}; 
+
+
+void __attribute__((naked,noinline)) taskcreate_Startup_my() { 
+	asm volatile (		
+	
+                 "STMFD   SP!, {R3,LR}\n"
+          //     "BL      nullsub_3\n"
+                 "BL      sub_FF82C8FC\n"
+                 "CMP     R0, #0\n"
+                 "BNE     loc_FF81DC4C\n"
+                 "BL      sub_FF824568\n"
+                 "CMP     R0, #0\n"
+                 "LDREQ   R2, =0xC0220000\n"
+                 "LDREQ   R0, [R2,#0xC0]\n"
+                 "LDREQ   R1, [R2,#0xC4]\n"
+                 "ORREQ   R0, R0, R1\n"
+                 "TSTEQ   R0, #1\n"
+                 "BNE     loc_FF81DC4C\n"
+                 "MOV     R0, #0x44\n"
+                 "STR     R0, [R2,#0x4C]\n"
+ "loc_FF81DC48:\n"
+                 "B       loc_FF81DC48\n"
+ "loc_FF81DC4C:\n"
+            //   "BL      sub_FF822E10\n"  // removed, see boot() function
+            //   "BL      nullsub_4\n"
+                 "BL      sub_FF82A488\n"
+                 "MOV     R1, #0x300000\n"
+                 "MOV     R0, #0\n"
+                 "BL      sub_FF82A6D0\n"
+                 "BL      sub_FF82A67C\n"
+                 "MOV     R3, #0\n"
+                 "STR     R3, [SP]\n"
+                 "LDR     R3, =task_Startup_my\n"  //----------->
+                 "MOV     R2, #0\n"
+                 "MOV     R1, #0x19\n"
+                 "LDR     R0, =0xFF81DC90\n"
+                 "BL      sub_FF81BAF0\n"
+                 "MOV     R0, #0\n"
+                 "LDMFD   SP!, {R12,PC}\n"
+ );
+}; 
+
+
+void __attribute__((naked,noinline)) task_Startup_my() { 
+       	asm volatile (
+                 "STMFD   SP!, {R4,LR}\n"
+                 "BL      sub_FF81517C\n"
+                 "BL      sub_FF823FA0\n"
+                 "BL      sub_FF820E60\n"
+          //     "BL      j_nullsub_134\n"
+                 "BL      sub_FF82CADC\n"
+          //     "BL      sub_FF82C9C4\n"  // Skip starting diskboot.bin again
+		);
+        CreateTask_spytask();  // +
+        asm volatile (
+                 "BL      sub_FF82CCA4\n"
+                 "BL      sub_FF82CB2C\n"
+                 "BL      sub_FF8299CC\n"
+                 "BL      sub_FF82CCA8\n"
+         //      "BL      taskcreate_PhySw\n" //-
+        );
+         CreateTask_PhySw(); // +
+        asm volatile (
+                 "BL      sub_FF82629C\n"
+                 "BL      sub_FF82CCC0\n"
+         //      "BL      nullsub_2\n"
+                 "BL      sub_FF822130\n"
+                 "BL      sub_FF82C6A8\n"
+                 "BL      sub_FF8228D4\n"
+                 "BL      sub_FF82203C\n"
+                 "BL      sub_FF82D720\n"
+                 "BL      sub_FF821FF8\n"
+                 "LDMFD   SP!, {R4,LR}\n"
+                 "B       sub_FF815088\n"
+ );
+}; 
+
+
+void CreateTask_spytask() { 
+        _CreateTask("SpyTask", 0x19, 0x2000, core_spytask, 0);
+
+}; 
+
+void CreateTask_PhySw() { 
+        _CreateTask("PhySw", 0x17, 0x800, mykbd_task, 0);
+        asm volatile ( "BL      sub_FF84962C\n");	//taskcreate_JogDial
+};
+
+
+void __attribute__((naked,noinline)) init_file_modules_task() { 
+  asm volatile (
+                "STMFD   SP!, {R4-R6,LR}\n"
+                "BL      sub_FF86FFF8\n"
+                "LDR     R5, =0x5006\n"
+                "MOVS    R4, R0\n"
+                "MOVNE   R1, #0\n"
+                "MOVNE   R0, R5\n"
+                "BLNE    sub_FF8711D8\n"
+                "BL      sub_FF870024_my\n"             //----------->
+                "BL      core_spytask_can_start\n"      // +
+                "CMP     R4, #0\n"
+                "MOVEQ   R0, R5\n"
+                "LDMEQFD SP!, {R4-R6,LR}\n"
+                "MOVEQ   R1, #0\n"
+                "BEQ     sub_FF8711D8\n"
+                "LDMFD   SP!, {R4-R6,PC}\n"
+ );
+}; 
+
+
+void __attribute__((naked,noinline)) sub_FF870024_my() { 
+ asm volatile (
+                "STMFD   SP!, {R4,LR}\n"
+                "BL      sub_FF85235C_my\n"   //----------->
+                "LDR     R4, =0x5AC4\n"
+                "LDR     R0, [R4,#4]\n"
+                "CMP     R0, #0\n"
+                "BNE     loc_FF870054\n"
+                "BL      sub_FF87FD60\n"
+                "BL      sub_FF90B9B4\n"
+                "BL      sub_FF87FD60\n"
+                "BL      sub_FF918508\n"
+                "BL      sub_FF87FD70\n"
+                "BL      sub_FF90BA5C\n"
+"loc_FF870054:\n"
+                "MOV     R0, #1\n"
+                "STR     R0, [R4]\n"
+                "LDMFD   SP!, {R4,PC}\n"
+ );
+}; 
+
+
+void __attribute__((naked,noinline)) sub_FF85235C_my() {
+ asm volatile (
+                "STMFD   SP!, {R4-R6,LR}\n"
+                "MOV     R6, #0\n"
+                "MOV     R0, R6\n"
+                "BL      sub_FF851F2C\n"
+                "LDR     R4, =0x168D0\n"
+                "MOV     R5, #0\n"
+                "LDR     R0, [R4,#0x38]\n"
+                "BL      sub_FF8528F4\n"
+                "CMP     R0, #0\n"
+                "LDREQ   R0, =0x2D34\n"
+                "STREQ   R5, [R0,#0xC]\n"
+                "STREQ   R5, [R0,#0x10]\n"
+                "STREQ   R5, [R0,#0x14]\n"
+                "MOV     R0, R6\n"
+                "BL      sub_FF851F6C\n"
+                "MOV     R0, R6\n"
+                "BL      sub_FF852198_my\n"  //-------------->
+                "MOV     R5, R0\n"
+                "MOV     R0, R6\n"
+                "BL      sub_FF852204\n"
+                "LDR     R1, [R4,#0x3C]\n"
+                "AND     R2, R5, R0\n"
+                "CMP     R1, #0\n"
+                "MOV     R0, #0\n"
+                "MOVEQ   R0, #0x80000001\n"
+                "BEQ     loc_FF8523F0\n"
+                "LDR     R3, [R4,#0x2C]\n"
+                "CMP     R3, #2\n"
+                "MOVEQ   R0, #4\n"
+                "CMP     R1, #5\n"
+                "ORRNE   R0, R0, #1\n"
+                "BICEQ   R0, R0, #1\n"
+                "CMP     R2, #0\n"
+                "BICEQ   R0, R0, #2\n"
+                "ORREQ   R0, R0, #0x80000000\n"
+                "BICNE   R0, R0, #0x80000000\n"
+                "ORRNE   R0, R0, #2\n"
+"loc_FF8523F0:\n"
+                "STR     R0, [R4,#0x40]\n"
+                "LDMFD   SP!, {R4-R6,PC}\n"
+ );
+}; 
+
+
+void __attribute__((naked,noinline)) sub_FF852198_my() {
+ asm volatile (
+                 "STMFD   SP!, {R4-R6,LR}\n"
+                 "LDR     R5, =0x2D34\n"
+                 "MOV     R6, R0\n"
+                 "LDR     R0, [R5,#0x10]\n"
+                 "CMP     R0, #0\n"
+                 "MOVNE   R0, #1\n"
+                 "LDMNEFD SP!, {R4-R6,PC}\n"
+                 "MOV     R0, #0x17\n"
+                 "MUL     R1, R0, R6\n"
+                 "LDR     R0, =0x168D0\n"
+                 "ADD     R4, R0, R1,LSL#2\n"
+                 "LDR     R0, [R4,#0x38]\n"
+                 "MOV     R1, R6\n"
+                 "BL      sub_FF852030_my\n"  //-------------->
+                 "CMP     R0, #0\n"
+                 "LDMEQFD SP!, {R4-R6,PC}\n"
+                 "LDR     R0, [R4,#0x38]\n"
+                 "MOV     R1, R6\n"
+                 "BL      sub_FF852A0C\n"
+                 "CMP     R0, #0\n"
+                 "LDMEQFD SP!, {R4-R6,PC}\n"
+                 "MOV     R0, R6\n"
+                 "BL      sub_FF851B4C\n"
+                 "CMP     R0, #0\n"
+                 "MOVNE   R1, #1\n"
+                 "STRNE   R1, [R5,#0x10]\n"
+                 "LDMFD   SP!, {R4-R6,PC}\n"
+ );
+};
+
+
+void __attribute__((naked,noinline)) sub_FF852030_my() {
+ asm volatile (	
+                 "STMFD   SP!, {R4-R8,LR}\n"
+                 "MOV     R8, R0\n"
+                 "MOV     R0, #0x17\n"
+                 "MUL     R1, R0, R1\n"
+                 "LDR     R0, =0x168D0\n"
+                 "MOV     R6, #0\n"
+                 "ADD     R7, R0, R1,LSL#2\n"
+                 "LDR     R0, [R7,#0x3C]\n"
+                 "MOV     R5, #0\n"
+                 "CMP     R0, #6\n"
+                 "ADDLS   PC, PC, R0,LSL#2\n"
+                 "B       loc_FF85217C\n"
+ "loc_FF852060:\n"
+                 "B       loc_FF852094\n"
+ "loc_FF852064:\n"
+                 "B       loc_FF85207C\n"
+ "loc_FF852068:\n"
+                 "B       loc_FF85207C\n"
+ "loc_FF85206C:\n"
+                 "B       loc_FF85207C\n"
+ "loc_FF852070:\n"
+                 "B       loc_FF85207C\n"
+ "loc_FF852074:\n"
+                 "B       loc_FF852174\n"
+ "loc_FF852078:\n"
+                 "B       loc_FF85207C\n"
+ "loc_FF85207C:\n"
+                 "MOV     R2, #0\n"
+                 "MOV     R1, #0x200\n"
+                 "MOV     R0, #3\n"
+                 "BL      sub_FF86C4D0\n"
+                 "MOVS    R4, R0\n"
+                 "BNE     loc_FF85209C\n"
+ "loc_FF852094:\n"
+                 "MOV     R0, #0\n"
+                 "LDMFD   SP!, {R4-R8,PC}\n"
+ "loc_FF85209C:\n"
+                 "LDR     R12, [R7,#0x4C]\n"
+                 "MOV     R3, R4\n"
+                 "MOV     R2, #1\n"
+                 "MOV     R1, #0\n"
+                 "MOV     R0, R8\n"
+                 "BLX     R12\n"
+                 "CMP     R0, #1\n"
+                 "BNE     loc_FF8520C8\n"
+                 "MOV     R0, #3\n"
+                 "BL      sub_FF86C610\n"
+                 "B       loc_FF852094\n"
+ "loc_FF8520C8:\n"
+                 "MOV     R0, R8\n"
+                 "BL      sub_FF9290BC\n"
+
+                 "MOV   R1, R4\n"           //  pointer to MBR in R1
+		 "BL    mbr_read_dryos\n"   //  total sectors count in R0 before and after call
+
+                // Start of DataGhost's FAT32 autodetection code
+                // Policy: If there is a partition which has type W95 FAT32, use the first one of those for image storage
+                // According to the code below, we can use R1, R2, R3 and R12.
+                // LR wasn't really used anywhere but for storing a part of the partition signature. This is the only thing
+                // that won't work with an offset, but since we can load from LR+offset into LR, we can use this to do that :)
+                "MOV     R12, R4\n"                    // Copy the MBR start address so we have something to work with
+                "MOV     LR, R4\n"                     // Save old offset for MBR signature
+                "MOV     R1, #1\n"                     // Note the current partition number
+                "B       dg_sd_fat32_enter\n"          // We actually need to check the first partition as well, no increments yet!
+           "dg_sd_fat32:\n"
+                "CMP     R1, #4\n"                     // Did we already see the 4th partition?
+                "BEQ     dg_sd_fat32_end\n"            // Yes, break. We didn't find anything, so don't change anything.
+                "ADD     R12, R12, #0x10\n"            // Second partition
+                "ADD     R1, R1, #1\n"                 // Second partition for the loop
+           "dg_sd_fat32_enter:\n"
+                "LDRB    R2, [R12, #0x1BE]\n"          // Partition status
+                "LDRB    R3, [R12, #0x1C2]\n"          // Partition type (FAT32 = 0xB)
+                "CMP     R3, #0xB\n"                   // Is this a FAT32 partition?
+                "CMPNE   R3, #0xC\n"                   // Not 0xB, is it 0xC (FAT32 LBA) then?
+                "BNE     dg_sd_fat32\n"                // No, it isn't.
+                "CMP     R2, #0x00\n"                  // It is, check the validity of the partition type
+                "CMPNE   R2, #0x80\n"
+                "BNE     dg_sd_fat32\n"                // Invalid, go to next partition
+                                                       // This partition is valid, it's the first one, bingo!
+                "MOV     R4, R12\n"                    // Move the new MBR offset for the partition detection.
+                
+           "dg_sd_fat32_end:\n"
+                // End of DataGhost's FAT32 autodetection code                
+
+                 "LDRB    R1, [R4,#0x1C9]\n"
+                 "LDRB    R3, [R4,#0x1C8]\n"
+                 "LDRB    R12, [R4,#0x1CC]\n"
+                 "MOV     R1, R1,LSL#24\n"
+                 "ORR     R1, R1, R3,LSL#16\n"
+                 "LDRB    R3, [R4,#0x1C7]\n"
+                 "LDRB    R2, [R4,#0x1BE]\n"
+           //    "LDRB    LR, [R4,#0x1FF]\n"          // replaced, see below
+                 "ORR     R1, R1, R3,LSL#8\n"
+                 "LDRB    R3, [R4,#0x1C6]\n"
+                 "CMP     R2, #0\n"
+                 "CMPNE   R2, #0x80\n"
+                 "ORR     R1, R1, R3\n"
+                 "LDRB    R3, [R4,#0x1CD]\n"
+                 "MOV     R3, R3,LSL#24\n"
+                 "ORR     R3, R3, R12,LSL#16\n"
+                 "LDRB    R12, [R4,#0x1CB]\n"
+                 "ORR     R3, R3, R12,LSL#8\n"
+                 "LDRB    R12, [R4,#0x1CA]\n"
+                 "ORR     R3, R3, R12\n"
+               //"LDRB    R12, [R4,#0x1FE]\n"     // replaced, see below
+
+                 "LDRB    R12, [LR,#0x1FE]\n"        // New! First MBR signature byte (0x55)
+                 "LDRB    LR, [LR,#0x1FF]\n"         //      Last MBR signature byte (0xAA)				
+
+                 "MOV     R4, #0\n"
+                 "BNE     loc_FF852150\n"
+                 "CMP     R0, R1\n"
+                 "BCC     loc_FF852150\n"
+                 "ADD     R2, R1, R3\n"
+                 "CMP     R2, R0\n"
+                 "CMPLS   R12, #0x55\n"
+                 "CMPEQ   LR, #0xAA\n"
+                 "MOVEQ   R6, R1\n"
+                 "MOVEQ   R5, R3\n"
+                 "MOVEQ   R4, #1\n"
+ "loc_FF852150:\n"
+                 "MOV     R0, #3\n"
+                 "BL      sub_FF86C610\n"
+                 "CMP     R4, #0\n"
+                 "BNE     loc_FF852188\n"
+                 "MOV     R6, #0\n"
+                 "MOV     R0, R8\n"
+                 "BL      sub_FF9290BC\n"
+                 "MOV     R5, R0\n"
+                 "B       loc_FF852188\n"
+ "loc_FF852174:\n"
+                 "MOV     R5, #0x40\n"
+                 "B       loc_FF852188\n"
+ "loc_FF85217C:\n"
+                 "LDR     R1, =0x365\n"
+                 "LDR     R0, =0xFF852024\n"
+                 "BL      sub_FF81BFC8\n"
+ "loc_FF852188:\n"
+                 "STR     R6, [R7,#0x44]!\n"
+                 "MOV     R0, #1\n"
+                 "STR     R5, [R7,#4]\n"
+                 "LDMFD   SP!, {R4-R8,PC}\n"
+ );
+}; 
+
+
+// I could not manually find this function in the S5IS firmware, possibly signatures
+// might find it. Until that moment, I hooked it here (copied from another camera)
+unsigned long __attribute__((naked,noinline)) _time(unsigned long *timer) {
+     asm volatile (
+          "STMFD   SP!, {R3-R5,LR}\n"
+          "MOV     R4, R0\n"
+          "MVN     R0, #0\n"
+          "STR     R0, [SP,#0x10-0x10]\n"
+          "MOV     R0, SP\n"
+          "BL      sub_FF86BAEC\n" // _GetTimeOfSystem\n"
+          "CMP     R0, #0\n"
+          "BNE     loc_FFC55F38\n"
+          "CMP     R4, #0\n"
+          "LDRNE   R0, [SP,#0x10-0x10]\n"
+          "STRNE   R0, [R4]\n"
+
+     "loc_FFC55F38:\n"
+          "LDR     R0, [SP,#0x10-0x10]\n"
+          "LDMFD   SP!, {R3-R5,PC}\n"
+     );
+   return 0;  // shut up the compiler
+}
+
Index: /branches/reyalp-ptp-live/platform/g9/sub/100i/stubs_min.S
===================================================================
--- /branches/reyalp-ptp-live/platform/g9/sub/100i/stubs_min.S	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/g9/sub/100i/stubs_min.S	(revision 1668)
@@ -0,0 +1,4 @@
+#include "stubs_asm.h"
+
+DEF(FlashParamsTable,                   0xFFB082B8) //OK  in FFA4C754
+DEF(recreview_hold,                     0xF050)     // 0xEFA0+0xB0		//OK
Index: /branches/reyalp-ptp-live/platform/g9/sub/100i/makefile.inc
===================================================================
--- /branches/reyalp-ptp-live/platform/g9/sub/100i/makefile.inc	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/g9/sub/100i/makefile.inc	(revision 1668)
@@ -0,0 +1,15 @@
+#315A
+PLATFORMID=12634
+
+PLATFORMOS=dryos
+
+MEMBASEADDR=0x1900
+RESTARTSTART=0x50000	
+MEMISOSTART=0xB0B68
+ROMBASEADDR=0xff810000
+
+
+PLFLAGS=-DMEMBASEADDR=$(MEMBASEADDR) -DMEMISOSTART=$(MEMISOSTART) -DMEMISOSIZE=$(MEMISOSIZE)
+PLFLAGS+=-DRESTARTSTART=$(RESTARTSTART)
+
+KEYSYS=d3
Index: /branches/reyalp-ptp-live/platform/g9/sub/100i/stubs_asm.h
===================================================================
--- /branches/reyalp-ptp-live/platform/g9/sub/100i/stubs_asm.h	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/g9/sub/100i/stubs_asm.h	(revision 1668)
@@ -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/reyalp-ptp-live/platform/g9/sub/100i/lib.c
===================================================================
--- /branches/reyalp-ptp-live/platform/g9/sub/100i/lib.c	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/g9/sub/100i/lib.c	(revision 1668)
@@ -0,0 +1,78 @@
+#include "platform.h"
+#include "stdlib.h"
+#include "lolevel.h"
+
+
+char *hook_raw_image_addr()
+{
+ return (char*) (*(int*)(0x5854+0x18) ? 0x11F8F740 : 0x108297C0);
+}
+
+long hook_raw_size()
+{
+    return 0xEE9710;//OK
+}
+
+void *vid_get_viewport_live_fb()
+{
+    return (void*)0;
+//    void **fb=(void **)0x21D0;
+//    unsigned char buff = *((unsigned char*)0x2084);
+//    if (buff == 0) {
+//        buff = 2;
+//    }
+//    else {
+//        buff--;
+//    }
+//    return fb[buff];
+}
+
+void *vid_get_bitmap_fb()       
+{
+    return (void*)0x10361000;//OK	
+	//THUM VRAM BUFF=0x103F2920 ;  IMG VRAM BUFF=0x108876B0 ; JPEG BUFF=0x11713000 ; MJVRAM Address=0x107F7040 ; MJVRAM Size=0x180000
+	//VRAM Address=0x1067B540 ; VRAM Size=0x7E900
+}
+
+void *vid_get_viewport_fb()
+{
+     return (void*)0x1067B540;//OK //0x1065A560;
+					
+}
+
+void *vid_get_viewport_fb_d()
+{
+    return (void*)(*(int*)0x55A0); //OK // 0x5558 + 0x48
+}
+
+long vid_get_viewport_height()
+{
+    return 240;
+}
+
+void JogDial_CW(void){
+  (*(short*)(0x263C+2))--;
+//  *(int*)(0x263C+0x18)=0x0;
+  *(int*)(0x263C+0x14)=0x32;
+  _GiveSemaphore(*(int*)(0x263C+0x0C));
+}
+
+void JogDial_CCW(void){
+  (*(short*)(0x263C+2))++;
+//  *(int*)(0x263C+0x18)=0x0;
+  *(int*)(0x263C+0x14)=0x32;
+  _GiveSemaphore(*(int*)(0x263C+0x0C));
+}
+
+
+int review_fullscreen_mode(){
+ char r;
+ get_parameter_data(53, &r, 1);
+ return  r==0;
+}
+//from g7
+
+char *camera_jpeg_count_str()
+{
+    return (char*)0x60354;//OK
+}
Index: /branches/reyalp-ptp-live/platform/g9/sub/100i/movie_rec.c
===================================================================
--- /branches/reyalp-ptp-live/platform/g9/sub/100i/movie_rec.c	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/g9/sub/100i/movie_rec.c	(revision 1668)
@@ -0,0 +1,367 @@
+void __attribute__((naked,noinline)) movie_record_task(){ 
+ asm volatile(
+                "STMFD   SP!, {R2-R8,LR}\n"
+                "LDR     R8, =0x32B\n"
+                "LDR     R7, =0x2710\n"
+                "LDR     R4, =0x56D8\n"
+                "MOV     R6, #0\n"
+                "MOV     R5, #1\n"
+"loc_FF85D4D8:\n"
+                "LDR     R0, [R4,#0x1C]\n"
+                "MOV     R2, #0\n"
+                "ADD     R1, SP, #4\n"
+                "BL      sub_FF829FB0\n"
+                "LDR     R0, [R4,#0x24]\n"
+                "CMP     R0, #0\n"
+                "BNE     loc_FF85D5A8\n"
+                "LDR     R0, [SP,#4]\n"
+                "LDR     R1, [R0]\n"
+                "SUB     R1, R1, #2\n"
+                "CMP     R1, #9\n"
+                "ADDLS   PC, PC, R1,LSL#2\n"
+                "B       loc_FF85D5A8\n"
+"loc_FF85D50C:\n"
+                "B       loc_FF85D55C\n"
+"loc_FF85D510:\n"
+                "B       loc_FF85D57C\n"
+"loc_FF85D514:\n"
+                "B       loc_FF85D58C\n"
+"loc_FF85D518:\n"
+                "B       loc_FF85D594\n"
+"loc_FF85D51C:\n"
+                "B       loc_FF85D564\n"
+"loc_FF85D520:\n"
+                "B       loc_FF85D59C\n"
+"loc_FF85D524:\n"
+                "B       loc_FF85D56C\n"
+"loc_FF85D528:\n"
+                "B       loc_FF85D5A8\n"
+"loc_FF85D52C:\n"
+                "B       loc_FF85D5A4\n"
+"loc_FF85D530:\n"
+                "B       loc_FF85D534\n"
+"loc_FF85D534:\n"
+                "LDR     R0, =0xFF85D180\n"
+                "STR     R6, [R4,#0x38]\n"
+                "STR     R0, [R4,#0xA4]\n"
+                "LDR     R0, =0xFF85CABC\n"
+                "LDR     R2, =0xFF85C9D8\n"
+                "LDR     R1, =0x1E080\n"
+                "STR     R6, [R4,#0x28]\n"
+                "BL      sub_FF83D8B4\n"
+                "STR     R5, [R4,#0x3C]\n"
+                "B       loc_FF85D5A8\n"
+"loc_FF85D55C:\n"
+                "BL      unlock_optical_zoom\n"  // +
+                "BL      sub_FF85D278\n"
+                "B       loc_FF85D5A8\n"
+"loc_FF85D564:\n"
+                "BL      sub_FF85CF18_my\n"      //---------->
+                "B       loc_FF85D5A8\n"
+"loc_FF85D56C:\n"
+                "LDR     R1, [R0,#0x10]\n"
+                "LDR     R0, [R0,#4]\n"
+                "BL      sub_FF940D14\n"
+                "B       loc_FF85D5A8\n"
+"loc_FF85D57C:\n"
+                "LDR     R0, [R4,#0x3C]\n"
+                "CMP     R0, #5\n"
+                "STRNE   R5, [R4,#0x2C]\n"
+                "B       loc_FF85D5A8\n"
+"loc_FF85D58C:\n"
+                "BL      sub_FF85CCA8\n"
+                "B       loc_FF85D5A8\n"
+"loc_FF85D594:\n"
+                "BL      sub_FF85CB08\n"
+                "B       loc_FF85D5A8\n"
+"loc_FF85D59C:\n"
+                "BL      sub_FF85C964\n"
+                "B       loc_FF85D5A8\n"
+"loc_FF85D5A4:\n"
+                "BL      sub_FF85D710\n"
+"loc_FF85D5A8:\n"
+                "LDR     R1, [SP,#4]\n"
+                "STR     R6, [R1]\n"
+                "LDR     R3, =0xFF85C768\n"
+                "MOV     R2, R7\n"
+                "STR     R8, [SP]\n"
+                "LDR     R0, [R4,#0x20]\n"
+                "BL      sub_FF81BF08\n"
+                "B       loc_FF85D4D8\n"
+ );
+} 
+
+
+void __attribute__((naked,noinline)) sub_FF85CF18_my(){ 
+ asm volatile(   
+                "STMFD   SP!, {R4-R9,LR}\n"
+                "SUB     SP, SP, #0x3C\n"
+                "MOV     R7, #0\n"
+                "LDR     R5, =0x56D8\n"
+                "MOV     R4, R0\n"
+                "STR     R7, [SP,#0x2C]\n"
+                "STR     R7, [SP,#0x24]\n"
+                "LDR     R0, [R5,#0x3C]\n"
+                "MOV     R8, #4\n"
+                "CMP     R0, #3\n"
+                "STREQ   R8, [R5,#0x3C]\n"
+                "LDR     R0, [R5,#0xA4]\n"
+                "MOV     R6, #0\n"
+                "BLX     R0\n"
+                "LDR     R0, [R5,#0x3C]\n"
+                "CMP     R0, #4\n"
+                "BNE     loc_FF85D028\n"
+                "LDRH    R0, [R5,#2]\n"
+                "MOV     R9, #1\n"
+                "CMP     R0, #1\n"
+                "BNE     loc_FF85CF94\n"
+                "LDRH    R1, [R5,#4]\n"
+                "LDR     R0, [R5,#0x4C]\n"
+                "MUL     R0, R1, R0\n"
+                "MOV     R1, #0x3E8\n"
+                "BL      sub_FFABECD0\n"
+                "MOV     R1, R0\n"
+                "LDR     R0, [R5,#0x54]\n"
+                "BL      sub_FFABECD0\n"
+                "CMP     R1, #0\n"
+                "BNE     loc_FF85CFB0\n"
+"loc_FF85CF94:\n"
+                "ADD     R3, SP, #0x24\n"
+                "ADD     R2, SP, #0x28\n"
+                "ADD     R1, SP, #0x2C\n"
+                "ADD     R0, SP, #0x30\n"
+                "BL      sub_FF940EA8\n"
+                "MOVS    R6, R0\n"
+                "BNE     loc_FF85CFCC\n"
+"loc_FF85CFB0:\n"
+                "LDR     R0, [R5,#0x2C]\n"
+                "CMP     R0, #1\n"
+                "BNE     loc_FF85D030\n"
+                "LDR     R0, [R5,#0x54]\n"
+                "LDR     R1, [R5,#0x40]\n"
+                "CMP     R0, R1\n"
+                "BCC     loc_FF85D030\n"
+"loc_FF85CFCC:\n"
+                "CMP     R6, #0x80000001\n"
+                "STREQ   R8, [R5,#0x58]\n"
+                "BEQ     loc_FF85D004\n"
+                "CMP     R6, #0x80000003\n"
+                "STREQ   R9, [R5,#0x58]\n"
+                "BEQ     loc_FF85D004\n"
+                "CMP     R6, #0x80000005\n"
+                "MOVEQ   R0, #2\n"
+                "BEQ     loc_FF85D000\n"
+                "CMP     R6, #0x80000007\n"
+                "STRNE   R7, [R5,#0x58]\n"
+                "BNE     loc_FF85D004\n"
+                "MOV     R0, #3\n"
+"loc_FF85D000:\n"
+                "STR     R0, [R5,#0x58]\n"
+"loc_FF85D004:\n"
+                "LDR     R0, =0x1E0B0\n"
+                "LDR     R0, [R0,#8]\n"
+                "CMP     R0, #0\n"
+                "BEQ     loc_FF85D01C\n"
+                "BL      sub_FF84ACE4\n"
+                "B       loc_FF85D020\n"
+"loc_FF85D01C:\n"
+                "BL      sub_FF85C964\n"
+"loc_FF85D020:\n"
+                "MOV     R0, #5\n"
+                "STR     R0, [R5,#0x3C]\n"
+"loc_FF85D028:\n"
+                "ADD     SP, SP, #0x3C\n"
+                "LDMFD   SP!, {R4-R9,PC}\n"
+"loc_FF85D030:\n"
+                "LDR     R12, [SP,#0x2C]\n"
+                "CMP     R12, #0\n"
+                "BEQ     loc_FF85D128\n"
+                "STR     R9, [R5,#0x30]\n"
+                "LDR     R0, [R5,#0x48]\n"
+                "CMP     R0, #4\n"
+                "LDRNE   LR, [R4,#0xC]\n"
+                "BNE     loc_FF85D070\n"
+                "LDR     R0, [R4,#0xC]\n"
+                "LDR     R1, [R4,#8]\n"
+                "MOV     R2, R0,LSR#3\n"
+                "MUL     R1, R2, R1\n"
+                "LDR     R2, [R4,#4]\n"
+                "SUB     LR, R0, R0,LSR#2\n"
+                "ADD     R1, R2, R1,LSL#1\n"
+                "STR     R1, [R4,#4]\n"
+"loc_FF85D070:\n"
+                "LDR     R0, [R5,#0x70]\n"
+                "LDR     R1, [R4,#0x14]\n"
+                "LDR     R2, [R4,#0x18]\n"
+                "ADD     R3, SP, #0x34\n"
+                "ADD     R6, SP, #0x14\n"
+                "STMIA   R6, {R0-R3}\n"
+                "LDR     R0, [SP,#0x24]\n"
+                "LDR     R3, [R5,#0x5C]\n"
+                "LDR     R1, [SP,#0x28]\n"
+                "ADD     R2, SP, #0x38\n"
+                "ADD     R6, SP, #8\n"
+                "STMIA   R6, {R0,R2,R3}\n"
+                "STR     R1, [SP,#4]\n"
+                "STR     R12, [SP]\n"
+                "LDMIB   R4, {R0,R1}\n"
+                "LDR     R3, [SP,#0x30]\n"
+                "MOV     R2, LR\n"
+                "BL      sub_FF8FBD68\n"
+                "LDR     R0, [R5,#0x14]\n"
+                "MOV     R1, #0x3E8\n"
+                "BL      sub_FF81B98C\n"
+                "CMP     R0, #9\n"
+                "BNE     loc_FF85D0DC\n"
+                "BL      sub_FF941484\n"
+                "MOV     R0, #0x90000\n"
+                "STR     R9, [R5,#0x3C]\n"
+                "B       loc_FF85D0F4\n"
+"loc_FF85D0DC:\n"
+                "LDR     R0, [SP,#0x34]\n"
+                "CMP     R0, #0\n"
+                "BEQ     loc_FF85D0FC\n"
+                "BL      sub_FF941484\n"
+                "MOV     R0, #0xA0000\n"
+                "STR     R9, [R5,#0x3C]\n"
+"loc_FF85D0F4:\n"
+                "BL      sub_FF87347C\n"
+                "B       loc_FF85D028\n"
+"loc_FF85D0FC:\n"
+                "BL      sub_FF8FBE2C\n"
+                "LDR     R0, [SP,#0x30]\n"
+                "LDR     R1, [SP,#0x38]\n"
+                "BL      sub_FF94122C\n"
+                "LDR     R0, [R5,#0x50]\n"
+                "LDR     R1, =0x5748\n"
+                "ADD     R0, R0, #1\n"
+                "STR     R0, [R5,#0x50]\n"
+                "LDR     R0, [SP,#0x38]\n"
+                "MOV     R2, #0\n"
+                "BL      sub_FF93F04C_my\n"  //---------->
+"loc_FF85D128:\n"
+                "LDR     R0, [R5,#0x54]\n"
+                "ADD     R0, R0, #1\n"
+                "STR     R0, [R5,#0x54]\n"
+                "LDR     R1, [R5,#0x7C]\n"
+                "MUL     R0, R1, R0\n"
+                "LDR     R1, [R5,#0x78]\n"
+                "BL      sub_FFABECD0\n"
+                "MOV     R4, R0\n"
+                "BL      sub_FF9414BC\n"
+                "LDR     R1, [R5,#0x74]\n"
+                "CMP     R1, R4\n"
+                "BNE     loc_FF85D164\n"
+                "LDR     R0, [R5,#0x34]\n"
+                "CMP     R0, #1\n"
+                "BNE     loc_FF85D178\n"
+"loc_FF85D164:\n"
+                "LDR     R1, [R5,#0x88]\n"
+                "MOV     R0, R4\n"
+                "BLX     R1\n"
+                "STR     R4, [R5,#0x74]\n"
+                "STR     R7, [R5,#0x34]\n"
+"loc_FF85D178:\n"
+                "STR     R7, [R5,#0x30]\n"
+                "B       loc_FF85D028\n"
+
+ );
+} 
+
+void __attribute__((naked,noinline)) sub_FF93F04C_my(){   
+ asm volatile(
+                "STMFD   SP!, {R4-R8,LR}\n"
+                "LDR     R4, =0xE400\n"
+                "LDR     LR, [R4]\n"
+                "LDR     R2, [R4,#8]\n"
+                "CMP     LR, #0\n"
+                "LDRNE   R3, [R4,#0xC]\n"
+                "MOV     R5, R2\n"
+                "CMPNE   R3, #1\n"
+                "MOVEQ   R2, #0\n"
+                "STREQ   R0, [R4]\n"
+                "STREQ   R2, [R4,#0xC]\n"
+                "BEQ     loc_FF93F118\n"
+                "LDR     R3, [R4,#4]\n"
+                "LDR     R7, =table\n"            // *
+                "ADD     R12, R3, R3,LSL#1\n"
+                "LDR     R3, [R7,R12,LSL#2]\n"
+                "ADD     R6, R7, #0x60\n"
+                "LDR     R8, [R6,R12,LSL#2]\n"
+                "SUB     R3, LR, R3\n"
+                "CMP     R3, #0\n"
+                "SUB     LR, LR, R8\n"
+                "BLE     loc_FF93F0D4\n"
+                "ADD     R12, R7, R12,LSL#2\n"
+                "LDR     LR, [R12,#4]\n"
+                "CMP     LR, R3\n"
+                "ADDGE   R2, R2, #1\n"
+                "BGE     loc_FF93F0C8\n"
+                "LDR     R12, [R12,#8]\n"
+                "CMP     R12, R3\n"
+                "ADDLT   R2, R2, #3\n"
+                "ADDGE   R2, R2, #2\n"
+"loc_FF93F0C8:\n"
+    //          "CMP     R2, #0x17\n"   // -
+    //          "MOVGE   R2, #0x16\n"   // -
+                "CMP     R2, #0x1A\n"   // +
+                "MOVGE   R2, #0x19\n"   // +
+                "B       loc_FF93F108\n"
+"loc_FF93F0D4:\n"
+                "CMP     LR, #0\n"
+                "BGE     loc_FF93F108\n"
+                "ADD     R3, R6, R12,LSL#2\n"
+                "LDR     R12, [R3,#4]\n"
+                "CMP     R12, LR\n"
+                "SUBLE   R2, R2, #1\n"
+                "BLE     loc_FF93F100\n"
+                "LDR     R3, [R3,#8]\n"
+                "CMP     R3, LR\n"
+                "SUBGT   R2, R2, #3\n"
+                "SUBLE   R2, R2, #2\n"
+"loc_FF93F100:\n"
+                "CMP     R2, #0\n"
+                "MOVLT   R2, #0\n"
+"loc_FF93F108:\n"
+                "CMP     R2, R5\n"
+                "STRNE   R2, [R4,#8]\n"
+                "MOVNE   R2, #1\n"
+                "STRNE   R2, [R4,#0xC]\n"
+"loc_FF93F118:\n"
+                "LDR     R2, =CompressionRateTable\n"  // *
+                "LDR     R3, [R4,#8]\n"
+                "LDR     R2, [R2,R3,LSL#2]\n"
+
+                "LDR     R3, =video_mode\n"      // +
+                "LDR     R3, [R3]\n"             // +
+                "LDR     R3, [R3]\n"             // +
+                "CMP     R3, #1\n"               // +
+                "LDREQ   R3, =video_quality\n"   // +     
+                "LDREQ   R3, [R3]\n"             // +     
+                "LDREQ   R2, [R3]\n"             // +     
+
+                "STR     R2, [R1]\n"
+                "STR     R0, [R4]\n"
+                "LDMFD   SP!, {R4-R8,PC}\n"
+ );
+} 
+
+#include "conf.h"
+
+int *video_quality = &conf.video_quality;
+int *video_mode    = &conf.video_mode;
+
+long def_table[48]={
+  0x2000,   0x38D,   0x788, 0x5800,  0x9C5,  0x14B8, 0x10000,  0x1C6A,  0x3C45, 0x20000,  0x387A,  0x7813,
+ 0x25800,  0x422F,  0x8CB6, 0x8000,  0xE35,  0x1E23, 0x10000,  0x1C6A,  0x3C45, 0x12C00,  0x2118,  0x465B,
+  0x1CCD,  -0x2E1,  -0x579, 0x4F33, -0x7EB,  -0xF0C,  0xE666, -0x170A, -0x2BC6, 0x1CC39, -0x2F5B, -0x59F0,
+ 0x21B53, -0x377F, -0x6965, 0x7333, -0xB85, -0x15E3,  0xE666, -0x170A, -0x2BC6, 0x10DAA, -0x1BC0, -0x34B3};
+
+long table[48];
+
+void change_video_tables(int a, int b){
+ int i;
+ for (i=0;i<48;i++) table[i]=(def_table[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};
Index: /branches/reyalp-ptp-live/platform/g9/sub/100i/stubs_auto.S
===================================================================
--- /branches/reyalp-ptp-live/platform/g9/sub/100i/stubs_auto.S	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/g9/sub/100i/stubs_auto.S	(revision 1668)
@@ -0,0 +1,189 @@
+/* THIS FILE IS GENERATED */
+/* DO NOT EDIT THIS FILE! */
+
+#include "stubs_asm.h"
+
+STUB(FF8101a4)
+STUB(FF81095C)
+STUB(FF810FB8)
+STUB(FF8114D0)
+STUB(FF812D70)
+STUB(FF81357C)
+STUB(FF8149E0)
+STUB(FF814ACC)
+STUB(FF814EB0)
+STUB(FF815088)
+STUB(FF81517C)
+STUB(FF8194D0)
+STUB(FF819948)
+STUB(FF81B98C)
+STUB(FF81BAF0)
+STUB(FF81BD80)
+STUB(FF81BF08)
+STUB(FF81BFC8)
+STUB(FF820E60)
+STUB(FF821FF8)
+STUB(FF82203C)
+STUB(FF822130)
+STUB(FF8228D4)
+STUB(FF822E10)
+STUB(FF823FA0)
+STUB(FF824568)
+STUB(FF826210)
+STUB(FF82629C)
+STUB(FF8299CC)
+STUB(FF829C64)
+STUB(FF829D2C)
+STUB(FF829D60)
+STUB(FF829FB0)
+STUB(FF82A488)
+STUB(FF82A67C)
+STUB(FF82A6D0)
+STUB(FF82C6A8)
+STUB(FF82C8FC)
+STUB(FF82C9C4)
+STUB(FF82CADC)
+STUB(FF82CB2C)
+STUB(FF82CCA4)
+STUB(FF82CCA8)
+STUB(FF82CCC0)
+STUB(FF82D720)
+STUB(FF83D8B4)
+STUB(FF84962C)
+STUB(FF84ACE4)
+STUB(FF84BE78)
+STUB(FF851B4C)
+STUB(FF851F2C)
+STUB(FF851F6C)
+STUB(FF852030)
+STUB(FF852198)
+STUB(FF852204)
+STUB(FF85235C)
+STUB(FF8528F4)
+STUB(FF852A0C)
+STUB(FF85B94C)
+STUB(FF85C964)
+STUB(FF85CB08)
+STUB(FF85CCA8)
+STUB(FF85CF18)
+STUB(FF85D278)
+STUB(FF85D710)
+STUB(FF85F050)
+STUB(FF85F620)
+STUB(FF860938)
+STUB(FF860BD0)
+STUB(FF860CEC)
+STUB(FF8615D0)
+STUB(FF86499C)
+STUB(FF864D24)
+STUB(FF86BAEC)
+STUB(FF86C4D0)
+STUB(FF86C610)
+STUB(FF86F768)
+STUB(FF86F8F8)
+STUB(FF86FB0C)
+STUB(FF86FFF8)
+STUB(FF870024)
+STUB(FF8711D8)
+STUB(FF87347C)
+STUB(FF87FD60)
+STUB(FF87FD70)
+STUB(FF897408)
+STUB(FF897664)
+STUB(FF897B9C)
+STUB(FF897C24)
+STUB(FF897EA4)
+STUB(FF8983E4)
+STUB(FF8ACA40)
+STUB(FF8B56C0)
+STUB(FF8B57CC)
+STUB(FF8B5824)
+STUB(FF8B587C)
+STUB(FF8B58D4)
+STUB(FF8B592C)
+STUB(FF8B5A6C)
+STUB(FF8B5B24)
+STUB(FF8B5DAC)
+STUB(FF8B5FB0)
+STUB(FF8B6218)
+STUB(FF8B640C)
+STUB(FF8B6670)
+STUB(FF8B67AC)
+STUB(FF8B6A04)
+STUB(FF8B6C40)
+STUB(FF8B6F3C)
+STUB(FF8B7040)
+STUB(FF8B7274)
+STUB(FF8B73EC)
+STUB(FF8B7584)
+STUB(FF8B76BC)
+STUB(FF8B7904)
+STUB(FF8B888C)
+STUB(FF8B8AE0)
+STUB(FF8B8B40)
+STUB(FF8B9E70)
+STUB(FF8B9EA0)
+STUB(FF8B9EE4)
+STUB(FF8BA060)
+STUB(FF8BA10C)
+STUB(FF8BA1AC)
+STUB(FF8BA244)
+STUB(FF8CF8C0)
+STUB(FF8FBD68)
+STUB(FF8FBE2C)
+STUB(FF90B9B4)
+STUB(FF90BA5C)
+STUB(FF918508)
+STUB(FF9290BC)
+STUB(FF9362E8)
+STUB(FF936388)
+STUB(FF936414)
+STUB(FF93655C)
+STUB(FF936AA8)
+STUB(FF93F04C)
+STUB(FF940D14)
+STUB(FF940EA8)
+STUB(FF94122C)
+STUB(FF941484)
+STUB(FF9414BC)
+STUB(FF94218C)
+STUB(FF942424)
+STUB(FF94242C)
+STUB(FF942434)
+STUB(FF942490)
+STUB(FF942580)
+STUB(FF94260C)
+STUB(FF942690)
+STUB(FF94282C)
+STUB(FF9428E0)
+STUB(FF942934)
+STUB(FF942B9C)
+STUB(FF942FC4)
+STUB(FF94323C)
+STUB(FF943438)
+STUB(FF9434CC)
+STUB(FF9435F4)
+STUB(FF9436A8)
+STUB(FF943914)
+STUB(FF943920)
+STUB(FF9439E4)
+STUB(FF943A7C)
+STUB(FF943ACC)
+STUB(FF943B30)
+STUB(FF943C70)
+STUB(FF943D04)
+STUB(FF943DC4)
+STUB(FF943F2C)
+STUB(FF94439C)
+STUB(FF944484)
+STUB(FF9444F8)
+STUB(FF944930)
+STUB(FF944990)
+STUB(FF944EDC)
+STUB(FF945048)
+STUB(FF94553C)
+STUB(FF957C54)
+STUB(FF9BF0C4)
+STUB(FFABD1C4)
+STUB(FFABD420)
+STUB(FFABECD0)
Index: /branches/reyalp-ptp-live/platform/g9/sub/100i/Makefile
===================================================================
--- /branches/reyalp-ptp-live/platform/g9/sub/100i/Makefile	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/g9/sub/100i/Makefile	(revision 1668)
@@ -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/reyalp-ptp-live/platform/g9/sub/Makefile
===================================================================
--- /branches/reyalp-ptp-live/platform/g9/sub/Makefile	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/g9/sub/Makefile	(revision 1668)
@@ -0,0 +1,8 @@
+topdir=../../../
+include $(topdir)makefile.inc
+
+SUBDIRS=$(PLATFORMSUB)
+
+all: all-recursive
+
+clean: clean-recursive
Index: /branches/reyalp-ptp-live/platform/g9/shooting.c
===================================================================
--- /branches/reyalp-ptp-live/platform/g9/shooting.c	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/g9/shooting.c	(revision 1668)
@@ -0,0 +1,158 @@
+#define PARAM_FILE_COUNTER      0x38
+
+// DRYOS-Notes:
+// propertycase
+//   196 - overall brightness (of viewport?)
+
+#include "platform.h"
+
+const ApertureSize aperture_sizes_table[] = {
+    {  9, 288, "2.8" },
+    { 10, 320, "3.2" },
+    { 11, 352, "3.5" },
+    { 12, 384, "4.0" },
+    { 13, 416, "4.5" },
+    { 14, 448, "5.0" },
+    { 15, 480, "5.6" },
+    { 16, 512, "6.3" },
+    { 17, 544, "7.1" },
+    { 18, 576, "8.0" },
+};
+
+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, 1024, "1/1600",  625 },
+    {  33, 1056, "1/2000",  500 },
+    {  34, 1084, "1/2500",  400 },
+};
+
+const ISOTable iso_table[] = {
+    { -1,    1,   "HI", -1},
+    {  0,    0, "Auto", -1},
+    {  1,   80,   "80", -1},
+    {  2,  100,  "100", -1},
+    {  3,  200,  "200", -1},
+    {  4,  400,  "400", -1},
+    {  5,  800,  "800", -1},
+    {  6, 1600, "1600", -1},
+};          
+
+/*
+http://www.usa.canon.com/consumer/controller?act=ModelInfoAct&fcategoryid=222&modelid=15669#ModelTechSpecsAct
+Shooting Modes
+	Auto, P, Av, Tv, M, C1, C2,
+	Special Scene
+		(Portrait, Landscape, Night Scene, Sports, Foliage, 
+		Snow, Beach, Fireworks, Aquarium, Underwater, Indoor,
+		ISO 3200, Kids & Pets, Night Snapshot, Color Accent, Color Swap),
+	Stitch Assist, Movie
+
+Movie: 1024 x 768 (15 fps), 640 x 480 (30 fps/30 fps LP), 640 x 480 (2 hours at 0.5 fps/1 fps), 320 x 240 (30 fps) available up to 4GB or 60 minutes, 160 x 120 (3 minutes at 15 fps)
+
+canon modelist in 100d 
+*/
+const CapturemodeMap modemap[] = {
+    { MODE_AUTO,               32768 },
+    { MODE_P,                  32772 },
+    { MODE_TV,                 32771 },
+    { MODE_AV,                 32770 },
+    { MODE_M,                  32769 },
+    { MODE_VIDEO_STD,          2597  },
+    { MODE_VIDEO_HIRES,        2600  },
+    { MODE_VIDEO_COMPACT,      2599  },
+    { MODE_VIDEO_COLOR_SWAP,   2596  },
+    { MODE_VIDEO_COLOR_ACCENT, 2595  },
+    { MODE_VIDEO_TIME_LAPSE,   2601  },
+    { MODE_STITCH,             33290 },
+    { MODE_SCN_PORTRAIT,       16397 },
+    { MODE_SCN_NIGHT_SCENE,    16398 },
+    { MODE_SCN_NIGHT_SNAPSHOT, 16395 },
+    { MODE_SCN_INDOOR,         16401 },
+    { MODE_SCN_SNOW,           16403 },
+    { MODE_SCN_FIREWORK,       16405 },
+    { MODE_SCN_UNDERWATER,     16406 },
+    { MODE_SCN_COLOR_ACCENT,   16922 },
+    { MODE_SCN_SPORT,          16903 },
+    { MODE_SCN_KIDS_PETS,      16400 },
+    { MODE_SCN_FOLIAGE,        16402 },
+    { MODE_SCN_BEACH,          16404 },
+    { MODE_SCN_AQUARIUM,       16407 },
+    { MODE_SCN_ISO_3200,       16412 },
+    { MODE_SCN_COLOR_SWAP,	   16923 },
+    { MODE_SCN_LANDSCAPE,      16396 }
+/*
+probably C1, C2
+ROM:FFB080B4                 DCW 8223
+ROM:FFB080B6                 DCW 8224
+*/
+};
+
+#include "../generic/shooting.c"
+
+const int dof_tbl[] = {7400, 8210, 9040, 9860, 10670, 12730, 14780, 16820, 18890, 21970, 25030, 29170, 36780, 44400};
+const int dof_tbl_size = sizeof(dof_tbl)/sizeof(dof_tbl[0]);
+
+long get_file_next_counter() {
+    return get_file_counter();
+}
+
+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 = 6;
Index: /branches/reyalp-ptp-live/platform/g9/Makefile
===================================================================
--- /branches/reyalp-ptp-live/platform/g9/Makefile	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/g9/Makefile	(revision 1668)
@@ -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
+lib.o: lib.c
+main.o: 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/reyalp-ptp-live/platform/s3is/kbd.c
===================================================================
--- /branches/reyalp-ptp-live/platform/s3is/kbd.c	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/s3is/kbd.c	(revision 1668)
@@ -0,0 +1,337 @@
+#include "lolevel.h"
+#include "platform.h"
+#include "core.h"
+#include "conf.h"
+#include "keyboard.h"
+
+typedef struct {
+	short grp;
+	short hackkey;
+	long canonkey;
+} KeyMap;
+
+
+long kbd_new_state[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF };
+static long kbd_prev_state[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF };
+static long kbd_mod_state[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF };
+
+static KeyMap keymap[];
+static long last_kbd_key = 0;
+static long alt_mode_key_mask = 0x00004000;
+
+#define KEYS_MASK0 (0x00000003)
+#define KEYS_MASK1 (0x5f7f7038)
+#define KEYS_MASK2 (0x00000000)
+
+#define NEW_SS (0x2000)
+#define SD_READONLY_FLAG (0x20000)
+#define USB_MASK (8)
+#define USB_IDX 2
+
+extern void usb_remote_key( int ) ;
+int get_usb_bit() 
+{
+	return 0 ;
+/*	
+	long usb_physw[3];
+	usb_physw[USB_IDX] = 0;
+	_kbd_read_keys_r2(usb_physw);
+	return(( usb_physw[USB_IDX] & USB_MASK)==USB_MASK) ; 
+*/
+}
+
+#ifndef MALLOCD_STACK
+static char kbd_stack[NEW_SS];
+#endif
+
+extern void _platformsub_kbd_fetch_data(long*);
+long __attribute__((naked)) wrap_kbd_p1_f() ;
+
+
+static void __attribute__((noinline)) mykbd_task_proceed()
+{
+    while (physw_run){
+	_SleepTask(10);
+
+	if (wrap_kbd_p1_f() == 1){ // autorepeat ?
+	    _kbd_p2_f();
+	}
+    }
+}
+
+void __attribute__((naked,noinline))
+mykbd_task(long ua, long ub, long uc, long ud, long ue, long uf)
+{
+    /* WARNING
+     * Stack pointer manipulation performed here!
+     * This means (but not limited to):
+     *	function arguments destroyed;
+     *	function CAN NOT return properly;
+     *	MUST NOT call or use stack variables before stack
+     *	is setup properly;
+     *
+     */
+
+    register int i;
+    register long *newstack;
+
+#ifndef MALLOCD_STACK
+    newstack = (void*)kbd_stack;
+#else
+    newstack = malloc(NEW_SS);
+#endif
+
+    for (i=0;i<NEW_SS/4;i++)
+	newstack[i]=0xdededede;
+
+    asm volatile (
+	"MOV	SP, %0"
+	:: "r"(((char*)newstack)+NEW_SS)
+	: "memory"
+    );
+
+    mykbd_task_proceed();
+
+    /* function can be modified to restore SP here...
+     */
+
+    _ExitTask();
+}
+
+
+long __attribute__((naked,noinline)) wrap_kbd_p1_f()
+{
+
+    asm volatile(
+                "STMFD   SP!, {R4-R7,LR}\n"
+                "SUB     SP, SP, #0xC\n"
+                "BL      my_kbd_read_keys\n"
+		"B	 _kbd_p1_f_cont\n"
+    );
+    return 0; // shut up the compiler
+}
+
+
+void my_kbd_read_keys()
+{
+    kbd_prev_state[0] = kbd_new_state[0];
+    kbd_prev_state[1] = kbd_new_state[1];
+    kbd_prev_state[2] = kbd_new_state[2];
+
+    _platformsub_kbd_fetch_data(kbd_new_state);
+
+    if (kbd_process() == 0){
+	// leave it alone...
+	physw_status[0] = kbd_new_state[0];
+	physw_status[1] = kbd_new_state[1];
+	physw_status[2] = kbd_new_state[2];
+        physw_status[1] |= alt_mode_key_mask;
+    } else {
+	// override keys
+	physw_status[0] = (kbd_new_state[0] & (~KEYS_MASK0)) |
+			  (kbd_mod_state[0] & KEYS_MASK0);
+
+	physw_status[1] = (kbd_new_state[1] & (~KEYS_MASK1)) |
+			  (kbd_mod_state[1] & KEYS_MASK1);
+
+	physw_status[2] = (kbd_new_state[2] & (~KEYS_MASK2)) |
+			  (kbd_mod_state[2] & KEYS_MASK2);
+    }
+
+    _kbd_read_keys_r2(physw_status);
+	
+	usb_remote_key(physw_status[USB_IDX]) ;
+
+	if (conf.remote_enable) {
+		physw_status[USB_IDX] = physw_status[USB_IDX] & ~(SD_READONLY_FLAG | USB_MASK);
+	} else {
+		physw_status[USB_IDX] = physw_status[USB_IDX] & ~SD_READONLY_FLAG;
+	}
+	
+}
+
+void kbd_set_alt_mode_key_mask(long key)
+{
+    int i;
+    for (i=0; keymap[i].hackkey; ++i) {
+	if (keymap[i].hackkey == key) {
+	    alt_mode_key_mask = keymap[i].canonkey;
+	    return;
+	}
+    }
+}
+
+void kbd_key_press(long key)
+{
+    int i;
+    for (i=0;keymap[i].hackkey;i++){
+	if (keymap[i].hackkey == key){
+	    kbd_mod_state[keymap[i].grp] &= ~keymap[i].canonkey;
+	    return;
+	}
+    }
+}
+
+void kbd_key_release(long key)
+{
+    int i;
+    for (i=0;keymap[i].hackkey;i++){
+	if (keymap[i].hackkey == key){
+	    kbd_mod_state[keymap[i].grp] |= keymap[i].canonkey;
+	    return;
+	}
+    }
+}
+
+void kbd_key_release_all()
+{
+  kbd_mod_state[0] |= KEYS_MASK0;
+  kbd_mod_state[1] |= KEYS_MASK1;
+  kbd_mod_state[2] |= KEYS_MASK2;
+}
+
+long kbd_is_key_pressed(long key)
+{
+    int i;
+    for (i=0;keymap[i].hackkey;i++){
+	if (keymap[i].hackkey == key){
+	    return ((kbd_new_state[keymap[i].grp] & keymap[i].canonkey) == 0) ? 1:0;
+	}
+    }
+    return 0;
+}
+
+long kbd_is_key_clicked(long key)
+{
+    int i;
+    for (i=0;keymap[i].hackkey;i++){
+	if (keymap[i].hackkey == key){
+	    return ((kbd_prev_state[keymap[i].grp] & keymap[i].canonkey) != 0) &&
+		    ((kbd_new_state[keymap[i].grp] & keymap[i].canonkey) == 0);
+	}
+    }
+    return 0;
+}
+
+long kbd_get_pressed_key()
+{
+    int i;
+    for (i=0;keymap[i].hackkey;i++){
+	if ((kbd_new_state[keymap[i].grp] & keymap[i].canonkey) == 0){
+	    return keymap[i].hackkey;
+	}
+    }
+    return 0;
+}
+
+long kbd_get_clicked_key()
+{
+    int i;
+    for (i=0;keymap[i].hackkey;i++){
+	if (((kbd_prev_state[keymap[i].grp] & keymap[i].canonkey) != 0) &&
+	    ((kbd_new_state[keymap[i].grp] & keymap[i].canonkey) == 0)){
+	    return keymap[i].hackkey;
+	}
+    }
+    return 0;
+}
+
+void kbd_reset_autoclicked_key() {
+    last_kbd_key = 0;
+}
+
+long kbd_get_autoclicked_key() {
+    static long last_kbd_time = 0, press_count = 0;
+    register long key, t;
+
+    key=kbd_get_clicked_key();
+    if (key) {
+        last_kbd_key = key;
+        press_count = 0;
+        last_kbd_time = get_tick_count();
+        return key;
+    } else {
+        if (last_kbd_key && kbd_is_key_pressed(last_kbd_key)) {
+            t = get_tick_count();
+            if (t-last_kbd_time>((press_count)?175:500)) {
+                ++press_count;
+                last_kbd_time = t;
+                return last_kbd_key;
+            } else {
+                return 0;
+            }
+        } else {
+            last_kbd_key = 0;
+            return 0;
+        }
+    }
+}
+
+long kbd_use_zoom_as_mf() {
+    static long v;
+    static long zoom_key_pressed = 0;
+
+    if (kbd_is_key_pressed(KEY_ZOOM_IN) && kbd_is_key_pressed(KEY_MF) && (mode_get()&MODE_MASK) == MODE_REC) {
+        get_property_case(PROPCASE_FOCUS_MODE, &v, 4);
+        if (v) {
+            kbd_key_release_all();
+            kbd_key_press(KEY_MF);
+            kbd_key_press(KEY_UP);
+            zoom_key_pressed = KEY_ZOOM_IN;
+            return 1;
+        }
+    } else {
+        if (zoom_key_pressed==KEY_ZOOM_IN) {
+            kbd_key_release(KEY_UP);
+            zoom_key_pressed = 0;
+            return 1;
+        }
+    }
+    if (kbd_is_key_pressed(KEY_ZOOM_OUT) && kbd_is_key_pressed(KEY_MF) && (mode_get()&MODE_MASK) == MODE_REC) {
+        get_property_case(PROPCASE_FOCUS_MODE, &v, 4);
+        if (v) {
+            kbd_key_release_all();
+            kbd_key_press(KEY_MF);
+            kbd_key_press(KEY_DOWN);
+            zoom_key_pressed = KEY_ZOOM_OUT;
+            return 1;
+        }
+    } else {
+        if (zoom_key_pressed==KEY_ZOOM_OUT) {
+            kbd_key_release(KEY_DOWN);
+            zoom_key_pressed = 0;
+            return 1;
+        }
+    }
+    return 0;
+}
+static KeyMap keymap[] = {
+    /* tiny bug: key order matters. see kbd_get_pressed_key()
+     * for example
+     */
+	{ 1, KEY_UP		, 0x00020000 },
+	{ 1, KEY_DOWN		, 0x00080000 },
+	{ 1, KEY_LEFT		, 0x00010000 },
+	{ 1, KEY_RIGHT		, 0x00040000 },
+	{ 1, KEY_SET		, 0x00100000 },
+	{ 0, KEY_SHOOT_FULL	, 0x00000003 },
+    { 0, KEY_SHOOT_FULL_ONLY, 0x00000002 },
+	{ 0, KEY_SHOOT_HALF	, 0x00000001 },
+	{ 1, KEY_ZOOM_IN	, 0x10000000 },
+	{ 1, KEY_ZOOM_IN	, 0x18000000 },
+	{ 1, KEY_ZOOM_OUT	, 0x01000000 },
+	{ 1, KEY_ZOOM_OUT	, 0x05000000 },
+	{ 1, KEY_MENU		, 0x00200000 },
+	{ 1, KEY_DISPLAY	, 0x00002000 },
+	{ 1, KEY_PRINT		, 0x00004000 },
+	{ 1, KEY_ERASE		, 0x00400000 },
+        { 1, KEY_ISO		, 0x00001000 },
+        { 1, KEY_FLASH		, 0x00000008 },
+        { 1, KEY_MF		, 0x00000010 },
+        { 1, KEY_MACRO		, 0x00000020 },
+        { 1, KEY_VIDEO		, 0x40000000 },
+        { 1, KEY_TIMER		, 0x02000000 },
+//        { 1, KEY_DUMMY   	, 0x00000000 },
+	{ 0, 0, 0 }
+};
+
Index: /branches/reyalp-ptp-live/platform/s3is/platform_camera.h
===================================================================
--- /branches/reyalp-ptp-live/platform/s3is/platform_camera.h	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/s3is/platform_camera.h	(revision 1668)
@@ -0,0 +1,63 @@
+// Camera - s3is - platform_camera.h
+
+// This file contains the various settings values specific to the s3is 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                  2888    // for 6 MP
+    #define CAM_RAW_ROWS                    2136    // for 6 MP
+
+    #undef  CAM_SYNCH
+    #define CAM_SWIVEL_SCREEN               1
+    #define CAM_ADJUSTABLE_ALT_BUTTON       1
+    #define CAM_MULTIPART                   1
+    #undef  CAM_CAN_SD_OVER_NOT_IN_MF
+    #undef  CAM_CAN_UNLOCK_OPTICAL_ZOOM_IN_VIDEO
+    #define CAM_HAS_VIDEO_BUTTON            1
+
+    #define CAM_DNG_LENS_INFO               { 60,10, 720,10, 27,10, 35,10 } // See comments in camera.h
+    // pattern
+    #define cam_CFAPattern                  0x02010100 // Red  Green  Green  Blue
+    // color
+    #define CAM_COLORMATRIX1                        \
+      14062, 10000,   -5199, 10000,   -1446, 10000, \
+      -4712, 10000,   12470, 10000,    2243, 10000, \
+      -1286, 10000,    2028, 10000,    4836, 10000
+
+    #define cam_CalibrationIlluminant1      17      // Standard light A
+    // cropping
+    #define CAM_JPEG_WIDTH                  2816
+    #define CAM_JPEG_HEIGHT                 2112
+    #define CAM_ACTIVE_AREA_X1              44
+    #define CAM_ACTIVE_AREA_Y1              8
+    #define CAM_ACTIVE_AREA_X2              2884
+    #define CAM_ACTIVE_AREA_Y2              2136
+    // camera name
+    #define PARAM_CAMERA_NAME               3       // parameter number for GetParameterData
+    #define CAM_BRACKETING                  1
+    #define DNG_EXT_FROM                    ".DPS"
+
+    #define CAM_EXT_TV_RANGE                1
+	
+//	#define REMOTE_SYNC_STATUS_LED 	0xC0xxyyyy		// specifies an LED that turns on while camera waits for USB remote to sync
+	
+//----------------------------------------------------------
+
Index: /branches/reyalp-ptp-live/platform/s3is/wrappers.c
===================================================================
--- /branches/reyalp-ptp-live/platform/s3is/wrappers.c	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/s3is/wrappers.c	(revision 1668)
@@ -0,0 +1,22 @@
+#include "../generic/wrappers.c"
+#include "keyboard.h"
+#include "conf.h"
+#include "platform.h"
+
+long lens_get_focus_pos()
+{
+    static long v=MAX_DIST;
+    return (kbd_is_key_pressed(KEY_SHOOT_HALF) || state_kbd_script_run  || shooting_get_focus_mode())?v=_GetFocusLensSubjectDistance():v;
+}
+
+long lens_get_focus_pos_from_lens()
+{
+    static long v=MAX_DIST;
+    return (kbd_is_key_pressed(KEY_SHOOT_HALF) || state_kbd_script_run  || shooting_get_focus_mode())?v=_GetFocusLensSubjectDistanceFromLens():v;
+}
+
+long lens_get_target_distance()
+{
+    static long v=MAX_DIST;
+    return (kbd_is_key_pressed(KEY_SHOOT_HALF) || state_kbd_script_run  || shooting_get_focus_mode())?v=_GetCurrentTargetDistance():v;
+}
Index: /branches/reyalp-ptp-live/platform/s3is/main.c
===================================================================
--- /branches/reyalp-ptp-live/platform/s3is/main.c	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/s3is/main.c	(revision 1668)
@@ -0,0 +1,65 @@
+#include "../generic/main.c"
+
+long get_vbatt_min()
+{
+    return 4550;
+}
+
+long get_vbatt_max()
+{
+    return 5150;
+}
+
+static const struct {
+    int zp, fl;
+} fl_tbl[] = {
+    {   0,   6000 },
+    {  11,   6400 },
+    {  41,  12100 },
+    {  64,  21300 },
+    {  86,  41600 },
+    { 105,  61400 },
+    { 128,  72000 },
+};
+#define NUM_FL (sizeof(fl_tbl)/sizeof(fl_tbl[0]))
+#define CF_EFL 6000
+
+const int zoom_points = 129;
+
+int get_effective_focal_length(int zp) {
+    return (CF_EFL*get_focal_length(zp))/1000;
+}
+
+int get_focal_length(int zp) {
+    int i;
+
+    if (zp<fl_tbl[0].zp)
+        return fl_tbl[0].fl;
+    else if (zp>fl_tbl[NUM_FL-1].zp)
+        return fl_tbl[NUM_FL-1].fl;
+    else 
+        for (i=1; i<NUM_FL; ++i) {
+           if (zp==fl_tbl[i-1].zp) 
+               return fl_tbl[i-1].fl;
+           else if (zp==fl_tbl[i].zp) 
+               return fl_tbl[i].fl;
+           else if (zp<fl_tbl[i].zp)
+               return fl_tbl[i-1].fl+(zp-fl_tbl[i-1].zp)*(fl_tbl[i].fl-fl_tbl[i-1].fl)/(fl_tbl[i].zp-fl_tbl[i-1].zp);
+        }
+    return fl_tbl[NUM_FL-1].fl;
+}
+
+int get_zoom_x(int zp) {
+    return get_focal_length(zp)*10/fl_tbl[0].fl;
+}
+
+
+int screen_opened(void) {
+//    mode |= (physw_status[1] & 0x00000001)?0:MODE_SCREEN_OPENED;
+	return !(physw_status[1] & 0x00000001);
+}
+
+int screen_rotated(void) {
+//    mode |= (physw_status[1] & 0x00000002)?0:MODE_SCREEN_ROTATED;
+	return !(physw_status[1] & 0x00000002);
+}
Index: /branches/reyalp-ptp-live/platform/s3is/notes.txt
===================================================================
--- /branches/reyalp-ptp-live/platform/s3is/notes.txt	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/s3is/notes.txt	(revision 1668)
@@ -0,0 +1,9 @@
+****************************************
+
+Camera depending notes: 
+
+- s3is uses Propset 1 of Properties (see http://tinyurl.com/6zbv9b)
+- s3is does have a REAL IRIS Diaphragm, it does NOT have an an ND Filter! 
+Mind this.
+- cam supports multipartitions
+
Index: /branches/reyalp-ptp-live/platform/s3is/lib.c
===================================================================
--- /branches/reyalp-ptp-live/platform/s3is/lib.c	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/s3is/lib.c	(revision 1668)
@@ -0,0 +1,76 @@
+#include "platform.h"
+#include "lolevel.h"
+
+void shutdown()
+{
+    volatile long *p = (void*)0xc022002c;
+        
+    asm(
+         "MRS     R1, CPSR\n"
+         "AND     R0, R1, #0x80\n"
+         "ORR     R1, R1, #0x80\n"
+         "MSR     CPSR_cf, R1\n"
+         :::"r1","r0");
+        
+    *p = 0x46;
+
+    while(1);
+}
+
+
+#define LED_PR 0xc0220088
+
+#define LED_BRIGHTNESS  200
+#define LED_GREEN       4
+#define LED_YELLOW      5
+#define LED_ORANGE      7
+#define LED_BLUE        8
+#define LED_AF_BEAM     9
+#define LED_TIMER       10
+  
+static void led_on(const int led, const int brightness)
+{
+    if (led < 4 || led > 10 || led == 6) return;
+    static void* addr;
+    addr = led_table + (led * 0x40);
+    _UniqueLedOn(addr,brightness);
+}
+ 
+static void led_off(const int led)
+{
+    if (led < 4 || led > 10 || led == 6) return;
+    static void* addr;
+    addr = led_table + (led * 0x40);
+    _UniqueLedOff(addr);
+}
+
+void debug_led(int state)
+{
+    if (state)
+        led_on(LED_BLUE, LED_BRIGHTNESS);
+    else
+        led_off(LED_BLUE);
+}
+
+int get_flash_params_count(void){
+ return 108;
+}
+
+
+void camera_set_led(int led, int state, int bright)
+{
+	if (state) {
+		if (bright > LED_BRIGHTNESS) bright = LED_BRIGHTNESS;
+		if (led == 6) { // yellow = red + green
+	        led_on(4, bright);
+		    led_on(5, bright);
+		} else
+			led_on(led, bright);
+	}
+    else
+		if (led == 6) {
+	        led_off(4);
+		    led_off(5);
+		} else
+        led_off(led);
+}
Index: /branches/reyalp-ptp-live/platform/s3is/sub/100a/capt_seq.c
===================================================================
--- /branches/reyalp-ptp-live/platform/s3is/sub/100a/capt_seq.c	(revision 1668)
+++ /branches/reyalp-ptp-live/platform/s3is/sub/100a/capt_seq.c	(revision 1668)
@@ -0,0 +1,781 @@
+#include "lolevel.h"
+#include "platform.h"
+#include "core.h"
+
+static long *nrflag = (long*)0x6688;
+
+#include "../../../generic/capt_seq.c"
+
+void __attribute__((naked,noinline)) sub_FF97DD78_my(long p)
+{
+    asm volatile (
+                "STMFD   SP!, {R4-R6,LR}\n"
+                "LDR     R3, =0x6193C\n"
+                "LDR     R5, =0x6684\n"
+                "SUB     SP, SP, #4\n"
+                "LDR     R1, =0xFFFFFFFF\n"
+                "STR     R0, [R5]\n"
+                "LDR     R0, [R3]\n"
+                "BL      sub_FF81FF40\n"
+                "LDR     R3, =0x92DE0\n"
+                "LDR     R0, [R3,#0x74]\n"
+                //"BL      nullsub_31\n"
+                "BL      sub_FF97DCCC\n"
+         //   "BL      wait_until_remote_button_is_released\n"
+	    	"BL      capt_seq_hook_set_nr\n"
+                "LDR     R3, =0x668C\n"
+                "LDR     R0, [R3]\n"
+
+		"B       sub_FF97DDB0\n"
+    );
+}
+
+void __attribute__((naked,noinline)) sub_FF97A124_my(long p)
+{
+    asm volatile (
+                "STMFD   SP!, {R4-R7,LR}\n"
+                "LDR     R4, [R0,#0xC]\n"
+                "BL      sub_FF983D84\n"
+                "CMP     R0, #0\n"
+                "BNE     loc_FF97A13C\n"
+                "BL      sub_FF983D90\n"
+"loc_FF97A13C:\n"
+                "LDR     R1, =0x92DE0\n"
+                "MOV     R3, #0x8000\n"
+                "LDRH    R2, [R1]\n"
+                "ADD     R3, R3, #7\n"
+                "CMP     R2, R3\n"
+                "BNE     loc_FF97A198\n"
+                "LDRH    R3, [R1,#0x80]\n"
+                "CMP     R3, #3\n"
+                "BEQ     loc_FF97A198\n"
+                "LDRH    R3, [R1,#0x7E]\n"
+                "CMP     R3, #0\n"
+                "BNE     loc_FF97A198\n"
+                "LDRH    R3, [R1,#0x7A]\n"
+                "CMP     R3, #1\n"
+                "BNE     loc_FF97A198\n"
+                "LDR     R2, =0x92E80\n"
+                "LDR     R3, [R2,#0x1C]\n"
+                "CMP     R3, #0\n"
+                "BNE     loc_FF97A198\n"
+                "LDR     R3, [R2,#0x18]\n"
+                "CMP     R3, #0\n"
+            