📄 consol.lst
字号:
404 02a8 0400A0E1 mov r0, r4 250:consol.c **** }
405 .loc 1 250 0 406 02ac 1040BDE8 ldmfd sp!, {r4, lr} 407 .loc 1 249 0 408 02b0 FEFFFFEA b consolSendChar 409 .LFE6: 410 .size consolSendCh, .-consolSendCh 411 .align 2 412 .global consolSendString 413 .type consolSendString, %function 414 consolSendString: 415 .LFB7: 251:consol.c ****
252:consol.c **** /*****************************************************************************
253:consol.c **** *
254:consol.c **** * Description:
255:consol.c **** * Print string to consol.
256:consol.c **** *
257:consol.c **** * Params:
258:consol.c **** * [in] pString - Pointer to string to be printed
259:consol.c **** *
260:consol.c **** ****************************************************************************/
261:consol.c **** void
ARM GAS /cygdrive/c/DOCUME~1/HOWARD~1/LOCALS~1/Temp/ccwlrNcM.s page 13 262:consol.c **** consolSendString(char *pString)
263:consol.c **** {
416 .loc 1 263 0 417 @ Function supports interworking. 418 @ args = 0, pretend = 0, frame = 0 419 @ frame_needed = 0, uses_anonymous_args = 0 420 .LVL61: 421 02b4 10402DE9 stmfd sp!, {r4, lr} 422 .LCFI4: 423 .loc 1 263 0 424 02b8 0040A0E1 mov r4, r0 425 02bc AF0000EA b .L77 426 .LVL62: 427 .L78: 264:consol.c **** while(*pString)
265:consol.c **** consolSendCh(*pString++);
428 .loc 1 265 0 429 02c0 FEFFFFEB bl consolSendCh 430 .LVL63: 431 .L77: 432 .loc 1 264 0 433 02c4 0030D4E5 ldrb r3, [r4, #0] @ zero_extendqisi2 434 02c8 000053E3 cmp r3, #0 435 .loc 1 265 0 436 02cc 0300A0E1 mov r0, r3 437 02d0 014084E2 add r4, r4, #1 438 .loc 1 264 0 439 02d4 AE00001A bne .L78 266:consol.c **** }
440 .loc 1 266 0 441 02d8 1040BDE8 ldmfd sp!, {r4, lr} 442 02dc 1EFF2FE1 bx lr 443 .LFE7: 444 .size consolSendString, .-consolSendString 445 .data 446 .align 2 447 .type hexChars.1869, %object 448 .size hexChars.1869, 16 449 hexChars.1869: 450 0000 30313233 .ascii "0123456789ABCDEF" 450 34353637 450 38394142 450 43444546 451 .text 452 .align 2 453 .global consolSendNumber 454 .type consolSendNumber, %function 455 consolSendNumber: 456 .LFB8: 267:consol.c ****
268:consol.c **** /*****************************************************************************
269:consol.c **** *
270:consol.c **** * Description:
271:consol.c **** * Routine for printing integer numbers in various formats. The number is
272:consol.c **** * printed in the specified 'base' using exactly 'noDigits', using +/- if
273:consol.c **** * signed flag 'sign' is TRUE, and using the character specified in 'pad'
274:consol.c **** * to pad extra characters.
ARM GAS /cygdrive/c/DOCUME~1/HOWARD~1/LOCALS~1/Temp/ccwlrNcM.s page 14 275:consol.c **** *
276:consol.c **** * Params:
277:consol.c **** * [in] base - Base to print number in (2-16)
278:consol.c **** * [in] noDigits - Number of digits to print (max 32)
279:consol.c **** * [in] sign - Flag if sign is to be used (TRUE), or not (FALSE)
280:consol.c **** * [in] pad - Character to pad any unused positions
281:consol.c **** * [in] number - Signed number to print
282:consol.c **** *
283:consol.c **** ****************************************************************************/
284:consol.c **** void
285:consol.c **** consolSendNumber(unsigned char base,
286:consol.c **** unsigned char noDigits,
287:consol.c **** unsigned char sign,
288:consol.c **** char pad,
289:consol.c **** int number)
290:consol.c **** {
457 .loc 1 290 0 458 @ Function supports interworking. 459 @ args = 4, pretend = 0, frame = 36 460 @ frame_needed = 0, uses_anonymous_args = 0 461 .LVL64: 462 02e0 F04F2DE9 stmfd sp!, {r4, r5, r6, r7, r8, r9, sl, fp, lr} 463 .LCFI5: 464 02e4 24D04DE2 sub sp, sp, #36 465 .LCFI6: 466 .LVL65: 467 .loc 1 290 0 468 02e8 48809DE5 ldr r8, [sp, #72] 291:consol.c **** static char hexChars[16] = "0123456789ABCDEF";
292:consol.c **** char *pBuf;
293:consol.c **** char buf[32];
294:consol.c **** unsigned int numberAbs;
295:consol.c **** unsigned char count;
296:consol.c ****
297:consol.c **** // prepare negative number
298:consol.c **** if(sign && (number < 0))
469 .loc 1 298 0 470 02ec FF2012E2 ands r2, r2, #255 471 02f0 0090A003 moveq r9, #0 472 02f4 0190A013 movne r9, #1 473 02f8 A8BFA0E1 mov fp, r8, lsr #31 474 02fc 0B0019E1 tst r9, fp 475 .loc 1 290 0 476 0300 FF1001E2 and r1, r1, #255 299:consol.c **** numberAbs = -number;
477 .loc 1 299 0 478 0304 00406812 rsbne r4, r8, #0 479 .LVL66: 300:consol.c **** else
301:consol.c **** numberAbs = number;
480 .loc 1 301 0 481 0308 0840A001 moveq r4, r8 482 .loc 1 290 0 483 030c FF7000E2 and r7, r0, #255 484 0310 FF3003E2 and r3, r3, #255 485 .LVL67: 302:consol.c ****
ARM GAS /cygdrive/c/DOCUME~1/HOWARD~1/LOCALS~1/Temp/ccwlrNcM.s page 15 303:consol.c **** // setup little string buffer
304:consol.c **** count = (noDigits - 1) - (sign ? 1 : 0);
486 .loc 1 304 0 487 0314 000052E3 cmp r2, #0 488 0318 0120A001 moveq r2, r1 489 031c 01204112 subne r2, r1, #1 490 .LVL68: 491 0320 012042E2 sub r2, r2, #1 492 .loc 1 290 0 493 0324 00308DE5 str r3, [sp, #0] 494 .LVL69: 305:consol.c **** pBuf = buf + sizeof(buf);
306:consol.c **** *--pBuf = '\0';
307:consol.c ****
308:consol.c **** // force calculation of first digit
309:consol.c **** // (to prevent zero from not printing at all!!!)
310:consol.c **** *--pBuf = hexChars[(numberAbs % base)];
495 .loc 1 310 0 496 0328 0710A0E1 mov r1, r7 497 .LVL70: 498 .loc 1 306 0 499 032c 0030A0E3 mov r3, #0 500 .loc 1 310 0 501 0330 0400A0E1 mov r0, r4 502 .LVL71: 503 .loc 1 304 0 504 0334 FFA002E2 and sl, r2, #255 505 .LVL72: 506 .loc 1 306 0 507 0338 2330CDE5 strb r3, [sp, #35] 508 .loc 1 310 0 509 033c FEFFFFEB bl __umodsi3 510 0340 BC309FE5 ldr r3, .L104 511 0344 0030D3E7 ldrb r3, [r3, r0] @ zero_extendqisi2 311:consol.c **** numberAbs /= base;
512 .loc 1 311 0 513 0348 0710A0E1 mov r1, r7 514 034c 0400A0E1 mov r0, r4 515 .loc 1 310 0 516 0350 2230CDE5 strb r3, [sp, #34] 517 .loc 1 311 0 518 0354 FEFFFFEB bl __udivsi3 519 0358 0A60A0E1 mov r6, sl 520 .LVL73: 521 035c 0050A0E1 mov r5, r0 522 .LVL74: 523 0360 22408DE2 add r4, sp, #34 524 .LVL75: 525 0364 E70000EA b .L103 526 .LVL76: 527 .L86: 528 0368 013044E2 sub r3, r4, #1 312:consol.c ****
313:consol.c **** // calculate remaining digits
314:consol.c **** while(count--)
315:consol.c **** {
316:consol.c **** if(numberAbs != 0)
ARM GAS /cygdrive/c/DOCUME~1/HOWARD~1/LOCALS~1/Temp/ccwlrNcM.s page 16 529 .loc 1 316 0 530 036c 000055E3 cmp r5, #0 317:consol.c **** {
318:consol.c **** //calculate next digit
319:consol.c **** *--pBuf = hexChars[(numberAbs % base)];
531 .loc 1 319 0 532 0370 0340A0E1 mov r4, r3 320:consol.c **** numberAbs /= base;
321:consol.c **** }
322:consol.c **** else
323:consol.c **** // no more digits left, pad out to desired length
324:consol.c **** *--pBuf = pad;
533 .loc 1 324 0 534 0374 0340A001 moveq r4, r3 535 0378 00309D05 ldreq r3, [sp, #0] 536 037c 0030C405 streqb r3, [r4, #0] 537 .loc 1 316 0 538 0380 E700000A beq .L103 539 .LVL77: 540 .loc 1 319 0 541 0384 FEFFFFEB bl __umodsi3 542 0388 74309FE5 ldr r3, .L104 543 038c 0030D3E7 ldrb r3, [r3, r0] @ zero_extendqisi2 544 .loc 1 320 0 545 0390 0710A0E1 mov r1, r7 546 0394 0500A0E1 mov r0, r5 547 .loc 1 319 0 548 0398 0030C4E5 strb r3, [r4, #0] 549 .loc 1 320 0 550 039c FEFFFFEB bl __udivsi3 551 03a0 0050A0E1 mov r5, r0 552 .LVL78: 553 .L103: 554 .loc 1 314 0 555 03a4 013046E2 sub r3, r6, #1 556 03a8 FF6003E2 and r6, r3, #255 557 03ac FF0056E3 cmp r6, #255 558 .loc 1 319 0 559 03b0 0500A0E1 mov r0, r5 560 03b4 0710A0E1 mov r1, r7 561 .loc 1 314 0 562 03b8 D800001A bne .L86 563 .LVL79: 325:consol.c **** }
326:consol.c ****
327:consol.c **** // apply signed notation if requested
328:consol.c **** if(sign)
564 .loc 1 328 0 565 03bc 000059E3 cmp r9, #0 566 03c0 FA00000A beq .L90 329:consol.c **** {
330:consol.c **** if(number < 0)
567 .loc 1 330 0 568 03c4 00005BE3 cmp fp, #0 331:consol.c **** *--pBuf = '-';
569 .loc 1 331 0 570 03c8 2D30A013 movne r3, #45ARM GAS /cygdrive/c/DOCUME~1/HOWARD~1/LOCALS~1/Temp/ccwlrNcM.s page 17 571 03cc 01306415 strneb r3, [r4, #-1]! 572 .loc 1 330 0 573 03d0 FA00001A bne .L90 574 03d4 013044E2 sub r3, r4, #1 332:consol.c **** else if(number > 0)
575 .loc 1 332 0 576 03d8 000058E3 cmp r8, #0 333:consol.c **** *--pBuf = '+';
577 .loc 1 333 0 578 03dc 0340A0C1 movgt r4, r3 334:consol.c **** else
335:consol.c **** *--pBuf = ' ';
579 .loc 1 335 0 580 03e0 0340A0D1 movle r4, r3 581 .loc 1 333 0 582 03e4 2B30A0C3 movgt r3, #43 583 .loc 1 335 0 584 03e8 2030A0D3 movle r3, #32 585 03ec 0030C4E5 strb r3, [r4, #0] 586 .L90: 336:consol.c **** }
337:consol.c ****
338:consol.c **** // print the string right-justified
339:consol.c **** consolSendString(pBuf);
587 .loc 1 339 0 588 03f0 0400A0E1 mov r0, r4 589 .LVL80: 590 03f4 FEFFFFEB bl consolSendString 340:consol.c **** }
591 .loc 1 340 0 592 03f8 24D08DE2 add sp, sp, #36 593 03fc F04FBDE8 ldmfd sp!, {r4, r5, r6, r7, r8, r9, sl, fp, lr} 594 0400 1EFF2FE1 bx lr 595 .L105: 596 .align 2 597 .L104: 598 0404 00000000 .word hexChars.1869 599 .LFE8: 600 .size consolSendNumber, .-consolSendNumber 601 .align 2 602 .global simplePrintf 603 .type simplePrintf, %function 604 simplePrintf: 605 .LFB9: 341:consol.c ****
342:consol.c **** #if (CONSOLE_API_PRINTF == 1) //OWN_PRINTF
343:consol.c **** /*****************************************************************************
344:consol.c **** *
345:consol.c **** * Description:
346:consol.c **** * Simple implementation of printf
347:consol.c **** *
348:consol.c **** * Params:
349:consol.c **** * [in] fmt - Format string that specifies what to be printed
350:consol.c **** * [in] ... - Variable number of parameters to match format string
351:consol.c **** *
352:consol.c **** ****************************************************************************/
353:consol.c **** void
ARM GAS /cygdrive/c/DOCUME~1/HOWARD~1/LOCALS~1/Temp/ccwlrNcM.s page 18 354:consol.c **** simplePrintf(const char * fmt,
355:consol.c **** ... )
356:consol.c **** {
606 .loc 1 356 0 607 @ Function supports interworking. 608 @ args = 4, pretend = 16, frame = 4 609 @ frame_needed = 0, uses_anonymous_args = 1 610 .LVL81: 611 0408 0F002DE9 stmfd sp!, {r0, r1, r2, r3} 612 .LCFI7: 613 040c 04E02DE5 str lr, [sp, #-4]! 614 .LCFI8: 615 0410 04D04DE2 sub sp, sp, #4 616 .LCFI9: 617 .LVL82: 357:consol.c **** va_list ap;
358:consol.c ****
359:consol.c **** va_start(ap, fmt);
618 .loc 1 359 0 619 0414 0C308DE2 add r3, sp, #12 360:consol.c **** simplePrint(consolSendCh, fmt, ap);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -