www.pudn.com > LPC1768_SD_Test.rar > getline.txt, change:2010-03-29,size:6348b


; generated by ARM C/C++ Compiler with , RVCT4.0 [Build 524] for uVision 
; commandline ArmCC [--debug -c --asm --interleave -o.\Obj\getline.o --depend=.\Obj\getline.d --device=DARMP1 --apcs=interwork -O0 -IC:\Keil\ARM\INC\NXP --omf_browse=.\Obj\getline.crf Getline.c] 
                          THUMB 
 
                          AREA ||.text||, CODE, READONLY, ALIGN=2 
 
                  getline PROC 
;;;18      *---------------------------------------------------------------------------*/ 
;;;19     BOOL getline (char *lp, U32 n) { 
000000  e92d41f0          PUSH     {r4-r8,lr} 
000004  4604              MOV      r4,r0 
000006  460e              MOV      r6,r1 
;;;20        U32 cnt = 0; 
000008  2700              MOVS     r7,#0 
;;;21        char c; 
;;;22      
;;;23        do { 
00000a  bf00              NOP       
                  |L1.12| 
;;;24           c = getkey (); 
00000c  f7fffffe          BL       getkey 
000010  b2c5              UXTB     r5,r0 
;;;25           switch (c) { 
000012  2d13              CMP      r5,#0x13 
000014  d00d              BEQ      |L1.50| 
000016  dc06              BGT      |L1.38| 
000018  2d08              CMP      r5,#8 
00001a  d00b              BEQ      |L1.52| 
00001c  2d0d              CMP      r5,#0xd 
00001e  d022              BEQ      |L1.102| 
000020  2d11              CMP      r5,#0x11 
000022  d125              BNE      |L1.112| 
000024  e004              B        |L1.48| 
                  |L1.38| 
000026  2d1b              CMP      r5,#0x1b 
000028  d019              BEQ      |L1.94| 
00002a  2d7f              CMP      r5,#0x7f 
00002c  d120              BNE      |L1.112| 
00002e  e002              B        |L1.54| 
                  |L1.48| 
;;;26              case CNTLQ:                       /* ignore Control S/Q             */ 
;;;27              case CNTLS: 
000030  bf00              NOP       
                  |L1.50| 
;;;28                 break;; 
000032  e028              B        |L1.134| 
                  |L1.52| 
;;;29              case BACKSPACE: 
;;;30              case DEL: 
000034  bf00              NOP       
                  |L1.54| 
;;;31                 if (cnt == 0) { 
000036  b907              CBNZ     r7,|L1.58| 
;;;32                    break; 
000038  e025              B        |L1.134| 
                  |L1.58| 
;;;33                 } 
;;;34                 cnt--;                         /* decrement count                */ 
00003a  1e7f              SUBS     r7,r7,#1 
;;;35                 lp--;                          /* and line pointer               */ 
00003c  1e64              SUBS     r4,r4,#1 
;;;36                 putchar (0x08);                /* echo backspace                 */ 
00003e  4917              LDR      r1,|L1.156| 
000040  2008              MOVS     r0,#8 
000042  f7fffffe          BL       putc 
;;;37                 putchar (' '); 
000046  4915              LDR      r1,|L1.156| 
000048  2020              MOVS     r0,#0x20 
00004a  f7fffffe          BL       putc 
;;;38                 putchar (0x08); 
00004e  4913              LDR      r1,|L1.156| 
000050  2008              MOVS     r0,#8 
000052  f7fffffe          BL       putc 
;;;39                 fflush (stdout); 
000056  4811              LDR      r0,|L1.156| 
000058  f7fffffe          BL       fflush 
;;;40                 break; 
00005c  e013              B        |L1.134| 
                  |L1.94| 
;;;41              case ESC: 
;;;42                 *lp = 0;                       /* ESC - stop editing line        */ 
00005e  2000              MOVS     r0,#0 
000060  7020              STRB     r0,[r4,#0] 
                  |L1.98| 
;;;43                 return (__FALSE); 
;;;44              case CR:                          /* CR - done, stop editing line   */ 
;;;45                 *lp = c; 
;;;46                 lp++;                          /* increment line pointer         */ 
;;;47                 cnt++;                         /* and count                      */ 
;;;48                 c = LF; 
;;;49              default: 
;;;50                 putchar (*lp = c);             /* echo and store character       */ 
;;;51                 fflush (stdout); 
;;;52                 lp++;                          /* increment line pointer         */ 
;;;53                 cnt++;                         /* and count                      */ 
;;;54                 break; 
;;;55           } 
;;;56        } while (cnt < n - 2  &&  c != LF);     /* check limit and CR             */ 
;;;57        *lp = 0;                                /* mark end of string             */ 
;;;58        return (__TRUE); 
;;;59     } 
000062  e8bd81f0          POP      {r4-r8,pc} 
                  |L1.102| 
000066  7025              STRB     r5,[r4,#0]            ;45 
000068  1c64              ADDS     r4,r4,#1              ;46 
00006a  1c7f              ADDS     r7,r7,#1              ;47 
00006c  250a              MOVS     r5,#0xa               ;48 
00006e  bf00              NOP                            ;49 
                  |L1.112| 
000070  7025              STRB     r5,[r4,#0]            ;50 
000072  4628              MOV      r0,r5                 ;50 
000074  4909              LDR      r1,|L1.156| 
000076  f7fffffe          BL       putc 
00007a  4808              LDR      r0,|L1.156| 
00007c  f7fffffe          BL       fflush 
000080  1c64              ADDS     r4,r4,#1              ;52 
000082  1c7f              ADDS     r7,r7,#1              ;53 
000084  bf00              NOP                            ;54 
                  |L1.134| 
000086  bf00              NOP                            ;28 
000088  1eb0              SUBS     r0,r6,#2              ;56 
00008a  42b8              CMP      r0,r7                 ;56 
00008c  d901              BLS      |L1.146| 
00008e  2d0a              CMP      r5,#0xa               ;56 
000090  d1bc              BNE      |L1.12| 
                  |L1.146| 
000092  2000              MOVS     r0,#0                 ;57 
000094  7020              STRB     r0,[r4,#0]            ;57 
000096  2001              MOVS     r0,#1                 ;58 
000098  e7e3              B        |L1.98| 
;;;60      
                          ENDP 
 
00009a  0000              DCW      0x0000 
                  |L1.156| 
                          DCD      __stdout