; generated by Component: ARM Compiler 5.04 update 1 (build 49) Tool: ArmCC [5040049]
; commandline ArmCC [--list --split_sections --debug -c --asm --interleave -o.\obj\retarget.o --asm_dir=.\lst\ --list_dir=.\lst\ --depend=.\obj\retarget.d --cpu=Cortex-M0 --apcs=interwork -I..\..\..\..\Library\CMSIS\Include -I..\..\..\..\Library\Device\Nuvoton\NM1120\Include -I..\..\..\..\Library\StdDriver\inc -I.\source -IC:\Keil_v5\ARM\RV31\INC -IC:\Keil_v5\ARM\PACK\ARM\CMSIS\3.20.4\CMSIS\Include -D__MICROLIB --omf_browse=.\obj\retarget.crf ..\..\..\..\Library\StdDriver\src\retarget.c]
                          THUMB

                          AREA ||i.GetChar||, CODE, READONLY, ALIGN=2

                  GetChar PROC
;;;312     */
;;;313    char GetChar(void)
000000  4805              LDR      r0,|L1.24|
                  |L1.2|
;;;314    {
;;;315    #ifdef DEBUG_ENABLE_SEMIHOST
;;;316    # if defined ( __CC_ARM   )
;;;317        int nRet;
;;;318        while(SH_DoCommand(0x101, 0, &nRet) != 0) {
;;;319            if(nRet != 0) {
;;;320                SH_DoCommand(0x07, 0, &nRet);
;;;321                return (char)nRet;
;;;322            }
;;;323        }
;;;324    # else
;;;325        int nRet;
;;;326        while(SH_DoCommand(0x7, 0, &nRet) != 0) {
;;;327            if(nRet != 0)
;;;328                return (char)nRet;
;;;329        }
;;;330    # endif
;;;331        return (0);
;;;332    #else
;;;333    
;;;334        while (1) {
;;;335            if(DEBUG_PORT->PROTSTS & USCI_PROTSTS_RXENDIF_Msk)  {
000002  6a41              LDR      r1,[r0,#0x24]
000004  06c9              LSLS     r1,r1,#27
000006  d5fc              BPL      |L1.2|
;;;336    					  DEBUG_PORT->PROTSTS = (USCI_PROTSTS_RXENDIF_Msk | USCI_PROTSTS_RXSTIF_Msk);
000008  2118              MOVS     r1,#0x18
00000a  6241              STR      r1,[r0,#0x24]
;;;337                return (DEBUG_PORT->RXDAT);
00000c  4802              LDR      r0,|L1.24|
00000e  3840              SUBS     r0,r0,#0x40
000010  6b40              LDR      r0,[r0,#0x34]
000012  b2c0              UXTB     r0,r0
;;;338            }
;;;339        }
;;;340    
;;;341    #endif
;;;342    }
000014  4770              BX       lr
;;;343    
                          ENDP

000016  0000              DCW      0x0000
                  |L1.24|
                          DCD      0x40070040

                          AREA ||i.IsDebugFifoEmpty||, CODE, READONLY, ALIGN=2

                  IsDebugFifoEmpty PROC
;;;372    
;;;373    int IsDebugFifoEmpty(void)
000000  4802              LDR      r0,|L2.12|
;;;374    {
;;;375        return ((DEBUG_PORT->PROTSTS & USCI_PROTSTS_TXSTIF_Msk) == 0);
000002  6a40              LDR      r0,[r0,#0x24]
000004  0780              LSLS     r0,r0,#30
000006  17c0              ASRS     r0,r0,#31
000008  1c40              ADDS     r0,r0,#1
;;;376    
;;;377    }
00000a  4770              BX       lr
;;;378    
                          ENDP

                  |L2.12|
                          DCD      0x40070040

                          AREA ||i.SendChar||, CODE, READONLY, ALIGN=1

                  SendChar PROC
;;;280     */
;;;281    void SendChar(int ch)
000000  b500              PUSH     {lr}
;;;282    {
;;;283    #if defined(DEBUG_ENABLE_SEMIHOST)
;;;284        g_buf[g_buf_len++] = ch;
;;;285        g_buf[g_buf_len] = '\0';
;;;286        if(g_buf_len + 1 >= sizeof(g_buf) || ch == '\n' || ch == '\0') {
;;;287            /* Send the char */
;;;288            if(SH_DoCommand(0x04, (int)g_buf, NULL) != 0) {
;;;289                g_buf_len = 0;
;;;290                return;
;;;291            } else {
;;;292                int i;
;;;293    
;;;294                for(i=0; i<g_buf_len; i++)
;;;295                    SendChar_ToUART(g_buf[i]);
;;;296                g_buf_len = 0;
;;;297            }
;;;298        }
;;;299    #else
;;;300        SendChar_ToUART(ch);
000002  f7fffffe          BL       SendChar_ToUART
;;;301    #endif
;;;302    }
000006  bd00              POP      {pc}
;;;303    
                          ENDP


                          AREA ||i.SendChar_ToUART||, CODE, READONLY, ALIGN=2

                  SendChar_ToUART PROC
;;;198    #ifndef NONBLOCK_PRINTF
;;;199    void SendChar_ToUART(int ch)
000000  4b0b              LDR      r3,|L4.48|
;;;200    {
;;;201    
;;;202        //while(((DEBUG_PORT->PROTSTS & USCI_PROTSTS_TXSTIF_Msk) == 1) && ((DEBUG_PORT->PROTSTS & USCI_PROTSTS_TXENDIF_Msk) == 0));
;;;203    		//DEBUG_PORT->PROTSTS = (USCI_PROTSTS_TXSTIF_Msk | USCI_PROTSTS_TXENDIF_Msk);
;;;204    	
;;;205        DEBUG_PORT->TXDAT = ch;
000002  6318              STR      r0,[r3,#0x30]
;;;206        if(ch == '\n') {
;;;207            while(((DEBUG_PORT->PROTSTS & USCI_PROTSTS_TXSTIF_Msk) == 0) || ((DEBUG_PORT->PROTSTS & USCI_PROTSTS_TXENDIF_Msk) == 0));
000004  490a              LDR      r1,|L4.48|
;;;208    				
;;;209    				DEBUG_PORT->PROTSTS = (USCI_PROTSTS_TXSTIF_Msk | USCI_PROTSTS_TXENDIF_Msk);
000006  2206              MOVS     r2,#6
000008  3140              ADDS     r1,r1,#0x40           ;207
00000a  280a              CMP      r0,#0xa               ;206
00000c  d108              BNE      |L4.32|
                  |L4.14|
00000e  6a48              LDR      r0,[r1,#0x24]         ;207
000010  0780              LSLS     r0,r0,#30             ;207
000012  d5fc              BPL      |L4.14|
000014  6a48              LDR      r0,[r1,#0x24]         ;207
000016  0740              LSLS     r0,r0,#29             ;207
000018  d5f9              BPL      |L4.14|
00001a  624a              STR      r2,[r1,#0x24]
;;;210    			
;;;211            DEBUG_PORT->TXDAT = '\r';
00001c  200d              MOVS     r0,#0xd
00001e  6318              STR      r0,[r3,#0x30]
                  |L4.32|
;;;212        }
;;;213    		
;;;214        while(((DEBUG_PORT->PROTSTS & USCI_PROTSTS_TXSTIF_Msk) == 0) || ((DEBUG_PORT->PROTSTS & USCI_PROTSTS_TXENDIF_Msk) == 0));
000020  6a48              LDR      r0,[r1,#0x24]
000022  0780              LSLS     r0,r0,#30
000024  d5fc              BPL      |L4.32|
000026  6a48              LDR      r0,[r1,#0x24]
000028  0740              LSLS     r0,r0,#29
00002a  d5f9              BPL      |L4.32|
;;;215    		DEBUG_PORT->PROTSTS = (USCI_PROTSTS_TXSTIF_Msk | USCI_PROTSTS_TXENDIF_Msk);
00002c  624a              STR      r2,[r1,#0x24]
;;;216    }
00002e  4770              BX       lr
;;;217    #else
                          ENDP

                  |L4.48|
                          DCD      0x40070000

                          AREA ||i._ttywrch||, CODE, READONLY, ALIGN=1

                  _ttywrch PROC
;;;388    
;;;389    void _ttywrch(int ch)
000000  b500              PUSH     {lr}
000002  f7fffffe          BL       SendChar_ToUART
;;;390    {
;;;391        SendChar(ch);
;;;392        return;
;;;393    }
000006  bd00              POP      {pc}
;;;394    
                          ENDP


                          AREA ||i.ferror||, CODE, READONLY, ALIGN=1

                  ferror PROC
;;;451    
;;;452    int ferror(FILE *stream)
000000  2000              MOVS     r0,#0
;;;453    {
;;;454        return EOF;
000002  43c0              MVNS     r0,r0
;;;455    }
000004  4770              BX       lr
;;;456    
                          ENDP


                          AREA ||i.fgetc||, CODE, READONLY, ALIGN=1

                  fgetc PROC
;;;431    
;;;432    int fgetc(FILE *stream)
000000  b500              PUSH     {lr}
;;;433    {
;;;434        return (GetChar());
000002  f7fffffe          BL       GetChar
;;;435    }
000006  bd00              POP      {pc}
;;;436    
                          ENDP


                          AREA ||i.fputc||, CODE, READONLY, ALIGN=1

                  fputc PROC
;;;413    
;;;414    int fputc(int ch, FILE *stream)
000000  b510              PUSH     {r4,lr}
;;;415    {
000002  4604              MOV      r4,r0
000004  f7fffffe          BL       SendChar_ToUART
;;;416        SendChar(ch);
;;;417        return ch;
000008  4620              MOV      r0,r4
;;;418    }
00000a  bd10              POP      {r4,pc}
;;;419    
                          ENDP


                          AREA ||i.kbhit||, CODE, READONLY, ALIGN=2

                  kbhit PROC
;;;354    
;;;355    int kbhit(void)
000000  4802              LDR      r0,|L9.12|
;;;356    {
;;;357    
;;;358        return !((DEBUG_PORT->PROTSTS & USCI_PROTSTS_TXENDIF_Msk) == 0);
000002  6a40              LDR      r0,[r0,#0x24]
000004  0740              LSLS     r0,r0,#29
000006  0fc0              LSRS     r0,r0,#31
;;;359    
;;;360    	
;;;361    }
000008  4770              BX       lr
;;;362    /**
                          ENDP

00000a  0000              DCW      0x0000
                  |L9.12|
                          DCD      0x40070040

                          AREA ||.data||, DATA, ALIGN=2

                  __stdout
                          DCD      0x00000000

                          AREA ||area_number.13||, DATA, ALIGN=2

                          EXPORTAS ||area_number.13||, ||.data||
                  __stdin
                          DCD      0x00000000

;*** Start embedded assembler ***

#line 1 "..\\..\\..\\..\\Library\\StdDriver\\src\\retarget.c"
	AREA ||.rev16_text||, CODE
	THUMB
	EXPORT |__asm___10_retarget_c_871f546e____REV16|
#line 118 "..\\..\\..\\..\\Library\\CMSIS\\Include\\core_cmInstr.h"
|__asm___10_retarget_c_871f546e____REV16| PROC
#line 119

 rev16 r0, r0
 bx lr
	ENDP
	AREA ||.revsh_text||, CODE
	THUMB
	EXPORT |__asm___10_retarget_c_871f546e____REVSH|
#line 132
|__asm___10_retarget_c_871f546e____REVSH| PROC
#line 133

 revsh r0, r0
 bx lr
	ENDP

;*** End   embedded assembler ***
