//////////////////////////////////////////////////////////////////////////////
//                                                                           /
// IAR ARM ANSI C/C++ Compiler V4.40A/W32 EVALUATION   02/Nov/2007  20:30:02 /
// Copyright 1999-2005 IAR Systems. All rights reserved.                     /
//                                                                           /
//    Cpu mode        =  interwork                                           /
//    Endian          =  little                                              /
//    Stack alignment =  4                                                   /
//    Source file     =  C:\ARM\ivoplay\player_controler.c                   /
//    Command line    =  C:\ARM\ivoplay\player_controler.c -D X75 -lC        /
//                       C:\ARM\ivoplay\ReleaseX75\List\ -lA                 /
//                       C:\ARM\ivoplay\ReleaseX75\List\ -o                  /
//                       C:\ARM\ivoplay\ReleaseX75\Obj\ -s9 --no_cse         /
//                       --no_unroll --no_inline --no_code_motion --no_tbaa  /
//                       --no_clustering --no_scheduling --cpu_mode arm      /
//                       --endian little --cpu ARM926EJ-S --stack_align 4    /
//                       --interwork -e --fpu None -I D:\arm\ARM\INC\        /
//    List file       =  C:\ARM\ivoplay\ReleaseX75\List\player_controler.s79 /
//                                                                           /
//                                                                           /
//////////////////////////////////////////////////////////////////////////////

        NAME player_controler

        RTMODEL "StackAlign4", "USED"
        RTMODEL "__cpu_mode", "__pcs__interwork"
        RTMODEL "__data_model", "absolute"
        RTMODEL "__endian", "little"
        RTMODEL "__rt_version", "6"

        RSEG CSTACK:DATA:NOROOT(2)

        MULTWEAK ??AddNL??rT
        MULTWEAK ??ClearNL??rT
        MULTWEAK ??CreateRemotePlayerControler??rT
??DataTable0 EQU 0
??DataTable1 EQU 0
??DataTable2 EQU 0
??DataTable3 EQU 0
??DataTable5 EQU 0
??DataTable6 EQU 0
??DataTable9 EQU 0
        MULTWEAK ??GetNumberOfDialogs??rT
        MULTWEAK ??SwapCSMS??rT
        MULTWEAK ??find_name??rT
        MULTWEAK ??method0??rT
        PUBWEAK ?init?tab?DATA_Z
        PUBLIC AddNL
        FUNCTION AddNL,0203H
        LOCFRAME CSTACK, 12, STACK
        PUBLIC ClearNL
        FUNCTION ClearNL,0203H
        LOCFRAME CSTACK, 12, STACK
        PUBLIC Controler_Canvas
        PUBLIC CreateRemotePlayerControler
        FUNCTION CreateRemotePlayerControler,0201H
        LOCFRAME CSTACK, 8, STACK
        PUBLIC GetNumberOfDialogs
        FUNCTION GetNumberOfDialogs,0203H
        LOCFRAME CSTACK, 24, STACK
        PUBLIC SwapCSMS
        FUNCTION SwapCSMS,0203H
        LOCFRAME CSTACK, 48, STACK
        PUBLIC csm_text
        PUBLIC cursor
        PUBLIC find_name
        FUNCTION find_name,0203H
        LOCFRAME CSTACK, 48, STACK
        PUBLIC maincsm
        PUBLIC method0
        FUNCTION method0,0203H
        LOCFRAME CSTACK, 28, STACK
        PUBLIC my_csm_id
        PUBLIC nlbot
        PUBLIC nltop
        PUBLIC percent_t
        PUBLIC selcsm
        
        CFI Names cfiNames0
        CFI StackFrame CFA R13 HUGEDATA
        CFI Resource R0:32, R1:32, R2:32, R3:32, R4:32, R5:32, R6:32, R7:32
        CFI Resource R8:32, R9:32, R10:32, R11:32, R12:32, CPSR:32, R13:32
        CFI Resource R14:32, SPSR:32
        CFI VirtualResource ?RET:32
        CFI EndNames cfiNames0
        
        CFI Common cfiCommon0 Using cfiNames0
        CFI CodeAlign 2
        CFI DataAlign 4
        CFI ReturnAddress ?RET CODE
        CFI CFA R13+0
        CFI R0 Undefined
        CFI R1 Undefined
        CFI R2 Undefined
        CFI R3 Undefined
        CFI R4 SameValue
        CFI R5 SameValue
        CFI R6 SameValue
        CFI R7 SameValue
        CFI R8 SameValue
        CFI R9 SameValue
        CFI R10 SameValue
        CFI R11 SameValue
        CFI R12 Undefined
        CFI CPSR SameValue
        CFI R14 Undefined
        CFI SPSR SameValue
        CFI ?RET R14
        CFI EndCommon cfiCommon0
        
        
        CFI Common cfiCommon1 Using cfiNames0
        CFI CodeAlign 4
        CFI DataAlign 4
        CFI ReturnAddress ?RET CODE
        CFI CFA R13+0
        CFI R0 Undefined
        CFI R1 Undefined
        CFI R2 Undefined
        CFI R3 Undefined
        CFI R4 SameValue
        CFI R5 SameValue
        CFI R6 SameValue
        CFI R7 SameValue
        CFI R8 SameValue
        CFI R9 SameValue
        CFI R10 SameValue
        CFI R11 SameValue
        CFI R12 Undefined
        CFI CPSR SameValue
        CFI R14 Undefined
        CFI SPSR SameValue
        CFI ?RET R14
        CFI EndCommon cfiCommon1
        
