root/platform/sx60hs/sub/100c/boot.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. spytask
  2. CreateTask_spytask
  3. init_required_fw_features
  4. boot
  5. CreateTask_my
  6. sub_fc05eec0_my
  7. sub_fc05f050_my
  8. sub_fc05f0e4_my
  9. sub_fc05f456_my
  10. task_Startup_my
  11. sub_fc07308e_my
  12. init_file_modules_task
  13. kbd_p2_f_my
  14. sub_fc0706e8_my

   1 #include "lolevel.h"
   2 #include "platform.h"
   3 #include "core.h"
   4 //#include "dryos31.h"
   5 
   6 #define offsetof(TYPE, MEMBER) ((int) &((TYPE *)0)->MEMBER)
   7 
   8 const char * const new_sa = &_end;
   9 
  10 // Forward declarations
  11 extern volatile int jogdial_stopped;
  12 void JogDial_task_my(void);
  13 
  14 extern void task_CaptSeq();
  15 extern void task_InitFileModules();
  16 extern void task_RotaryEncoder();
  17 extern void task_MovieRecord();
  18 extern void task_ExpDrv();
  19 
  20 /*----------------------------------------------------------------------
  21     spytask
  22 -----------------------------------------------------------------------*/
  23 void spytask(long ua, long ub, long uc, long ud, long ue, long uf)
  24 {
  25     core_spytask();
  26 }
  27 
  28 /*----------------------------------------------------------------------
  29     CreateTask_spytask
  30 -----------------------------------------------------------------------*/
  31 void CreateTask_spytask()
  32 {
  33 //    *(int*)0xd20b0884 = 0x4d0002;
  34 
  35     _CreateTask("SpyTask", 0x19, 0x2000, spytask, 0);
  36 }
  37 
  38 /*
  39     *** TEMPORARY? workaround ***
  40     Init stuff to avoid asserts on cameras running DryOS r54+
  41     https://chdk.setepontos.com/index.php?topic=12516.0
  42     Execute this only once
  43  */
  44 void init_required_fw_features(void) {
  45     extern void _init_focus_eventflag();
  46     extern void _init_nd_eventflag();
  47 //   extern void _init_nd_semaphore();
  48     //extern void _init_zoom_semaphore(); // for MoveZoomLensWithPoint
  49 
  50     _init_focus_eventflag();
  51     _init_nd_eventflag();
  52     // for MoveIrisWithAv, based on fc3d1a74 (but without registers eventprocs)
  53     extern int av_override_semaphore;
  54     extern int _CreateBinarySemaphoreStrictly(int x, int y);
  55     av_override_semaphore = _CreateBinarySemaphoreStrictly(0,0);
  56 //    _init_nd_semaphore();
  57 }
  58 ///*----------------------------------------------------------------------
  59 // Pointer to stack location where jogdial task records previous and current
  60 // jogdial positions
  61 // short *jog_position;
  62 
  63 /*----------------------------------------------------------------------
  64     boot()
  65 
  66     Main entry point for the CHDK code
  67 -----------------------------------------------------------------------*/
  68 
  69 /*************************************************************/
  70 void __attribute__((naked,noinline)) boot() {
  71 //    *(int*)0xd20b0884 = 0x4d0002;
  72     asm volatile ( // 0xfc02000c  -s=0xfc02000d -c=30 -f=chdk
  73 "    ldr.w sp, =0x80010000\n"
  74 "    bl      sub_fc020064\n"
  75 "    ldr     r2, =0xc0242010\n"
  76 "    ldr     r1, [r2]\n"
  77 "    orr     r1, r1, #1\n"
  78 "    str     r1, [r2]\n"
  79 "    ldr     r0, =0xfcd16b64\n"
  80 "    ldr     r1, =0x010e1000\n"
  81 "    ldr     r3, =0x0110daa4\n"
  82 "loc_fc020024:\n"
  83 "    cmp     r1, r3\n"
  84 "    itt     lo\n"
  85 "    ldrlo   r2, [r0], #4\n"
  86 "    strlo   r2, [r1], #4\n"
  87 "    blo     loc_fc020024\n"
  88 // Install CreateTask patch
  89 // use half words in case source or destination not word aligned
  90         "adr     r0, patch_CreateTask\n"    // src: Patch data
  91         "ldr     r1, =hook_CreateTask\n"    // dest: Address to patch (hook_ has thumb bit off)
  92         "add     r2, r0, #8\n" // two words
  93 "task_hook_loop:\n"
  94         "ldrh   r3, [r0],#2\n"
  95         "strh   r3, [r1],#2\n"
  96         "cmp    r0,r2\n"
  97         "blo    task_hook_loop\n"
  98 "    ldr     r0, =0x010e1000\n"
  99 "    ldr     r1, =0x0002caa4\n"
 100 "    bl      sub_fc1361ce\n"
 101 "    ldr     r0, =0xfccec558\n"
 102 "    ldr     r1, =0x00008000\n"
 103 "    ldr     r3, =0x0003260c\n"
 104 "loc_fc020040:\n"
 105 "    cmp     r1, r3\n"
 106 "    itt     lo\n"
 107 "    ldrlo   r2, [r0], #4\n"
 108 "    strlo   r2, [r1], #4\n"
 109 "    blo     loc_fc020040\n"
 110 "    ldr     r3, =0x0003260c\n"
 111 "    ldr     r1, =0x003a8bb0\n"
 112 "    mov.w   r2, #0\n"
 113 "loc_fc020056:\n"
 114 "    cmp     r3, r1\n"
 115 "    it      lo\n"
 116 "    strlo   r2, [r3], #4\n"
 117 "    blo     loc_fc020056\n"
 118 //"    b.w     loc_fc05eec0\n"
 119 "    b.w     sub_fc05eec0_my\n" // continue 
 120 
 121         "patch_CreateTask:\n"
 122         "ldr.w   pc, [pc,#0]\n"             // Do jump to absolute address CreateTask_my
 123         ".long   CreateTask_my + 1\n"           // has to be a thumb address
 124 
 125  
 126 );
 127 }
 128 
 129 /*************************************************************/
 130 void __attribute__((naked,noinline)) CreateTask_my() {
 131 //    *(int*)0xd20b0884 = 0x4d0002;
 132 asm volatile (
 133 "    push   {r0}\n"
 134 //R3 = Pointer to task function to create
 135 "    ldr     r0, =task_CaptSeq\n"       // DryOS original code function ptr.
 136 "    cmp     r0, r3\n"                  // is the given taskptr equal to our searched function?
 137 "    itt     eq\n"                      // EQ block
 138 "    ldreq   r3, =capt_seq_task\n"      // if so replace with our task function base ptr.
 139 "    orreq   r3, #1\n"                  // make sure it's a thumb address (may not be needed?)
 140 "    beq     exitHook\n"                // below compares not necessary if this check has found something.
 141 
 142 "    LDR     R0, =task_ExpDrv\n"
 143 "    CMP     R0, R3\n"
 144 "    itt     eq\n"
 145 "    LDREQ   R3, =exp_drv_task\n"
 146 "    orreq   r3, #1\n"
 147 "    BEQ     exitHook\n"
 148 /*
 149 "    LDR     R0, =task_DvlpSeqTask\n"
 150 "    CMP     R0, R3\n"
 151 "    itt     eq\n"
 152 "    LDREQ   R3, =developseq_task\n"
 153 "    orreq   r3, #1\n"
 154 "    BEQ     exitHook\n"
 155 */
 156 
 157 "    ldr     r0, =task_FileWrite\n"
 158 "    cmp     r0, r3\n"
 159 "    itt     eq\n"
 160 "    ldreq   r3, =filewritetask\n"
 161 "    orreq   r3, #1\n"
 162 "    beq     exitHook\n"
 163 
 164 /*
 165 "    LDR     R0, =task_MovieRecord\n"
 166 "    CMP     R0, R3\n"
 167 "    LDREQ   R3, =movie_record_task\n"
 168 "    BEQ     exitHook\n"
 169 */
 170 
 171 "    ldr     r0, =task_InitFileModules\n"
 172 "    cmp     r0, r3\n"
 173 "    itt     eq\n"
 174 "    ldreq   r3, =init_file_modules_task\n"
 175 "    orreq   r3, #1\n"
 176 
 177 "exitHook:\n" 
 178 
 179 // restore overwritten register(s)
 180 "    pop    {r0}\n"
 181 /*                        // turn led on
 182                         "push    {r4-r5}\n"
 183                         "ldr r4, =0x4d0002\n"
 184                         "ldr r5, =0xd20b0884\n"
 185                         "str r4, [r5]\n"
 186                         "pop     {r4-r5}\n"
 187  */                   
 188 // Execute overwritten instructions from original code, then jump to firmware
 189 "    stmdb   sp!, {r1, r2, r3, r4, r5, r6, r7, r8, r9, lr}\n"
 190 //"    push.w  {r1, r2, r3, r4, r5, r6, r7, r8, sb, lr}\n"
 191 "    mov     r4, r0\n"
 192 "    ldr     r0, =0x8160\n" //at fc05f1b0
 193 //"    mov     r6, r1\n"
 194 //"    mov     r5, r2\n"
 195 "    ldr.w   pc, =(hook_CreateTask + 8 + 1) \n"  // Continue in firmware
 196 ".ltorg\n"
 197 );
 198 }
 199 
 200 //fc04f194 fc05eec0
 201 void __attribute__((naked,noinline)) sub_fc05eec0_my() {
 202 //*(int*)0xd20b0884 = 0x4d0002;
 203 
 204 
 205 /* no gpio checks needed    if (*(int*)(0xd20b0000 + 0x10 * 4) & 0x10000) {
 206         // see sub_fc060338, sub_fc06082a
 207         // GPIO 0x10 (aka ON/OFF button) is not pressed -> play
 208         *(int*)(0x970c+0x4) = 0x200000;
 209     }
 210     else {
 211         // GPIO 0x10 is pressed -> rec
 212         *(int*)(0x970c+0x4) = 0x100000;
 213     }
 214 */
 215     asm volatile (
 216     "push    {r4, lr}\n"
 217 
 218 #if defined(CHDK_NOT_IN_CANON_HEAP)
 219     "ldr     r4, =0x003a8bb0\n"         // heap start, modify here
 220 #else
 221     "ldr     r4, =new_sa\n"             // +
 222     "ldr     r4, [r4]\n"                // +
 223 #endif
 224 "    sub     sp, #0x78\n"
 225 "    ldr     r0, =0x006ce000\n"
 226 "    ldr     r1, =0x0008fd8c\n"
 227 "    subs    r0, r0, r4\n"
 228 "    cmp     r0, r1\n"
 229 "    bhs     loc_fc05eed2\n"
 230 "loc_fc05eed0:\n"
 231 "    b       loc_fc05eed0\n"
 232 "loc_fc05eed2:\n"
 233 "    ldr     r1, =0x00008074\n"
 234 "    mov.w   r0, #0x80000\n"
 235 "    str     r0, [r1]\n"
 236 "    ldr     r1, =0x00008078\n"
 237 "    ldr     r0, =0x42a41000\n"
 238 "    str     r0, [r1]\n"
 239 "    ldr     r1, =0x0000807c\n"
 240 "    ldr     r0, =0x42a43000\n"
 241 "    str     r0, [r1]\n"
 242 "    movs    r1, #0x78\n"
 243 "    mov     r0, sp\n"
 244 "    blx     sub_fc2cf43c\n" // j_bzero
 245 "    ldr     r0, =0x0062e000\n"
 246 "    mov.w   r1, #0xa0000\n"
 247 "    stm.w   sp, {r0, r1, r4}\n"
 248 "    ldr     r1, =0x00622274\n" //  *"t"b"
 249 "    subs    r2, r1, r4\n"
 250 "    strd    r2, r1, [sp, #0xc]\n"
 251 "    str     r0, [sp, #0x14]\n"
 252 "    movs    r0, #0x22\n"
 253 "    str     r0, [sp, #0x18]\n"
 254 "    movs    r0, #0x98\n"
 255 "    str     r0, [sp, #0x1c]\n"
 256 "    movw    r0, #0x24c\n"
 257 "    str     r0, [sp, #0x20]\n"
 258 "    movs    r0, #0xfa\n"
 259 "    str     r0, [sp, #0x24]\n"
 260 "    movs    r0, #0xe8\n"
 261 "    str     r0, [sp, #0x28]\n"
 262 "    movs    r0, #0x85\n"
 263 "    str     r0, [sp, #0x2c]\n"
 264 "    movs    r0, #0x40\n"
 265 "    str     r0, [sp, #0x30]\n"
 266 "    movs    r0, #4\n"
 267 "    str     r0, [sp, #0x34]\n"
 268 "    movs    r0, #0\n"
 269 "    str     r0, [sp, #0x38]\n"
 270 "    movs    r0, #0x10\n"
 271 "    str     r0, [sp, #0x5c]\n"
 272 "    movs    r2, #0\n"
 273 "    lsls    r0, r0, #8\n"
 274 "    str     r0, [sp, #0x60]\n"
 275 //"    ldr     r1, =0xfc05f051\n"
 276     "ldr     r1, =sub_fc05f050_my\n"    // -> continue here (init_task)
 277 "    asrs    r0, r0, #4\n"
 278 "    str     r0, [sp, #0x64]\n"
 279 "    lsls    r0, r0, #5\n"
 280 "    str     r0, [sp, #0x68]\n"
 281 "    mov     r0, sp\n"
 282 "    blx     sub_fc2ce9a8\n"
 283 "    add     sp, #0x78\n"
 284 "    pop     {r4, pc}\n"
 285    ".ltorg\n"
 286 
 287     );
 288 
 289 
 290 }
 291 
 292 
 293 //fc04f324
 294 void __attribute__((naked,noinline)) sub_fc05f050_my() {
 295 
 296 //*(int*)0xd20b0884 = 0x4d0002;
 297     asm volatile (
 298 "    push    {r4, lr}\n"
 299 "    ldr     r4, =0xfc05f0fc\n" //  *"/_term"
 300 "    bl      sub_fc0602ec\n"
 301 "    ldr     r0, =0x000080ec\n"
 302 "    ldr     r1, [r0]\n"
 303 "    ldr     r0, =0x00008074\n"
 304 "    ldr     r0, [r0]\n"
 305 "    adds    r0, #0x10\n"
 306 "    cmp     r1, r0\n"
 307 "    bhs     loc_fc05f06c\n"
 308 "    ldr     r0, =0xfc05f10c\n" //  *"USER_MEM size checking"
 309 "    bl      sub_fc05f0e4\n"
 310 "loc_fc05f06c:\n"
 311 "    bl      sub_fc1362a8\n"
 312 "    ldr     r3, =0x80000800\n"
 313 // bad capdis output
 314 //  
 315     "mov.w   r1, #0x80000000\n" //2147483648
 316     "mov.w   r2, #0xeeeeeeee\n"
 317 "loc_fc05f07a:\n"
 318 "    stm     r1!, {r2}\n"
 319 "    cmp     r1, r3\n"
 320 "    blo     loc_fc05f07a\n"
 321 "    bl      sub_fc1362ba\n"
 322 "    bl      sub_fc136890\n"
 323 "    cmp     r0, #0\n"
 324 "    bge     loc_fc05f092\n"
 325 "    ldr     r0, =0xfc05f128\n" //  *"dmSetup"
 326 "    bl      sub_fc05f0e4\n"
 327 "loc_fc05f092:\n"
 328 "    bl      sub_fc05f8c4\n"
 329 "    cmp     r0, #0\n"
 330 "    bge     loc_fc05f0a0\n"
 331 "    ldr     r0, =0xfc05f130\n" //  *"termDriverInit"
 332 "    bl      sub_fc05f0e4\n"
 333 "loc_fc05f0a0:\n"
 334 "    mov     r0, r4\n"
 335 "    bl      sub_fc05f952\n"
 336 "    cmp     r0, #0\n"
 337 "    bge     loc_fc05f0b0\n"
 338 "    ldr     r0, =0xfc05f140\n" //  *"termDeviceCreate"
 339 "    bl      sub_fc05f0e4\n"
 340 "loc_fc05f0b0:\n"
 341 "    mov     r0, r4\n"
 342 "    bl      sub_fc05f288\n"
 343 "    cmp     r0, #0\n"
 344 "    bge     loc_fc05f0c0\n"
 345 "    ldr     r0, =0xfc05f154\n" //  *"stdioSetup"
 346 "    bl      sub_fc05f0e4\n"
 347 "loc_fc05f0c0:\n"
 348 "    bl      sub_fc05f3cc\n"
 349 "    cmp     r0, #0\n"
 350 "    bge     loc_fc05f0ce\n"
 351 "    ldr     r0, =0xfc05f160\n" //  *"stdlibSetup"
 352 "    bl      sub_fc05f0e4\n"
 353 "loc_fc05f0ce:\n"
 354 "    bl      sub_fc0623e8\n"
 355 "    cmp     r0, #0\n"
 356 "    bge     loc_fc05f0dc\n"
 357 "    ldr     r0, =0xfc05f16c\n" //  *"extlib_setup"
 358 "    bl      sub_fc05f0e4\n"
 359 "loc_fc05f0dc:\n"
 360 "    pop.w   {r4, lr}\n"
 361 //"    b.w     loc_fc05f456\n"
 362     "b.w     sub_fc05f456_my\n" // -> continue (taskcreate_startup)
 363     ".ltorg\n"
 364 
 365     );
 366 
 367 }
 368 
 369 void __attribute__((naked,noinline)) sub_fc05f0e4_my() {
 370 
 371 //*(int*)0xd20b0884 = 0x4d0002;
 372 }
 373 void __attribute__((naked,noinline)) sub_fc05f456_my() {
 374 // turn on LED
 375  //   *(int*)0xd20b0884 = 0x4d0002;
 376        
 377     asm volatile (
 378 "    push    {r3, lr}\n"
 379 "    bl      sub_fc05f570\n"
 380 "    bl      sub_fc0b9738\n"
 381 "    cbnz    r0, loc_fc05f46c\n"
 382 "    bl      sub_fc07f062\n" // IsNormalCameraMode_FW
 383 "    cbz     r0, loc_fc05f46c\n"
 384 "    movs    r0, #1\n"
 385 "    b       loc_fc05f46e\n"
 386 "loc_fc05f46c:\n"
 387 "    movs    r0, #0\n"
 388 "loc_fc05f46e:\n"
 389 "    bl      sub_fc07319c\n"
 390 "    cbnz    r0, loc_fc05f47a\n"
 391 "    bl      sub_fc05f55e\n"
 392 "loc_fc05f478:\n"
 393 "    b       loc_fc05f478\n"
 394 "loc_fc05f47a:\n"
 395 "    blx     sub_fc2cea00\n"
 396 "    ldr     r1, =0x006ce000\n"
 397 "    movs    r0, #0\n"
 398 "    bl      sub_fc336500\n"
 399 "    blx     sub_fc2cefd4\n"
 400 "    movs    r3, #0\n"
 401 "    str     r3, [sp]\n"
 402 //"    ldr     r3, =0xfc05f3f1\n" //  task_Startup
 403     "ldr     r3, =task_Startup_my\n"
 404 "    movs    r2, #0\n"
 405 "    movs    r1, #0x19\n"
 406 "    ldr     r0, =0xfc05f4a8\n" //  *"Startup"
 407 //"    blx     sub_fc2cf01c\n" // j_CreateTask
 408     "bl       _CreateTask\n"    // CreateTask
 409 "    movs    r0, #0\n"
 410 "    pop     {r3, pc}\n"
 411     ".ltorg\n"
 412     );
 413 }
 414 
 415 // task_Startup
 416 //"    ldr     r3, =0xfc05f3f1\n" //  task_Startup  -s=0xfc05f3f1 -c=100 -f=chdk
 417 void __attribute__((naked,noinline)) task_Startup_my() {
 418 //    *(int*)0xd20b0884 = 0x4d0002;
 419     asm volatile (
 420 // task_Startup 0xfc05f3f1
 421 "    push    {r4, lr}\n"
 422 "    bl      sub_fc137ad4\n" // CreateTask ClockSave
 423 "    bl      sub_fc05f53c\n" // posixSetup etc
 424 //"    bl      sub_fc05f6bc\n"
 425 "    bl      sub_fc0daedc\n" // StartWDT ...
 426 "bl sub_010e6355\n" //see 0x010e63cc task_SD1stInit in RAMCODE.dis
 427 //"    bl      sub_fc05f712\n"
 428 "    bl      sub_fc08da46\n"
 429 "    bl      sub_fc0db028\n"
 430 "    bl      sub_fc05f804\n"
 431 "    bl      sub_fc05f650\n"
 432 "    bl      sub_fc0daf1a\n"
 433 "    bl      sub_fc0b947c\n"
 434 "    bl      sub_fc0db02e\n"
 435 "    bl      sub_fc07308e_my\n"
 436 "    bl      CreateTask_spytask\n"
 437 "    bl      init_required_fw_features\n"
 438 "    bl      sub_fc275708\n"
 439 "    bl      sub_fc0db044\n"
 440 "    bl      sub_fc0b9230\n"
 441 "    bl      sub_fc13788e\n"
 442 "    bl      sub_fc0b95e4\n"
 443 "    bl      sub_fc0b942e\n"
 444 "    bl      sub_fc13784a\n"
 445 "    bl      sub_fc05f808\n"
 446 "    bl      sub_fc32f65a\n"
 447 "    bl      sub_fc13781e\n"
 448 "    pop.w   {r4, lr}\n"
 449 "    b.w     sub_fc137aaa\n"
 450     ".ltorg\n"
 451     );
 452 }
 453 //taskcreate_physw
 454 void __attribute__((naked,noinline)) sub_fc07308e_my() {
 455 //    *(int*)0xd20b0884 = 0x4d0002;
 456     asm volatile (
 457 "    push    {r3, r4, r5, lr}\n"
 458 "    bl      sub_fc07202c\n"
 459 "    bl      sub_fc07efe0\n" // IsFactoryMode_FW
 460 "    cbnz    r0, loc_fc07309e\n"
 461 "    bl      sub_fc071fd0\n" // OpLog.Start_FW
 462 "loc_fc07309e:\n"
 463 "    ldr     r4, =0x000082c8\n" //  physw_run
 464 "    ldr     r0, [r4, #4]\n"
 465 "    cmp     r0, #0\n"
 466 "    bne     loc_fc0730ba\n"
 467 "    movs    r3, #0\n"
 468 "    str     r3, [sp]\n"
 469 //"    ldr     r3, =0xfc073069\n" //  task_PhySw
 470         "ldr     r3, =mykbd_task\n" 
 471 "    movs    r1, #0x17\n"
 472 "    ldr     r0, =0xfc0730e8\n" //  *"PhySw"
 473 "    movw    r2, #0x2000\n" // adjust upward?was 800
 474 "    blx     sub_fc2cf344\n" // j_CreateTaskStrictly
 475 "    str     r0, [r4, #4]\n"
 476 "loc_fc0730ba:\n"
 477 "    pop     {r3, r4, r5, pc}\n"
 478                         ".ltorg\n"
 479     );
 480 }
 481 
 482 void __attribute__((naked,noinline)) init_file_modules_task() { //sub_fc088220_my()
 483 //fc0bda11
 484 // task_InitFileModules 0xfc0bda11
 485     asm volatile (
 486 // task_InitFileModules 0xfc0bda11
 487 "    push    {r4, r5, r6, lr}\n"
 488 "    bl      sub_fc0e5238\n"
 489 "    movs    r4, r0\n"
 490 "    movw    r5, #0x5006\n"
 491 "    beq     loc_fc0bda26\n"
 492 "    movs    r1, #0\n"
 493 "    mov     r0, r5\n"
 494 "    bl      _PostLogicalEventToUI\n"
 495 "loc_fc0bda26:\n"
 496 "    bl      sub_fc0e5262\n"
 497 "    BL      core_spytask_can_start\n" // + CHDK: Set "it's-safe-to-start" flag for spytask
 498 "    cmp     r4, #0\n"
 499 "    bne     loc_fc0bda3a\n"
 500 "    mov     r0, r5\n"
 501 "    pop.w   {r4, r5, r6, lr}\n"
 502 "    movs    r1, #0\n"
 503 "    b.w     _PostLogicalEventToUI\n"
 504 "loc_fc0bda3a:\n"
 505 "    pop     {r4, r5, r6, pc}\n"
 506 "    .ltorg\n"
 507     );
 508 
 509 }
 510 
 511 
 512 void __attribute__((naked,noinline)) kbd_p2_f_my() { 
 513 
 514 // kbd_p2_f 0xfc072e35
 515 
 516    asm volatile(// kbd_p2_f 0xfc072e35
 517 "    stmdb   sp!, {r4, r5, r6, r7, r8, lr}\n"
 518 //"    push.w  {r4, r5, r6, r7, r8, lr}\n"
 519 "    ldr     r6, =0x00033f88\n"
 520 "    sub     sp, #0x18\n"
 521 "    add     r7, sp, #8\n"
 522 "    subs    r6, #0xc\n"
 523 "    b       loc_fc072e76\n"
 524 "loc_fc072e42:\n"
 525 "    ldr     r1, =0x00033f88\n"
 526 "    add     r3, sp, #8\n"
 527 "    ldrb.w  r0, [sp, #4]\n"
 528 "    add     r2, sp, #0x14\n"
 529 "    subs    r1, #0x18\n"
 530 "    bl      sub_fc070b4e\n"
 531 "    cbnz    r0, loc_fc072e5c\n"
 532 "    ldr     r1, [sp, #0x14]\n"
 533 "    movs    r0, #0\n"
 534 "    bl      sub_fc072da6\n"
 535 "loc_fc072e5c:\n"
 536 "    movs    r0, #2\n"
 537 "loc_fc072e5e:\n"
 538 "    ldr.w   r1, [r7, r0, lsl #2]\n"
 539 "    cbz     r1, loc_fc072e6e\n"
 540 "    ldr.w   r2, [r6, r0, lsl #2]\n"
 541 "    bics    r2, r1\n"
 542 "    str.w   r2, [r6, r0, lsl #2]\n"
 543 "loc_fc072e6e:\n"
 544 "    subs    r0, r0, #1\n"
 545 "    sxtb    r0, r0\n"
 546 "    cmp     r0, #0\n"
 547 "    bge     loc_fc072e5e\n"
 548 "loc_fc072e76:\n"
 549 "    ldr     r0, =0x00033f88\n"
 550 "    add     r1, sp, #4\n"
 551 "    subs    r0, #0xc\n"
 552 "    bl      sub_fc07084c\n"
 553 "    cmp     r0, #0\n"
 554 "    bne     loc_fc072e42\n"
 555 "    ldr.w   r8, =0x00033f88\n"
 556 "    movs    r4, #0\n"
 557 "loc_fc072e8a:\n"
 558 "    movs    r5, #0\n"
 559 "    ldr.w   r0, [r6, r4, lsl #2]\n"
 560 "    ldr.w   r1, [r8, r4, lsl #2]\n"
 561 "    ands    r0, r1\n"
 562 "    str.w   r0, [r6, r4, lsl #2]\n"
 563 "    b       loc_fc072ee2\n"
 564 "loc_fc072e9c:\n"
 565 "    lsrs    r0, r5\n"
 566 "    lsls    r0, r0, #0x1f\n"
 567 "    beq     loc_fc072eda\n"
 568 "    ldr     r1, =0x00033f88\n"
 569 "    add.w   r0, r5, r4, lsl #5\n"
 570 "    add     r3, sp, #8\n"
 571 "    subs    r1, #0x18\n"
 572 "    add     r2, sp, #0x14\n"
 573 "    uxtb    r0, r0\n"
 574 "    bl      sub_fc070b4e\n"
 575 "    cbnz    r0, loc_fc072ebe\n"
 576 "    ldr     r1, [sp, #0x14]\n"
 577 "    movs    r0, #1\n"
 578 "    bl      sub_fc072da6\n"
 579 "loc_fc072ebe:\n"
 580 "    mov     r0, r4\n"
 581 "    b       loc_fc072ed6\n"
 582 "loc_fc072ec2:\n"
 583 "    ldr.w   r1, [r7, r0, lsl #2]\n"
 584 "    cbz     r1, loc_fc072ed2\n"
 585 "    ldr.w   r2, [r6, r0, lsl #2]\n"
 586 "    bics    r2, r1\n"
 587 "    str.w   r2, [r6, r0, lsl #2]\n"
 588 "loc_fc072ed2:\n"
 589 "    adds    r0, r0, #1\n"
 590 "    sxtb    r0, r0\n"
 591 "loc_fc072ed6:\n"
 592 "    cmp     r0, #3\n"
 593 "    blt     loc_fc072ec2\n"
 594 "loc_fc072eda:\n"
 595 "    ldr.w   r0, [r6, r4, lsl #2]\n"
 596 "    adds    r5, r5, #1\n"
 597 "    uxtb    r5, r5\n"
 598 "loc_fc072ee2:\n"
 599 "    cmp     r0, #0\n"
 600 "    bne     loc_fc072e9c\n"
 601 "    adds    r4, r4, #1\n"
 602 "    sxtb    r4, r4\n"
 603 "    cmp     r4, #3\n"
 604 "    blt     loc_fc072e8a\n"
 605 //"    bl      sub_fc0706e8\n"
 606 "    bl      sub_fc0706e8_my\n"     // ->
 607 "    add     sp, #0x18\n"
 608 "    pop.w   {r4, r5, r6, r7, r8, pc}\n"
 609 ".ltorg\n"
 610     );
 611 
 612 }
 613 //extern void handle_jogdial();
 614 void __attribute__((naked,noinline)) sub_fc0706e8_my() {
 615     asm volatile(
 616 "    push    {r4, lr}\n"
 617 "    ldr     r4, =0x0000970c\n"
 618 "    ldr     r0, [r4, #0xc]\n"
 619 "    bl      sub_fc072250\n"
 620 "    bl      sub_fc0f9118\n"
 621 "    ldr     r0, [r4, #0x10]\n"
 622 "    bl      sub_fc07216c\n"
 623 "    bl      handle_jogdial\n"  // +
 624 "    cmp     r0, #0\n"          // +
 625 "    beq     no_scroll\n"       // +
 626 "    bl      sub_fc072490\n"    // handles scrollwheel(s), void function, no args
 627 "no_scroll:\n" 
 628 "    pop     {r4, pc}\n"        // +
 629     );
 630 }
 631 
 632 
 633 
 634 

/* [<][>][^][v][top][bottom][index][help] */