//////////////////////////////////////////////////////////////////////////////
//                                                                           /
// IAR ARM ANSI C/C++ Compiler V4.11A/W32              20/Jul/2004  18:58:53 /
// Copyright 1999-2004 IAR Systems. All rights reserved.                     /
//                                                                           /
//    Cpu mode        =  arm                                                 /
//    Endian          =  little                                              /
//    Stack alignment =  4                                                   /
//    Source file     =  C:\medusa\clivar.c                                  /
//    Command line    =  -I "C:\Program Files\IAR Systems\Embedded           /
//                       Workbench 4.0\ARM\INC\" -lc C:\medusa\Debug\List\   /
//                       -la C:\medusa\Debug\List\ -o C:\medusa\Debug\Obj\   /
//                       -s2 --no_cse --no_unroll --no_inline                /
//                       --no_code_motion --no_tbaa --no_clustering          /
//                       --no_scheduling --debug --cpu_mode arm --endian     /
//                       little --cpu ARM7TDMI-S --stack_align 4 -e --fpu    /
//                       None "-D_DLIB_CONFIG_FILE=C:\Program Files\IAR      /
//                       Systems\Embedded Workbench                          /
//                       4.0\ARM\LIB\dl4tpannl8n.h" C:\medusa\clivar.c       /
//    List file       =  C:\medusa\Debug\List\clivar.s79                     /
//                                                                           /
//                                                                           /
//////////////////////////////////////////////////////////////////////////////

        NAME clivar

        RTMODEL "ARMv4M", "USED"
        RTMODEL "StackAlign4", "USED"
        RTMODEL "__cpu_mode", "__pcs__arm"
        RTMODEL "__data_model", "absolute"
        RTMODEL "__dlib_file_descriptor", "0"
        RTMODEL "__endian", "little"
        RTMODEL "__rt_version", "6"

        RSEG CSTACK:DATA:NOROOT(2)

        PUBWEAK `?*?DATA_ID`
??DataTable0 EQU 0
        PUBWEAK ?init?tab?DATA_I
        PUBWEAK ?init?tab?DATA_Z
        PUBLIC addVariableHandler
        FUNCTION addVariableHandler,0603H
        LOCFRAME CSTACK, 20, STACK
        MULTWEAK cliRegisterCommand??rA
        PUBLIC clivarInit
        FUNCTION clivarInit,0203H
        LOCFRAME CSTACK, 8, STACK
        MULTWEAK printf??rA
        
        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 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 cfiCommon0
        
cliRegisterCommand  SYMBOL "cliRegisterCommand"
printf              SYMBOL "printf"
cliRegisterCommand??rA SYMBOL "??rA", cliRegisterCommand
printf??rA          SYMBOL "??rA", printf

        EXTERN cliRegisterCommand
        FUNCTION cliRegisterCommand,0202H
        EXTERN printf
        FUNCTION printf,010202H


        RSEG DATA_Z:DATA:SORT:NOROOT(2)
variableTable:
        DS8 640

        RSEG DATA_Z:DATA:SORT:NOROOT(2)
variableTableLen:
        DS8 4

        RSEG DATA_I:DATA:SORT:NOROOT(2)
varaddHelpText:
        DS8 4
	REQUIRE `?<Initializer for varaddHelpText>`

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock0 Using cfiCommon0
        CFI Function clivarInit
   CODE32      
