/* Copyright (c) 1982 Regents of the University of California */
static char sccsid
[] = "@(#)printinst.c 1.2 2/10/82";
* decode and print the instructions
LOCAL ADDRESS
printop(), docase();
* print instructions within the given address range
printinst(lowaddr
, highaddr
)
for (addr
= lowaddr
; addr
<= highaddr
; ) {
* print count instructions from given address
for (i
= 0; i
< count
; i
++) {
* print the opcode at the given address, return the address
* of the next instruction
LOCAL ADDRESS
printop(addr
)
struct { char c1
, c2
; } opword
;
iread(&u
.i
, addr
, sizeof(u
.i
));
printf("%5d %s", addr
, o
->opname
);
for (i
= 0; o
->argtype
[i
] != 0; i
++) {
iread(&longarg
, addr
, sizeof(longarg
));
if (i
!= 0 || subop
== 0) {
iread(&arg
, addr
, sizeof(arg
));
iread(&c
, addr
, sizeof(c
));
panic("bad argtype %d", o
->argtype
[i
]);
addr
= docase(addr
, 1, subop
);
addr
= docase(addr
, 2, subop
);
addr
= docase(addr
, 4, subop
);
* print out the destinations and cases
LOCAL ADDRESS
docase(addr
, size
, n
)
iread(&arg
, addr
, sizeof(arg
));
for (i
= 1; i
< n
; i
++) {
iread(&arg
, addr
, sizeof(arg
));
for (i
= 0; i
< n
; i
++) {
iread(&c
, addr
, sizeof(c
));
iread(&arg
, addr
, sizeof(arg
));
iread(&longarg
, addr
, sizeof(longarg
));