new copyright; att/bsd/shared
[unix-history] / usr / src / usr.bin / pascal / pdx / machine / printdata.c
CommitLineData
505bf312
KB
1/*-
2 * Copyright (c) 1980 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * %sccs.include.redist.c%
e7d8eb31 6 */
56e1c09b 7
e7d8eb31 8#ifndef lint
505bf312
KB
9static char sccsid[] = "@(#)printdata.c 5.3 (Berkeley) %G%";
10#endif /* not lint */
11
56e1c09b
ML
12/*
13 * print contents of data addresses in octal
14 *
15 * There are two entries: one is given a range of addresses,
16 * the other is given a count and a starting address.
17 */
18
19#include "defs.h"
20#include "machine.h"
21#include "process.h"
22#include "object.h"
82d3cd01
KM
23#include "process/process.rep"
24#include "process/pxinfo.h"
56e1c09b
ML
25
26#define WORDSPERLINE 4
27
28/*
29 * print words from lowaddr to highaddr
30 */
31
32printdata(lowaddr, highaddr)
33ADDRESS lowaddr;
34ADDRESS highaddr;
35{
36 register int count;
37 register ADDRESS addr;
38 int val;
39
40 if (lowaddr > highaddr) {
41 error("first address larger than second");
42 }
43 count = 0;
44 for (addr = lowaddr; addr <= highaddr; addr += sizeof(int)) {
45 if (count == 0) {
46 printf("%8x: ", addr);
47 }
48 dread(&val, addr, sizeof(val));
49 printf(" %8x", val);
50 if (++count >= WORDSPERLINE) {
51 putchar('\n');
52 count = 0;
53 }
54 }
55 if (count != 0) {
56 putchar('\n');
57 }
58}