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

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