source: umon/main/glib/printmem.c @ 87db514

Last change on this file since 87db514 was 87db514, checked in by Amar Takhar <amar@…>, on 04/16/15 at 19:26:21

Initial commit of the umon repository.

Prior to this three changes were made:

  • Remove umon_ prefix from parent directories.
  • Collapse main/target/ into main/
  • Remove ports/template/flashtest.scr.ucon script.
  • Property mode set to 100755
File size: 661 bytes
Line 
1#include "config.h"
2#include <ctype.h>
3#include "genlib.h"
4#include "stddefs.h"
5
6/*  printMem():
7 *      Dump a block of memory.
8 */
9void
10printMem(uchar *base, int size, int showascii)
11{
12        int i, col;
13        uchar *cp, *cp1;
14
15        cp = cp1 = base;
16        printf("  ");
17        for(col=1,i=0;i<size;i++,col++) {
18                printf("%02x ",*cp++);
19                if ((col == 8) || (col == 16)) {
20                        printf("  ");
21                        if (col == 16) {
22                                col = 0;
23                                if (showascii)
24                                        prascii(cp1,16);
25                                cp1 += 16;
26                                printf("\n  ");
27                        }
28                }
29        }
30        if ((showascii) && (col > 1)) {
31                int     space;
32
33                space = (3 * (17 - col)) + (col <= 8 ? 4 : 2);
34                while(space--)
35                        putchar(' ');
36                prascii(cp1,col-1);
37        }
38        printf("\n");
39        return;
40}
Note: See TracBrowser for help on using the repository browser.