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

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

DEFINITIONS

This source file includes following definitions.
  1. taskHook
  2. CreateTask_spytask
  3. boot
  4. sub_FF810354_my
  5. sub_FF811198_my
  6. sub_FF815E58_my
  7. taskcreate_Startup_my
  8. task_Startup_my
  9. debug_blink
  10. init_file_modules_task
  11. sub_FF891968_my
  12. sub_FF87343C_my
  13. sub_FF873064_my
  14. sub_FF872D84_my
  15. JogDial_task_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 void JogDial_task_my(void);
   9 
  10 const char * const new_sa = &_end;
  11 
  12 void taskHook(context_t **context) {
  13 
  14 task_t *tcb=(task_t*)((char*)context-offsetof(task_t, context));
  15 
  16 if(!_strcmp(tcb->name, "PhySw"))           tcb->entry = (void*)mykbd_task;  //JHARP - Verified name - Sept 5, 2010
  17 if(!_strcmp(tcb->name, "CaptSeqTask"))     tcb->entry = (void*)capt_seq_task; //JHARP - Verified name - Sept 5, 2010
  18 if(!_strcmp(tcb->name, "InitFileModules")) tcb->entry = (void*)init_file_modules_task; //JHARP - Verified name - Sept 5, 2010
  19 if(!_strcmp(tcb->name, "MovieRecord"))     tcb->entry = (void*)movie_record_task; //JHARP - Verified name - Sept 5, 2010
  20 if(!_strcmp(tcb->name, "ExpDrvTask"))      tcb->entry = (void*)exp_drv_task; //JHARP - Verified name - Sept 5, 2010
  21 if(!_strcmp(tcb->name, "RotarySw"))        tcb->entry = (void*)JogDial_task_my; //JHARP - Must verify the code in use - Sept 5, 2010
  22 
  23 }
  24 
  25 void CreateTask_spytask() {
  26         _CreateTask("SpyTask", 0x19, 0x2000, core_spytask, 0);
  27 };
  28 
  29 
  30 
  31 
  32 
  33 
  34 void __attribute__((naked,noinline)) boot() {
  35     asm volatile (
  36                                  //"B             sub_FF81000C\n"
  37                  "LDR     R1, =0xC0410000\n"
  38                  "MOV     R0, #0\n"
  39                  "STR     R0, [R1]\n"
  40                  "MOV     R1, #0x78\n"
  41                  "MCR     p15, 0, R1,c1,c0\n"                   // control reg
  42                  "MOV     R1, #0\n"
  43                  "MCR     p15, 0, R1,c7,c10, 4\n"               // drain write buffer
  44                  "MCR     p15, 0, R1,c7,c5\n"                   // flush instruction cache
  45                  "MCR     p15, 0, R1,c7,c6\n"                           // flush data cache
  46                  "MOV     R0, #0x3D\n"                                  // size 2GB base 0x00000000
  47                  "MCR     p15, 0, R0,c6,c0\n"                   // protection region 0
  48                  "MOV     R0, #0xC000002F\n"                    // size 16M base 0xc0000000
  49                  "MCR     p15, 0, R0,c6,c1\n"
  50                  "MOV     R0, #0x33\n"                                  // size 128M base 0x00000000 (s90 is 64M)
  51                  "MCR     p15, 0, R0,c6,c2\n"
  52                  "MOV     R0, #0x40000033\n"                    // size 128M base 0x40000000 (s90 is 64M)
  53                  "MCR     p15, 0, R0,c6,c3\n"
  54                  "MOV     R0, #0x80000017\n"                    // size  4k base 0x80000000
  55                  "MCR     p15, 0, R0,c6,c4\n"
  56                  "LDR     R0, =0xFF80002D\n"                    // size  8M base 0xff800000
  57                  "MCR     p15, 0, R0,c6,c5\n"
  58                  "MOV     R0, #0x34\n"
  59                  "MCR     p15, 0, R0,c2,c0\n"
  60                  "MOV     R0, #0x34\n"
  61                  "MCR     p15, 0, R0,c2,c0, 1\n"
  62                  "MOV     R0, #0x34\n"
  63                  "MCR     p15, 0, R0,c3,c0\n"
  64                  "LDR     R0, =0x3333330\n"
  65                  "MCR     p15, 0, R0,c5,c0, 2\n"
  66                  "LDR     R0, =0x3333330\n"
  67                  "MCR     p15, 0, R0,c5,c0, 3\n"
  68                  "MRC     p15, 0, R0,c1,c0\n"
  69                  "ORR     R0, R0, #0x1000\n"
  70                  "ORR     R0, R0, #4\n"
  71                  "ORR     R0, R0, #1\n"
  72                  "MCR     p15, 0, R0,c1,c0\n"
  73                  "MOV     R1, #0x80000006\n"
  74                  "MCR     p15, 0, R1,c9,c1\n"
  75                  "MOV     R1, #6\n"
  76                  "MCR     p15, 0, R1,c9,c1, 1\n"
  77                  "MRC     p15, 0, R1,c1,c0\n"
  78                  "ORR     R1, R1, #0x50000\n"
  79                  "MCR     p15, 0, R1,c1,c0\n"
  80                  "LDR     R2, =0xC0200000\n"
  81                  "MOV     R1, #1\n"
  82                  "STR     R1, [R2,#0x10C]\n"
  83                  "MOV     R1, #0xFF\n"
  84                  "STR     R1, [R2,#0xC]\n"
  85                  "STR     R1, [R2,#0x1C]\n"
  86                  "STR     R1, [R2,#0x2C]\n"
  87                  "STR     R1, [R2,#0x3C]\n"
  88                  "STR     R1, [R2,#0x4C]\n"
  89                  "STR     R1, [R2,#0x5C]\n"
  90                  "STR     R1, [R2,#0x6C]\n"
  91                  "STR     R1, [R2,#0x7C]\n"
  92                  "STR     R1, [R2,#0x8C]\n"
  93                  "STR     R1, [R2,#0x9C]\n"
  94                  "STR     R1, [R2,#0xAC]\n"
  95                  "STR     R1, [R2,#0xBC]\n"
  96                  "STR     R1, [R2,#0xCC]\n"
  97                  "STR     R1, [R2,#0xDC]\n"
  98                  "STR     R1, [R2,#0xEC]\n"
  99                  "STR     R1, [R2,#0xFC]\n"
 100                  "LDR     R1, =0xC0400008\n"
 101                  "LDR     R2, =0x430005\n"
 102                  "STR     R2, [R1]\n"
 103                  "MOV     R1, #1\n"
 104                  "LDR     R2, =0xC0243100\n"
 105                  "STR     R2, [R1]\n"
 106                  "LDR     R2, =0xC0242010\n"
 107                  "LDR     R1, [R2]\n"
 108                  "ORR     R1, R1, #1\n"
 109                  "STR     R1, [R2]\n"
 110                  "LDR     R0, =0xFFC2FA94\n"    // ASM1989 -> In sx200 was:  "LDR     R0, =0xFFB91B18\n"
 111                  "LDR     R1, =0x1900\n"
 112                  "LDR     R3, =0xFA80\n"                // ASM1989 -> In sx200 was:  "LDR     R3, =0xDBCC\n"
 113     "loc_FF81013C:\n"
 114                  "CMP     R1, R3\n"
 115                  "LDRCC   R2, [R0],#4\n"
 116                  "STRCC   R2, [R1],#4\n"
 117                  "BCC     loc_FF81013C\n"
 118                  "LDR     R1, =0x152728\n"      // ASM1989 -> In sx200 was:  "LDR     R1, =0x12351C\n"
 119                  "MOV     R2, #0\n"
 120     "loc_FF810154:\n"
 121                  "CMP     R3, R1\n"
 122                  "STRCC   R2, [R3],#4\n"
 123                  "BCC     loc_FF810154\n"
 124                  "B       sub_FF810354_my\n"   // ASM1989 -> In sx200 was:  "B       sub_FF8101A0_my\n"
 125                                                  //---------->
 126     );
 127 }
 128 
 129 
 130 void __attribute__((naked,noinline)) sub_FF810354_my() { // ASM1989 -> In sx200 was:  sub_FF8101A0_my
 131    // ASM1989 -> Need to review all the task creationhooks
 132 
 133    *(int*)0x1934=(int)taskHook;   //was 1934 in sx200 if 1938 hangs
 134    *(int*)0x1938=(int)taskHook;
 135 //UNABLE TO FIND THIS YET
 136 //   *(int*)0x1930=(int)taskCreateHook3; //  don't know why but movie will only work with 1930 and card lock only with 1934 - 1938
 137 //  OLD SX200
 138 //   *(int*)(0x24C0+4)= (*(int*)0xC0220128)&1 ? 0x2000000 : 0x1000000; // replacement of sub_FF821BD4 for correct power-on.
 139 // NEW SX210
 140      *(int*)(0x24B4)= (*(int*)0xC022010C)&1 ? 0x400000 : 0x200000; // // ASM1989 -> values for this found at: FF861488 in sx210, in sx200 at: FF847A08
 141 
 142 
 143    asm volatile (
 144                  "LDR     R0, =0xFF8103CC\n"        // ASM1989 -> In sx200 was: "LDR     R0, =0xFF810218\n"
 145                  "MOV     R1, #0\n"
 146                  "LDR     R3, =0xFF810404\n"        // ASM1989 -> In sx200 was: "LDR     R3, =0xFF810250\n"
 147 "loc_FF810360:\n"                                                                        // ASM1989 -> In sx200 was: "loc_FF8101AC:\n"
 148                  "CMP     R0, R3\n"
 149                  "LDRCC   R2, [R0],#4\n"
 150                  "STRCC   R2, [R1],#4\n"
 151                  "BCC     loc_FF810360\n"        // ASM1989 -> In sx200 was: "BCC     loc_FF8101AC\n"
 152                  "LDR     R0, =0xFF810404\n"     // ASM1989 -> In sx200 was:  "LDR     R0, =0xFF810250\n"
 153                  "MOV     R1, #0x4B0\n"
 154                  "LDR     R3, =0xFF810618\n"     // ASM1989 -> In sx200 was:   "LDR     R3, =0xFF810464\n"
 155 "loc_FF81037C:\n"                                                                        // ASM1989 -> In sx200 was: "loc_FF8101C8:\n"
 156                  "CMP     R0, R3\n"
 157                  "LDRCC   R2, [R0],#4\n"
 158                  "STRCC   R2, [R1],#4\n"
 159                  "BCC     loc_FF81037C\n"     // ASM1989 -> In sx200 was:  "BCC     loc_FF8101C8\n"
 160                  "MOV     R0, #0xD2\n"
 161                  "MSR     CPSR_cxsf, R0\n"
 162                  "MOV     SP, #0x1000\n"
 163                  "MOV     R0, #0xD3\n"
 164                  "MSR     CPSR_cxsf, R0\n"
 165                  "MOV     SP, #0x1000\n"
 166                  "LDR     R0, =0x6C4\n"       //ASM1989 left the same as other cameras, but in the firmare points to FF8103C0
 167                  "LDR     R2, =0xEEEEEEEE\n"
 168                  "MOV     R3, #0x1000\n"
 169 "loc_FF8103B0:\n"                                                                        // ASM1989 -> In sx200 was: "loc_FF8101FC:\n"
 170                  "CMP     R0, R3\n"
 171                  "STRCC   R2, [R0],#4\n"
 172                  "BCC     loc_FF8103B0\n"     // ASM1989 -> In sx200 was:  "BCC     loc_FF8101FC\n"
 173                  "BL      sub_FF811198_my\n"  // ASM1989 -> In sx200 was: "BL      sub_FF810FC4_my\n"
 174                                                                           //------------>
 175 
 176 
 177 
 178 "loc_FF810218:\n"                                                                        // ASM1989 -> In sx200 was: "loc_FF81020C:\n"
 179                  "ANDEQ   R0, R0, R4,ASR#13\n"
 180 "loc_FF8103C4:\n"                                                                        // ASM1989 -> In sx200 was: "loc_FF810210:\n"
 181                  "ANDEQ   R0, R0, R0,ROR R6\n"
 182 "loc_FF8103C8:\n"                                                                        // ASM1989 -> In sx200 was: "loc_FF810214:\n"
 183                  "ANDEQ   R0, R0, R4,ROR R6\n"
 184 "loc_FF8103CC:\n"                                                                        // ASM1989 -> In sx200 was: "loc_FF810218:\n"
 185                  "NOP\n"
 186                  "LDR     PC, =0xFF810618\n"             // ASM1989 -> In sx200 was:  "LDR     PC, =0xFF810464\n"
 187      );
 188 }
 189 
 190 void __attribute__((naked,noinline)) sub_FF811198_my() { // ASM1989 -> In sx200 was: sub_FF810FC4_my
 191      asm volatile (
 192                  "STR     LR, [SP,#-4]!\n"
 193                  "SUB     SP, SP, #0x74\n"
 194                  "MOV     R0, SP\n"
 195                  "MOV     R1, #0x74\n"
 196                  "BL      sub_FFB5FA88\n"                // ASM1989 -> In sx200 was: "sub_FFAF8D3C\n"
 197                  "MOV     R0, #0x53000\n"
 198                  "STR     R0, [SP,#4]\n"
 199                //  "LDR     R0, =0x0x152728\n" // In sx200 : 12351C
 200                  "LDR     R0, =new_sa\n"        // +
 201                  "LDR     R0, [R0]\n"           // +
 202                  "LDR     R2, =0x339C00\n"            // ASM1989 -> In sx200 was: "LDR     R2, =0x2F9C00\n"
 203                  "LDR     R1, =0x3324A8\n"        // ASM1989 -> In sx200 was: "LDR     R1, =0x2F24A8\n"
 204                  "STR     R0, [SP,#8]\n"
 205                  "SUB     R0, R1, R0\n"
 206                  "ADD     R3, SP, #0xC\n"
 207                  "STR     R2, [SP]\n"
 208                  "STMIA   R3, {R0-R2}\n"
 209                  "MOV     R0, #0x22\n"
 210                  "STR     R0, [SP,#0x18]\n"
 211                  "MOV     R0, #0x68\n"
 212                  "STR     R0, [SP,#0x1C]\n"
 213                  "LDR     R0, =0x19B\n"
 214                  "LDR     R1, =sub_FF815E58_my\n"   // ASM1989 -> In sx200 was:"LDR     R1, =sub_FF814D38_my\n"
 215                                                                                         //------------>
 216                  "STR     R0, [SP,#0x20]\n"
 217                  "MOV     R0, #0x96\n"
 218                  "STR     R0, [SP,#0x24]\n"
 219                  "MOV     R0, #0x78\n"
 220                  "STR     R0, [SP,#0x28]\n"
 221                  "MOV     R0, #0x64\n"
 222                  "STR     R0, [SP,#0x2C]\n"
 223                  "MOV     R0, #0\n"
 224                  "STR     R0, [SP,#0x30]\n"
 225                  "STR     R0, [SP,#0x34]\n"
 226                  "MOV     R0, #0x10\n"
 227                  "STR     R0, [SP,#0x5C]\n"
 228                  "MOV     R0, #0x800\n"
 229                  "STR     R0, [SP,#0x60]\n"
 230                  "MOV     R0, #0xA0\n"
 231                  "STR     R0, [SP,#0x64]\n"
 232                  "MOV     R0, #0x280\n"
 233                  "STR     R0, [SP,#0x68]\n"
 234                  "MOV     R0, SP\n"
 235                  "MOV     R2, #0\n"
 236                  "BL      sub_FF813404\n"        // ASM1989 -> In sx200 was:   "sub_FF812D68\n"
 237                  "ADD     SP, SP, #0x74\n"
 238                  "LDR     PC, [SP],#4\n"
 239      );
 240 }
 241 
 242 
 243 
 244 void __attribute__((naked,noinline)) sub_FF815E58_my() {// ASM1989 -> In sx200 was: sub_FF814D38_my(
 245      asm volatile (
 246                  "STMFD   SP!, {R4,LR}\n"
 247                  "BL      sub_FF810B20\n"       // ASM1989 -> In sx200 was:  "sub_FF810954\n"
 248                  "BL      sub_FF81A244\n"       // ASM1989 -> In sx200 was: "sub_FF8190B4\n"    dmSetup
 249                  "CMP     R0, #0\n"
 250                  "LDRLT   R0, =0xFF815F6C\n"    // ASM1989 -> In sx200 was: "LDRLT   R0, =0xFF814E4C\n"  // "dmSetup"
 251                  "BLLT    sub_FF815F4C\n"       // ASM1989 -> In sx200 was:  "BLLT    sub_FF814E2C\n"  err_init_task
 252                  "BL      sub_FF815A94\n"      // ASM1989 -> In sx200 was: "sub_FF814974\n"
 253                  "CMP     R0, #0\n"
 254                  "LDRLT   R0, =0xFF815F74\n"    // ASM1989 -> In sx200 was: "LDRLT   R0, =0xFF814E54\n"     // "termDriverInit"
 255                  "BLLT    sub_FF815F4C\n"          // ASM1989 ->        err_init_task
 256                  "LDR     R0, =0xFF815F84\n"   // ASM1989 -> In sx200 was: "LDR     R0, =0xFF814E64\n"  // "/_term"
 257                  "BL      sub_FF815B7C\n"          // ASM1989 -> In sx200 was:  "sub_FF814A5C\n"  termDeviceCreate
 258                  "CMP     R0, #0\n"
 259                  "LDRLT   R0, =0xFF815F8C\n"   // ASM1989 -> In sx200 was:  FF814E6C // "termDeviceCreate"
 260                  "BLLT    sub_FF815F4C\n"       // ASM1989 -> err_init_task
 261                  "LDR     R0, =0xFF815F84\n"   // ASM1989 -> "/_term"
 262                  "BL      sub_FF813BF0\n"               // ASM1989 -> In sx200 was: FF813578    stdioSetup
 263                  "CMP     R0, #0\n"
 264                  "LDRLT   R0, =0xFF815FA0\n"    // ASM1989 -> In sx200 was: FF814E80 // "stdioSetup"
 265                  "BLLT    sub_FF815F4C\n"       // ASM1989 -> err_init_task
 266                  "BL      sub_FF819C3C\n"               // ASM1989 -> In sx200 was: FF818BCC
 267                  "CMP     R0, #0\n"
 268                  "LDRLT   R0, =0xFF815FAC\n"    // ASM1989 -> In sx200 was: FF814E8C // "stdlibSetup"
 269                  "BLLT    sub_FF815F4C\n"       // ASM1989 -> err_init_task
 270                  "BL      sub_FF81167C\n"               // ASM1989 -> In sx200 was:  FF8114A8
 271                  "CMP     R0, #0\n"
 272                  "LDRLT   R0, =0xFF815FB8\n"    // ASM1989 -> In sx200 was: FF814E98// "armlib_setup"
 273                  "BLLT    sub_FF815F4C\n"       // ASM1989 -> err_init_task
 274                  "LDMFD   SP!, {R4,LR}\n"
 275                  "B       taskcreate_Startup_my\n" // ASM1989 -> In sx200 at FF81C260
 276 
 277                                                                         //---------->  In sx210 at FF81FAF0
 278 
 279         );
 280 };
 281 
 282 
 283 // ASM1989 -> Here starts the diferences with SX200
 284 
 285 void __attribute__((naked,noinline)) taskcreate_Startup_my() {
 286      asm volatile (
 287 
 288                  "STMFD   SP!, {R3-R5,LR}\n"            // ASM1989 -> In sx200 was:"STMFD   SP!, {R3,LR}\n"
 289                  "BL      sub_FF834410\n"         //ASM1989 -> j_nullsub_231 in sx200 j_nullsub_239
 290                  "BL      sub_FF83BF28\n"               // ASM1989 -> In sx200 was: FF829050
 291                  "CMP     R0, #0\n"
 292 
 293                 "BNE     loc_FF81FB44\n"                // ASM1989 -> In sx200 was: FF81C298
 294 
 295 
 296                  "BL      sub_FF835C04\n"               // ASM1989 -> In sx200 was: FF821BC8
 297                  "CMP     R0, #0\n"
 298 
 299 // Here are diferences with the sx200 code
 300                 "BEQ     loc_FF81FB44\n"                // ASM1989 -> In sx200 was: "BNE     loc_FF81FB44\n"
 301                  // old SX200 code : "BL      sub_FF8212BC\n"
 302                  "LDR     R4, =0xC0220000\n"    // ASM1989 -> In sx200 was:    "LDR     R1, =0xC0220000\n"
 303                  "LDR     R0, [R4,#0xCC]\n"           // ASM1989 -> In sx200 was: "MOV     R0, #0x44\n"
 304                  //New for sx210
 305                  "TST     R0, #1\n"
 306                                  "MOVEQ   R0, #0x12C\n"
 307 
 308 
 309 
 310 
 311                                 "BLEQ    sub_FF83A2DC\n"   //ASM1989 ->  eventproc_export_SleepTask
 312                                 "BL      sub_FF83440C\n"
 313                                 "CMP     R0, #0\n"
 314                                 "BNE     loc_FF81FB44\n"
 315                                 "BL      sub_FF833AA4\n"
 316                                 "MOV     R0, #0x44\n"
 317                                 "STR     R0, [R4,#0x1C]\n"
 318                                 "BL      sub_FF833C90\n"
 319 "loc_FF81FB40:\n"
 320                                 "B       loc_FF81FB40\n"
 321 
 322 
 323 "loc_FF81FB44:\n"
 324                                 //"BL      sub_FF834418\n" // ASM1989 -> -- replaced for power button startup
 325 
 326                                 "BL      sub_FF834414\n"//ASM1989 ->  j_nullsub_232
 327                                 "BL      sub_FF83A154\n"
 328 
 329                                 "LDR     R1, =0x38E000\n"
 330                                 "MOV     R0, #0\n"
 331 
 332                                 "BL      sub_FF83A59C\n"
 333                                 "BL      sub_FF83A348\n"  //ASM1989 -> sub_FF83A348__KerSys.c__548
 334                                 "MOV     R3, #0\n"
 335 
 336                                 "STR     R3, [SP]\n"  //ASM1989 ->Modified to match equal as sx200
 337                                 "LDR     R3, =task_Startup_my\n" //  ASM1989 -> original is FF81FA8C   task_Startup   // LDR instead of ADR
 338                 //---------------->
 339 
 340                                 "MOV     R2, #0\n"
 341                                 "MOV     R1, #0x19\n"
 342                                 "LDR     R0, =0xFF81FB8C\n"  //aStartup  // LDR instead of ADR
 343 
 344 
 345                                 "BL      sub_FF81E83C\n"  //eventproc_export_CreateTask
 346                                 "MOV     R0, #0\n"
 347                                 "LDMFD   SP!, {R3-R5,PC}\n"
 348 
 349 
 350 
 351 //OLD SX200
 352 /*
 353                  "BL      sub_FF8214A8\n"
 354 "loc_FF81C294:\n"
 355                  "B       loc_FF81C294\n"
 356 "loc_FF81C298:\n"
 357       //           "BL      sub_FF821BD4\n"       // -- replaced for power button startup
 358                  "BL      sub_FF821BD0\n"        // j_nullsub_240
 359                  "BL      sub_FF827308\n"
 360                  "LDR     R1, =0x34E000\n"
 361                  "MOV     R0, #0\n"
 362                  "BL      sub_FF827750\n"
 363                  "BL      sub_FF8274FC\n"     // _sub_FF8274FC__KerSys.c__548
 364                  "MOV     R3, #0\n"
 365                  "STR     R3, [SP]\n"
 366                  "LDR     R3, =task_Startup_my\n"    //---------------->
 367                  "MOV     R2, #0\n"
 368                  "MOV     R1, #0x19\n"
 369                  "LDR     R0, =0xFF81C2E0\n"   // "Startup"
 370                  "BL      sub_FF81AFAC\n"      // eventproc_export_CreateTask
 371                  "MOV     R0, #0\n"
 372                  "LDMFD   SP!, {R12,PC}\n" */
 373      );
 374 }
 375 
 376 
 377 
 378 // ASM1989 25.8.2010
 379 
 380 void __attribute__((naked,noinline)) task_Startup_my() {
 381      asm volatile (
 382                  "STMFD   SP!, {R4,LR}\n"
 383                  "BL      sub_FF81650C\n"     //ASM1989 -> taskcreate_ClockSave   in sx200 FF815394
 384                  "BL      sub_FF83550C\n"        //ASM1989 -> In sx200 was: FF822CB0
 385                  "BL      sub_FF833728\n"    //ASM1989 -> In sx200 was: FF820F70
 386                  "BL      sub_FF83BF68\n"    //ASM1989 ->  j_nullsub_235 in sx200 was: FF829090
 387                  "BL      sub_FF83C154\n"       //ASM1989 -> In sx200 was: FF829274
 388 
 389             //     "BL      sub_FF83BFFC\n"    // start diskboot.bin ASM1989 -> In sx200 was:  FF829124
 390 
 391                  "BL      sub_FF83C2F8\n"               //ASM1989 -> In sx200 was: FF829418
 392                  "BL      sub_FF8322F4\n"       //ASM1989 -> In sx200 was: FF81FB90
 393                  "BL      sub_FF83C184\n"       //ASM1989 -> In sx200 was: FF8292A4
 394                  "BL      sub_FF8398F8\n"       //ASM1989 -> In sx200 was: FF826908
 395                  "BL      sub_FF83C2FC\n"       //ASM1989 -> In sx200 was: FF82941C
 396 
 397 //"BL debug_blink\n"
 398 //"BL debug_blink\n"
 399 //"BL debug_blink\n"
 400 //"BL debug_blink\n"
 401 
 402 // If uncommented reboots why??
 403 
 404                "BL      CreateTask_spytask\n"    // +
 405                                                                 //---------------->
 406 
 407 //"BL debug_blink\n"
 408                  "BL      sub_FF8342F4\n"   // taskcreate_PhySw //ASM1989 -> In sx200 was: FF821AC4
 409                  "BL      sub_FF8378B0\n"       //ASM1989 -> In sx200 was: FF824B14
 410 
 411                  "BL      sub_FF83C314\n"       //ASM1989 -> In sx200 was: FF829434
 412                  "BL      sub_FF8316B8\n"   //ASM1989 -> In sx200 was: FF81EFB0 // nullsub_2
 413                  "BL      sub_FF833178\n"   //ASM1989 -> In sx200 was: FF82087C // sx210: sub_FF833178__Battery.c__0
 414                  "BL      sub_FF83BD00\n"   //ASM1989 -> In sx200 was: FF828E2C// taskcreate_Bye
 415                  "BL      sub_FF8336DC\n"   //ASM1989 -> In sx200 was: FF820F20
 416                  "BL      sub_FF833114\n"   //ASM1989 -> In sx200 was: FF820788 // taskcreate_TempCheck in sx200
 417                  "BL      sub_FF832328\n"       //ASM1989 -> In sx200 was: FF81FBC4
 418 
 419 
 420                  "BL      sub_FF83CD78\n"       //ASM1989 -> In sx200 was: FF829F18
 421                  "BL      sub_FF8330EC\n"       //ASM1989 -> In sx200 was: FF820760
 422 // Reaches ok here OK
 423                  "LDMFD   SP!, {R4,LR}\n"
 424                  "B       sub_FF81662C\n"   //ASM1989 -> In sx200 was:FF8154B4  // _sub_FF81662C__MLHClock.c__992
 425 
 426 
 427      );
 428 }
 429 
 430 
 431 
 432 // debug use only
 433 int debug_blink(int save_R0) {
 434         int i;
 435         *((volatile int *) 0xC0220130) = 0x46; // Turn on Print LED
 436         for (i=0; i<800000; i++) // Wait a while
 437                 {
 438                 asm volatile ( "nop\n" );
 439                 }
 440         *((volatile int *) 0xC0220130) = 0x44; // Turn off LED
 441         for (i=0; i<800000; i++) // Wait a while
 442                 {
 443                 asm volatile ( "nop\n" );
 444                 }
 445         return save_R0;
 446 };
 447 
 448 
 449 
 450 
 451 void __attribute__((naked,noinline)) init_file_modules_task() {
 452  asm volatile(
 453 // "BL debug_blink\n"
 454 
 455 
 456                "STMFD   SP!, {R4-R6,LR}\n"
 457                  "BL      sub_FF89193C\n"   //ASM1989 -> In sx200 was: FF874B88
 458                  "LDR     R5, =0x5006\n"
 459                  "MOVS    R4, R0\n"
 460                  "MOVNE   R1, #0\n"
 461                  "MOVNE   R0, R5\n"
 462                  "BLNE    sub_FF8953D8\n"    //ASM1989 -> eventproc_export_PostLogicalEventToUI In sx200 was:  FF879A54
 463 
 464                "BL      sub_FF891968_my\n" //ASM1989 -> In sx200 was:  FF874BB4
 465 
 466                  //---------->
 467 
 468                  "BL      core_spytask_can_start\n"      // CHDK: Set "it's-safe-to-start"-Flag for spytask
 469                  "CMP     R4, #0\n"
 470                  "MOVEQ   R0, R5\n"
 471                  "LDMEQFD SP!, {R4-R6,LR}\n"
 472                  "MOVEQ   R1, #0\n"
 473                  "BEQ     sub_FF8953D8\n"   //ASM1989 -> eventproc_export_PostLogicalEventToUI In sx200 was:  FF879A54
 474                  "LDMFD   SP!, {R4-R6,PC}\n"
 475  );
 476 }
 477 
 478 
 479 
 480 
 481 
 482 
 483 void __attribute__((naked,noinline)) sub_FF891968_my() {  //ASM1989 -> In sx200 was:  FF874BB4
 484  asm volatile(
 485                  "STMFD   SP!, {R4,LR}\n"
 486                  "MOV     R0, #3\n"
 487                  "BL      sub_FF87343C_my\n"  //ASM1989 -> In sx200 was: FF857704
 488                                                                //----------->
 489 
 490                  "BL      sub_FF951620\n"       //ASM1989 -> nullsub_109 In sx200 was: FF91572C // nullsub_99
 491                  "LDR     R4, =0x3680\n"                //ASM1989 -> In sx200 was: 0x2F04
 492                  "LDR     R0, [R4,#4]\n"
 493                  "CMP     R0, #0\n"
 494                  "BNE     loc_FF8919A0\n"               //ASM1989 -> In sx200 was: FF874BEC
 495                  "BL      sub_FF872684\n"               //ASM1989 -> In sx200 was: FF856AC8
 496                  "BL      sub_FF9443A4\n"               //ASM1989 -> In sx200 was: FF909DC4
 497                  "BL      sub_FF872684\n"               //ASM1989 -> In sx200 was: FF856AC8
 498                  "BL      sub_FF86EAA8\n"               //ASM1989 -> In sx200 was: FF852B1C
 499                  "BL      sub_FF872584\n"               //ASM1989 -> In sx200 was: FF8569C8
 500                  "BL      sub_FF944440\n"               //ASM1989 -> In sx200 was: FF909E90
 501  "loc_FF8919A0:\n"                                                              //ASM1989 -> In sx200 was: FF874BEC
 502                  "MOV     R0, #1\n"
 503                  "STR     R0, [R4]\n"
 504                  "LDMFD   SP!, {R4,PC}\n"
 505  );
 506 }
 507 
 508 
 509 void __attribute__((naked,noinline)) sub_FF87343C_my() {
 510  asm volatile(
 511                  "STMFD   SP!, {R4-R8,LR}\n"
 512                  "MOV     R8, R0\n"                                     //ASM1989 -> In sx200 was: "MOV     R6, R0\n"
 513                  "BL      sub_FF8733BC\n"             //ASM1989 ->  LOCATION: Mounter.c:0 In sx200 was: FF85766C
 514                  "LDR     R1, =0x39390\n"                       //ASM1989 -> In sx200 was: 0x11840
 515                  "MOV     R6, R0\n"                                     //ASM1989 -> In sx200 was: "MOV     R5, R0\n"
 516                  "ADD     R4, R1, R0,LSL#7\n"
 517                  "LDR     R0, [R4,#0x6C]\n"                //ASM1989 -> In sx200 was: 0x70
 518                  "CMP     R0, #4\n"
 519                  "LDREQ   R1, =0x83F\n"                         //ASM1989 -> In sx200 was: 0x6D8
 520                  "LDREQ   R0, =0xFF872EFC\n"    //  ; "Mounter.c" //ASM1989 -> In sx200 was:  FF857190
 521                  "BLEQ    sub_FF81EB14\n"      //ASM1989 -> In sx200 was:FF81B284  // DebugAssert
 522                  "MOV     R1, R8\n"                             //ASM1989 -> In sx200 was:  "MOV     R1, R6\n"
 523                  "MOV     R0, R6\n"                             //ASM1989 -> In sx200 was:  "MOV     R0, R5\n"
 524                  "BL      sub_FF872C74\n"      //  ASM1989 -> In sx200 was: FF857508 LOCATION: Mounter.c:0
 525                  "LDR     R0, [R4,#0x38]\n"             //  ASM1989 -> In sx200 was: LDR     R6, [R4,#0x3C]
 526                  "BL      sub_FF873ADC\n"               //  ASM1989 -> In sx200 was: FF857C30
 527                  "CMP     R0, #0\n"
 528                  "STREQ   R0, [R4,#0x6C]\n"     //  ASM1989 -> In sx200 was: 0x70
 529                  "MOV     R0, R6\n"                             //ASM1989 -> In sx200 was:  "MOV     R0, R5\n"  ??????
 530                  "BL      sub_FF872D04\n"               //ASM1989 -> In sx200 was: FF8571B0
 531                  "MOV     R0, R6\n"                             //ASM1989 -> In sx200 was:  "MOV     R0, R5\n"??????
 532                 "BL      sub_FF873064_my\n"   //  ASM1989 -> In sx200 was:  FF8574A4_my
 533                                                 // ------------------->
 534 
 535 
 536 
 537 
 538                  "MOV     R5, R0\n"                             //ASM1989 -> In sx200 was:  "MOV     R7, R0\n"
 539                  "MOV     R0, R6\n"                             //ASM1989 -> In sx200 was:  "MOV     R0, R5\n"??????
 540                  "BL      sub_FF873294\n"          //   LOCATION: Mounter.c:0 ASM1989 -> In sx200 was: FF857508
 541                  "LDR     R6, [R4,#0x3C]\n"      //ASM1989 -> In sx200 was:  "LDR     R1, [R4,#0x3C]\n"
 542                  "AND     R7, R5, R0\n"      //ASM1989 -> In sx200 was:  "AND     R2, R7, R0\n"
 543                  "CMP     R6, #0\n"           //ASM1989 -> In sx200 was:   "CMP     R1, #0\n"
 544                  "LDR     R1, [R4,#0x38]\n"          //ASM1989 -> In sx200 was:   "MOV     R0, #0\n"
 545                  "MOVEQ   R0, #0x80000001\n"
 546                  "MOV     R5, #0\n"                             //ASM1989 -> New in sx210
 547 
 548                  "BEQ     loc_FF8734EC\n"                //ASM1989 -> In sx200 was: FF8577AC
 549                  "LDR     R3, [R4,#0x2C]\n"
 550                  "MOV     R0, R1\n"
 551                  "BL      sub_FF8727EC\n"               //ASM1989 -> New in sx210  why ????????
 552                  "CMP     R0, #0\n"                   //ASM1989 -> In sx200 was:  "CMP     R3, #2\n"
 553                  "MOVNE   R5, #4\n"                     //ASM1989 -> In sx200 was:   "MOVEQ   R0, #4\n"
 554                  "CMP     R6, #5\n"                     //ASM1989 -> In sx200 was:  "CMP     R1, #5\n"
 555                  "ORRNE   R0, R5, #1\n"         //ASM1989 -> In sx200 was: R0, R0
 556                  "BICEQ   R0, R5, #1\n"         //ASM1989 -> In sx200 was: R0, R0
 557                  "CMP     R7, #0\n"                     //ASM1989 -> In sx200 was: R2
 558                  "BICEQ   R0, R0, #2\n"
 559                  "ORREQ   R0, R0, #0x80000000\n"
 560                  "BICNE   R0, R0, #0x80000000\n"
 561                  "ORRNE   R0, R0, #2\n"
 562  "loc_FF8734EC:\n"                                                              //ASM1989 -> In sx200 was: FF8577AC
 563                  "CMP     R8, #7\n"                                             //ASM1989 -> In sx200 was: R6
 564                  "STR     R0, [R4,#0x40]\n"
 565                  "LDMNEFD SP!, {R4-R8,PC}\n"
 566                  "MOV     R0, R8\n"                             //ASM1989 -> In sx200 was: R6
 567                  "BL      sub_FF87340C\n"               //ASM1989 -> In sx200 was:
 568                  "CMP     R0, #0\n"
 569                  "LDMEQFD SP!, {R4-R8,LR}\n"
 570                  "LDREQ   R0, =0xFF873538\n"     //ASM1989 -> In sx200 was:"LDREQ   R0, =0xFF8579A8\n"   // ; "EMEM MOUNT ERROR!!!"
 571                  "BEQ     sub_FF81177C\n"        //ASM1989 -> In sx200 was:  FF8115A8// qPrintf
 572                  "LDMFD   SP!, {R4-R8,PC}\n"
 573 
 574  );
 575 }
 576 
 577 
 578 
 579 
 580 
 581 void __attribute__((naked,noinline)) sub_FF873064_my() {  //  ASM1989 -> In sx200 was:  FF8574A4_my
 582  asm volatile(
 583                  "STMFD   SP!, {R4-R6,LR}\n"
 584                  "MOV     R5, R0\n"
 585                  "LDR     R0, =0x39390\n"       //ASM1989 -> In sx200 was:  0x11840
 586                  "ADD     R4, R0, R5,LSL#7\n"
 587                  "LDR     R0, [R4,#0x6C]\n"     //ASM1989 -> In sx200 was:  0x70
 588                  "TST     R0, #2\n"
 589                  "MOVNE   R0, #1\n"
 590                  "LDMNEFD SP!, {R4-R6,PC}\n"
 591                  "LDR     R0, [R4,#0x38]\n"
 592                  "MOV     R1, R5\n"
 593                  "BL      sub_FF872D84_my\n"    //ASM1989 -> Mounter.c__0 In sx200 was:     sub_FF857234_my
 594                                                          // ------------------>
 595                  "CMP     R0, #0\n"
 596                                                                         //In sx200 there was: "LDMEQFD SP!, {R4-R6,PC}\n"
 597                  "LDRNE   R0, [R4,#0x38]\n"             //ASM1989 -> In sx200 was: LDR
 598                  "MOVNE   R1, R5\n"                             //ASM1989 -> In sx200 was: MOV
 599                  "BLNE    sub_FF872F20\n"     //ASM1989 -> In sx200 was: "sub_FF8573A0\n"  //Mounter.c:0
 600                  // New in sx210
 601                  "LDR     R2, =0x39410\n"
 602                  "ADD     R1, R5, R5,LSL#4\n"
 603                  "LDR     R1, [R2,R1,LSL#2]\n"
 604                  "CMP     R1, #4\n"
 605                  "BEQ     loc_FF8730C4\n"
 606                  // sx200 shared code
 607                  "CMP     R0, #0\n"
 608                  "LDMEQFD SP!, {R4-R6,PC}\n"
 609                  "MOV     R0, R5\n"
 610                  "BL      sub_FF87287C\n"               //ASM1989 -> In sx200 was:FF856CC0
 611 
 612 "loc_FF8730C4:\n"                                                                   // New in sx210
 613                  "CMP     R0, #0\n"
 614                  "LDRNE   R1, [R4,#0x6C]\n"     //ASM1989 -> In sx200 was:  0x70
 615                  "ORRNE   R1, R1, #2\n"
 616                  "STRNE   R1, [R4,#0x6C]\n"    //ASM1989 -> In sx200 was:  0x70
 617                  "LDMFD   SP!, {R4-R6,PC}\n"
 618  );
 619 }
 620 
 621 //Next step "THE BEAST":
 622 
 623 
 624 
 625 void __attribute__((naked,noinline)) sub_FF872D84_my() { //ASM1989 -> Mounter.c__0 In sx200 was:     sub_FF857234_my
 626  asm volatile(
 627                  "STMFD   SP!, {R4-R10,LR}\n"           //ASM1989 -> In sx200 was: "STMFD   SP!, {R4-R8,LR}\n"
 628                  "MOV     R9, R0\n"                                     //ASM1989 -> In sx200 was:  R8
 629                  "LDR     R0, =0x39390\n"                               //ASM1989 -> In sx200 was: 0x11840
 630                  "MOV     R8, #0\n"                             //ASM1989 -> In sx200 was:  R7
 631                  "ADD     R5, R0, R1,LSL#7\n"
 632                  "LDR     R0, [R5,#0x3C]\n"
 633                  "MOV     R7, #0\n"                             //ASM1989 -> In sx200 was:  R6
 634                  "CMP     R0, #7\n"
 635                  "MOV     R6, #0\n"                 // New in sx210
 636                  "ADDLS   PC, PC, R0,LSL#2\n"
 637 /*
 638 //OLD SX200 block
 639 
 640                  "B       loc_FF857384\n"
 641 "loc_FF85725C:\n"
 642                  "B       loc_FF857294\n"
 643 "loc_FF857260:\n"
 644                  "B       loc_FF85727C\n"
 645 "loc_FF857264:\n"
 646                  "B       loc_FF85727C\n"
 647 "loc_FF857268:\n"
 648                  "B       loc_FF85727C\n"
 649 "loc_FF85726C:\n"
 650                  "B       loc_FF85727C\n"
 651 "loc_FF857270:\n"
 652                  "B       loc_FF85737C\n"
 653 "loc_FF857274:\n"
 654                  "B       loc_FF85727C\n"
 655 "loc_FF857278:\n"
 656                  "B       loc_FF85727C\n"
 657 "loc_FF85727C:\n"
 658 */
 659                  "B       loc_FF872EDC\n"
 660 "loc_FF872DB0:\n"
 661                  "B       loc_FF872DE8\n"
 662 "loc_FF872DB4:\n"
 663                  "B       loc_FF872DD0\n"
 664 "loc_FF872DB8:\n"
 665                  "B       loc_FF872DD0\n"
 666 "loc_FF872DBC:\n"
 667                  "B       loc_FF872DD0\n"
 668 "loc_FF872DC0:\n"
 669                  "B       loc_FF872DD0\n"
 670 "loc_FF872DC4:\n"
 671                  "B       loc_FF872ED4\n"
 672 "loc_FF872DC8:\n"
 673                  "B       loc_FF872DD0\n"
 674 "loc_FF872DCC:\n"
 675                  "B       loc_FF872DD0\n"
 676 "loc_FF872DD0:\n"
 677 
 678                                                                                 // ; jumptable FF872DA8 entries 1-4,6,7
 679                  "MOV     R2, #0\n"
 680                  "MOV     R1, #0x200\n"
 681                  "MOV     R0, #2\n"
 682                  "BL      sub_FF88B9EC\n"       //ASM1989 -> In sx200 was:FF86EC80
 683                  "MOVS    R4, R0\n"
 684                  "BNE     loc_FF872DF0\n"       //ASM1989 -> In sx200 was:FF85729C
 685 "loc_FF872DE8:\n"                                                       //ASM1989 -> In sx200 was:FF857294
 686                  "MOV     R0, #0\n"
 687                  "LDMFD   SP!, {R4-R10,PC}\n" //ASM1989 -> In sx200 was:"LDMFD   SP!, {R4-R8,PC}\n"
 688 "loc_FF872DF0:\n"                                                        //ASM1989 -> In sx200 was:FF85729C
 689                  "LDR     R12, [R5,#0x50]\n"     //ASM1989 -> In sx200 was:0x4C
 690                  "MOV     R3, R4\n"
 691                  "MOV     R2, #1\n"
 692                  "MOV     R1, #0\n"
 693                  "MOV     R0, R9\n"                              //ASM1989 -> In sx200 was:"MOV     R0, R8\n"
 694                  "BLX     R12\n"
 695                  "CMP     R0, #1\n"
 696                  "BNE     loc_FF872E1C\n"        //ASM1989 -> In sx200 :FF8572C8
 697                  "MOV     R0, #2\n"
 698                  "BL      sub_FF88BB38\n"       // ASM1989 -> In sx200 :FF86EDCC//__ExMemMan.c__0 ; LOCATION: ExMemMan.c:0
 699                  "B       loc_FF872DE8\n"      //ASM1989 -> In sx200 :FF857294
 700 "loc_FF872E1C:\n"                                                     //ASM1989 -> In sx200 :FF8572C8
 701                  "LDR     R1, [R5,#0x64]\n"   //ASM1989 -> In sx200 :0x68
 702                  "MOV     R0, R9\n"                             //ASM1989 -> In sx200 was:"MOV     R0, R8\n"
 703                  "BLX     R1\n"
 704 
 705 //Allready inserted code
 706 
 707                  "MOV   R1, R4\n"           //  pointer to MBR in R1
 708                  "BL    mbr_read_dryos\n"   //  total sectors count in R0 before and after call
 709 
 710         // Start of DataGhost's FAT32 autodetection code
 711           // Policy: If there is a partition which has type W95 FAT32, use the first one of those for image storage
 712           // According to the code below, we can use R1, R2, R3 and R12.
 713           // LR wasn't really used anywhere but for storing a part of the partition signature. This is the only thing
 714           // that won't work with an offset, but since we can load from LR+offset into LR, we can use this to do that :)
 715           "MOV     R12, R4\n"                    // Copy the MBR start address so we have something to work with
 716           "MOV     LR, R4\n"                     // Save old offset for MBR signature
 717           "MOV     R1, #1\n"                     // Note the current partition number
 718           "B       dg_sd_fat32_enter\n"          // We actually need to check the first partition as well, no increments yet!
 719      "dg_sd_fat32:\n"
 720           "CMP     R1, #4\n"                     // Did we already see the 4th partition?
 721           "BEQ     dg_sd_fat32_end\n"            // Yes, break. We didn't find anything, so don't change anything.
 722           "ADD     R12, R12, #0x10\n"            // Second partition
 723           "ADD     R1, R1, #1\n"                 // Second partition for the loop
 724      "dg_sd_fat32_enter:\n"
 725           "LDRB    R2, [R12, #0x1BE]\n"          // Partition status
 726           "LDRB    R3, [R12, #0x1C2]\n"          // Partition type (FAT32 = 0xB)
 727           "CMP     R3, #0xB\n"                   // Is this a FAT32 partition?
 728           "CMPNE   R3, #0xC\n"                   // Not 0xB, is it 0xC (FAT32 LBA) then?
 729           "BNE     dg_sd_fat32\n"                // No, it isn't. Loop again.
 730           "CMP     R2, #0x00\n"                  // It is, check the validity of the partition type
 731           "CMPNE   R2, #0x80\n"
 732           "BNE     dg_sd_fat32\n"                // Invalid, go to next partition
 733                                                  // This partition is valid, it's the first one, bingo!
 734           "MOV     R4, R12\n"                    // Move the new MBR offset for the partition detection.
 735 
 736      "dg_sd_fat32_end:\n"
 737           // End of DataGhost's FAT32 autodetection code
 738 
 739                  "LDRB    R1, [R4,#0x1C9]\n"
 740                  "LDRB    R3, [R4,#0x1C8]\n"
 741                  "LDRB    R12, [R4,#0x1CC]\n"
 742                  "MOV     R1, R1,LSL#24\n"
 743                  "ORR     R1, R1, R3,LSL#16\n"
 744                  "LDRB    R3, [R4,#0x1C7]\n"
 745                  "LDRB    R2, [R4,#0x1BE]\n"
 746             //     "LDRB    LR, [R4,#0x1FF]\n"          //remains commented as in sx200
 747                  "ORR     R1, R1, R3,LSL#8\n"
 748                  "LDRB    R3, [R4,#0x1C6]\n"
 749                  "CMP     R2, #0\n"
 750                  "CMPNE   R2, #0x80\n"
 751                  "ORR     R1, R1, R3\n"
 752                  "LDRB    R3, [R4,#0x1CD]\n"
 753                  "MOV     R3, R3,LSL#24\n"
 754                  "ORR     R3, R3, R12,LSL#16\n"
 755                  "LDRB    R12, [R4,#0x1CB]\n"
 756                  "ORR     R3, R3, R12,LSL#8\n"
 757                  "LDRB    R12, [R4,#0x1CA]\n"
 758                  "ORR     R3, R3, R12\n"
 759           //       "LDRB    R12, [R4,#0x1FE]\n"                 //remains commented as in sx200
 760                                                                                                         // Left as in sx200
 761                  "LDRB    R12, [LR,#0x1FE]\n"           // + First MBR signature byte (0x55), LR is original offset.
 762                  "LDRB    LR, [LR,#0x1FF]\n"            // + Last MBR signature byte (0xAA), LR is original offset.
 763 
 764                  // "MOV     R4, #0\n"    //ASM1989 -> It was not present in sx210 ??
 765 
 766 
 767 
 768                  "BNE     loc_FF872EA8\n"
 769                  "CMP     R0, R1\n"
 770                  "BCC     loc_FF872EA8\n"
 771                  "ADD     R2, R1, R3\n"
 772                  "CMP     R2, R0\n"
 773                  "CMPLS   R12, #0x55\n"
 774                  "CMPEQ   LR, #0xAA\n"
 775                  "MOVEQ   R7, R1\n"
 776                  "MOVEQ   R6, R3\n"
 777                  "MOVEQ   R4, #1\n"
 778                  "BEQ     loc_FF872EAC\n"      //ASM1989 -> New  In sx210
 779 "loc_FF872EA8:\n"                                       //ASM1989 -> New  In sx210
 780                                 "MOV     R4, R8\n"                      //ASM1989 -> New  In sx210
 781 "loc_FF872EAC:\n"                            //ASM1989 -> In sx200: FF857354   //Mounter.c__0+F8j
 782                  "MOV     R0, #2\n"
 783                  "BL      sub_FF88BB38\n"    //ASM1989 -> In sx200:FF86EDCC  // LOCATION: ExMemMan.c
 784                  "CMP     R4, #0\n"
 785                  "BNE     loc_FF872EE8\n"       //ASM1989 -> In sx200:FF857390
 786                  "LDR     R1, [R5,#0x64]\n" //ASM1989 -> In sx200:0x68
 787                  "MOV     R7, #0\n"
 788                  "MOV     R0, R9\n"                     //ASM1989 -> In sx200:"MOV     R0, R8\n"
 789                  "BLX     R1\n"
 790                  "MOV     R6, R0\n"
 791                  "B       loc_FF872EE8\n"        //ASM1989 -> In sx200:FF857390
 792 "loc_FF872ED4:\n"                            //ASM1989 -> In sx200: FF85737C
 793                  "MOV     R6, #0x40\n"
 794                  "B       loc_FF872EE8\n"               //ASM1989 -> In sx200:FF857390
 795 "loc_FF872EDC:\n"                            //ASM1989 -> In sx200: FF857384
 796                  "LDR     R1, =0x597\n"       //ASM1989 -> In sx200:0x5C9
 797                  "LDR     R0, =0xFF872EFC\n"     ///ASM1989 -> In sx200:FF857190 //"Mounter.c"
 798                  "BL      sub_FF81EB14\n"        ///ASM1989 -> In sx200:FF81B284 // DebugAssert
 799 "loc_FF872EE8:\n"                                //ASM1989 -> In sx200:FF857390
 800                  "STR     R7, [R5,#0x44]!\n"
 801                  "STMIB   R5, {R6,R8}\n"
 802                  "MOV     R0, #1\n"
 803                  "LDMFD   SP!, {R4-R10,PC}\n"
 804 
 805 
 806 
 807 
 808                 //OLD SX200 3 last lines
 809                 /*
 810                 "MOV     R0, #1\n"
 811                  "STR     R6, [R5,#4]\n"
 812                  "LDMFD   SP!, {R4-R8,PC}\n" */
 813  );
 814 }
 815 
 816 // ASM1989 base From the sd980 since it uses rotary too code from sx210 at FF862024
 817 void __attribute__((naked,noinline)) JogDial_task_my() {
 818  asm volatile(
 819                 "STMFD   SP!, {R4-R11,LR}\n"
 820                 "SUB     SP, SP, #0x2C\n"
 821                 "BL      sub_FF862410\n"
 822                 "LDR     R1, =0x24C8\n"      // in sd980 was: 0x23E4
 823                 "LDR     R9, =0xFFB65A50\n"
 824                 "MOV     R0, #0\n"
 825                 "ADD     R2, SP, #0x14\n"
 826                 "ADD     R3, SP, #0x18\n"
 827                 "ADD     R10, SP, #0xc\n"
 828                 "ADD     R8, SP, #0x10\n"
 829                 "MOV     R7, #0\n"
 830 
 831 "loc_FF862050:\n"
 832                 "ADD     R3, SP, #0x18\n"
 833                 "ADD     R12, R3, R0,LSL#1\n"
 834                 "ADD     R2, SP, #0x14\n"
 835                 "STRH    R7, [R12]\n"
 836                 "ADD     R12, R2, R0,LSL#1\n"
 837                 "STRH    R7, [R12]\n"
 838                 "STR     R7, [R8,R0,LSL#2]\n"
 839                 "STR     R7, [R10,R0,LSL#2]\n"
 840                 "ADD     R0, R0, #1\n"
 841                 "CMP     R0, #1\n"
 842                 "BLT     loc_FF862050\n"
 843 
 844 "loc_FF86207C:\n"
 845 
 846                 "LDR     R0, =0x24C8\n"                 // in sd980 was: 0x23E4
 847                 "MOV     R2, #0\n"
 848                 "LDR     R0, [R0,#8]\n"
 849                 "ADD     R1, SP, #0x4\n"
 850                 "BL      sub_FF839B88\n"
 851                 "TST     R0, #1\n"
 852                 "LDRNE   R1, =0x25C\n"                  // in sd980 was: 0x226
 853                 "LDRNE   R0, =0xFF862348\n"             //; "JogDial.c"
 854                 "BLNE    sub_FF81EB14\n"                //DebugAssert
 855                 "LDR     R0, [SP,#0x4]\n"
 856                 "AND     R4, R0, #0xFF\n"
 857                 "AND     R0, R0, #0xFF00\n"
 858                 "CMP     R0, #0x100\n"
 859                 "BEQ     loc_FF862100\n"
 860                 "CMP     R0, #0x200\n"
 861                 "BEQ     loc_FF862138\n"
 862                 "CMP     R0, #0x300\n"
 863                 "BEQ     loc_FF862394\n"
 864                 "CMP     R0, #0x400\n"
 865                 "BNE     loc_FF86207C\n"
 866                 "CMP     R4, #0\n"
 867                 "LDRNE   R1, =0x30E\n"          // in sd980 was: 0x2CA
 868                 "LDRNE   R0, =0xFF862348\n"             //; "JogDial.c"
 869                 "BLNE    sub_FF81EB14\n"                //DebugAssert
 870                 "LDR     R2, =0xFFB65A3C\n"
 871                 "ADD     R0, R4, R4,LSL#2\n"
 872                 "LDR     R1, [R2,R0,LSL#2]\n"
 873                 "STR     R7, [R1]\n"
 874                 "MOV     R1, #1\n"
 875                 "ADD     R0, R2, R0,LSL#2\n"
 876 
 877 "loc_FF8620F4:\n"
 878                 "LDR     R0, [R0,#8]\n"
 879                 "STR     R1, [R0]\n"
 880                 "B       loc_FF86207C\n"                // in sd980 was:
 881 
 882 "loc_FF862100:\n"
 883 //------------------  added code ---------------------
 884 "labelA:\n"
 885                 "LDR     R0, =jogdial_stopped\n"
 886                 "LDR     R0, [R0]\n"
 887                 "CMP     R0, #1\n"
 888                 "BNE     labelB\n"
 889                 "MOV     R0, #40\n"
 890                 "BL      sub_FF83A2DC\n"   //sleep ASM1989 for sx210
 891                 "B       labelA\n"
 892 "labelB:\n"
 893 //------------------  original code ------------------
 894                 "LDR     R5, =0x24D8\n"                         // in sd980 was:0x23F4
 895                 "LDR     R0, [R5,R4,LSL#2]\n"
 896                 "BL      sub_FF83AB20\n"/*
 897 //------------------  added code ---------------------  Allready commented from the sd980 port
 898 "labelA:\n"
 899                 "LDR     R0, =jogdial_stopped\n"
 900                 "LDR     R0, [R0]\n"
 901                 "CMP     R0, #1\n"
 902                 "BNE     labelB\n"
 903                 "MOV     R0, #40\n"
 904                 //"BL      sub_FF838DBC\n"//sleep
 905                 "BL      sub_FF83865C\n"//sleep
 906                 "B       labelA\n"
 907 "labelB:\n"
 908 //------------------  original code ------------------
 909 */
 910                 "LDR     R2, =0xFF861F8C\n"
 911                 "ADD     R1, R2, #0\n"
 912                 "ORR     R3, R4, #0x200\n"
 913                 "MOV     R0, #0x28\n"
 914                 "BL      sub_FF83AA3C\n"
 915                 "TST     R0, #1\n"
 916                 "CMPNE   R0, #0x15\n"
 917                 "STR     R0, [R10,R4,LSL#2]\n"
 918                 "BEQ     loc_FF86207C\n"
 919                 "LDR     R1, =0x271\n"                  // in sd980 was 0x23B
 920                 "B       loc_FF862338\n"
 921 
 922 "loc_FF862138:\n"
 923                 "LDR     R1, =0xFFB65A3C\n"
 924                 "ADD     R0, R4, R4,LSL#2\n"
 925                 "STR     R0, [SP,#0x28]\n"
 926                 "ADD     R0, R1, R0,LSL#2\n"
 927                 "STR     R0, [SP,#0x24]\n"
 928                 "LDR     R0, [R0,#4]\n"
 929                 "LDR     R0, [R0]\n"
 930                 "MOV     R2, R0,ASR#16\n"
 931                 "ADD     R0, SP, #0x18\n"
 932                 "ADD     R0, R0, R4,LSL#1\n"
 933                 "STR     R0, [SP,#0x20]\n"
 934                 "STRH    R2, [R0]\n"
 935                 "ADD     R0, SP, #0x14\n"
 936                 "ADD     R0, R0, R4,LSL#1\n"
 937                 "STR     R0, [SP,#0x1c]\n"
 938                 "LDRSH   R3, [R0]\n"
 939                 "SUB     R0, R2, R3\n"
 940                 "CMP     R0, #0\n"
 941                 "BNE     loc_FF8621C8\n"
 942                 // chages from here from sd980 code
 943                 "CMP     R0, #0\n"
 944                 "BEQ     loc_FF8622F0\n"
 945                 "LDR     R5, =0x24D8\n"
 946                 "LDR     R0, [R5,R4,LSL#2]\n"
 947                 "BL      sub_FF83AB20\n"
 948                 "LDR     R2, =0xFF861F98\n"
 949                 "ADD     R1, R2, #0\n"
 950                 "ORR     R3, R4, #0x300\n"
 951                 "MOV     R0, #0x1F4\n"
 952                 "BL      sub_FF83AA3C\n"
 953                 "TST     R0, #1\n"
 954                 "CMPNE   R0, #0x15\n"
 955                 "STR     R0, [R5,R4,LSL#2]\n"
 956                 "BEQ     loc_FF8622F0\n"
 957                 "LDR     R1, =0x28E\n"
 958                 "B       loc_FF8622E8\n"
 959                         //end of changes from sd980 original
 960 "loc_FF8621C8:\n"
 961                 "MOV     R1, R0\n"
 962                 "RSBLT   R0, R0, #0\n"
 963                 "MOVLE   R5, #0\n"
 964                 "MOVGT   R5, #1\n"
 965                 "CMP     R0, #0xFF\n"
 966                 "BLS     loc_FF862208\n"
 967                 "CMP     R1, #0\n"
 968                 "RSBLE   R0, R3, #0xFF\n"
 969                 "ADDLE   R0, R0, #0x7F00\n"
 970                 "ADDLE   R0, R0, R2\n"
 971                 "RSBGT   R0, R2, #0xFF\n"
 972                 "ADDGT   R0, R0, #0x7F00\n"
 973                 "ADDGT   R0, R0, R3\n"
 974                 "ADD     R0, R0, #0x8000\n"
 975                 "ADD     R0, R0, #1\n"
 976                 "EOR     R5, R5, #1\n"
 977 
 978 "loc_FF862208:\n"
 979                 "STR     R0, [SP,#0x8]\n"
 980                 "LDR     R0, [R8,R4,LSL#2]\n"
 981                 "CMP     R0, #0\n"
 982                 "BEQ     loc_FF862258\n"
 983                 "LDR     R1, =0xFFB65A34\n"
 984                 "ADD     R1, R1, R4,LSL#3\n"
 985                 "LDR     R1, [R1,R5,LSL#2]\n"
 986                 "CMP     R1, R0\n"
 987                 "BEQ     loc_FF862274\n"
 988                 "ADD     R11, R4, R4,LSL#1\n"
 989                 "ADD     R6, R9, R11,LSL#2\n"
 990                 "LDRB    R0, [R6,#9]\n"
 991                 "CMP     R0, #1\n"
 992                 "LDREQ   R0, [R6,#4]\n"
 993                 "BLEQ    sub_FF897278\n"
 994                 "LDRB    R0, [R6,#8]\n"
 995                 "CMP     R0, #1\n"
 996                 "BNE     loc_FF862274\n"
 997                 "LDR     R0, [R9,R11,LSL#2]\n"
 998                 "B       loc_FF862270\n"
 999 
1000 "loc_FF862258:\n"
1001                 "ADD     R0, R4, R4,LSL#1\n"
1002                 "ADD     R1, R9, R0,LSL#2\n"
1003                 "LDRB    R1, [R1,#8]\n"
1004                 "CMP     R1, #1\n"
1005                 "BNE     loc_FF862274\n"
1006                 "LDR     R0, [R9,R0,LSL#2]\n"
1007 
1008 "loc_FF862270:\n"
1009                 "BL      sub_FF897278\n"
1010 
1011 "loc_FF862274:\n"
1012                 "LDR     R0, =0xFFB65A34\n"
1013                 "LDR     R1, [SP,#0x8]\n"
1014                 "ADD     R6, R0, R4,LSL#3\n"
1015                 "LDR     R0, [R6,R5,LSL#2]\n"
1016                 "BL      sub_FF8971A8\n"
1017                 "LDR     R0, [R6,R5,LSL#2]\n"
1018                 "STR     R0, [R8,R4,LSL#2]\n"
1019                 "LDR     R0, [SP,#0x20]\n"
1020                 "LDR     R1, [SP,#0x1c]\n"
1021                 "LDRH    R0, [R0]\n"
1022                 "STRH    R0, [R1]\n"
1023                 "ADD     R0, R4, R4,LSL#1\n"
1024                 "ADD     R0, R9, R0,LSL#2\n"
1025                 "LDRB    R0, [R0,#9]\n"
1026                 "CMP     R0, #1\n"
1027                 "BNE     loc_FF8622F0\n"
1028                 "LDR     R5, =0x24D8\n"   // in sd980 was: 0x23F4
1029                 "LDR     R0, [R5,R4,LSL#2]\n"
1030                 "BL      sub_FF83AB20\n"
1031                 "LDR     R2, =0xFF861F98\n"  //LOCATION: JogDial.c:824
1032                 "ADD     R1, R2, #0\n"
1033                 "ORR     R3, R4, #0x300\n"
1034                 "MOV     R0, #0x1F4\n"
1035                 "BL      sub_FF83AA3C\n"
1036                 "TST     R0, #1\n"
1037                 "CMPNE   R0, #0x15\n"
1038                 "STR     R0, [R5,R4,LSL#2]\n"
1039                 //Diferences from sd980
1040                 "BEQ     loc_FF8622F0\n"
1041                 "MOV     R1, #0x2E8\n"
1042                 ""
1043  "loc_FF8622E8:\n"
1044                                 "LDR     R0, =0xFF862348\n"  // "JogDial.c"
1045                                 "BL      sub_FF81EB14\n"                //DebugAssert"
1046 
1047                                  //End Diferences from sd980
1048 "loc_FF8622F0:\n"
1049 
1050                 "ADD     R0, R4, R4,LSL#1\n"
1051                 "ADD     R0, R8, R0,LSL#2\n"
1052                 "LDRB    R0, [R0,#0xA]\n"
1053                 "CMP     R0, #1\n"
1054                 "BNE     loc_FF862378\n"
1055                 "LDR     R0, =0x24C8\n"
1056                 "LDR     R0, [R0,#0xC]\n"
1057                 "CMP     R0, #0\n"
1058                 "BEQ     loc_FF862378\n"
1059                 "LDR     R2, =0xFF861F8C\n"
1060                 "ADD     R1, R2, #0\n"
1061                 "ORR     R3, R4, #0x400\n"
1062                 "BL      sub_FF83AA3C\n"
1063                 "TST     R0, #1\n"
1064                 "CMPNE   R0, #0x15\n"
1065                 "STR     R0, [R10,R4,LSL#2]\n"
1066                 "BEQ     loc_FF86207C\n"
1067                 "LDR     R1, =0x2F3\n"
1068 
1069 "loc_FF862338:\n"
1070                 "LDR     R0, =0xFF862348\n"  // "JogDial.c"
1071                 "BL      sub_FF81EB14\n"                //DebugAssert"
1072                 "B       loc_FF86207C\n"
1073 
1074 "loc_FF862378:\n"
1075                 "LDR     R1, =0xFFB65A3C\n"
1076                 "LDR     R0, [SP,#0x28]\n"
1077                 "LDR     R0, [R1,R0,LSL#2]\n"
1078                 "STR     R7, [R0]\n"
1079                 "LDR     R0, [SP,#0x24]\n"
1080                 "MOV     R1, #1\n"
1081                 "B       loc_FF8620F4\n"
1082 
1083 "loc_FF862394:\n"
1084                 "LDR     R0, [R9,R4,LSL#2]\n"
1085                 "CMP     R0, #0\n"
1086                 "MOVEQ   R1, #0x2BC\n"
1087                 "LDREQ   R0, =0xFF862348\n"  // "JogDial.c"
1088                 "BLEQ    sub_FF81EB14\n"                //DebugAssert"
1089                 "ADD     R0, R4, R4,LSL#1\n"
1090                 "ADD     R0, R9, R0,LSL#2\n"
1091                 "LDR     R0, [R0,#4]\n"
1092                 "BL      sub_FF897278\n"
1093                 "STR     R7, [R8,R4,LSL#2]\n"
1094                 "B       loc_FF86207C\n"
1095 
1096  );
1097 }
1098 
1099 
1100 
1101 /*
1102 
1103 void __attribute__((naked,noinline)) JogDial_task_my() {
1104  asm volatile(
1105                  "STMFD   SP!, {R3-R11,LR}\n"
1106                  "BL      sub_FF84871C\n"        // __JogDial.c__416 ; LOCATION: JogDial.c:416
1107                  "LDR     R11, =0x80000B01\n"
1108                  "LDR     R8, =0xFFAFE608\n"
1109                  "LDR     R7, =0xC0240000\n"
1110                  "LDR     R6, =0x24E4\n"
1111                  "MOV     R9, #1\n"
1112                  "MOV     R10, #0\n"
1113 "loc_FF84858C:\n"
1114                  "LDR     R3, =0x1BB\n"
1115                  "LDR     R0, [R6,#0xC]\n"
1116                  "LDR     R2, =0xFF8487C4\n"     // "JogDial.c"
1117                  "MOV     R1, #0\n"
1118                  "BL      sub_FF827638\n"
1119                  "MOV     R0, #0x28\n"
1120                  "BL      sub_FF827490\n"        // eventproc_export_SleepTask ; LOCATION: KerSys.c:0
1121 //------------------  added code ---------------------
1122 "labelA:\n"
1123                 "LDR     R0, =jogdial_stopped\n"
1124                 "LDR     R0, [R0]\n"
1125                 "CMP     R0, #1\n"
1126                 "BNE     labelB\n"
1127                 "MOV     R0, #40\n"
1128                 "BL      _SleepTask\n"
1129                 "B       labelA\n"
1130 "labelB:\n"
1131 //------------------  original code ------------------
1132                  "LDR     R0, [R7,#0x104]\n"
1133                  "MOV     R0, R0,ASR#16\n"
1134                  "STRH    R0, [R6]\n"
1135                  "LDRSH   R2, [R6,#2]\n"
1136                  "SUB     R1, R0, R2\n"
1137                  "CMP     R1, #0\n"
1138                  "BEQ     loc_FF848650\n"
1139                  "MOV     R5, R1\n"
1140                  "RSBLT   R5, R5, #0\n"
1141                  "MOVLE   R4, #0\n"
1142                  "MOVGT   R4, #1\n"
1143                  "CMP     R5, #0xFF\n"
1144                  "BLS     loc_FF848604\n"
1145                  "CMP     R1, #0\n"
1146                  "RSBLE   R1, R2, #0xFF\n"
1147                  "ADDLE   R1, R1, #0x7F00\n"
1148                  "ADDLE   R0, R1, R0\n"
1149                  "RSBGT   R0, R0, #0xFF\n"
1150                  "ADDGT   R0, R0, #0x7F00\n"
1151                  "ADDGT   R0, R0, R2\n"
1152                  "ADD     R5, R0, #0x8000\n"
1153                  "ADD     R5, R5, #1\n"
1154                  "EOR     R4, R4, #1\n"
1155 "loc_FF848604:\n"
1156                  "LDR     R0, [R6,#0x14]\n"
1157                  "CMP     R0, #0\n"
1158                  "BEQ     loc_FF848648\n"
1159                  "LDR     R0, [R6,#0x1C]\n"
1160                  "CMP     R0, #0\n"
1161                  "BEQ     loc_FF848630\n"
1162                  "LDR     R1, [R8,R4,LSL#2]\n"
1163                  "CMP     R1, R0\n"
1164                  "BEQ     loc_FF848638\n"
1165                  "LDR     R0, =0xB01\n"
1166                  "BL      sub_FF87B9B8\n"
1167 "loc_FF848630:\n"
1168                  "MOV     R0, R11\n"
1169                  "BL      sub_FF87B9B8\n"
1170 "loc_FF848638:\n"
1171                  "LDR     R0, [R8,R4,LSL#2]\n"
1172                  " MOV     R1, R5\n"
1173                  "STR     R0, [R6,#0x1C]\n"
1174                  "BL      sub_FF87B8E8\n"
1175 "loc_FF848648:\n"
1176                  "LDRH    R0, [R6]\n"
1177                  "STRH    R0, [R6,#2]\n"
1178 "loc_FF848650:\n"
1179                  "STR     R10, [R7,#0x100]\n"
1180                  "STR     R9, [R7,#0x108]\n"
1181                  "LDR     R0, [R6,#0x10]\n"
1182                  "CMP     R0, #0\n"
1183                  "BLNE    sub_FF827490\n"        // eventproc_export_SleepTask ; LOCATION: KerSys.c:0
1184                  "B       loc_FF84858C\n"
1185  );
1186 }
1187 
1188 
1189 */
1190 

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