AddNL               SYMBOL "AddNL"
??AddNL??rT         SYMBOL "??rT", AddNL
ClearNL             SYMBOL "ClearNL"
??ClearNL??rT       SYMBOL "??rT", ClearNL
CreateRemotePlayerControler SYMBOL "CreateRemotePlayerControler"
??CreateRemotePlayerControler??rT SYMBOL "??rT", CreateRemotePlayerControler
GetNumberOfDialogs  SYMBOL "GetNumberOfDialogs"
??GetNumberOfDialogs??rT SYMBOL "??rT", GetNumberOfDialogs
SwapCSMS            SYMBOL "SwapCSMS"
??SwapCSMS??rT      SYMBOL "??rT", SwapCSMS
find_name           SYMBOL "find_name"
??find_name??rT     SYMBOL "??rT", find_name
method0             SYMBOL "method0"
??method0??rT       SYMBOL "??rT", method0

        EXTERN under_idle
        EXTERN ws_nogui


        RSEG DATA_C:CONST:SORT:NOROOT(2)
`?<Constant "%08X ">`:
        DATA
        DC8 "%08X "
        DC8 0, 0

        RSEG DATA_C:CONST:SORT:NOROOT(2)
`?<Constant "Unknown %08X!">`:
        DATA
        DC8 "Unknown %08X!"
        DC8 0, 0

        RSEG DATA_C:CONST:SORT:NOROOT(2)
`?<Constant "IDLE Screen">`:
        DATA
        DC8 "IDLE Screen"

        RSEG DATA_C:CONST:SORT:NOROOT(2)
`?<Constant "!SKIP!">`:
        DATA
        DC8 "!SKIP!"
        DC8 0
// C:\ARM\ivoplay\player_controler.c
//    1 #include "..\inc\swilib.h"
//    2 
//    3 extern int mode;
//    4 extern CSM_RAM *under_idle;
//    5 

        RSEG DATA_C:CONST:SORT:NOROOT(2)
//    6 const CSM_DESC maincsm;
maincsm:
        DATA
        DC8 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
        DC8 0, 0, 0, 0, 0, 0, 0, 0
//    7 
//    8 typedef struct
//    9 {
//   10   CSM_RAM csm;
//   11   int gui_id;
//   12 }MAIN_CSM;
//   13 
//   14 typedef struct
//   15 {
//   16   GUI gui;
//   17   WSHDR *ws1;
//   18   WSHDR *ws2;
//   19   //  int i1;
//   20 }MAIN_GUI;
//   21 

        RSEG DATA_Z:DATA:SORT:NOROOT(2)
//   22 int my_csm_id;
my_csm_id:
        DS8 4
//   23 

        RSEG DATA_Z:DATA:SORT:NOROOT(2)
//   24 int cursor;
cursor:
        DS8 4

        RSEG DATA_Z:DATA:SORT:NOROOT(2)
//   25 void * volatile selcsm;
selcsm:
        DS8 4
//   26 
//   27 typedef struct
//   28 {
//   29   void *next;
//   30   WSHDR *name;
//   31   void *p;
//   32 } NAMELIST;
//   33 

        RSEG DATA_Z:DATA:SORT:NOROOT(2)
//   34 NAMELIST * volatile nltop;
nltop:
        DS8 4

        RSEG DATA_Z:DATA:SORT:NOROOT(2)
//   35 NAMELIST * volatile nlbot;
nlbot:
        DS8 4
//   36 

        RSEG DATA_Z:DATA:SORT:NOROOT(2)
//   37 char csm_text[32768];
csm_text:
        DS8 32768
//   38 

        RSEG DATA_C:CONST:SORT:NOROOT(0)
//   39 const char percent_t[]="%t";
percent_t:
        DATA
        DC8 "%t"

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock0 Using cfiCommon0
        CFI NoFunction
        THUMB