clivarInit:
   STMDB       SP!,{R4,LR}        ;; Push
        CFI ?RET Frame(CFA, -4)
        CFI R4 Frame(CFA, -8)
        CFI CFA R13+8
   LDR         R0,??DataTable1    ;; variableTableLen
   MOV         R1,#+0x0
   STR         R1,[R0, #+0]
   MOV         R2,#+0x0
   MOV         R4,R2
??clivarInit_0:
   CMP         R4,#+0x10
   BGE         ??clivarInit_1
   MOV         R3,#+0x28
   LDR         R12,??clivarInit_2  ;; variableTable
   MLAS        LR,R3,R4,R12
   MOV         R0,#+0x0
   STRB        R0,[LR, #+0]
   ADDS        R4,R4,#+0x1
   B           ??clivarInit_0
??clivarInit_1:
   LDR         R1,??clivarInit_2+4  ;; varaddHelpText
   LDR         R2,[R1, #+0]
   LDR         R1,??clivarInit_2+8  ;; addVariableHandler
   LDR         R0,??clivarInit_2+12  ;; `?<Constant "varadd">`
   _BLF        cliRegisterCommand,cliRegisterCommand??rA
   MOV         R0,#+0x0
   LDMIA       SP!,{R4,PC}        ;; return
   DATA        
??clivarInit_2:
   DC32        variableTable
   DC32        varaddHelpText
   DC32        addVariableHandler
   DC32        `?<Constant "varadd">`
        CFI EndBlock cfiBlock0

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock1 Using cfiCommon0
        CFI Function addVariableHandler
   CODE32      
addVariableHandler:
   STMDB       SP!,{R4-R7,LR}     ;; Push
        CFI ?RET Frame(CFA, -4)
        CFI R7 Frame(CFA, -8)
        CFI R6 Frame(CFA, -12)
        CFI R5 Frame(CFA, -16)
        CFI R4 Frame(CFA, -20)
        CFI CFA R13+20
   MOV         R4,R0
   MOV         R5,R1
   MOV         R6,R2
   MVN         R0,#+0x0
   MOV         R7,R0
   MOV         R2,R4
   LDR         R1,[R5, #+0]
   LDR         R0,??addVariableHandler_0  ;; `?<Constant "%s: [%d] arguments\\n">`
   _BLF        printf,printf??rA
   LDR         R1,??DataTable1    ;; variableTableLen
   LDR         R2,[R1, #+0]
   CMP         R2,#+0x10
   BNE         ??addVariableHandler_1
   MOV         R0,R7
   B           ??addVariableHandler_2
??addVariableHandler_1:
   CMP         R4,#+0x3
   BEQ         ??addVariableHandler_3
   MOV         R0,R7
   B           ??addVariableHandler_2
??addVariableHandler_3:
   MOV         R0,R7
??addVariableHandler_2:
   LDMIA       SP!,{R4-R7,PC}     ;; return
   DATA        
??addVariableHandler_0:
   DC32        `?<Constant "%s: [%d] arguments\\n">`
        CFI EndBlock cfiBlock1

        RSEG CODE:CODE:NOROOT(2)
   DATA        
??DataTable1:
   DC32        variableTableLen

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock2 Using cfiCommon0
        CFI NoFunction
   CODE32      
cliRegisterCommand??rA:
   LDR         R12,??Subroutine0_0  ;; cliRegisterCommand
   MOV         PC,R12
   DATA        
??Subroutine0_0:
   DC32        cliRegisterCommand
        CFI EndBlock cfiBlock2

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock3 Using cfiCommon0
        CFI NoFunction
   CODE32      
printf??rA:
   LDR         R12,??Subroutine1_0  ;; printf
   MOV         PC,R12
   DATA        
??Subroutine1_0:
   DC32        printf
        CFI EndBlock cfiBlock3

        RSEG DATA_ID:CONST:SORT:NOROOT(2)
`?<Initializer for varaddHelpText>`:
        DC32 `?<Constant "varadd <name> [-i -f ...">`

        RSEG DATA_ID:CONST:SORT:NOROOT(2)
`?*?DATA_ID`:

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

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

        RSEG DATA_C:CONST:SORT:NOROOT(2)
`?<Constant "varadd <name> [-i -f ...">`:
        DC8 "varadd <name> [-i -f -s] <value>"
        DC8 0, 0, 0

        RSEG DATA_C:CONST:SORT:NOROOT(2)
`?<Constant "varadd">`:
        DC8 "varadd"
        DC8 0

        RSEG DATA_C:CONST:SORT:NOROOT(2)
`?<Constant "%s: [%d] arguments\\n">`:
        DC8 "%s: [%d] arguments\012"

        END
// 
// 224 bytes in segment CODE
//  64 bytes in segment DATA_C
//   4 bytes in segment DATA_I
//   4 bytes in segment DATA_ID
// 644 bytes in segment DATA_Z
//  24 bytes in segment INITTAB
// 
// 200 bytes of CODE  memory (+ 48 bytes shared)
//  68 bytes of CONST memory
// 648 bytes of DATA  memory
//
//Errors: none
//Warnings: 2