??ClearNL??rT:
        BX       PC
        Nop      
        CFI EndBlock cfiBlock0
        REQUIRE ClearNL
//   40 

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock1 Using cfiCommon1
        CFI Function ClearNL
        ARM
//   41 void ClearNL(void)
//   42 {
ClearNL:
        PUSH     {R4,R5,LR}
        CFI ?RET Frame(CFA, -4)
        CFI R5 Frame(CFA, -8)
        CFI R4 Frame(CFA, -12)
        CFI CFA R13+12
//   43   LockSched();
        SWI      +326
//   44   NAMELIST *nl=nltop;
        LDR      R0,??DataTable7  ;; nltop
        LDR      R4,[R0, #+0]
//   45   nltop=0;
        MOV      R1,#+0
        STR      R1,[R0, #+0]
//   46   nlbot=0;
        LDR      R0,??DataTable4  ;; nlbot
        STR      R1,[R0, #+0]
//   47   UnlockSched();
        SWI      +327
        CMP      R4,#+0
        POPEQ    {R4,R5,PC}
//   48   while(nl)
//   49   {
//   50     NAMELIST *p=nl;
??ClearNL_0:
        MOV      R5,R4
//   51     FreeWS(nl->name);
        LDR      R0,[R4, #+4]
        SWI      +297
//   52     nl=p->next;
        LDR      R4,[R5, #+0]
//   53     mfree(p);
        MOV      R0,R5
        SWI      +21
//   54   }
        CMP      R4,#+0
        BNE      ??ClearNL_0
//   55 }
        POP      {R4,R5,PC}       ;; return
        CFI EndBlock cfiBlock1

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock2 Using cfiCommon0
        CFI NoFunction
        THUMB
??AddNL??rT:
        BX       PC
        Nop      
        CFI EndBlock cfiBlock2
        REQUIRE AddNL
//   56 

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock3 Using cfiCommon1
        CFI Function AddNL
        ARM
//   57 void AddNL(WSHDR *ws)
//   58 {
AddNL:
        PUSH     {R4,R5,LR}
        CFI ?RET Frame(CFA, -4)
        CFI R5 Frame(CFA, -8)
        CFI R4 Frame(CFA, -12)
        CFI CFA R13+12
        MOV      R5,R0
//   59   NAMELIST *nnl=malloc(sizeof(NAMELIST));
        MOV      R0,#+12
        SWI      +20
        MOV      R4,R0
//   60   nnl->name=ws;
        STR      R5,[R4, #+4]
//   61   nnl->next=0;
        MOV      R0,#+0
        STR      R0,[R4, #+0]
//   62   LockSched();
        SWI      +326
//   63   if (!nltop)
        LDR      R0,??DataTable7  ;; nltop
        LDR      R0,[R0, #+0]
        CMP      R0,#+0
        LDR      R0,??DataTable7  ;; nltop
//   64   {
//   65     nlbot=nltop=nnl;
        STREQ    R4,[R0, #+0]
        LDREQ    R0,??DataTable4  ;; nlbot
//   66   }
//   67   else
//   68   {
//   69     nnl->next=nltop;
        LDRNE    R0,[R0, #+0]
        STRNE    R0,[R4, #+0]
//   70     nltop=nnl;
        LDRNE    R0,??DataTable7  ;; nltop
        STR      R4,[R0, #+0]
//   71   }
//   72   UnlockSched();
        SWI      +327
//   73 }
        POP      {R4,R5,PC}       ;; return
        CFI EndBlock cfiBlock3

        RSEG CODE:CODE:NOROOT(2)
        DATA
??DataTable4:
        DC32     nlbot

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock4 Using cfiCommon0
        CFI NoFunction
        THUMB
??find_name??rT:
        BX       PC
        Nop      
        CFI EndBlock cfiBlock4
        REQUIRE find_name
//   74 

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock5 Using cfiCommon1
        CFI Function find_name
        ARM
//   75 char *find_name(CSM_RAM *csm)
//   76 {
find_name:
        PUSH     {R4,LR}
        CFI ?RET Frame(CFA, -4)
        CFI R4 Frame(CFA, -8)
        CFI CFA R13+8
        SUB      SP,SP,#+40
        CFI CFA R13+48
//   77   char s[40];
//   78   char *p;
//   79   static char u[40];
//   80 
//   81   CSM_DESC *desc=csm->constr;
        LDR      R4,[R0, #+8]
//   82 
//   83   sprintf(s,"%08X ",desc);
        MOV      R2,R4
        LDR      R1,??find_name_0  ;; `?<Constant "%08X ">`
        MOV      R0,SP
        SWI      +22
//   84   p=strstr(csm_text,s);
        MOV      R1,SP
        LDR      R0,??find_name_0+0x4  ;; csm_text
        SWI      +280
//   85   if (p)
        CMP      R0,#+0
//   86   {
//   87     return(p+9);
        ADDNE    R0,R0,#+9
        BNE      ??find_name_1
//   88   }
//   89   else
//   90   {
//   91     sprintf(u,"Unknown %08X!",desc);
        MOV      R2,R4
        LDR      R1,??find_name_0+0x8  ;; `?<Constant "Unknown %08X!">`
        LDR      R0,??find_name_0+0xC  ;; ??u
        SWI      +22
//   92     return(u);
        LDR      R0,??find_name_0+0xC  ;; ??u
??find_name_1:
        ADD      SP,SP,#+40       ;; stack cleaning
        CFI CFA R13+8
        POP      {R4,PC}          ;; return
        DATA
??find_name_0:
        DC32     `?<Constant "%08X ">`
        DC32     csm_text
        DC32     `?<Constant "Unknown %08X!">`
        DC32     ??u
        CFI EndBlock cfiBlock5
//   93   }
//   94 }

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock6 Using cfiCommon0
        CFI NoFunction
        THUMB
??GetNumberOfDialogs??rT:
        BX       PC
        Nop      
        CFI EndBlock cfiBlock6
        REQUIRE GetNumberOfDialogs

        RSEG DATA_Z:DATA:SORT:NOROOT(2)
??u:
        DS8 40
//   95 

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock7 Using cfiCommon1
        CFI Function GetNumberOfDialogs
        ARM
//   96 int GetNumberOfDialogs(void)
//   97 {
GetNumberOfDialogs:
        PUSH     {R4-R8,LR}
        CFI ?RET Frame(CFA, -4)
        CFI R8 Frame(CFA, -8)
        CFI R7 Frame(CFA, -12)
        CFI R6 Frame(CFA, -16)
        CFI R5 Frame(CFA, -20)
        CFI R4 Frame(CFA, -24)
        CFI CFA R13+24
//   98   int count=0;
        MOV      R4,#+0
//   99   CSM_RAM *icsm=under_idle->next; //?????? ????????
        LDR      R0,??DataTable8  ;; under_idle
        LDR      R0,[R0, #+0]
        LDR      R5,[R0, #+0]
//  100   ClearNL();
        BL       ClearNL
//  101   WSHDR *ws;
//  102 
//  103   void *ircsm=FindCSMbyID(CSM_root()->idle_id);
        SWI      +33030
        LDR      R0,[R0, #+4]
        SWI      +264
        MOV      R6,R0
//  104 
//  105   do
//  106   {
//  107     if (icsm==ircsm)
??GetNumberOfDialogs_0:
        CMP      R5,R6
        BNE      ??GetNumberOfDialogs_1
//  108     {
//  109       ws=AllocWS(40);
        MOV      R0,#+40
        SWI      +293
        MOV      R8,R0
//  110       wsprintf(ws,"IDLE Screen");
        LDR      R1,??GetNumberOfDialogs_2  ;; `?<Constant "IDLE Screen">`
        SWI      +292
//  111       AddNL(ws);
        B        ??GetNumberOfDialogs_3
//  112       nltop->p=icsm;
//  113       count++;
//  114     }
//  115     else
//  116     {
//  117       if (icsm->constr!=&maincsm)
??GetNumberOfDialogs_1:
        LDR      R0,[R5, #+8]
        LDR      R1,??GetNumberOfDialogs_2+0x4  ;; maincsm
        CMP      R0,R1
        BEQ      ??GetNumberOfDialogs_4
//  118       {
//  119 	WSHDR *tws=(WSHDR *)(((char *)icsm->constr)+sizeof(CSM_DESC));
        ADD      R7,R0,#+24
//  120 	char *s;
//  121 	if((tws->ws_malloc==NAMECSM_MAGIC1)&&(tws->ws_mfree==NAMECSM_MAGIC2))
        LDR      R0,[R7, #+4]
        LDR      R1,??GetNumberOfDialogs_2+0x8  ;; 0x55aacccc
        CMP      R0,R1
        BNE      ??GetNumberOfDialogs_5
        LDR      R0,[R7, #+8]
        LDR      R1,??GetNumberOfDialogs_2+0xC  ;; 0x3333aa55
        CMP      R0,R1
        BNE      ??GetNumberOfDialogs_5
//  122 	{
//  123 	  ws=AllocWS(40);
        MOV      R0,#+40
        SWI      +293
        MOV      R8,R0
//  124 	  wstrcpy(ws,tws);
        MOV      R1,R7
        SWI      +287
//  125 	  AddNL(ws);
        B        ??GetNumberOfDialogs_3
//  126 	  nltop->p=icsm;
//  127 	  count++;
//  128 	}
//  129 	else
//  130 	{
//  131 	  s=find_name(icsm);
??GetNumberOfDialogs_5:
        MOV      R0,R5
        BL       find_name
        MOV      R7,R0
//  132 	  if (strncmp(s,"!SKIP!",6))
        MOV      R2,#+6
        LDR      R1,??GetNumberOfDialogs_2+0x10  ;; `?<Constant "!SKIP!">`
        SWI      +277
        CMP      R0,#+0
        BEQ      ??GetNumberOfDialogs_4
//  133 	  {
//  134 	    ws=AllocWS(40);
        MOV      R0,#+40
        SWI      +293
        MOV      R8,R0
//  135 	    wsprintf(ws,percent_t,s);
        MOV      R2,R7
        LDR      R1,??GetNumberOfDialogs_2+0x14  ;; percent_t
        SWI      +292
//  136 	    AddNL(ws);
??GetNumberOfDialogs_3:
        MOV      R0,R8
        BL       AddNL
//  137 	    nltop->p=icsm;
        LDR      R0,??DataTable7  ;; nltop
        LDR      R0,[R0, #+0]
        STR      R5,[R0, #+8]
//  138 	    count++;
        ADD      R4,R4,#+1
//  139 	  }
//  140 	}
//  141       }
//  142     }
//  143   }
//  144   while((icsm=icsm->next));
??GetNumberOfDialogs_4:
        LDR      R5,[R5, #+0]
        CMP      R5,#+0
        BNE      ??GetNumberOfDialogs_0
//  145   return(count);
        MOV      R0,R4
        POP      {R4-R8,PC}       ;; return
        DATA
??GetNumberOfDialogs_2:
        DC32     `?<Constant "IDLE Screen">`
        DC32     maincsm
        DC32     0x55aacccc
        DC32     0x3333aa55
        DC32     `?<Constant "!SKIP!">`
        DC32     percent_t
        CFI EndBlock cfiBlock7
//  146 }

        RSEG CODE:CODE:NOROOT(2)
        DATA
??DataTable7:
        DC32     nltop

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock8 Using cfiCommon0
        CFI NoFunction
        THUMB
??SwapCSMS??rT:
        BX       PC
        Nop      
        CFI EndBlock cfiBlock8
        REQUIRE SwapCSMS
//  147 

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock9 Using cfiCommon1
        CFI Function SwapCSMS
        ARM
//  148 void SwapCSMS(void)
//  149 {
SwapCSMS:
        PUSH     {R4,LR}
        CFI ?RET Frame(CFA, -4)
        CFI R4 Frame(CFA, -8)
        CFI CFA R13+8
//  150   CSM_RAM *icsm; //?????? CSM
//  151   CSM_RAM *ucsm; //??????? CSM
//  152   CSM_RAM *wcsm; //???????????? CSM
//  153   extern WSHDR *ws_nogui;
//  154 
//  155   if (GetNumberOfDialogs()<2) return; //?????? ???????????
        BL       GetNumberOfDialogs
        CMP      R0,#+2
        POPLT    {R4,PC}
//  156   if (!selcsm) return;
        LDR      R0,??SwapCSMS_0  ;; selcsm
        LDR      R0,[R0, #+0]
        CMP      R0,#+0
        POPEQ    {R4,PC}
//  157   do
//  158   {
//  159     icsm=under_idle;
??SwapCSMS_1:
        LDR      R0,??DataTable8  ;; under_idle
        LDR      R4,[R0, #+0]
//  160     ucsm=FindCSMbyID(my_csm_id);
        LDR      R0,??DataTable10  ;; my_csm_id
        LDR      R0,[R0, #+0]
        SWI      +264
//  161     wcsm=(CSM_RAM *)ucsm->prev; //???????? ???????????? CSM
        LDR      R1,[R0, #+4]
//  162     ((CSM_RAM *)(wcsm->prev))->next=ucsm; //CSM ????? ???????????? ?????? ????????? ?? ??????? CSM
        LDR      R2,[R1, #+4]
        STR      R0,[R2, #+0]
//  163     ucsm->prev=wcsm->prev; //prev ???????? CSM ????????? ?? CSM ????? ????????????
        LDR      R2,[R1, #+4]
        STR      R2,[R0, #+4]
//  164     //?????? ????????? ? ?????? ????? ???????????? CSM
//  165     ((CSM_RAM *)(wcsm->next=icsm->next))->prev=wcsm;
        LDR      R2,[R4, #+0]
        STR      R2,[R1, #+0]
        STR      R1,[R2, #+4]
//  166     icsm->next=wcsm;
        STR      R1,[R4, #+0]
//  167     wcsm->prev=icsm;
        STR      R4,[R1, #+4]
//  168   }
//  169   while(ucsm->prev!=selcsm);
        LDR      R0,[R0, #+4]
        LDR      R1,??SwapCSMS_0  ;; selcsm
        LDR      R1,[R1, #+0]
        CMP      R0,R1
        BNE      ??SwapCSMS_1
//  170   //?????? ?????? "??? GUI" ?? ?????? ??????
//  171   DrawRoundedFrame(0,0,131,175,0,0,0,
//  172 			GetPaletteAdrByColorIndex(0),
//  173 			GetPaletteAdrByColorIndex(20));
        MOV      R0,#+20
        SWI      +302
        MOV      R4,R0
        MOV      R0,#+0
        SWI      +302
        PUSH     {R4}
        CFI CFA R13+12
        PUSH     {R0}
        CFI CFA R13+16
        MOV      R0,#+0
        PUSH     {R0}
        CFI CFA R13+20
        PUSH     {R0}
        CFI CFA R13+24
        PUSH     {R0}
        CFI CFA R13+28
        MOV      R3,#+175
        MOV      R2,#+131
        MOV      R1,#+0
        SWI      +336
//  174   DrawString(ws_nogui,3,70,128,172,1,2,GetPaletteAdrByColorIndex(2),GetPaletteAdrByColorIndex(23));
        MOV      R0,#+23
        SWI      +302
        MOV      R4,R0
        MOV      R0,#+2
        SWI      +302
        PUSH     {R4}
        CFI CFA R13+32
        PUSH     {R0}
        CFI CFA R13+36
        MOV      R0,#+2
        PUSH     {R0}
        CFI CFA R13+40
        MOV      R0,#+1
        PUSH     {R0}
        CFI CFA R13+44
        MOV      R0,#+172
        PUSH     {R0}
        CFI CFA R13+48
        MOV      R3,#+128
        MOV      R2,#+70
        MOV      R1,#+3
        LDR      R0,??SwapCSMS_0+0x4  ;; ws_nogui
        LDR      R0,[R0, #+0]
        SWI      +332
        ADD      SP,SP,#+40       ;; stack cleaning
        CFI CFA R13+8
//  175 }
        POP      {R4,PC}          ;; return
        DATA
??SwapCSMS_0:
        DC32     selcsm
        DC32     ws_nogui
        CFI EndBlock cfiBlock9

        RSEG CODE:CODE:NOROOT(2)
        DATA
??DataTable8:
        DC32     under_idle

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock10 Using cfiCommon0
        CFI NoFunction
        THUMB
??method0??rT:
        BX       PC
        Nop      
        CFI EndBlock cfiBlock10
        REQUIRE method0
//  176 
//  177 

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock11 Using cfiCommon1
        CFI Function method0
        ARM
//  178 void method0(MAIN_GUI *data)
//  179 {
method0:
        PUSH     {R4,LR}
        CFI ?RET Frame(CFA, -4)
        CFI R4 Frame(CFA, -8)
        CFI CFA R13+8
//  180   /*int i;
//  181   int pos;
//  182   int vcur;
//  183   NAMELIST *nl;
//  184 */
//  185   DrawRoundedFrame(0,0,131,175,0,0,0,
//  186 			GetPaletteAdrByColorIndex(0),
//  187 			GetPaletteAdrByColorIndex(20));
        MOV      R0,#+20
        SWI      +302
        MOV      R4,R0
        MOV      R0,#+0
        SWI      +302
        PUSH     {R4}
        CFI CFA R13+12
        PUSH     {R0}
        CFI CFA R13+16
        MOV      R0,#+0
        PUSH     {R0}
        CFI CFA R13+20
        PUSH     {R0}
        CFI CFA R13+24
        PUSH     {R0}
        CFI CFA R13+28
        MOV      R3,#+175
        MOV      R2,#+131
        MOV      R1,#+0
        SWI      +336
//  188   /*wsprintf(data->ws1,"XTask v1.1\n(C)2006 by Rst7/CBSIE\n\n%t%d",
//  189 	   "?????? ????????: ",
//  190 	   GetNumberOfDialogs());
//  191   DrawString(data->ws1,3,3,128,51,11,0,GetPaletteAdrByColorIndex(0),GetPaletteAdrByColorIndex(23));
//  192 
//  193   nl=nltop;
//  194   i=0;
//  195   while(nl)
//  196   {
//  197     i++;
//  198     nl=nl->next;
//  199   }
//  200   if (i)
//  201   {
//  202     if (cursor>=i) cursor=i-1;
//  203   }
//  204   else cursor=0;
//  205   nl=nltop;
//  206   if (cursor<2)
//  207   {
//  208     pos=0;
//  209     vcur=cursor;
//  210   }
//  211   else
//  212   {
//  213     pos=cursor-2;
//  214     vcur=2;
//  215   }
//  216   while(pos)
//  217   {
//  218     if (nl)
//  219     {
//  220       nl=nl->next;
//  221     }
//  222     pos--;
//  223   }
//  224   i=0;
//  225   do
//  226   {
//  227     if (nl)
//  228     {
//  229       if (nl->name)
//  230       {
//  231 	if (i==vcur)
//  232 	{
//  233 	  selcsm=nl->p;
//  234 	  DrawRoundedFrame(3,55+14*i,128,58+11+14*i,0,0,0,
//  235 			GetPaletteAdrByColorIndex(0),
//  236 			GetPaletteAdrByColorIndex(3));
//  237 	}
//  238 	DrawString(nl->name,5,57+14*i,126,57+11+14*i,11,0x80,GetPaletteAdrByColorIndex(0),GetPaletteAdrByColorIndex(23));
//  239       }
//  240       nl=nl->next;
//  241     }
//  242     i++;
//  243   }
//  244   while(i<5);
//  245 
//  246   wsprintf(data->ws2,percent_t," Idle           ?????");
//  247   DrawString(data->ws2,3,157,128,172,5,2,GetPaletteAdrByColorIndex(0),GetPaletteAdrByColorIndex(23));*/
//  248 }
        ADD      SP,SP,#+20       ;; stack cleaning
        CFI CFA R13+8
        POP      {R4,PC}          ;; return
        CFI EndBlock cfiBlock11

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock12 Using cfiCommon0
        CFI NoFunction
        THUMB
??CreateRemotePlayerControler??rT:
        BX       PC
        Nop      
        CFI EndBlock cfiBlock12
        REQUIRE CreateRemotePlayerControler
//  249 /*
//  250 void method1(MAIN_GUI *data, void *(*malloc_adr)(int))
//  251 {
//  252   int f;
//  253   int sz=0;
//  254   unsigned int ul;
//  255   data->ws1=AllocWS(256);
//  256   data->ws2=AllocWS(256);
//  257   if ((f=fopen("4:\\ZBin\\etc\\CSMlist.txt",A_ReadOnly+A_BIN,0,&ul))!=-1)
//  258   {
//  259     sz=fread(f,csm_text,32767,&ul);
//  260     fclose(f,&ul);
//  261   }
//  262   if (sz>0) csm_text[sz]=0;
//  263   cursor=1; //?? ?????????
//  264   selcsm=0;
//  265   data->gui.state=1;
//  266 }
//  267 
//  268 void method2(MAIN_GUI *data, void (*mfree_adr)(void *))
//  269 {
//  270   ClearNL();
//  271   FreeWS(data->ws1);
//  272   FreeWS(data->ws2);
//  273   data->gui.state=0;
//  274 }
//  275 
//  276 void method3(MAIN_GUI *data, void *(*malloc_adr)(int), void (*mfree_adr)(void *))
//  277 {
//  278   data->gui.state=2;
//  279 }
//  280 
//  281 void method4(MAIN_GUI *data, void (*mfree_adr)(void *))
//  282 {
//  283   if (data->gui.state!=2) return;
//  284   data->gui.state=1;
//  285 }
//  286 
//  287 int method5(MAIN_GUI *data, GUI_MSG *msg)
//  288 {
//  289   if (msg->gbsmsg->msg==KEY_DOWN)
//  290   {
//  291     switch(msg->gbsmsg->submess)
//  292     {
//  293     case LEFT_SOFT:
//  294       selcsm=FindCSMbyID(CSM_root()->idle_id);
//  295     case ENTER_BUTTON:
//  296       SwapCSMS();
//  297     case RIGHT_SOFT:
//  298       return(1); //?????????? ????? GeneralFunc ??? ???. GUI -> ???????? GUI
//  299     case UP_BUTTON:
//  300       if (cursor) cursor--;
//  301       break;
//  302     case DOWN_BUTTON:
//  303       cursor++;
//  304       break;
//  305     }
//  306   }
//  307   DirectRedrawGUI();
//  308   return(0);
//  309 }*/
//  310 /*
//  311 void method7(MAIN_GUI *data, void (*mfree_adr)(void *))
//  312 {
//  313   mfree_adr(data);
//  314 }
//  315 
//  316 int method8(void){return(0);}
//  317 
//  318 int method9(void){return(0);}
//  319 
//  320 const void * const control_gui_methods[11]={
//  321   (void *)method0,	//Redraw
//  322   (void *)method1,	//Create
//  323   (void *)method2,	//Close
//  324   (void *)method3,	//Focus
//  325   (void *)method4,	//Unfocus
//  326   (void *)method5,	//OnKey
//  327   0,
//  328   (void *)method7,	//Destroy
//  329   (void *)method8,
//  330   (void *)method9,
//  331   0
//  332 };*/
//  333 

        RSEG DATA_C:CONST:SORT:NOROOT(2)
//  334 const RECT Controler_Canvas={0,0,131,175};
Controler_Canvas:
        DATA
        DC16 0, 0, 131, 175
//  335 
//  336 /*void maincsm_oncreate(CSM_RAM *data)
//  337 {
//  338   MAIN_GUI *main_gui=malloc(sizeof(MAIN_GUI));
//  339   MAIN_CSM *csm=(MAIN_CSM*)data;
//  340   zeromem(main_gui,sizeof(MAIN_GUI));
//  341   main_gui->gui.canvas=(void *)(&Controler_Canvas);
//  342   main_gui->gui.flag30=2;
//  343   main_gui->gui.methods=(void *)gui_methods;
//  344   main_gui->gui.item_ll.data_mfree=(void (*)(void *))mfree_adr();
//  345   csm->csm.state=0;
//  346   csm->csm.unk1=0;
//  347   csm->gui_id=CreateGUI(main_gui);
//  348 }*/
//  349 
//  350 /*void maincsm_onclose(CSM_RAM *csm)
//  351 {
//  352   //  extern void *ELF_BEGIN;
//  353   //  ((void (*)(void *))(mfree_adr()))(&ELF_BEGIN);
//  354   mode=0;
//  355 }*/
//  356 
//  357 /*int maincsm_onmessage(CSM_RAM *data, GBS_MSG *msg)
//  358 {
//  359   MAIN_CSM *csm=(MAIN_CSM*)data;
//  360   if ((msg->msg==MSG_GUI_DESTROYED)&&((int)msg->data0==csm->gui_id))
//  361   {
//  362     csm->csm.state=-3;
//  363   }
//  364   return(1);
//  365 }*/
//  366 
//  367 //const int minus11=-11;
//  368 
//  369 /*const CSM_DESC maincsm=
//  370 {
//  371   maincsm_onmessage,
//  372   maincsm_oncreate,
//  373   maincsm_onclose,
//  374   sizeof(MAIN_CSM),
//  375   1,
//  376   &minus11
//  377 };*/
//  378 

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock13 Using cfiCommon1
        CFI Function CreateRemotePlayerControler
        ARM
//  379 void CreateRemotePlayerControler()
//  380 {
CreateRemotePlayerControler:
        PUSH     {R4,LR}
        CFI ?RET Frame(CFA, -4)
        CFI R4 Frame(CFA, -8)
        CFI CFA R13+8
//  381   //char dummy[sizeof(MAIN_CSM)];
//  382   CSM_RAM *data;
//  383   zeromem(data,sizeof(data));
        MOV      R1,#+4
        SWI      +285
//  384   MAIN_GUI *main_gui=malloc(sizeof(MAIN_GUI));
        MOV      R0,#+56
        SWI      +20
        MOV      R4,R0
//  385   MAIN_CSM *csm=(MAIN_CSM*)data;
//  386   zeromem(main_gui,sizeof(MAIN_GUI));
        MOV      R1,#+56
        SWI      +285
//  387   my_csm_id=CreateGUI(main_gui);
        MOV      R0,R4
        SWI      +311
        LDR      R1,??DataTable10  ;; my_csm_id
        STR      R0,[R1, #+0]
//  388 }
        POP      {R4,PC}          ;; return
        CFI EndBlock cfiBlock13

        RSEG CODE:CODE:NOROOT(2)
        DATA
??DataTable10:
        DC32     my_csm_id

        RSEG INITTAB:CODE:ROOT(2)
        DATA
?init?tab?DATA_Z:
        DCD      sfe(DATA_Z) - sfb(DATA_Z), sfb(DATA_Z), sfb(DATA_Z)

        END
// 
//    964 bytes in segment CODE
//     79 bytes in segment DATA_C
// 32 828 bytes in segment DATA_Z
//     12 bytes in segment INITTAB
// 
//    936 bytes of CODE  memory (+ 40 bytes shared)
//     79 bytes of CONST memory
// 32 828 bytes of DATA  memory
//
//Errors: none
//Warnings: 2
